").addClass("autocomplete-item").data(ele).text(ele.description);autoDiv.append(optionDiv)});this.typingField.parent().append(autoDiv)},handleBodyclick:function(){$("body").on("click",function(){$(".city-autocomplete").remove()})},handleAutocompleteItemClick:function(){var _this=this;$("body").on("click","div.autocomplete-item",function(){_this.typingField.val(this.innerText);_this.getCityCountry($(this).data("key"))})},getCityCountry:function(key){var _this=this;$.ajax({type:"GET",url:"https://mobile.homify.de/api/v1.0/placeDetails",dataType:"json",data:{key:key,language:_this.language},success:function(response){_this.setCityCountryLocation(response.result)},error:function(xhr,statusText,error){console.log(error)}})},setCityCountryLocation:function(result){var region="";if(result.region.length!==0){region=", "+result.region}this.cityElement.val(result.city+region);this.countryElement.val(result.country_code.toLowerCase());$("#latitude").val(result.location.lat);$("#longitude").val(result.location.lng)}};(function(){var parseKeyValue;var parseSocialMediaButtons=function(){var did;var el;var st;try{FB.XFBML.parse()}catch(error){}try{twttr.widgets.load()}catch(error){}try{parsePinBtns()}catch(error){}try{gapi.plusone.go()}catch(error){}if(location.hostname.match(/homify.ru$/)){try{el=document.getElementById("ok_shareWidget");if(el&&el.children.length===0){st=JSON.stringify(el.dataset);did=el.dataset.path;el.id+="_loaded";return OK.CONNECT.insertShareWidget(el.id,did,st)}}catch(error){}}};parseKeyValue=function(){$(".key-value--value").each(function(){var $el=$(this);var closed=true;var maxHeight=parseInt($el.css("max-height"));$el.css({maxHeight:"inherit"});var height=$el.height();if(height>maxHeight){$el.css({height:maxHeight}).addClass("-closed");$el.click(function(){$el.animate({height:closed?height:maxHeight});$el.toggleClass("-closed");closed=!closed})}})};this.openExternalLinksInNewTab=function(){return $(".project--description a, .photo--description a, .ideabook-photo--description a").each(function(){if($(this).attr("href")&&$(this).attr("href").indexOf("www.homify.")===-1){return $(this).attr("target","_blank")}})};this.addBeforeUnloadEvent=function(){if($("form[data-confirm-beforeunload]").length>0){$(window).on("beforeunload",function(){return $("form[data-confirm-beforeunload]").data("confirm-beforeunload")});$("form[data-confirm-beforeunload]").on("submit",function(){$(window).off("beforeunload")})}};$(function(){$(document).on("click",".closed-box",function(){$(this).toggleClass("-open")});$(document).on("click",".array--show-all",function(){$(this).hide().parents(".array").removeClass("-limited")});$(document).on("click",".js-autoselect",function(){var $el;$el=$(this);$el.siblings().removeClass("-selected");$el.addClass("-selected")});$(document).on("click",".js-autoselect-toggle",function(){var $el=$(this);var selected=!$el.hasClass("-selected");setTimeout(function(){$el.toggleClass("-selected",selected)},50)});$(document).keypress(function(e){var c;if(!location.host.match(/local|staging/)){return}c=e.keyCode;if(c>48&&c<58){$("html").attr("alternative",e.keyCode-48)}});$(document).on("change",".js-select-link",function(){location.href=this.value});$(document).on("submit","[data-replace-on-submit]",function(event){event.preventDefault();var $container=$(this.dataset.replaceOnSubmit);var $form=$(this);var method=$form.find("[name='_method']").val();if(typeof method==="undefined"){method=this.method}$.ajax({url:this.action,method:method,data:$(this).serialize(),success:function(html){$container.replaceWith(html)},failure:function(html){$container.replaceWith(html)}})});parseSocialMediaButtons();parseKeyValue();window.openExternalLinksInNewTab();window.RemotePartial.loadRemotePartials();window.addBeforeUnloadEvent();if(typeof svg4everybody!=="undefined"){this.LEGACY_SUPPORT=true;svg4everybody()}window.pageCached=$("meta[name='x-cached']").length>0;$.ajaxSetup({beforeSend:function(xhr,options){var token;if(options.url.match(/^http/)){return}token=$('meta[name="csrf-token"]').attr("content");if(token&&token!=="*"){return xhr.setRequestHeader("X-CSRF-Token",token)}}})});window.DocCookie.removeItem("nocache","/")}).call(this);(function(){this.showFlashFor=function(type){var $el,cookieName,message;cookieName="flash_"+type;message=window.DocCookie.getItem(cookieName);if(message){window.DocCookie.removeItem(cookieName,"/");if($(".flash--"+type+":contains('"+message+"')").length){return}$el=$("
");$el.text(message);$(".flash").append($el);$el.fadeIn();return setTimeout(function(){return $el.fadeOut(function(){return $el.remove()})},3e3)}};this.showFlashMessages=function(){setTimeout(function(){return showFlashFor("notice")},100);return setTimeout(function(){return showFlashFor("alert")},200)};$(showFlashMessages);$(document).ajaxComplete(showFlashMessages)}).call(this);(function($){"use strict";var readmore="readmore",defaults={speed:100,collapsedHeight:200,heightMargin:16,moreLink:'
Read More',lessLink:'
Close',embedCSS:true,blockCSS:"display: block; width: 100%;",startOpen:false,beforeToggle:function(){},afterToggle:function(){}},cssEmbedded={},uniqueIdCounter=0;function debounce(func,wait,immediate){var timeout;return function(){var context=this,args=arguments;var later=function(){timeout=null;if(!immediate){func.apply(context,args)}};var callNow=immediate&&!timeout;clearTimeout(timeout);timeout=setTimeout(later,wait);if(callNow){func.apply(context,args)}}}function uniqueId(prefix){var id=++uniqueIdCounter;return String(prefix==null?"rmjs-":prefix)+id}function setBoxHeights(element){var el=element.clone().css({height:"auto",width:element.width(),maxHeight:"none",overflow:"hidden"}).insertAfter(element),expandedHeight=el.outerHeight(),cssMaxHeight=parseInt(el.css({maxHeight:""}).css("max-height").replace(/[^-\d\.]/g,""),10),defaultHeight=element.data("defaultHeight");el.remove();var collapsedHeight=cssMaxHeight||element.data("collapsedHeight")||defaultHeight;element.data({expandedHeight:expandedHeight,maxHeight:cssMaxHeight,collapsedHeight:collapsedHeight}).css({maxHeight:"none"})}var resizeBoxes=debounce(function(){$("[data-readmore]").each(function(){var current=$(this),isExpanded=current.attr("aria-expanded")==="true";setBoxHeights(current);current.css({height:current.data(isExpanded?"expandedHeight":"collapsedHeight")})})},100);function embedCSS(options){if(!cssEmbedded[options.selector]){var styles=" ";if(options.embedCSS&&options.blockCSS!==""){styles+=options.selector+" + [data-readmore-toggle], "+options.selector+"[data-readmore]{"+options.blockCSS+"}"}styles+=options.selector+"[data-readmore]{"+"transition: height "+options.speed+"ms;"+"overflow: hidden;"+"}";(function(d,u){var css=d.createElement("style");css.type="text/css";if(css.styleSheet){css.styleSheet.cssText=u}else{css.appendChild(d.createTextNode(u))}d.getElementsByTagName("head")[0].appendChild(css)})(document,styles);cssEmbedded[options.selector]=true}}function Readmore(element,options){var $this=this;this.element=element;this.options=$.extend({},defaults,options);embedCSS(this.options);this._defaults=defaults;this._name=readmore;this.init();if(window.addEventListener){window.addEventListener("load",resizeBoxes);window.addEventListener("resize",resizeBoxes)}else{window.attachEvent("load",resizeBoxes);window.attachEvent("resize",resizeBoxes)}}Readmore.prototype={init:function(){var $this=this,current=$(this.element);current.data({defaultHeight:this.options.collapsedHeight,heightMargin:this.options.heightMargin});setBoxHeights(current);var collapsedHeight=current.data("collapsedHeight"),heightMargin=current.data("heightMargin");if(current.outerHeight(true)<=collapsedHeight+heightMargin){return true}else{var id=current.attr("id")||uniqueId(),useLink=$this.options.startOpen?$this.options.lessLink:$this.options.moreLink;current.attr({"data-readmore":"","aria-expanded":false,id:id});current.after($(useLink).on("click",function(event){$this.toggle(this,current[0],event)}).attr({"data-readmore-toggle":"","aria-controls":id}));if(!$this.options.startOpen){current.css({height:collapsedHeight})}}},toggle:function(trigger,element,event){if(event){event.preventDefault()}if(!trigger){trigger=$('[aria-controls="'+this.element.id+'"]')[0]}if(!element){element=this.element}var $this=this,$element=$(element),newHeight="",newLink="",expanded=false,collapsedHeight=$element.data("collapsedHeight");if($element.height()<=collapsedHeight){newHeight=$element.data("expandedHeight")+"px";newLink="lessLink";expanded=true}else{newHeight=collapsedHeight;newLink="moreLink"}$this.options.beforeToggle(trigger,element,!expanded);$element.css({height:newHeight});$element.on("transitionend",function(){$this.options.afterToggle(trigger,element,expanded);$(this).attr({"aria-expanded":expanded}).off("transitionend")});$(trigger).replaceWith($($this.options[newLink]).on("click",function(event){$this.toggle(this,element,event)}).attr({"data-readmore-toggle":"","aria-controls":$element.attr("id")}))},destroy:function(){$(this.element).each(function(){var current=$(this);current.attr({"data-readmore":null,"aria-expanded":null}).css({maxHeight:"",height:""}).next("[data-readmore-toggle]").remove();current.removeData()})}};$.fn.readmore=function(options){var args=arguments,selector=this.selector;options=options||{};if(typeof options==="object"){return this.each(function(){if($.data(this,"plugin_"+readmore)){var instance=$.data(this,"plugin_"+readmore);instance.destroy.apply(instance)}options.selector=selector;$.data(this,"plugin_"+readmore,new Readmore(this,options))})}else if(typeof options==="string"&&options[0]!=="_"&&options!=="init"){return this.each(function(){var instance=$.data(this,"plugin_"+readmore);if(instance instanceof Readmore&&typeof instance[options]==="function"){instance[options].apply(instance,Array.prototype.slice.call(args,1))}})}}})(jQuery);function reRenderCaptcha(){if(typeof grecaptcha!=="undefined"&&grecaptcha!==null){return grecaptcha.reset()}}(function($,undefined){"use strict";$.ajaxPrefilter(function(options,origOptions,jqXHR){if(options.iframe){options.originalURL=options.url;return"iframe"}});$.ajaxTransport("iframe",function(options,origOptions,jqXHR){var form=null,iframe=null,name="iframe-"+$.now(),files=$(options.files).filter(":file:enabled"),markers=null,accepts=null;function cleanUp(){files.each(function(i,file){var $file=$(file);$file.data("clone").replaceWith($file)});form.remove();iframe.one("load",function(){iframe.remove()});iframe.attr("src","about:blank")}options.dataTypes.shift();options.data=origOptions.data;if(files.length){form=$("
").hide().attr({action:options.originalURL,target:name});if(typeof options.data==="string"&&options.data.length>0){$.error("data must not be serialized")}$.each(options.data||{},function(name,value){if($.isPlainObject(value)){name=value.name;value=value.value}$("
").attr({name:name,value:value}).appendTo(form)});$("
").appendTo(form);if(options.dataTypes[0]&&options.accepts[options.dataTypes[0]]){accepts=options.accepts[options.dataTypes[0]]+(options.dataTypes[0]!=="*"?", */*; q=0.01":"")}else{accepts=options.accepts["*"]}$("
").attr("value",accepts).appendTo(form);markers=files.after(function(idx){var $this=$(this),$clone=$this.clone().prop("disabled",true);$this.data("clone",$clone);return $clone}).next();files.appendTo(form);return{send:function(headers,completeCallback){iframe=$("
");iframe.one("load",function(){iframe.one("load",function(){var doc=this.contentWindow?this.contentWindow.document:this.contentDocument?this.contentDocument:this.document,root=doc.documentElement?doc.documentElement:doc.body,textarea=root.getElementsByTagName("textarea")[0],type=textarea&&textarea.getAttribute("data-type")||null,status=textarea&&textarea.getAttribute("data-status")||200,statusText=textarea&&textarea.getAttribute("data-statusText")||"OK",content={text:type?textarea.value:root?root.textContent||root.innerText:null};cleanUp();if(!jqXHR.responseText){jqXHR.responseText=content.text}completeCallback(status,statusText,content,type?"Content-Type: "+type:null)});form[0].submit()});$("body").append(form,iframe)},abort:function(){if(iframe!==null){iframe.unbind("load").attr("src","about:blank");cleanUp()}}}}})})(jQuery);(function($){var remotipart;$.remotipart=remotipart={setup:function(form){var button=form.data("ujs:submit-button"),csrfParam=$('meta[name="csrf-param"]').attr("content"),csrfToken=$('meta[name="csrf-token"]').attr("content"),csrfInput=form.find('input[name="'+csrfParam+'"]').length;form.one("ajax:beforeSend.remotipart",function(e,xhr,settings){delete settings.beforeSend;settings.iframe=true;settings.files=$($.rails.fileInputSelector,form);settings.data=form.serializeArray();if(button)settings.data.push(button);settings.files.each(function(i,file){for(var j=settings.data.length-1;j>=0;j--)if(settings.data[j].name==file.name)settings.data.splice(j,1)});settings.processData=false;if(settings.dataType===undefined){settings.dataType="script *"}settings.data.push({name:"remotipart_submitted",value:true});if(csrfToken&&csrfParam&&!csrfInput){settings.data.push({name:csrfParam,value:csrfToken})}if($.rails.fire(form,"ajax:remotipartSubmit",[xhr,settings])){$.rails.ajax(settings).always(function(data){$.rails.fire(form,"ajax:remotipartComplete",[data])});setTimeout(function(){$.rails.disableFormElements(form)},20)}remotipart.teardown(form);return false}).data("remotipartSubmitted",true)},teardown:function(form){form.unbind("ajax:beforeSend.remotipart").removeData("remotipartSubmitted")}};$(document).on("ajax:aborted:file","form",function(){var form=$(this);remotipart.setup(form);$.rails.handleRemote(form);return false})})(jQuery);(function(a){a.Jcrop=function(b,c){function i(a){return Math.round(a)+"px"}function j(a){return d.baseClass+"-"+a}function k(){return a.fx.step.hasOwnProperty("backgroundColor")}function l(b){var c=a(b).offset();return[c.left,c.top]}function m(a){return[a.pageX-e[0],a.pageY-e[1]]}function n(b){typeof b!="object"&&(b={}),d=a.extend(d,b),a.each(["onChange","onSelect","onRelease","onDblClick"],function(a,b){typeof d[b]!="function"&&(d[b]=function(){})})}function o(a,b,c){e=l(D),bc.setCursor(a==="move"?a:a+"-resize");if(a==="move")return bc.activateHandlers(q(b),v,c);var d=_.getFixed(),f=r(a),g=_.getCorner(r(f));_.setPressed(_.getCorner(f)),_.setCurrent(g),bc.activateHandlers(p(a,d),v,c)}function p(a,b){return function(c){if(!d.aspectRatio)switch(a){case"e":c[1]=b.y2;break;case"w":c[1]=b.y2;break;case"n":c[0]=b.x2;break;case"s":c[0]=b.x2}else switch(a){case"e":c[1]=b.y+1;break;case"w":c[1]=b.y+1;break;case"n":c[0]=b.x+1;break;case"s":c[0]=b.x+1}_.setCurrent(c),bb.update()}}function q(a){var b=a;return bd.watchKeys(),function(a){_.moveOffset([a[0]-b[0],a[1]-b[1]]),b=a,bb.update()}}function r(a){switch(a){case"n":return"sw";case"s":return"nw";case"e":return"nw";case"w":return"ne";case"ne":return"sw";case"nw":return"se";case"se":return"nw";case"sw":return"ne"}}function s(a){return function(b){return d.disabled?!1:a==="move"&&!d.allowMove?!1:(e=l(D),W=!0,o(a,m(b)),b.stopPropagation(),b.preventDefault(),!1)}}function t(a,b,c){var d=a.width(),e=a.height();d>b&&b>0&&(d=b,e=b/a.width()*a.height()),e>c&&c>0&&(e=c,d=c/a.height()*a.width()),T=a.width()/d,U=a.height()/e,a.width(d).height(e)}function u(a){return{x:a.x*T,y:a.y*U,x2:a.x2*T,y2:a.y2*U,w:a.w*T,h:a.h*U}}function v(a){var b=_.getFixed();b.w>d.minSelect[0]&&b.h>d.minSelect[1]?(bb.enableHandles(),bb.done()):bb.release(),bc.setCursor(d.allowSelect?"crosshair":"default")}function w(a){if(d.disabled)return!1;if(!d.allowSelect)return!1;W=!0,e=l(D),bb.disableHandles(),bc.setCursor("crosshair");var b=m(a);return _.setPressed(b),bb.update(),bc.activateHandlers(x,v,a.type.substring(0,5)==="touch"),bd.watchKeys(),a.stopPropagation(),a.preventDefault(),!1}function x(a){_.setCurrent(a),bb.update()}function y(){var b=a("
").addClass(j("tracker"));return g&&b.css({opacity:0,backgroundColor:"white"}),b}function be(a){G.removeClass().addClass(j("holder")).addClass(a)}function bf(a,b){function t(){window.setTimeout(u,l)}var c=a[0]/T,e=a[1]/U,f=a[2]/T,g=a[3]/U;if(X)return;var h=_.flipCoords(c,e,f,g),i=_.getFixed(),j=[i.x,i.y,i.x2,i.y2],k=j,l=d.animationDelay,m=h[0]-j[0],n=h[1]-j[1],o=h[2]-j[2],p=h[3]-j[3],q=0,r=d.swingSpeed;c=k[0],e=k[1],f=k[2],g=k[3],bb.animMode(!0);var s,u=function(){return function(){q+=(100-q)/r,k[0]=Math.round(c+q/100*m),k[1]=Math.round(e+q/100*n),k[2]=Math.round(f+q/100*o),k[3]=Math.round(g+q/100*p),q>=99.8&&(q=100),q<100?(bh(k),t()):(bb.done(),bb.animMode(!1),typeof b=="function"&&b.call(bs))}}();t()}function bg(a){bh([a[0]/T,a[1]/U,a[2]/T,a[3]/U]),d.onSelect.call(bs,u(_.getFixed())),bb.enableHandles()}function bh(a){_.setPressed([a[0],a[1]]),_.setCurrent([a[2],a[3]]),bb.update()}function bi(){return u(_.getFixed())}function bj(){return _.getFixed()}function bk(a){n(a),br()}function bl(){d.disabled=!0,bb.disableHandles(),bb.setCursor("default"),bc.setCursor("default")}function bm(){d.disabled=!1,br()}function bn(){bb.done(),bc.activateHandlers(null,null)}function bo(){G.remove(),A.show(),A.css("visibility","visible"),a(b).removeData("Jcrop")}function bp(a,b){bb.release(),bl();var c=new Image;c.onload=function(){var e=c.width,f=c.height,g=d.boxWidth,h=d.boxHeight;D.width(e).height(f),D.attr("src",a),H.attr("src",a),t(D,g,h),E=D.width(),F=D.height(),H.width(E).height(F),M.width(E+L*2).height(F+L*2),G.width(E).height(F),ba.resize(E,F),bm(),typeof b=="function"&&b.call(bs)},c.src=a}function bq(a,b,c){var e=b||d.bgColor;d.bgFade&&k()&&d.fadeTime&&!c?a.animate({backgroundColor:e},{queue:!1,duration:d.fadeTime}):a.css("backgroundColor",e)}function br(a){d.allowResize?a?bb.enableOnly():bb.enableHandles():bb.disableHandles(),bc.setCursor(d.allowSelect?"crosshair":"default"),bb.setCursor(d.allowMove?"move":"default"),d.hasOwnProperty("trueSize")&&(T=d.trueSize[0]/E,U=d.trueSize[1]/F),d.hasOwnProperty("setSelect")&&(bg(d.setSelect),bb.done(),delete d.setSelect),ba.refresh(),d.bgColor!=N&&(bq(d.shade?ba.getShades():G,d.shade?d.shadeColor||d.bgColor:d.bgColor),N=d.bgColor),O!=d.bgOpacity&&(O=d.bgOpacity,d.shade?ba.refresh():bb.setBgOpacity(O)),P=d.maxSize[0]||0,Q=d.maxSize[1]||0,R=d.minSize[0]||0,S=d.minSize[1]||0,d.hasOwnProperty("outerImage")&&(D.attr("src",d.outerImage),delete d.outerImage),bb.refresh()}var d=a.extend({},a.Jcrop.defaults),e,f=navigator.userAgent.toLowerCase(),g=/msie/.test(f),h=/msie [1-6]\./.test(f);typeof b!="object"&&(b=a(b)[0]),typeof c!="object"&&(c={}),n(c);var z={border:"none",visibility:"visible",margin:0,padding:0,position:"absolute",top:0,left:0},A=a(b),B=!0;if(b.tagName=="IMG"){if(A[0].width!=0&&A[0].height!=0)A.width(A[0].width),A.height(A[0].height);else{var C=new Image;C.src=A[0].src,A.width(C.width),A.height(C.height)}var D=A.clone().removeAttr("id").css(z).show();D.width(A.width()),D.height(A.height()),A.after(D).hide()}else D=A.css(z).show(),B=!1,d.shade===null&&(d.shade=!0);t(D,d.boxWidth,d.boxHeight);var E=D.width(),F=D.height(),G=a("
").width(E).height(F).addClass(j("holder")).css({position:"relative",backgroundColor:d.bgColor}).insertAfter(A).append(D);d.addClass&&G.addClass(d.addClass);var H=a("
"),I=a("
").width("100%").height("100%").css({zIndex:310,position:"absolute",overflow:"hidden"}),J=a("
").width("100%").height("100%").css("zIndex",320),K=a("
").css({position:"absolute",zIndex:600}).dblclick(function(){var a=_.getFixed();d.onDblClick.call(bs,a)}).insertBefore(D).append(I,J);B&&(H=a("
![]()
").attr("src",D.attr("src")).css(z).width(E).height(F),I.append(H)),h&&K.css({overflowY:"hidden"});var L=d.boundary,M=y().width(E+L*2).height(F+L*2).css({position:"absolute",top:i(-L),left:i(-L),zIndex:290}).mousedown(w),N=d.bgColor,O=d.bgOpacity,P,Q,R,S,T,U,V=!0,W,X,Y;e=l(D);var Z=function(){function a(){var a={},b=["touchstart","touchmove","touchend"],c=document.createElement("div"),d;try{for(d=0;d
a+f&&(f-=f+a),0>b+g&&(g-=g+b),FE&&(r=E,u=Math.abs((r-a)/f),s=k<0?b-u:u+b)):(r=c,u=l/f,s=k<0?b-u:b+u,s<0?(s=0,t=Math.abs((s-b)*f),r=j<0?a-t:t+a):s>F&&(s=F,t=Math.abs(s-b)*f,r=j<0?a-t:t+a)),r>a?(r-ah&&(r=a+h),s>b?s=b+(r-a)/f:s=b-(r-a)/f):rh&&(r=a-h),s>b?s=b+(a-r)/f:s=b-(a-r)/f),r<0?(a-=r,r=0):r>E&&(a-=r-E,r=E),s<0?(b-=s,s=0):s>F&&(b-=s-F,s=F),q(o(a,b,r,s))}function n(a){return a[0]<0&&(a[0]=0),a[1]<0&&(a[1]=0),a[0]>E&&(a[0]=E),a[1]>F&&(a[1]=F),[Math.round(a[0]),Math.round(a[1])]}function o(a,b,c,d){var e=a,f=c,g=b,h=d;return cP&&(c=d>0?a+P:a-P),Q&&Math.abs(f)>Q&&(e=f>0?b+Q:b-Q),S/U&&Math.abs(f)0?b+S/U:b-S/U),R/T&&Math.abs(d)0?a+R/T:a-R/T),a<0&&(c-=a,a-=a),b<0&&(e-=b,b-=b),c<0&&(a-=c,c-=c),e<0&&(b-=e,e-=e),c>E&&(g=c-E,a-=g,c-=g),e>F&&(g=e-F,b-=g,e-=g),a>E&&(g=a-F,e-=g,b-=g),b>F&&(g=b-F,e-=g,b-=g),q(o(a,b,c,e))}function q(a){return{x:a[0],y:a[1],x2:a[2],y2:a[3],w:a[2]-a[0],h:a[3]-a[1]}}var a=0,b=0,c=0,e=0,f,g;return{flipCoords:o,setPressed:h,setCurrent:i,getOffset:j,moveOffset:k,getCorner:l,getFixed:m}}(),ba=function(){function f(a,b){e.left.css({height:i(b)}),e.right.css({height:i(b)})}function g(){return h(_.getFixed())}function h(a){e.top.css({left:i(a.x),width:i(a.w),height:i(a.y)}),e.bottom.css({top:i(a.y2),left:i(a.x),width:i(a.w),height:i(F-a.y2)}),e.right.css({left:i(a.x2),width:i(E-a.x2)}),e.left.css({width:i(a.x)})}function j(){return a("").css({position:"absolute",backgroundColor:d.shadeColor||d.bgColor}).appendTo(c)}function k(){b||(b=!0,c.insertBefore(D),g(),bb.setBgOpacity(1,0,1),H.hide(),l(d.shadeColor||d.bgColor,1),bb.isAwake()?n(d.bgOpacity,1):n(1,1))}function l(a,b){bq(p(),a,b)}function m(){b&&(c.remove(),H.show(),b=!1,bb.isAwake()?bb.setBgOpacity(d.bgOpacity,1,1):(bb.setBgOpacity(1,1,1),bb.disableHandles()),bq(G,0,1))}function n(a,e){b&&(d.bgFade&&!e?c.animate({opacity:1-a},{queue:!1,duration:d.fadeTime}):c.css({opacity:1-a}))}function o(){d.shade?k():m(),bb.isAwake()&&n(d.bgOpacity)}function p(){return c.children()}var b=!1,c=a("").css({position:"absolute",zIndex:240,opacity:0}),e={top:j(),left:j().height(F),right:j().height(F),bottom:j()};return{update:g,updateRaw:h,getShades:p,setBgColor:l,enable:k,disable:m,resize:f,refresh:o,opacity:n}}(),bb=function(){function k(b){var c=a("").css({position:"absolute",opacity:d.borderOpacity}).addClass(j(b));return I.append(c),c}function l(b,c){var d=a("").mousedown(s(b)).css({cursor:b+"-resize",position:"absolute",zIndex:c}).addClass("ord-"+b);return Z.support&&d.bind("touchstart.jcrop",Z.createDragger(b)),J.append(d),d}function m(a){var b=d.handleSize,e=l(a,c++).css({opacity:d.handleOpacity}).addClass(j("handle"));return b&&e.width(b).height(b),e}function n(a){return l(a,c++).addClass("jcrop-dragbar")}function o(a){var b;for(b=0;b').css({position:"fixed",left:"-120px",width:"12px"}).addClass("jcrop-keymgr"),c=a("").css({position:"absolute",overflow:"hidden"}).append(b);return d.keySupport&&(b.keydown(i).blur(f),h||!d.fixedSupport?(b.css({position:"absolute",left:"-20px"}),c.append(b).insertBefore(D)):b.insertBefore(D)),{watchKeys:e}}();Z.support&&M.bind("touchstart.jcrop",Z.newSelection),J.hide(),br(!0);var bs={setImage:bp,animateTo:bf,setSelect:bg,setOptions:bk,tellSelect:bi,tellScaled:bj,setClass:be,disable:bl,enable:bm,cancel:bn,release:bb.release,destroy:bo,focus:bd.watchKeys,getBounds:function(){return[E*T,F*U]},getWidgetSize:function(){return[E,F]},getScaleFactor:function(){return[T,U]},getOptions:function(){return d},ui:{holder:G,selection:K}};return g&&G.bind("selectstart",function(){return!1}),A.data("Jcrop",bs),bs},a.fn.Jcrop=function(b,c){var d;return this.each(function(){if(a(this).data("Jcrop")){if(b==="api")return a(this).data("Jcrop");a(this).data("Jcrop").setOptions(b)}else this.tagName=="IMG"?a.Jcrop.Loader(this,function(){a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d)}):(a(this).css({display:"block",visibility:"hidden"}),d=a.Jcrop(this,b),a.isFunction(c)&&c.call(d))}),this},a.Jcrop.Loader=function(b,c,d){function g(){f.complete?(e.unbind(".jcloader"),a.isFunction(c)&&c.call(f)):window.setTimeout(g,50)}var e=a(b),f=e[0];e.bind("load.jcloader",g).bind("error.jcloader",function(b){e.unbind(".jcloader"),a.isFunction(d)&&d.call(f)}),f.complete&&a.isFunction(c)&&(e.unbind(".jcloader"),c.call(f))},a.Jcrop.defaults={allowSelect:!0,allowMove:!0,allowResize:!0,trackDocument:!0,baseClass:"jcrop",addClass:null,bgColor:"black",bgOpacity:.6,bgFade:!1,borderOpacity:.4,handleOpacity:.5,handleSize:null,aspectRatio:0,keySupport:!0,createHandles:["n","s","e","w","nw","ne","se","sw"],createDragbars:["n","s","e","w"],createBorders:["n","s","e","w"],drawBorders:!0,dragEdges:!0,fixedSupport:!0,touchSupport:null,shade:null,boxWidth:0,boxHeight:0,boundary:2,fadeTime:400,animationDelay:20,swingSpeed:3,minSelect:[0,0],maxSize:[0,0],minSize:[0,0],onChange:function(){},onSelect:function(){},onDblClick:function(){},onRelease:function(){}}})(jQuery);$(function(){$(document).on("click",".tabs--item",function(){var $el;var $target;var viewportWidth=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);$el=$(this);if(viewportWidth<=768&&$el.parent().hasClass("reviews-block")){return}$target="."+$el.data("target-class");$($target).siblings().removeClass("-selected");$($target).addClass("-selected");$el.parents(".tabs").find(".tabs--item").removeClass("-selected");return $el.addClass("-selected")})});$(document).on("click",".sign-in-popup-button",function(){$(".form--info").hide();window.Lightbox.closeAllLightboxes();window.User.askToLogin()});$(document).on("click",".sign-in--form--new-password-popup--link",function(){$(".form--info").hide();window.Lightbox.closeAllLightboxes();window.Lightbox.openLightbox("remember_password")});$(document).on("click",".sign-up-popup-link",function(){$(".form--info").hide();window.Lightbox.closeAllLightboxes();window.User.askToSignup()});var $signInUserForm=$("form#sign_in_user");$signInUserForm.bind("ajax:send",function(){$signInUserForm.addClass("-submitted")});var $resetPasswordForm=$("form#reset_password");$resetPasswordForm.bind("ajax:send",function(){$resetPasswordForm.addClass("-submitted")});$signInUserForm.bind("ajax:success",function(e,data,status,xhr){if(data.success){$(".sign-in-form--errors").hide();if(data["next_page_path"]){window.location=data["next_page_path"]}else{location.reload()}}else{$(this).removeClass("-submitted");$(".sign-in-form--errors").show()}});$resetPasswordForm.bind("ajax:success",function(e,data,status,xhr){var form_errors_item=$(".reset-password-form .form--errors-item");var form_info_item=$(".reset-password-form .form--info-item");if(data.success){form_errors_item.hide();form_info_item.show();$(this).removeClass("-submitted");form_info_item.html(data["success_message"])}else{form_info_item.hide();$(this).removeClass("-submitted");form_errors_item.html(data["error_message"]);$(".reset-password-form .form--info").show()}});$("form#sign_up_user").bind("ajax:success",function(e,data,status,xhr){if(data.success){$(".sign-up-form--errors").hide();if(data["next_page_path"]){window.location=data["next_page_path"]}else{location.reload()}}else{if(data["reason"]==="inactive resource"){location.reload()}$signInUserForm.removeClass("-submitted");$(".sign-up-form--errors").show();$(".sign-up-form--errors .form--errors-item").html(data["error_message"]);$(this).removeClass("-submitted")}});(function(){var $savetoIdeabookForm=$("form#save-to-ideabook");$savetoIdeabookForm.bind("ajax:send",function(){$savetoIdeabookForm.addClass("-submitted")});$savetoIdeabookForm.bind("ajax:success",function(){$savetoIdeabookForm.removeClass("-submitted")})})();(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){factory(require("jquery"))}else{factory(jQuery)}})(function($){$.ui=$.ui||{};var version=$.ui.version="1.12.1";var widgetUuid=0;var widgetSlice=Array.prototype.slice;$.cleanData=function(orig){return function(elems){var events,elem,i;for(i=0;(elem=elems[i])!=null;i++){try{events=$._data(elem,"events");if(events&&events.remove){$(elem).triggerHandler("remove")}}catch(e){}}orig(elems)}}($.cleanData);$.widget=function(name,base,prototype){var existingConstructor,constructor,basePrototype;var proxiedPrototype={};var namespace=name.split(".")[0];name=name.split(".")[1];var fullName=namespace+"-"+name;if(!prototype){prototype=base;base=$.Widget}if($.isArray(prototype)){prototype=$.extend.apply(null,[{}].concat(prototype))}$.expr[":"][fullName.toLowerCase()]=function(elem){return!!$.data(elem,fullName)};$[namespace]=$[namespace]||{};existingConstructor=$[namespace][name];constructor=$[namespace][name]=function(options,element){if(!this._createWidget){return new constructor(options,element)}if(arguments.length){this._createWidget(options,element)}};$.extend(constructor,existingConstructor,{version:prototype.version,_proto:$.extend({},prototype),_childConstructors:[]});basePrototype=new base;basePrototype.options=$.widget.extend({},basePrototype.options);$.each(prototype,function(prop,value){if(!$.isFunction(value)){proxiedPrototype[prop]=value;return}proxiedPrototype[prop]=function(){function _super(){return base.prototype[prop].apply(this,arguments)}function _superApply(args){return base.prototype[prop].apply(this,args)}return function(){var __super=this._super;var __superApply=this._superApply;var returnValue;this._super=_super;this._superApply=_superApply;returnValue=value.apply(this,arguments);this._super=__super;this._superApply=__superApply;return returnValue}}()});constructor.prototype=$.widget.extend(basePrototype,{widgetEventPrefix:existingConstructor?basePrototype.widgetEventPrefix||name:name},proxiedPrototype,{constructor:constructor,namespace:namespace,widgetName:name,widgetFullName:fullName});if(existingConstructor){$.each(existingConstructor._childConstructors,function(i,child){var childPrototype=child.prototype;$.widget(childPrototype.namespace+"."+childPrototype.widgetName,constructor,child._proto)});delete existingConstructor._childConstructors}else{base._childConstructors.push(constructor)}$.widget.bridge(name,constructor);return constructor};$.widget.extend=function(target){var input=widgetSlice.call(arguments,1);var inputIndex=0;var inputLength=input.length;var key;var value;for(;inputIndex",options:{classes:{},disabled:false,create:null},_createWidget:function(options,element){element=$(element||this.defaultElement||this)[0];this.element=$(element);this.uuid=widgetUuid++;this.eventNamespace="."+this.widgetName+this.uuid;this.bindings=$();this.hoverable=$();this.focusable=$();this.classesElementLookup={};if(element!==this){$.data(element,this.widgetFullName,this);this._on(true,this.element,{remove:function(event){if(event.target===element){this.destroy()}}});this.document=$(element.style?element.ownerDocument:element.document||element);this.window=$(this.document[0].defaultView||this.document[0].parentWindow)}this.options=$.widget.extend({},this.options,this._getCreateOptions(),options);this._create();if(this.options.disabled){this._setOptionDisabled(this.options.disabled)}this._trigger("create",null,this._getCreateEventData());this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:$.noop,_create:$.noop,_init:$.noop,destroy:function(){var that=this;this._destroy();$.each(this.classesElementLookup,function(key,value){that._removeClass(value,key)});this.element.off(this.eventNamespace).removeData(this.widgetFullName);this.widget().off(this.eventNamespace).removeAttr("aria-disabled");this.bindings.off(this.eventNamespace)},_destroy:$.noop,widget:function(){return this.element},option:function(key,value){var options=key;var parts;var curOption;var i;if(arguments.length===0){return $.widget.extend({},this.options)}if(typeof key==="string"){options={};parts=key.split(".");key=parts.shift();if(parts.length){curOption=options[key]=$.widget.extend({},this.options[key]);for(i=0;i');form.attr("accept-charset",options.formAcceptCharset);addParamChar=/\?/.test(options.url)?"&":"?";if(options.type==="DELETE"){options.url=options.url+addParamChar+"_method=DELETE";options.type="POST"}else if(options.type==="PUT"){options.url=options.url+addParamChar+"_method=PUT";options.type="POST"}else if(options.type==="PATCH"){options.url=options.url+addParamChar+"_method=PATCH";options.type="POST"}counter+=1;iframe=$('').bind("load",function(){var fileInputClones,paramNames=$.isArray(options.paramName)?options.paramName:[options.paramName];iframe.unbind("load").bind("load",function(){var response;try{response=iframe.contents();if(!response.length||!response[0].firstChild){throw new Error}}catch(e){response=undefined}completeCallback(200,"success",{iframe:response});$('').appendTo(form);window.setTimeout(function(){form.remove()},0)});form.prop("target",iframe.prop("name")).prop("action",options.url).prop("method",options.type);if(options.formData){$.each(options.formData,function(index,field){$('').prop("name",field.name).val(field.value).appendTo(form)})}if(options.fileInput&&options.fileInput.length&&options.type==="POST"){fileInputClones=options.fileInput.clone();options.fileInput.after(function(index){return fileInputClones[index]});if(options.paramName){options.fileInput.each(function(index){$(this).prop("name",paramNames[index]||options.paramName)})}form.append(options.fileInput).prop("enctype","multipart/form-data").prop("encoding","multipart/form-data");options.fileInput.removeAttr("form")}form.submit();if(fileInputClones&&fileInputClones.length){options.fileInput.each(function(index,input){var clone=$(fileInputClones[index]);$(input).prop("name",clone.prop("name")).attr("form",clone.attr("form"));clone.replaceWith(input)})}});form.append(iframe).appendTo(document.body)},abort:function(){if(iframe){iframe.unbind("load").prop("src",initialIframeSrc)}if(form){form.remove()}}}}});$.ajaxSetup({converters:{"iframe text":function(iframe){return iframe&&$(iframe[0].body).text()},"iframe json":function(iframe){return iframe&&jsonAPI[jsonParse]($(iframe[0].body).text())},"iframe html":function(iframe){return iframe&&$(iframe[0].body).html()},"iframe xml":function(iframe){var xmlDoc=iframe&&iframe[0];return xmlDoc&&$.isXMLDoc(xmlDoc)?xmlDoc:$.parseXML(xmlDoc.XMLDocument&&xmlDoc.XMLDocument.xml||$(xmlDoc.body).html())},"iframe script":function(iframe){return iframe&&$.globalEval($(iframe[0].body).text())}}})});(function(factory){"use strict";if(typeof define==="function"&&define.amd){define(["jquery","jquery-ui/ui/widget"],factory)}else if(typeof exports==="object"){factory(require("jquery"),require("./vendor/jquery.ui.widget"))}else{factory(window.jQuery)}})(function($){"use strict";$.support.fileInput=!(new RegExp("(Android (1\\.[0156]|2\\.[01]))"+"|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)"+"|(w(eb)?OSBrowser)|(webOS)"+"|(Kindle/(1\\.0|2\\.[05]|3\\.0))").test(window.navigator.userAgent)||$('').prop("disabled"));$.support.xhrFileUpload=!!(window.ProgressEvent&&window.FileReader);$.support.xhrFormDataFileUpload=!!window.FormData;$.support.blobSlice=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);function getDragHandler(type){var isDragOver=type==="dragover";return function(e){e.dataTransfer=e.originalEvent&&e.originalEvent.dataTransfer;var dataTransfer=e.dataTransfer;if(dataTransfer&&$.inArray("Files",dataTransfer.types)!==-1&&this._trigger(type,$.Event(type,{delegatedEvent:e}))!==false){e.preventDefault();if(isDragOver){dataTransfer.dropEffect="copy"}}}}$.widget("blueimp.fileupload",{options:{dropZone:$(document),pasteZone:undefined,fileInput:undefined,replaceFileInput:true,paramName:undefined,singleFileUploads:true,limitMultiFileUploads:undefined,limitMultiFileUploadSize:undefined,limitMultiFileUploadSizeOverhead:512,sequentialUploads:false,limitConcurrentUploads:undefined,forceIframeTransport:false,redirect:undefined,redirectParamName:undefined,postMessage:undefined,multipart:true,maxChunkSize:undefined,uploadedBytes:undefined,recalculateProgress:true,progressInterval:100,bitrateInterval:500,autoUpload:true,messages:{uploadedBytes:"Uploaded bytes exceed file size"},i18n:function(message,context){message=this.messages[message]||message.toString();if(context){$.each(context,function(key,value){message=message.replace("{"+key+"}",value)})}return message},formData:function(form){return form.serializeArray()},add:function(e,data){if(e.isDefaultPrevented()){return false}if(data.autoUpload||data.autoUpload!==false&&$(this).fileupload("option","autoUpload")){data.process().done(function(){data.submit()})}},processData:false,contentType:false,cache:false,timeout:0},_specialOptions:["fileInput","dropZone","pasteZone","multipart","forceIframeTransport"],_blobSlice:$.support.blobSlice&&function(){var slice=this.slice||this.webkitSlice||this.mozSlice;return slice.apply(this,arguments)},_BitrateTimer:function(){this.timestamp=Date.now?Date.now():(new Date).getTime();this.loaded=0;this.bitrate=0;this.getBitrate=function(now,loaded,interval){var timeDiff=now-this.timestamp;if(!this.bitrate||!interval||timeDiff>interval){this.bitrate=(loaded-this.loaded)*(1e3/timeDiff)*8;this.loaded=loaded;this.timestamp=now}return this.bitrate}},_isXHRUpload:function(options){return!options.forceIframeTransport&&(!options.multipart&&$.support.xhrFileUpload||$.support.xhrFormDataFileUpload)},_getFormData:function(options){var formData;if($.type(options.formData)==="function"){return options.formData(options.form)}if($.isArray(options.formData)){return options.formData}if($.type(options.formData)==="object"){formData=[];$.each(options.formData,function(name,value){formData.push({name:name,value:value})});return formData}return[]},_getTotal:function(files){var total=0;$.each(files,function(index,file){total+=file.size||1});return total},_initProgressObject:function(obj){var progress={loaded:0,total:0,bitrate:0};if(obj._progress){$.extend(obj._progress,progress)}else{obj._progress=progress}},_initResponseObject:function(obj){var prop;if(obj._response){for(prop in obj._response){if(obj._response.hasOwnProperty(prop)){delete obj._response[prop]}}}else{obj._response={}}},_onProgress:function(e,data){if(e.lengthComputable){var now=Date.now?Date.now():(new Date).getTime(),loaded;if(data._time&&data.progressInterval&&now-data._time").prop("href",options.url).prop("host");options.dataType="iframe "+(options.dataType||"");options.formData=this._getFormData(options);if(options.redirect&&targetHost&&targetHost!==location.host){options.formData.push({name:options.redirectParamName||"redirect",value:options.redirect})}},_initDataSettings:function(options){if(this._isXHRUpload(options)){if(!this._chunkedUpload(options,true)){if(!options.data){this._initXHRData(options)}this._initProgressListener(options)}if(options.postMessage){options.dataType="postmessage "+(options.dataType||"")}}else{this._initIframeSettings(options)}},_getParamName:function(options){var fileInput=$(options.fileInput),paramName=options.paramName;if(!paramName){paramName=[];fileInput.each(function(){var input=$(this),name=input.prop("name")||"files[]",i=(input.prop("files")||[1]).length;while(i){paramName.push(name);i-=1}});if(!paramName.length){paramName=[fileInput.prop("name")||"files[]"]}}else if(!$.isArray(paramName)){paramName=[paramName]}return paramName},_initFormSettings:function(options){if(!options.form||!options.form.length){options.form=$(options.fileInput.prop("form"));if(!options.form.length){options.form=$(this.options.fileInput.prop("form"))}}options.paramName=this._getParamName(options);if(!options.url){options.url=options.form.prop("action")||location.href}options.type=(options.type||$.type(options.form.prop("method"))==="string"&&options.form.prop("method")||"").toUpperCase();if(options.type!=="POST"&&options.type!=="PUT"&&options.type!=="PATCH"){options.type="POST"}if(!options.formAcceptCharset){options.formAcceptCharset=options.form.attr("accept-charset")}},_getAJAXSettings:function(data){var options=$.extend({},this.options,data);this._initFormSettings(options);this._initDataSettings(options);return options},_getDeferredState:function(deferred){if(deferred.state){return deferred.state()}if(deferred.isResolved()){return"resolved"}if(deferred.isRejected()){return"rejected"}return"pending"},_enhancePromise:function(promise){promise.success=promise.done;promise.error=promise.fail;promise.complete=promise.always;return promise},_getXHRPromise:function(resolveOrReject,context,args){var dfd=$.Deferred(),promise=dfd.promise();context=context||this.options.context||promise;if(resolveOrReject===true){dfd.resolveWith(context,args)}else if(resolveOrReject===false){dfd.rejectWith(context,args)}promise.abort=dfd.promise;return this._enhancePromise(promise)},_addConvenienceMethods:function(e,data){var that=this,getPromise=function(args){return $.Deferred().resolveWith(that,args).promise()};data.process=function(resolveFunc,rejectFunc){if(resolveFunc||rejectFunc){data._processQueue=this._processQueue=(this._processQueue||getPromise([this])).then(function(){if(data.errorThrown){return $.Deferred().rejectWith(that,[data]).promise()}return getPromise(arguments)}).then(resolveFunc,rejectFunc)}return this._processQueue||getPromise([this])};data.submit=function(){if(this.state()!=="pending"){data.jqXHR=this.jqXHR=that._trigger("submit",$.Event("submit",{delegatedEvent:e}),this)!==false&&that._onSend(e,this)}return this.jqXHR||that._getXHRPromise()};data.abort=function(){if(this.jqXHR){return this.jqXHR.abort()}this.errorThrown="abort";that._trigger("fail",null,this);return that._getXHRPromise(false)};data.state=function(){if(this.jqXHR){return that._getDeferredState(this.jqXHR)}if(this._processQueue){return that._getDeferredState(this._processQueue)}};data.processing=function(){return!this.jqXHR&&this._processQueue&&that._getDeferredState(this._processQueue)==="pending"};data.progress=function(){return this._progress};data.response=function(){return this._response}},_getUploadedBytes:function(jqXHR){var range=jqXHR.getResponseHeader("Range"),parts=range&&range.split("-"),upperBytesPos=parts&&parts.length>1&&parseInt(parts[1],10);return upperBytesPos&&upperBytesPos+1},_chunkedUpload:function(options,testOnly){options.uploadedBytes=options.uploadedBytes||0;var that=this,file=options.files[0],fs=file.size,ub=options.uploadedBytes,mcs=options.maxChunkSize||fs,slice=this._blobSlice,dfd=$.Deferred(),promise=dfd.promise(),jqXHR,upload;if(!(this._isXHRUpload(options)&&slice&&(ub||($.type(mcs)==="function"?mcs(options):mcs)=fs){file.error=options.i18n("uploadedBytes");return this._getXHRPromise(false,options.context,[null,"error",file.error])}upload=function(){var o=$.extend({},options),currentLoaded=o._progress.loaded;o.blob=slice.call(file,ub,ub+($.type(mcs)==="function"?mcs(o):mcs),file.type);o.chunkSize=o.blob.size;o.contentRange="bytes "+ub+"-"+(ub+o.chunkSize-1)+"/"+fs;that._trigger("chunkbeforesend",null,o);that._initXHRData(o);that._initProgressListener(o);jqXHR=(that._trigger("chunksend",null,o)!==false&&$.ajax(o)||that._getXHRPromise(false,o.context)).done(function(result,textStatus,jqXHR){ub=that._getUploadedBytes(jqXHR)||ub+o.chunkSize;if(currentLoaded+o.chunkSize-o._progress.loaded){that._onProgress($.Event("progress",{lengthComputable:true,loaded:ub-o.uploadedBytes,total:ub-o.uploadedBytes}),o)}options.uploadedBytes=o.uploadedBytes=ub;o.result=result;o.textStatus=textStatus;o.jqXHR=jqXHR;that._trigger("chunkdone",null,o);that._trigger("chunkalways",null,o);if(ubthat._sending){var nextSlot=that._slots.shift();while(nextSlot){if(that._getDeferredState(nextSlot)==="pending"){nextSlot.resolve();break}nextSlot=that._slots.shift()}}if(that._active===0){that._trigger("stop")}});return jqXHR};this._beforeSend(e,options);if(this.options.sequentialUploads||this.options.limitConcurrentUploads&&this.options.limitConcurrentUploads<=this._sending){if(this.options.limitConcurrentUploads>1){slot=$.Deferred();this._slots.push(slot);pipe=slot.then(send)}else{this._sequence=this._sequence.then(send,send);pipe=this._sequence}pipe.abort=function(){aborted=[undefined,"abort","abort"];if(!jqXHR){if(slot){slot.rejectWith(options.context,aborted)}return send()}return jqXHR.abort()};return this._enhancePromise(pipe)}return send()},_onAdd:function(e,data){var that=this,result=true,options=$.extend({},this.options,data),files=data.files,filesLength=files.length,limit=options.limitMultiFileUploads,limitSize=options.limitMultiFileUploadSize,overhead=options.limitMultiFileUploadSizeOverhead,batchSize=0,paramName=this._getParamName(options),paramNameSet,paramNameSlice,fileSet,i,j=0;if(!filesLength){return false}if(limitSize&&files[0].size===undefined){limitSize=undefined}if(!(options.singleFileUploads||limit||limitSize)||!this._isXHRUpload(options)){fileSet=[files];paramNameSet=[paramName]}else if(!(options.singleFileUploads||limitSize)&&limit){fileSet=[];paramNameSet=[];for(i=0;ilimitSize||limit&&i+1-j>=limit){fileSet.push(files.slice(j,i+1));paramNameSlice=paramName.slice(j,i+1);if(!paramNameSlice.length){paramNameSlice=paramName}paramNameSet.push(paramNameSlice);j=i+1;batchSize=0}}}else{paramNameSet=paramName}data.originalFiles=files;$.each(fileSet||files,function(index,element){var newData=$.extend({},data);newData.files=fileSet?element:[element];newData.paramName=paramNameSet[index];that._initResponseObject(newData);that._initProgressObject(newData);that._addConvenienceMethods(e,newData);result=that._trigger("add",$.Event("add",{delegatedEvent:e}),newData);return result});return result},_replaceFileInput:function(data){var input=data.fileInput,inputClone=input.clone(true),restoreFocus=input.is(document.activeElement);data.fileInputClone=inputClone;$("").append(inputClone)[0].reset();input.after(inputClone).detach();if(restoreFocus){inputClone.focus()}$.cleanData(input.unbind("remove"));this.options.fileInput=this.options.fileInput.map(function(i,el){if(el===input[0]){return inputClone[0]}return el});if(input[0]===this.element[0]){this.element=inputClone}},_handleFileTreeEntry:function(entry,path){var that=this,dfd=$.Deferred(),entries=[],dirReader,errorHandler=function(e){if(e&&!e.entry){e.entry=entry}dfd.resolve([e])},successHandler=function(entries){that._handleFileTreeEntries(entries,path+entry.name+"/").done(function(files){dfd.resolve(files)}).fail(errorHandler)},readEntries=function(){dirReader.readEntries(function(results){if(!results.length){successHandler(entries)}else{entries=entries.concat(results);readEntries()}},errorHandler)};path=path||"";if(entry.isFile){if(entry._file){entry._file.relativePath=path;dfd.resolve(entry._file)}else{entry.file(function(file){file.relativePath=path;dfd.resolve(file)},errorHandler)}}else if(entry.isDirectory){dirReader=entry.createReader();readEntries()}else{dfd.resolve([])}return dfd.promise()},_handleFileTreeEntries:function(entries,path){var that=this;return $.when.apply($,$.map(entries,function(entry){return that._handleFileTreeEntry(entry,path)})).then(function(){return Array.prototype.concat.apply([],arguments)})},_getDroppedFiles:function(dataTransfer){dataTransfer=dataTransfer||{};var items=dataTransfer.items;if(items&&items.length&&(items[0].webkitGetAsEntry||items[0].getAsEntry)){return this._handleFileTreeEntries($.map(items,function(item){var entry;if(item.webkitGetAsEntry){entry=item.webkitGetAsEntry();if(entry){entry._file=item.getAsFile()}return entry}return item.getAsEntry()}))}return $.Deferred().resolve($.makeArray(dataTransfer.files)).promise()},_getSingleFileInputFiles:function(fileInput){fileInput=$(fileInput);var entries=fileInput.prop("webkitEntries")||fileInput.prop("entries"),files,value;if(entries&&entries.length){return this._handleFileTreeEntries(entries)}files=$.makeArray(fileInput.prop("files"));if(!files.length){value=fileInput.prop("value");if(!value){return $.Deferred().resolve([]).promise()}files=[{name:value.replace(/^.*\\/,"")}]}else if(files[0].name===undefined&&files[0].fileName){$.each(files,function(index,file){file.name=file.fileName;file.size=file.fileSize})}return $.Deferred().resolve(files).promise()},_getFileInputFiles:function(fileInput){if(!(fileInput instanceof $)||fileInput.length===1){return this._getSingleFileInputFiles(fileInput)}return $.when.apply($,$.map(fileInput,this._getSingleFileInputFiles)).then(function(){return Array.prototype.concat.apply([],arguments)})},_onChange:function(e){var that=this,data={fileInput:$(e.target),form:$(e.target.form)};this._getFileInputFiles(data.fileInput).always(function(files){data.files=files;if(that.options.replaceFileInput){that._replaceFileInput(data)}if(that._trigger("change",$.Event("change",{delegatedEvent:e}),data)!==false){that._onAdd(e,data)}})},_onPaste:function(e){var items=e.originalEvent&&e.originalEvent.clipboardData&&e.originalEvent.clipboardData.items,data={files:[]};if(items&&items.length){$.each(items,function(index,item){var file=item.getAsFile&&item.getAsFile();if(file){data.files.push(file)}});if(this._trigger("paste",$.Event("paste",{delegatedEvent:e}),data)!==false){this._onAdd(e,data)}}},_onDrop:function(e){e.dataTransfer=e.originalEvent&&e.originalEvent.dataTransfer;var that=this,dataTransfer=e.dataTransfer,data={};if(dataTransfer&&dataTransfer.files&&dataTransfer.files.length){e.preventDefault();this._getDroppedFiles(dataTransfer).always(function(files){data.files=files;if(that._trigger("drop",$.Event("drop",{delegatedEvent:e}),data)!==false){that._onAdd(e,data)}})}},_onDragOver:getDragHandler("dragover"),_onDragEnter:getDragHandler("dragenter"),_onDragLeave:getDragHandler("dragleave"),_initEventHandlers:function(){if(this._isXHRUpload(this.options)){this._on(this.options.dropZone,{dragover:this._onDragOver,drop:this._onDrop,dragenter:this._onDragEnter,dragleave:this._onDragLeave});this._on(this.options.pasteZone,{paste:this._onPaste})}if($.support.fileInput){this._on(this.options.fileInput,{change:this._onChange})}},_destroyEventHandlers:function(){this._off(this.options.dropZone,"dragenter dragleave dragover drop");this._off(this.options.pasteZone,"paste");this._off(this.options.fileInput,"change")},_destroy:function(){this._destroyEventHandlers()},_setOption:function(key,value){var reinit=$.inArray(key,this._specialOptions)!==-1;if(reinit){this._destroyEventHandlers()}this._super(key,value);if(reinit){this._initSpecialOptions();this._initEventHandlers()}},_initSpecialOptions:function(){var options=this.options;if(options.fileInput===undefined){options.fileInput=this.element.is('input[type="file"]')?this.element:this.element.find('input[type="file"]')}else if(!(options.fileInput instanceof $)){options.fileInput=$(options.fileInput)}if(!(options.dropZone instanceof $)){options.dropZone=$(options.dropZone)}if(!(options.pasteZone instanceof $)){options.pasteZone=$(options.pasteZone)}},_getRegExp:function(str){var parts=str.split("/"),modifiers=parts.pop();parts.shift();return new RegExp(parts.join("/"),modifiers)},_isRegExpOption:function(key,value){return key!=="url"&&$.type(value)==="string"&&/^\/.*\/[igm]{0,3}$/.test(value)},_initDataAttributes:function(){var that=this,options=this.options,data=this.element.data();$.each(this.element[0].attributes,function(index,attr){var key=attr.name.toLowerCase(),value;if(/^data-/.test(key)){key=key.slice(5).replace(/-[a-z]/g,function(str){return str.charAt(1).toUpperCase()});value=data[key];if(that._isRegExpOption(key,value)){value=that._getRegExp(value)}options[key]=value}})},_create:function(){this._initDataAttributes();this._initSpecialOptions();this._slots=[];this._sequence=this._getXHRPromise(true);this._sending=this._active=0;this._initProgressObject(this);this._initEventHandlers()},active:function(){return this._active},progress:function(){return this._progress},add:function(data){var that=this;if(!data||this.options.disabled){return}if(data.fileInput&&!data.files){this._getFileInputFiles(data.fileInput).always(function(files){data.files=files;that._onAdd(null,data)})}else{data.files=$.makeArray(data.files);this._onAdd(null,data)}},send:function(data){if(data&&!this.options.disabled){if(data.fileInput&&!data.files){var that=this,dfd=$.Deferred(),promise=dfd.promise(),jqXHR,aborted;promise.abort=function(){aborted=true;if(jqXHR){return jqXHR.abort()}dfd.reject(null,"abort","abort");return promise};this._getFileInputFiles(data.fileInput).always(function(files){if(aborted){return}if(!files.length){dfd.reject();return}data.files=files;jqXHR=that._onSend(null,data);jqXHR.then(function(result,textStatus,jqXHR){dfd.resolve(result,textStatus,jqXHR)},function(jqXHR,textStatus,errorThrown){dfd.reject(jqXHR,textStatus,errorThrown)})});return this._enhancePromise(promise)}data.files=$.makeArray(data.files);if(data.files.length){return this._onSend(null,data)}}return this._getXHRPromise(false,data&&data.context)}})});var slice=[].slice,extend=function(child,parent){for(var key in parent){if(hasProp.call(parent,key))child[key]=parent[key]}function ctor(){this.constructor=child}ctor.prototype=parent.prototype;child.prototype=new ctor;child.__super__=parent.prototype;return child},hasProp={}.hasOwnProperty;(function(root,factory){var name,ref,results,value;if(typeof define==="function"&&define.amd){return define(["jquery"],factory)}else if(typeof exports==="object"){return module.exports=factory(require("jquery"))}else{root.cloudinary||(root.cloudinary={});ref=factory(jQuery);results=[];for(name in ref){value=ref[name];results.push(root.cloudinary[name]=value)}return results}})(this,function(jQuery){var ArrayParam,BaseUtil,ClientHintsMetaTag,Cloudinary,CloudinaryJQuery,Condition,Configuration,Expression,ExpressionParam,FetchLayer,HtmlTag,ImageTag,Layer,LayerParam,Param,RangeParam,RawParam,SubtitlesLayer,TextLayer,Transformation,TransformationBase,TransformationParam,Util,VideoTag,addClass,allStrings,base64Encode,base64EncodeURL,camelCase,cloneDeep,cloudinary,compact,contains,convertKeys,crc32,defaults,difference,funcTag,functions,getAttribute,getData,hasClass,identity,isEmpty,isFunction,isNumberLike,isObject,isString,m,merge,objToString,objectProto,parameters,reWords,removeAttribute,setAttribute,setAttributes,setData,smartEscape,snakeCase,utf8_encode,webp,width,withCamelCaseKeys,withSnakeCaseKeys,without;allStrings=function(list){var item,j,len;for(j=0,len=list.length;j127&&c1<2048){enc=String.fromCharCode(c1>>6|192,c1&63|128)}else{enc=String.fromCharCode(c1>>12|224,c1>>6&63|128,c1&63|128)}if(enc!==null){if(end>start){utftext+=string.slice(start,end)}utftext+=enc;start=end=n+1}n++}if(end>start){utftext+=string.slice(start,stringl)}return utftext};crc32=function(str){var crc,i,iTop,table,x,y;str=utf8_encode(str);table="00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";crc=0;x=0;y=0;crc=crc^-1;i=0;iTop=str.length;while(i>>8^x;i++}crc=crc^-1;if(crc<0){crc+=4294967296}return crc};Layer=function(){function Layer(options){this.options={};if(options!=null){["resourceType","type","publicId","format"].forEach(function(_this){return function(key){var ref;return _this.options[key]=(ref=options[key])!=null?ref:options[Util.snakeCase(key)]}}(this))}}Layer.prototype.resourceType=function(value){this.options.resourceType=value;return this};Layer.prototype.type=function(value){this.options.type=value;return this};Layer.prototype.publicId=function(value){this.options.publicId=value;return this};Layer.prototype.getPublicId=function(){var ref;return(ref=this.options.publicId)!=null?ref.replace(/\//g,":"):void 0};Layer.prototype.getFullPublicId=function(){if(this.options.format!=null){return this.getPublicId()+"."+this.options.format}else{return this.getPublicId()}};Layer.prototype.format=function(value){this.options.format=value;return this};Layer.prototype.toString=function(){var components;components=[];if(this.options.publicId==null){throw"Must supply publicId"}if(!(this.options.resourceType==="image")){components.push(this.options.resourceType)}if(!(this.options.type==="upload")){components.push(this.options.type)}components.push(this.getFullPublicId());return Util.compact(components).join(":")};return Layer}();FetchLayer=function(superClass){extend(FetchLayer,superClass);function FetchLayer(options){FetchLayer.__super__.constructor.call(this,options);if(Util.isString(options)){this.options.url=options}else if(options!=null?options.url:void 0){this.options.url=options.url}}FetchLayer.prototype.url=function(url){this.options.url=url;return this};FetchLayer.prototype.toString=function(){return"fetch:"+cloudinary.Util.base64EncodeURL(this.options.url)};return FetchLayer}(Layer);TextLayer=function(superClass){extend(TextLayer,superClass);function TextLayer(options){var keys;TextLayer.__super__.constructor.call(this,options);keys=["resourceType","resourceType","fontFamily","fontSize","fontWeight","fontStyle","textDecoration","textAlign","stroke","letterSpacing","lineSpacing","fontHinting","fontAntialiasing","text"];if(options!=null){keys.forEach(function(_this){return function(key){var ref;return _this.options[key]=(ref=options[key])!=null?ref:options[Util.snakeCase(key)]}}(this))}this.options.resourceType="text"}TextLayer.prototype.resourceType=function(resourceType){throw"Cannot modify resourceType for text layers"};TextLayer.prototype.type=function(type){throw"Cannot modify type for text layers"};TextLayer.prototype.format=function(format){throw"Cannot modify format for text layers"};TextLayer.prototype.fontFamily=function(fontFamily){this.options.fontFamily=fontFamily;return this};TextLayer.prototype.fontSize=function(fontSize){this.options.fontSize=fontSize;return this};TextLayer.prototype.fontWeight=function(fontWeight){this.options.fontWeight=fontWeight;return this};TextLayer.prototype.fontStyle=function(fontStyle){this.options.fontStyle=fontStyle;return this};TextLayer.prototype.textDecoration=function(textDecoration){this.options.textDecoration=textDecoration;return this};TextLayer.prototype.textAlign=function(textAlign){this.options.textAlign=textAlign;return this};TextLayer.prototype.stroke=function(stroke){this.options.stroke=stroke;return this};TextLayer.prototype.letterSpacing=function(letterSpacing){this.options.letterSpacing=letterSpacing;return this};TextLayer.prototype.lineSpacing=function(lineSpacing){this.options.lineSpacing=lineSpacing;return this};TextLayer.prototype.fontAntialiasing=function(fontAntialiasing){this.options.fontAntialiasing=fontAntialiasing;return this};TextLayer.prototype.fontHinting=function(fontHinting){this.options.fontHinting=fontHinting;return this};TextLayer.prototype.text=function(text){this.options.text=text;return this};TextLayer.prototype.toString=function(){var components,hasPublicId,hasStyle,publicId,re,res,start,style,text,textSource;style=this.textStyleIdentifier();if(this.options.publicId!=null){publicId=this.getFullPublicId()}if(this.options.text!=null){hasPublicId=!Util.isEmpty(publicId);hasStyle=!Util.isEmpty(style);if(hasPublicId&&hasStyle||!hasPublicId&&!hasStyle){throw"Must supply either style parameters or a public_id when providing text parameter in a text overlay/underlay, but not both!"}re=/\$\([a-zA-Z]\w*\)/g;start=0;textSource=Util.smartEscape(this.options.text,/[,\/]/g);text="";while(res=re.exec(textSource)){text+=Util.smartEscape(textSource.slice(start,res.index));text+=res[0];start=res.index+res[0].length}text+=Util.smartEscape(textSource.slice(start))}components=[this.options.resourceType,style,publicId,text];return Util.compact(components).join(":")};TextLayer.prototype.textStyleIdentifier=function(){var components;components=[];if(this.options.fontWeight!=="normal"){components.push(this.options.fontWeight)}if(this.options.fontStyle!=="normal"){components.push(this.options.fontStyle)}if(this.options.textDecoration!=="none"){components.push(this.options.textDecoration)}components.push(this.options.textAlign);if(this.options.stroke!=="none"){components.push(this.options.stroke)}if(!(Util.isEmpty(this.options.letterSpacing)&&!Util.isNumberLike(this.options.letterSpacing))){components.push("letter_spacing_"+this.options.letterSpacing)}if(!(Util.isEmpty(this.options.lineSpacing)&&!Util.isNumberLike(this.options.lineSpacing))){components.push("line_spacing_"+this.options.lineSpacing)}if(this.options.fontAntialiasing!=="none"){components.push("antialias_"+this.options.fontAntialiasing)}if(this.options.fontHinting!=="none"){components.push("hinting_"+this.options.fontHinting)}if(!Util.isEmpty(Util.compact(components))){if(Util.isEmpty(this.options.fontFamily)){throw"Must supply fontFamily. "+components}if(Util.isEmpty(this.options.fontSize)&&!Util.isNumberLike(this.options.fontSize)){throw"Must supply fontSize."}}components.unshift(this.options.fontFamily,this.options.fontSize);components=Util.compact(components).join("_");return components};return TextLayer}(Layer);SubtitlesLayer=function(superClass){extend(SubtitlesLayer,superClass);function SubtitlesLayer(options){SubtitlesLayer.__super__.constructor.call(this,options);this.options.resourceType="subtitles"}return SubtitlesLayer}(TextLayer);Param=function(){function Param(name,shortName,process){if(process==null){process=cloudinary.Util.identity}this.name=name;this.shortName=shortName;this.process=process}Param.prototype.set=function(origValue){this.origValue=origValue;return this};Param.prototype.serialize=function(){var val,valid;val=this.value();valid=cloudinary.Util.isArray(val)||cloudinary.Util.isPlainObject(val)||cloudinary.Util.isString(val)?!cloudinary.Util.isEmpty(val):val!=null;if(this.shortName!=null&&valid){return this.shortName+"_"+val}else{return""}};Param.prototype.value=function(){return this.process(this.origValue)};Param.norm_color=function(value){return value!=null?value.replace(/^#/,"rgb:"):void 0};Param.prototype.build_array=function(arg){if(arg==null){arg=[]}if(cloudinary.Util.isArray(arg)){return arg}else{return[arg]}};Param.process_video_params=function(param){var video;switch(param.constructor){case Object:video="";if("codec"in param){video=param["codec"];if("profile"in param){video+=":"+param["profile"];if("level"in param){video+=":"+param["level"]}}}return video;case String:return param;default:return null}};return Param}();ArrayParam=function(superClass){extend(ArrayParam,superClass);function ArrayParam(name,shortName,sep,process){if(sep==null){sep="."}this.sep=sep;ArrayParam.__super__.constructor.call(this,name,shortName,process)}ArrayParam.prototype.serialize=function(){var arrayValue,flat,t;if(this.shortName!=null){arrayValue=this.value();if(cloudinary.Util.isEmpty(arrayValue)){return""}else if(cloudinary.Util.isString(arrayValue)){return this.shortName+"_"+arrayValue}else{flat=function(){var j,len,results;results=[];for(j=0,len=arrayValue.length;j":"gt","<=":"lte",">=":"gte","&&":"and","||":"or","*":"mul","/":"div","+":"add","-":"sub","^":"pow"};Expression.PREDEFINED_VARS={aspect_ratio:"ar",aspectRatio:"ar",current_page:"cp",currentPage:"cp",face_count:"fc",faceCount:"fc",height:"h",initial_aspect_ratio:"iar",initial_height:"ih",initial_width:"iw",initialAspectRatio:"iar",initialHeight:"ih",initialWidth:"iw",page_count:"pc",page_x:"px",page_y:"py",pageCount:"pc",pageX:"px",pageY:"py",tags:"tags",width:"w"};Expression.BOUNDRY="[ _]+";function Expression(expressionStr){this.expressions=[];if(expressionStr!=null){this.expressions.push(Expression.normalize(expressionStr))}}Expression["new"]=function(expressionStr){return new this(expressionStr)};Expression.normalize=function(expression){var operators,operatorsPattern,operatorsReplaceRE,predefinedVarsPattern,predefinedVarsReplaceRE;if(expression==null){return expression}expression=String(expression);operators="\\|\\||>=|<=|&&|!=|>|=|<|/|-|\\+|\\*|\\^";operatorsPattern="(("+operators+")(?=[ _]))";operatorsReplaceRE=new RegExp(operatorsPattern,"g");expression=expression.replace(operatorsReplaceRE,function(match){return Expression.OPERATORS[match]});predefinedVarsPattern="("+Object.keys(Expression.PREDEFINED_VARS).join("|")+")";predefinedVarsReplaceRE=new RegExp(predefinedVarsPattern,"g");expression=expression.replace(predefinedVarsReplaceRE,function(match,p1,offset){return expression[offset-1]==="$"?match:Expression.PREDEFINED_VARS[match]});return expression.replace(/[ _]+/g,"_")};Expression.prototype.serialize=function(){return Expression.normalize(this.expressions.join("_"))};Expression.prototype.toString=function(){return this.serialize()};Expression.prototype.getParent=function(){return this.parent};Expression.prototype.setParent=function(parent){this.parent=parent;return this};Expression.prototype.predicate=function(name,operator,value){if(Expression.OPERATORS[operator]!=null){operator=Expression.OPERATORS[operator]}this.expressions.push(name+"_"+operator+"_"+value);return this};Expression.prototype.and=function(){this.expressions.push("and");return this};Expression.prototype.or=function(){this.expressions.push("or");return this};Expression.prototype.then=function(){return this.getParent()["if"](this.toString())};Expression.prototype.height=function(operator,value){return this.predicate("h",operator,value)};Expression.prototype.width=function(operator,value){return this.predicate("w",operator,value)};Expression.prototype.aspectRatio=function(operator,value){return this.predicate("ar",operator,value)};Expression.prototype.pageCount=function(operator,value){return this.predicate("pc",operator,value)};Expression.prototype.faceCount=function(operator,value){return this.predicate("fc",operator,value)};Expression.prototype.value=function(value){this.expressions.push(value);return this};Expression.variable=function(name,value){return new this(name).value(value)};Expression.width=function(){return new this("width")};Expression.height=function(){return new this("height")};Expression.initialWidth=function(){return new this("initialWidth")};Expression.initialHeight=function(){return new this("initialHeight")};Expression.aspectRatio=function(){return new this("aspectRatio")};Expression.initialAspectRatio=function(){return new this("initialAspectRatio")};Expression.pageCount=function(){return new this("pageCount")};faceCount=function(){return new this("faceCount")};Expression.currentPage=function(){return new this("currentPage")};Expression.tags=function(){return new this("tags")};Expression.pageX=function(){return new this("pageX")};Expression.pageY=function(){return new this("pageY")};return Expression}();Condition=function(superClass){extend(Condition,superClass);function Condition(conditionStr){Condition.__super__.constructor.call(this,conditionStr)}Condition.prototype.height=function(operator,value){return this.predicate("h",operator,value)};Condition.prototype.width=function(operator,value){return this.predicate("w",operator,value)};Condition.prototype.aspectRatio=function(operator,value){return this.predicate("ar",operator,value)};Condition.prototype.pageCount=function(operator,value){return this.predicate("pc",operator,value)};Condition.prototype.faceCount=function(operator,value){return this.predicate("fc",operator,value)};return Condition}(Expression);Configuration=function(){var DEFAULT_CONFIGURATION_PARAMS,ref;DEFAULT_CONFIGURATION_PARAMS={responsive_class:"cld-responsive",responsive_use_breakpoints:true,round_dpr:true,secure:(typeof window!=="undefined"&&window!==null?(ref=window.location)!=null?ref.protocol:void 0:void 0)==="https:"};Configuration.CONFIG_PARAMS=["api_key","api_secret","callback","cdn_subdomain","cloud_name","cname","private_cdn","protocol","resource_type","responsive","responsive_class","responsive_use_breakpoints","responsive_width","round_dpr","secure","secure_cdn_subdomain","secure_distribution","shorten","type","upload_preset","url_suffix","use_root_path","version"];function Configuration(options){if(options==null){options={}}this.configuration=Util.cloneDeep(options);Util.defaults(this.configuration,DEFAULT_CONFIGURATION_PARAMS)}Configuration.prototype.init=function(){this.fromEnvironment();this.fromDocument();return this};Configuration.prototype.set=function(name,value){this.configuration[name]=value;return this};Configuration.prototype.get=function(name){return this.configuration[name]};Configuration.prototype.merge=function(config){if(config==null){config={}}Util.assign(this.configuration,Util.cloneDeep(config));return this};Configuration.prototype.fromDocument=function(){var el,j,len,meta_elements;meta_elements=typeof document!=="undefined"&&document!==null?document.querySelectorAll('meta[name^="cloudinary_"]'):void 0;if(meta_elements){for(j=0,len=meta_elements.length;j=1){if(options["width"]==null){options["width"]=width}}if(parseFloat(height)>=1){if(options["height"]==null){options["height"]=height}}}return options};TransformationBase.prototype.isValidParamName=function(name){return Transformation.methods.indexOf(Util.camelCase(name))>=0};TransformationBase.prototype.toHtml=function(){var ref;return(ref=this.getParent())!=null?typeof ref.toHtml==="function"?ref.toHtml():void 0:void 0};TransformationBase.prototype.toString=function(){return this.serialize()};processVar=function(varArray){var j,len,name,ref,results,v;if(Util.isArray(varArray)){results=[];for(j=0,len=varArray.length;j=0;i=j+=-1){ifVal=this.chained[i].getValue("if");if(ifVal==="end"){break}else if(ifVal!=null){trIf=Transformation["new"]()["if"](ifVal);this.chained[i].remove("if");trRest=this.chained[i];this.chained[i]=Transformation["new"]().transformation([trIf,trRest]);if(ifVal!=="else"){break}}}return this.param(value,"if","if");case"":return Condition["new"]().setParent(this);default:return this.param(value,"if","if",function(value){return Condition["new"](value).toString()})}};Transformation.prototype.keyframeInterval=function(value){return this.param(value,"keyframe_interval","ki")};Transformation.prototype.offset=function(value){var end_o,ref,start_o;ref=Util.isFunction(value!=null?value.split:void 0)?value.split(".."):Util.isArray(value)?value:[null,null],start_o=ref[0],end_o=ref[1];if(start_o!=null){this.startOffset(start_o)}if(end_o!=null){return this.endOffset(end_o)}};Transformation.prototype.opacity=function(value){return this.param(value,"opacity","o",Expression.normalize)};Transformation.prototype.overlay=function(value){return this.layerParam(value,"overlay","l")};Transformation.prototype.page=function(value){return this.param(value,"page","pg")};Transformation.prototype.poster=function(value){return this.param(value,"poster")};Transformation.prototype.prefix=function(value){return this.param(value,"prefix","p")};Transformation.prototype.quality=function(value){return this.param(value,"quality","q",Expression.normalize)};Transformation.prototype.radius=function(value){return this.param(value,"radius","r",Expression.normalize)};Transformation.prototype.rawTransformation=function(value){return this.rawParam(value,"raw_transformation")};Transformation.prototype.size=function(value){var height,ref;if(Util.isFunction(value!=null?value.split:void 0)){ref=value.split("x"),width=ref[0],height=ref[1];this.width(width);return this.height(height)}};Transformation.prototype.sourceTypes=function(value){return this.param(value,"source_types")};Transformation.prototype.sourceTransformation=function(value){return this.param(value,"source_transformation")};Transformation.prototype.startOffset=function(value){return this.rangeParam(value,"start_offset","so")};Transformation.prototype.streamingProfile=function(value){return this.param(value,"streaming_profile","sp")};Transformation.prototype.transformation=function(value){return this.transformationParam(value,"transformation","t")};Transformation.prototype.underlay=function(value){return this.layerParam(value,"underlay","u")};Transformation.prototype.variable=function(name,value){return this.param(value,name,name)};Transformation.prototype.variables=function(values){return this.arrayParam(values,"variables")};Transformation.prototype.videoCodec=function(value){return this.param(value,"video_codec","vc",Param.process_video_params)};Transformation.prototype.videoSampling=function(value){return this.param(value,"video_sampling","vs")};Transformation.prototype.width=function(value){return this.param(value,"width","w",function(_this){return function(){if(_this.getValue("crop")||_this.getValue("overlay")||_this.getValue("underlay")){return Expression.normalize(value)}else{return null}}}(this))};Transformation.prototype.x=function(value){return this.param(value,"x","x",Expression.normalize)};Transformation.prototype.y=function(value){return this.param(value,"y","y",Expression.normalize)};Transformation.prototype.zoom=function(value){return this.param(value,"zoom","z",Expression.normalize)};return Transformation}(TransformationBase);Transformation.methods||(Transformation.methods=Util.difference(Util.functions(Transformation.prototype),Util.functions(TransformationBase.prototype)));Transformation.PARAM_NAMES||(Transformation.PARAM_NAMES=function(){var j,len,ref,results;ref=Transformation.methods;results=[];for(j=0,len=ref.length;j"};HtmlTag.prototype.closeTag=function(){return""+this.name+">"};HtmlTag.prototype.toHtml=function(){return this.openTag()+this.content()+this.closeTag()};HtmlTag.prototype.toDOM=function(){var element,name,ref,value;if(!Util.isFunction(typeof document!=="undefined"&&document!==null?document.createElement:void 0)){throw"Can't create DOM if document is not present!"}element=document.createElement(this.name);ref=this.attributes();for(name in ref){value=ref[name];element[name]=value}return element};HtmlTag.isResponsive=function(tag,responsiveClass){var dataSrc;dataSrc=Util.getData(tag,"src-cache")||Util.getData(tag,"src");return Util.hasClass(tag,responsiveClass)&&/\bw_auto\b/.exec(dataSrc)};return HtmlTag}();ImageTag=function(superClass){extend(ImageTag,superClass);function ImageTag(publicId,options){if(options==null){options={}}ImageTag.__super__.constructor.call(this,"img",publicId,options)}ImageTag.prototype.closeTag=function(){return""};ImageTag.prototype.attributes=function(){var attr,options,srcAttribute;attr=ImageTag.__super__.attributes.call(this)||[];options=this.getOptions();srcAttribute=options.responsive&&!options.client_hints?"data-src":"src";if(attr[srcAttribute]==null){attr[srcAttribute]=new Cloudinary(this.getOptions()).url(this.publicId)}return attr};return ImageTag}(HtmlTag);VideoTag=function(superClass){var DEFAULT_POSTER_OPTIONS,DEFAULT_VIDEO_SOURCE_TYPES,VIDEO_TAG_PARAMS;extend(VideoTag,superClass);VIDEO_TAG_PARAMS=["source_types","source_transformation","fallback_content","poster"];DEFAULT_VIDEO_SOURCE_TYPES=["webm","mp4","ogv"];DEFAULT_POSTER_OPTIONS={format:"jpg",resource_type:"video"};function VideoTag(publicId,options){if(options==null){options={}}options=Util.defaults({},options,Cloudinary.DEFAULT_VIDEO_PARAMS);VideoTag.__super__.constructor.call(this,"video",publicId.replace(/\.(mp4|ogv|webm)$/,""),options)}VideoTag.prototype.setSourceTransformation=function(value){this.transformation().sourceTransformation(value);return this};VideoTag.prototype.setSourceTypes=function(value){this.transformation().sourceTypes(value);return this};VideoTag.prototype.setPoster=function(value){this.transformation().poster(value);return this};VideoTag.prototype.setFallbackContent=function(value){this.transformation().fallbackContent(value);return this};VideoTag.prototype.content=function(){var cld,fallback,innerTags,mimeType,sourceTransformation,sourceTypes,src,srcType,transformation,videoType;sourceTypes=this.transformation().getValue("source_types");sourceTransformation=this.transformation().getValue("source_transformation");fallback=this.transformation().getValue("fallback_content");if(Util.isArray(sourceTypes)){cld=new Cloudinary(this.getOptions());innerTags=function(){var j,len,results;results=[];for(j=0,len=sourceTypes.length;j")}return results}.call(this)}else{innerTags=[]}return innerTags.join("")+fallback};VideoTag.prototype.attributes=function(){var a,attr,j,len,poster,ref,ref1,sourceTypes;sourceTypes=this.getOption("source_types");poster=(ref=this.getOption("poster"))!=null?ref:{};if(Util.isPlainObject(poster)){defaults=poster.public_id!=null?Cloudinary.DEFAULT_IMAGE_PARAMS:DEFAULT_POSTER_OPTIONS;poster=new Cloudinary(this.getOptions()).url((ref1=poster.public_id)!=null?ref1:this.publicId,Util.defaults({},poster,defaults))}attr=VideoTag.__super__.attributes.call(this)||[];for(j=0,len=attr.length;j=0&&!publicId.match(/^v[0-9]+/)&&!publicId.match(/^https?:\//)&&!((ref=options.version)!=null?ref.toString():void 0)){options.version=1}if(publicId.match(/^https?:/)){if(options.type==="upload"||options.type==="asset"){url=publicId}else{publicId=encodeURIComponent(publicId).replace(/%3A/g,":").replace(/%2F/g,"/")}}else{try{publicId=decodeURIComponent(publicId)}catch(error1){error=error1}publicId=encodeURIComponent(publicId).replace(/%3A/g,":").replace(/%2F/g,"/");if(options.url_suffix){if(options.url_suffix.match(/[\.\/]/)){throw"url_suffix should not include . or /"}publicId=publicId+"/"+options.url_suffix}if(options.format){if(!options.trust_public_id){publicId=publicId.replace(/\.(jpg|png|gif|webp)$/,"")}publicId=publicId+"."+options.format}}prefix=cloudinaryUrlPrefix(publicId,options);resourceTypeAndType=finalizeResourceType(options.resource_type,options.type,options.url_suffix,options.use_root_path,options.shorten);version=options.version?"v"+options.version:"";return url||Util.compact([prefix,resourceTypeAndType,transformationString,version,publicId]).join("/").replace(/([^:])\/+/g,"$1/")};Cloudinary.prototype.video_url=function(publicId,options){options=Util.assign({resource_type:"video"},options);return this.url(publicId,options)};Cloudinary.prototype.video_thumbnail_url=function(publicId,options){options=Util.assign({},DEFAULT_POSTER_OPTIONS,options);return this.url(publicId,options)};Cloudinary.prototype.transformation_string=function(options){return new Transformation(options).serialize()};Cloudinary.prototype.image=function(publicId,options){var client_hints,img,ref,ref1;if(options==null){options={}}img=this.imageTag(publicId,options);client_hints=(ref=(ref1=options.client_hints)!=null?ref1:this.config("client_hints"))!=null?ref:false;if(!(options.src!=null||client_hints)){img.setAttr("src","")}img=img.toDOM();if(!client_hints){Util.setData(img,"src-cache",this.url(publicId,options));this.cloudinary_update(img,options)}return img};Cloudinary.prototype.imageTag=function(publicId,options){var tag;tag=new ImageTag(publicId,this.config());tag.transformation().fromOptions(options);return tag};Cloudinary.prototype.video_thumbnail=function(publicId,options){return this.image(publicId,Util.merge({},DEFAULT_POSTER_OPTIONS,options))};Cloudinary.prototype.facebook_profile_image=function(publicId,options){return this.image(publicId,Util.assign({type:"facebook"},options))};Cloudinary.prototype.twitter_profile_image=function(publicId,options){return this.image(publicId,Util.assign({type:"twitter"},options))};Cloudinary.prototype.twitter_name_profile_image=function(publicId,options){return this.image(publicId,Util.assign({type:"twitter_name"},options))};Cloudinary.prototype.gravatar_image=function(publicId,options){return this.image(publicId,Util.assign({type:"gravatar"},options))};Cloudinary.prototype.fetch_image=function(publicId,options){return this.image(publicId,Util.assign({type:"fetch"},options))};Cloudinary.prototype.video=function(publicId,options){if(options==null){options={}}return this.videoTag(publicId,options).toHtml()};Cloudinary.prototype.videoTag=function(publicId,options){options=Util.defaults({},options,this.config());return new VideoTag(publicId,options)};Cloudinary.prototype.sprite_css=function(publicId,options){options=Util.assign({type:"sprite"},options);if(!publicId.match(/.css$/)){options.format="css"}return this.url(publicId,options)};Cloudinary.prototype.responsive=function(options,bootstrap){var ref,ref1,ref2,responsiveClass,responsiveResize,timeout;if(bootstrap==null){bootstrap=true}this.responsiveConfig=Util.merge(this.responsiveConfig||{},options);responsiveClass=(ref=this.responsiveConfig["responsive_class"])!=null?ref:this.config("responsive_class");if(bootstrap){this.cloudinary_update("img."+responsiveClass+", img.cld-hidpi",this.responsiveConfig)}responsiveResize=(ref1=(ref2=this.responsiveConfig["responsive_resize"])!=null?ref2:this.config("responsive_resize"))!=null?ref1:true;if(responsiveResize&&!this.responsiveResizeInitialized){this.responsiveConfig.resizing=this.responsiveResizeInitialized=true;timeout=null;return window.addEventListener("resize",function(_this){return function(){var debounce,ref3,ref4,reset,run,wait,waitFunc;debounce=(ref3=(ref4=_this.responsiveConfig["responsive_debounce"])!=null?ref4:_this.config("responsive_debounce"))!=null?ref3:100;reset=function(){if(timeout){clearTimeout(timeout);return timeout=null}};run=function(){return _this.cloudinary_update("img."+responsiveClass,_this.responsiveConfig)};waitFunc=function(){reset();return run()};wait=function(){reset();return timeout=setTimeout(waitFunc,debounce)};if(debounce){return wait()}else{return run()}}}(this))}};Cloudinary.prototype.calc_breakpoint=function(element,width,steps){var breakpoints,point;breakpoints=Util.getData(element,"breakpoints")||Util.getData(element,"stoppoints")||this.config("breakpoints")||this.config("stoppoints")||defaultBreakpoints;if(Util.isFunction(breakpoints)){return breakpoints(width,steps)}else{if(Util.isString(breakpoints)){breakpoints=function(){var j,len,ref,results;ref=breakpoints.split(",");results=[];for(j=0,len=ref.length;j=0&&list[i]>=value){i--}return list[i+1]};cdnSubdomainNumber=function(publicId){return crc32(publicId)%5+1};cloudinaryUrlPrefix=function(publicId,options){var cdnPart,host,path,protocol,ref,subdomain;if(((ref=options.cloud_name)!=null?ref.indexOf("/"):void 0)===0){return"/res"+options.cloud_name}protocol="http://";cdnPart="";subdomain="res";host=".cloudinary.com";path="/"+options.cloud_name;if(options.protocol){protocol=options.protocol+"//"}if(options.private_cdn){cdnPart=options.cloud_name+"-";path=""}if(options.cdn_subdomain){subdomain="res-"+cdnSubdomainNumber(publicId)}if(options.secure){protocol="https://";if(options.secure_cdn_subdomain===false){subdomain="res"}if(options.secure_distribution!=null&&options.secure_distribution!==OLD_AKAMAI_SHARED_CDN&&options.secure_distribution!==SHARED_CDN){cdnPart="";subdomain="";host=options.secure_distribution}}else if(options.cname){protocol="http://";cdnPart="";subdomain=options.cdn_subdomain?"a"+(crc32(publicId)%5+1)+".":"";host=options.cname}return[protocol,cdnPart,subdomain,host,path].join("")};Cloudinary.prototype.processImageTags=function(nodes,options){var images,imgOptions,node,publicId,url;if(options==null){options={}}if(Util.isEmpty(nodes)){return this}options=Util.defaults({},options,this.config());images=function(){var j,len,ref,results;results=[];for(j=0,len=nodes.length;jimageWidth){imageWidth=requiredWidth;Util.setData(tag,"width",requiredWidth)}return imageWidth};Cloudinary.prototype.cloudinary_update=function(elements,options){var containerWidth,dataSrc,j,len,match,ref,ref1,ref2,ref3,ref4,ref5,requiredWidth,responsive,responsiveClass,roundDpr,setUrl,tag;if(options==null){options={}}if(elements===null){return this}responsive=(ref=(ref1=options.responsive)!=null?ref1:this.config("responsive"))!=null?ref:false;elements=function(){switch(false){case!Util.isArray(elements):return elements;case elements.constructor.name!=="NodeList":return elements;case!Util.isString(elements):return document.querySelectorAll(elements);default:return[elements]}}();responsiveClass=(ref2=(ref3=this.responsiveConfig["responsive_class"])!=null?ref3:options["responsive_class"])!=null?ref2:this.config("responsive_class");roundDpr=(ref4=options["round_dpr"])!=null?ref4:this.config("round_dpr");for(j=0,len=elements.length;j").attr({type:"file",name:"file"}).unsigned_cloudinary_upload(upload_preset,upload_params,options)};jQuery.fn.cloudinary_fileupload=function(options){var cloud_name,initializing,resource_type,type,upload_url;if(!Util.isFunction(jQuery.fn.fileupload)){return this}initializing=!this.data("blueimpFileupload");if(initializing){options=jQuery.extend({maxFileSize:2e7,dataType:"json",headers:{"X-Requested-With":"XMLHttpRequest"}},options)}this.fileupload(options);if(initializing){this.bind("fileuploaddone",function(e,data){var add_field,field,multiple,upload_info;if(data.result.error){return}data.result.path=["v",data.result.version,"/",data.result.public_id,data.result.format?"."+data.result.format:""].join("");if(data.cloudinaryField&&data.form.length>0){upload_info=[data.result.resource_type,data.result.type,data.result.path].join("/")+"#"+data.result.signature;multiple=jQuery(e.target).prop("multiple");add_field=function(){return jQuery("").attr({type:"hidden",name:data.cloudinaryField}).val(upload_info).appendTo(data.form)};if(multiple){add_field()}else{field=jQuery(data.form).find('input[name="'+data.cloudinaryField+'"]');if(field.length>0){field.val(upload_info)}else{add_field()}}}return jQuery(e.target).trigger("cloudinarydone",data)});this.bind("fileuploadsend",function(e,data){data.headers=jQuery.extend({},data.headers,{"X-Unique-Upload-Id":(Math.random()*1e10).toString(16)});return true});this.bind("fileuploadstart",function(e){return jQuery(e.target).trigger("cloudinarystart")});this.bind("fileuploadstop",function(e){return jQuery(e.target).trigger("cloudinarystop")});this.bind("fileuploadprogress",function(e,data){return jQuery(e.target).trigger("cloudinaryprogress",data)});this.bind("fileuploadprogressall",function(e,data){return jQuery(e.target).trigger("cloudinaryprogressall",data)});this.bind("fileuploadfail",function(e,data){return jQuery(e.target).trigger("cloudinaryfail",data)});this.bind("fileuploadalways",function(e,data){return jQuery(e.target).trigger("cloudinaryalways",data)});if(!this.fileupload("option").url){cloud_name=options.cloud_name||jQuery.cloudinary.config().cloud_name;resource_type=options.resource_type||"auto";type=options.type||"upload";upload_url="https://api.cloudinary.com/v1_1/"+cloud_name+"/"+resource_type+"/"+type;this.fileupload("option","url",upload_url)}}return this};jQuery.fn.cloudinary_upload_url=function(remote_url){if(!Util.isFunction(jQuery.fn.fileupload)){return this}this.fileupload("option","formData").file=remote_url;this.fileupload("add",{files:[remote_url]});delete this.fileupload("option","formData").file;return this};jQuery.fn.unsigned_cloudinary_upload=function(upload_preset,upload_params,options){var attr,attrs_to_move,html_options,i,key,value;if(upload_params==null){upload_params={}}if(options==null){options={}}upload_params=Util.cloneDeep(upload_params);options=Util.cloneDeep(options);attrs_to_move=["cloud_name","resource_type","type"];i=0;while(i0&&jQuery.isArray(value[0])){upload_params[key]=jQuery.map(value,function(array_value){return array_value.join(",")}).join("|")}else{upload_params[key]=value.join(",")}}}if(!upload_params.callback){upload_params.callback="/cloudinary_cors.html"}upload_params.upload_preset=upload_preset;options.formData=upload_params;if(options.cloudinary_field){options.cloudinaryField=options.cloudinary_field;delete options.cloudinary_field}html_options=options.html||{};html_options["class"]=Util.trim("cloudinary_fileupload "+(html_options["class"]||""));if(options.multiple){html_options.multiple=true}this.attr(html_options).cloudinary_fileupload(options);return this};jQuery.cloudinary=new CloudinaryJQuery;cloudinary={utf8_encode:utf8_encode,crc32:crc32,Util:Util,Condition:Condition,Transformation:Transformation,Configuration:Configuration,HtmlTag:HtmlTag,ImageTag:ImageTag,VideoTag:VideoTag,ClientHintsMetaTag:ClientHintsMetaTag,Layer:Layer,FetchLayer:FetchLayer,TextLayer:TextLayer,SubtitlesLayer:SubtitlesLayer,Cloudinary:Cloudinary,VERSION:"2.5.0",CloudinaryJQuery:CloudinaryJQuery};return cloudinary});$(function(){var DISMISS_KEY="email_banner_dismiss";var $banner=$("#email-confirmation-banner");var $closeButton=$("#js-email-banner-close");var dismissed=window.sessionStorage&&window.sessionStorage[DISMISS_KEY];if(!dismissed){window.setTimeout(function(){$banner.removeClass("!hidden");$closeButton.on("click",function(e){e.preventDefault();$banner.addClass("!hidden");if(window.sessionStorage){window.sessionStorage[DISMISS_KEY]=true}})},1e3)}});function reviewSubmitHandler(event){event.preventDefault();var $form=$(this);$.ajax(this.action,{method:this.method,data:$form.serialize(),success:function(data){if(data.success){window.Lightbox.closeAllLightboxes();window.RemotePartial.loadRemotePartial("#js-admin-actions")}else{if(data["error_message"]){$form.find(".form--errors-item").html(""+data["error_message"]+"
")}$form.removeClass("-submitted")}}})}$(document).on("click","#js-review-request",function(event){event.preventDefault();window.Lightbox.openLightbox("idea-book-review-request",$(this).data(),function(){$("#js-review-request-form").submit(reviewSubmitHandler)})}).on("click","#js-review-response",function(event){event.preventDefault();window.Lightbox.openLightbox("idea-book-review-response",$(this).data(),function(){$("#js-review-response-form").submit(reviewSubmitHandler)})});var photoAddedToIdeabook=function(data){var $form=$("#save-to-ideabook-form-content");$form.find(".ideabook-used-link").attr("href",data["idea_book"]["path"]);$form.find(".ideabook-title").text(data["idea_book"]["title"]);if(data["idea_books"]){$(".save-to-ideabook-form-content--select").html(data["idea_books"])}$("#save-to-ideabook").removeClass("-submitted");window.Lightbox.closeAllLightboxes();window.User.askToSignup({display:function(){$(".js-ideabook-signup-title").show();$(".js-signup-title").hide()},success:function(){window.Lightbox.openLightbox("save-to-ideabook-form-content",{url:"save-to-ideabook"},function(){var type;if($form.length===0){$(".save-to-ideabook-form-content--photo-id").val(data["photo_id"]);$("body").find(".ideabook-used-link").attr("href",data["idea_book"]["path"]);$("body").find(".ideabook-title").text(data["idea_book"]["title"]);if(data["idea_book_photo_type"]==="IdeaBookRoom"){type="photo"}else{type="product"}loadAddToIdeaBookDialog(data["photo_id"],type)}})}})};function getParameterByName(name){name=name.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var regex=new RegExp("[\\?&]"+name+"=([^]*)");var results=regex.exec(location.search);return results===null?"":decodeURIComponent(results[1].replace(/\+/g," "))}var initializeLightboxLinks=function(){$("body").on("click",".add-to-ideabook-lightbox-link",function(){var linkId=$(this).attr("id");var photoId=linkId.replace("add-idea-book-photo-","");var type=$(this).data("type");var ideaBookPhotoType;if(type==="product"){ideaBookPhotoType="IdeaBookProduct"}else if(type==="idea_book_upload_photo"){ideaBookPhotoType="IdeaBookUpload"}else{ideaBookPhotoType="IdeaBookRoom"}window.Lightbox.openLightbox("save-to-ideabook",function(){$(".save-to-ideabook-form-content--photo-id").val(photoId);$(".save-to-ideabook-form-content--type").val(ideaBookPhotoType);loadAddToIdeaBookDialog(photoId,type)})})};$(function(){$(document).on("focus","#idea_book_title",function(){$("#idea_book_photo_idea_book_id").val(0)});$(document).on("change","#idea_book_photo_idea_book_id",function(){var $transferIdParent=$("#transfer_user_id_parent");var $ideabookTitleParent=$("#idea_book_title_parent");if($(this).val()==="anothers_ideabook"){$ideabookTitleParent.addClass("-hidden");$transferIdParent.removeClass("-hidden")}else{$ideabookTitleParent.removeClass("-hidden");$transferIdParent.addClass("-hidden");$("#transfer_id").val("")}});$(document).on("click",".save-to-ideabook-form-content--submit-button",function(e){$(this).prop("disabled",true);var $lightbox=$("#save-to-ideabook");$lightbox.addClass("-submitted");$lightbox.submit();$lightbox.find(".save-to-ideabook-form-content .form--errors").hide();$lightbox.find(".save-to-ideabook-form-content--title").val("");$lightbox.find(".save-to-ideabook-form-content--description").val("");$lightbox.find(".form--cancel").removeAttr("disabled");$(".save-to-ideabook-form-content--submit-button").removeAttr("disabled");e.preventDefault()});$(document).on("ajax:success","form#save-to-ideabook",function(e,data){photoAddedToIdeabook(data)});initializeLightboxLinks();var data;if(window.DocCookie.hasItem("saved_idea_book")){data=JSON.parse(window.DocCookie.getItem("saved_idea_book"));photoAddedToIdeabook(data);window.DocCookie.removeItem("saved_idea_book","/")}});var loadAddToIdeaBookDialog=function(photoId,type){$("#save-to-ideabook .save-to-ideabook-form-content--photo-id").val(photoId);var $lightbox=$("#save-to-ideabook-form-content");$lightbox.find(".js-add-to-ideabook-preview").attr("src",null);$lightbox.find(".form--errors-item").html("");return $.ajax({url:"/idea_book_photos/save_to_ideabook",type:"GET",data:{photo_id:photoId,type:type}})};var addToIdeaBookErrorNotification=function(message){var $lightbox=$("#save-to-ideabook");$lightbox.find(".form--errors-item").html(message);$lightbox.find(".form--errors").show();$(".save-to-ideabook-form-content--submit-button").removeAttr("disabled");$(".add-to-ideabook-cancel").removeAttr("disabled");$(".add-to-ideabook-submit-form-loader").hide();$lightbox.removeClass("-submitted")};$(window).on("load",function(){var photoToAdd=getParameterByName("add_to_idea_book");if(photoToAdd){$("#add-idea-book-photo-"+photoToAdd).trigger("click")}var checkCount=0;var gEl=$("[id*=google_osd_static_frame_] + .adsbygoogle ins + ins > span > svg");var gInterval=setInterval(function(){if(gEl.length||checkCount>=100){gEl.attr("style",function(i,s){return(s||"")+" left: 100px !important"});clearInterval(gInterval)}},50)});var showIdeaBookAdminActions=function(html){var $container=$("#js-admin-actions");var $adminActions=$(html);$container.replaceWith($adminActions);window.Lightbox.setLightboxLinks();window.User.setToken(window.user.token)};$(document).on("click","#js-toggle-feature-idea-book",function(){this.disabled=true;$.ajax(this.dataset.action,{method:this.dataset.method}).success(showIdeaBookAdminActions)});$(document).on("click",".js-toggle-newsletter",function(){this.disabled=true;$.ajax(this.dataset.action,{method:"put",dataType:"json"}).success(function(data){if(data["success"]){$(".js-toggle-newsletter").toggleClass("-hidden-")}else{alert("This week's newsletter is full. Please go to the admin page to remove one.")}this.disabled=false}.bind(this))});$(document).on("change",".save-to-ideabook-form-content--select",function(e){if(e.target.value!=="0"){$("#idea_book_title_parent").fadeOut("slow")}else{$("#idea_book_title_parent").fadeIn("slow")}});$(document).on("click",".js-show-phone",()=>{trackContact("clicked call");$(".js-show-phone").addClass("-hidden-");$(".js-show-phone").removeClass("-up-from-sm-");$(".show-user--phone").addClass("-up-from-sm-");$(".show-user--phone").removeClass("-hidden-")});function trackContact(action,userId){userId=userId||$(".user-header").data("user-id")||$(this).data("user-id");trackGA("event","Contact",action,userId)}ContextMenu={show:function(event,pathName,altText,imagePath_316,imagePath_632,projectPath,profilePath,by,photoOrProjectName,companyName,noContextMenu){if(this.contextMenuDiv!=null||(this.contextMenuDiv=document.getElementsByClassName("context-menu")[0],this.contextMenuDiv)){event=event||window.event;event.preventDefault();this.altText=altText;this.pathName=pathName;this.imagePath_316=imagePath_316;this.imagePath_632=imagePath_632;this.projectPath=projectPath;this.profilePath=profilePath;this.photoOrProjectName=photoOrProjectName;this.by=by;this.companyName=companyName;if(noContextMenu==="true"){this.showBox()}else{this.contextMenuDiv.style.display="block";$(this.contextMenuDiv).offset({left:event.pageX,top:event.pageY});contextMenuFocus=document.getElementsByClassName("context-menu--focus")[0];return contextMenuFocus&&contextMenuFocus.focus(),this.contextMenuShowing=true,false}}},dismiss:function(event){this.contextMenuShowing=false;var that=this;setTimeout(function(){that.hide(that)},200)},hide:function(event){this.contextMenuShowing||(this.contextMenuDiv.style.display="none")},photoInNewWindow:function(){url=this.getHost()+this.pathName;window.open(url)},getHost:function(){return window.location.origin},getHtml:function(size){homify_url=this.getHost()+this.pathName;html_tag="';html_tag+='"},embedCode:function(){var that=this;$.each({big:"632",small:"316"},function(css_class,size){$(".embed-box--textarea.-"+css_class).text(that.getHtml(size))})},showBox:function(){var that=this;window.Lightbox.openLightbox("context-menu",function(){that.embedCode()})}};(function(){var undefined;var VERSION="4.17.5";var LARGE_ARRAY_SIZE=200;var CORE_ERROR_TEXT="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",FUNC_ERROR_TEXT="Expected a function";var HASH_UNDEFINED="__lodash_hash_undefined__";var MAX_MEMOIZE_SIZE=500;var PLACEHOLDER="__lodash_placeholder__";var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION="...";var HOT_COUNT=800,HOT_SPAN=16;var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=17976931348623157e292,NAN=0/0;var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;var wrapFlags=[["ary",WRAP_ARY_FLAG],["bind",WRAP_BIND_FLAG],["bindKey",WRAP_BIND_KEY_FLAG],["curry",WRAP_CURRY_FLAG],["curryRight",WRAP_CURRY_RIGHT_FLAG],["flip",WRAP_FLIP_FLAG],["partial",WRAP_PARTIAL_FLAG],["partialRight",WRAP_PARTIAL_RIGHT_FLAG],["rearg",WRAP_REARG_FLAG]];var argsTag="[object Arguments]",arrayTag="[object Array]",asyncTag="[object AsyncFunction]",boolTag="[object Boolean]",dateTag="[object Date]",domExcTag="[object DOMException]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",nullTag="[object Null]",objectTag="[object Object]",promiseTag="[object Promise]",proxyTag="[object Proxy]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",undefinedTag="[object Undefined]",weakMapTag="[object WeakMap]",weakSetTag="[object WeakSet]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);var reTrim=/^\s+|\s+$/g,reTrimStart=/^\s+/,reTrimEnd=/\s+$/;var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;var reEscapeChar=/\\(\\)?/g;var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var reFlags=/\w*$/;var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;var reIsBinary=/^0b[01]+$/i;var reIsHostCtor=/^\[object .+?Constructor\]$/;var reIsOctal=/^0o[0-7]+$/i;var reIsUint=/^(?:0|[1-9]\d*)$/;var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;var reNoMatch=/($^)/;var reUnescapedString=/['\n\r\u2028\u2029\\]/g;var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange="a-z\\xdf-\\xf6\\xf8-\\xff",rsMathOpRange="\\xac\\xb1\\xd7\\xf7",rsNonCharRange="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange="A-Z\\xc0-\\xd6\\xd8-\\xde",rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;var rsApos="['’]",rsAstral="["+rsAstralRange+"]",rsBreak="["+rsBreakRange+"]",rsCombo="["+rsComboRange+"]",rsDigits="\\d+",rsDingbat="["+rsDingbatRange+"]",rsLower="["+rsLowerRange+"]",rsMisc="[^"+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+"]",rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier="(?:"+rsCombo+"|"+rsFitz+")",rsNonAstral="[^"+rsAstralRange+"]",rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper="["+rsUpperRange+"]",rsZWJ="\\u200d";var rsMiscLower="(?:"+rsLower+"|"+rsMisc+")",rsMiscUpper="(?:"+rsUpper+"|"+rsMisc+")",rsOptContrLower="(?:"+rsApos+"(?:d|ll|m|re|s|t|ve))?",rsOptContrUpper="(?:"+rsApos+"(?:D|LL|M|RE|S|T|VE))?",reOptMod=rsModifier+"?",rsOptVar="["+rsVarRange+"]?",rsOptJoin="(?:"+rsZWJ+"(?:"+[rsNonAstral,rsRegional,rsSurrPair].join("|")+")"+rsOptVar+reOptMod+")*",rsOrdLower="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",rsOrdUpper="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji="(?:"+[rsDingbat,rsRegional,rsSurrPair].join("|")+")"+rsSeq,rsSymbol="(?:"+[rsNonAstral+rsCombo+"?",rsCombo,rsRegional,rsSurrPair,rsAstral].join("|")+")";var reApos=RegExp(rsApos,"g");var reComboMark=RegExp(rsCombo,"g");var reUnicode=RegExp(rsFitz+"(?="+rsFitz+")|"+rsSymbol+rsSeq,"g");var reUnicodeWord=RegExp([rsUpper+"?"+rsLower+"+"+rsOptContrLower+"(?="+[rsBreak,rsUpper,"$"].join("|")+")",rsMiscUpper+"+"+rsOptContrUpper+"(?="+[rsBreak,rsUpper+rsMiscLower,"$"].join("|")+")",rsUpper+"?"+rsMiscLower+"+"+rsOptContrLower,rsUpper+"+"+rsOptContrUpper,rsOrdUpper,rsOrdLower,rsDigits,rsEmoji].join("|"),"g");var reHasUnicode=RegExp("["+rsZWJ+rsAstralRange+rsComboRange+rsVarRange+"]");var reHasUnicodeWord=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;var contextProps=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"];var templateCounter=-1;var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;var deburredLetters={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"};var htmlEscapes={"&":"&","<":"<",">":">",'"':""","'":"'"};var htmlUnescapes={"&":"&","<":"<",">":">",""":'"',"'":"'"};var stringEscapes={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};var freeParseFloat=parseFloat,freeParseInt=parseInt;var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeProcess=moduleExports&&freeGlobal.process;var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();var nodeIsArrayBuffer=nodeUtil&&nodeUtil.isArrayBuffer,nodeIsDate=nodeUtil&&nodeUtil.isDate,nodeIsMap=nodeUtil&&nodeUtil.isMap,nodeIsRegExp=nodeUtil&&nodeUtil.isRegExp,nodeIsSet=nodeUtil&&nodeUtil.isSet,nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayAggregator(array,setter,iteratee,accumulator){var index=-1,length=array==null?0:array.length;while(++index-1}function arrayIncludesWith(array,value,comparator){var index=-1,length=array==null?0:array.length;while(++index-1){}return index}function charsEndIndex(strSymbols,chrSymbols){var index=strSymbols.length;while(index--&&baseIndexOf(chrSymbols,strSymbols[index],0)>-1){}return index}function countHolders(array,placeholder){var length=array.length,result=0;while(length--){if(array[length]===placeholder){++result}}return result}var deburrLetter=basePropertyOf(deburredLetters);var escapeHtmlChar=basePropertyOf(htmlEscapes);function escapeStringChar(chr){return"\\"+stringEscapes[chr]}function getValue(object,key){return object==null?undefined:object[key]}function hasUnicode(string){return reHasUnicode.test(string)}function hasUnicodeWord(string){return reHasUnicodeWord.test(string)}function iteratorToArray(iterator){var data,result=[];while(!(data=iterator.next()).done){result.push(data.value)}return result}function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}function overArg(func,transform){return function(arg){return func(transform(arg))}}function replaceHolders(array,placeholder){var index=-1,length=array.length,resIndex=0,result=[];while(++index-1}function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else{data[index][1]=value}return this}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index=lower?number:lower}}return number}function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer){result=object?customizer(value,key,object,stack):customizer(value)}if(result!==undefined){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return copyArray(value,result)}}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value)){return cloneBuffer(value,isDeep)}if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep){return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value))}}else{if(!cloneableTags[tag]){return object?value:{}}result=initCloneByTag(value,tag,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked){return stacked}stack.set(value,result);if(isSet(value)){value.forEach(function(subValue){result.add(baseClone(subValue,bitmask,customizer,subValue,value,stack))});return result}if(isMap(value)){value.forEach(function(subValue,key){result.set(key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}function baseConforms(source){var props=keys(source);return function(object){return baseConformsTo(object,source,props)}}function baseConformsTo(object,source,props){var length=props.length;if(object==null){return!length}object=Object(object);while(length--){var key=props[length],predicate=source[key],value=object[key];if(value===undefined&&!(key in object)||!predicate(value)){return false}}return true}function baseDelay(func,wait,args){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return setTimeout(function(){func.apply(undefined,args)},wait)}function baseDifference(array,values,iteratee,comparator){var index=-1,includes=arrayIncludes,isCommon=true,length=array.length,result=[],valuesLength=values.length;if(!length){return result}if(iteratee){values=arrayMap(values,baseUnary(iteratee))}if(comparator){includes=arrayIncludesWith;isCommon=false}else if(values.length>=LARGE_ARRAY_SIZE){includes=cacheHas;isCommon=false;values=new SetCache(values)}outer:while(++indexlength?0:length+start}end=end===undefined||end>length?length:toInteger(end);if(end<0){end+=length}end=start>end?0:toLength(end);while(start0&&predicate(value)){if(depth>1){baseFlatten(value,depth-1,predicate,isStrict,result)}else{arrayPush(result,value)}}else if(!isStrict){result[result.length]=value}}return result}var baseFor=createBaseFor();var baseForRight=createBaseFor(true);function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseForOwnRight(object,iteratee){return object&&baseForRight(object,iteratee,keys)}function baseFunctions(object,props){return arrayFilter(props,function(key){return isFunction(object[key])})}function baseGet(object,path){path=castPath(path,object);var index=0,length=path.length;while(object!=null&&indexother}function baseHas(object,key){return object!=null&&hasOwnProperty.call(object,key)}function baseHasIn(object,key){return object!=null&&key in Object(object)}function baseInRange(number,start,end){return number>=nativeMin(start,end)&&number=120&&array.length>=120)?new SetCache(othIndex&&array):undefined}array=arrays[0];var index=-1,seen=caches[0];outer:while(++index-1){if(seen!==array){splice.call(seen,fromIndex,1)}splice.call(array,fromIndex,1)}}return array}function basePullAt(array,indexes){var length=array?indexes.length:0,lastIndex=length-1;while(length--){var index=indexes[length];if(length==lastIndex||index!==previous){var previous=index;if(isIndex(index)){splice.call(array,index,1)}else{baseUnset(array,index)}}}return array}function baseRandom(lower,upper){return lower+nativeFloor(nativeRandom()*(upper-lower+1))}function baseRange(start,end,step,fromRight){var index=-1,length=nativeMax(nativeCeil((end-start)/(step||1)),0),result=Array(length);while(length--){result[fromRight?length:++index]=start;start+=step}return result}function baseRepeat(string,n){var result="";if(!string||n<1||n>MAX_SAFE_INTEGER){return result}do{if(n%2){result+=string}n=nativeFloor(n/2);if(n){string+=string}}while(n);return result}function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}function baseSample(collection){return arraySample(values(collection))}function baseSampleSize(collection,n){var array=values(collection);return shuffleSelf(array,baseClamp(n,0,array.length))}function baseSet(object,path,value,customizer){if(!isObject(object)){return object}path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++indexlength?0:length+start}end=end>length?length:end;if(end<0){end+=length}length=start>end?0:end-start>>>0;start>>>=0;var result=Array(length);while(++index>>1,computed=array[mid];if(computed!==null&&!isSymbol(computed)&&(retHighest?computed<=value:computed=LARGE_ARRAY_SIZE){var set=iteratee?null:createSet(array);if(set){return setToArray(set)}isCommon=false;includes=cacheHas;seen=new SetCache}else{seen=iteratee?[]:result}outer:while(++index=length?array:baseSlice(array,start,end)}var clearTimeout=ctxClearTimeout||function(id){return root.clearTimeout(id)};function cloneBuffer(buffer,isDeep){if(isDeep){return buffer.slice()}var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result}function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result}function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}function compareAscending(value,other){if(value!==other){var valIsDefined=value!==undefined,valIsNull=value===null,valIsReflexive=value===value,valIsSymbol=isSymbol(value);var othIsDefined=other!==undefined,othIsNull=other===null,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive){return 1}if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value=ordersLength){return result}var order=orders[index];return result*(order=="desc"?-1:1)}}return object.index-other.index}function composeArgs(args,partials,holders,isCurried){var argsIndex=-1,argsLength=args.length,holdersLength=holders.length,leftIndex=-1,leftLength=partials.length,rangeLength=nativeMax(argsLength-holdersLength,0),result=Array(leftLength+rangeLength),isUncurried=!isCurried;while(++leftIndex1?sources[length-1]:undefined,guard=length>2?sources[2]:undefined;customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){customizer=length<3?undefined:customizer;length=1}object=Object(object);while(++index-1?iterable[iteratee?collection[index]:index]:undefined}}function createFlow(fromRight){return flatRest(function(funcs){var length=funcs.length,index=length,prereq=LodashWrapper.prototype.thru;if(fromRight){funcs.reverse()}while(index--){var func=funcs[index];if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(prereq&&!wrapper&&getFuncName(func)=="wrapper"){var wrapper=new LodashWrapper([],true)}}index=wrapper?index:length;while(++index1){args.reverse()}if(isAry&&aryarrLength)){return false}var stacked=stack.get(array);if(stacked&&stack.get(other)){return stacked==other}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache:undefined;stack.set(array,other);stack.set(other,array);while(++index1?"& ":"")+details[lastIndex];details=details.join(length>2?", ":" ");return source.replace(reWrapComment,"{\n/* [wrapped with "+details+"] */\n")}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isIndex(value,length){var type=typeof value;length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(type=="number"||type!="symbol"&&reIsUint.test(value))&&(value>-1&&value%1==0&&value0){if(++count>=HOT_COUNT){return arguments[0]}}else{count=0}return func.apply(undefined,arguments)}}function shuffleSelf(array,size){var index=-1,length=array.length,lastIndex=length-1;size=size===undefined?length:size;while(++index1?arrays[length-1]:undefined;iteratee=typeof iteratee=="function"?(arrays.pop(),iteratee):undefined;return unzipWith(arrays,iteratee)});function chain(value){var result=lodash(value);result.__chain__=true;return result}function tap(value,interceptor){interceptor(value);return value}function thru(value,interceptor){return interceptor(value)}var wrapperAt=flatRest(function(paths){var length=paths.length,start=length?paths[0]:0,value=this.__wrapped__,interceptor=function(object){return baseAt(object,paths)};if(length>1||this.__actions__.length||!(value instanceof LazyWrapper)||!isIndex(start)){return this.thru(interceptor)}value=value.slice(start,+start+(length?1:0));value.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(value,this.__chain__).thru(function(array){if(length&&!array.length){array.push(undefined)}return array})});function wrapperChain(){return chain(this)}function wrapperCommit(){return new LodashWrapper(this.value(),this.__chain__)}function wrapperNext(){if(this.__values__===undefined){this.__values__=toArray(this.value())}var done=this.__index__>=this.__values__.length,value=done?undefined:this.__values__[this.__index__++];return{done:done,value:value}}function wrapperToIterator(){return this}function wrapperPlant(value){var result,parent=this;while(parent instanceof baseLodash){var clone=wrapperClone(parent);clone.__index__=0;clone.__values__=undefined;if(result){previous.__wrapped__=clone}else{result=clone}var previous=clone;parent=parent.__wrapped__}previous.__wrapped__=value;return result}function wrapperReverse(){var value=this.__wrapped__;if(value instanceof LazyWrapper){var wrapped=value;if(this.__actions__.length){wrapped=new LazyWrapper(this)}wrapped=wrapped.reverse();wrapped.__actions__.push({func:thru,args:[reverse],thisArg:undefined});return new LodashWrapper(wrapped,this.__chain__)}return this.thru(reverse)}function wrapperValue(){return baseWrapperValue(this.__wrapped__,this.__actions__)}var countBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){++result[key]}else{baseAssignValue(result,key,1)}});function every(collection,predicate,guard){var func=isArray(collection)?arrayEvery:baseEvery;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3))}var find=createFind(findIndex);var findLast=createFind(findLastIndex);function flatMap(collection,iteratee){return baseFlatten(map(collection,iteratee),1)}function flatMapDeep(collection,iteratee){return baseFlatten(map(collection,iteratee),INFINITY)}function flatMapDepth(collection,iteratee,depth){depth=depth===undefined?1:toInteger(depth);return baseFlatten(map(collection,iteratee),depth)}function forEach(collection,iteratee){var func=isArray(collection)?arrayEach:baseEach;return func(collection,getIteratee(iteratee,3))}function forEachRight(collection,iteratee){var func=isArray(collection)?arrayEachRight:baseEachRight;return func(collection,getIteratee(iteratee,3))}var groupBy=createAggregator(function(result,value,key){if(hasOwnProperty.call(result,key)){result[key].push(value)}else{baseAssignValue(result,key,[value])}});function includes(collection,value,fromIndex,guard){collection=isArrayLike(collection)?collection:values(collection);fromIndex=fromIndex&&!guard?toInteger(fromIndex):0;var length=collection.length;if(fromIndex<0){fromIndex=nativeMax(length+fromIndex,0)}return isString(collection)?fromIndex<=length&&collection.indexOf(value,fromIndex)>-1:!!length&&baseIndexOf(collection,value,fromIndex)>-1}var invokeMap=baseRest(function(collection,path,args){var index=-1,isFunc=typeof path=="function",result=isArrayLike(collection)?Array(collection.length):[];baseEach(collection,function(value){result[++index]=isFunc?apply(path,value,args):baseInvoke(value,path,args)});return result});var keyBy=createAggregator(function(result,value,key){baseAssignValue(result,key,value)});function map(collection,iteratee){var func=isArray(collection)?arrayMap:baseMap;return func(collection,getIteratee(iteratee,3))}function orderBy(collection,iteratees,orders,guard){if(collection==null){return[]}if(!isArray(iteratees)){iteratees=iteratees==null?[]:[iteratees]}orders=guard?undefined:orders;if(!isArray(orders)){orders=orders==null?[]:[orders]}return baseOrderBy(collection,iteratees,orders)}var partition=createAggregator(function(result,value,key){result[key?0:1].push(value)},function(){return[[],[]]});function reduce(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduce:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEach)}function reduceRight(collection,iteratee,accumulator){var func=isArray(collection)?arrayReduceRight:baseReduce,initAccum=arguments.length<3;return func(collection,getIteratee(iteratee,4),accumulator,initAccum,baseEachRight)}function reject(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,negate(getIteratee(predicate,3)))}function sample(collection){var func=isArray(collection)?arraySample:baseSample;return func(collection)}function sampleSize(collection,n,guard){if(guard?isIterateeCall(collection,n,guard):n===undefined){n=1}else{n=toInteger(n)}var func=isArray(collection)?arraySampleSize:baseSampleSize;return func(collection,n)}function shuffle(collection){var func=isArray(collection)?arrayShuffle:baseShuffle;return func(collection)}function size(collection){if(collection==null){return 0}if(isArrayLike(collection)){return isString(collection)?stringSize(collection):collection.length}var tag=getTag(collection);if(tag==mapTag||tag==setTag){return collection.size}return baseKeys(collection).length}function some(collection,predicate,guard){var func=isArray(collection)?arraySome:baseSome;if(guard&&isIterateeCall(collection,predicate,guard)){predicate=undefined}return func(collection,getIteratee(predicate,3))}var sortBy=baseRest(function(collection,iteratees){if(collection==null){return[]}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[]}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]]}return baseOrderBy(collection,baseFlatten(iteratees,1),[])});var now=ctxNow||function(){return root.Date.now()};function after(n,func){if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n<1){return func.apply(this,arguments)}}}function ary(func,n,guard){n=guard?undefined:n;n=func&&n==null?func.length:n;return createWrap(func,WRAP_ARY_FLAG,undefined,undefined,undefined,undefined,n)}function before(n,func){var result;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}n=toInteger(n);return function(){if(--n>0){result=func.apply(this,arguments)}if(n<=1){func=undefined}return result}}var bind=baseRest(function(func,thisArg,partials){var bitmask=WRAP_BIND_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bind));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(func,bitmask,thisArg,partials,holders)});var bindKey=baseRest(function(object,key,partials){var bitmask=WRAP_BIND_FLAG|WRAP_BIND_KEY_FLAG;if(partials.length){var holders=replaceHolders(partials,getHolder(bindKey));bitmask|=WRAP_PARTIAL_FLAG}return createWrap(key,bitmask,object,partials,holders)});function curry(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curry.placeholder;return result}function curryRight(func,arity,guard){arity=guard?undefined:arity;var result=createWrap(func,WRAP_CURRY_RIGHT_FLAG,undefined,undefined,undefined,undefined,undefined,arity);result.placeholder=curryRight.placeholder;return result}function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=false,maxing=false,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}wait=toNumber(wait)||0;if(isObject(options)){leading=!!options.leading;maxing="maxWait"in options;maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait;trailing="trailing"in options?!!options.trailing:trailing}function invokeFunc(time){var args=lastArgs,thisArg=lastThis;lastArgs=lastThis=undefined;lastInvokeTime=time;result=func.apply(thisArg,args);return result}function leadingEdge(time){lastInvokeTime=time;timerId=setTimeout(timerExpired,wait);return leading?invokeFunc(time):result}function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===undefined||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}function timerExpired(){var time=now();if(shouldInvoke(time)){return trailingEdge(time)}timerId=setTimeout(timerExpired,remainingWait(time))}function trailingEdge(time){timerId=undefined;if(trailing&&lastArgs){return invokeFunc(time)}lastArgs=lastThis=undefined;return result}function cancel(){if(timerId!==undefined){clearTimeout(timerId)}lastInvokeTime=0;lastArgs=lastCallTime=lastThis=timerId=undefined}function flush(){return timerId===undefined?result:trailingEdge(now())}function debounced(){var time=now(),isInvoking=shouldInvoke(time);lastArgs=arguments;lastThis=this;lastCallTime=time;if(isInvoking){if(timerId===undefined){return leadingEdge(lastCallTime)}if(maxing){timerId=setTimeout(timerExpired,wait);return invokeFunc(lastCallTime)}}if(timerId===undefined){timerId=setTimeout(timerExpired,wait)}return result}debounced.cancel=cancel;debounced.flush=flush;return debounced}var defer=baseRest(function(func,args){return baseDelay(func,1,args)});var delay=baseRest(function(func,wait,args){return baseDelay(func,toNumber(wait)||0,args)});function flip(func){return createWrap(func,WRAP_FLIP_FLAG)}function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key)){return cache.get(key)}var result=func.apply(this,args);memoized.cache=cache.set(key,result)||cache;return result};memoized.cache=new(memoize.Cache||MapCache);return memoized}memoize.Cache=MapCache;function negate(predicate){if(typeof predicate!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return function(){var args=arguments;switch(args.length){case 0:return!predicate.call(this);case 1:return!predicate.call(this,args[0]);case 2:return!predicate.call(this,args[0],args[1]);case 3:return!predicate.call(this,args[0],args[1],args[2])}return!predicate.apply(this,args)}}function once(func){return before(2,func)}var overArgs=castRest(function(func,transforms){transforms=transforms.length==1&&isArray(transforms[0])?arrayMap(transforms[0],baseUnary(getIteratee())):arrayMap(baseFlatten(transforms,1),baseUnary(getIteratee()));var funcsLength=transforms.length;return baseRest(function(args){var index=-1,length=nativeMin(args.length,funcsLength);while(++index=other});var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};var isArray=Array.isArray;var isArrayBuffer=nodeIsArrayBuffer?baseUnary(nodeIsArrayBuffer):baseIsArrayBuffer;function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isBoolean(value){return value===true||value===false||isObjectLike(value)&&baseGetTag(value)==boolTag}var isBuffer=nativeIsBuffer||stubFalse;var isDate=nodeIsDate?baseUnary(nodeIsDate):baseIsDate;function isElement(value){return isObjectLike(value)&&value.nodeType===1&&!isPlainObject(value)}function isEmpty(value){if(value==null){return true}if(isArrayLike(value)&&(isArray(value)||typeof value=="string"||typeof value.splice=="function"||isBuffer(value)||isTypedArray(value)||isArguments(value))){return!value.length}var tag=getTag(value);if(tag==mapTag||tag==setTag){return!value.size}if(isPrototype(value)){return!baseKeys(value).length}for(var key in value){if(hasOwnProperty.call(value,key)){return false}}return true}function isEqual(value,other){return baseIsEqual(value,other)}function isEqualWith(value,other,customizer){customizer=typeof customizer=="function"?customizer:undefined;var result=customizer?customizer(value,other):undefined;return result===undefined?baseIsEqual(value,other,undefined,customizer):!!result}function isError(value){if(!isObjectLike(value)){return false}var tag=baseGetTag(value);return tag==errorTag||tag==domExcTag||typeof value.message=="string"&&typeof value.name=="string"&&!isPlainObject(value)}function isFinite(value){return typeof value=="number"&&nativeIsFinite(value)}function isFunction(value){if(!isObject(value)){return false}var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}function isInteger(value){return typeof value=="number"&&value==toInteger(value)}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}function isObjectLike(value){return value!=null&&typeof value=="object"}var isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap;function isMatch(object,source){return object===source||baseIsMatch(object,source,getMatchData(source))}function isMatchWith(object,source,customizer){customizer=typeof customizer=="function"?customizer:undefined;return baseIsMatch(object,source,getMatchData(source),customizer)}function isNaN(value){return isNumber(value)&&value!=+value}function isNative(value){if(isMaskable(value)){throw new Error(CORE_ERROR_TEXT)}return baseIsNative(value)}function isNull(value){return value===null}function isNil(value){return value==null}function isNumber(value){return typeof value=="number"||isObjectLike(value)&&baseGetTag(value)==numberTag}function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag){return false}var proto=getPrototype(value);if(proto===null){return true}var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}var isRegExp=nodeIsRegExp?baseUnary(nodeIsRegExp):baseIsRegExp;function isSafeInteger(value){return isInteger(value)&&value>=-MAX_SAFE_INTEGER&&value<=MAX_SAFE_INTEGER}var isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet;function isString(value){return typeof value=="string"||!isArray(value)&&isObjectLike(value)&&baseGetTag(value)==stringTag}function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;function isUndefined(value){return value===undefined}function isWeakMap(value){return isObjectLike(value)&&getTag(value)==weakMapTag}function isWeakSet(value){return isObjectLike(value)&&baseGetTag(value)==weakSetTag}var lt=createRelationalOperation(baseLt);var lte=createRelationalOperation(function(value,other){return value<=other});function toArray(value){if(!value){return[]}if(isArrayLike(value)){return isString(value)?stringToArray(value):copyArray(value)}if(symIterator&&value[symIterator]){return iteratorToArray(value[symIterator]())}var tag=getTag(value),func=tag==mapTag?mapToArray:tag==setTag?setToArray:values;return func(value)}function toFinite(value){if(!value){return value===0?value:0}value=toNumber(value);if(value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}function toLength(value){return value?baseClamp(toInteger(value),0,MAX_ARRAY_LENGTH):0}function toNumber(value){if(typeof value=="number"){return value}if(isSymbol(value)){return NAN}if(isObject(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject(other)?other+"":other}if(typeof value!="string"){return value===0?value:+value}value=value.replace(reTrim,"");var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}function toPlainObject(value){return copyObject(value,keysIn(value))}function toSafeInteger(value){return value?baseClamp(toInteger(value),-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER):value===0?value:0}function toString(value){return value==null?"":baseToString(value)}var assign=createAssigner(function(object,source){if(isPrototype(source)||isArrayLike(source)){copyObject(source,keys(source),object);return}for(var key in source){if(hasOwnProperty.call(source,key)){assignValue(object,key,source[key])}}});var assignIn=createAssigner(function(object,source){copyObject(source,keysIn(source),object)});var assignInWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)});var assignWith=createAssigner(function(object,source,srcIndex,customizer){copyObject(source,keys(source),object,customizer)});var at=flatRest(baseAt);function create(prototype,properties){var result=baseCreate(prototype);return properties==null?result:baseAssign(result,properties)}var defaults=baseRest(function(object,sources){object=Object(object);var index=-1;var length=sources.length;var guard=length>2?sources[2]:undefined;if(guard&&isIterateeCall(sources[0],sources[1],guard)){length=1}while(++index1);return path});copyObject(object,getAllKeysIn(object),result);if(isDeep){result=baseClone(result,CLONE_DEEP_FLAG|CLONE_FLAT_FLAG|CLONE_SYMBOLS_FLAG,customOmitClone)}var length=paths.length;while(length--){baseUnset(result,paths[length])}return result});function omitBy(object,predicate){return pickBy(object,negate(getIteratee(predicate)))}var pick=flatRest(function(object,paths){return object==null?{}:basePick(object,paths)});function pickBy(object,predicate){if(object==null){return{}}var props=arrayMap(getAllKeysIn(object),function(prop){return[prop]});predicate=getIteratee(predicate);return basePickBy(object,props,function(value,path){return predicate(value,path[0])})}function result(object,path,defaultValue){path=castPath(path,object);var index=-1,length=path.length;if(!length){length=1;object=undefined}while(++indexupper){var temp=lower;lower=upper;upper=temp}if(floating||lower%1||upper%1){var rand=nativeRandom();return nativeMin(lower+rand*(upper-lower+freeParseFloat("1e-"+((rand+"").length-1))),upper)}return baseRandom(lower,upper)}var camelCase=createCompounder(function(result,word,index){word=word.toLowerCase();return result+(index?capitalize(word):word)});function capitalize(string){return upperFirst(toString(string).toLowerCase())}function deburr(string){string=toString(string);return string&&string.replace(reLatin,deburrLetter).replace(reComboMark,"")}function endsWith(string,target,position){string=toString(string);target=baseToString(target);var length=string.length;position=position===undefined?length:baseClamp(toInteger(position),0,length);var end=position;position-=target.length;return position>=0&&string.slice(position,end)==target}function escape(string){string=toString(string);return string&&reHasUnescapedHtml.test(string)?string.replace(reUnescapedHtml,escapeHtmlChar):string}function escapeRegExp(string){string=toString(string);return string&&reHasRegExpChar.test(string)?string.replace(reRegExpChar,"\\$&"):string}var kebabCase=createCompounder(function(result,word,index){return result+(index?"-":"")+word.toLowerCase()});var lowerCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toLowerCase()});var lowerFirst=createCaseFirst("toLowerCase");function pad(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;if(!length||strLength>=length){return string}var mid=(length-strLength)/2;return createPadding(nativeFloor(mid),chars)+string+createPadding(nativeCeil(mid),chars)}function padEnd(string,length,chars){string=toString(string);length=toInteger(length);var strLength=length?stringSize(string):0;return length&&strLength>>0;if(!limit){return[]}string=toString(string);if(string&&(typeof separator=="string"||separator!=null&&!isRegExp(separator))){separator=baseToString(separator);if(!separator&&hasUnicode(string)){return castSlice(stringToArray(string),0,limit)}}return string.split(separator,limit)}var startCase=createCompounder(function(result,word,index){return result+(index?" ":"")+upperFirst(word)});function startsWith(string,target,position){string=toString(string);position=position==null?0:baseClamp(toInteger(position),0,string.length);target=baseToString(target);return string.slice(position,position+target.length)==target}function template(string,options,guard){var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard)){options=undefined}string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";var reDelimiters=RegExp((options.escape||reNoMatch).source+"|"+interpolate.source+"|"+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+"|"+(options.evaluate||reNoMatch).source+"|$","g");var sourceURL="//# sourceURL="+("sourceURL"in options?options.sourceURL:"lodash.templateSources["+ ++templateCounter+"]")+"\n";string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'"}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '"}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'"}index=offset+match.length;return match});source+="';\n";var variable=options.variable;if(!variable){source="with (obj) {\n"+source+"\n}\n"}source=(isEvaluating?source.replace(reEmptyStringLeading,""):source).replace(reEmptyStringMiddle,"$1").replace(reEmptyStringTrailing,"$1;");source="function("+(variable||"obj")+") {\n"+(variable?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(isEscaping?", __e = _.escape":"")+(isEvaluating?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+source+"return __p\n}";var result=attempt(function(){return Function(importsKeys,sourceURL+"return "+source).apply(undefined,importsValues)});result.source=source;if(isError(result)){throw result}return result}function toLower(value){return toString(value).toLowerCase()}function toUpper(value){return toString(value).toUpperCase()}function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrim,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join("")}function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimEnd,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,0,end).join("")}function trimStart(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined)){return string.replace(reTrimStart,"")}if(!string||!(chars=baseToString(chars))){return string}var strSymbols=stringToArray(string),start=charsStartIndex(strSymbols,stringToArray(chars));return castSlice(strSymbols,start).join("")}function truncate(string,options){var length=DEFAULT_TRUNC_LENGTH,omission=DEFAULT_TRUNC_OMISSION;if(isObject(options)){var separator="separator"in options?options.separator:separator;length="length"in options?toInteger(options.length):length;omission="omission"in options?baseToString(options.omission):omission}string=toString(string);var strLength=string.length;if(hasUnicode(string)){var strSymbols=stringToArray(string);strLength=strSymbols.length}if(length>=strLength){return string}var end=length-stringSize(omission);if(end<1){return omission}var result=strSymbols?castSlice(strSymbols,0,end).join(""):string.slice(0,end);if(separator===undefined){return result+omission}if(strSymbols){end+=result.length-end}if(isRegExp(separator)){if(string.slice(end).search(separator)){var match,substring=result;if(!separator.global){separator=RegExp(separator.source,toString(reFlags.exec(separator))+"g")}separator.lastIndex=0;while(match=separator.exec(substring)){var newEnd=match.index}result=result.slice(0,newEnd===undefined?end:newEnd)}}else if(string.indexOf(baseToString(separator),end)!=end){var index=result.lastIndexOf(separator);if(index>-1){result=result.slice(0,index)}}return result+omission}function unescape(string){string=toString(string);return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,unescapeHtmlChar):string}var upperCase=createCompounder(function(result,word,index){return result+(index?" ":"")+word.toUpperCase()});var upperFirst=createCaseFirst("toUpperCase");function words(string,pattern,guard){string=toString(string);pattern=guard?undefined:pattern;if(pattern===undefined){return hasUnicodeWord(string)?unicodeWords(string):asciiWords(string)}return string.match(pattern)||[]}var attempt=baseRest(function(func,args){try{return apply(func,undefined,args)}catch(e){return isError(e)?e:new Error(e)}});var bindAll=flatRest(function(object,methodNames){arrayEach(methodNames,function(key){key=toKey(key);baseAssignValue(object,key,bind(object[key],object))});return object});function cond(pairs){var length=pairs==null?0:pairs.length,toIteratee=getIteratee();pairs=!length?[]:arrayMap(pairs,function(pair){if(typeof pair[1]!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return[toIteratee(pair[0]),pair[1]]});return baseRest(function(args){var index=-1;while(++indexMAX_SAFE_INTEGER){return[]}var index=MAX_ARRAY_LENGTH,length=nativeMin(n,MAX_ARRAY_LENGTH);iteratee=getIteratee(iteratee);n-=MAX_ARRAY_LENGTH;var result=baseTimes(length,iteratee);while(++index0||end<0)){return new LazyWrapper(result)}if(start<0){result=result.takeRight(-start)}else if(start){result=result.drop(start)}if(end!==undefined){end=toInteger(end);result=end<0?result.dropRight(-end):result.take(end-start)}return result};LazyWrapper.prototype.takeRightWhile=function(predicate){return this.reverse().takeWhile(predicate).reverse()};LazyWrapper.prototype.toArray=function(){return this.take(MAX_ARRAY_LENGTH)};baseForOwn(LazyWrapper.prototype,function(func,methodName){var checkIteratee=/^(?:filter|find|map|reject)|While$/.test(methodName),isTaker=/^(?:head|last)$/.test(methodName),lodashFunc=lodash[isTaker?"take"+(methodName=="last"?"Right":""):methodName],retUnwrapped=isTaker||/^find/.test(methodName);if(!lodashFunc){return}lodash.prototype[methodName]=function(){var value=this.__wrapped__,args=isTaker?[1]:arguments,isLazy=value instanceof LazyWrapper,iteratee=args[0],useLazy=isLazy||isArray(value);var interceptor=function(value){var result=lodashFunc.apply(lodash,arrayPush([value],args));return isTaker&&chainAll?result[0]:result};if(useLazy&&checkIteratee&&typeof iteratee=="function"&&iteratee.length!=1){isLazy=useLazy=false}var chainAll=this.__chain__,isHybrid=!!this.__actions__.length,isUnwrapped=retUnwrapped&&!chainAll,onlyLazy=isLazy&&!isHybrid;if(!retUnwrapped&&useLazy){value=onlyLazy?value:new LazyWrapper(this);var result=func.apply(value,args);result.__actions__.push({func:thru,args:[interceptor],thisArg:undefined});return new LodashWrapper(result,chainAll)}if(isUnwrapped&&onlyLazy){return func.apply(this,args)}result=this.thru(interceptor);return isUnwrapped?isTaker?result.value()[0]:result.value():result}});arrayEach(["pop","push","shift","sort","splice","unshift"],function(methodName){var func=arrayProto[methodName],chainName=/^(?:push|sort|unshift)$/.test(methodName)?"tap":"thru",retUnwrapped=/^(?:pop|shift)$/.test(methodName);lodash.prototype[methodName]=function(){var args=arguments;if(retUnwrapped&&!this.__chain__){var value=this.value();return func.apply(isArray(value)?value:[],args)}return this[chainName](function(value){return func.apply(isArray(value)?value:[],args)})}});baseForOwn(LazyWrapper.prototype,function(func,methodName){var lodashFunc=lodash[methodName];if(lodashFunc){var key=lodashFunc.name+"",names=realNames[key]||(realNames[key]=[]);names.push({name:methodName,func:lodashFunc})}});realNames[createHybrid(undefined,WRAP_BIND_KEY_FLAG).name]=[{name:"wrapper",func:undefined}];LazyWrapper.prototype.clone=lazyClone;LazyWrapper.prototype.reverse=lazyReverse;LazyWrapper.prototype.value=lazyValue;lodash.prototype.at=wrapperAt;lodash.prototype.chain=wrapperChain;lodash.prototype.commit=wrapperCommit;lodash.prototype.next=wrapperNext;lodash.prototype.plant=wrapperPlant;lodash.prototype.reverse=wrapperReverse;lodash.prototype.toJSON=lodash.prototype.valueOf=lodash.prototype.value=wrapperValue;lodash.prototype.first=lodash.prototype.head;if(symIterator){lodash.prototype[symIterator]=wrapperToIterator}return lodash};var _=runInContext();if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){root._=_;define(function(){return _})}else if(freeModule){(freeModule.exports=_)._=_;freeExports._=_}else{root._=_}}).call(this);if(typeof window.variation==="undefined"){window.variation=0}window.optimizely=window.optimizely||[];function trackOptimizelyGoal(){window.optimizely.push(["trackEvent",this.dataset.abGoal])}$(window).on("click","[data-ab-goal]",trackOptimizelyGoal);$(window).on("submit","[data-ab-goal]",trackOptimizelyGoal);(function(){var evalJavaScriptResponse=function(){var xhr=this;var contentType=xhr.getResponseHeader("content-type");if(contentType==="text/javascript; charset=utf-8"){eval(xhr.responseText)}};var sendXhrAfterPageload=function(request){var xhrAfterPageload;try{if(localStorage.xhrAfterPageload){xhrAfterPageload=JSON.parse(localStorage.xhrAfterPageload);xhrAfterPageload.push(request)}else{xhrAfterPageload=[request]}localStorage.xhrAfterPageload=JSON.stringify(xhrAfterPageload)}catch(error){}};var sendXhrAfterPageloadIfAbborted=function(xhr,request){if(xhr.readyState===4&&xhr.status===0){sendXhrAfterPageload(request)}};var sendXhr=function(request){var xhr=new XMLHttpRequest;xhr.open(request.method,request.url);if(window.user){xhr.setRequestHeader("X-CSRF-Token",window.user.token)}xhr.onload=evalJavaScriptResponse;xhr.onreadystatechange=function(){sendXhrAfterPageloadIfAbborted(xhr,request)};xhr.send()};document.documentElement.addEventListener("click",function(event){var el=event.target;var i=0;while(el){if(el.dataset&&el.dataset.xhrOnClick){var data=el.dataset.xhrOnClick.split(/\s+/);sendXhr({method:data[0],url:data[1],async:true});return}el=event.path?event.path[i++]:el.parentNode}});if(localStorage.xhrAfterPageload){JSON.parse(localStorage.xhrAfterPageload).forEach(sendXhr);delete localStorage.xhrAfterPageload}})();(function(){function resizeOnInput(event){var el=event.target;if(el.classList&&el.classList.contains("js-auto-resize")){el.style.height="auto";var style=window.getComputedStyle(el);var borderSize=2*parseInt(style.getPropertyValue("border-top-width"));el.style.height=el.scrollHeight+borderSize+"px"}}document.documentElement.addEventListener("input",resizeOnInput,false)})();if(typeof window!=="undefined"){window.validations={validatePhone:function(number,callback){if(number.length>0){var sanitizedNumber=number.replace(/([()-\s])/g,"");var url="https://mobile.homify.de/api/v1.0/validate/phonenumber";var params={number:sanitizedNumber};$.get(url,params,function(data){callback(data.valid)})}else{callback(true)}},validateEmail:function(email,callback){var regex=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;if(email.length&®ex.test(email)){var url="https://mobile.homify.de/api/v1.0/validate/email";var params={email:email};$.get(url,params,function(data){callback(data.valid)})}else{callback(false)}}}}document.documentElement.addEventListener("submit",function(event){var $form=$(event.target);if($form.hasClass("js-ping-server")){$form.addClass("-submitted");event.preventDefault();var errorHandler=function(){$form.removeClass("-submitted");window.Lightbox.openLightbox("error-while-saving")};var xhr=new XMLHttpRequest;xhr.open("GET","/a/ping");xhr.timeout=2e3;xhr.onload=function(){try{var data=JSON.parse(xhr.responseText);if(data.pong){$form.submit()}else{errorHandler()}}catch(error){errorHandler()}};xhr.onerror=errorHandler;xhr.ontimeout=errorHandler;xhr.send()}});$(function(){$("form").on("submit",function(){if($(this)[0].id!=="new-expert"){$(this).toggleClass("-submitted",true)}})});(function(){$("body").on("submit","#js-guest-sign-in-form",function(e){trackGA("event","Login","clicked login")});$("body").on("submit","#js-guest-sign-up-form, #new-expert",function(e){trackGA("event","Login","clicked signup")})})();(function($){var cocoon_element_counter=0;var create_new_id=function(){return(new Date).getTime()+cocoon_element_counter++};var newcontent_braced=function(id){return"["+id+"]$1"};var newcontent_underscord=function(id){return"_"+id+"_$1"};var getInsertionNodeElem=function(insertionNode,insertionTraversal,$this){if(!insertionNode){return $this.parent()}if(typeof insertionNode=="function"){if(insertionTraversal){console.warn("association-insertion-traversal is ignored, because association-insertion-node is given as a function.")}return insertionNode($this)}if(typeof insertionNode=="string"){if(insertionTraversal){return $this[insertionTraversal](insertionNode)}else{return insertionNode=="this"?$this:$(insertionNode)}}};$(document).on("click",".add_fields",function(e){e.preventDefault();e.stopPropagation();var $this=$(this),assoc=$this.data("association"),assocs=$this.data("associations"),content=$this.data("association-insertion-template"),insertionMethod=$this.data("association-insertion-method")||$this.data("association-insertion-position")||"before",insertionNode=$this.data("association-insertion-node"),insertionTraversal=$this.data("association-insertion-traversal"),count=parseInt($this.data("count"),10),regexp_braced=new RegExp("\\[new_"+assoc+"\\](.*?\\s)","g"),regexp_underscord=new RegExp("_new_"+assoc+"_(\\w*)","g"),new_id=create_new_id(),new_content=content.replace(regexp_braced,newcontent_braced(new_id)),new_contents=[],originalEvent=e;if(new_content==content){regexp_braced=new RegExp("\\[new_"+assocs+"\\](.*?\\s)","g");regexp_underscord=new RegExp("_new_"+assocs+"_(\\w*)","g");new_content=content.replace(regexp_braced,newcontent_braced(new_id))}new_content=new_content.replace(regexp_underscord,newcontent_underscord(new_id));new_contents=[new_content];count=isNaN(count)?1:Math.max(count,1);count-=1;while(count){new_id=create_new_id();new_content=content.replace(regexp_braced,newcontent_braced(new_id));new_content=new_content.replace(regexp_underscord,newcontent_underscord(new_id));new_contents.push(new_content);count-=1}var insertionNodeElem=getInsertionNodeElem(insertionNode,insertionTraversal,$this);if(!insertionNodeElem||insertionNodeElem.length==0){console.warn("Couldn't find the element to insert the template. Make sure your `data-association-insertion-*` on `link_to_add_association` is correct.")}$.each(new_contents,function(i,node){var contentNode=$(node);var before_insert=jQuery.Event("cocoon:before-insert");insertionNodeElem.trigger(before_insert,[contentNode,originalEvent]);if(!before_insert.isDefaultPrevented()){var addedContent=insertionNodeElem[insertionMethod](contentNode);insertionNodeElem.trigger("cocoon:after-insert",[contentNode,originalEvent])}})});$(document).on("click",".remove_fields.dynamic, .remove_fields.existing",function(e){var $this=$(this),wrapper_class=$this.data("wrapper-class")||"nested-fields",node_to_delete=$this.closest("."+wrapper_class),trigger_node=node_to_delete.parent(),originalEvent=e;e.preventDefault();e.stopPropagation();var before_remove=jQuery.Event("cocoon:before-remove");trigger_node.trigger(before_remove,[node_to_delete,originalEvent]);if(!before_remove.isDefaultPrevented()){var timeout=trigger_node.data("remove-timeout")||0;setTimeout(function(){if($this.hasClass("dynamic")){node_to_delete.detach()}else{$this.prev("input[type=hidden]").val("1");node_to_delete.hide()}trigger_node.trigger("cocoon:after-remove",[node_to_delete,originalEvent])},timeout)}});$(document).on("ready page:load turbolinks:load",function(){$(".remove_fields.existing.destroyed").each(function(i,obj){var $this=$(this),wrapper_class=$this.data("wrapper-class")||"nested-fields";$this.closest("."+wrapper_class).hide()})})})(jQuery);