mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Since the `window` can only ever have one `onload` value, if ever a third-party script overwrites this property, the application risks never initializing.
By using `addEventListener('load',…)`, the application's bootstrapping logic is queued and is more likely to be initialized.
11 lines
53 KiB
JavaScript
11 lines
53 KiB
JavaScript
(()=>{var Xt=Object.create;var $=Object.defineProperty;var Zt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames,P=Object.getOwnPropertySymbols,Jt=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var ct=(i,e,t)=>e in i?$(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ut=(i,e)=>{for(var t in e||(e={}))Z.call(e,t)&&ct(i,t,e[t]);if(P)for(var t of P(e))ht.call(e,t)&&ct(i,t,e[t]);return i};var dt=(i,e)=>{var t={};for(var s in i)Z.call(i,s)&&e.indexOf(s)<0&&(t[s]=i[s]);if(i!=null&&P)for(var s of P(i))e.indexOf(s)<0&&ht.call(i,s)&&(t[s]=i[s]);return t};var Qt=(i,e)=>()=>(i&&(e=i(i=0)),e);var te=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),ft=(i,e)=>{for(var t in e)$(i,t,{get:e[t],enumerable:!0})},ee=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Kt(e))!Z.call(i,n)&&n!==t&&$(i,n,{get:()=>e[n],enumerable:!(s=Zt(e,n))||s.enumerable});return i};var se=(i,e,t)=>(t=i!=null?Xt(Jt(i)):{},ee(e||!i||!i.__esModule?$(t,"default",{value:i,enumerable:!0}):t,i));var y=(i,e,t)=>new Promise((s,n)=>{var r=a=>{try{l(t.next(a))}catch(c){n(c)}},o=a=>{try{l(t.throw(a))}catch(c){n(c)}},l=a=>a.done?s(a.value):Promise.resolve(a.value).then(r,o);l((t=t.apply(i,e)).next())});var Ft=te((xt,q)=>{(function(i,e){typeof define=="function"&&define.amd?define([],function(){return i.svg4everybody=e()}):typeof q=="object"&&q.exports?q.exports=e():i.svg4everybody=e()})(xt,function(){function i(n,r,o){if(o){var l=document.createDocumentFragment(),a=!r.hasAttribute("viewBox")&&o.getAttribute("viewBox");a&&r.setAttribute("viewBox",a);for(var c=o.cloneNode(!0);c.childNodes.length;)l.appendChild(c.firstChild);n.appendChild(l)}}function e(n){n.onreadystatechange=function(){if(n.readyState===4){var r=n._cachedDocument;r||(r=n._cachedDocument=document.implementation.createHTMLDocument(""),r.body.innerHTML=n.responseText,n._cachedTarget={}),n._embeds.splice(0).map(function(o){var l=n._cachedTarget[o.id];l||(l=n._cachedTarget[o.id]=r.getElementById(o.id)),i(o.parent,o.svg,l)})}},n.onreadystatechange()}function t(n){function r(){for(var O=0;O<p.length;){var E=p[O],S=E.parentNode,_=s(S),w=E.getAttribute("xlink:href")||E.getAttribute("href");if(!w&&l.attributeName&&(w=E.getAttribute(l.attributeName)),_&&w){if(o)if(!l.validate||l.validate(w,_,E)){S.removeChild(E);var g=w.split("#"),C=g.shift(),I=g.join("#");if(C.length){var m=f[C];m||(m=f[C]=new XMLHttpRequest,m.open("GET",C),m.send(),m._embeds=[]),m._embeds.push({parent:S,svg:_,id:I}),e(m)}else i(S,_,document.getElementById(I))}else++O,++k}else++O}(!p.length||p.length-k>0)&&v(r,67)}var o,l=Object(n),a=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,c=/\bAppleWebKit\/(\d+)\b/,h=/\bEdge\/12\.(\d+)\b/,u=/\bEdge\/.(\d+)\b/,d=window.top!==window.self;o="polyfill"in l?l.polyfill:a.test(navigator.userAgent)||(navigator.userAgent.match(h)||[])[1]<10547||(navigator.userAgent.match(c)||[])[1]<537||u.test(navigator.userAgent)&&d;var f={},v=window.requestAnimationFrame||setTimeout,p=document.getElementsByTagName("use"),k=0;o&&r()}function s(n){for(var r=n;r.nodeName.toLowerCase()!=="svg"&&(r=r.parentNode););return r}return t})});var Nt={};ft(Nt,{gridHelper:()=>xe});function xe({gutterCssVar:i=Pe,marginCssVar:e=$e,rgbaColor:t=De}={}){let s=document.createElement("div");document.body.append(s),Ut(s,t),Fe(s,i,e),Ue(s,t)}function Fe(i,e,t){let s=i.style;s.zIndex="10000",s.position="fixed",s.top="0",s.left="0",s.display="flex",s.width="100%",s.height="100%",s.columnGap=`var(${e}, 0)`,s.paddingLeft=`var(${t}, 0)`,s.paddingRight=`var(${t}, 0)`,s.pointerEvents="none",s.visibility="hidden"}function Ut(i,e){i.innerHTML="";let t=Number(window.getComputedStyle(i).getPropertyValue("--grid-columns")),s;for(var n=0;n<t;n++)s=document.createElement("div"),s.style.flex="1 1 0",s.style.backgroundColor=e,i.appendChild(s)}function Ue(i,e){window.addEventListener("resize",Ut(i,e));let t=!1,s=!1;document.addEventListener("keydown",n=>{n.key=="Control"?t=!0:t&&n.key=="g"&&(s?i.style.visibility="hidden":i.style.visibility="visible",s=!s)}),document.addEventListener("keyup",n=>{n.key=="Control"&&(t=!1)})}var Pe,$e,De,Wt=Qt(()=>{Pe="--grid-gutter",$e="--grid-margin",De="rgba(255, 0, 0, .1)"});function x(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x=function(e){return typeof e}:x=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(i)}function pt(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function mt(i,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,s.key,s)}}function gt(i,e,t){return e&&mt(i.prototype,e),t&&mt(i,t),i}function vt(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function D(i,e){return re(i)||le(i,e)||yt(i,e)||ce()}function ie(i){return ne(i)||oe(i)||yt(i)||ae()}function ne(i){if(Array.isArray(i))return K(i)}function re(i){if(Array.isArray(i))return i}function oe(i){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(i))return Array.from(i)}function le(i,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(i)))){var t=[],s=!0,n=!1,r=void 0;try{for(var o=i[Symbol.iterator](),l;!(s=(l=o.next()).done)&&(t.push(l.value),!(e&&t.length===e));s=!0);}catch(a){n=!0,r=a}finally{try{!s&&o.return!=null&&o.return()}finally{if(n)throw r}}return t}}function yt(i,e){if(i){if(typeof i=="string")return K(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return K(i,e)}}function K(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function ae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var A=function(){function i(e){pt(this,i),this.mAttr="data-"+e.dataName,this.mCaptureEvents=["mouseenter","mouseleave"],this.el=e.el}return gt(i,[{key:"mInit",value:function(t){var s=this;this.modules=t,this.mCheckEventTarget=this.mCheckEventTarget.bind(this),this.events&&Object.keys(this.events).forEach(function(n){return s.mAddEvent(n)})}},{key:"mUpdate",value:function(t){this.modules=t}},{key:"mDestroy",value:function(){var t=this;this.events&&Object.keys(this.events).forEach(function(s){return t.mRemoveEvent(s)})}},{key:"mAddEvent",value:function(t){var s=!!this.mCaptureEvents.includes(t);this.el.addEventListener(t,this.mCheckEventTarget,s)}},{key:"mRemoveEvent",value:function(t){var s=!!this.mCaptureEvents.includes(t);this.el.removeEventListener(t,this.mCheckEventTarget,s)}},{key:"mCheckEventTarget",value:function(t){var s=this.events[t.type];if(typeof s=="string")this[s](t);else{var n="["+this.mAttr+"]",r=t.target;if(this.mCaptureEvents.includes(t.type))r.matches(n)&&this.mCallEventMethod(t,s,r);else for(;r&&r!==document&&!(r.matches(n)&&this.mCallEventMethod(t,s,r)!="undefined");)r=r.parentNode}}},{key:"mCallEventMethod",value:function(t,s,n){var r=n.getAttribute(this.mAttr);if(s.hasOwnProperty(r)){var o=s[r];t.hasOwnProperty("currentTarget")||Object.defineProperty(t,"currentTarget",{value:n}),t.hasOwnProperty("curTarget")||Object.defineProperty(t,"curTarget",{value:n}),this[o](t)}}},{key:"$",value:function(t,s){var n=t.indexOf("."),r=t.indexOf("#"),o=t.indexOf("["),l=[n,r,o].filter(function(d){return d!=-1}),a=!1,c=t,h="",u=this.el;return l.length&&(a=Math.min.apply(Math,ie(l)),c=t.slice(0,a),h=t.slice(a)),x(s)=="object"&&(u=s),u.querySelectorAll("["+this.mAttr+"="+c+"]"+h)}},{key:"parent",value:function(t,s){for(var n="["+this.mAttr+"="+t+"]",r=s.parentNode;r&&r!==document;){if(r.matches(n))return r;r=r.parentNode}}},{key:"getData",value:function(t,s){var n=s||this.el;return n.getAttribute(this.mAttr+"-"+t)}},{key:"setData",value:function(t,s,n){var r=n||this.el;return r.setAttribute(this.mAttr+"-"+t,s)}},{key:"call",value:function(t,s,n,r){var o=this;s&&!n&&(n=s,s=!1),this.modules[n]&&(r?this.modules[n][r]&&this.modules[n][r][t](s):Object.keys(this.modules[n]).forEach(function(l){o.modules[n][l][t](s)}))}},{key:"on",value:function(t,s,n,r){var o=this;this.modules[s]&&(r?this.modules[s][r].el.addEventListener(t,function(l){return n(l)}):Object.keys(this.modules[s]).forEach(function(l){o.modules[s][l].el.addEventListener(t,function(a){return n(a)})}))}},{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),i}(),he=function(){function i(e){pt(this,i),this.app,this.modules=e.modules,this.currentModules={},this.activeModules={},this.newModules={},this.moduleId=0}return gt(i,[{key:"init",value:function(t,s){var n=this,r=s||document,o=r.querySelectorAll("*");t&&!this.app&&(this.app=t),this.activeModules.app={app:this.app},o.forEach(function(l){Array.from(l.attributes).forEach(function(a){if(a.name.startsWith("data-module")){var c=!1,h=a.name.split("-").splice(2),u=n.toCamel(h);if(n.modules[u]?c=!0:n.modules[n.toUpper(u)]&&(u=n.toUpper(u),c=!0),c){var d={el:l,name:u,dataName:h.join("-")},f=new n.modules[u](d),v=a.value;v||(n.moduleId++,v="m"+n.moduleId,l.setAttribute(a.name,v)),n.addActiveModule(u,v,f);var p=u+"-"+v;s?n.newModules[p]=f:n.currentModules[p]=f}}})}),Object.entries(this.currentModules).forEach(function(l){var a=D(l,2),c=a[0],h=a[1];if(s){var u=c.split("-"),d=u.shift(),f=u.pop();n.addActiveModule(d,f,h)}else n.initModule(h)})}},{key:"initModule",value:function(t){t.mInit(this.activeModules),t.init()}},{key:"addActiveModule",value:function(t,s,n){this.activeModules[t]?Object.assign(this.activeModules[t],vt({},s,n)):this.activeModules[t]=vt({},s,n)}},{key:"update",value:function(t){var s=this;this.init(this.app,t),Object.entries(this.currentModules).forEach(function(n){var r=D(n,2),o=r[0],l=r[1];l.mUpdate(s.activeModules)}),Object.entries(this.newModules).forEach(function(n){var r=D(n,2),o=r[0],l=r[1];s.initModule(l)}),Object.assign(this.currentModules,this.newModules)}},{key:"destroy",value:function(t){t?this.destroyScope(t):this.destroyModules()}},{key:"destroyScope",value:function(t){var s=this,n=t.querySelectorAll("*");n.forEach(function(r){Array.from(r.attributes).forEach(function(o){if(o.name.startsWith("data-module")){var l=o.value,a=o.name.split("-").splice(2),c=s.toCamel(a)+"-"+l,h=!1;s.currentModules[c]?h=!0:s.currentModules[s.toUpper(c)]&&(c=s.toUpper(c),h=!0),h&&(s.destroyModule(s.currentModules[c]),delete s.currentModules[c])}})}),this.activeModules={},this.newModules={}}},{key:"destroyModules",value:function(){var t=this;Object.entries(this.currentModules).forEach(function(s){var n=D(s,2),r=n[0],o=n[1];t.destroyModule(o)}),this.currentModules=[]}},{key:"destroyModule",value:function(t){t.mDestroy(),t.destroy()}},{key:"toCamel",value:function(t){var s=this;return t.reduce(function(n,r){return n+s.toUpper(r)})}},{key:"toUpper",value:function(t){return t.charAt(0).toUpperCase()+t.slice(1)}}]),i}(),bt=he;var lt={};ft(lt,{Example:()=>N,Load:()=>W,Scroll:()=>G});var J="production",Et=typeof window.orientation=="undefined",M=Object.freeze({NAME:J,IS_PROD:J==="production",IS_DEV:J==="development",IS_DESKTOP:Et,IS_MOBILE:!Et}),b=Object.freeze({LOADING:"is-loading",LOADED:"is-loaded",READY:"is-ready",FONTS_LOADED:"fonts-loaded",LAZY_CONTAINER:"c-lazy",LAZY_LOADED:"-lazy-loaded"}),wt=Object.freeze({RESIZE_END:"loco.resizeEnd"}),F=Object.freeze({EAGER:[{family:"Source Sans",style:"normal",weight:400},{family:"Source Sans",style:"normal",weight:700}]});var _t="fonts"in document;function ue(i,e){for(let[t,s]of Object.entries(e))switch(t){case"family":{if(U(i[t])!==s)return!1;break}case"weight":{if(i[t]!=s)return!1;break}default:{if(i[t]!==s)return!1;break}}return!0}function de(i,e){let t=U(i.family);return U(t)===e||e.endsWith(U(t))&&(e.match(i.weight)||e.match(i.style)),!0}function fe(i){let e=[];for(let t of document.fonts)ue(t,i)&&e.push(t);return e}function me(i){let e=[];for(let t of document.fonts)de(t,i)&&e.push(t);return e}function It(i){Array.isArray(i)||(i=[i]);let e=new Set;return i.forEach(t=>{if(t)switch(typeof t){case"string":e.add(...me(t));return;case"object":e.add(...fe(t));return}throw new TypeError("Expected font query to be font shorthand or font reference")}),[...e]}function Ot(i,e=!1){return y(this,null,function*(){var t;if(((t=i.size)!=null?t:i.length)===0)throw new TypeError("Expected at least one font");return yield ve([...i],e)})}function St(i){return y(this,null,function*(){return yield(i.status==="unloaded"?i.load():i.loaded).then(e=>e,e=>i)})}function ve(i,e=!1){return y(this,null,function*(){e&&console.group("[loadFonts:API]",i.length,"/",document.fonts.size);let t=[];for(let s of i)s instanceof FontFace?(document.fonts.has(s)||document.fonts.add(s),t.push(St(s))):t.push(...It(s).map(n=>St(n)));return e&&console.groupEnd(),yield Promise.all(t)})}function U(i){return i.replace(/['"]+/g,"")}function Ct(i){return y(this,null,function*(){let e=It(i);return yield Promise.all(e.map(t=>t.loaded))})}var N=class extends A{constructor(i){super(i)}init(){Ct(F.EAGER).then(i=>this.onFontsLoaded(i))}onFontsLoaded(i){console.log("Example: Eager Fonts Loaded!",i)}};function pe(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function At(i,e){for(var t=0;t<e.length;t++){var s=e[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(i,s.key,s)}}function ge(i,e,t){return e&&At(i.prototype,e),t&&At(i,t),i}function ye(i,e){return be(i)||Ee(i,e)||we(i,e)||Se()}function be(i){if(Array.isArray(i))return i}function Ee(i,e){var t=i==null?null:typeof Symbol!="undefined"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var s=[],n=!0,r=!1,o,l;try{for(t=t.call(i);!(n=(o=t.next()).done)&&(s.push(o.value),!(e&&s.length===e));n=!0);}catch(a){r=!0,l=a}finally{try{!n&&t.return!=null&&t.return()}finally{if(r)throw l}}return s}}function we(i,e){if(i){if(typeof i=="string")return Tt(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Tt(i,e)}}function Tt(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,s=new Array(e);t<e;t++)s[t]=i[t];return s}function Se(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var _e=function(){function i(e){pe(this,i),this.defaults={name:"load",loadingClass:"is-loading",loadedClass:"is-loaded",readyClass:"is-ready",transitionsPrefix:"is-",transitionsHistory:!0,enterDelay:0,exitDelay:0,loadedDelay:0,isLoaded:!1,isEntered:!1,isUrl:!1,transitionContainer:null,popstateIgnore:!1},Object.assign(this,this.defaults,e),this.options=e,this.namespace="modular",this.html=document.documentElement,this.href=window.location.href,this.container="data-"+this.name+"-container",this.subContainer=!1,this.prevTransition=null,this.loadAttributes=["src","srcset","style","href"],this.isInserted=!1,this.isLoading=!1,this.enterTimeout=!1,this.controller=new AbortController,this.classContainer=this.html,this.isChrome=navigator.userAgent.indexOf("Chrome")!=-1,this.init()}return ge(i,[{key:"init",value:function(){var t=this;window.addEventListener("popstate",function(s){return t.checkState(s)},!1),this.html.addEventListener("click",function(s){return t.checkClick(s)},!1),this.loadEls(document)}},{key:"checkClick",value:function(t){if(!t.ctrlKey&&!t.metaKey)for(var s=t.target;s&&s!==document;){if(s.matches("a")&&s.getAttribute("download")==null){var n=s.getAttribute("href");!n.startsWith("#")&&!n.startsWith("mailto:")&&!n.startsWith("tel:")&&(t.preventDefault(),this.reset(),this.getClickOptions(s));break}s=s.parentNode}}},{key:"checkState",value:function(){typeof this.popstateIgnore=="string"&&window.location.href.indexOf(this.popstateIgnore)>-1||(this.reset(),this.getStateOptions())}},{key:"reset",value:function(){this.isLoading&&(this.controller.abort(),this.isLoading=!1,this.controller=new AbortController),window.clearTimeout(this.enterTimeout),this.isInserted&&this.removeContainer(),this.classContainer=this.html,Object.assign(this,this.defaults,this.options)}},{key:"getClickOptions",value:function(t){this.transition=t.getAttribute("data-"+this.name),this.isUrl=t.getAttribute("data-"+this.name+"-url");var s=t.getAttribute("href"),n=t.getAttribute("target");if(n=="_blank"){window.open(s,"_blank");return}if(this.transition=="false"){window.location=s;return}this.setOptions(s,!0)}},{key:"getStateOptions",value:function(){this.transitionsHistory?this.transition=history.state:this.transition=!1;var t=window.location.href;this.setOptions(t)}},{key:"goTo",value:function(t,s,n){this.reset(),this.transition=s,this.isUrl=n,this.setOptions(t,!0)}},{key:"setOptions",value:function(t,s){var n="["+this.container+"]",r;this.transition&&this.transition!="true"&&(this.transitionContainer="["+this.container+'="'+this.transition+'"]',this.loadingClass=this.transitions[this.transition].loadingClass||this.loadingClass,this.loadedClass=this.transitions[this.transition].loadedClass||this.loadedClass,this.readyClass=this.transitions[this.transition].readyClass||this.readyClass,this.transitionsPrefix=this.transitions[this.transition].transitionsPrefix||this.transitionsPrefix,this.enterDelay=this.transitions[this.transition].enterDelay||this.enterDelay,this.exitDelay=this.transitions[this.transition].exitDelay||this.exitDelay,this.loadedDelay=this.transitions[this.transition].loadedDelay||this.loadedDelay,r=document.querySelector(this.transitionContainer)),r?(n=this.transitionContainer,this.oldContainer=r,this.classContainer=this.oldContainer.parentNode,this.subContainer||history.replaceState(this.transition,null,this.href),this.subContainer=!0):(this.oldContainer=document.querySelector(n),this.subContainer&&history.replaceState(this.prevTransition,null,this.href),this.subContainer=!1),this.href=t,this.parentContainer=this.oldContainer.parentNode,this.isUrl===""||this.isUrl!=null&&this.isUrl!="false"&&this.isUrl!=!1?history.pushState(this.transition,null,t):(this.oldContainer.classList.add("is-old"),this.setLoading(),this.startEnterDelay(),this.loadHref(t,n,s))}},{key:"setLoading",value:function(){this.classContainer.classList.remove(this.loadedClass,this.readyClass),this.classContainer.classList.add(this.loadingClass),this.classContainer.classList.remove(this.transitionsPrefix+this.prevTransition),this.transition&&this.classContainer.classList.add(this.transitionsPrefix+this.transition),this.subContainer||(this.prevTransition=this.transition);var t=new Event(this.namespace+"loading");window.dispatchEvent(t)}},{key:"startEnterDelay",value:function(){var t=this;this.enterTimeout=window.setTimeout(function(){t.isEntered=!0,t.isLoaded&&t.transitionContainers()},this.enterDelay)}},{key:"loadHref",value:function(t,s,n){var r=this;this.isLoading=!0;var o=this.controller.signal;fetch(t,{signal:o}).then(function(l){return l.text()}).then(function(l){n&&history.pushState(r.transition,null,t);var a=new DOMParser;r.data=a.parseFromString(l,"text/html"),r.newContainer=r.data.querySelector(s),r.newContainer.classList.add("is-new"),r.parentNewContainer=r.newContainer.parentNode,r.hideContainer(),r.parentContainer.insertBefore(r.newContainer,r.oldContainer),r.isInserted=!0,r.setSvgs(),r.isLoaded=!0,r.isEntered&&r.transitionContainers(),r.loadEls(r.newContainer),r.isLoading=!1}).catch(function(l){window.location=t})}},{key:"transitionContainers",value:function(){var t=this;this.setAttributes(),this.showContainer(),this.setLoaded(),setTimeout(function(){t.removeContainer(),t.setReady()},this.exitDelay)}},{key:"setSvgs",value:function(){if(this.isChrome){var t=this.newContainer.querySelectorAll("use");t.length&&t.forEach(function(s){var n=s.getAttribute("xlink:href");if(n)s.parentNode.innerHTML='<use xlink:href="'+n+'"></use>';else{var r=s.getAttribute("href");r&&(s.parentNode.innerHTML='<use href="'+r+'"></use>')}})}}},{key:"setAttributes",value:function(){var t=this,s=this.data.getElementsByTagName("title")[0],n=this.data.head.querySelector('meta[name="description"]'),r=document.head.querySelector('meta[name="description"]'),o,l;this.subContainer?(l=this.parentNewContainer,o=document.querySelector(this.transitionContainer).parentNode):(l=this.data.querySelector("html"),o=document.querySelector("html"));var a=Object.assign({},l.dataset);s&&(document.title=s.innerText),r&&n&&r.setAttribute("content",n.getAttribute("content")),a&&Object.entries(a).forEach(function(c){var h=ye(c,2),u=h[0],d=h[1];o.setAttribute("data-"+t.toDash(u),d)})}},{key:"toDash",value:function(t){return t.split(/(?=[A-Z])/).join("-").toLowerCase()}},{key:"hideContainer",value:function(){this.newContainer.style.visibility="hidden",this.newContainer.style.height=0,this.newContainer.style.overflow="hidden"}},{key:"showContainer",value:function(){this.newContainer.style.visibility="",this.newContainer.style.height="",this.newContainer.style.overflow=""}},{key:"loadEls",value:function(t){var s=this,n=[];this.loadAttributes.forEach(function(r){var o="data-"+s.name+"-"+r,l=t.querySelectorAll("["+o+"]");l.length&&l.forEach(function(a){var c=a.getAttribute(o);if(a.setAttribute(r,c),r=="src"||r=="srcset"){var h=new Promise(function(u){a.onload=function(){return u(a)}});n.push(h)}})}),Promise.all(n).then(function(r){var o=new Event(s.namespace+"images");window.dispatchEvent(o)})}},{key:"setLoaded",value:function(){var t=this;this.classContainer.classList.remove(this.loadingClass),setTimeout(function(){t.classContainer.classList.add(t.loadedClass)},this.loadedDelay);var s=new Event(this.namespace+"loaded");window.dispatchEvent(s)}},{key:"removeContainer",value:function(){this.parentContainer.removeChild(this.oldContainer),this.newContainer.classList.remove("is-new"),this.isInserted=!1}},{key:"setReady",value:function(){this.classContainer.classList.add(this.readyClass);var t=new Event(this.namespace+"ready");window.dispatchEvent(t)}},{key:"on",value:function(t,s){var n=this;window.addEventListener(this.namespace+t,function(){switch(t){case"loading":return s(n.transition,n.oldContainer);case"loaded":return s(n.transition,n.oldContainer,n.newContainer);case"ready":return s(n.transition,n.newContainer);default:return s()}},!1)}}]),i}(),Rt=_e;var W=class extends A{constructor(i){super(i)}init(){new Rt({enterDelay:0,transitions:{customTransition:{}}}).on("loaded",(e,t,s)=>{this.call("destroy",t,"app"),this.call("update",s,"app")})}};var Ie=i=>({url:i.src,width:i.naturalWidth,height:i.naturalHeight,ratio:i.naturalWidth/i.naturalHeight}),Oe=(i,e={})=>new Promise((t,s)=>{let n=new Image;e.crossOrigin&&(n.crossOrigin=e.crossOrigin);let r=()=>{t(ut({element:n},Ie(n)))};n.decode?(n.src=i,n.decode().then(r).catch(o=>{s(o)})):(n.onload=r,n.onerror=o=>{s(o)},n.src=i)}),Mt=[],kt=(i,e,t)=>y(void 0,null,function*(){let s=e||i.dataset.src,n=Mt.find(r=>r.url===s);if(!n){if(n=yield Oe(s),!n.url)return;Mt.push(n)}i.src!==s&&(i.tagName==="IMG"?i.src=n.url:i.style.backgroundImage=`url(${n.url})`,requestAnimationFrame(()=>{let r=i.closest(`.${b.LAZY_CONTAINER}`);r&&(r.classList.add(b.LAZY_LOADED),r.style.backgroundImage=""),i.classList.add(b.LAZY_LOADED),t==null||t()}))});function Q(){return Q=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},Q.apply(this,arguments)}function j(i,e,t){return Math.max(i,Math.min(e,t))}var tt=class{advance(e){var t;if(!this.isRunning)return;let s=!1;if(this.lerp)this.value=(1-(n=this.lerp))*this.value+n*this.to,Math.round(this.value)===this.to&&(this.value=this.to,s=!0);else{this.currentTime+=e;let r=j(0,this.currentTime/this.duration,1);s=r>=1;let o=s?1:this.easing(r);this.value=this.from+(this.to-this.from)*o}var n;(t=this.onUpdate)==null||t.call(this,this.value,{completed:s}),s&&this.stop()}stop(){this.isRunning=!1}fromTo(e,t,{lerp:s=.1,duration:n=1,easing:r=l=>l,onUpdate:o}){this.from=this.value=e,this.to=t,this.lerp=s,this.duration=n,this.easing=r,this.currentTime=0,this.isRunning=!0,this.onUpdate=o}};function Lt(i,e){let t;return function(){let s=arguments,n=this;clearTimeout(t),t=setTimeout(function(){i.apply(n,s)},e)}}var et=class{constructor(e,t){this.onWindowResize=()=>{this.width=window.innerWidth,this.height=window.innerHeight},this.onWrapperResize=()=>{this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight},this.onContentResize=()=>{let s=this.wrapper===window?document.documentElement:this.wrapper;this.scrollHeight=s.scrollHeight,this.scrollWidth=s.scrollWidth},this.wrapper=e,this.content=t,this.wrapper===window?(window.addEventListener("resize",this.onWindowResize,!1),this.onWindowResize()):(this.wrapperResizeObserver=new ResizeObserver(Lt(this.onWrapperResize,100)),this.wrapperResizeObserver.observe(this.wrapper),this.onWrapperResize()),this.contentResizeObserver=new ResizeObserver(Lt(this.onContentResize,100)),this.contentResizeObserver.observe(this.content),this.onContentResize()}destroy(){var e,t;window.removeEventListener("resize",this.onWindowResize,!1),(e=this.wrapperResizeObserver)==null||e.disconnect(),(t=this.contentResizeObserver)==null||t.disconnect()}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},zt=()=>({events:{},emit(i,...e){let t=this.events[i]||[];for(let s=0,n=t.length;s<n;s++)t[s](...e)},on(i,e){var t;return(t=this.events[i])!=null&&t.push(e)||(this.events[i]=[e]),()=>{var s;this.events[i]=(s=this.events[i])==null?void 0:s.filter(n=>e!==n)}}}),st=class{constructor(e,{wheelMultiplier:t=1,touchMultiplier:s=2,normalizeWheel:n=!1}){this.onTouchStart=r=>{let{clientX:o,clientY:l}=r.targetTouches?r.targetTouches[0]:r;this.touchStart.x=o,this.touchStart.y=l,this.lastDelta={x:0,y:0}},this.onTouchMove=r=>{let{clientX:o,clientY:l}=r.targetTouches?r.targetTouches[0]:r,a=-(o-this.touchStart.x)*this.touchMultiplier,c=-(l-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=o,this.touchStart.y=l,this.lastDelta={x:a,y:c},this.emitter.emit("scroll",{type:"touch",deltaX:a,deltaY:c,event:r})},this.onTouchEnd=r=>{this.emitter.emit("scroll",{type:"touch",inertia:!0,deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:r})},this.onWheel=r=>{let{deltaX:o,deltaY:l}=r;this.normalizeWheel&&(o=j(-100,o,100),l=j(-100,l,100)),o*=this.wheelMultiplier,l*=this.wheelMultiplier,this.emitter.emit("scroll",{type:"wheel",deltaX:o,deltaY:l,event:r})},this.element=e,this.wheelMultiplier=t,this.touchMultiplier=s,this.normalizeWheel=n,this.touchStart={x:null,y:null},this.emitter=zt(),this.element.addEventListener("wheel",this.onWheel,{passive:!1}),this.element.addEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.addEventListener("touchend",this.onTouchEnd,{passive:!1})}on(e,t){return this.emitter.on(e,t)}destroy(){this.emitter.events={},this.element.removeEventListener("wheel",this.onWheel,{passive:!1}),this.element.removeEventListener("touchstart",this.onTouchStart,{passive:!1}),this.element.removeEventListener("touchmove",this.onTouchMove,{passive:!1}),this.element.removeEventListener("touchend",this.onTouchEnd,{passive:!1})}},H=class{constructor({direction:e,gestureDirection:t,mouseMultiplier:s,smooth:n,wrapper:r=window,content:o=document.documentElement,wheelEventsTarget:l=r,smoothWheel:a=n==null||n,smoothTouch:c=!1,syncTouch:h=!1,syncTouchLerp:u=.1,touchInertiaMultiplier:d=35,duration:f,easing:v=g=>Math.min(1,1.001-Math.pow(2,-10*g)),lerp:p=f?null:.1,infinite:k=!1,orientation:O=e!=null?e:"vertical",gestureOrientation:E=t!=null?t:"vertical",touchMultiplier:S=1,wheelMultiplier:_=s!=null?s:1,normalizeWheel:w=!1}={}){this.onVirtualScroll=({type:g,inertia:C,deltaX:I,deltaY:m,event:L})=>{if(L.ctrlKey)return;let z=g==="touch",qt=g==="wheel";if(this.options.gestureOrientation==="vertical"&&m===0||this.options.gestureOrientation==="horizontal"&&I===0||z&&this.options.gestureOrientation==="vertical"&&this.scroll===0&&!this.options.infinite&&m<=0||L.composedPath().find(X=>X==null||X.hasAttribute==null?void 0:X.hasAttribute("data-lenis-prevent")))return;if(this.isStopped||this.isLocked)return void L.preventDefault();if(this.isSmooth=(this.options.smoothTouch||this.options.syncTouch)&&z||this.options.smoothWheel&&qt,!this.isSmooth)return this.isScrolling=!1,void this.animate.stop();L.preventDefault();let R=m;this.options.gestureOrientation==="both"?R=Math.abs(m)>Math.abs(I)?m:I:this.options.gestureOrientation==="horizontal"&&(R=I);let Yt=z&&this.options.syncTouch,at=z&&C&&Math.abs(R)>1;at&&(R=this.velocity*this.options.touchInertiaMultiplier),this.scrollTo(this.targetScroll+R,Q({programmatic:!1},Yt&&{lerp:at?this.syncTouchLerp:.4}))},this.onScroll=()=>{if(!this.isScrolling){let g=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.direction=Math.sign(this.animatedScroll-g),this.emit()}},e&&console.warn("Lenis: `direction` option is deprecated, use `orientation` instead"),t&&console.warn("Lenis: `gestureDirection` option is deprecated, use `gestureOrientation` instead"),s&&console.warn("Lenis: `mouseMultiplier` option is deprecated, use `wheelMultiplier` instead"),n&&console.warn("Lenis: `smooth` option is deprecated, use `smoothWheel` instead"),window.lenisVersion="1.0.11",r!==document.documentElement&&r!==document.body||(r=window),this.options={wrapper:r,content:o,wheelEventsTarget:l,smoothWheel:a,smoothTouch:c,syncTouch:h,syncTouchLerp:u,touchInertiaMultiplier:d,duration:f,easing:v,lerp:p,infinite:k,gestureOrientation:E,orientation:O,touchMultiplier:S,wheelMultiplier:_,normalizeWheel:w},this.dimensions=new et(r,o),this.rootElement.classList.add("lenis"),this.velocity=0,this.isStopped=!1,this.isSmooth=a||c,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.animate=new tt,this.emitter=zt(),this.options.wrapper.addEventListener("scroll",this.onScroll,{passive:!1}),this.virtualScroll=new st(l,{touchMultiplier:S,wheelMultiplier:_,normalizeWheel:w}),this.virtualScroll.on("scroll",this.onVirtualScroll)}destroy(){this.emitter.events={},this.options.wrapper.removeEventListener("scroll",this.onScroll,{passive:!1}),this.virtualScroll.destroy()}on(e,t){return this.emitter.on(e,t)}off(e,t){var s;this.emitter.events[e]=(s=this.emitter.events[e])==null?void 0:s.filter(n=>t!==n)}setScroll(e){this.isHorizontal?this.rootElement.scrollLeft=e:this.rootElement.scrollTop=e}emit(){this.emitter.emit("scroll",this)}reset(){this.isLocked=!1,this.isScrolling=!1,this.velocity=0,this.animate.stop()}start(){this.isStopped=!1,this.reset()}stop(){this.isStopped=!0,this.animate.stop(),this.reset()}raf(e){let t=e-(this.time||e);this.time=e,this.animate.advance(.001*t)}scrollTo(e,{offset:t=0,immediate:s=!1,lock:n=!1,duration:r=this.options.duration,easing:o=this.options.easing,lerp:l=!r&&this.options.lerp,onComplete:a=null,force:c=!1,programmatic:h=!0}={}){if(!this.isStopped||c){if(["top","left","start"].includes(e))e=0;else if(["bottom","right","end"].includes(e))e=this.limit;else{var u;let d;if(typeof e=="string"?d=document.querySelector(e):(u=e)!=null&&u.nodeType&&(d=e),d){if(this.options.wrapper!==window){let v=this.options.wrapper.getBoundingClientRect();t-=this.isHorizontal?v.left:v.top}let f=d.getBoundingClientRect();e=(this.isHorizontal?f.left:f.top)+this.animatedScroll}}if(typeof e=="number"){if(e+=t,e=Math.round(e),this.options.infinite?h&&(this.targetScroll=this.animatedScroll=this.scroll):e=j(0,e,this.limit),s)return this.animatedScroll=this.targetScroll=e,this.setScroll(this.scroll),this.reset(),this.emit(),void(a==null||a());if(!h){if(e===this.targetScroll)return;this.targetScroll=e}this.animate.fromTo(this.animatedScroll,e,{duration:r,easing:o,lerp:l,onUpdate:(d,{completed:f})=>{n&&(this.isLocked=!0),this.isScrolling=!0,this.velocity=d-this.animatedScroll,this.direction=Math.sign(this.velocity),this.animatedScroll=d,this.setScroll(this.scroll),h&&(this.targetScroll=d),f&&(n&&(this.isLocked=!1),requestAnimationFrame(()=>{this.isScrolling=!1}),this.velocity=0,a==null||a()),this.emit()}})}}}get rootElement(){return this.options.wrapper===window?this.options.content:this.options.wrapper}get limit(){return this.isHorizontal?this.dimensions.limit.x:this.dimensions.limit.y}get isHorizontal(){return this.options.orientation==="horizontal"}get actualScroll(){return this.isHorizontal?this.rootElement.scrollLeft:this.rootElement.scrollTop}get scroll(){return this.options.infinite?function(e,t){let s=e%t;return(t>0&&s<0||t<0&&s>0)&&(s+=t),s}(this.animatedScroll,this.limit):this.animatedScroll}get progress(){return this.limit===0?1:this.scroll/this.limit}get isSmooth(){return this.__isSmooth}set isSmooth(e){this.__isSmooth!==e&&(this.rootElement.classList.toggle("lenis-smooth",e),this.__isSmooth=e)}get isScrolling(){return this.__isScrolling}set isScrolling(e){this.__isScrolling!==e&&(this.rootElement.classList.toggle("lenis-scrolling",e),this.__isScrolling=e)}get isStopped(){return this.__isStopped}set isStopped(e){this.__isStopped!==e&&(this.rootElement.classList.toggle("lenis-stopped",e),this.__isStopped=e)}};function it(){return it=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},it.apply(this,arguments)}var B=class{constructor({scrollElements:e,rootMargin:t="-1px -1px -1px -1px",IORaf:s}){this.scrollElements=void 0,this.rootMargin=void 0,this.IORaf=void 0,this.observer=void 0,this.scrollElements=e,this.rootMargin=t,this.IORaf=s,this._init()}_init(){let e={rootMargin:this.rootMargin},t=s=>{s.forEach(n=>{let r=this.scrollElements.find(o=>o.$el===n.target);n.isIntersecting?(r&&(r.isAlreadyIntersected=!0),this._setInview(n)):r&&r.isAlreadyIntersected&&this._setOutOfView(n)})};this.observer=new IntersectionObserver(t,e);for(let s of this.scrollElements){let n=s.$el;this.observe(n)}}destroy(){this.observer.disconnect()}observe(e){e&&this.observer.observe(e)}unobserve(e){e&&this.observer.unobserve(e)}_setInview(e){let t=this.scrollElements.find(s=>s.$el===e.target);this.IORaf&&(t==null||t.setInteractivityOn()),!this.IORaf&&(t==null||t.setInview())}_setOutOfView(e){let t=this.scrollElements.find(s=>s.$el===e.target);this.IORaf&&(t==null||t.setInteractivityOff()),!this.IORaf&&(t==null||t.setOutOfView()),!(t!=null&&t.attributes.scrollRepeat)&&!this.IORaf&&this.unobserve(e.target)}};function Ce(i,e,t){return t<i?i:t>e?e:t}function Dt(i,e,t,s,n){let r=e-i,o=s-t;return t+((n-i)/r*o||0)}function Ae(i,e,t){return Dt(i,e,0,1,t)}function Pt(i,e){return i.reduce((t,s)=>Math.abs(s-e)<Math.abs(t-e)?s:t)}var Te="is-inview",Re="--progress",Me="onScrollProgress",nt=class{constructor({$el:e,id:t,modularInstance:s,subscribeElementUpdateFn:n,unsubscribeElementUpdateFn:r,needRaf:o,scrollOrientation:l}){var a,c,h,u,d;this.$el=void 0,this.id=void 0,this.needRaf=void 0,this.attributes=void 0,this.scrollOrientation=void 0,this.isAlreadyIntersected=void 0,this.intersection=void 0,this.metrics=void 0,this.currentScroll=void 0,this.translateValue=void 0,this.progress=void 0,this.lastProgress=void 0,this.modularInstance=void 0,this.progressModularModules=void 0,this.isInview=void 0,this.isInteractive=void 0,this.isInFold=void 0,this.isFirstResize=void 0,this.subscribeElementUpdateFn=void 0,this.unsubscribeElementUpdateFn=void 0,this.$el=e,this.id=t,this.needRaf=o,this.scrollOrientation=l,this.modularInstance=s,this.subscribeElementUpdateFn=n,this.unsubscribeElementUpdateFn=r,this.attributes={scrollClass:(a=this.$el.dataset.scrollClass)!=null?a:Te,scrollOffset:(c=this.$el.dataset.scrollOffset)!=null?c:"0,0",scrollPosition:(h=this.$el.dataset.scrollPosition)!=null?h:"start,end",scrollModuleProgress:this.$el.dataset.scrollModuleProgress!=null,scrollCssProgress:this.$el.dataset.scrollCssProgress!=null,scrollEventProgress:(u=this.$el.dataset.scrollEventProgress)!=null?u:null,scrollSpeed:this.$el.dataset.scrollSpeed!=null?parseFloat(this.$el.dataset.scrollSpeed):null,scrollRepeat:this.$el.dataset.scrollRepeat!=null,scrollCall:(d=this.$el.dataset.scrollCall)!=null?d:null,scrollCallSelf:this.$el.dataset.scrollCallSelf!=null,scrollIgnoreFold:this.$el.dataset.scrollIgnoreFold!=null,scrollEnableTouchSpeed:this.$el.dataset.scrollEnableTouchSpeed!=null},this.intersection={start:0,end:0},this.metrics={offsetStart:0,offsetEnd:0,bcr:{}},this.currentScroll=this.scrollOrientation==="vertical"?window.scrollY:window.scrollX,this.translateValue=0,this.progress=0,this.lastProgress=null,this.progressModularModules=[],this.isInview=!1,this.isInteractive=!1,this.isAlreadyIntersected=!1,this.isInFold=!1,this.isFirstResize=!0,this._init()}_init(){this.needRaf&&(this.modularInstance&&this.attributes.scrollModuleProgress&&this._getProgressModularModules(),this._resize())}onResize({currentScroll:e}){this.currentScroll=e,this._resize()}onRender({currentScroll:e,smooth:t}){let s=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth;if(this.currentScroll=e,this._computeProgress(),this.attributes.scrollSpeed&&!isNaN(this.attributes.scrollSpeed))if(!this.attributes.scrollEnableTouchSpeed&&!t)this.translateValue&&(this.$el.style.transform="translate3d(0, 0, 0)"),this.translateValue=0;else{if(this.isInFold){let n=Math.max(0,this.progress);this.translateValue=n*s*this.attributes.scrollSpeed*-1}else{let n=Dt(0,1,-1,1,this.progress);this.translateValue=n*s*this.attributes.scrollSpeed*-1}this.$el.style.transform=this.scrollOrientation==="vertical"?`translate3d(0, ${this.translateValue}px, 0)`:`translate3d(${this.translateValue}px, 0, 0)`}}setInview(){if(this.isInview)return;this.isInview=!0,this.$el.classList.add(this.attributes.scrollClass);let e="enter",t=this._getScrollCallFrom();this.attributes.scrollCall&&this._dispatchCall(e,t)}setOutOfView(){if(!(this.isInview&&this.attributes.scrollRepeat))return;this.isInview=!1,this.$el.classList.remove(this.attributes.scrollClass);let e="leave",t=this._getScrollCallFrom();this.attributes.scrollCall&&this._dispatchCall(e,t)}setInteractivityOn(){this.isInteractive||(this.isInteractive=!0,this.subscribeElementUpdateFn(this))}setInteractivityOff(){this.isInteractive&&(this.isInteractive=!1,this.unsubscribeElementUpdateFn(this),this.lastProgress!=null&&this._computeProgress(Pt([0,1],this.lastProgress)))}_resize(){this.metrics.bcr=this.$el.getBoundingClientRect(),this._computeMetrics(),this._computeIntersection(),this.isFirstResize&&(this.isFirstResize=!1,this.isInFold&&this.setInview())}_computeMetrics(){let{top:e,left:t,height:s,width:n}=this.metrics.bcr,r=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth,o=this.scrollOrientation==="vertical"?e:t,l=this.scrollOrientation==="vertical"?s:n;this.metrics.offsetStart=this.currentScroll+o-this.translateValue,this.metrics.offsetEnd=this.metrics.offsetStart+l,this.metrics.offsetStart<r&&!this.attributes.scrollIgnoreFold?this.isInFold=!0:this.isInFold=!1}_computeIntersection(){let e=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth,t=this.scrollOrientation==="vertical"?this.metrics.bcr.height:this.metrics.bcr.width,s=this.attributes.scrollOffset.split(","),n=s[0]!=null?s[0].trim():"0",r=s[1]!=null?s[1].trim():"0",o=this.attributes.scrollPosition.split(","),l=o[0]!=null?o[0].trim():"start",a=o[1]!=null?o[1].trim():"end",c=n.includes("%")?e*parseInt(n.replace("%","").trim())*.01:parseInt(n),h=r.includes("%")?e*parseInt(r.replace("%","").trim())*.01:parseInt(r);switch(this.isInFold&&(l="fold"),l){case"start":this.intersection.start=this.metrics.offsetStart-e+c;break;case"middle":this.intersection.start=this.metrics.offsetStart-e+c+t*.5;break;case"end":this.intersection.start=this.metrics.offsetStart-e+c+t;break;case"fold":this.intersection.start=0;break;default:this.intersection.start=this.metrics.offsetStart-e+c;break}switch(a){case"start":this.intersection.end=this.metrics.offsetStart-h;break;case"middle":this.intersection.end=this.metrics.offsetStart-h+t*.5;break;case"end":this.intersection.end=this.metrics.offsetStart-h+t;break;default:this.intersection.end=this.metrics.offsetStart-h+t;break}if(this.intersection.end<=this.intersection.start)switch(a){case"start":this.intersection.end=this.intersection.start+1;break;case"middle":this.intersection.end=this.intersection.start+t*.5;break;case"end":this.intersection.end=this.intersection.start+t;break;default:this.intersection.end=this.intersection.start+1;break}}_computeProgress(e){let t=e!=null?e:Ce(0,1,Ae(this.intersection.start,this.intersection.end,this.currentScroll));if(this.progress=t,t!=this.lastProgress){if(this.lastProgress=t,this.attributes.scrollCssProgress&&this._setCssProgress(t),this.attributes.scrollEventProgress&&this._setCustomEventProgress(t),this.attributes.scrollModuleProgress)for(let s of this.progressModularModules)this.modularInstance&&this.modularInstance.call(Me,t,s.moduleName,s.moduleId);t>0&&t<1&&this.setInview(),t===0&&this.setOutOfView(),t===1&&this.setOutOfView()}}_setCssProgress(e=0){this.$el.style.setProperty(Re,e.toString())}_setCustomEventProgress(e=0){let t=this.attributes.scrollEventProgress;if(!t)return;let s=new CustomEvent(t,{detail:{target:this.$el,progress:e}});window.dispatchEvent(s)}_getProgressModularModules(){if(!this.modularInstance)return;let e=Object.keys(this.$el.dataset).filter(s=>s.includes("module")),t=Object.entries(this.modularInstance.modules);if(e.length)for(let s of e){let n=this.$el.dataset[s];if(!n)return;for(let r of t){let[o,l]=r;n in l&&this.progressModularModules.push({moduleName:o,moduleId:n})}}}_getScrollCallFrom(){let e=Pt([this.intersection.start,this.intersection.end],this.currentScroll);return this.intersection.start===e?"start":"end"}_dispatchCall(e,t){var s,n;let r=(s=this.attributes.scrollCall)==null?void 0:s.split(","),o=(n=this.attributes)==null?void 0:n.scrollCallSelf;if(r&&r.length>1){var l;let[a,c,h]=r,u;o?u=this.$el.dataset[`module${c.trim()}`]:u=h,this.modularInstance&&this.modularInstance.call(a.trim(),{target:this.$el,way:e,from:t},c.trim(),(l=u)==null?void 0:l.trim())}else if(r){let[a]=r,c=new CustomEvent(a,{detail:{target:this.$el,way:e,from:t}});window.dispatchEvent(c)}}},ke=["scrollOffset","scrollPosition","scrollModuleProgress","scrollCssProgress","scrollEventProgress","scrollSpeed"],Le="-1px -1px -1px -1px",ze="100% 100% 100% 100%",rt=class{constructor({$el:e,modularInstance:t,triggerRootMargin:s,rafRootMargin:n,scrollOrientation:r}){if(this.$scrollContainer=void 0,this.modularInstance=void 0,this.triggerRootMargin=void 0,this.rafRootMargin=void 0,this.scrollElements=void 0,this.triggeredScrollElements=void 0,this.RAFScrollElements=void 0,this.scrollElementsToUpdate=void 0,this.IOTriggerInstance=void 0,this.IORafInstance=void 0,this.scrollOrientation=void 0,!e){console.error("Please provide a DOM Element as scrollContainer");return}this.$scrollContainer=e,this.modularInstance=t,this.scrollOrientation=r,this.triggerRootMargin=s!=null?s:Le,this.rafRootMargin=n!=null?n:ze,this.scrollElements=[],this.triggeredScrollElements=[],this.RAFScrollElements=[],this.scrollElementsToUpdate=[],this._init()}_init(){let e=this.$scrollContainer.querySelectorAll("[data-scroll]"),t=Array.from(e);this._subscribeScrollElements(t),this.IOTriggerInstance=new B({scrollElements:[...this.triggeredScrollElements],rootMargin:this.triggerRootMargin,IORaf:!1}),this.IORafInstance=new B({scrollElements:[...this.RAFScrollElements],rootMargin:this.rafRootMargin,IORaf:!0})}destroy(){this.IOTriggerInstance.destroy(),this.IORafInstance.destroy(),this._unsubscribeAllScrollElements()}onResize({currentScroll:e}){for(let t of this.RAFScrollElements)t.onResize({currentScroll:e})}onRender({currentScroll:e,smooth:t}){for(let s of this.scrollElementsToUpdate)s.onRender({currentScroll:e,smooth:t})}removeScrollElements(e){let t=e.querySelectorAll("[data-scroll]");if(t.length){for(let s=0;s<this.triggeredScrollElements.length;s++){let n=this.triggeredScrollElements[s];Array.from(t).indexOf(n.$el)>-1&&(this.IOTriggerInstance.unobserve(n.$el),this.triggeredScrollElements.splice(s,1))}for(let s=0;s<this.RAFScrollElements.length;s++){let n=this.RAFScrollElements[s];Array.from(t).indexOf(n.$el)>-1&&(this.IORafInstance.unobserve(n.$el),this.RAFScrollElements.splice(s,1))}t.forEach(s=>{let n=this.scrollElementsToUpdate.find(o=>o.$el===s),r=this.scrollElements.find(o=>o.$el===s);n&&this._unsubscribeElementUpdate(n),r&&(this.scrollElements=this.scrollElements.filter(o=>o.id!=r.id))})}}addScrollElements(e){let t=e.querySelectorAll("[data-scroll]"),s=[];this.scrollElements.forEach(l=>{s.push(l.id)});let r=Math.max(...s)+1,o=Array.from(t);this._subscribeScrollElements(o,r,!0)}_subscribeScrollElements(e,t=0,s=!1){for(let n=0;n<e.length;n++){let r=e[n],o=this._checkRafNeeded(r),l=new nt({$el:r,id:t+n,scrollOrientation:this.scrollOrientation,modularInstance:this.modularInstance,subscribeElementUpdateFn:this._subscribeElementUpdate.bind(this),unsubscribeElementUpdateFn:this._unsubscribeElementUpdate.bind(this),needRaf:o});this.scrollElements.push(l),o?(this.RAFScrollElements.push(l),s&&(this.IORafInstance.scrollElements.push(l),this.IORafInstance.observe(l.$el))):(this.triggeredScrollElements.push(l),s&&(this.IOTriggerInstance.scrollElements.push(l),this.IOTriggerInstance.observe(l.$el)))}}_unsubscribeAllScrollElements(){this.scrollElements=[],this.RAFScrollElements=[],this.triggeredScrollElements=[],this.scrollElementsToUpdate=[]}_subscribeElementUpdate(e){this.scrollElementsToUpdate.push(e)}_unsubscribeElementUpdate(e){this.scrollElementsToUpdate=this.scrollElementsToUpdate.filter(t=>t.id!=e.id)}_checkRafNeeded(e){let t=[...ke],s=n=>{t=t.filter(r=>r!=n)};if(e.dataset.scrollOffset){if(e.dataset.scrollOffset.split(",").map(r=>r.replace("%","").trim()).join(",")!="0,0")return!0;s("scrollOffset")}else s("scrollOffset");if(e.dataset.scrollPosition){if(e.dataset.scrollPosition.trim()!="top,bottom")return!0;s("scrollPosition")}else s("scrollPosition");if(e.dataset.scrollSpeed&&!isNaN(parseFloat(e.dataset.scrollSpeed)))return!0;s("scrollSpeed");for(let n of t)if(n in e.dataset)return!0;return!1}},ot=class{constructor({resizeElements:e,resizeCallback:t=()=>{}}){this.$resizeElements=void 0,this.isFirstObserve=void 0,this.observer=void 0,this.resizeCallback=void 0,this.$resizeElements=e,this.resizeCallback=t,this.isFirstObserve=!0,this._init()}_init(){let e=t=>{var s;!this.isFirstObserve&&((s=this.resizeCallback)==null||s.call(this)),this.isFirstObserve=!1};this.observer=new ResizeObserver(e);for(let t of this.$resizeElements)this.observer.observe(t)}destroy(){this.observer.disconnect()}},$t={wrapper:window,content:document.documentElement,lerp:.1,duration:1.2,orientation:"vertical",gestureOrientation:"vertical",smoothWheel:!0,smoothTouch:!1,wheelMultiplier:1,touchMultiplier:2,normalizeWheel:!0,easing:i=>Math.min(1,1.001-Math.pow(2,-10*i))},V=class{constructor({lenisOptions:e={},modularInstance:t,triggerRootMargin:s,rafRootMargin:n,autoResize:r=!0,autoStart:o=!0,scrollCallback:l=()=>{},initCustomTicker:a,destroyCustomTicker:c}={}){this.rafPlaying=void 0,this.lenisInstance=void 0,this.coreInstance=void 0,this.lenisOptions=void 0,this.modularInstance=void 0,this.triggerRootMargin=void 0,this.rafRootMargin=void 0,this.rafInstance=void 0,this.autoResize=void 0,this.autoStart=void 0,this.ROInstance=void 0,this.initCustomTicker=void 0,this.destroyCustomTicker=void 0,this._onRenderBind=void 0,this._onResizeBind=void 0,this._onScrollToBind=void 0,this.lenisOptions=it({},$t,e),Object.assign(this,{lenisOptions:e,modularInstance:t,triggerRootMargin:s,rafRootMargin:n,autoResize:r,autoStart:o,scrollCallback:l,initCustomTicker:a,destroyCustomTicker:c}),this._onRenderBind=this._onRender.bind(this),this._onScrollToBind=this._onScrollTo.bind(this),this._onResizeBind=this._onResize.bind(this),this.rafPlaying=!1,this._init()}_init(){var e;this.lenisInstance=new H({wrapper:this.lenisOptions.wrapper,content:this.lenisOptions.content,lerp:this.lenisOptions.lerp,duration:this.lenisOptions.duration,orientation:this.lenisOptions.orientation,gestureOrientation:this.lenisOptions.gestureOrientation,smoothWheel:this.lenisOptions.smoothWheel,smoothTouch:this.lenisOptions.smoothTouch,wheelMultiplier:this.lenisOptions.wheelMultiplier,touchMultiplier:this.lenisOptions.touchMultiplier,normalizeWheel:this.lenisOptions.normalizeWheel,easing:this.lenisOptions.easing}),(e=this.lenisInstance)==null||e.on("scroll",this.scrollCallback),document.documentElement.setAttribute("data-scroll-orientation",this.lenisInstance.options.orientation),requestAnimationFrame(()=>{this.coreInstance=new rt({$el:this.lenisInstance.rootElement,modularInstance:this.modularInstance,triggerRootMargin:this.triggerRootMargin,rafRootMargin:this.rafRootMargin,scrollOrientation:this.lenisInstance.options.orientation}),this._bindEvents(),this.initCustomTicker&&!this.destroyCustomTicker?console.warn("initCustomTicker callback is declared, but destroyCustomTicker is not. Please pay attention. It could cause trouble."):!this.initCustomTicker&&this.destroyCustomTicker&&console.warn("destroyCustomTicker callback is declared, but initCustomTicker is not. Please pay attention. It could cause trouble."),this.autoStart&&this.start()})}destroy(){this.stop(),this._unbindEvents(),this.lenisInstance.destroy(),this.coreInstance.destroy()}_bindEvents(){this._bindScrollToEvents(),this.autoResize&&("ResizeObserver"in window?this.ROInstance=new ot({resizeElements:[document.body],resizeCallback:this._onResizeBind}):window.addEventListener("resize",this._onResizeBind))}_unbindEvents(){this._unbindScrollToEvents(),this.autoResize&&("ResizeObserver"in window?this.ROInstance&&this.ROInstance.destroy():window.removeEventListener("resize",this._onResizeBind))}_bindScrollToEvents(e){let t=e||this.lenisInstance.rootElement,s=t==null?void 0:t.querySelectorAll("[data-scroll-to]");s!=null&&s.length&&s.forEach(n=>{n.addEventListener("click",this._onScrollToBind,!1)})}_unbindScrollToEvents(e){let t=e||this.lenisInstance.rootElement,s=t==null?void 0:t.querySelectorAll("[data-scroll-to]");s!=null&&s.length&&s.forEach(n=>{n.removeEventListener("click",this._onScrollToBind,!1)})}_onResize(){requestAnimationFrame(()=>{var e;(e=this.coreInstance)==null||e.onResize({currentScroll:this.lenisInstance.scroll})})}_onRender(){var e,t;(e=this.lenisInstance)==null||e.raf(Date.now()),(t=this.coreInstance)==null||t.onRender({currentScroll:this.lenisInstance.scroll,smooth:this.lenisInstance.isSmooth})}_onScrollTo(e){var t;e.preventDefault();let s=(t=e.currentTarget)!=null?t:null;if(!s)return;let n=s.getAttribute("data-scroll-to-href")||s.getAttribute("href"),r=s.getAttribute("data-scroll-to-offset")||0,o=s.getAttribute("data-scroll-to-duration")||this.lenisOptions.duration||$t.duration;n&&this.scrollTo(n,{offset:typeof r=="string"?parseInt(r):r,duration:typeof o=="string"?parseInt(o):o})}start(){this.rafPlaying||(this.rafPlaying=!0,this.initCustomTicker?this.initCustomTicker(this._onRenderBind):this._raf())}stop(){this.rafPlaying&&(this.rafPlaying=!1,this.destroyCustomTicker?this.destroyCustomTicker(this._onRenderBind):this.rafInstance&&cancelAnimationFrame(this.rafInstance))}removeScrollElements(e){var t;if(!e){console.error("Please provide a DOM Element as $oldContainer");return}this._unbindScrollToEvents(e),(t=this.coreInstance)==null||t.removeScrollElements(e)}addScrollElements(e){var t;if(!e){console.error("Please provide a DOM Element as $newContainer");return}(t=this.coreInstance)==null||t.addScrollElements(e),requestAnimationFrame(()=>{this._bindScrollToEvents(e)})}resize(){this._onResizeBind()}scrollTo(e,t){var s;(s=this.lenisInstance)==null||s.scrollTo(e,{offset:t==null?void 0:t.offset,lerp:t==null?void 0:t.lerp,duration:t==null?void 0:t.duration,immediate:t==null?void 0:t.immediate,lock:t==null?void 0:t.lock,force:t==null?void 0:t.force,easing:t==null?void 0:t.easing,onComplete:t==null?void 0:t.onComplete})}_raf(){this._onRenderBind(),this.rafInstance=requestAnimationFrame(()=>this._raf())}};var G=class extends A{constructor(i){super(i)}init(){this.scroll=new V({modularInstance:this})}lazyLoad(i){kt(i.target,null,()=>{})}scrollTo(i){var n;let s=i,{target:e}=s,t=dt(s,["target"]);t=Object.assign({duration:1},t),(n=this.scroll)==null||n.scrollTo(e,t)}destroy(){this.scroll.destroy()}};var jt=se(Ft(),1);var Y;y(void 0,null,function*(){if(M.IS_DEV){let i=yield Promise.resolve().then(()=>(Wt(),Nt));Y=i==null?void 0:i.gridHelper}});function Ht(){(0,jt.default)(),Y==null||Y()}var Bt=(i,e,t=!1)=>{let s=null;return(...n)=>{clearTimeout(s);let r=()=>{s=null,t||i(...n)};t&&!s&&i(...n),s=setTimeout(r,e)}};var T=document.documentElement,Es=document.body;var Vt=new bt({modules:lt});window.addEventListener("load",i=>{let e=document.getElementById("main-css");e?e.isLoaded?Gt():e.addEventListener("load",t=>{Gt()}):console.warn('The "main-css" stylesheet not found')});function Gt(){Ht(),Vt.init(Vt),T.classList.add(b.LOADED),T.classList.add(b.READY),T.classList.remove(b.LOADING);let i=new CustomEvent(wt.RESIZE_END);window.addEventListener("resize",()=>{T.style.setProperty("--vw",`${document.documentElement.clientWidth*.01}px`),Bt(()=>{window.dispatchEvent(i)},200,!1)}),_t&&Ot(F.EAGER,M.IS_DEV).then(e=>{T.classList.add(b.FONTS_LOADED),M.IS_DEV&&(console.group("Eager fonts loaded!",e.length,"/",document.fonts.size),console.group("State of eager fonts:"),e.forEach(t=>console.log(t.family,t.style,t.weight,t.status)),console.groupEnd(),console.group("State of all fonts:"),document.fonts.forEach(t=>console.log(t.family,t.style,t.weight,t.status)),console.groupEnd())})}})();
|
|
/*! Bundled license information:
|
|
|
|
svg4everybody/dist/svg4everybody.js:
|
|
(*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody *)
|
|
*/
|
|
//# sourceMappingURL=app.js.map
|