1 2 3/* ==== INCLUDE: /js/blocks.js ==== */ 4 5LazyLoad=function(a){function h(b,c){var e,d=a.createElement(b);for(e in c)c.hasOwnProperty(e)&&d.setAttribute(e,c[e]);return d}function i(a){var c,g,b=d[a];b&&(c=b.callback,g=b.urls,g.shift(),e=0,g.length||(c&&c.call(b.context,b.obj),d[a]=null,f[a].length&&k(a)))}function j(){var c=navigator.userAgent;b={async:a.createElement("script").async===!0},(b.webkit=/AppleWebKit\//.test(c))||(b.ie=/MSIE|Trident/.test(c))||(b.opera=/Opera/.test(c))||(b.gecko=/Gecko\//.test(c))||(b.unknown=!0)}function k(e,g,k,n,o){var s,t,u,v,w,x,p=function(){i(e)},q="css"===e,r=[];if(b||j(),g)if(g="string"==typeof g?[g]:g.concat(),q||b.async||b.gecko||b.opera)f[e].push({urls:g,callback:k,obj:n,context:o});else for(s=0,t=g.length;s<t;++s)f[e].push({urls:[g[s]],callback:s===t-1?k:null,obj:n,context:o});if(!d[e]&&(v=d[e]=f[e].shift())){for(c||(c=a.head||a.getElementsByTagName("head")[0]),w=v.urls.concat(),s=0,t=w.length;s<t;++s)x=w[s],q?u=b.gecko?h("style"):h("link",{href:x,rel:"stylesheet"}):(u=h("script",{src:x}),u.async=!1),u.className="lazyload",u.setAttribute("charset","utf-8"),b.ie&&!q&&"onreadystatechange"in u&&!("draggable"in u)?u.onreadystatechange=function(){/loaded|complete/.test(u.readyState)&&(u.onreadystatechange=null,p())}:q&&(b.gecko||b.webkit)?b.webkit?(v.urls[s]=u.href,m()):(u.innerHTML='@import "'+x+'";',l(u)):u.onload=u.onerror=p,r.push(u);for(s=0,t=r.length;s<t;++s)c.appendChild(r[s])}}function l(a){var b;try{b=!!a.sheet.cssRules}catch(c){return e+=1,void(e<200?setTimeout(function(){l(a)},50):b&&i("css"))}i("css")}function m(){var b,a=d.css;if(a){for(b=g.length;--b>=0;)if(g[b].href===a.urls[0]){i("css");break}e+=1,a&&(e<200?setTimeout(m,50):i("css"))}}var b,c,d={},e=0,f={css:[],js:[]},g=a.styleSheets;return{css:function(a,b,c,d){k("css",a,b,c,d)},js:function(a,b,c,d){k("js",a,b,c,d)}}}(this.document); 6 7window.nanoid=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t));for(;t--;){let n=63&r[t];e+=n<36?n.toString(36):n<62?(n-26).toString(36).toUpperCase():n<63?"_":"-"}return e}; 8 9!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).TypeIt=t()}(this,(function(){"use strict";function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(t)}var t={strings:[],speed:100,cursor:!0,cursorChar:"|",cursorSpeed:1e3,deleteSpeed:null,lifeLike:!0,breakLines:!0,startDelay:250,startDelete:!1,nextStringDelay:750,loop:!1,loopDelay:750,html:!0,waitUntilVisible:!1,beforeString:function(){},afterString:function(){},beforeStep:function(){},afterStep:function(){},afterComplete:function(){}},e=function(n){return n.map((function(n){return void 0===n[1]&&n.push(null),void 0===n[2]&&n.push({}),n}))},r=function(n,t){return Object.assign({},n,t)},i=function(n){return Array.isArray(n)},o=function(n,t){return n[2]=r(n[2],t)||t,n},u=function(n,t){return i(n[0])?n.map((function(n){return o(n,t)})):o(n,t)},c=function(n,t,e,r){r=r||!1,e=e||{};var o=!i(n),c=n.length;return(n=o?new Array(n).fill(0):n).map((function(n,i){if(o)return t;var a=[t,n,e];return r&&(0===i&&(a=u(a,{isFirst:!0})),i+1===c&&(a=u(a,{isLast:!0}))),a}))};function a(n){this.insert=function(n,e){t.splice(n,0,e)},this.add=function(n,u,a){return n=i(n)?n:[n,null],a=a||!1,u=u||1,i(n[0])||(n=c(u,n)),n=e(n).map((function(n){return n[2]=r(n[2],{id:o}),o++,n})),t=a?n.concat(t):t.concat(n),this},this.set=function(n,e){t[n]=e},this.reset=function(){t=t.map((function(n){return n[2].executed=!1,n}))},this.getItems=function(){return(t=e(t)).filter((function(n){return!n[2].executed}))},this.setMeta=function(n,e){var i=t.findIndex((function(t){return t[2].id===n}));t[i][2]=r(t[i][2],e)};var t=[],o=0;this.add(n)}var f=function(n){return Array.from(n)},s=function(n){var t=[];return t.concat.apply(t,n)},l=function(n){var t=document.implementation.createHTMLDocument("");return t.body.innerHTML=n,t.body},d=function n(t,e,r){e=e||null,r=void 0!==r&&r;var i=f(t.childNodes).map((function(t){return 3===(e=t).nodeType||"BR"===e.tagName?t:n(t);var e}));return i=s(i),e&&(i=i.filter((function(n){return!e.contains(n)}))),r?i.reverse():i},p=function(n){return"BODY"===n.tagName},h=function(n,t){t=t||null;var e=n instanceof HTMLElement;return{node:t,isTopLevelText:(!t||p(t.parentNode))&&!e,isHTMLElement:e,content:n}};function v(n){var t,e=l(n);return t=d(e).map((function(n){return n.nodeValue?f(n.nodeValue).map((function(t){return h(t,n)})):h(n)})),s(t)}function y(n,t){return(t=void 0===t||t)?v(n):f(n).map((function(n){return h(n)}))}var m=function(n){return document.createElement(n)},g=function(n,t){var e=m("style");e.id=t||"",e.appendChild(document.createTextNode(n)),document.head.appendChild(e)},b=function(n){return i(n)||(n=[n/2,n/2]),{before:n[0],after:n[1],total:n[0]+n[1]}},S=function(n,t){return Math.abs(Math.random()*(n+t-(n-t))+(n-t))};var N=function(n){return["textarea","input"].indexOf(n.tagName.toLowerCase())>-1},T=function(n,t){var e=t.querySelectorAll("*");return[t].concat(f(e).reverse()).find((function(t){return t.cloneNode().outerHTML===n.outerHTML}))},L=function(n,t,e,r){e=e||null;var i=t.isHTMLElement,o=i?t.content:document.createTextNode(t.content);if(N(n))n.value="".concat(n.value).concat(t.content);else{if(!t.isTopLevelText&&!i){var u=t.node.parentNode,c=T(u.cloneNode(),n);if(function(n,t){if(!n)return!1;var e=n.nextSibling;return!e||e.isEqualNode(t)}(c,e))n=c;else if((o=u.cloneNode()).innerText=t.content,!p(u.parentNode)){for(var a=u.parentNode,f=a.cloneNode(),s=T(f,n);!s&&!p(a);)f.innerHTML=o.outerHTML,o=f,f=a.parentNode.cloneNode(),a=a.parentNode,s=T(f,n);n=s||n}}var l=d(n,e,!0)[r-1],h=l?l.parentNode:n;h.insertBefore(o,h.contains(e)?e:null)}},M=function(n){var t;return null==n||null===(t=n.parentNode)||void 0===t?void 0:t.removeChild(n)};var x=function(n,t,e){var r,i="string"==typeof n,o=!1,u=-1*n;return i&&(u=(r="END"===n.toUpperCase())?-1:1,o=r?t+u>0:t+u<e.length),{isString:i,numberOfSteps:u,canKeepMoving:o}},w=function(n){var t,e=["font","lineHeight","color"],r=m("SPAN"),i=(t=n,window.getComputedStyle(t,null));for(var o in i)e.indexOf(o)>-1&&i[o]&&(r.style[o]=i[o]);return r.style.cssText};
9function D(n,t,e){return e?t?t(n):n:(n&&n.then||(n=Promise.resolve(n)),t?n.then(t):n)}function H(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return Promise.resolve(n.apply(this,t))}catch(n){return Promise.reject(n)}}}function E(){}function C(n,t){if(!t)return n&&n.then?n.then(E):Promise.resolve()}function A(n,t){var e=n();return e&&e.then?e.then(t):t(e)}function k(n,t,e){if(!n.s){if(e instanceof O){if(!e.s)return void(e.o=k.bind(null,n,t));1&t&&(t=e.s),e=e.v}if(e&&e.then)return void e.then(k.bind(null,n,t),k.bind(null,n,2));n.s=t,n.v=e;var r=n.o;r&&r(n)}}var O=function(){function n(){}return n.prototype.then=function(t,e){var r=new n,i=this.s;if(i){var o=1&i?t:e;if(o){try{k(r,1,o(this.v))}catch(n){k(r,2,n)}return r}return this}return this.o=function(n){try{var i=n.v;1&n.s?k(r,1,t?t(i):i):e?k(r,1,e(i)):k(r,2,i)}catch(n){k(r,2,n)}},r},n}();function P(n,t){return n&&n.then?n.then(t):t(n)}return function(e,o){var u=this,s=this;o=o||{};var p=function(n,t,e){return n=i(n[0])?n:[n],an.add(n,t),function(n){var t=(n=n||{}).delay;t&&an.add([U,t])}(e),s},T=function(t){return t="object"===n(t)?t:{},[[Q,t,{force:!0}],[Q,en,{force:!0}]]},z=function(){return X?f(W.value):d(W,fn,!0)},B=function(n,t){t=t||1;var e=en.nextStringDelay;an.insert(n,[U,e.before]),an.insert(n+t+1,[U,e.after])},I=H((function(){if(fn){var n="[data-typeit-id='".concat(cn,"'] .ti-cursor");g("@keyframes blink-".concat(cn," { 0% {opacity: 0} 49% {opacity: 0} 50% {opacity: 1} } ").concat(n," { animation: blink-").concat(cn," ").concat(en.cursorSpeed/1e3,"s infinite; } ").concat(n,".with-delay { animation-delay: 500ms; } ").concat(n,".disabled { animation: none; }"),cn),W.appendChild(fn);var t="loaded"===document.fonts.status;return D(t||document.fonts.ready,(function(n){var t=fn.getBoundingClientRect().width/2;fn.style.margin="0 -".concat(t+2,"px 0 -").concat(t-2,"px")}),t)}})),R=function(n){fn&&(fn.classList.toggle("disabled",n),fn.classList.toggle("with-delay",!n))},q=H((function(n,t){return $.push(setTimeout(n,t)),D()})),j=H((function(n){var t=_;return D(t&&F(_),(function(t){return an.reset(),an.set(0,[U,n.before]),C(G(!0))}),!t)})),V=H((function(){tn.started=!0;var n,t=an.getItems();return P(function(n,t){try{var e=n()}catch(n){return t(n)}return e&&e.then?e.then(void 0,t):e}((function(){return P(function(n,t,e){var r,i,o=-1;return function u(c){try{for(;++o<n.length&&(!e||!e());)if((c=t(o))&&c.then){if(!((a=c)instanceof O&&1&a.s))return void c.then(u,i||(i=k.bind(null,r=new O,2)));c=c.v}r?k(r,1,c):r=c}catch(n){k(r||(r=new O),2,n)}var a}(),r}(t,(function(e){if(tn.frozen||tn.destroyed)throw"";var r,i,o,c,a=t[e],f=a[2];return n=[a,u],f.freezeCursor&&R(!0),r=en.speed,i=en.deleteSpeed,o=en.lifeLike,c=(i=null!==i?i:r/3)/2,Z=o?[S(r,r/2),S(i,c)]:[r,i],A((function(){var t;if(null==f?void 0:f.isFirst)return C((t=en).beforeString.apply(t,n))}),(function(){var t;return D((t=en).beforeStep.apply(t,n),(function(){return D(a[0].call(u,a[1],f),(function(){return A((function(){var t,e;if(null===(t=a[2])||void 0===t?void 0:t.isLast)return C((e=en).afterString.apply(e,n))}),(function(){var t;return D((t=en).afterStep.apply(t,n),(function(){an.setMeta(f.id,{executed:!0}),R(!1)}))}))}))}))}))}),(function(){return!1})),(function(t){var e;return tn.completed=!0,D((e=en).afterComplete.apply(e,n),(function(){if(!en.loop)throw"";var n=en.loopDelay;q((function(){return D(j(n),(function(){V()}))}),n.after)}))}))}),E),(function(n){return u}))})),U=function(n){return new Promise((function(t){q((function(){return t()}),n||0)}))},F=function n(t){var e=z(),r=x(t,_,e);return _+=r.numberOfSteps,new Promise((function(t){q(H((function(){return function(n,t,e,r){if(e){var i=r,o=t[(i=i>t.length?t.length:i)-1];(n=o?o.parentNode:n).insertBefore(e,o||null)}}(W,z(),fn,_),A((function(){if(r.isString&&r.canKeepMoving)return C(n(r.numberOfSteps>0?"START":"END"))}),(function(){return t()}))})),Z[0])}))},K=function(n){return new Promise((function(t){q((function(){return L(W,n,fn,_),t()}),Z[0])}))},Q=H((function(n){en=r(en,n)})),Y=H((function(){X?W.value="":z().forEach((function(n){M(n)}))})),G=function n(t){return t=!0===t,new Promise((function(e){q(H((function(){var r=!1,i=z();return i.length&&(X?W.value=W.value.slice(0,-1):M(i[_])),f(W.querySelectorAll("*")).forEac
9h((function(n){if(!n.innerHTML&&"BR"!==n.tagName){for(var t=n;1===t.parentNode.childNodes.length&&t.parentNode.childNodes[0].isEqualNode(t);)t=t.parentNode;M(t)}})),A((function(){if(t&&i.length-1>0)return D(n(!0),(function(){return r=!0,e()}))}),(function(n){return r?n:e()}))})),Z[1])}))};this.break=function(n){return p([K,h(m("BR"))],1,n)},this.delete=function(n,t){var e=T(t);return p([e[0]].concat([].concat(Array(Math.abs(n)||1)).fill().map((function(){return[G,!n,nn]})),[e[1]]),1,t)},this.empty=function(){return p(Y,1,arguments)},this.exec=function(n,t){var e=T(t);return p([e[0],[n,null],e[1]],1,t)},this.move=function(n,t){var e=x(n,_,z()),r=T(t),i=e.isString?n:Math.sign(n);return p([r[0]].concat([].concat(Array(Math.abs(n)||1)).fill().map((function(){return[F,i,nn]})),[r[1]]),1,t)},this.options=function(n){return p([Q,n],1,n)},this.pause=function(n,t){return p([U,n],1,t)},this.type=function(n,t){var e=T(t),r=y(n,en.html),i=[e[0]].concat(c(r,K,nn,!0),[e[1]]);return p(i,1,t)},this.is=function(n){return tn[n]},this.destroy=function(n){n=void 0===n||n,$.forEach((function(n){clearTimeout(n)})),$=[],n&&M(fn),tn.destroyed=!0},this.freeze=function(){tn.frozen=!0},this.unfreeze=function(){tn.frozen=!1,V()},this.reset=function(){for(var n in!this.is("destroyed")&&this.destroy(),an.reset(),_=0,tn)tn[n]=!1;return X?W.value="":W.innerHTML="",this},this.go=function(){return tn.started?this:(I(),en.waitUntilVisible?(function(n,t){new IntersectionObserver((function(e,r){e.forEach((function(e){e.isIntersecting&&(t(),r.unobserve(n))}))}),{threshold:1}).observe(n)}(W,V.bind(this)),this):(V(),this))},this.getQueue=function(){return an},this.getOptions=function(){return en},this.getElement=function(){return W};var J,W="string"==typeof(J=e)?document.querySelector(J):J,X=N(W),Z=[],$=[],_=0,nn={freezeCursor:!0},tn={started:!1,completed:!1,frozen:!1,destroyed:!1},en=r(t,o);en=r(en,{html:!X&&en.html,nextStringDelay:b(en.nextStringDelay),loopDelay:b(en.loopDelay)});var rn,on,un,cn=Math.random().toString().substring(2,9),an=new a([U,en.startDelay]);W.setAttribute("data-typeit-id",cn),g("[data-typeit-id]:before {content: '.'; display: inline-block; width: 0; visibility: hidden;}[data-typeit-id]"),en.strings=(un=en.strings,rn=i(un)?un:[un],(on=function(n){return n.innerHTML.replace(/<\!--.*?-->/g,"").trim()}(W))?(W.innerHTML="",en.startDelete?(v(on).forEach((function(n){L(W,n,fn,_)})),an.add([G,!0]),B(1),rn):[on.trim()].concat(rn)):rn);var fn=function(){if(X||!en.cursor)return null;var n=m("span");return n.innerHTML=l(en.cursorChar).innerHTML,n.className="ti-cursor",n.style.cssText="display:inline;".concat(w(W)),n}();en.strings.length&&function(){var n=en.strings.filter((function(n){return!!n}));n.forEach((function(t,e){var r=y(t,en.html);an.add(c(r,K,nn,!0));var i=an.getItems().length;if(e+1!==n.length){if(en.breakLines){var o=h(m("BR"));return an.add([K,o,nn]),void B(i)}an.add(c(r,G,nn)),B(i,t.length)}}))}()}})); 10 11!function(){"use strict";function o(){var o=window,t=document;if(!("scrollBehavior"in t.documentElement.style&&!0!==o.__forceSmoothScrollPolyfill__)){var l,e=o.HTMLElement||o.Element,r=468,i={scroll:o.scroll||o.scrollTo,scrollBy:o.scrollBy,elementScroll:e.prototype.scroll||n,scrollIntoView:e.prototype.scrollIntoView},s=o.performance&&o.performance.now?o.performance.now.bind(o.performance):Date.now,c=(l=o.navigator.userAgent,new RegExp(["MSIE ","Trident/","Edge/"].join("|")).test(l)?1:0);o.scroll=o.scrollTo=function(){void 0!==arguments[0]&&(!0!==f(arguments[0])?h.call(o,t.body,void 0!==arguments[0].left?~~arguments[0].left:o.scrollX||o.pageXOffset,void 0!==arguments[0].top?~~arguments[0].top:o.scrollY||o.pageYOffset):i.scroll.call(o,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:o.scrollX||o.pageXOffset,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:o.scrollY||o.pageYOffset))},o.scrollBy=function(){void 0!==arguments[0]&&(f(arguments[0])?i.scrollBy.call(o,void 0!==arguments[0].left?arguments[0].left:"object"!=typeof arguments[0]?arguments[0]:0,void 0!==arguments[0].top?arguments[0].top:void 0!==arguments[1]?arguments[1]:0):h.call(o,t.body,~~arguments[0].left+(o.scrollX||o.pageXOffset),~~arguments[0].top+(o.scrollY||o.pageYOffset)))},e.prototype.scroll=e.prototype.scrollTo=function(){if(void 0!==arguments[0])if(!0!==f(arguments[0])){var o=arguments[0].left,t=arguments[0].top;h.call(this,this,void 0===o?this.scrollLeft:~~o,void 0===t?this.scrollTop:~~t)}else{if("number"==typeof arguments[0]&&void 0===arguments[1])throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left:"object"!=typeof arguments[0]?~~arguments[0]:this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top:void 0!==arguments[1]?~~arguments[1]:this.scrollTop)}},e.prototype.scrollBy=function(){void 0!==arguments[0]&&(!0!==f(arguments[0])?this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior}):i.elementScroll.call(this,void 0!==arguments[0].left?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,void 0!==arguments[0].top?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop))},e.prototype.scrollIntoView=function(){if(!0!==f(arguments[0])){var l=function(o){for(;o!==t.body&&!1===(e=p(l=o,"Y")&&a(l,"Y"),r=p(l,"X")&&a(l,"X"),e||r);)o=o.parentNode||o.host;var l,e,r;return o}(this),e=l.getBoundingClientRect(),r=this.getBoundingClientRect();l!==t.body?(h.call(this,l,l.scrollLeft+r.left-e.left,l.scrollTop+r.top-e.top),"fixed"!==o.getComputedStyle(l).position&&o.scrollBy({left:e.left,top:e.top,behavior:"smooth"})):o.scrollBy({left:r.left,top:r.top,behavior:"smooth"})}else i.scrollIntoView.call(this,void 0===arguments[0]||arguments[0])}}function n(o,t){this.scrollLeft=o,this.scrollTop=t}function f(o){if(null===o||"object"!=typeof o||void 0===o.behavior||"auto"===o.behavior||"instant"===o.behavior)return!0;
11if("object"==typeof o&&"smooth"===o.behavior)return!1;throw new TypeError("behavior member of ScrollOptions "+o.behavior+" is not a valid value for enumeration ScrollBehavior.")}function p(o,t){return"Y"===t?o.clientHeight+c<o.scrollHeight:"X"===t?o.clientWidth+c<o.scrollWidth:void 0}function a(t,l){var e=o.getComputedStyle(t,null)["overflow"+l];return"auto"===e||"scroll"===e}function d(t){var l,e,i,c,n=(s()-t.startTime)/r;c=n=n>1?1:n,l=.5*(1-Math.cos(Math.PI*c)),e=t.startX+(t.x-t.startX)*l,i=t.startY+(t.y-t.startY)*l,t.method.call(t.scrollable,e,i),e===t.x&&i===t.y||o.requestAnimationFrame(d.bind(o,t))}function h(l,e,r){var c,f,p,a,h=s();l===t.body?(c=o,f=o.scrollX||o.pageXOffset,p=o.scrollY||o.pageYOffset,a=i.scroll):(c=l,f=l.scrollLeft,p=l.scrollTop,a=n),d({scrollable:c,method:a,startTime:h,startX:f,startY:p,x:e,y:r})}}"object"==typeof exports&&"undefined"!=typeof module?module.exports={polyfill:o}:o()}(); 12/** 13 * @popperjs/core v2.4.4 - MIT License 14 */ 15 16"use strict";!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).Popper={})}(this,(function(e){function t(e){return{width:(e=e.getBoundingClientRect()).width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left,x:e.left,y:e.top}}function n(e){return"[object Window]"!==e.toString()?(e=e.ownerDocument)?e.defaultView:window:e}function r(e){return{scrollLeft:(e=n(e)).pageXOffset,scrollTop:e.pageYOffset}}function o(e){return e instanceof n(e).Element||e instanceof Element}function i(e){return e instanceof n(e).HTMLElement||e instanceof HTMLElement}function a(e){return e?(e.nodeName||"").toLowerCase():null}function s(e){return(o(e)?e.ownerDocument:e.document).documentElement}function f(e){return t(s(e)).left+r(e).scrollLeft}function c(e){return n(e).getComputedStyle(e)}function p(e){return e=c(e),/auto|scroll|overlay|hidden/.test(e.overflow+e.overflowY+e.overflowX)}function l(e,o,c){void 0===c&&(c=!1);var l=s(o);e=t(e);var u=i(o),d={scrollLeft:0,scrollTop:0},m={x:0,y:0};return(u||!u&&!c)&&(("body"!==a(o)||p(l))&&(d=o!==n(o)&&i(o)?{scrollLeft:o.scrollLeft,scrollTop:o.scrollTop}:r(o)),i(o)?((m=t(o)).x+=o.clientLeft,m.y+=o.clientTop):l&&(m.x=f(l))),{x:e.left+d.scrollLeft-m.x,y:e.top+d.scrollTop-m.y,width:e.width,height:e.height}}function u(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function d(e){return"html"===a(e)?e:e.assignedSlot||e.parentNode||e.host||s(e)}function m(e,t){void 0===t&&(t=[]);var r=function e(t){return 0<=["html","body","#document"].indexOf(a(t))?t.ownerDocument.body:i(t)&&p(t)?t:e(d(t))}(e);e="body"===a(r);var o=n(r);return r=e?[o].concat(o.visualViewport||[],p(r)?r:[]):r,t=t.concat(r),e?t:t.concat(m(d(r)))}function h(e){if(!i(e)||"fixed"===c(e).position)return null;if(e=e.offsetParent){var t=s(e);if("body"===a(e)&&"static"===c(e).position&&"static"!==c(t).position)return t}return e}function g(e){for(var t=n(e),r=h(e);r&&0<=["table","td","th"].indexOf(a(r))&&"static"===c(r).position;)r=h(r);if(r&&"body"===a(r)&&"static"===c(r).position)return t;if(!r)e:{for(e=d(e);i(e)&&0>["html","body"].indexOf(a(e));){if("none"!==(r=c(e)).transform||"none"!==r.perspective||r.willChange&&"auto"!==r.willChange){r=e;break e}e=e.parentNode}r=null}return r||t}function b(e){var t=new Map,n=new Set,r=[];return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||function e(o){n.add(o.name),[].concat(o.requires||[],o.requiresIfExists||[]).forEach((function(r){n.has(r)||(r=t.get(r))&&e(r)})),r.push(o)}(e)})),r}function v(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=void 0,n(e())}))}))),t}}function y(e){return e.split("-")[0]}function O(e,t){var n=!(!t.getRootNode||!t.getRootNode().host);if(e.contains(t))return!0;if(n)do{if(t&&e.isSameNode(t))return!0;t=t.parentNode||t.host}while(t);return!1}function x(e){return Object.assign(Object.assign({},e),{},{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function w(e,o){if("viewport"===o){o=n(e);var a=s(e);
16o=o.visualViewport;var p=a.clientWidth;a=a.clientHeight;var l=0,u=0;o&&(p=o.width,a=o.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(l=o.offsetLeft,u=o.offsetTop)),e=x(e={width:p,height:a,x:l+f(e),y:u})}else i(o)?((e=t(o)).top+=o.clientTop,e.left+=o.clientLeft,e.bottom=e.top+o.clientHeight,e.right=e.left+o.clientWidth,e.width=o.clientWidth,e.height=o.clientHeight,e.x=e.left,e.y=e.top):(u=s(e),e=s(u),l=r(u),o=u.ownerDocument.body,p=Math.max(e.scrollWidth,e.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Math.max(e.scrollHeight,e.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),u=-l.scrollLeft+f(u),l=-l.scrollTop,"rtl"===c(o||e).direction&&(u+=Math.max(e.clientWidth,o?o.clientWidth:0)-p),e=x({width:p,height:a,x:u,y:l}));return e}function j(e,t,n){return t="clippingParents"===t?function(e){var t=m(d(e)),n=0<=["absolute","fixed"].indexOf(c(e).position)&&i(e)?g(e):e;return o(n)?t.filter((function(e){return o(e)&&O(e,n)&&"body"!==a(e)})):[]}(e):[].concat(t),(n=(n=[].concat(t,[n])).reduce((function(t,n){return n=w(e,n),t.top=Math.max(n.top,t.top),t.right=Math.min(n.right,t.right),t.bottom=Math.min(n.bottom,t.bottom),t.left=Math.max(n.left,t.left),t}),w(e,n[0]))).width=n.right-n.left,n.height=n.bottom-n.top,n.x=n.left,n.y=n.top,n}function M(e){return 0<=["top","bottom"].indexOf(e)?"x":"y"}function E(e){var t=e.reference,n=e.element,r=(e=e.placement)?y(e):null;e=e?e.split("-")[1]:null;var o=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2;switch(r){case"top":o={x:o,y:t.y-n.height};break;case"bottom":o={x:o,y:t.y+t.height};break;case"right":o={x:t.x+t.width,y:i};break;case"left":o={x:t.x-n.width,y:i};break;default:o={x:t.x,y:t.y}}if(null!=(r=r?M(r):null))switch(i="y"===r?"height":"width",e){case"start":o[r]=Math.floor(o[r])-Math.floor(t[i]/2-n[i]/2);break;case"end":o[r]=Math.floor(o[r])+Math.ceil(t[i]/2-n[i]/2)}return o}function D(e){return Object.assign(Object.assign({},{top:0,right:0,bottom:0,left:0}),e)}function P(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function k(e,n){void 0===n&&(n={});var r=n;n=void 0===(n=r.placement)?e.placement:n;var i=r.boundary,a=void 0===i?"clippingParents":i,f=void 0===(i=r.rootBoundary)?"viewport":i;i=void 0===(i=r.elementContext)?"popper":i;var c=r.altBoundary,p=void 0!==c&&c;r=D("number"!=typeof(r=void 0===(r=r.padding)?0:r)?r:P(r,q));var l=e.elements.reference;c=e.rects.popper,a=j(o(p=e.elements[p?"popper"===i?"reference":"popper":i])?p:p.contextElement||s(e.elements.popper),a,f),p=E({reference:f=t(l),element:c,strategy:"absolute",placement:n}),c=x(Object.assign(Object.assign({},c),p)),f="popper"===i?c:f;
16var u={top:a.top-f.top+r.top,bottom:f.bottom-a.bottom+r.bottom,left:a.left-f.left+r.left,right:f.right-a.right+r.right};if(e=e.modifiersData.offset,"popper"===i&&e){var d=e[n];Object.keys(u).forEach((function(e){var t=0<=["right","bottom"].indexOf(e)?1:-1,n=0<=["top","bottom"].indexOf(e)?"y":"x";u[e]+=d[n]*t}))}return u}function L(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function B(e){void 0===e&&(e={});var t=e.defaultModifiers,n=void 0===t?[]:t,r=void 0===(e=e.defaultOptions)?V:e;return function(e,t,i){function a(){f.forEach((function(e){return e()})),f=[]}void 0===i&&(i=r);var s={placement:"bottom",orderedModifiers:[],options:Object.assign(Object.assign({},V),r),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},f=[],c=!1,p={state:s,setOptions:function(i){return a(),s.options=Object.assign(Object.assign(Object.assign({},r),s.options),i),s.scrollParents={reference:o(e)?m(e):e.contextElement?m(e.contextElement):[],popper:m(t)},i=function(e){var t=b(e);return N.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}(function(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign(Object.assign(Object.assign({},n),t),{},{options:Object.assign(Object.assign({},n.options),t.options),data:Object.assign(Object.assign({},n.data),t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}([].concat(n,s.options.modifiers))),s.orderedModifiers=i.filter((function(e){return e.enabled})),s.orderedModifiers.forEach((function(e){var t=e.name,n=e.options;n=void 0===n?{}:n,"function"==typeof(e=e.effect)&&(t=e({state:s,name:t,instance:p,options:n}),f.push(t||function(){}))})),p.update()},forceUpdate:function(){if(!c){var e=s.elements,t=e.reference;if(L(t,e=e.popper))for(s.rects={reference:l(t,g(e),"fixed"===s.options.strategy),popper:u(e)},s.reset=!1,s.placement=s.options.placement,s.orderedModifiers.forEach((function(e){return s.modifiersData[e.name]=Object.assign({},e.data)})),t=0;t<s.orderedModifiers.length;t++)if(!0===s.reset)s.reset=!1,t=-1;else{var n=s.orderedModifiers[t];e=n.fn;var r=n.options;r=void 0===r?{}:r,n=n.name,"function"==typeof e&&(s=e({state:s,options:r,name:n,instance:p})||s)}}},update:v((function(){return new Promise((function(e){p.forceUpdate(),e(s)}))})),destroy:function(){a(),c=!0}};return L(e,t)?(p.setOptions(i).then((function(e){!c&&i.onFirstUpdate&&i.onFirstUpdate(e)})),p):p}}function W(e){var t,r=e.popper,o=e.popperRect,i=e.placement,a=e.offsets,f=e.position,c=e.gpuAcceleration,p=e.adaptive,l=window.devicePixelRatio||1;e=Math.round(a.x*l)/l||0,l=Math.round(a.y*l)/l||0;var u=a.hasOwnProperty("x");a=a.hasOwnProperty("y");var d,m="left",h="top",b=window;if(p){var v=g(r);v===n(r)&&(v=s(r)),"top"===i&&(h="bottom",l-=v.clientHeight-o.height,l*=c?1:-1),"left"===i&&(m="right",e-=v.clientWidth-o.width,e*=c?1:-1)}return r=Object.assign({position:f},p&&_),c?Object.assign(Object.assign({},r),{},((d={})[h]=a?"0":"",d[m]=u?"0":"",d.transform=2>(b.devicePixelRatio||1)?"translate("+e+"px, "+l+"px)":"translate3d("+e+"px, "+l+"px, 0)",d)):Object.assign(Object.assign({},r),{},((t={})[h]=a?l+"px":"",t[m]=u?e+"px":"",t.transform="",t))}function A(e){return e.replace(/left|right|bottom|top/g,(function(e){return U[e]}))}function H(e){return e.replace(/start|end/g,(function(e){return z[e]}))}function T(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function R(e){return["top","right","bottom","left"].some((function(t){return 0<=e[t]}))}var q=["top","bottom","right","left"],C=q.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),S=[].concat(q,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),N="beforeRead read afterRead beforeMain main afterMain beforeWrite write afterWrite".split(" "),V={placement:"bottom",modifiers:[],strategy:"absolute"},I={passive:!0},_={top:"auto",right:"auto",bottom:"auto",left:"auto"}
16,U={left:"right",right:"left",bottom:"top",top:"bottom"},z={start:"end",end:"start"},F=[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,r=e.instance,o=(e=e.options).scroll,i=void 0===o||o,a=void 0===(e=e.resize)||e,s=n(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",r.update,I)})),a&&s.addEventListener("resize",r.update,I),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",r.update,I)})),a&&s.removeEventListener("resize",r.update,I)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state;t.modifiersData[e.name]=E({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options;e=void 0===(e=n.gpuAcceleration)||e,n=void 0===(n=n.adaptive)||n,e={placement:y(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:e},null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign(Object.assign({},t.styles.popper),W(Object.assign(Object.assign({},e),{},{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:n})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign(Object.assign({},t.styles.arrow),W(Object.assign(Object.assign({},e),{},{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];i(o)&&a(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{};e=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{}),i(r)&&a(r)&&(Object.assign(r.style,e),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.name,r=void 0===(e=e.options.offset)?[0,0]:e,o=(e=S.reduce((function(e,n){var o=t.rects,i=y(n),a=0<=["left","top"].indexOf(i)?-1:1,s="function"==typeof r?r(Object.assign(Object.assign({},o),{},{placement:n})):r;return o=(o=s[0])||0,s=((s=s[1])||0)*a,i=0<=["left","right"].indexOf(i)?{x:s,y:o}:{x:o,y:s},e[n]=i,e}),{}))[t.placement],i=o.x;o=o.y,null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=i,t.modifiersData.popperOffsets.y+=o),t.modifiersData[n]=e}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;if(e=e.name,!t.modifiersData[e]._skip){var r=n.mainAxis;r=void 0===r||r;var o=n.altAxis;o=void 0===o||o;var i=n.fallbackPlacements,a=n.padding,s=n.boundary,f=n.rootBoundary,c=n.altBoundary,p=n.flipVariations,l=void 0===p||p,u=n.allowedAutoPlacements;p=y(n=t.options.placement),i=i||(p!==n&&l?function(e){if("auto"===y(e))return[];var t=A(e);return[H(e),t,H(t)]}(n):[A(n)]);var d=[n].concat(i).reduce((function(e,n){return e.concat("auto"===y(n)?function(e,t){void 0===t&&(t={});var n=t.boundary,r=t.rootBoundary,o=t.padding,i=t.flipVariations,a=t.allowedAutoPlacements,s=void 0===a?S:a,f=t.placement.split("-")[1];0===(i=(t=f?i?C:C.filter((function(e){return e.split("-")[1]===f})):q).filter((function(e){return 0<=s.indexOf(e)}))).length&&(i=t);var c=i.reduce((function(t,i){return t[i]=k(e,{placement:i,boundary:n,rootBoundary:r,padding:o})[y(i)],t}),{});return Object.keys(c).sort((function(e,t){return c[e]-c[t]}))}(t,{placement:n,boundary:s,rootBoundary:f,padding:a,flipVariations:l,allowedAutoPlacements:u}):n)}),[]);n=t.rects.reference,i=t.rects.popper;var m=new Map;p=!0;for(var h=d[0],g=0;g<d.length;g++){var b=d[g],v=y(b),O="start"===b.split("-")[1],x=0<=["top","bottom"].indexOf(v),w=x?"width":"height",j=k(t,{placement:b,boundary:s,rootBoundary:f,altBoundary:c,padding:a});if(O=x?O?"right":"left":O?"bottom":"top",n[w]>i[w]&&(O=A(O)),w=A(O),x=[],r&&x.push(0>=j[v]),o&&x.push(0>=j[O],0>=j[w]),x.every((function(e){return e}))){h=b,p=!1;break}m.set(b,x)}if(p)for(r=function(e){var t=d.find((function(t){if(t=m.get(t))return t.slice(0,e).every((function(e){return e}))}));if(t)return h=t,"break"},o=l?3:1;0<o&&"break"!==r(o);o--);t.placement!==h&&(t.modifiersData[e]._skip=!0,t.placement=h,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options;e=e.name;var r=n.mainAxis,o=void 0===r||r;r=void 0!==(r=n.altAxis)&&r;var i=n.tether;i=void 0===i||i;var a=n.tetherOffset,s=void 0===a?0:a;n=k(t,{boundary:n.boundary,rootBoundary:n.rootBoundary,padding:n.padding,altBoundary:n.altBoundary}),a=y(t.placement);var f=t.placement.split("-")[1],c=!f,p=M(a);a="x"===p?"y":"x";var l=t.modifiersData.popperOffsets,d=t.rects.reference,m=t.rects.popper,h="function"==typeof s?s(Object.assign(Object.assign({},t.rects),{},{placement:t.placement})):s;if(s={x:0,y:0}
16,l){if(o){var b="y"===p?"top":"left",v="y"===p?"bottom":"right",O="y"===p?"height":"width";o=l[p];var x=l[p]+n[b],w=l[p]-n[v],j=i?-m[O]/2:0,E="start"===f?d[O]:m[O];f="start"===f?-m[O]:-d[O],m=t.elements.arrow,m=i&&m?u(m):{width:0,height:0};var D=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0};b=D[b],v=D[v],m=Math.max(0,Math.min(d[O],m[O])),E=c?d[O]/2-j-m-b-h:E-m-b-h,c=c?-d[O]/2+j+m+v+h:f+m+v+h,h=t.elements.arrow&&g(t.elements.arrow),d=t.modifiersData.offset?t.modifiersData.offset[t.placement][p]:0,h=l[p]+E-d-(h?"y"===p?h.clientTop||0:h.clientLeft||0:0),c=l[p]+c-d,i=Math.max(i?Math.min(x,h):x,Math.min(o,i?Math.max(w,c):w)),l[p]=i,s[p]=i-o}r&&(r=l[a],i=Math.max(r+n["x"===p?"top":"left"],Math.min(r,r-n["x"===p?"bottom":"right"])),l[a]=i,s[a]=i-r),t.modifiersData[e]=s}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state;e=e.name;var r=n.elements.arrow,o=n.modifiersData.popperOffsets,i=y(n.placement),a=M(i);if(i=0<=["left","right"].indexOf(i)?"height":"width",r&&o){var s=n.modifiersData[e+"#persistent"].padding,f
16=u(r),c="y"===a?"top":"left",p="y"===a?"bottom":"right",l=n.rects.reference[i]+n.rects.reference[a]-o[a]-n.rects.popper[i];o=o[a]-n.rects.reference[a],l=(r=(r=g(r))?"y"===a?r.clientHeight||0:r.clientWidth||0:0)/2-f[i]/2+(l/2-o/2),i=Math.max(s[c],Math.min(l,r-f[i]-s[p])),n.modifiersData[e]=((t={})[a]=i,t.centerOffset=i-l,t)}},effect:function(e){var t=e.state,n=e.options;e=e.name;var r=n.element;if(r=void 0===r?"[data-popper-arrow]":r,n=void 0===(n=n.padding)?0:n,null!=r){if("string"==typeof r&&!(r=t.elements.popper.querySelector(r)))return;O(t.elements.popper,r)&&(t.elements.arrow=r,t.modifiersData[e+"#persistent"]={padding:D("number"!=typeof n?n:P(n,q))})}},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state;e=e.name;var n=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=k(t,{elementContext:"reference"}),a=k(t,{altBoundary:!0});n=T(i,n),r=T(a,r,o),o=R(n),a=R(r),t.modifiersData[e]={referenceClippingOffsets:n,popperEscapeOffsets:r,isReferenceHidden:o,hasPopperEscaped:a},t.attributes.popper=Object.assign(Object.assign({},t.attributes.popper),{},{"data-popper-reference-hidden":o,"data-popper-escaped":a})}}],X=B({defaultModifiers:F});e.createPopper=X,e.defaultModifiers=F,e.detectOverflow=k,e.popperGenerator=B,Object.defineProperty(e,"__esModule",{value:!0})})); 17; 18 19window.mrp_open_new_window = function( url, width, height, name ) { 20 21 function optimalWindowHeight( desired ) 22 { 23 if( desired && desired < screen.availHeight ) { 24 return desired; 25 } 26 27 var h = 500; 28 if( screen.availHeight > 600 ) { 29 h = 700; 30 } 31 if( screen.availHeight > 800 ) { 32 h = 800; 33 } 34 return h; 35 } 36 37 if( !height ) { 38 height = optimalWindowHeight(); 39 } 40 41 var left = parseInt((screen.availWidth/2) - (width/2)); 42 var top = parseInt((screen.availHeight/2) - (height/2)); 43 44 if( !name ) { 45 name = "" + parseInt( ( Math.random() * 100000 ) ); 46 } 47 var w = window.open( url, name, "width=" + width + ",height=" + height + 48 ",scrollbars=1,location=1,left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top ); 49 50 if( w == null ) { 51 alert( "Please enable popups in your browser" ); 52 } 53 else { 54 w.focus(); 55 } 56 57 return w; 58}; 59 60// DOMParser patch for IOS Safari 61(function(DOMParser) { 62 "use strict"; 63 64 var proto = DOMParser.prototype, 65 nativeParse = proto.parseFromString; 66 67 // Firefox/Opera/IE throw errors on unsupported types 68 try { 69 // WebKit returns null on unsupported types 70 if ((new DOMParser()).parseFromString("", "text/html")) { 71 // text/html parsing is natively supported 72 return; 73 } 74 } catch (ex) {} 75 76 proto.parseFromString = function(markup, type) { 77 if (/^\s*text\/html\s*(?:;|$)/i.test(type)) { 78 var doc = document.implementation.createHTMLDocument(""); 79 if (markup.toLowerCase().indexOf('<!doctype') > -1) { 80 doc.documentElement.innerHTML = markup; 81 } else { 82 doc.body.innerHTML = markup; 83 } 84 return doc; 85 } else { 86 return nativeParse.apply(this, arguments); 87 } 88 }; 89}(DOMParser)); 90 91function get_if_exist(obj){ 92 if( !obj ) { 93 return undefined; 94 } 95 return arguments.length==1 || (obj[arguments[1]] && get_if_exist.apply(this,[obj[arguments[1]]].concat([].slice.call(arguments,2)))); 96} 97 98const _G = { 99 reinitHandlers: [], 100 isMobile: () => /iPhone|iPad|iPod|Android/i.test(navigator.userAgent), 101} 102 103;(function() { 104 _G.visibilityService = (function() { 105 106 const options = { 107 threshold: [0,0.1,0.2,0.4,0.6,0.8] 108 } 109 110 const observer = new IntersectionObserver( entries => { 111 (entries || []).forEach( entry => { 112 if( typeof entry.target.__visibility === 'function' ) { 113 114 const isLikelyMobile = window.innerWidth < window.innerHeight 115 const defaultVisibilityRatio = isLikelyMobile ? 0.01 : 0.2; 116 117 const ratio = getComputedStyle(entry.target) 118 .getPropertyValue('--visibility-ratio') || defaultVisibilityRatio; 119 120 if( entry.intersectionRatio >= ratio /* && !document.querySelector('html').classList.contains('editing') */ ) { 121 entry.target.__visibility(entry) 122 } 123 } 124 }) 125 }, options ) 126 127 const observe = ( el, callback ) => { 128 el.__visibility = callback 129 observer.observe(el) 130 } 131 132 const unobserve = ( el ) => { 133 observer.unobserve(el) 134 } 135 136 return { 137 observe, 138 unobserve, 139 } 140 })() 141})() 142 143 144function _initBlocks() { 145 for (let m of (window.block_code_modules || [])) { 146 try { 147 m && m.init && m.init(m.id, m) 148 } catch (err) { 149 console.log('Error initing module', m.id, err) 150 } 151 } 152} 153 154function _destroyBlocks() { 155 for (let m of (window.block_code_modules || [])) { 156 try { 157 m && m.destroy && m.destroy() 158 } catch (err) { 159 console.log('Error destroying module', m.id, err) 160 } 161 } 162} 163 164_G.parallaxService = (function () { 165 166 const BASE_SPEED = 0.7 167 168 let stopped = false 169 const elements = [] 170 const observer = new IntersectionObserver((entries) => {
171 entries.forEach(entry => { 172 entry.target._parallaxVisible = entry.isIntersecting 173 recalc(entry.target) 174 }) 175 }, { 176 // blank options 177 }) 178 179 window.addEventListener('scroll', (ev) => { 180 requestAnimationFrame(() => { 181 recalcAll() 182 }) 183 184 }, { passive: true }) 185 186 const calcShift = (elem) => { 187 /* 188 * calculates a number -1..0..1 where 0 is dead center of the element in viewport 189 * -1 is when the element touches with its top the top edge of the viewport 190 * 1 is when the element touches with its bottom the bottom edge of the viewport 191 * 192 * */ 193 const rect = elem.parentElement.getBoundingClientRect() 194 const bgRect = elem.getBoundingClientRect() 195 const elemFreeHeight = window.innerHeight - rect.height 196 const bgFreeHeight = window.innerHeight - bgRect.height 197 const shapeCenterY = rect.top + (rect.height / 2) 198 const viewportCenterY = window.innerHeight / 2 199 const delta = viewportCenterY - shapeCenterY 200 201 // adjusting speed is necessary for containers that are shorter than 202 // viewport height and have bg element with some spare space top and 203 // bottom to allow for differential scroll speeds. If these conditions 204 // are not met, we fall back to the base speed. Otherwise, we calculate the 205 // ideal speed based on the amount of spare image space and size of 206 // container. The idea is that the top of bg image reach the top 207 // of the viewport at exactly the same time as the container to avoid exposing 208 // any areas uncovered by the image. 209 const shouldAdjustSpeed = bgRect.height < window.innerHeight 210 && rect.height < window.innerHeight 211 && bgRect.height >= rect.height 212 213 const baseSpeed = shouldAdjustSpeed 214 ? bgFreeHeight / elemFreeHeight 215 : BASE_SPEED 216 217 const translateValue = ( 1 - baseSpeed ) * delta 218 219 // console.log( delta, acceleration, adjustedRatio, translateValue ) 220 221 return translateValue.toFixed(4) 222 } 223 224 const recalcAll = () => { 225 if( stopped ) { 226 return 227 } 228 elements.forEach(elem => { 229 recalc(elem) 230 }) 231 } 232 233 const recalc = (elem) => { 234 if( stopped ) { 235 return 236 } 237 if (elem._parallaxVisible) { 238 elem.style.transform = 'translate(0,' + calcShift(elem) + 'px)' + 239 (elem.classList.contains('blur') ? ' scale(1.1)' : '' ) 240 } 241 } 242 243 const add = (elem) => { 244 if (!elem) { 245 return 246 } 247 elem._parallaxVisible = false 248 elements.push(elem) 249 observer.observe(elem) 250 recalc(elem) 251 } 252 253 const remove = (elem) => { 254 const index = elements.indexOf(elem) 255 if (index !== -1) { 256 elements.splice(index, 1) 257 } 258 observer.unobserve(elem) 259 } 260 261 const setStopped = (flag) => { 262 stopped = flag 263 } 264 265 const refresh = () => { 266 recalcAll() 267 } 268 269 const cleanup = () => { 270 // cleanup potentially stale elements, i.e. detached from DOM 271 // may happen after a block was re-inserted in the editor 272 elements.slice().filter(elem => { 273 if (!document.body.contains(elem)) { 274 remove(elem) 275 } 276 }) 277 } 278 279 return { 280 setStopped, 281 refresh, 282 add, 283 remove, 284 cleanup, 285 } 286})() 287 288_G.fxService = (function() { 289 290 let queue = [] 291 let revealLaunched = null 292 293 function cleanupFastScrolled() { 294 // const snapshot = queue.map( el => { 295 // let rect = el.getBoundingClientRect() 296 // let top = rect.top 297 // let bottom = rect.bottom 298 // return { 299 // el, 300 // top, 301 // bottom, 302 // scrolledOutOfView: bottom < 0, 303 // } 304 // }) 305 // console.log( 'REVEAL', snapshot ) 306 while(queue.length > 0) { 307 let el = queue.at(0) 308 if( !el ) { 309 break; 310 } 311 let rect = el.getBoundingClientRect() 312 if( rect.bottom < 0 ) { 313 queue.shift().classList.remove('fx') 314 } 315 else { 316 break; 317 } 318 } 319 } 320 321 function revealStaggered() { 322 if( revealLaunched !== null ) { 323 return 324 } 325 if( queue.length === 0 ) { 326 return 327 } 328 revealLaunched = setInterval( () => { 329 if( queue.length === 0 ) { 330 clearInterval( revealLaunched ) 331 revealLaunched = null 332 return 333 } 334 cleanupFastScrolled() 335 queue.shift().classList.remove( 'fx' ) 336 }, 100 ) 337 } 338 339 function initElem( el ) { 340 if( !el || el.__fx_inited ) { 341 return 342 } 343 344 if( el.closest('.managed-fx')) { 345 return 346 } 347 348 el.__fx_inited = true 349 _G.visibilityService.observe( el, result => { 350 351 if( !el.classList.contains('fx')) { 352 return // probably already revealed 353 } 354 queue.push(el) 355 revealStaggered() 356 _G.visibilityService.unobserve(el) 357 }) 358 } 359
360 function init() { 361 document.querySelectorAll('.fx' ).forEach( initElem ) 362 } 363 364 return { 365 init, 366 initElem 367 } 368})() 369 370 371document.addEventListener('DOMContentLoaded', () => { 372 373 if( window.customOnLoads ) { 374 window.customOnLoads.forEach( f => { 375 try { 376 if( typeof f === 'function' ) { 377 f() 378 } 379 } 380 catch( ex ) { 381 console.error( 'ERROR: failed to run customOnLoad: ', ex ); 382 } 383 }) 384 } 385 386 function initVideo( v ) { 387 if( v.__videoInited ) { 388 return 389 } 390 v.__videoInited = true 391 v.addEventListener('pause', () => { 392 v.__paused = true 393 }) 394 _G.visibilityService.observe(v, result => { 395 if( result.isIntersecting ) { 396 if( v.__paused ) { 397 return 398 } 399 v.muted = true 400 v.play() 401 if(v.getAttribute("data-speed")) { 402 v.playbackRate = parseFloat(v.getAttribute("data-speed")) 403 } 404 // if( document.querySelector('html').classList.contains('editing') ) { 405 //v.pause() 406 // } 407 } 408 }) 409 } 410 411 _G.fxService.init() 412 _G.reinitHandlers.push( id => { 413 document.getElementById(id).querySelectorAll('.fx').forEach( el => { 414 _G.fxService.initElem(el) 415 }) 416 document.querySelectorAll('video[data-autoplay="true"]').forEach(initVideo ) 417 }) 418 419 420 document.querySelectorAll('.with-scroll-parallax').forEach(elem => { 421 _G.parallaxService.add(elem) 422 }) 423 document.querySelectorAll( '.with-smart-bg.with-bg-video video' ).forEach(( v => { 424 v.muted = true 425 v.play() 426 })) 427 428 document.querySelectorAll('video.video[data-autoplay="true"]').forEach(initVideo ) 429 430 document.addEventListener( 'editor.on', () => { 431 }) 432 433 _G.quickMessage = ( msg, options={} ) => { 434 const m = document.createElement('div') 435 m.classList.add('quick-message') 436 if( options.error ) { 437 m.classList.add( 'error' ) 438 } 439 m.style.opacity = '0' 440 m.innerText = msg 441 document.body.appendChild( m ) 442 setTimeout( () => { 443 m.style.opacity = '1' 444 }, 10 ) 445 setTimeout( () => { 446 m.style.opacity = '0' 447 m.addEventListener( 'transitionend', () => { 448 m.remove() 449 },{once:true}) 450 }, 3000 ) 451 m.addEventListener('click', ev => { 452 m.style.opacity = '0' 453 m.addEventListener( 'transitionend', () => { 454 m.remove() 455 },{once:true}) 456 }, {once: true}) 457 } 458 459 _G.applyRipple = function( event, button ) { 460 461 const circle = document.createElement("span") 462 const diameter = Math.max(button.clientWidth, button.clientHeight) 463 const radius = diameter / 2; 464 465 circle.style.width = circle.style.height = `${diameter}px` 466 const rect = button.getBoundingClientRect() 467 circle.style.left = `${event.clientX - (rect.left + radius)}px` 468 circle.style.top = `${event.clientY - (rect.top + radius)}px` 469 circle.classList.add("ripple") 470 471 const ripple = button.getElementsByClassName("ripple")[0] 472 if (ripple) { 473 ripple.remove() 474 } 475 476 button.appendChild(circle) 477 478 circle.addEventListener( 'animationend', () => { 479 circle.remove() 480 }, { once: true }) 481 } 482 483 _G.createFragment = htmlStr => { 484 var frag = document.createDocumentFragment(), temp = document.createElement('div'); 485 temp.innerHTML = htmlStr; 486 while (temp.firstChild) { 487 frag.appendChild(temp.firstChild); 488 } 489 return frag; 490 } 491 492 function scrollToBlock( id ) { 493 console.log( 'will scroll to ', id ) 494 const elem = document.querySelector(id) 495 if( elem ) { 496 elem.scrollIntoView({ 497 behavior: 'smooth', 498 block: 'start',
499 inline: 'nearest', 500 }) 501 history.pushState({}, '', id) 502 // window.location.hash = id 503 } 504 } 505 506 document.addEventListener( 'click', event => { 507 if( event.target && ( event.target.matches( '.block-layout .button' ) || event.target.matches( '.block-layout .button *' ))) { 508 const button = event.target.closest('.button') 509 if( button ) { 510 _G.applyRipple(event, button ) 511 if( button.tagName === 'BUTTON' ) { 512 const form = button.closest('form') 513 if( form && form.getAttribute('action') && 514 form.getAttribute('action').indexOf('#bid_') === 0 ) { 515 event.stopPropagation() 516 event.preventDefault() 517 scrollToBlock(form.getAttribute('action')) 518 } 519 } 520 } 521 } 522 if( event.target && ( event.target.matches( '.block-layout a' ) || event.target.matches('.block-layout a *'))) { 523 const link = event.target.closest('a') 524 if( link && link.getAttribute('href') && link.getAttribute('href').indexOf('#bid_') === 0 ) { 525 event.stopPropagation() 526 event.preventDefault() 527 scrollToBlock(link.getAttribute('href')) 528 } 529 } 530 }) 531}) 532 533function debounce(func, wait, immediate) { 534 var timeout; 535 return function() { 536 var context = this, args = arguments; 537 var later = function() { 538 timeout = null; 539 if (!immediate) func.apply(context, args); 540 }; 541 var callNow = immediate && !timeout; 542 clearTimeout(timeout); 543 timeout = setTimeout(later, wait); 544 if (callNow) func.apply(context, args); 545 }; 546} 547 548function openTranslate( toLang ) { 549 toLang = toLang || "en"; 550 window.open("https://" + window.location.hostname.replaceAll("-","--") 551 .replaceAll(".","-") + ".translate.goog" + window.location.pathname + 552 "?_x_tr_sl=auto&_x_tr_tl=" + toLang + "&_x_tr_hl=en&_x_tr_pto=wapp' target='_blank'>Translate Page") 553} 554 555function mrp_basic_auth_logout( safelocation ) { 556 const c = ''; 557 var a, b = "You should be logged out now."; 558 try { 559 a = document.execCommand("ClearAuthenticationCache", 'false') 560 } catch (d) { 561 } 562 a || ((a = window.XMLHttpRequest ? new window.XMLHttpRequest : window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : void 0) ? 563 (a.open("HEAD", c || location.href, !0, "logout", (new Date).getTime().toString()), a.send(""), a = 1) : a = void 0); 564 a || (b = "Your browser is too old or too weird to support log out functionality. Close all windows and restart the browser."); 565 // alert(b) 566 document.body.innerHTML = ''; 567 setTimeout(() => { 568 const url = window.location.href; 569 const fake = btoa('logout:logout') 570 // history.replaceState({}, '', url + '?t' + Date.now() ); 571 window.location = safelocation || 'https://private-office.myrealpage.com' 572 // fetch( url, { 573 // headers: { 574 // 'Authorization': 'Basic fake' 575 // } 576 // }) 577 // .finally( () => { 578 // 579 // }); 580 }, 1000 ) 581} 582 583/* ==== INCLUDE: /js/responsive-containers-mod.js ==== */ 584 585/* 586MIT Licensed. 587Copyright (c) 2011 Andy Hume (http://andyhume.net, [email protected]). 588 589Permission is hereby granted, free of charge, to any person obtaining a copy 590of this software and associated documentation files (the "Software"), to deal 591in the Software without restriction, including without limitation the rights 592to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 593copies of the Software, and to permit persons to whom the Software is 594furnished to do so, subject to the following conditions: 595 596The above copyright notice and this permission notice shall be included in 597all copies or substantial portions of the Software. 598 599THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 600IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 601FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 602AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 603LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 604OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 605THE SOFTWARE. 606*/ 607 608(function(win) { 609 610 if( window.responsiveContainersLoaded ) { 611 return; 612 } 613 614 window.responsiveContainersLoaded = true; 615 616 var doc = win.document, 617 els = [], 618 check_data_attributes = true, 619 loaded = false;
620 621 622 if( window.mrp_v2_ready ) { 623 window.mrp_v2_ready( function() { 624 _gmrp.$( document ).on( "mrp.responsify.containers mrp.popup.close", 625 function(e) { 626 //console.log( "mrp.ajax-idx.show" ); 627 for( var i=0; i<els.length; ++i ) { 628 delete els[i].cq_rules; 629 } 630 els = []; 631 //var b = new Date().getTime(); 632 findContainerQueries(); 633 applyRules(); 634 //console.log( ( new Date().getTime() - b ) + "ms" ); 635 } 636 ); 637 }); 638 } 639 640 function add(elements, query, value, class_name) { 641 var split_value = /([0-9]*)(px|em)/.exec(value); 642 for (var i = 0, j = elements.length; i<j; ++i) { 643 var el = elements[i]; 644 el.cq_rules = el.cq_rules || []; 645 el.cq_rules.push([null, query, split_value[1], split_value[2], class_name]); 646 els.push(el); 647 } 648 if (loaded) { // if we're not 'loaded' yet, domLoaded will run applyRules() for us. 649 applyRules(); 650 } 651 } 652 653 function ignoreDataAttributes() { 654 check_data_attributes = false; 655 } 656 657 function findContainerQueries() { 658 if (check_data_attributes) { 659 // Find data-squery attributes. 660 var nodes = []; 661 if (doc.querySelectorAll) { 662 var nodes = doc.querySelectorAll("[data-squery]"); 663 } else { 664 // If no query selectors. 665 var e = doc.getElementsByTagName("*"); 666 for (var i = 0, j = e.length; i<j; ++i) { 667 if (e[i].getAttribute("data-squery")) { 668 nodes.push(e[i]); 669 } 670 } 671 } 672 // Parse the data-squery attribute and store resulting rules on the element. 673 for (var i = 0, j = nodes.length; i<j; ++i) { 674 var el = nodes[i]; 675 if( el.cq_rules && el.cq_rules.length > 0 ) { 676 continue; 677 } 678 var cq_rules = []; 679 var raw_rules = el.getAttribute("data-squery").split(" "); 680 for (var k = 0, l = raw_rules.length; k<l; ++k) { 681 var rule = /(.*):([0-9]*)(px|em)=(.*)/.exec(raw_rules[k]); 682 if (rule) { 683 cq_rules.push(rule); 684 } 685 } 686 el.cq_rules = el.cq_rules || []; 687 el.cq_rules = el.cq_rules.concat(cq_rules); 688 els.push(el); 689 } 690 } 691 } 692 693 function applyRules() { 694 // For each element, apply the rules to the class name. 695 console.log( "els:", els.length ); 696 for (var i = 0, j = els.length; i<j; ++i) { 697 el = els[i]; 698 console.log( "els.cq_rules:",el.cq_rules.length ); 699 for (var k = 0, l = el.cq_rules.length; k<l; ++k) { 700 var rule = el.cq_rules[k]; 701 702 // Get a target width value in pixels. 703 var width = parseInt(rule[2]); 704 if (rule[3] === "em") { 705 width = emsToPixels(parseFloat(rule[2]), el); 706 } 707 708 // Calculate the width of the target without the class added. 709 var defaultWidth = getDefaultWidth(el, rule[4]); 710 // Test current width against target width and add/remove class values. 711 if ( compareFunction[rule[1]](defaultWidth, width) ) { 712 window._gmrp && _gmrp.$ && _gmrp.$( document ).trigger( "mrp.resp.container.change", "+" + rule[4] ); 713 if (el.className.indexOf(rule[4]) < 0) { 714 el.className += " " + rule[4]; 715 } 716 } else { 717 window._gmrp && _gmrp.$ && _gmrp.$( document ).trigger( "mrp.resp.container.change", "-" + rule[4] ); 718 var class_name = el.className.replace(new RegExp('(^| )'+rule[4]+'( |$)'), '$1'); 719 class_name = class_name.replace(/ $/, ''); 720 el.className = class_name; 721 } 722 } 723 } 724 } 725 726 var compareFunction = { 727 "min-width": function(a, b) { 728 return a > b; 729 }, 730 "max-width": function(a, b) { 731 return a < b; 732 } 733 } 734 735 function contentReady() { 736 if (loaded) { 737 return; 738 } 739 loaded = true; 740 findContainerQueries(); 741 applyRules(); 742 if (win.addEventListener) { 743 win.addEventListener("resize", applyRules, false); 744 745 } 746 // Allow for resizing text after the page has loaded. 747 var current_em = emsToPixels(1, doc.body); 748 win.setInterval(function() { 749 var new_em = emsToPixels(1, doc.body); 750 if (new_em !== current_em) { 751 applyRules(); 752 current_em = new_em; 753 } 754 }, 2000); 755 } 756 757 function memoize( f ) { 758 return function () { 759 var args = Array.prototype.slice.call(arguments); 760 f.memoize = f.memoize || {}; 761 return (args in f.memoize) ? f.memoize[args] : f.memoize[args] = f.apply(this, args); 762 }; 763 } 764 765 var emsToPixels = memoize(function(em, scope) { 766 var test = doc.createElement("div"); 767 test.style.fontSize = "1em"; 768 test.style.margin = "0"; 769 test.style.padding = "0"; 770 test.style.border = "none"; 771 test.style.width = "1em"; 772 scope.appendChild(test); 773 var val = test.offsetWidth; 774 scope.removeChild(test); 775 return Math.round(val * em); 776 }); 777 778 var getDefaultWidth = function(el, class_name) { 779 if( true ) { 780 // we don't need to be fancy, simple width is ok, all the resp containers are flexible 781 return el.offsetWidth; 782 } 783 //console.log( "hit width", el ); 784 var test = el.cloneNode(true); 785 test.className = (" " + test.className + " ").replace(" " + class_name + " ", " "); 786 test.style.height = 0; 787 test.style.visibility = "hidden"; 788 test.style.overflow = "hidden"; 789 test.style.clear = "both"; 790 var parent = el.parentNode; 791 parent.insertBefore(test, el); 792 var val = test.offsetWidth; 793 parent.removeChild(test); 794 return val; 795 } 796 797 if( window.addEventListener ) { 798 console.log( "installing mrpRescanResponsifyContainers listener" ); 799 window.addEventListener("mrpRescanResponsifyContainers", function() { 800 console.log( "mrpRescanResponsifyContainers" ); 801 findContainerQueries(); 802 applyRules(); 803 }, false); 804 } 805 else if (window.attachEvent) { 806 window.attachEvent("mrpRescanResponsifyContainers", function() { 807 findContainerQueries(); 808 applyRules(); 809 }); 810 } 811 812 if( /loaded|complete|interactive/.test(doc.readyState) ) { 813 contentReady(); 814 } 815 else if (doc.addEventListener) { 816 doc.addEventListener("DOMContentLoaded", contentReady, false); 817 // or 818 win.addEventListener("load", contentReady, false); 819 } 820 // If old IE 821 else if (doc.attachEvent) { 822 doc.attachEvent("onreadystatechange", contentReady); 823 // or 824 win.attachEvent("onload", contentReady); 825 } 826 827 828 win["SelectorQueries"] = { 829 "add": add, 830 "ignoreDataAttributes": ignoreDataAttributes 831 } 832 833})(this); 834 835 836 837/* ==== INCLUDE: /js/blocks/sticky-menu.js ==== */ 838 839 840document.addEventListener( 'DOMContentLoaded', function() { 841 842 function initBlock(id) { 843 const block = document.getElementById(id) 844 if( block.querySelector('.sticky-menu')) { 845 init( block.querySelector( '.sticky-menu' ) ) 846 } 847 } 848 849 function isMenuVisible (el) { 850 var rect = el.getBoundingClientRect(); 851 852 if( rect.top < 0 ) { 853 return false;
854 } 855 else { 856 return true; 857 } 858 } 859 860 function floatMenu( el ) { 861 if( el.querySelector('.sticky' ).classList.contains( 'floated')) { 862 return 863 } 864 if( document.querySelector('html').classList.contains('editing') ) { 865 return unfloatMenu(el) 866 } 867 el.querySelector('.sticky' ).style.opacity = '1' 868 el.querySelector('.sticky' ).classList.add( 'floating', 'floated', 'elevation3' ) 869 el.classList.add( 'sticky-on' ) 870 } 871 872 function unfloatMenu( el ) { 873 if( !el.querySelector('.sticky' ).classList.contains( 'floated')) { 874 return 875 } 876 el.querySelector('.sticky' ).classList.remove( 'floating', 'floated', 'elevation3' ) 877 el.classList.remove( 'sticky-on' ) 878 } 879 880 function init( el ) { 881 if( !el || !el.querySelector( '.sticky' )) { 882 return 883 } 884 885 window.addEventListener( 'scroll', function() { 886 isMenuVisible( el ) ? unfloatMenu(el) : floatMenu(el) 887 }, { passive: true }) 888 889 890 if( !isMenuVisible(el) ) { 891 floatMenu(el) 892 } 893 894 document.addEventListener( 'editor.on', function() { 895 unfloatMenu( el ) 896 }) 897 document.addEventListener( 'editor.off', function() { 898 if( !isMenuVisible( el ) ) { 899 floatMenu( el ) 900 } 901 }) 902 } 903 904 document.querySelectorAll( '.sticky-menu' ).forEach( function(el) { 905 init( el ) 906 }) 907 908 _G.reinitHandlers.push(initBlock) 909}) 910 911 912/* ==== INCLUDE: /js/blocks/hmenu.js ==== */ 913 914document.addEventListener( 'DOMContentLoaded', ev => { 915 916 document.body.addEventListener( 'click', ev => { 917 918 if( document.querySelector('html').classList.contains('editing')) { 919 return 920 } 921 if( !ev.target.matches( '.hmenu li.has-submenu, .hmenu li.has-submenu > *' ) ) { 922 return 923 } 924 const el = ev.target.closest( 'li' ) 925 ev.preventDefault() 926 ev.stopPropagation() 927 928 document.querySelectorAll( '.hmenu li.open' ).forEach( open => { 929 if( open.contains(el) ) { 930 return 931 } 932 open.classList.remove('open') 933 open.classList.remove('visible') 934 }) 935 if( el.classList.contains('open')) { 936 // toggle 937 el.classList.remove('open'); 938 el.classList.remove('visible'); 939 return; 940 } 941 // open -> does display: block which acquires dimension for popper 942 el.classList.add( 'open' ) 943 setTimeout( () => { 944 // then we fade it in 945 el.classList.add( 'visible' ) 946 }, 100 ) 947 948 if( el.__popper ) { 949 el.__popper.update() 950 return 951 } 952 953 console.log( 'placement', el.closest('ul' ).classList.contains('mrp-menu-level-0') ? 'bottom-start' : 'right-start' ) 954 955 el.__popper = Popper.createPopper( el, el.querySelector( 'ul'), { 956 placement: el.closest('ul' ).classList.contains('mrp-menu-level-0') ? 'bottom-start' : 'right-start', 957 }) 958 }) 959 960 document.body.addEventListener('keydown', ev => { 961 if( ev.key === 'Enter' ) { 962 if( !ev.target.closest( 'li.has-submenu') ) { 963 return 964 } 965 ev.stopPropagation() 966 ev.preventDefault() 967 ev.target.closest( 'li.has-submenu').click() 968 } 969 else if( ev.key === 'Escape' ) { 970 document.querySelectorAll( '.hmenu li.open' ).forEach( el => { 971 el.classList.remove('open') 972 el.classList.remove('visible') 973 }) 974 } 975 }) 976 977 document.body.addEventListener('click', ev => { 978 if( ev.target.closest( 'li.has-submenu') ) { 979 return 980 } 981 document.querySelectorAll( '.hmenu li.open' ).forEach( el => { 982 el.classList.remove('open') 983 el.classList.remove('visible') 984 }) 985 }) 986 987 document.querySelectorAll('.hmenu').forEach( menu => { 988 menu.querySelectorAll( '.hmenu li.has-submenu' ).forEach( item => { 989 item.addEventListener('click', ev => { 990 991 }) 992 993 }) 994 }) 995}) 996 997 998/* ==== INCLUDE: /js/blocks/vmenu.js ==== */ 999
1000/*! 1001 * Mmenu Light 1002 * mmenujs.com/mmenu-light 1003 * 1004 * Copyright (c) Fred Heusschen 1005 * www.frebsite.nl 1006 * 1007 * License: CC-BY-4.0 1008 * http://creativecommons.org/licenses/by/4.0/ 1009 */ 1010 1011!function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var i=function(){function t(t){var e=this;this.listener=function(t){(t.matches?e.matchFns:e.unmatchFns).forEac
1011h((function(t){t()}))},this.toggler=window.matchMedia(t),this.toggler.addListener(this.listener),this.matchFns=[],this.unmatchFns=[]}return t.prototype.add=function(t,e){this.matchFns.push(t),this.unmatchFns.push(e),(this.toggler.matches?t:e)()},t}(),s=function(t){return Array.prototype.slice.call(t)},o=function(t,e){return s((e||document).querySelectorAll(t))},r=("ontouchstart"in window||navigator.msMaxTouchPoints,navigator.userAgent.indexOf("MSIE")>-1||navigator.appVersion.indexOf("Trident/")>-1),a="mm-spn",c=function(){function t(t,e,n,i,s){this.node=t,this.title=e,this.slidingSubmenus=i,this.selectedClass=n,this.node.classList.add(a),r&&(this.slidingSubmenus=!1),this.node.classList.add(a+"--"+s),this.node.classList.add(a+"--"+(this.slidingSubmenus?"navbar":"vertical")),this._setSelectedl(),this._initAnchors()}return Object.defineProperty(t.prototype,"prefix",{get:function(){return a},enumerable:!1,configurable:!0}),t.prototype.openPanel=function(t){var e=t.parentElement;if(this.slidingSubmenus){var n=t.dataset.mmSpnTitle;e===this.node?this.node.classList.add(a+"--main"):(this.node.classList.remove(a+"--main"),n||s(e.children).forEach((function(t){t.matches("a, span")&&(n=t.textContent)}))),n||(n=this.title),this.node.dataset.mmSpnTitle=n,o(".mm-spn--open",this.node).forEach((function(t){t.classList.remove(a+"--open"),t.classList.remove(a+"--parent")})),t.classList.add(a+"--open"),t.classList.remove(a+"--parent");for(var i=t.parentElement.closest("ul");i;)i.classList.add(a+"--open"),i.classList.add(a+"--parent"),i=i.parentElement.closest("ul")}else{var r=t.matches(".mm-spn--open");r?e.classList.remove(a+"--open-parent"):e.classList.add(a+"--open-parent"),t.classList[r?"remove":"add"](a+"--open");for(var c=t.parentElement.closest("ul");c;)c.classList.add(a+"--open"),c=c.parentElement.closest("ul")}},t.prototype._setSelectedl=function(){var t=o("."+this.selectedClass,this.node),e=t[t.length-1],n=null;e&&(n=e.closest("ul")),n||(n=this.node.querySelector("ul")),this.openPanel(n)},t.prototype._initAnchors=function(){var t=this;this.node.addEventListener("click",(function(e){var n=e.target,i=!1;(i=(i=(i=i||function(t){return!!t.matches("a")}(n))||function(e){var n;return!!(n=e.closest("span")?e.parentElement:!!e.closest("li")&&e)&&(s(n.children).forEach((function(e){e.matches("ul")&&t.openPanel(e)})),!0)}(n))||function(e){var n=o(".mm-spn--open",e),i=n[n.length-1];if(i){var s=i.parentElement.closest("ul");
1011if(s)return t.openPanel(s),!0}return!1}(n))&&e.stopImmediatePropagation()}))},t}(),d=function(){function t(t,e){var n=this;void 0===t&&(t=null),this.wrapper=document.createElement("div"),this.wrapper.classList.add("mm-ocd"),this.wrapper.classList.add("mm-ocd--"+e),this.content=document.createElement("div"),this.content.classList.add("mm-ocd__content"),this.wrapper.append(this.content),this.backdrop=document.createElement("div"),this.backdrop.classList.add("mm-ocd__backdrop"),this.wrapper.append(this.backdrop),document.body.append(this.wrapper),t&&this.content.append(t);var i=function(t){n.close(),t.stopImmediatePropagation()};this.backdrop.addEventListener("touchstart",i,{passive:!0}),this.backdrop.addEventListener("mousedown",i,{passive:!0})}return Object.defineProperty(t.prototype,"prefix",{get:function(){return"mm-ocd"},enumerable:!1,configurable:!0}),t.prototype.open=function(){this.wrapper.classList.add("mm-ocd--open"),document.querySelector('html').classList.add("mm-ocd-opened")},t.prototype.close=function(){this.wrapper.classList.remove("mm-ocd--open"),document.querySelector('html').classList.remove("mm-ocd-opened")},t}(),l=function(){function t(t,e){void 0===e&&(e="all"),this.menu=t,this.toggler=new i(e)}return t.prototype.navigation=function(t){var e=this;if(!this.navigator){var n=(t=t||{}).title,i=void 0===n?"Menu":n,s=t.selectedClass,o=void 0===s?"Selected":s,r=t.slidingSubmenus,a=void 0===r||r,d=t.theme,l=void 0===d?"light":d;this.navigator=new c(this.menu,i,o,a,l),this.toggler.add((function(){return e.menu.classList.add(e.navigator.prefix)}),(function(){return e.menu.classList.remove(e.navigator.prefix)}))}return this.navigator},t.prototype.offcanvas=function(t){var e=this;if(!this.drawer){var n=(t=t||{}).position,i=void 0===n?"left":n;this.drawer=new d(null,i);var s=document.createComment("original menu location");this.menu.after(s),this.toggler.add((function(){e.drawer.content.append(e.menu)}),(function(){e.drawer.close(),s.after(e.menu)}))}return this.drawer},t}();e.default=l;window.MmenuLight=l}]); 1012 1013;(function () { 1014 1015 const menus = {} 1016 1017 const init = (id) => { 1018 // re-entrant 1019 1020 if( id ) { 1021 // re-init 1022 // first destroy all existing (after apply in-place changes) constructs 1023 document.querySelectorAll( '[data-rel="' + id + '"]').forEach( existing => { 1024 existing.remove() 1025 }) 1026 } 1027 1028 document.querySelectorAll( '.vmenu').forEach( (el, index) => { 1029 if( el.classList.contains('inited')) { 1030 return 1031 } 1032 el.classList.add('inited') 1033 1034 const blockId = el.closest( '.block-layout' ).getAttribute('id') 1035 1036 1037 1038 const menu = new MmenuLight( el, 'all' ) 1039 const navigation = menu.navigation({ 1040 selected: 'selected', 1041 slidingSubmenus: 'true' === el.getAttribute('data-slide'), 1042 theme: 'true' === el.getAttribute('data-dark') ? 'dark' : 'light', 1043 title: '' 1044 }) 1045 1046 const drawer = menu.offcanvas({ 1047 position: 'right' === el.getAttribute('data-position') ? 'right' : 'left', 1048 }) 1049 1050 drawer.wrapper.setAttribute( 'data-rel', blockId ) 1051 1052 el.classList.remove('initial') 1053 1054 // if id was given to us in init(id), then we are reiniting 1055 if( id && index === 0 ) { 1056 menus[blockId] = [] 1057 } 1058 if( !menus[blockId] ) { 1059 // array for potentially multiple per block 1060 menus[blockId] = [] 1061 } 1062 menus[blockId].push({ navigation, drawer }) 1063 }) 1064 } 1065 1066 document.addEventListener('DOMContentLoaded', () => { 1067 init() 1068 1069 document.addEventListener('editor.on', () => { 1070 Reflect.ownKeys(menus).forEach( m => { 1071 const handlers = menus[m] 1072 handlers.forEach( h => { 1073 try { 1074 h.drawer.close() 1075 } 1076 catch( e ) {} 1077 }) 1078 }) 1079 }) 1080 1081 document.addEventListener('keydown', ev => { 1082 if( ev.key === 'Escape' ) {
1083 Reflect.ownKeys(menus).forEach( m => { 1084 const handlers = menus[m] 1085 handlers.forEach( h => { 1086 try { 1087 h.drawer.close() 1088 } 1089 catch( e ) {} 1090 }) 1091 }) 1092 } 1093 }) 1094 1095 document.addEventListener('click', ev => { 1096 if( ev.target && ev.target && 1097 ev.target.closest('.vmenu-opener')) { 1098 1099 if( document.querySelector('html').classList.contains('editing')) { 1100 return 1101 } 1102 const blockId = ev.target.closest('.block-layout').getAttribute('id') 1103 const index = parseInt(ev.target.closest('.vmenu-opener').getAttribute( 'data-index')) || 0 1104 const handlers = menus[blockId] 1105 if( Array.isArray(handlers) && handlers[index]) { 1106 handlers[index].drawer.open() 1107 if( handlers[index].navigation.slidingSubmenus ) { 1108 handlers[index].navigation.openPanel(handlers[index].navigation.node.querySelector('ul')) 1109 } 1110 handlers[index].drawer.content.querySelector('.vmenu').focus() 1111 } 1112 } 1113 }) 1114 }) 1115 1116 _G.reinitHandlers.push(init) 1117 1118})() 1119 1120 1121/* ==== INCLUDE: /js/blocks/vmenu-fix.js ==== */ 1122 1123document.addEventListener("DOMContentLoaded", function () { 1124 const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent); 1125 if (!isIOS) return; 1126 1127 const html = document.documentElement; 1128 1129 const syncViewport = () => { 1130 // Force Safari to sync visual + layout viewport 1131 window.scrollTo(0, 1); 1132 window.scrollTo(0, 0); 1133 1134 // Force reflow 1135 html.style.transform = "translateZ(0)"; 1136 void html.offsetHeight; 1137 html.style.transform = ""; 1138 }; 1139 1140 // Watch for mmenu open class on <html> 1141 const obs = new MutationObserver(() => { 1142 if (html.classList.contains("mm-ocd-opened")) { 1143 syncViewport(); 1144 } 1145 }); 1146 1147 obs.observe(html, { attributes: true, attributeFilter: ["class"] }); 1148}); 1149 1150/* ==== INCLUDE: /js/blocks/omnibox-v2_1.js ==== */ 1151 1152;(function () { 1153 1154 function Typeahead(el, accountId) { 1155 1156 if (el.__typeahead) { 1157 // already inited 1158 return 1159 } 1160 1161 el.__typeahead = true 1162 1163 const MIN_CHARS_MSG = 'Enter at least 3 characters...' 1164 1165 // const typeaheadURL = el.getAttribute('data-typeahead') 1166 const typeaheadURL = '/wps/rest/api/' + accountId + '/typeahead?' 1167 1168 el.getAttribute('data-with-ticker') === 'true' && (function () { 1169 1170 const text = el.getAttribute('placeholder') || '' 1171 if (!text) { 1172 return 1173 } 1174 1175 const ticker = document.createElement('div') 1176 ticker.style.position = 'absolute' 1177 ticker.style.width = ticker.style.height = '0' 1178 ticker.style.overflow = 'hidden' 1179 ticker.setAttribute('data-ticker', text) 1180 ticker.innerText = '' 1181 el.setAttribute('placeholder', '') 1182 const typing = window.TypeIt && new window.TypeIt(ticker, { 1183 //waitUntilVisible: true, 1184 cursor: '', 1185 speed: 50, 1186 afterStep: (step, queue, instance) => { 1187 el.setAttribute('placeholder', ticker.textContent) 1188 } 1189 }) 1190 _G.visibilityService.observe(el, result => { 1191 if (result.isIntersecting && !document.querySelector('html').classList.contains('editing')) { 1192 typing.pause(1000).type(text).go() 1193 _G.visibilityService.unobserve(el) 1194 } 1195 }) 1196 1197 })() 1198 1199 const popup = document.createElement("div") 1200 popup.setAttribute("class", "typeahead elevation8") 1201 el.parentElement.appendChild(popup) 1202 1203 const popper = Popper.createPopper(el, popup, { 1204 placement: 'bottom-start', 1205 modifiers: [ 1206 { 1207 name: 'offset', 1208 options: { 1209 offset: [0, 8], 1210 }, 1211 }, 1212 ], 1213 }) 1214 1215 const doFetch = debounce((val, onData, onError) => { 1216 1217 let soldCheckbox = el.form.querySelector('input[name=solds]') 1218 if(!soldCheckbox) { 1219 soldCheckbox = el.form.querySelector('input[name=ibf_solds]') 1220 } 1221 const isForSolds = soldCheckbox && soldCheckbox.checked || false 1222 const listingType = isForSolds ? 'AUTO_SOLD' : 1223 (el.form.querySelector('input[name=listingType]').value || 'AUTO') 1224 1225 1226 fetch(typeaheadURL + 'listingType=' + encodeURIComponent(listingType) + 1227 '&q=' + encodeURIComponent(val)) 1228 .then(response => response.json()) 1229 .then(json => { 1230 onData(json) 1231 }) 1232 .catch(err => { 1233 onError(err) 1234 }) 1235 }, 300) 1236 1237 const createTypeaheadMessage = msg => { 1238 popup.innerHTML = '' 1239 const out = document.createElement('div') 1240 out.setAttribute('class', 'message') 1241 out.innerText = msg 1242 popup.appendChild(out) 1243 showTypeahead() 1244 } 1245 1246 const createTypeaheadEntry = row => { 1247 const out = document.createElement('div') 1248 out.setAttribute('class', 'entry') 1249 out.setAttribute('data-value', row[0]) 1250 out.setAttribute('data-label', row[1]) 1251 1252 out.addEventListener('mouseenter', () => { 1253 focusEntry(out) 1254 }) 1255 out.innerText = row[1] 1256 return out 1257 } 1258 1259 const createTypeahead = data => { 1260 popup.innerHTML = '' 1261 if (data.length === 0) { 1262 return createTypeaheadMessage('Hm, nothing found...') 1263 } 1264 data.forEach(record => { 1265 popup.appendChild(createTypeaheadEntry(record)) 1266 }) 1267 if (!popup.classList.contains('visible')) { 1268 showTypeahead() 1269 } 1270 focusFirst() 1271 } 1272 1273 const showTypeahead = () => { 1274 popup.classList.add('visible') 1275 popper.forceUpdate() 1276 } 1277 1278 const hideTypeahead = () => { 1279 popup.classList.remove('visible') 1280 } 1281 1282 const currentSelection = () => { 1283 return popup.querySelector('.focused') 1284 } 1285 1286 const focusFirst = () => { 1287 const first = popup.firstElementChild 1288 if (first && first.classList.contains('entry')) { 1289 return first.classList.add('focused') 1290 } 1291 } 1292 1293 const focusNext = () => { 1294 const current = currentSelection() 1295 if (!current) { 1296 focusFirst() 1297 } else { 1298 current.classList.remove('focused') 1299 const next = current.nextElementSibling 1300 if (!next) { 1301 focusFirst() 1302 } else if (next.classList.contains('entry')) { 1303 next.classList.add('focused') 1304 } 1305 } 1306 } 1307 1308 const focusPrev = () => { 1309 const current = currentSelection() 1310 if (!current) { 1311 return 1312 } 1313 current.classList.remove('focused') 1314 const prev = current.previousElementSibling 1315 if (!prev) { 1316 const last = popup.lastElementChild 1317 if (last && last.classList.contains('entry')) { 1318 last.classList.add('focused') 1319 } 1320 } else if (prev.classList.contains('entry')) { 1321 prev.classList.add('focused') 1322 } 1323 } 1324 1325 const focusEntry = entry => { 1326 const current = currentSelection() 1327 current && current.classList.remove('focused') 1328 entry.classList.add('focused') 1329 } 1330 1331 const isValueAddressOrMlsNum = value => { 1332 return value && (value.startsWith('addr:') || value.startsWith('mls:')) 1333 } 1334 1335 const selectItem = item => { 1336 if (!item || !item.classList.contains('entry')) { 1337 return 1338 } 1339 1340 el.value = '' 1341 1342 const label = item.getAttribute('data-label') 1343 const value = item.getAttribute('data-value') 1344 const isAddressOrMlsNum = isValueAddressOrMlsNum(value) 1345 1346 const data = { 1347 label, 1348 value, 1349 isAddressOrMlsNum, 1350 }
1351 listeners.forEach(l => { 1352 try { 1353 l(data) 1354 } catch (e) { 1355 console.warn('WARNING: error in listener', e) 1356 } 1357 }) 1358 1359 item.remove() 1360 } 1361 1362 // event handling 1363 1364 popup.addEventListener('click', ev => { 1365 if (ev.target && ev.target.classList.contains('entry')) { 1366 selectItem(ev.target) 1367 hideTypeahead() 1368 // setTimeout(() => { 1369 el.focus() 1370 // }, 100) 1371 } 1372 }) 1373 1374 const processKey = ev => { 1375 if (ev.key === 'Escape') { 1376 el.value = '' 1377 return hideTypeahead() 1378 } else if (ev.key === 'ArrowDown') { 1379 ev.preventDefault() 1380 if (popup.classList.contains('visible')) { 1381 focusNext() 1382 } else { 1383 if (popup.querySelectorAll('.entry').length === 0) { 1384 return createTypeaheadMessage(MIN_CHARS_MSG) 1385 } 1386 showTypeahead() 1387 } 1388 } else if (ev.key === 'ArrowUp') { 1389 ev.preventDefault() 1390 focusPrev() 1391 } else if (ev.key === 'Enter') { 1392 ev.preventDefault() 1393 ev.stopPropagation() 1394 if (!popup.classList.contains('visible')) { 1395 // popup is not visible, submit the form 1396 return ev.target.form.submit() 1397 } 1398 const sel = currentSelection() 1399 if (sel) { 1400 selectItem(sel) 1401 hideTypeahead() 1402 } 1403 else { 1404 return ev.target.form.submit() 1405 } 1406 } 1407 } 1408 el.addEventListener('keydown', processKey) 1409 1410 const submitButton = el.closest('form').querySelector('[type=submit]') 1411 if( submitButton ) { 1412 submitButton.addEventListener('click', ev => { 1413 ev.preventDefault(); 1414 ev.stopPropagation(); 1415 if (!popup.classList.contains('visible') && el.value ) { 1416 // popup is not visible, submit the form 1417 // if no suggestion was found (perhaps, due to latency) 1418 // but the text was entered, assume it was an MLS number 1419 const mlsNum = document.createElement('div') 1420 mlsNum.setAttribute('data-value', 'mls:' + el.value ) 1421 mlsNum.setAttribute('data-label', el.value ) 1422 mlsNum.classList.add('entry') 1423 selectItem(mlsNum) 1424 hideTypeahead() 1425 return ev.target.closest('[type=submit]').form.submit() 1426 } 1427 const sel = currentSelection() 1428 if (sel) { 1429 selectItem(sel) 1430 hideTypeahead() 1431 } 1432 else if( el.value ) { 1433 // if no suggestion was found (perhaps, due to latency) 1434 // but the text was entered, assume it was an MLS number 1435 const mlsNum = document.createElement('div') 1436 mlsNum.setAttribute('data-value', 'mls:' + el.value ) 1437 mlsNum.setAttribute('data-label', el.value ) 1438 mlsNum.classList.add('entry') 1439 selectItem(mlsNum) 1440 hideTypeahead() 1441 } 1442 return ev.target.closest('[type=submit]').form.submit() 1443 }) 1444 } 1445 1446 const processInput = ev => { 1447 1448 const val = ev.target.value 1449 if (val && val.length > 2) { 1450 doFetch(val, data => { 1451 createTypeahead(data) 1452 }, err => { 1453 console.log('err', err) 1454 }) 1455 } else { 1456 createTypeaheadMessage(MIN_CHARS_MSG) 1457 //hideTypeahead() 1458 } 1459 } 1460 1461 el.addEventListener('input', processInput) 1462 1463 const click = ev => { 1464 if (!popup.classList.contains('visible') && popup.children.length > 0) { 1465 popup.classList.add('visible') 1466 popper.forceUpdate() 1467 } 1468 } 1469 el.addEventListener('mousedown', click) 1470 1471 1472 const clickAway = ev => { 1473 if (ev.target && ev.target.contains(el)) { 1474 return 1475 } 1476 if (ev.target && ev.target.contains(popup)) { 1477 return 1478 } 1479 if (ev.target && ev.target.closest('.typeahead')) { 1480 return 1481 } 1482 if (ev.target && ev.target.closest('[type=submit]')) { 1483 return 1484 } 1485 hideTypeahead() 1486 } 1487 document.querySelector('html').addEventListener('mousedown', clickAway) 1488 1489 1490 // exported 1491 1492 const listeners = [] 1493 1494 function onSelect(callback) { 1495 callback && (typeof callback === 'function') && listeners.push(callback) 1496 } 1497 1498 function destroy() { 1499 el.__typeahead = false 1500 popper.destroy() 1501 el.removeEventListener('keydown', processKey) 1502 el.removeEventListener('input', processInput) 1503 el.removeEventListener('mousedown', click) 1504 document.removeEventListener('mousedown', clickAway) 1505 } 1506 1507 return { 1508 destroy, 1509 onSelect, 1510 } 1511 } 1512 1513 function Selections(el) { 1514 1515 let selections = [] 1516 1517 el.querySelectorAll('input[type=hidden]').forEach(preset => { 1518 const name = preset.getAttribute('name') 1519 const value = preset.getAttribute('value') 1520 const label = preset.getAttribute('data-label') 1521 1522 selections.push({ 1523 name, 1524 value, 1525 label 1526 }) 1527 1528 preset.remove() 1529 }) 1530 1531 const render = () => { 1532 el.innerHTML = '' 1533 selections.forEach(s => { 1534 const pill = document.createElement('span')
1535 pill.classList.add('selection-pill') 1536 const cancel = document.createElement('img') 1537 cancel.src = 'data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'24\' height=\'24\' viewBox=\'0 0 24 24\'%3e%3cpath d=\'M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\'/%3e%3c/svg%3e' 1538 cancel.setAttribute('aria-role', 'button') 1539 cancel.classList.add('cancel') 1540 cancel.innerText = '×' 1541 pill.appendChild(cancel) 1542 1543 cancel.addEventListener('click', ev => { 1544 ev.preventDefault() 1545 remove(s.name, s.value) 1546 }) 1547 const label = document.createElement('span') 1548 label.classList.add('label') 1549 label.innerText = s.label 1550 pill.appendChild(label) 1551 1552 const hidden = document.createElement('input') 1553 hidden.setAttribute('type', 'hidden') 1554 hidden.setAttribute('name', s.name) 1555 hidden.setAttribute('value', s.value) 1556 el.appendChild(hidden) 1557 el.appendChild(pill) 1558 }) 1559 1560 if( selections.length > 3 ) { 1561 const pill = document.createElement('span') 1562 pill.classList.add('selection-pill','clear-all') 1563 const cancel = document.createElement('img') 1564 cancel.src = 'data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'24\' height=\'24\' viewBox=\'0 0 24 24\'%3e%3cpath d=\'M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\'/%3e%3c/svg%3e' 1565 cancel.setAttribute('aria-role', 'button') 1566 cancel.classList.add('cancel') 1567 cancel.innerText = '×' 1568 pill.appendChild(cancel) 1569 1570 pill.addEventListener('click', ev => { 1571 ev.preventDefault() 1572 clear() 1573 }) 1574 const label = document.createElement('span') 1575 label.classList.add('label') 1576 label.innerText = 'Clear all' 1577 pill.appendChild(label) 1578 1579 el.appendChild( pill ) 1580 } 1581 } 1582 1583 const clear = () => { 1584 selections = [] 1585 render() 1586 } 1587 1588 const clearNonMlsOrAddress = () => { 1589 selections = selections.filter(s => { 1590 return s.name === 'omni' && s.isAddressOrMlsNum === true 1591 }) 1592 } 1593 1594 const find = (name, value) => { 1595 return selections.find(s => ( 1596 s.name === name && s.value === value 1597 )) 1598 } 1599 1600 const add = (name, data) => { 1601 if (find(name, data.value)) { 1602 return 1603 } 1604 let label = data.label 1605 if (data.isAddressOrMlsNum === true) { 1606 label = label.replace(/,.+$/, '') 1607 } 1608 selections.push({ 1609 name, 1610 ...data, 1611 label, 1612 }) 1613 render() 1614 } 1615 1616 const remove = (name, value=null) => { 1617 selections = selections.filter(s => { 1618 return !(s.name === name && ( value === null ? true : s.value === value )) 1619 }) 1620 render() 1621 } 1622 1623 const change = ( data, multipleOk=false ) => { 1624 1625 if( data.value === null ) { 1626 selections = selections.filter(s => { 1627 return s.name !== data.name 1628 }) 1629 return render() 1630 } 1631 1632 const found = selections.find( s => ( s.name === data.name && ( multipleOk ? s.value === data.value: true ))) 1633 if( found ) { 1634 found.value = data.value 1635 found.label = data.label 1636 render() 1637 } 1638 else { 1639 add( data.name, data ) 1640 } 1641 } 1642 1643 const unset = ( name, value ) => { 1644 1645 } 1646 1647 const values = () => { 1648 return JSON.parse(JSON.stringify(selections)) 1649 } 1650 1651 render() 1652 1653 return { 1654 clear, 1655 clearNonMlsOrAddress, 1656 add, 1657 remove, 1658 change, 1659 values, 1660 } 1661 } 1662 1663 let meta 1664 let metaPromise 1665 1666 function Metadata(accountId, listingType, context) {
1667 if (metaPromise) { 1668 return metaPromise 1669 } 1670 if (meta) { 1671 return Promise.resolve(meta) 1672 } 1673 return new Promise((resolve, reject) => { 1674 const url = '/wps/-/noframe~true/' + context + '/' + accountId + '/idx.browse?ibf_json=true&' 1675 1676 setTimeout(() => { 1677 1678 fetch(url + '&listingType=' + encodeURIComponent(listingType)) 1679 .then(response => response.json()) 1680 .then(json => { 1681 meta = json 1682 metaPromise = null 1683 resolve(json) 1684 }) 1685 .catch(err => { 1686 metaPromise = null 1687 reject(err) 1688 }) 1689 1690 }, 0) 1691 }) 1692 } 1693 1694 function BaseControl(meta) { 1695 const out = document.createElement('div') 1696 out.classList.add('control') 1697 const heading = document.createElement('div') 1698 heading.classList.add('heading') 1699 const title = document.createElement('div') 1700 title.classList.add('title') 1701 const expandToggle = document.createElement('div') 1702 expandToggle.classList.add('toggle') 1703 const icon = document.createElement('img') 1704 icon.src = 'data:image/svg+xml,%3csvg xmlns=\'http://www.w3.org/2000/svg\' viewBox=\'0 0 512 512\'%3e %3cpolygon fill=\'var(--ci-primary-color%2c currentColor)\' points=\'440 240 272 240 272 72 240 72 240 240 72 240 72 272 240 272 240 440 272 440 272 272 440 272 440 240\' class=\'ci-primary\'/%3e %3c/svg%3e' 1705 icon.setAttribute('aria-label', 'Show/Hide control') 1706 icon.setAttribute('aria-role', 'button') 1707 icon.setAttribute('alt', 'Show/Hide control') 1708 expandToggle.appendChild(icon) 1709 1710 heading.appendChild(title) 1711 heading.appendChild(expandToggle) 1712 1713 const contentOuter = document.createElement('div') 1714 contentOuter.classList.add('content-outer') 1715 const contentInner = document.createElement('div') 1716 contentInner.classList.add('content-inner') 1717 1718 contentOuter.appendChild(contentInner) 1719 1720 out.appendChild(heading) 1721 out.appendChild(contentOuter) 1722 1723 out.querySelector('.title').innerText = meta.label 1724 1725 heading.addEventListener('click', () => { 1726 if( heading.classList.contains('fixed')) { 1727 return 1728 } 1729 if (icon.classList.contains('expanded')) { 1730 icon.classList.remove('expanded') 1731 contentOuter.style.height = '0px' 1732 } else { 1733 icon.classList.add('expanded') 1734 const h = contentInner.getBoundingClientRect().height 1735 contentOuter.style.height = h + 'px' 1736 } 1737 // setTimeout(() => { 1738 // contentOuter.closest('.control-panel').popper.update() 1739 // }, 100 ) 1740 }) 1741 1742 return out 1743 } 1744 1745 function nFormatter(num, digits) { 1746 var si = [ 1747 {value: 1, symbol: ""}, 1748 {value: 1E3, symbol: "K"}, 1749 {value: 1E6, symbol: "M"}, 1750 ]; 1751 var rx = /\.0+$|(\.[0-9]*[1-9])0+$/; 1752 var i; 1753 for (i = si.length - 1; i > 0; i--) { 1754 if (num >= si[i].value) { 1755 break; 1756 } 1757 } 1758 return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol; 1759 } 1760 1761 function PriceControl(meta, values, onChange, onClear ) { 1762 1763 const out = BaseControl( meta ) 1764 1765 const min = 0 1766 const max = 10000000 1767 let initialFrom = min 1768 let initialTo = max 1769 1770 if( values ) { 1771 const found = values.find( s => s.name === 'ibf_price') 1772 if( found ) { 1773 const v = found.value 1774 if( v ) { 1775 const parsed = v.split("|") 1776 initialFrom = parseInt(parsed[0]) || initialFrom 1777 initialTo = parseInt(parsed[1]) || initialTo 1778 } 1779 } 1780 } 1781 1782 const content = out.querySelector('.content-inner') 1783 1784 const bar = document.createElement('div') 1785 bar.classList.add( 'slider' ) 1786 1787 const formatter = { 1788 to: val => { 1789 return '$' + new Intl.NumberFormat().format(val.toFixed(0)) 1790 }, 1791 from: str => { 1792 return parseInt( val ) 1793 } 1794 } 1795 1796 1797 noUiSlider.create(bar, { 1798 start: [initialFrom, initialTo], 1799 connect: true, 1800 range: { 1801 'min': [0,1000], 1802 // '5%': [1000,1000], 1803 '5%': [100000,10000], 1804 '70%': [1000000,100000], 1805 '80%': [2000000,500000], 1806 'max': [(initialTo || 10000000)], 1807 }, 1808 ariaFormat: formatter, 1809 }) 1810 1811 const labels = document.createElement('div') 1812 labels.classList.add( 'labels' ) 1813 1814 const from = document.createElement('div') 1815 from.classList.add('value') 1816 labels.appendChild(from) 1817 1818 const to = document.createElement('div') 1819 to.classList.add('value') 1820 labels.appendChild(to) 1821 1822 bar.noUiSlider.on( 'update', values => { 1823 const fromVal = parseInt(values[0]) 1824 const toVal = parseInt(values[1]) 1825 if( fromVal === min ) { 1826 from.innerText = 'Any' 1827 } 1828 else { 1829 from.innerText = formatter.to(fromVal) 1830 } 1831 if( toVal === max ) { 1832 to.innerText = 'Any' 1833 } 1834 else{ 1835 to.innerText = formatter.to(toVal) 1836 } 1837 1838 if( fromVal === min && toVal === max ) { 1839 // console.log( 'onChange null' ) 1840 onClear( 'ibf_price') 1841 } 1842 else { 1843 // console.log( 'onChange', fromVal + '-' + toVal ) 1844 onChange({ 1845 name: 'ibf_price', 1846 value: fromVal + '|' + toVal, 1847 // label: 'Price: ' + nFormatter(fromVal,2) + '-' + nFormatter(toVal, 1) 1848 label: formatter.to(fromVal) + ' - ' + formatter.to(toVal) 1849 }, false ) // multipleOk=false 1850 } 1851 1852 }) 1853 1854 content.appendChild(bar) 1855 content.appendChild(labels) 1856 1857 return out 1858 } 1859 1860 function MixedOptionsControl( meta, values, onChange, onClear ) { 1861 const out = BaseControl( meta ) 1862 const content = out.querySelector('.content-inner') 1863 1864 const name = 'ibf_' + meta.name.toLowerCase() 1865 1866 for( let i = 0; i<meta.groups.length; ++i ) { 1867 1868 const group = meta.groups[i] 1869 1870 if( i > 0 ) { 1871 const subhead = document.createElement('div') 1872 subhead.classList.add( 'subhead' ) 1873 subhead.innerText = group.label 1874 content.appendChild(subhead) 1875 } 1876 1877 const pane = document.createElement('div') 1878 pane.classList.add( 'checkbox-pane') 1879 content.appendChild(pane) 1880 1881 for( const option of group.options ) { 1882 const label = document.createElement('label') 1883 const checkbox = document.createElement('input') 1884 checkbox.setAttribute('type', 'checkbox') 1885 checkbox.setAttribute('value', option[0]) 1886 const text = document.createElement('span') 1887 text.innerText = option[1] 1888 label.appendChild(checkbox) 1889 label.appendChild(text) 1890 pane.appendChild(label) 1891 1892 const found = values.find( v => { 1893 return v.name === name && v.value === option[0] 1894 }) 1895 found && ( checkbox.checked = true ) 1896 1897 checkbox.addEventListener( 'change', ev => { 1898 if( ev.target.checked ) { 1899 onChange( { 1900 name, 1901 label: option[1], 1902 value: option[0], 1903 }, true ) 1904 } 1905 }) 1906 } 1907 } 1908 1909 return out 1910 } 1911 1912 function SingleOptionControl( meta, values, onChange, onClear ) { 1913 const out = BaseControl( meta ) 1914 const content = out.querySelector('.content-inner') 1915 1916 const name = 'ibf_' + meta.name.toLowerCase() 1917 1918 const pane = document.createElement('div') 1919 pane.classList.add( 'checkbox-pane') 1920 content.appendChild(pane) 1921 1922 for( const option of meta.options ) { 1923 1924 if( !option[0] ) { 1925 continue; 1926 } 1927 const label = document.createElement('label') 1928 const checkbox = document.createElement('input') 1929 checkbox.setAttribute('type', 'radio') 1930 checkbox.setAttribute('value', option[0]) 1931 const text = document.createElement('span') 1932 text.innerText = option[1] 1933 label.appendChild(checkbox) 1934 label.appendChild(text) 1935 pane.appendChild(label) 1936 1937 const found = values.find( v => { 1938 return v.name === name && v.value === option[0] 1939 }) 1940 found && ( checkbox.checked = true ) 1941 1942 checkbox.addEventListener( 'change', ev => { 1943 1944 pane.querySelectorAll('input[type=radio]').forEach( r => { 1945 if( r.getAttribute('value') !== ev.target.value ) { 1946 r.checked = false 1947 } 1948 }) 1949 1950 if( ev.target.checked ) { 1951 onChange( { 1952 name, 1953 label: meta.label + ': ' + option[1], 1954 value: option[0], 1955 }, false ) 1956 } 1957 }) 1958 } 1959 1960 return out 1961 } 1962 1963 function Control(meta, values, onChange, onClear ) { 1964 1965 if( meta.type === 'PriceControl' ) { 1966 return PriceControl(meta, values, onChange, onClear) 1967 } 1968 else if( meta.type === 'MixedOptionsControl' ) { 1969 return MixedOptionsControl(meta, values, onChange, onClear) 1970 } 1971 else if( meta.type === 'SingleOptionControl' ) { 1972 return SingleOptionControl( meta, values, onChange, onClear) 1973 } 1974 1975 return null 1976 } 1977 1978 function ControlPanel(el, metadataFetcher, selections ) { 1979 const what = el.getAttribute('data-omni-trigger'); 1980 if (!what) { 1981 return 1982 } 1983 1984 const popup = document.createElement("div") 1985 popup.setAttribute("class", "control-panel elevation8")
1986 el.parentElement.appendChild(popup) 1987 1988 // popup.innerHTML = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris tempor ultricies interdum. Suspendisse potenti. Sed consectetur, odio eget mattis commodo, metus massa tincidunt sapien, quis tincidunt sapien mi sed ipsum. Suspendisse eleifend sodales nulla, sit amet vehicula mauris bibendum vitae. Integer condimentum suscipit libero ac pharetra. In eget viverra felis. Cras odio nisi, lacinia eget semper ut, dictum vitae odio. Pellentesque at suscipit justo, id sagittis nisl.' 1989 1990 const popper = Popper.createPopper(el, popup, { 1991 placement: 'bottom', 1992 modifiers: [ 1993 { 1994 name: 'offset', 1995 options: { 1996 offset: [0, 0], 1997 }, 1998 }, 1999 { 2000 name: 'flip', 2001 options: { 2002 // flipVariations: false, // true by default 2003 // allowedAutoPlacements: ['bottom'], 2004 fallbackPlacements: ['bottom'], 2005 }, 2006 }, 2007 ], 2008 }) 2009 2010 popup.popper = popper 2011 2012 window.addEventListener( 'resize', () => { 2013 if( !_G.isMobile() ) { 2014 hidePopup() 2015 } 2016 }, {passive: true}) 2017 2018 const showPopup = () => { 2019 popup.classList.add('visible') 2020 popup.classList.add('becoming') 2021 popper.forceUpdate() 2022 setTimeout(() => { 2023 popup.classList.remove('becoming') 2024 }, 10) 2025 } 2026 2027 const hidePopup = () => { 2028 if (!isVisible()) { 2029 return 2030 } 2031 popup.addEventListener('transitionend', () => { 2032 popup.classList.remove('visible') 2033 popup.classList.remove('becoming') 2034 }, {once: true}) 2035 popup.classList.add('becoming') 2036 } 2037 2038 const isVisible = () => { 2039 return popup.classList.contains('visible') 2040 } 2041 2042 const renderProgress = () => { 2043 const loading = document.createElement('div') 2044 loading.classList.add('progress') 2045 const ind = document.createElement('img') 2046 ind.setAttribute('src', 'data:image/svg+xml,%3c%3fxml version=\'1.0\' encoding=\'UTF-8\'%3f%3e%3c!DOCTYPE svg PUBLIC \'-//W3C//DTD SVG 1.1//EN\' \'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\'%3e%3csvg xmlns=\'http://www.w3.org/2000/svg\' xmlns:xlink=\'http://www.w3.org/1999/xlink\' version=\'1.1\' id=\'mdi-refresh-circle\' width=\'24\' height=\'24\' viewBox=\'0 0 24 24\'%3e%3cpath d=\'M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2M18 11H13L14.81 9.19A3.94 3.94 0 0 0 12 8A4 4 0 1 0 15.86 13H17.91A6 6 0 1 1 12 6A5.91 5.91 0 0 1 16.22 7.78L18 6Z\' /%3e%3c/svg%3e') 2047 ind.classList.add('indicator') 2048 loading.appendChild(ind) 2049 popup.innerHTML = '' 2050 popup.appendChild(loading) 2051 } 2052 2053 const renderError = err => { 2054 const error = document.createElement('div') 2055 error.classList.add('error') 2056 2057 const msg = document.createElement('div') 2058 msg.classList.add('message') 2059 msg.innerText = 'Sorry, an unexpected error occurred: ' 2060 2061 const details = document.createElement('div') 2062 details.classList.add('message') 2063 details.innerText = err.toString() 2064 2065 error.appendChild(msg) 2066 error.appendChild(details) 2067 2068 const reload = document.createElement('button') 2069 reload.classList.add('button') 2070 reload.classList.add('small') 2071 reload.innerText = 'Try again' 2072 2073 reload.addEventListener('click', ev => { 2074 ev.preventDefault() 2075 hidePopup() 2076 setTimeout(() => { 2077 render() 2078 }, 200) 2079 }) 2080 2081 error.appendChild(reload) 2082 2083 popup.innerHTML = '' 2084 popup.appendChild(error) 2085 } 2086 2087 const renderControls = meta => { 2088 2089 const filterProp = getComputedStyle(el).getPropertyValue('--OMNI-CONTROLS') 2090 let filters = [] 2091 if( filterProp ) { 2092 filters = filterProp.split(',') 2093 filters = filters.map( f => f.trim() ) 2094 } 2095 if( filters.length == 1 && ( filters[0] === '' || filters[0] === 'all' )) { 2096 filters = [] 2097 } 2098 2099 popup.innerHTML = '' 2100 let numControls = 0
2101 meta.controls.forEach(c => { 2102 const skip = filters.length > 0 && filters.find( f => { 2103 if( !f ) return false 2104 if( f.startsWith('-') && f.substring(1) === c.name ) { 2105 return true // skip 2106 } 2107 else if( f === c.name ) { 2108 return false 2109 } 2110 else { 2111 if( filters[0].startsWith('-')) { 2112 return false 2113 } 2114 else { 2115 return true 2116 } 2117 } 2118 }) 2119 2120 if( skip ) { 2121 return 2122 } 2123 2124 const control = Control(c, selections.values(), selections.change, selections.remove) 2125 if( control ) { 2126 popup.appendChild(control) 2127 numControls++ 2128 } 2129 }) 2130 if( numControls === 1 ) { 2131 popup.querySelector('.content-outer').style.height = 'auto' 2132 popup.querySelector( '.heading' ).classList.add('fixed'); 2133 } 2134 } 2135 2136 const render = () => { 2137 2138 let timer = setTimeout(() => { 2139 renderProgress() 2140 showPopup() 2141 popper.forceUpdate() 2142 timer = null 2143 }, 300) 2144 2145 metadataFetcher().then(meta => { 2146 renderControls(meta) 2147 }).catch(err => { 2148 console.error( err ) 2149 renderError(err) 2150 }).finally(() => { 2151 if (timer) { 2152 clearTimeout(timer) 2153 timer = null 2154 showPopup() 2155 } 2156 else { 2157 popper.forceUpdate() 2158 } 2159 }) 2160 } 2161 2162 2163 el.addEventListener('click', () => { 2164 isVisible() ? hidePopup() : render() 2165 }) 2166 2167 const clickAway = ev => { 2168 // const html = document.querySelector('html') 2169 console.log( 'clickaway', ev.target ) 2170 if( popup.contains(ev.target) ) { 2171 return 2172 } 2173 // if (ev.target && ev.target.closest('.control-panel')) { 2174 // return 2175 // } 2176 hidePopup() 2177 } 2178 document.querySelector('html').addEventListener('mousedown', clickAway) 2179 2180 const debug = (event) => { 2181 console.log( 'fired', event ) 2182 } 2183 document.addEventListener('touchstart', debug) 2184 document.addEventListener('touchmove', debug) 2185 document.addEventListener('touchend', debug) 2186 document.addEventListener('touchcancel', debug) 2187 } 2188 2189 function OmniboxForm(el) { 2190 2191 if (el.__omniInited) { 2192 return 2193 } 2194 2195 el.__omniInited = true 2196 el.classList.add('inited') 2197 2198 const accountId = parseInt(el.getAttribute('data-account')) || 0 2199 const context = el.getAttribute('data-context') || 'recip' 2200 const listingType = el.querySelector('input[name=listingType]').value || 'AUTO' 2201 2202 const isImmediateSearch = el.getAttribute('data-immediate') === 'true' 2203 2204 const metadataFetcher = () => { 2205 return Metadata(accountId, listingType, context ) 2206 } 2207 // prime the meta 2208 metadataFetcher() 2209 2210 const selections = Selections(el.querySelector('[data-rel=selections]')) 2211 2212 const omniElem = el.querySelector('[data-rel=omni]') 2213 if (omniElem) { 2214 const typeahead = Typeahead(omniElem, accountId) 2215 typeahead.onSelect(data => { 2216 const toadd = { 2217 ...data, 2218 label: data.label, 2219 value: data.value + '[' + data.label + ']', 2220 } 2221 if (data.isAddressOrMlsNum) { 2222 selections.clearNonMlsOrAddress() 2223 selections.add('omni', toadd) 2224 } else { 2225 selections.add('omni', toadd) 2226 } 2227 2228 if( isImmediateSearch ) { 2229 const submitButton = el.closest('form').querySelector('[type=submit]') 2230 if (submitButton) { 2231 submitButton.click() 2232 } 2233 } 2234 }) 2235 } 2236 2237 const triggers = el.querySelectorAll('[data-omni-trigger]:not([data-omni-trigger=\"\"])').forEach(t => { 2238 ControlPanel(t, metadataFetcher, selections ) 2239 }) 2240 2241 return {} 2242 } 2243
2244 function init() { 2245 document.querySelectorAll('.omnibox-form').forEach(el => { 2246 OmniboxForm(el) 2247 }) 2248 } 2249 2250 document.addEventListener('DOMContentLoaded', init) 2251 2252 _G.reinitHandlers.push(init) 2253})(); 2254 2255/* ==== INCLUDE: /js/blocks/nouislider.14.6.2.min.js ==== */ 2256 2257/*! nouislider - 14.6.2 - 9/16/2020 */ 2258!function(t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.noUiSlider=t()}(function(){"use strict";var lt="14.6.2";function ut(t){t.parentElement.removeChild(t)}function a(t){return null!=t}function ct(t){t.preventDefault()}function o(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function pt(t,e,r){0<r&&(ht(t,e),setTimeout(function(){mt(t,e)},r))}function ft(t){return Math.max(Math.min(t,100),0)}function dt(t){return Array.isArray(t)?t:[t]}function e(t){var e=(t=String(t)).split(".");return 1<e.length?e[1].length:0}function ht(t,e){t.classList&&!/\s/.test(e)?t.classList.add(e):t.className+=" "+e}function mt(t,e){t.classList&&!/\s/.test(e)?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," ")}function gt(t){var e=void 0!==window.pageXOffset,r="CSS1Compat"===(t.compatMode||"");return{x:e?window.pageXOffset:r?t.documentElement.scrollLeft:t.body.scrollLeft,y:e?window.pageYOffset:r?t.documentElement.scrollTop:t.body.scrollTop}}function c(t,e){return 100/(e-t)}function p(t,e,r){return 100*e/(t[r+1]-t[r])}function f(t,e){for(var r=1;t>=e[r];)r+=1;return r}function r(t,e,r){if(r>=t.slice(-1)[0])return 100;var n,i,o=f(r,t),s=t[o-1],a=t[o],l=e[o-1],u=e[o];return l+(i=r,p(n=[s,a],n[0]<0?i+Math.abs(n[0]):i-n[0],0)/c(l,u))}function n(t,e,r,n){if(100===n)return n;var i,o,s=f(n,t),a=t[s-1],l=t[s];return r?(l-a)/2<n-a?l:a:e[s-1]?t[s-1]+(i=n-t[s-1],o=e[s-1],Math.round(i/o)*o):n}function s(t,e,r){var n;if("number"==typeof e&&(e=[e]),!Array.isArray(e))throw new Error("noUiSlider ("+lt+"): 'range' contains invalid value.");if(!o(n="min"===t?0:"max"===t?100:parseFloat(t))||!o(e[0]))throw new Error("noUiSlider ("+lt+"): 'range' value isn't numeric.");r.xPct.push(n),r.xVal.push(e[0]),n?r.xSteps.push(!isNaN(e[1])&&e[1]):isNaN(e[1])||(r.xSteps[0]=e[1]),r.xHighestCompleteStep.push(0)}function l(t,e,r){if(e)if(r.xVal[t]!==r.xVal[t+1]){r.xSteps[t]=p([r.xVal[t],r.xVal[t+1]],e,0)/c(r.xPct[t],r.xPct[t+1]);var n=(r.xVal[t+1]-r.xVal[t])/r.xNumSteps[t],i=Math.ceil(Number(n.toFixed(3))-1),o=r.xVal[t]+r.xNumSteps[t]*i;r.xHighestCompleteStep[t]=o}else r.xSteps[t]=r.xHighestCompleteStep[t]=r.xVal[t]}function i(t,e,r){var n;this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.xHighestCompleteStep=[],this.snap=e;var i=[];for(n in t)t.hasOwnProperty(n)&&i.push([t[n],n]);for(i.length&&"object"==typeof i[0][0]?i.sort(function(t,e){return t[0][0]-e[0][0]}):i.sort(function(t,e){return t[0]-e[0]}),n=0;n<i.length;n++)s(i[n][1],i[n][0],this);for(this.xNumSteps=this.xSteps.slice(0),n=0;n<this.xNumSteps.length;n++)l(n,this.xNumSteps[n],this)}i.prototype.getDistance=function(t){var e,r=[];for(e=0;e<this.xNumSteps.length-1;e++){var n=this.xNumSteps[e];if(n&&t/n%1!=0)throw new Error("noUiSlider ("+lt+"): 'limit', 'margin' and 'padding' of "+this.xPct[e]+"% range must be divisible by step.");r[e]=p(this.xVal,t,e)}return r},i.prototype.getAbsoluteDistance=function(t,e,r){var n,i=0;if(t<this.xPct[this.xPct.length-1])for(;t>this.xPct[i+1];)i++;else t===this.xPct[this.xPct.length-1]&&(i=this.xPct.length-2);r||t!==this.xPct[i+1]||i++;var o=1,s=e[i],a=0,l=0,u=0,c=0;for(n=r?(t-this.xPct[i])/(this.xPct[i+1]-this.xPct[i]):(this.xPct[i+1]-t)/(this.xPct[i+1]-this.xPct[i]);0<s;)a=this.xPct[i+1+c]-this.xPct[i+c],100<e[i+c]*o+100-100*n?(l=a*n,o=(s-100*n)/e[i+c],n=1):(l=e[i+c]*a/100*o,o=0),r?(u-=l,1<=this.xPct.length+c&&c--):(u+=l,1<=this.xPct.length-c&&c++),s=e[i+c]*o;return t+u},i.prototype.toStepping=function(t){return t=r(this.xVal,this.xPct,t)},i.prototype.fromStepping=function(t){return function(t,e,r){if(100<=r)return t.slice(-1)[0];var n,i=f(r,e),o=t[i-1],s=t[i],a=e[i-1],l=e[i];return n=[o,s],(r-a)*c(a,l)*(n[1]-n[0])/100+n[0]}(this.xVal,this.xPct,t)},i.prototype.getStep=function(t){return t=n(this.xPct,this.xSteps,this.snap,t)},i.prototype.getDefaultStep=function(t,e,r){var n=f(t,this.xPct);return(100===t||e&&t===this.xPct[n-1])&&(n=Math.max(n-1,1)),(this.xVal[n]-this.xVal[n-1])/r},i.prototype.getNearbySteps=function(t){var e=f(t,this.xPct);return{stepBefore:{startValue:this.xVal[e-2],step:this.xNumSteps[e-2],highestStep:this.xHighestCompleteStep[e-2]},thisStep:{startValue:this.xVal[e-1],step:this.xNumSteps[e-1],highestStep:this.xHighestCompleteStep[e-1]},stepAfter:{startValue:this.xVal[e],step:this.xNumSteps[e],highestStep:this.xHighestCompleteStep[e]}}},i.prototype.countStepDecimals=function(){var t=this.xNumSteps.map(e);return Math.max.apply(null,t)}
2258,i.prototype.convert=function(t){return this.getStep(this.toStepping(t))};var u={to:function(t){return void 0!==t&&t.toFixed(2)},from:Number},d={target:"target",base:"base",origin:"origin",handle:"handle",handleLower:"handle-lower",handleUpper:"handle-upper",touchArea:"touch-area",horizontal:"horizontal",vertical:"vertical",background:"background",connect:"connect",connects:"connects",ltr:"ltr",rtl:"rtl",textDirectionLtr:"txt-dir-ltr",textDirectionRtl:"txt-dir-rtl",draggable:"draggable",drag:"state-drag",tap:"state-tap",active:"active",tooltip:"tooltip",pips:"pips",pipsHorizontal:"pips-horizontal",pipsVertical:"pips-vertical",marker:"marker",markerHorizontal:"marker-horizontal",markerVertical:"marker-vertical",markerNormal:"marker-normal",markerLarge:"marker-large",markerSub:"marker-sub",value:"value",valueHorizontal:"value-horizontal",valueVertical:"value-vertical",valueNormal:"value-normal",valueLarge:"value-large",valueSub:"value-sub"};function h(t){if("object"==typeof(e=t)&&"function"==typeof e.to&&"function"==typeof e.from)return!0;var e;throw new Error("noUiSlider ("+lt+"): 'format' requires 'to' and 'from' methods.")}function m(t,e){if(!o(e))throw new Error("noUiSlider ("+lt+"): 'step' is not numeric.");t.singleStep=e}function g(t,e){if(!o(e))throw new Error("noUiSlider ("+lt+"): 'keyboardPageMultiplier' is not numeric.");t.keyboardPageMultiplier=e}function v(t,e){if(!o(e))throw new Error("noUiSlider ("+lt+"): 'keyboardDefaultStep' is not numeric.");t.keyboardDefaultStep=e}function b(t,e){if("object"!=typeof e||Array.isArray(e))throw new Error("noUiSlider ("+lt+"): 'range' is not an object.");if(void 0===e.min||void 0===e.max)throw new Error("noUiSlider ("+lt+"): Missing 'min' or 'max' in 'range'.");if(e.min===e.max)throw new Error("noUiSlider ("+lt+"): 'range' 'min' and 'max' cannot be equal.");t.spectrum=new i(e,t.snap,t.singleStep)}function x(t,e){if(e=dt(e),!Array.isArray(e)||!e.length)throw new Error("noUiSlider ("+lt+"): 'start' option is incorrect.");t.handles=e.length,t.start=e}function S(t,e){if("boolean"!=typeof(t.snap=e))throw new Error("noUiSlider ("+lt+"): 'snap' option must be a boolean.")}function w(t,e){if("boolean"!=typeof(t.animate=e))throw new Error("noUiSlider ("+lt+"): 'animate' option must be a boolean.")}function y(t,e){if("number"!=typeof(t.animationDuration=e))throw new Error("noUiSlider ("+lt+"): 'animationDuration' option must be a number.")}function E(t,e){var r,n=[!1];if("lower"===e?e=[!0,!1]:"upper"===e&&(e=[!1,!0]),!0===e||!1===e){for(r=1;r<t.handles;r++)n.push(e);n.push(!1)}else{if(!Array.isArray(e)||!e.length||e.length!==t.handles+1)throw new Error("noUiSlider ("+lt+"): 'connect' option doesn't match handle count.");n=e}t.connect=n}function C(t,e){switch(e){case"horizontal":t.ort=0;break;case"vertical":t.ort=1;break;default:throw new Error("noUiSlider ("+lt+"): 'orientation' option is invalid.")}}function P(t,e){if(!o(e))throw new Error("noUiSlider ("+lt+"): 'margin' option must be numeric.");0!==e&&(t.margin=t.spectrum.getDistance(e))}function N(t,e){if(!o(e))throw new Error("noUiSlider ("+lt+"): 'limit' option must be numeric.");if(t.limit=t.spectrum.getDistance(e),!t.limit||t.handles<2)throw new Error("noUiSlider ("+lt+"): 'limit' option is only supported on linear sliders with 2 or more handles.")}function k(t,e){var r;if(!o(e)&&!Array.isArray(e))throw new Error("noUiSlider ("+lt+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(Array.isArray(e)&&2!==e.length&&!o(e[0])&&!o(e[1]))throw new Error("noUiSlider ("+lt+"): 'padding' option must be numeric or array of exactly 2 numbers.");if(0!==e){for(Array.isArray(e)||(e=[e,e]),t.padding=[t.spectrum.getDistance(e[0]),t.spectrum.getDistance(e[1])],r=0;r<t.spectrum.xNumSteps.length-1;r++)if(t.padding[0][r]<0||t.padding[1][r]<0)throw new Error("noUiSlider ("+lt+"): 'padding' option must be a positive number(s).");var n=e[0]+e[1],i=t.spectrum.xVal[0];if(1<n/(t.spectrum.xVal[t.spectrum.xVal.length-1]-i))throw new Error("noUiSlider ("+lt+"): 'padding' option must not exceed 100% of the range.")}}function U(t,e){switch(e){case"ltr":t.dir=0;break;case"rtl":t.dir=1;break;default:throw new Error("noUiSlider ("+lt+"): 'direction' option was not recognized.")}}function A(t,e){if("string"!=typeof e)throw new Error("noUiSlider ("+lt+"): 'behaviour' must be a string containing options.");var r=0<=e.indexOf("tap"),n=0<=e.indexOf("drag"),i=0<=e.indexOf("fixed"),o=0<=e.indexOf("snap"),s=0<=e.indexOf("hover"),a=0<=e.indexOf("unconstrained");if(i){if(2!==t.handles)throw new Error("noUiSlider ("+lt+"): 'fixed' behaviour must be used with 2 handles");P(t,t.start[1]-t.start[0])}if(a&&(t.margin||t.limit))throw new Error("noUiSlider ("+lt+"): 'unconstrained' behaviour cannot be used with margin or limit");t.events={tap:r||o,drag:n,fixed:i,snap:o,hover:s,unconstrained:a}}function V(t,e){if(!1!==e)if(!0===e){t.tooltips=[];for(var r=0;r<t.handles;r++)t.tooltips.push(!0)}else{if(t.tooltips=dt(e),t.tooltips.length!==t.handles)throw new Error("noUiSlider ("+lt+"): must pass a formatter for all handles.");t.tooltips.forEach(function(t){if("boolean"!=typeof t&&("object"!=typeof t||"function"!=typeof t.to))throw new Error("noUiSlider ("+lt+"): 'tooltips' must be passed a formatter or 'false'.")})}}function D(t,e){h(t.ariaFormat=e)}function M(t,e){h(t.format=e)}function O(t,e){if("boolean"!=typeof(t.keyboardSupport=e))throw new Error("noUiSlider ("+lt+"): 'keyboardSupport' option must be a boolean.")}function L(t,e){t.documentElement=e}function z(t,e){if("string"!=typeof e&&!1!==e)throw new Error("noUiSlider ("+lt+"): 'cssPrefix' must be a string or `false`.");t.cssPrefix=e}function H(t,e){if("object"!=typeof e)throw new Error("noUiSlider ("+lt+"): 'cssClasse
2258s' must be an object.");if("string"==typeof t.cssPrefix)for(var r in t.cssClasses={},e)e.hasOwnProperty(r)&&(t.cssClasses[r]=t.cssPrefix+e[r]);else t.cssClasses=e}function vt(e){var r={margin:0,limit:0,padding:0,animate:!0,animationDuration:300,ariaFormat:u,format:u},n={step:{r:!1,t:m},keyboardPageMultiplier:{r:!1,t:g},keyboardDefaultStep:{r:!1,t:v},start:{r:!0,t:x},connect:{r:!0,t:E},direction:{r:!0,t:U},snap:{r:!1,t:S},animate:{r:!1,t:w},animationDuration:{r:!1,t:y},range:{r:!0,t:b},orientation:{r:!1,t:C},margin:{r:!1,t:P},limit:{r:!1,t:N},padding:{r:!1,t:k},behaviour:{r:!0,t:A},ariaFormat:{r:!1,t:D},format:{r:!1,t:M},tooltips:{r:!1,t:V},keyboardSupport:{r:!0,t:O},documentElement:{r:!1,t:L},cssPrefix:{r:!0,t:z},cssClasses:{r:!0,t:H}},i={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal",keyboardSupport:!0,cssPrefix:"noUi-",cssClasses:d,keyboardPageMultiplier:5,keyboardDefaultStep:10};e.format&&!e.ariaFormat&&(e.ariaFormat=e.format),Object.keys(n).forEach(function(t){if(!a(e[t])&&void 0===i[t]){if(n[t].r)throw new Error("noUiSlider ("+lt+"): '"+t+"' is required.");return!0}n[t].t(r,a(e[t])?e[t]:i[t])}),r.pips=e.pips;var t=document.createElement("div"),o=void 0!==t.style.msTransform,s=void 0!==t.style.transform;r.transformRule=s?"transform":o?"msTransform":"webkitTransform";return r.style=[["left","top"],["right","bottom"]][r.dir][r.ort],r}function j(t,b,o){var l,u,s,c,i,a,e,p,f=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},d=window.CSS&&CSS.supports&&CSS.supports("touch-action","none")&&function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e)}catch(t){}return t}(),h=t,y=b.spectrum,x=[],S=[],m=[],g=0,v={},w=t.ownerDocument,E=b.documentElement||w.documentElement,C=w.body,P=-1,N=0,k=1,U=2,A="rtl"===w.dir||1===b.ort?0:100;function V(t,e){var r=w.createElement("div");return e&&ht(r,e),t.appendChild(r),r}function D(t,e){var r=V(t,b.cssClasses.origin),n=V(r,b.cssClasses.handle);return V(n,b.cssClasses.touchArea),n.setAttribute("data-handle",e),b.keyboardSupport&&(n.setAttribute("tabindex","0"),n.addEventListener("keydown",function(t){return function(t,e){if(O()||L(e))return!1;var r=["Left","Right"],n=["Down","Up"],i=["PageDown","PageUp"],o=["Home","End"];b.dir&&!b.ort?r.reverse():b.ort&&!b.dir&&(n.reverse(),i.reverse());var s,a=t.key.replace("Arrow",""),l=a===i[0],u=a===i[1],c=a===n[0]||a===r[0]||l,p=a===n[1]||a===r[1]||u,f=a===o[0],d=a===o[1];if(!(c||p||f||d))return!0;if(t.preventDefault(),p||c){var h=b.keyboardPageMultiplier,m=c?0:1,g=at(e),v=g[m];if(null===v)return!1;!1===v&&(v=y.getDefaultStep(S[e],c,b.keyboardDefaultStep)),(u||l)&&(v*=h),v=Math.max(v,1e-7),v*=c?-1:1,s=x[e]+v}else s=d?b.spectrum.xVal[b.spectrum.xVal.length-1]:b.spectrum.xVal[0];return rt(e,y.toStepping(s),!0,!0),J("slide",e),J("update",e),J("change",e),J("set",e),!1}(t,e)})),n.setAttribute("role","slider"),n.setAttribute("aria-orientation",b.ort?"vertical":"horizontal"),0===e?ht(n,b.cssClasses.handleLower):e===b.handles-1&&ht(n,b.cssClasses.handleUpper),r}function M(t,e){return!!e&&V(t,b.cssClasses.connect)}function r(t,e){return!!b.tooltips[e]&&V(t.firstChild,b.cssClasses.tooltip)}function O(){return h.hasAttribute("disabled")}function L(t){return u[t].hasAttribute("disabled")}function z(){i&&(G("update.tooltips"),i.forEach(function(t){t&&ut(t)}),i=null)}function H(){z(),i=u.map(r),$("update.tooltips",function(t,e,r){if(i[e]){var n=t[e];!0!==b.tooltips[e]&&(n=b.tooltips[e].to(r[e])),i[e].innerHTML=n}})}function j(e,i,o){var s=w.createElement("div"),a=[];a[N]=b.cssClasses.valueNormal,a[k]=b.cssClasses.valueLarge,a[U]=b.cssClasses.valueSub;var l=[];l[N]=b.cssClasses.markerNormal,l[k]=b.cssClasses.markerLarge,l[U]=b.cssClasses.markerSub;var u=[b.cssClasses.valueHorizontal,b.cssClasses.valueVertical],c=[b.cssClasses.markerHorizontal,b.cssClasses.markerVertical];
2258function p(t,e){var r=e===b.cssClasses.value,n=r?a:l;return e+" "+(r?u:c)[b.ort]+" "+n[t]}return ht(s,b.cssClasses.pips),ht(s,0===b.ort?b.cssClasses.pipsHorizontal:b.cssClasses.pipsVertical),Object.keys(e).forEach(function(t){!function(t,e,r){if((r=i?i(e,r):r)!==P){var n=V(s,!1);n.className=p(r,b.cssClasses.marker),n.style[b.style]=t+"%",N<r&&((n=V(s,!1)).className=p(r,b.cssClasses.value),n.setAttribute("data-value",e),n.style[b.style]=t+"%",n.innerHTML=o.to(e))}}(t,e[t][0],e[t][1])}),s}function F(){c&&(ut(c),c=null)}function R(t){F();var m,g,v,b,e,r,x,S,w,n=t.mode,i=t.density||1,o=t.filter||!1,s=function(t,e,r){if("range"===t||"steps"===t)return y.xVal;if("count"===t){if(e<2)throw new Error("noUiSlider ("+lt+"): 'values' (>= 2) required for mode 'count'.");var n=e-1,i=100/n;for(e=[];n--;)e[n]=n*i;e.push(100),t="positions"}return"positions"===t?e.map(function(t){return y.fromStepping(r?y.getStep(t):t)}):"values"===t?r?e.map(function(t){return y.fromStepping(y.getStep(y.toStepping(t)))}):e:void 0}(n,t.values||!1,t.stepped||!1),a=(m=i,g=n,v=s,b={},e=y.xVal[0],r=y.xVal[y.xVal.length-1],S=x=!1,w=0,(v=v.slice().sort(function(t,e){return t-e}).filter(function(t){return!this[t]&&(this[t]=!0)},{}))[0]!==e&&(v.unshift(e),x=!0),v[v.length-1]!==r&&(v.push(r),S=!0),v.forEach(function(t,e){var r,n,i,o,s,a,l,u,c,p,f=t,d=v[e+1],h="steps"===g;if(h&&(r=y.xNumSteps[e]),r||(r=d-f),!1!==f)for(void 0===d&&(d=f),r=Math.max(r,1e-7),n=f;n<=d;n=(n+r).toFixed(7)/1){for(u=(s=(o=y.toStepping(n))-w)/m,p=s/(c=Math.round(u)),i=1;i<=c;i+=1)b[(a=w+i*p).toFixed(5)]=[y.fromStepping(a),0];l=-1<v.indexOf(n)?k:h?U:N,!e&&x&&n!==d&&(l=0),n===d&&S||(b[o.toFixed(5)]=[n,l]),w=o}}),b),l=t.format||{to:Math.round};return c=h.appendChild(j(a,o,l))}function T(){var t=l.getBoundingClientRect(),e="offset"+["Width","Height"][b.ort];return 0===b.ort?t.width||l[e]:t.height||l[e]}function B(n,i,o,s){var e=function(t){return!!(t=function(t,e,r){var n,i,o=0===t.type.indexOf("touch"),s=0===t.type.indexOf("mouse"),a=0===t.type.indexOf("pointer");0===t.type.indexOf("MSPointer")&&(a=!0);if("mousedown"===t.type&&!t.buttons&&!t.touches)return!1;if(o){var l=function(t){return t.target===r||r.contains(t.target)||t.target.shadowRoot&&t.target.shadowRoot.contains(r)};if("touchstart"===t.type){var u=Array.prototype.filter.call(t.touches,l);if(1<u.length)return!1;n=u[0].pageX,i=u[0].pageY}else{var c=Array.prototype.find.call(t.changedTouches,l);if(!c)return!1;n=c.pageX,i=c.pageY}}e=e||gt(w),(s||a)&&(n=t.clientX+e.x,i=t.clientY+e.y);return t.pageOffset=e,t.points=[n,i],t.cursor=s||a,t}(t,s.pageOffset,s.target||i))&&(!(O()&&!s.doNotReject)&&(e=h,r=b.cssClasses.tap,!((e.classList?e.classList.contains(r):new RegExp("\\b"+r+"\\b").test(e.className))&&!s.doNotReject)&&(!(n===f.start&&void 0!==t.buttons&&1<t.buttons)&&((!s.hover||!t.buttons)&&(d||t.preventDefault(),t.calcPoint=t.points[b.ort],void o(t,s))))));var e,r},r=[];return n.split(" ").forEach(function(t){i.addEventListener(t,e,!!d&&{passive:!0}),r.push([t,e])}),r}function q(t){var e,r,n,i,o,s,a=100*(t-(e=l,r=b.ort,n=e.getBoundingClientRect(),i=e.ownerDocument,o=i.documentElement,s=gt(i),/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(s.x=0),r?n.top+s.y-o.clientTop:n.left+s.x-o.clientLeft))/T();return a=ft(a),b.dir?100-a:a}function X(t,e){"mouseout"===t.type&&"HTML"===t.target.nodeName&&null===t.relatedTarget&&_(t,e)}function Y(t,e){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===t.buttons&&0!==e.buttonsProperty)return _(t,e);var r=(b.dir?-1:1)*(t.calcPoint-e.startCalcPoint);Z(0<r,100*r/e.baseSize,e.locations,e.handleNumbers)}function _(t,e){e.handle&&(mt(e.handle,b.cssClasses.active),g-=1),e.listeners.forEach(function(t){E.removeEventListener(t[0],t[1])}),0===g&&(mt(h,b.cssClasses.drag),et(),t.cursor&&(C.style.cursor="",C.removeEventListener("selectstart",ct))),e.handleNumbers.forEach(function(t){J("change",t),J("set",t),J("end",t)})}function I(t,e){if(e.handleNumbers.some(L))return!1;var r;1===e.handleNumbers.length&&(r=u[e.handleNumbers[0]].children[0],g+=1,ht(r,b.cssClasses.active));t.stopPropagation();var n=[],i=B(f.move,E,Y,{target:t.target,handle:r,listeners:n,startCalcPoint:t.calcPoint,baseSize:T(),pageOffset:t.pageOffset,handleNumbers:e.handleNumbers,buttonsProperty:t.buttons,locations:S.slice()}),o=B(f.end,E,_,{target:t.target,handle:r,listeners:n,doNotReject:!0,handleNumbers:e.handleNumbers}),s=B("mouseout",E,X,{target:t.target,handle:r,listeners:n,doNotReject:!0,handleNumbers:e.handleNumbers});n.push.apply(n,i.concat(o,s)),t.cursor&&(C.style.cursor=getComputedStyle(t.target).cursor,1<u.length&&ht(h,b.cssClasse
2258s.drag),C.addEventListener("selectstart",ct,!1)),e.handleNumbers.forEach(function(t){J("start",t)})}function n(t){t.stopPropagation();var i,o,s,e=q(t.calcPoint),r=(i=e,s=!(o=100),u.forEach(function(t,e){if(!L(e)){var r=S[e],n=Math.abs(r-i);(n<o||n<=o&&r<i||100===n&&100===o)&&(s=e,o=n)}}),s);if(!1===r)return!1;b.events.snap||pt(h,b.cssClasses.tap,b.animationDuration),rt(r,e,!0,!0),et(),J("slide",r,!0),J("update",r,!0),J("change",r,!0),J("set",r,!0),b.events.snap&&I(t,{handleNumbers:[r]})}function W(t){var e=q(t.calcPoint),r=y.getStep(e),n=y.fromStepping(r);Object.keys(v).forEach(function(t){"hover"===t.split(".")[0]&&v[t].forEach(function(t){t.call(a,n)})})}function $(t,e){v[t]=v[t]||[],v[t].push(e),"update"===t.split(".")[0]&&u.forEach(function(t,e){J("update",e)})}function G(t){var n=t&&t.split(".")[0],i=n&&t.substring(n.length);Object.keys(v).forEach(function(t){var e=t.split(".")[0],r=t.substring(e.length);n&&n!==e||i&&i!==r||delete v[t]})}function J(r,n,i){Object.keys(v).forEach(function(t){var e=t.split(".")[0];r===e&&v[t].forEach(function(t){t.call(a,x.map(b.format.to),n,x.slice(),i||!1,S.slice(),a)})})}function K(t,e,r,n,i,o){var s;return 1<u.length&&!b.events.unconstrained&&(n&&0<e&&(s=y.getAbsoluteDistance(t[e-1],b.margin,0),r=Math.max(r,s)),i&&e<u.length-1&&(s=y.getAbsoluteDistance(t[e+1],b.margin,1),r=Math.min(r,s))),1<u.length&&b.limit&&(n&&0<e&&(s=y.getAbsoluteDistance(t[e-1],b.limit,0),r=Math.min(r,s)),i&&e<u.length-1&&(s=y.getAbsoluteDistance(t[e+1],b.limit,1),r=Math.max(r,s))),b.padding&&(0===e&&(s=y.getAbsoluteDistance(0,b.padding[0],0),r=Math.max(r,s)),e===u.length-1&&(s=y.getAbsoluteDistance(100,b.padding[1],1),r=Math.min(r,s))),!((r=ft(r=y.getStep(r)))===t[e]&&!o)&&r}function Q(t,e){var r=b.ort;return(r?e:t)+", "+(r?t:e)}function Z(t,n,r,e){var i=r.slice(),o=[!t,t],s=[t,!t];e=e.slice(),t&&e.reverse(),1<e.length?e.forEach(function(t,e){var r=K(i,t,i[t]+n,o[e],s[e],!1);!1===r?n=0:(n=r-i[t],i[t]=r)}):o=s=[!0];var a=!1;e.forEach(function(t,e){a=rt(t,r[t]+n,o[e],s[e])||a}),a&&e.forEach(function(t){J("update",t),J("slide",t)})}function tt(t,e){return b.dir?100-t-e:t}function et(){m.forEach(function(t){var e=50<S[t]?-1:1,r=3+(u.length+e*t);u[t].style.zIndex=r})}function rt(t,e,r,n,i){return i||(e=K(S,t,e,r,n,!1)),!1!==e&&(function(t,e){S[t]=e,x[t]=y.fromStepping(e);var r="translate("+Q(10*(tt(e,0)-A)+"%","0")+")";u[t].style[b.transformRule]=r,nt(t),nt(t+1)}(t,e),!0)}function nt(t){if(s[t]){var e=0,r=100;0!==t&&(e=S[t-1]),t!==s.length-1&&(r=S[t]);var n=r-e,i="translate("+Q(tt(e,n)+"%","0")+")",o="scale("+Q(n/100,"1")+")";s[t].style[b.transformRule]=i+" "+o}}function it(t,e){return null===t||!1===t||void 0===t?S[e]:("number"==typeof t&&(t=String(t)),t=b.format.from(t),!1===(t=y.toStepping(t))||isNaN(t)?S[e]:t)}function ot(t,e,r){var n=dt(t),i=void 0===S[0];e=void 0===e||!!e,b.animate&&!i&&pt(h,b.cssClasses.tap,b.animationDuration),m.forEach(function(t){rt(t,it(n[t],t),!0,!1,r)});for(var o=1===m.length?0:1;o<m.length;++o)m.forEach(function(t){rt(t,S[t],!0,!0,r)});et(),m.forEach(function(t){J("update",t),null!==n[t]&&e&&J("set",t)})}function st(){var t=x.map(b.format.to);return 1===t.length?t[0]:t}function at(t){var e=S[t],r=y.getNearbySteps(e),n=x[t],i=r.thisStep.step,o=null;if(b.snap)return[n-r.stepBefore.startValue||null,r.stepAfter.startValue-n||null];!1!==i&&n+i>r.stepAfter.startValue&&(i=r.stepAfter.startValue-n),o=n>r.thisStep.startValue?r.thisStep.step:!1!==r.stepBefore.step&&n-r.stepBefore.highestStep,100===e?i=null:0===e&&(o=null);var s=y.countStepDecimals();return null!==i&&!1!==i&&(i=Number(i.toFixed(s))),null!==o&&!1!==o&&(o=Number(o.toFixed(s))),[o,i]}return ht(e=h,b.cssClasses.target),0===b.dir?ht(e,b.cssClasses.ltr):ht(e,b.cssClasses.rtl),0===b.ort?ht(e,b.cssClasses.horizontal):ht(e,b.cssClasses.vertical),ht(e,"rtl"===getComputedStyle(e).direction?b.cssClasses.textDirectionRtl:b.cssClasses.textDirectionLtr),l=V(e,b.cssClasses.base),function(t,e){var r=V(e,b.cssClasses.connects);u=[],(s=[]).push(M(r,t[0]));for(var n=0;n<b.handles;n++)u.push(D(e,n)),m[n]=n,s.push(M(r,t[n+1]))}(b.connect,l),(p=b.events).fixed||u.forEach(function(t,e){B(f.start,t.children[0],I,{handleNumbers:[e]})}),p.tap&&B(f.start,l,n,{}),p.hover&&B(f.move,l,W,{hover:!0}
2258),p.drag&&s.forEach(function(t,e){if(!1!==t&&0!==e&&e!==s.length-1){var r=u[e-1],n=u[e],i=[t];ht(t,b.cssClasses.draggable),p.fixed&&(i.push(r.children[0]),i.push(n.children[0])),i.forEach(function(t){B(f.start,t,I,{handles:[r,n],handleNumbers:[e-1,e]})})}}),ot(b.start),b.pips&&R(b.pips),b.tooltips&&H(),$("update",function(t,e,s,r,a){m.forEach(function(t){var e=u[t],r=K(S,t,0,!0,!0,!0),n=K(S,t,100,!0,!0,!0),i=a[t],o=b.ariaFormat.to(s[t]);r=y.fromStepping(r).toFixed(1),n=y.fromStepping(n).toFixed(1),i=y.fromStepping(i).toFixed(1),e.children[0].setAttribute("aria-valuemin",r),e.children[0].setAttribute("aria-valuemax",n),e.children[0].setAttribute("aria-valuenow",i),e.children[0].setAttribute("aria-valuetext",o)})}),a={destroy:function(){for(var t in b.cssClasses)b.cssClasses.hasOwnProperty(t)&&mt(h,b.cssClasses[t]);for(;h.firstChild;)h.removeChild(h.firstChild);delete h.noUiSlider},steps:function(){return m.map(at)},on:$,off:G,get:st,set:ot,setHandle:function(t,e,r,n){if(!(0<=(t=Number(t))&&t<m.length))throw new Error("noUiSlider ("+lt+"): invalid handle number, got: "+t);rt(t,it(e,t),!0,!0,n),J("update",t),r&&J("set",t)},reset:function(t){ot(b.start,t)},__moveHandles:function(t,e,r){Z(t,e,S,r)},options:o,updateOptions:function(e,t){var r=st(),n=["margin","limit","padding","range","animate","snap","step","format","pips","tooltips"];n.forEach(function(t){void 0!==e[t]&&(o[t]=e[t])});var i=vt(o);n.forEach(function(t){void 0!==e[t]&&(b[t]=i[t])}),y=i.spectrum,b.margin=i.margin,b.limit=i.limit,b.padding=i.padding,b.pips?R(b.pips):F(),b.tooltips?H():z(),S=[],ot(e.start||r,t)},target:h,removePips:F,removeTooltips:z,getTooltips:function(){return i},getOrigins:function(){return u},pips:R}}return{__spectrum:i,version:lt,cssClasses:d,create:function(t,e){if(!t||!t.nodeName)throw new Error("noUiSlider ("+lt+"): create requires a single element, got: "+t);if(t.noUiSlider)throw new Error("noUiSlider ("+lt+"): Slider was already initialized.");var r=j(t,vt(e),e);return t.noUiSlider=r}}}); 2259 2260/* ==== INCLUDE: /js/weblets/blog.js ==== */ 2261 2262 2263function toggle(divName){ 2264 2265 var row = document.getElementById(divName); 2266 var image = document.getElementById('img' + divName); 2267 2268 if(row.style.display == 'none'){ 2269 row.style.display = 'block'; 2270 image.src = '/img/collapseall.gif'; 2271 } 2272 else{ 2273 row.style.display = 'none'; 2274 image.src = '/img/expandall.gif'; 2275 } 2276 2277} 2278 2279function timestampToString(timestamp, skipTime) { 2280 if (timestamp) { 2281 var a = new Date(timestamp); 2282 var year = a.getFullYear(); 2283 var month = ''; 2284 if (skipTime) { 2285 var months = ['January','February','March','April','May','June','July','August','September','October','November','December']; 2286 month = months[a.getMonth()]; 2287 } else { 2288 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; 2289 month = months[a.getMonth()]; 2290 } 2291 var date = a.getDate(); 2292 if (skipTime) 2293 return month+' '+date+', '+year; 2294 var hour = a.getHours(); 2295 var min = a.getMinutes(); 2296 var am = ''; 2297 if (hour==0) { 2298 hour = 12; 2299 am = 'PM'; 2300 } else if (hour<=12) { 2301 am = 'AM'; 2302 } else { 2303 hour -= 12; 2304 am = 'PM'; 2305 } 2306 if (min<10) { 2307 min = "0"+min; 2308 } 2309 return month+' '+date+', '+year+' '+hour+':'+min+' '+am; 2310 } 2311 return ""; 2312} 2313 2314function updateAllTimestamps() { 2315 var dates = document.querySelectorAll( '.weblet_blog-date-friendly' ); 2316 for (var i=0; i<dates.length; i++) { 2317 var timestamp = dates[i].getAttribute('timestamp'); 2318 if (timestamp) { 2319 dates[i].innerHTML = timestampToString( parseInt( timestamp ), true ); 2320 } 2321 } 2322 dates = document.querySelectorAll( '.weblet_blog-date-full, .weblet_blog-comment-date-full' ); 2323 for (var i=0; i<dates.length; i++) { 2324 var timestamp = dates[i].getAttribute('timestamp'); 2325 if (timestamp) { 2326 dates[i].innerHTML = 'on '+timestampToString( parseInt( timestamp ) ); 2327 } 2328 } 2329} 2330 2331function updateListingBanners() { 2332 var banners = document.querySelectorAll( ".weblet_blog-entry-text .listing-banner" ); 2333 for( var i=0; i<banners.length; ++i ) { 2334 var article = banners[i].closest( ".weblet_blog-blog-entry"); 2335 if( article ) { 2336 var imageLink = article.querySelector( "a.weblet_blog-main-image-link" ); 2337 if( imageLink ) { 2338 imageLink.appendChild( banners[i] ); 2339 banners[i].classList.add( "ready" ); 2340 } 2341 } 2342 } 2343} 2344 2345function createScrollParallaxForBlogImages() { 2346 var images = document.querySelectorAll( ".blog-post-full .blog-with-parallax .weblet_blog-entry-image-container" ); 2347 for (i = 0; i < images.length; i++) { 2348 var p = document.createElement("div"); 2349 p.classList.add( "weblet_blog-entry-image-container-parallax"); 2350 p.classList.add( "with-scroll-parallax" ); 2351 images[i].appendChild(p); 2352 _G.parallaxService.add(p); 2353 } 2354} 2355 2356 2357function mrp_shareBlogWindow(target) { 2358 var url = target.getAttribute( "data-url" ); 2359 mrp_open_new_window( url, 600, 400, "share-blog-post" ); 2360} 2361 2362window.customOnLoads = window.customOnLoads || []; 2363 2364window.customOnLoads.push( function() {
2365 var images = document.querySelectorAll( ".blog-entry-list .weblet_blog-entry-image-container" ); 2366 for (i = 0; i < images.length; i++) { 2367 if( images[i].parentElement && images[i].parentElement.nodeName === 'A' ) { 2368 continue; 2369 } 2370 images[i].style.cursor = "pointer"; 2371 images[i].addEventListener( "click", function(ev,elem) { 2372 var url = ev.target.getAttribute( "data-link" ); 2373 if( url ) { 2374 window.location = url; 2375 } 2376 }); 2377 } 2378}); 2379 2380window.customOnLoads.push( function() { 2381 updateAllTimestamps(); 2382 updateListingBanners(); 2383 createScrollParallaxForBlogImages(); 2384}); 2385 2386 2387 2388 2389/* ==== INCLUDE: /js/weblets/responsive/blog-resp.js ==== */ 2390 2391;(function() { 2392 2393 function launchLightbox( thumb ) { 2394 var index = Array.prototype.indexOf.call(thumb.parentNode.childNodes, thumb); 2395 var lightbox = new FsLightbox() 2396 var sources = [] 2397 var captions = [] 2398 thumb.parentElement.querySelectorAll('img' ).forEach( function(img) { 2399 sources.push( img.getAttribute('src')) 2400 captions.push( img.getAttribute( 'alt') || '') 2401 }) 2402 lightbox.props.captions = captions 2403 lightbox.props.sources = sources 2404 lightbox.props.disableThumbs = true 2405 lightbox.props.slideChangeAnimation = 'slide-change-animation' 2406 lightbox.open(index || 0) 2407 } 2408 2409 function initThumb( el ) { 2410 if( el.getAttribute("inited") ) { 2411 return 2412 } 2413 el.setAttribute('inited', true ) 2414 el.addEventListener( 'click', function(event) { 2415 if( document.querySelector("html.editing")) { 2416 return; 2417 } 2418 launchLightbox(el) 2419 }) 2420 } 2421 2422 document.addEventListener( 'DOMContentLoaded', function() { 2423 document.querySelectorAll( '[data-type="gallery"] > img' ).forEach( function(el) { 2424 initThumb(el) 2425 }) 2426 }) 2427})(); 2428 2429/* ==== INCLUDE: /js/blocks/forms.js ==== */ 2430 2431;(function() { 2432 2433 // --- WAF attestation token (alpha) -------------------------------------- 2434 // Active only when the server emits window._wafTokenEndpoint (blank 2435 // waf.token.url in wps-application.properties = never emitted = inert). 2436 // Contract: never block, never break a submission -- any failure means no 2437 // token, the form submits exactly as before and the server scores "missing". 2438 const wafToken = (function() { 2439 let cached = null // { token, exp } 2440 let inflight = null 2441 2442 const endpoint = () => window._wafTokenEndpoint 2443 const fresh = () => cached && (cached.exp - 30) > Math.floor(Date.now() / 1000) 2444 2445 function request() { 2446 if( !endpoint() || !window.fetch ) { 2447 return Promise.resolve(null) 2448 } 2449 if( inflight ) { 2450 return inflight 2451 } 2452 const ctrl = window.AbortController ? new AbortController() : null 2453 const timer = ctrl && setTimeout( () => ctrl.abort(), 3000 ) 2454 inflight = fetch( endpoint(), { mode: 'cors', credentials: 'omit', 2455 signal: ctrl ? ctrl.signal : undefined } ) 2456 .then( r => r.ok ? r.json() : null ) 2457 .then( j => { 2458 if( j && j.token ) { 2459 cached = j 2460 } 2461 return j && j.token 2462 }) 2463 .catch( () => null ) // unreachable/CORS/timeout -> no token 2464 .finally( () => { 2465 if( timer ) clearTimeout(timer) 2466 inflight = null 2467 }) 2468 return inflight 2469 } 2470 2471 // mint on first interaction with any dynamic form; re-mint when stale 2472 document.addEventListener( 'focusin', ev => { 2473 if( endpoint() && ev.target.closest 2474 && ev.target.closest('.mrp-dynamic-form') && !fresh() ) { 2475 request() 2476 } 2477 }) 2478 2479 return { get: () => fresh() ? cached.token : null, request } 2480 })() 2481 2482 2483 function processSubmitResponse( origForm, html ) { 2484 2485 const targetFormEl = origForm.querySelector('[name=__targetForm]') 2486 if( !targetFormEl ) { 2487 console.error( "Failed to find __targetForm" ) 2488 return 2489 } 2490 2491 const targetForm = targetFormEl.getAttribute('value') 2492 2493 const htmlFragment = _G.createFragment(html) 2494 2495 const newTargetFormEl = htmlFragment.querySelector('[name=__targetForm][value="' + targetForm + '"]') 2496
2497 if( !newTargetFormEl ) { 2498 console.error( "Failed to find targetForm in the returned response" ) 2499 return 2500 } 2501 const newForm = newTargetFormEl.closest('form') 2502 // const newForm = _G.createFragment( html ).querySelector('form') 2503 newForm.querySelectorAll('.form-error').forEach( el => { 2504 el.remove() 2505 }) 2506 origForm.parentElement.replaceChild( newForm, origForm ) 2507 2508 setTimeout(function() { 2509 const firstError = newForm.querySelector('.control-error') 2510 if( firstError ) { 2511 const top = firstError.getBoundingClientRect().top 2512 if( top < 0 ) { 2513 window.scrollTo( {top: window.scrollY + top - 100, behavior: 'smooth'}) 2514 } 2515 } 2516 }, 50) 2517 } 2518 2519 _G.onSubmitForm = ( form, customCallback ) => { 2520 2521 let submitting = true 2522 2523 function submitFeedback( form ) { 2524 setTimeout( () => { 2525 2526 if( !submitting ) { 2527 return 2528 } 2529 const submit = form.querySelector( '[type=submit]') 2530 if( submit ) { 2531 // const submitText = submit.innerText; 2532 // submit.setAttribute('data-submit-text', submitText ) 2533 // submit.innerText = 'Sending' 2534 submit.classList.add('submitting') 2535 submit.setAttribute('disabled', 'disabled') 2536 } 2537 }, 100 ) 2538 } 2539 2540 function undoSubmitFeedback( form ) { 2541 // note that we are passing our original form, not the new replaced form 2542 // so this will only fire if there was a network issue and no form 2543 // arrived back; otherwise, the new form would have had reset submit anyways 2544 const submit = form.querySelector( '[type=submit]') 2545 if( submit ) { 2546 // submit.innerText = submit.getAttribute('data-submit-text') 2547 submit.classList.remove('submitting') 2548 submit.removeAttribute('disabled') 2549 } 2550 } 2551 2552 let authTk = form.getAttribute('data-tk') 2553 if( !authTk ) { 2554 // try hidden 2555 const hidden = form.querySelector('input[name=__sh]') 2556 if( hidden ) { 2557 authTk = hidden.getAttribute('value') 2558 } 2559 if( !authTk ) { 2560 // bail 2561 console.error( 'auth token missing' ) 2562 return 2563 } 2564 } 2565 2566 const data = new URLSearchParams() 2567 for (const pair of new FormData(form)) { 2568 data.append(pair[0], pair[1].toString()) 2569 } 2570 data.append( '__src_url', window.location.href ) 2571 data.append( '__sh', authTk ) 2572 2573 if( !wafToken.get() ) { 2574 wafToken.request() // last-chance mint; races the submit delay below 2575 } 2576 2577 submitFeedback( form ) 2578 2579 setTimeout( () => { 2580 const wafTk = wafToken.get() 2581 if( wafTk ) { 2582 data.append( '__waf_tk', wafTk ) 2583 } 2584 fetch( window.location.href, { 2585 method: 'post', 2586 body: data, 2587 headers: { 2588 'X-Requested-With': 'fetch', 2589 'X-Form-Submit': 'true', 2590 'X-Form-Submit-From': window.location.href, 2591 } 2592 }).then( response => { 2593 if( customCallback ) { 2594 return customCallback(response) 2595 } 2596 const redir = response.headers.get('Location') 2597 if( redir ) { 2598 return window.location = redir 2599 } 2600 response.text().then( html => { 2601 // console.log( 'form html', html ) 2602 2603 const error = response.headers.get('X-Form-Error') 2604 const successURL = response.headers.get( 'X-Success-URL') 2605 const success = response.headers.get( 'X-Success-Message' ) 2606 2607 if( !error && success && successURL ) { 2608 window.location = successURL 2609 return 2610 } 2611 2612 processSubmitResponse( form, html ) 2613 2614 if( error ) { 2615 _G.quickMessage(error, { error: true } ); 2616 } 2617 else if( success ) { 2618 _G.quickMessage(success) 2619 2620 if( window.dataLayer ) { 2621 window.dataLayer.push( { 2622 event: 'formSubmitted', 2623 formURL: window.location.href, 2624 title: document.title, 2625 formName: data.get( '__formName') || '' 2626 }) 2627 } 2628 2629 window.dispatchEvent( new CustomEvent( "mrp.webFormSubmitted", { 2630 detail: { 2631 formURL: window.location.href, 2632 title: document.title, 2633 formName: data.get( '__formName') || '' 2634 } 2635 })); 2636 } 2637 }) 2638 }).catch( err => { 2639 console.error( "error occurred during form submission", err ) 2640 _G.quickMessage('Error occurred during form submission', { error: true } ); 2641 }).finally( () => { 2642 submitting = false 2643 undoSubmitFeedback(form) 2644 }) 2645 }, 1000 ) 2646 2647 2648 return false;
2649 } 2650 2651 2652 function processBlogCommentSubmitResponse( origForm, html ) { 2653 2654 const formID = origForm.getAttribute("id"); 2655 2656 const htmlFragment = _G.createFragment(html) 2657 2658 const newForm = htmlFragment.querySelector('#' + formID) 2659 2660 // const successEl = newForm.querySelector(".form-success"); 2661 // if( successEl && successEl.innerText ) { 2662 // const message = successEl.innerText; 2663 // setTimeout(() => { 2664 // _G.quickMessage( message, { 2665 // 2666 // }); 2667 // }, 100 ); 2668 // successEl.remove(); 2669 // } 2670 2671 // const newForm = _G.createFragment( html ).querySelector('form') 2672 newForm.querySelectorAll('.form-error').forEach( el => { 2673 el.remove() 2674 }) 2675 const authTk = newForm.getAttribute("data-tk"); 2676 if( authTk ) { 2677 const authTkEl = document.createElement("input"); 2678 authTkEl.setAttribute( "type", "hidden" ); 2679 authTkEl.setAttribute( "value", authTk ); 2680 newForm.appendChild( authTkEl ); 2681 } 2682 const srcUrlEl = document.createElement("input"); 2683 srcUrlEl.setAttribute( "type", "hidden" ); 2684 srcUrlEl.setAttribute( "value", window.location.href ); 2685 newForm.appendChild( srcUrlEl ); 2686 origForm.parentElement.replaceChild( newForm, origForm ); 2687 2688 2689 setTimeout(function() { 2690 const firstError = newForm.querySelector('.control-error') 2691 if( firstError ) { 2692 const top = firstError.getBoundingClientRect().top 2693 if( top < 0 ) { 2694 window.scrollTo( {top: window.scrollY + top - 100, behavior: 'smooth'}) 2695 } 2696 } 2697 }, 50) 2698 } 2699 2700 _G.onBlogCommentSubmitForm = ( form, customCallback ) => { 2701 2702 let submitting = true 2703 2704 function submitFeedback( form ) { 2705 setTimeout( () => { 2706 2707 if( !submitting ) { 2708 return 2709 } 2710 const submit = form.querySelector( '[type=submit]') 2711 if( submit ) { 2712 // const submitText = submit.innerText; 2713 // submit.setAttribute('data-submit-text', submitText ) 2714 // submit.innerText = 'Sending' 2715 submit.classList.add('submitting') 2716 submit.setAttribute('disabled', 'disabled') 2717 } 2718 }, 100 ) 2719 } 2720 2721 function undoSubmitFeedback( form ) { 2722 // note that we are passing our original form, not the new replaced form 2723 // so this will only fire if there was a network issue and no form 2724 // arrived back; otherwise, the new form would have had reset submit anyways 2725 const submit = form.querySelector( '[type=submit]') 2726 if( submit ) { 2727 // submit.innerText = submit.getAttribute('data-submit-text') 2728 submit.classList.remove('submitting') 2729 submit.removeAttribute('disabled') 2730 } 2731 } 2732 2733 let authTk = form.getAttribute('data-tk') 2734 if( !authTk ) { 2735 // try hidden 2736 const hidden = form.querySelector('input[name=__sh]') 2737 if( hidden ) { 2738 authTk = hidden.getAttribute('value') 2739 } 2740 if( !authTk ) { 2741 // bail 2742 console.error( 'auth token missing' ) 2743 return 2744 } 2745 } 2746 2747 const data = new URLSearchParams() 2748 for (const pair of new FormData(form)) { 2749 data.append(pair[0], pair[1].toString()) 2750 } 2751 data.append( '__src_url', window.location.href ) 2752 data.append( '__sh', authTk ) 2753 2754 submitFeedback( form ) 2755 2756 setTimeout( () => { 2757 fetch( window.location.href, { 2758 method: 'post', 2759 body: data, 2760 headers: { 2761 'X-Requested-With': 'fetch', 2762 'X-Form-Submit': 'true', 2763 'X-Form-Submit-From': window.location.href, 2764 } 2765 }).then( response => { 2766 if( customCallback ) { 2767 return customCallback(response) 2768 } 2769 const redir = response.headers.get('Location') 2770 if( redir ) { 2771 return window.location = redir 2772 } 2773 response.text().then( html => { 2774 // console.log( 'form html', html ) 2775 2776 const error = response.headers.get('X-Form-Error') 2777 const successURL = response.headers.get( 'X-Success-URL') 2778 const success = true; 2779 // const success = "Comment submitted. It will be reviewed and published shortly." 2780 2781 if( !error && success && successURL ) { 2782 window.location = successURL 2783 return 2784 } 2785 2786 processBlogCommentSubmitResponse( form, html ) 2787 2788 if( error ) { 2789 _G.quickMessage(error, { error: true } ); 2790 } 2791 else { 2792 // _G.quickMessage(success) 2793 2794 if( window.dataLayer ) { 2795 window.dataLayer.push( { 2796 event: 'formSubmitted', 2797 formURL: window.location.href, 2798 title: document.title, 2799 formName: data.get( '__formName') || '' 2800 }) 2801 } 2802 } 2803 }) 2804 }).catch( err => { 2805 console.error( "error occurred during form submission", err ) 2806 _G.quickMessage('Error occurred during form submission', { error: true } ); 2807 }).finally( () => { 2808 submitting = false 2809 undoSubmitFeedback(form) 2810 }) 2811 }, 1000 ) 2812 2813 2814 return false;
2815 } 2816})() 2817 2818/* ==== INCLUDE: /js/blocks/maps.js ==== */ 2819 2820 2821window.mapboxJsLoaded = false 2822window.mapboxCssLoaded = false 2823 2824function initMaps() { 2825 _G.maps = [] 2826 2827 // const BG_IMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAATCAYAAABPwleqAAAAZUlEQVQ4T+2TQQ7AIAgEl88WnyR+lgbSNGotCT31IEezs+IkEgDFxyGDVfM8EWHDCetbWEKWRX8grN9YasXB/HhEEwGXMpzbx5hH54IOHPIr2MrugjfQpQWSveBadZmLYN8guuAEQo5PBQyQLMoAAAAASUVORK5CYII=" 2828 // const BG_IMG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAAL0lEQVQ4T2NkYGD4z0AmYARp/v+fdP2MjIwMo5pJCPXRACMhsEBKB0GAkehiuHIAy842AX0JUPAAAAAASUVORK5CYII=" 2829 const BG_IMG = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCAAPAA8DASIAAhEBAxEB/8QAFgABAQEAAAAAAAAAAAAAAAAABgAI/8QAJRAAAQMEAQQCAwAAAAAAAAAAAQIDBAUGBxEUAAgSExUxISJB/8QAFAEBAAAAAAAAAAAAAAAAAAAAAP/EABQRAQAAAAAAAAAAAAAAAAAAAAD/2gAMAwEAAhEDEQA/AN54ixFYtSxPZUyZZdvSpciiQnXn36UwtxxamEFSlKKNkkkkk/e+iXdZi+zbdwHdFQpVpUKmT2eL6pUOmssuo3KZSfFaUgjYJB0fokdWL+6zFtu40tKlVC6OPPg0iJFkM/HyleDiGUJWnaWiDogjYJHRnuT7k8cX/hW4qDQbi59Wl8b0x+DJb8/GS0tX7LbCRpKVH8n+dB//2Q==" 2830 2831 const sources = document.querySelectorAll( '[data-rel=block-map]') 2832 const promises = [] 2833 2834 const resizeObserver = new ResizeObserver((entries) => { 2835 entries.forEach( entry => { 2836 const map = entry && entry.target && entry.target['__map'] 2837 if( map ) { 2838 try { 2839 map.resize() 2840 } 2841 catch( e ) { 2842 console.warn( 'ERROR in maps', e ) 2843 } 2844 } 2845 }) 2846 }) 2847 2848 function addMarker(map, marker) { 2849 // console.log('to add marker', marker) 2850 var m = new mapboxgl.Marker({ 2851 color: "#d9534f" 2852 }).setLngLat([marker.geometry.coordinates[0], marker.geometry.coordinates[1]]) 2853 2854 try { 2855 m.getElement().setAttribute('data-id', marker.id) 2856 } 2857 catch( e ) { 2858 console.error( e ) 2859 } 2860 2861 if (marker.properties && marker.properties.label) { 2862 2863 try { 2864 m.getElement().setAttribute('data-label', marker.properties.label) 2865 } 2866 catch( e ) { 2867 console.error( e ) 2868 } 2869 2870 const popup = new mapboxgl.Popup({offset: 25,focusAfterOpen:false}) 2871 if (marker.properties.link) { 2872 const link = document.createElement('a') 2873 link.setAttribute('href', marker.properties.link ) 2874 link.innerText = marker.properties.label 2875 if( marker.properties.openInNewWindow ) { 2876 link.setAttribute('target', '_blank') 2877 } 2878 popup.setHTML(link.outerHTML) 2879 2880 m.getElement().classList.add("has-link") 2881 } else { 2882 popup.setText( 2883 `${marker.properties.label}` 2884 ) 2885 } 2886 m.setPopup(popup) 2887 } 2888 m.addTo(map); 2889 if (marker.properties && !marker.properties.hideInitially) { 2890 m.togglePopup(); 2891 } 2892 return m 2893 } 2894 2895 function addMarkers( map, geojson ) { 2896 2897 // console.log( 'to add markers', geojson ) 2898 geojson.__markers = {} 2899 geojson.__markerDefs = {} 2900 geojson.features.forEach( f => { 2901 if( f.geometry && f.geometry.type === 'Point' ) { 2902 const marker = addMarker( map, f ) 2903 geojson.__markers[f.id] = marker 2904 geojson.__markerDefs[f.id] = f 2905 } 2906 }) 2907 } 2908 2909 2910 function hideAllMarkers( geojson ) { 2911 Object.keys(geojson.__markers || {}).forEach( key => { 2912 const m = geojson.__markers[key] 2913 const p = m.getPopup() 2914 if( p && p.isOpen() ) { 2915 // p.remove() 2916 try { 2917 // p.getElement().style.opacity = '0' 2918 // setTimeout(() => { 2919 m.togglePopup() 2920 // }, 200) 2921 } 2922 catch( e ) { 2923 console.error(e) 2924 } 2925 } 2926 }) 2927 } 2928 2929 function showAllMarkers( geojson ) { 2930 Object.keys(geojson.__markers || {}
2930).forEach( key => { 2931 const m = geojson.__markers[key] 2932 const p = m.getPopup() 2933 if( p && !p.isOpen() ) { 2934 try { 2935 m.togglePopup() 2936 } 2937 catch( e ) { 2938 console.error(e) 2939 } 2940 } 2941 }) 2942 } 2943 2944 function restoreAllMarkers( geojson ) { 2945 Object.keys(geojson.__markers || {}).forEach( key => { 2946 const m = geojson.__markers[key] 2947 const p = m.getPopup() 2948 if( p && !p.isOpen() ) { 2949 try { 2950 m.togglePopup() 2951 } 2952 catch( e ) { 2953 console.error(e) 2954 } 2955 } 2956 }) 2957 } 2958 2959 2960 if( sources.length > 0 ) { 2961 promises.push( new Promise( (resolve, reject) => { 2962 if( window.mapboxJsLoaded ) { 2963 window.mapboxJsLoaded = true 2964 return resolve() 2965 } 2966 // LazyLoad.js( "https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.js", () => { 2967 // resolve() 2968 // }) 2969 LazyLoad.js( "https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.js", () => { 2970 resolve() 2971 }) 2972 // LazyLoad.js( "https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.0-beta.1/mapbox-gl.js", () => { 2973 // resolve() 2974 // }) 2975 })) 2976 promises.push( new Promise( (resolve, reject) => { 2977 if( window.mapboxCssLoaded ) { 2978 return resolve() 2979 } 2980 // LazyLoad.css( "https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.css", () => { 2981 // window.mapboxCssLoaded = true 2982 // resolve() 2983 // }) 2984 LazyLoad.css( "https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.css", () => { 2985 window.mapboxCssLoaded = true 2986 resolve() 2987 }) 2988 // LazyLoad.css( "https://api.tiles.mapbox.com/mapbox-gl-js/v2.6.0-beta.1/mapbox-gl.css", () => { 2989 // window.mapboxCssLoaded = true 2990 // resolve() 2991 // }) 2992 })) 2993 Promise.all(promises).then( () => { 2994 sources.forEach( source => { 2995 try { 2996 const jsonSource = source.querySelector('script') 2997 if( !jsonSource ) { 2998 return 2999 } 3000 const json = JSON.parse( jsonSource.innerHTML ) 3001 mapboxgl.accessToken = json.key 3002 source.innerHTML = '' 3003 3004 // this is dumb by mapbox doesn't recognize non-numeric IDs on features 3005 let id = 1 3006 json.geoJson.features = json.geoJson.features.map( f => ({ 3007 ...f, 3008 id: ++id, 3009 state: { hover: false }, 3010 })) 3011 3012 console.log( 'geojson', json.geoJson ) 3013 3014 const map = new mapboxgl.Map({ 3015 container: source, 3016 style: 'mapbox://styles/mapbox/streets-v11', 3017 center: [json.centerLng, json.centerLat], 3018 zoom : json.zoom, 3019 pitch: json.pitch, 3020 scrollZoom: false, 3021 attributionControl : false, 3022 trackResize : true, 3023 cooperativeGestures: true, 3024 }) 3025 const nav = new mapboxgl.NavigationControl(); 3026 map.addControl(nav, 'top-left'); 3027 source['__map'] = map 3028 resizeObserver.observe(source) 3029 map.on( 'load', () => { 3030 map.loadImage( BG_IMG, (error, image) => { 3031 console.log( 'loaded image', image, error ) 3032 map.addImage('mrp_label_bg', image, { 3033 content: [3, 3, 13, 13], 3034 stretchX: [[3, 5],[10,12]], 3035 stretchY: [[3, 5], [8,13]] 3036 }) 3037 3038 map.addSource( 'data', { 3039 type: 'geojson', 3040 data: json.geoJson, 3041 }) 3042 map.addLayer({ 3043 id: 'line', 3044 source: 'data', 3045 type: 'line', 3046 filter: ['==', ['geometry-type'], 'LineString'], 3047 layout: { 3048 'line-cap': 'round', 3049 'line-join': 'round' 3050 }, 3051 paint: { 3052 'line-color': '#3e81a9', 3053 'line-width': 2, 3054 } 3055 }) 3056 map.addLayer({ 3057 id: 'polygon-fill', 3058 source: 'data', 3059 type: 'fill', 3060 filter: ['==', ['geometry-type'], 'Polygon'], 3061 paint: { 3062 'fill-color': '#3e81a9', 3063 'fill-outline-color': '#3e81a9', 3064 // 'fill-opacity': 0.1 3065 'fill-opacity': [ 3066 'case', 3067 ['==', ['feature-state', 'hover'], true], 3068 0.3, 3069 0.1 3070 ] 3071 } 3072 }) 3073 map.addLayer({ 3074 id: 'polygon-line', 3075 source: 'data', 3076 type: 'line', 3077 filter: ['==', ['geometry-type'], 'Polygon'], 3078 layout: { 3079 'line-cap': 'round', 3080 'line-join': 'round' 3081 }, 3082 paint: { 3083 'line-color': '#3e81a9', 3084 // 'line-width': 2 3085 'line-width': [ 3086 'case', 3087 ['==', ['feature-state', 'hover'], true], 3088 5, 3089 2 3090 ] 3091 } 3092 }) 3093 map.addLayer({ 3094 id: 'marker-halo', 3095 source: 'data', 3096 type: 'circle', 3097 filter: ['==', ['geometry-type'], 'Point'], 3098 paint: { 3099 'circle-radius': 9, 3100 'circle-opacity': 1, 3101 // 'circle-color': '#fff', 3102 'circle-color': 'transparent' // making transparent 3103 }, 3104 }) 3105 map.addLayer({ 3106 id: 'marker', 3107 source: 'data', 3108 type: 'circle', 3109 filter: ['==', ['geometry-type'], 'Point'], 3110 paint: { 3111 'circle-radius': 20, 3112 'circle-opacity': 1, 3113 // 'circle-color': '#3e81a9', 3114 'circle-color': 'transparent' // making transparent 3115 }, 3116 }) 3117 // map.addLayer({ 3118 // id: 'marker-label', 3119 // source: 'data', 3120 // type: 'symbol', 3121 // filter: ['all', ['has', 'label'], ['!=', 'label', '']], 3122 // paint: { 3123 // 'text-halo-color': '#fff', 3124 // 'text-halo-width': 2, 3125 // 'text-halo-blur': 2, 3126 // // 'text-color': '#3e81a9', 3127 // 'text-color': '#333333', 3128 // }, 3129 // layout: { 3130 // 'text-field': ['get', 'label'], 3131 // 'text-font': [ 3132 // 'Open Sans Semibold', 3133 // ], 3134 // 'text-offset': [0, -3], 3135 // 'text-anchor': 'bottom', 3136 // 'text-size': 16, 3137 // 'text-allow-overlap': true, 3138 // 'text-ignore-placement': true, 3139 // 'text-variable-anchor': ['bottom', 'top'], 3140 // 'text-justify': 'auto', 3141 // 'icon-image' : 'mrp_label_bg', 3142 // 'icon-text-fit' : 'both', 3143 // 'icon-text-fit-padding': [8,8,8,8], 3144 // } 3145 // }) 3146 addMarkers(map, json.geoJson) 3147 3148 map.on( 'click', 'polygon-fill', e => { 3149 // console.log( 'click on', e, e.features ) 3150 if( e.features && e.features[0] ) { 3151 const props = e.features[0].properties || {} 3152 if (props.link) { 3153 if( props.openInNewWindow ) { 3154 window.open( props.link, '_blank' ) 3155 } 3156 else { 3157 window.location = props.link 3158 } 3159 } 3160 } 3161 }) 3162 let hoverId = -1; 3163 map.on( 'mousemove', 'polygon-fill', e => { 3164 // console.log( 'hoverId', hoverId ) 3165 if( e.features && e.features[0] ) { 3166 const props = e.features[0].properties || {} 3167 if( props.link ) { 3168 if( hoverId >= 0 ) { 3169 map.setFeatureState( 3170 { source: 'data', id: hoverId }, 3171 { hover: false } 3172 ) 3173 } 3174 hoverId = e.features[0].id 3175 map.setFeatureState( 3176 { source: 'data', id: hoverId }, 3177 { hover: true } 3178 ) 3179 map.getCanvas().style.cursor = 'pointer' 3180 } 3181 } 3182 }) 3183 map.on( 'mouseleave', 'polygon-fill', e => { 3184 // console.log( 'mouse out', e ) 3185 map.getCanvas().style.cursor = '' 3186 if( hoverId >= 0 ) { 3187 map.setFeatureState( 3188 { source: 'data', id: hoverId }, 3189 { hover: false } 3190 ) 3191 hoverId = -1 3192 } 3193 // console.log( 'hoverId', hoverId ) 3194 }) 3195 map.on( 'click', e => { 3196 //showAllMarkers(json.geoJson) 3197 }) 3198 map.on( 'mouseleave', 'marker', e => { 3199 //showAllMarkers(json.geoJson) 3200 }) 3201 // let hoverPopup = null; 3202 map.on( 'mouseenter', 'marker', e => { 3203 if( e.features && e.features[0] ) { 3204 // console.log( 'marker', json.geoJson.__markers[e.features[0].id] ) 3205 // if( hoverPopup ) { 3206 // hoverPopup.remove() 3207 // hoverPopup = null; 3208 // } 3209 hideAllMarkers(json.geoJson) 3210 const marker = json.geoJson.__markers[e.features[0].id] 3211 if( marker ) { 3212 const popup = marker.getPopup() 3213 if( popup && !popup.isOpen() ) { 3214 // popup.addTo(map) 3215 // hoverPopup = popup 3216 marker.togglePopup() 3217 } 3218 } 3219 } 3220 }) 3221 // setTimeout(() => { 3222 // map.resize() 3223 // }, 1000) 3224 // map.on( 'mouseleave', 'marker', e => { 3225 // if( hoverPopup ) { 3226 // hoverPopup.remove() 3227 // hoverPopup = null; 3228 // } 3229 // }) 3230 }) 3231 }) 3232 //console.log( 'geoJSON', json ) 3233 } 3234 catch( e ) { 3235 console.error( 'Failed to init maps', e ) 3236 } 3237 }) 3238 }) 3239 } 3240} 3241 3242document.addEventListener('DOMContentLoaded', () => { 3243 initMaps() 3244 3245 _G.reinitHandlers.push(initMaps) 3246});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.