var Sundance,ContactUrlFormatter,SearchPageUrlGenerator,PhoneNumberFormatter,CloudinaryHelpers,DateHelpers,AdditionalValidationRules,FizzFormControls,ModelHelpers,CloudinaryUpload,SundanceImageCreditDialogue,Alpinist,SundanceCreditDialogue,__assign,__extends,SundanceCredit;(function(n){var t;(function(n){var t;(function(n){var t;(function(n){var t;(function(n){var t;(function(n){n.CONTACTS_CATEGORY="Category";n.CONTACTS_BOOKS_STATUS="Books status";n.MEMBERSHIP_DISCOUNT="Spotlight member discounts"})(t=n.IJsonListingDto||(n.IJsonListingDto={}))})(t=n.Listing||(n.Listing={}))})(t=n.Features||(n.Features={}))})(t=n.Contacts||(n.Contacts={}))})(t=n.Websites||(n.Websites={}))})(Sundance||(Sundance={})),function(n){var t;(function(n){var t;(function(n){var t;(function(n){var t;(function(n){var t;(function(n){var t,i;(function(n){n.LABEL_MAX_LENGTH=100;n.LABEL_SEPARATOR_FUDGE="－"})(t=n.IJsonContactGrouping||(n.IJsonContactGrouping={})),function(n){n.CATEGORY_SEPARATOR=" > "}(i=n.IJsonFacetValue||(n.IJsonFacetValue={}))})(t=n.JsonModels||(n.JsonModels={}))})(t=n.Listing||(n.Listing={}))})(t=n.Features||(n.Features={}))})(t=n.Contacts||(n.Contacts={}))})(t=n.Websites||(n.Websites={}))}(Sundance||(Sundance={})),function(n){function i(t){return"https://www.google.com/maps?q="+encodeURIComponent(n.getAddressOneLine(t)+", "+t.CountryIsoCode)}function r(n){for(var i,u=[n.AddressLine1,n.AddressLine2,n.AddressLine3,n.AddressLine4,n.PostCode],t="",r=0;r<u.length;r++)i=u[r],i!=null&&i.length>0&&(t.length>0&&(t+=", "),t+=i);return t}function u(n,t){var r,i;n=n==null?"":n;switch(t){case 3:return"#";case 11:return n==""?"":(n=HttpUtilities.stripDomainAndProtocol(n),r=n.includes("/")||n.startsWith("+")?"https://plus.google.com/":"https://plus.google.com/+",r+n);case 4:return n==""?"":"https://www.instagram.com/"+HttpUtilities.stripDomainAndProtocol(n);case 5:return n==""?"":"https://twitter.com/"+HttpUtilities.stripDomainAndProtocol(n);case 10:return n==""?"":"https://www.facebook.com/"+HttpUtilities.stripDomainAndProtocol(n);case 1:case 2:case 0:case 6:return"tel:"+n;case 7:default:return(i=n.toLowerCase(),i.startsWith("http://")||i.startsWith("https://"))?n:"http://"+n}}function f(t,i){t=t==null?"":t;switch(i){case 3:return{__html:_.escape(t).split("").join('<span style="display:none">'+n.OBFUSCATED_JUNK+"<\/span>")};case 11:return{__html:_.escape(t)};case 4:return{__html:_.escape(t)};case 1:case 2:case 0:case 6:return{__html:_.escape(PhoneNumberFormatter.formatPhoneNumber(t))};case 5:return{__html:_.escape(t)};case 10:case 7:default:return{__html:_.escape(t)}}}function t(n,t,i){var r=$(n),u,f;r[0].tagName.toLowerCase()!="a"&&(r=r.closest("a"));u=!i||_.isEmpty(i)?r:r.find(i);f=u.text();r.attr("href","mailto:"+f.replace(new RegExp(t,"g"),""))}function e(i,r,u){return r==3?{onFocus:function(i){t(i.target,n.OBFUSCATED_JUNK,u)},onMouseDown:function(i){t(i.target,n.OBFUSCATED_JUNK,u)}}:{}}n.getAddressUrl=i;n.getAddressOneLine=r;n.getUrl=u;n.OBFUSCATED_JUNK="qdfbv4";n.getHtml=f;n.unobscureEmailLink=t;n.getAnchorProperties=e}(ContactUrlFormatter||(ContactUrlFormatter={})),function(n){function t(n,t){for(var f,u={},r=0;r<t.length;r++)u[t[r].facetName]=u[t[r].facetName]||[],u[t[r].facetName].push(t[r].facetValues.join("\\"));return f=i(n),HttpUtilities.buildUrl({path:f,queryString:u,urlStyle:"onlyPathQueryHash"})}function i(n){switch(n){case 0:throw"You must specify a website to build the search url";case 1:return"/contacts/listing/search";case 2:return"/stunts/profile/search"}}n.getSearchUrl=t}(SearchPageUrlGenerator||(SearchPageUrlGenerator={})),function(n){function i(n){try{var t=(n||"").trim().replace(/\s/g,"");return(t.startsWith("00")&&(t="+"+t.substring(2)),t.startsWith("+44")&&(t="0"+t.substring(3)),t=t.replace(/^\((0[0-9]+)\)/,"$1"),/^[^0-9+]/.test(t))?n:(t=r(t),t=f(t),t=u(t),t.startsWith("00 "))?"+"+t.substring(3):t.startsWith("00")?"+"+t.substring(2):t}catch(i){return n}}function r(n){return n.indexOf("(0)")>=0&&(n=n.replace(/\(0\)/g,"")),n.startsWith("+")&&(n="00"+n.substring(1)),n}function u(n){var r,i=[];if(n.startsWith("00")&&(i.push("00"),n=n.substring(2),_.each(o,function(t){if(n.startsWith(t))return i.push(t),r=t,n=n.substring(t.length),!1})),n.startsWith("07")&&(i.push(n.substring(0,5)),n=n.substring(5)),n.startsWith("08")&&n.length>4&&(i.push(n.substring(0,4)),n=n.substring(4)),_.each(e,function(t){if(n.startsWith(t)){i.push(t);n=n.substring(t.length);switch(n.length){case 8:i.push(n.substring(0,4));i.push(n.substring(4));n="";break;case 7:i.push(n.substring(0,3));i.push(n.substring(3));n=""}return!1}}),n.length>0)if(r!=undefined&&t[r])_.each(t[r],function(t){if(n.length<t)return!1;i.push(n.substring(0,t));n=n.substring(t)});else while(n.length>6)i.push(n.substring(0,3)),n=n.substring(3);return n.length>0&&i.push(n),i.join(" ")}function f(n){return _.each(["00 44","0044","+ 44","+44"],function(t){if(n.startsWith(t))return"0"+n.substring(t.length)}),n}n.formatPhoneNumber=i;var e=["0113","0114","0115","0116","0117","0118","01200","01201","01202","01203","01204","01205","01206","01207","01208","01209","0121","01220","01221","01222","01223","01224","01225","01226","01227","01228","01229","01230","01231","01232","01233","01234","01235","01236","01237","01238","01239","012477","01240","01241","01242","01243","01244","01245","01246","01247","01248","01249","01250","01251","01252","01253","01254","01255","01256","01257","01258","01259","012656","012657","012665","012667","01260","01261","01262","01263","01264","01265","01266","01267","01268","01269","01270","01271","01272","01273","01274","01275","01276","01277","01278","01279","01280","01281","01282","01283","01284","01285","01286","01287","01288","01289","01290","01291","01292","01293","01294","01295","01296","01297","01298","01299","01300","01301","01302","01303","01304","01305","01306","01307","01308","01309","0131","01320","01321","01322","01323","01324","01325","01326","01327","01328","01329","01330","01331","01332","01333","01334","01335","01336","01337","01338","01339","01340","01341","01342","01343","01344","01345","01346","01347","01348","01349","01350","01351","01352","01353","01354","01355","01356","01357","01358","01359","013655","013656","013657","01360","01361","01362","01363","01364","01365","01366","01367","01368","01369","01370","01371","01372","01373","01374","01375","01376","01377","01378","01379","013873","01380","01381","01382","01383","01384","01385","01386","01387","01388","01389","013967","01390","01391","01392","01393","01394","01395","01396","01397","01398","028","024","01399","01400","01401","01402","01403","01404","01405","01406","01407","01408","01409","0141","01410","01411","01420","01421","01422","01423","01424","01425","023","01426","01427","01428","01429","01430","01431","01432","01433","01434","01435","01436","01437","01438","01439","01440","01441","01442","01443","01444","01445","01446","01447","01448","01449","01450","01451","01452","01453","01454","01455","01456","01457","01458","020","01999","01459","01460","01461","01462","01463","01464","01465","01466","01467","01468","01469","01470","01471","01472","01473","01474","01475","01476","01477","01478","01479","01480","01481","01482","01483","01484","01485","01486","01487","01488","01489","01490","01491","01492","01493","01494","01495","01496","01497","01498","01499","015047","01500","01501","01502","01503","01504","01505","01506","01507","01508","01509","0151","015242","01520","01521","01522","01998","01523","01524","01525","01526","01527","01528","01529","015394","015395","015396","01530","01531","01532","01533","01534","01535","01536","01537","01538","01539","01540","01541","01542","01543","01544","01545","01546","01547","01548","01549","01550","01551","01552","01553","01554","01555","01556","01557","01558","01559","01560","01561","01562","01563","01564","01565","01566","01567","01568","01569","01570","01571","01572","01573","01574","01575","01576","01577","01578","01579","01580","01581","01582","01583","01584","01585","01586","01587","01588","01589","01590","01591","01592","01593","01594","01595","01596","01597","01598","01599","01600","01601","01602","01603","01604","01605","01606","01607","01608","01609","0161","01620","01621","01622","01623","01624","01625","01626","01627","01628","01629","01630","01631","01997","01632","01633","01634","01635","01636","01637","01638","01639","016487","01640","01641","01642","01643","01644","01645","01646","01647","01648","01649","01650","01651","01652","01653","01654","01655","01656","01657","01658","01659","016625","016626","016627","01660","01661","01662","01663","01664","01665","01666","01667","01668","01669","01670","01671","01672","01673","01674","01675","01676","01677","01678","01679","01680","01681","01682","01683","01684","01685","01686","01687","01688","01689","016937","016973","016974","016977","01690","01691","01692","01693","01694","01695","01696","01697","01698","01699","01700","01701","01702","01703","01704","01705","01706","01707","01708","01709","0171","01996","01720","01721","01722","01723","01724","01725","01726","01727","01728","01729","01730","01731","01732","01733","01734","01735","01736","01737","01738","01739","01740","01741","01742","01743","01744","01745","01746","01747","01748","01749","01750","01751","01752","01753","01754","01755","01756","01757","01758","01759","017683","017684","017687","01760","01761","01762","01763","01764","01765","01766","01767","01768","01769","01770","01771","01772","01773","01774","01775","01776","01777","01778","01779","01780","01781","01782","01783","01784","01785","01786","01787","01788","01789","01790","01791","01792","01793","01794","01795","01796","01797","01798","01799","01800","01801","01802","01803","01804","01805","01806","01807","01808","01809","01995","018206","01820","01821","01822","01823","01824","01825","01826","01827","01828","01829","01830","01831","01832","01833","01834","01835","01836","01837","01838","01839","01840","01841","01842","01843","01844","01845","01846","01847","01848","01849","01850","01851","01852","01853","01854","01855","01856","01857","01858","01859","01860","01861","01862","01863","01864","01865","01866","01867","01868","01869","01870","01871","01872","01873","01874","01875","01876","01877","01878","01879","01880","01881","01882","01883","01884","01885","01886","01887","01888","01889","01890","01891","01892","01994","01893","01894","01895","01896","01897","01898","01899","01900","01901","01902","01903","01904","01905","01906","01907","01908","01909","0191","01920","01921","01922","01923","01924","01925","01926","01927","01928","01929","01930","01931","01932","01933","01934","01935","01936","01937","01938","01939","019467","01940","01941","01942","01943","01944","01945","01946","01947","01948","01949","01950","01951","01952","01953","01954","01955","01956","01957","01958","01959","01960","01961","01962","01963","01964","01965","01966","01967","01968","01969","01970","01971","01972","01973","01974","01975","01976","01977","01978","01979","01980","01981","01982","01983","01984","01985","01986","01987","01988","01989","01990","01991","01992","01993","029"],o=["1","7","20","27","30","31","32","33","34","36","39","39","40","41","43","44","45","46","47","47","48","49","51","52","53","54","55","56","56","57","58","60","61","62","63","64","65","66","81","82","84","86","90","91","92","93","94","95","98","212","213","216","218","220","221","222","223","224","225","226","227","228","229","230","231","232","233","234","235","236","237","238","239","240","241","242","243","244","245","248","249","249","250","251","252","253","254","255","256","257","258","260","261","262","263","264","265","266","267","268","269","269","290","291","297","298","299","350","351","352","353","354","355","356","357","358","359","370","371","372","373","374","375","376","377","378","380","381","382","385","386","387","389","420","421","423","500","501","502","503","504","505","506","507","508","509","590","591","592","593","594","595","596","597","598","599","618","670","672","673","674","675","676","677","678","679","680","681","682","683","685","686","687","688","689","690","691","692","808","850","852","853","855","856","872","880","886","960","961","962","963","964","965","966","967","968","970","971","972","973","974","975","976","977","992","993","994","995","996","998",],t={"1":[3,3],"353":[1,3],"27":[2,3],"33":[1,2,2,2],"49":[4],"45":[8],"34":[3,3,3],"48":[3,3,3]}}(PhoneNumberFormatter||(PhoneNumberFormatter={})),function(n){function i(n,i,r,e,o,s,h,c,l,a){if(a&&(h==r||s==i))return StringHelpers.format(f,{cloudName:t,imageId:n,cropX:e,cropY:o,cropWidth:s,cropHeight:h,displayWidth:c,displayHeight:l});var v=Math.min(c/s,l/h),y=i*v,p=e+s/2,w=o+h/2,b=p*v,k=w*v;return StringHelpers.format(u,{cloudName:t,imageId:n,resizeWidth:Math.floor(y),cropCenterX:Math.floor(b),cropCenterY:Math.floor(k),displayWidth:Math.floor(c),displayHeight:Math.floor(l)})}function e(n,t,r){return i(n.ExternalId,n.OriginalWidth,n.OriginalHeight,n.CropXOffset,n.CropYOffset,n.CropWidth,n.CropHeight,t,r)}function o(n){return StringHelpers.format(r,{cloudName:t,imageId:n})}var t="spotlightuk",u="https://res.cloudinary.com/{cloudName}/image/upload/pg_1/w_{resizeWidth}/c_thumb,w_{displayWidth},h_{displayHeight},g_xy_center,x_{cropCenterX},y_{cropCenterY}/{imageId}",f="https://res.cloudinary.com/{cloudName}/image/upload/pg_1/c_crop,x_{cropX},y_{cropY},w_{cropWidth},h_{cropHeight}/c_pad,w_{displayWidth},h_{displayHeight},b_white/{imageId}",r;n.generateDisplayUrl=i;n.generateDisplayUrlForImage=e;r="https://res.cloudinary.com/{cloudName}/image/upload/pg_1/c_limit,w_{width}/{imageId}";n.generateTemplatedDisplayUrlForCroppedToWidth=o}(CloudinaryHelpers||(CloudinaryHelpers={})),function(){"use strict";function n(n){function s(s,h){var rt,ut,w=s==window,l=h&&h.message!==undefined?h.message:undefined,nt,k,d,tt,g,p,b,it,ft,et,lt,at,yt;if(h=n.extend({},n.blockUI.defaults,h||{}),!h.ignoreIfBlocked||!n(s).data("blockUI.isBlocked")){if(h.overlayCSS=n.extend({},n.blockUI.defaults.overlayCSS,h.overlayCSS||{}),rt=n.extend({},n.blockUI.defaults.css,h.css||{}),h.onOverlayClick&&(h.overlayCSS.cursor="pointer"),ut=n.extend({},n.blockUI.defaults.themedCSS,h.themedCSS||{}),l=l===undefined?h.message:l,w&&t&&e(window,{fadeOut:0}),l&&typeof l!="string"&&(l.parentNode||l.jquery)&&(nt=l.jquery?l[0]:l,k={},n(s).data("blockUI.history",k),k.el=nt,k.parent=nt.parentNode,k.display=nt.style.display,k.position=nt.style.position,k.parent&&k.parent.removeChild(nt)),n(s).data("blockUI.onUnblock",h.onUnblock),d=h.baseZ,tt=f||h.forceIframe?n('<iframe class="blockUI" style="z-index:'+d+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+h.iframeSrc+'"><\/iframe>'):n('<div class="blockUI" style="display:none"><\/div>'),g=h.theme?n('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+d+++';display:none"><\/div>'):n('<div class="blockUI blockOverlay" style="z-index:'+d+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"><\/div>'),h.theme&&w?(b='<div class="blockUI '+h.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(d+10)+';display:none;position:fixed">',h.title&&(b+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"<\/div>"),b+='<div class="ui-widget-content ui-dialog-content"><\/div>',b+="<\/div>"):h.theme?(b='<div class="blockUI '+h.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(d+10)+';display:none;position:absolute">',h.title&&(b+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(h.title||"&nbsp;")+"<\/div>"),b+='<div class="ui-widget-content ui-dialog-content"><\/div>',b+="<\/div>"):b=w?'<div class="blockUI '+h.blockMsgClass+' blockPage" style="z-index:'+(d+10)+';display:none;position:fixed"><\/div>':'<div class="blockUI '+h.blockMsgClass+' blockElement" style="z-index:'+(d+10)+';display:none;position:absolute"><\/div>',p=n(b),l&&(h.theme?(p.css(ut),p.addClass("ui-widget-content")):p.css(rt)),h.theme||g.css(h.overlayCSS),g.css("position",w?"fixed":"absolute"),(f||h.forceIframe)&&tt.css("opacity",0),it=[tt,g,p],ft=w?n("body"):n(s),n.each(it,function(){this.appendTo(ft)}),h.theme&&h.draggable&&n.fn.draggable&&p.draggable({handle:".ui-dialog-titlebar",cancel:"li"}),et=v&&(!n.support.boxModel||n("object,embed",w?null:s).length>0),o||et){if(w&&h.allowBodyStretch&&n.support.boxModel&&n("html,body").css("height","100%"),(o||!n.support.boxModel)&&!w)var ot=r(s,"borderTopWidth"),st=r(s,"borderLeftWidth"),ht=ot?"(0 - "+ot+")":0,ct=st?"(0 - "+st+")":0;n.each(it,function(n,t){var i=t[0].style,r,u;i.position="absolute";n<2?(w?i.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+h.quirksmodeOffsetHack+') + "px"'):i.setExpression("height",'this.parentNode.offsetHeight + "px"'),w?i.setExpression("width",'jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):i.setExpression("width",'this.parentNode.offsetWidth + "px"'),ct&&i.setExpression("left",ct),ht&&i.setExpression("top",ht)):h.centerY?(w&&i.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),i.marginTop=0):!h.centerY&&w&&(r=h.css&&h.css.top?parseInt(h.css.top,10):0,u="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+r+') + "px"',i.setExpression("top",u))})}if(l&&(h.theme?p.find(".ui-widget-content").append(l):p.append(l),(l.jquery||l.nodeType)&&n(l).show()),h.centerY&&(g.show(),p.show(),h.css&&h.css.height&&typeof h.css.height=="number"&&(lt=h.css.height),at=lt||l.height(),g.hide(),p.hide(),p.css("top",(n(window).height()-at)/2)),(f||h.forceIframe)&&h.showOverlay&&tt.show(),h.fadeIn){var vt=h.onBlock?h.onBlock:u,pt=h.showOverlay&&!l?vt:u,wt=l?vt:u;h.showOverlay&&g._fadeIn(h.fadeIn,pt);l&&p._fadeIn(h.fadeIn,wt)}else h.showOverlay&&g.show(),l&&p.show(),h.onBlock&&h.onBlock.bind(p)();c(1,s,h);w?(t=p[0],i=n(h.focusableElements,t),h.focusInput&&setTimeout(a,20)):y(p[0],h.centerX,h.centerY);h.timeout&&(yt=setTimeout(function(){w?n.unblockUI(h):n(s).unblock(h)},h.timeout),n(s).data("blockUI.timeout",yt))}}function e(r,u){var o,s=r==window,e=n(r),l=e.data("blockUI.history"),a=e.data("blockUI.timeout"),f;a&&(clearTimeout(a),e.removeData("blockUI.timeout"));u=n.extend({},n.blockUI.defaults,u||{});c(0,r,u);u.onUnblock===null&&(u.onUnblock=e.data("blockUI.onUnblock"),e.removeData("blockUI.onUnblock"));f=s?n("body").children().filter(".blockUI").add("body > .blockUI"):e.find(">.blockUI");u.cursorReset&&(f.length>1&&(f[1].style.cursor=u.cursorReset),f.length>2&&(f[2].style.cursor=u.cursorReset));s&&(t=i=null);u.fadeOut?(o=f.length,f.stop().fadeOut(u.fadeOut,function(){--o==0&&h(f,l,u,r)})):h(f,l,u,r)}function h(t,i,r,u){var f=n(u);if(!f.data("blockUI.isBlocked")){if(t.each(function(){this.parentNode&&this.parentNode.removeChild(this)}),i&&i.el&&(i.el.style.display=i.display,i.el.style.position=i.position,i.el.style.cursor="default",i.parent&&i.parent.appendChild(i.el),f.removeData("blockUI.history")),f.data("blockUI.static")&&f.css("position","static"),typeof r.onUnblock=="function")r.onUnblock(u,r);var e=n(document.body),o=e.width(),s=e[0].style.width;e.width(o-1).width(o);e[0].style.width=s}}function c(i,r,u){var f=r==window,o=n(r),e;(i||(!f||t)&&(f||o.data("blockUI.isBlocked")))&&(o.data("blockUI.isBlocked",i),f&&u.bindEvents&&(!i||u.showOverlay))&&(e="mousedown mouseup keydown keypress keyup touchstart touchend touchmove",i?n(document).bind(e,u,l):n(document).unbind(e,l))}function l(r){var u,f;if(r.type==="keydown"&&r.keyCode&&r.keyCode==9&&t&&r.data.constrainTabKey){var e=i,s=!r.shiftKey&&r.target===e[e.length-1],o=r.shiftKey&&r.target===e[0];if(s||o)return setTimeout(function(){a(o)},10),!1}if(u=r.data,f=n(r.target),f.hasClass("blockOverlay")&&u.onOverlayClick)u.onOverlayClick(r);return f.parents("div."+u.blockMsgClass).length>0?!0:f.parents().children().filter("div.blockUI").length===0}function a(n){if(i){var t=i[n===!0?i.length-1:0];t&&t.focus()}}function y(n,t,i){var u=n.parentNode,f=n.style,e=(u.offsetWidth-n.offsetWidth)/2-r(u,"borderLeftWidth"),o=(u.offsetHeight-n.offsetHeight)/2-r(u,"borderTopWidth");t&&(f.left=e>0?e+"px":"0");i&&(f.top=o>0?o+"px":"0")}function r(t,i){return parseInt(n.css(t,i),10)||0}var t,i;n.fn._fadeIn=n.fn.fadeIn;var u=n.noop||function(){},f=/MSIE/.test(navigator.userAgent),o=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),p=document.documentMode||0,v=n.isFunction(document.createElement("div").style.setExpression);n.blockUI=function(n){s(window,n)};n.unblockUI=function(n){e(window,n)};n.growlUI=function(t,i,r,u){var f=n('<div class="growlUI"><\/div>'),e,o;t&&f.append("<h1>"+t+"<\/h1>");i&&f.append("<h2>"+i+"<\/h2>");r===undefined&&(r=3e3);e=function(t){t=t||{};n.blockUI({message:f,fadeIn:typeof t.fadeIn!="undefined"?t.fadeIn:700,fadeOut:typeof t.fadeOut!="undefined"?t.fadeOut:1e3,timeout:typeof t.timeout!="undefined"?t.timeout:r,centerY:!1,showOverlay:!1,onUnblock:u,css:n.blockUI.defaults.growlCSS})};e();o=f.css("opacity");f.mouseover(function(){e({fadeIn:0,timeout:3e4});var t=n(".blockMsg");t.stop();t.fadeTo(300,1)}).mouseout(function(){n(".blockMsg").fadeOut(1e3)})};n.fn.block=function(t){if(this[0]===window)return n.blockUI(t),this;var i=n.extend({},n.blockUI.defaults,t||{});return this.each(function(){var t=n(this);i.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){n.css(this,"position")=="static"&&(this.style.position="relative",n(this).data("blockUI.static",!0));this.style.zoom=1;s(this,t)})};n.fn.unblock=function(t){return this[0]===window?(n.unblockUI(t),this):this.each(function(){e(this,t)})};n.blockUI.version=2.7;n.blockUI.defaults={message:"<h1>Please wait...<\/h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};t=null;i=[]}typeof define=="function"&&define.amd&&define.amd.jQuery?define(["jquery"],n):n(jQuery)}();$.blockUI.defaults=$.extend($.blockUI.defaults,{centerY:!0,css:$.extend($.blockUI.defaults.css,{cursor:"default",border:0,"box-shadow":"0px 0px 60px #000","border-radius":"2px",padding:"10px 20px","text-align":"left"}),overlayCSS:$.extend($.blockUI.defaults.overlayCSS,{cursor:"default"})}),function(n,t,i){"use strict";n.fn.simpleLightbox=function(r){var r=n.extend({overlay:!0,spinner:!0,nav:!0,navText:["&lsaquo;","&rsaquo;"],captions:!0,captionDelay:0,captionSelector:"img",captionType:"attr",captionsData:"title",captionPosition:"bottom",close:!0,closeText:"×",swipeClose:!0,showCounter:!0,fileExt:"png|jpg|jpeg|gif",animationSlide:!0,animationSpeed:250,preloading:!0,enableKeyboard:!0,loop:!0,docClose:!0,swipeTolerance:50,className:"simple-lightbox",widthRatio:.8,heightRatio:.9,disableRightClick:!1,disableScroll:!0,alertError:!0,alertErrorMessage:"Image not found, next image will be loaded",additionalHtml:!1},r),ht="ontouchstart"in t,ct=t.navigator.pointerEnabled||t.navigator.msPointerEnabled,bt=function(n){if(ht)return!0;if(!ct||typeof n=="undefined"||typeof n.pointerType=="undefined")return!1;if(typeof n.MSPOINTER_TYPE_MOUSE!="undefined"){if(n.MSPOINTER_TYPE_MOUSE!=n.pointerType)return!0}else if(n.pointerType!="mouse")return!0;return!1},o=0,rt=0,s=n(),w=function(){var n=i.body||i.documentElement,n=n.style;return n.WebkitTransition==""?"-webkit-":n.MozTransition==""?"-moz-":n.OTransition==""?"-o-":n.transition==""?"":!1},v=!1,h=[],u=this,w=w(),b=w!==!1?!0:!1,e="simplelb",ut=n("<div>").addClass("sl-overlay"),lt=n("<button>").addClass("sl-close").html(r.closeText),k=n("<div>").addClass("sl-spinner").html("<div><\/div>"),g=n("<div>").addClass("sl-navigation").html('<button class="sl-prev">'+r.navText[0]+'<\/button><button class="sl-next">'+r.navText[1]+"<\/button>"),tt=n("<div>").addClass("sl-counter").html('<span class="sl-current"><\/span>/<span class="sl-total"><\/span>'),c=!1,f=0,at=n("<div>").addClass("sl-caption pos-"+r.captionPosition),l=n("<div>").addClass("sl-image"),y=n("<div>").addClass("sl-wrapper").addClass(r.className),vt=function(t){return r.fileExt?n(t).prop("tagName").toLowerCase()=="a"&&new RegExp(".("+r.fileExt+")$","i").test(n(t).attr("href")):!0},yt=function(){r.close&&lt.appendTo(y);r.showCounter&&u.length>1&&(tt.appendTo(y),tt.find(".sl-total").text(u.length));r.nav&&g.appendTo(y);r.spinner&&k.appendTo(y)},nt=function(i){return r.imageSrcTransform&&(i=r.imageSrcTransform(i,n(t).width()*r.widthRatio)),i},ft=function(t){t.trigger(n.Event("show.simplelightbox"));r.disableScroll&&st("hide");y.appendTo("body");l.appendTo(y);r.overlay&&ut.appendTo(n("body"));c=!0;f=u.index(t);s=n("<img/>").hide().attr("src",nt(t.attr("href")));h.indexOf(t.attr("href"))==-1&&h.push(t.attr("href"));l.html("").attr("style","");s.appendTo(l);pt();ut.fadeIn("fast");n(".sl-close").fadeIn("fast");k.show();g.fadeIn("fast");n(".sl-wrapper .sl-counter .sl-current").text(f+1);tt.fadeIn("fast");it();r.preloading&&ot();setTimeout(function(){t.trigger(n.Event("shown.simplelightbox"))},r.animationSpeed)},it=function(i){if(s.length){var e=new Image,o=n(t).width()*r.widthRatio,l=n(t).height()*r.heightRatio;e.src=s.attr("src");n(e).bind("error",function(){if(u.eq(f).trigger(n.Event("error.simplelightbox")),c=!1,v=!0,k.hide(),r.alertError){alert(r.alertErrorMessage);i==1||i==-1?a(i):a(1);return}});e.onload=function(){var a,y,w,p,g,nt;typeof i!="undefined"&&u.eq(f).trigger(n.Event("changed.simplelightbox")).trigger(n.Event((i===1?"nextDone":"prevDone")+".simplelightbox"));h.indexOf(s.attr("src"))==-1&&h.push(s.attr("src"));a=e.width;y=e.height;(a>o||y>l)&&(w=a/y>o/l?a/o:y/l,a/=w,y/=w);n(".sl-image").css({top:(n(t).height()-y)/2+"px",left:(n(t).width()-a)/2+"px"});k.hide();s.css({width:a+"px",height:y+"px"}).fadeIn("fast");v=!0;p=r.captionSelector=="self"?u.eq(f):u.eq(f).find(r.captionSelector);g=r.captionType=="data"?p.data(r.captionsData):r.captionType=="text"?p.html():p.prop(r.captionsData);r.loop||(f==0&&n(".sl-prev").hide(),f>=u.length-1&&n(".sl-next").hide(),f>0&&n(".sl-prev").show(),f<u.length-1&&n(".sl-next").show());u.length==1&&n(".sl-prev, .sl-next").hide();i==1||i==-1?(nt={opacity:1},r.animationSlide&&(b?(d(0,100*i+"px"),setTimeout(function(){d(r.animationSpeed/1e3,"0px");50})):nt.left=parseInt(n(".sl-image").css("left"))+100*i+"px"),n(".sl-image").animate(nt,r.animationSpeed,function(){c=!1;et(g)})):(c=!1,et(g));r.additionalHtml&&n(".sl-additional-html").length==0&&n("<div>").html(r.additionalHtml).addClass("sl-additional-html").appendTo(n(".sl-image"))}}},et=function(t){t!=""&&typeof t!="undefined"&&r.captions&&at.html(t).hide().appendTo(n(".sl-image")).delay(r.captionDelay).fadeIn("fast")},d=function(t,i){var r={};r[w+"transform"]="translateX("+i+")";r[w+"transition"]=w+"transform "+t+"s linear";n(".sl-image").css(r)},pt=function(){n(t).on("resize."+e,it);n(i).on("click."+e+" touchstart."+e,".sl-close",function(n){n.preventDefault();v&&p()});g.on("click."+e,"button",function(t){t.preventDefault();o=0;a(n(this).hasClass("sl-next")?1:-1)});var c=0,y=0,w=0,k=0,s=!1,h=0;l.on("touchstart."+e+" mousedown."+e,function(n){return s?!0:(b&&(h=parseInt(l.css("left"))),s=!0,c=n.originalEvent.pageX||n.originalEvent.touches[0].pageX,w=n.originalEvent.pageY||n.originalEvent.touches[0].pageY,!1)}).on("touchmove."+e+" mousemove."+e+" pointermove MSPointerMove",function(n){if(!s)return!0;n.preventDefault();y=n.originalEvent.pageX||n.originalEvent.touches[0].pageX;k=n.originalEvent.pageY||n.originalEvent.touches[0].pageY;o=c-y;rt=w-k;r.animationSlide&&(b?d(0,-o+"px"):l.css("left",h-o+"px"))}).on("touchend."+e+" mouseup."+e+" touchcancel."+e+" mouseleave."+e+" pointerup pointercancel MSPointerUp MSPointerCancel",function(){if(s){s=!1;var n=!0;r.loop||(f==0&&o<0&&(n=!1),f>=u.length-1&&o>0&&(n=!1));Math.abs(o)>r.swipeTolerance&&n?a(o>0?1:-1):r.animationSlide&&(b?d(r.animationSpeed/1e3,"0px"):l.animate({left:h+"px"},r.animationSpeed/2));r.swipeClose&&Math.abs(rt)>50&&Math.abs(o)<r.swipeTolerance&&p()}})},wt=function(){g.off("click","button");n(i).off("click."+e,".sl-close");n(t).off("resize."+e)},ot=function(){var t=f+1<0?u.length-1:f+1>=u.length-1?0:f+1,i=f-1<0?u.length-1:f-1>=u.length-1?0:f-1;n("<img />").attr("src",nt(u.eq(t).attr("href"))).load(function(){h.indexOf(n(this).attr("src"))==-1&&h.push(n(this).attr("src"));u.eq(f).trigger(n.Event("nextImageLoaded.simplelightbox"))});n("<img />").attr("src",nt(u.eq(i).attr("href"))).load(function(){h.indexOf(n(this).attr("src"))==-1&&h.push(n(this).attr("src"));u.eq(f).trigger(n.Event("prevImageLoaded.simplelightbox"))})},a=function(t){var i,e;(u.eq(f).trigger(n.Event("change.simplelightbox")).trigger(n.Event((t===1?"next":"prev")+".simplelightbox")),i=f+t,c||(i<0||i>=u.length)&&r.loop==!1)||(f=i<0?u.length-1:i>u.length-1?0:i,n(".sl-wrapper .sl-counter .sl-current").text(f+1),e={opacity:0},r.animationSlide&&(b?d(r.animationSpeed/1e3,-100*t-o+"px"):e.left=parseInt(n(".sl-image").css("left"))+-100*t+"px"),n(".sl-image").animate(e,r.animationSpeed,function(){setTimeout(function(){var i=u.eq(f);s.attr("src",nt(i.attr("href")));h.indexOf(i.attr("href"))==-1&&k.show();n(".sl-caption").remove();it(t);r.preloading&&ot()},100)}))},p=function(){if(!c){var t=u.eq(f),i=!1;t.trigger(n.Event("close.simplelightbox"));n(".sl-image img, .sl-overlay, .sl-close, .sl-navigation, .sl-image .sl-caption, .sl-counter").fadeOut("fast",function(){r.disableScroll&&st("show");n(".sl-wrapper, .sl-overlay").remove();wt();i||t.trigger(n.Event("closed.simplelightbox"));i=!0});s=n();v=!1;c=!1}},st=function(r){var f,e,u,o,s;r=="hide"?(f=t.innerWidth,f||(e=i.documentElement.getBoundingClientRect(),f=e.right-Math.abs(e.left)),i.body.clientWidth<f&&(u=i.createElement("div"),o=parseInt(n("body").css("padding-right"),10),u.className="sl-scrollbar-measure",n("body").append(u),s=u.offsetWidth-u.clientWidth,n(i.body)[0].removeChild(u),n("body").data("padding",o),s>0&&n("body").addClass("hidden-scroll").css({"padding-right":o+s}))):n("body").removeClass("hidden-scroll").css({"padding-right":n("body").data("padding")})};yt();u.on("click."+e,function(t){if(vt(this)){if(t.preventDefault(),c)return!1;ft(n(this))}});n(i).on("click."+e+" touchstart."+e,function(t){v&&r.docClose&&n(t.target).closest(".sl-image").length==0&&n(t.target).closest(".sl-navigation").length==0&&p()});if(r.disableRightClick)n(i).on("contextmenu",".sl-image img",function(){return!1});if(r.enableKeyboard)n(i).on("keyup."+e,function(n){if(o=0,v){n.preventDefault();var t=n.keyCode;t==27&&p();(t==37||n.keyCode==39)&&a(n.keyCode==39?1:-1)}});return this.open=function(t){t=t||n(this[0]);ft(t)},this.next=function(){a(1)},this.prev=function(){a(-1)},this.close=function(){p()},this.destroy=function(){n(i).unbind("click."+e).unbind("keyup."+e);p();n(".sl-overlay, .sl-wrapper").remove();this.off("click")},this.refresh=function(){this.destroy();n(this.selector).simpleLightbox(r)},this}}(jQuery,window,document),function(n){function t(t,i){switch(i){case 2:return t.getFullYear().toString();case 1:return n.shortMonthNames[t.getMonth()]+" "+t.getFullYear().toString();default:return t.getDate()+" "+n.shortMonthNames[t.getMonth()]+" "+t.getFullYear()}}n.fullMonthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];n.shortMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];n.getFormattedDate=t}(DateHelpers||(DateHelpers={})),function(){var n;(function(){var n=function(n,t,i){if(n==null||n.length==0)return!0;switch(t.ContactDetailType){case 3:return new RegExp(i.emailRegexPattern).test(n)?!0:i.invalidEmailErrorMessage;case 2:case 1:case 0:case 6:return new RegExp(i.phoneNumberRegexPattern).test(n)?!0:i.invalidPhoneNumberMessage}return!0};ValidationTypes.addValidationType("contactinformation",n)})(n||(n={}))}(AdditionalValidationRules||(AdditionalValidationRules={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.render=function(){var n=this;return React.createElement("input",{type:"number",placeholder:this.props.placeholder,value:this.props.context.getState(),onChange:function(t){return n.props.context.setState(t.target.value)},onKeyDown:function(t){return n.handleOnKeyDown(t)},onBlur:this.props.onBlur,min:this.props.minValue,max:this.props.maxValue,disabled:this.props.isDisabled?!0:undefined})},t.prototype.handleOnKeyDown=function(n){(n.key=="e"||n.key=="+"||this.props.minValue!=undefined&&this.props.minValue>=0&&n.key=="-")&&n.preventDefault()},t}(React.Component);n.FizzFormNumberBox=t}(FizzFormControls||(FizzFormControls={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(){return t!==null&&t.apply(this,arguments)||this}return __extends(i,t),i.prototype.render=function(){var i=this,t;return t=this.props.placeholderTextOverride!=null?this.props.placeholderTextOverride:ReactFormHelpers.getDisplayName(this.props.context),React.createElement("div",{className:"fizzFormRow"},React.createElement(n.FizzFormTextBox,{context:this.props.context,placeholder:t,onBlur:function(n){return i.onTextBoxBlur(n)},dataAtsId:this.props.dataAtsId}),React.createElement(FizzFormValidationMessage,{context:this.props.context}))},i.prototype.onTextBoxBlur=function(){this.props.context.validate(this.props.context.getState())},i}(React.Component);n.FizzFormPlaceholderTextBoxRow=t}(FizzFormControls||(FizzFormControls={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.render=function(){var n=this;return React.createElement("input",{type:"text",placeholder:this.props.placeholder,value:this.props.context.getState()||"",onChange:function(t){return n.props.context.setState(t.target.value)},onBlur:this.props.onBlur,"data-ats-id":this.props.dataAtsId})},t}(React.Component);n.FizzFormTextBox=t}(FizzFormControls||(FizzFormControls={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(t){var i=n.call(this,t)||this;return i.state={controlId:i.props.context.getFizzRoot().createUniqueId("checkbox")},i}return __extends(t,n),t.prototype.render=function(){var n=this,t=this.props.labelOverride!=null?this.props.labelOverride:ReactFormHelpers.getDisplayName(this.props.context);return React.createElement("div",{className:"fizzFormCheckBox checkboxContainer"},React.createElement("input",{name:this.state.controlId,id:this.state.controlId,type:"checkbox",checked:this.props.context.getState(),onChange:function(t){return n.onChange(t)}}),React.createElement("label",{htmlFor:this.state.controlId},t))},t.prototype.onChange=function(n){var t=n.target;this.props.context.setState(t.checked);this.props.onChange&&this.props.onChange()},t}(React.Component);n.FizzFormCheckBox=t}(FizzFormControls||(FizzFormControls={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){function t(n,t){return React.createElement("div",{className:"fizzFormRow"},t.bind(n)(),React.createElement(FizzFormValidationMessage,{context:n.props.context}))}n.RenderRow=t;var i=function(n){function i(){return n!==null&&n.apply(this,arguments)||this}return __extends(i,n),i.prototype.render=function(){return t(this,n.prototype.render)},i}(n.FizzFormTextBox);n.FizzFormTextBoxRow=i}(FizzFormControls||(FizzFormControls={}));var __extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),AutoCompleteDropdown=function(n){function t(t){var i=n.call(this,t)||this;return i.searchCallbackAbort=null,i.state={items:[],isLoading:!1,hasEverLoaded:!1,searchText:i.props.initialValue==null?"":i.props.initialValue,keyboardFocusItemIndex:-1,dropDownHidden:!0},i}return __extends(t,n),t.prototype.render=function(){var n=this,t=(this.state.items.length>0||this.hasFooterItem())&&!this.state.dropDownHidden?React.createElement("ul",{className:"reactAutoCompleteDropdown"},this.state.items.map(function(t,i){return React.createElement("li",{key:i,className:n.state.keyboardFocusItemIndex==i?"keyboardFocus":"",onClick:function(){return n.handleItemSelection(t)}},n.renderItem(t))}),this.hasFooterItem()&&this.state.searchText.length>=(this.props.itemSearchMinimumCharacters||3)&&this.state.hasEverLoaded?React.createElement("li",{key:"footerItem",className:this.state.keyboardFocusItemIndex==this.state.items.length?"keyboardFocus":"",onClick:function(){return n.handleFooterItemSelection()}},this.renderFooterItem()):null):null;return React.createElement("div",{className:"reactAutoComplete leafworm"},React.createElement("input",{type:"text",id:this.props.textBoxId,value:this.state.searchText,onBlur:function(t){if(n.props.onBlur)n.props.onBlur(t)},onChange:function(t){return n.handleChange(t)},onKeyDown:function(t){return n.handleKeyPress(t)},placeholder:this.props.placeholder,"data-ats-id":this.props.dataAtsId}),t)},t.prototype.hasFooterItem=function(){return!1},t.prototype.renderFooterItem=function(){return null},t.prototype.onFooterItemSelected=function(){},t.prototype.componentDidMount=function(){var n=this;$(document).on("click.reactautocomplete",function(t){var i=$(t.target);i.is(".reactAutoCompleteDropdown")||i.closest(".reactAutoComplete").length>0||n.setState({dropDownHidden:!0})})},t.prototype.componentWillUnmount=function(){this.searchCallbackAbort&&this.searchCallbackAbort();$(document).off(".reactautocomplete")},t.prototype.onItemSelected=function(){},t.prototype.handleFooterItemSelection=function(){this.setState({dropDownHidden:!0});this.onFooterItemSelected();this.props.onFooterItemSelected&&this.props.onFooterItemSelected()},t.prototype.handleItemSelection=function(n){this.setState({dropDownHidden:!0});this.onItemSelected(n);if(this.props.onItemSelected)this.props.onItemSelected(n)},t.prototype.handleKeyPress=function(n){var i=this.hasFooterItem(),t=null;n.keyCode==38?(n.preventDefault(),t=Math.max(-1,this.state.keyboardFocusItemIndex-1)):n.keyCode==40?(n.preventDefault(),t=Math.min(this.state.items.length+(i?0:-1),this.state.keyboardFocusItemIndex+1)):n.keyCode==13&&(this.state.keyboardFocusItemIndex>=0?(n.preventDefault(),this.state.keyboardFocusItemIndex==this.state.items.length?this.handleFooterItemSelection():this.handleItemSelection(this.state.items[this.state.keyboardFocusItemIndex])):(this.setState({dropDownHidden:!0}),this.props.onNonItemEnterPress&&this.props.onNonItemEnterPress()));t!=null&&this.setState({keyboardFocusItemIndex:t})},t.prototype.handleChange=function(n){var i=this,t=n.target.value;if(this.setState({searchText:t,dropDownHidden:t.length==0}),this.props.onTextChanged)this.props.onTextChanged(t);t.length==0?(this.setState({items:[]}),this.searchCallbackAbort&&this.searchCallbackAbort()):t.length>=(this.props.itemSearchMinimumCharacters||4)&&(this.state.isLoading?this.setState({queuedSearchText:t}):(this.setState({isLoading:!0}),this.searchCallbackAbort=this.props.itemSearchCallback(t,function(n){return i.onSearchComplete(n)})))},t.prototype.onSearchComplete=function(n){var i=this,t;this.searchCallbackAbort=null;n!=null?this.setState({items:n,isLoading:!1,hasEverLoaded:!0}):this.setState({isLoading:!1,hasEverLoaded:!0});this.state.queuedSearchText&&(t=this.state.queuedSearchText,this.setState({isLoading:!0,queuedSearchText:""}),this.searchCallbackAbort=this.props.itemSearchCallback(t,function(n){return i.onSearchComplete(n)}))},t.prototype.reset=function(){this.setState({items:[],isLoading:!1,hasEverLoaded:!1,searchText:"",queuedSearchText:"",dropDownHidden:!1,keyboardFocusItemIndex:-1})},t}(React.Component),StringAutoCompleteDropdown=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.renderItem=function(n){return React.createElement("span",{className:"stringItem"},n)},t.prototype.onItemSelected=function(n){this.setState({searchText:n})},t}(AutoCompleteDropdown),__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},Alpinist;(function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.LISTING_PACKAGE_TIER_ZERO=0,i.LISTING_PACKAGE_TIER_ONE=1,i.LISTING_PACKAGE_TIER_TWO=2,i.PROFILE_IMAGE_COUNT=1,i.IMAGE_CROP_SIZE=200,i.listOfThingsCanBeAccepted=[],i.boundOnBeforeUnload=function(n){return i.onBeforeUnload(n)},i.state.data.Categories.length==0&&i.state.data.Categories.push({FacetName:"Category",ValuePath:""}),i.transformData(i.state.data),i.transformValidationData(i.props.metadata),typeof window!="undefined"&&(window.addEventListener("beforeunload",i.boundOnBeforeUnload),window.atsDisableOnBeforeUnload=function(){console.log("Removing onBeforeUnload handler");window.removeEventListener("beforeunload",i.boundOnBeforeUnload)}),i.state.otherState.allowedFacetNames=_.keyBy(i.props.otherProps.InitialFacetNameInfos.map(function(n){return n.FacetName}).filter(function(n){return n!="Category"})),i.state.otherState.facetNameInfos=i.props.otherProps.InitialFacetNameInfos,i}return __extends(i,t),i.prototype.onBeforeUnload=function(n){if(this.state.otherState.isDirty){var t="You are about to leave this page, but you have some unsaved changes.\n\nPlease stay on this page and either publish or discard your changes.";return n.returnValue=t,t}},i.prototype.transformValidationData=function(n){var t=n.filter(function(n){return n.name.startsWith("ContactGrouping.ContactInformations.Value")});_.each(t,function(t){n.push({displayName:t.displayName,name:t.name.replace("ContactGrouping.ContactInformations.Value","transformedData.unlabelledGrouping.ContactInformations"),validators:t.validators});n.push({displayName:t.displayName,name:t.name.replace("ContactGrouping.ContactInformations.Value","transformedData.labelledGrouping.ContactInformations"),validators:t.validators})});n.push({displayName:"Label",name:"transformedData.labelledGrouping.Label",validators:[{clientvalidationrules:[{ErrorMessage:"Team members must have labels.",ValidationParameters:{},ValidationType:"required"}]},{clientvalidationrules:[{ErrorMessage:"A team members name should be less than 100 characters.",ValidationParameters:{max:100},ValidationType:"maxlength"}]}]})},i.prototype.transformData=function(n){var t={Value:""},h=n.ContactGrouping.map(function(n){return n.Address}).filter(function(n){return n!=null})[0],u=n.ContactGrouping.map(function(n){return n.ContactInformations}),i=_.flatten(u),f=(i.filter(function(n){return n.ContactDetailType==10})[0]||t).Value,e=(i.filter(function(n){return n.ContactDetailType==5})[0]||t).Value,o=(i.filter(function(n){return n.ContactDetailType==4})[0]||t).Value,s=(i.filter(function(n){return n.ContactDetailType==11})[0]||t).Value,r;n.transformedData={facebook:HttpUtilities.stripDomainAndProtocol(f),twitter:HttpUtilities.stripDomainAndProtocol(e),instagram:HttpUtilities.stripDomainAndProtocol(o),googlePlus:HttpUtilities.stripDomainAndProtocol(s),unlabelledGrouping:[],labelledGrouping:[]};r=n.ContactGrouping.map(function(n){return{key:n.key||null,Label:n.Label,JobTitle:n.JobTitle,Address:n.Address,ContactInformations:n.ContactInformations.filter(function(n){return n.ContactDetailType!=10&&n.ContactDetailType!=5&&n.ContactDetailType!=4&&n.ContactDetailType!=11})}});n.transformedData.unlabelledGrouping=r.filter(function(n){return n.Label==null||n.Label.length==0});n.transformedData.labelledGrouping=r.filter(function(n){return n.Label!=null&&n.Label.length>0});n.transformedData.unlabelledGrouping.length==0&&(console.log("no grouping"),n.transformedData.unlabelledGrouping.push({Address:[],ContactInformations:[],key:null,Label:""}))},i.prototype.untransformData=function(n){var r,u,f,t,i;n.ContactInformation.length=0;n.Addresses.length=0;r={};r[10]=n.transformedData.facebook;r[5]=n.transformedData.twitter;r[4]=n.transformedData.instagram;r[11]=n.transformedData.googlePlus;for(u in r)f=+u,r[u]!=null&&r[u].length>0&&n.ContactInformation.push({key:null,ContactDetailType:f,Value:r[u],Label:""});for(t=0;t<n.transformedData.labelledGrouping.map(function(n){return n.Address}).length;t++){for(i=0;i<n.transformedData.labelledGrouping[t].Address.length;i++)n.transformedData.labelledGrouping[t].Address[i].Label=this.createRawLabel(n.transformedData.labelledGrouping[t]);Array.prototype.push.apply(n.Addresses,n.transformedData.labelledGrouping[t].Address)}for(t=0;t<n.transformedData.unlabelledGrouping.map(function(n){return n.Address}).length;t++){for(i=0;i<n.transformedData.unlabelledGrouping[t].Address.length;i++)n.transformedData.unlabelledGrouping[t].Address[i].Label=n.transformedData.unlabelledGrouping[t].Label;Array.prototype.push.apply(n.Addresses,n.transformedData.unlabelledGrouping[t].Address)}for(t=0;t<n.transformedData.labelledGrouping.map(function(n){return n.ContactInformations}).length;t++){for(i=0;i<n.transformedData.labelledGrouping[t].ContactInformations.length;i++)n.transformedData.labelledGrouping[t].ContactInformations[i].Label=this.createRawLabel(n.transformedData.labelledGrouping[t]);Array.prototype.push.apply(n.ContactInformation,n.transformedData.labelledGrouping[t].ContactInformations)}for(t=0;t<n.transformedData.unlabelledGrouping.map(function(n){return n.ContactInformations}).length;t++){for(i=0;i<n.transformedData.unlabelledGrouping[t].ContactInformations.length;i++)n.transformedData.unlabelledGrouping[t].ContactInformations[i].Label=n.transformedData.unlabelledGrouping[t].Label;Array.prototype.push.apply(n.ContactInformation,n.transformedData.unlabelledGrouping[t].ContactInformations)}n.ContactGrouping.length=0;Array.prototype.push.apply(n.ContactGrouping,n.transformedData.unlabelledGrouping);Array.prototype.push.apply(n.ContactGrouping,n.transformedData.labelledGrouping)},i.prototype.createRawLabel=function(n){return n.Label+(_.isEmpty(n.JobTitle)?"":Sundance.Websites.Contacts.Features.Listing.JsonModels.IJsonContactGrouping.LABEL_SEPARATOR_FUDGE+n.JobTitle)},i.prototype.onCategoryListChange=function(){for(var r=this,t=this.state.data.Categories,i=[],n=0;n<t.length;n++)t[n].ValuePath!=null&&t[n].ValuePath.length>0&&i.push({FacetName:t[n].FacetName,ValuePath:t[n].ValuePath});console.log("Getting permitted facets for "+JSON.stringify(i));i.length>0&&SundanceWebEndpoints.getAvailableFacetsForCategory(JSON.stringify(i),function(n){var t={},i;_.each(n,function(n){if(t[n.FacetName]=!0,_.find(r.state.otherState.facetNameInfos,function(t){return t.FacetName==n.FacetName})==null){var i={otherState:{facetNameInfos:{$push:[n]}}};r.setState(function(n){return React.addons.update(n,i)})}});i={otherState:{allowedFacetNames:{$set:t}}};r.setState(function(n){return React.addons.update(n,i)})})},i.prototype.render=function(){var t=this;this.listOfThingsCanBeAccepted.length=0;var r=_.find(this.state.data.transformedData.unlabelledGrouping[0].ContactInformations,function(n){return n.ContactDetailType==3}),f=_.find(this.state.data.transformedData.unlabelledGrouping[0].ContactInformations,function(n){return n.ContactDetailType==7}),e=_.find(this.state.data.transformedData.unlabelledGrouping[0].ContactInformations,function(n){return n.ContactDetailType==0||n.ContactDetailType==6}),o=_.find(this.state.data.transformedData.unlabelledGrouping[0].ContactInformations,function(n){return n.ContactDetailType==1}),i=this.props.otherProps.AllowEditMode,s=i?undefined:"_blank",h="button "+(i?"disabled":""),g=this.props.otherProps.AllowedFeatures.MaxAllowedImages>0,l=g&&(this.props.otherProps.AllowEditMode||this.state.data.PrimaryImage!=null&&!_.isEmpty(this.state.data.PrimaryImage.ExternalId)),u=this.state.data.transformedData.unlabelledGrouping[0].Address[0],c=!1;u!=null&&(c=u.AllowInMaps);var a=u?u.Latitude:null,v=u?u.Longitude:null,y=this.props.otherProps.AllowEditMode||c&&a!=null&&v!=null,nt=React.createElement(n.FacetNameList,{context:this.getContext(function(n){return n}),ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},otherProps:{AllowEditMode:this.props.otherProps.AllowEditMode,facetNameInfos:this.state.otherState.facetNameInfos,allowedFeatures:this.props.otherProps.AllowedFeatures,ignoreFacetNames:{Category:!0,"Books status":!0,"Spotlight member discounts":!0},allowedFacetNames:this.state.otherState.allowedFacetNames}}),tt=this.props.otherProps.AllowEditMode&&this.state.otherState.allowedFacetNames[Sundance.Websites.Contacts.Features.Listing.IJsonListingDto.CONTACTS_BOOKS_STATUS]!=null,it=tt||this.props.initialData.BookStatus!=null?React.createElement(n.BooksStatus,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.BookStatus}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode,facetNameInfo:this.state.otherState.facetNameInfos.filter(function(n){return n.FacetName==Sundance.Websites.Contacts.Features.Listing.IJsonListingDto.CONTACTS_BOOKS_STATUS})[0]}}):null,rt=this.props.otherProps.AllowEditMode&&this.props.otherProps.AllowedFeatures.PackageLevel>=2,p=rt||this.props.initialData.SpotlightMemberDiscount!=null?React.createElement(n.MemberDiscount,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.SpotlightMemberDiscount}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode,facetNameInfo:this.state.otherState.facetNameInfos.filter(function(n){return n.FacetName==Sundance.Websites.Contacts.Features.Listing.IJsonListingDto.MEMBERSHIP_DISCOUNT})[0]}}):null,ut=this.props.otherProps.AllowEditMode||y||!_.isEmpty(this.state.data.transformedData.facebook)||!_.isEmpty(this.state.data.transformedData.googlePlus)||!_.isEmpty(this.state.data.transformedData.instagram)||!_.isEmpty(this.state.data.transformedData.twitter)||!_.isEmpty(p),ft=this.state.data.transformedData.unlabelledGrouping.length>0&&(this.state.data.transformedData.unlabelledGrouping[0].Address.length>0||this.state.data.transformedData.unlabelledGrouping[0].ContactInformations.length>0),et=this.props.otherProps.AllowEditMode||ft?React.createElement("div",{className:"formRow"},React.createElement("label",null,"Contact information"),React.createElement("div",{className:"formEditorControls"},React.createElement(n.GroupingPanelList,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.transformedData.unlabelledGrouping}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode,countryLookup:this.props.otherProps.CountryLookup,maxGroups:1,isMain:!0,atsId:"MainContactInfo",allowPrettyCards:!1,allowJobTitle:!1}}))):null,ot=this.props.otherProps.AllowEditMode||this.state.data.transformedData.labelledGrouping.length>0?React.createElement("div",{className:"formRow"},React.createElement("label",null,"The Team"),React.createElement("div",{className:"formEditorControls teamMembers","data-ats-id":"OtherContactInfo"},React.createElement(n.GroupingPanelList,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.transformedData.labelledGrouping}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode,countryLookup:this.props.otherProps.CountryLookup,maxGroups:this.props.otherProps.AllowedFeatures.MaxAllowedGroupings,isMain:!1,allowPrettyCards:this.props.otherProps.AllowedFeatures.PackageLevel>=this.LISTING_PACKAGE_TIER_TWO,allowJobTitle:this.props.otherProps.AllowedFeatures.PackageLevel>=this.LISTING_PACKAGE_TIER_ONE}}))):null,w,b;this.props.otherProps.AllowEditMode?b=React.createElement("a",{href:StringHelpers.format(this.props.otherProps.ListingReadOnlyUrlFormatString,{listingId:this.props.initialData.Id}),className:"button viewPublic",target:"_blank","data-rc":"listing-view-public","data-ats-id":"GoToPublicListing"},"View public listing"):w=React.createElement("a",{className:"backLink",href:"javascript:history.back();void(0);","data-rc":"listing-header-back"},React.createElement("span",{className:"sunlighticon-arrow-left"})," Back");var k=this.props.otherProps.AllowedFeatures.MaxAllowedImages-this.PROFILE_IMAGE_COUNT,d=this.props.otherProps.AllowedFeatures.MaxAllowedClientImages;return React.createElement("div",{className:"alpinistListing leafworm "+(this.state.otherState.isPageLoaded?"reactLoaded ":"reactLoading ")+(this.props.otherProps.AllowEditMode?"allowEditMode":"noEditMode")},React.createElement("div",{className:"sunlightHeroContainer sunlightHeroAlignTop sunlightHeroAlignCentre heroAspectRatio__20 dimmedBackground"},React.createElement("div",{className:"sunlightHeroBackground"},React.createElement("div",{className:"sunlightHeroBackgroundInner"},React.createElement("img",{className:"hero",src:"/Contacts/Content/Images/ListingTextureBackground.jpg"}))),React.createElement("div",{className:"sunlightHeroContent"},React.createElement("div",{className:"heroHeadingContainerWidthLimiter sundanceHeroContentContainer sundanceListingHeroArea"},React.createElement("div",{className:"sundanceHeroContentContainerInner sundanceHeroContentContainerInnerBottom"},w,React.createElement("div",{className:"imageAndDetailsContainer "+(l?"hasImage":"noImage")},l?React.createElement(n.PrimaryListingImage,{context:this.getContext(function(n){return n.PrimaryImage}),otherProps:{allowEdit:this.props.otherProps.AllowEditMode,cloudinarySettings:this.props.otherProps.CloudinarySettings,cropWidth:this.IMAGE_CROP_SIZE,cropHeight:this.IMAGE_CROP_SIZE,id:"PrimaryListingImage"}}):null,React.createElement("div",{className:"details"},b,React.createElement(n.AlpinistFormTextRow,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.DisplayName}),rowClassName:"displayNameRow",atsId:"DisplayName",allowEdits:this.props.otherProps.AllowEditMode}),React.createElement("div",{className:"quickDetails"},r!=null&&!_.isEmpty(r.Value)?React.createElement("div",{className:"quickDetail"},React.createElement("a",__assign({target:s,href:i?"#":ContactUrlFormatter.getUrl(r.Value,r.ContactDetailType),"data-rc":"listing-hero-email","data-ats-id":"HeroEmail",className:h},i?{}:ContactUrlFormatter.getAnchorProperties(r.Value,r.ContactDetailType,".obfuscated")),React.createElement("span",{className:"sunlighticon-envelope"}),"Send email",React.createElement("span",{className:"obfuscated",dangerouslySetInnerHTML:ContactUrlFormatter.getHtml(r.Value,r.ContactDetailType)}))):null,f!=null&&!_.isEmpty(f.Value)?React.createElement("div",{className:"quickDetail"},React.createElement("a",{target:s,href:i?"#":ContactUrlFormatter.getUrl(f.Value,f.ContactDetailType),"data-rc":"listing-hero-web",className:h},React.createElement("span",{className:"sunlighticon-earth"}),"Visit website")):null,o!=null&&!_.isEmpty(o.Value)?React.createElement("div",{className:"quickDetail"},React.createElement("a",{target:s,href:i?"#":ContactUrlFormatter.getUrl(o.Value,o.ContactDetailType),"data-rc":"listing-hero-mobile",className:h},React.createElement("span",{className:"sunlighticon-phone-mobile"}),"Call mobile")):null,e!=null&&!_.isEmpty(e.Value)?React.createElement("div",{className:"quickDetail"},React.createElement("a",{target:s,href:i?"#":ContactUrlFormatter.getUrl(e.Value,e.ContactDetailType),"data-rc":"listing-hero-phone",className:h},React.createElement("span",{className:"sunlighticon-phone-landline"}),"Call now")):null))))))),React.createElement("div",{className:"mainContent"},React.createElement("div",{className:"listingDetails"},React.createElement(n.CategoryList,{context:this.getContext(function(n){return n.Categories}),otherProps:{facetNameInfo:_.find(this.state.otherState.facetNameInfos,function(n){return n.FacetName=="Category"}),allowEdits:this.props.otherProps.AllowEditMode,maxAllowedValues:this.props.otherProps.AllowedFeatures.MaxAllowedCategories}}),React.createElement(n.AlpinistFormTextRow,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.Description}),multiline:!0,growHeight:!0,showCharacterCounter:!0,atsId:"Description",allowEdits:this.props.otherProps.AllowEditMode}),nt,et,it,ot,this.props.otherProps.AllowedFeatures.PackageLevel>=this.LISTING_PACKAGE_TIER_TWO&&(this.props.otherProps.AllowEditMode||this.state.data.Credits.length>0)?React.createElement("div",{className:"alpinistCredits formRow"},React.createElement("label",null,"Production Details"),React.createElement("div",{className:"formEditorControls"},React.createElement(SundanceCredit.CreditList,{context:this.getContext(function(n){return n.Credits}),ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},otherProps:{allowEdits:this.props.otherProps.AllowEditMode,allowedProductions:this.props.otherProps.AllowedProductionTypes,allowedRoles:this.props.otherProps.AllowedCreditRoles,allowedSecondaryRoles:this.props.otherProps.AllowedSecondaryCreditRoles,creditRoleDisplayNameLookup:this.props.otherProps.CreditRoleDisplayNameLookup,defaultCreditRole:0}}))):null,k>0&&(this.props.otherProps.AllowEditMode||this.state.data.Images.length>0)?React.createElement(n.ImageThumbnails,{context:this.getContext(function(n){return n.Images}),otherProps:{headingText:"Gallery",singularNoun:"photo",pluralNoun:"photos",allowEdits:i,cloudName:this.props.otherProps.CloudinarySettings.CloudName,cloudinaryApiKey:this.props.otherProps.CloudinarySettings.ApiKey,cloudinaryTagsForAdditionalImages:this.props.otherProps.CloudinarySettings.TagsForGalleryImages,maxImages:k,startGallery:function(n){return t.startGallery(n,2)},atsId:"GalleryImages"}}):null,d>0&&(this.props.otherProps.AllowEditMode||this.state.data.ClientImages.length>0)?React.createElement(n.ImageThumbnails,{context:this.getContext(function(n){return n.ClientImages}),otherProps:{headingText:"Client list",singularNoun:"client",pluralNoun:"clients",allowEdits:i,cloudName:this.props.otherProps.CloudinarySettings.CloudName,cloudinaryApiKey:this.props.otherProps.CloudinarySettings.ApiKey,cloudinaryTagsForAdditionalImages:this.props.otherProps.CloudinarySettings.TagsForClientImages,maxImages:d,startGallery:function(n){return t.startGallery(n,3)}}}):null),ut?React.createElement("aside",{className:"sideBar"},y?React.createElement("div",null,React.createElement("h2",null,"Location"),React.createElement(n.ListingGoogleMap,{context:this.getContext(function(n){return n}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode,mapIsAllowed:c,mapLat:a,mapLng:v}})):null,React.createElement("div",{className:"discountHolder"},p),React.createElement("div",{className:"socialHolder"},React.createElement(n.SocialPanel,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n}),otherProps:{allowEdits:this.props.otherProps.AllowEditMode}}))):null),React.createElement("div",{className:"changesBanner "+(this.props.otherProps.AllowEditMode&&this.state.otherState.isDirty?"hasChanges":"")},React.createElement("strong",null,"What do you want to do next?"),React.createElement("div",{className:"changesAction"},React.createElement("button",{"data-rc":"listing-discardChanges",onClick:function(){return t.discardChanges()}},"Discard all"),React.createElement("span",null,"You will lose all changes")),React.createElement("div",{className:"changesAction"},React.createElement("button",{"data-rc":"listing-publishChanges","data-ats-id":"PublishChanges",onClick:function(){return t.save()},disabled:this.state.otherState.isAjaxUpdating},"Publish changes"),React.createElement("span",null,"Your profile will be updated and changes will appear in your listing"))))},i.prototype.discardChanges=function(){window.location.reload()},i.prototype.startGallery=function(n,t){var r,i;switch(t){case 2:r=this.state.data.Images;break;case 3:r=this.state.data.ClientImages}i=r.map(function(n){return{href:CloudinaryHelpers.generateTemplatedDisplayUrlForCroppedToWidth(n.ExternalId),trigger:function(){},attr:function(){return CloudinaryHelpers.generateTemplatedDisplayUrlForCroppedToWidth(n.ExternalId)},title:(n.ImageCredit||"")+(_.isEmpty(n.ImageDescription)?"":" - "+n.ImageDescription)}});console.log(i);$(i).simpleLightbox({navText:["&lsaquo;","&rsaquo;"],imageSrcTransform:function(n,t){var i=Math.ceil(t/100)*100;return n.replace("{width}",i*(window.devicePixelRatio||1))},captionSelector:"self",captionType:"prop",animationSpeed:100}).open(i[n])},i.prototype.componentDidMount=function(){this.loadingComplete()},i.prototype.loadingComplete=function(){this.updateOtherState({isPageLoaded:{$set:!0}});Cookies.get("isNew")==="true"},i.prototype.onRootStateChange=function(){this.updateOtherState({isDirty:{$set:!0}})},i.prototype.componentDidUpdate=function(){if(this.awaitingSave)this.sendToServer();else{var n=this.getCategoriesString();this.lastCategories!=null&&n!=this.lastCategories&&this.onCategoryListChange();this.lastCategories=n}},i.prototype.getCategoriesString=function(){return this.state.data.Categories.map(function(n){return n.FacetName+"___"+n.ValuePath}).join("___")},i.prototype.save=function(){this.awaitingSave=!0;_.each(this.listOfThingsCanBeAccepted.reverse(),function(n){n!=null&&n.acceptChanges()})},i.prototype.sendToServer=function(){var t=this,n,i;if(this.state.data.Categories.length==0||_.isEmpty(this.state.data.Categories[0].ValuePath)){alert("Please select a category.");this.awaitingSave=!1;return}for(this.untransformData(this.state.data),this.awaitingSave=!1,n=this.state.data.FacetValues.length-1;n>=0;n--)i=this.state.data.FacetValues[n].FacetName,this.state.otherState.allowedFacetNames[i]==null&&this.state.data.FacetValues.splice(n,1);_.values(this.state.validationStates).filter(function(n){return n!=null}).length>0?(alert("We could not update your listing. Please check that you have filled in your details correctly."),console.log(this.state.validationStates)):(SundanceWebEndpoints.updateListing(this.props.initialData.Id,this.state.data,this.props.otherProps.EditToken,function(n,i,r,u,f){t.updateOtherState({isAjaxUpdating:{$set:!1}});n?(alert("Thank you, your changes have been published successfully!"),t.updateOtherState({isDirty:{$set:!1}}),window.parent!=window&&window.parent.postMessage("Sundance.AdminEditor.SaveSuccessful","*"),f&&(Cookies.set("isNew","true"),window.location.href=StringHelpers.format(t.props.otherProps.ListingEditUrlFormatString,{listingId:r,edit:encodeURIComponent(u)}))):alert("Sorry, an error has occurred. Please try again later.")}),this.updateOtherState({isAjaxUpdating:{$set:!0}}))},i}(FizzForm);n.Listing=t})(Alpinist||(Alpinist={})),function(n){function t(n){return n.AddressLine1!=null&&n.AddressLine1.trim().length>0||n.AddressLine2!=null&&n.AddressLine2.trim().length>0||n.AddressLine3!=null&&n.AddressLine3.trim().length>0||n.AddressLine4!=null&&n.AddressLine4.trim().length>0||n.PostCode!=null&&n.PostCode.trim().length>0}n.addressHasValues=t}(ModelHelpers||(ModelHelpers={})),function(n){var t;(function(n){n.blurbAboveCreditTextBox=React.createElement("p",{className:"photoCreditText"},"Please add any credit or copyright information for this photo.");n.blurbAboveDescriptionTextBox=React.createElement("div",null,React.createElement("p",{className:"photoCreditText"},"You can also provide a description for your photo."))})(t=n.AlpinistContants||(n.AlpinistContants={}))}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t=function(n){function t(t){var i=n.call(this,t)||this,r=ReactFormHelpers.getPropertyPath(i.props.context);return i.displayName=ReactFormHelpers.getDisplayName(i.props.context),i.state={isEditing:t.initialEdit?!0:!1,oldValue:t.initialEdit?i.props.context.getState():null},t.initialEdit&&(i.awaitingFocus=!0),i}return __extends(t,n),t.prototype.onKeyDown=function(n){n.key!="Tab"&&(n.key!="Enter"||this.allowNewLines())||(n.preventDefault(),this.acceptChanges())},t.prototype.handleChange=function(n){var t=n.target.value;this.props.context.setState(t);this.onChange(t)},t.prototype.allowNewLines=function(){return!1},t.prototype.onChange=function(){},t.prototype.validate=function(n){var t=n.target.value,i=this.props.context.validate(t)},t.prototype.render=function(){var n=this,u,i,f,t,o,s,h,c,v;this.elementId=this.elementId||(this.elementId=this.props.context.createUniqueId(this.displayName));var e=null,a=null,r=this.convertValueToString(this.props.context.getState());if(this.props.showCharacterCounter){u=ReactFormHelpers.getValidationRules(this.props.context);n:for(i=0;i<u.length;i++)for(f=0;f<u[i].clientvalidationrules.length;f++)if(u[i].clientvalidationrules[f].ValidationType=="maxlength"){e=u[i].clientvalidationrules[f].ValidationParameters.max;t=(e||99999999)-r.length;a=t>=0?t+" "+(t==1?"character":"characters")+" remaining":-t+" "+(t==-1?"character":"characters")+" too many";break n}}if(o=this.props.context.getValidationMessage()==null,s={id:this.elementId,value:r,onChange:function(t){return n.handleChange(t)},onBlur:function(t){return n.validate(t)},onKeyDown:function(t){return n.onKeyDown(t)},placeholder:this.props.placeholderText||"",className:o?"":"input-validation-error",maxLength:e&&!this.allowNewLines()},this.state.isEditing)c=!0,v=this.props.showCharacterCounter?React.createElement("span",{className:"characterCounter "+(t<0?"characterCounterOverBudget":"")},a):null,h=React.createElement("span",null,React.createElement("span",{className:"editorControl"},this.createEditorControl(s,function(t){return n.editorElement=t}),v),React.createElement("span",{className:"fieldButtons"},React.createElement("button",{className:"rejectChanges","data-ats-id":"RejectChanges",onClick:function(){return n.rejectChanges()}})," ",s.value!=null?React.createElement("button",{className:"acceptChanges","data-ats-id":"AcceptChanges",onClick:function(){return n.acceptChanges()}}):null));else{var p=ReactFormHelpers.getPropertyPath(this.props.context),r=this.convertValueToString(this.props.context.getState()),l=r.length>0,y=this.allowNewLines()?r.split("\n").map(function(n){return React.createElement("p",null,n.length==0?" ":n)}):r;c=l||this.props.allowEdits;h=React.createElement("span",null,React.createElement("span",{className:"readonlyValue "+(l?"":"noValue"),"data-ats-id":"ReadOnlyValue","data-rc":"listing-"+this.displayName,onClick:function(){return n.startEditing()}},l?y:this.props.emptyValuePrompt||"Click to edit"),this.props.allowEdits?React.createElement("span",{className:"fieldButtons"},React.createElement("button",{className:"editValue","data-ats-id":"StartEditing",onClick:function(){return n.startEditing()}})):"")}return c?React.createElement("div",{"data-ats-id":this.props.atsId,className:"formRow "+(o?"formRowValid":"formRowNotValid")+" "+this.props.rowClassName+" "+(this.state.isEditing?"isEditing":"")},React.createElement("div",{className:"formControls"},React.createElement("label",{"data-rc":"listing-"+this.displayName+"-label",htmlFor:this.elementId},this.displayName),h,React.createElement(FizzFormValidationMessage,{context:this.props.context}))):React.createElement("span",null)},t.prototype.startEditing=function(){if(this.props.allowEdits){var n=this.props.context.getState();this.awaitingFocus=!0;this.setState({isEditing:!0,oldValue:n});this.onStartEditing()}},t.prototype.onStartEditing=function(){},t.prototype.componentDidMount=function(){this.focusIfNeeded()},t.prototype.componentDidUpdate=function(){this.focusIfNeeded()},t.prototype.focusIfNeeded=function(){this.awaitingFocus&&(this.editorElement!=null&&this.editorElement.focus(),this.awaitingFocus=!1)},t.prototype.acceptChanges=function(){var t=this.props.context.validate(this.convertValueToString(this.props.context.getState())),n;return t==null&&(n=this.props.onBeforeAccepted?this.props.onBeforeAccepted():!0,n)?(this.setState({isEditing:!1,oldValue:null}),!0):!1},t.prototype.rejectChanges=function(){this.props.context.validate(this.convertValueToString(this.state.oldValue));this.props.context.setState(this.state.oldValue);var n;n=this.props.onBeforeCancelled?this.props.onBeforeCancelled():!0;n&&this.setState({isEditing:!1,oldValue:null})},t}(React.Component),i=function(n){function t(t){var i=n.call(this,t)||this,r=ReactFormHelpers.getPropertyPath(i.props.context);return i.displayName=ReactFormHelpers.getDisplayName(i.props.context),i}return __extends(t,n),t.prototype.convertValueToString=function(n){return n==null?"":n},t.prototype.createEditorControl=function(n,t){var i,r;return this.props.multiline?(i={},this.props.growHeight&&this.editorElement!=null&&(r=$(this.editorElement),i.height=this.state.textBoxHeight+5),React.createElement("textarea",__assign({ref:t,rows:6},n,{style:i}))):React.createElement("input",__assign({ref:t,type:"text"},n))},t.prototype.onChange=function(){this.updateHeight()},t.prototype.allowNewLines=function(){return this.props.multiline},t.prototype.updateHeight=function(){var t=this.editorElement.style.height,n;this.editorElement.style.height="1px";n=Math.max(100,this.editorElement.scrollHeight);this.editorElement.style.height=t;this.setState({oldValue:this.state.oldValue,isEditing:this.state.isEditing,textBoxHeight:n})},t.prototype.onStartEditing=function(){this.awaitingHeightMeasurement=this.props.growHeight},t.prototype.componentDidUpdate=function(){n.prototype.componentDidUpdate.call(this);this.awaitingHeightMeasurement&&this.editorElement!=null&&(this.updateHeight(),this.awaitingHeightMeasurement=!1)},t}(t);n.AlpinistFormTextRow=i}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(t){var i=n.call(this,t)||this;return i.listOfThingsCanBeAccepted=[],i.state={isEditing:!1},i.contactDetailTypeIconsMap={},i.contactDetailTypeIconsMap[10]="sunlighticon-facebook",i.contactDetailTypeIconsMap[5]="sunlighticon-twitter",i.contactDetailTypeIconsMap[4]="sunlighticon-instagram",i.contactDetailTypeIconsMap[11]="sunlighticon-google-plus",i}return __extends(t,n),t.prototype.render=function(){var t=this,r,n,u,i,f;return this.listOfThingsCanBeAccepted.length=0,this.props.otherProps.allowEdits&&(r=this.state.isEditing?React.createElement("div",{className:"fieldButtons"},React.createElement("button",{className:"rejectChanges",onClick:function(){return t.rejectChanges()},"data-ats-id":"RejectChanges"})," ",React.createElement("button",{className:"acceptChanges",onClick:function(){return t.acceptChanges()},"data-ats-id":"AcceptChanges"})):React.createElement("div",{className:"fieldButtons"},React.createElement("button",{className:"editValue",onClick:function(){return t.startEditing()},"data-ats-id":"StartEditing"}))),n=this.props.context.getState(),u=this.state.isEditing?React.createElement("div",{className:"socialNetworks socialNetworksEditable"},React.createElement("div",{className:"socialRow"},React.createElement("span",{className:this.contactDetailTypeIconsMap[10]}),React.createElement("input",{type:"text","data-ats-id":"FacebookTextBox",placeholder:"Facebook URL",value:n.transformedData.facebook,onChange:function(n){return t.handleChange(n,t.getContext(function(n){return n.transformedData.facebook}))}})),React.createElement("div",{className:"socialRow"},React.createElement("span",{className:this.contactDetailTypeIconsMap[5]}),React.createElement("input",{type:"text","data-ats-id":"TwitterTextBox",placeholder:"Twitter handle",value:n.transformedData.twitter,onChange:function(n){return t.handleChange(n,t.getContext(function(n){return n.transformedData.twitter}))}})),React.createElement("div",{className:"socialRow"},React.createElement("span",{className:this.contactDetailTypeIconsMap[4]}),React.createElement("input",{type:"text","data-ats-id":"InstagramTextBox",placeholder:"Instagram username",value:n.transformedData.instagram,onChange:function(n){return t.handleChange(n,t.getContext(function(n){return n.transformedData.instagram}))}}))):React.createElement("div",{className:"socialNetworks socialNetworksReadOnly"},this.createSocialLink(n.transformedData.facebook,10,"ReadOnlyFacebook"),this.createSocialLink(n.transformedData.twitter,5,"ReadOnlyTwitter"),this.createSocialLink(n.transformedData.instagram,4,"ReadOnlyInstagram")),i=n.transformedData.facebook!=null&&n.transformedData.facebook.length>0||n.transformedData.twitter!=null&&n.transformedData.twitter.length>0||n.transformedData.instagram!=null&&n.transformedData.instagram.length>0||n.transformedData.googlePlus!=null&&n.transformedData.googlePlus.length>0,f=React.createElement("div",{className:"socialPanel formControls"+(this.state.isEditing?"editing":""),"data-ats-id":"SocialPanel"},this.props.otherProps.allowEdits||i?React.createElement("h2",null,"Social Networks ",r):null,this.props.otherProps.allowEdits&&!i&&!this.state.isEditing?React.createElement("div",{className:"addNetworksMessage",onClick:function(){return t.startEditing()}},"Click to add social networks"):null,u),f},t.prototype.createSocialLink=function(n,t,i){if(n!=null&&n.length>0){var r=ContactUrlFormatter.getUrl(n,t);return React.createElement("a",{target:"_blank",href:r,"data-ats-id":i},React.createElement("span",{className:this.contactDetailTypeIconsMap[t]}))}return null},t.prototype.handleChange=function(n,t){var i=n.target.value;this.props.context.setRootState(function(n){return React.addons.update(n,ReactFormHelpers.createUpdateSpecForValue(n,t,i))})},t.prototype.acceptChanges=function(){var n=this,t=this.props.context.getState();return this.props.context.setRootState(function(i){return React.addons.update(i,ReactFormHelpers.createUpdateSpecForValue(i,n.getContext(function(n){return n.transformedData.facebook}),HttpUtilities.stripDomainAndProtocol(t.transformedData.facebook)))}),this.props.context.setRootState(function(i){return React.addons.update(i,ReactFormHelpers.createUpdateSpecForValue(i,n.getContext(function(n){return n.transformedData.googlePlus}),HttpUtilities.stripDomainAndProtocol(t.transformedData.googlePlus)))}),this.props.context.setRootState(function(i){return React.addons.update(i,ReactFormHelpers.createUpdateSpecForValue(i,n.getContext(function(n){return n.transformedData.instagram}),HttpUtilities.stripDomainAndProtocol(t.transformedData.instagram)))}),this.props.context.setRootState(function(i){return React.addons.update(i,ReactFormHelpers.createUpdateSpecForValue(i,n.getContext(function(n){return n.transformedData.twitter}),HttpUtilities.stripDomainAndProtocol(t.transformedData.twitter)))}),this.setState({isEditing:!1}),!0},t.prototype.stripDomain=function(n){return n.replace(/^https?\:\/\/(?:www\.)?([^\/?#]+)(?:[\/?#]|$)/i,"")},t.prototype.rejectChanges=function(){this.getContext(function(n){return n.transformedData.facebook}).setState(this.state.oldFacebook);this.getContext(function(n){return n.transformedData.twitter}).setState(this.state.oldTwitter);this.getContext(function(n){return n.transformedData.instagram}).setState(this.state.oldInstagram);this.getContext(function(n){return n.transformedData.googlePlus}).setState(this.state.oldGooglePlus);this.setState({isEditing:!1})},t.prototype.startEditing=function(){var n=this.props.context.getState();this.setState({isEditing:!0,oldFacebook:n.transformedData.facebook,oldTwitter:n.transformedData.twitter,oldInstagram:n.transformedData.instagram,oldGooglePlus:n.transformedData.googlePlus})},t}(FizzFormPartial);n.SocialPanel=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var i=function(n){function i(t){var i=n.call(this,t)||this;return i.listOfThingsCanBeAccepted=[],i.state=__assign({},n.prototype.createInitialState.call(i)),i}return __extends(i,n),i.prototype.createItem=function(){var n={CountryIsoCode:"gb"};return this.props.context.ensureKey(n),this.initialEditKey=n.key,n},i.prototype.renderNoItems=function(){return React.createElement("span",null)},i.prototype.renderInternal=function(){return this.listOfThingsCanBeAccepted.length=0,React.createElement("div",{className:"addressContainer"},React.createElement("div",{className:"addressItems"},this.renderItems()))},i.prototype.acceptChanges=function(){var n=!0;return _.each(this.listOfThingsCanBeAccepted.reverse(),function(t){t!=null&&(n=t.acceptChanges()&&n)}),n},i.prototype.renderSingleItem=function(n,i,r){var u=this;return React.createElement(t,{context:i,otherProps:{itemRemover:r,initialEdit:(this.props.otherProps.initialEditKey||this.initialEditKey)==i.getState().key,allowEdits:this.props.otherProps.allowEdits},ref:function(n){return u.listOfThingsCanBeAccepted.push(n)}})},i}(FizzFormListPartial),t;n.AddressPanelList=i;t=function(n){function t(t){var i=n.call(this,t)||this;return i.state={isEditing:t.otherProps.initialEdit||!1},i}return __extends(t,n),t.prototype.render=function(){var n=this,u=this.state.isEditing?React.createElement("div",{className:"fieldButtons"},React.createElement("button",{"data-ats-id":"RejectChanges",className:"rejectChanges",onClick:function(){return n.rejectChanges()}})," ",React.createElement("button",{"data-ats-id":"AcceptChanges",className:"acceptChanges",onClick:function(){return n.acceptChanges()}})):this.props.otherProps.allowEdits?React.createElement("div",{className:"fieldButtons"},React.createElement("button",{"data-ats-id":"StartEditing",className:"editValue",onClick:function(){return n.startEditing()}})," ",React.createElement("button",{"data-ats-id":"Remove",className:"removeValue",onClick:function(){return n.props.otherProps.itemRemover()}})):"",t=this.props.context.getState(),i,r;return this.state.isEditing?i=React.createElement("div",{className:"addressDetails addressDetailsEditable"},React.createElement("input",{type:"text","data-ats-id":"AddressLine1",placeholder:"Address line 1",value:t.AddressLine1||"",onChange:function(t){return n.handleChange(t,n.getContext(function(n){return n.AddressLine1}))}}),React.createElement("input",{type:"text","data-ats-id":"AddressLine2",placeholder:"Address line 2",value:t.AddressLine2||"",onChange:function(t){return n.handleChange(t,n.getContext(function(n){return n.AddressLine2}))}}),React.createElement("input",{type:"text","data-ats-id":"AddressLine3",placeholder:"Address line 3",value:t.AddressLine3||"",onChange:function(t){return n.handleChange(t,n.getContext(function(n){return n.AddressLine3}))}}),React.createElement("input",{type:"text","data-ats-id":"AddressLine4",placeholder:"Address line 4",value:t.AddressLine4||"",onChange:function(t){return n.handleChange(t,n.getContext(function(n){return n.AddressLine4}))}}),React.createElement("input",{type:"text","data-ats-id":"PostCode",placeholder:"Post Code",value:t.PostCode||"",onChange:function(t){return n.handleChange(t,n.getContext(function(n){return n.PostCode}))}})):(r=this.props.context.getState(),i=React.createElement("div",{className:"addressDetails addressDetailsReadOnly","data-rc":"listing-body-address",onClick:function(){return n.startEditing()}},React.createElement("span",{className:"sunlighticon-map-pointer-o"}),React.createElement("span",{"data-ats-id":"ReadOnlyValue"},ContactUrlFormatter.getAddressOneLine(r)))),React.createElement("div",{"data-ats-id":"Address__"+t.key,className:"addressPanel "+(this.state.isEditing?"editing":"")},i,u)},t.prototype.handleChange=function(n,t){var i=n.target.value;t.setState(i)},t.prototype.acceptChanges=function(){console.log("accept changes");var n=this.props.context.getState();return this.state.isEditing&&(ModelHelpers.addressHasValues(n)?this.startGeocoding(n.AddressLine1||"",n.PostCode||""):this.props.otherProps.itemRemover(),this.setState({isEditing:!1})),!0},t.prototype.rejectChanges=function(){this.getContext(function(n){return n.AddressLine1}).setState(this.state.oldAddressLine1);this.getContext(function(n){return n.AddressLine2}).setState(this.state.oldAddressLine2);this.getContext(function(n){return n.AddressLine3}).setState(this.state.oldAddressLine3);this.getContext(function(n){return n.AddressLine4}).setState(this.state.oldAddressLine4);this.getContext(function(n){return n.PostCode}).setState(this.state.oldPostCode);this.setState({isEditing:!1})},t.prototype.startEditing=function(){if(this.props.otherProps.allowEdits){var n=this.props.context.getState();this.setState({isEditing:!0,oldAddressLine1:n.AddressLine1,oldAddressLine2:n.AddressLine2,oldAddressLine3:n.AddressLine3,oldAddressLine4:n.AddressLine4,oldPostCode:n.PostCode})}},t.prototype.startGeocoding=function(n,t){var r=this,i=[],u=t.split("|"),e,f;u.length>1?(i.push(u[1]),this.getContext(function(n){return n.PostCode}).setState(u[0])):(i.push(n+(n?",":"")+t),i.push(t));e=new google.maps.Geocoder;f=function(){var n=i.shift(),t;n?(console.log("Geocoding "+n),t={address:n},e.geocode(t,function(n,t){t==google.maps.GeocoderStatus.OK?r.finishGeocoding(!1,n[0].geometry.location.lat(),n[0].geometry.location.lng()):t==google.maps.GeocoderStatus.ZERO_RESULTS?f():r.finishGeocoding(!0,null,null)})):(console.log("Geocoding ran out of address formats"),r.finishGeocoding(!0,null,null))};f()},t.prototype.finishGeocoding=function(n,t,i){n?(this.getContext(function(n){return n.LocationRequiresUpdating}).setState(!0),this.getContext(function(n){return n.Latitude}).setState(null),this.getContext(function(n){return n.Longitude}).setState(null)):(this.getContext(function(n){return n.LocationRequiresUpdating}).setState(!1),this.getContext(function(n){return n.Latitude}).setState(t),this.getContext(function(n){return n.Longitude}).setState(i))},t}(FizzFormPartial);n.AddressPanel=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.listOfThingsCanBeAccepted=[],i.state=__assign({},t.prototype.createInitialState.call(i),{isAddingNew:!1}),i}return __extends(i,t),i.prototype.createItem=function(){var n={};return this.props.context.ensureKey(n),this.initialEditKey=n.key,n},i.prototype.renderNoItems=function(){var n=this;return this.props.otherProps.allowEdits?React.createElement("p",null,"You have no team members listed."," ",React.createElement("a",{onClick:function(){return n.addGroupingItem()},"data-ats-id":"AddTeamMember"},"Add a team member ",React.createElement("span",{className:"sunlighticon-plus"}))):React.createElement("span",null)},i.prototype.renderInternal=function(n){var t=this;return this.listOfThingsCanBeAccepted.length=0,n==0?this.renderNoItems():React.createElement("div",{className:"groupingContainer"+(this.props.otherProps.allowPrettyCards?" prettyGroupingContainer":""),"data-ats-id":this.props.otherProps.atsId},React.createElement("div",{className:"groupingItems"},this.renderItems()),this.props.otherProps.allowEdits&&n<this.props.otherProps.maxGroups?React.createElement("a",{onClick:function(){return t.addGroupingItem()},"data-ats-id":"AddTeamMember"},"Add another team member ",React.createElement("span",{className:"sunlighticon-plus"})):null)},i.prototype.acceptChanges=function(){var n=!0;return _.each(this.listOfThingsCanBeAccepted.reverse(),function(t){t!=null&&(n=t.acceptChanges()&&n)}),n},i.prototype.renderSingleItem=function(t,i,r){var u=this;return React.createElement(n.GroupingPanel,{ref:function(n){return u.listOfThingsCanBeAccepted.push(n)},context:i,otherProps:{itemRemover:r,initialEdit:this.initialEditKey==i.getState().key,allowEdits:this.props.otherProps.allowEdits,countryLookup:this.props.otherProps.countryLookup,isMain:this.props.otherProps.isMain,allowPrettyCards:this.props.otherProps.allowPrettyCards,allowJobTitle:this.props.otherProps.allowJobTitle}})},i.prototype.addGroupingItem=function(){var n={key:null,Label:"",JobTitle:"",Address:[],ContactInformations:[]};this.props.context.ensureKey(n);this.initialEditKey=n.key;t.prototype.addItem.call(this,n);this.setState({isEditing:!0})},i}(FizzFormListPartial);n.GroupingPanelList=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.listOfThingsCanBeAccepted=[],i.state={isEditing:n.otherProps.initialEdit||!1},i.boundHandleBodyClick=function(n){return i.handleBodyClick(n)},i}return __extends(i,t),i.prototype.componentDidMount=function(){document.body.addEventListener("click",this.boundHandleBodyClick)},i.prototype.componentWillUnmount=function(){var n=this;document.body.removeEventListener("click",function(){return n.boundHandleBodyClick})},i.prototype.render=function(){var n=this.props.context.getState();return this.listOfThingsCanBeAccepted.length=0,!this.props.otherProps.allowPrettyCards||this.props.otherProps.isMain||this.state.isEditing?this.renderFullWidth():this.renderCard()},i.prototype.renderCard=function(){var i=this,t=this.props.context.getState();return React.createElement("div",{className:"teamMemberCard","data-ats-id":"GroupingPanel__"+t.key},React.createElement("div",{className:"teamMemberCardInner"},this.props.otherProps.allowEdits?React.createElement("button",{onClick:function(){return i.startCardEditing()},className:"editValue","data-ats-id":"EditTeamMember"}):null,React.createElement("div",{className:"teamMemberFace"},React.createElement("img",{src:"/Contacts/Content/Images/HeadOutline.svg"})),React.createElement("div",{className:"teamMemberDetails"},React.createElement("div",{className:"teamMemberLabel","data-ats-id":"TeamMemberName_ReadOnly"},t.Label),React.createElement("div",{"data-ats-id":"TeamMemberJobTitle_ReadOnly"},t.JobTitle)),React.createElement(n.ContactInfoPanelList,{context:this.getContext(function(n){return n.ContactInformations}),otherProps:{allowEdits:!1,initialEditKey:null}}),React.createElement(n.AddressPanelList,{context:this.getContext(function(n){return n.Address}),otherProps:{allowEdits:!1,initialEditKey:null,countryLookup:this.props.otherProps.countryLookup}})))},i.prototype.startCardEditing=function(){this.setState({isEditing:!0})},i.prototype.handleBodyClick=function(n){this.addNewContactInfoElement==null||this.addNewContactInfoElement.contains(n.target)||this.setState({isNewContactInfoPanelOpen:!1})},i.prototype.onTeamNameAccepted=function(){if(this.acceptingChanges)return!1;this.acceptingChanges=!0;var n=this.acceptChanges(!0);if(this.acceptingChanges=!1,n)return this.setState({isEditing:!1}),!0},i.prototype.renderFullWidth=function(){var t=this,r=this.props.context.getState(),u=this.getContext(function(n){return n.ContactInformations}).getState()!=null?!0:!1,f=this.getContext(function(n){return n.Address}).getState()!=null&&this.getContext(function(n){return n.Address}).getState().length>0?React.createElement(n.AddressPanelList,{context:this.getContext(function(n){return n.Address}),otherProps:{countryLookup:this.props.otherProps.countryLookup,allowEdits:this.props.otherProps.allowEdits,initialEditKey:this.initialEditKey},ref:function(n){return t.listOfThingsCanBeAccepted.push(n)}}):null,i;u&&(i=React.createElement(n.ContactInfoPanelList,{ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.ContactInformations}),otherProps:{allowEdits:this.props.otherProps.allowEdits,initialEditKey:this.initialEditKey}}));var e=this.state.isNewContactInfoPanelOpen?this.renderAddContactTypeSelectionElement():null,o=this.props.otherProps.allowEdits?React.createElement("div",null,React.createElement("a",{onClick:function(){return t.toggleNewPanel()},"data-ats-id":"AddContactInformation"},"Add contact information",React.createElement("span",{className:"sunlighticon-plus"})),e):null,s=!this.props.otherProps.isMain&&this.props.otherProps.allowEdits?React.createElement("div",{className:"groupingName"},React.createElement("span",null,"Remove member and info",React.createElement("button",{className:"removeValue",onClick:function(){return t.props.otherProps.itemRemover()},"data-ats-id":"RemoveTeamMember"}))):null,h=this.props.otherProps.isMain?null:React.createElement("span",null,React.createElement(n.AlpinistFormTextRow,{atsId:"TeamMemberName",ref:function(n){return t.teamMemberName=n},context:this.getContext(function(n){return n.Label}),rowClassName:"contactGroupingLabelRow",allowEdits:this.props.otherProps.allowEdits,initialEdit:this.state.isEditing,placeholderText:"New Member",onBeforeAccepted:function(){return t.onTeamNameAccepted()},onBeforeCancelled:function(){return t.onTeamNameAccepted()}})),c=this.props.otherProps.isMain||!this.props.otherProps.allowJobTitle?null:React.createElement("span",null,React.createElement(n.AlpinistFormTextRow,{atsId:"TeamMemberJobTitle",ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},context:this.getContext(function(n){return n.JobTitle}),rowClassName:"contactGroupingLabelRow",allowEdits:this.props.otherProps.allowEdits,placeholderText:"Job title",emptyValuePrompt:"Add a job title"}));return React.createElement("div",{className:"groupedContact","data-ats-id":"GroupingPanel__"+r.key},React.createElement("div",{className:"groupedContactInformation"},h,React.createElement(FizzFormValidationMessage,{context:this.props.context,className:"groupedContactInformationValidationMessage"}),c,f,i,o),s)},i.prototype.toggleNewPanel=function(){this.setState({isNewContactInfoPanelOpen:!this.state.isNewContactInfoPanelOpen})},i.prototype.acceptChanges=function(n){var t=!0,i,u,f,r;return this.props.context.clearValidation(),_.each(this.listOfThingsCanBeAccepted.reverse(),function(n){n!=null&&(t=n.acceptChanges()&&t)}),this.teamMemberName==null||n||(t=this.teamMemberName.acceptChanges()&&t),i=this.props.context.getState(),this.props.otherProps.isMain||(u=!_.some(i.ContactInformations,function(n){return n.Value!=null&&n.Value.length>0})&&!_.some(i.Address,function(n){return ModelHelpers.addressHasValues(n)}),u?_.isEmpty(i.Label)?this.props.otherProps.itemRemover():(this.props.context.addValidationError("Team members must have an address or contact information"),t=!1):(f=i.Label.length+i.JobTitle.length,r=Sundance.Websites.Contacts.Features.Listing.JsonModels.IJsonContactGrouping.LABEL_MAX_LENGTH-1,f>r&&(this.props.context.addValidationError("The team members name and job title must be "+r+" characters or less"),t=!1))),t},i.prototype.renderAddContactTypeSelectionElement=function(){var n=this;return React.createElement("div",{key:"addNewContactType",ref:function(t){return n.addNewContactInfoElement=t},className:"addNewContactType"},React.createElement("ul",null,React.createElement("li",{"data-rc":"listing-add-email"},React.createElement("a",{"data-ats-id":"AddEmail",onClick:function(){return n.addEmailAddress()}},React.createElement("span",{className:"sunlighticon-envelope"}),"Email Address")),React.createElement("li",{"data-rc":"listing-add-landline"},React.createElement("a",{"data-ats-id":"AddLandline",onClick:function(){return n.addLandlinePhoneNumber()}},React.createElement("span",{className:"sunlighticon-phone-landline"}),"Landline Number")),React.createElement("li",{"data-rc":"listing-add-mobile"},React.createElement("a",{"data-ats-id":"AddMobile",onClick:function(){return n.addMobilePhoneNumber()}},React.createElement("span",{className:"sunlighticon-phone-mobile"}),"Mobile Number")),React.createElement("li",{"data-rc":"listing-add-fax"},React.createElement("a",{"data-ats-id":"AddFax",onClick:function(){return n.addFaxNumber()}},React.createElement("span",{className:"sunlighticon-arrow-right-circle"}),"Fax Number")),React.createElement("li",{"data-rc":"listing-add-website"},React.createElement("a",{"data-ats-id":"AddWebsite",onClick:function(){return n.addWebsite()}},React.createElement("span",{className:"sunlighticon-earth"}),"Website")),React.createElement("li",{"data-rc":"listing-add-address"},React.createElement("a",{"data-ats-id":"AddAddress",onClick:function(){return n.addAddress()}},React.createElement("span",{className:"sunlighticon-map-pointer-o"}),"Address"))))},i.prototype.addEmailAddress=function(){this.addContactItem({ContactDetailType:3})},i.prototype.addMobilePhoneNumber=function(){this.addContactItem({ContactDetailType:1})},i.prototype.addLandlinePhoneNumber=function(){this.addContactItem({ContactDetailType:0})},i.prototype.addFaxNumber=function(){this.addContactItem({ContactDetailType:2})},i.prototype.addWebsite=function(){this.addContactItem({ContactDetailType:7})},i.prototype.addAddress=function(){this.addAddressItem({CountryIsoCode:"gb",AllowInMaps:!0});this.props.context.clearValidation()},i.prototype.addContactItem=function(n){var t=this;this.props.context.ensureKey(n);this.initialEditKey=n.key;this.props.context.setRootState(function(i){var r=ReactFormHelpers.createUpdateSpecForCommand(i,t.getContext(function(n){return n.ContactInformations}),"$push",[n]);return React.addons.update(i,r)});this.setState({isNewContactInfoPanelOpen:!1,isEditing:!0});this.props.context.clearValidation()},i.prototype.addAddressItem=function(n){var t=this;this.props.context.ensureKey(n);this.initialEditKey=n.key;this.props.context.setRootState(function(i){var r=ReactFormHelpers.createUpdateSpecForCommand(i,t.getContext(function(n){return n.Address}),"$push",[n]);return React.addons.update(i,r)});this.setState({isEditing:!0,isNewContactInfoPanelOpen:!1})},i}(FizzFormPartial);n.GroupingPanel=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var i=function(n){function i(t){var i=n.call(this,t)||this,r;return i.listOfThingsCanBeAccepted=[],i.state=__assign({},n.prototype.createInitialState.call(i),{isAddingNew:!1}),r=i,i.handleBodyClickCapturedThis=function(n){r.handleBodyClick(n)},i}return __extends(i,n),i.prototype.createItem=function(){return{}},i.prototype.renderNoItems=function(){return React.createElement("span",null)},i.prototype.renderInternal=function(){return this.listOfThingsCanBeAccepted.length=0,React.createElement("div",{className:"contactInfoContainer"},React.createElement("div",{className:"contactInfoItems"},this.renderItems()))},i.prototype.componentDidMount=function(){document.body.addEventListener("click",this.handleBodyClickCapturedThis)},i.prototype.componentWillUnmount=function(){document.body.removeEventListener("click",this.handleBodyClickCapturedThis)},i.prototype.handleBodyClick=function(n){var t=this.refs.addNewContactType;t==null||t.contains(n.target)||this.setState({isAddingNew:!1})},i.prototype.acceptChanges=function(){var n=!0;return _.each(this.listOfThingsCanBeAccepted.reverse(),function(t){t!=null&&(n=t.acceptChanges()&&n)}),n},i.prototype.renderSingleItem=function(n,i,r){var u=this;return React.createElement(t,{ref:function(n){return u.listOfThingsCanBeAccepted.push(n)},context:i,otherProps:{itemRemover:r,initialEdit:(this.props.otherProps.initialEditKey||this.initialEditKey)==i.getState().key,allowEdits:this.props.otherProps.allowEdits}})},i}(FizzFormListPartial),t;n.ContactInfoPanelList=i;t=function(n){function t(t){var i=n.call(this,t)||this;return i.state={isEditing:t.otherProps.initialEdit||!1},i}return __extends(t,n),t.prototype.render=function(){var t=this,i,r,n,u;return this.props.otherProps.allowEdits&&(i=this.state.isEditing?React.createElement("div",{className:"fieldButtons"},React.createElement("button",{"data-ats-id":"RejectChanges",className:"rejectChanges",onClick:function(){return t.rejectChanges()}})," ",React.createElement("button",{"data-ats-id":"AcceptChanges",className:"acceptChanges",onClick:function(){return t.acceptChanges()}})):React.createElement("div",{className:"fieldButtons"},React.createElement("button",{"data-ats-id":"StartEditing",className:"editValue",onClick:function(){return t.startEditing()}})," ",React.createElement("button",{"data-ats-id":"Remove",className:"removeValue",onClick:function(){return t.props.otherProps.itemRemover()}}))),n=this.props.context.getState(),u=this.props.context.getValidationMessage()==null,r=this.state.isEditing?React.createElement("div",{className:"contactInfo contactInfoEditable"},React.createElement("input",{type:"text",className:u?"":"input-validation-error",placeholder:this.getPlaceholderText(n.ContactDetailType),value:n.Value,onChange:function(n){return t.handleChange(n)},onKeyDown:function(n){return t.onKeyDown(n)}})):React.createElement("div",{className:"contactInfo contactInfoReadOnly",onClick:function(){return t.startEditing()}},React.createElement("span",{className:this.getIconClassName(n.ContactDetailType)}),React.createElement("a",__assign({"data-ats-id":"ReadOnlyValue",target:"_blank",href:ContactUrlFormatter.getUrl(n.Value,n.ContactDetailType),"data-rc":"listing-body-"+this.getPlaceholderText(n.ContactDetailType),dangerouslySetInnerHTML:ContactUrlFormatter.getHtml(n.Value,n.ContactDetailType)},ContactUrlFormatter.getAnchorProperties(n.Value,n.ContactDetailType)))),React.createElement("div",{"data-ats-id":"ContactInfo__"+n.key,className:"contactInfoPanel "+(this.state.isEditing?"editing":"")},r,i,React.createElement(FizzFormValidationMessage,{context:this.props.context}))},t.prototype.handleChange=function(n){var t=n.target.value;this.getContext(function(n){return n.Value}).setState(t)},t.prototype.onKeyDown=function(n){(n.key=="Tab"||n.key=="Enter")&&(n.preventDefault(),this.acceptChanges())},t.prototype.getPlaceholderText=function(n){switch(n){case 3:return"Email address";case 1:return"Mobile phone number";case 0:return"Landline number";case 6:return"Phone/fax number";case 7:return"Website";case 2:default:return"Fax number"}},t.prototype.getIconClassName=function(n){switch(n){case 3:return"sunlighticon-envelope";case 1:return"sunlighticon-phone-mobile";case 0:return"sunlighticon-phone-landline";case 6:return"sunlighticon-phone-landline";case 7:return"sunlighticon-earth";case 2:default:return"sunlighticon-arrow-right-circle"}},t.prototype.acceptChanges=function(){var n=this.props.context.getState(),t;return n==null||n.Value==null||n.Value.length==0?(this.props.otherProps.itemRemover(),!0):(t=this.props.context.validate(n.Value,this.props.context)==null,t&&this.setState({isEditing:!1}),t)},t.prototype.rejectChanges=function(){var n=this.state.oldValue;this.getContext(function(n){return n.Value}).setState(n);this.setState({isEditing:!1})},t.prototype.startEditing=function(){if(this.props.otherProps.allowEdits){var n=this.props.context.getState();this.setState({isEditing:!0,oldValue:n.Value,label:n.Label})}},t}(FizzFormPartial);n.ContactInfoPanel=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(){return t!==null&&t.apply(this,arguments)||this}return __extends(i,t),i.prototype.showMap=function(n){var t=this.props.context.getState();this.props.context.setRootState(function(i){for(var f,u={data:{transformedData:{unlabelledGrouping:{},labelledGrouping:{}}}},r=0;r<t.transformedData.unlabelledGrouping.length;r++)for(f=0;f<t.transformedData.unlabelledGrouping[r].Address.length;f++)u.data.transformedData.unlabelledGrouping[r]=u.data.transformedData.unlabelledGrouping[r]||{},u.data.transformedData.unlabelledGrouping[r].Address=u.data.transformedData.unlabelledGrouping[r].Address||{},u.data.transformedData.unlabelledGrouping[r].Address[f]={},u.data.transformedData.unlabelledGrouping[r].Address[f].AllowInMaps={$set:n};for(r=0;r<t.transformedData.labelledGrouping.length;r++)for(f=0;f<t.transformedData.labelledGrouping[r].Address.length;f++)u.data.transformedData.labelledGrouping[r]=u.data.transformedData.labelledGrouping[r]||{},u.data.transformedData.labelledGrouping[r].Address=u.data.transformedData.labelledGrouping[r].Address||{},u.data.transformedData.labelledGrouping[r].Address[f]={},u.data.transformedData.labelledGrouping[r].Address[f].AllowInMaps={$set:n};return React.addons.update(i,u)})},i.prototype.render=function(){var t=this,i=this.props.otherProps.mapLat!=null;return this.props.otherProps.allowEdits?i?this.props.otherProps.mapIsAllowed?React.createElement("div",{className:"mapOuter"},React.createElement(n.RawGoogleMap,{mapDivId:"googleMap",lat:this.props.otherProps.mapLat,lng:this.props.otherProps.mapLng}),React.createElement("button",{"data-ats-id":"HideMap",onClick:function(){return t.showMap(!1)}},"Hide map")):React.createElement("div",{className:"mapOuter"},React.createElement("div",{className:"mapMessage"},React.createElement("p",{"data-ats-id":"MapHiddenMessage"},"The map will be hidden on your listing."),React.createElement("button",{"data-ats-id":"ShowMap",onClick:function(){return t.showMap(!0)}},"Show map"))):React.createElement("div",{className:"mapOuter"},React.createElement("div",{className:"mapMessage"},"A map will appear here after you update your address")):i&&this.props.otherProps.mapIsAllowed?React.createElement("div",{className:"mapOuter"},React.createElement(n.RawGoogleMap,{mapDivId:"googleMap",lat:this.props.otherProps.mapLat,lng:this.props.otherProps.mapLng})):React.createElement("span",null)},i}(FizzFormPartial);n.ListingGoogleMap=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(){var n=t!==null&&t.apply(this,arguments)||this;return n.listOfThingsCanBeAccepted=[],n}return __extends(i,t),i.prototype.render=function(){var t=this;this.listOfThingsCanBeAccepted.length=0;var i=this.props.context.getState(),f=_.keyBy(i.FacetValues.map(function(n){return n.FacetName})),u=this.props.otherProps.facetNameInfos.sort(function(n,t){return n.SortOrder-t.SortOrder}),r={};return i.FacetValues.forEach(function(n){return r[n.FacetName]=!0}),this.props.otherProps.facetNameInfos,React.createElement("div",{className:"facetListItemContainer"},u.filter(function(n){return t.props.otherProps.allowedFacetNames[n.FacetName]!=null&&!t.isIgnoredFacetName(n.FacetName)&&(t.props.otherProps.AllowEditMode?!0:r[n.FacetName])}).map(function(i){return React.createElement("div",{className:"formRow",key:i.FacetName,"data-ats-id":"FacetNameContainer__"+i.FacetName,"data-ats-value":i.FacetName},React.createElement("label",null,i.FacetName),React.createElement(n.FacetValueList,{context:t.getContext(function(n){return n.FacetValues}),ref:function(n){return t.listOfThingsCanBeAccepted.push(n)},otherProps:{facetNameInfo:i,allowEdits:t.props.otherProps.AllowEditMode,availableFeatures:t.props.otherProps.allowedFeatures}}))}))},i.prototype.acceptChanges=function(){var u=this,i=!0,n,r,t;for(_.each(this.listOfThingsCanBeAccepted.reverse(),function(n){n!=null&&(i=n.acceptChanges()&&i)}),n=this.props.context.getState().FacetValues,r=this.getContext(function(n){return n.FacetValues}),t=n.length-1;t>=0;t--)(function(t){if(n[t].ValuePath==null||n[t].ValuePath.length==0){var i=u.getContext(function(){return n[t]});i.prefix=ReactFormHelpers.getPropertyPath(r);i.arrayAccessors.push(n[t].key);i.clearValidation();u.props.context.setRootState(function(n){var i=ReactFormHelpers.createUpdateSpecForCommand(n,r,"$splice",[[t,1]]);return React.addons.update(n,i)})}})(t);return i},i.prototype.isIgnoredFacetName=function(n){return this.props.otherProps.ignoreFacetNames[n]||!1},i}(FizzFormPartial);n.FacetNameList=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var r=function(n){function i(t){var i=n.call(this,t)||this;return i.PRIMARY_IMAGE_SIZE=200,i.cropperInittedForUrl="INITIAL_VALUE",i.onZoomOrOffsetChangedDebounced=_.debounce(function(){return i.onZoomOrOffsetChangedRaw()},250),i.state={isEditing:!1},i}return __extends(i,n),i.prototype.uploadProgress=function(n){this.setState({uploadProgress:n})},i.prototype.uploadCompleted=function(n){var u=this,t;if(n!=null)var f=this.props.otherProps.cropWidth/n.OriginalWidth,e=this.props.otherProps.cropHeight/n.OriginalHeight,i=Math.min(f,e),o=(this.props.otherProps.cropWidth-n.OriginalWidth*i)/2,s=(this.props.otherProps.cropHeight-n.OriginalHeight*i)/2,r={key:"",CropXOffset:o,CropYOffset:s,CropWidth:n.OriginalWidth,CropHeight:n.OriginalHeight,ExternalId:n.ExternalId,IsPublic:!0,OriginalFileUrl:n.Url,Url:n.Url,OriginalWidth:n.OriginalWidth,OriginalHeight:n.OriginalHeight,Rotation:0};else r=null;this.props.context.setRootState(function(n){return React.addons.update(n,ReactFormHelpers.createUpdateSpecForValue(n,u.props.context,r))});t={isEditing:!0,uploadProgress:null};n===null&&(t.cropItInitialising=!1);this.setState(t)},i.prototype.render=function(){var n=this.props.context.getState()||{key:"",CropXOffset:0,CropYOffset:0,CropWidth:this.props.otherProps.cropWidth,CropHeight:this.props.otherProps.cropHeight,ExternalId:"",IsPublic:!0,OriginalFileUrl:"",OriginalWidth:0,OriginalHeight:0,Rotation:0,ImageCredit:"",ImageDescription:""};return this.props.otherProps.allowEdit?this.renderEditMode(n):this.renderViewMode(n)},i.prototype.renderViewMode=function(n){var i,t;return n==null||_.isEmpty(n.ExternalId)?null:(i=n.CropWidth==n.CropHeight?"square":n.CropWidth>n.CropHeight?"landscape":"portrait",(n.Rotation==90||n.Rotation==270)&&(t=[n.CropHeight,n.CropWidth],n.CropWidth=t[0],n.CropHeight=t[1]),React.createElement("div",{className:"primaryListingImage readOnly","data-ats-id":"PrimaryImage"},React.createElement("div",{className:"imageContainer aspectRatio_square"},React.createElement("img",{src:CloudinaryHelpers.generateDisplayUrl(n.ExternalId,n.OriginalWidth,n.OriginalHeight,n.CropXOffset,n.CropYOffset,n.CropWidth,n.CropHeight,this.PRIMARY_IMAGE_SIZE,this.PRIMARY_IMAGE_SIZE,!0),width:this.PRIMARY_IMAGE_SIZE,height:this.PRIMARY_IMAGE_SIZE,"data-ats-id":"ReadOnlyValue"}))))},i.prototype.renderEditMode=function(n){var i=this,r=this.state.uploadProgress==null&&n!=null&&!_.isEmpty(n.ExternalId),u,f,e;return r?this.state.isEditing||(f=React.createElement("div",{className:"preEditButtons"},React.createElement("button",{className:"editValue alwaysHover",onClick:function(){return i.startEditing()},"data-ats-id":"StartEditing"})," ",React.createElement("button",{className:"removeValue alwaysHover",onClick:function(){return i.removeImage()},"data-ats-id":"Remove"}))):u=this.state.uploadProgress!=null?React.createElement("div",{className:"noImageInner","data-ats-id":"PrimaryImage"},React.createElement("p",null,"Uploading..."),React.createElement("p",null,this.state.uploadProgress,"%")):React.createElement("div",{className:"noImageInner","data-ats-id":"PrimaryImage"},React.createElement("p",null,"You can upload a logo"),React.createElement("button",{onClick:function(){return i.uploadForm.clickFileInput()},"data-ats-id":"StartUpload"},"Choose logo")),e=React.createElement("div",{className:"cropit-tools"},React.createElement("div",{className:"cropit-tools-inner"},React.createElement("div",{className:"zoomTools"},React.createElement("span",{className:" icon sunlighticon-magnifier-minus"}),React.createElement("input",{type:"range",className:"cropit-image-zoom-input",min:"0",max:"1",step:"0.1"}),React.createElement("span",{className:"icon sunlighticon-magnifier-plus"})),React.createElement("div",{className:"leftControls"},React.createElement("button",{onClick:function(){return i.rotateCcw()}},React.createElement("span",{className:"sunlighticon-undo rotate-ccw-btn"})),React.createElement("button",{onClick:function(){return i.rotateCw()}},React.createElement("span",{className:"sunlighticon-redo rotate-cw-btn"}))),React.createElement("button",{onClick:function(){return i.uploadForm.clickFileInput()}},React.createElement("span",{className:"sunlighticon-upload"})),React.createElement("div",{className:"rightControls"},React.createElement("button",{className:"acceptChanges",onClick:function(){return i.acceptChanges()},"data-ats-id":"AcceptChanges"}),React.createElement("button",{className:"rejectChanges",onClick:function(){return i.rejectChanges()},"data-ats-id":"RejectChanges"})))),React.createElement("div",{className:"primaryListingImage "+(r?"hasImage":"noImage")+" "+(this.state.isEditing?"isEditing":"notEditing"),"data-ats-id":"PrimaryImage"},React.createElement("div",{id:"cropit_image_cropper",ref:function(n){return i.cropItContainer=n}},React.createElement("div",{className:"imageContainer"},React.createElement("div",{className:"cropit-preview",style:{width:this.props.otherProps.cropWidth,height:this.props.otherProps.cropHeight}},u),React.createElement("div",{className:"cropit-mouse-blocker"}),f,React.createElement(t,{ref:function(n){return i.uploadForm=n},objectId:this.props.otherProps.id,dataUrl:this.props.otherProps.cloudinarySettings.UploadUrl,dataFormData:this.props.otherProps.cloudinarySettings.CloudinaryUploadParams,onUploadProgress:function(n){return i.uploadProgress(n)},onUploadCompleted:function(n){return i.uploadCompleted(n)}}),this.state.cropItInitialising?React.createElement("div",{className:"cropitItLoading"},React.createElement("p",null,"Loading image...")):null),e))},i.prototype.removeImage=function(){this.uploadCompleted(null);this.setState({isEditing:!1,cropItInitialising:!1})},i.prototype.acceptChanges=function(){this.setState({isEditing:!1})},i.prototype.rejectChanges=function(){var n=this,t=this.state.oldValue;this.props.context.setRootState(function(i){return React.addons.update(i,ReactFormHelpers.createUpdateSpecForValue(i,n.props.context,t))});this.setState({isEditing:!1});this.cropperInittedForUrl=null},i.prototype.startEditing=function(){var n=this.props.context.getState();this.props.otherProps.allowEdit&&this.setState({isEditing:!0,oldValue:JSON.parse(JSON.stringify(n))})},i.prototype.componentDidMount=function(){this.initCropper()},i.prototype.componentDidUpdate=function(){this.initCropper()},i.prototype.initCropper=function(){var i=this,n=this.props.context.getState(),r=$(this.cropItContainer),u=n==null?null:n.OriginalFileUrl,s,h;if(this.cropperInittedForUrl!=u){if(r.cropit("disable"),r.cropit("destroy"),r.find(".cropit-preview-image-container").remove(),n!=null){var c=this.props.otherProps.cropWidth/n.CropWidth,l=this.props.otherProps.cropHeight/n.CropHeight,f=Math.min(c,l),a=-(n.CropXOffset*f),v=-(n.CropYOffset*f),e=n.OriginalFileUrl.lastIndexOf("/"),t=n.OriginalFileUrl.substring(0,e)+"/pg_1/a_0"+n.OriginalFileUrl.substring(e),o=t.lastIndexOf(".");o>=0&&(t=t.substr(0,o));t=t.replace(/\/upload\/v[^/]+/,"/upload");s={src:t,zoom:f,offset:{x:a,y:v},rotation:n.Rotation};h={imageState:s,initialZoom:.5,onZoomChange:function(){return i.onZoomOrOffsetChanged()},onOffsetChange:function(){return i.onZoomOrOffsetChanged()},onImageDropped:function(n){return i.onImageDropped(n)},onImageLoaded:function(n){return i.onImageLoaded(n)},onImageError:function(n){return i.onImageError(n)},minZoom:"fit",forceSmallImagesToCentre:!0,allowDragNDrop:!1};r.cropit(h);this.setState({cropItInitialising:!0})}else r.find(".cropit-preview-image").attr("src","data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"),this.state.cropItInitialising&&this.setState({cropItInitialising:!1});this.cropperInittedForUrl=u;console.log("Inited cropit for "+u)}window.cloudinaryFileUploadBlocked=this.state.isEditing?!1:!0},i.prototype.rotateCcw=function(){$(this.cropItContainer).cropit("rotateCCW")},i.prototype.rotateCw=function(){$(this.cropItContainer).cropit("rotateCW")},i.prototype.onImageLoaded=function(){this.setState({cropItInitialising:!1})},i.prototype.onImageDropped=function(n){$("#"+this.props.otherProps.id).prop("files",n.originalEvent.dataTransfer.files)},i.prototype.onImageError=function(n){this.uploadCompleted(null);n.code==1&&alert("The image that you have chosen is too small. Please provide an image that is bigger than "+this.props.otherProps.cropWidth+"x"+this.props.otherProps.cropHeight)},i.prototype.onZoomOrOffsetChanged=function(){this.onZoomOrOffsetChangedDebounced()},i.prototype.onZoomOrOffsetChangedRaw=function(){var u=$(this.cropItContainer),f=u.cropit("offset"),t=u.cropit("zoom"),e=u.cropit("rotation");if(t!=null&&e!=null&&f!=null){var n=this.props.context.getState(),o=Math.max(0,-Math.floor(f.x/t)),s=Math.max(0,-Math.floor(f.y/t)),i=Math.floor(this.props.otherProps.cropWidth/t),r=Math.floor(this.props.otherProps.cropHeight/t);i=Math.min(i,n.OriginalWidth);r=Math.min(r,n.OriginalHeight);o!=n.CropXOffset&&this.getContext(function(n){return n.CropXOffset}).setState(o);s!=n.CropYOffset&&this.getContext(function(n){return n.CropYOffset}).setState(s);i!=n.CropWidth&&this.getContext(function(n){return n.CropWidth}).setState(i);r!=n.CropHeight&&this.getContext(function(n){return n.CropHeight}).setState(r);e!=n.Rotation&&this.getContext(function(n){return n.Rotation}).setState(e)}},i}(FizzFormPartial),t,i;n.PrimaryListingImage=r;t=function(n){function t(){return n.call(this)||this}return __extends(t,n),t.prototype.render=function(){var n=this;return React.createElement("form",{className:"cloudinaryForm",ref:"CloudinaryUploadForm"},React.createElement("input",{ref:function(t){return n.cloudinaryfileupload=t},type:"file",name:"file","data-url":this.props.dataUrl,"data-form-data":this.props.dataFormData,"data-cloudinary-field":"test-field",className:"cloudinaryfileupload",multiple:!0}),React.createElement("input",{type:"hidden",name:"test-field"}))},t.prototype.clickFileInput=function(){this.cloudinaryfileupload.click()},t.prototype.uploadCompleted=function(n,t){if(t.result.resource_type!="image"||(t.result.format||"").toLowerCase()=="pdf"||(t.result.format||"").toLowerCase()=="psd"){alert("The file that you have uploaded was not recognised as image. Please try another file.");this.props.onUploadCompleted(null)}else{var r=new i;r.OriginalWidth=t.result.width;r.OriginalHeight=t.result.height;r.ExternalId=t.result.public_id;r.Url=t.result.secure_url;this.props.onUploadCompleted(r)}this.setState({percentComplete:0,uploading:!1});this.initCloudinaryUpload()},t.prototype.uploadFailed=function(n,t){var i=t!=null&&t.errorThrown=="Bad Request"&&t.loaded>t.maxFileSize;i?alert("Sorry, that file was too large. Please upload a file that is less than "+Math.floor(t.maxFileSize/1048576*100)/100+"Mb"):alert("Sorry, there was a problem using that image. Please try again or try another image.");this.props.onUploadCompleted(null);this.setState({percentComplete:0,uploading:!1});this.initCloudinaryUpload()},t.prototype.componentDidMount=function(){var n=this;this.initCloudinaryUpload();window[t.AUTOMATED_TEST_SUITE_UPLOAD_COMPLETE_DUMMY_CALLBACK]=function(t,i){return n.uploadCompleted(t,i)}},t.prototype.componentWillUnmount=function(){window[t.AUTOMATED_TEST_SUITE_UPLOAD_COMPLETE_DUMMY_CALLBACK]=null},t.prototype.initCloudinaryUpload=function(){var n=this,t=$(this.cloudinaryfileupload);t.cloudinary_fileupload({start:function(t,i){return n.onUploadStarted(t,i)},progress:function(t,i){return n.onUploadProgress(t,i)},fail:function(t,i){return n.uploadFailed(t,i)},done:function(t,i){return n.uploadCompleted(t,i)}})},t.prototype.onUploadStarted=function(){console.log("Starting direct upload...")},t.prototype.onUploadProgress=function(n,t){var i=Math.round(t.loaded*100/t.total);if(console.log("progress:"+i),this.props.onUploadProgress)this.props.onUploadProgress(i)},t.AUTOMATED_TEST_SUITE_UPLOAD_COMPLETE_DUMMY_CALLBACK="atsFileUploadComplete",t}(React.Component);n.CloudinaryUploadForm=t;i=function(){function n(){}return n}();n.ImageMetaData=i}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){function t(){return window.document.getElementById("googleMapsApi").getAttribute("data-api-key")}var i=function(n){function i(){var t=n!==null&&n.apply(this,arguments)||this;return t.state={googleMapsApiKey:""},t}return __extends(i,n),i.prototype.componentDidMount=function(){this.setState({googleMapsApiKey:t()})},i.prototype.render=function(){if(this.state.googleMapsApiKey&&this.props.lat!=null&&this.props.lng!=null){var n="https://www.google.com/maps/embed/v1/place?key="+t()+"&q="+this.props.lat+","+this.props.lng;return React.createElement("iframe",{className:"mapHolder hasMap","data-ats-id":"RawGoogleMap",src:n})}return React.createElement("div",{className:"mapHolder noMap"})},i.prototype.shouldComponentUpdate=function(n,t){return this.props.lat!=n.lat||this.props.lng!=n.lng||t.googleMapsApiKey!=this.state.googleMapsApiKey},i}(React.Component);n.RawGoogleMap=i}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.render=function(){var t=this,f=this.props.context.getState().FacetName,r=this.props.otherProps.facetValues,n=this.props.context.getState(),u=n.ValuePath,i=React.createElement("div",{className:"fieldButtons"},this.props.otherProps.showDeleteButton?React.createElement("button",{className:"removeValue",onClick:function(){return t.props.otherProps.itemRemover()},"data-ats-id":"Remove"}):null,this.props.otherProps.listAccepter?React.createElement("button",{"data-ats-id":"AcceptChanges",className:"acceptChanges",onClick:function(){return t.props.otherProps.listAccepter()}}):null);return this.props.otherProps.allowEdits?this.props.otherProps.facetNameInfo.IsDiscrete?React.createElement("div",{className:"listed-dropdown-box","data-ats-id":"FacetValueEditor__"+n.key,"data-ats-type":"Discrete"},React.createElement(FizzFormDropDown,{ref:"dropDownRow",context:this.getContext(function(n){return n.ValuePath}),valueToTextMap:this.props.otherProps.valueTextMap,values:r,includeBlankOption:this.props.otherProps.includeBlankOption})," ",i):React.createElement("div",{className:"textboxFacetValueEditor"},React.createElement("div",{className:"textboxFacetValueEditorInner","data-ats-id":"FacetValueEditor__"+n.key,"data-ats-type":"Continuous"},React.createElement(FormNumericTextRow,{ref:"dropDownRow",context:this.getContext(function(n){return n.ValuePath}),showLabel:!1,inclusiveLowerLimit:this.props.otherProps.facetNameInfo.InclusiveLowerLimit,inclusiveUpperLimit:this.props.otherProps.facetNameInfo.InclusiveUpperLimit,decimalPlaces:this.props.otherProps.facetNameInfo.DecimalPlaces}),this.props.otherProps.facetNameInfo.UnitSuffix==null?null:" "+this.props.otherProps.facetNameInfo.UnitSuffix," ",i),React.createElement(FizzFormValidationMessage,{context:this.props.context})):React.createElement("div",{className:"facetValue"},this.props.otherProps.isFirst?"":", ",u,this.props.otherProps.facetNameInfo.UnitSuffix||"")},t.prototype.validate=function(){if(!this.props.otherProps.facetNameInfo.IsDiscrete){var n=+this.props.context.getState().ValuePath;if(this.props.otherProps.facetNameInfo.InclusiveLowerLimit!=null&&n<this.props.otherProps.facetNameInfo.InclusiveLowerLimit)return this.props.context.addValidationError("Please enter a value greater than or equal to "+this.props.otherProps.facetNameInfo.InclusiveLowerLimit),!1;if(this.props.otherProps.facetNameInfo.InclusiveUpperLimit!=null&&n>this.props.otherProps.facetNameInfo.InclusiveUpperLimit)return this.props.context.addValidationError("Please enter a value less than or equal to "+this.props.otherProps.facetNameInfo.InclusiveUpperLimit),!1;this.props.context.clearValidation()}return!0},t.prototype.focus=function(){this.refs.dropDownRow.focus()},t}(FizzFormPartial);n.FacetValueEditor=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.editors=[],i.state=__assign({},t.prototype.createInitialState.call(i),{isEditing:!1}),i}return __extends(i,t),i.prototype.createItem=function(){return{FacetName:this.props.otherProps.facetNameInfo.FacetName}},i.prototype.renderNoItems=function(){var n=this;return this.props.otherProps.allowEdits?React.createElement("span",null,React.createElement("span",null,this.props.otherProps.facetNameInfo.IsDiscrete?"None selected.":"Not specified.")," ",React.createElement("a",{"data-ats-id":"AddFacetValue",onClick:function(){return n.addItem()}},"Add ",React.createElement("span",{className:"sunlighticon-plus"}))):null},i.prototype.renderInternal=function(n){var r=this,f,i,u;return this.editors.length=0,f=this.props.context.getState(),i=this.props.otherProps.facetNameInfo.GroupingHeading=="Contacts specialisation"?this.props.otherProps.availableFeatures.MaxAllowedSpecialisations:this.props.otherProps.facetNameInfo.FacetName=="Category"?this.props.otherProps.availableFeatures.MaxAllowedCategories:this.props.otherProps.facetNameInfo.DefaultListingLimit,u=n<i,n==0?this.renderNoItems():React.createElement("div",{"data-ats-id":"FacetValueContainer",className:"facetValueContainer "+(this.state.isEditing?"facetValueContainerEditing":"")},React.createElement("div",{className:"facetValueItems"},this.renderItems(),this.props.otherProps.allowEdits?this.state.isEditing?null:React.createElement("button",{"data-ats-id":"StartEditing",className:"editValue",onClick:function(){return r.startEditing()}}):null,this.state.isEditing?u?React.createElement("a",{"data-ats-id":"AddFacetValue",onClick:function(){return t.prototype.addItem.call(r)}},"Add another ",React.createElement("span",{className:"sunlighticon-plus"})):i==1?null:React.createElement("p",null,"You can only select ",i," options"):null))},i.prototype.addItem=function(){t.prototype.addItem.call(this);this.startEditing()},i.prototype.itemFilterCallback=function(n){return n.FacetName===this.props.otherProps.facetNameInfo.FacetName},i.prototype.renderSingleItem=function(t,i,r,u){var f=this,e=this.props.otherProps.facetNameInfo;return React.createElement(n.FacetValueEditor,{context:i,ref:function(n){return n!=null?f.editors.push(n):null},key:this.props.otherProps.facetNameInfo.FacetName,otherProps:{itemRemover:r,listAccepter:u==0?function(){return f.acceptChanges()}:null,facetNameInfo:e,facetValues:e.FacetValues,allowEdits:this.state.isEditing,showDeleteButton:!0,isFirst:u==0,includeBlankOption:!0}})},i.prototype.startEditing=function(){this.props.otherProps.allowEdits&&this.setState({isEditing:!0})},i.prototype.acceptChanges=function(){for(var r,n=!0,t=0,i=this.editors;t<i.length;t++)r=i[t],r.validate()||(n=!1);return n&&this.setState({isEditing:!1}),n},i}(FizzFormListPartial);n.FacetValueList=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.state=__assign({},t.prototype.createInitialState.call(i),{isEditing:!1}),i}return __extends(i,t),i.prototype.createItem=function(){return{FacetName:"Category"}},i.prototype.renderNoItems=function(){return console.log("PrettyListingCategoryList should never have zero items"),React.createElement("span",null)},i.prototype.renderInternal=function(n){var i=this,o=this.props.context.getState(),r,u=o.map(function(n,t){var i=n.ValuePath!=undefined?n.ValuePath.split(" > "):[],r=i.length>0?i[i.length-1].trim():"";return[t==0?"":", ",React.createElement("a",{href:SearchPageUrlGenerator.getSearchUrl(1,[{facetName:"Category",facetValues:i}])},r)]}),f,e;return u.length>0&&(r=React.createElement("span",{className:"tidbit"},"Category - ",React.createElement("span",{"data-ats-id":"ReadOnlyValue"},u))),f=this.props.otherProps.allowEdits?React.createElement("div",null,React.createElement("div",null,u.length==0?React.createElement("span",{className:"tidbit"},"Uncategorised",React.createElement("span",{"data-ats-id":"ReadOnlyValue"})):r," ",React.createElement("button",{className:"editValue",onClick:function(){return i.startEditing()},"data-ats-id":"StartEditing"}))):React.createElement("div",null,r),e=this.state.isEditing?React.createElement("div",{className:"categoryEditing"},React.createElement("a",{onClick:function(){return i.acceptChanges()}},"Accept these Categories"),React.createElement("button",{className:"acceptChanges",onClick:function(){return i.acceptChanges()},"data-ats-id":"AcceptChanges"}),this.renderItems(),n<this.props.otherProps.maxAllowedValues?React.createElement("a",{onClick:function(){return t.prototype.addItem.call(i)},"data-ats-id":"AddCategory"},"Add another category ",React.createElement("span",{className:"sunlighticon-plus"})):React.createElement("p",null,"You can only be in ",StringHelpers.pluralise(this.props.otherProps.maxAllowedValues," category"," categories"))):null,n==0?this.renderNoItems():React.createElement("div",{className:"facetValueContainer categoryValueContainer","data-ats-id":"CategoryContainer"},React.createElement("div",{className:"facetValueItems"},this.state.isEditing?e:f))},i.prototype.renderSingleItem=function(t,i,r,u,f){for(var c,a=this,e=this.props.otherProps.facetNameInfo,v=f>1,h=[],l={},s=null,o=0;o<e.FacetValues.length;o++)c=e.FacetValues[o].split(" > "),l[e.FacetValues[o]]=c.length>1?c.splice(1).join(" > "):"",s==null||e.FacetValues[o].startsWith(s)&&e.FacetValues[o][s.length+1]==">"||h.push(s),s=e.FacetValues[o];return h.push(s),React.createElement(n.FacetValueEditor,{context:i,otherProps:{listAccepter:u==0?function(){return a.acceptChanges()}:null,itemRemover:r,facetNameInfo:e,facetValues:h,allowEdits:this.props.otherProps.allowEdits,showDeleteButton:v,isFirst:u==0,valueTextMap:l,includeBlankOption:!0}})},i.prototype.startEditing=function(){this.props.otherProps.allowEdits&&this.setState({isEditing:!0})},i.prototype.acceptChanges=function(){this.setState({isEditing:!1})},i}(FizzFormListPartial);n.CategoryList=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var i=function(i){function r(n){var t=i.call(this,n)||this;return t.THUMBNAIL_WIDTH=190,t.THUMBNAIL_HEIGHT=190,t.state=__assign({},i.prototype.createInitialState.call(t),{isEditing:!1}),t}return __extends(r,i),r.prototype.isDragAndDropReorderingEnabled=function(){return this.props.otherProps.allowEdits},r.prototype.createItem=function(){throw"Cannot create an item this way.";},r.prototype.renderNoItems=function(){return React.createElement("span",null,"No additional images")},r.prototype.renderInternal=function(n){var t=this;return React.createElement("div",{className:"alpinistThumbnails","data-ats-id":this.props.otherProps.atsId},React.createElement("label",null,this.props.otherProps.headingText),React.createElement("div",{className:"formEditorControls"},this.renderItems(),React.createElement("div",{className:"alpinistThumbnailControls"},this.props.otherProps.allowEdits?React.createElement("p",null," Your listing can have up to ",StringHelpers.pluralise(this.props.otherProps.maxImages," "+this.props.otherProps.singularNoun," "+this.props.otherProps.pluralNoun)):null,this.props.otherProps.allowEdits&&n<this.props.otherProps.maxImages?React.createElement("button",{onClick:function(){return t.addImage()}},"Add ",this.props.otherProps.singularNoun):null)))},r.prototype.hackThumbSize=function(){this.setState({thumbnailAspectRatio:((this.state.thumbnailAspectRatio||0)+1)%3})},r.prototype.addImage=function(){var t=this,i=new n.ContactsCloudinaryUpload,r=this.props.context.sliceMetadata();i.showUploadDialog({cloudName:this.props.otherProps.cloudName,apiKey:this.props.otherProps.cloudinaryApiKey,uploadSignatureCallback:SundanceWebEndpoints.generateCloudinarySignature,stylesheetUrl:"//"+window.location.hostname+"/contacts/Features/Components/Cloudinary/CloudinaryStylesheet.scss",croppingAspectRatio:1,minImageWidth:200,minImageHeight:200,tags:this.props.otherProps.cloudinaryTagsForAdditionalImages,onSuccess:function(i){i!=null&&SundanceImageCreditDialogue.addCopyrightInfo({image:i,imageMetaData:r,successCallback:function(n){t.addItem(n)},isProfile:!1,previewImageAspectRatio:1,blurbAboveCreditTextBox:n.AlpinistContants.blurbAboveCreditTextBox,blurbAboveDescriptionTextBox:n.AlpinistContants.blurbAboveDescriptionTextBox})}})},r.prototype.acceptChanges=function(){return!0},r.prototype.itemFilterCallback=function(n,t){return this.props.otherProps.allowEdits||n.IsPublic&&t<this.props.otherProps.maxImages},r.prototype.renderSingleItem=function(i,r,u,f,e,o){var a=this,s,h,c,l;return this.state.thumbnailAspectRatio==1?(s=this.THUMBNAIL_WIDTH,h=this.THUMBNAIL_WIDTH*.8):this.state.thumbnailAspectRatio==2?(s=this.THUMBNAIL_WIDTH*.8,h=this.THUMBNAIL_WIDTH):(s=this.THUMBNAIL_WIDTH,h=this.THUMBNAIL_HEIGHT),c=function(){return a.props.otherProps.startGallery(f)},l=r.sliceMetadata(),React.createElement(t,{context:r,otherProps:{allowEdits:this.props.otherProps.allowEdits,itemReorder:o,thumbnailWidth:s,thumbnailHeight:h,galleryStarter:c,imageEditor:function(t){SundanceImageCreditDialogue.editCopyrightInfo({image:t,imageMetaData:l,successCallback:function(n){r.setState(n)},itemRemover:u,isProfile:!1,previewImageAspectRatio:1,blurbAboveCreditTextBox:n.AlpinistContants.blurbAboveCreditTextBox,blurbAboveDescriptionTextBox:n.AlpinistContants.blurbAboveDescriptionTextBox})}}})},r}(FizzFormListPartial),t;n.ImageThumbnails=i;t=function(n){function t(t){var i=n.call(this,t)||this;return i.state={isEditing:!1},i}return __extends(t,n),t.prototype.acceptChanges=function(){return!0},t.prototype.render=function(){var t=this,n=this.props.context.getState(),u=CloudinaryHelpers.generateDisplayUrl(n.ExternalId,n.OriginalWidth,n.OriginalHeight,n.CropXOffset,n.CropYOffset,n.CropWidth,n.CropHeight,this.props.otherProps.thumbnailWidth,this.props.otherProps.thumbnailHeight),i=!_.isEmpty(n.ImageCredit),r=!_.isEmpty(n.ImageDescription);return React.createElement("div",{className:"alpinistThumbnail","data-ats-id":"Image__"+n.key},React.createElement("div",{className:"imgWrapper",onMouseDown:function(n){return t.handleMouseClick(n,!1)},onMouseUp:function(n){return t.handleMouseClick(n,!0)}},React.createElement("img",{src:u}),this.props.otherProps.allowEdits?React.createElement("span",null,React.createElement("button",{className:FizzFormConstants.DRAG_HANDLE_CLASS_NAME}),React.createElement("button",{className:"editValue alwaysHover","data-ats-id":"Remove",onClick:function(){return t.editImage(n)}})):null),React.createElement("div",{className:"imageText"},i?"© ":null,i?n.ImageCredit:null,i&&r?" - ":null,r?n.ImageDescription:null))},t.prototype.editImage=function(n){this.props.otherProps.imageEditor(n)},t.prototype.getAspectRatioName=function(n){return n.CropWidth==n.CropHeight?"Square":n.CropWidth>n.CropHeight?"Landscape":"Portrait"},t.prototype.handleMouseClick=function(n,t){var i=$(n.target);i.is("button")||i.closest("button").length>0||(t?this.lastMouseX==n.pageX&&this.lastMouseY==n.pageY&&this.props.otherProps.galleryStarter():(this.lastMouseX=n.pageX,this.lastMouseY=n.pageY))},t}(FizzFormPartial);n.ImageThumbnail=t}(Alpinist||(Alpinist={})),function(n){var t=function(){function n(){}return n.prototype.showUploadDialog=function(n){var t=this;window.cloudinary.openUploadWidget({cloud_name:n.cloudName,api_key:n.apiKey,cropping:!0,showSkipCropButton:!1,upload_signature:n.uploadSignatureCallback,show_powered_by:!1,cropping_validate_dimensions:!0,cropping_aspect_ratio:n.croppingAspectRatio,min_image_width:n.minImageWidth,min_image_height:n.minImageHeight,sources:["local"],clientAllowedFormats:["png","gif","jpeg","jpg","bmp"],tags:n.tags,styles:{palette:{window:"#FFF",windowBorder:"#90A0B3",tabIcon:"#000",menuIcons:"#000",textDark:"#000000",textLight:"#FFFFFF",link:"#ea5d5a",action:"#000",inactiveTabIcon:"#0E2F5A",error:"#F44235",inProgress:"#0078FF",complete:"#20B832",sourceBg:"#E4EBF1"}},text:{en:{crop:{title:"Set the focal area of the photo. The full photo will be displayed in your gallery",crop_btn:"Set focal area"},local:{dd_title_single:"Drag and drop a photo here"},menu:{files:"Upload a photo"}}}},function(i,r){i==null?r.event=="success"&&(r.info.resource_type=="image"&&(r.info.format||"").toLowerCase()!="pdf"&&(r.info.format||"").toLowerCase()!="psd"?t.handleCloudinaryImageAdded(n,r):alert("The file that you have uploaded was not recognised as image. Please try another file.")):i.message=="User closed widget"||alert("There was a problem uploading your file. Please try again by uploading another jpg, png or bmp image.\n\nThe focal area of the photo must be at least "+n.minImageWidth+"x"+n.minImageHeight+".")})},n.prototype.handleCloudinaryImageAdded=function(n,t){var f=t.info.public_id,i=((t.info.coordinates||{}).custom||[])[0],e=t.info.secure_url,o=t.info.width,s=t.info.height,u,r;if(i==null)var h=0,c=0,l=t.width,a=t.height;else var h=i[0],c=i[1],l=i[2],a=i[3];if(u={imageId:f,originalUrl:e,originalWidth:o,originalHeight:s,cropX:h,cropY:c,cropWidth:l,cropHeight:a,rotation:0},r=this.convertData(u),r!=null)n.onSuccess(r)},n}();n.CloudinaryUploadBase=t}(CloudinaryUpload||(CloudinaryUpload={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.convertData=function(n){if(n.cropWidth==0||n.cropHeight==0||n.cropWidth==undefined||n.cropHeight==undefined)return alert("There was a problem cropping your image. Please try again"),null;return{key:null,IsPublic:!0,ExternalId:n.imageId,OriginalFileUrl:n.originalUrl,OriginalWidth:n.originalWidth,OriginalHeight:n.originalHeight,CropXOffset:n.cropX,CropYOffset:n.cropY,CropWidth:n.cropWidth,CropHeight:n.cropHeight,Rotation:0,ImageCredit:"",ImageDescription:""}},t}(CloudinaryUpload.CloudinaryUploadBase);n.ContactsCloudinaryUpload=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){function t(n){var t=$("<div class='photoCredit leafworm'><\/div>").appendTo("body"),i=n.itemRemover,r=n.profileGallerySwitcher,f={initialData:n.image,metadata:n.formMetadata,otherProps:{imageInfoModalSuccessCallback:function(i){ReactDOM.unmountComponentAtNode(t[0]);n.imageInfoModalSuccessCallback(i)},cancelCallback:function(){ReactDOM.unmountComponentAtNode(t[0])},itemRemover:i!=undefined?function(){return i()}:undefined,isNew:n.isNew,profileGallerySwitcher:r!=undefined?function(){return r()}:undefined,isProfile:n.isProfile,previewImageAspectRatio:n.previewImageAspectRatio,blurbAboveCreditTextBox:n.blurbAboveCreditTextBox,blurbAboveDescriptionTextBox:n.blurbAboveDescriptionTextBox}},e=React.createElement(u,__assign({},f));ReactDOM.render(e,t[0])}function i(n){t({imageInfoModalSuccessCallback:n.successCallback,formMetadata:n.imageMetaData,image:n.image,isNew:!1,isProfile:n.isProfile,itemRemover:n.itemRemover,profileGallerySwitcher:n.profileGallerySwitcher,previewImageAspectRatio:n.previewImageAspectRatio,blurbAboveCreditTextBox:n.blurbAboveCreditTextBox,blurbAboveDescriptionTextBox:n.blurbAboveDescriptionTextBox})}function r(n){t({imageInfoModalSuccessCallback:n.successCallback,formMetadata:n.imageMetaData,image:n.image,isNew:!0,isProfile:n.isProfile,previewImageAspectRatio:n.previewImageAspectRatio,blurbAboveCreditTextBox:n.blurbAboveCreditTextBox,blurbAboveDescriptionTextBox:n.blurbAboveDescriptionTextBox})}n.editCopyrightInfo=i;n.addCopyrightInfo=r;var u=function(n){function t(t){var i=n.call(this,t)||this;return i.IMAGE_WIDTH=200,i.state={data:i.props.initialData,validationStates:{},otherState:undefined},i}return __extends(t,n),t.prototype.render=function(){var n=this,e=this.props.initialData.ExternalId,t=this.props.otherProps.isNew,r=t?"Add a photo":"Modify photo",u=t?"Cancel upload":"Cancel",i=this.props.otherProps.isProfile,f=this.props.otherProps.profileGallerySwitcher!=null;return React.createElement("div",{className:"eclipse"},React.createElement("div",{className:"eclipseWrapper"},React.createElement("div",{className:"eclipseContent photoCreditModal"},React.createElement("h3",null,r),React.createElement("span",{className:"mobileButtons"},React.createElement("button",{className:"removeValue",onClick:function(t){t.stopPropagation();n.handleDeleteClick()}}),React.createElement("button",{className:"swapValue",onClick:function(t){t.stopPropagation();n.handleProfileGallerySwap()}})),React.createElement("div",{className:"imageContainer"},React.createElement("img",{width:this.IMAGE_WIDTH,height:this.IMAGE_WIDTH*(1/this.props.otherProps.previewImageAspectRatio),src:CloudinaryHelpers.generateDisplayUrl(this.props.initialData.ExternalId,this.props.initialData.OriginalWidth,this.props.initialData.OriginalHeight,this.props.initialData.CropXOffset,this.props.initialData.CropYOffset,this.props.initialData.CropWidth,this.props.initialData.CropHeight,this.IMAGE_WIDTH,this.IMAGE_WIDTH*(1/this.props.otherProps.previewImageAspectRatio))}),t?null:React.createElement("div",{className:"verticleButtonContainer"},React.createElement("button",{onClick:function(t){t.stopPropagation();n.handleDeleteClick()}},i?"Upload new photo":"Delete image"),i||!f?null:React.createElement("button",{onClick:function(t){t.stopPropagation();n.handleProfileGallerySwap()}},"Set as main photo"))),React.createElement("div",{className:"imageInfoContainer contentBody"},this.props.otherProps.blurbAboveCreditTextBox,React.createElement("div",{className:"fizzFormRow"},React.createElement(StringAutoCompleteDropdown,{itemSearchCallback:function(t,i){return n.doAjaxSearch(t,i)},onTextChanged:function(t){return n.onValueChanged(t)},onItemSelected:function(t){n.onValueChanged(t);SundanceTracking.autocompleteSelectionEvent(t,SundanceTracking.DropdownTypes.photographerSearch)},onBlur:function(t){return n.photographerCreditBlur(t)},placeholder:ReactFormHelpers.getDisplayName(this.getContext(function(n){return n.ImageCredit})),initialValue:this.props.initialData.ImageCredit,dataAtsId:"PhotoEditDialogCredit"}),React.createElement(FizzFormValidationMessage,{context:this.getContext(function(n){return n.ImageCredit})})),this.props.otherProps.blurbAboveDescriptionTextBox,React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.ImageDescription}),dataAtsId:"PhotoEditDialogDescription"}),React.createElement("div",{className:"buttonContainer"},React.createElement("button",{onClick:function(){return n.updateImageWithCredit()},"data-ats-id":"PhotoEditDialogOk"},"OK"),React.createElement("button",{onClick:function(){return n.props.otherProps.cancelCallback()},"data-ats-id":"PhotoEditDialogCancel"},u))))))},t.prototype.handleDeleteClick=function(){var n=this.props.otherProps.itemRemover;n&&confirm("Are you sure that you want to remove this photo?")&&(n(),this.props.otherProps.cancelCallback())},t.prototype.handleProfileGallerySwap=function(){this.props.otherProps.profileGallerySwitcher&&this.props.otherProps.cancelCallback&&(this.props.otherProps.profileGallerySwitcher(),this.props.otherProps.cancelCallback())},t.prototype.photographerCreditBlur=function(){var n=this.getContext(function(n){return n.ImageCredit});n.validate(n.getState())},t.prototype.updateImageWithCredit=function(){this.getContext(function(n){return n.ImageCredit}).validate();this.isValid()&&this.props.otherProps.imageInfoModalSuccessCallback(this.state.data)},t.prototype.onValueChanged=function(n){this.getContext(function(n){return n.ImageCredit}).setState(n)},t.prototype.doAjaxSearch=function(n,t){var i=CommonEndpoints.getPhotographerNames(n,t);return function(){return i.abort()}},t}(FizzForm)}(SundanceImageCreditDialogue||(SundanceImageCreditDialogue={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.state={isEditing:!1},i}return __extends(i,t),i.prototype.render=function(){var t=this,i=this.props.context.getState(),r;return i==null?React.createElement("div",{className:"formRow"},React.createElement("p",null,React.createElement("a",{onClick:function(){return t.initBookStatusCallback()}},"Are your books open? ",React.createElement("span",{className:"sunlighticon-plus"}))),React.createElement(FizzFormValidationMessage,{context:this.props.context})):this.state.isEditing?React.createElement("div",{className:"facetListItemContainer"},React.createElement("div",{className:"formRow","data-ats-id":"FacetNameContainer__BookStatus","data-ats-value":"Book status"},React.createElement("label",null,"Books status"),React.createElement("div",{className:"facetValueContainer facetValueContainerEditing"},React.createElement("div",{className:"facetValueItems"},React.createElement("div",{className:"fizzListItem"},React.createElement(n.FacetValueEditor,{context:this.props.context,otherProps:{itemRemover:function(){return t.itemRemover()},listAccepter:function(){return t.acceptChanges()},facetNameInfo:this.props.otherProps.facetNameInfo,facetValues:this.props.otherProps.facetNameInfo.FacetValues,allowEdits:this.props.otherProps.allowEdits,showDeleteButton:!0,isFirst:!1,includeBlankOption:!1}})))))):(r=i.ValuePath,React.createElement("div",{className:"facetListItemContainer"},React.createElement("div",{className:"formRow","data-ats-id":"FacetNameContainer__BookStatus","data-ats-value":"Book status"},React.createElement("label",null,"Books status"),React.createElement("div",{className:"facetValueContainer"},React.createElement("div",{className:"facetValueItems"},React.createElement("div",{className:"fizzListItem"},React.createElement("div",{className:"facetValue"},r)),this.props.otherProps.allowEdits?React.createElement("button",{className:"editValue",onClick:function(){return t.editValue()}}):null)))))},i.prototype.acceptChanges=function(){if(this.props.context.getState()==null)return!1;var n={key:null,FacetName:this.props.otherProps.facetNameInfo.FacetName,ValuePath:this.getContext(function(n){return n.ValuePath}).getState()};return this.props.context.setState(n),this.setState({isEditing:!1}),!0},i.prototype.itemRemover=function(){this.props.context.setState(null)},i.prototype.startEditing=function(){this.props.otherProps.allowEdits&&this.setState({isEditing:!0})},i.prototype.initBookStatusCallback=function(){var n={key:null,FacetName:this.props.otherProps.facetNameInfo.FacetName,ValuePath:this.props.otherProps.facetNameInfo.FacetValues[0]};this.props.context.setState(n);this.setState({isEditing:!0})},i.prototype.editValue=function(){this.setState({isEditing:!0})},i}(FizzFormPartial);n.BooksStatus=t}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var i=function(n){function i(t){var i=n.call(this,t)||this;return i.state={isEditing:!1},i}return __extends(i,n),i.prototype.render=function(){var n=this,i=this.props.context.getState(),r,u;return i==null?React.createElement("div",{className:"carnivalItem"},React.createElement("p",null,React.createElement("a",{onClick:function(){return n.initDiscountCallback()}},"Do you offer a discount to Spotlight members?",React.createElement("span",{className:"sunlighticon-plus"}))),React.createElement(FizzFormValidationMessage,{context:this.props.context})):(r=React.createElement("div",{style:t.dropdownContainer},React.createElement(FizzFormDropDown,{context:this.getContext(function(n){return n.ValuePath}),values:this.props.otherProps.facetNameInfo.FacetValues})),u=this.state.isEditing?React.createElement("button",{className:"acceptChanges",onClick:function(){return n.acceptChanges()}}):React.createElement("span",null,React.createElement("button",{className:"removeValue",onClick:function(){return n.itemRemover()}}),React.createElement("button",{className:"editValue",onClick:function(){return n.startEditing()}})),React.createElement("div",{className:"discountWrapper",style:t.discountWrapper},this.props.otherProps.allowEdits?React.createElement("div",{style:t.editHolder},u):null,React.createElement("div",{className:"discountValue",style:t.discountValue},this.state.isEditing?r:i.ValuePath),React.createElement("div",{className:"discountMember",style:t.members}," discount for Spotlight members")))},i.prototype.acceptChanges=function(){if(this.props.context.getState()==null)return!1;var n={key:null,FacetName:this.props.otherProps.facetNameInfo.FacetName,ValuePath:this.getContext(function(n){return n.ValuePath}).getState()};return this.props.context.setState(n),this.setState({isEditing:!1}),!0},i.prototype.itemRemover=function(){this.props.context.setState(null)},i.prototype.startEditing=function(){this.props.otherProps.allowEdits&&this.setState({isEditing:!0})},i.prototype.initDiscountCallback=function(){var n={key:null,FacetName:this.props.otherProps.facetNameInfo.FacetName,ValuePath:this.props.otherProps.facetNameInfo.FacetValues[0]};this.props.context.setState(n);this.setState({isEditing:!0})},i.prototype.editValue=function(){this.setState({isEditing:!0})},i}(FizzFormPartial),t;n.MemberDiscount=i;t={discountWrapper:{marginTop:10,marginBottom:10,paddingTop:20,paddingBottom:20,background:"rgba(90, 181, 172, 0.4)",textAlign:"center",borderStyle:"dashed",borderColor:"#ea5d5a",borderWidth:2,position:"relative"},discountValue:{fontWeight:700,color:"black"},members:{color:"black",fontSize:12},editHolder:{top:5,right:5,position:"absolute"},dropdownContainer:{width:80,marginRight:"auto",marginLeft:"auto"}}}(Alpinist||(Alpinist={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){function i(n){var r=$("<div class='creditModal'><\/div>").appendTo("body"),t=n.credit.CreditStartDateUtcAsString?new Date(n.credit.CreditStartDateUtcAsString):null,i=n.credit.CreditEndDateUtcAsString?new Date(n.credit.CreditEndDateUtcAsString):null,f=DateHelpers.fullMonthNames,e={ajaxUrl:n.ajaxUrl,initialData:{credit:n.credit,startYear:n.isNewCredit||t==null?"":t.getFullYear().toString(),startMonth:n.isNewCredit||t==null||n.credit.CreditDisplayYearMonthDay==2?"":f[t.getMonth()],endYear:n.isNewCredit||i==null?"":i.getFullYear().toString(),endMonth:n.isNewCredit||i==null||n.credit.CreditDisplayYearMonthDay==2?"":f[i.getMonth()],currentlyStarring:t!=null&&i==null},metadata:n.formMetadata.map(function(n){return{name:"credit."+n.name,validators:n.validators,displayName:n.displayName}}),otherProps:{successCallback:function(t){ReactDOM.unmountComponentAtNode(r[0]);n.successCallback(t)},cancelCallback:function(){ReactDOM.unmountComponentAtNode(r[0])},isNewCredit:n.isNewCredit,allowedProductions:n.allowedProductions,allowedRoles:n.allowedRoles,allowedSecondaryRoles:n.allowedSecondaryRoles}},o=React.createElement(u,__assign({},e));ReactDOM.render(o,r[0])}n.showDialog=i;var r=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.render=function(){return FizzFormControls.RenderRow(this,n.prototype.render)},t}(FizzFormEnumDropDown),t=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.render=function(){return FizzFormControls.RenderRow(this,n.prototype.render)},t}(FizzFormEnumDropDown),u=function(n){function i(t){var i=n.call(this,t)||this;return i.MIN_YEAR=1900,i.MAX_YEAR=(new Date).getFullYear()+5,i.months=DateHelpers.fullMonthNames,i.productionsWithVenue=[46,31,33,32,44,51,17,15,14,16,43,1,23,27],i.state={data:t.initialData,validationStates:{},otherState:{showPageOne:!0,hasSecondaryRole:t.initialData.credit.SecondaryRole!=null,showFullForm:!i.props.otherProps.isNewCredit}},i}return __extends(i,n),i.prototype.onShowRoleDetails=function(){var n=this.getContext(function(n){return n.credit.ProductionType}).validate();n==null&&this.isValid()?this.updateOtherState({showPageOne:{$set:!1},showPageTwo:{$set:!0}}):alert("Please check that you have filled in all of the fields correctly.")},i.prototype.onShowProductionDetails=function(){this.isValid()?this.updateOtherState({showPageOne:{$set:!0},showPageTwo:{$set:!1}}):alert("Please check that you have filled in all of the fields correctly.")},i.prototype.componentWillMount=function(){this.oldBodyOverflowState=$("body").css("overflow");$("body").css("overflow","hidden")},i.prototype.componentWillUnmount=function(){$("body").css("overflow",this.oldBodyOverflowState)},i.prototype.startCreditSearch=function(n,t){if(n.length>2){var i=CommonEndpoints.getCreditInformation(n,t);return function(){return i.abort()}}},i.prototype.handleCreditSelected=function(n){var t,i;this.getContext(function(n){return n.credit.ProductionTitle}).setState(n.ProductionTitle);this.getContext(function(n){return n.credit.ProductionTitle}).validate(n.ProductionTitle);this.getContext(function(n){return n.credit.ProductionDirector}).setState(n.ProductionDirector);this.getContext(function(n){return n.credit.ProductionType}).setState(n.ProductionType);this.getContext(function(n){return n.credit.ProductionVenue}).setState(n.ProductionVenue);this.getContext(function(n){return n.credit.ProductionCompanyOrStudio}).setState(n.ProductionCompanyOrStudio);(n.ProductionType==4||n.ProductionType==13)&&(this.getContext(function(n){return n.credit.CreditDisplayYearMonthDay}).setState(n.DisplayYearMonthDay),n.StartDateUtc!=null&&(t=new Date(n.StartDateUtc),this.getContext(function(n){return n.startYear}).setState(t.getFullYear().toString()),n.DisplayYearMonthDay!=2&&this.getContext(function(n){return n.startMonth}).setState(DateHelpers.fullMonthNames[t.getMonth()])),n.EndDateUtc!=null&&(i=new Date(n.EndDateUtc),this.getContext(function(n){return n.endYear}).setState(i.getFullYear().toString()),n.DisplayYearMonthDay!=2&&this.getContext(function(n){return n.endMonth}).setState(DateHelpers.fullMonthNames[i.getMonth()])));this.switchProductionSearchForm(!1)},i.prototype.isFilm=function(n){return n==13||n==4},i.prototype.allowVenues=function(n){return this.productionsWithVenue.includes(n)?!0:!1},i.prototype.render=function(){var n=this,c=(new Date).getFullYear(),f=this.isFilm(this.state.data.credit.ProductionType),s=React.createElement("div",{className:"productionDetails modalSection"},this.state.otherState.showFullForm?React.createElement("div",null,React.createElement("div",null,"Confirm information by clicking next, or ",React.createElement("a",{onClick:function(){return n.switchProductionSearchForm(!1)}},"search again")),React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.ProductionTitle})}),React.createElement(r,{context:this.getContext(function(n){return n.credit.ProductionType}),values:_.keys(this.props.otherProps.allowedProductions),valueToTextMap:this.props.otherProps.allowedProductions,sortValues:function(n,t){return n.localeCompare(t)},onChange:function(t){return n.getContext(function(n){return n.credit.ProductionType}).validate(t==null?undefined:t.toString())},placeholder:"Production type"}),React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.ProductionCompanyOrStudio})}),React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.ProductionDirector})}),this.allowVenues(this.state.data.credit.ProductionType)?React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.ProductionVenue})}):null,React.createElement("button",{onClick:function(){return n.onShowRoleDetails()}},"Next")):React.createElement("div",null,React.createElement("div",null,"Search for a production by name or director, or type in a new one"),React.createElement(CreditAutoCompleteDropdown,{placeholder:"Type in the production title, director and/or venue",initialValue:this.getContext(function(n){return n.credit.ProductionTitle}).getState(),itemSearchCallback:function(t,i){return n.startCreditSearch(t,i)},onTextChanged:function(t){return n.getContext(function(n){return n.credit.ProductionTitle}).setState(t)},onItemSelected:function(t){return n.handleCreditSelected(t)},onNonItemEnterPress:function(){return n.switchProductionSearchForm(!0)},onFooterItemSelected:function(){return n.switchProductionSearchForm(!0)},itemSearchMinimumCharacters:3}))),e=parseInt(this.state.data.startYear,10),h=isNaN(e)?this.MIN_YEAR:e,i,u,o;switch(this.state.data.credit.Role){case 2:i=React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.CharacterName}),placeholderTextOverride:"Doubled as"});break;case 1:case 16:i=React.createElement(FizzFormControls.FizzFormPlaceholderTextBoxRow,{context:this.getContext(function(n){return n.credit.CharacterName})});break;default:i=null}return u=_.keys(this.props.otherProps.allowedRoles),o=React.createElement("div",{className:"roleDetails modalSection"},u.length>1?React.createElement(t,{context:this.getContext(function(n){return n.credit.Role}),values:u,valueToTextMap:this.props.otherProps.allowedRoles,sortValues:function(n,t){return n.localeCompare(t)},onChange:function(t){return n.handleRoleChange(t)}}):null,i,u.length>1?this.state.otherState.hasSecondaryRole?React.createElement(t,{context:this.getContext(function(n){return n.credit.SecondaryRole}),values:_.keys(this.props.otherProps.allowedSecondaryRoles),valueToTextMap:this.props.otherProps.allowedSecondaryRoles,sortValues:function(n,t){return n.localeCompare(t)},includeBlankOption:!0,placeholder:"Additional role (optional)"}):React.createElement("a",{onClick:function(){return n.onAdditionalRoleClick()}},"Did you have another non-performer role?"):null,React.createElement("div",{className:"modalFormDividerMessage"},"When did you appear on it?"),React.createElement("div",{className:"fizzFormRow"},React.createElement("div",{className:"dateControls "+(f?"hideMonth":"")},React.createElement("div",{className:"creditFrom"},React.createElement("div",null,"From"),React.createElement(FizzFormControls.FizzFormNumberBox,{context:this.getContext(function(n){return n.startYear}),placeholder:"Year",minValue:this.MIN_YEAR,maxValue:this.MAX_YEAR}),f?null:React.createElement(FizzFormDropDown,{context:this.getContext(function(n){return n.startMonth}),values:this.months,includeBlankOption:!0,placeholder:"Month"})),React.createElement("span",{className:"creditFromToSeparator"},"-"),React.createElement("div",{className:"creditTo"+(this.state.data.currentlyStarring?" disabled":"")},React.createElement("div",null,"To"),React.createElement(FizzFormControls.FizzFormNumberBox,{context:this.getContext(function(n){return n.endYear}),placeholder:"Year",minValue:h,maxValue:this.MAX_YEAR,isDisabled:this.state.data.currentlyStarring}),f?null:React.createElement(FizzFormDropDown,{context:this.getContext(function(n){return n.endMonth}),values:this.months,includeBlankOption:!0,placeholder:"Month",isDisabled:this.state.data.currentlyStarring}),React.createElement(FizzFormControls.FizzFormCheckBox,{context:this.getContext(function(n){return n.currentlyStarring}),labelOverride:"Ongoing",onChange:function(){return n.onOngoingChange()}}))),React.createElement(FizzFormValidationMessage,{context:this.getContext(function(n){return n.startYear})})),React.createElement("button",{onClick:function(){return n.addCreditToList()}},"Done")),React.createElement("div",{className:"eclipse"},React.createElement("div",{className:"eclipseWrapper "},React.createElement("div",{className:"creditDetailsContainer leafworm modalDialog eclipseContent"},React.createElement("h2",null,this.props.otherProps.isNewCredit?"New credit":"Change credit"),React.createElement("div",{className:"modalSectionHeading "+(this.state.otherState.showPageOne?"selected":"")},"1. PRODUCTION DETAILS",this.state.otherState.showPageOne?null:React.createElement("span",{className:"modalSectionSwap",onClick:function(){return n.onShowProductionDetails()}},"Change")),this.state.otherState.showPageOne?s:null,React.createElement("div",{className:"modalSectionHeading "+(this.state.otherState.showPageTwo?"selected":"")},"2. YOUR DETAILS"),this.state.otherState.showPageTwo?o:null,React.createElement("button",{onClick:function(){return n.props.otherProps.cancelCallback()}},"Cancel"))))},i.prototype.handleRoleChange=function(n){switch(n){case 1:case 2:break;default:this.getContext(function(n){return n.credit.CharacterName}).setState("")}},i.prototype.onAdditionalRoleClick=function(){this.updateOtherState({hasSecondaryRole:{$set:!0}})},i.prototype.switchProductionSearchForm=function(n){n&&(this.getContext(function(n){return n.credit.CharacterName}).setState(""),this.getContext(function(n){return n.credit.ProductionDirector}).setState(""),this.getContext(function(n){return n.credit.ProductionVenue}).setState(""),this.getContext(function(n){return n.credit.ProductionType}).setState(0),this.getContext(function(n){return n.credit.ProductionCompanyOrStudio}).setState(""));this.updateOtherState({showFullForm:{$set:!this.state.otherState.showFullForm}})},i.prototype.onOngoingChange=function(){this.getContext(function(n){return n.startYear}).clearValidation()},i.prototype.validateDateFields=function(){var n=this.getContext(function(n){return n.startYear}),t=undefined,i=undefined,u,r,f,e,o;if((this.state.data.startYear||"").trim()!=""){if(r=parseFloat(this.state.data.startYear),isNaN(r))return this.addValidationError(n,"Please enter a valid from year."),null;if(r<this.MIN_YEAR||r>this.MAX_YEAR)return this.addValidationError(n,"Please enter a starting year between "+this.MIN_YEAR+" and "+this.MAX_YEAR+"."),null;u=this.months.indexOf(this.state.data.startMonth);t=new Date(r,Math.max(u,0),1)}if(!this.state.data.currentlyStarring&&(this.state.data.endYear||"").trim()!=""){if(f=parseFloat(this.state.data.endYear),isNaN(f))return this.addValidationError(n,"Please enter a valid to year."),null;if(f>this.MAX_YEAR)return this.addValidationError(n,"Please enter a starting year between "+this.MIN_YEAR+" and "+this.MAX_YEAR+"."),null;e=this.months.indexOf(this.state.data.endMonth);i=this.state.data.endYear.trim()==""?undefined:new Date(parseFloat(this.state.data.endYear),Math.max(e,0),1)}return i!=null&&t==null?(this.addValidationError(n,"Please enter the from date."),null):i!=null&&t!=null&&i<t?(this.addValidationError(n,"Please enter a to date that is after the from date."),null):(o=u!=undefined&&u>=0?1:2,this.clearValidationForContext(n),{startDate:t,endDate:i,displayStyle:o})},i.prototype.componentDidUpdate=function(){this.awaitingValidation&&this.addCreditToListAfterValidation()},i.prototype.addCreditToList=function(){var n=this.validateDateFields();this.state.data.currentlyStarring||(this.state.data.endYear==""||this.state.data.endYear==null)&&this.state.data.startYear!=""&&(this.getContext(function(n){return n.endYear}).setState(this.state.data.startYear),(this.state.data.endMonth==""||this.state.data.endMonth==null)&&this.state.data.startMonth!=""&&this.getContext(function(n){return n.endMonth}).setState(this.state.data.startMonth));this.awaitingValidation=!0;this.forceUpdate()},i.prototype.addCreditToListAfterValidation=function(){var n,t;this.awaitingValidation=!1;this.isValid()?(n=this.validateDateFields(),n!=null&&(t={key:"",CharacterName:this.state.data.credit.CharacterName,ProductionCompanyOrStudio:this.state.data.credit.ProductionCompanyOrStudio,ProductionDirector:this.state.data.credit.ProductionDirector,ProductionTitle:this.state.data.credit.ProductionTitle,ProductionVenue:this.allowVenues(this.state.data.credit.ProductionType)?this.state.data.credit.ProductionVenue:"",CreditStartDateUtcAsString:n.startDate==null?"":n.startDate.toJSON(),CreditEndDateUtcAsString:this.state.data.currentlyStarring?"":n.endDate==null?"":n.endDate.toJSON(),CreditDisplayYearMonthDay:n.displayStyle,ProductionType:this.state.data.credit.ProductionType,Role:this.state.data.credit.Role,SecondaryRole:this.state.data.credit.SecondaryRole},this.props.otherProps.successCallback(t))):alert("Please check that you have filled in all of the fields correctly.")},i}(FizzForm)}(SundanceCreditDialogue||(SundanceCreditDialogue={}));var __extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),CreditAutoCompleteDropdown=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.renderItem=function(n){var t=n.StartDateUtc?DateHelpers.getFormattedDate(new Date(n.StartDateUtc),n.DisplayYearMonthDay):null,i=n.EndDateUtc?DateHelpers.getFormattedDate(new Date(n.EndDateUtc),n.DisplayYearMonthDay):null;return React.createElement(SundanceCredit.CreditItem,{creditRole:"",productionTitle:n.ProductionTitle,productionCompanyOrStudio:n.ProductionCompanyOrStudio,productionDirector:n.ProductionDirector,productionVenue:n.ProductionVenue,startDateText:t,endDateText:i,showApprovedBadge:n.IsApproved})},t.prototype.onItemSelected=function(n){this.setState({searchText:n.ProductionTitle})},t.prototype.onFooterItemSelected=function(){this.setState({searchText:""})},t.prototype.hasFooterItem=function(){return!0},t.prototype.renderFooterItem=function(){return React.createElement("a",null,"Add this production ",React.createElement("span",{className:"sunlighticon-plus"}))},t}(AutoCompleteDropdown),__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),SundanceCredit;(function(n){var t=function(n){function t(t){var i=n.call(this,t)||this;return i.months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],i.state={extraInfoExpanded:!1},i}return __extends(t,n),t.prototype.render=function(){var n=this.props.startDateText&&this.props.endDateText==null?"present":this.props.endDateText,t=n&&this.props.startDateText!=n;return React.createElement("div",{className:"creditItem "+(this.props.showApprovedBadge?"approved":"")},React.createElement("div",{className:"creditItemDate"},React.createElement("span",null,this.props.startDateText),t?" - ":null,t?React.createElement("span",null,n):null),React.createElement("div",{className:"creditItemInfos"},React.createElement("div",{className:"creditItemHeading"},React.createElement("span",{className:"creditItemTitle"},this.props.productionTitle),this.props.productionCompanyOrStudio?", "+this.props.productionCompanyOrStudio:""),_.isEmpty(this.props.creditRole)?null:React.createElement("span",{className:"creditRole"},this.props.creditRole),_.isEmpty(this.props.creditRole)?null:" ",React.createElement("dl",null,this.renderOptionalDdRow("Director:",this.props.productionDirector),this.renderOptionalDdRow("Venue:",this.props.productionVenue))))},t.prototype.renderOptionalDdRow=function(n,t){return t==null||t==""?[]:[React.createElement("dt",{key:n+"1"},n),React.createElement("dd",{key:n+"2"},t)]},t.prototype.formatDate=function(n){return n.getDate()+" "+this.months[n.getMonth()]+" "+n.getFullYear()},t}(React.Component);n.CreditItem=t})(SundanceCredit||(SundanceCredit={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();__assign=this&&this.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},function(n){var t=function(t){function i(n){var i=t.call(this,n)||this;return i.listOfThingsCanBeAccepted=[],i.state=__assign({},t.prototype.createInitialState.call(i),{isAddingNew:!1}),i}return __extends(i,t),i.prototype.createItem=function(){var n={};return this.props.context.ensureKey(n),this.initialEditKey=n.key,n},i.prototype.renderNoItems=function(){return React.createElement("span",null,"Nothing here")},i.prototype.renderInternal=function(){var n=this;return this.listOfThingsCanBeAccepted.length=0,React.createElement("span",null,this.renderItems(),this.props.otherProps.allowEdits?React.createElement("button",{onClick:function(){return n.renderNewCreditDialogue()}},"Add credit"):null)},i.prototype.isDragAndDropReorderingEnabled=function(){return this.props.otherProps.allowEdits},i.prototype.getDragAndDropOrientation=function(){return"vertical"},i.prototype.acceptChanges=function(){return!0},i.prototype.renderSingleItem=function(t,i,r){var u=this;return React.createElement(n.CreditListRow,{context:i,otherProps:{itemRemover:r,itemEditCallback:function(){return u.renderEditCreditDialogue(t,!1,function(n){return i.setState(n)})},allowEdits:this.props.otherProps.allowEdits,creditRoleDisplayNameLookup:this.props.otherProps.creditRoleDisplayNameLookup}})},i.prototype.renderNewCreditDialogue=function(){var t=this,n=this.createItem();n.Role=this.props.otherProps.defaultCreditRole;this.renderEditCreditDialogue(n,!0,function(n){return t.addItem(n)})},i.prototype.renderEditCreditDialogue=function(n,t,i){var r=this.props.context.sliceMetadata();SundanceCreditDialogue.showDialog({ajaxUrl:"",successCallback:function(n){i(n)},credit:n,isNewCredit:t,formMetadata:r,allowedProductions:this.props.otherProps.allowedProductions,allowedRoles:this.props.otherProps.allowedRoles,allowedSecondaryRoles:this.props.otherProps.allowedSecondaryRoles})},i}(FizzFormListPartial);n.CreditList=t}(SundanceCredit||(SundanceCredit={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(t){function i(n){return t.call(this,n)||this}return __extends(i,t),i.prototype.render=function(){var r=this,u;this.props.otherProps.allowEdits&&(u=React.createElement("div",{className:"foliateButtons"},React.createElement("button",{"data-ats-id":"StartEditing",className:"editValue",onClick:function(){return r.props.otherProps.itemEditCallback()}}),React.createElement("button",{"data-ats-id":"Remove",className:"removeValue",onClick:function(){return r.removeItem()}}),React.createElement("button",{className:FizzFormConstants.DRAG_HANDLE_CLASS_NAME})));var t=this.props.context.getState(),o=this.props.context.getValidationMessage()==null,f=t.CreditStartDateUtcAsString?DateHelpers.getFormattedDate(new Date(t.CreditStartDateUtcAsString),t.CreditDisplayYearMonthDay):"",e=t.CreditEndDateUtcAsString?DateHelpers.getFormattedDate(new Date(t.CreditEndDateUtcAsString),t.CreditDisplayYearMonthDay):"",i="";switch(t.Role){case 1:case 16:i+=t.CharacterName||"";break;case 2:i+=_.isEmpty(t.CharacterName)?"Stunt double":"Doubled as "+(t.CharacterName||"");break;case 0:i="";break;default:i+=this.props.otherProps.creditRoleDisplayNameLookup[t.Role]}return t.SecondaryRole!=null&&t.SecondaryRole!=0&&(i.length>0&&(i+=", "),i+=this.props.otherProps.creditRoleDisplayNameLookup[t.SecondaryRole]),React.createElement("div",{"data-ats-id":"CreditItem__"+t.key,className:"foliate creditsListItem "+(this.props.otherProps.allowEdits?"hasThreeButtons":"")},React.createElement("div",{className:"foliateValue"},React.createElement(n.CreditItem,{creditRole:i,productionTitle:t.ProductionTitle,productionCompanyOrStudio:t.ProductionCompanyOrStudio,productionDirector:t.ProductionDirector,productionVenue:t.ProductionVenue,startDateText:f,endDateText:e,showApprovedBadge:!1})),u)},i.prototype.removeItem=function(){confirm("Are you sure that you want to remove this credit?")&&this.props.otherProps.itemRemover()},i}(FizzFormPartial);n.CreditListRow=t}(SundanceCredit||(SundanceCredit={}))