!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):window.jQuery||window.Zepto)}(function(a){var b,c,d,e,f,g,h="Close",i="BeforeClose",j="AfterClose",k="BeforeAppend",l="MarkupParse",m="Open",n="Change",o="mfp",p="."+o,q="mfp-ready",r="mfp-removing",s="mfp-prevent-close",t=function(){},u=!!window.jQuery,v=a(window),w=function(a,c){b.ev.on(o+a+p,c)},x=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(c,d){b.ev.triggerHandler(o+c,d),b.st.callbacks&&(c=c.charAt(0).toLowerCase()+c.slice(1),b.st.callbacks[c]&&b.st.callbacks[c].apply(b,a.isArray(d)?d:[d]))},z=function(c){return c===g&&b.currTemplate.closeBtn||(b.currTemplate.closeBtn=a(b.st.closeMarkup.replace("%title%",b.st.tClose)),g=c),b.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(b=new t,b.init(),a.magnificPopup.instance=b)},B=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(void 0!==a.transition)return!0;for(;b.length;)if(b.pop()+"Transition"in a)return!0;return!1};t.prototype={constructor:t,init:function(){var c=navigator.appVersion;b.isLowIE=b.isIE8=document.all&&!document.addEventListener,b.isAndroid=/android/gi.test(c),b.isIOS=/iphone|ipad|ipod/gi.test(c),b.supportsTransition=B(),b.probablyMobile=b.isAndroid||b.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),d=a(document),b.popupsCache={}},open:function(c){var e;if(c.isObj===!1){b.items=c.items.toArray(),b.index=0;var g,h=c.items;for(e=0;e<h.length;e++)if(g=h[e],g.parsed&&(g=g.el[0]),g===c.el[0]){b.index=e;break}}else b.items=a.isArray(c.items)?c.items:[c.items],b.index=c.index||0;if(b.isOpen)return void b.updateItemHTML();b.types=[],f="",c.mainEl&&c.mainEl.length?b.ev=c.mainEl.eq(0):b.ev=d,c.key?(b.popupsCache[c.key]||(b.popupsCache[c.key]={}),b.currTemplate=b.popupsCache[c.key]):b.currTemplate={},b.st=a.extend(!0,{},a.magnificPopup.defaults,c),b.fixedContentPos="auto"===b.st.fixedContentPos?!b.probablyMobile:b.st.fixedContentPos,b.st.modal&&(b.st.closeOnContentClick=!1,b.st.closeOnBgClick=!1,b.st.showCloseBtn=!1,b.st.enableEscapeKey=!1),b.bgOverlay||(b.bgOverlay=x("bg").on("click"+p,function(){b.close()}),b.wrap=x("wrap").attr("tabindex",-1).on("click"+p,function(a){b._checkIfClose(a.target)&&b.close()}),b.container=x("container",b.wrap)),b.contentContainer=x("content"),b.st.preloader&&(b.preloader=x("preloader",b.container,b.st.tLoading));var i=a.magnificPopup.modules;for(e=0;e<i.length;e++){var j=i[e];j=j.charAt(0).toUpperCase()+j.slice(1),b["init"+j].call(b)}y("BeforeOpen"),b.st.showCloseBtn&&(b.st.closeBtnInside?(w(l,function(a,b,c,d){c.close_replaceWith=z(d.type)}),f+=" mfp-close-btn-in"):b.wrap.append(z())),b.st.alignTop&&(f+=" mfp-align-top"),b.fixedContentPos?b.wrap.css({overflow:b.st.overflowY,overflowX:"hidden",overflowY:b.st.overflowY}):b.wrap.css({top:v.scrollTop(),position:"absolute"}),(b.st.fixedBgPos===!1||"auto"===b.st.fixedBgPos&&!b.fixedContentPos)&&b.bgOverlay.css({height:d.height(),position:"absolute"}),b.st.enableEscapeKey&&d.on("keyup"+p,function(a){27===a.keyCode&&b.close()}),v.on("resize"+p,function(){b.updateSize()}),b.st.closeOnContentClick||(f+=" mfp-auto-cursor"),f&&b.wrap.addClass(f);var k=b.wH=v.height(),n={};if(b.fixedContentPos&&b._hasScrollBar(k)){var o=b._getScrollbarSize();o&&(n.marginRight=o)}b.fixedContentPos&&(b.isIE7?a("body, html").css("overflow","hidden"):n.overflow="hidden");var r=b.st.mainClass;return b.isIE7&&(r+=" mfp-ie7"),r&&b._addClassToMFP(r),b.updateItemHTML(),y("BuildControls"),a("html").css(n),b.bgOverlay.add(b.wrap).prependTo(b.st.prependTo||a(document.body)),b._lastFocusedEl=document.activeElement,setTimeout(function(){b.content?(b._addClassToMFP(q),b._setFocus()):b.bgOverlay.addClass(q),d.on("focusin"+p,b._onFocusIn)},16),b.isOpen=!0,b.updateSize(k),y(m),c},close:function(){b.isOpen&&(y(i),b.isOpen=!1,b.st.removalDelay&&!b.isLowIE&&b.supportsTransition?(b._addClassToMFP(r),setTimeout(function(){b._close()},b.st.removalDelay)):b._close())},_close:function(){y(h);var c=r+" "+q+" ";if(b.bgOverlay.detach(),b.wrap.detach(),b.container.empty(),b.st.mainClass&&(c+=b.st.mainClass+" "),b._removeClassFromMFP(c),b.fixedContentPos){var e={marginRight:""};b.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}d.off("keyup"+p+" focusin"+p),b.ev.off(p),b.wrap.attr("class","mfp-wrap").removeAttr("style"),b.bgOverlay.attr("class","mfp-bg"),b.container.attr("class","mfp-container"),!b.st.showCloseBtn||b.st.closeBtnInside&&b.currTemplate[b.currItem.type]!==!0||b.currTemplate.closeBtn&&b.currTemplate.closeBtn.detach(),b.st.autoFocusLast&&b._lastFocusedEl&&a(b._lastFocusedEl).focus(),b.currItem=null,b.content=null,b.currTemplate=null,b.prevHeight=0,y(j)},updateSize:function(a){if(b.isIOS){var c=document.documentElement.clientWidth/window.innerWidth,d=window.innerHeight*c;b.wrap.css("height",d),b.wH=d}else b.wH=a||v.height();b.fixedContentPos||b.wrap.css("height",b.wH),y("Resize")},updateItemHTML:function(){var c=b.items[b.index];b.contentContainer.detach(),b.content&&b.content.detach(),c.parsed||(c=b.parseEl(b.index));var d=c.type;if(y("BeforeChange",[b.currItem?b.currItem.type:"",d]),b.currItem=c,!b.currTemplate[d]){var f=b.st[d]?b.st[d].markup:!1;y("FirstMarkupParse",f),f?b.currTemplate[d]=a(f):b.currTemplate[d]=!0}e&&e!==c.type&&b.container.removeClass("mfp-"+e+"-holder");var g=b["get"+d.charAt(0).toUpperCase()+d.slice(1)](c,b.currTemplate[d]);b.appendContent(g,d),c.preloaded=!0,y(n,c),e=c.type,b.container.prepend(b.contentContainer),y("AfterChange")},appendContent:function(a,c){b.content=a,a?b.st.showCloseBtn&&b.st.closeBtnInside&&b.currTemplate[c]===!0?b.content.find(".mfp-close").length||b.content.append(z()):b.content=a:b.content="",y(k),b.container.addClass("mfp-"+c+"-holder"),b.contentContainer.append(b.content)},parseEl:function(c){var d,e=b.items[c];if(e.tagName?e={el:a(e)}:(d=e.type,e={data:e,src:e.src}),e.el){for(var f=b.types,g=0;g<f.length;g++)if(e.el.hasClass("mfp-"+f[g])){d=f[g];break}e.src=e.el.attr("data-mfp-src"),e.src||(e.src=e.el.attr("href"))}return e.type=d||b.st.type||"inline",e.index=c,e.parsed=!0,b.items[c]=e,y("ElementParse",e),b.items[c]},addGroup:function(a,c){var d=function(d){d.mfpEl=this,b._openClick(d,a,c)};c||(c={});var e="click.magnificPopup";c.mainEl=a,c.items?(c.isObj=!0,a.off(e).on(e,d)):(c.isObj=!1,c.delegate?a.off(e).on(e,c.delegate,d):(c.items=a,a.off(e).on(e,d)))},_openClick:function(c,d,e){var f=void 0!==e.midClick?e.midClick:a.magnificPopup.defaults.midClick;if(f||!(2===c.which||c.ctrlKey||c.metaKey||c.altKey||c.shiftKey)){var g=void 0!==e.disableOn?e.disableOn:a.magnificPopup.defaults.disableOn;if(g)if(a.isFunction(g)){if(!g.call(b))return!0}else if(v.width()<g)return!0;c.type&&(c.preventDefault(),b.isOpen&&c.stopPropagation()),e.el=a(c.mfpEl),e.delegate&&(e.items=d.find(e.delegate)),b.open(e)}},updateStatus:function(a,d){if(b.preloader){c!==a&&b.container.removeClass("mfp-s-"+c),d||"loading"!==a||(d=b.st.tLoading);var e={status:a,text:d};y("UpdateStatus",e),a=e.status,d=e.text,b.preloader.html(d),b.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),b.container.addClass("mfp-s-"+a),c=a}},_checkIfClose:function(c){if(!a(c).hasClass(s)){var d=b.st.closeOnContentClick,e=b.st.closeOnBgClick;if(d&&e)return!0;if(!b.content||a(c).hasClass("mfp-close")||b.preloader&&c===b.preloader[0])return!0;if(c===b.content[0]||a.contains(b.content[0],c)){if(d)return!0}else if(e&&a.contains(document,c))return!0;return!1}},_addClassToMFP:function(a){b.bgOverlay.addClass(a),b.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),b.wrap.removeClass(a)},_hasScrollBar:function(a){return(b.isIE7?d.height():document.body.scrollHeight)>(a||v.height())},_setFocus:function(){(b.st.focus?b.content.find(b.st.focus).eq(0):b.wrap).focus()},_onFocusIn:function(c){return c.target===b.wrap[0]||a.contains(b.wrap[0],c.target)?void 0:(b._setFocus(),!1)},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(l,[b,c,d]),a.each(c,function(c,d){if(void 0===d||d===!1)return!0;if(e=c.split("_"),e.length>1){var f=b.find(p+"-"+e[0]);if(f.length>0){var g=e[1];"replaceWith"===g?f[0]!==d[0]&&f.replaceWith(d):"img"===g?f.is("img")?f.attr("src",d):f.replaceWith(a("<img>").attr("src",d).attr("class",f.attr("class"))):f.attr(e[1],d)}}else b.find(p+"-"+c).html(d)})},_getScrollbarSize:function(){if(void 0===b.scrollbarSize){var a=document.createElement("div");a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),b.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return b.scrollbarSize}},a.magnificPopup={instance:null,proto:t.prototype,modules:[],open:function(b,c){return A(),b=b?a.extend(!0,{},b):{},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">&#215;</button>',tClose:"Close (Esc)",tLoading:"Loading...",autoFocusLast:!0}},a.fn.magnificPopup=function(c){A();var d=a(this);if("string"==typeof c)if("open"===c){var e,f=u?d.data("magnificPopup"):d[0].magnificPopup,g=parseInt(arguments[1],10)||0;f.items?e=f.items[g]:(e=d,f.delegate&&(e=e.find(f.delegate)),e=e.eq(g)),b._openClick({mfpEl:e},d,f)}else b.isOpen&&b[c].apply(b,Array.prototype.slice.call(arguments,1));else c=a.extend(!0,{},c),u?d.data("magnificPopup",c):d[0].magnificPopup=c,b.addGroup(d,c);return d};var C,D,E,F="inline",G=function(){E&&(D.after(E.addClass(C)).detach(),E=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){b.types.push(F),w(h+"."+F,function(){G()})},getInline:function(c,d){if(G(),c.src){var e=b.st.inline,f=a(c.src);if(f.length){var g=f[0].parentNode;g&&g.tagName&&(D||(C=e.hiddenClass,D=x(C),C="mfp-"+C),E=f.after(D).detach().removeClass(C)),b.updateStatus("ready")}else b.updateStatus("error",e.tNotFound),f=a("<div>");return c.inlineElement=f,f}return b.updateStatus("ready"),b._parseMarkup(d,{},c),d}}});var H,I="ajax",J=function(){H&&a(document.body).removeClass(H)},K=function(){J(),b.req&&b.req.abort()};a.magnificPopup.registerModule(I,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){b.types.push(I),H=b.st.ajax.cursor,w(h+"."+I,K),w("BeforeChange."+I,K)},getAjax:function(c){H&&a(document.body).addClass(H),b.updateStatus("loading");var d=a.extend({url:c.src,success:function(d,e,f){var g={data:d,xhr:f};y("ParseAjax",g),b.appendContent(a(g.data),I),c.finished=!0,J(),b._setFocus(),setTimeout(function(){b.wrap.addClass(q)},16),b.updateStatus("ready"),y("AjaxContentAdded")},error:function(){J(),c.finished=c.loadError=!0,b.updateStatus("error",b.st.ajax.tError.replace("%url%",c.src))}},b.st.ajax.settings);return b.req=a.ajax(d),""}}});var L,M=function(c){if(c.data&&void 0!==c.data.title)return c.data.title;var d=b.st.image.titleSrc;if(d){if(a.isFunction(d))return d.call(b,c);if(c.el)return c.el.attr(d)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><figure><div class="mfp-img"></div><figcaption><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></figcaption></figure></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var c=b.st.image,d=".image";b.types.push("image"),w(m+d,function(){"image"===b.currItem.type&&c.cursor&&a(document.body).addClass(c.cursor)}),w(h+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),v.off("resize"+p)}),w("Resize"+d,b.resizeImage),b.isLowIE&&w("AfterChange",b.resizeImage)},resizeImage:function(){var a=b.currItem;if(a&&a.img&&b.st.image.verticalFit){var c=0;b.isLowIE&&(c=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",b.wH-c)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y("ImageHasSize",a),a.imgHidden&&(b.content&&b.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var c=0,d=a.img[0],e=function(f){L&&clearInterval(L),L=setInterval(function(){return d.naturalWidth>0?void b._onImageHasSize(a):(c>200&&clearInterval(L),c++,void(3===c?e(10):40===c?e(50):100===c&&e(500)))},f)};e(1)},getImage:function(c,d){var e=0,f=function(){c&&(c.img[0].complete?(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("ready")),c.hasSize=!0,c.loaded=!0,y("ImageLoadComplete")):(e++,200>e?setTimeout(f,100):g()))},g=function(){c&&(c.img.off(".mfploader"),c===b.currItem&&(b._onImageHasSize(c),b.updateStatus("error",h.tError.replace("%url%",c.src))),c.hasSize=!0,c.loaded=!0,c.loadError=!0)},h=b.st.image,i=d.find(".mfp-img");if(i.length){var j=document.createElement("img");j.className="mfp-img",c.el&&c.el.find("img").length&&(j.alt=c.el.find("img").attr("alt")),c.img=a(j).on("load.mfploader",f).on("error.mfploader",g),j.src=c.src,i.is("img")&&(c.img=c.img.clone()),j=c.img[0],j.naturalWidth>0?c.hasSize=!0:j.width||(c.hasSize=!1)}return b._parseMarkup(d,{title:M(c),img_replaceWith:c.img},c),b.resizeImage(),c.hasSize?(L&&clearInterval(L),c.loadError?(d.addClass("mfp-loading"),b.updateStatus("error",h.tError.replace("%url%",c.src))):(d.removeClass("mfp-loading"),b.updateStatus("ready")),d):(b.updateStatus("loading"),c.loading=!0,c.hasSize||(c.imgHidden=!0,d.addClass("mfp-loading"),b.findImageSize(c)),d)}}});var N,O=function(){return void 0===N&&(N=void 0!==document.createElement("p").style.MozTransform),N};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a,c=b.st.zoom,d=".zoom";if(c.enabled&&b.supportsTransition){var e,f,g=c.duration,j=function(a){var b=a.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+c.duration/1e3+"s "+c.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,b.css(e),b},k=function(){b.content.css("visibility","visible")};w("BuildControls"+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.content.css("visibility","hidden"),a=b._getItemToZoom(),!a)return void k();f=j(a),f.css(b._getOffset()),b.wrap.append(f),e=setTimeout(function(){f.css(b._getOffset(!0)),e=setTimeout(function(){k(),setTimeout(function(){f.remove(),a=f=null,y("ZoomAnimationEnded")},16)},g)},16)}}),w(i+d,function(){if(b._allowZoom()){if(clearTimeout(e),b.st.removalDelay=g,!a){if(a=b._getItemToZoom(),!a)return;f=j(a)}f.css(b._getOffset(!0)),b.wrap.append(f),b.content.css("visibility","hidden"),setTimeout(function(){f.css(b._getOffset())},16)}}),w(h+d,function(){b._allowZoom()&&(k(),f&&f.remove(),a=null)})}},_allowZoom:function(){return"image"===b.currItem.type},_getItemToZoom:function(){return b.currItem.hasSize?b.currItem.img:!1},_getOffset:function(c){var d;d=c?b.currItem.img:b.st.zoom.opener(b.currItem.el||b.currItem);var e=d.offset(),f=parseInt(d.css("padding-top"),10),g=parseInt(d.css("padding-bottom"),10);e.top-=a(window).scrollTop()-f;var h={width:d.width(),height:(u?d.innerHeight():d[0].offsetHeight)-g-f};return O()?h["-moz-transform"]=h.transform="translate("+e.left+"px,"+e.top+"px)":(h.left=e.left,h.top=e.top),h}}});var P="iframe",Q="//about:blank",R=function(a){if(b.currTemplate[P]){var c=b.currTemplate[P].find("iframe");c.length&&(a||(c[0].src=Q),b.isIE8&&c.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){b.types.push(P),w("BeforeChange",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(h+"."+P,function(){R()})},getIframe:function(c,d){var e=c.src,f=b.st.iframe;a.each(f.patterns,function(){return e.indexOf(this.index)>-1?(this.id&&(e="string"==typeof this.id?e.substr(e.lastIndexOf(this.id)+this.id.length,e.length):this.id.call(this,e)),e=this.src.replace("%id%",e),!1):void 0});var g={};return f.srcAction&&(g[f.srcAction]=e),b._parseMarkup(d,g,c),b.updateStatus("ready"),d}}});var S=function(a){var c=b.items.length;return a>c-1?a-c:0>a?c+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=b.st.gallery,e=".mfp-gallery";return b.direction=!0,c&&c.enabled?(f+=" mfp-gallery",w(m+e,function(){c.navigateByImgClick&&b.wrap.on("click"+e,".mfp-img",function(){return b.items.length>1?(b.next(),!1):void 0}),d.on("keydown"+e,function(a){37===a.keyCode?b.prev():39===a.keyCode&&b.next()})}),w("UpdateStatus"+e,function(a,c){c.text&&(c.text=T(c.text,b.currItem.index,b.items.length))}),w(l+e,function(a,d,e,f){var g=b.items.length;e.counter=g>1?T(c.tCounter,f.index,g):""}),w("BuildControls"+e,function(){if(b.items.length>1&&c.arrows&&!b.arrowLeft){var d=c.arrowMarkup,e=b.arrowLeft=a(d.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,"left")).addClass(s),f=b.arrowRight=a(d.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,"right")).addClass(s);e.click(function(){b.prev()}),f.click(function(){b.next()}),b.container.append(e.add(f))}}),w(n+e,function(){b._preloadTimeout&&clearTimeout(b._preloadTimeout),b._preloadTimeout=setTimeout(function(){b.preloadNearbyImages(),b._preloadTimeout=null},16)}),void w(h+e,function(){d.off(e),b.wrap.off("click"+e),b.arrowRight=b.arrowLeft=null})):!1},next:function(){b.direction=!0,b.index=S(b.index+1),b.updateItemHTML()},prev:function(){b.direction=!1,b.index=S(b.index-1),b.updateItemHTML()},goTo:function(a){b.direction=a>=b.index,b.index=a,b.updateItemHTML()},preloadNearbyImages:function(){var a,c=b.st.gallery.preload,d=Math.min(c[0],b.items.length),e=Math.min(c[1],b.items.length);for(a=1;a<=(b.direction?e:d);a++)b._preloadItem(b.index+a);for(a=1;a<=(b.direction?d:e);a++)b._preloadItem(b.index-a)},_preloadItem:function(c){if(c=S(c),!b.items[c].preloaded){var d=b.items[c];d.parsed||(d=b.parseEl(c)),y("LazyLoad",d),"image"===d.type&&(d.img=a('<img class="mfp-img" />').on("load.mfploader",function(){d.hasSize=!0}).on("error.mfploader",function(){d.hasSize=!0,d.loadError=!0,y("LazyLoadError",d)}).attr("src",d.src)),d.preloaded=!0}}}});var U="retina";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=b.st.retina,c=a.ratio;c=isNaN(c)?c():c,c>1&&(w("ImageHasSize."+U,function(a,b){b.img.css({"max-width":b.img[0].naturalWidth/c,width:"100%"})}),w("ElementParse."+U,function(b,d){d.src=a.replaceSrc(d,c)}))}}}}),A()});
!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(x){"use strict";var t,e,i,n,W,C,o,s,r,l,a,h,u;function E(t,e,i){return[parseFloat(t[0])*(a.test(t[0])?e/100:1),parseFloat(t[1])*(a.test(t[1])?i/100:1)]}function L(t,e){return parseInt(x.css(t,e),10)||0}function N(t){return null!=t&&t===t.window}x.ui=x.ui||{},x.ui.version="1.13.3",
x.extend(x.expr.pseudos,{data:x.expr.createPseudo?x.expr.createPseudo(function(e){return function(t){return!!x.data(t,e)}}):function(t,e,i){return!!x.data(t,i[3])}}),
x.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}}),
x.ui.focusable=function(t,e){var i,n,o,s=t.nodeName.toLowerCase();return"area"===s?(o=(i=t.parentNode).name,!(!t.href||!o||"map"!==i.nodeName.toLowerCase())&&0<(i=x("img[usemap='#"+o+"']")).length&&i.is(":visible")):(/^(input|select|textarea|button|object)$/.test(s)?(n=!t.disabled)&&(o=x(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===s&&t.href||e,n&&x(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(x(t)))},x.extend(x.expr.pseudos,{focusable:function(t){return x.ui.focusable(t,null!=x.attr(t,"tabindex"))}}),x.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):x(this[0].form)},
x.ui.formResetMixin={_formResetHandler:function(){var e=x(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");x.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(x.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}},x.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),
x.expr.pseudos||(x.expr.pseudos=x.expr[":"]),x.uniqueSort||(x.uniqueSort=x.unique),x.escapeSelector||(e=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,i=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},x.escapeSelector=function(t){return(t+"").replace(e,i)}),x.fn.even&&x.fn.odd||x.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}}),
x.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},
x.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+x.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},x.ui.plugin={add:function(t,e,i){var n,o=x.ui[t].prototype;for(n in i)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([e,i[n]])},call:function(t,e,i,n){var o,s=t.plugins[e];if(s&&(n||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(o=0;o<s.length;o++)t.options[s[o][0]]&&s[o][1].apply(t.element,i)}},
W=Math.max,C=Math.abs,o=/left|center|right/,s=/top|center|bottom/,r=/[\+\-]\d+(\.[\d]+)?%?/,l=/^\w+/,a=/%$/,h=x.fn.position,x.position={scrollbarWidth:function(){var t,e,i;return void 0!==n?n:(i=(e=x("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>")).children()[0],x("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),n=t-i)},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?x.position.scrollbarWidth():0,height:e?x.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=x(t||window),i=N(e[0]),n=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:n,offset:!i&&!n?x(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},x.fn.position=function(f){var c,d,p,g,m,v,y,w,b,_,t,e;return f&&f.of?(v="string"==typeof(f=x.extend({},f)).of?x(document).find(f.of):x(f.of),y=x.position.getWithinInfo(f.within),w=x.position.getScrollInfo(y),b=(f.collision||"flip").split(" "),_={},e=9===(e=(t=v)[0]).nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:N(e)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:e.preventDefault?{width:0,height:0,offset:{top:e.pageY,left:e.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()},v[0].preventDefault&&(f.at="left top"),d=e.width,p=e.height,m=x.extend({},g=e.offset),x.each(["my","at"],function(){var t,e,i=(f[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):s.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=s.test(i[1])?i[1]:"center",t=r.exec(i[0]),e=r.exec(i[1]),_[this]=[t?t[0]:0,e?e[0]:0],f[this]=[l.exec(i[0])[0],l.exec(i[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===f.at[0]?m.left+=d:"center"===f.at[0]&&(m.left+=d/2),"bottom"===f.at[1]?m.top+=p:"center"===f.at[1]&&(m.top+=p/2),c=E(_.at,d,p),m.left+=c[0],m.top+=c[1],this.each(function(){var i,t,r=x(this),l=r.outerWidth(),a=r.outerHeight(),e=L(this,"marginLeft"),n=L(this,"marginTop"),o=l+e+L(this,"marginRight")+w.width,s=a+n+L(this,"marginBottom")+w.height,h=x.extend({},m),u=E(_.my,r.outerWidth(),r.outerHeight());"right"===f.my[0]?h.left-=l:"center"===f.my[0]&&(h.left-=l/2),"bottom"===f.my[1]?h.top-=a:"center"===f.my[1]&&(h.top-=a/2),h.left+=u[0],h.top+=u[1],i={marginLeft:e,marginTop:n},x.each(["left","top"],function(t,e){x.ui.position[b[t]]&&x.ui.position[b[t]][e](h,{targetWidth:d,targetHeight:p,elemWidth:l,elemHeight:a,collisionPosition:i,collisionWidth:o,collisionHeight:s,offset:[c[0]+u[0],c[1]+u[1]],my:f.my,at:f.at,within:y,elem:r})}),f.using&&(t=function(t){var e=g.left-h.left,i=e+d-l,n=g.top-h.top,o=n+p-a,s={target:{element:v,left:g.left,top:g.top,width:d,height:p},element:{element:r,left:h.left,top:h.top,width:l,height:a},horizontal:i<0?"left":0<e?"right":"center",vertical:o<0?"top":0<n?"bottom":"middle"};d<l&&C(e+i)<d&&(s.horizontal="center"),p<a&&C(n+o)<p&&(s.vertical="middle"),W(C(e),C(i))>W(C(n),C(o))?s.important="horizontal":s.important="vertical",f.using.call(this,t,s)}),r.offset(x.extend(h,{using:t}))})):h.apply(this,arguments)},x.ui.position={fit:{left:function(t,e){var i,n=e.within,o=n.isWindow?n.scrollLeft:n.offset.left,n=n.width,s=t.left-e.collisionPosition.marginLeft,r=o-s,l=s+e.collisionWidth-n-o;n<e.collisionWidth?0<r&&l<=0?(i=t.left+r+e.collisionWidth-n-o,t.left+=r-i):t.left=!(0<l&&r<=0)&&l<r?o+n-e.collisionWidth:o:0<r?t.left+=r:0<l?t.left-=l:t.left=W(t.left-s,t.left)},top:function(t,e){var i,n=e.within,n=n.isWindow?n.scrollTop:n.offset.top,o=e.within.height,s=t.top-e.collisionPosition.marginTop,r=n-s,l=s+e.collisionHeight-o-n;o<e.collisionHeight?0<r&&l<=0?(i=t.top+r+e.collisionHeight-o-n,t.top+=r-i):t.top=!(0<l&&r<=0)&&l<r?n+o-e.collisionHeight:n:0<r?t.top+=r:0<l?t.top-=l:t.top=W(t.top-s,t.top)}},flip:{left:function(t,e){var i=e.within,n=i.offset.left+i.scrollLeft,o=i.width,i=i.isWindow?i.scrollLeft:i.offset.left,s=t.left-e.collisionPosition.marginLeft,r=s-i,s=s+e.collisionWidth-o-i,l="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,a="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,h=-2*e.offset[0];r<0?((o=t.left+l+a+h+e.collisionWidth-o-n)<0||o<C(r))&&(t.left+=l+a+h):0<s&&(0<(n=t.left-e.collisionPosition.marginLeft+l+a+h-i)||C(n)<s)&&(t.left+=l+a+h)},top:function(t,e){var i=e.within,n=i.offset.top+i.scrollTop,o=i.height,i=i.isWindow?i.scrollTop:i.offset.top,s=t.top-e.collisionPosition.marginTop,r=s-i,s=s+e.collisionHeight-o-i,l="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,a="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,h=-2*e.offset[1];r<0?((o=t.top+l+a+h+e.collisionHeight-o-n)<0||o<C(r))&&(t.top+=l+a+h):0<s&&(0<(n=t.top-e.collisionPosition.marginTop+l+a+h-i)||C(n)<s)&&(t.top+=l+a+h)}},flipfit:{left:function(){x.ui.position.flip.left.apply(this,arguments),x.ui.position.fit.left.apply(this,arguments)},top:function(){x.ui.position.flip.top.apply(this,arguments),x.ui.position.fit.top.apply(this,arguments)}}},x.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=(i=i||e.body).nodeName?i:e.body},x.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&x(t).trigger("blur")},
x.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=x(this);return(!i||"static"!==t.css("position"))&&n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:x(this[0].ownerDocument||document)},
x.extend(x.expr.pseudos,{tabbable:function(t){var e=x.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&x.ui.focusable(t,i)}}),
x.fn.extend({uniqueId:(u=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++u)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&x(this).removeAttr("id")})}});
var f,c=0,d=Array.prototype.hasOwnProperty,p=Array.prototype.slice;x.cleanData=(f=x.cleanData,function(t){for(var e,i,n=0;null!=(i=t[n]);n++)(e=x._data(i,"events"))&&e.remove&&x(i).triggerHandler("remove");f(t)}),x.widget=function(t,i,e){var n,o,s,r={},l=t.split(".")[0],a=l+"-"+(t=t.split(".")[1]);return e||(e=i,i=x.Widget),Array.isArray(e)&&(e=x.extend.apply(null,[{}].concat(e))),x.expr.pseudos[a.toLowerCase()]=function(t){return!!x.data(t,a)},x[l]=x[l]||{},n=x[l][t],o=x[l][t]=function(t,e){if(!this||!this._createWidget)return new o(t,e);arguments.length&&this._createWidget(t,e)},x.extend(o,n,{version:e.version,_proto:x.extend({},e),_childConstructors:[]}),(s=new i).options=x.widget.extend({},s.options),x.each(e,function(e,n){function o(){return i.prototype[e].apply(this,arguments)}function s(t){return i.prototype[e].apply(this,t)}r[e]="function"!=typeof n?n:function(){var t,e=this._super,i=this._superApply;return this._super=o,this._superApply=s,t=n.apply(this,arguments),this._super=e,this._superApply=i,t}}),o.prototype=x.widget.extend(s,{widgetEventPrefix:n&&s.widgetEventPrefix||t},r,{constructor:o,namespace:l,widgetName:t,widgetFullName:a}),n?(x.each(n._childConstructors,function(t,e){var i=e.prototype;x.widget(i.namespace+"."+i.widgetName,o,e._proto)}),delete n._childConstructors):i._childConstructors.push(o),x.widget.bridge(t,o),o},x.widget.extend=function(t){for(var e,i,n=p.call(arguments,1),o=0,s=n.length;o<s;o++)for(e in n[o])i=n[o][e],d.call(n[o],e)&&void 0!==i&&(x.isPlainObject(i)?t[e]=x.isPlainObject(t[e])?x.widget.extend({},t[e],i):x.widget.extend({},i):t[e]=i);return t},x.widget.bridge=function(s,e){var r=e.prototype.widgetFullName||s;x.fn[s]=function(i){var t="string"==typeof i,n=p.call(arguments,1),o=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=x.data(this,r);return"instance"===i?(o=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?x.error("no such method '"+i+"' for "+s+" widget instance"):(t=e[i].apply(e,n))!==e&&void 0!==t?(o=t&&t.jquery?o.pushStack(t.get()):t,!1):void 0:x.error("cannot call methods on "+s+" prior to initialization; attempted to call method '"+i+"'")}):o=void 0:(n.length&&(i=x.widget.extend.apply(null,[i].concat(n))),this.each(function(){var t=x.data(this,r);t?(t.option(i||{}),t._init&&t._init()):x.data(this,r,new e(i,this))})),o}},x.Widget=function(){},x.Widget._childConstructors=[],x.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=x(e||this.defaultElement||this)[0],this.element=x(e),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=x(),this.hoverable=x(),this.focusable=x(),this.classesElementLookup={},e!==this&&(x.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=x(e.style?e.ownerDocument:e.document||e),this.window=x(this.document[0].defaultView||this.document[0].parentWindow)),this.options=x.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:x.noop,_create:x.noop,_init:x.noop,destroy:function(){var i=this;this._destroy(),x.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:x.noop,widget:function(){return this.element},option:function(t,e){var i,n,o,s=t;if(0===arguments.length)return x.widget.extend({},this.options);if("string"==typeof t)if(s={},t=(i=t.split(".")).shift(),i.length){for(n=s[t]=x.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)n[i[o]]=n[i[o]]||{},n=n[i[o]];if(t=i.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=e}return this._setOptions(s),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,n;for(e in t)n=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&n&&n.length&&(i=x(n.get()),this._removeClass(n,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(o){var s=[],r=this;function t(t,e){for(var i,n=0;n<t.length;n++)i=r.classesElementLookup[t[n]]||x(),i=o.add?(function(){var i=[];o.element.each(function(t,e){x.map(r.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),r._on(x(i),{remove:"_untrackClassesElement"})}(),x(x.uniqueSort(i.get().concat(o.element.get())))):x(i.not(o.element).get()),r.classesElementLookup[t[n]]=i,s.push(t[n]),e&&o.classes[t[n]]&&s.push(o.classes[t[n]])}return(o=x.extend({element:this.element,classes:this.options.classes||{}},o)).keys&&t(o.keys.match(/\S+/g)||[],!0),o.extra&&t(o.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(i){var n=this;x.each(n.classesElementLookup,function(t,e){-1!==x.inArray(i.target,e)&&(n.classesElementLookup[t]=x(e.not(i.target).get()))}),this._off(x(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,n){var o="string"==typeof t||null===t,e={extra:o?e:i,keys:o?t:e,element:o?this.element:t,add:n="boolean"==typeof n?n:i};return e.element.toggleClass(this._classes(e),n),this},_on:function(o,s,t){var r,l=this;"boolean"!=typeof o&&(t=s,s=o,o=!1),t?(s=r=x(s),this.bindings=this.bindings.add(s)):(t=s,s=this.element,r=this.widget()),x.each(t,function(t,e){function i(){if(o||!0!==l.options.disabled&&!x(this).hasClass("ui-state-disabled"))return("string"==typeof e?l[e]:e).apply(l,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||x.guid++);var t=t.match(/^([\w:-]*)\s*(.*)$/),n=t[1]+l.eventNamespace,t=t[2];t?r.on(n,t,i):s.on(n,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=x(this.bindings.not(t).get()),this.focusable=x(this.focusable.not(t).get()),this.hoverable=x(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(x(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(x(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(x(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var n,o,s=this.options[t];if(i=i||{},(e=x.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],o=e.originalEvent)for(n in o)n in e||(e[n]=o[n]);return this.element.trigger(e,i),!("function"==typeof s&&!1===s.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},x.each({show:"fadeIn",hide:"fadeOut"},function(s,r){x.Widget.prototype["_"+s]=function(e,t,i){var n,o=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||r:s;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),n=!x.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),n&&x.effects&&x.effects.effect[o]?e[s](t):o!==s&&e[o]?e[o](t.duration,t.easing,i):e.queue(function(t){x(this)[s](),i&&i.call(e[0]),t()})}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","../ie","../version","../widget"],e):e(jQuery)}(function(o){"use strict";var n=!1;return o(document).on("mouseup",function(){n=!1}),o.widget("ui.mouse",{version:"1.13.3",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.on("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).on("click."+this.widgetName,function(e){if(!0===o.data(e.target,t.widgetName+".preventClickEvent"))return o.removeData(e.target,t.widgetName+".preventClickEvent"),e.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){var t,i,s;if(!n)return this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),i=1===(this._mouseDownEvent=e).which,s=!("string"!=typeof(t=this).options.cancel||!e.target.nodeName)&&o(e.target).closest(this.options.cancel).length,i&&!s&&this._mouseCapture(e)&&(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){t.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(e),!this._mouseStarted)?e.preventDefault():(!0===o.data(e.target,this.widgetName+".preventClickEvent")&&o.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return t._mouseMove(e)},this._mouseUpDelegate=function(e){return t._mouseUp(e)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),n=!0)),!0},_mouseMove:function(e){if(this._mouseMoved){if(o.ui.ie&&(!document.documentMode||document.documentMode<9)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,e),this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&o.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,n=!1,e.preventDefault()},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})});
!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery","./mouse","../keycode","../version","../widget"],e):e(jQuery)}(function(o){"use strict";return o.widget("ui.slider",o.ui.mouse,{version:"1.13.3",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,t=this.options,i=this.element.find(".ui-slider-handle"),s=[],a=t.values&&t.values.length||1;for(i.length>a&&(i.slice(a).remove(),i=i.slice(0,a)),e=i.length;e<a;e++)s.push("<span tabindex='0'></span>");this.handles=i.add(o(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(e){o(this).data("ui-slider-handle-index",e).attr("tabIndex",0)})},_createRange:function(){var e=this.options;e.range?(!0===e.range&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:Array.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=o("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==e.range&&"max"!==e.range||this._addClass(this.range,"ui-slider-range-"+e.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(e){var i,s,a,n,t,h,l=this,u=this.options;return!u.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),t={x:e.pageX,y:e.pageY},i=this._normValueFromMouse(t),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var t=Math.abs(i-l.values(e));(t<s||s===t&&(e===l._lastChangedValue||l.values(e)===u.min))&&(s=t,a=o(this),n=e)}),!1!==this._start(e,n))&&(this._mouseSliding=!0,this._handleIndex=n,this._addClass(a,null,"ui-state-active"),a.trigger("focus"),t=a.offset(),h=!o(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-t.left-a.width()/2,top:e.pageY-t.top-a.height()/2-(parseInt(a.css("borderTopWidth"),10)||0)-(parseInt(a.css("borderBottomWidth"),10)||0)+(parseInt(a.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,n,i),this._animateOff=!0)},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},t=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,t),!1},_mouseStop:function(e){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,e="horizontal"===this.orientation?(t=this.elementSize.width,e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),e=e/t;return(e=1<e?1:e)<0&&(e=0),"vertical"===this.orientation&&(e=1-e),t=this._valueMax()-this._valueMin(),e=this._valueMin()+e*t,this._trimAlignValue(e)},_uiHash:function(e,t,i){var s={handle:this.handles[e],handleIndex:e,value:void 0!==t?t:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==t?t:this.values(e),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(e,t){return this._trigger("start",e,this._uiHash(t))},_slide:function(e,t,i){var s,a=this.value(),n=this.values();this._hasMultipleValues()&&(s=this.values(t?0:1),a=this.values(t),2===this.options.values.length&&!0===this.options.range&&(i=0===t?Math.min(s,i):Math.max(s,i)),n[t]=i),i!==a&&!1!==this._trigger("slide",e,this._uiHash(t,i,n))&&(this._hasMultipleValues()?this.values(t,i):this.value(i))},_stop:function(e,t){this._trigger("stop",e,this._uiHash(t))},_change:function(e,t){this._keySliding||this._mouseSliding||(this._lastChangedValue=t,this._trigger("change",e,this._uiHash(t)))},value:function(e){if(!arguments.length)return this._value();this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0)},values:function(e,t){var i,s,a;if(1<arguments.length)this.options.values[e]=this._trimAlignValue(t),this._refreshValue(),this._change(null,e);else{if(!arguments.length)return this._values();if(!Array.isArray(e))return this._hasMultipleValues()?this._values(e):this.value();for(i=this.options.values,s=e,a=0;a<i.length;a+=1)i[a]=this._trimAlignValue(s[a]),this._change(null,a);this._refreshValue()}},_setOption:function(e,t){var i,s=0;switch("range"===e&&!0===this.options.range&&("min"===t?(this.options.value=this._values(0),this.options.values=null):"max"===t&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(e,t),e){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(t),this.handles.css("horizontal"===t?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(e){this._super(e),this._toggleClass(null,"ui-state-disabled",!!e)},_value:function(){var e=this.options.value;return this._trimAlignValue(e)},_values:function(e){var t,i;if(arguments.length)return e=this.options.values[e],this._trimAlignValue(e);if(this._hasMultipleValues()){for(t=this.options.values.slice(),i=0;i<t.length;i+=1)t[i]=this._trimAlignValue(t[i]);return t}return[]},_trimAlignValue:function(e){var t,i;return e<=this._valueMin()?this._valueMin():e>=this._valueMax()?this._valueMax():(t=0<this.options.step?this.options.step:1,i=e-(e=(e-this._valueMin())%t),2*Math.abs(e)>=t&&(i+=0<e?t:-t),parseFloat(i.toFixed(5)))},_calculateNewMax:function(){var e=this.options.max,t=this._valueMin(),i=this.options.step;(e=Math.round((e-t)/i)*i+t)>this.options.max&&(e-=i),this.max=parseFloat(e.toFixed(this._precision()))},_precision:function(){var e=this._precisionOf(this.options.step);return e=null!==this.options.min?Math.max(e,this._precisionOf(this.options.min)):e},_precisionOf:function(e){var e=e.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(e){"vertical"===e&&this.range.css({width:"",left:""}),"horizontal"===e&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var t,i,e,s,a,n=this.options.range,h=this.options,l=this,u=!this._animateOff&&h.animate,r={};this._hasMultipleValues()?this.handles.each(function(e){i=(l.values(e)-l._valueMin())/(l._valueMax()-l._valueMin())*100,r["horizontal"===l.orientation?"left":"bottom"]=i+"%",o(this).stop(1,1)[u?"animate":"css"](r,h.animate),!0===l.options.range&&("horizontal"===l.orientation?(0===e&&l.range.stop(1,1)[u?"animate":"css"]({left:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({width:i-t+"%"},{queue:!1,duration:h.animate})):(0===e&&l.range.stop(1,1)[u?"animate":"css"]({bottom:i+"%"},h.animate),1===e&&l.range[u?"animate":"css"]({height:i-t+"%"},{queue:!1,duration:h.animate}))),t=i}):(e=this.value(),s=this._valueMin(),a=this._valueMax(),i=a!==s?(e-s)/(a-s)*100:0,r["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[u?"animate":"css"](r,h.animate),"min"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:i+"%"},h.animate),"max"===n&&"horizontal"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({width:100-i+"%"},h.animate),"min"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:i+"%"},h.animate),"max"===n&&"vertical"===this.orientation&&this.range.stop(1,1)[u?"animate":"css"]({height:100-i+"%"},h.animate))},_handleEvents:{keydown:function(e){var t,i,s,a=o(e.target).data("ui-slider-handle-index");switch(e.keyCode){case o.ui.keyCode.HOME:case o.ui.keyCode.END:case o.ui.keyCode.PAGE_UP:case o.ui.keyCode.PAGE_DOWN:case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(e.preventDefault(),this._keySliding||(this._keySliding=!0,this._addClass(o(e.target),null,"ui-state-active"),!1!==this._start(e,a)))break;return}switch(s=this.options.step,t=i=this._hasMultipleValues()?this.values(a):this.value(),e.keyCode){case o.ui.keyCode.HOME:i=this._valueMin();break;case o.ui.keyCode.END:i=this._valueMax();break;case o.ui.keyCode.PAGE_UP:i=this._trimAlignValue(t+(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(t-(this._valueMax()-this._valueMin())/this.numPages);break;case o.ui.keyCode.UP:case o.ui.keyCode.RIGHT:if(t===this._valueMax())return;i=this._trimAlignValue(t+s);break;case o.ui.keyCode.DOWN:case o.ui.keyCode.LEFT:if(t===this._valueMin())return;i=this._trimAlignValue(t-s)}this._slide(e,a,i)},keyup:function(e){var t=o(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,t),this._change(e,t),this._removeClass(o(e.target),null,"ui-state-active"))}}})});
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
(function ($){
"use strict";
if(!$.wjbpExtensions)
$.wjbpExtensions={};
function WJBPMainCore(){
var self=this;
self.init();
};
WJBPMainCore.prototype={
init: function(){
var self=this;
self.fileUpload();
self.userLoginRegister();
self.userLoginRegisterNew();
self.userChangePass();
self.removeJob();
self.fillJob();
self.applyEmail();
self.recaptchaCallback();
self.applyInternal();
self.applicantsInit();
self.applicationMeeting();
self.addJobShortlist();
self.removeJobShortlist();
self.addCandidateShortlist();
self.removeCandidateShortlist();
self.reviewInit();
self.jobAlert();
self.candidateAlert();
self.jobSocialApply();
self.select2Init();
self.jobSubmission();
self.filterListing();
self.followEmployer();
self.employerAddEmployee();
self.inviteCandidate();
self.mixesFn();
self.loadExtension();
},
loadExtension: function(){
var self=this;
},
fileUpload: function(){
var imagesPreview=function(input, placeToInsertImagePreview){
if(input.files){
var filesAmount=input.files.length;
var i;
for (i=0; i < filesAmount; i++){
var reader=new FileReader();
reader.onload=function(event){
$($.parseHTML('<img>')).attr('src', event.target.result).appendTo(placeToInsertImagePreview);
}
reader.readAsDataURL(input.files[i]);
}}
};
var filesPreview=function(input, placeToInsertImagePreview){
if(input.files){
var filesAmount=input.files.length;
var i;
for (i=0; i < filesAmount; i++){
var html=$($.parseHTML('<div><code>'+ input.files[i].name +'</code></div>')).appendTo(placeToInsertImagePreview);
}}
};
$('.cmb-type-wp-job-board-pro-file').each(function(e){
var $e_this=$(this);
$(this).find('input[type="file"]:not(.wp-job-board-pro-file-upload)').on('change', function(){
$e_this.find('.wp-job-board-pro-uploaded-files').html('');
var allowed_types=$(this).data('file_types');
if(allowed_types){
var acceptFileTypes=new RegExp('(\.|\/)(' + allowed_types + ')$', 'i');
if(this.files[0].name.length&&! acceptFileTypes.test(this.files[0].name) ){
alert(wp_job_board_pro_opts.not_allow);
$(this).val(null);
return false;
}}
var file=this.files[0];
var fileType=file["type"];
var validImageTypes=["image/gif", "image/jpeg", "image/png"];
if($.inArray(fileType, validImageTypes) < 0){
filesPreview(this, $e_this.find('.wp-job-board-pro-uploaded-files'));
$e_this.find('.wp-job-board-pro-uploaded-files').css("display","block");
}else{
imagesPreview(this, $e_this.find('.wp-job-board-pro-uploaded-files'));
$e_this.find('.wp-job-board-pro-uploaded-files').css("display","block");
}});
});
$(document).on('change', '.upload-file-btn-wrapper input[type="file"]', function(){
var $e_this=$(this).closest('.upload-file-btn-wrapper');
var $text=$e_this.find('.upload-file-btn').data('text');
var allowed_types=$(this).data('file_types');
if($(this).val()==''){
$e_this.find('.upload-file-btn span.text').html($text);
$e_this.find('.label-can-drag').removeClass('has-file');
return false;
}
if(allowed_types){
var acceptFileTypes=new RegExp('(\.|\/)(' + allowed_types + ')$', 'i');
if(this.files[0].name.length&&! acceptFileTypes.test(this.files[0].name) ){
alert(wp_job_board_pro_opts.not_allow);
$(this).val(null);
$e_this.find('.upload-file-btn span.text').html($text);
$e_this.find('.label-can-drag').removeClass('has-file');
return false;
}}
if(this.files){
var filesAmount=this.files.length;
var i;
$e_this.find('.upload-file-btn span.text').html('');
for (i=0; i < filesAmount; i++){
var $file_html=$($.parseHTML('<span class="text-inner"><span>'+ this.files[i].name +'</span><span class="close">&times;</span></span>'));
$e_this.find('.upload-file-btn span.text').append($file_html);
}
$e_this.find('.label-can-drag').addClass('has-file');
}});
$(document).on('click', '.upload-file-btn-wrapper .upload-file-btn span.close', function(e){
e.preventDefault();
var $e_this=$(this).closest('.upload-file-btn-wrapper');
var $file_input=$e_this.find('input[type="file"]');
var $text=$e_this.find('.upload-file-btn').data('text');
$file_input.val(null);
$e_this.find('.upload-file-btn span.text').html($text);
$e_this.find('.label-can-drag').removeClass('has-file');
});
var isAdvancedUpload=function(){
var div=document.createElement('div');
return (('draggable' in div)||('ondragstart' in div&&'ondrop' in div))&&'FormData' in window&&'FileReader' in window;
}();
if(isAdvancedUpload){
var droppedFiles=false;
$('.label-can-drag').each(function(){
var label_self=$(this);
label_self.on('drag dragstart dragend dragover dragenter dragleave drop', function(e){
e.preventDefault();
e.stopPropagation();
}).on('dragover dragenter', function(){
label_self.addClass('is-dragover');
}).on('dragleave dragend drop', function(){
label_self.removeClass('is-dragover');
}).on('drop', function(e){
droppedFiles=e.originalEvent.dataTransfer.files;
label_self.parent().find('input[type="file"]').prop('files', droppedFiles).trigger('change');
});
});
}
$(document).on('click', '.label-can-drag:not(.has-file)', function(){
$(this).parent().find('input[type="file"]').trigger('click');
});
},
userLoginRegisterNew: function(){
var self=this;
$(document).on('submit', 'form._employer_register_fields, form._candidate_register_fields', function(){
var $this=$(this);
if(self.registerAjax){
self.registerAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
self.registerAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_registernew&action=wp_job_board_pro_ajax_registernew'),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
if(data.redirect){
setTimeout(function(){
if(data.role=='wp_job_board_pro_employer'){
window.location.href=wp_job_board_pro_opts.after_register_page_url;
}else{
window.location.href=wp_job_board_pro_opts.after_register_page_candidate_url;
}}, 500);
}}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
if(wp_job_board_pro_opts.recaptcha_enable){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
grecaptcha.reset(i);
}}
}
self.registerAjax=false;
});
return false;
});
},
userLoginRegister: function(){
var self=this;
$('body').on('submit', 'form.login-form', function(){
var $this=$(this);
$('.alert', this).remove();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_login'),
type:'POST',
dataType: 'json',
data:  $(this).serialize()+"&action=wp_job_board_pro_ajax_login"
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">' + data.msg + '</div>');
setTimeout(function(){
if(data.role=='wp_job_board_pro_employer'){
window.location.href=wp_job_board_pro_opts.after_login_page_url;
}else{
window.location.href=wp_job_board_pro_opts.after_login_page_candidate_url;
}}, 500);
}else{
$this.prepend('<div class="alert alert-warning">' + data.msg + '</div>');
if(wp_job_board_pro_opts.recaptcha_enable){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
grecaptcha.reset(i);
}}
}});
return false;
});
$('body').on('click', '.back-link', function(e){
e.preventDefault();
var $con=$(this).closest('.login-form-wrapper');
$con.find('.form-container').hide();
$($(this).attr('href')).show();
return false;
});
$('body').on('submit', 'form.forgotpassword-form', function(){
var $this=$(this);
$('.alert', this).remove();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_forgotpass'),
type:'POST',
dataType: 'json',
data:  $(this).serialize()+"&action=wp_job_board_pro_ajax_forgotpass"
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
setTimeout(function(){
window.location.reload(true);
}, 500);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
if(wp_job_board_pro_opts.recaptcha_enable){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
grecaptcha.reset(i);
}}
}});
return false;
});
$('body').on('click', '#forgot-password-form-wrapper form .btn-cancel', function(e){
e.preventDefault();
$('#forgot-password-form-wrapper').hide();
$('#login-form-wrapper').show();
});
$('body').on('submit', 'form.register-form', function(){
var $this=$(this);
$('.alert', this).remove();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_register'),
type:'POST',
dataType: 'json',
data:  $(this).serialize()+"&action=wp_job_board_pro_ajax_register"
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
if(data.redirect){
setTimeout(function(){
if(data.role=='wp_job_board_pro_employer'){
window.location.href=wp_job_board_pro_opts.after_register_page_url;
}else{
window.location.href=wp_job_board_pro_opts.after_register_page_candidate_url;
}}, 500);
}}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
if(wp_job_board_pro_opts.recaptcha_enable){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
grecaptcha.reset(i);
}}
}});
return false;
});
if($('form.register-form').length > 0){
$('.role-tabs input[type=radio]').on('change', function(){
var val=$(this).val();
var container=$(this).closest('.register-form');
if(val=='wp_job_board_pro_candidate'){
container.find('.wp_job_board_pro_candidate_show').show();
container.find('.wp_job_board_pro_employer_show').hide();
}else{
container.find('.wp_job_board_pro_candidate_show').hide();
container.find('.wp_job_board_pro_employer_show').show();
}});
var val=$('.role-tabs input[type=radio]:checked').val();
var container=$('form.register-form').closest('.register-form');
if(val=='wp_job_board_pro_candidate'){
container.find('.wp_job_board_pro_candidate_show').show();
container.find('.wp_job_board_pro_employer_show').hide();
}else{
container.find('.wp_job_board_pro_candidate_show').hide();
container.find('.wp_job_board_pro_employer_show').show();
}}
$(document).on('click', '.wp-job-board-pro-resend-approve-account-btn', function(e){
e.preventDefault();
var $this=$(this),
$container=$(this).parent();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_resend_approve_account'),
type:'POST',
dataType: 'json',
data: {
action: 'wp_job_board_pro_ajax_resend_approve_account',
login: $this.data('login'),
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$container.html(data.msg);
}else{
$container.html(data.msg);
}});
});
},
userChangePass: function(){
var self=this;
$('body').on('submit', 'form.change-password-form', function(){
var $this=$(this);
$('.alert', this).remove();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_change_password'),
type:'POST',
dataType: 'json',
data:  $(this).serialize()+"&action=wp_job_board_pro_ajax_change_password"
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">' + data.msg + '</div>');
setTimeout(function(){
window.location.href=wp_job_board_pro_opts.login_register_url;
}, 500);
}else{
$this.prepend('<div class="alert alert-warning">' + data.msg + '</div>');
}});
return false;
});
},
removeJob: function(){
var self=this;
$('.job-button-delete').on('click', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_job'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_job',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('tr').remove();
}
$(document).trigger("after_remove_my_job", [$this, data]);
self.showMessage(data.msg, data.status);
});
}});
},
fillJob: function(){
var self=this;
$(document).on('click', '.btn-action-icon.mark_filled', function(){
var $this=$(this);
$this.addClass('loading');
var job_id=$this.data('job_id');
var nonce=$this.data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_mark_filled_job'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_mark_filled_job',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.attr('title', data.title);
$this.data('nonce', data.nonce);
$this.removeClass('mark_filled').addClass('mark_not_filled');
$this.find('i').attr('class', data.icon_class);
$this.closest('tr').find('.job-title-wrapper .application-status-label').remove();
if(data.label){
$this.closest('tr').find('.job-title-wrapper').append(data.label);
}}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-action-icon.mark_not_filled', function(){
var $this=$(this);
$this.addClass('loading');
var job_id=$this.data('job_id');
var nonce=$this.data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_mark_not_filled_job'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_mark_not_filled_job',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.attr('title', data.title);
$this.data('nonce', data.nonce);
$this.removeClass('mark_not_filled').addClass('mark_filled');
$this.find('i').attr('class', data.icon_class);
$this.closest('tr').find('.job-title-wrapper .application-status-label').remove();
if(data.label){
$this.closest('tr').find('.job-title-wrapper').append(data.label);
}}
self.showMessage(data.msg, data.status);
});
});
},
recaptchaCallback: function(){
if(window.grecaptcha){
setTimeout(function(){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
var recaptcha=recaptchas[i];
var sitekey=recaptcha.dataset.sitekey;
grecaptcha.render(recaptcha, {
'sitekey':sitekey
});
}}, 1000);
}},
applyEmail: function(){
var self=this;
$('.btn-apply-job-email:not(.filled), .btn-apply-job-call:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in apus-mfp-zoom-call-in',
type:'inline',
midClick: true
});
$('.btn-apply-job-email:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true
});
$(document).on('click', '.btn-apply-job-email.filled', function(e){
e.preventDefault();
self.showMessage(wp_job_board_pro_opts.job_filled, false);
});
$(document).on('submit', 'form.job-apply-email-form', function(){
var $this=$(this);
if(self.applyEmailAjax){
self.applyEmailAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
var error=false;
if(wp_job_board_pro_opts.cv_required=='on'){
var cv_file=$this.find('input.cv_file');
if(cv_file.length > 0&&cv_file.val()!=''){
cv_file=cv_file.prop('files')[0];
var file_size=cv_file.size;
var file_type=cv_file.type;
var allowed_types=wp_job_board_pro_opts.cv_file_types;
var filesize_allow=wp_job_board_pro_opts.cv_file_size_allow;
filesize_allow=parseInt(filesize_allow);
if(file_size > filesize_allow){
alert(wp_job_board_pro_opts.cv_file_size_error);
error=true;
}
if(allowed_types.indexOf(file_type) < 0){
alert(wp_job_board_pro_opts.cv_file_types_error);
error=true;
}}
}
if(error==false){
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
var action=$(this).find('input[name=action]').val();
self.applyEmailAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', action),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}
self.applyEmailAjax=false;
});
}else{
alert(wp_job_board_pro_opts.choose_a_cv);
}
return false;
});
},
applyInternal: function(){
var self=this;
$(document).on('click', '.btn-apply-job-internal-required:not(.filled)', function(){
var msg=$(this).parent().find('.job-apply-internal-required-wrapper .msg-inner').html();
self.showMessage(msg, false);
});
$(document).on('click', '.btn-apply-job-internal:not(.filled), .btn-apply-job-internal-without-login:not(.filled)', function(e){
e.preventDefault();
var href=$(this).attr('href');
$.magnificPopup.open({
items: {
src: href,
},
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true
});
});
$(document).on('click', '.btn-apply-job-internal.filled, .btn-apply-job-internal-without-login.filled, .btn-apply-job-internal-required.filled', function(e){
e.preventDefault();
self.showMessage(wp_job_board_pro_opts.job_filled, false);
});
$(document).on('submit', 'form.job-apply-internal-form', function(){
var $this=$(this);
if(self.applyInternalAjax){
self.applyInternalAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_wrapper_id=$(this).closest('.job-apply-internal-form-wrapper').attr('id');
var form_id=$(this).attr('id');
var error=true;
if($this.find('input.apply_cv_id:checked').val()){
var error=false;
}
var cv_file=$this.find('input.cv_file');
if(cv_file.length > 0&&cv_file.val()!=''){
var file_error=false;
cv_file=cv_file.prop('files')[0];
var file_size=cv_file.size;
var file_type=cv_file.type;
var allowed_types=wp_job_board_pro_opts.cv_file_types;
var filesize_allow=wp_job_board_pro_opts.cv_file_size_allow;
filesize_allow=parseInt(filesize_allow);
if(file_size > filesize_allow){
alert(wp_job_board_pro_opts.cv_file_size_error);
file_error=true;
}
if(allowed_types.indexOf(file_type) < 0){
alert(wp_job_board_pro_opts.cv_file_types_error);
file_error=true;
}
if(file_error==true){
return false;
}
error=false;
}
if(wp_job_board_pro_opts.cv_required=='on'){
}else{
var error=false;
}
if(error==false){
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
var action=$(this).find('input[name=action]').val();
self.applyInternalAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', action),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
if($('a[href="#'+form_wrapper_id+'"]').length){
$('a[href="#'+form_wrapper_id+'"]').html(data.text).removeClass('btn-apply-job-internal').addClass('btn-applied-job-internal');
setTimeout(function(){
$.magnificPopup.close();
}, 2000);
}}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}
self.applyInternalAjax=false;
});
}else{
alert(wp_job_board_pro_opts.choose_a_cv);
}
return false;
});
$(document).on('submit', 'form#_candidate_register_fields_apply_apply', function(){
var $this=$(this);
if(self.registerAjax){
self.registerAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
self.registerAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_register_apply&action=wp_job_board_pro_ajax_register_apply'),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
setTimeout(function(){
location.reload();
}, 500);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
if(wp_job_board_pro_opts.recaptcha_enable){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
grecaptcha.reset(i);
}}
}
self.registerAjax=false;
});
return false;
});
},
applicantsInit: function(){
var self=this;
$(document).on('click', '.btn-remove-job-applied', function(e){
e.preventDefault();
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
var $this=$(this);
$this.addClass('loading');
var applicant_id=$(this).data('applicant_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_applied'),
type:'POST',
dataType: 'json',
data: {
'applicant_id': applicant_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_applied',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.job-applied-wrapper').remove();
$this.closest('.job-applicant-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
$(document).on('click', '.btn-reject-job-applied', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
var applicant_id=$(this).data('applicant_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_reject_applied'),
type:'POST',
dataType: 'json',
data: {
'applicant_id': applicant_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_reject_applied',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
var total_rej=parseInt($this.closest('.job-applicants').find('.rejected-applicants span').text()) + 1;
$this.closest('.job-applicants').find('.rejected-applicants span').text(total_rej);
if(data.output){
$this.closest('.job-applicant-wrapper').replaceWith(data.output);
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-undo-reject-job-applied', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
var applicant_id=$(this).data('applicant_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_undo_reject_applied'),
type:'POST',
dataType: 'json',
data: {
'applicant_id': applicant_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_undo_reject_applied',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
var total_rej=parseInt($this.closest('.job-applicants').find('.rejected-applicants span').text()) - 1;
$this.closest('.job-applicants').find('.rejected-applicants span').text(total_rej);
if($this.closest('.job-applicants').find('.rejected-applicants').hasClass('active')){
$this.closest('.job-applied-wrapper').remove();
$this.closest('.job-applicant-wrapper').remove();
}else{
if(data.output){
$this.closest('.job-applicant-wrapper').replaceWith(data.output);
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}}
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.show-rejected-applicants', function(e){
e.preventDefault();
var $this=$(this),
$con=$this.closest('.job-applicants');
if($this.hasClass('active')||$this.hasClass('loading')){
return false;
}
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_show_rejected_applicants'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_show_rejected_applicants'
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$con.find('.applicants-wrapper').html(data.output);
$con.find('.show-total-applicants').removeClass('active');
$con.find('.show-approved-applicants').removeClass('active');
$this.addClass('active');
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-approve-job-applied', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
var applicant_id=$(this).data('applicant_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_approve_applied'),
type:'POST',
dataType: 'json',
data: {
'applicant_id': applicant_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_approve_applied',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
var total_app=parseInt($this.closest('.job-applicants').find('.approved-applicants span').text()) + 1;
$this.closest('.job-applicants').find('.approved-applicants span').text(total_app);
if(data.output){
$this.closest('.job-applicant-wrapper').replaceWith(data.output);
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-undo-approve-job-applied', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
var applicant_id=$(this).data('applicant_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_undo_approve_applied'),
type:'POST',
dataType: 'json',
data: {
'applicant_id': applicant_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_undo_approve_applied',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
var total_approve=parseInt($this.closest('.job-applicants').find('.approved-applicants span').text()) - 1;
$this.closest('.job-applicants').find('.approved-applicants span').text(total_approve);
if($this.closest('.job-applicants').find('.approved-applicants').hasClass('active')){
$this.closest('.job-applied-wrapper').remove();
$this.closest('.job-applicant-wrapper').remove();
}else{
if(data.output){
$this.closest('.job-applicant-wrapper').replaceWith(data.output);
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}}
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.show-approved-applicants', function(e){
e.preventDefault();
var $this=$(this),
$con=$this.closest('.job-applicants');
if($this.hasClass('active')||$this.hasClass('loading')){
return false;
}
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_show_approved_applicants'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_show_approved_applicants'
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$con.find('.applicants-wrapper').html(data.output);
$con.find('.show-total-applicants').removeClass('active');
$con.find('.show-rejected-applicants').removeClass('active');
$this.addClass('active');
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.show-total-applicants', function(e){
e.preventDefault();
var $this=$(this),
$con=$this.closest('.job-applicants');
if($this.hasClass('active')||$this.hasClass('loading')){
return false;
}
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_show_applicants'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_show_applicants'
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$con.find('.applicants-wrapper').html(data.output);
$con.find('.show-rejected-applicants').removeClass('active');
$con.find('.show-approved-applicants').removeClass('active');
$this.addClass('active');
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('submit', 'form.applicants-pagination-form', function(e){
e.preventDefault();
var $this=$(this);
var $container=$(this).closest('.applicants-wrapper');
if($this.hasClass('loading')){
return false;
}
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_applicants_pagination'),
type:'POST',
dataType: 'json',
data: $this.serialize()
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$container.find('.applicants-inner').append(data.output);
if(data.paged > 0){
$this.find('input[name=paged]').val(data.paged);
}else{
$this.remove();
}
$('.btn-create-meeting-job-applied').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
}else{
self.showMessage(data.msg, data.status);
}});
return false;
});
},
applicationMeeting: function(){
if($('input.datetimepicker-date').length){
$("input.datetimepicker-date").each(function(){
$(this).datepicker({
dateFormat: $(this).data('date_format'),
altField: $(this).data('id'),
altFormat: 'yy-mm-dd'
});
});
}
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=false;
select2_args['minimumResultsForSearch']=-1;
select2_args['width']='100%';
if(typeof wp_job_board_pro_select2_opts.language_result!=='undefined'){
select2_args['language']={
noResults: function (params){
return wp_job_board_pro_select2_opts['language_result'];
}}
}
$('select.select-time-hour').select2(select2_args);
}
$('.btn-create-meeting-job-applied, .btn-messages-job-meeting, .btn-reschedule-job-meeting, .employer-meeting-zoom-settings').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true,
closeBtnInside:false,
});
$(document).on('click', '.close-popup', function(){
$.magnificPopup.close()
});
$(document).on('submit', 'form.create-meeting-form', function(e){
e.preventDefault();
var $this=$(this);
if(self.createMeetingAjax){
self.createMeetingAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
var action=$(this).find('input[name=action]').val();
self.createMeetingAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', action),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
setTimeout(function(){
$.magnificPopup.close();
}, 2000);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}
self.createMeetingAjax=false;
});
});
$(document).on('submit', 'form.reschedule-meeting-form', function(e){
e.preventDefault();
var $this=$(this);
if(self.rescheduleMeetingAjax){
self.rescheduleMeetingAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
var action=$(this).find('input[name=action]').val();
self.rescheduleMeetingAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', action),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
location.reload();
setTimeout(function(){
$.magnificPopup.close();
}, 2000);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}
self.rescheduleMeetingAjax=false;
});
});
$(document).on('click', '.btn-remove-job-meeting', function(e){
e.preventDefault();
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
var $this=$(this),
$con=$this.closest('.meetings-list-inner');
if($this.hasClass('loading')){
return false;
}
$this.addClass('loading');
var meeting_id=$(this).data('meeting_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_meeting'),
type:'POST',
dataType: 'json',
data: {
'meeting_id': meeting_id,
'nonce': nonce
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
if($con.find('.meeting-wrapper').length > 1){
$this.closest('.meeting-wrapper').remove();
}else{
location.reload();
}}
self.showMessage(data.msg, data.status);
});
}});
$(document).on('click', '.btn-cancel-job-meeting', function(e){
e.preventDefault();
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
var $this=$(this),
$con=$this.closest('.meetings-list-inner');
if($this.hasClass('loading')){
return false;
}
$this.addClass('loading');
var meeting_id=$(this).data('meeting_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_cancel_meeting'),
type:'POST',
dataType: 'json',
data: {
'meeting_id': meeting_id,
'nonce': nonce
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
location.reload();
}
self.showMessage(data.msg, data.status);
});
}});
$(document).on('submit', 'form.zoom-meeting-settings-form', function(e){
e.preventDefault();
var $this=$(this);
if(self.zoomSettingAjax){
self.zoomSettingAjax.abort();
}
if($this.hasClass('loading')){
return false;
}
var form_id=$(this).attr('id');
$this.find('.alert').remove();
$this.addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
var action=$(this).find('input[name=action]').val();
self.zoomSettingAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', action),
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.removeClass('loading');
$this.prepend('<div class="data">'+data.html+'</div>');
self.zoomSettingAjax=false;
});
});
},
addJobShortlist: function(){
var self=this;
$(document).on('click', '.btn-add-job-shortlist', function(){
var $this=$(this);
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_add_job_shortlist'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_add_job_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.replaceWith(data.html);
$(document).trigger("after_add_shortlist", [$this, data]);
}
self.showMessage(data.msg, data.status);
});
});
},
removeJobShortlist: function(){
var self=this;
$(document).on('click', '.btn-added-job-shortlist', function(){
var $this=$(this);
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_job_shortlist'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_job_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.replaceWith(data.html);
$(document).trigger("after_remove_shortlist", [$this, data]);
}
self.showMessage(data.msg, data.status);
});
});
$('.btn-remove-job-shortlist').on('click', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var job_id=$(this).data('job_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_job_shortlist'),
type:'POST',
dataType: 'json',
data: {
'job_id': job_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_job_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.job-shortlist-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
},
addCandidateShortlist: function(){
var self=this;
$(document).on('click', '.btn-add-candidate-shortlist', function(){
var $this=$(this);
$this.addClass('loading');
var candidate_id=$(this).data('candidate_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_add_candidate_shortlist'),
type:'POST',
dataType: 'json',
data: {
'candidate_id': candidate_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_add_candidate_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.replaceWith(data.html);
$(document).trigger("after_add_candidate_shortlist", [$this, data]);
}
self.showMessage(data.msg, data.status);
});
});
},
removeCandidateShortlist: function(){
var self=this;
$(document).on('click', '.btn-added-candidate-shortlist', function(){
var $this=$(this);
$this.addClass('loading');
var candidate_id=$(this).data('candidate_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_candidate_shortlist'),
type:'POST',
dataType: 'json',
data: {
'candidate_id': candidate_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_candidate_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.replaceWith(data.html);
$(document).trigger("after_remove_candidate_shortlist", [$this, data]);
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-remove-candidate-shortlist', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var candidate_id=$(this).data('candidate_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_candidate_shortlist'),
type:'POST',
dataType: 'json',
data: {
'candidate_id': candidate_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_candidate_shortlist',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.candidate-shortlist-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
},
followEmployer: function(){
var self=this;
$(document).on('click', '.btn-follow-employer', function(){
var $this=$(this);
$this.addClass('loading');
var employer_id=$(this).data('employer_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_follow_employer'),
type:'POST',
dataType: 'json',
data: {
'employer_id': employer_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_follow_employer',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.removeClass('btn-follow-employer').addClass('btn-unfollow-employer');
$this.data('nonce', data.nonce);
$this.find('span').text(data.text);
$(document).trigger("after_follow_employer", [$this, data]);
}
self.showMessage(data.msg, data.status);
});
});
$(document).on('click', '.btn-unfollow-employer', function(){
var $this=$(this);
$this.addClass('loading');
var employer_id=$(this).data('employer_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_unfollow_employer'),
type:'POST',
dataType: 'json',
data: {
'employer_id': employer_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_unfollow_employer',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
if($this.closest('.following-employer-wrapper').length > 0){
if($('.following-employer-wrapper').length <=1){
location.reload();
}else{
$this.closest('.following-employer-wrapper').remove();
}}else{
$this.removeClass('btn-unfollow-employer').addClass('btn-follow-employer');
$this.data('nonce', data.nonce);
$this.find('span').text(data.text);
$(document).trigger("after_unfollow_employer", [$this, data]);
}}
self.showMessage(data.msg, data.status);
});
});
},
reviewInit: function(){
var self=this;
if($('.comment-form-rating').length > 0){
var $star=$('.comment-form-rating .filled');
var $review=$('#_input_rating');
$star.find('li').on('mouseover', function (){
$(this).nextAll().addClass('active');
$(this).prevAll().removeClass('active');
$(this).removeClass('active');
});
$star.on('mouseout', function(){
var current=$review.val() - 1;
var current_e=$star.find('li').eq(current);
current_e.nextAll().addClass('active');
current_e.prevAll().removeClass('active');
current_e.removeClass('active');
});
$star.find('li').on('click', function (){
$(this).nextAll().addClass('active');
$(this).prevAll().removeClass('active');
$(this).removeClass('active');
$review.val($(this).index() + 1);
});
}},
jobAlert: function(){
var self=this;
$(document).on('click', '.btn-job-alert', function(){
var form_html=$('.job-alert-form-wrapper').html();
$.magnificPopup.open({
mainClass: 'wp-job-board-pro-mfp-container',
items:{
src:form_html,
type: 'inline'
}});
});
$(document).on('submit', 'form.job-alert-form', function(){
var $this=$(this);
$this.addClass('loading');
$this.find('.alert').remove();
var url_vars=self.getUrlVars();
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_add_job_alert'),
type:'POST',
dataType: 'json',
data: $this.serialize() + '&action=wp_job_board_pro_ajax_add_job_alert' + url_vars
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
setTimeout(function(){
$.magnificPopup.close();
}, 1500);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}});
return false;
});
$(document).on('click', '.btn-remove-job-alert', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var alert_id=$(this).data('alert_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_job_alert'),
type:'POST',
dataType: 'json',
data: {
'alert_id': alert_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_job_alert',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.job-alert-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
},
candidateAlert: function(){
var self=this;
$(document).on('click', '.btn-candidate-alert', function(){
var form_html=$('.candidate-alert-form-wrapper').html();
$.magnificPopup.open({
mainClass: 'wp-job-board-pro-mfp-container',
items:{
src:form_html,
type: 'inline'
}});
});
$(document).on('submit', 'form.candidate-alert-form', function(){
var $this=$(this);
$this.addClass('loading');
var url_vars=self.getUrlVars();
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_add_candidate_alert'),
type:'POST',
dataType: 'json',
data: $this.serialize() + '&action=wp_job_board_pro_ajax_add_candidate_alert' + url_vars
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
setTimeout(function(){
$.magnificPopup.close();
}, 1500);
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}});
return false;
});
$(document).on('click', '.btn-remove-candidate-alert', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var alert_id=$(this).data('alert_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_candidate_alert'),
type:'POST',
dataType: 'json',
data: {
'alert_id': alert_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_remove_candidate_alert',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.candidate-alert-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
},
getUrlVars: function(){
var self=this;
var vars='';
var hashes=window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i=0; i < hashes.length; i++){
vars +='&' +hashes[i];
}
return vars;
},
jobSocialApply: function(){
var self=this;
$('.facebook-apply-btn').on('click', function(){
var job_id=$(this).data('job_id');
var facebook_login_url=$(this).attr('href');
self.setCookie('wp_job_board_pro_facebook_job_id', job_id, 1);
window.location.href=facebook_login_url;
});
$('.google-apply-btn').on('click', function(){
var job_id=$(this).data('job_id');
var google_login_url=$(this).attr('href');
self.setCookie('wp_job_board_pro_google_job_id', job_id, 1);
window.location.href=google_login_url;
});
$('.linkedin-apply-btn').on('click', function(){
var job_id=$(this).data('job_id');
var linkedin_login_url=$(this).attr('href');
self.setCookie('wp_job_board_pro_linkedin_job_id', job_id, 1);
window.location.href=linkedin_login_url;
});
$('.twitter-apply-btn').on('click', function(){
var job_id=$(this).data('job_id');
var twitter_login_url=$(this).attr('href');
self.setCookie('wp_job_board_pro_twitter_job_id', job_id, 1);
window.location.href=twitter_login_url;
});
},
select2Init: function(){
var self=this;
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=false;
select2_args['minimumResultsForSearch']=10;
select2_args['width']='auto';
if(typeof wp_job_board_pro_select2_opts.language_result!=='undefined'){
select2_args['language']={
noResults: function (params){
return wp_job_board_pro_select2_opts['language_result'];
}}
}
if($('.woocommerce-ordering select.orderby').length){
var woo_select2_args=select2_args;
woo_select2_args.theme='default orderby';
$('.woocommerce-ordering select.orderby').select2(woo_select2_args);
}
$('select.orderby').select2(select2_args);
$('select.job_id').select2(select2_args);
}},
jobSubmission: function(){
var self=this;
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=false;
if(typeof wp_job_board_pro_select2_opts.language_result!=='undefined'){
select2_args['language']={
noResults: function (params){
return select2_args['language_result'];
}}
}
select2_args['minimumResultsForSearch']=10;
$('select.cmb2_select').select2(select2_args);
}
$('.cmb-repeatable-group').on('cmb2_add_group_row_start', function (event, instance){
var $table=$(document.getElementById($(instance).data('selector')));
var $oldRow=$table.find('.cmb-repeatable-grouping').last();
$oldRow.find('select.cmb2_select').each(function (){
$(this).select2('destroy');
});
});
$('.cmb-repeatable-group').on('cmb2_add_row', function (event, newRow){
$(newRow).find('select.cmb2_select').each(function (){
$('option:selected', this).removeAttr("selected");
$(this).select2(select2_args);
});
$(newRow).prev().find('select.cmb2_select').each(function (){
$(this).select2(select2_args);
});
});
$('.cmb-add-row-button').on('click', function (event){
var $table=$(document.getElementById($(event.target).data('selector')));
var $oldRow=$table.find('.cmb-row').last();
$oldRow.find('select.cmb2_select').each(function (){
$(this).select2('destroy');
});
});
$('.cmb-repeat-table').on('cmb2_add_row', function (event, newRow){
$(newRow).prev().find('select.cmb2_select').each(function (){
$('option:selected', this).removeAttr("selected");
$(this).select2(select2_args);
});
});
var apply_type=$('#_job_apply_type').val();
if(apply_type=='internal'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').hide();
}else if(apply_type=='external'){
$('.cmb2-id--job-apply-url').show();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').hide();
}else if(apply_type=='with_email'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-phone').hide();
$('.cmb2-id--job-apply-email').show();
}else if(apply_type=='call'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').show();
}
$('#_job_apply_type').change(function(){
var apply_type=$('#_job_apply_type').val();
if(apply_type=='internal'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').hide();
}else if(apply_type=='external'){
$('.cmb2-id--job-apply-url').show();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').hide();
}else if(apply_type=='with_email'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-phone').hide();
$('.cmb2-id--job-apply-email').show();
}else if(apply_type=='call'){
$('.cmb2-id--job-apply-url').hide();
$('.cmb2-id--job-apply-email').hide();
$('.cmb2-id--job-phone').show();
}});
},
filterListing: function(){
var self=this;
$(document).on('click', 'form .toggle-field .heading-label', function(){
var container=$(this).closest('.form-group');
container.find('.form-group-inner').slideToggle();
if(container.hasClass('hide-content')){
container.removeClass('hide-content');
}else{
container.addClass('hide-content');
}});
$(document).on('click', '.toggle-filter-list', function(){
var $this=$(this);
var container=$(this).closest('.form-group');
container.find('.terms-list .more-fields').each(function(){
if($(this).hasClass('active')){
$(this).removeClass('active');
$this.find('.text').text(wp_job_board_pro_opts.show_more);
}else{
$(this).addClass('active');
$this.find('.text').text(wp_job_board_pro_opts.show_less);
}});
});
if($.isFunction($.fn.slider) ){
$('.search-distance-slider').each(function(){
var $this=$(this);
var search_distance=$this.closest('.search-distance-wrapper').find('input[name^=filter-distance]');
var search_wrap=$this.closest('.search_distance_wrapper');
$(this).slider({
range: "min",
value: search_distance.val(),
min: 0,
max: 100,
slide: function(event, ui){
search_distance.val(ui.value);
$('.text-distance', search_wrap).text(ui.value);
$('.distance-custom-handle', $this).attr("data-value", ui.value);
search_distance.trigger('change');
},
create: function(){
$('.distance-custom-handle', $this).attr("data-value", $(this).slider("value") );
}});
});
$('.main-range-slider').each(function(){
var $this=$(this);
$this.slider({
range: true,
min: $this.data('min'),
max: $this.data('max'),
values: [ $this.parent().find('.filter-from').val(), $this.parent().find('.filter-to').val() ],
slide: function(event, ui){
$this.parent().find('.from-text').text(ui.values[ 0 ]);
$this.parent().find('.filter-from').val(ui.values[ 0 ])
$this.parent().find('.to-text').text(ui.values[ 1 ]);
$this.parent().find('.filter-to').val(ui.values[ 1 ]);
$this.parent().find('.filter-to').trigger('change');
}});
});
$('.salary-range-slider').each(function(){
var $this=$(this);
$this.slider({
range: true,
min: $this.data('min'),
max: $this.data('max'),
values: [ $this.parent().find('.filter-from').val(), $this.parent().find('.filter-to').val() ],
slide: function(event, ui){
$this.parent().find('.from-text .price-text').text(self.addCommas(ui.values[ 0 ]));
$this.parent().find('.filter-from').val(ui.values[ 0 ])
$this.parent().find('.to-text .price-text').text(self.addCommas(ui.values[ 1 ]));
$this.parent().find('.filter-to').val(ui.values[ 1 ]);
$this.parent().find('.filter-to').trigger('change');
}});
});
}
$('.find-me').on('click', function(){
$(this).addClass('loading');
var this_e=$(this);
var container=$(this).closest('.form-group');
navigator.geolocation.getCurrentPosition(function (position){
container.find('input[name="filter-center-latitude"]').val(position.coords.latitude);
container.find('input[name="filter-center-longitude"]').val(position.coords.longitude);
container.find('input[name="filter-center-location"]').val('Location');
container.find('.clear-location').removeClass('hidden');
container.find('.leaflet-geocode-container').html('').removeClass('active');
var position=[position.coords.latitude, position.coords.longitude];
if(typeof L.esri.Geocoding.geocodeService!='undefined'){
var geocodeService=L.esri.Geocoding.geocodeService();
geocodeService.reverse().latlng(position).run(function(error, result){
container.find('input[name="filter-center-location"]').val(result.address.Match_addr);
});
}
return this_e.removeClass('loading');
}, function (e){
return this_e.removeClass('loading');
}, {
enableHighAccuracy: true
});
});
$('.clear-location').on('click', function(){
var container=$(this).closest('.form-group');
container.find('input[name="filter-center-latitude"]').val('');
container.find('input[name="filter-center-longitude"]').val('');
container.find('input[name="filter-center-location"]').val('').trigger('keyup');
container.find('.clear-location').addClass('hidden');
});
$('input[name="filter-center-location"]').on('keyup', function(){
var container=$(this).closest('.form-group');
var val=$(this).val();
if($(this).val()!==''){
container.find('.clear-location').removeClass('hidden');
}else{
container.find('.clear-location').removeClass('hidden').addClass('hidden');
}});
if(wp_job_board_pro_opts.map_service=='google-map'){
}else{
if(typeof L.Control.Geocoder.Nominatim!='undefined'){
if(wp_job_board_pro_opts.geocoder_country){
var geocoder=new L.Control.Geocoder.Nominatim({
geocodingQueryParams: {countrycodes: wp_job_board_pro_opts.geocoder_country, lang: wp_job_board_pro_opts.geocoder_country}});
}else{
var geocoder=new L.Control.Geocoder.Nominatim();
}
function delay(fn, ms){
let timer=0
return function(...args){
clearTimeout(timer)
timer=setTimeout(fn.bind(this, ...args), ms||0)
}}
$("input[name=filter-center-location]").attr('autocomplete', 'off').after('<div class="leaflet-geocode-container"></div>');
$("input[name=filter-center-location]").on("keyup", delay(function (e){
var s=$(this).val(), $this=$(this), container=$(this).closest('.form-group-inner');
if(s&&s.length >=3){
$this.parent().addClass('loading');
geocoder.geocode(s, function(results){
var output_html='';
for (var i=0; i < results.length; i++){
output_html +='<li class="result-item" data-latitude="'+results[i].center.lat+'" data-longitude="'+results[i].center.lng+'" ><i class="fa fa-map-marker" aria-hidden="true"></i> '+results[i].name+'</li>';
}
if(output_html){
output_html='<ul>'+ output_html +'</ul>';
}
container.find('.leaflet-geocode-container').html(output_html).addClass('active');
var highlight_texts=s.split(' ');
highlight_texts.forEach(function (item){
container.find('.leaflet-geocode-container').highlight(item);
});
$this.parent().removeClass('loading');
});
}else{
container.find('.leaflet-geocode-container').html('').removeClass('active');
}}, 500));
$('.form-group-inner').on('click', '.leaflet-geocode-container ul li', function(){
var container=$(this).closest('.form-group-inner');
container.find('input[name=filter-center-latitude]').val($(this).data('latitude'));
container.find('input[name=filter-center-longitude]').val($(this).data('longitude'));
container.find('input[name=filter-center-location]').val($(this).text());
container.find('.leaflet-geocode-container').removeClass('active').html('');
});
}}
},
employerAddEmployee: function(){
var self=this;
$(document).on('submit', 'form.employer-add-employees-form', function(e){
e.preventDefault();
var $this=$(this);
if($this.hasClass('loading')){
return false;
}
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_employer_add_employee'),
type:'POST',
dataType: 'json',
data: $this.serialize() + '&action=wp_job_board_pro_ajax_employer_add_employee'
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$('.employer-employees-list-inner').prepend(data.html);
if($('.employer-employees-list-inner .not-found').length){
$('.employer-employees-list-inner .not-found').remove();
}
$this.find('.team-employee-inner').remove();
}
self.showMessage(data.msg, data.status);
});
return false;
});
$(document).on('click', '.btn-employer-remove-employee', function(){
var $this=$(this);
var r=confirm(wp_job_board_pro_opts.rm_item_txt);
if(r==true){
$this.addClass('loading');
var employee_id=$(this).data('employee_id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_employer_remove_employee'),
type:'POST',
dataType: 'json',
data: {
'employee_id': employee_id,
'nonce': nonce,
'action': 'wp_job_board_pro_ajax_employer_remove_employee',
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('article.employee-team-wrapper').remove();
}
self.showMessage(data.msg, data.status);
});
}});
},
inviteCandidate: function(){
var self=this;
$(document).on('click', '.cannot-download-cv-btn', function(){
var msg=$(this).data('msg');
self.showMessage(msg, false);
});
$('.btn-invite-candidate:not(.cannot-download-cv-btn)').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true
});
$(document).on('submit', 'form.invite-candidate-form', function(e){
e.preventDefault();
var $this=$(this);
if($this.hasClass('loading')){
return false;
}
if(self.inviteAjax){
self.inviteAjax.abort();
}
$this.find('.alert').remove();
$this.addClass('loading');
self.inviteAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_invite_candidate'),
type:'POST',
dataType: 'json',
data: $this.serialize()
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}
self.inviteAjax=false;
});
return false;
});
},
mixesFn: function(){
var self=this;
$('.my-jobs-ordering').on('change', 'select.orderby', function(){
$(this).closest('form').submit();
});
$('.contact-form-wrapper').on('submit', function(){
var $this=$(this);
$this.find('.alert').remove();
$this.addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_contact_form'),
type:'POST',
dataType: 'json',
data: $this.serialize() + '&action=wp_job_board_pro_ajax_contact_form'
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}});
return false;
});
$(document).on('submit', 'form.delete-profile-form', function(){
var $this=$(this);
$this.addClass('loading');
$(this).find('.alert').remove();
$.ajax({
url: wp_job_board_pro_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: $this.serialize() + '&action=wp_job_board_pro_ajax_delete_profile'
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
window.location.href=wp_job_board_pro_opts.home_url;
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}});
return false;
});
$('.cannot-download-cv-btn').on('click', function(e){
e.preventDefault();
self.showMessage($(this).data('msg'), false);
});
$('body').on('change', 'select.select-field-region', function(){
var val=$(this).val();
var next=$(this).data('next');
var hide_empty=$(this).data('hide_empty');
var main_select='select.select-field-region' + next;
if($(main_select).length > 0){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=true;
select2_args['minimumResultsForSearch']=10;
select2_args['width']='100%';
if(typeof wp_job_board_pro_select2_opts.language_result!=='undefined'){
select2_args['language']={
noResults: function(){
return wp_job_board_pro_select2_opts.language_result;
}};}
$(main_select).prop('disabled', true);
$(main_select).val('').trigger('change');
if(val){
$(main_select).parent().addClass('loading');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wpjb_process_change_location'),
type:'POST',
dataType: 'json',
data:{
'action': 'wpjb_process_change_location',
'parent': val,
'hide_empty': hide_empty,
'taxonomy': $(main_select).data('taxonomy'),
'security': wp_job_board_pro_opts.ajax_nonce,
}}).done(function(data){
$(main_select).parent().removeClass('loading');
$(main_select).find('option').remove();
if(data){
$.each(data, function(i, item){
var option=new Option(item.name, item.id, true, true);
$(main_select).append(option);
});
}
$(main_select).prop("disabled", false);
$(main_select).val(null).select2("destroy").select2(select2_args);
});
}else{
$(main_select).find('option').remove();
$(main_select).prop("disabled", false);
$(main_select).val(null).select2("destroy").select2(select2_args);
}}
});
$('.notifications-wrapper').on('click', '.remove-notify-btn', function(e){
e.stopPropagation();
var $this=$(this);
$this.addClass('loading');
var unique_id=$(this).data('id');
var nonce=$(this).data('nonce');
$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wp_job_board_pro_ajax_remove_notify'),
type:'POST',
dataType: 'json',
data: {
'unique_id': unique_id,
'nonce': nonce,
}}).done(function(data){
$this.removeClass('loading');
if(data.status){
if($this.closest('ul').find('li').length > 1){
$this.closest('li').remove();
}else{
window.location.reload(true);
}}
self.showMessage(data.msg, data.status);
});
});
$('body').on('change', '.jobs-currencies input', function(){
$(this).closest('form').trigger('submit');
});
},
addCommas: function(str){
var parts=(str + "").split("."),
main=parts[0],
len=main.length,
output="",
first=main.charAt(0),
i;
if(first==='-'){
main=main.slice(1);
len=main.length;
}else{
first="";
}
i=len - 1;
while(i >=0){
output=main.charAt(i) + output;
if((len - i) % 3===0&&i > 0){
output=wp_job_board_pro_opts.money_thousands_separator + output;
}
--i;
}
output=first + output;
if(parts.length > 1){
output +=wp_job_board_pro_opts.money_dec_point + parts[1];
}
return output;
},
showMessage: function(msg, status){
if(msg){
var classes='alert bg-warning';
if(status){
classes='alert bg-info';
}
var $html='<div id="wp-job-board-pro-popup-message" class="animated fadeInRight"><div class="message-inner '+ classes +'">'+ msg +'</div></div>';
$('body').find('#wp-job-board-pro-popup-message').remove();
$('body').append($html).fadeIn(500);
setTimeout(function(){
$('body').find('#wp-job-board-pro-popup-message').removeClass('fadeInRight').addClass('delay-2s fadeOutRight');
}, 2500);
}},
setCookie: function(cname, cvalue, exdays){
var d=new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires="expires="+d.toUTCString();
document.cookie=cname + "=" + cvalue + "; " + expires+";path=/";
},
getCookie: function(cname){
var name=cname + "=";
var ca=document.cookie.split(';');
for(var i=0; i<ca.length; i++){
var c=ca[i];
while (c.charAt(0)==' ') c=c.substring(1);
if(c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
},
}
$.wjbpMainCore=WJBPMainCore.prototype;
$(document).ready(function(){
new WJBPMainCore();
});
})(jQuery);
if(wp_job_board_pro_opts.map_service=='google-map'){
if(typeof google==='object'&&typeof google.maps==='object'){
function search_location_initialize(){
jQuery('input[name="filter-center-location"]').each(function(){
var $id=jQuery(this).attr('id');
if(typeof $id!=='undefined'){
var container=jQuery('#'+$id).closest('.form-group-inner');
var input=document.getElementById($id);
var autocomplete=new google.maps.places.Autocomplete(input);
autocomplete.setTypes([]);
if(wp_job_board_pro_opts.geocoder_country){
autocomplete.setComponentRestrictions({
country: [wp_job_board_pro_opts.geocoder_country],
});
}
autocomplete.addListener('place_changed', function (){
var place=autocomplete.getPlace();
place.toString();
if(!place.geometry){
window.alert("No details available for input: '" + place.name + "'");
return;
}
container.find('input[name=filter-center-latitude]').val(place.geometry.location.lat());
container.find('input[name=filter-center-longitude]').val(place.geometry.location.lng());
});
}});
}
google.maps.event.addDomListener(window, 'load', search_location_initialize);
}};
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var ps=require('../main')
, psInstances=require('../plugin/instances');
function mountJQuery(jQuery){
jQuery.fn.perfectScrollbar=function (settingOrCommand){
return this.each(function (){
if(typeof settingOrCommand==='object' ||
typeof settingOrCommand==='undefined'){
var settings=settingOrCommand;
if(!psInstances.get(this)){
ps.initialize(this, settings);
}}else{
var command=settingOrCommand;
if(command==='update'){
ps.update(this);
}else if(command==='destroy'){
ps.destroy(this);
}}
return jQuery(this);
});
};}
if(typeof define==='function'&&define.amd){
define(['jquery'], mountJQuery);
}else{
var jq=window.jQuery ? window.jQuery:window.$;
if(typeof jq!=='undefined'){
mountJQuery(jq);
}}
module.exports=mountJQuery;
},{"../main":7,"../plugin/instances":18}],2:[function(require,module,exports){
'use strict';
function oldAdd(element, className){
var classes=element.className.split(' ');
if(classes.indexOf(className) < 0){
classes.push(className);
}
element.className=classes.join(' ');
}
function oldRemove(element, className){
var classes=element.className.split(' ');
var idx=classes.indexOf(className);
if(idx >=0){
classes.splice(idx, 1);
}
element.className=classes.join(' ');
}
exports.add=function (element, className){
if(element.classList){
element.classList.add(className);
}else{
oldAdd(element, className);
}};
exports.remove=function (element, className){
if(element.classList){
element.classList.remove(className);
}else{
oldRemove(element, className);
}};
exports.list=function (element){
if(element.classList){
return Array.prototype.slice.apply(element.classList);
}else{
return element.className.split(' ');
}};},{}],3:[function(require,module,exports){
'use strict';
var DOM={};
DOM.e=function (tagName, className){
var element=document.createElement(tagName);
element.className=className;
return element;
};
DOM.appendTo=function (child, parent){
parent.appendChild(child);
return child;
};
function cssGet(element, styleName){
return window.getComputedStyle(element)[styleName];
}
function cssSet(element, styleName, styleValue){
if(typeof styleValue==='number'){
styleValue=styleValue.toString() + 'px';
}
element.style[styleName]=styleValue;
return element;
}
function cssMultiSet(element, obj){
for (var key in obj){
var val=obj[key];
if(typeof val==='number'){
val=val.toString() + 'px';
}
element.style[key]=val;
}
return element;
}
DOM.css=function (element, styleNameOrObject, styleValue){
if(typeof styleNameOrObject==='object'){
return cssMultiSet(element, styleNameOrObject);
}else{
if(typeof styleValue==='undefined'){
return cssGet(element, styleNameOrObject);
}else{
return cssSet(element, styleNameOrObject, styleValue);
}}
};
DOM.matches=function (element, query){
if(typeof element.matches!=='undefined'){
return element.matches(query);
}else{
if(typeof element.matchesSelector!=='undefined'){
return element.matchesSelector(query);
}else if(typeof element.webkitMatchesSelector!=='undefined'){
return element.webkitMatchesSelector(query);
}else if(typeof element.mozMatchesSelector!=='undefined'){
return element.mozMatchesSelector(query);
}else if(typeof element.msMatchesSelector!=='undefined'){
return element.msMatchesSelector(query);
}}
};
DOM.remove=function (element){
if(typeof element.remove!=='undefined'){
element.remove();
}else{
if(element.parentNode){
element.parentNode.removeChild(element);
}}
};
DOM.queryChildren=function (element, selector){
return Array.prototype.filter.call(element.childNodes, function (child){
return DOM.matches(child, selector);
});
};
module.exports=DOM;
},{}],4:[function(require,module,exports){
'use strict';
var EventElement=function (element){
this.element=element;
this.events={};};
EventElement.prototype.bind=function (eventName, handler){
if(typeof this.events[eventName]==='undefined'){
this.events[eventName]=[];
}
this.events[eventName].push(handler);
this.element.addEventListener(eventName, handler, false);
};
EventElement.prototype.unbind=function (eventName, handler){
var isHandlerProvided=(typeof handler!=='undefined');
this.events[eventName]=this.events[eventName].filter(function (hdlr){
if(isHandlerProvided&&hdlr!==handler){
return true;
}
this.element.removeEventListener(eventName, hdlr, false);
return false;
}, this);
};
EventElement.prototype.unbindAll=function (){
for (var name in this.events){
this.unbind(name);
}};
var EventManager=function (){
this.eventElements=[];
};
EventManager.prototype.eventElement=function (element){
var ee=this.eventElements.filter(function (eventElement){
return eventElement.element===element;
})[0];
if(typeof ee==='undefined'){
ee=new EventElement(element);
this.eventElements.push(ee);
}
return ee;
};
EventManager.prototype.bind=function (element, eventName, handler){
this.eventElement(element).bind(eventName, handler);
};
EventManager.prototype.unbind=function (element, eventName, handler){
this.eventElement(element).unbind(eventName, handler);
};
EventManager.prototype.unbindAll=function (){
for (var i=0; i < this.eventElements.length; i++){
this.eventElements[i].unbindAll();
}};
EventManager.prototype.once=function (element, eventName, handler){
var ee=this.eventElement(element);
var onceHandler=function (e){
ee.unbind(eventName, onceHandler);
handler(e);
};
ee.bind(eventName, onceHandler);
};
module.exports=EventManager;
},{}],5:[function(require,module,exports){
'use strict';
module.exports=(function (){
function s4(){
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return function (){
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
s4() + '-' + s4() + s4() + s4();
};})();
},{}],6:[function(require,module,exports){
'use strict';
var cls=require('./class')
, d=require('./dom');
exports.toInt=function (x){
return parseInt(x, 10)||0;
};
exports.clone=function (obj){
if(obj===null){
return null;
}else if(typeof obj==='object'){
var result={};
for (var key in obj){
result[key]=this.clone(obj[key]);
}
return result;
}else{
return obj;
}};
exports.extend=function (original, source){
var result=this.clone(original);
for (var key in source){
result[key]=this.clone(source[key]);
}
return result;
};
exports.isEditable=function (el){
return d.matches(el, "input,[contenteditable]") ||
d.matches(el, "select,[contenteditable]") ||
d.matches(el, "textarea,[contenteditable]") ||
d.matches(el, "button,[contenteditable]");
};
exports.removePsClasses=function (element){
var clsList=cls.list(element);
for (var i=0; i < clsList.length; i++){
var className=clsList[i];
if(className.indexOf('ps-')===0){
cls.remove(element, className);
}}
};
exports.outerWidth=function (element){
return this.toInt(d.css(element, 'width')) +
this.toInt(d.css(element, 'paddingLeft')) +
this.toInt(d.css(element, 'paddingRight')) +
this.toInt(d.css(element, 'borderLeftWidth')) +
this.toInt(d.css(element, 'borderRightWidth'));
};
exports.startScrolling=function (element, axis){
cls.add(element, 'ps-in-scrolling');
if(typeof axis!=='undefined'){
cls.add(element, 'ps-' + axis);
}else{
cls.add(element, 'ps-x');
cls.add(element, 'ps-y');
}};
exports.stopScrolling=function (element, axis){
cls.remove(element, 'ps-in-scrolling');
if(typeof axis!=='undefined'){
cls.remove(element, 'ps-' + axis);
}else{
cls.remove(element, 'ps-x');
cls.remove(element, 'ps-y');
}};
exports.env={
isWebKit: 'WebkitAppearance' in document.documentElement.style,
supportsTouch: (('ontouchstart' in window)||window.DocumentTouch&&document instanceof window.DocumentTouch),
supportsIePointer: window.navigator.msMaxTouchPoints!==null
};},{"./class":2,"./dom":3}],7:[function(require,module,exports){
'use strict';
var destroy=require('./plugin/destroy')
, initialize=require('./plugin/initialize')
, update=require('./plugin/update');
module.exports={
initialize: initialize,
update: update,
destroy: destroy
};},{"./plugin/destroy":9,"./plugin/initialize":17,"./plugin/update":21}],8:[function(require,module,exports){
'use strict';
module.exports={
maxScrollbarLength: null,
minScrollbarLength: null,
scrollXMarginOffset: 0,
scrollYMarginOffset: 0,
stopPropagationOnClick: true,
suppressScrollX: false,
suppressScrollY: false,
swipePropagation: true,
useBothWheelAxes: false,
useKeyboard: true,
useSelectionScroll: false,
wheelPropagation: false,
wheelSpeed: 1,
theme: 'default'
};},{}],9:[function(require,module,exports){
'use strict';
var d=require('../lib/dom')
, h=require('../lib/helper')
, instances=require('./instances');
module.exports=function (element){
var i=instances.get(element);
if(!i){
return;
}
i.event.unbindAll();
d.remove(i.scrollbarX);
d.remove(i.scrollbarY);
d.remove(i.scrollbarXRail);
d.remove(i.scrollbarYRail);
h.removePsClasses(element);
instances.remove(element);
};},{"../lib/dom":3,"../lib/helper":6,"./instances":18}],10:[function(require,module,exports){
'use strict';
var h=require('../../lib/helper')
, instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindClickRailHandler(element, i){
function pageOffset(el){
return el.getBoundingClientRect();
}
var stopPropagation=window.Event.prototype.stopPropagation.bind;
if(i.settings.stopPropagationOnClick){
i.event.bind(i.scrollbarY, 'click', stopPropagation);
}
i.event.bind(i.scrollbarYRail, 'click', function (e){
var halfOfScrollbarLength=h.toInt(i.scrollbarYHeight / 2);
var positionTop=i.railYRatio * (e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength);
var maxPositionTop=i.railYRatio * (i.railYHeight - i.scrollbarYHeight);
var positionRatio=positionTop / maxPositionTop;
if(positionRatio < 0){
positionRatio=0;
}else if(positionRatio > 1){
positionRatio=1;
}
updateScroll(element, 'top', (i.contentHeight - i.containerHeight) * positionRatio);
updateGeometry(element);
e.stopPropagation();
});
if(i.settings.stopPropagationOnClick){
i.event.bind(i.scrollbarX, 'click', stopPropagation);
}
i.event.bind(i.scrollbarXRail, 'click', function (e){
var halfOfScrollbarLength=h.toInt(i.scrollbarXWidth / 2);
var positionLeft=i.railXRatio * (e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength);
var maxPositionLeft=i.railXRatio * (i.railXWidth - i.scrollbarXWidth);
var positionRatio=positionLeft / maxPositionLeft;
if(positionRatio < 0){
positionRatio=0;
}else if(positionRatio > 1){
positionRatio=1;
}
updateScroll(element, 'left', ((i.contentWidth - i.containerWidth) * positionRatio) - i.negativeScrollAdjustment);
updateGeometry(element);
e.stopPropagation();
});
}
module.exports=function (element){
var i=instances.get(element);
bindClickRailHandler(element, i);
};},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],11:[function(require,module,exports){
'use strict';
var d=require('../../lib/dom')
, h=require('../../lib/helper')
, instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindMouseScrollXHandler(element, i){
var currentLeft=null;
var currentPageX=null;
function updateScrollLeft(deltaX){
var newLeft=currentLeft + (deltaX * i.railXRatio);
var maxLeft=Math.max(0, i.scrollbarXRail.getBoundingClientRect().left) + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth));
if(newLeft < 0){
i.scrollbarXLeft=0;
}else if(newLeft > maxLeft){
i.scrollbarXLeft=maxLeft;
}else{
i.scrollbarXLeft=newLeft;
}
var scrollLeft=h.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment;
updateScroll(element, 'left', scrollLeft);
}
var mouseMoveHandler=function (e){
updateScrollLeft(e.pageX - currentPageX);
updateGeometry(element);
e.stopPropagation();
e.preventDefault();
};
var mouseUpHandler=function (){
h.stopScrolling(element, 'x');
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
};
i.event.bind(i.scrollbarX, 'mousedown', function (e){
currentPageX=e.pageX;
currentLeft=h.toInt(d.css(i.scrollbarX, 'left')) * i.railXRatio;
h.startScrolling(element, 'x');
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
e.stopPropagation();
e.preventDefault();
});
}
function bindMouseScrollYHandler(element, i){
var currentTop=null;
var currentPageY=null;
function updateScrollTop(deltaY){
var newTop=currentTop + (deltaY * i.railYRatio);
var maxTop=Math.max(0, i.scrollbarYRail.getBoundingClientRect().top) + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight));
if(newTop < 0){
i.scrollbarYTop=0;
}else if(newTop > maxTop){
i.scrollbarYTop=maxTop;
}else{
i.scrollbarYTop=newTop;
}
var scrollTop=h.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight)));
updateScroll(element, 'top', scrollTop);
}
var mouseMoveHandler=function (e){
updateScrollTop(e.pageY - currentPageY);
updateGeometry(element);
e.stopPropagation();
e.preventDefault();
};
var mouseUpHandler=function (){
h.stopScrolling(element, 'y');
i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);
};
i.event.bind(i.scrollbarY, 'mousedown', function (e){
currentPageY=e.pageY;
currentTop=h.toInt(d.css(i.scrollbarY, 'top')) * i.railYRatio;
h.startScrolling(element, 'y');
i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);
i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);
e.stopPropagation();
e.preventDefault();
});
}
module.exports=function (element){
var i=instances.get(element);
bindMouseScrollXHandler(element, i);
bindMouseScrollYHandler(element, i);
};},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],12:[function(require,module,exports){
'use strict';
var h=require('../../lib/helper')
, d=require('../../lib/dom')
, instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindKeyboardHandler(element, i){
var hovered=false;
i.event.bind(element, 'mouseenter', function (){
hovered=true;
});
i.event.bind(element, 'mouseleave', function (){
hovered=false;
});
var shouldPrevent=false;
function shouldPreventDefault(deltaX, deltaY){
var scrollTop=element.scrollTop;
if(deltaX===0){
if(!i.scrollbarYActive){
return false;
}
if((scrollTop===0&&deltaY > 0)||(scrollTop >=i.contentHeight - i.containerHeight&&deltaY < 0)){
return !i.settings.wheelPropagation;
}}
var scrollLeft=element.scrollLeft;
if(deltaY===0){
if(!i.scrollbarXActive){
return false;
}
if((scrollLeft===0&&deltaX < 0)||(scrollLeft >=i.contentWidth - i.containerWidth&&deltaX > 0)){
return !i.settings.wheelPropagation;
}}
return true;
}
i.event.bind(i.ownerDocument, 'keydown', function (e){
if(e.isDefaultPrevented&&e.isDefaultPrevented()){
return;
}
var focused=d.matches(i.scrollbarX, ':focus') ||
d.matches(i.scrollbarY, ':focus');
if(!hovered&&!focused){
return;
}
var activeElement=document.activeElement ? document.activeElement:i.ownerDocument.activeElement;
if(activeElement){
while (activeElement.shadowRoot){
activeElement=activeElement.shadowRoot.activeElement;
}
if(h.isEditable(activeElement)){
return;
}}
var deltaX=0;
var deltaY=0;
switch (e.which){
case 37:
deltaX=-30;
break;
case 38:
deltaY=30;
break;
case 39:
deltaX=30;
break;
case 40:
deltaY=-30;
break;
case 33:
deltaY=90;
break;
case 32:
if(e.shiftKey){
deltaY=90;
}else{
deltaY=-90;
}
break;
case 34:
deltaY=-90;
break;
case 35:
if(e.ctrlKey){
deltaY=-i.contentHeight;
}else{
deltaY=-i.containerHeight;
}
break;
case 36:
if(e.ctrlKey){
deltaY=element.scrollTop;
}else{
deltaY=i.containerHeight;
}
break;
default:
return;
}
updateScroll(element, 'top', element.scrollTop - deltaY);
updateScroll(element, 'left', element.scrollLeft + deltaX);
updateGeometry(element);
shouldPrevent=shouldPreventDefault(deltaX, deltaY);
if(shouldPrevent){
e.preventDefault();
}});
}
module.exports=function (element){
var i=instances.get(element);
bindKeyboardHandler(element, i);
};},{"../../lib/dom":3,"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],13:[function(require,module,exports){
'use strict';
var instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindMouseWheelHandler(element, i){
var shouldPrevent=false;
function shouldPreventDefault(deltaX, deltaY){
var scrollTop=element.scrollTop;
if(deltaX===0){
if(!i.scrollbarYActive){
return false;
}
if((scrollTop===0&&deltaY > 0)||(scrollTop >=i.contentHeight - i.containerHeight&&deltaY < 0)){
return !i.settings.wheelPropagation;
}}
var scrollLeft=element.scrollLeft;
if(deltaY===0){
if(!i.scrollbarXActive){
return false;
}
if((scrollLeft===0&&deltaX < 0)||(scrollLeft >=i.contentWidth - i.containerWidth&&deltaX > 0)){
return !i.settings.wheelPropagation;
}}
return true;
}
function getDeltaFromEvent(e){
var deltaX=e.deltaX;
var deltaY=-1 * e.deltaY;
if(typeof deltaX==="undefined"||typeof deltaY==="undefined"){
deltaX=-1 * e.wheelDeltaX / 6;
deltaY=e.wheelDeltaY / 6;
}
if(e.deltaMode&&e.deltaMode===1){
deltaX *=10;
deltaY *=10;
}
if(deltaX!==deltaX&&deltaY!==deltaY){
deltaX=0;
deltaY=e.wheelDelta;
}
return [deltaX, deltaY];
}
function shouldBeConsumedByTextarea(deltaX, deltaY){
var hoveredTextarea=element.querySelector('textarea:hover');
if(hoveredTextarea){
var maxScrollTop=hoveredTextarea.scrollHeight - hoveredTextarea.clientHeight;
if(maxScrollTop > 0){
if(!(hoveredTextarea.scrollTop===0&&deltaY > 0) &&
!(hoveredTextarea.scrollTop===maxScrollTop&&deltaY < 0)){
return true;
}}
var maxScrollLeft=hoveredTextarea.scrollLeft - hoveredTextarea.clientWidth;
if(maxScrollLeft > 0){
if(!(hoveredTextarea.scrollLeft===0&&deltaX < 0) &&
!(hoveredTextarea.scrollLeft===maxScrollLeft&&deltaX > 0)){
return true;
}}
}
return false;
}
function mousewheelHandler(e){
var delta=getDeltaFromEvent(e);
var deltaX=delta[0];
var deltaY=delta[1];
if(shouldBeConsumedByTextarea(deltaX, deltaY)){
return;
}
shouldPrevent=false;
if(!i.settings.useBothWheelAxes){
updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));
updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));
}else if(i.scrollbarYActive&&!i.scrollbarXActive){
if(deltaY){
updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));
}else{
updateScroll(element, 'top', element.scrollTop + (deltaX * i.settings.wheelSpeed));
}
shouldPrevent=true;
}else if(i.scrollbarXActive&&!i.scrollbarYActive){
if(deltaX){
updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));
}else{
updateScroll(element, 'left', element.scrollLeft - (deltaY * i.settings.wheelSpeed));
}
shouldPrevent=true;
}
updateGeometry(element);
shouldPrevent=(shouldPrevent||shouldPreventDefault(deltaX, deltaY));
if(shouldPrevent){
e.stopPropagation();
e.preventDefault();
}}
if(typeof window.onwheel!=="undefined"){
i.event.bind(element, 'wheel', mousewheelHandler);
}else if(typeof window.onmousewheel!=="undefined"){
i.event.bind(element, 'mousewheel', mousewheelHandler);
}}
module.exports=function (element){
var i=instances.get(element);
bindMouseWheelHandler(element, i);
};},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],14:[function(require,module,exports){
'use strict';
var instances=require('../instances')
, updateGeometry=require('../update-geometry');
function bindNativeScrollHandler(element, i){
i.event.bind(element, 'scroll', function (){
updateGeometry(element);
});
}
module.exports=function (element){
var i=instances.get(element);
bindNativeScrollHandler(element, i);
};},{"../instances":18,"../update-geometry":19}],15:[function(require,module,exports){
'use strict';
var h=require('../../lib/helper')
, instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindSelectionHandler(element, i){
function getRangeNode(){
var selection=window.getSelection ? window.getSelection() :
document.getSelection ? document.getSelection():'';
if(selection.toString().length===0){
return null;
}else{
return selection.getRangeAt(0).commonAncestorContainer;
}}
var scrollingLoop=null;
var scrollDiff={top: 0, left: 0};
function startScrolling(){
if(!scrollingLoop){
scrollingLoop=setInterval(function (){
if(!instances.get(element)){
clearInterval(scrollingLoop);
return;
}
updateScroll(element, 'top', element.scrollTop + scrollDiff.top);
updateScroll(element, 'left', element.scrollLeft + scrollDiff.left);
updateGeometry(element);
}, 50);
}}
function stopScrolling(){
if(scrollingLoop){
clearInterval(scrollingLoop);
scrollingLoop=null;
}
h.stopScrolling(element);
}
var isSelected=false;
i.event.bind(i.ownerDocument, 'selectionchange', function (){
if(element.contains(getRangeNode())){
isSelected=true;
}else{
isSelected=false;
stopScrolling();
}});
i.event.bind(window, 'mouseup', function (){
if(isSelected){
isSelected=false;
stopScrolling();
}});
i.event.bind(window, 'mousemove', function (e){
if(isSelected){
var mousePosition={x: e.pageX, y: e.pageY};
var containerGeometry={
left: element.offsetLeft,
right: element.offsetLeft + element.offsetWidth,
top: element.offsetTop,
bottom: element.offsetTop + element.offsetHeight
};
if(mousePosition.x < containerGeometry.left + 3){
scrollDiff.left=-5;
h.startScrolling(element, 'x');
}else if(mousePosition.x > containerGeometry.right - 3){
scrollDiff.left=5;
h.startScrolling(element, 'x');
}else{
scrollDiff.left=0;
}
if(mousePosition.y < containerGeometry.top + 3){
if(containerGeometry.top + 3 - mousePosition.y < 5){
scrollDiff.top=-5;
}else{
scrollDiff.top=-20;
}
h.startScrolling(element, 'y');
}else if(mousePosition.y > containerGeometry.bottom - 3){
if(mousePosition.y - containerGeometry.bottom + 3 < 5){
scrollDiff.top=5;
}else{
scrollDiff.top=20;
}
h.startScrolling(element, 'y');
}else{
scrollDiff.top=0;
}
if(scrollDiff.top===0&&scrollDiff.left===0){
stopScrolling();
}else{
startScrolling();
}}
});
}
module.exports=function (element){
var i=instances.get(element);
bindSelectionHandler(element, i);
};},{"../../lib/helper":6,"../instances":18,"../update-geometry":19,"../update-scroll":20}],16:[function(require,module,exports){
'use strict';
var instances=require('../instances')
, updateGeometry=require('../update-geometry')
, updateScroll=require('../update-scroll');
function bindTouchHandler(element, i, supportsTouch, supportsIePointer){
function shouldPreventDefault(deltaX, deltaY){
var scrollTop=element.scrollTop;
var scrollLeft=element.scrollLeft;
var magnitudeX=Math.abs(deltaX);
var magnitudeY=Math.abs(deltaY);
if(magnitudeY > magnitudeX){
if(((deltaY < 0)&&(scrollTop===i.contentHeight - i.containerHeight)) ||
((deltaY > 0)&&(scrollTop===0))){
return !i.settings.swipePropagation;
}}else if(magnitudeX > magnitudeY){
if(((deltaX < 0)&&(scrollLeft===i.contentWidth - i.containerWidth)) ||
((deltaX > 0)&&(scrollLeft===0))){
return !i.settings.swipePropagation;
}}
return true;
}
function applyTouchMove(differenceX, differenceY){
updateScroll(element, 'top', element.scrollTop - differenceY);
updateScroll(element, 'left', element.scrollLeft - differenceX);
updateGeometry(element);
}
var startOffset={};
var startTime=0;
var speed={};
var easingLoop=null;
var inGlobalTouch=false;
var inLocalTouch=false;
function globalTouchStart(){
inGlobalTouch=true;
}
function globalTouchEnd(){
inGlobalTouch=false;
}
function getTouch(e){
if(e.targetTouches){
return e.targetTouches[0];
}else{
return e;
}}
function shouldHandle(e){
if(e.targetTouches&&e.targetTouches.length===1){
return true;
}
if(e.pointerType&&e.pointerType!=='mouse'&&e.pointerType!==e.MSPOINTER_TYPE_MOUSE){
return true;
}
return false;
}
function touchStart(e){
if(shouldHandle(e)){
inLocalTouch=true;
var touch=getTouch(e);
startOffset.pageX=touch.pageX;
startOffset.pageY=touch.pageY;
startTime=(new Date()).getTime();
if(easingLoop!==null){
clearInterval(easingLoop);
}
e.stopPropagation();
}}
function touchMove(e){
if(!inGlobalTouch&&inLocalTouch&&shouldHandle(e)){
var touch=getTouch(e);
var currentOffset={pageX: touch.pageX, pageY: touch.pageY};
var differenceX=currentOffset.pageX - startOffset.pageX;
var differenceY=currentOffset.pageY - startOffset.pageY;
applyTouchMove(differenceX, differenceY);
startOffset=currentOffset;
var currentTime=(new Date()).getTime();
var timeGap=currentTime - startTime;
if(timeGap > 0){
speed.x=differenceX / timeGap;
speed.y=differenceY / timeGap;
startTime=currentTime;
}
if(shouldPreventDefault(differenceX, differenceY)){
e.stopPropagation();
e.preventDefault();
}}
}
function touchEnd(){
if(!inGlobalTouch&&inLocalTouch){
inLocalTouch=false;
clearInterval(easingLoop);
easingLoop=setInterval(function (){
if(!instances.get(element)){
clearInterval(easingLoop);
return;
}
if(Math.abs(speed.x) < 0.01&&Math.abs(speed.y) < 0.01){
clearInterval(easingLoop);
return;
}
applyTouchMove(speed.x * 30, speed.y * 30);
speed.x *=0.8;
speed.y *=0.8;
}, 10);
}}
if(supportsTouch){
i.event.bind(window, 'touchstart', globalTouchStart);
i.event.bind(window, 'touchend', globalTouchEnd);
i.event.bind(element, 'touchstart', touchStart);
i.event.bind(element, 'touchmove', touchMove);
i.event.bind(element, 'touchend', touchEnd);
}
if(supportsIePointer){
if(window.PointerEvent){
i.event.bind(window, 'pointerdown', globalTouchStart);
i.event.bind(window, 'pointerup', globalTouchEnd);
i.event.bind(element, 'pointerdown', touchStart);
i.event.bind(element, 'pointermove', touchMove);
i.event.bind(element, 'pointerup', touchEnd);
}else if(window.MSPointerEvent){
i.event.bind(window, 'MSPointerDown', globalTouchStart);
i.event.bind(window, 'MSPointerUp', globalTouchEnd);
i.event.bind(element, 'MSPointerDown', touchStart);
i.event.bind(element, 'MSPointerMove', touchMove);
i.event.bind(element, 'MSPointerUp', touchEnd);
}}
}
module.exports=function (element, supportsTouch, supportsIePointer){
var i=instances.get(element);
bindTouchHandler(element, i, supportsTouch, supportsIePointer);
};},{"../instances":18,"../update-geometry":19,"../update-scroll":20}],17:[function(require,module,exports){
'use strict';
var cls=require('../lib/class')
, h=require('../lib/helper')
, instances=require('./instances')
, updateGeometry=require('./update-geometry');
var clickRailHandler=require('./handler/click-rail')
, dragScrollbarHandler=require('./handler/drag-scrollbar')
, keyboardHandler=require('./handler/keyboard')
, mouseWheelHandler=require('./handler/mouse-wheel')
, nativeScrollHandler=require('./handler/native-scroll')
, selectionHandler=require('./handler/selection')
, touchHandler=require('./handler/touch');
module.exports=function (element, userSettings){
userSettings=typeof userSettings==='object' ? userSettings:{};
cls.add(element, 'ps-container');
var i=instances.add(element);
i.settings=h.extend(i.settings, userSettings);
cls.add(element, 'ps-theme-' + i.settings.theme);
clickRailHandler(element);
dragScrollbarHandler(element);
mouseWheelHandler(element);
nativeScrollHandler(element);
if(i.settings.useSelectionScroll){
selectionHandler(element);
}
if(h.env.supportsTouch||h.env.supportsIePointer){
touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer);
}
if(i.settings.useKeyboard){
keyboardHandler(element);
}
updateGeometry(element);
};},{"../lib/class":2,"../lib/helper":6,"./handler/click-rail":10,"./handler/drag-scrollbar":11,"./handler/keyboard":12,"./handler/mouse-wheel":13,"./handler/native-scroll":14,"./handler/selection":15,"./handler/touch":16,"./instances":18,"./update-geometry":19}],18:[function(require,module,exports){
'use strict';
var cls=require('../lib/class')
, d=require('../lib/dom')
, defaultSettings=require('./default-setting')
, EventManager=require('../lib/event-manager')
, guid=require('../lib/guid')
, h=require('../lib/helper');
var instances={};
function Instance(element){
var i=this;
i.settings=h.clone(defaultSettings);
i.containerWidth=null;
i.containerHeight=null;
i.contentWidth=null;
i.contentHeight=null;
i.isRtl=d.css(element, 'direction')==="rtl";
i.isNegativeScroll=(function (){
var originalScrollLeft=element.scrollLeft;
var result=null;
element.scrollLeft=-1;
result=element.scrollLeft < 0;
element.scrollLeft=originalScrollLeft;
return result;
})();
i.negativeScrollAdjustment=i.isNegativeScroll ? element.scrollWidth - element.clientWidth:0;
i.event=new EventManager();
i.ownerDocument=element.ownerDocument||document;
function focus(){
cls.add(element, 'ps-focus');
}
function blur(){
cls.remove(element, 'ps-focus');
}
i.scrollbarXRail=d.appendTo(d.e('div', 'ps-scrollbar-x-rail'), element);
i.scrollbarX=d.appendTo(d.e('div', 'ps-scrollbar-x'), i.scrollbarXRail);
i.scrollbarX.setAttribute('tabindex', 0);
i.event.bind(i.scrollbarX, 'focus', focus);
i.event.bind(i.scrollbarX, 'blur', blur);
i.scrollbarXActive=null;
i.scrollbarXWidth=null;
i.scrollbarXLeft=null;
i.scrollbarXBottom=h.toInt(d.css(i.scrollbarXRail, 'bottom'));
i.isScrollbarXUsingBottom=i.scrollbarXBottom===i.scrollbarXBottom;
i.scrollbarXTop=i.isScrollbarXUsingBottom ? null:h.toInt(d.css(i.scrollbarXRail, 'top'));
i.railBorderXWidth=h.toInt(d.css(i.scrollbarXRail, 'borderLeftWidth')) + h.toInt(d.css(i.scrollbarXRail, 'borderRightWidth'));
d.css(i.scrollbarXRail, 'display', 'block');
i.railXMarginWidth=h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight'));
d.css(i.scrollbarXRail, 'display', '');
i.railXWidth=null;
i.railXRatio=null;
i.scrollbarYRail=d.appendTo(d.e('div', 'ps-scrollbar-y-rail'), element);
i.scrollbarY=d.appendTo(d.e('div', 'ps-scrollbar-y'), i.scrollbarYRail);
i.scrollbarY.setAttribute('tabindex', 0);
i.event.bind(i.scrollbarY, 'focus', focus);
i.event.bind(i.scrollbarY, 'blur', blur);
i.scrollbarYActive=null;
i.scrollbarYHeight=null;
i.scrollbarYTop=null;
i.scrollbarYRight=h.toInt(d.css(i.scrollbarYRail, 'right'));
i.isScrollbarYUsingRight=i.scrollbarYRight===i.scrollbarYRight;
i.scrollbarYLeft=i.isScrollbarYUsingRight ? null:h.toInt(d.css(i.scrollbarYRail, 'left'));
i.scrollbarYOuterWidth=i.isRtl ? h.outerWidth(i.scrollbarY):null;
i.railBorderYWidth=h.toInt(d.css(i.scrollbarYRail, 'borderTopWidth')) + h.toInt(d.css(i.scrollbarYRail, 'borderBottomWidth'));
d.css(i.scrollbarYRail, 'display', 'block');
i.railYMarginHeight=h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom'));
d.css(i.scrollbarYRail, 'display', '');
i.railYHeight=null;
i.railYRatio=null;
}
function getId(element){
if(typeof element.dataset==='undefined'){
return element.getAttribute('data-ps-id');
}else{
return element.dataset.psId;
}}
function setId(element, id){
if(typeof element.dataset==='undefined'){
element.setAttribute('data-ps-id', id);
}else{
element.dataset.psId=id;
}}
function removeId(element){
if(typeof element.dataset==='undefined'){
element.removeAttribute('data-ps-id');
}else{
delete element.dataset.psId;
}}
exports.add=function (element){
var newId=guid();
setId(element, newId);
instances[newId]=new Instance(element);
return instances[newId];
};
exports.remove=function (element){
delete instances[getId(element)];
removeId(element);
};
exports.get=function (element){
return instances[getId(element)];
};},{"../lib/class":2,"../lib/dom":3,"../lib/event-manager":4,"../lib/guid":5,"../lib/helper":6,"./default-setting":8}],19:[function(require,module,exports){
'use strict';
var cls=require('../lib/class')
, d=require('../lib/dom')
, h=require('../lib/helper')
, instances=require('./instances')
, updateScroll=require('./update-scroll');
function getThumbSize(i, thumbSize){
if(i.settings.minScrollbarLength){
thumbSize=Math.max(thumbSize, i.settings.minScrollbarLength);
}
if(i.settings.maxScrollbarLength){
thumbSize=Math.min(thumbSize, i.settings.maxScrollbarLength);
}
return thumbSize;
}
function updateCss(element, i){
var xRailOffset={width: i.railXWidth};
if(i.isRtl){
xRailOffset.left=i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth - i.contentWidth;
}else{
xRailOffset.left=element.scrollLeft;
}
if(i.isScrollbarXUsingBottom){
xRailOffset.bottom=i.scrollbarXBottom - element.scrollTop;
}else{
xRailOffset.top=i.scrollbarXTop + element.scrollTop;
}
d.css(i.scrollbarXRail, xRailOffset);
var yRailOffset={top: element.scrollTop, height: i.railYHeight};
if(i.isScrollbarYUsingRight){
if(i.isRtl){
yRailOffset.right=i.contentWidth - (i.negativeScrollAdjustment + element.scrollLeft) - i.scrollbarYRight - i.scrollbarYOuterWidth;
}else{
yRailOffset.right=i.scrollbarYRight - element.scrollLeft;
}}else{
if(i.isRtl){
yRailOffset.left=i.negativeScrollAdjustment + element.scrollLeft + i.containerWidth * 2 - i.contentWidth - i.scrollbarYLeft - i.scrollbarYOuterWidth;
}else{
yRailOffset.left=i.scrollbarYLeft + element.scrollLeft;
}}
d.css(i.scrollbarYRail, yRailOffset);
d.css(i.scrollbarX, {left: i.scrollbarXLeft, width: i.scrollbarXWidth - i.railBorderXWidth});
d.css(i.scrollbarY, {top: i.scrollbarYTop, height: i.scrollbarYHeight - i.railBorderYWidth});
}
module.exports=function (element){
var i=instances.get(element);
i.containerWidth=element.clientWidth;
i.containerHeight=element.clientHeight;
i.contentWidth=element.scrollWidth;
i.contentHeight=element.scrollHeight;
var existingRails;
if(!element.contains(i.scrollbarXRail)){
existingRails=d.queryChildren(element, '.ps-scrollbar-x-rail');
if(existingRails.length > 0){
existingRails.forEach(function (rail){
d.remove(rail);
});
}
d.appendTo(i.scrollbarXRail, element);
}
if(!element.contains(i.scrollbarYRail)){
existingRails=d.queryChildren(element, '.ps-scrollbar-y-rail');
if(existingRails.length > 0){
existingRails.forEach(function (rail){
d.remove(rail);
});
}
d.appendTo(i.scrollbarYRail, element);
}
if(!i.settings.suppressScrollX&&i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth){
i.scrollbarXActive=true;
i.railXWidth=i.containerWidth - i.railXMarginWidth;
i.railXRatio=i.containerWidth / i.railXWidth;
i.scrollbarXWidth=getThumbSize(i, h.toInt(i.railXWidth * i.containerWidth / i.contentWidth));
i.scrollbarXLeft=h.toInt((i.negativeScrollAdjustment + element.scrollLeft) * (i.railXWidth - i.scrollbarXWidth) / (i.contentWidth - i.containerWidth));
}else{
i.scrollbarXActive=false;
}
if(!i.settings.suppressScrollY&&i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight){
i.scrollbarYActive=true;
i.railYHeight=i.containerHeight - i.railYMarginHeight;
i.railYRatio=i.containerHeight / i.railYHeight;
i.scrollbarYHeight=getThumbSize(i, h.toInt(i.railYHeight * i.containerHeight / i.contentHeight));
i.scrollbarYTop=h.toInt(element.scrollTop * (i.railYHeight - i.scrollbarYHeight) / (i.contentHeight - i.containerHeight));
}else{
i.scrollbarYActive=false;
}
if(i.scrollbarXLeft >=i.railXWidth - i.scrollbarXWidth){
i.scrollbarXLeft=i.railXWidth - i.scrollbarXWidth;
}
if(i.scrollbarYTop >=i.railYHeight - i.scrollbarYHeight){
i.scrollbarYTop=i.railYHeight - i.scrollbarYHeight;
}
updateCss(element, i);
if(i.scrollbarXActive){
cls.add(element, 'ps-active-x');
}else{
cls.remove(element, 'ps-active-x');
i.scrollbarXWidth=0;
i.scrollbarXLeft=0;
updateScroll(element, 'left', 0);
}
if(i.scrollbarYActive){
cls.add(element, 'ps-active-y');
}else{
cls.remove(element, 'ps-active-y');
i.scrollbarYHeight=0;
i.scrollbarYTop=0;
updateScroll(element, 'top', 0);
}};},{"../lib/class":2,"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-scroll":20}],20:[function(require,module,exports){
'use strict';
var instances=require('./instances');
var upEvent=document.createEvent('Event')
, downEvent=document.createEvent('Event')
, leftEvent=document.createEvent('Event')
, rightEvent=document.createEvent('Event')
, yEvent=document.createEvent('Event')
, xEvent=document.createEvent('Event')
, xStartEvent=document.createEvent('Event')
, xEndEvent=document.createEvent('Event')
, yStartEvent=document.createEvent('Event')
, yEndEvent=document.createEvent('Event')
, lastTop
, lastLeft;
upEvent.initEvent('ps-scroll-up', true, true);
downEvent.initEvent('ps-scroll-down', true, true);
leftEvent.initEvent('ps-scroll-left', true, true);
rightEvent.initEvent('ps-scroll-right', true, true);
yEvent.initEvent('ps-scroll-y', true, true);
xEvent.initEvent('ps-scroll-x', true, true);
xStartEvent.initEvent('ps-x-reach-start', true, true);
xEndEvent.initEvent('ps-x-reach-end', true, true);
yStartEvent.initEvent('ps-y-reach-start', true, true);
yEndEvent.initEvent('ps-y-reach-end', true, true);
module.exports=function (element, axis, value){
if(typeof element==='undefined'){
throw 'You must provide an element to the update-scroll function';
}
if(typeof axis==='undefined'){
throw 'You must provide an axis to the update-scroll function';
}
if(typeof value==='undefined'){
throw 'You must provide a value to the update-scroll function';
}
if(axis==='top'&&value <=0){
element.scrollTop=value=0;
element.dispatchEvent(yStartEvent);
}
if(axis==='left'&&value <=0){
element.scrollLeft=value=0;
element.dispatchEvent(xStartEvent);
}
var i=instances.get(element);
if(axis==='top'&&value >=i.contentHeight - i.containerHeight){
element.scrollTop=value=i.contentHeight - i.containerHeight;
element.dispatchEvent(yEndEvent);
}
if(axis==='left'&&value >=i.contentWidth - i.containerWidth){
element.scrollLeft=value=i.contentWidth - i.containerWidth;
element.dispatchEvent(xEndEvent);
}
if(!lastTop){
lastTop=element.scrollTop;
}
if(!lastLeft){
lastLeft=element.scrollLeft;
}
if(axis==='top'&&value < lastTop){
element.dispatchEvent(upEvent);
}
if(axis==='top'&&value > lastTop){
element.dispatchEvent(downEvent);
}
if(axis==='left'&&value < lastLeft){
element.dispatchEvent(leftEvent);
}
if(axis==='left'&&value > lastLeft){
element.dispatchEvent(rightEvent);
}
if(axis==='top'){
element.scrollTop=lastTop=value;
element.dispatchEvent(yEvent);
}
if(axis==='left'){
element.scrollLeft=lastLeft=value;
element.dispatchEvent(xEvent);
}};},{"./instances":18}],21:[function(require,module,exports){
'use strict';
var d=require('../lib/dom')
, h=require('../lib/helper')
, instances=require('./instances')
, updateGeometry=require('./update-geometry')
, updateScroll=require('./update-scroll');
module.exports=function (element){
var i=instances.get(element);
if(!i){
return;
}
i.negativeScrollAdjustment=i.isNegativeScroll ? element.scrollWidth - element.clientWidth:0;
d.css(i.scrollbarXRail, 'display', 'block');
d.css(i.scrollbarYRail, 'display', 'block');
i.railXMarginWidth=h.toInt(d.css(i.scrollbarXRail, 'marginLeft')) + h.toInt(d.css(i.scrollbarXRail, 'marginRight'));
i.railYMarginHeight=h.toInt(d.css(i.scrollbarYRail, 'marginTop')) + h.toInt(d.css(i.scrollbarYRail, 'marginBottom'));
d.css(i.scrollbarXRail, 'display', 'none');
d.css(i.scrollbarYRail, 'display', 'none');
updateGeometry(element);
updateScroll(element, 'top', element.scrollTop);
updateScroll(element, 'left', element.scrollLeft);
d.css(i.scrollbarXRail, 'display', '');
d.css(i.scrollbarYRail, 'display', '');
};},{"../lib/dom":3,"../lib/helper":6,"./instances":18,"./update-geometry":19,"./update-scroll":20}]},{},[1]);
(function ($){
"use strict";
if(!$.wjbExtensions)
$.wjbExtensions={};
function WJBMainCore(){
var self=this;
self.init();
};
WJBMainCore.prototype={
init: function(){
var self=this;
self.sendMessage();
self.replyMessage();
self.chooseMessage();
self.searchMessage();
self.messageLoadmore();
self.repliedLoadmore();
self.deleteMessage();
$('.list-message-inner').perfectScrollbar();
$('.list-replies-inner').perfectScrollbar();
$(".list-replies-inner").scrollTop($(".list-replies-inner").prop("scrollHeight") );
$(".list-replies-inner").perfectScrollbar('update');
$(document).on('click', '.toggle-message-btn', function(){
$('.list-message-wrapper').slideToggle();
});
self.loadExtension();
},
loadExtension: function(){
var self=this;
if($.wjbExtensions.ajax_upload){
$.wjbExtensions.ajax_upload.call(self);
}},
sendMessage: function(){
var self=this;
$(document).on('submit', 'form.send-message-form', function(e){
e.preventDefault();
var form_id=$(this).attr('id');
var $this=$(this);
$this.find('.alert').remove();
$this.find('.send-message-btn').addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.find('.send-message-btn').removeClass('loading');
if(data.status){
$this.prepend('<div class="alert alert-info">'+data.msg+'</div>');
$this.find('textarea[name=subject]').val('');
$this.find('textarea[name=message]').val('');
}else{
$this.prepend('<div class="alert alert-warning">'+data.msg+'</div>');
}});
return false;
});
},
replyMessage: function(){
var self=this;
$(document).on('submit', 'form.reply-message-form', function(e){
e.preventDefault();
var form_id=$(this).attr('id');
var $this=$(this);
$this.find('.alert').remove();
$this.find('.reply-message-btn').addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.find('.reply-message-btn').removeClass('loading');
if(data.status){
$this.closest('.replies-content').find('.list-replies').append(data.msg);
$this.find('textarea[name=message]').val('');
$(".list-replies-inner").scrollTop($(".list-replies-inner").prop("scrollHeight") );
$(".list-replies-inner").perfectScrollbar('update');
}else{
self.showMessage(data.msg, data.status);
}});
return false;
});
},
chooseMessage: function(){
var self=this;
$(document).on('click', 'a.message-item', function(e){
e.preventDefault();
var $this=$(this);
var parent=$(this).parent();
if(parent.hasClass('active')){
return;
}
$('ul.list-message li').removeClass('active');
parent.addClass('active').addClass('read').removeClass('unread');
$this.closest('.message-section-wrapper').find('.replies-content').addClass('loading');
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: {
'message_id': $(this).data('id'),
'action': 'wp_private_message_choose_message',
'nonce': $(this).data('nonce')
}}).done(function(data){
$this.closest('.message-section-wrapper').find('.replies-content').removeClass('loading');
if(data.status){
$this.closest('.message-section-wrapper').find('.replies-content').html(data.msg);
var $inner=$this.closest('.message-section-wrapper').find(".list-replies-inner");
$inner.perfectScrollbar();
$inner.scrollTop($inner.prop("scrollHeight") );
$inner.perfectScrollbar('update');
}else{
self.showMessage(data.msg, data.status);
}});
return false;
});
},
searchMessage: function(){
var self=this;
$(document).on('submit', 'form.search-message-form', function(e){
e.preventDefault();
var $this=$(this);
var form_id=$this.attr('id');
$this.closest('.list-message-wrapper').addClass('loading');
var form_data=new FormData($('#' + form_id)[0]);
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: form_data,
processData: false,
contentType: false,
}).done(function(data){
$this.closest('.list-message-wrapper').removeClass('loading');
if(data.status){
$this.closest('.list-message-wrapper').find('ul.list-message').html(data.output);
$this.closest('.list-message-wrapper').find('.loadmore-action').remove();
if(data.next_page){
$this.closest('.list-message-wrapper').find('.list-message-inner').append(data.next_page);
}
var $inner=$this.closest('.list-message-wrapper').find('.list-message-inner');
$inner.perfectScrollbar();
}else{
self.showMessage(data.msg, data.status);
}});
return false;
});
$(document).on('change', 'input[name=search_read]', function(){
$('form.search-message-form').trigger('submit');
});
},
messageLoadmore: function(){
var self=this;
$(document).on('click', '.loadmore-message-btn', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
var search='';
if($('form.search-message-form').length > 0){
search=$('form.search-message-form').find('input[name=search]').val();
}
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: {
'paged': $this.data('paged'),
'action': 'wp_private_message_message_loadmore',
'search': search,
},
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.list-message-inner').find('.list-message').append(data.output);
if(data.next_page > 0){
$this.attr('data-paged', data.next_page);
}else{
$this.remove();
}}
});
return false;
});
},
repliedLoadmore: function(){
var self=this;
$(document).on('click', '.loadmore-replied-btn', function(e){
e.preventDefault();
var $this=$(this);
$this.addClass('loading');
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: {
'paged': $this.attr('data-paged'),
'action': 'wp_private_message_replied_loadmore',
'parent': $this.data('parent'),
},
}).done(function(data){
$this.removeClass('loading');
if(data.status){
$this.closest('.list-replies-inner').find('.list-replies').prepend(data.output);
if(data.next_page > 0){
$this.attr('data-paged', data.next_page);
}else{
$this.remove();
}}
});
return false;
});
},
deleteMessage: function(){
var self=this;
$(document).on('click', 'a.delete-message-btn', function(e){
e.preventDefault();
var $this=$(this);
var message_id=$this.data('id');
$this.closest('.replies-content').addClass('loading');
$.ajax({
url: wp_private_message_opts.ajaxurl,
type:'POST',
dataType: 'json',
data: {
'message_id': message_id,
'action': 'wp_private_message_delete_message',
'nonce': $this.data('nonce')
}}).done(function(data){
$this.closest('.replies-content').removeClass('loading');
if(data.status){
$this.closest('.message-section-wrapper').find('#message-id-' + message_id).remove();
$this.closest('.replies-content').html('');
}
self.showMessage(data.msg, data.status);
});
return false;
});
},
showMessage: function(msg, status){
console.log(msg);
if(msg){
var classes='alert bg-warning';
if(status){
classes='alert bg-info';
}
var $html='<div id="wp-private-message-popup-message" class="animated fadeInRight"><div class="message-inner '+ classes +'">'+ msg +'</div></div>';
$('body').find('#wp-private-message-popup-message').remove();
$('body').append($html).fadeIn(500);
setTimeout(function(){
$('body').find('#wp-private-message-popup-message').removeClass('fadeInRight').addClass('delay-2s fadeOutRight');
}, 2500);
}}
}
$.wjbMainCore=WJBMainCore.prototype;
$(document).ready(function(){
new WJBMainCore();
});
})(jQuery);
(function($){
"use strict";
$.extend($.apusThemeCore, {
woo_init: function(){
var self=this;
self.productDetail();
$('body').on('found_variation', function(event, variation){
self.variationsImageUpdate(variation);
});
$('body').on('reset_image', function(event, variation){
self.variationsImageUpdate(variation);
});
$('body').on('hover', '.apus-topcart .cart_list', function(){
$(this).perfectScrollbar();
});
},
productDetail: function(){
$('.woocommerce-review-link').on('click', function(){
$('.woocommerce-tabs a[href="#tabs-list-reviews"]').trigger('click');
$('html, body').animate({
scrollTop: $("#reviews").offset().top
}, 1000);
return false;
});
},
variationsImageUpdate: function(variation){
var $form=$('.variations_form'),
$product=$form.closest('.product'),
$product_gallery=$product.find('.apus-woocommerce-product-gallery-wrapper'),
$gallery_img=$product.find('.apus-woocommerce-product-gallery-thumbs img:eq(0)'),
$product_img_wrap=$product_gallery.find('.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder').eq(0),
$product_img=$product_img_wrap.find('.wp-post-image'),
$product_link=$product_img_wrap.find('a').eq(0);
if(variation&&variation.image&&variation.image.src&&variation.image.src.length > 1){
if($('.apus-woocommerce-product-gallery-thumbs img[src="' + variation.image.thumb_src + '"]').length > 0){
$('.apus-woocommerce-product-gallery-thumbs img[src="' + variation.image.thumb_src + '"]').trigger('click');
$form.attr('current-image', variation.image_id);
return;
}else{
$product_img.wc_set_variation_attr('src', variation.image.src);
$product_img.wc_set_variation_attr('height', variation.image.src_h);
$product_img.wc_set_variation_attr('width', variation.image.src_w);
$product_img.wc_set_variation_attr('srcset', variation.image.srcset);
$product_img.wc_set_variation_attr('sizes', variation.image.sizes);
$product_img.wc_set_variation_attr('title', variation.image.title);
$product_img.wc_set_variation_attr('alt', variation.image.alt);
$product_img.wc_set_variation_attr('data-src', variation.image.full_src);
$product_img.wc_set_variation_attr('data-large_image', variation.image.full_src);
$product_img.wc_set_variation_attr('data-large_image_width', variation.image.full_src_w);
$product_img.wc_set_variation_attr('data-large_image_height', variation.image.full_src_h);
$product_img_wrap.wc_set_variation_attr('data-thumb', variation.image.src);
$gallery_img.wc_set_variation_attr('src', variation.image.thumb_src);
$gallery_img.wc_set_variation_attr('srcset', variation.image.thumb_srcset);
$product_link.wc_set_variation_attr('href', variation.image.full_src);
$gallery_img.removeAttr('srcset');
$('.apus-woocommerce-product-gallery').slick('slickGoTo', 0);
}}else{
$product_img.wc_reset_variation_attr('src');
$product_img.wc_reset_variation_attr('width');
$product_img.wc_reset_variation_attr('height');
$product_img.wc_reset_variation_attr('srcset');
$product_img.wc_reset_variation_attr('sizes');
$product_img.wc_reset_variation_attr('title');
$product_img.wc_reset_variation_attr('alt');
$product_img.wc_reset_variation_attr('data-src');
$product_img.wc_reset_variation_attr('data-large_image');
$product_img.wc_reset_variation_attr('data-large_image_width');
$product_img.wc_reset_variation_attr('data-large_image_height');
$product_img_wrap.wc_reset_variation_attr('data-thumb');
$gallery_img.wc_reset_variation_attr('src');
$product_link.wc_reset_variation_attr('href');
}
window.setTimeout(function(){
$(window).trigger('resize');
$form.wc_maybe_trigger_slide_position_reset(variation);
$product_gallery.trigger('woocommerce_gallery_init_zoom');
}, 20);
}});
$.apusThemeExtensions.shop=$.apusThemeCore.woo_init;
var ApusProductGallery=function($target, args){
var self=this;
this.$target=$target;
this.$images=$('.woocommerce-product-gallery__image', $target);
if(0===this.$images.length){
this.$target.css('opacity', 1);
return;
}
$target.data('product_gallery', this);
this.zoom_enabled=$.isFunction($.fn.zoom)&&wc_single_product_params.zoom_enabled;
this.photoswipe_enabled=typeof PhotoSwipe!=='undefined'&&wc_single_product_params.photoswipe_enabled;
if(args){
this.zoom_enabled=false===args.zoom_enabled ? false:this.zoom_enabled;
this.photoswipe_enabled=false===args.photoswipe_enabled ? false:this.photoswipe_enabled;
}
this.initZoom=this.initZoom.bind(this);
this.initZoomForTarget=this.initZoomForTarget.bind(this);
this.initPhotoswipe=this.initPhotoswipe.bind(this);
this.getGalleryItems=this.getGalleryItems.bind(this);
this.openPhotoswipe=this.openPhotoswipe.bind(this);
this.$target.css('opacity', 1);
if(this.zoom_enabled){
this.initZoom();
$target.on('woocommerce_gallery_init_zoom', this.initZoom);
}
if(this.photoswipe_enabled){
this.initPhotoswipe();
}
$('.apus-woocommerce-product-gallery').on('beforeChange', function(event, slick, currentSlide, nextSlide){
self.initZoomForTarget(self.$images.eq(nextSlide));
});
};
ApusProductGallery.prototype.initZoom=function(){
this.initZoomForTarget(this.$images.first());
};
ApusProductGallery.prototype.initZoomForTarget=function(zoomTarget){
if(! this.zoom_enabled){
return false;
}
var galleryWidth=this.$target.width(),
zoomEnabled=false;
$(zoomTarget).each(function(index, target){
var image=$(target).find('img');
if(image.data('large_image_width') > galleryWidth){
zoomEnabled=true;
return false;
}});
if(zoomEnabled){
var zoom_options={
touch: false
};
if('ontouchstart' in window){
zoom_options.on='click';
}
zoomTarget.trigger('zoom.destroy');
zoomTarget.zoom(zoom_options);
}};
ApusProductGallery.prototype.initPhotoswipe=function(){
if(this.zoom_enabled&&this.$images.length > 0){
this.$target.prepend('<a href="#" class="woocommerce-product-gallery__trigger"><i class="fa fa-search-plus" aria-hidden="true"></i></a>');
this.$target.on('click', '.woocommerce-product-gallery__trigger', this.openPhotoswipe);
}};
ApusProductGallery.prototype.getGalleryItems=function(){
var $slides=this.$images,
items=[];
if($slides.length > 0){
$slides.each(function(i, el){
var img=$(el).find('img'),
large_image_src=img.attr('data-large_image'),
large_image_w=img.attr('data-large_image_width'),
large_image_h=img.attr('data-large_image_height'),
item={
src:large_image_src,
w:large_image_w,
h:large_image_h,
title: img.attr('data-caption') ? img.attr('data-caption'):img.attr('title')
};
items.push(item);
});
}
return items;
};
ApusProductGallery.prototype.openPhotoswipe=function(e){
e.preventDefault();
var pswpElement=$('.pswp')[0],
items=this.getGalleryItems(),
eventTarget=$(e.target),
clicked;
if(this.$target.find('.woocommerce-product-gallery__image.slick-current').length > 0){
clicked=this.$target.find('.woocommerce-product-gallery__image.slick-current');
}else{
clicked=eventTarget.closest('.woocommerce-product-gallery__image');
}
var options=$.extend({
index: $(clicked).index()
}, wc_single_product_params.photoswipe_options);
var photoswipe=new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
photoswipe.init();
};
$.fn.apus_wc_product_gallery=function(args){
new ApusProductGallery(this, args);
return this;
};
$('.apus-woocommerce-product-gallery-wrapper').each(function(){
$(this).apus_wc_product_gallery();
});
})(jQuery);
jQuery.fn.highlight=function(pat){
function innerHighlight(node, pat){
var skip=0;
if(node.nodeType==3){
var pos=node.data.toUpperCase().indexOf(pat);
pos -=(node.data.substr(0, pos).toUpperCase().length - node.data.substr(0, pos).length);
if(pos >=0){
var spannode=document.createElement('span');
spannode.className='highlight';
var middlebit=node.splitText(pos);
var endbit=middlebit.splitText(pat.length);
var middleclone=middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip=1;
}}
else if(node.nodeType==1&&node.childNodes&&!/(script|style)/i.test(node.tagName)){
for (var i=0; i < node.childNodes.length; ++i){
i +=innerHighlight(node.childNodes[i], pat);
}}
return skip;
}
return this.length&&pat&&pat.length ? this.each(function(){
innerHighlight(this, pat.toUpperCase());
}):this;
};
jQuery.fn.removeHighlight=function(){
return this.find("span.highlight").each(function(){
this.parentNode.firstChild.nodeName;
with (this.parentNode){
replaceChild(this.firstChild, this);
normalize();
}}).end();
};
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i(t.L={})}(this,function(t){"use strict";var i=Object.freeze;function h(t){var i,e,n,o;for(e=1,n=arguments.length;e<n;e++)for(i in o=arguments[e])t[i]=o[i];return t}Object.freeze=function(t){return t};var s=Object.create||function(t){return e.prototype=t,new e};function e(){}function a(t,i){var e=Array.prototype.slice;if(t.bind)return t.bind.apply(t,e.call(arguments,1));var n=e.call(arguments,2);return function(){return t.apply(i,n.length?n.concat(e.call(arguments)):arguments)}}var n=0;function u(t){return t._leaflet_id=t._leaflet_id||++n,t._leaflet_id}function o(t,i,e){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(e,o),o=!1)},s=function(){n?o=arguments:(t.apply(e,arguments),setTimeout(r,i),n=!0)}}function r(t,i,e){var n=i[1],o=i[0],s=n-o;return t===n&&e?t:((t-o)%s+s)%s+o}function l(){return!1}function c(t,i){return i=void 0===i?6:i,+(Math.round(t+"e+"+i)+"e-"+i)}function _(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function d(t){return _(t).split(/\s+/)}function p(t,i){for(var e in t.hasOwnProperty("options")||(t.options=t.options?s(t.options):{}),i)t.options[e]=i[e];return t.options}function m(t,i,e){var n=[];for(var o in t)n.push(encodeURIComponent(e?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(i&&-1!==i.indexOf("?")?"&":"?")+n.join("&")}var f=/\{ *([\w_-]+) *\}/g;function g(t,n){return t.replace(f,function(t,i){var e=n[i];if(void 0===e)throw new Error("No value provided for variable "+t);return"function"==typeof e&&(e=e(n)),e})}var v=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function y(t,i){for(var e=0;e<t.length;e++)if(t[e]===i)return e;return-1}var x="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function w(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var P=0;function b(t){var i=+new Date,e=Math.max(0,16-(i-P));return P=i+e,window.setTimeout(t,e)}var T=window.requestAnimationFrame||w("RequestAnimationFrame")||b,z=window.cancelAnimationFrame||w("CancelAnimationFrame")||w("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function M(t,i,e){if(!e||T!==b)return T.call(window,a(t,i));t.call(i)}function C(t){t&&z.call(window,t)}var S=(Object.freeze||Object)({freeze:i,extend:h,create:s,bind:a,lastId:n,stamp:u,throttle:o,wrapNum:r,falseFn:l,formatNum:c,trim:_,splitWords:d,setOptions:p,getParamString:m,template:g,isArray:v,indexOf:y,emptyImageUrl:x,requestFn:T,cancelFn:z,requestAnimFrame:M,cancelAnimFrame:C});function Z(){}Z.extend=function(t){function i(){this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()}var e=i.__super__=this.prototype,n=s(e);for(var o in(n.constructor=i).prototype=n,this)this.hasOwnProperty(o)&&"prototype"!==o&&"__super__"!==o&&(i[o]=this[o]);return t.statics&&(h(i,t.statics),delete t.statics),t.includes&&(function(t){if("undefined"==typeof L||!L||!L.Mixin)return;t=v(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",(new Error).stack)}(t.includes),h.apply(null,[n].concat(t.includes)),delete t.includes),n.options&&(t.options=h(s(n.options),t.options)),h(n,t),n._initHooks=[],n.callInitHooks=function(){if(!this._initHooksCalled){e.callInitHooks&&e.callInitHooks.call(this),this._initHooksCalled=!0;for(var t=0,i=n._initHooks.length;t<i;t++)n._initHooks[t].call(this)}},i},Z.include=function(t){return h(this.prototype,t),this},Z.mergeOptions=function(t){return h(this.prototype.options,t),this},Z.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),e="function"==typeof t?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(e),this};var E={on:function(t,i,e){if("object"==typeof t)for(var n in t)this._on(n,t[n],i);else for(var o=0,s=(t=d(t)).length;o<s;o++)this._on(t[o],i,e);return this},off:function(t,i,e){if(t)if("object"==typeof t)for(var n in t)this._off(n,t[n],i);else for(var o=0,s=(t=d(t)).length;o<s;o++)this._off(t[o],i,e);else delete this._events;return this},_on:function(t,i,e){this._events=this._events||{};var n=this._events[t];n||(n=[],this._events[t]=n),e===this&&(e=void 0);for(var o={fn:i,ctx:e},s=n,r=0,a=s.length;r<a;r++)if(s[r].fn===i&&s[r].ctx===e)return;s.push(o)},_off:function(t,i,e){var n,o,s;if(this._events&&(n=this._events[t]))if(i){if(e===this&&(e=void 0),n)for(o=0,s=n.length;o<s;o++){var r=n[o];if(r.ctx===e&&r.fn===i)return r.fn=l,this._firingCount&&(this._events[t]=n=n.slice()),void n.splice(o,1)}}else{for(o=0,s=n.length;o<s;o++)n[o].fn=l;delete this._events[t]}},fire:function(t,i,e){if(!this.listens(t,e))return this;var n=h({},i,{type:t,target:this,sourceTarget:i&&i.sourceTarget||this});if(this._events){var o=this._events[t];if(o){this._firingCount=this._firingCount+1||1;for(var s=0,r=o.length;s<r;s++){var a=o[s];a.fn.call(a.ctx||this,n)}this._firingCount--}}return e&&this._propagateEvent(n),this},listens:function(t,i){var e=this._events&&this._events[t];if(e&&e.length)return!0;if(i)for(var n in this._eventParents)if(this._eventParents[n].listens(t,i))return!0;return!1},once:function(t,i,e){if("object"==typeof t){for(var n in t)this.once(n,t[n],i);return this}var o=a(function(){this.off(t,i,e).off(t,o,e)},this);return this.on(t,i,e).on(t,o,e)},addEventParent:function(t){return this._eventParents=this._eventParents||{},this._eventParents[u(t)]=t,this},removeEventParent:function(t){return this._eventParents&&delete this._eventParents[u(t)],this},_propagateEvent:function(t){for(var i in this._eventParents)this._eventParents[i].fire(t.type,h({layer:t.target,propagatedFrom:t.target},t),!0)}};E.addEventListener=E.on,E.removeEventListener=E.clearAllEventListeners=E.off,E.addOneTimeEventListener=E.once,E.fireEvent=E.fire,E.hasEventListeners=E.listens;var k=Z.extend(E);function B(t,i,e){this.x=e?Math.round(t):t,this.y=e?Math.round(i):i}var A=Math.trunc||function(t){return 0<t?Math.floor(t):Math.ceil(t)};function I(t,i,e){return t instanceof B?t:v(t)?new B(t[0],t[1]):null==t?t:"object"==typeof t&&"x"in t&&"y"in t?new B(t.x,t.y):new B(t,i,e)}function O(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function R(t,i){return!t||t instanceof O?t:new O(t,i)}function N(t,i){if(t)for(var e=i?[t,i]:t,n=0,o=e.length;n<o;n++)this.extend(e[n])}function D(t,i){return t instanceof N?t:new N(t,i)}function j(t,i,e){if(isNaN(t)||isNaN(i))throw new Error("Invalid LatLng object: ("+t+", "+i+")");this.lat=+t,this.lng=+i,void 0!==e&&(this.alt=+e)}function W(t,i,e){return t instanceof j?t:v(t)&&"object"!=typeof t[0]?3===t.length?new j(t[0],t[1],t[2]):2===t.length?new j(t[0],t[1]):null:null==t?t:"object"==typeof t&&"lat"in t?new j(t.lat,"lng"in t?t.lng:t.lon,t.alt):void 0===i?null:new j(t,i,e)}B.prototype={clone:function(){return new B(this.x,this.y)},add:function(t){return this.clone()._add(I(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(I(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},scaleBy:function(t){return new B(this.x*t.x,this.y*t.y)},unscaleBy:function(t){return new B(this.x/t.x,this.y/t.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=A(this.x),this.y=A(this.y),this},distanceTo:function(t){var i=(t=I(t)).x-this.x,e=t.y-this.y;return Math.sqrt(i*i+e*e)},equals:function(t){return(t=I(t)).x===this.x&&t.y===this.y},contains:function(t){return t=I(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+c(this.x)+", "+c(this.y)+")"}},O.prototype={extend:function(t){return t=I(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new B((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new B(this.min.x,this.max.y)},getTopRight:function(){return new B(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var i,e;return(t="number"==typeof t[0]||t instanceof B?I(t):R(t))instanceof O?(i=t.min,e=t.max):i=e=t,i.x>=this.min.x&&e.x<=this.max.x&&i.y>=this.min.y&&e.y<=this.max.y},intersects:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>=i.x&&n.x<=e.x,r=o.y>=i.y&&n.y<=e.y;return s&&r},overlaps:function(t){t=R(t);var i=this.min,e=this.max,n=t.min,o=t.max,s=o.x>i.x&&n.x<e.x,r=o.y>i.y&&n.y<e.y;return s&&r},isValid:function(){return!(!this.min||!this.max)}},N.prototype={extend:function(t){var i,e,n=this._southWest,o=this._northEast;if(t instanceof j)e=i=t;else{if(!(t instanceof N))return t?this.extend(W(t)||D(t)):this;if(i=t._southWest,e=t._northEast,!i||!e)return this}return n||o?(n.lat=Math.min(i.lat,n.lat),n.lng=Math.min(i.lng,n.lng),o.lat=Math.max(e.lat,o.lat),o.lng=Math.max(e.lng,o.lng)):(this._southWest=new j(i.lat,i.lng),this._northEast=new j(e.lat,e.lng)),this},pad:function(t){var i=this._southWest,e=this._northEast,n=Math.abs(i.lat-e.lat)*t,o=Math.abs(i.lng-e.lng)*t;return new N(new j(i.lat-n,i.lng-o),new j(e.lat+n,e.lng+o))},getCenter:function(){return new j((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new j(this.getNorth(),this.getWest())},getSouthEast:function(){return new j(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof j||"lat"in t?W(t):D(t);var i,e,n=this._southWest,o=this._northEast;return t instanceof N?(i=t.getSouthWest(),e=t.getNorthEast()):i=e=t,i.lat>=n.lat&&e.lat<=o.lat&&i.lng>=n.lng&&e.lng<=o.lng},intersects:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>=i.lat&&n.lat<=e.lat,r=o.lng>=i.lng&&n.lng<=e.lng;return s&&r},overlaps:function(t){t=D(t);var i=this._southWest,e=this._northEast,n=t.getSouthWest(),o=t.getNorthEast(),s=o.lat>i.lat&&n.lat<e.lat,r=o.lng>i.lng&&n.lng<e.lng;return s&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t,i){return!!t&&(t=D(t),this._southWest.equals(t.getSouthWest(),i)&&this._northEast.equals(t.getNorthEast(),i))},isValid:function(){return!(!this._southWest||!this._northEast)}};var H,F={latLngToPoint:function(t,i){var e=this.projection.project(t),n=this.scale(i);return this.transformation._transform(e,n)},pointToLatLng:function(t,i){var e=this.scale(i),n=this.transformation.untransform(t,e);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},unproject:function(t){return this.projection.unproject(t)},scale:function(t){return 256*Math.pow(2,t)},zoom:function(t){return Math.log(t/256)/Math.LN2},getProjectedBounds:function(t){if(this.infinite)return null;var i=this.projection.bounds,e=this.scale(t);return new O(this.transformation.transform(i.min,e),this.transformation.transform(i.max,e))},infinite:!(j.prototype={equals:function(t,i){return!!t&&(t=W(t),Math.max(Math.abs(this.lat-t.lat),Math.abs(this.lng-t.lng))<=(void 0===i?1e-9:i))},toString:function(t){return"LatLng("+c(this.lat,t)+", "+c(this.lng,t)+")"},distanceTo:function(t){return U.distance(this,W(t))},wrap:function(){return U.wrapLatLng(this)},toBounds:function(t){var i=180*t/40075017,e=i/Math.cos(Math.PI/180*this.lat);return D([this.lat-i,this.lng-e],[this.lat+i,this.lng+e])},clone:function(){return new j(this.lat,this.lng,this.alt)}}),wrapLatLng:function(t){var i=this.wrapLng?r(t.lng,this.wrapLng,!0):t.lng;return new j(this.wrapLat?r(t.lat,this.wrapLat,!0):t.lat,i,t.alt)},wrapLatLngBounds:function(t){var i=t.getCenter(),e=this.wrapLatLng(i),n=i.lat-e.lat,o=i.lng-e.lng;if(0==n&&0==o)return t;var s=t.getSouthWest(),r=t.getNorthEast();return new N(new j(s.lat-n,s.lng-o),new j(r.lat-n,r.lng-o))}},U=h({},F,{wrapLng:[-180,180],R:6371e3,distance:function(t,i){var e=Math.PI/180,n=t.lat*e,o=i.lat*e,s=Math.sin((i.lat-t.lat)*e/2),r=Math.sin((i.lng-t.lng)*e/2),a=s*s+Math.cos(n)*Math.cos(o)*r*r,h=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*h}}),V=6378137,q={R:V,MAX_LATITUDE:85.0511287798,project:function(t){var i=Math.PI/180,e=this.MAX_LATITUDE,n=Math.max(Math.min(e,t.lat),-e),o=Math.sin(n*i);return new B(this.R*t.lng*i,this.R*Math.log((1+o)/(1-o))/2)},unproject:function(t){var i=180/Math.PI;return new j((2*Math.atan(Math.exp(t.y/this.R))-Math.PI/2)*i,t.x*i/this.R)},bounds:(H=V*Math.PI,new O([-H,-H],[H,H]))};function G(t,i,e,n){if(v(t))return this._a=t[0],this._b=t[1],this._c=t[2],void(this._d=t[3]);this._a=t,this._b=i,this._c=e,this._d=n}function K(t,i,e,n){return new G(t,i,e,n)}G.prototype={transform:function(t,i){return this._transform(t.clone(),i)},_transform:function(t,i){return i=i||1,t.x=i*(this._a*t.x+this._b),t.y=i*(this._c*t.y+this._d),t},untransform:function(t,i){return i=i||1,new B((t.x/i-this._b)/this._a,(t.y/i-this._d)/this._c)}};var Y,X=h({},U,{code:"EPSG:3857",projection:q,transformation:(Y=.5/(Math.PI*q.R),K(Y,.5,-Y,.5))}),J=h({},X,{code:"EPSG:900913"});function $(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Q(t,i){var e,n,o,s,r,a,h="";for(e=0,o=t.length;e<o;e++){for(n=0,s=(r=t[e]).length;n<s;n++)h+=(n?"L":"M")+(a=r[n]).x+" "+a.y;h+=i?Zt?"z":"x":""}return h||"M0 0"}var tt=document.documentElement.style,it="ActiveXObject"in window,et=it&&!document.addEventListener,nt="msLaunchUri"in navigator&&!("documentMode"in document),ot=kt("webkit"),st=kt("android"),rt=kt("android 2")||kt("android 3"),at=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ht=st&&kt("Google")&&at<537&&!("AudioNode"in window),ut=!!window.opera,lt=kt("chrome"),ct=kt("gecko")&&!ot&&!ut&&!it,_t=!lt&&kt("safari"),dt=kt("phantom"),pt="OTransition"in tt,mt=0===navigator.platform.indexOf("Win"),ft=it&&"transition"in tt,gt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!rt,vt="MozPerspective"in tt,yt=!window.L_DISABLE_3D&&(ft||gt||vt)&&!pt&&!dt,xt="undefined"!=typeof orientation||kt("mobile"),wt=xt&&ot,Pt=xt&&gt,Lt=!window.PointerEvent&&window.MSPointerEvent,bt=!(!window.PointerEvent&&!Lt),Tt=!window.L_NO_TOUCH&&(bt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),zt=xt&&ut,Mt=xt&&ct,Ct=1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),St=!!document.createElement("canvas").getContext,Zt=!(!document.createElementNS||!$("svg").createSVGRect),Et=!Zt&&function(){try{var t=document.createElement("div");t.innerHTML='<v:shape adj="1"/>';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(t){return!1}}();function kt(t){return 0<=navigator.userAgent.toLowerCase().indexOf(t)}var Bt=(Object.freeze||Object)({ie:it,ielt9:et,edge:nt,webkit:ot,android:st,android23:rt,androidStock:ht,opera:ut,chrome:lt,gecko:ct,safari:_t,phantom:dt,opera12:pt,win:mt,ie3d:ft,webkit3d:gt,gecko3d:vt,any3d:yt,mobile:xt,mobileWebkit:wt,mobileWebkit3d:Pt,msPointer:Lt,pointer:bt,touch:Tt,mobileOpera:zt,mobileGecko:Mt,retina:Ct,canvas:St,svg:Zt,vml:Et}),At=Lt?"MSPointerDown":"pointerdown",It=Lt?"MSPointerMove":"pointermove",Ot=Lt?"MSPointerUp":"pointerup",Rt=Lt?"MSPointerCancel":"pointercancel",Nt=["INPUT","SELECT","OPTION"],Dt={},jt=!1,Wt=0;function Ht(t,i,e,n){return"touchstart"===i?function(t,i,e){var n=a(function(t){if("mouse"!==t.pointerType&&t.MSPOINTER_TYPE_MOUSE&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE){if(!(Nt.indexOf(t.target.tagName)<0))return;Di(t)}qt(t,i)});t["_leaflet_touchstart"+e]=n,t.addEventListener(At,n,!1),jt||(document.documentElement.addEventListener(At,Ft,!0),document.documentElement.addEventListener(It,Ut,!0),document.documentElement.addEventListener(Ot,Vt,!0),document.documentElement.addEventListener(Rt,Vt,!0),jt=!0)}(t,e,n):"touchmove"===i?function(t,i,e){var n=function(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&qt(t,i)};t["_leaflet_touchmove"+e]=n,t.addEventListener(It,n,!1)}(t,e,n):"touchend"===i&&function(t,i,e){var n=function(t){qt(t,i)};t["_leaflet_touchend"+e]=n,t.addEventListener(Ot,n,!1),t.addEventListener(Rt,n,!1)}(t,e,n),this}function Ft(t){Dt[t.pointerId]=t,Wt++}function Ut(t){Dt[t.pointerId]&&(Dt[t.pointerId]=t)}function Vt(t){delete Dt[t.pointerId],Wt--}function qt(t,i){for(var e in t.touches=[],Dt)t.touches.push(Dt[e]);t.changedTouches=[t],i(t)}var Gt=Lt?"MSPointerDown":bt?"pointerdown":"touchstart",Kt=Lt?"MSPointerUp":bt?"pointerup":"touchend",Yt="_leaflet_";function Xt(t,o,i){var s,r,a=!1;function e(t){var i;if(bt){if(!nt||"mouse"===t.pointerType)return;i=Wt}else i=t.touches.length;if(!(1<i)){var e=Date.now(),n=e-(s||e);r=t.touches?t.touches[0]:t,a=0<n&&n<=250,s=e}}function n(t){if(a&&!r.cancelBubble){if(bt){if(!nt||"mouse"===t.pointerType)return;var i,e,n={};for(e in r)i=r[e],n[e]=i&&i.bind?i.bind(r):i;r=n}r.type="dblclick",r.button=0,o(r),s=null}}return t[Yt+Gt+i]=e,t[Yt+Kt+i]=n,t[Yt+"dblclick"+i]=o,t.addEventListener(Gt,e,!1),t.addEventListener(Kt,n,!1),t.addEventListener("dblclick",o,!1),this}function Jt(t,i){var e=t[Yt+Gt+i],n=t[Yt+Kt+i],o=t[Yt+"dblclick"+i];return t.removeEventListener(Gt,e,!1),t.removeEventListener(Kt,n,!1),nt||t.removeEventListener("dblclick",o,!1),this}var $t,Qt,ti,ii,ei,ni=yi(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),oi=yi(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),si="webkitTransition"===oi||"OTransition"===oi?oi+"End":"transitionend";function ri(t){return"string"==typeof t?document.getElementById(t):t}function ai(t,i){var e=t.style[i]||t.currentStyle&&t.currentStyle[i];if((!e||"auto"===e)&&document.defaultView){var n=document.defaultView.getComputedStyle(t,null);e=n?n[i]:null}return"auto"===e?null:e}function hi(t,i,e){var n=document.createElement(t);return n.className=i||"",e&&e.appendChild(n),n}function ui(t){var i=t.parentNode;i&&i.removeChild(t)}function li(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function ci(t){var i=t.parentNode;i&&i.lastChild!==t&&i.appendChild(t)}function _i(t){var i=t.parentNode;i&&i.firstChild!==t&&i.insertBefore(t,i.firstChild)}function di(t,i){if(void 0!==t.classList)return t.classList.contains(i);var e=gi(t);return 0<e.length&&new RegExp("(^|\\s)"+i+"(\\s|$)").test(e)}function pi(t,i){if(void 0!==t.classList)for(var e=d(i),n=0,o=e.length;n<o;n++)t.classList.add(e[n]);else if(!di(t,i)){var s=gi(t);fi(t,(s?s+" ":"")+i)}}function mi(t,i){void 0!==t.classList?t.classList.remove(i):fi(t,_((" "+gi(t)+" ").replace(" "+i+" "," ")))}function fi(t,i){void 0===t.className.baseVal?t.className=i:t.className.baseVal=i}function gi(t){return t.correspondingElement&&(t=t.correspondingElement),void 0===t.className.baseVal?t.className:t.className.baseVal}function vi(t,i){"opacity"in t.style?t.style.opacity=i:"filter"in t.style&&function(t,i){var e=!1,n="DXImageTransform.Microsoft.Alpha";try{e=t.filters.item(n)}catch(t){if(1===i)return}i=Math.round(100*i),e?(e.Enabled=100!==i,e.Opacity=i):t.style.filter+=" progid:"+n+"(opacity="+i+")"}(t,i)}function yi(t){for(var i=document.documentElement.style,e=0;e<t.length;e++)if(t[e]in i)return t[e];return!1}function xi(t,i,e){var n=i||new B(0,0);t.style[ni]=(ft?"translate("+n.x+"px,"+n.y+"px)":"translate3d("+n.x+"px,"+n.y+"px,0)")+(e?" scale("+e+")":"")}function wi(t,i){t._leaflet_pos=i,yt?xi(t,i):(t.style.left=i.x+"px",t.style.top=i.y+"px")}function Pi(t){return t._leaflet_pos||new B(0,0)}if("onselectstart"in document)$t=function(){Ei(window,"selectstart",Di)},Qt=function(){Bi(window,"selectstart",Di)};else{var Li=yi(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);$t=function(){if(Li){var t=document.documentElement.style;ti=t[Li],t[Li]="none"}},Qt=function(){Li&&(document.documentElement.style[Li]=ti,ti=void 0)}}function bi(){Ei(window,"dragstart",Di)}function Ti(){Bi(window,"dragstart",Di)}function zi(t){for(;-1===t.tabIndex;)t=t.parentNode;t.style&&(Mi(),ei=(ii=t).style.outline,t.style.outline="none",Ei(window,"keydown",Mi))}function Mi(){ii&&(ii.style.outline=ei,ei=ii=void 0,Bi(window,"keydown",Mi))}function Ci(t){for(;!((t=t.parentNode).offsetWidth&&t.offsetHeight||t===document.body););return t}function Si(t){var i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}var Zi=(Object.freeze||Object)({TRANSFORM:ni,TRANSITION:oi,TRANSITION_END:si,get:ri,getStyle:ai,create:hi,remove:ui,empty:li,toFront:ci,toBack:_i,hasClass:di,addClass:pi,removeClass:mi,setClass:fi,getClass:gi,setOpacity:vi,testProp:yi,setTransform:xi,setPosition:wi,getPosition:Pi,disableTextSelection:$t,enableTextSelection:Qt,disableImageDrag:bi,enableImageDrag:Ti,preventOutline:zi,restoreOutline:Mi,getSizedParentNode:Ci,getScale:Si});function Ei(t,i,e,n){if("object"==typeof i)for(var o in i)Ai(t,o,i[o],e);else for(var s=0,r=(i=d(i)).length;s<r;s++)Ai(t,i[s],e,n);return this}var ki="_leaflet_events";function Bi(t,i,e,n){if("object"==typeof i)for(var o in i)Ii(t,o,i[o],e);else if(i)for(var s=0,r=(i=d(i)).length;s<r;s++)Ii(t,i[s],e,n);else{for(var a in t[ki])Ii(t,a,t[ki][a]);delete t[ki]}return this}function Ai(i,t,e,n){var o=t+u(e)+(n?"_"+u(n):"");if(i[ki]&&i[ki][o])return this;var s=function(t){return e.call(n||i,t||window.event)},r=s;bt&&0===t.indexOf("touch")?Ht(i,t,s,o):!Tt||"dblclick"!==t||bt&&lt?"addEventListener"in i?"mousewheel"===t?i.addEventListener("onwheel"in i?"wheel":"mousewheel",s,!1):"mouseenter"===t||"mouseleave"===t?(s=function(t){t=t||window.event,Ki(i,t)&&r(t)},i.addEventListener("mouseenter"===t?"mouseover":"mouseout",s,!1)):("click"===t&&st&&(s=function(t){!function(t,i){var e=t.timeStamp||t.originalEvent&&t.originalEvent.timeStamp,n=Ui&&e-Ui;if(n&&100<n&&n<500||t.target._simulatedClick&&!t._simulated)return ji(t);Ui=e,i(t)}(t,r)}),i.addEventListener(t,s,!1)):"attachEvent"in i&&i.attachEvent("on"+t,s):Xt(i,s,o),i[ki]=i[ki]||{},i[ki][o]=s}function Ii(t,i,e,n){var o=i+u(e)+(n?"_"+u(n):""),s=t[ki]&&t[ki][o];if(!s)return this;bt&&0===i.indexOf("touch")?function(t,i,e){var n=t["_leaflet_"+i+e];"touchstart"===i?t.removeEventListener(At,n,!1):"touchmove"===i?t.removeEventListener(It,n,!1):"touchend"===i&&(t.removeEventListener(Ot,n,!1),t.removeEventListener(Rt,n,!1))}(t,i,o):!Tt||"dblclick"!==i||bt&&lt?"removeEventListener"in t?"mousewheel"===i?t.removeEventListener("onwheel"in t?"wheel":"mousewheel",s,!1):t.removeEventListener("mouseenter"===i?"mouseover":"mouseleave"===i?"mouseout":i,s,!1):"detachEvent"in t&&t.detachEvent("on"+i,s):Jt(t,o),t[ki][o]=null}function Oi(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,Gi(t),this}function Ri(t){return Ai(t,"mousewheel",Oi),this}function Ni(t){return Ei(t,"mousedown touchstart dblclick",Oi),Ai(t,"click",qi),this}function Di(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function ji(t){return Di(t),Oi(t),this}function Wi(t,i){if(!i)return new B(t.clientX,t.clientY);var e=Si(i),n=e.boundingClientRect;return new B((t.clientX-n.left)/e.x-i.clientLeft,(t.clientY-n.top)/e.y-i.clientTop)}var Hi=mt&&lt?2*window.devicePixelRatio:ct?window.devicePixelRatio:1;function Fi(t){return nt?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/Hi:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&Math.abs(t.detail)<32765?20*-t.detail:t.detail?t.detail/-32765*60:0}var Ui,Vi={};function qi(t){Vi[t.type]=!0}function Gi(t){var i=Vi[t.type];return Vi[t.type]=!1,i}function Ki(t,i){var e=i.relatedTarget;if(!e)return!0;try{for(;e&&e!==t;)e=e.parentNode}catch(t){return!1}return e!==t}var Yi=(Object.freeze||Object)({on:Ei,off:Bi,stopPropagation:Oi,disableScrollPropagation:Ri,disableClickPropagation:Ni,preventDefault:Di,stop:ji,getMousePosition:Wi,getWheelDelta:Fi,fakeStop:qi,skipped:Gi,isExternalTarget:Ki,addListener:Ei,removeListener:Bi}),Xi=k.extend({run:function(t,i,e,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=e||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=Pi(t),this._offset=i.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=M(this._animate,this),this._step()},_step:function(t){var i=+new Date-this._startTime,e=1e3*this._duration;i<e?this._runFrame(this._easeOut(i/e),t):(this._runFrame(1),this._complete())},_runFrame:function(t,i){var e=this._startPos.add(this._offset.multiplyBy(t));i&&e._round(),wi(this._el,e),this.fire("step")},_complete:function(){C(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),Ji=k.extend({options:{crs:X,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(t,i){i=p(this,i),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(t),this._initLayout(),this._onResize=a(this._onResize,this),this._initEvents(),i.maxBounds&&this.setMaxBounds(i.maxBounds),void 0!==i.zoom&&(this._zoom=this._limitZoom(i.zoom)),i.center&&void 0!==i.zoom&&this.setView(W(i.center),i.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=oi&&yt&&!zt&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),Ei(this._proxy,si,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(t,i,e){if((i=void 0===i?this._zoom:this._limitZoom(i),t=this._limitCenter(W(t),i,this.options.maxBounds),e=e||{},this._stop(),this._loaded&&!e.reset&&!0!==e)&&(void 0!==e.animate&&(e.zoom=h({animate:e.animate},e.zoom),e.pan=h({animate:e.animate,duration:e.duration},e.pan)),this._zoom!==i?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,i,e.zoom):this._tryAnimatedPan(t,e.pan)))return clearTimeout(this._sizeTimer),this;return this._resetView(t,i),this},setZoom:function(t,i){return this._loaded?this.setView(this.getCenter(),t,{zoom:i}):(this._zoom=t,this)},zoomIn:function(t,i){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom+t,i)},zoomOut:function(t,i){return t=t||(yt?this.options.zoomDelta:1),this.setZoom(this._zoom-t,i)},setZoomAround:function(t,i,e){var n=this.getZoomScale(i),o=this.getSize().divideBy(2),s=(t instanceof B?t:this.latLngToContainerPoint(t)).subtract(o).multiplyBy(1-1/n),r=this.containerPointToLatLng(o.add(s));return this.setView(r,i,{zoom:e})},_getBoundsCenterZoom:function(t,i){i=i||{},t=t.getBounds?t.getBounds():D(t);var e=I(i.paddingTopLeft||i.padding||[0,0]),n=I(i.paddingBottomRight||i.padding||[0,0]),o=this.getBoundsZoom(t,!1,e.add(n));if((o="number"==typeof i.maxZoom?Math.min(i.maxZoom,o):o)===1/0)return{center:t.getCenter(),zoom:o};var s=n.subtract(e).divideBy(2),r=this.project(t.getSouthWest(),o),a=this.project(t.getNorthEast(),o);return{center:this.unproject(r.add(a).divideBy(2).add(s),o),zoom:o}},fitBounds:function(t,i){if(!(t=D(t)).isValid())throw new Error("Bounds are not valid.");var e=this._getBoundsCenterZoom(t,i);return this.setView(e.center,e.zoom,i)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,i){return this.setView(t,this._zoom,{pan:i})},panBy:function(t,i){if(i=i||{},!(t=I(t).round()).x&&!t.y)return this.fire("moveend");if(!0!==i.animate&&!this.getSize().contains(t))return this._resetView(this.unproject(this.project(this.getCenter()).add(t)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new Xi,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),i.noMoveStart||this.fire("movestart"),!1!==i.animate){pi(this._mapPane,"leaflet-pan-anim");var e=this._getMapPanePos().subtract(t).round();this._panAnim.run(this._mapPane,e,i.duration||.25,i.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},flyTo:function(n,o,t){if(!1===(t=t||{}).animate||!yt)return this.setView(n,o,t);this._stop();var s=this.project(this.getCenter()),r=this.project(n),i=this.getSize(),a=this._zoom;n=W(n),o=void 0===o?a:o;var h=Math.max(i.x,i.y),u=h*this.getZoomScale(a,o),l=r.distanceTo(s)||1,c=1.42,_=c*c;function e(t){var i=(u*u-h*h+(t?-1:1)*_*_*l*l)/(2*(t?u:h)*_*l),e=Math.sqrt(i*i+1)-i;return e<1e-9?-18:Math.log(e)}function d(t){return(Math.exp(t)-Math.exp(-t))/2}function p(t){return(Math.exp(t)+Math.exp(-t))/2}var m=e(0);function f(t){return h*(p(m)*function(t){return d(t)/p(t)}(m+c*t)-d(m))/_}var g=Date.now(),v=(e(1)-m)/c,y=t.duration?1e3*t.duration:1e3*v*.8;return this._moveStart(!0,t.noMoveStart),function t(){var i=(Date.now()-g)/y,e=function(t){return 1-Math.pow(1-t,1.5)}(i)*v;i<=1?(this._flyToFrame=M(t,this),this._move(this.unproject(s.add(r.subtract(s).multiplyBy(f(e)/l)),a),this.getScaleZoom(h/function(t){return h*(p(m)/p(m+c*t))}(e),a),{flyTo:!0})):this._move(n,o)._moveEnd(!0)}.call(this),this},flyToBounds:function(t,i){var e=this._getBoundsCenterZoom(t,i);return this.flyTo(e.center,e.zoom,i)},setMaxBounds:function(t){return(t=D(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(t){var i=this.options.minZoom;return this.options.minZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()<this.options.minZoom)?this.setZoom(t):this},setMaxZoom:function(t){var i=this.options.maxZoom;return this.options.maxZoom=t,this._loaded&&i!==t&&(this.fire("zoomlevelschange"),this.getZoom()>this.options.maxZoom)?this.setZoom(t):this},panInsideBounds:function(t,i){this._enforcingBounds=!0;var e=this.getCenter(),n=this._limitCenter(e,this._zoom,D(t));return e.equals(n)||this.panTo(n,i),this._enforcingBounds=!1,this},panInside:function(t,i){var e=I((i=i||{}).paddingTopLeft||i.padding||[0,0]),n=I(i.paddingBottomRight||i.padding||[0,0]),o=this.getCenter(),s=this.project(o),r=this.project(t),a=this.getPixelBounds(),h=a.getSize().divideBy(2),u=R([a.min.add(e),a.max.subtract(n)]);if(!u.contains(r)){this._enforcingBounds=!0;var l=s.subtract(r),c=I(r.x+l.x,r.y+l.y);(r.x<u.min.x||r.x>u.max.x)&&(c.x=s.x-l.x,0<l.x?c.x+=h.x-e.x:c.x-=h.x-n.x),(r.y<u.min.y||r.y>u.max.y)&&(c.y=s.y-l.y,0<l.y?c.y+=h.y-e.y:c.y-=h.y-n.y),this.panTo(this.unproject(c),i),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=h({animate:!1,pan:!0},!0===t?{animate:!0}:t);var i=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var e=this.getSize(),n=i.divideBy(2).round(),o=e.divideBy(2).round(),s=n.subtract(o);return s.x||s.y?(t.animate&&t.pan?this.panBy(s):(t.pan&&this._rawPanBy(s),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(a(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:i,newSize:e})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(t){if(t=this._locateOptions=h({timeout:1e4,watch:!1},t),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var i=a(this._handleGeolocationResponse,this),e=a(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(i,e,t):navigator.geolocation.getCurrentPosition(i,e,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var i=t.code,e=t.message||(1===i?"permission denied":2===i?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:i,message:"Geolocation error: "+e+"."})},_handleGeolocationResponse:function(t){var i=new j(t.coords.latitude,t.coords.longitude),e=i.toBounds(2*t.coords.accuracy),n=this._locateOptions;if(n.setView){var o=this.getBoundsZoom(e);this.setView(i,n.maxZoom?Math.min(o,n.maxZoom):o)}var s={latlng:i,bounds:e,timestamp:t.timestamp};for(var r in t.coords)"number"==typeof t.coords[r]&&(s[r]=t.coords[r]);this.fire("locationfound",s)},addHandler:function(t,i){if(!i)return this;var e=this[t]=new i(this);return this._handlers.push(e),this.options[t]&&e.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}var t;for(t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),ui(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(C(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)ui(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(t,i){var e=hi("div","leaflet-pane"+(t?" leaflet-"+t.replace("Pane","")+"-pane":""),i||this._mapPane);return t&&(this._panes[t]=e),e},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new N(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,i,e){t=D(t),e=I(e||[0,0]);var n=this.getZoom()||0,o=this.getMinZoom(),s=this.getMaxZoom(),r=t.getNorthWest(),a=t.getSouthEast(),h=this.getSize().subtract(e),u=R(this.project(a,n),this.project(r,n)).getSize(),l=yt?this.options.zoomSnap:1,c=h.x/u.x,_=h.y/u.y,d=i?Math.max(c,_):Math.min(c,_);return n=this.getScaleZoom(d,n),l&&(n=Math.round(n/(l/100))*(l/100),n=i?Math.ceil(n/l)*l:Math.floor(n/l)*l),Math.max(o,Math.min(s,n))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new B(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(t,i){var e=this._getTopLeftPoint(t,i);return new O(e,e.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t,i){var e=this.options.crs;return i=void 0===i?this._zoom:i,e.scale(t)/e.scale(i)},getScaleZoom:function(t,i){var e=this.options.crs;i=void 0===i?this._zoom:i;var n=e.zoom(t*e.scale(i));return isNaN(n)?1/0:n},project:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.latLngToPoint(W(t),i)},unproject:function(t,i){return i=void 0===i?this._zoom:i,this.options.crs.pointToLatLng(I(t),i)},layerPointToLatLng:function(t){var i=I(t).add(this.getPixelOrigin());return this.unproject(i)},latLngToLayerPoint:function(t){return this.project(W(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(W(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(D(t))},distance:function(t,i){return this.options.crs.distance(W(t),W(i))},containerPointToLayerPoint:function(t){return I(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return I(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var i=this.containerPointToLayerPoint(I(t));return this.layerPointToLatLng(i)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(W(t)))},mouseEventToContainerPoint:function(t){return Wi(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var i=this._container=ri(t);if(!i)throw new Error("Map container not found.");if(i._leaflet_id)throw new Error("Map container is already initialized.");Ei(i,"scroll",this._onScroll,this),this._containerId=u(i)},_initLayout:function(){var t=this._container;this._fadeAnimated=this.options.fadeAnimation&&yt,pi(t,"leaflet-container"+(Tt?" leaflet-touch":"")+(Ct?" leaflet-retina":"")+(et?" leaflet-oldie":"")+(_t?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var i=ai(t,"position");"absolute"!==i&&"relative"!==i&&"fixed"!==i&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),wi(this._mapPane,new B(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(pi(t.markerPane,"leaflet-zoom-hide"),pi(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(t,i){wi(this._mapPane,new B(0,0));var e=!this._loaded;this._loaded=!0,i=this._limitZoom(i),this.fire("viewprereset");var n=this._zoom!==i;this._moveStart(n,!1)._move(t,i)._moveEnd(n),this.fire("viewreset"),e&&this.fire("load")},_moveStart:function(t,i){return t&&this.fire("zoomstart"),i||this.fire("movestart"),this},_move:function(t,i,e){void 0===i&&(i=this._zoom);var n=this._zoom!==i;return this._zoom=i,this._lastCenter=t,this._pixelOrigin=this._getNewPixelOrigin(t),(n||e&&e.pinch)&&this.fire("zoom",e),this.fire("move",e)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return C(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){wi(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(t){this._targets={};var i=t?Bi:Ei;i((this._targets[u(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&i(window,"resize",this._onResize,this),yt&&this.options.transform3DLimit&&(t?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){C(this._resizeRequest),this._resizeRequest=M(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(t,i){for(var e,n=[],o="mouseout"===i||"mouseover"===i,s=t.target||t.srcElement,r=!1;s;){if((e=this._targets[u(s)])&&("click"===i||"preclick"===i)&&!t._simulated&&this._draggableMoved(e)){r=!0;break}if(e&&e.listens(i,!0)){if(o&&!Ki(s,t))break;if(n.push(e),o)break}if(s===this._container)break;s=s.parentNode}return n.length||r||o||!Ki(s,t)||(n=[this]),n},_handleDOMEvent:function(t){if(this._loaded&&!Gi(t)){var i=t.type;"mousedown"!==i&&"keypress"!==i&&"keyup"!==i&&"keydown"!==i||zi(t.target||t.srcElement),this._fireDOMEvent(t,i)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(t,i,e){if("click"===t.type){var n=h({},t);n.type="preclick",this._fireDOMEvent(n,n.type,e)}if(!t._stopped&&(e=(e||[]).concat(this._findEventTargets(t,i))).length){var o=e[0];"contextmenu"===i&&o.listens(i,!0)&&Di(t);var s={originalEvent:t};if("keypress"!==t.type&&"keydown"!==t.type&&"keyup"!==t.type){var r=o.getLatLng&&(!o._radius||o._radius<=10);s.containerPoint=r?this.latLngToContainerPoint(o.getLatLng()):this.mouseEventToContainerPoint(t),s.layerPoint=this.containerPointToLayerPoint(s.containerPoint),s.latlng=r?o.getLatLng():this.layerPointToLatLng(s.layerPoint)}for(var a=0;a<e.length;a++)if(e[a].fire(i,s,!0),s.originalEvent._stopped||!1===e[a].options.bubblingMouseEvents&&-1!==y(this._mouseEvents,i))return}},_draggableMoved:function(t){return(t=t.dragging&&t.dragging.enabled()?t:this).dragging&&t.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var t=0,i=this._handlers.length;t<i;t++)this._handlers[t].disable()},whenReady:function(t,i){return this._loaded?t.call(i||this,{target:this}):this.on("load",t,i),this},_getMapPanePos:function(){return Pi(this._mapPane)||new B(0,0)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(t,i){return(t&&void 0!==i?this._getNewPixelOrigin(t,i):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(t,i){var e=this.getSize()._divideBy(2);return this.project(t,i)._subtract(e)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return this.project(t,i)._subtract(n)},_latLngBoundsToNewLayerBounds:function(t,i,e){var n=this._getNewPixelOrigin(e,i);return R([this.project(t.getSouthWest(),i)._subtract(n),this.project(t.getNorthWest(),i)._subtract(n),this.project(t.getSouthEast(),i)._subtract(n),this.project(t.getNorthEast(),i)._subtract(n)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,i,e){if(!e)return t;var n=this.project(t,i),o=this.getSize().divideBy(2),s=new O(n.subtract(o),n.add(o)),r=this._getBoundsOffset(s,e,i);return r.round().equals([0,0])?t:this.unproject(n.add(r),i)},_limitOffset:function(t,i){if(!i)return t;var e=this.getPixelBounds(),n=new O(e.min.add(t),e.max.add(t));return t.add(this._getBoundsOffset(n,i))},_getBoundsOffset:function(t,i,e){var n=R(this.project(i.getNorthEast(),e),this.project(i.getSouthWest(),e)),o=n.min.subtract(t.min),s=n.max.subtract(t.max);return new B(this._rebound(o.x,-s.x),this._rebound(o.y,-s.y))},_rebound:function(t,i){return 0<t+i?Math.round(t-i)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(i))},_limitZoom:function(t){var i=this.getMinZoom(),e=this.getMaxZoom(),n=yt?this.options.zoomSnap:1;return n&&(t=Math.round(t/n)*n),Math.max(i,Math.min(e,t))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){mi(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,i){var e=this._getCenterOffset(t)._trunc();return!(!0!==(i&&i.animate)&&!this.getSize().contains(e))&&(this.panBy(e,i),!0)},_createAnimProxy:function(){var t=this._proxy=hi("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(t),this.on("zoomanim",function(t){var i=ni,e=this._proxy.style[i];xi(this._proxy,this.project(t.center,t.zoom),this.getZoomScale(t.zoom,1)),e===this._proxy.style[i]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on("load moveend",function(){var t=this.getCenter(),i=this.getZoom();xi(this._proxy,this.project(t,i),this.getZoomScale(i,1))},this),this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){ui(this._proxy),delete this._proxy},_catchTransitionEnd:function(t){this._animatingZoom&&0<=t.propertyName.indexOf("transform")&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,i,e){if(this._animatingZoom)return!0;if(e=e||{},!this._zoomAnimated||!1===e.animate||this._nothingToAnimate()||Math.abs(i-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(i),o=this._getCenterOffset(t)._divideBy(1-1/n);return!(!0!==e.animate&&!this.getSize().contains(o))&&(M(function(){this._moveStart(!0,!1)._animateZoom(t,i,!0)},this),!0)},_animateZoom:function(t,i,e,n){this._mapPane&&(e&&(this._animatingZoom=!0,this._animateToCenter=t,this._animateToZoom=i,pi(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:t,zoom:i,noUpdate:n}),setTimeout(a(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&mi(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),M(function(){this._moveEnd(!0)},this))}});function $i(t){return new Qi(t)}var Qi=Z.extend({options:{position:"topright"},initialize:function(t){p(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var i=this._map;return i&&i.removeControl(this),this.options.position=t,i&&i.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this.remove(),this._map=t;var i=this._container=this.onAdd(t),e=this.getPosition(),n=t._controlCorners[e];return pi(i,"leaflet-control"),-1!==e.indexOf("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(ui(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0<t.screenX&&0<t.screenY&&this._map.getContainer().focus()}});Ji.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.remove(),this},_initControlPos:function(){var n=this._controlCorners={},o="leaflet-",s=this._controlContainer=hi("div",o+"control-container",this._container);function t(t,i){var e=o+t+" "+o+i;n[t+i]=hi("div",e,s)}t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos:function(){for(var t in this._controlCorners)ui(this._controlCorners[t]);ui(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var te=Qi.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(t,i,e,n){return e<n?-1:n<e?1:0}},initialize:function(t,i,e){for(var n in p(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[n],n);for(n in i)this._addLayer(i[n],n,!0)},onAdd:function(t){this._initLayout(),this._update(),(this._map=t).on("zoomend",this._checkDisabledLayers,this);for(var i=0;i<this._layers.length;i++)this._layers[i].layer.on("add remove",this._onLayerChange,this);return this._container},addTo:function(t){return Qi.prototype.addTo.call(this,t),this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.off("add remove",this._onLayerChange,this)},addBaseLayer:function(t,i){return this._addLayer(t,i),this._map?this._update():this},addOverlay:function(t,i){return this._addLayer(t,i,!0),this._map?this._update():this},removeLayer:function(t){t.off("add remove",this._onLayerChange,this);var i=this._getLayer(u(t));return i&&this._layers.splice(this._layers.indexOf(i),1),this._map?this._update():this},expand:function(){pi(this._container,"leaflet-control-layers-expanded"),this._section.style.height=null;var t=this._map.getSize().y-(this._container.offsetTop+50);return t<this._section.clientHeight?(pi(this._section,"leaflet-control-layers-scrollbar"),this._section.style.height=t+"px"):mi(this._section,"leaflet-control-layers-scrollbar"),this._checkDisabledLayers(),this},collapse:function(){return mi(this._container,"leaflet-control-layers-expanded"),this},_initLayout:function(){var t="leaflet-control-layers",i=this._container=hi("div",t),e=this.options.collapsed;i.setAttribute("aria-haspopup",!0),Ni(i),Ri(i);var n=this._section=hi("section",t+"-list");e&&(this._map.on("click",this.collapse,this),st||Ei(i,{mouseenter:this.expand,mouseleave:this.collapse},this));var o=this._layersLink=hi("a",t+"-toggle",i);o.href="#",o.title="Layers",Tt?(Ei(o,"click",ji),Ei(o,"click",this.expand,this)):Ei(o,"focus",this.expand,this),e||this.expand (),this._baseLayersList=hi("div",t+"-base",n),this._separator=hi("div",t+"-separator",n),this._overlaysList=hi("div",t+"-overlays",n),i.appendChild(n)},_getLayer:function(t){for(var i=0;i<this._layers.length;i++)if(this._layers[i]&&u(this._layers[i].layer)===t)return this._layers[i]},_addLayer:function(t,i,e){this._map&&t.on("add remove",this._onLayerChange,this),this._layers.push({layer:t,name:i,overlay:e}),this.options.sortLayers&&this._layers.sort(a(function(t,i){return this.options.sortFunction(t.layer,i.layer,t.name,i.name)},this)),this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;li(this._baseLayersList),li(this._overlaysList),this._layerControlInputs=[];var t,i,e,n,o=0;for(e=0;e<this._layers.length;e++)n=this._layers[e],this._addItem(n),i=i||n.overlay,t=t||!n.overlay,o+=n.overlay?0:1;return this.options.hideSingleBase&&(t=t&&1<o,this._baseLayersList.style.display=t?"":"none"),this._separator.style.display=i&&t?"":"none",this},_onLayerChange:function(t){this._handlingClick||this._update();var i=this._getLayer(u(t.target)),e=i.overlay?"add"===t.type?"overlayadd":"overlayremove":"add"===t.type?"baselayerchange":null;e&&this._map.fire(e,i)},_createRadioElement:function(t,i){var e='<input type="radio" class="leaflet-control-layers-selector" name="'+t+'"'+(i?' checked="checked"':"")+"/>",n=document.createElement("div");return n.innerHTML=e,n.firstChild},_addItem:function(t){var i,e=document.createElement("label"),n=this._map.hasLayer(t.layer);t.overlay?((i=document.createElement("input")).type="checkbox",i.className="leaflet-control-layers-selector",i.defaultChecked=n):i=this._createRadioElement("leaflet-base-layers_"+u(this),n),this._layerControlInputs.push(i),i.layerId=u(t.layer),Ei(i,"click",this._onInputClick,this);var o=document.createElement("span");o.innerHTML=" "+t.name;var s=document.createElement("div");return e.appendChild(s),s.appendChild(i),s.appendChild(o),(t.overlay?this._overlaysList:this._baseLayersList).appendChild(e),this._checkDisabledLayers(),e},_onInputClick:function(){var t,i,e=this._layerControlInputs,n=[],o=[];this._handlingClick=!0;for(var s=e.length-1;0<=s;s--)t=e[s],i=this._getLayer(t.layerId).layer,t.checked?n.push(i):t.checked||o.push(i);for(s=0;s<o.length;s++)this._map.hasLayer(o[s])&&this._map.removeLayer(o[s]);for(s=0;s<n.length;s++)this._map.hasLayer(n[s])||this._map.addLayer(n[s]);this._handlingClick=!1,this._refocusOnMap()},_checkDisabledLayers:function(){for(var t,i,e=this._layerControlInputs,n=this._map.getZoom(),o=e.length-1;0<=o;o--)t=e[o],i=this._getLayer(t.layerId).layer,t.disabled=void 0!==i.options.minZoom&&n<i.options.minZoom||void 0!==i.options.maxZoom&&n>i.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand (),this},_expand:function(){return this.expand ()},_collapse:function(){return this.collapse()}}),ie=Qi.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(t){var i="leaflet-control-zoom",e=hi("div",i+" leaflet-bar"),n=this.options;return this._zoomInButton=this._createButton(n.zoomInText,n.zoomInTitle,i+"-in",e,this._zoomIn),this._zoomOutButton=this._createButton(n.zoomOutText,n.zoomOutTitle,i+"-out",e,this._zoomOut),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),e},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(t.shiftKey?3:1))},_zoomOut:function(t){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(t,i,e,n,o){var s=hi("a",e,n);return s.innerHTML=t,s.href="#",s.title=i,s.setAttribute("role","button"),s.setAttribute("aria-label",i),Ni(s),Ei(s,"click",ji),Ei(s,"click",o,this),Ei(s,"click",this._refocusOnMap,this),s},_updateDisabled:function(){var t=this._map,i="leaflet-disabled";mi(this._zoomInButton,i),mi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMinZoom()||pi(this._zoomOutButton,i),!this._disabled&&t._zoom!==t.getMaxZoom()||pi(this._zoomInButton,i)}});Ji.mergeOptions({zoomControl:!0}),Ji.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new ie,this.addControl(this.zoomControl))});var ee=Qi.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(t){var i="leaflet-control-scale",e=hi("div",i),n=this.options;return this._addScales(n,i+"-line",e),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),e},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,i,e){t.metric&&(this._mScale=hi("div",i,e)),t.imperial&&(this._iScale=hi("div",i,e))},_update:function(){var t=this._map,i=t.getSize().y/2,e=t.distance(t.containerPointToLatLng([0,i]),t.containerPointToLatLng([this.options.maxWidth,i]));this._updateScales(e)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(t){var i=this._getRoundNum(t),e=i<1e3?i+" m":i/1e3+" km";this._updateScale(this._mScale,e,i/t)},_updateImperial:function(t){var i,e,n,o=3.2808399*t;5280<o?(i=o/5280,e=this._getRoundNum(i),this._updateScale(this._iScale,e+" mi",e/i)):(n=this._getRoundNum(o),this._updateScale(this._iScale,n+" ft",n/o))},_updateScale:function(t,i,e){t.style.width=Math.round(this.options.maxWidth*e)+"px",t.innerHTML=i},_getRoundNum:function(t){var i=Math.pow(10,(Math.floor(t)+"").length-1),e=t/i;return i*(e=10<=e?10:5<=e?5:3<=e?3:2<=e?2:1)}}),ne=Qi.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(t){p(this,t),this._attributions={}},onAdd:function(t){for(var i in(t.attributionControl=this)._container=hi("div","leaflet-control-attribution"),Ni(this._container),t._layers)t._layers[i].getAttribution&&this.addAttribution(t._layers[i].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var t=[];for(var i in this._attributions)this._attributions[i]&&t.push(i);var e=[];this.options.prefix&&e.push(this.options.prefix),t.length&&e.push(t.join(", ")),this._container.innerHTML=e.join(" | ")}}});Ji.mergeOptions({attributionControl:!0}),Ji.addInitHook(function(){this.options.attributionControl&&(new ne).addTo(this)});Qi.Layers=te,Qi.Zoom=ie,Qi.Scale=ee,Qi.Attribution=ne,$i.layers=function(t,i,e){return new te(t,i,e)},$i.zoom=function(t){return new ie(t)},$i.scale=function(t){return new ee(t)},$i.attribution=function(t){return new ne(t)};var oe=Z.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});oe.addTo=function(t,i){return t.addHandler(i,this),this};var se,re={Events:E},ae=Tt?"touchstart mousedown":"mousedown",he={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},ue={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},le=k.extend({options:{clickTolerance:3},initialize:function(t,i,e,n){p(this,n),this._element=t,this._dragStartTarget=i||t,this._preventOutline=e},enable:function(){this._enabled||(Ei(this._dragStartTarget,ae,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(le._dragging===this&&this.finishDrag(),Bi(this._dragStartTarget,ae,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(t){if(!t._simulated&&this._enabled&&(this._moved=!1,!di(this._element,"leaflet-zoom-anim")&&!(le._dragging||t.shiftKey||1!==t.which&&1!==t.button&&!t.touches||((le._dragging=this)._preventOutline&&zi(this._element),bi(),$t(),this._moving)))){this.fire("down");var i=t.touches?t.touches[0]:t,e=Ci(this._element);this._startPoint=new B(i.clientX,i.clientY),this._parentScale=Si(e),Ei(document,ue[t.type],this._onMove,this),Ei(document,he[t.type],this._onUp,this)}},_onMove:function(t){if(!t._simulated&&this._enabled)if(t.touches&&1<t.touches.length)this._moved=!0;else{var i=t.touches&&1===t.touches.length?t.touches[0]:t,e=new B(i.clientX,i.clientY)._subtract(this._startPoint);(e.x||e.y)&&(Math.abs(e.x)+Math.abs(e.y)<this.options.clickTolerance||(e.x/=this._parentScale.x,e.y/=this._parentScale.y,Di(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=Pi(this._element).subtract(e),pi(document.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),pi(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(e),this._moving=!0,C(this._animRequest),this._lastEvent=t,this._animRequest=M(this._updatePosition,this,!0)))}},_updatePosition:function(){var t={originalEvent:this._lastEvent};this.fire("predrag",t),wi(this._element,this._newPos),this.fire("drag",t)},_onUp:function(t){!t._simulated&&this._enabled&&this.finishDrag()},finishDrag:function(){for(var t in mi(document.body,"leaflet-dragging"),this._lastTarget&&(mi(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null),ue)Bi(document,ue[t],this._onMove,this),Bi(document,he[t],this._onUp,this);Ti(),Qt(),this._moved&&this._moving&&(C(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1,le._dragging=!1}});function ce(t,i){if(!i||!t.length)return t.slice();var e=i*i;return t=function(t,i){var e=t.length,n=new(typeof Uint8Array!=void 0+""?Uint8Array:Array)(e);n[0]=n[e-1]=1,function t(i,e,n,o,s){var r,a,h,u=0;for(a=o+1;a<=s-1;a++)h=fe(i[a],i[o],i[s],!0),u<h&&(r=a,u=h);n<u&&(e[r]=1,t(i,e,n,o,r),t(i,e,n,r,s))}(t,n,i,0,e-1);var o,s=[];for(o=0;o<e;o++)n[o]&&s.push(t[o]);return s}(t=function(t,i){for(var e=[t[0]],n=1,o=0,s=t.length;n<s;n++)r=t[n],a=t[o],void 0,h=a.x-r.x,u=a.y-r.y,i<h*h+u*u&&(e.push(t[n]),o=n);var r,a,h,u;o<s-1&&e.push(t[s-1]);return e}(t,e),e)}function _e(t,i,e){return Math.sqrt(fe(t,i,e,!0))}function de(t,i,e,n,o){var s,r,a,h=n?se:me(t,e),u=me(i,e);for(se=u;;){if(!(h|u))return[t,i];if(h&u)return!1;a=me(r=pe(t,i,s=h||u,e,o),e),s===h?(t=r,h=a):(i=r,u=a)}}function pe(t,i,e,n,o){var s,r,a=i.x-t.x,h=i.y-t.y,u=n.min,l=n.max;return 8&e?(s=t.x+a*(l.y-t.y)/h,r=l.y):4&e?(s=t.x+a*(u.y-t.y)/h,r=u.y):2&e?(s=l.x,r=t.y+h*(l.x-t.x)/a):1&e&&(s=u.x,r=t.y+h*(u.x-t.x)/a),new B(s,r,o)}function me(t,i){var e=0;return t.x<i.min.x?e|=1:t.x>i.max.x&&(e|=2),t.y<i.min.y?e|=4:t.y>i.max.y&&(e|=8),e}function fe(t,i,e,n){var o,s=i.x,r=i.y,a=e.x-s,h=e.y-r,u=a*a+h*h;return 0<u&&(1<(o=((t.x-s)*a+(t.y-r)*h)/u)?(s=e.x,r=e.y):0<o&&(s+=a*o,r+=h*o)),a=t.x-s,h=t.y-r,n?a*a+h*h:new B(s,r)}function ge(t){return!v(t[0])||"object"!=typeof t[0][0]&&void 0!==t[0][0]}function ve(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),ge(t)}var ye=(Object.freeze||Object)({simplify:ce,pointToSegmentDistance:_e,closestPointOnSegment:function(t,i,e){return fe(t,i,e)},clipSegment:de,_getEdgeIntersection:pe,_getBitCode:me,_sqClosestPointOnSegment:fe,isFlat:ge,_flat:ve});function xe(t,i,e){var n,o,s,r,a,h,u,l,c,_=[1,4,2,8];for(o=0,u=t.length;o<u;o++)t[o]._code=me(t[o],i);for(r=0;r<4;r++){for(l=_[r],n=[],o=0,s=(u=t.length)-1;o<u;s=o++)a=t[o],h=t[s],a._code&l?h._code&l||((c=pe(h,a,l,i,e))._code=me(c,i),n.push(c)):(h._code&l&&((c=pe(h,a,l,i,e))._code=me(c,i),n.push(c)),n.push(a));t=n}return t}var we,Pe=(Object.freeze||Object)({clipPolygon:xe}),Le={project:function(t){return new B(t.lng,t.lat)},unproject:function(t){return new j(t.y,t.x)},bounds:new O([-180,-90],[180,90])},be={R:6378137,R_MINOR:6356752.314245179,bounds:new O([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(t){var i=Math.PI/180,e=this.R,n=t.lat*i,o=this.R_MINOR/e,s=Math.sqrt(1-o*o),r=s*Math.sin(n),a=Math.tan(Math.PI/4-n/2)/Math.pow((1-r)/(1+r),s/2);return n=-e*Math.log(Math.max(a,1e-10)),new B(t.lng*i*e,n)},unproject:function(t){for(var i,e=180/Math.PI,n=this.R,o=this.R_MINOR/n,s=Math.sqrt(1-o*o),r=Math.exp(-t.y/n),a=Math.PI/2-2*Math.atan(r),h=0,u=.1;h<15&&1e-7<Math.abs(u);h++)i=s*Math.sin(a),i=Math.pow((1-i)/(1+i),s/2),a+=u=Math.PI/2-2*Math.atan(r*i)-a;return new j(a*e,t.x*e/n)}},Te=(Object.freeze||Object)({LonLat:Le,Mercator:be,SphericalMercator:q}),ze=h({},U,{code:"EPSG:3395",projection:be,transformation:(we=.5/(Math.PI*be.R),K(we,.5,-we,.5))}),Me=h({},U,{code:"EPSG:4326",projection:Le,transformation:K(1/180,1,-1/180,.5)}),Ce=h({},F,{projection:Le,transformation:K(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,i){var e=i.lng-t.lng,n=i.lat-t.lat;return Math.sqrt(e*e+n*n)},infinite:!0});F.Earth=U,F.EPSG3395=ze,F.EPSG3857=X,F.EPSG900913=J,F.EPSG4326=Me,F.Simple=Ce;var Se=k.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[u(t)]=this},removeInteractiveTarget:function(t){return delete this._map._targets[u(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var i=t.target;if(i.hasLayer(this)){if(this._map=i,this._zoomAnimated=i._zoomAnimated,this.getEvents){var e=this.getEvents();i.on(e,this),this.once("remove",function(){i.off(e,this)},this)}this.onAdd(i),this.getAttribution&&i.attributionControl&&i.attributionControl.addAttribution(this.getAttribution()),this.fire("add"),i.fire("layeradd",{layer:this})}}});Ji.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var i=u(t);return this._layers[i]||((this._layers[i]=t)._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t)),this},removeLayer:function(t){var i=u(t);return this._layers[i]&&(this._loaded&&t.onRemove(this),t.getAttribution&&this.attributionControl&&this.attributionControl.removeAttribution(t.getAttribution()),delete this._layers[i],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null),this},hasLayer:function(t){return!!t&&u(t)in this._layers},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},_addLayers:function(t){for(var i=0,e=(t=t?v(t)?t:[t]:[]).length;i<e;i++)this.addLayer(t[i])},_addZoomLimit:function(t){!isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[u(t)]=t,this._updateZoomLevels())},_removeZoomLimit:function(t){var i=u(t);this._zoomBoundLayers[i]&&(delete this._zoomBoundLayers[i],this._updateZoomLevels())},_updateZoomLevels:function(){var t=1/0,i=-1/0,e=this._getZoomSpan();for(var n in this._zoomBoundLayers){var o=this._zoomBoundLayers[n].options;t=void 0===o.minZoom?t:Math.min(t,o.minZoom),i=void 0===o.maxZoom?i:Math.max(i,o.maxZoom)}this._layersMaxZoom=i===-1/0?void 0:i,this._layersMinZoom=t===1/0?void 0:t,e!==this._getZoomSpan()&&this.fire("zoomlevelschange"),void 0===this.options.maxZoom&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Ze=Se.extend({initialize:function(t,i){var e,n;if(p(this,i),this._layers={},t)for(e=0,n=t.length;e<n;e++)this.addLayer(t[e])},addLayer:function(t){var i=this.getLayerId(t);return this._layers[i]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var i=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[i]&&this._map.removeLayer(this._layers[i]),delete this._layers[i],this},hasLayer:function(t){return!!t&&(t in this._layers||this.getLayerId(t)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(t){var i,e,n=Array.prototype.slice.call(arguments,1);for(i in this._layers)(e=this._layers[i])[t]&&e[t].apply(e,n);return this},onAdd:function(t){this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t)},eachLayer:function(t,i){for(var e in this._layers)t.call(i,this._layers[e]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];return this.eachLayer(t.push,t),t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return u(t)}}),Ee=Ze.extend({addLayer:function(t){return this.hasLayer(t)?this:(t.addEventParent(this),Ze.prototype.addLayer.call(this,t),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),t.removeEventParent(this),Ze.prototype.removeLayer.call(this,t),this.fire("layerremove",{layer:t})):this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new N;for(var i in this._layers){var e=this._layers[i];t.extend(e.getBounds?e.getBounds():e.getLatLng())}return t}}),ke=Z.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(t){p(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,i){var e=this._getIconUrl(t);if(!e){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n=this._createImg(e,i&&"IMG"===i.tagName?i:null);return this._setIconStyles(n,t),n},_setIconStyles:function(t,i){var e=this.options,n=e[i+"Size"];"number"==typeof n&&(n=[n,n]);var o=I(n),s=I("shadow"===i&&e.shadowAnchor||e.iconAnchor||o&&o.divideBy(2,!0));t.className="leaflet-marker-"+i+" "+(e.className||""),s&&(t.style.marginLeft=-s.x+"px",t.style.marginTop=-s.y+"px"),o&&(t.style.width=o.x+"px",t.style.height=o.y+"px")},_createImg:function(t,i){return(i=i||document.createElement("img")).src=t,i},_getIconUrl:function(t){return Ct&&this.options[t+"RetinaUrl"]||this.options[t+"Url"]}});var Be=ke.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(t){return Be.imagePath||(Be.imagePath=this._detectIconPath()),(this.options.imagePath||Be.imagePath)+ke.prototype._getIconUrl.call(this,t)},_detectIconPath:function(){var t=hi("div","leaflet-default-icon-path",document.body),i=ai(t,"background-image")||ai(t,"backgroundImage");return document.body.removeChild(t),i=null===i||0!==i.indexOf("url")?"":i.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}}),Ae=oe.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new le(t,t,!0)),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),pi(t,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&mi(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(t){var i=this._marker,e=i._map,n=this._marker.options.autoPanSpeed,o=this._marker.options.autoPanPadding,s=Pi(i._icon),r=e.getPixelBounds(),a=e.getPixelOrigin(),h=R(r.min._subtract(a).add(o),r.max._subtract(a).subtract(o));if(!h.contains(s)){var u=I((Math.max(h.max.x,s.x)-h.max.x)/(r.max.x-h.max.x)-(Math.min(h.min.x,s.x)-h.min.x)/(r.min.x-h.min.x),(Math.max(h.max.y,s.y)-h.max.y)/(r.max.y-h.max.y)-(Math.min(h.min.y,s.y)-h.min.y)/(r.min.y-h.min.y)).multiplyBy(n);e.panBy(u,{animate:!1}),this._draggable._newPos._add(u),this._draggable._startPos._add(u),wi(i._icon,this._draggable._newPos),this._onDrag(t),this._panRequest=M(this._adjustPan.bind(this,t))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(t){this._marker.options.autoPan&&(C(this._panRequest),this._panRequest=M(this._adjustPan.bind(this,t)))},_onDrag:function(t){var i=this._marker,e=i._shadow,n=Pi(i._icon),o=i._map.layerPointToLatLng(n);e&&wi(e,n),i._latlng=o,t.latlng=o,t.oldLatLng=this._oldLatLng,i.fire("move",t).fire("drag",t)},_onDragEnd:function(t){C(this._panRequest),delete this._oldLatLng,this._marker.fire("moveend").fire("dragend",t)}}),Ie=Se.extend({options:{icon:new Be,interactive:!0,keyboard:!0,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:!1,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(t,i){p(this,i),this._latlng=W(t)},onAdd:function(t){this._zoomAnimated=this._zoomAnimated&&t.options.markerZoomAnimation,this._zoomAnimated&&t.on("zoomanim",this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(t){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&t.off("zoomanim",this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(t){var i=this._latlng;return this._latlng=W(t),this.update(),this.fire("move",{oldLatLng:i,latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update()},getIcon:function(){return this.options.icon},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var t=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(t)}return this},_initIcon:function(){var t=this.options,i="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide"),e=t.icon.createIcon(this._icon),n=!1;e!==this._icon&&(this._icon&&this._removeIcon(),n=!0,t.title&&(e.title=t.title),"IMG"===e.tagName&&(e.alt=t.alt||"")),pi(e,i),t.keyboard&&(e.tabIndex="0"),this._icon=e,t.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex});var o=t.icon.createShadow(this._shadow),s=!1;o!==this._shadow&&(this._removeShadow(),s=!0),o&&(pi(o,i),o.alt=""),this._shadow=o,t.opacity<1&&this._updateOpacity(),n&&this.getPane().appendChild(this._icon),this._initInteraction(),o&&s&&this.getPane(t.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),ui(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&ui(this._shadow),this._shadow=null},_setPos:function(t){wi(this._icon,t),this._shadow&&wi(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(i)},_initInteraction:function(){if(this.options.interactive&&(pi(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Ae)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Ae(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&vi(this._icon,t),this._shadow&&vi(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});var Oe=Se.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return p(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),Re=Oe.extend({options:{fill:!0,radius:10},initialize:function(t,i){p(this,i),this._latlng=W(t),this._radius=this.options.radius},setLatLng:function(t){return this._latlng=W(t),this.redraw(),this.fire("move",{latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(t){var i=t&&t.radius||this._radius;return Oe.prototype.setStyle.call(this,t),this.setRadius(i),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var t=this._radius,i=this._radiusY||t,e=this._clickTolerance(),n=[t+e,i+e];this._pxBounds=new O(this._point.subtract(n),this._point.add(n))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}});var Ne=Re.extend({initialize:function(t,i,e){if("number"==typeof i&&(i=h({},e,{radius:i})),p(this,i),this._latlng=W(t),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new N(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:Oe.prototype.setStyle,_project:function(){var t=this._latlng.lng,i=this._latlng.lat,e=this._map,n=e.options.crs;if(n.distance===U.distance){var o=Math.PI/180,s=this._mRadius/U.R/o,r=e.project([i+s,t]),a=e.project([i-s,t]),h=r.add(a).divideBy(2),u=e.unproject(h).lat,l=Math.acos((Math.cos(s*o)-Math.sin(i*o)*Math.sin(u*o))/(Math.cos(i*o)*Math.cos(u*o)))/o;!isNaN(l)&&0!==l||(l=s/Math.cos(Math.PI/180*i)),this._point=h.subtract(e.getPixelOrigin()),this._radius=isNaN(l)?0:h.x-e.project([u,t-l]).x,this._radiusY=h.y-r.y}else{var c=n.unproject(n.project(this._latlng).subtract([this._mRadius,0]));this._point=e.latLngToLayerPoint(this._latlng),this._radius=this._point.x-e.latLngToLayerPoint(c).x}this._updateBounds()}});var De=Oe.extend({options:{smoothFactor:1,noClip:!1},initialize:function(t,i){p(this,i),this._setLatLngs(t)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(t){for(var i,e,n=1/0,o=null,s=fe,r=0,a=this._parts.length;r<a;r++)for(var h=this._parts[r],u=1,l=h.length;u<l;u++){var c=s(t,i=h[u-1],e=h[u],!0);c<n&&(n=c,o=s(t,i,e))}return o&&(o.distance=Math.sqrt(n)),o},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a=this._rings[0],h=a.length;if(!h)return null;for(i=t=0;t<h-1;t++)i+=a[t].distanceTo(a[t+1])/2;if(0===i)return this._map.layerPointToLatLng(a[0]);for(n=t=0;t<h-1;t++)if(o=a[t],s=a[t+1],i<(n+=e=o.distanceTo(s)))return r=(n-i)/e,this._map.layerPointToLatLng([s.x-r*(s.x-o.x),s.y-r*(s.y-o.y)])},getBounds:function(){return this._bounds},addLatLng:function(t,i){return i=i||this._defaultShape(),t=W(t),i.push(t),this._bounds.extend(t),this.redraw()},_setLatLngs:function(t){this._bounds=new N,this._latlngs=this._convertLatLngs(t)},_defaultShape:function(){return ge(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(t){for(var i=[],e=ge(t),n=0,o=t.length;n<o;n++)e?(i[n]=W(t[n]),this._bounds.extend(i[n])):i[n]=this._convertLatLngs(t[n]);return i},_project:function(){var t=new O;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,t),this._bounds.isValid()&&t.isValid()&&(this._rawPxBounds=t,this._updateBounds())},_updateBounds:function(){var t=this._clickTolerance(),i=new B(t,t);this._pxBounds=new O([this._rawPxBounds.min.subtract(i),this._rawPxBounds.max.add(i)])},_projectLatlngs:function(t,i,e){var n,o,s=t[0]instanceof j,r=t.length;if(s){for(o=[],n=0;n<r;n++)o[n]=this._map.latLngToLayerPoint(t[n]),e.extend(o[n]);i.push(o)}else for(n=0;n<r;n++)this._projectLatlngs(t[n],i,e)},_clipPoints:function(){var t=this._renderer._bounds;if(this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else{var i,e,n,o,s,r,a,h=this._parts;for(n=i=0,o=this._rings.length;i<o;i++)for(e=0,s=(a=this._rings[i]).length;e<s-1;e++)(r=de(a[e],a[e+1],t,e,!0))&&(h[n]=h[n]||[],h[n].push(r[0]),r[1]===a[e+1]&&e!==s-2||(h[n].push(r[1]),n++))}},_simplifyPoints:function(){for(var t=this._parts,i=this.options.smoothFactor,e=0,n=t.length;e<n;e++)t[e]=ce(t[e],i)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(t,i){var e,n,o,s,r,a,h=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(e=0,s=this._parts.length;e<s;e++)for(n=0,o=(r=(a=this._parts[e]).length)-1;n<r;o=n++)if((i||0!==n)&&_e(t,a[o],a[n])<=h)return!0;return!1}});De._flat=ve;var je=De.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw new Error("Must add layer to map before using getCenter()");var t,i,e,n,o,s,r,a,h,u=this._rings[0],l=u.length;if(!l)return null;for(s=r=a=0,t=0,i=l-1;t<l;i=t++)e=u[t],n=u[i],o=e.y*n.x-n.y*e.x,r+=(e.x+n.x)*o,a+=(e.y+n.y)*o,s+=3*o;return h=0===s?u[0]:[r/s,a/s],this._map.layerPointToLatLng(h)},_convertLatLngs:function(t){var i=De.prototype._convertLatLngs.call(this,t),e=i.length;return 2<=e&&i[0]instanceof j&&i[0].equals(i[e-1])&&i.pop(),i},_setLatLngs:function(t){De.prototype._setLatLngs.call(this,t),ge(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return ge(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,i=this.options.weight,e=new B(i,i);if(t=new O(t.min.subtract(e),t.max.add(e)),this._parts=[],this._pxBounds&&this._pxBounds.intersects(t))if(this.options.noClip)this._parts=this._rings;else for(var n,o=0,s=this._rings.length;o<s;o++)(n=xe(this._rings[o],t,!0)).length&&this._parts.push(n)},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(t){var i,e,n,o,s,r,a,h,u=!1;if(!this._pxBounds||!this._pxBounds.contains(t))return!1;for(o=0,a=this._parts.length;o<a;o++)for(s=0,r=(h=(i=this._parts[o]).length)-1;s<h;r=s++)e=i[s],n=i[r],e.y>t.y!=n.y>t.y&&t.x<(n.x-e.x)*(t.y-e.y)/(n.y-e.y)+e.x&&(u=!u);return u||De.prototype._containsPoint.call(this,t,!0)}});var We=Ee.extend({initialize:function(t,i){p(this,i),this._layers={},t&&this.addData(t)},addData:function(t){var i,e,n,o=v(t)?t:t.features;if(o){for(i=0,e=o.length;i<e;i++)((n=o[i]).geometries||n.geometry||n.features||n.coordinates)&&this.addData(n);return this}var s=this.options;if(s.filter&&!s.filter(t))return this;var r=He(t,s);return r?(r.feature=Ke(t),r.defaultOptions=r.options,this.resetStyle(r),s.onEachFeature&&s.onEachFeature(t,r),this.addLayer(r)):this},resetStyle:function(t){return t.options=h({},t.defaultOptions),this._setLayerStyle(t,this.options.style),this},setStyle:function(i){return this.eachLayer(function(t){this._setLayerStyle(t,i)},this)},_setLayerStyle:function(t,i){t.setStyle&&("function"==typeof i&&(i=i(t.feature)),t.setStyle(i))}});function He(t,i){var e,n,o,s,r="Feature"===t.type?t.geometry:t,a=r?r.coordinates:null,h=[],u=i&&i.pointToLayer,l=i&&i.coordsToLatLng||Fe;if(!a&&!r)return null;switch(r.type){case"Point":return e=l(a),u?u(t,e):new Ie(e);case"MultiPoint":for(o=0,s=a.length;o<s;o++)e=l(a[o]),h.push(u?u(t,e):new Ie(e));return new Ee(h);case"LineString":case"MultiLineString":return n=Ue(a,"LineString"===r.type?0:1,l),new De(n,i);case"Polygon":case"MultiPolygon":return n=Ue(a,"Polygon"===r.type?1:2,l),new je(n,i);case"GeometryCollection":for(o=0,s=r.geometries.length;o<s;o++){var c=He({geometry:r.geometries[o],type:"Feature",properties:t.properties},i);c&&h.push(c)}return new Ee(h);default:throw new Error("Invalid GeoJSON object.")}}function Fe(t){return new j(t[1],t[0],t[2])}function Ue(t,i,e){for(var n,o=[],s=0,r=t.length;s<r;s++)n=i?Ue(t[s],i-1,e):(e||Fe)(t[s]),o.push(n);return o}function Ve(t,i){return i="number"==typeof i?i:6,void 0!==t.alt?[c(t.lng,i),c(t.lat,i),c(t.alt,i)]:[c(t.lng,i),c(t.lat,i)]}function qe(t,i,e,n){for(var o=[],s=0,r=t.length;s<r;s++)o.push(i?qe(t[s],i-1,e,n):Ve(t[s],n));return!i&&e&&o.push(o[0]),o}function Ge(t,i){return t.feature?h({},t.feature,{geometry:i}):Ke(i)}function Ke(t){return"Feature"===t.type||"FeatureCollection"===t.type?t:{type:"Feature",properties:{},geometry:t}}var Ye={toGeoJSON:function(t){return Ge(this,{type:"Point",coordinates:Ve(this.getLatLng(),t)})}};function Xe(t,i){return new We(t,i)}Ie.include(Ye),Ne.include(Ye),Re.include(Ye),De.include({toGeoJSON:function(t){var i=!ge(this._latlngs);return Ge(this,{type:(i?"Multi":"")+"LineString",coordinates:qe(this._latlngs,i?1:0,!1,t)})}}),je.include({toGeoJSON:function(t){var i=!ge(this._latlngs),e=i&&!ge(this._latlngs[0]),n=qe(this._latlngs,e?2:i?1:0,!0,t);return i||(n=[n]),Ge(this,{type:(e?"Multi":"")+"Polygon",coordinates:n})}}),Ze.include({toMultiPoint:function(i){var e=[];return this.eachLayer(function(t){e.push(t.toGeoJSON(i).geometry.coordinates)}),Ge(this,{type:"MultiPoint",coordinates:e})},toGeoJSON:function(n){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if("MultiPoint"===t)return this.toMultiPoint(n);var o="GeometryCollection"===t,s=[];return this.eachLayer(function(t){if(t.toGeoJSON){var i=t.toGeoJSON(n);if(o)s.push(i.geometry);else{var e=Ke(i);"FeatureCollection"===e.type?s.push.apply(s,e.features):s.push(e)}}}),o?Ge(this,{geometries:s,type:"GeometryCollection"}):{type:"FeatureCollection",features:s}}});var Je=Xe,$e=Se.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,i,e){this._url=t,this._bounds=D(i),p(this,e)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(pi(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){ui(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&ci(this._image),this},bringToBack:function(){return this._map&&_i(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=D(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t="IMG"===this._url.tagName,i=this._image=t?this._url:hi("img");pi(i,"leaflet-image-layer"),this._zoomAnimated&&pi(i,"leaflet-zoom-animated"),this.options.className&&pi(i,this.options.className),i.onselectstart=l,i.onmousemove=l,i.onload=a(this.fire,this,"load"),i.onerror=a(this._overlayOnError,this,"error"),!this.options.crossOrigin&&""!==this.options.crossOrigin||(i.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t?this._url=i.src:(i.src=this._url,i.alt=this.options.alt)},_animateZoom:function(t){var i=this._map.getZoomScale(t.zoom),e=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;xi(this._image,e,i)},_reset:function(){var t=this._image,i=new O(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),e=i.getSize();wi(t,i.min),t.style.width=e.x+"px",t.style.height=e.y+"px"},_updateOpacity:function(){vi(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),Qe=$e.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var t="VIDEO"===this._url.tagName,i=this._image=t?this._url:hi("video");if(pi(i,"leaflet-image-layer"),this._zoomAnimated&&pi(i,"leaflet-zoom-animated"),i.onselectstart=l,i.onmousemove=l,i.onloadeddata=a(this.fire,this,"load"),t){for(var e=i.getElementsByTagName("source"),n=[],o=0;o<e.length;o++)n.push(e[o].src);this._url=0<e.length?n:[i.src]}else{v(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&i.style.hasOwnProperty("objectFit")&&(i.style.objectFit="fill"),i.autoplay=!!this.options.autoplay,i.loop=!!this.options.loop;for(var s=0;s<this._url.length;s++){var r=hi("source");r.src=this._url[s],i.appendChild(r)}}}});var tn=$e.extend({_initImage:function(){var t=this._image=this._url;pi(t,"leaflet-image-layer"),this._zoomAnimated&&pi(t,"leaflet-zoom-animated"),t.onselectstart=l,t.onmousemove=l}});var en=Se.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(t,i){p(this,t),this._source=i},onAdd:function(t){this._zoomAnimated=t._zoomAnimated,this._container||this._initLayout(),t._fadeAnimated&&vi(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),t._fadeAnimated&&vi(this._container,1),this.bringToFront()},onRemove:function(t){t._fadeAnimated?(vi(this._container,0),this._removeTimeout=setTimeout(a(ui,void 0,this._container),200)):ui(this._container)},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=W(t),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(t){return this._content=t,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility="hidden",this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility="",this._adjustPan())},getEvents:function(){var t={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&ci(this._container),this},bringToBack:function(){return this._map&&_i(this._container),this},_prepareOpen:function(t,i,e){if(i instanceof Se||(e=i,i=t),i instanceof Ee)for(var n in t._layers){i=t._layers[n];break}if(!e)if(i.getCenter)e=i.getCenter();else{if(!i.getLatLng)throw new Error("Unable to get source layer LatLng.");e=i.getLatLng()}return this._source=i,this.update(),e},_updateContent:function(){if(this._content){var t=this._contentNode,i="function"==typeof this._content?this._content(this._source||this):this._content;if("string"==typeof i)t.innerHTML=i;else{for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(i)}this.fire("contentupdate")}},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),i=I(this.options.offset),e=this._getAnchor();this._zoomAnimated?wi(this._container,t.add(e)):i=i.add(t).add(e);var n=this._containerBottom=-i.y,o=this._containerLeft=-Math.round(this._containerWidth/2)+i.x;this._container.style.bottom=n+"px",this._container.style.left=o+"px"}},_getAnchor:function(){return[0,0]}}),nn=en.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:""},openOn:function(t){return t.openPopup(this),this},onAdd:function(t){en.prototype.onAdd.call(this,t),t.fire("popupopen",{popup:this}),this._source&&(this._source.fire("popupopen",{popup:this},!0),this._source instanceof Oe||this._source.on("preclick",Oi))},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("popupclose",{popup:this}),this._source&&(this._source.fire("popupclose",{popup:this},!0),this._source instanceof Oe||this._source.off("preclick",Oi))},getEvents:function(){var t=en.prototype.getEvents.call(this);return(void 0!==this.options.closeOnClick?this.options.closeOnClick:this._map.options.closePopupOnClick)&&(t.preclick=this._close),this.options.keepInView&&(t.moveend=this._adjustPan),t},_close:function(){this._map&&this._map.closePopup(this)},_initLayout:function(){var t="leaflet-popup",i=this._container=hi("div",t+" "+(this.options.className||"")+" leaflet-zoom-animated"),e=this._wrapper=hi("div",t+"-content-wrapper",i);if(this._contentNode=hi("div",t+"-content",e),Ni(e),Ri(this._contentNode),Ei(e,"contextmenu",Oi),this._tipContainer=hi("div",t+"-tip-container",i),this._tip=hi("div",t+"-tip",this._tipContainer),this.options.closeButton){var n=this._closeButton=hi("a",t+"-close-button",i);n.href="#close",n.innerHTML="&#215;",Ei(n,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var t=this._contentNode,i=t.style;i.width="",i.whiteSpace="nowrap";var e=t.offsetWidth;e=Math.min(e,this.options.maxWidth),e=Math.max(e,this.options.minWidth),i.width=e+1+"px",i.whiteSpace="",i.height="";var n=t.offsetHeight,o=this.options.maxHeight,s="leaflet-popup-scrolled";o&&o<n?(i.height=o+"px",pi(t,s)):mi(t,s),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),e=this._getAnchor();wi(this._container,i.add(e))},_adjustPan:function(){if(this.options.autoPan){this._map._panAnim&&this._map._panAnim.stop();var t=this._map,i=parseInt(ai(this._container,"marginBottom"),10)||0,e=this._container.offsetHeight+i,n=this._containerWidth,o=new B(this._containerLeft,-e-this._containerBottom);o._add(Pi(this._container));var s=t.layerPointToContainerPoint(o),r=I(this.options.autoPanPadding),a=I(this.options.autoPanPaddingTopLeft||r),h=I(this.options.autoPanPaddingBottomRight||r),u=t.getSize(),l=0,c=0;s.x+n+h.x>u.x&&(l=s.x+n-u.x+h.x),s.x-l-a.x<0&&(l=s.x-a.x),s.y+e+h.y>u.y&&(c=s.y+e-u.y+h.y),s.y-c-a.y<0&&(c=s.y-a.y),(l||c)&&t.fire("autopanstart").panBy([l,c])}},_onCloseButtonClick:function(t){this._close(),ji(t)},_getAnchor:function(){return I(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});Ji.mergeOptions({closePopupOnClick:!0}),Ji.include({openPopup:function(t,i,e){return t instanceof nn||(t=new nn(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=t,this.addLayer(t))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Se.include({bindPopup:function(t,i){return t instanceof nn?(p(t,i),(this._popup=t)._source=this):(this._popup&&!i||(this._popup=new nn(i,this)),this._popup.setContent(t)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t,i){return this._popup&&this._map&&(i=this._popup._prepareOpen(this,t,i),this._map.openPopup(this._popup,i)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){var i=t.layer||t.target;this._popup&&this._map&&(ji(t),i instanceof Oe?this.openPopup(t.layer||t.target,t.latlng):this._map.hasLayer(this._popup)&&this._popup._source===i?this.closePopup():this.openPopup(i,t.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var on=en.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){en.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=en.prototype.getEvents.call(this);return Tt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=hi("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var i=this._map,e=this._container,n=i.latLngToContainerPoint(i.getCenter()),o=i.layerPointToContainerPoint(t),s=this.options.direction,r=e.offsetWidth,a=e.offsetHeight,h=I(this.options.offset),u=this._getAnchor();t="top"===s?t.add(I(-r/2+h.x,-a+h.y+u.y,!0)):"bottom"===s?t.subtract(I(r/2-h.x,-h.y,!0)):"center"===s?t.subtract(I(r/2+h.x,a/2-u.y+h.y,!0)):"right"===s||"auto"===s&&o.x<n.x?(s="right",t.add(I(h.x+u.x,u.y-a/2+h.y,!0))):(s="left",t.subtract(I(r+u.x-h.x,a/2-u.y-h.y,!0))),mi(e,"leaflet-tooltip-right"),mi(e,"leaflet-tooltip-left"),mi(e,"leaflet-tooltip-top"),mi(e,"leaflet-tooltip-bottom"),pi(e,"leaflet-tooltip-"+s),wi(e,t)},_updatePosition:function(){var t=this._map.latLngToLayerPoint(this._latlng);this._setPosition(t)},setOpacity:function(t){this.options.opacity=t,this._container&&vi(this._container,t)},_animateZoom:function(t){var i=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);this._setPosition(i)},_getAnchor:function(){return I(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});Ji.include({openTooltip:function(t,i,e){return t instanceof on||(t=new on(e).setContent(t)),i&&t.setLatLng(i),this.hasLayer(t)?this:this.addLayer(t)},closeTooltip:function(t){return t&&this.removeLayer(t),this}}),Se.include({bindTooltip:function(t,i){return t instanceof on?(p(t,i),(this._tooltip=t)._source=this):(this._tooltip&&!i||(this._tooltip=new on(i,this)),this._tooltip.setContent(t)),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&(this._initTooltipInteractions(!0),this.closeTooltip(),this._tooltip=null),this},_initTooltipInteractions:function(t){if(t||!this._tooltipHandlersAdded){var i=t?"off":"on",e={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?e.add=this._openTooltip:(e.mouseover=this._openTooltip,e.mouseout=this.closeTooltip,this._tooltip.options.sticky&&(e.mousemove=this._moveTooltip),Tt&&(e.click=this._openTooltip)),this[i](e),this._tooltipHandlersAdded=!t}},openTooltip:function(t,i){return this._tooltip&&this._map&&(i=this._tooltip._prepareOpen(this,t,i),this._map.openTooltip(this._tooltip,i),this._tooltip.options.interactive&&this._tooltip._container&&(pi(this._tooltip._container,"leaflet-clickable"),this.addInteractiveTarget(this._tooltip._container))),this},closeTooltip:function(){return this._tooltip&&(this._tooltip._close(),this._tooltip.options.interactive&&this._tooltip._container&&(mi(this._tooltip._container,"leaflet-clickable"),this.removeInteractiveTarget(this._tooltip._container))),this},toggleTooltip:function(t){return this._tooltip&&(this._tooltip._map?this.closeTooltip():this.openTooltip(t)),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(t){return this._tooltip&&this._tooltip.setContent(t),this},getTooltip:function(){return this._tooltip},_openTooltip:function(t){var i=t.layer||t.target;this._tooltip&&this._map&&this.openTooltip(i,this._tooltip.options.sticky?t.latlng:void 0)},_moveTooltip:function(t){var i,e,n=t.latlng;this._tooltip.options.sticky&&t.originalEvent&&(i=this._map.mouseEventToContainerPoint(t.originalEvent),e=this._map.containerPointToLayerPoint(i),n=this._map.layerPointToLatLng(e)),this._tooltip.setLatLng(n)}});var sn=ke.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:"leaflet-div-icon"},createIcon:function(t){var i=t&&"DIV"===t.tagName?t:document.createElement("div"),e=this.options;if(e.html instanceof Element?(li(i),i.appendChild(e.html)):i.innerHTML=!1!==e.html?e.html:"",e.bgPos){var n=I(e.bgPos);i.style.backgroundPosition=-n.x+"px "+-n.y+"px"}return this._setIconStyles(i,"icon"),i},createShadow:function(){return null}});ke.Default=Be;var rn=Se.extend({options:{tileSize:256,opacity:1,updateWhenIdle:xt,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:"tilePane",className:"",keepBuffer:2},initialize:function(t){p(this,t)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView(),this._update()},beforeAdd:function(t){t._addZoomLimit(this)},onRemove:function(t){this._removeAllTiles(),ui(this._container),t._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(ci(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(_i(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){return this._map&&(this._removeAllTiles(),this._update()),this},getEvents:function(){var t={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||(this._onMove=o(this._onMoveEnd,this.options.updateInterval,this)),t.move=this._onMove),this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},createTile:function(){return document.createElement("div")},getTileSize:function(){var t=this.options.tileSize;return t instanceof B?t:new B(t,t)},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t){for(var i,e=this.getPane().children,n=-t(-1/0,1/0),o=0,s=e.length;o<s;o++)i=e[o].style.zIndex,e[o]!==this._container&&i&&(n=t(n,+i));isFinite(n)&&(this.options.zIndex=n+t(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!et){vi(this._container,this.options.opacity);var t=+new Date,i=!1,e=!1;for(var n in this._tiles){var o=this._tiles[n];if(o.current&&o.loaded){var s=Math.min(1,(t-o.loaded)/200);vi(o.el,s),s<1?i=!0:(o.active?e=!0:this._onOpaqueTile(o),o.active=!0)}}e&&!this._noPrune&&this._pruneTiles(),i&&(C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this))}},_onOpaqueTile:l,_initContainer:function(){this._container||(this._container=hi("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var t=this._tileZoom,i=this.options.maxZoom;if(void 0!==t){for(var e in this._levels)this._levels[e].el.children.length||e===t?(this._levels[e].el.style.zIndex=i-Math.abs(t-e),this._onUpdateLevel(e)):(ui(this._levels[e].el),this._removeTilesAtZoom(e),this._onRemoveLevel(e),delete this._levels[e]);var n=this._levels[t],o=this._map;return n||((n=this._levels[t]={}).el=hi("div","leaflet-tile-container leaflet-zoom-animated",this._container),n.el.style.zIndex=i,n.origin=o.project(o.unproject(o.getPixelOrigin()),t).round(),n.zoom=t,this._setZoomTransform(n,o.getCenter(),o.getZoom()),n.el.offsetWidth,this._onCreateLevel(n)),this._level=n}},_onUpdateLevel:l,_onRemoveLevel:l,_onCreateLevel:l,_pruneTiles:function(){if(this._map){var t,i,e=this._map.getZoom();if(e>this.options.maxZoom||e<this.options.minZoom)this._removeAllTiles();else{for(t in this._tiles)(i=this._tiles[t]).retain=i.current;for(t in this._tiles)if((i=this._tiles[t]).current&&!i.active){var n=i.coords;this._retainParent(n.x,n.y,n.z,n.z-5)||this._retainChildren(n.x,n.y,n.z,n.z+2)}for(t in this._tiles)this._tiles[t].retain||this._removeTile(t)}}},_removeTilesAtZoom:function(t){for(var i in this._tiles)this._tiles[i].coords.z===t&&this._removeTile(i)},_removeAllTiles:function(){for(var t in this._tiles)this._removeTile(t)},_invalidateAll:function(){for(var t in this._levels)ui(this._levels[t].el),this._onRemoveLevel(t),delete this._levels[t];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(t,i,e,n){var o=Math.floor(t/2),s=Math.floor(i/2),r=e-1,a=new B(+o,+s);a.z=+r;var h=this._tileCoordsToKey(a),u=this._tiles[h];return u&&u.active?u.retain=!0:(u&&u.loaded&&(u.retain=!0),n<r&&this._retainParent(o,s,r,n))},_retainChildren:function(t,i,e,n){for(var o=2*t;o<2*t+2;o++)for(var s=2*i;s<2*i+2;s++){var r=new B(o,s);r.z=e+1;var a=this._tileCoordsToKey(r),h=this._tiles[a];h&&h.active?h.retain=!0:(h&&h.loaded&&(h.retain=!0),e+1<n&&this._retainChildren(o,s,e+1,n))}},_resetView:function(t){var i=t&&(t.pinch||t.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),i,i)},_animateZoom:function(t){this._setView(t.center,t.zoom,!0,t.noUpdate)},_clampZoom:function(t){var i=this.options;return void 0!==i.minNativeZoom&&t<i.minNativeZoom?i.minNativeZoom:void 0!==i.maxNativeZoom&&i.maxNativeZoom<t?i.maxNativeZoom:t},_setView:function(t,i,e,n){var o=this._clampZoom(Math.round(i));(void 0!==this.options.maxZoom&&o>this.options.maxZoom||void 0!==this.options.minZoom&&o<this.options.minZoom)&&(o=void 0);var s=this.options.updateWhenZooming&&o!==this._tileZoom;n&&!s||(this._tileZoom=o,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),void 0!==o&&this._update(t),e||this._pruneTiles(),this._noPrune=!!e),this._setZoomTransforms(t,i)},_setZoomTransforms:function(t,i){for(var e in this._levels)this._setZoomTransform(this._levels[e],t,i)},_setZoomTransform:function(t,i,e){var n=this._map.getZoomScale(e,t.zoom),o=t.origin.multiplyBy(n).subtract(this._map._getNewPixelOrigin(i,e)).round();yt?xi(t.el,o,n):wi(t.el,o)},_resetGrid:function(){var t=this._map,i=t.options.crs,e=this._tileSize=this.getTileSize(),n=this._tileZoom,o=this._map.getPixelWorldBounds(this._tileZoom);o&&(this._globalTileRange=this._pxBoundsToTileRange(o)),this._wrapX=i.wrapLng&&!this.options.noWrap&&[Math.floor(t.project([0,i.wrapLng[0]],n).x/e.x),Math.ceil(t.project([0,i.wrapLng[1]],n).x/e.y)],this._wrapY=i.wrapLat&&!this.options.noWrap&&[Math.floor(t.project([i.wrapLat[0],0],n).y/e.x),Math.ceil(t.project([i.wrapLat[1],0],n).y/e.y)]},_onMoveEnd:function(){this._map&&!this._map._animatingZoom&&this._update()},_getTiledPixelBounds:function(t){var i=this._map,e=i._animatingZoom?Math.max(i._animateToZoom,i.getZoom()):i.getZoom(),n=i.getZoomScale(e,this._tileZoom),o=i.project(t,this._tileZoom).floor(),s=i.getSize().divideBy(2*n);return new O(o.subtract(s),o.add(s))},_update:function(t){var i=this._map;if(i){var e=this._clampZoom(i.getZoom());if(void 0===t&&(t=i.getCenter()),void 0!==this._tileZoom){var n=this._getTiledPixelBounds(t),o=this._pxBoundsToTileRange(n),s=o.getCenter(),r=[],a=this.options.keepBuffer,h=new O(o.getBottomLeft().subtract([a,-a]),o.getTopRight().add([a,-a]));if(!(isFinite(o.min.x)&&isFinite(o.min.y)&&isFinite(o.max.x)&&isFinite(o.max.y)))throw new Error("Attempted to load an infinite number of tiles");for(var u in this._tiles){var l=this._tiles[u].coords;l.z===this._tileZoom&&h.contains(new B(l.x,l.y))||(this._tiles[u].current=!1)}if(1<Math.abs(e-this._tileZoom))this._setView(t,e);else{for(var c=o.min.y;c<=o.max.y;c++)for(var _=o.min.x;_<=o.max.x;_++){var d=new B(_,c);if(d.z=this._tileZoom,this._isValidTile(d)){var p=this._tiles[this._tileCoordsToKey(d)];p?p.current=!0:r.push(d)}}if(r.sort(function(t,i){return t.distanceTo(s)-i.distanceTo(s)}),0!==r.length){this._loading||(this._loading=!0,this.fire("loading"));var m=document.createDocumentFragment();for(_=0;_<r.length;_++)this._addTile(r[_],m);this._level.el.appendChild(m)}}}}},_isValidTile:function(t){var i=this._map.options.crs;if(!i.infinite){var e=this._globalTileRange;if(!i.wrapLng&&(t.x<e.min.x||t.x>e.max.x)||!i.wrapLat&&(t.y<e.min.y||t.y>e.max.y))return!1}if(!this.options.bounds)return!0;var n=this._tileCoordsToBounds(t);return D(this.options.bounds).overlaps(n)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var i=this._map,e=this.getTileSize(),n=t.scaleBy(e),o=n.add(e);return[i.unproject(n,t.z),i.unproject(o,t.z)]},_tileCoordsToBounds:function(t){var i=this._tileCoordsToNwSe(t),e=new N(i[0],i[1]);return this.options.noWrap||(e=this._map.wrapLatLngBounds(e)),e},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var i=t.split(":"),e=new B(+i[0],+i[1]);return e.z=+i[2],e},_removeTile:function(t){var i=this._tiles[t];i&&(ui(i.el),delete this._tiles[t],this.fire("tileunload",{tile:i.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){pi(t,"leaflet-tile");var i=this.getTileSize();t.style.width=i.x+"px",t.style.height=i.y+"px",t.onselectstart=l,t.onmousemove=l,et&&this.options.opacity<1&&vi(t,this.options.opacity),st&&!rt&&(t.style.WebkitBackfaceVisibility="hidden")},_addTile:function(t,i){var e=this._getTilePos(t),n=this._tileCoordsToKey(t),o=this.createTile(this._wrapCoords(t),a(this._tileReady,this,t));this._initTile(o),this.createTile.length<2&&M(a(this._tileReady,this,t,null,o)),wi(o,e),this._tiles[n]={el:o,coords:t,current:!0},i.appendChild(o),this.fire("tileloadstart",{tile:o,coords:t})},_tileReady:function(t,i,e){i&&this.fire("tileerror",{error:i,tile:e,coords:t});var n=this._tileCoordsToKey(t);(e=this._tiles[n])&&(e.loaded=+new Date,this._map._fadeAnimated?(vi(e.el,0),C(this._fadeFrame),this._fadeFrame=M(this._updateOpacity,this)):(e.active=!0,this._pruneTiles()),i||(pi(e.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:e.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),et||!this._map._fadeAnimated?M(this._pruneTiles,this):setTimeout(a(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var i=new B(this._wrapX?r(t.x,this._wrapX):t.x,this._wrapY?r(t.y,this._wrapY):t.y);return i.z=t.z,i},_pxBoundsToTileRange:function(t){var i=this.getTileSize();return new O(t.min.unscaleBy(i).floor(),t.max.unscaleBy(i).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});var an=rn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(t,i){this._url=t,(i=p(this,i)).detectRetina&&Ct&&0<i.maxZoom&&(i.tileSize=Math.floor(i.tileSize/2),i.zoomReverse?(i.zoomOffset--,i.minZoom++):(i.zoomOffset++,i.maxZoom--),i.minZoom=Math.max(0,i.minZoom)),"string"==typeof i.subdomains&&(i.subdomains=i.subdomains.split("")),st||this.on("tileunload",this._onTileRemove)},setUrl:function(t,i){return this._url===t&&void 0===i&&(i=!0),this._url=t,i||this.redraw(),this},createTile:function(t,i){var e=document.createElement("img");return Ei(e,"load",a(this._tileOnLoad,this,i,e)),Ei(e,"error",a(this._tileOnError,this,i,e)),!this.options.crossOrigin&&""!==this.options.crossOrigin||(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),e.alt="",e.setAttribute("role","presentation"),e.src=this.getTileUrl(t),e},getTileUrl:function(t){var i={r:Ct?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var e=this._globalTileRange.max.y-t.y;this.options.tms&&(i.y=e),i["-y"]=e}return g(this._url,h(i,this.options))},_tileOnLoad:function(t,i){et?setTimeout(a(t,this,null,i),0):t(null,i)},_tileOnError:function(t,i,e){var n=this.options.errorTileUrl;n&&i.getAttribute("src")!==n&&(i.src=n),t(e,i)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,i=this.options.maxZoom;return this.options.zoomReverse&&(t=i-t),t+this.options.zoomOffset},_getSubdomain:function(t){var i=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[i]},_abortLoading:function(){var t,i;for(t in this._tiles)this._tiles[t].coords.z!==this._tileZoom&&((i=this._tiles[t].el).onload=l,i.onerror=l,i.complete||(i.src=x,ui(i),delete this._tiles[t]))},_removeTile:function(t){var i=this._tiles[t];if(i)return ht||i.el.setAttribute("src",x),rn.prototype._removeTile.call(this,t)},_tileReady:function(t,i,e){if(this._map&&(!e||e.getAttribute("src")!==x))return rn.prototype._tileReady.call(this,t,i,e)}});function hn(t,i){return new an(t,i)}var un=an.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,i){this._url=t;var e=h({},this.defaultWmsParams);for(var n in i)n in this.options||(e[n]=i[n]);var o=(i=p(this,i)).detectRetina&&Ct?2:1,s=this.getTileSize();e.width=s.x*o,e.height=s.y*o,this.wmsParams=e},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var i=1.3<=this._wmsVersion?"crs":"srs";this.wmsParams[i]=this._crs.code,an.prototype.onAdd.call(this,t)},getTileUrl:function(t){var i=this._tileCoordsToNwSe(t),e=this._crs,n=R(e.project(i[0]),e.project(i[1])),o=n.min,s=n.max,r=(1.3<=this._wmsVersion&&this._crs===Me?[o.y,o.x,s.y,s.x]:[o.x,o.y,s.x,s.y]).join(","),a=an.prototype.getTileUrl.call(this,t);return a+m(this.wmsParams,a,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+r},setParams:function(t,i){return h(this.wmsParams,t),i||this.redraw(),this}});an.WMS=un,hn.wms=function(t,i){return new un(t,i)};var ln=Se.extend({options:{padding:.1,tolerance:0},initialize:function(t){p(this,t),u(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),this._zoomAnimated&&pi(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,i){var e=this._map.getZoomScale(i,this._zoom),n=Pi(this._container),o=this._map.getSize().multiplyBy(.5+this.options.padding),s=this._map.project(this._center,i),r=this._map.project(t,i).subtract(s),a=o.multiplyBy(-e).add(n).add(o).subtract(r);yt?xi(this._container,a,e):wi(this._container,a)},_reset:function(){for(var t in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,i=this._map.getSize(),e=this._map.containerPointToLayerPoint(i.multiplyBy(-t)).round();this._bounds=new O(e,e.add(i.multiplyBy(1+2*t)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),cn=ln.extend({getEvents:function(){var t=ln.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ln.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");Ei(t,"mousemove",o(this._onMouseMove,32,this),this),Ei(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),Ei(t,"mouseout",this._handleMouseOut,this),this._ctx=t.getContext("2d")},_destroyContainer:function(){C(this._redrawRequest),delete this._ctx,ui(this._container),Bi(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){for(var t in this._redrawBounds=null,this._layers)this._layers[t]._update();this._redraw()}},_update:function(){if(!this._map._animatingZoom||!this._bounds){ln.prototype._update.call(this);var t=this._bounds,i=this._container,e=t.getSize(),n=Ct?2:1;wi(i,t.min),i.width=n*e.x,i.height=n*e.y,i.style.width=e.x+"px",i.style.height=e.y+"px",Ct&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){ln.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t);var i=(this._layers[u(t)]=t)._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=i),this._drawLast=i,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var i=t._order,e=i.next,n=i.prev;e?e.prev=n:this._drawLast=n,n?n.next=e:this._drawFirst=e,delete t._order,delete this._layers[u(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if("string"==typeof t.options.dashArray){var i,e,n=t.options.dashArray.split(/[, ]+/),o=[];for(e=0;e<n.length;e++){if(i=Number(n[e]),isNaN(i))return;o.push(i)}t.options._dashArray=o}else t.options._dashArray=t.options.dashArray},_requestRedraw:function(t){this._map&&(this._extendRedrawBounds(t),this._redrawRequest=this._redrawRequest||M(this._redraw,this))},_extendRedrawBounds:function(t){if(t._pxBounds){var i=(t.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new O,this._redrawBounds.extend(t._pxBounds.min.subtract([i,i])),this._redrawBounds.extend(t._pxBounds.max.add([i,i]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var t=this._redrawBounds;if(t){var i=t.getSize();this._ctx.clearRect(t.min.x,t.min.y,i.x,i.y)}else this._ctx.clearRect(0,0,this._container.width,this._container.height)},_draw:function(){var t,i=this._redrawBounds;if(this._ctx.save(),i){var e=i.getSize();this._ctx.beginPath(),this._ctx.rect(i.min.x,i.min.y,e.x,e.y),this._ctx.clip()}this._drawing=!0;for(var n=this._drawFirst;n;n=n.next)t=n.layer,(!i||t._pxBounds&&t._pxBounds.intersects(i))&&t._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(t,i){if(this._drawing){var e,n,o,s,r=t._parts,a=r.length,h=this._ctx;if(a){for(h.beginPath(),e=0;e<a;e++){for(n=0,o=r[e].length;n<o;n++)s=r[e][n],h[n?"lineTo":"moveTo"](s.x,s.y);i&&h.closePath()}this._fillStroke(h,t)}}},_updateCircle:function(t){if(this._drawing&&!t._empty()){var i=t._point,e=this._ctx,n=Math.max(Math.round(t._radius),1),o=(Math.max(Math.round(t._radiusY),1)||n)/n;1!=o&&(e.save(),e.scale(1,o)),e.beginPath(),e.arc(i.x,i.y/o,n,0,2*Math.PI,!1),1!=o&&e.restore(),this._fillStroke(e,t)}},_fillStroke:function(t,i){var e=i.options;e.fill&&(t.globalAlpha=e.fillOpacity,t.fillStyle=e.fillColor||e.color,t.fill(e.fillRule||"evenodd")),e.stroke&&0!==e.weight&&(t.setLineDash&&t.setLineDash(i.options&&i.options._dashArray||[]),t.globalAlpha=e.opacity,t.lineWidth=e.weight,t.strokeStyle=e.color,t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.stroke())},_onClick:function(t){for(var i,e,n=this._map.mouseEventToLayerPoint(t),o=this._drawFirst;o;o=o.next)(i=o.layer).options.interactive&&i._containsPoint(n)&&!this._map._draggableMoved(i)&&(e=i);e&&(qi(t),this._fireEvent([e],t))},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var i=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,i)}},_handleMouseOut:function(t){var i=this._hoveredLayer;i&&(mi(this._container,"leaflet-interactive"),this._fireEvent([i],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,i){for(var e,n,o=this._drawFirst;o;o=o.next)(e=o.layer).options.interactive&&e._containsPoint(i)&&(n=e);n!==this._hoveredLayer&&(this._handleMouseOut(t),n&&(pi(this._container,"leaflet-interactive"),this._fireEvent([n],t,"mouseover"),this._hoveredLayer=n)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,i,e){this._map._fireDOMEvent(i,e||i.type,t)},_bringToFront:function(t){var i=t._order;if(i){var e=i.next,n=i.prev;e&&((e.prev=n)?n.next=e:e&&(this._drawFirst=e),i.prev=this._drawLast,(this._drawLast.next=i).next=null,this._drawLast=i,this._requestRedraw(t))}},_bringToBack:function(t){var i=t._order;if(i){var e=i.next,n=i.prev;n&&((n.next=e)?e.prev=n:n&&(this._drawLast=n),i.prev=null,i.next=this._drawFirst,this._drawFirst.prev=i,this._drawFirst=i,this._requestRedraw(t))}}});function _n(t){return St?new cn(t):null}var dn=function(){try{return document.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return document.createElement("<lvml:"+t+' class="lvml">')}}catch(t){return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),pn={_initContainer:function(){this._container=hi("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ln.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var i=t._container=dn("shape");pi(i,"leaflet-vml-shape "+(this.options.className||"")),i.coordsize="1 1",t._path=dn("path"),i.appendChild(t._path),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){var i=t._container;this._container.appendChild(i),t.options.interactive&&t.addInteractiveTarget(i)},_removePath:function(t){var i=t._container;ui(i),t.removeInteractiveTarget(i),delete this._layers[u(t)]},_updateStyle:function(t){var i=t._stroke,e=t._fill,n=t.options,o=t._container;o.stroked=!!n.stroke,o.filled=!!n.fill,n.stroke?(i||(i=t._stroke=dn("stroke")),o.appendChild(i),i.weight=n.weight+"px",i.color=n.color,i.opacity=n.opacity,n.dashArray?i.dashStyle=v(n.dashArray)?n.dashArray.join(" "):n.dashArray.replace(/( *, *)/g," "):i.dashStyle="",i.endcap=n.lineCap.replace("butt","flat"),i.joinstyle=n.lineJoin):i&&(o.removeChild(i),t._stroke=null),n.fill?(e||(e=t._fill=dn("fill")),o.appendChild(e),e.color=n.fillColor||n.color,e.opacity=n.fillOpacity):e&&(o.removeChild(e),t._fill=null)},_updateCircle:function(t){var i=t._point.round(),e=Math.round(t._radius),n=Math.round(t._radiusY||e);this._setPath(t,t._empty()?"M0 0":"AL "+i.x+","+i.y+" "+e+","+n+" 0,23592600")},_setPath:function(t,i){t._path.v=i},_bringToFront:function(t){ci(t._container)},_bringToBack:function(t){_i(t._container)}},mn=Et?dn:$,fn=ln.extend({getEvents:function(){var t=ln.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=mn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=mn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){ui(this._container),Bi(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){ln.prototype._update.call(this);var t=this._bounds,i=t.getSize(),e=this._container;this._svgSize&&this._svgSize.equals(i)||(this._svgSize=i,e.setAttribute("width",i.x),e.setAttribute("height",i.y)),wi(e,t.min),e.setAttribute("viewBox",[t.min.x,t.min.y,i.x,i.y].join(" ")),this.fire("update")}},_initPath:function(t){var i=t._path=mn("path");t.options.className&&pi(i,t.options.className),t.options.interactive&&pi(i,"leaflet-interactive"),this._updateStyle(t),this._layers[u(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){ui(t._path),t.removeInteractiveTarget(t._path),delete this._layers[u(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var i=t._path,e=t.options;i&&(e.stroke?(i.setAttribute("stroke",e.color),i.setAttribute("stroke-opacity",e.opacity),i.setAttribute("stroke-width",e.weight),i.setAttribute("stroke-linecap",e.lineCap),i.setAttribute("stroke-linejoin",e.lineJoin),e.dashArray?i.setAttribute("stroke-dasharray",e.dashArray):i.removeAttribute("stroke-dasharray"),e.dashOffset?i.setAttribute("stroke-dashoffset",e.dashOffset):i.removeAttribute("stroke-dashoffset")):i.setAttribute("stroke","none"),e.fill?(i.setAttribute("fill",e.fillColor||e.color),i.setAttribute("fill-opacity",e.fillOpacity),i.setAttribute("fill-rule",e.fillRule||"evenodd")):i.setAttribute("fill","none"))},_updatePoly:function(t,i){this._setPath(t,Q(t._parts,i))},_updateCircle:function(t){var i=t._point,e=Math.max(Math.round(t._radius),1),n="a"+e+","+(Math.max(Math.round(t._radiusY),1)||e)+" 0 1,0 ",o=t._empty()?"M0 0":"M"+(i.x-e)+","+i.y+n+2*e+",0 "+n+2*-e+",0 ";this._setPath(t,o)},_setPath:function(t,i){t._path.setAttribute("d",i)},_bringToFront:function(t){ci(t._path)},_bringToBack:function(t){_i(t._path)}});function gn(t){return Zt||Et?new fn(t):null}Et&&fn.include(pn),Ji.include({getRenderer:function(t){var i=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return i||(i=this._renderer=this._createRenderer()),this.hasLayer(i)||this.addLayer(i),i},_getPaneRenderer:function(t){if("overlayPane"===t||void 0===t)return!1;var i=this._paneRenderers[t];return void 0===i&&(i=this._createRenderer({pane:t}),this._paneRenderers[t]=i),i},_createRenderer:function(t){return this.options.preferCanvas&&_n(t)||gn(t)}});var vn=je.extend({initialize:function(t,i){je.prototype.initialize.call(this,this._boundsToLatLngs(t),i)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=D(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});fn.create=mn,fn.pointsToPath=Q,We.geometryToLayer=He,We.coordsToLatLng=Fe,We.coordsToLatLngs=Ue,We.latLngToCoords=Ve,We.latLngsToCoords=qe,We.getFeature=Ge,We.asFeature=Ke,Ji.mergeOptions({boxZoom:!0});var yn=oe.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){Ei(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){Bi(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){ui(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||1!==t.which&&1!==t.button)return!1;this._clearDeferredResetState(),this._resetState(),$t(),bi(),this._startPoint=this._map.mouseEventToContainerPoint(t),Ei(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=hi("div","leaflet-zoom-box",this._container),pi(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var i=new O(this._point,this._startPoint),e=i.getSize();wi(this._box,i.min),this._box.style.width=e.x+"px",this._box.style.height=e.y+"px"},_finish:function(){this._moved&&(ui(this._box),mi(this._container,"leaflet-crosshair")),Qt(),Ti(),Bi(document,{contextmenu:ji,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if((1===t.which||1===t.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(a(this._resetState,this),0);var i=new N(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(i).fire("boxzoomend",{boxZoomBounds:i})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});Ji.addInitHook("addHandler","boxZoom",yn),Ji.mergeOptions({doubleClickZoom:!0});var xn=oe.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var i=this._map,e=i.getZoom(),n=i.options.zoomDelta,o=t.originalEvent.shiftKey?e-n:e+n;"center"===i.options.doubleClickZoom?i.setZoom(o):i.setZoomAround(t.containerPoint,o)}});Ji.addInitHook("addHandler","doubleClickZoom",xn),Ji.mergeOptions({dragging:!0,inertia:!rt,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var wn=oe.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new le(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}pi(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){mi(this._map._container,"leaflet-grab"),mi(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var i=D(this._map.options.maxBounds);this._offsetLimit=R(this._map.latLngToContainerPoint(i.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(i.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var i=this._lastTime=+new Date,e=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(e),this._times.push(i),this._prunePositions(i)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;1<this._positions.length&&50<t-this._times[0];)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),i=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=i.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,i){return t-(t-i)*this._viscosity},_onPreDragLimit:function(){if(this._viscosity&&this._offsetLimit){var t=this._draggable._newPos.subtract(this._draggable._startPos),i=this._offsetLimit;t.x<i.min.x&&(t.x=this._viscousLimit(t.x,i.min.x)),t.y<i.min.y&&(t.y=this._viscousLimit(t.y,i.min.y)),t.x>i.max.x&&(t.x=this._viscousLimit(t.x,i.max.x)),t.y>i.max.y&&(t.y=this._viscousLimit(t.y,i.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,i=Math.round(t/2),e=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-i+e)%t+i-e,s=(n+i+e)%t-i-e,r=Math.abs(o+e)<Math.abs(s+e)?o:s;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=r},_onDragEnd:function(t){var i=this._map,e=i.options,n=!e.inertia||this._times.length<2;if(i.fire("dragend",t),n)i.fire("moveend");else{this._prunePositions(+new Date);var o=this._lastPos.subtract(this._positions[0]),s=(this._lastTime-this._times[0])/1e3,r=e.easeLinearity,a=o.multiplyBy(r/s),h=a.distanceTo([0,0]),u=Math.min(e.inertiaMaxSpeed,h),l=a.multiplyBy(u/h),c=u/(e.inertiaDeceleration*r),_=l.multiplyBy(-c/2).round();_.x||_.y?(_=i._limitOffset(_,i.options.maxBounds),M(function(){i.panBy(_,{duration:c,easeLinearity:r,noMoveStart:!0,animate:!0})})):i.fire("moveend")}}});Ji.addInitHook("addHandler","dragging",wn),Ji.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Pn=oe.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;t.tabIndex<=0&&(t.tabIndex="0"),Ei(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Bi(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var t=document.body,i=document.documentElement,e=t.scrollTop||i.scrollTop,n=t.scrollLeft||i.scrollLeft;this._map._container.focus(),window.scrollTo(n,e)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(t){var i,e,n=this._panKeys={},o=this.keyCodes;for(i=0,e=o.left.length;i<e;i++)n[o.left[i]]=[-1*t,0];for(i=0,e=o.right.length;i<e;i++)n[o.right[i]]=[t,0];for(i=0,e=o.down.length;i<e;i++)n[o.down[i]]=[0,t];for(i=0,e=o.up.length;i<e;i++)n[o.up[i]]=[0,-1*t]},_setZoomDelta:function(t){var i,e,n=this._zoomKeys={},o=this.keyCodes;for(i=0,e=o.zoomIn.length;i<e;i++)n[o.zoomIn[i]]=t;for(i=0,e=o.zoomOut.length;i<e;i++)n[o.zoomOut[i]]=-t},_addHooks:function(){Ei(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){Bi(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var i,e=t.keyCode,n=this._map;if(e in this._panKeys)n._panAnim&&n._panAnim._inProgress||(i=this._panKeys[e],t.shiftKey&&(i=I(i).multiplyBy(3)),n.panBy(i),n.options.maxBounds&&n.panInsideBounds(n.options.maxBounds));else if(e in this._zoomKeys)n.setZoom(n.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[e]);else{if(27!==e||!n._popup||!n._popup.options.closeOnEscapeKey)return;n.closePopup()}ji(t)}}});Ji.addInitHook("addHandler","keyboard",Pn),Ji.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var Ln=oe.extend({addHooks:function(){Ei(this._map._container,"mousewheel",this._onWheelScroll,this),this._delta=0},removeHooks:function(){Bi(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(t){var i=Fi(t),e=this._map.options.wheelDebounceTime;this._delta+=i,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var n=Math.max(e-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(a(this._performZoom,this),n),ji(t)},_performZoom:function(){var t=this._map,i=t.getZoom(),e=this._map.options.zoomSnap||0;t._stop();var n=this._delta/(4*this._map.options.wheelPxPerZoomLevel),o=4*Math.log(2/(1+Math.exp(-Math.abs(n))))/Math.LN2,s=e?Math.ceil(o/e)*e:o,r=t._limitZoom(i+(0<this._delta?s:-s))-i;this._delta=0,this._startTime=null,r&&("center"===t.options.scrollWheelZoom?t.setZoom(i+r):t.setZoomAround(this._lastMousePos,i+r))}});Ji.addInitHook("addHandler","scrollWheelZoom",Ln),Ji.mergeOptions({tap:!0,tapTolerance:15});var bn=oe.extend({addHooks:function(){Ei(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){Bi(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(Di(t),this._fireClick=!0,1<t.touches.length)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=t.touches[0],e=i.target;this._startPos=this._newPos=new B(i.clientX,i.clientY),e.tagName&&"a"===e.tagName.toLowerCase()&&pi(e,"leaflet-active"),this._holdTimeout=setTimeout(a(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),this._simulateEvent("mousedown",i),Ei(document,{touchmove:this._onMove,touchend:this._onUp},this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),Bi(document,{touchmove:this._onMove,touchend:this._onUp},this),this._fireClick&&t&&t.changedTouches){var i=t.changedTouches[0],e=i.target;e&&e.tagName&&"a"===e.tagName.toLowerCase()&&mi(e,"leaflet-active"),this._simulateEvent("mouseup",i),this._isTapValid()&&this._simulateEvent("click",i)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var i=t.touches[0];this._newPos=new B(i.clientX,i.clientY),this._simulateEvent("mousemove",i)},_simulateEvent:function(t,i){var e=document.createEvent("MouseEvents");e._simulated=!0,i.target._simulatedClick=!0,e.initMouseEvent(t,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),i.target.dispatchEvent(e)}});Tt&&!bt&&Ji.addInitHook("addHandler","tap",bn),Ji.mergeOptions({touchZoom:Tt&&!rt,bounceAtZoomLimits:!0});var Tn=oe.extend({addHooks:function(){pi(this._map._container,"leaflet-touch-zoom"),Ei(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){mi(this._map._container,"leaflet-touch-zoom"),Bi(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var i=this._map;if(t.touches&&2===t.touches.length&&!i._animatingZoom&&!this._zooming){var e=i.mouseEventToContainerPoint(t.touches[0]),n=i.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=i.getSize()._divideBy(2),this._startLatLng=i.containerPointToLatLng(this._centerPoint),"center"!==i.options.touchZoom&&(this._pinchStartLatLng=i.containerPointToLatLng(e.add(n)._divideBy(2))),this._startDist=e.distanceTo(n),this._startZoom=i.getZoom(),this._moved=!1,this._zooming=!0,i._stop(),Ei(document,"touchmove",this._onTouchMove,this),Ei(document,"touchend",this._onTouchEnd,this),Di(t)}},_onTouchMove:function(t){if(t.touches&&2===t.touches.length&&this._zooming){var i=this._map,e=i.mouseEventToContainerPoint(t.touches[0]),n=i.mouseEventToContainerPoint(t.touches[1]),o=e.distanceTo(n)/this._startDist;if(this._zoom=i.getScaleZoom(o,this._startZoom),!i.options.bounceAtZoomLimits&&(this._zoom<i.getMinZoom()&&o<1||this._zoom>i.getMaxZoom()&&1<o)&&(this._zoom=i._limitZoom(this._zoom)),"center"===i.options.touchZoom){if(this._center=this._startLatLng,1==o)return}else{var s=e._add(n)._divideBy(2)._subtract(this._centerPoint);if(1==o&&0===s.x&&0===s.y)return;this._center=i.unproject(i.project(this._pinchStartLatLng,this._zoom).subtract(s),this._zoom)}this._moved||(i._moveStart(!0,!1),this._moved=!0),C(this._animRequest);var r=a(i._move,i,this._center,this._zoom,{pinch:!0,round:!1});this._animRequest=M(r,this,!0),Di(t)}},_onTouchEnd:function(){this._moved&&this._zooming?(this._zooming=!1,C(this._animRequest),Bi(document,"touchmove",this._onTouchMove),Bi(document,"touchend",this._onTouchEnd),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))):this._zooming=!1}});Ji.addInitHook("addHandler","touchZoom",Tn),Ji.BoxZoom=yn,Ji.DoubleClickZoom=xn,Ji.Drag=wn,Ji.Keyboard=Pn,Ji.ScrollWheelZoom=Ln,Ji.Tap=bn,Ji.TouchZoom=Tn,Object.freeze=i,t.version="1.5.1+HEAD.2e3e0ff",t.Control=Qi,t.control=$i,t.Browser=Bt,t.Evented=k,t.Mixin=re,t.Util=S,t.Class=Z,t.Handler=oe,t.extend=h,t.bind=a,t.stamp=u,t.setOptions=p,t.DomEvent=Yi,t.DomUtil=Zi,t.PosAnimation=Xi,t.Draggable=le,t.LineUtil=ye,t.PolyUtil=Pe,t.Point=B,t.point=I,t.Bounds=O,t.bounds=R,t.Transformation=G,t.transformation=K,t.Projection=Te,t.LatLng=j,t.latLng=W,t.LatLngBounds=N,t.latLngBounds=D,t.CRS=F,t.GeoJSON=We,t.geoJSON=Xe,t.geoJson=Je,t.Layer=Se,t.LayerGroup=Ze,t.layerGroup=function(t,i){return new Ze(t,i)},t.FeatureGroup=Ee,t.featureGroup=function(t){return new Ee(t)},t.ImageOverlay=$e,t.imageOverlay=function(t,i,e){return new $e(t,i,e)},t.VideoOverlay=Qe,t.videoOverlay=function(t,i,e){return new Qe(t,i,e)},t.SVGOverlay=tn,t.svgOverlay=function(t,i,e){return new tn(t,i,e)},t.DivOverlay=en,t.Popup=nn,t.popup=function(t,i){return new nn(t,i)},t.Tooltip=on,t.tooltip=function(t,i){return new on(t,i)},t.Icon=ke,t.icon=function(t){return new ke(t)},t.DivIcon=sn,t.divIcon=function(t){return new sn(t)},t.Marker=Ie,t.marker=function(t,i){return new Ie(t,i)},t.TileLayer=an,t.tileLayer=hn,t.GridLayer=rn,t.gridLayer=function(t){return new rn(t)},t.SVG=fn,t.svg=gn,t.Renderer=ln,t.Canvas=cn,t.canvas=_n,t.Path=Oe,t.CircleMarker=Re,t.circleMarker=function(t,i){return new Re(t,i)},t.Circle=Ne,t.circle=function(t,i,e){return new Ne(t,i,e)},t.Polyline=De,t.polyline=function(t,i){return new De(t,i)},t.Polygon=je,t.polygon=function(t,i){return new je(t,i)},t.Rectangle=vn,t.rectangle=function(t,i){return new vn(t,i)},t.Map=Ji,t.map=function(t,i){return new Ji(t,i)};var zn=window.L;t.noConflict=function(){return window.L=zn,this},window.L=t});
this.L=this.L||{};
this.L.Control=this.L.Control||{};
this.L.Control.Geocoder=(function (L){
'use strict';
L=L&&L.hasOwnProperty('default') ? L['default']:L;
var lastCallbackId=0;
var badChars=/[&<>"'`]/g;
var possible=/[&<>"'`]/;
var escape={
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#x27;',
'`': '&#x60;'
};
function escapeChar(chr){
return escape[chr];
}
function htmlEscape(string){
if(string==null){
return '';
}else if(!string){
return string + '';
}
string='' + string;
if(!possible.test(string)){
return string;
}
return string.replace(badChars, escapeChar);
}
function jsonp(url, params, callback, context, jsonpParam){
var callbackId='_l_geocoder_' + lastCallbackId++;
params[jsonpParam||'callback']=callbackId;
window[callbackId]=L.Util.bind(callback, context);
var script=document.createElement('script');
script.type='text/javascript';
script.src=url + getParamString(params);
script.id=callbackId;
document.getElementsByTagName('head')[0].appendChild(script);
}
function getJSON(url, params, callback){
var xmlHttp=new XMLHttpRequest();
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState!==4){
return;
}
if(xmlHttp.status!==200&&xmlHttp.status!==304){
callback('');
return;
}
callback(xmlHttp.response);
};
xmlHttp.open('GET', url + getParamString(params), true);
xmlHttp.responseType='json';
xmlHttp.setRequestHeader('Accept', 'application/json');
xmlHttp.send(null);
}
function template(str, data){
return str.replace(/\{ *([\w_]+) *\}/g, function(str, key){
var value=data[key];
if(value===undefined){
value='';
}else if(typeof value==='function'){
value=value(data);
}
return htmlEscape(value);
});
}
function getParamString(obj, existingUrl, uppercase){
var params=[];
for (var i in obj){
var key=encodeURIComponent(uppercase ? i.toUpperCase():i);
var value=obj[i];
if(!L.Util.isArray(value)){
params.push(key + '=' + encodeURIComponent(value));
}else{
for (var j=0; j < value.length; j++){
params.push(key + '=' + encodeURIComponent(value[j]));
}}
}
return (!existingUrl||existingUrl.indexOf('?')===-1 ? '?':'&') + params.join('&');
}
var ArcGis=L.Class.extend({
options: {
service_url: 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer'
},
initialize: function(accessToken, options){
L.setOptions(this, options);
this._accessToken=accessToken;
},
geocode: function(query, cb, context){
var params={
SingleLine: query,
outFields: 'Addr_Type',
forStorage: false,
maxLocations: 10,
f: 'json'
};
if(this._key&&this._key.length){
params.token=this._key;
}
getJSON(
this.options.service_url + '/findAddressCandidates',
L.extend(params, this.options.geocodingQueryParams),
function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.candidates&&data.candidates.length){
for (var i=0; i <=data.candidates.length - 1; i++){
loc=data.candidates[i];
latLng=L.latLng(loc.location.y, loc.location.x);
latLngBounds=L.latLngBounds(L.latLng(loc.extent.ymax, loc.extent.xmax),
L.latLng(loc.extent.ymin, loc.extent.xmin)
);
results[i]={
name: loc.address,
bbox: latLngBounds,
center: latLng
};}}
cb.call(context, results);
}
);
},
suggest: function(query, cb, context){
return this.geocode(query, cb, context);
},
reverse: function(location, scale, cb, context){
var params={
location: encodeURIComponent(location.lng) + ',' + encodeURIComponent(location.lat),
distance: 100,
f: 'json'
};
getJSON(this.options.service_url + '/reverseGeocode', params, function(data){
var result=[],
loc;
if(data&&!data.error){
loc=L.latLng(data.location.y, data.location.x);
result.push({
name: data.address.Match_addr,
center: loc,
bounds: L.latLngBounds(loc, loc)
});
}
cb.call(context, result);
});
}});
function arcgis(accessToken, options){
return new ArcGis(accessToken, options);
}
var Bing=L.Class.extend({
initialize: function(key){
this.key=key;
},
geocode: function(query, cb, context){
jsonp(
'https://dev.virtualearth.net/REST/v1/Locations',
{
query: query,
key: this.key
},
function(data){
var results=[];
if(data.resourceSets.length > 0){
for (var i=data.resourceSets[0].resources.length - 1; i >=0; i--){
var resource=data.resourceSets[0].resources[i],
bbox=resource.bbox;
results[i]={
name: resource.name,
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),
center: L.latLng(resource.point.coordinates)
};}}
cb.call(context, results);
},
this,
'jsonp'
);
},
reverse: function(location, scale, cb, context){
jsonp(
'//dev.virtualearth.net/REST/v1/Locations/' + location.lat + ',' + location.lng,
{
key: this.key
},
function(data){
var results=[];
for (var i=data.resourceSets[0].resources.length - 1; i >=0; i--){
var resource=data.resourceSets[0].resources[i],
bbox=resource.bbox;
results[i]={
name: resource.name,
bbox: L.latLngBounds([bbox[0], bbox[1]], [bbox[2], bbox[3]]),
center: L.latLng(resource.point.coordinates)
};}
cb.call(context, results);
},
this,
'jsonp'
);
}});
function bing(key){
return new Bing(key);
}
var Google=L.Class.extend({
options: {
serviceUrl: 'https://maps.googleapis.com/maps/api/geocode/json',
geocodingQueryParams: {},
reverseQueryParams: {}},
initialize: function(key, options){
this._key=key;
L.setOptions(this, options);
this.options.serviceUrl=this.options.service_url||this.options.serviceUrl;
},
geocode: function(query, cb, context){
var params={
address: query
};
if(this._key&&this._key.length){
params.key=this._key;
}
params=L.Util.extend(params, this.options.geocodingQueryParams);
getJSON(this.options.serviceUrl, params, function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.results&&data.results.length){
for (var i=0; i <=data.results.length - 1; i++){
loc=data.results[i];
latLng=L.latLng(loc.geometry.location);
latLngBounds=L.latLngBounds(L.latLng(loc.geometry.viewport.northeast),
L.latLng(loc.geometry.viewport.southwest)
);
results[i]={
name: loc.formatted_address,
bbox: latLngBounds,
center: latLng,
properties: loc.address_components
};}}
cb.call(context, results);
});
},
reverse: function(location, scale, cb, context){
var params={
latlng: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng)
};
params=L.Util.extend(params, this.options.reverseQueryParams);
if(this._key&&this._key.length){
params.key=this._key;
}
getJSON(this.options.serviceUrl, params, function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.results&&data.results.length){
for (var i=0; i <=data.results.length - 1; i++){
loc=data.results[i];
latLng=L.latLng(loc.geometry.location);
latLngBounds=L.latLngBounds(L.latLng(loc.geometry.viewport.northeast),
L.latLng(loc.geometry.viewport.southwest)
);
results[i]={
name: loc.formatted_address,
bbox: latLngBounds,
center: latLng,
properties: loc.address_components
};}}
cb.call(context, results);
});
}});
function google(key, options){
return new Google(key, options);
}
var HERE=L.Class.extend({
options: {
geocodeUrl: 'http://geocoder.api.here.com/6.2/geocode.json',
reverseGeocodeUrl: 'http://reverse.geocoder.api.here.com/6.2/reversegeocode.json',
app_id: '<insert your app_id here>',
app_code: '<insert your app_code here>',
geocodingQueryParams: {},
reverseQueryParams: {}},
initialize: function(options){
L.setOptions(this, options);
},
geocode: function(query, cb, context){
var params={
searchtext: query,
gen: 9,
app_id: this.options.app_id,
app_code: this.options.app_code,
jsonattributes: 1
};
params=L.Util.extend(params, this.options.geocodingQueryParams);
this.getJSON(this.options.geocodeUrl, params, cb, context);
},
reverse: function(location, scale, cb, context){
var params={
prox: encodeURIComponent(location.lat) + ',' + encodeURIComponent(location.lng),
mode: 'retrieveAddresses',
app_id: this.options.app_id,
app_code: this.options.app_code,
gen: 9,
jsonattributes: 1
};
params=L.Util.extend(params, this.options.reverseQueryParams);
this.getJSON(this.options.reverseGeocodeUrl, params, cb, context);
},
getJSON: function(url, params, cb, context){
getJSON(url, params, function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.response.view&&data.response.view.length){
for (var i=0; i <=data.response.view[0].result.length - 1; i++){
loc=data.response.view[0].result[i].location;
latLng=L.latLng(loc.displayPosition.latitude, loc.displayPosition.longitude);
latLngBounds=L.latLngBounds(L.latLng(loc.mapView.topLeft.latitude, loc.mapView.topLeft.longitude),
L.latLng(loc.mapView.bottomRight.latitude, loc.mapView.bottomRight.longitude)
);
results[i]={
name: loc.address.label,
bbox: latLngBounds,
center: latLng
};}}
cb.call(context, results);
});
}});
function here(options){
return new HERE(options);
}
var LatLng=L.Class.extend({
options: {
next: undefined,
sizeInMeters: 10000
},
initialize: function(options){
L.Util.setOptions(this, options);
},
geocode: function(query, cb, context){
var match;
var center;
if((match=query.match(/^([NS])\s*(\d{1,3}(?:\.\d*)?)\W*([EW])\s*(\d{1,3}(?:\.\d*)?)$/))){
center=L.latLng((/N/i.test(match[1]) ? 1:-1) * parseFloat(match[2]),
(/E/i.test(match[3]) ? 1:-1) * parseFloat(match[4])
);
}else if((match=query.match(/^(\d{1,3}(?:\.\d*)?)\s*([NS])\W*(\d{1,3}(?:\.\d*)?)\s*([EW])$/))
){
center=L.latLng((/N/i.test(match[2]) ? 1:-1) * parseFloat(match[1]),
(/E/i.test(match[4]) ? 1:-1) * parseFloat(match[3])
);
}else if((match=query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?$/
))
){
center=L.latLng((/N/i.test(match[1]) ? 1:-1) * (parseFloat(match[2]) + parseFloat(match[3] / 60)),
(/E/i.test(match[4]) ? 1:-1) * (parseFloat(match[5]) + parseFloat(match[6] / 60))
);
}else if((match=query.match(/^(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([NS])\W*(\d{1,3})°?\s*(\d{1,3}(?:\.\d*)?)?['′]?\s*([EW])$/
))
){
center=L.latLng((/N/i.test(match[3]) ? 1:-1) * (parseFloat(match[1]) + parseFloat(match[2] / 60)),
(/E/i.test(match[6]) ? 1:-1) * (parseFloat(match[4]) + parseFloat(match[5] / 60))
);
}else if((match=query.match(/^([NS])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\W*([EW])\s*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?$/
))
){
center=L.latLng((/N/i.test(match[1]) ? 1:-1) *
(parseFloat(match[2]) + parseFloat(match[3] / 60 + parseFloat(match[4] / 3600))),
(/E/i.test(match[5]) ? 1:-1) *
(parseFloat(match[6]) + parseFloat(match[7] / 60) + parseFloat(match[8] / 3600))
);
}else if((match=query.match(/^(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]\s*([NS])\W*(\d{1,3})°?\s*(\d{1,2})['′]?\s*(\d{1,3}(?:\.\d*)?)?["″]?\s*([EW])$/
))
){
center=L.latLng((/N/i.test(match[4]) ? 1:-1) *
(parseFloat(match[1]) + parseFloat(match[2] / 60 + parseFloat(match[3] / 3600))),
(/E/i.test(match[8]) ? 1:-1) *
(parseFloat(match[5]) + parseFloat(match[6] / 60) + parseFloat(match[7] / 3600))
);
}else if((match=query.match(/^\s*([+-]?\d+(?:\.\d*)?)\s*[\s,]\s*([+-]?\d+(?:\.\d*)?)\s*$/))
){
center=L.latLng(parseFloat(match[1]), parseFloat(match[2]));
}
if(center){
var results=[
{
name: query,
center: center,
bbox: center.toBounds(this.options.sizeInMeters)
}
];
cb.call(context, results);
}else if(this.options.next){
this.options.next.geocode(query, cb, context);
}}
});
function latLng(options){
return new LatLng(options);
}
var Mapbox=L.Class.extend({
options: {
serviceUrl: 'https://api.mapbox.com/geocoding/v5/mapbox.places/',
geocodingQueryParams: {},
reverseQueryParams: {}},
initialize: function(accessToken, options){
L.setOptions(this, options);
this.options.geocodingQueryParams.access_token=accessToken;
this.options.reverseQueryParams.access_token=accessToken;
},
geocode: function(query, cb, context){
var params=this.options.geocodingQueryParams;
if(typeof params.proximity!=='undefined' &&
params.proximity.hasOwnProperty('lat') &&
params.proximity.hasOwnProperty('lng')
){
params.proximity=params.proximity.lng + ',' + params.proximity.lat;
}
getJSON(this.options.serviceUrl + encodeURIComponent(query) + '.json', params, function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.features&&data.features.length){
for (var i=0; i <=data.features.length - 1; i++){
loc=data.features[i];
latLng=L.latLng(loc.center.reverse());
if(loc.hasOwnProperty('bbox')){
latLngBounds=L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()),
L.latLng(loc.bbox.slice(2, 4).reverse())
);
}else{
latLngBounds=L.latLngBounds(latLng, latLng);
}
var properties={
text: loc.text,
address: loc.address
};
for (var j=0; j < loc.context.length; j++){
var id=loc.context[j].id.split('.')[0];
properties[id]=loc.context[j].text;
}
results[i]={
name: loc.place_name,
bbox: latLngBounds,
center: latLng,
properties: properties
};}}
cb.call(context, results);
});
},
suggest: function(query, cb, context){
return this.geocode(query, cb, context);
},
reverse: function(location, scale, cb, context){
getJSON(
this.options.serviceUrl +
encodeURIComponent(location.lng) +
',' +
encodeURIComponent(location.lat) +
'.json',
this.options.reverseQueryParams,
function(data){
var results=[],
loc,
latLng,
latLngBounds;
if(data.features&&data.features.length){
for (var i=0; i <=data.features.length - 1; i++){
loc=data.features[i];
latLng=L.latLng(loc.center.reverse());
if(loc.hasOwnProperty('bbox')){
latLngBounds=L.latLngBounds(L.latLng(loc.bbox.slice(0, 2).reverse()),
L.latLng(loc.bbox.slice(2, 4).reverse())
);
}else{
latLngBounds=L.latLngBounds(latLng, latLng);
}
results[i]={
name: loc.place_name,
bbox: latLngBounds,
center: latLng
};}}
cb.call(context, results);
}
);
}});
function mapbox(accessToken, options){
return new Mapbox(accessToken, options);
}
var MapQuest=L.Class.extend({
options: {
serviceUrl: 'https://www.mapquestapi.com/geocoding/v1'
},
initialize: function(key, options){
this._key=decodeURIComponent(key);
L.Util.setOptions(this, options);
},
_formatName: function(){
var r=[],
i;
for (i=0; i < arguments.length; i++){
if(arguments[i]){
r.push(arguments[i]);
}}
return r.join(', ');
},
geocode: function(query, cb, context){
getJSON(
this.options.serviceUrl + '/address',
{
key: this._key,
location: query,
limit: 5,
outFormat: 'json'
},
L.bind(function(data){
var results=[],
loc,
latLng;
if(data.results&&data.results[0].locations){
for (var i=data.results[0].locations.length - 1; i >=0; i--){
loc=data.results[0].locations[i];
latLng=L.latLng(loc.latLng);
results[i]={
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),
bbox: L.latLngBounds(latLng, latLng),
center: latLng
};}}
cb.call(context, results);
}, this)
);
},
reverse: function(location, scale, cb, context){
getJSON(
this.options.serviceUrl + '/reverse',
{
key: this._key,
location: location.lat + ',' + location.lng,
outputFormat: 'json'
},
L.bind(function(data){
var results=[],
loc,
latLng;
if(data.results&&data.results[0].locations){
for (var i=data.results[0].locations.length - 1; i >=0; i--){
loc=data.results[0].locations[i];
latLng=L.latLng(loc.latLng);
results[i]={
name: this._formatName(loc.street, loc.adminArea4, loc.adminArea3, loc.adminArea1),
bbox: L.latLngBounds(latLng, latLng),
center: latLng
};}}
cb.call(context, results);
}, this)
);
}});
function mapQuest(key, options){
return new MapQuest(key, options);
}
var Neutrino=L.Class.extend({
options: {
userId: '<insert your userId here>',
apiKey: '<insert your apiKey here>',
serviceUrl: 'https://neutrinoapi.com/'
},
initialize: function(options){
L.Util.setOptions(this, options);
},
geocode: function(query, cb, context){
getJSON(
this.options.serviceUrl + 'geocode-address',
{
apiKey: this.options.apiKey,
userId: this.options.userId,
address: query.split(/\s+/).join('.')
},
function(data){
var results=[],
latLng,
latLngBounds;
if(data.hasOwnProperty('locations')){
data.geometry=data.locations[0];
latLng=L.latLng(data.geometry['latitude'], data.geometry['longitude']);
latLngBounds=L.latLngBounds(latLng, latLng);
results[0]={
name: data.geometry.address,
bbox: latLngBounds,
center: latLng
};}
cb.call(context, results);
}
);
},
suggest: function(query, cb, context){
return this.geocode(query, cb, context);
},
reverse: function(location, scale, cb, context){
getJSON(
this.options.serviceUrl + 'geocode-reverse',
{
apiKey: this.options.apiKey,
userId: this.options.userId,
latitude: location.lat,
longitude: location.lng
},
function(data){
var results=[],
latLng,
latLngBounds;
if(data.status.status==200&&data.found){
latLng=L.latLng(location.lat, location.lng);
latLngBounds=L.latLngBounds(latLng, latLng);
results[0]={
name: data.address,
bbox: latLngBounds,
center: latLng
};}
cb.call(context, results);
}
);
}});
function neutrino(accessToken){
return new Neutrino(accessToken);
}
var Nominatim=L.Class.extend({
options: {
serviceUrl: 'https://nominatim.openstreetmap.org/',
geocodingQueryParams: {},
reverseQueryParams: {},
htmlTemplate: function(r){
var a=r.address,
parts=[];
if(a.road||a.building){
parts.push('{building} {road} {house_number}');
}
if(a.city||a.town||a.village||a.hamlet){
parts.push('<span class="' +
(parts.length > 0 ? 'leaflet-control-geocoder-address-detail':'') +
'">{postcode} {city} {town} {village} {hamlet}</span>'
);
}
if(a.state||a.country){
parts.push('<span class="' +
(parts.length > 0 ? 'leaflet-control-geocoder-address-context':'') +
'">{state} {country}</span>'
);
}
return template(parts.join('<br/>'), a, true);
}},
initialize: function(options){
L.Util.setOptions(this, options);
},
geocode: function(query, cb, context){
getJSON(
this.options.serviceUrl + 'search',
L.extend({
q: query,
limit: 5,
format: 'json',
addressdetails: 1
},
this.options.geocodingQueryParams
),
L.bind(function(data){
var results=[];
for (var i=data.length - 1; i >=0; i--){
var bbox=data[i].boundingbox;
for (var j=0; j < 4; j++) bbox[j]=parseFloat(bbox[j]);
results[i]={
icon: data[i].icon,
name: data[i].display_name,
html: this.options.htmlTemplate ? this.options.htmlTemplate(data[i]):undefined,
bbox: L.latLngBounds([bbox[0], bbox[2]], [bbox[1], bbox[3]]),
center: L.latLng(data[i].lat, data[i].lon),
properties: data[i]
};}
cb.call(context, results);
}, this)
);
},
reverse: function(location, scale, cb, context){
getJSON(
this.options.serviceUrl + 'reverse',
L.extend({
lat: location.lat,
lon: location.lng,
zoom: Math.round(Math.log(scale / 256) / Math.log(2)),
addressdetails: 1,
format: 'json'
},
this.options.reverseQueryParams
),
L.bind(function(data){
var result=[],
loc;
if(data&&data.lat&&data.lon){
loc=L.latLng(data.lat, data.lon);
result.push({
name: data.display_name,
html: this.options.htmlTemplate ? this.options.htmlTemplate(data):undefined,
center: loc,
bounds: L.latLngBounds(loc, loc),
properties: data
});
}
cb.call(context, result);
}, this)
);
}});
function nominatim(options){
return new Nominatim(options);
}
var OpenLocationCode=L.Class.extend({
options: {
OpenLocationCode: undefined,
codeLength: undefined
},
initialize: function(options){
L.setOptions(this, options);
},
geocode: function(query, cb, context){
try {
var decoded=this.options.OpenLocationCode.decode(query);
var result={
name: query,
center: L.latLng(decoded.latitudeCenter, decoded.longitudeCenter),
bbox: L.latLngBounds(L.latLng(decoded.latitudeLo, decoded.longitudeLo),
L.latLng(decoded.latitudeHi, decoded.longitudeHi)
)
};
cb.call(context, [result]);
} catch (e){
console.warn(e);
cb.call(context, []);
}},
reverse: function(location, scale, cb, context){
try {
var code=this.options.OpenLocationCode.encode(location.lat,
location.lng,
this.options.codeLength
);
var result={
name: code,
center: L.latLng(location.lat, location.lng),
bbox: L.latLngBounds(L.latLng(location.lat, location.lng),
L.latLng(location.lat, location.lng)
)
};
cb.call(context, [result]);
} catch (e){
console.warn(e);
cb.call(context, []);
}}
});
function openLocationCode(options){
return new OpenLocationCode(options);
}
var Pelias=L.Class.extend({
options: {
serviceUrl: 'https://api.geocode.earth/v1',
geocodingQueryParams: {},
reverseQueryParams: {}},
initialize: function(apiKey, options){
L.Util.setOptions(this, options);
this._apiKey=apiKey;
this._lastSuggest=0;
},
geocode: function(query, cb, context){
var _this=this;
getJSON(
this.options.serviceUrl + '/search',
L.extend({
api_key: this._apiKey,
text: query
},
this.options.geocodingQueryParams
),
function(data){
cb.call(context, _this._parseResults(data, 'bbox'));
}
);
},
suggest: function(query, cb, context){
var _this=this;
getJSON(
this.options.serviceUrl + '/autocomplete',
L.extend({
api_key: this._apiKey,
text: query
},
this.options.geocodingQueryParams
),
L.bind(function(data){
if(data.geocoding.timestamp > this._lastSuggest){
this._lastSuggest=data.geocoding.timestamp;
cb.call(context, _this._parseResults(data, 'bbox'));
}}, this)
);
},
reverse: function(location, scale, cb, context){
var _this=this;
getJSON(
this.options.serviceUrl + '/reverse',
L.extend({
api_key: this._apiKey,
'point.lat': location.lat,
'point.lon': location.lng
},
this.options.reverseQueryParams
),
function(data){
cb.call(context, _this._parseResults(data, 'bounds'));
}
);
},
_parseResults: function(data, bboxname){
var results=[];
L.geoJson(data, {
pointToLayer: function(feature, latlng){
return L.circleMarker(latlng);
},
onEachFeature: function(feature, layer){
var result={},
bbox,
center;
if(layer.getBounds){
bbox=layer.getBounds();
center=bbox.getCenter();
}else if(layer.feature.bbox){
center=layer.getLatLng();
bbox=L.latLngBounds(L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(0, 2)),
L.GeoJSON.coordsToLatLng(layer.feature.bbox.slice(2, 4))
);
}else{
center=layer.getLatLng();
bbox=L.latLngBounds(center, center);
}
result.name=layer.feature.properties.label;
result.center=center;
result[bboxname]=bbox;
result.properties=layer.feature.properties;
results.push(result);
}});
return results;
}});
function pelias(apiKey, options){
return new Pelias(apiKey, options);
}
var GeocodeEarth=Pelias;
var geocodeEarth=pelias;
var Mapzen=Pelias;
var mapzen=pelias;
var Openrouteservice=Mapzen.extend({
options: {
serviceUrl: 'https://api.openrouteservice.org/geocode'
}});
function openrouteservice(apiKey, options){
return new Openrouteservice(apiKey, options);
}
var Photon=L.Class.extend({
options: {
serviceUrl: 'https://photon.komoot.de/api/',
reverseUrl: 'https://photon.komoot.de/reverse/',
nameProperties: ['name', 'street', 'suburb', 'hamlet', 'town', 'city', 'state', 'country']
},
initialize: function(options){
L.setOptions(this, options);
},
geocode: function(query, cb, context){
var params=L.extend({
q: query
},
this.options.geocodingQueryParams
);
getJSON(
this.options.serviceUrl,
params,
L.bind(function(data){
cb.call(context, this._decodeFeatures(data));
}, this)
);
},
suggest: function(query, cb, context){
return this.geocode(query, cb, context);
},
reverse: function(latLng, scale, cb, context){
var params=L.extend({
lat: latLng.lat,
lon: latLng.lng
},
this.options.reverseQueryParams
);
getJSON(
this.options.reverseUrl,
params,
L.bind(function(data){
cb.call(context, this._decodeFeatures(data));
}, this)
);
},
_decodeFeatures: function(data){
var results=[],
i,
f,
c,
latLng,
extent,
bbox;
if(data&&data.features){
for (i=0; i < data.features.length; i++){
f=data.features[i];
c=f.geometry.coordinates;
latLng=L.latLng(c[1], c[0]);
extent=f.properties.extent;
if(extent){
bbox=L.latLngBounds([extent[1], extent[0]], [extent[3], extent[2]]);
}else{
bbox=L.latLngBounds(latLng, latLng);
}
results.push({
name: this._decodeFeatureName(f),
html: this.options.htmlTemplate ? this.options.htmlTemplate(f):undefined,
center: latLng,
bbox: bbox,
properties: f.properties
});
}}
return results;
},
_decodeFeatureName: function(f){
return (this.options.nameProperties||[])
.map(function(p){
return f.properties[p];
})
.filter(function(v){
return !!v;
})
.join(', ');
}});
function photon(options){
return new Photon(options);
}
var What3Words=L.Class.extend({
options: {
serviceUrl: 'https://api.what3words.com/v2/'
},
initialize: function(accessToken){
this._accessToken=accessToken;
},
geocode: function(query, cb, context){
getJSON(
this.options.serviceUrl + 'forward',
{
key: this._accessToken,
addr: query.split(/\s+/).join('.')
},
function(data){
var results=[],
latLng,
latLngBounds;
if(data.hasOwnProperty('geometry')){
latLng=L.latLng(data.geometry['lat'], data.geometry['lng']);
latLngBounds=L.latLngBounds(latLng, latLng);
results[0]={
name: data.words,
bbox: latLngBounds,
center: latLng
};}
cb.call(context, results);
}
);
},
suggest: function(query, cb, context){
return this.geocode(query, cb, context);
},
reverse: function(location, scale, cb, context){
getJSON(
this.options.serviceUrl + 'reverse',
{
key: this._accessToken,
coords: [location.lat, location.lng].join(',')
},
function(data){
var results=[],
latLng,
latLngBounds;
if(data.status.status==200){
latLng=L.latLng(data.geometry['lat'], data.geometry['lng']);
latLngBounds=L.latLngBounds(latLng, latLng);
results[0]={
name: data.words,
bbox: latLngBounds,
center: latLng
};}
cb.call(context, results);
}
);
}});
function what3words(accessToken){
return new What3Words(accessToken);
}
var geocoders=Object.freeze({
ArcGis: ArcGis,
arcgis: arcgis,
Bing: Bing,
bing: bing,
Google: Google,
google: google,
HERE: HERE,
here: here,
LatLng: LatLng,
latLng: latLng,
Mapbox: Mapbox,
mapbox: mapbox,
MapQuest: MapQuest,
mapQuest: mapQuest,
Neutrino: Neutrino,
neutrino: neutrino,
Nominatim: Nominatim,
nominatim: nominatim,
OpenLocationCode: OpenLocationCode,
openLocationCode: openLocationCode,
Pelias: Pelias,
pelias: pelias,
GeocodeEarth: GeocodeEarth,
geocodeEarth: geocodeEarth,
Mapzen: Mapzen,
mapzen: mapzen,
Openrouteservice: Openrouteservice,
openrouteservice: openrouteservice,
Photon: Photon,
photon: photon,
What3Words: What3Words,
what3words: what3words
});
var Geocoder=L.Control.extend({
options: {
showResultIcons: false,
collapsed: true,
expand: 'touch',
position: 'topright',
placeholder: 'Search...',
errorMessage: 'Nothing found.',
queryMinLength: 1,
suggestMinLength: 3,
suggestTimeout: 250,
defaultMarkGeocode: true
},
includes: L.Evented.prototype||L.Mixin.Events,
initialize: function(options){
L.Util.setOptions(this, options);
if(!this.options.geocoder){
this.options.geocoder=new Nominatim();
}
this._requestCount=0;
},
addThrobberClass: function(){
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-throbber');
},
removeThrobberClass: function(){
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-throbber');
},
onAdd: function(map){
var className='leaflet-control-geocoder',
container=L.DomUtil.create('div', className + ' leaflet-bar'),
icon=L.DomUtil.create('button', className + '-icon', container),
form=(this._form=L.DomUtil.create('div', className + '-form', container)),
input;
this._map=map;
this._container=container;
icon.innerHTML='&nbsp;';
icon.type='button';
input=this._input=L.DomUtil.create('input', '', form);
input.type='text';
input.placeholder=this.options.placeholder;
L.DomEvent.disableClickPropagation(input);
this._errorElement=L.DomUtil.create('div', className + '-form-no-error', container);
this._errorElement.innerHTML=this.options.errorMessage;
this._alts=L.DomUtil.create('ul',
className + '-alternatives leaflet-control-geocoder-alternatives-minimized',
container
);
L.DomEvent.disableClickPropagation(this._alts);
L.DomEvent.addListener(input, 'keydown', this._keydown, this);
if(this.options.geocoder.suggest){
L.DomEvent.addListener(input, 'input', this._change, this);
}
L.DomEvent.addListener(input,
'blur',
function(){
if(this.options.collapsed&&!this._preventBlurCollapse){
this._collapse();
}
this._preventBlurCollapse=false;
},
this
);
if(this.options.collapsed){
if(this.options.expand==='click'){
L.DomEvent.addListener(container,
'click',
function(e){
if(e.button===0&&e.detail!==2){
this._toggle();
}},
this
);
}else if(L.Browser.touch&&this.options.expand==='touch'){
L.DomEvent.addListener(container,
'touchstart mousedown',
function(e){
this._toggle();
e.preventDefault();
e.stopPropagation();
},
this
);
}else{
L.DomEvent.addListener(container, 'mouseover', this._expand, this);
L.DomEvent.addListener(container, 'mouseout', this._collapse, this);
this._map.on('movestart', this._collapse, this);
}}else{
this._expand ();
if(L.Browser.touch){
L.DomEvent.addListener(container,
'touchstart',
function(){
this._geocode();
},
this
);
}else{
L.DomEvent.addListener(container,
'click',
function(){
this._geocode();
},
this
);
}}
if(this.options.defaultMarkGeocode){
this.on('markgeocode', this.markGeocode, this);
}
this.on('startgeocode', this.addThrobberClass, this);
this.on('finishgeocode', this.removeThrobberClass, this);
this.on('startsuggest', this.addThrobberClass, this);
this.on('finishsuggest', this.removeThrobberClass, this);
L.DomEvent.disableClickPropagation(container);
return container;
},
_geocodeResult: function(results, suggest){
if(!suggest&&results.length===1){
this._geocodeResultSelected(results[0]);
}else if(results.length > 0){
this._alts.innerHTML='';
this._results=results;
L.DomUtil.removeClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-open');
for (var i=0; i < results.length; i++){
this._alts.appendChild(this._createAlt(results[i], i));
}}else{
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-options-error');
L.DomUtil.addClass(this._errorElement, 'leaflet-control-geocoder-error');
}},
markGeocode: function(result){
result=result.geocode||result;
this._map.fitBounds(result.bbox);
if(this._geocodeMarker){
this._map.removeLayer(this._geocodeMarker);
}
this._geocodeMarker=new L.Marker(result.center)
.bindPopup(result.html||result.name)
.addTo(this._map)
.openPopup();
return this;
},
_geocode: function(suggest){
var value=this._input.value;
if(!suggest&&value.length < this.options.queryMinLength){
return;
}
var requestCount=++this._requestCount,
mode=suggest ? 'suggest':'geocode',
eventData={ input: value };
this._lastGeocode=value;
if(!suggest){
this._clearResults();
}
this.fire('start' + mode, eventData);
this.options.geocoder[mode](
value,
function(results){
if(requestCount===this._requestCount){
eventData.results=results;
this.fire('finish' + mode, eventData);
this._geocodeResult(results, suggest);
}},
this
);
},
_geocodeResultSelected: function(result){
this.fire('markgeocode', { geocode: result });
},
_toggle: function(){
if(L.DomUtil.hasClass(this._container, 'leaflet-control-geocoder-expanded')){
this._collapse();
}else{
this._expand ();
}},
_expand: function(){
L.DomUtil.addClass(this._container, 'leaflet-control-geocoder-expanded');
this._input.select();
this.fire('expand');
},
_collapse: function(){
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-expanded');
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open');
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error');
this._input.blur();
this.fire('collapse');
},
_clearResults: function(){
L.DomUtil.addClass(this._alts, 'leaflet-control-geocoder-alternatives-minimized');
this._selection=null;
L.DomUtil.removeClass(this._errorElement, 'leaflet-control-geocoder-error');
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-open');
L.DomUtil.removeClass(this._container, 'leaflet-control-geocoder-options-error');
},
_createAlt: function(result, index){
var li=L.DomUtil.create('li', ''),
a=L.DomUtil.create('a', '', li),
icon=this.options.showResultIcons&&result.icon ? L.DomUtil.create('img', '', a):null,
text=result.html ? undefined:document.createTextNode(result.name),
mouseDownHandler=function mouseDownHandler(e){
this._preventBlurCollapse=true;
L.DomEvent.stop(e);
this._geocodeResultSelected(result);
L.DomEvent.on(li,
'click',
function(){
if(this.options.collapsed){
this._collapse();
}else{
this._clearResults();
}},
this
);
};
if(icon){
icon.src=result.icon;
}
li.setAttribute('data-result-index', index);
if(result.html){
a.innerHTML=a.innerHTML + result.html;
}else{
a.appendChild(text);
}
L.DomEvent.addListener(li, 'mousedown touchstart', mouseDownHandler, this);
return li;
},
_keydown: function(e){
var _this=this,
select=function select(dir){
if(_this._selection){
L.DomUtil.removeClass(_this._selection, 'leaflet-control-geocoder-selected');
_this._selection=_this._selection[dir > 0 ? 'nextSibling':'previousSibling'];
}
if(!_this._selection){
_this._selection=_this._alts[dir > 0 ? 'firstChild':'lastChild'];
}
if(_this._selection){
L.DomUtil.addClass(_this._selection, 'leaflet-control-geocoder-selected');
}};
switch (e.keyCode){
case 27:
if(this.options.collapsed){
this._collapse();
}else{
this._clearResults();
}
break;
case 38:
select(-1);
break;
case 40:
select(1);
break;
case 13:
if(this._selection){
var index=parseInt(this._selection.getAttribute('data-result-index'), 10);
this._geocodeResultSelected(this._results[index]);
this._clearResults();
}else{
this._geocode();
}
break;
default:
return;
}
L.DomEvent.preventDefault(e);
},
_change: function(){
var v=this._input.value;
if(v!==this._lastGeocode){
clearTimeout(this._suggestTimeout);
if(v.length >=this.options.suggestMinLength){
this._suggestTimeout=setTimeout(
L.bind(function(){
this._geocode(true);
}, this),
this.options.suggestTimeout
);
}else{
this._clearResults();
}}
}});
function geocoder(options){
return new Geocoder(options);
}
L.Util.extend(Geocoder, geocoders);
L.Util.extend(L.Control, {
Geocoder: Geocoder,
geocoder: geocoder
});
return Geocoder;
}(L));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e.Leaflet=e.Leaflet||{},e.Leaflet.markercluster=e.Leaflet.markercluster||{}))}(this,function(e){"use strict";var t=L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,clusterPane:L.Marker.prototype.options.pane,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animate:!0,animateAddingMarkers:!1,spiderfyDistanceMultiplier:1,spiderLegPolylineOptions:{weight:1.5,color:"#222",opacity:.5},chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(e){L.Util.setOptions(this,e),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.addEventParent(this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.addEventParent(this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this._childMarkerEventHandlers={dragstart:this._childMarkerDragStart,move:this._childMarkerMoved,dragend:this._childMarkerDragEnd};var t=L.DomUtil.TRANSITION&&this.options.animate;L.extend(this,t?this._withAnimation:this._noAnimation),this._markerCluster=t?L.MarkerCluster:L.MarkerClusterNonAnimated},addLayer:function(e){if(e instanceof L.LayerGroup)return this.addLayers([e]);if(!e.getLatLng)return this._nonPointGroup.addLayer(e),this.fire("layeradd",{layer:e}),this;if(!this._map)return this._needsClustering.push(e),this.fire("layeradd",{layer:e}),this;if(this.hasLayer(e))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(e,this._maxZoom),this.fire("layeradd",{layer:e}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons();var t=e,i=this._zoom;if(e.__parent)for(;t.__parent._zoom>=i;)t=t.__parent;return this._currentShownBounds.contains(t.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(e,t):this._animationAddLayerNonAnimated(e,t)),this},removeLayer:function(e){return e instanceof L.LayerGroup?this.removeLayers([e]):e.getLatLng?this._map?e.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(e)),this._removeLayer(e,!0),this.fire("layerremove",{layer:e}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),e.off(this._childMarkerEventHandlers,this),this._featureGroup.hasLayer(e)&&(this._featureGroup.removeLayer(e),e.clusterShow&&e.clusterShow()),this):this:(!this._arraySplice(this._needsClustering,e)&&this.hasLayer(e)&&this._needsRemoving.push({layer:e,latlng:e._latlng}),this.fire("layerremove",{layer:e}),this):(this._nonPointGroup.removeLayer(e),this.fire("layerremove",{layer:e}),this)},addLayers:function(e,t){if(!L.Util.isArray(e))return this.addLayer(e);var i,n=this._featureGroup,r=this._nonPointGroup,s=this.options.chunkedLoading,o=this.options.chunkInterval,a=this.options.chunkProgress,h=e.length,l=0,u=!0;if(this._map){var _=(new Date).getTime(),d=L.bind(function(){for(var c=(new Date).getTime();h>l;l++){if(s&&0===l%200){var p=(new Date).getTime()-c;if(p>o)break}if(i=e[l],i instanceof L.LayerGroup)u&&(e=e.slice(),u=!1),this._extractNonGroupLayers(i,e),h=e.length;else if(i.getLatLng){if(!this.hasLayer(i)&&(this._addLayer(i,this._maxZoom),t||this.fire("layeradd",{layer:i}),i.__parent&&2===i.__parent.getChildCount())){var f=i.__parent.getAllChildMarkers(),m=f[0]===i?f[1]:f[0];n.removeLayer(m)}}else r.addLayer(i),t||this.fire("layeradd",{layer:i})}a&&a(l,h,(new Date).getTime()-_),l===h?(this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(d,this.options.chunkDelay)},this);d()}else for(var c=this._needsClustering;h>l;l++)i=e[l],i instanceof L.LayerGroup?(u&&(e=e.slice(),u=!1),this._extractNonGroupLayers(i,e),h=e.length):i.getLatLng?this.hasLayer(i)||c.push(i):r.addLayer(i);return this},removeLayers:function(e){var t,i,n=e.length,r=this._featureGroup,s=this._nonPointGroup,o=!0;if(!this._map){for(t=0;n>t;t++)i=e[t],i instanceof L.LayerGroup?(o&&(e=e.slice(),o=!1),this._extractNonGroupLayers(i,e),n=e.length):(this._arraySplice(this._needsClustering,i),s.removeLayer(i),this.hasLayer(i)&&this._needsRemoving.push({layer:i,latlng:i._latlng}),this.fire("layerremove",{layer:i}));return this}if(this._unspiderfy){this._unspiderfy();var a=e.slice(),h=n;for(t=0;h>t;t++)i=a[t],i instanceof L.LayerGroup?(this._extractNonGroupLayers(i,a),h=a.length):this._unspiderfyLayer(i)}for(t=0;n>t;t++)i=e[t],i instanceof L.LayerGroup?(o&&(e=e.slice(),o=!1),this._extractNonGroupLayers(i,e),n=e.length):i.__parent?(this._removeLayer(i,!0,!0),this.fire("layerremove",{layer:i}),r.hasLayer(i)&&(r.removeLayer(i),i.clusterShow&&i.clusterShow())):(s.removeLayer(i),this.fire("layerremove",{layer:i}));return this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),this},clearLayers:function(){return this._map||(this._needsClustering=[],this._needsRemoving=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(e){e.off(this._childMarkerEventHandlers,this),delete e.__parent},this),this._map&&this._generateInitialClusters(),this},getBounds:function(){var e=new L.LatLngBounds;this._topClusterLevel&&e.extend(this._topClusterLevel._bounds);for(var t=this._needsClustering.length-1;t>=0;t--)e.extend(this._needsClustering[t].getLatLng());return e.extend(this._nonPointGroup.getBounds()),e},eachLayer:function(e,t){var i,n,r,s=this._needsClustering.slice(),o=this._needsRemoving;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(s),n=s.length-1;n>=0;n--){for(i=!0,r=o.length-1;r>=0;r--)if(o[r].layer===s[n]){i=!1;break}i&&e.call(t,s[n])}this._nonPointGroup.eachLayer(e,t)},getLayers:function(){var e=[];return this.eachLayer(function(t){e.push(t)}),e},getLayer:function(e){var t=null;return e=parseInt(e,10),this.eachLayer(function(i){L.stamp(i)===e&&(t=i)}),t},hasLayer:function(e){if(!e)return!1;var t,i=this._needsClustering;for(t=i.length-1;t>=0;t--)if(i[t]===e)return!0;for(i=this._needsRemoving,t=i.length-1;t>=0;t--)if(i[t].layer===e)return!1;return!(!e.__parent||e.__parent._group!==this)||this._nonPointGroup.hasLayer(e)},zoomToShowLayer:function(e,t){"function"!=typeof t&&(t=function(){});var i=function(){!e._icon&&!e.__parent._icon||this._inZoomAnimation||(this._map.off("moveend",i,this),this.off("animationend",i,this),e._icon?t():e.__parent._icon&&(this.once("spiderfied",t,this),e.__parent.spiderfy()))};e._icon&&this._map.getBounds().contains(e.getLatLng())?t():e.__parent._zoom<Math.round(this._map._zoom)?(this._map.on("moveend",i,this),this._map.panTo(e.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),e.__parent.zoomToBounds())},onAdd:function(e){this._map=e;var t,i,n;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";for(this._featureGroup.addTo(e),this._nonPointGroup.addTo(e),this._gridClusters||this._generateInitialClusters(),this._maxLat=e.options.crs.projection.MAX_LATITUDE,t=0,i=this._needsRemoving.length;i>t;t++)n=this._needsRemoving[t],n.newlatlng=n.layer._latlng,n.layer._latlng=n.latlng;for(t=0,i=this._needsRemoving.length;i>t;t++)n=this._needsRemoving[t],this._removeLayer(n.layer,!0),n.layer._latlng=n.newlatlng;this._needsRemoving=[],this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds(),this._map.on("zoomend",this._zoomEnd,this),this._map.on("moveend",this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),i=this._needsClustering,this._needsClustering=[],this.addLayers(i,!0)},onRemove:function(e){e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""),this._spiderfierOnRemove&&this._spiderfierOnRemove(),delete this._maxLat,this._hideCoverage(),this._featureGroup.remove(),this._nonPointGroup.remove(),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(e){for(var t=e;t&&!t._icon;)t=t.__parent;return t||null},_arraySplice:function(e,t){for(var i=e.length-1;i>=0;i--)if(e[i]===t)return e.splice(i,1),!0},_removeFromGridUnclustered:function(e,t){for(var i=this._map,n=this._gridUnclustered,r=Math.floor(this._map.getMinZoom());t>=r&&n[t].removeObject(e,i.project(e.getLatLng(),t));t--);},_childMarkerDragStart:function(e){e.target.__dragStart=e.target._latlng},_childMarkerMoved:function(e){if(!this._ignoreMove&&!e.target.__dragStart){var t=e.target._popup&&e.target._popup.isOpen();this._moveChild(e.target,e.oldLatLng,e.latlng),t&&e.target.openPopup()}},_moveChild:function(e,t,i){e._latlng=t,this.removeLayer(e),e._latlng=i,this.addLayer(e)},_childMarkerDragEnd:function(e){var t=e.target.__dragStart;delete e.target.__dragStart,t&&this._moveChild(e.target,t,e.target._latlng)},_removeLayer:function(e,t,i){var n=this._gridClusters,r=this._gridUnclustered,s=this._featureGroup,o=this._map,a=Math.floor(this._map.getMinZoom());t&&this._removeFromGridUnclustered(e,this._maxZoom);var h,l=e.__parent,u=l._markers;for(this._arraySplice(u,e);l&&(l._childCount--,l._boundsNeedUpdate=!0,!(l._zoom<a));)t&&l._childCount<=1?(h=l._markers[0]===e?l._markers[1]:l._markers[0],n[l._zoom].removeObject(l,o.project(l._cLatLng,l._zoom)),r[l._zoom].addObject(h,o.project(h.getLatLng(),l._zoom)),this._arraySplice(l.__parent._childClusters,l),l.__parent._markers.push(h),h.__parent=l.__parent,l._icon&&(s.removeLayer(l),i||s.addLayer(h))):l._iconNeedsUpdate=!0,l=l.__parent;delete e.__parent},_isOrIsParent:function(e,t){for(;t;){if(e===t)return!0;t=t.parentNode}return!1},fire:function(e,t,i){if(t&&t.layer instanceof L.MarkerCluster){if(t.originalEvent&&this._isOrIsParent(t.layer._icon,t.originalEvent.relatedTarget))return;e="cluster"+e}L.FeatureGroup.prototype.fire.call(this,e,t,i)},listens:function(e,t){return L.FeatureGroup.prototype.listens.call(this,e,t)||L.FeatureGroup.prototype.listens.call(this,"cluster"+e,t)},_defaultIconCreateFunction:function(e){var t=e.getChildCount(),i=" marker-cluster-";return i+=10>t?"small":100>t?"medium":"large",new L.DivIcon({html:"<div><span>"+t+"</span></div>",className:"marker-cluster"+i,iconSize:new L.Point(40,40)})},_bindEvents:function(){var e=this._map,t=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick;(t||n)&&this.on("clusterclick",this._zoomOrSpiderfy,this),i&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),e.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(e){for(var t=e.layer,i=t;1===i._childClusters.length;)i=i._childClusters[0];i._zoom===this._maxZoom&&i._childCount===t._childCount&&this.options.spiderfyOnMaxZoom?t.spiderfy():this.options.zoomToBoundsOnClick&&t.zoomToBounds(),e.originalEvent&&13===e.originalEvent.keyCode&&this._map._container.focus()},_showCoverage:function(e){var t=this._map;this._inZoomAnimation||(this._shownPolygon&&t.removeLayer(this._shownPolygon),e.layer.getChildCount()>2&&e.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(e.layer.getConvexHull(),this.options.polygonOptions),t.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var e=this.options.spiderfyOnMaxZoom,t=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,n=this._map;(e||i)&&this.off("clusterclick",this._zoomOrSpiderfy,this),t&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),n.off("zoomend",this._hideCoverage,this))},_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var e=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,Math.round(this._map._zoom),e),this._currentShownBounds=e}},_generateInitialClusters:function(){var e=Math.ceil(this._map.getMaxZoom()),t=Math.floor(this._map.getMinZoom()),i=this.options.maxClusterRadius,n=i;"function"!=typeof i&&(n=function(){return i}),null!==this.options.disableClusteringAtZoom&&(e=this.options.disableClusteringAtZoom-1),this._maxZoom=e,this._gridClusters={},this._gridUnclustered={};for(var r=e;r>=t;r--)this._gridClusters[r]=new L.DistanceGrid(n(r)),this._gridUnclustered[r]=new L.DistanceGrid(n(r));this._topClusterLevel=new this._markerCluster(this,t-1)},_addLayer:function(e,t){var i,n,r=this._gridClusters,s=this._gridUnclustered,o=Math.floor(this._map.getMinZoom());for(this.options.singleMarkerMode&&this._overrideMarkerIcon(e),e.on(this._childMarkerEventHandlers,this);t>=o;t--){i=this._map.project(e.getLatLng(),t);var a=r[t].getNearObject(i);if(a)return a._addChild(e),e.__parent=a,void 0;if(a=s[t].getNearObject(i)){var h=a.__parent;h&&this._removeLayer(a,!1);var l=new this._markerCluster(this,t,a,e);r[t].addObject(l,this._map.project(l._cLatLng,t)),a.__parent=l,e.__parent=l;var u=l;for(n=t-1;n>h._zoom;n--)u=new this._markerCluster(this,n,u),r[n].addObject(u,this._map.project(a.getLatLng(),n));return h._addChild(u),this._removeFromGridUnclustered(a,t),void 0}s[t].addObject(e,i)}this._topClusterLevel._addChild(e),e.__parent=this._topClusterLevel},_refreshClustersIcons:function(){this._featureGroup.eachLayer(function(e){e instanceof L.MarkerCluster&&e._iconNeedsUpdate&&e._updateIcon()})},_enqueue:function(e){this._queue.push(e),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var e=0;e<this._queue.length;e++)this._queue[e].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){var e=Math.round(this._map._zoom);this._processQueue(),this._zoom<e&&this._currentShownBounds.intersects(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,e)):this._zoom>e?(this._animationStart(),this._animationZoomOut(this._zoom,e)):this._moveEnd()},_getExpandedVisibleBounds:function(){return this.options.removeOutsideVisibleBounds?L.Browser.mobile?this._checkBoundsMaxLat(this._map.getBounds()):this._checkBoundsMaxLat(this._map.getBounds().pad(1)):this._mapBoundsInfinite},_checkBoundsMaxLat:function(e){var t=this._maxLat;return void 0!==t&&(e.getNorth()>=t&&(e._northEast.lat=1/0),e.getSouth()<=-t&&(e._southWest.lat=-1/0)),e},_animationAddLayerNonAnimated:function(e,t){if(t===e)this._featureGroup.addLayer(e);else if(2===t._childCount){t._addToMap();var i=t.getAllChildMarkers();this._featureGroup.removeLayer(i[0]),this._featureGroup.removeLayer(i[1])}else t._updateIcon()},_extractNonGroupLayers:function(e,t){var i,n=e.getLayers(),r=0;for(t=t||[];r<n.length;r++)i=n[r],i instanceof L.LayerGroup?this._extractNonGroupLayers(i,t):t.push(i);return t},_overrideMarkerIcon:function(e){var t=e.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[e]}});return t}});L.MarkerClusterGroup.include({_mapBoundsInfinite:new L.LatLngBounds(new L.LatLng(-1/0,-1/0),new L.LatLng(1/0,1/0))}),L.MarkerClusterGroup.include({_noAnimation:{_animationStart:function(){},_animationZoomIn:function(e,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(e,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(e,t){this._animationAddLayerNonAnimated(e,t)}},_withAnimation:{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationZoomIn:function(e,t){var i,n=this._getExpandedVisibleBounds(),r=this._featureGroup,s=Math.floor(this._map.getMinZoom());this._ignoreMove=!0,this._topClusterLevel._recursively(n,e,s,function(s){var o,a=s._latlng,h=s._markers;for(n.contains(a)||(a=null),s._isSingleParent()&&e+1===t?(r.removeLayer(s),s._recursivelyAddChildrenToMap(null,t,n)):(s.clusterHide(),s._recursivelyAddChildrenToMap(a,t,n)),i=h.length-1;i>=0;i--)o=h[i],n.contains(o._latlng)||r.removeLayer(o)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(n,t),r.eachLayer(function(e){e instanceof L.MarkerCluster||!e._icon||e.clusterShow()}),this._topClusterLevel._recursively(n,e,t,function(e){e._recursivelyRestoreChildPositions(t)}),this._ignoreMove=!1,this._enqueue(function(){this._topClusterLevel._recursively(n,e,s,function(e){r.removeLayer(e),e.clusterShow()}),this._animationEnd()})},_animationZoomOut:function(e,t){this._animationZoomOutSingle(this._topClusterLevel,e-1,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e,this._getExpandedVisibleBounds())},_animationAddLayer:function(e,t){var i=this,n=this._featureGroup;n.addLayer(e),t!==e&&(t._childCount>2?(t._updateIcon(),this._forceLayout(),this._animationStart(),e._setPos(this._map.latLngToLayerPoint(t.getLatLng())),e.clusterHide(),this._enqueue(function(){n.removeLayer(e),e.clusterShow(),i._animationEnd()})):(this._forceLayout(),i._animationStart(),i._animationZoomOutSingle(t,this._map.getMaxZoom(),this._zoom)))}},_animationZoomOutSingle:function(e,t,i){var n=this._getExpandedVisibleBounds(),r=Math.floor(this._map.getMinZoom());e._recursivelyAnimateChildrenInAndAddSelfToMap(n,r,t+1,i);var s=this;this._forceLayout(),e._recursivelyBecomeVisible(n,i),this._enqueue(function(){if(1===e._childCount){var o=e._markers[0];this._ignoreMove=!0,o.setLatLng(o.getLatLng()),this._ignoreMove=!1,o.clusterShow&&o.clusterShow()}else e._recursively(n,i,r,function(e){e._recursivelyRemoveChildrenFromMap(n,r,t+1)});s._animationEnd()})},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_forceLayout:function(){L.Util.falseFn(document.body.offsetWidth)}}),L.markerClusterGroup=function(e){return new L.MarkerClusterGroup(e)};var i=L.MarkerCluster=L.Marker.extend({options:L.Icon.prototype.options,initialize:function(e,t,i,n){L.Marker.prototype.initialize.call(this,i?i._cLatLng||i.getLatLng():new L.LatLng(0,0),{icon:this,pane:e.options.clusterPane}),this._group=e,this._zoom=t,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._bounds=new L.LatLngBounds,i&&this._addChild(i),n&&this._addChild(n)},getAllChildMarkers:function(e,t){e=e||[];for(var i=this._childClusters.length-1;i>=0;i--)this._childClusters[i].getAllChildMarkers(e);for(var n=this._markers.length-1;n>=0;n--)t&&this._markers[n].__dragStart||e.push(this._markers[n]);return e},getChildCount:function(){return this._childCount},zoomToBounds:function(e){for(var t,i=this._childClusters.slice(),n=this._group._map,r=n.getBoundsZoom(this._bounds),s=this._zoom+1,o=n.getZoom();i.length>0&&r>s;){s++;var a=[];for(t=0;t<i.length;t++)a=a.concat(i[t]._childClusters);i=a}r>s?this._group._map.setView(this._latlng,s):o>=r?this._group._map.setView(this._latlng,o+1):this._group._map.fitBounds(this._bounds,e)},getBounds:function(){var e=new L.LatLngBounds;return e.extend(this._bounds),e},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(e,t){this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._setClusterCenter(e),e instanceof L.MarkerCluster?(t||(this._childClusters.push(e),e.__parent=this),this._childCount+=e._childCount):(t||this._markers.push(e),this._childCount++),this.__parent&&this.__parent._addChild(e,!0)},_setClusterCenter:function(e){this._cLatLng||(this._cLatLng=e._cLatLng||e._latlng)},_resetBounds:function(){var e=this._bounds;e._southWest&&(e._southWest.lat=1/0,e._southWest.lng=1/0),e._northEast&&(e._northEast.lat=-1/0,e._northEast.lng=-1/0)},_recalculateBounds:function(){var e,t,i,n,r=this._markers,s=this._childClusters,o=0,a=0,h=this._childCount;if(0!==h){for(this._resetBounds(),e=0;e<r.length;e++)i=r[e]._latlng,this._bounds.extend(i),o+=i.lat,a+=i.lng;for(e=0;e<s.length;e++)t=s[e],t._boundsNeedUpdate&&t._recalculateBounds(),this._bounds.extend(t._bounds),i=t._wLatLng,n=t._childCount,o+=i.lat*n,a+=i.lng*n;this._latlng=this._wLatLng=new L.LatLng(o/h,a/h),this._boundsNeedUpdate=!1}},_addToMap:function(e){e&&(this._backupLatlng=this._latlng,this.setLatLng(e)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(e,t,i){this._recursively(e,this._group._map.getMinZoom(),i-1,function(e){var i,n,r=e._markers;for(i=r.length-1;i>=0;i--)n=r[i],n._icon&&(n._setPos(t),n.clusterHide())},function(e){var i,n,r=e._childClusters;for(i=r.length-1;i>=0;i--)n=r[i],n._icon&&(n._setPos(t),n.clusterHide())})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(e,t,i,n){this._recursively(e,n,t,function(r){r._recursivelyAnimateChildrenIn(e,r._group._map.latLngToLayerPoint(r.getLatLng()).round(),i),r._isSingleParent()&&i-1===n?(r.clusterShow(),r._recursivelyRemoveChildrenFromMap(e,t,i)):r.clusterHide(),r._addToMap()})},_recursivelyBecomeVisible:function(e,t){this._recursively(e,this._group._map.getMinZoom(),t,null,function(e){e.clusterShow()})},_recursivelyAddChildrenToMap:function(e,t,i){this._recursively(i,this._group._map.getMinZoom()-1,t,function(n){if(t!==n._zoom)for(var r=n._markers.length-1;r>=0;r--){var s=n._markers[r];i.contains(s._latlng)&&(e&&(s._backupLatlng=s.getLatLng(),s.setLatLng(e),s.clusterHide&&s.clusterHide()),n._group._featureGroup.addLayer(s))}},function(t){t._addToMap(e)})},_recursivelyRestoreChildPositions:function(e){for(var t=this._markers.length-1;t>=0;t--){var i=this._markers[t];i._backupLatlng&&(i.setLatLng(i._backupLatlng),delete i._backupLatlng)}if(e-1===this._zoom)for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n]._restorePosition();else for(var r=this._childClusters.length-1;r>=0;r--)this._childClusters[r]._recursivelyRestoreChildPositions(e)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(e,t,i,n){var r,s;this._recursively(e,t-1,i-1,function(e){for(s=e._markers.length-1;s>=0;s--)r=e._markers[s],n&&n.contains(r._latlng)||(e._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())},function(e){for(s=e._childClusters.length-1;s>=0;s--)r=e._childClusters[s],n&&n.contains(r._latlng)||(e._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())})},_recursively:function(e,t,i,n,r){var s,o,a=this._childClusters,h=this._zoom;if(h>=t&&(n&&n(this),r&&h===i&&r(this)),t>h||i>h)for(s=a.length-1;s>=0;s--)o=a[s],o._boundsNeedUpdate&&o._recalculateBounds(),e.intersects(o._bounds)&&o._recursively(e,t,i,n,r)},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.Marker.include({clusterHide:function(){var e=this.options.opacity;return this.setOpacity(0),this.options.opacity=e,this},clusterShow:function(){return this.setOpacity(this.options.opacity)}}),L.DistanceGrid=function(e){this._cellSize=e,this._sqCellSize=e*e,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(e,t){var i=this._getCoord(t.x),n=this._getCoord(t.y),r=this._grid,s=r[n]=r[n]||{},o=s[i]=s[i]||[],a=L.Util.stamp(e);this._objectPoint[a]=t,o.push(e)},updateObject:function(e,t){this.removeObject(e),this.addObject(e,t)},removeObject:function(e,t){var i,n,r=this._getCoord(t.x),s=this._getCoord(t.y),o=this._grid,a=o[s]=o[s]||{},h=a[r]=a[r]||[];for(delete this._objectPoint[L.Util.stamp(e)],i=0,n=h.length;n>i;i++)if(h[i]===e)return h.splice(i,1),1===n&&delete a[r],!0},eachObject:function(e,t){var i,n,r,s,o,a,h,l=this._grid;for(i in l){o=l[i];for(n in o)for(a=o[n],r=0,s=a.length;s>r;r++)h=e.call(t,a[r]),h&&(r--,s--)}},getNearObject:function(e){var t,i,n,r,s,o,a,h,l=this._getCoord(e.x),u=this._getCoord(e.y),_=this._objectPoint,d=this._sqCellSize,c=null;for(t=u-1;u+1>=t;t++)if(r=this._grid[t])for(i=l-1;l+1>=i;i++)if(s=r[i])for(n=0,o=s.length;o>n;n++)a=s[n],h=this._sqDist(_[L.Util.stamp(a)],e),(d>h||d>=h&&null===c)&&(d=h,c=a);return c},_getCoord:function(e){var t=Math.floor(e/this._cellSize);return isFinite(t)?t:e},_sqDist:function(e,t){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n}},function(){L.QuickHull={getDistant:function(e,t){var i=t[1].lat-t[0].lat,n=t[0].lng-t[1].lng;return n*(e.lat-t[0].lat)+i*(e.lng-t[0].lng)},findMostDistantPointFromBaseLine:function(e,t){var i,n,r,s=0,o=null,a=[];for(i=t.length-1;i>=0;i--)n=t[i],r=this.getDistant(n,e),r>0&&(a.push(n),r>s&&(s=r,o=n));return{maxPoint:o,newPoints:a}},buildConvexHull:function(e,t){var i=[],n=this.findMostDistantPointFromBaseLine(e,t);return n.maxPoint?(i=i.concat(this.buildConvexHull([e[0],n.maxPoint],n.newPoints)),i=i.concat(this.buildConvexHull([n.maxPoint,e[1]],n.newPoints))):[e[0]]},getConvexHull:function(e){var t,i=!1,n=!1,r=!1,s=!1,o=null,a=null,h=null,l=null,u=null,_=null;for(t=e.length-1;t>=0;t--){var d=e[t];(i===!1||d.lat>i)&&(o=d,i=d.lat),(n===!1||d.lat<n)&&(a=d,n=d.lat),(r===!1||d.lng>r)&&(h=d,r=d.lng),(s===!1||d.lng<s)&&(l=d,s=d.lng)}n!==i?(_=a,u=o):(_=l,u=h);var c=[].concat(this.buildConvexHull([_,u],e),this.buildConvexHull([u,_],e));return c}}}(),L.MarkerCluster.include({getConvexHull:function(){var e,t,i=this.getAllChildMarkers(),n=[];for(t=i.length-1;t>=0;t--)e=i[t].getLatLng(),n.push(e);return L.QuickHull.getConvexHull(n)}}),L.MarkerCluster.include({_2PI:2*Math.PI,_circleFootSeparation:25,_circleStartAngle:0,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(this._group._spiderfied!==this&&!this._group._inZoomAnimation){var e,t=this.getAllChildMarkers(null,!0),i=this._group,n=i._map,r=n.latLngToLayerPoint(this._latlng);this._group._unspiderfy(),this._group._spiderfied=this,t.length>=this._circleSpiralSwitchover?e=this._generatePointsSpiral(t.length,r):(r.y+=10,e=this._generatePointsCircle(t.length,r)),this._animationSpiderfy(t,e)}},unspiderfy:function(e){this._group._inZoomAnimation||(this._animationUnspiderfy(e),this._group._spiderfied=null)},_generatePointsCircle:function(e,t){var i,n,r=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+e),s=r/this._2PI,o=this._2PI/e,a=[];for(s=Math.max(s,35),a.length=e,i=0;e>i;i++)n=this._circleStartAngle+i*o,a[i]=new L.Point(t.x+s*Math.cos(n),t.y+s*Math.sin(n))._round();return a},_generatePointsSpiral:function(e,t){var i,n=this._group.options.spiderfyDistanceMultiplier,r=n*this._spiralLengthStart,s=n*this._spiralFootSeparation,o=n*this._spiralLengthFactor*this._2PI,a=0,h=[];for(h.length=e,i=e;i>=0;i--)e>i&&(h[i]=new L.Point(t.x+r*Math.cos(a),t.y+r*Math.sin(a))._round()),a+=s/r+5e-4*i,r+=o/a;return h},_noanimationUnspiderfy:function(){var e,t,i=this._group,n=i._map,r=i._featureGroup,s=this.getAllChildMarkers(null,!0);for(i._ignoreMove=!0,this.setOpacity(1),t=s.length-1;t>=0;t--)e=s[t],r.removeLayer(e),e._preSpiderfyLatlng&&(e.setLatLng(e._preSpiderfyLatlng),delete e._preSpiderfyLatlng),e.setZIndexOffset&&e.setZIndexOffset(0),e._spiderLeg&&(n.removeLayer(e._spiderLeg),delete e._spiderLeg);i.fire("unspiderfied",{cluster:this,markers:s}),i._ignoreMove=!1,i._spiderfied=null}}),L.MarkerClusterNonAnimated=L.MarkerCluster.extend({_animationSpiderfy:function(e,t){var i,n,r,s,o=this._group,a=o._map,h=o._featureGroup,l=this._group.options.spiderLegPolylineOptions;for(o._ignoreMove=!0,i=0;i<e.length;i++)s=a.layerPointToLatLng(t[i]),n=e[i],r=new L.Polyline([this._latlng,s],l),a.addLayer(r),n._spiderLeg=r,n._preSpiderfyLatlng=n._latlng,n.setLatLng(s),n.setZIndexOffset&&n.setZIndexOffset(1e6),h.addLayer(n);this.setOpacity(.3),o._ignoreMove=!1,o.fire("spiderfied",{cluster:this,markers:e})},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerCluster.include({_animationSpiderfy:function(e,t){var i,n,r,s,o,a,h=this,l=this._group,u=l._map,_=l._featureGroup,d=this._latlng,c=u.latLngToLayerPoint(d),p=L.Path.SVG,f=L.extend({},this._group.options.spiderLegPolylineOptions),m=f.opacity;for(void 0===m&&(m=L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity),p?(f.opacity=0,f.className=(f.className||"")+" leaflet-cluster-spider-leg"):f.opacity=m,l._ignoreMove=!0,i=0;i<e.length;i++)n=e[i],a=u.layerPointToLatLng(t[i]),r=new L.Polyline([d,a],f),u.addLayer(r),n._spiderLeg=r,p&&(s=r._path,o=s.getTotalLength()+.1,s.style.strokeDasharray=o,s.style.strokeDashoffset=o),n.setZIndexOffset&&n.setZIndexOffset(1e6),n.clusterHide&&n.clusterHide(),_.addLayer(n),n._setPos&&n._setPos(c);for(l._forceLayout(),l._animationStart(),i=e.length-1;i>=0;i--)a=u.layerPointToLatLng(t[i]),n=e[i],n._preSpiderfyLatlng=n._latlng,n.setLatLng(a),n.clusterShow&&n.clusterShow(),p&&(r=n._spiderLeg,s=r._path,s.style.strokeDashoffset=0,r.setStyle({opacity:m}));this.setOpacity(.3),l._ignoreMove=!1,setTimeout(function(){l._animationEnd(),l.fire("spiderfied",{cluster:h,markers:e})},200)},_animationUnspiderfy:function(e){var t,i,n,r,s,o,a=this,h=this._group,l=h._map,u=h._featureGroup,_=e?l._latLngToNewLayerPoint(this._latlng,e.zoom,e.center):l.latLngToLayerPoint(this._latlng),d=this.getAllChildMarkers(null,!0),c=L.Path.SVG;for(h._ignoreMove=!0,h._animationStart(),this.setOpacity(1),i=d.length-1;i>=0;i--)t=d[i],t._preSpiderfyLatlng&&(t.closePopup(),t.setLatLng(t._preSpiderfyLatlng),delete t._preSpiderfyLatlng,o=!0,t._setPos&&(t._setPos(_),o=!1),t.clusterHide&&(t.clusterHide(),o=!1),o&&u.removeLayer(t),c&&(n=t._spiderLeg,r=n._path,s=r.getTotalLength()+.1,r.style.strokeDashoffset=s,n.setStyle({opacity:0})));h._ignoreMove=!1,setTimeout(function(){var e=0;for(i=d.length-1;i>=0;i--)t=d[i],t._spiderLeg&&e++;for(i=d.length-1;i>=0;i--)t=d[i],t._spiderLeg&&(t.clusterShow&&t.clusterShow(),t.setZIndexOffset&&t.setZIndexOffset(0),e>1&&u.removeLayer(t),l.removeLayer(t._spiderLeg),delete t._spiderLeg);h._animationEnd(),h.fire("unspiderfied",{cluster:a,markers:d})},200)}}),L.MarkerClusterGroup.include({_spiderfied:null,unspiderfy:function(){this._unspiderfy.apply(this,arguments)},_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on("zoomstart",this._unspiderfyZoomStart,this),this._map.on("zoomend",this._noanimationUnspiderfy,this),L.Browser.touch||this._map.getRenderer(this)},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._map.off("zoomend",this._noanimationUnspiderfy,this),this._noanimationUnspiderfy()
},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(e){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(e))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(e){this._spiderfied&&this._spiderfied.unspiderfy(e)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(e){e._spiderLeg&&(this._featureGroup.removeLayer(e),e.clusterShow&&e.clusterShow(),e.setZIndexOffset&&e.setZIndexOffset(0),this._map.removeLayer(e._spiderLeg),delete e._spiderLeg)}}),L.MarkerClusterGroup.include({refreshClusters:function(e){return e?e instanceof L.MarkerClusterGroup?e=e._topClusterLevel.getAllChildMarkers():e instanceof L.LayerGroup?e=e._layers:e instanceof L.MarkerCluster?e=e.getAllChildMarkers():e instanceof L.Marker&&(e=[e]):e=this._topClusterLevel.getAllChildMarkers(),this._flagParentsIconsNeedUpdate(e),this._refreshClustersIcons(),this.options.singleMarkerMode&&this._refreshSingleMarkerModeMarkers(e),this},_flagParentsIconsNeedUpdate:function(e){var t,i;for(t in e)for(i=e[t].__parent;i;)i._iconNeedsUpdate=!0,i=i.__parent},_refreshSingleMarkerModeMarkers:function(e){var t,i;for(t in e)i=e[t],this.hasLayer(i)&&i.setIcon(this._overrideMarkerIcon(i))}}),L.Marker.include({refreshIconOptions:function(e,t){var i=this.options.icon;return L.setOptions(i,e),this.setIcon(i),t&&this.__parent&&this.__parent._group.refreshClusters(this),this}}),e.MarkerClusterGroup=t,e.MarkerCluster=i});
L.HtmlIcon=L.Icon.extend({
options: {
},
initialize: function (options){
L.Util.setOptions(this, options);
},
createIcon: function (){
var div=document.createElement('div');
div.innerHTML=this.options.html;
return div;
},
createShadow: function (){
return null;
}});
// Based on https://github.com/shramov/leaflet-plugins
L.GridLayer.GoogleMutant=L.GridLayer.extend({
options: {
minZoom: 0,
maxZoom: 23,
tileSize: 256,
subdomains: 'abc',
errorTileUrl: '',
attribution: '',
opacity: 1,
continuousWorld: false,
noWrap: false,
type: 'roadmap',
maxNativeZoom: 21
},
initialize: function (options){
L.GridLayer.prototype.initialize.call(this, options);
this._ready = !!window.google&&!!window.google.maps&&!!window.google.maps.Map;
this._GAPIPromise=this._ready ? Promise.resolve(window.google):new Promise(function (resolve, reject){
var checkCounter=0;
var intervalId=null;
intervalId=setInterval(function (){
if(checkCounter >=10){
clearInterval(intervalId);
return reject(new Error('window.google not found after 10 attempts'));
}
if(!!window.google&&!!window.google.maps&&!!window.google.maps.Map){
clearInterval(intervalId);
return resolve(window.google);
}
checkCounter++;
}, 500);
});
this._tileCallbacks={};
this._freshTiles={};
this._imagesPerTile=(this.options.type==='hybrid') ? 2:1;
this._boundOnMutatedImage=this._onMutatedImage.bind(this);
},
onAdd: function (map){
L.GridLayer.prototype.onAdd.call(this, map);
this._initMutantContainer();
this._GAPIPromise.then(function (){
this._ready=true;
this._map=map;
this._initMutant();
map.on('viewreset', this._reset, this);
if(this.options.updateWhenIdle){
map.on('moveend', this._update, this);
}else{
map.on('move', this._update, this);
}
map.on('zoomend', this._handleZoomAnim, this);
map.on('resize', this._resize, this);
google.maps.event.addListenerOnce(this._mutant, 'idle', function (){
this._checkZoomLevels();
this._mutantIsReady=true;
}.bind(this));
map._controlCorners.bottomright.style.marginBottom='20px';
map._controlCorners.bottomleft.style.marginBottom='20px';
this._reset();
this._update();
if(this._subLayers){
for (var layerName in this._subLayers){
this._subLayers[layerName].setMap(this._mutant);
}}
}.bind(this));
},
onRemove: function (map){
L.GridLayer.prototype.onRemove.call(this, map);
this._observer.disconnect();
map._container.removeChild(this._mutantContainer);
google.maps.event.clearListeners(map, 'idle');
google.maps.event.clearListeners(this._mutant, 'idle');
map.off('viewreset', this._reset, this);
map.off('move', this._update, this);
map.off('moveend', this._update, this);
map.off('zoomend', this._handleZoomAnim, this);
map.off('resize', this._resize, this);
if(map._controlCorners){
map._controlCorners.bottomright.style.marginBottom='0em';
map._controlCorners.bottomleft.style.marginBottom='0em';
}},
getAttribution: function (){
return this.options.attribution;
},
setElementSize: function (e, size){
e.style.width=size.x + 'px';
e.style.height=size.y + 'px';
},
addGoogleLayer: function (googleLayerName, options){
if(!this._subLayers) this._subLayers={};
return this._GAPIPromise.then(function (){
var Constructor=google.maps[googleLayerName];
var googleLayer=new Constructor(options);
googleLayer.setMap(this._mutant);
this._subLayers[googleLayerName]=googleLayer;
return googleLayer;
}.bind(this));
},
removeGoogleLayer: function (googleLayerName){
var googleLayer=this._subLayers&&this._subLayers[googleLayerName];
if(!googleLayer) return;
googleLayer.setMap(null);
delete this._subLayers[googleLayerName];
},
_initMutantContainer: function (){
if(!this._mutantContainer){
this._mutantContainer=L.DomUtil.create('div', 'leaflet-google-mutant leaflet-top leaflet-left');
this._mutantContainer.id='_MutantContainer_' + L.Util.stamp(this._mutantContainer);
this._mutantContainer.style.zIndex='800';
this._mutantContainer.style.pointerEvents='none';
L.DomEvent.off(this._mutantContainer);
}
this._map.getContainer().appendChild(this._mutantContainer);
this.setOpacity(this.options.opacity);
this.setElementSize(this._mutantContainer, this._map.getSize());
this._attachObserver(this._mutantContainer);
},
_initMutant: function (){
if(!this._ready||!this._mutantContainer) return;
if(this._mutant){
this._resize();
return;
}
this._mutantCenter=new google.maps.LatLng(0, 0);
var map=new google.maps.Map(this._mutantContainer, {
center: this._mutantCenter,
zoom: 0,
tilt: 0,
mapTypeId: this.options.type,
disableDefaultUI: true,
keyboardShortcuts: false,
draggable: false,
disableDoubleClickZoom: true,
scrollwheel: false,
streetViewControl: false,
styles: this.options.styles||{},
backgroundColor: 'transparent'
});
this._mutant=map;
google.maps.event.addListenerOnce(map, 'idle', function (){
var nodes=this._mutantContainer.querySelectorAll('a');
for (var i=0; i < nodes.length; i++){
nodes[i].style.pointerEvents='auto';
}}.bind(this));
this.fire('spawned', {mapObject: map});
},
_attachObserver: function _attachObserver (node){
if(!this._observer)
this._observer=new MutationObserver(this._onMutations.bind(this));
this._observer.observe(node, { childList: true, subtree: true });
Array.prototype.forEach.call(node.querySelectorAll('img'),
this._boundOnMutatedImage
);
},
_onMutations: function _onMutations (mutations){
for (var i=0; i < mutations.length; ++i){
var mutation=mutations[i];
for (var j=0; j < mutation.addedNodes.length; ++j){
var node=mutation.addedNodes[j];
if(node instanceof HTMLImageElement){
this._onMutatedImage(node);
}else if(node instanceof HTMLElement){
Array.prototype.forEach.call(node.querySelectorAll('img'),
this._boundOnMutatedImage
);
if(node.style.backgroundColor==='white'){
L.DomUtil.remove(node);
}
if(node.textContent.indexOf('For development purposes only')===0){
L.DomUtil.remove(node);
}
Array.prototype.forEach.call(node.querySelectorAll('div[draggable=false][style*="text-align: center"]'),
L.DomUtil.remove
);
}}
}},
_roadRegexp: /!1i(\d+)!2i(\d+)!3i(\d+)!/,
_satRegexp: /x=(\d+)&y=(\d+)&z=(\d+)/,
_staticRegExp: /StaticMapService\.GetMapImage/,
_onMutatedImage: function _onMutatedImage (imgNode){
var coords;
var match=imgNode.src.match(this._roadRegexp);
var sublayer=0;
if(match){
coords={
z: match[1],
x: match[2],
y: match[3]
};
if(this._imagesPerTile > 1){
imgNode.style.zIndex=1;
sublayer=1;
}}else{
match=imgNode.src.match(this._satRegexp);
if(match){
coords={
x: match[1],
y: match[2],
z: match[3]
};}
sublayer=0;
}
if(coords){
var tileKey=this._tileCoordsToKey(coords);
imgNode.style.position='absolute';
imgNode.style.visibility='hidden';
var key=tileKey + '/' + sublayer;
this._freshTiles[key]=imgNode;
if(key in this._tileCallbacks&&this._tileCallbacks[key]){
this._tileCallbacks[key].pop()(imgNode);
if(!this._tileCallbacks[key].length){ delete this._tileCallbacks[key]; }}else{
if(this._tiles[tileKey]){
var c=this._tiles[tileKey].el;
var oldImg=(sublayer===0) ? c.firstChild:c.firstChild.nextSibling;
var cloneImgNode=this._clone(imgNode);
c.replaceChild(cloneImgNode, oldImg);
}}
}else if(imgNode.src.match(this._staticRegExp)){
imgNode.style.visibility='hidden';
}},
createTile: function (coords, done){
var key=this._tileCoordsToKey(coords);
var tileContainer=L.DomUtil.create('div');
tileContainer.dataset.pending=this._imagesPerTile;
done=done.bind(this, null, tileContainer);
for (var i=0; i < this._imagesPerTile; i++){
var key2=key + '/' + i;
if(key2 in this._freshTiles){
var imgNode=this._freshTiles[key2];
tileContainer.appendChild(this._clone(imgNode));
tileContainer.dataset.pending--;
}else{
this._tileCallbacks[key2]=this._tileCallbacks[key2]||[];
this._tileCallbacks[key2].push((function (c){
return function (imgNode){
c.appendChild(this._clone(imgNode));
c.dataset.pending--;
if(!parseInt(c.dataset.pending)){ done(); }}.bind(this);
}.bind(this))(tileContainer));
}}
if(!parseInt(tileContainer.dataset.pending)){
L.Util.requestAnimFrame(done);
}
return tileContainer;
},
_clone: function (imgNode){
var clonedImgNode=imgNode.cloneNode(true);
clonedImgNode.style.visibility='visible';
return clonedImgNode;
},
_checkZoomLevels: function (){
var zoomLevel=this._map.getZoom();
var gMapZoomLevel=this._mutant.getZoom();
if(!zoomLevel||!gMapZoomLevel) return;
if((gMapZoomLevel!==zoomLevel) ||
(gMapZoomLevel > this.options.maxNativeZoom)){
this._setMaxNativeZoom(gMapZoomLevel);
}},
_setMaxNativeZoom: function (zoomLevel){
if(zoomLevel!=this.options.maxNativeZoom){
this.options.maxNativeZoom=zoomLevel;
this._resetView();
}},
_reset: function (){
this._initContainer();
},
_update: function (){
if(this._mutant){
var center=this._map.getCenter();
var _center=new google.maps.LatLng(center.lat, center.lng);
this._mutant.setCenter(_center);
var zoom=this._map.getZoom();
var fractionalLevel=zoom!==Math.round(zoom);
var mutantZoom=this._mutant.getZoom();
if(!fractionalLevel&&(zoom!=mutantZoom)){
this._mutant.setZoom(zoom);
if(this._mutantIsReady) this._checkZoomLevels();
}}
L.GridLayer.prototype._update.call(this);
},
_resize: function (){
var size=this._map.getSize();
if(this._mutantContainer.style.width===size.x &&
this._mutantContainer.style.height===size.y)
return;
this.setElementSize(this._mutantContainer, size);
if(!this._mutant) return;
google.maps.event.trigger(this._mutant, 'resize');
},
_handleZoomAnim: function (){
if(!this._mutant) return;
var center=this._map.getCenter();
var _center=new google.maps.LatLng(center.lat, center.lng);
this._mutant.setCenter(_center);
this._mutant.setZoom(Math.round(this._map.getZoom()));
},
_removeTile: function (key){
if(!this._mutant) return;
setTimeout(this._pruneTile.bind(this, key), 1000);
return L.GridLayer.prototype._removeTile.call(this, key);
},
_pruneTile: function (key){
var gZoom=this._mutant.getZoom();
var tileZoom=key.split(':')[2];
var googleBounds=this._mutant.getBounds();
var sw=googleBounds.getSouthWest();
var ne=googleBounds.getNorthEast();
var gMapBounds=L.latLngBounds([[sw.lat(), sw.lng()], [ne.lat(), ne.lng()]]);
for (var i=0; i<this._imagesPerTile; i++){
var key2=key + '/' + i;
if(key2 in this._freshTiles){
var tileBounds=this._map&&this._keyToBounds(key);
var stillVisible=this._map&&tileBounds.overlaps(gMapBounds)&&(tileZoom==gZoom);
if(!stillVisible) delete this._freshTiles[key2];
}}
}});
L.gridLayer.googleMutant=function (options){
return new L.GridLayer.GoogleMutant(options);
};
(function($){
"use strict";
var __cache=[];
$.extend($.apusThemeCore, {
job_init: function(){
var self=this;
self.select2Init();
self.searchAjaxInit();
self.listingDetail();
self.filterListingFnc();
self.listingBtnFilter();
self.portfolio();
self.sendPrivateMessage();
self.changeHeightJobsDetail();
setTimeout(function(){
self.changePaddingTopContent();
$(window).trigger('resize');
}, 100);
self.checkSidebar();
$(window).resize(function(){
setTimeout(function(){
self.changePaddingTopContent();
self.changeHeightJobsDetail();
}, 50);
});
self.userLoginRegister();
self.dashboardChart();
if($('.jobs-listing-wrapper.main-items-wrapper, .employers-listing-wrapper.main-items-wrapper, .candidates-listing-wrapper.main-items-wrapper').length){
$(document).on('change', 'form.filter-listing-form-wrapper input, form.filter-listing-form-wrapper select', function (e){
var form=$(this).closest('form.filter-listing-form-wrapper');
if($(this).attr('name')=='filter-salary-type'){
form.find('input[name=filter-salary-from]').val('');
form.find('input[name=filter-salary-to]').val('');
}
setTimeout(function(){
form.trigger('submit');
}, 200);
});
$(document).on('submit', 'form.filter-listing-form-wrapper', function (e){
e.preventDefault();
var url=$(this).attr('action');
var formData=$(this).find(":input").filter(function(index, element){
return $(element).val()!='';
}).serialize();
if(url.indexOf('?')!=-1){
url=url + '&' + formData;
}else{
url=url + '?' + formData;
}
self.jobsGetPage(url);
return false;
});
}
$(document).on('change', 'form.jobs-ordering select.orderby', function(e){
e.preventDefault();
$('form.jobs-ordering').trigger('submit');
});
$(document).on('submit', 'form.jobs-ordering', function (e){
var url=$(this).attr('action');
var formData=$(this).find(":input").filter(function(index, element){
return $(element).val()!='';
}).serialize();
if(url.indexOf('?')!=-1){
url=url + '&' + formData;
}else{
url=url + '?' + formData;
}
self.jobsGetPage(url);
return false;
});
if($('.ajax-pagination').length){
self.ajaxPaginationLoad();
}
$(document).on('click', '.advance-search-btn', function(e){
e.preventDefault();
$(this).closest('.filter-listing-form').find('.advance-search-wrapper').slideToggle('fast', 'swing');
});
$('.message-notification').on('click', function (e){
e.stopPropagation();
$('.notifications-wrapper').toggleClass('active');
$('.message-top .notifications-wrapper.active').perfectScrollbar();
});
$('body').on('click', function(){
if($('.notifications-wrapper').hasClass('active')){
$('.notifications-wrapper').removeClass('active');
}});
$('.notifications-wrapper').on('click', function(e){
e.stopPropagation();
});
$('body').on('click', '.close-filter-sidebar', function(){
var parent=$(this).closest('.inner-left');
parent.find('.filter-sidebar').removeClass('active');
parent.find('.over-dark').removeClass('active');
});
},
checkSidebar: function(){
$('.sidebar-job > .widget').each(function(){
var $this=$(this);
if($this.find('> *').length > 0){
$this.addClass('has-content');
}});
},
dashboardChart: function(){
var self=this;
if($('#dashboard_chart_wrapper').length){
var $this=$('#dashboard_chart_wrapper');
var labels=$this.data('labels');
var values=$this.data('values');
var label=$this.data('label');
var chart_type=$this.data('chart_type');
var bg_color=$this.data('bg_color');
var border_color=$this.data('border_color');
var ctx=$this.get(0).getContext("2d");
var data={
labels: labels,
datasets: [
{
label: label,
backgroundColor: bg_color,
borderColor: border_color,
borderWidth: 1,
data: values
},
]
};
var options={
scaleBeginAtZero:true,
scaleShowGridLines:false,
scaleGridLineColor:"rgba(0,0,0,.05)",
scaleGridLineWidth:1,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
barShowStroke:false,
barStrokeWidth:2,
barValueSpacing:5,
barDatasetSpacing:1,
legend: { display: false },
tooltips: {
enabled: true,
mode: 'x-axis',
cornerRadius: 4
},
}
var myBarChart=new Chart(ctx, {
type: chart_type,
data: data,
options: options
});
}
$('.dashboard-notifications-wrapper').perfectScrollbar();
var self=this;
var $this=$('#dashboard_job_chart_wrapper');
if($this.length <=0){
return;
}
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=false;
select2_args['minimumResultsForSearch']=10;
select2_args['language']={
noResults: function(){
return wp_job_board_pro_select2_opts.language_result;
}};
select2_args['width']='100%';
$('.stats-graph-search-form select').select2(select2_args);
}
var job_id=$this.data('job_id');
var nb_days=$this.data('nb_days');
self.dashboardChartAjaxInit($this, job_id, nb_days);
$('form.stats-graph-search-form select[name="job_id"]').on('change', function(){
$('form.stats-graph-search-form').trigger('submit');
});
$('form.stats-graph-search-form select[name="nb_days"]').on('change', function(){
$('form.stats-graph-search-form').trigger('submit');
});
$('form.stats-graph-search-form').on('submit', function(e){
e.preventDefault();
var job_id=$('form.stats-graph-search-form select[name="job_id"]').val();
var nb_days=$('form.stats-graph-search-form select[name="nb_days"]').val();
self.dashboardChartAjaxInit($this, job_id, nb_days);
return false;
});
},
dashboardChartAjaxInit: function($this, job_id, nb_days){
var self=this;
if($this.length <=0){
return;
}
if($this.hasClass('loading')){
return;
}
$this.addClass('loading');
var ajaxurl=superio_job_opts.ajaxurl;
if(typeof wp_job_board_pro_opts.ajaxurl_endpoint!=='undefined'){
ajaxurl=wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'superio_get_job_chart');
}
$.ajax({
url: ajaxurl,
type:'POST',
dataType: 'json',
data: {
action: 'superio_get_job_chart',
job_id: job_id,
nb_days: nb_days,
nonce: $this.data('nonce'),
}}).done(function(response){
if(response.status=='error'){
$this.remove();
}else{
var ctx=$this.get(0).getContext("2d");
var data={
labels: response.stats_labels,
datasets: [
{
label: response.stats_view,
backgroundColor: response.bg_color,
borderColor: response.border_color,
borderWidth: 1,
data: response.stats_values
},
]
};
var options={
scaleBeginAtZero:true,
scaleShowGridLines:false,
scaleGridLineColor:"rgba(0,0,0,.05)",
scaleGridLineWidth:1,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
barShowStroke:false,
barStrokeWidth:2,
barValueSpacing:5,
barDatasetSpacing:1,
legend: { display: false },
tooltips: {
enabled: true,
mode: 'x-axis',
cornerRadius: 4
},
}
if(typeof self.myBarChart!=='undefined'){
self.myBarChart.destroy();
}
self.myBarChart=new Chart(ctx, {
type: response.chart_type,
data: data,
options: options
});
}
$this.removeClass('loading');
});
},
portfolio: function(){
$('.portfolio').each(function(){
var $this=$(this);
$('.view-more-gallery', $this).on('click', function(e){
$('.item', $this).removeClass('hidden');
$('.popup-image-gallery').removeClass('view-more-image');
$(this).addClass('hidden');
$(document).trigger('resize');
});
});
},
sendPrivateMessage: function(){
var self=this;
$('.send-private-message-btn').magnificPopup({
mainClass: 'apus-mfp-zoom-in login-popup',
type:'inline',
midClick: true
});
},
select2Init: function(){
var self=this;
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=true;
select2_args['minimumResultsForSearch']=10;
select2_args['language']={
noResults: function (params){
return select2_args['language_result'];
}}
$('.select-taxonomy-search').each(function(){
self.select2SearchInit($(this), select2_args, false);
});
$('.select-field-region-search').each(function(){
self.select2SearchInit($(this), select2_args, true);
});
$('body').on('change', 'select.select-field-region-search', function(){
var val=$(this).val();
var next=$(this).data('next');
var main_select='select.select-field-region-search' + next;
if($(main_select).length > 0){
$(main_select).val(null).trigger("change");
}});
$('.filter-listing-form select:not(.select-taxonomy-search, .select-field-region-search)').select2(select2_args);
select2_args['allowClear']=false;
$('select[name=jobs_ppp]').select2(select2_args);
$('select[name=candidates_ppp]').select2(select2_args);
$('select[name=employers_ppp]').select2(select2_args);
$('select[name=email_frequency]').select2(select2_args);
}},
select2SearchInit: function($element, select2_args, region){
$element.select2({
allowClear: true,
width: '100%',
dir: select2_args['dir'],
language: {
noResults: function (params){
return select2_args['language_result'];
},
inputTooShort: function (){
return select2_args['formatInputTooShort_text'];
}},
minimumInputLength: 2,
ajax: {
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'wpjb_search_terms'),
dataType: 'json',
delay: 250,
data: function (params){
if(region){
var parent_id=0;
var prev=$element.data('prev');
var prev_select=$('.select-field-region-search' + prev);
if(prev_select.length){
parent_id=prev_select.val();
if(!parent_id){
parent_id='lost-parent';
}}
var query={
search: params.term,
page: params.page||1,
taxonomy: $element.data('taxonomy'),
parent: parent_id,
prev: prev
}}else{
var query={
search: params.term,
page: params.page||1,
taxonomy: $element.data('taxonomy'),
parent: '',
prev: '',
}}
return query;
},
processResults: function (data, params){
params.page=params.page||1;
return {
results: $.map(data.results, function (item){
return {
text: item.name,
id: item.id
}}),
pagination: {
more: params.page < data.pages
}};},
transport: function(params, success, failure){
var __cachekey=params.data.search + '-' + params.data.taxonomy + '-' + params.data.page + '-' + params.data.parent + params.data.prev;
if('undefined'!==typeof __cache[__cachekey]){
success(__cache[__cachekey]);
return; 
}
var $request=$.ajax(params);
$request.then(function(data){
__cache[__cachekey]=data;
success(__cache[__cachekey]);
});
$request.fail(failure);
return $request;
},
cache: true
}});
},
changeHeightJobsDetail: function(){
var heightdetail=0;
if($('#job-details-wrapper .top-detail-job').length){
var heightdetail=$('#job-details-wrapper .top-detail-job').outerHeight();
}
$('#job-details-wrapper .job-content-area').css({ 'height': 'calc(100vh - ' +(heightdetail + 20) + 'px' });
},
changePaddingTopContent: function(){
var admin_bar_h=0;
if($('#wpadminbar').length){
var admin_bar_h=$('#wpadminbar').outerHeight();
}
if($(window).width() >=1200){
var header_h=$('#apus-header').outerHeight();
var header_top_h=header_h;
var header_main_content_h=header_h - admin_bar_h;
$('body.page-template-page-dashboard #apus-main-content').css({ 'padding-top': header_h });
if($('.layout-type-fullwidth .filter-sidebar').length){
$('.layout-type-fullwidth .filter-sidebar').css({ 'top': header_h, 'height': 'calc(100vh - ' + header_h + 'px)' });
$('#apus-main-content').css({ 'padding-top': header_main_content_h });
}}else{
var header_h=$('#apus-header-mobile').outerHeight();
if($('#jobs-google-maps').is('.fix-map')){
var header_top_h=header_h + admin_bar_h;
var header_main_content_h=header_h - admin_bar_h;
}else if($('.layout-type-fullwidth .filter-sidebar').length){
if($(window).width() >=992){
var header_top_h=header_h + admin_bar_h;
}else{
var header_top_h=header_h - admin_bar_h;
}
$('.layout-type-fullwidth .filter-sidebar').css({ 'padding-top': header_top_h, 'height': 'calc(100vh - ' + header_top_h + 'px)' });
$('#apus-main-content').css({ 'padding-top': header_top_h });
}
$('body.page-template-page-dashboard #apus-main-content').css({ 'padding-top': header_h });
}
if($('#jobs-google-maps').is('.fix-map')){
$('#jobs-google-maps').css({ 'top': header_top_h, 'height': 'calc(100vh - ' + header_top_h+ 'px)' });
$('#apus-main-content').css({ 'padding-top': header_main_content_h });
}
$('.offcanvas-filter-sidebar .filter-scroll, .layout-type-fullwidth .filter-sidebar').perfectScrollbar();
},
searchAjaxInit: function(){
if($.isFunction($.fn.typeahead) ){
$('.apus-autocompleate-input').each(function(){
var $this=$(this);
$this.typeahead({
'hint': true,
'highlight': true,
'minLength': 2,
'limit': 10
}, {
name: 'search',
source: function (query, processSync, processAsync){
processSync([superio_job_opts.empty_msg]);
$this.closest('.twitter-typeahead').addClass('loading');
var values={};
$.each($this.closest('form').serializeArray(), function (i, field){
values[field.name]=field.value;
});
return $.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'superio_autocomplete_search_jobs'),
type: 'GET',
data: {
'search': query,
'data': values
},
dataType: 'json',
success: function (json){
$this.closest('.twitter-typeahead').removeClass('loading');
$this.closest('.has-suggestion').removeClass('active');
return processAsync(json);
}});
},
templates: {
empty:[
'<div class="empty-message">',
superio_job_opts.empty_msg,
'</div>'
].join('\n'),
suggestion: function(data){
return '<a href="'+ data.url +'" class="media autocompleate-media">\
<div class="media-left media-middle">\
<img src="'+ data.image +'" class="media-object" height="50" width="50">\
</div>\
<div class="media-body media-middle">\
<h4>'+ data.title +'</h4>\
'+ data.salary +'\
</div></a>';
}},
}
);
$this.on('typeahead:selected', function (e, data){
e.preventDefault();
setTimeout(function(){
$('.apus-autocompleate-input').val(data.title);
}, 5);
return false;
});
});
}},
listingDetail: function(){
var self=this;
$(document).on('click', '.add-a-review', function(e){
e.preventDefault();
var $id=$(this).attr('href');
if($($id).length > 0){
$('html,body').animate({
scrollTop: $($id).offset().top - 100
}, 1000);
}});
},
listingBtnFilter: function(){
$('.btn-view-map').on('click', function(e){
e.preventDefault();
$('#jobs-google-maps').removeClass('hidden-sm').removeClass('hidden-xs');
$('.content-listing .jobs-listing-wrapper').addClass('hidden-sm').addClass('hidden-xs');
$('.content-listing .candidates-listing-wrapper').addClass('hidden-sm').addClass('hidden-xs');
$('.content-listing').addClass('no-padding');
$('.btn-view-listing').removeClass('hidden-sm').removeClass('hidden-xs');
$(this).addClass('hidden-sm').addClass('hidden-xs');
$('.jobs-pagination-wrapper').addClass('p-fix-pagination');
$('.candidates-pagination-wrapper').addClass('p-fix-pagination');
setTimeout(function(){
$(window).trigger('pxg:refreshmap');
});
});
$('.btn-view-listing').on('click', function(e){
e.preventDefault();
$('#jobs-google-maps').addClass('hidden-sm').addClass('hidden-xs');
$('.content-listing .jobs-listing-wrapper').removeClass('hidden-sm').removeClass('hidden-xs');
$('.content-listing .candidates-listing-wrapper').removeClass('hidden-sm').removeClass('hidden-xs');
$('.content-listing').removeClass('no-padding');
$('.btn-view-map').removeClass('hidden-sm').removeClass('hidden-xs');
$(this).addClass('hidden-sm').addClass('hidden-xs');
$('.jobs-pagination-wrapper').removeClass('p-fix-pagination');
$('.candidates-pagination-wrapper').removeClass('p-fix-pagination');
});
$(document).on('click', '.show-filter-jobs, .filter-in-sidebar', function(){
$('.offcanvas-filter-sidebar').toggleClass('active');
$('.offcanvas-filter-sidebar + .over-dark').toggleClass('active');
});
$(document).on('click', '.offcanvas-filter-sidebar + .over-dark', function(){
$('.offcanvas-filter-sidebar').removeClass('active');
$('.offcanvas-filter-sidebar + .over-dark').removeClass('active');
});
},
userLoginRegister: function(){
var self=this;
$('.user-login-form, .must-log-in').on('click', function(e){
if($('.apus-user-login').length){
e.preventDefault();
$('.apus-user-login').trigger('click');
}});
$('.apus-user-login, .apus-user-register').magnificPopup({
mainClass: 'apus-mfp-zoom-in login-popup',
type:'inline',
midClick: true,
modal: true,
callbacks: {
open: function(){
self.layzyLoadImage();
}}
});
$('.meesage-meeting-wrapper').perfectScrollbar();
$(".show_hide_password a").on('click', function(event){
event.preventDefault();
if($(this).siblings('input').attr("type")=="text"){
$(this).attr('title', superio_job_opts.show);
$(this).siblings('input').attr('type', 'password');
$(this).find('span').addClass("dashicons-hidden");
$(this).find('span').removeClass("dashicons-visibility");
}else if($(this).siblings('input').attr("type")=="password"){
$(this).attr('title', superio_job_opts.hide);
$(this).siblings('input').attr('type', 'text');
$(this).find('span').removeClass("dashicons-hidden");
$(this).find('span').addClass("dashicons-visibility");
}});
},
filterListingFnc: function(){
var self=this;
$('body').on('click', '.btn-show-filter, .offcanvas-filter-sidebar + .over-dark', function(){
$('.offcanvas-filter-sidebar, .offcanvas-filter-sidebar + .over-dark').toggleClass('active');
$('.offcanvas-filter-sidebar').perfectScrollbar();
});
$('body').on('click', '.tax-radios-field .form-group-inner ul span.caret-wrapper, .tax-checklist-field .form-group-inner ul span.caret-wrapper', function(){
var con=$(this).closest('.list-item');
con.find('> ul').slideToggle();
});
$('form .toggle-field.hide-content .heading-label i').removeClass('fa-angle-down').addClass('fa-angle-up');
$('body').on('click', 'form .toggle-field .heading-label', function(){
if($(this).find('i').hasClass('fa-angle-down')){
$(this).find('i').removeClass('fa-angle-down').addClass('fa-angle-up');
}else{
$(this).find('i').removeClass('fa-angle-up').addClass('fa-angle-down');
}
var parent_e=$(this).closest('.form-group');
setTimeout(function(){
if(parent_e.hasClass('tax-viewmore-field')){
var height=parent_e.find('.terms-list').outerHeight();
if(height > 231){
parent_e.addClass('show-more');
}}
}, 300);
});
$('.tax-viewmore-field').each(function(){
var height=$(this).find('.terms-list').outerHeight();
if(height > 231){
$(this).addClass('show-more');
}});
$(document).on('click', '.toggle-filter-viewmore', function(){
var $this=$(this);
var container=$(this).closest('.tax-viewmore-field');
if(container.hasClass('show-more')){
container.addClass('show-less').removeClass('show-more');
$this.find('.text').text(wp_job_board_pro_opts.show_less);
}else{
container.addClass('show-more').removeClass('show-less');
$this.find('.text').text(wp_job_board_pro_opts.show_more);
}});
if($('input.field-datetimepicker').length > 0&&$.isFunction($.fn.datetimepicker) ){
jQuery.datetimepicker.setLocale(superio_job_opts.lang_code);
$('input.field-datetimepicker').datetimepicker({
timepicker:false,
'scrollInput': false,
format:'Y/m/d',
});
}
if($(window).width() > 991){
$(document).on('click', '.layout-type-half-job-details .item-job', function(e){
if(self.showJobAjax){ return false; }
var $this=$(this);
self.loadJobDetail($this);
});
$(document).on('click', '.layout-type-half-job-details .item-job .job-title a', function(e){
e.preventDefault();
if(self.showJobAjax){ return false; }
var $this=$(this).closest('.item-job');
self.loadJobDetail($this);
});
}},
loadJobDetail($this){
var self=this;
$('#job-details-wrapper').addClass('loading');
self.showJobAjax=$.ajax({
url: wp_job_board_pro_opts.ajaxurl_endpoint.toString().replace('%%endpoint%%', 'superio_show_job_details'),
data: {
job_id: $this.attr('data-job_id')
},
dataType: 'json',
cache: false,
headers: {'cache-control': 'no-cache'},
method: 'POST',
error: function(XMLHttpRequest, textStatus, errorThrown){
console.log('Apus: AJAX error - ' + errorThrown);
$('#job-details-wrapper').removeClass('loading');
self.showJobAjax=false;
},
success: function(response){
if(response.status){
$('#job-details-wrapper').html(response.html);
self.changeHeightJobsDetail();
$this.closest('.row-items').find('.item-job').removeClass('active');
$this.addClass('active');
self.initSlick($('#job-details-wrapper').find('.slick-carousel'));
$('#job-details-wrapper').find('.btn-apply-job-email:not(.filled), .btn-apply-job-call:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in apus-mfp-zoom-call-in',
type:'inline',
midClick: true
});
$('#job-details-wrapper').find('.btn-apply-job-email:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true
});
if(wp_job_board_pro_opts.recaptcha_enable){
setTimeout(function(){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
var recaptcha=recaptchas[i];
var sitekey=recaptcha.dataset.sitekey;
grecaptcha.render(recaptcha, {
'sitekey':sitekey
});
}}, 1000);
}}
$('#job-details-wrapper').removeClass('loading');
self.showJobAjax=false;
}});
},
jobsGetPage: function(pageUrl, isBackButton){
var self=this;
if(self.filterAjax){ return false; }
self.jobsSetCurrentUrl();
if(pageUrl){
self.jobsShowLoader();
pageUrl=pageUrl.replace(/\/?(\?|#|$)/, '/$1');
if(!isBackButton){
self.setPushState(pageUrl);
}
self.filterAjax=$.ajax({
url: pageUrl,
data: {
load_type: 'full'
},
dataType: 'html',
cache: false,
headers: {'cache-control': 'no-cache'},
method: 'POST',
error: function(XMLHttpRequest, textStatus, errorThrown){
console.log('Apus: AJAX error - jobsGetPage() - ' + errorThrown);
self.jobsHideLoader();
self.filterAjax=false;
},
success: function(response){
self.jobsUpdateContent(response);
self.filterAjax=false;
}});
}},
jobsHideLoader: function(){
$('body').find('.main-items-wrapper').removeClass('loading');
},
jobsShowLoader: function(){
$('body').find('.main-items-wrapper').addClass('loading');
},
setPushState: function(pageUrl){
window.history.pushState({apusShop: true}, '', pageUrl);
},
jobsSetCurrentUrl: function(){
var self=this;
self.searchAndTagsResetURL=window.location.href;
},
jobsUpdateContent: function(ajaxHTML){
var self=this,
$ajaxHTML=$('<div>' + ajaxHTML + '</div>');
var $jobs=$ajaxHTML.find('.main-items-wrapper'),
$pagination=$ajaxHTML.find('.main-pagination-wrapper');
if($jobs.length){
$('.main-items-wrapper').replaceWith($jobs);
}
if($pagination.length){
$('.main-pagination-wrapper').replaceWith($pagination);
}
self.layzyLoadImage();
if($('.ajax-pagination').length){
self.infloadScroll=false;
self.ajaxPaginationLoad();
}
if($.isFunction($.fn.select2)&&typeof wp_job_board_pro_select2_opts!=='undefined'){
var select2_args=wp_job_board_pro_select2_opts;
select2_args['allowClear']=false;
select2_args['minimumResultsForSearch']=10;
select2_args['language']={
noResults: function (params){
return select2_args['language_result'];
}}
select2_args['minimumResultsForSearch']=10;
select2_args['width']='auto';
$('select.orderby').select2(select2_args);
$('select[name=jobs_ppp]').select2(select2_args);
$('select[name=candidates_ppp]').select2(select2_args);
$('select[name=employers_ppp]').select2(select2_args);
}
$('.main-items-wrapper').find('.btn-apply-job-email:not(.filled), .btn-apply-job-call:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in apus-mfp-zoom-call-in',
type:'inline',
midClick: true
});
$('.main-items-wrapper').find('.btn-apply-job-email:not(.filled)').magnificPopup({
mainClass: 'apus-mfp-zoom-in',
type:'inline',
midClick: true
});
if(wp_job_board_pro_opts.recaptcha_enable){
setTimeout(function(){
var recaptchas=document.getElementsByClassName("ga-recaptcha");
for(var i=0; i<recaptchas.length; i++){
var recaptcha=recaptchas[i];
var sitekey=recaptcha.dataset.sitekey;
grecaptcha.render(recaptcha, {
'sitekey':sitekey
});
}}, 1000);
}
self.initSlick($('.main-items-wrapper').find('.slick-carousel'));
self.updateMakerCards();
setTimeout(function(){
self.jobsHideLoader();
}, 100);
},
ajaxPaginationLoad: function(){
var self=this,
$infloadControls=$('body').find('.ajax-pagination'),
nextPageUrl;
self.infloadScroll=($infloadControls.hasClass('infinite-action')) ? true:false;
if(self.infloadScroll){
self.infscrollLock=false;
var pxFromWindowBottomToBottom,
pxFromMenuToBottom=Math.round($(document).height() - $infloadControls.offset().top);
var to=null;
$(window).resize(function(){
if(to){ clearTimeout(to); }
to=setTimeout(function(){
var $infloadControls=$('.ajax-pagination');
pxFromMenuToBottom=Math.round($(document).height() - $infloadControls.offset().top);
}, 100);
});
$(window).scroll(function(){
if(self.infscrollLock){
return;
}
pxFromWindowBottomToBottom=0 + $(document).height() - ($(window).scrollTop()) - $(window).height();
if(pxFromWindowBottomToBottom < pxFromMenuToBottom){
self.ajaxPaginationGet();
}});
}else{
var $productsWrap=$('body');
$productsWrap.on('click', '.main-pagination-wrapper .apus-loadmore-btn', function(e){
e.preventDefault();
self.ajaxPaginationGet();
});
}
if(self.infloadScroll){
$(window).trigger('scroll');
}},
ajaxPaginationGet: function(){
var self=this;
if(self.filterAjax) return false;
var $nextPageLink=$('.apus-pagination-next-link').find('a'),
$infloadControls=$('.ajax-pagination'),
nextPageUrl=$nextPageLink.attr('href');
if(nextPageUrl){
$infloadControls.addClass('apus-loader');
self.filterAjax=$.ajax({
url: nextPageUrl,
data: {
load_type: 'items'
},
dataType: 'html',
cache: false,
headers: {'cache-control': 'no-cache'},
method: 'GET',
error: function(XMLHttpRequest, textStatus, errorThrown){
console.log('APUS: AJAX error - ajaxPaginationGet() - ' + errorThrown);
},
complete: function(){
$infloadControls.removeClass('apus-loader');
},
success: function(response){
var $response=$('<div>' + response + '</div>'),
$gridItemElement=$('.items-wrapper', $response).html(),
$resultCount=$('.results-count .last', $response).html(),
$display_mode=$('.main-items-wrapper').data('display_mode');
$('.main-items-wrapper .items-wrapper .row').append($gridItemElement);
$('.main-items-wrapper .results-count .last').html($resultCount);
self.updateMakerCards(response);
self.layzyLoadImage();
nextPageUrl=$response.find('.apus-pagination-next-link').children('a').attr('href');
if(nextPageUrl){
$nextPageLink.attr('href', nextPageUrl);
}else{
$('.main-items-wrapper').addClass('all-jobs-loaded');
if(self.infloadScroll){
self.infscrollLock=true;
}
$infloadControls.find('.apus-loadmore-btn').addClass('hidden');
$nextPageLink.removeAttr('href');
}
self.filterAjax=false;
if(self.infloadScroll){
$(window).trigger('scroll');
}}
});
}else{
if(self.infloadScroll){
self.infscrollLock=true; // "Lock" scroll (no more products/pages)
}}
},
addCommas: function(str){
var parts=(str + "").split("."),
main=parts[0],
len=main.length,
output="",
first=main.charAt(0),
i;
if(first==='-'){
main=main.slice(1);
len=main.length;
}else{
first="";
}
i=len - 1;
while(i >=0){
output=main.charAt(i) + output;
if((len - i) % 3===0&&i > 0){
output=wp_job_board_pro_opts.money_thousands_separator + output;
}
--i;
}
output=first + output;
if(parts.length > 1){
output +=wp_job_board_pro_opts.money_dec_point + parts[1];
}
return output;
}});
$.apusThemeExtensions.job=$.apusThemeCore.job_init;
})(jQuery);
(function($){
"use strict";
var map, mapSidebar, markers, CustomHtmlIcon, group;
var markerArray=[];
$.extend($.apusThemeCore, {
job_map_init: function(){
var self=this;
if($('#jobs-google-maps').length){
L.Icon.Default.imagePath='wp-content/themes/superio/images/';
}
setTimeout(function(){
self.mapInit();
}, 50);
},
mapInit: function(){
var self=this;
var $window=$(window);
if(!$('#jobs-google-maps').length){
return;
}
map=L.map('jobs-google-maps', {
scrollWheelZoom: false
});
markers=new L.MarkerClusterGroup({
showCoverageOnHover: false
});
CustomHtmlIcon=L.HtmlIcon.extend({
options: {
html: "<div class='map-popup'></div>",
iconSize: [30, 30],
iconAnchor: [22, 30],
popupAnchor: [0, -30]
}});
$window.on('pxg:refreshmap', function(){
map._onResize();
setTimeout(function(){
if(markerArray.length > 0){
group=L.featureGroup(markerArray);
map.fitBounds(group.getBounds());
}}, 100);
});
$window.on('pxg:simplerefreshmap', function(){
map._onResize();
});
if(superio_job_map_opts.map_service=='mapbox'){
var tileLayer=L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/'+superio_job_map_opts.mapbox_style+'/tiles/{z}/{x}/{y}?access_token='+ superio_job_map_opts.mapbox_token, {
attribution: " &copy;  <a href='https://www.mapbox.com/about/maps/'>Mapbox</a> &copy;  <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap</a> <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>",
maxZoom: 18,
});
}else if(superio_job_map_opts.map_service=='here'){
var hereTileUrl='https://2.base.maps.ls.hereapi.com/maptile/2.1/maptile/newest/'+superio_job_map_opts.here_style+'/{z}/{x}/{y}/512/png8?apiKey='+ superio_job_map_opts.here_map_api_key +'&ppi=320';
var tileLayer=L.tileLayer(hereTileUrl, {
attribution: " &copy;  <a href='https://www.mapbox.com/about/maps/'>Here</a> &copy; <strong><a href='https://www.mapbox.com/map-feedback/' target='_blank'>Improve this map</a></strong>",
maxZoom: 18,
});
}else if(superio_job_map_opts.map_service=='openstreetmap'){
var tileLayer=L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
});
}else{
if(superio_job_map_opts.custom_style!=''){
try {
var custom_style=$.parseJSON(superio_job_map_opts.custom_style);
var tileLayer=L.gridLayer.googleMutant({
type: 'roadmap',
styles: custom_style
});
} catch(err){
var tileLayer=L.gridLayer.googleMutant({
type: 'roadmap'
});
}}else{
var tileLayer=L.gridLayer.googleMutant({
type: 'roadmap'
});
}}
map.addLayer(tileLayer);
if(!$('#jobs-google-maps').is('.single-job-map')){
self.updateMakerCards();
}else{
var $item=$('.single-listing-wrapper');
if($item.data('latitude')!==""&&$item.data('latitude')!==""){
var zoom=(typeof MapWidgetZoom!=="undefined") ? MapWidgetZoom:15;
self.addMakerToMap($item);
map.addLayer(markers);
map.setView([$item.data('latitude'), $item.data('longitude')], zoom);
$(window).on('update:map', function(){
map.setView([$item.data('latitude'), $item.data('longitude')], zoom);
});
}else{
$('#jobs-google-maps').hide();
}}
},
updateMakerCards: function(){
var self=this;
var $items=$('.main-items-wrapper .map-item');
if($('#jobs-google-maps').length&&typeof map!=="undefined"){
if(!$items.length){
map.setView([superio_job_map_opts.default_latitude, superio_job_map_opts.default_longitude], 12);
return;
}
map.removeLayer(markers);
markers=new L.MarkerClusterGroup({
showCoverageOnHover: false
});
$items.each(function(i, obj){
self.addMakerToMap($(obj), true);
});
map.addLayer(markers);
if(markerArray.length > 0){
group=L.featureGroup(markerArray);
map.fitBounds(group.getBounds());
}}
},
addMakerToMap: function($item, archive){
var self=this;
var marker;
if($item.data('latitude')==""||$item.data('longitude')==""){
return;
}
if($item.data('img')){
var img_logo="<img src='" + $item.data('img') + "' alt=''>";
var mapPinHTML="<div class='map-popup'><div class='icon-wrapper has-img is-job'>" + img_logo + "</div></div>";
}else{
var mapPinHTML="<div class='map-popup'><div class='icon-wrapper is-candidate'></div></div>";
}
marker=L.marker([$item.data('latitude'), $item.data('longitude')], {
icon: new CustomHtmlIcon({ html: mapPinHTML })
});
if(typeof archive!=="undefined"){
$item.on('mouseenter', function(){
$(marker._icon).find('.map-popup').addClass('map-popup-selected');
}).on('mouseleave', function(){
$(marker._icon).find('.map-popup').removeClass('map-popup-selected');
});
var html_output='';
if($item.hasClass('job_listing')){
var logo_html='';
if($item.data('img')){
logo_html="<div class='employer-logo'><div class='image-wrapper image-loaded'>" +
"<img src='" + $item.data('img') + "' alt=''>" +
"</div></div>";
}
var title_html='';
if($item.find('.job-title').length){
title_html="<div class='job-title'>" + $item.find('.job-title').html() + "</div>";
}
var category_html='';
if($item.find('.category-job').length){
category_html="<div class='category-job'>" + $item.find('.category-job').html() + "</div>";
}
var location_html='';
if($item.find('.job-location').length){
location_html="<div class='job-location'>" + $item.find('.job-location').html() + "</div>";
}
var meta_html="<div class='job-metas'>" + category_html + location_html + "</div>";
html_output="<div class='maps-popup-style job-list'>" +
"<div class='inner'>" + logo_html +
"<div class='job-list-content'>" + title_html + meta_html + "</div>" +
"</div>" +
"</div>";
}else if($item.hasClass('employer')){
var logo_html='';
if($item.data('img')){
logo_html="<div class='employer-logo'><div class='image-wrapper image-loaded'>" +
"<img src='" + $item.data('img') + "' alt=''>" +
"</div></div>";
}
var title_html='';
if($item.find('.employer-title').length){
title_html="<div class='job-title'>" + $item.find('.employer-title').html() + "</div>";
}
var meta_html='';
if($item.find('.employer-map-metas').length){
meta_html="<div class='job-metas'>" + $item.find('.employer-map-metas').html() + "</div>";
}
html_output="<div class='maps-popup-style job-list'>" +
"<div class='inner'>" + logo_html +
"<div class='job-list-content'>" + title_html + meta_html + "</div>" +
"</div>" +
"</div>";
}else{
var logo_html='';
if($item.data('img')){
logo_html="<div class='employer-logo'><div class='image-wrapper image-loaded'>" +
"<img src='" + $item.data('img') + "' alt=''>" +
"</div></div>";
}
var title_html='';
if($item.find('.candidate-title').length){
title_html="<div class='job-title'>" + $item.find('.candidate-title').html() + "</div>";
}
var meta_html='';
if($item.find('.job-metas').length){
meta_html="<div class='job-metas'>" + $item.find('.job-metas').html() + "</div>";
}
html_output="<div class='maps-popup-style job-list'>" +
"<div class='inner'>" + logo_html +
"<div class='job-list-content'>" + title_html + meta_html + "</div>" +
"</div>" +
"</div>";
}
marker.bindPopup(html_output).openPopup();
}
markers.addLayer(marker);
markerArray.push(L.marker([$item.data('latitude'), $item.data('longitude')]));
},
});
$.apusThemeExtensions.job_map=$.apusThemeCore.job_map_init;
})(jQuery);
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.sbjs=e()}}(function(){return function e(t,r,n){function a(s,o){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!o&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var p=r[s]={exports:{}};t[s][0].call(p.exports,function(e){var r=t[s][1][e];return a(r||e)},p,p.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(e,t,r){"use strict";var n=e("./init"),a={init:function(e){this.get=n(e),e&&e.callback&&"function"==typeof e.callback&&e.callback(this.get)}};t.exports=a},{"./init":6}],2:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/utils"),i={containers:{current:"sbjs_current",current_extra:"sbjs_current_add",first:"sbjs_first",first_extra:"sbjs_first_add",session:"sbjs_session",udata:"sbjs_udata",promocode:"sbjs_promo"},service:{migrations:"sbjs_migrations"},delimiter:"|||",aliases:{main:{type:"typ",source:"src",medium:"mdm",campaign:"cmp",content:"cnt",term:"trm",id:"id",platform:"plt",format:"fmt",tactic:"tct"},extra:{fire_date:"fd",entrance_point:"ep",referer:"rf"},session:{pages_seen:"pgs",current_page:"cpg"},udata:{visits:"vst",ip:"uip",agent:"uag"},promo:"code"},pack:{main:function(e){return i.aliases.main.type+"="+e.type+i.delimiter+i.aliases.main.source+"="+e.source+i.delimiter+i.aliases.main.medium+"="+e.medium+i.delimiter+i.aliases.main.campaign+"="+e.campaign+i.delimiter+i.aliases.main.content+"="+e.content+i.delimiter+i.aliases.main.term+"="+e.term+i.delimiter+i.aliases.main.id+"="+e.id+i.delimiter+i.aliases.main.platform+"="+e.platform+i.delimiter+i.aliases.main.format+"="+e.format+i.delimiter+i.aliases.main.tactic+"="+e.tactic},extra:function(e){return i.aliases.extra.fire_date+"="+a.setDate(new Date,e)+i.delimiter+i.aliases.extra.entrance_point+"="+document.location.href+i.delimiter+i.aliases.extra.referer+"="+(document.referrer||n.none)},user:function(e,t){return i.aliases.udata.visits+"="+e+i.delimiter+i.aliases.udata.ip+"="+t+i.delimiter+i.aliases.udata.agent+"="+navigator.userAgent},session:function(e){return i.aliases.session.pages_seen+"="+e+i.delimiter+i.aliases.session.current_page+"="+document.location.href},promo:function(e){return i.aliases.promo+"="+a.setLeadingZeroToInt(a.randomInt(e.min,e.max),e.max.toString().length)}}};t.exports=i},{"./helpers/utils":5,"./terms":9}],3:[function(e,t,r){"use strict";var n=e("../data").delimiter;t.exports={useBase64:!1,setBase64Flag:function(e){this.useBase64=e},encodeData:function(e){return encodeURIComponent(e).replace(/\!/g,"%21").replace(/\~/g,"%7E").replace(/\*/g,"%2A").replace(/\'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29")},decodeData:function(e){try{return decodeURIComponent(e).replace(/\%21/g,"!").replace(/\%7E/g,"~").replace(/\%2A/g,"*").replace(/\%27/g,"'").replace(/\%28/g,"(").replace(/\%29/g,")")}catch(t){try{return unescape(e)}catch(r){return""}}},set:function(e,t,r,n,a){var i,s;if(r){var o=new Date;o.setTime(o.getTime()+60*r*1e3),i="; expires="+o.toGMTString()}else i="";s=n&&!a?";domain=."+n:"";var c=this.encodeData(t);this.useBase64&&(c=btoa(c).replace(/=+$/,"")),document.cookie=this.encodeData(e)+"="+c+i+s+"; path=/"},get:function(e){for(var t=this.encodeData(e)+"=",r=document.cookie.split(";"),n=0;n<r.length;n++){for(var a=r[n];" "===a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(t)){var i=a.substring(t.length,a.length);if(/^[A-Za-z0-9+/]+$/.test(i))try{i=atob(i.padEnd(4*Math.ceil(i.length/4),"="))}catch(s){}return this.decodeData(i)}}return null},destroy:function(e,t,r){this.set(e,"",-1,t,r)},parse:function(e){var t=[],r={};if("string"==typeof e)t.push(e);else for(var a in e)e.hasOwnProperty(a)&&t.push(e[a]);for(var i=0;i<t.length;i++){var s;r[this.unsbjs(t[i])]={},s=this.get(t[i])?this.get(t[i]).split(n):[];for(var o=0;o<s.length;o++){var c=s[o].split("="),u=c.splice(0,1);u.push(c.join("=")),r[this.unsbjs(t[i])][u[0]]=this.decodeData(u[1])}}return r},unsbjs:function(e){return e.replace("sbjs_","")}}},{"../data":2}],4:[function(e,t,r){"use strict";t.exports={parse:function(e){for(var t=this.parseOptions,r=t.parser[t.strictMode?"strict":"loose"].exec(e),n={},a=14;a--;)n[t.key[a]]=r[a]||"";return n[t.q.name]={},n[t.key[12]].replace(t.q.parser,function(e,r,a){r&&(n[t.q.name][r]=a)}),n},parseOptions:{strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},getParam:function(e){for(var t={},r=(e||window.location.search.substring(1)).split("&"),n=0;n<r.length;n++){var a=r[n].split("=");if("undefined"==typeof t[a[0]])t[a[0]]=a[1];else if("string"==typeof t[a[0]]){var i=[t[a[0]],a[1]];t[a[0]]=i}else t[a[0]].push(a[1])}return t},getHost:function(e){return this.parse(e).host.replace("www.","")}}},{}],5:[function(e,t,r){"use strict";t.exports={escapeRegexp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},setDate:function(e,t){var r=e.getTimezoneOffset()/60,n=e.getHours(),a=t||0===t?t:-r;return e.setHours(n+r+a),e.getFullYear()+"-"+this.setLeadingZeroToInt(e.getMonth()+1,2)+"-"+this.setLeadingZeroToInt(e.getDate(),2)+" "+this.setLeadingZeroToInt(e.getHours(),2)+":"+this.setLeadingZeroToInt(e.getMinutes(),2)+":"+this.setLeadingZeroToInt(e.getSeconds(),2)},setLeadingZeroToInt:function(e,t){for(var r=e+"";r.length<t;)r="0"+r;return r},randomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e}}},{}],6:[function(e,t,r){"use strict";var n=e("./data"),a=e("./terms"),i=e("./helpers/cookies"),s=e("./helpers/uri"),o=e("./helpers/utils"),c=e("./params"),u=e("./migrations");t.exports=function(e){var t,r,p,f,m,d,l,g,h,y,_,v,b,x=c.fetch(e),k=s.getParam(),w=x.domain.host,q=x.domain.isolate,I=x.lifetime;function j(e){switch(e){case a.traffic.utm:t=a.traffic.utm,r="undefined"!=typeof k.utm_source?k.utm_source:"undefined"!=typeof k.gclid?"google":"undefined"!=typeof k.yclid?"yandex":a.none,p="undefined"!=typeof k.utm_medium?k.utm_medium:"undefined"!=typeof k.gclid?"cpc":"undefined"!=typeof k.yclid?"cpc":a.none,f="undefined"!=typeof k.utm_campaign?k.utm_campaign:"undefined"!=typeof k[x.campaign_param]?k[x.campaign_param]:"undefined"!=typeof k.gclid?"google_cpc":"undefined"!=typeof k.yclid?"yandex_cpc":a.none,m="undefined"!=typeof k.utm_content?k.utm_content:"undefined"!=typeof k[x.content_param]?k[x.content_param]:a.none,l=k.utm_id||a.none,g=k.utm_source_platform||a.none,h=k.utm_creative_format||a.none,y=k.utm_marketing_tactic||a.none,d="undefined"!=typeof k.utm_term?k.utm_term:"undefined"!=typeof k[x.term_param]?k[x.term_param]:function(){var e=document.referrer;if(k.utm_term)return k.utm_term;if(!(e&&s.parse(e).host&&s.parse(e).host.match(/^(?:.*\.)?yandex\..{2,9}$/i)))return!1;try{return s.getParam(s.parse(document.referrer).query).text}catch(t){return!1}}()||a.none;break;case a.traffic.organic:t=a.traffic.organic,r=r||s.getHost(document.referrer),p=a.referer.organic,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.referral:t=a.traffic.referral,r=r||s.getHost(document.referrer),p=p||a.referer.referral,f=a.none,m=s.parse(document.referrer).path,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;case a.traffic.typein:t=a.traffic.typein,r=x.typein_attributes.source,p=x.typein_attributes.medium,f=a.none,m=a.none,d=a.none,l=a.none,g=a.none,h=a.none,y=a.none;break;default:t=a.oops,r=a.oops,p=a.oops,f=a.oops,m=a.oops,d=a.oops,l=a.oops,g=a.oops,h=a.oops,y=a.oops}var i={type:t,source:r,medium:p,campaign:f,content:m,term:d,id:l,platform:g,format:h,tactic:y};return n.pack.main(i)}function R(e){var t=document.referrer;switch(e){case a.traffic.organic:return!!t&&H(t)&&function(e){var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp("yandex")+"\\..{2,9}$"),n=new RegExp(".*"+o.escapeRegexp("text")+"=.*"),a=new RegExp("^(?:www\\.)?"+o.escapeRegexp("google")+"\\..{2,9}$");if(s.parse(e).query&&s.parse(e).host.match(t)&&s.parse(e).query.match(n))return r="yandex",!0;if(s.parse(e).host.match(a))return r="google",!0;if(!s.parse(e).query)return!1;for(var i=0;i<x.organics.length;i++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.organics[i].host)+"$","i"))&&s.parse(e).query.match(new RegExp(".*"+o.escapeRegexp(x.organics[i].param)+"=.*","i")))return r=x.organics[i].display||x.organics[i].host,!0;if(i+1===x.organics.length)return!1}}(t);case a.traffic.referral:return!!t&&H(t)&&function(e){if(!(x.referrals.length>0))return r=s.getHost(e),!0;for(var t=0;t<x.referrals.length;t++){if(s.parse(e).host.match(new RegExp("^(?:.*\\.)?"+o.escapeRegexp(x.referrals[t].host)+"$","i")))return r=x.referrals[t].display||x.referrals[t].host,p=x.referrals[t].medium||a.referer.referral,!0;if(t+1===x.referrals.length)return r=s.getHost(e),!0}}(t);default:return!1}}function H(e){if(x.domain){if(q)return s.getHost(e)!==s.getHost(w);var t=new RegExp("^(?:.*\\.)?"+o.escapeRegexp(w)+"$","i");return!s.getHost(e).match(t)}return s.getHost(e)!==s.getHost(document.location.href)}function D(){i.set(n.containers.current_extra,n.pack.extra(x.timezone_offset),I,w,q),i.get(n.containers.first_extra)||i.set(n.containers.first_extra,n.pack.extra(x.timezone_offset),I,w,q)}return i.setBase64Flag(x.base64),u.go(I,w,q),i.set(n.containers.current,function(){var e;if("undefined"!=typeof k.utm_source||"undefined"!=typeof k.utm_medium||"undefined"!=typeof k.utm_campaign||"undefined"!=typeof k.utm_content||"undefined"!=typeof k.utm_term||"undefined"!=typeof k.utm_id||"undefined"!=typeof k.utm_source_platform||"undefined"!=typeof k.utm_creative_format||"undefined"!=typeof k.utm_marketing_tactic||"undefined"!=typeof k.gclid||"undefined"!=typeof k.yclid||"undefined"!=typeof k[x.campaign_param]||"undefined"!=typeof k[x.term_param]||"undefined"!=typeof k[x.content_param])D(),e=j(a.traffic.utm);else if(R(a.traffic.organic))D(),e=j(a.traffic.organic);else if(!i.get(n.containers.session)&&R(a.traffic.referral))D(),e=j(a.traffic.referral);else{if(i.get(n.containers.first)||i.get(n.containers.current))return i.get(n.containers.current);D(),e=j(a.traffic.typein)}return e}(),I,w,q),i.get(n.containers.first)||i.set(n.containers.first,i.get(n.containers.current),I,w,q),i.get(n.containers.udata)?(_=parseInt(i.parse(n.containers.udata)[i.unsbjs(n.containers.udata)][n.aliases.udata.visits])||1,_=i.get(n.containers.session)?_:_+1,v=n.pack.user(_,x.user_ip)):(_=1,v=n.pack.user(_,x.user_ip)),i.set(n.containers.udata,v,I,w,q),i.get(n.containers.session)?(b=parseInt(i.parse(n.containers.session)[i.unsbjs(n.containers.session)][n.aliases.session.pages_seen])||1,b+=1):b=1,i.set(n.containers.session,n.pack.session(b),x.session_length,w,q),x.promocode&&!i.get(n.containers.promocode)&&i.set(n.containers.promocode,n.pack.promo(x.promocode),I,w,q),i.parse(n.containers)}},{"./data":2,"./helpers/cookies":3,"./helpers/uri":4,"./helpers/utils":5,"./migrations":7,"./params":8,"./terms":9}],7:[function(e,t,r){"use strict";var n=e("./data"),a=e("./helpers/cookies");t.exports={go:function(e,t,r){var i,s=this.migrations,o={l:e,d:t,i:r};if(a.get(n.containers.first)||a.get(n.service.migrations)){if(!a.get(n.service.migrations))for(i=0;i<s.length;i++)s[i].go(s[i].id,o)}else{var c=[];for(i=0;i<s.length;i++)c.push(s[i].id);var u="";for(i=0;i<c.length;i++)u+=c[i]+"=1",i<c.length-1&&(u+=n.delimiter);a.set(n.service.migrations,u,o.l,o.d,o.i)}},migrations:[{id:"1418474375998",version:"1.0.0-beta",go:function(e,t){var r=e+"=1",i=e+"=0",s=function(e,t,r){return t||r?e:n.delimiter};try{var o=[];for(var c in n.containers)n.containers.hasOwnProperty(c)&&o.push(n.containers[c]);for(var u=0;u<o.length;u++)if(a.get(o[u])){var p=a.get(o[u]).replace(/(\|)?\|(\|)?/g,s);a.destroy(o[u],t.d,t.i),a.destroy(o[u],t.d,!t.i),a.set(o[u],p,t.l,t.d,t.i)}a.get(n.containers.session)&&a.set(n.containers.session,n.pack.session(0),t.l,t.d,t.i),a.set(n.service.migrations,r,t.l,t.d,t.i)}catch(f){a.set(n.service.migrations,i,t.l,t.d,t.i)}}}]}},{"./data":2,"./helpers/cookies":3}],8:[function(e,t,r){"use strict";var n=e("./terms"),a=e("./helpers/uri");t.exports={fetch:function(e){var t=e||{},r={};if(r.lifetime=this.validate.checkFloat(t.lifetime)||6,r.lifetime=parseInt(30*r.lifetime*24*60),r.session_length=this.validate.checkInt(t.session_length)||30,r.timezone_offset=this.validate.checkInt(t.timezone_offset),r.base64=t.base64||!1,r.campaign_param=t.campaign_param||!1,r.term_param=t.term_param||!1,r.content_param=t.content_param||!1,r.user_ip=t.user_ip||n.none,t.promocode?(r.promocode={},r.promocode.min=parseInt(t.promocode.min)||1e5,r.promocode.max=parseInt(t.promocode.max)||999999):r.promocode=!1,t.typein_attributes&&t.typein_attributes.source&&t.typein_attributes.medium?(r.typein_attributes={},r.typein_attributes.source=t.typein_attributes.source,r.typein_attributes.medium=t.typein_attributes.medium):r.typein_attributes={source:"(direct)",medium:"(none)"},t.domain&&this.validate.isString(t.domain)?r.domain={host:t.domain,isolate:!1}:t.domain&&t.domain.host?r.domain=t.domain:r.domain={host:a.getHost(document.location.hostname),isolate:!1},r.referrals=[],t.referrals&&t.referrals.length>0)for(var i=0;i<t.referrals.length;i++)t.referrals[i].host&&r.referrals.push(t.referrals[i]);if(r.organics=[],t.organics&&t.organics.length>0)for(var s=0;s<t.organics.length;s++)t.organics[s].host&&t.organics[s].param&&r.organics.push(t.organics[s]);return r.organics.push({host:"bing.com",param:"q",display:"bing"}),r.organics.push({host:"yahoo.com",param:"p",display:"yahoo"}),r.organics.push({host:"about.com",param:"q",display:"about"}),r.organics.push({host:"aol.com",param:"q",display:"aol"}),r.organics.push({host:"ask.com",param:"q",display:"ask"}),r.organics.push({host:"globososo.com",param:"q",display:"globo"}),r.organics.push({host:"go.mail.ru",param:"q",display:"go.mail.ru"}),r.organics.push({host:"rambler.ru",param:"query",display:"rambler"}),r.organics.push({host:"tut.by",param:"query",display:"tut.by"}),r.referrals.push({host:"t.co",display:"twitter.com"}),r.referrals.push({host:"plus.url.google.com",display:"plus.google.com"}),r},validate:{checkFloat:function(e){return!(!e||!this.isNumeric(parseFloat(e)))&&parseFloat(e)},checkInt:function(e){return!(!e||!this.isNumeric(parseInt(e)))&&parseInt(e)},isNumeric:function(e){return!isNaN(e)},isString:function(e){return"[object String]"===Object.prototype.toString.call(e)}}}},{"./helpers/uri":4,"./terms":9}],9:[function(e,t,r){"use strict";t.exports={traffic:{utm:"utm",organic:"organic",referral:"referral",typein:"typein"},referer:{referral:"referral",organic:"organic",social:"social"},none:"(none)",oops:"(Houston, we have a problem)"}},{}]},{},[1])(1)});
!function(t){"use strict";const e=t.params,n=(document.querySelector.bind(document),(t,e)=>e.split(".").reduce((t,e)=>t&&t[e],t)),i=()=>null,s=t=>null===t||t===undefined?"":t,o="wc/store/checkout";function a(t){document.querySelectorAll("wc-order-attribution-inputs").forEach((t,e)=>{e>0&&t.remove()});for(const e of document.querySelectorAll("wc-order-attribution-inputs"))e.values=t}function r(t){window.wp&&window.wp.data&&window.wp.data.dispatch&&window.wc&&window.wc.wcBlocksData&&window.wp.data.dispatch(window.wc.wcBlocksData.CHECKOUT_STORE_KEY).setExtensionData("woocommerce/order-attribution",t,!0)}function c(){return"undefined"!=typeof sbjs}function d(){if(window.wp&&window.wp.data&&"function"==typeof window.wp.data.subscribe){const e=window.wp.data.subscribe(function(){e(),r(t.getAttributionData())},o)}}t.getAttributionData=function(){const s=e.allowTracking&&c()?n:i,o=c()?sbjs.get:{},a=Object.entries(t.fields).map(([t,e])=>[t,s(o,e)]);return Object.fromEntries(a)},t.setOrderTracking=function(n){if(e.allowTracking=n,n){if(!c())return;sbjs.init({lifetime:Number(e.lifetime),session_length:Number(e.session),base64:Boolean(e.base64),timezone_offset:"0"})}else!function(){const t=window.location.hostname;["sbjs_current","sbjs_current_add","sbjs_first","sbjs_first_add","sbjs_session","sbjs_udata","sbjs_migrations","sbjs_promo"].forEach(e=>{document.cookie=`${e}=; path=/; max-age=-999; domain=.${t};`})}();const i=t.getAttributionData();a(i),r(i)},t.setOrderTracking(e.allowTracking),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",d):d(),window.customElements.define("wc-order-attribution-inputs",class extends HTMLElement{constructor(){if(super(),this._fieldNames=Object.keys(t.fields),this.hasOwnProperty("_values")){let t=this.values;delete this.values,this.values=t||{}}}connectedCallback(){this.innerHTML="";const t=new DocumentFragment;for(const n of this._fieldNames){const i=document.createElement("input");i.type="hidden",i.name=`${e.prefix}${n}`,i.value=s(this.values&&this.values[n]||""),t.appendChild(i)}this.appendChild(t)}set values(t){if(this._values=t,this.isConnected)for(const t of this._fieldNames){const n=this.querySelector(`input[name="${e.prefix}${t}"]`);n?n.value=s(this.values[t]):console.warn(`Field "${t}" not found. `+"Most likely, the '<wc-order-attribution-inputs>' element was manipulated.")}}get values(){return this._values}})}(window.wc_order_attribution);
!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{init:function(){return w},register:function(){return r},registerBySelector:function(){return a},unregister:function(){return l},unregisterBySelector:function(){return s}});const n=new Map,o=new Map,r=({elementType:e,id:t,callback:o})=>{n.has(e)||n.set(e,new Map),n.get(e)?.has(t)||n.get(e)?.set(t,o)};Object.defineProperty(window,"registerElementorElement",{value:r,enumerable:!0});const l=({elementType:e,id:t})=>{n.has(e)&&(t?(n.get(e)?.delete(t),0===n.get(e)?.size&&n.delete(e)):n.delete(e))},a=({id:e,selector:t,callback:n})=>{o.has(t)||o.set(t,new Map),o.get(t)?.has(e)||o.get(t)?.set(e,n)},s=({selector:e,id:t})=>{o.has(e)&&(t?(o.get(e)?.delete(t),0===o.get(e)?.size&&o.delete(e)):o.delete(e))},d=new WeakMap,i="elementor/element/rendered",m="elementor/element/destroyed",c=({element:e,elementType:t,elementId:o})=>{y(e);const r=new AbortController,l=[],a=()=>{u({element:e,controller:r}),e.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:{element:e,elementType:t,elementId:o}}))};e.isConnected?a():requestAnimationFrame(()=>{a()}),n.has(t)&&(p({element:e,controller:r,manualUnmount:l}),Array.from(n.get(t)?.values()??[]).forEach(t=>{const n=e.getAttribute("data-e-settings"),o=t({element:e,signal:r.signal,settings:n?JSON.parse(n):{},listenToChildren:t=>({render:n=>{const o=e=>{const{elementType:o}=e.detail;t.includes(o)&&n()};e.addEventListener(i,o,{signal:r.signal}),e.addEventListener(m,o,{signal:r.signal})}})});"function"==typeof o&&l.push(o)}))},u=({element:e,controller:t})=>{let n=!1;const r=[];Array.from(o.entries()??[]).forEach(([o,l])=>{e.matches(o)&&(n=!0,Array.from(l.values()??[]).forEach(n=>{const o=e.getAttribute("data-e-settings"),l=n({element:e,signal:t.signal,settings:o?JSON.parse(o):{}});"function"==typeof l&&r.push(l)}))}),n&&p({element:e,controller:t,manualUnmount:r})},f=({elementType:e,elementId:t,element:n})=>{var o;n&&(y(n),(o={element:n,elementType:e,elementId:t}).element.dispatchEvent(new CustomEvent(m,{bubbles:!0,detail:o})))},p=({element:e,controller:t,manualUnmount:n})=>{const o=d.get(e);o?o.manualUnmount.push(...n):d.set(e,{controller:t,manualUnmount:n})},y=e=>{const t=d.get(e);t&&(t.controller.abort(),t.manualUnmount.forEach(e=>e()),d.delete(e))},g="[data-e-type]";let h=!1;const b=new Set;let E=0;function w(){window.addEventListener("elementor/element/render",e=>{const t=e,{id:n,type:o,element:r}=t.detail;c({element:r,elementType:o,elementId:n})}),window.addEventListener("elementor/element/destroy",e=>{const t=e,{id:n,type:o,element:r}=t.detail;f({elementType:o,elementId:n,element:r})});const e=()=>{document.querySelectorAll(g).forEach(e=>{const t=e,{eType:n,id:o}=t.dataset;n&&o&&v(t)}),h||"undefined"==typeof MutationObserver||(h=!0,new MutationObserver(e=>{for(const t of e)t.addedNodes.forEach(e=>{b.add(e)});!E&&b.size&&(E=requestAnimationFrame(()=>{E=0;const e=Array.from(b);b.clear();const t=new Set;for(const n of e)Node.ELEMENT_NODE===n.nodeType&&T(n).forEach(e=>{t.add(e)});t.forEach(e=>v(e))}))}).observe(document.documentElement,{childList:!0,subtree:!0}))};document.addEventListener("DOMContentLoaded",e),"loading"!==document.readyState&&e()}function v(e){const t=e.dataset.eType,n=e.dataset.id;t&&n&&c({element:e,elementType:t,elementId:n})}function T(e){const t=[];return e.matches(g)&&t.push(e),e.querySelectorAll(g).forEach(e=>{t.push(e)}),t}(window.elementorV2=window.elementorV2||{}).frontendHandlers=t}(),window.elementorV2.frontendHandlers?.init?.();
!function(){"use strict";var e={d:function(t,n){for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Alpine:function(){return ni},init:function(){return ii},refreshTree:function(){return ri}});var n,i,r,o,s=!1,a=!1,l=[],c=-1;function u(e){let t=l.indexOf(e);-1!==t&&t>c&&l.splice(t,1)}function p(){s=!1,a=!0;for(let e=0;e<l.length;e++)l[e](),c=e;l.length=0,c=-1,a=!1}var f=!0;function d(e){i=e}function h(e,t){let n,o=!0,s=i(()=>{let i=e();JSON.stringify(i),o?n=i:queueMicrotask(()=>{t(i,n),n=i}),o=!1});return()=>r(s)}var _=[],m=[],g=[];function x(e,t){"function"==typeof t?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,m.push(t))}function v(e){_.push(e)}function y(e,t,n){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(n)}function b(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([n,i])=>{(void 0===t||t.includes(n))&&(i.forEach(e=>e()),delete e._x_attributeCleanups[n])})}var w=new MutationObserver(R),E=!1;function O(){w.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),E=!0}function A(){!function(){let e=w.takeRecords();k.push(()=>e.length>0&&R(e));let t=k.length;queueMicrotask(()=>{if(k.length===t)for(;k.length>0;)k.shift()()})}(),w.disconnect(),E=!1}var k=[];function T(e){if(!E)return e();A();let t=e();return O(),t}var S=!1,N=[];function R(e){if(S)return void(N=N.concat(e));let t=[],n=new Set,i=new Map,r=new Map;for(let o=0;o<e.length;o++)if(!e[o].target._x_ignoreMutationObserver&&("childList"===e[o].type&&(e[o].removedNodes.forEach(e=>{1===e.nodeType&&e._x_marker&&n.add(e)}),e[o].addedNodes.forEach(e=>{1===e.nodeType&&(n.has(e)?n.delete(e):e._x_marker||t.push(e))})),"attributes"===e[o].type)){let t=e[o].target,n=e[o].attributeName,s=e[o].oldValue,a=()=>{i.has(t)||i.set(t,[]),i.get(t).push({name:n,value:t.getAttribute(n)})},l=()=>{r.has(t)||r.set(t,[]),r.get(t).push(n)};t.hasAttribute(n)&&null===s?a():t.hasAttribute(n)?(l(),a()):l()}r.forEach((e,t)=>{b(t,e)}),i.forEach((e,t)=>{_.forEach(n=>n(t,e))});for(let e of n)t.some(t=>t.contains(e))||m.forEach(t=>t(e));for(let e of t)e.isConnected&&g.forEach(t=>t(e));t=null,n=null,i=null,r=null}function C(e){return j($(e))}function P(e,t,n){return e._x_dataStack=[t,...$(n||e)],()=>{e._x_dataStack=e._x_dataStack.filter(e=>e!==t)}}function $(e){return e._x_dataStack?e._x_dataStack:"function"==typeof ShadowRoot&&e instanceof ShadowRoot?$(e.host):e.parentNode?$(e.parentNode):[]}function j(e){return new Proxy({objects:e},U)}var U={ownKeys({objects:e}){return Array.from(new Set(e.flatMap(e=>Object.keys(e))))},has({objects:e},t){return t!=Symbol.unscopables&&e.some(e=>Object.prototype.hasOwnProperty.call(e,t)||Reflect.has(e,t))},get({objects:e},t,n){return"toJSON"==t?I:Reflect.get(e.find(e=>Reflect.has(e,t))||{},t,n)},set({objects:e},t,n,i){const r=e.find(e=>Object.prototype.hasOwnProperty.call(e,t))||e[e.length-1],o=Object.getOwnPropertyDescriptor(r,t);return o?.set&&o?.get?o.set.call(i,n)||!0:Reflect.set(r,t,n)}};function I(){return Reflect.ownKeys(this).reduce((e,t)=>(e[t]=Reflect.get(this,t),e),{})}function L(e){let t=(n,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(n)).forEach(([r,{value:o,enumerable:s}])=>{if(!1===s||void 0===o)return;if("object"==typeof o&&null!==o&&o.__v_skip)return;let a=""===i?r:`${i}.${r}`;var l;"object"==typeof o&&null!==o&&o._x_interceptor?n[r]=o.initialize(e,a,r):"object"!=typeof(l=o)||Array.isArray(l)||null===l||o===n||o instanceof Element||t(o,a)})};return t(e)}function M(e,t=()=>{}){let n={initialValue:void 0,_x_interceptor:!0,initialize(t,n,i){return e(this.initialValue,()=>function(e,t){return t.split(".").reduce((e,t)=>e[t],e)}(t,n),e=>B(t,n,e),n,i)}};return t(n),e=>{if("object"==typeof e&&null!==e&&e._x_interceptor){let t=n.initialize.bind(n);n.initialize=(i,r,o)=>{let s=e.initialize(i,r,o);return n.initialValue=s,t(i,r,o)}}else n.initialValue=e;return n}}function B(e,t,n){if("string"==typeof t&&(t=t.split(".")),1!==t.length){if(0===t.length)throw error;return e[t[0]]||(e[t[0]]={}),B(e[t[0]],t.slice(1),n)}e[t[0]]=n}var F={};function D(e,t){F[e]=t}function z(e,t){let n=function(e){let[t,n]=le(e),i={interceptor:M,...t};return x(e,n),i}(t);return Object.entries(F).forEach(([i,r])=>{Object.defineProperty(e,`$${i}`,{get(){return r(t,n)},enumerable:!1})}),e}function G(e,t,n,...i){try{return n(...i)}catch(n){q(n,e,t)}}function q(e,t,n=void 0){e=Object.assign(e??{message:"No error message given."},{el:t,expression:n}),console.warn(`Alpine Expression Error: ${e.message}\n\n${n?'Expression: "'+n+'"\n\n':""}`,t),setTimeout(()=>{throw e},0)}var W=!0;function V(e){let t=W;W=!1;let n=e();return W=t,n}function K(e,t,n={}){let i;return J(e,t)(e=>i=e,n),i}function J(...e){return Z(...e)}var Z=function(e,t){let n={};z(n,e);let i=[n,...$(e)],r="function"==typeof t?H(i,t):function(e,t,n){let i=function(e,t){if(X[e])return X[e];let n=Object.getPrototypeOf(async function(){}).constructor,i=/^[\n\s]*if.*\(.*\)/.test(e.trim())||/^(let|const)\s/.test(e.trim())?`(async()=>{ ${e}})()`:e;let r=(()=>{try{let t=new n(["__self","scope"],`with (scope){ __self.result=${i}}; __self.finished=true; return __self.result;`);return Object.defineProperty(t,"name",{value:`[Alpine] ${e}`}),t}catch(n){return q(n,t,e),Promise.resolve()}})();return X[e]=r,r}(t,n);return(r=()=>{},{scope:o={},params:s=[],context:a}={})=>{i.result=void 0,i.finished=!1;let l=j([o,...e]);if("function"==typeof i){let e=i.call(a,i,l).catch(e=>q(e,n,t));i.finished?(Y(r,i.result,l,s,n),i.result=void 0):e.then(e=>{Y(r,e,l,s,n)}).catch(e=>q(e,n,t)).finally(()=>i.result=void 0)}}}(i,t,e);return G.bind(null,e,t,r)};function H(e,t){return(n=()=>{},{scope:i={},params:r=[],context:o}={})=>{Y(n,t.apply(j([i,...e]),r))}}var X={};function Y(e,t,n,i,r){if(W&&"function"==typeof t){let o=t.apply(n,i);o instanceof Promise?o.then(t=>Y(e,t,n,i)).catch(e=>q(e,r,t)):e(o)}else"object"==typeof t&&t instanceof Promise?t.then(t=>e(t)):e(t)}var Q="x-";function ee(e=""){return Q+e}var te={};function ne(e,t){return te[e]=t,{before(t){if(!te[t])return void console.warn(String.raw`Cannot find directive \`${t}\`. \`${e}\` will use the default order of execution`);const n=me.indexOf(t);me.splice(n>=0?n:me.indexOf("DEFAULT"),0,e)}}}function ie(e,t,n){if(t=Array.from(t),e._x_virtualDirectives){let n=Object.entries(e._x_virtualDirectives).map(([e,t])=>({name:e,value:t})),i=re(n);n=n.map(e=>i.find(t=>t.name===e.name)?{name:`x-bind:${e.name}`,value:`"${e.value}"`}:e),t=t.concat(n)}let i={},r=t.map(ue((e,t)=>i[e]=t)).filter(de).map(function(e,t){return({name:n,value:i})=>{let r=n.match(he()),o=n.match(/:([a-zA-Z0-9\-_:]+)/),s=n.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],a=t||e[n]||n;return{type:r?r[1]:null,value:o?o[1]:null,modifiers:s.map(e=>e.replace(".","")),expression:i,original:a}}}(i,n)).sort(ge);return r.map(t=>function(e,t){let n=te[t.type]||(()=>{}),[i,r]=le(e);y(e,t.original,r);let o=()=>{e._x_ignore||e._x_ignoreSelf||(n.inline&&n.inline(e,t,i),n=n.bind(n,e,t,i),oe?se.get(ae).push(n):n())};return o.runCleanups=r,o}(e,t))}function re(e){return Array.from(e).map(ue()).filter(e=>!de(e))}var oe=!1,se=new Map,ae=Symbol();function le(e){let t=[],[n,o]=function(e){let t=()=>{};return[n=>{let o=i(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(e=>e())}),e._x_effects.add(o),t=()=>{void 0!==o&&(e._x_effects.delete(o),r(o))},o},()=>{t()}]}(e);return t.push(o),[{Alpine:mt,effect:n,cleanup:e=>t.push(e),evaluateLater:J.bind(J,e),evaluate:K.bind(K,e)},()=>t.forEach(e=>e())]}var ce=(e,t)=>({name:n,value:i})=>(n.startsWith(e)&&(n=n.replace(e,t)),{name:n,value:i});function ue(e=()=>{}){return({name:t,value:n})=>{let{name:i,value:r}=pe.reduce((e,t)=>t(e),{name:t,value:n});return i!==t&&e(i,t),{name:i,value:r}}}var pe=[];function fe(e){pe.push(e)}function de({name:e}){return he().test(e)}var he=()=>new RegExp(`^${Q}([^:^.]+)\\b`),_e="DEFAULT",me=["ignore","ref","data","id","anchor","bind","init","for","model","modelable","transition","show","if",_e,"teleport"];function ge(e,t){let n=-1===me.indexOf(e.type)?_e:e.type,i=-1===me.indexOf(t.type)?_e:t.type;return me.indexOf(n)-me.indexOf(i)}function xe(e,t,n={}){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}function ve(e,t){if("function"==typeof ShadowRoot&&e instanceof ShadowRoot)return void Array.from(e.children).forEach(e=>ve(e,t));let n=!1;if(t(e,()=>n=!0),n)return;let i=e.firstElementChild;for(;i;)ve(i,t),i=i.nextElementSibling}function ye(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}var be=!1,we=[],Ee=[];function Oe(){return we.map(e=>e())}function Ae(){return we.concat(Ee).map(e=>e())}function ke(e){we.push(e)}function Te(e){Ee.push(e)}function Se(e,t=!1){return Ne(e,e=>{if((t?Ae():Oe()).some(t=>e.matches(t)))return!0})}function Ne(e,t){if(e){if(t(e))return e;if(e._x_teleportBack&&(e=e._x_teleportBack),e.parentElement)return Ne(e.parentElement,t)}}var Re=[],Ce=1;function Pe(e,t=ve,n=()=>{}){Ne(e,e=>e._x_ignore)||function(){oe=!0;let i=Symbol();ae=i,se.set(i,[]);let r=()=>{for(;se.get(i).length;)se.get(i).shift()();se.delete(i)};t(e,(e,t)=>{e._x_marker||(n(e,t),Re.forEach(n=>n(e,t)),ie(e,e.attributes).forEach(e=>e()),e._x_ignore||(e._x_marker=Ce++),e._x_ignore&&t())}),oe=!1,r()}()}function $e(e,t=ve){t(e,e=>{!function(e){for(e._x_effects?.forEach(u);e._x_cleanups?.length;)e._x_cleanups.pop()()}(e),b(e),delete e._x_marker})}var je=[],Ue=!1;function Ie(e=()=>{}){return queueMicrotask(()=>{Ue||setTimeout(()=>{Le()})}),new Promise(t=>{je.push(()=>{e(),t()})})}function Le(){for(Ue=!1;je.length;)je.shift()()}function Me(e,t){return Array.isArray(t)?Be(e,t.join(" ")):"object"==typeof t&&null!==t?function(e,t){let n=e=>e.split(" ").filter(Boolean),i=Object.entries(t).flatMap(([e,t])=>!!t&&n(e)).filter(Boolean),r=Object.entries(t).flatMap(([e,t])=>!t&&n(e)).filter(Boolean),o=[],s=[];return r.forEach(t=>{e.classList.contains(t)&&(e.classList.remove(t),s.push(t))}),i.forEach(t=>{e.classList.contains(t)||(e.classList.add(t),o.push(t))}),()=>{s.forEach(t=>e.classList.add(t)),o.forEach(t=>e.classList.remove(t))}}(e,t):"function"==typeof t?Me(e,t()):Be(e,t)}function Be(e,t){return t=!0===t?t="":t||"",n=t.split(" ").filter(t=>!e.classList.contains(t)).filter(Boolean),e.classList.add(...n),()=>{e.classList.remove(...n)};var n}function Fe(e,t){return"object"==typeof t&&null!==t?function(e,t){let n={};return Object.entries(t).forEach(([t,i])=>{n[t]=e.style[t],t.startsWith("--")||(t=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),e.style.setProperty(t,i)}),setTimeout(()=>{0===e.style.length&&e.removeAttribute("style")}),()=>{Fe(e,n)}}(e,t):function(e,t){let n=e.getAttribute("style",t);return e.setAttribute("style",t),()=>{e.setAttribute("style",n||"")}}(e,t)}function De(e,t=()=>{}){let n=!1;return function(){n?t.apply(this,arguments):(n=!0,e.apply(this,arguments))}}function ze(e,t,n={}){e._x_transition||(e._x_transition={enter:{during:n,start:n,end:n},leave:{during:n,start:n,end:n},in(n=()=>{},i=()=>{}){qe(e,t,{during:this.enter.during,start:this.enter.start,end:this.enter.end},n,i)},out(n=()=>{},i=()=>{}){qe(e,t,{during:this.leave.during,start:this.leave.start,end:this.leave.end},n,i)}})}function Ge(e){let t=e.parentNode;if(t)return t._x_hidePromise?t:Ge(t)}function qe(e,t,{during:n,start:i,end:r}={},o=()=>{},s=()=>{}){if(e._x_transitioning&&e._x_transitioning.cancel(),0===Object.keys(n).length&&0===Object.keys(i).length&&0===Object.keys(r).length)return o(),void s();let a,l,c;!function(e,t){let n,i,r,o=De(()=>{T(()=>{n=!0,i||t.before(),r||(t.end(),Le()),t.after(),e.isConnected&&t.cleanup(),delete e._x_transitioning})});e._x_transitioning={beforeCancels:[],beforeCancel(e){this.beforeCancels.push(e)},cancel:De(function(){for(;this.beforeCancels.length;)this.beforeCancels.shift()();o()}),finish:o},T(()=>{t.start(),t.during()}),Ue=!0,requestAnimationFrame(()=>{if(n)return;let o=1e3*Number(getComputedStyle(e).transitionDuration.replace(/,.*/,"").replace("s","")),s=1e3*Number(getComputedStyle(e).transitionDelay.replace(/,.*/,"").replace("s",""));0===o&&(o=1e3*Number(getComputedStyle(e).animationDuration.replace("s",""))),T(()=>{t.before()}),i=!0,requestAnimationFrame(()=>{n||(T(()=>{t.end()}),Le(),setTimeout(e._x_transitioning.finish,o+s),r=!0)})})}(e,{start(){a=t(e,i)},during(){l=t(e,n)},before:o,end(){a(),c=t(e,r)},after:s,cleanup(){l(),c()}})}function We(e,t,n){if(-1===e.indexOf(t))return n;const i=e[e.indexOf(t)+1];if(!i)return n;if("scale"===t&&isNaN(i))return n;if("duration"===t||"delay"===t){let e=i.match(/([0-9]+)ms/);if(e)return e[1]}return"origin"===t&&["top","right","left","center","bottom"].includes(e[e.indexOf(t)+2])?[i,e[e.indexOf(t)+2]].join(" "):i}ne("transition",(e,{value:t,modifiers:n,expression:i},{evaluate:r})=>{"function"==typeof i&&(i=r(i)),!1!==i&&(i&&"boolean"!=typeof i?function(e,t,n){ze(e,Me,""),{enter:t=>{e._x_transition.enter.during=t},"enter-start":t=>{e._x_transition.enter.start=t},"enter-end":t=>{e._x_transition.enter.end=t},leave:t=>{e._x_transition.leave.during=t},"leave-start":t=>{e._x_transition.leave.start=t},"leave-end":t=>{e._x_transition.leave.end=t}}[n](t)}(e,i,t):function(e,t,n){ze(e,Fe);let i=!t.includes("in")&&!t.includes("out")&&!n,r=i||t.includes("in")||["enter"].includes(n),o=i||t.includes("out")||["leave"].includes(n);t.includes("in")&&!i&&(t=t.filter((e,n)=>n<t.indexOf("out"))),t.includes("out")&&!i&&(t=t.filter((e,n)=>n>t.indexOf("out")));let s=!t.includes("opacity")&&!t.includes("scale"),a=s||t.includes("opacity")?0:1,l=s||t.includes("scale")?We(t,"scale",95)/100:1,c=We(t,"delay",0)/1e3,u=We(t,"origin","center"),p="opacity, transform",f=We(t,"duration",150)/1e3,d=We(t,"duration",75)/1e3,h="cubic-bezier(0.4, 0.0, 0.2, 1)";r&&(e._x_transition.enter.during={transformOrigin:u,transitionDelay:`${c}s`,transitionProperty:p,transitionDuration:`${f}s`,transitionTimingFunction:h},e._x_transition.enter.start={opacity:a,transform:`scale(${l})`},e._x_transition.enter.end={opacity:1,transform:"scale(1)"}),o&&(e._x_transition.leave.during={transformOrigin:u,transitionDelay:`${c}s`,transitionProperty:p,transitionDuration:`${d}s`,transitionTimingFunction:h},e._x_transition.leave.start={opacity:1,transform:"scale(1)"},e._x_transition.leave.end={opacity:a,transform:`scale(${l})`})}(e,n,t))}),window.Element.prototype._x_toggleAndCascadeWithTransitions=function(e,t,n,i){const r="visible"===document.visibilityState?requestAnimationFrame:setTimeout;let o=()=>r(n);t?e._x_transition&&(e._x_transition.enter||e._x_transition.leave)?e._x_transition.enter&&(Object.entries(e._x_transition.enter.during).length||Object.entries(e._x_transition.enter.start).length||Object.entries(e._x_transition.enter.end).length)?e._x_transition.in(n):o():e._x_transition?e._x_transition.in(n):o():(e._x_hidePromise=e._x_transition?new Promise((t,n)=>{e._x_transition.out(()=>{},()=>t(i)),e._x_transitioning&&e._x_transitioning.beforeCancel(()=>n({isFromCancelledTransition:!0}))}):Promise.resolve(i),queueMicrotask(()=>{let t=Ge(e);t?(t._x_hideChildren||(t._x_hideChildren=[]),t._x_hideChildren.push(e)):r(()=>{let t=e=>{let n=Promise.all([e._x_hidePromise,...(e._x_hideChildren||[]).map(t)]).then(([e])=>e?.());return delete e._x_hidePromise,delete e._x_hideChildren,n};t(e).catch(e=>{if(!e.isFromCancelledTransition)throw e})})}))};var Ve=!1;function Ke(e,t=()=>{}){return(...n)=>Ve?t(...n):e(...n)}var Je=[];function Ze(e){Je.push(e)}var He=!1;function Xe(e){let t=i;d((e,n)=>{let i=t(e);return r(i),()=>{}}),e(),d(t)}function Ye(e,t,i,r=[]){switch(e._x_bindings||(e._x_bindings=n({})),e._x_bindings[t]=i,t=r.includes("camel")?t.toLowerCase().replace(/-(\w)/g,(e,t)=>t.toUpperCase()):t){case"value":!function(e,t){if(st(e))void 0===e.attributes.value&&(e.value=t),window.fromModel&&(e.checked="boolean"==typeof t?tt(e.value)===t:et(e.value,t));else if(ot(e))Number.isInteger(t)?e.value=t:Array.isArray(t)||"boolean"==typeof t||[null,void 0].includes(t)?Array.isArray(t)?e.checked=t.some(t=>et(t,e.value)):e.checked=!!t:e.value=String(t);else if("SELECT"===e.tagName)!function(e,t){const n=[].concat(t).map(e=>e+"");Array.from(e.options).forEach(e=>{e.selected=n.includes(e.value)})}(e,t);else{if(e.value===t)return;e.value=void 0===t?"":t}}(e,i);break;case"style":!function(e,t){e._x_undoAddedStyles&&e._x_undoAddedStyles(),e._x_undoAddedStyles=Fe(e,t)}(e,i);break;case"class":!function(e,t){e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedClasses=Me(e,t)}(e,i);break;case"selected":case"checked":!function(e,t,n){Qe(e,t,n),function(e,t,n){e[t]!==n&&(e[t]=n)}(e,t,n)}(e,t,i);break;default:Qe(e,t,i)}}function Qe(e,t,n){[null,void 0,!1].includes(n)&&function(e){return!["aria-pressed","aria-checked","aria-expanded","aria-selected"].includes(e)}(t)?e.removeAttribute(t):(it(t)&&(n=t),function(e,t,n){e.getAttribute(t)!=n&&e.setAttribute(t,n)}(e,t,n))}function et(e,t){return e==t}function tt(e){return!![1,"1","true","on","yes",!0].includes(e)||![0,"0","false","off","no",!1].includes(e)&&(e?Boolean(e):null)}var nt=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected","shadowrootclonable","shadowrootdelegatesfocus","shadowrootserializable"]);function it(e){return nt.has(e)}function rt(e,t,n){let i=e.getAttribute(t);return null===i?"function"==typeof n?n():n:""===i||(it(t)?!![t,"true"].includes(i):i)}function ot(e){return"checkbox"===e.type||"ui-checkbox"===e.localName||"ui-switch"===e.localName}function st(e){return"radio"===e.type||"ui-radio"===e.localName}function at(e,t){let n;return function(){const i=this,r=arguments;clearTimeout(n),n=setTimeout(function(){n=null,e.apply(i,r)},t)}}function lt(e,t){let n;return function(){let i=arguments;n||(e.apply(this,i),n=!0,setTimeout(()=>n=!1,t))}}function ct({get:e,set:t},{get:n,set:o}){let s,a,l=!0,c=i(()=>{let i=e(),r=n();if(l)o(ut(i)),l=!1;else{let e=JSON.stringify(i),n=JSON.stringify(r);e!==s?o(ut(i)):e!==n&&t(ut(r))}s=JSON.stringify(e()),a=JSON.stringify(n())});return()=>{r(c)}}function ut(e){return"object"==typeof e?JSON.parse(JSON.stringify(e)):e}var pt={},ft=!1,dt={};function ht(e,t,n){let i=[];for(;i.length;)i.pop()();let r=Object.entries(t).map(([e,t])=>({name:e,value:t})),o=re(r);return r=r.map(e=>o.find(t=>t.name===e.name)?{name:`x-bind:${e.name}`,value:`"${e.value}"`}:e),ie(e,r,n).map(e=>{i.push(e.runCleanups),e()}),()=>{for(;i.length;)i.pop()()}}var _t={},mt={get reactive(){return n},get release(){return r},get effect(){return i},get raw(){return o},version:"3.15.0",flushAndStopDeferringMutations:function(){S=!1,R(N),N=[]},dontAutoEvaluateFunctions:V,disableEffectScheduling:function(e){f=!1,e(),f=!0},startObservingMutations:O,stopObservingMutations:A,setReactivityEngine:function(e){n=e.reactive,r=e.release,i=t=>e.effect(t,{scheduler:e=>{f?function(e){var t;t=e,l.includes(t)||l.push(t),a||s||(s=!0,queueMicrotask(p))}(e):e()}}),o=e.raw},onAttributeRemoved:y,onAttributesAdded:v,closestDataStack:$,skipDuringClone:Ke,onlyDuringClone:function(e){return(...t)=>Ve&&e(...t)},addRootSelector:ke,addInitSelector:Te,interceptClone:Ze,addScopeToNode:P,deferMutations:function(){S=!0},mapAttributes:fe,evaluateLater:J,interceptInit:function(e){Re.push(e)},setEvaluator:function(e){Z=e},mergeProxies:j,extractProp:function(e,t,n,i=!0){if(e._x_bindings&&void 0!==e._x_bindings[t])return e._x_bindings[t];if(e._x_inlineBindings&&void 0!==e._x_inlineBindings[t]){let n=e._x_inlineBindings[t];return n.extract=i,V(()=>K(e,n.expression))}return rt(e,t,n)},findClosest:Ne,onElRemoved:x,closestRoot:Se,destroyTree:$e,interceptor:M,transition:qe,setStyles:Fe,mutateDom:T,directive:ne,entangle:ct,throttle:lt,debounce:at,evaluate:K,initTree:Pe,nextTick:Ie,prefixed:ee,prefix:function(e){Q=e},plugin:function(e){(Array.isArray(e)?e:[e]).forEach(e=>e(mt))},magic:D,store:function(e,t){if(ft||(pt=n(pt),ft=!0),void 0===t)return pt[e];pt[e]=t,L(pt[e]),"object"==typeof t&&null!==t&&t.hasOwnProperty("init")&&"function"==typeof t.init&&pt[e].init()},start:function(){var e;be&&ye("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."),be=!0,document.body||ye("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"),xe(document,"alpine:init"),xe(document,"alpine:initializing"),O(),e=e=>Pe(e,ve),g.push(e),x(e=>$e(e)),v((e,t)=>{ie(e,t).forEach(e=>e())}),Array.from(document.querySelectorAll(Ae().join(","))).filter(e=>!Se(e.parentElement,!0)).forEach(e=>{Pe(e)}),xe(document,"alpine:initialized"),setTimeout(()=>{[["ui","dialog",["[x-dialog], [x-popover]"]],["anchor","anchor",["[x-anchor]"]],["sort","sort",["[x-sort]"]]].forEach(([e,t,n])=>{var i;i=t,Object.keys(te).includes(i)||n.some(t=>{if(document.querySelector(t))return ye(`found "${t}", but missing ${e} plugin`),!0})})})},clone:function(e,t){t._x_dataStack||(t._x_dataStack=e._x_dataStack),Ve=!0,He=!0,Xe(()=>{!function(e){let t=!1;Pe(e,(e,n)=>{ve(e,(e,i)=>{if(t&&function(e){return Oe().some(t=>e.matches(t))}(e))return i();t=!0,n(e,i)})})}(t)}),Ve=!1,He=!1},cloneNode:function(e,t){Je.forEach(n=>n(e,t)),Ve=!0,Xe(()=>{Pe(t,(e,t)=>{t(e,()=>{})})}),Ve=!1},bound:function(e,t,n){return e._x_bindings&&void 0!==e._x_bindings[t]?e._x_bindings[t]:rt(e,t,n)},$data:C,watch:h,walk:ve,data:function(e,t){_t[e]=t},bind:function(e,t){let n="function"!=typeof t?()=>t:t;return e instanceof Element?ht(e,n()):(dt[e]=n,()=>{})}},gt=class{constructor(e,t,n,i){this.type=e,this.value=t,this.start=n,this.end=i}},xt=class{constructor(e){this.input=e,this.position=0,this.tokens=[]}tokenize(){for(;this.position<this.input.length&&(this.skipWhitespace(),!(this.position>=this.input.length));){const e=this.input[this.position];this.isDigit(e)?this.readNumber():this.isAlpha(e)||"_"===e||"$"===e?this.readIdentifierOrKeyword():'"'===e||"'"===e?this.readString():"/"===e&&"/"===this.peek()?this.skipLineComment():this.readOperatorOrPunctuation()}return this.tokens.push(new gt("EOF",null,this.position,this.position)),this.tokens}skipWhitespace(){for(;this.position<this.input.length&&/\s/.test(this.input[this.position]);)this.position++}skipLineComment(){for(;this.position<this.input.length&&"\n"!==this.input[this.position];)this.position++}isDigit(e){return/[0-9]/.test(e)}isAlpha(e){return/[a-zA-Z]/.test(e)}isAlphaNumeric(e){return/[a-zA-Z0-9_$]/.test(e)}peek(e=1){return this.input[this.position+e]||""}readNumber(){const e=this.position;let t=!1;for(;this.position<this.input.length;){const e=this.input[this.position];if(this.isDigit(e))this.position++;else{if("."!==e||t)break;t=!0,this.position++}}const n=this.input.slice(e,this.position);this.tokens.push(new gt("NUMBER",parseFloat(n),e,this.position))}readIdentifierOrKeyword(){const e=this.position;for(;this.position<this.input.length&&this.isAlphaNumeric(this.input[this.position]);)this.position++;const t=this.input.slice(e,this.position);["true","false","null","undefined","new","typeof","void","delete","in","instanceof"].includes(t)?"true"===t||"false"===t?this.tokens.push(new gt("BOOLEAN","true"===t,e,this.position)):"null"===t?this.tokens.push(new gt("NULL",null,e,this.position)):"undefined"===t?this.tokens.push(new gt("UNDEFINED",void 0,e,this.position)):this.tokens.push(new gt("KEYWORD",t,e,this.position)):this.tokens.push(new gt("IDENTIFIER",t,e,this.position))}readString(){const e=this.position,t=this.input[this.position];this.position++;let n="",i=!1;for(;this.position<this.input.length;){const r=this.input[this.position];if(i){switch(r){case"n":n+="\n";break;case"t":n+="\t";break;case"r":n+="\r";break;case"\\":n+="\\";break;case t:n+=t;break;default:n+=r}i=!1}else if("\\"===r)i=!0;else{if(r===t)return this.position++,void this.tokens.push(new gt("STRING",n,e,this.position));n+=r}this.position++}throw new Error(`Unterminated string starting at position ${e}`)}readOperatorOrPunctuation(){const e=this.position,t=this.input[this.position],n=this.peek(),i=this.peek(2);if("="===t&&"="===n&&"="===i)this.position+=3,this.tokens.push(new gt("OPERATOR","===",e,this.position));else if("!"===t&&"="===n&&"="===i)this.position+=3,this.tokens.push(new gt("OPERATOR","!==",e,this.position));else if("="===t&&"="===n)this.position+=2,this.tokens.push(new gt("OPERATOR","==",e,this.position));else if("!"===t&&"="===n)this.position+=2,this.tokens.push(new gt("OPERATOR","!=",e,this.position));else if("<"===t&&"="===n)this.position+=2,this.tokens.push(new gt("OPERATOR","<=",e,this.position));else if(">"===t&&"="===n)this.position+=2,this.tokens.push(new gt("OPERATOR",">=",e,this.position));else if("&"===t&&"&"===n)this.position+=2,this.tokens.push(new gt("OPERATOR","&&",e,this.position));else if("|"===t&&"|"===n)this.position+=2,this.tokens.push(new gt("OPERATOR","||",e,this.position));else if("+"===t&&"+"===n)this.position+=2,this.tokens.push(new gt("OPERATOR","++",e,this.position));else if("-"===t&&"-"===n)this.position+=2,this.tokens.push(new gt("OPERATOR","--",e,this.position));else{this.position++;const n="()[]{},.;:?".includes(t)?"PUNCTUATION":"OPERATOR";this.tokens.push(new gt(n,t,e,this.position))}}},vt=class{constructor(e){this.tokens=e,this.position=0}parse(){if(this.isAtEnd())throw new Error("Empty expression");const e=this.parseExpression();if(this.match("PUNCTUATION",";"),!this.isAtEnd())throw new Error(`Unexpected token: ${this.current().value}`);return e}parseExpression(){return this.parseAssignment()}parseAssignment(){const e=this.parseTernary();if(this.match("OPERATOR","=")){const t=this.parseAssignment();if("Identifier"===e.type||"MemberExpression"===e.type)return{type:"AssignmentExpression",left:e,operator:"=",right:t};throw new Error("Invalid assignment target")}return e}parseTernary(){const e=this.parseLogicalOr();if(this.match("PUNCTUATION","?")){const t=this.parseExpression();return this.consume("PUNCTUATION",":"),{type:"ConditionalExpression",test:e,consequent:t,alternate:this.parseExpression()}}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match("OPERATOR","||");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseLogicalAnd()};return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match("OPERATOR","&&");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseEquality()};return e}parseEquality(){let e=this.parseRelational();for(;this.match("OPERATOR","==","!=","===","!==");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseRelational()};return e}parseRelational(){let e=this.parseAdditive();for(;this.match("OPERATOR","<",">","<=",">=");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseAdditive()};return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match("OPERATOR","+","-");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseMultiplicative()};return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match("OPERATOR","*","/","%");)e={type:"BinaryExpression",operator:this.previous().value,left:e,right:this.parseUnary()};return e}parseUnary(){return this.match("OPERATOR","++","--")?{type:"UpdateExpression",operator:this.previous().value,argument:this.parseUnary(),prefix:!0}:this.match("OPERATOR","!","-","+")?{type:"UnaryExpression",operator:this.previous().value,argument:this.parseUnary(),prefix:!0}:this.parsePostfix()}parsePostfix(){let e=this.parseMember();return this.match("OPERATOR","++","--")?{type:"UpdateExpression",operator:this.previous().value,argument:e,prefix:!1}:e}parseMember(){let e=this.parsePrimary();for(;;)if(this.match("PUNCTUATION","."))e={type:"MemberExpression",object:e,property:{type:"Identifier",name:this.consume("IDENTIFIER").value},computed:!1};else if(this.match("PUNCTUATION","[")){const t=this.parseExpression();this.consume("PUNCTUATION","]"),e={type:"MemberExpression",object:e,property:t,computed:!0}}else{if(!this.match("PUNCTUATION","("))break;e={type:"CallExpression",callee:e,arguments:this.parseArguments()}}return e}parseArguments(){const e=[];if(!this.check("PUNCTUATION",")"))do{e.push(this.parseExpression())}while(this.match("PUNCTUATION",","));return this.consume("PUNCTUATION",")"),e}parsePrimary(){if(this.match("NUMBER"))return{type:"Literal",value:this.previous().value};if(this.match("STRING"))return{type:"Literal",value:this.previous().value};if(this.match("BOOLEAN"))return{type:"Literal",value:this.previous().value};if(this.match("NULL"))return{type:"Literal",value:null};if(this.match("UNDEFINED"))return{type:"Literal",value:void 0};if(this.match("IDENTIFIER"))return{type:"Identifier",name:this.previous().value};if(this.match("PUNCTUATION","(")){const e=this.parseExpression();return this.consume("PUNCTUATION",")"),e}if(this.match("PUNCTUATION","["))return this.parseArrayLiteral();if(this.match("PUNCTUATION","{"))return this.parseObjectLiteral();throw new Error(`Unexpected token: ${this.current().type} "${this.current().value}"`)}parseArrayLiteral(){const e=[];for(;!this.check("PUNCTUATION","]")&&!this.isAtEnd()&&(e.push(this.parseExpression()),this.match("PUNCTUATION",","))&&!this.check("PUNCTUATION","]"););return this.consume("PUNCTUATION","]"),{type:"ArrayExpression",elements:e}}parseObjectLiteral(){const e=[];for(;!this.check("PUNCTUATION","}")&&!this.isAtEnd();){let t,n=!1;if(this.match("STRING"))t={type:"Literal",value:this.previous().value};else if(this.match("IDENTIFIER"))t={type:"Identifier",name:this.previous().value};else{if(!this.match("PUNCTUATION","["))throw new Error("Expected property key");t=this.parseExpression(),n=!0,this.consume("PUNCTUATION","]")}this.consume("PUNCTUATION",":");const i=this.parseExpression();if(e.push({type:"Property",key:t,value:i,computed:n,shorthand:!1}),!this.match("PUNCTUATION",","))break;if(this.check("PUNCTUATION","}"))break}return this.consume("PUNCTUATION","}"),{type:"ObjectExpression",properties:e}}match(...e){for(let t=0;t<e.length;t++){const n=e[t];if(0===t&&e.length>1){const t=n;for(let n=1;n<e.length;n++)if(this.check(t,e[n]))return this.advance(),!0;return!1}if(1===e.length)return!!this.checkType(n)&&(this.advance(),!0)}return!1}check(e,t){return!this.isAtEnd()&&(void 0!==t?this.current().type===e&&this.current().value===t:this.current().type===e)}checkType(e){return!this.isAtEnd()&&this.current().type===e}advance(){return this.isAtEnd()||this.position++,this.previous()}isAtEnd(){return"EOF"===this.current().type}current(){return this.tokens[this.position]}previous(){return this.tokens[this.position-1]}consume(e,t){if(void 0!==t){if(this.check(e,t))return this.advance();throw new Error(`Expected ${e} "${t}" but got ${this.current().type} "${this.current().value}"`)}if(this.check(e))return this.advance();throw new Error(`Expected ${e} but got ${this.current().type} "${this.current().value}"`)}},yt=class{evaluate({node:e,scope:t={},context:n=null,allowGlobal:i=!1,forceBindingRootScopeToFunctions:r=!0}){switch(e.type){case"Literal":return e.value;case"Identifier":if(e.name in t){const n=t[e.name];return"function"==typeof n?n.bind(t):n}if(i&&void 0!==globalThis[e.name]){const t=globalThis[e.name];return"function"==typeof t?t.bind(globalThis):t}throw new Error(`Undefined variable: ${e.name}`);case"MemberExpression":const o=this.evaluate({node:e.object,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});if(null==o)throw new Error("Cannot read property of null or undefined");let s;return s=e.computed?o[this.evaluate({node:e.property,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r})]:o[e.property.name],"function"==typeof s?r?s.bind(t):s.bind(o):s;case"CallExpression":const a=e.arguments.map(e=>this.evaluate({node:e,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}));if("MemberExpression"===e.callee.type){const o=this.evaluate({node:e.callee.object,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});let s;if(s=e.callee.computed?o[this.evaluate({node:e.callee.property,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r})]:o[e.callee.property.name],"function"!=typeof s)throw new Error("Value is not a function");return s.apply(o,a)}if("Identifier"===e.callee.type){const r=e.callee.name;let o;if(r in t)o=t[r];else{if(!i||void 0===globalThis[r])throw new Error(`Undefined variable: ${r}`);o=globalThis[r]}if("function"!=typeof o)throw new Error("Value is not a function");const s=null!==n?n:t;return o.apply(s,a)}{const o=this.evaluate({node:e.callee,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});if("function"!=typeof o)throw new Error("Value is not a function");return o.apply(n,a)}case"UnaryExpression":const l=this.evaluate({node:e.argument,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});switch(e.operator){case"!":return!l;case"-":return-l;case"+":return+l;default:throw new Error(`Unknown unary operator: ${e.operator}`)}case"UpdateExpression":if("Identifier"===e.argument.type){const n=e.argument.name;if(!(n in t))throw new Error(`Undefined variable: ${n}`);const i=t[n];return"++"===e.operator?t[n]=i+1:"--"===e.operator&&(t[n]=i-1),e.prefix?t[n]:i}if("MemberExpression"===e.argument.type){const o=this.evaluate({node:e.argument.object,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}),s=e.argument.computed?this.evaluate({node:e.argument.property,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}):e.argument.property.name,a=o[s];return"++"===e.operator?o[s]=a+1:"--"===e.operator&&(o[s]=a-1),e.prefix?o[s]:a}throw new Error("Invalid update expression target");case"BinaryExpression":const c=this.evaluate({node:e.left,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}),u=this.evaluate({node:e.right,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});switch(e.operator){case"+":return c+u;case"-":return c-u;case"*":return c*u;case"/":return c/u;case"%":return c%u;case"==":return c==u;case"!=":return c!=u;case"===":return c===u;case"!==":return c!==u;case"<":return c<u;case">":return c>u;case"<=":return c<=u;case">=":return c>=u;case"&&":return c&&u;case"||":return c||u;default:throw new Error(`Unknown binary operator: ${e.operator}`)}case"ConditionalExpression":return this.evaluate({node:e.test,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r})?this.evaluate({node:e.consequent,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}):this.evaluate({node:e.alternate,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});case"AssignmentExpression":const p=this.evaluate({node:e.right,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});if("Identifier"===e.left.type)return t[e.left.name]=p,p;if("MemberExpression"===e.left.type){const o=this.evaluate({node:e.left.object,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});return e.left.computed?o[this.evaluate({node:e.left.property,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r})]=p:o[e.left.property.name]=p,p}throw new Error("Invalid assignment target");case"ArrayExpression":return e.elements.map(e=>this.evaluate({node:e,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}));case"ObjectExpression":const f={};for(const o of e.properties){const e=o.computed?this.evaluate({node:o.key,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}):"Identifier"===o.key.type?o.key.name:this.evaluate({node:o.key,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r}),s=this.evaluate({node:o.value,scope:t,context:n,allowGlobal:i,forceBindingRootScopeToFunctions:r});f[e]=s}return f;default:throw new Error(`Unknown node type: ${e.type}`)}}};function bt(e,t){const n=Object.create(null),i=e.split(",");for(let e=0;e<i.length;e++)n[i[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}var wt,Et=Object.freeze({}),Ot=(Object.freeze([]),Object.prototype.hasOwnProperty),At=(e,t)=>Ot.call(e,t),kt=Array.isArray,Tt=e=>"[object Map]"===Ct(e),St=e=>"symbol"==typeof e,Nt=e=>null!==e&&"object"==typeof e,Rt=Object.prototype.toString,Ct=e=>Rt.call(e),Pt=e=>Ct(e).slice(8,-1),$t=e=>"string"==typeof e&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,jt=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Ut=/-(\w)/g,It=(jt(e=>e.replace(Ut,(e,t)=>t?t.toUpperCase():"")),/\B([A-Z])/g),Lt=(jt(e=>e.replace(It,"-$1").toLowerCase()),jt(e=>e.charAt(0).toUpperCase()+e.slice(1))),Mt=(jt(e=>e?`on${Lt(e)}`:""),(e,t)=>e!==t&&(e==e||t==t)),Bt=new WeakMap,Ft=[],Dt=Symbol("iterate"),zt=Symbol("Map key iterate"),Gt=0;function qt(e){const{deps:t}=e;if(t.length){for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}}var Wt=!0,Vt=[];function Kt(){const e=Vt.pop();Wt=void 0===e||e}function Jt(e,t,n){if(!Wt||void 0===wt)return;let i=Bt.get(e);i||Bt.set(e,i=new Map);let r=i.get(n);r||i.set(n,r=new Set),r.has(wt)||(r.add(wt),wt.deps.push(r),wt.options.onTrack&&wt.options.onTrack({effect:wt,target:e,type:t,key:n}))}function Zt(e,t,n,i,r,o){const s=Bt.get(e);if(!s)return;const a=new Set,l=e=>{e&&e.forEach(e=>{(e!==wt||e.allowRecurse)&&a.add(e)})};if("clear"===t)s.forEach(l);else if("length"===n&&kt(e))s.forEach((e,t)=>{("length"===t||t>=i)&&l(e)});else switch(void 0!==n&&l(s.get(n)),t){case"add":kt(e)?$t(n)&&l(s.get("length")):(l(s.get(Dt)),Tt(e)&&l(s.get(zt)));break;case"delete":kt(e)||(l(s.get(Dt)),Tt(e)&&l(s.get(zt)));break;case"set":Tt(e)&&l(s.get(Dt))}a.forEach(s=>{s.options.onTrigger&&s.options.onTrigger({effect:s,target:e,key:n,type:t,newValue:i,oldValue:r,oldTarget:o}),s.options.scheduler?s.options.scheduler(s):s()})}var Ht=bt("__proto__,__v_isRef,__isVue"),Xt=new Set(Object.getOwnPropertyNames(Symbol).map(e=>Symbol[e]).filter(St)),Yt=nn(),Qt=nn(!0),en=tn();function tn(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...e){const n=Ln(this);for(let e=0,t=this.length;e<t;e++)Jt(n,"get",e+"");const i=n[t](...e);return-1===i||!1===i?n[t](...e.map(Ln)):i}}),["push","pop","shift","unshift","splice"].forEach(t=>{e[t]=function(...e){Vt.push(Wt),Wt=!1;const n=Ln(this)[t].apply(this,e);return Kt(),n}}),e}function nn(e=!1,t=!1){return function(n,i,r){if("__v_isReactive"===i)return!e;if("__v_isReadonly"===i)return e;if("__v_raw"===i&&r===(e?t?$n:Pn:t?Cn:Rn).get(n))return n;const o=kt(n);if(!e&&o&&At(en,i))return Reflect.get(en,i,r);const s=Reflect.get(n,i,r);return(St(i)?Xt.has(i):Ht(i))?s:(e||Jt(n,"get",i),t?s:Mn(s)?o&&$t(i)?s:s.value:Nt(s)?e?Un(s):jn(s):s)}}function rn(e=!1){return function(t,n,i,r){let o=t[n];if(!e&&(i=Ln(i),o=Ln(o),!kt(t)&&Mn(o)&&!Mn(i)))return o.value=i,!0;const s=kt(t)&&$t(n)?Number(n)<t.length:At(t,n),a=Reflect.set(t,n,i,r);return t===Ln(r)&&(s?Mt(i,o)&&Zt(t,"set",n,i,o):Zt(t,"add",n,i)),a}}var on={get:Yt,set:rn(),deleteProperty:function(e,t){const n=At(e,t),i=e[t],r=Reflect.deleteProperty(e,t);return r&&n&&Zt(e,"delete",t,void 0,i),r},has:function(e,t){const n=Reflect.has(e,t);return St(t)&&Xt.has(t)||Jt(e,"has",t),n},ownKeys:function(e){return Jt(e,"iterate",kt(e)?"length":Dt),Reflect.ownKeys(e)}},sn={get:Qt,set(e,t){return console.warn(`Set operation on key "${String(t)}" failed: target is readonly.`,e),!0},deleteProperty(e,t){return console.warn(`Delete operation on key "${String(t)}" failed: target is readonly.`,e),!0}},an=e=>Nt(e)?jn(e):e,ln=e=>Nt(e)?Un(e):e,cn=e=>e,un=e=>Reflect.getPrototypeOf(e);function pn(e,t,n=!1,i=!1){const r=Ln(e=e.__v_raw),o=Ln(t);t!==o&&!n&&Jt(r,"get",t),!n&&Jt(r,"get",o);const{has:s}=un(r),a=i?cn:n?ln:an;return s.call(r,t)?a(e.get(t)):s.call(r,o)?a(e.get(o)):void(e!==r&&e.get(t))}function fn(e,t=!1){const n=this.__v_raw,i=Ln(n),r=Ln(e);return e!==r&&!t&&Jt(i,"has",e),!t&&Jt(i,"has",r),e===r?n.has(e):n.has(e)||n.has(r)}function dn(e,t=!1){return e=e.__v_raw,!t&&Jt(Ln(e),"iterate",Dt),Reflect.get(e,"size",e)}function hn(e){e=Ln(e);const t=Ln(this);return un(t).has.call(t,e)||(t.add(e),Zt(t,"add",e,e)),this}function _n(e,t){t=Ln(t);const n=Ln(this),{has:i,get:r}=un(n);let o=i.call(n,e);o?Nn(n,i,e):(e=Ln(e),o=i.call(n,e));const s=r.call(n,e);return n.set(e,t),o?Mt(t,s)&&Zt(n,"set",e,t,s):Zt(n,"add",e,t),this}function mn(e){const t=Ln(this),{has:n,get:i}=un(t);let r=n.call(t,e);r?Nn(t,n,e):(e=Ln(e),r=n.call(t,e));const o=i?i.call(t,e):void 0,s=t.delete(e);return r&&Zt(t,"delete",e,void 0,o),s}function gn(){const e=Ln(this),t=0!==e.size,n=Tt(e)?new Map(e):new Set(e),i=e.clear();return t&&Zt(e,"clear",void 0,void 0,n),i}function xn(e,t){return function(n,i){const r=this,o=r.__v_raw,s=Ln(o),a=t?cn:e?ln:an;return!e&&Jt(s,"iterate",Dt),o.forEach((e,t)=>n.call(i,a(e),a(t),r))}}function vn(e,t,n){return function(...i){const r=this.__v_raw,o=Ln(r),s=Tt(o),a="entries"===e||e===Symbol.iterator&&s,l="keys"===e&&s,c=r[e](...i),u=n?cn:t?ln:an;return!t&&Jt(o,"iterate",l?zt:Dt),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:a?[u(e[0]),u(e[1])]:u(e),done:t}},[Symbol.iterator](){return this}}}}function yn(e){return function(...t){{const n=t[0]?`on key "${t[0]}" `:"";console.warn(`${Lt(e)} operation ${n}failed: target is readonly.`,Ln(this))}return"delete"!==e&&this}}function bn(){const e={get(e){return pn(this,e)},get size(){return dn(this)},has:fn,add:hn,set:_n,delete:mn,clear:gn,forEach:xn(!1,!1)},t={get(e){return pn(this,e,!1,!0)},get size(){return dn(this)},has:fn,add:hn,set:_n,delete:mn,clear:gn,forEach:xn(!1,!0)},n={get(e){return pn(this,e,!0)},get size(){return dn(this,!0)},has(e){return fn.call(this,e,!0)},add:yn("add"),set:yn("set"),delete:yn("delete"),clear:yn("clear"),forEach:xn(!0,!1)},i={get(e){return pn(this,e,!0,!0)},get size(){return dn(this,!0)},has(e){return fn.call(this,e,!0)},add:yn("add"),set:yn("set"),delete:yn("delete"),clear:yn("clear"),forEach:xn(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(r=>{e[r]=vn(r,!1,!1),n[r]=vn(r,!0,!1),t[r]=vn(r,!1,!0),i[r]=vn(r,!0,!0)}),[e,n,t,i]}var[wn,En,On,An]=bn();function kn(e,t){const n=t?e?An:On:e?En:wn;return(t,i,r)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(At(n,i)&&i in t?n:t,i,r)}var Tn={get:kn(!1,!1)},Sn={get:kn(!0,!1)};function Nn(e,t,n){const i=Ln(n);if(i!==n&&t.call(e,i)){const t=Pt(e);console.warn(`Reactive ${t} contains both the raw and reactive versions of the same object${"Map"===t?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}var Rn=new WeakMap,Cn=new WeakMap,Pn=new WeakMap,$n=new WeakMap;function jn(e){return e&&e.__v_isReadonly?e:In(e,!1,on,Tn,Rn)}function Un(e){return In(e,!0,sn,Sn,Pn)}function In(e,t,n,i,r){if(!Nt(e))return console.warn(`value cannot be made reactive: ${String(e)}`),e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=r.get(e);if(o)return o;const s=(a=e).__v_skip||!Object.isExtensible(a)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(Pt(a));var a;if(0===s)return e;const l=new Proxy(e,2===s?i:n);return r.set(e,l),l}function Ln(e){return e&&Ln(e.__v_raw)||e}function Mn(e){return Boolean(e&&!0===e.__v_isRef)}D("nextTick",()=>Ie),D("dispatch",e=>xe.bind(xe,e)),D("watch",(e,{evaluateLater:t,cleanup:n})=>(e,i)=>{let r=t(e),o=h(()=>{let e;return r(t=>e=t),e},i);n(o)}),D("store",function(){return pt}),D("data",e=>C(e)),D("root",e=>Se(e)),D("refs",e=>(e._x_refs_proxy||(e._x_refs_proxy=j(function(e){let t=[];return Ne(e,e=>{e._x_refs&&t.push(e._x_refs)}),t}(e))),e._x_refs_proxy));var Bn={};function Fn(e){return Bn[e]||(Bn[e]=0),++Bn[e]}function Dn(e,t,n){D(t,i=>ye(`You can't use [$${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${n}`,i))}D("id",(e,{cleanup:t})=>(n,i=null)=>function(e,t,n,i){if(e._x_id||(e._x_id={}),e._x_id[t])return e._x_id[t];let r=i();return e._x_id[t]=r,n(()=>{delete e._x_id[t]}),r}(e,`${n}${i?`-${i}`:""}`,t,()=>{let t=function(e,t){return Ne(e,e=>{if(e._x_ids&&e._x_ids[t])return!0})}(e,n),r=t?t._x_ids[n]:Fn(n);return i?`${n}-${r}-${i}`:`${n}-${r}`})),Ze((e,t)=>{e._x_id&&(t._x_id=e._x_id)}),D("el",e=>e),Dn("Focus","focus","focus"),Dn("Persist","persist","persist"),ne("modelable",(e,{expression:t},{effect:n,evaluateLater:i,cleanup:r})=>{let o=i(t),s=()=>{let e;return o(t=>e=t),e},a=i(`${t}=__placeholder`),l=e=>a(()=>{},{scope:{__placeholder:e}}),c=s();l(c),queueMicrotask(()=>{if(!e._x_model)return;e._x_removeModelListeners.default();let t=e._x_model.get,n=e._x_model.set,i=ct({get(){return t()},set(e){n(e)}},{get(){return s()},set(e){l(e)}});r(i)})}),ne("teleport",(e,{modifiers:t,expression:n},{cleanup:i})=>{"template"!==e.tagName.toLowerCase()&&ye("x-teleport can only be used on a <template> tag",e);let r=Gn(n),o=e.content.cloneNode(!0).firstElementChild;e._x_teleport=o,o._x_teleportBack=e,e.setAttribute("data-teleport-template",!0),o.setAttribute("data-teleport-target",!0),e._x_forwardEvents&&e._x_forwardEvents.forEach(t=>{o.addEventListener(t,t=>{t.stopPropagation(),e.dispatchEvent(new t.constructor(t.type,t))})}),P(o,{},e);let s=(e,t,n)=>{n.includes("prepend")?t.parentNode.insertBefore(e,t):n.includes("append")?t.parentNode.insertBefore(e,t.nextSibling):t.appendChild(e)};T(()=>{s(o,r,t),Ke(()=>{Pe(o)})()}),e._x_teleportPutBack=()=>{let i=Gn(n);T(()=>{s(e._x_teleport,i,t)})},i(()=>T(()=>{o.remove(),$e(o)}))});var zn=document.createElement("div");function Gn(e){let t=Ke(()=>document.querySelector(e),()=>zn)();return t||ye(`Cannot find x-teleport element for selector: "${e}"`),t}var qn=()=>{};function Wn(e,t,n,i){let r=e,o=e=>i(e),s={},a=(e,t)=>n=>t(e,n);if(n.includes("dot")&&(t=t.replace(/-/g,".")),n.includes("camel")&&(t=t.toLowerCase().replace(/-(\w)/g,(e,t)=>t.toUpperCase())),n.includes("passive")&&(s.passive=!0),n.includes("capture")&&(s.capture=!0),n.includes("window")&&(r=window),n.includes("document")&&(r=document),n.includes("debounce")){let e=n[n.indexOf("debounce")+1]||"invalid-wait",t=Vn(e.split("ms")[0])?Number(e.split("ms")[0]):250;o=at(o,t)}if(n.includes("throttle")){let e=n[n.indexOf("throttle")+1]||"invalid-wait",t=Vn(e.split("ms")[0])?Number(e.split("ms")[0]):250;o=lt(o,t)}return n.includes("prevent")&&(o=a(o,(e,t)=>{t.preventDefault(),e(t)})),n.includes("stop")&&(o=a(o,(e,t)=>{t.stopPropagation(),e(t)})),n.includes("once")&&(o=a(o,(e,n)=>{e(n),r.removeEventListener(t,o,s)})),(n.includes("away")||n.includes("outside"))&&(r=document,o=a(o,(t,n)=>{e.contains(n.target)||!1!==n.target.isConnected&&(e.offsetWidth<1&&e.offsetHeight<1||!1!==e._x_isShown&&t(n))})),n.includes("self")&&(o=a(o,(t,n)=>{n.target===e&&t(n)})),(function(e){return["keydown","keyup"].includes(e)}(t)||Kn(t))&&(o=a(o,(e,t)=>{(function(e,t){let n=t.filter(e=>!["window","document","prevent","stop","once","capture","self","away","outside","passive","preserve-scroll"].includes(e));if(n.includes("debounce")){let e=n.indexOf("debounce");n.splice(e,Vn((n[e+1]||"invalid-wait").split("ms")[0])?2:1)}if(n.includes("throttle")){let e=n.indexOf("throttle");n.splice(e,Vn((n[e+1]||"invalid-wait").split("ms")[0])?2:1)}if(0===n.length)return!1;if(1===n.length&&Jn(e.key).includes(n[0]))return!1;const i=["ctrl","shift","alt","meta","cmd","super"].filter(e=>n.includes(e));if(n=n.filter(e=>!i.includes(e)),i.length>0&&i.filter(t=>("cmd"!==t&&"super"!==t||(t="meta"),e[`${t}Key`])).length===i.length){if(Kn(e.type))return!1;if(Jn(e.key).includes(n[0]))return!1}return!0})(t,n)||e(t)})),r.addEventListener(t,o,s),()=>{r.removeEventListener(t,o,s)}}function Vn(e){return!Array.isArray(e)&&!isNaN(e)}function Kn(e){return["contextmenu","click","mouse"].some(t=>e.includes(t))}function Jn(e){if(!e)return[];var t;e=[" ","_"].includes(t=e)?t:t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[_\s]/,"-").toLowerCase();let n={ctrl:"control",slash:"/",space:" ",spacebar:" ",cmd:"meta",esc:"escape",up:"arrow-up",down:"arrow-down",left:"arrow-left",right:"arrow-right",period:".",comma:",",equal:"=",minus:"-",underscore:"_"};return n[e]=e,Object.keys(n).map(t=>{if(n[t]===e)return t}).filter(e=>e)}function Zn(e,t,n,i){return T(()=>{if(n instanceof CustomEvent&&void 0!==n.detail)return null!==n.detail&&void 0!==n.detail?n.detail:n.target.value;if(ot(e)){if(Array.isArray(i)){let e=null;return e=t.includes("number")?Hn(n.target.value):t.includes("boolean")?tt(n.target.value):n.target.value,n.target.checked?i.includes(e)?i:i.concat([e]):i.filter(t=>!(t==e))}return n.target.checked}if("select"===e.tagName.toLowerCase()&&e.multiple)return t.includes("number")?Array.from(n.target.selectedOptions).map(e=>Hn(e.value||e.text)):t.includes("boolean")?Array.from(n.target.selectedOptions).map(e=>tt(e.value||e.text)):Array.from(n.target.selectedOptions).map(e=>e.value||e.text);{let r;return r=st(e)?n.target.checked?n.target.value:i:n.target.value,t.includes("number")?Hn(r):t.includes("boolean")?tt(r):t.includes("trim")?r.trim():r}})}function Hn(e){let t=e?parseFloat(e):null;return n=t,Array.isArray(n)||isNaN(n)?e:t;var n}function Xn(e){return null!==e&&"object"==typeof e&&"function"==typeof e.get&&"function"==typeof e.set}qn.inline=(e,{modifiers:t},{cleanup:n})=>{t.includes("self")?e._x_ignoreSelf=!0:e._x_ignore=!0,n(()=>{t.includes("self")?delete e._x_ignoreSelf:delete e._x_ignore})},ne("ignore",qn),ne("effect",Ke((e,{expression:t},{effect:n})=>{n(J(e,t))})),ne("model",(e,{modifiers:t,expression:n},{effect:i,cleanup:r})=>{let o=e;t.includes("parent")&&(o=e.parentNode);let s,a=J(o,n);s="string"==typeof n?J(o,`${n}=__placeholder`):"function"==typeof n&&"string"==typeof n()?J(o,`${n()}=__placeholder`):()=>{};let l=()=>{let e;return a(t=>e=t),Xn(e)?e.get():e},c=e=>{let t;a(e=>t=e),Xn(t)?t.set(e):s(()=>{},{scope:{__placeholder:e}})};"string"==typeof n&&"radio"===e.type&&T(()=>{e.hasAttribute("name")||e.setAttribute("name",n)});let u="select"===e.tagName.toLowerCase()||["checkbox","radio"].includes(e.type)||t.includes("lazy")?"change":"input",p=Ve?()=>{}:Wn(e,u,t,n=>{c(Zn(e,t,n,l()))});if(t.includes("fill")&&([void 0,null,""].includes(l())||ot(e)&&Array.isArray(l())||"select"===e.tagName.toLowerCase()&&e.multiple)&&c(Zn(e,t,{target:e},l())),e._x_removeModelListeners||(e._x_removeModelListeners={}),e._x_removeModelListeners.default=p,r(()=>e._x_removeModelListeners.default()),e.form){let n=Wn(e.form,"reset",[],n=>{Ie(()=>e._x_model&&e._x_model.set(Zn(e,t,{target:e},l())))});r(()=>n())}e._x_model={get(){return l()},set(e){c(e)}},e._x_forceModelUpdate=t=>{void 0===t&&"string"==typeof n&&n.match(/\./)&&(t=""),window.fromModel=!0,T(()=>Ye(e,"value",t)),delete window.fromModel},i(()=>{let n=l();t.includes("unintrusive")&&document.activeElement.isSameNode(e)||e._x_forceModelUpdate(n)})}),ne("cloak",e=>queueMicrotask(()=>T(()=>e.removeAttribute(ee("cloak"))))),Te(()=>`[${ee("init")}]`),ne("init",Ke((e,{expression:t},{evaluate:n})=>"string"==typeof t?!!t.trim()&&n(t,{},!1):n(t,{},!1))),ne("text",(e,{expression:t},{effect:n,evaluateLater:i})=>{let r=i(t);n(()=>{r(t=>{T(()=>{e.textContent=t})})})}),ne("html",(e,{expression:t},{effect:n,evaluateLater:i})=>{let r=i(t);n(()=>{r(t=>{T(()=>{e.innerHTML=t,e._x_ignoreSelf=!0,Pe(e),delete e._x_ignoreSelf})})})}),fe(ce(":",ee("bind:")));var Yn=(e,{value:t,modifiers:n,expression:i,original:r},{effect:o,cleanup:s})=>{if(!t){let t={};return a=t,Object.entries(dt).forEach(([e,t])=>{Object.defineProperty(a,e,{get(){return(...e)=>t(...e)}})}),void J(e,i)(t=>{ht(e,t,r)},{scope:t})}var a;if("key"===t)return function(e,t){e._x_keyExpression=t}(e,i);if(e._x_inlineBindings&&e._x_inlineBindings[t]&&e._x_inlineBindings[t].extract)return;let l=J(e,i);o(()=>l(r=>{void 0===r&&"string"==typeof i&&i.match(/\./)&&(r=""),T(()=>Ye(e,t,r,n))})),s(()=>{e._x_undoAddedClasses&&e._x_undoAddedClasses(),e._x_undoAddedStyles&&e._x_undoAddedStyles()})};function Qn(e,t,n,i){let r={};return/^\[.*\]$/.test(e.item)&&Array.isArray(t)?e.item.replace("[","").replace("]","").split(",").map(e=>e.trim()).forEach((e,n)=>{r[e]=t[n]}):/^\{.*\}$/.test(e.item)&&!Array.isArray(t)&&"object"==typeof t?e.item.replace("{","").replace("}","").split(",").map(e=>e.trim()).forEach(e=>{r[e]=t[e]}):r[e.item]=t,e.index&&(r[e.index]=n),e.collection&&(r[e.collection]=i),r}function ei(){}function ti(e,t,n){ne(t,i=>ye(`You can't use [x-${t}] without first installing the "${e}" plugin here: https://alpinejs.dev/plugins/${n}`,i))}Yn.inline=(e,{value:t,modifiers:n,expression:i})=>{t&&(e._x_inlineBindings||(e._x_inlineBindings={}),e._x_inlineBindings[t]={expression:i,extract:!1})},ne("bind",Yn),ke(()=>`[${ee("data")}]`),ne("data",(e,{expression:t},{cleanup:i})=>{if(function(e){return!!Ve&&(!!He||e.hasAttribute("data-has-alpine-state"))}(e))return;t=""===t?"{}":t;let r={};z(r,e);let o={};var s,a;s=o,a=r,Object.entries(_t).forEach(([e,t])=>{Object.defineProperty(s,e,{get(){return(...e)=>t.bind(a)(...e)},enumerable:!1})});let l=K(e,t,{scope:o});void 0!==l&&!0!==l||(l={}),z(l,e);let c=n(l);L(c);let u=P(e,c);c.init&&K(e,c.init),i(()=>{c.destroy&&K(e,c.destroy),u()})}),Ze((e,t)=>{e._x_dataStack&&(t._x_dataStack=e._x_dataStack,t.setAttribute("data-has-alpine-state",!0))}),ne("show",(e,{modifiers:t,expression:n},{effect:i})=>{let r=J(e,n);e._x_doHide||(e._x_doHide=()=>{T(()=>{e.style.setProperty("display","none",t.includes("important")?"important":void 0)})}),e._x_doShow||(e._x_doShow=()=>{T(()=>{1===e.style.length&&"none"===e.style.display?e.removeAttribute("style"):e.style.removeProperty("display")})});let o,s=()=>{e._x_doHide(),e._x_isShown=!1},a=()=>{e._x_doShow(),e._x_isShown=!0},l=()=>setTimeout(a),c=De(e=>e?a():s(),t=>{"function"==typeof e._x_toggleAndCascadeWithTransitions?e._x_toggleAndCascadeWithTransitions(e,t,a,s):t?l():s()}),u=!0;i(()=>r(e=>{(u||e!==o)&&(t.includes("immediate")&&(e?l():s()),c(e),o=e,u=!1)}))}),ne("for",(e,{expression:t},{effect:i,cleanup:r})=>{let o=function(e){let t=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,n=e.match(/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/);if(!n)return;let i={};i.items=n[2].trim();let r=n[1].replace(/^\s*\(|\)\s*$/g,"").trim(),o=r.match(t);return o?(i.item=r.replace(t,"").trim(),i.index=o[1].trim(),o[2]&&(i.collection=o[2].trim())):i.item=r,i}(t),s=J(e,o.items),a=J(e,e._x_keyExpression||"index");e._x_prevKeys=[],e._x_lookup={},i(()=>function(e,t,i,r){let o=e;i(i=>{var s;s=i,!Array.isArray(s)&&!isNaN(s)&&i>=0&&(i=Array.from(Array(i).keys(),e=>e+1)),void 0===i&&(i=[]);let a=e._x_lookup,l=e._x_prevKeys,c=[],u=[];if("object"!=typeof(p=i)||Array.isArray(p))for(let n=0;n<i.length;n++){let o=Qn(t,i[n],n,i);r(t=>{u.includes(t)&&ye("Duplicate key on x-for",e),u.push(t)},{scope:{index:n,...o}}),c.push(o)}else i=Object.entries(i).map(([n,o])=>{let s=Qn(t,o,n,i);r(t=>{u.includes(t)&&ye("Duplicate key on x-for",e),u.push(t)},{scope:{index:n,...s}}),c.push(s)});var p;let f=[],d=[],h=[],_=[];for(let e=0;e<l.length;e++){let t=l[e];-1===u.indexOf(t)&&h.push(t)}l=l.filter(e=>!h.includes(e));let m="template";for(let e=0;e<u.length;e++){let t=u[e],n=l.indexOf(t);if(-1===n)l.splice(e,0,t),f.push([m,e]);else if(n!==e){let t=l.splice(e,1)[0],i=l.splice(n-1,1)[0];l.splice(e,0,i),l.splice(n,0,t),d.push([t,i])}else _.push(t);m=t}for(let e=0;e<h.length;e++){let t=h[e];t in a&&(T(()=>{$e(a[t]),a[t].remove()}),delete a[t])}for(let e=0;e<d.length;e++){let[t,n]=d[e],i=a[t],r=a[n],s=document.createElement("div");T(()=>{r||ye('x-for ":key" is undefined or invalid',o,n,a),r.after(s),i.after(r),r._x_currentIfEl&&r.after(r._x_currentIfEl),s.before(i),i._x_currentIfEl&&i.after(i._x_currentIfEl),s.remove()}),r._x_refreshXForScope(c[u.indexOf(n)])}for(let e=0;e<f.length;e++){let[t,i]=f[e],r="template"===t?o:a[t];r._x_currentIfEl&&(r=r._x_currentIfEl);let s=c[i],l=u[i],p=document.importNode(o.content,!0).firstElementChild,d=n(s);P(p,d,o),p._x_refreshXForScope=e=>{Object.entries(e).forEach(([e,t])=>{d[e]=t})},T(()=>{r.after(p),Ke(()=>Pe(p))()}),"object"==typeof l&&ye("x-for key cannot be an object, it must be a string or an integer",o),a[l]=p}for(let e=0;e<_.length;e++)a[_[e]]._x_refreshXForScope(c[u.indexOf(_[e])]);o._x_prevKeys=u})}(e,o,s,a)),r(()=>{Object.values(e._x_lookup).forEach(e=>T(()=>{$e(e),e.remove()})),delete e._x_prevKeys,delete e._x_lookup})}),ei.inline=(e,{expression:t},{cleanup:n})=>{let i=Se(e);i._x_refs||(i._x_refs={}),i._x_refs[t]=e,n(()=>delete i._x_refs[t])},ne("ref",ei),ne("if",(e,{expression:t},{effect:n,cleanup:i})=>{"template"!==e.tagName.toLowerCase()&&ye("x-if can only be used on a <template> tag",e);let r=J(e,t);n(()=>r(t=>{t?(()=>{if(e._x_currentIfEl)return e._x_currentIfEl;let t=e.content.cloneNode(!0).firstElementChild;P(t,{},e),T(()=>{e.after(t),Ke(()=>Pe(t))()}),e._x_currentIfEl=t,e._x_undoIf=()=>{T(()=>{$e(t),t.remove()}),delete e._x_currentIfEl}})():e._x_undoIf&&(e._x_undoIf(),delete e._x_undoIf)})),i(()=>e._x_undoIf&&e._x_undoIf())}),ne("id",(e,{expression:t},{evaluate:n})=>{n(t).forEach(t=>function(e,t){e._x_ids||(e._x_ids={}),e._x_ids[t]||(e._x_ids[t]=Fn(t))}(e,t))}),Ze((e,t)=>{e._x_ids&&(t._x_ids=e._x_ids)}),fe(ce("@",ee("on:"))),ne("on",Ke((e,{value:t,modifiers:n,expression:i},{cleanup:r})=>{let o=i?J(e,i):()=>{};"template"===e.tagName.toLowerCase()&&(e._x_forwardEvents||(e._x_forwardEvents=[]),e._x_forwardEvents.includes(t)||e._x_forwardEvents.push(t));let s=Wn(e,t,n,e=>{o(()=>{},{scope:{$event:e},params:[e]})});r(()=>s())})),ti("Collapse","collapse","collapse"),ti("Intersect","intersect","intersect"),ti("Focus","trap","focus"),ti("Mask","mask","mask"),mt.setEvaluator(function(e,t){let n=function(e){let t={};return z(t,e),[t,...$(e)]}(e);if("function"==typeof t)return H(n,t);let i=function(e,t,n){return(e=()=>{},{scope:i={},params:r=[]}={})=>{let o=j([i,...n]),s=function(e){try{const t=new xt(e).tokenize(),n=new vt(t).parse(),i=new yt;return function(e={}){const{scope:t={},context:r=null,allowGlobal:o=!1,forceBindingRootScopeToFunctions:s=!1}=e;return i.evaluate({node:n,scope:t,context:r,allowGlobal:o,forceBindingRootScopeToFunctions:s})}}catch(e){throw new Error(`CSP Parser Error: ${e.message}`)}}(t),a=s({scope:o,allowGlobal:!0,forceBindingRootScopeToFunctions:!0});if(W&&"function"==typeof a){let t=a.apply(a,r);t instanceof Promise?t.then(t=>e(t)):e(t)}else"object"==typeof a&&a instanceof Promise?a.then(t=>e(t)):e(a)}}(0,t,n);return G.bind(null,e,t,i)}),mt.setReactivityEngine({reactive:jn,effect:function(e,t=Et){(function(e){return e&&!0===e._isEffect})(e)&&(e=e.raw);const n=function(e,t){const n=function(){if(!n.active)return e();if(!Ft.includes(n)){qt(n);try{return Vt.push(Wt),Wt=!0,Ft.push(n),wt=n,e()}finally{Ft.pop(),Kt(),wt=Ft[Ft.length-1]}}};return n.id=Gt++,n.allowRecurse=!!t.allowRecurse,n._isEffect=!0,n.active=!0,n.raw=e,n.deps=[],n.options=t,n}(e,t);return t.lazy||n(),n},release:function(e){e.active&&(qt(e),e.options.onStop&&e.options.onStop(),e.active=!1)},raw:Ln});var ni=mt;function ii(){document.addEventListener("DOMContentLoaded",()=>{ni.start()},{once:!0})}const ri=e=>{ni.nextTick(()=>{ni.destroyTree(e),ni.initTree(e)})};(window.elementorV2=window.elementorV2||{}).alpinejs=t}(),window.elementorV2.alpinejs?.init?.();