mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
11 lines
82 KiB
JavaScript
11 lines
82 KiB
JavaScript
(()=>{var De=Object.create;var B=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames,q=Object.getOwnPropertySymbols,je=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable;var Ht=(s,t,e)=>t in s?B(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,qt=(s,t)=>{for(var e in t||(t={}))gt.call(t,e)&&Ht(s,e,t[e]);if(q)for(var e of q(t))Wt.call(t,e)&&Ht(s,e,t[e]);return s};var G=(s,t)=>{var e={};for(var i in s)gt.call(s,i)&&t.indexOf(i)<0&&(e[i]=s[i]);if(s!=null&&q)for(var i of q(s))t.indexOf(i)<0&&Wt.call(s,i)&&(e[i]=s[i]);return e};var He=(s,t)=>()=>(s&&(t=s(s=0)),t);var We=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports),Bt=(s,t)=>{for(var e in t)B(s,e,{get:t[e],enumerable:!0})},qe=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ne(t))!gt.call(s,n)&&n!==e&&B(s,n,{get:()=>t[n],enumerable:!(i=Ve(t,n))||i.enumerable});return s};var Be=(s,t,e)=>(e=s!=null?De(je(s)):{},qe(t||!s||!s.__esModule?B(e,"default",{value:s,enumerable:!0}):e,s));var y=(s,t,e)=>new Promise((i,n)=>{var r=l=>{try{a(e.next(l))}catch(c){n(c)}},o=l=>{try{a(e.throw(l))}catch(c){n(c)}},a=l=>l.done?i(l.value):Promise.resolve(l.value).then(r,o);a((e=e.apply(s,t)).next())});var Re=We((_e,ft)=>{(function(s,t){typeof define=="function"&&define.amd?define([],function(){return s.svg4everybody=t()}):typeof ft=="object"&&ft.exports?ft.exports=t():s.svg4everybody=t()})(_e,function(){function s(n,r,o){if(o){var a=document.createDocumentFragment(),l=!r.hasAttribute("viewBox")&&o.getAttribute("viewBox");l&&r.setAttribute("viewBox",l);for(var c=o.cloneNode(!0);c.childNodes.length;)a.appendChild(c.firstChild);n.appendChild(a)}}function t(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 a=n._cachedTarget[o.id];a||(a=n._cachedTarget[o.id]=r.getElementById(o.id)),s(o.parent,o.svg,a)})}},n.onreadystatechange()}function e(n){function r(){for(var m=0;m<w.length;){var I=w[m],O=I.parentNode,v=i(O),b=I.getAttribute("xlink:href")||I.getAttribute("href");if(!b&&a.attributeName&&(b=I.getAttribute(a.attributeName)),v&&b){if(o)if(!a.validate||a.validate(b,v,I)){O.removeChild(I);var S=b.split("#"),_=S.shift(),C=S.join("#");if(_.length){var M=f[_];M||(M=f[_]=new XMLHttpRequest,M.open("GET",_),M.send(),M._embeds=[]),M._embeds.push({parent:O,svg:v,id:C}),t(M)}else s(O,v,document.getElementById(C))}else++m,++g}else++m}(!w.length||w.length-g>0)&&p(r,67)}var o,a=Object(n),l=/\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 a?a.polyfill:l.test(navigator.userAgent)||(navigator.userAgent.match(h)||[])[1]<10547||(navigator.userAgent.match(c)||[])[1]<537||u.test(navigator.userAgent)&&d;var f={},p=window.requestAnimationFrame||setTimeout,w=document.getElementsByTagName("use"),g=0;o&&r()}function i(n){for(var r=n;r.nodeName.toLowerCase()!=="svg"&&(r=r.parentNode););return r}return e})});var Te={};Bt(Te,{gridHelper:()=>Hs});function Hs({gutterCssVar:s=Vs,marginCssVar:t=Ns,rgbaColor:e=js}={}){let i=document.createElement("div");document.body.append(i),Ae(i,e),Ws(i,s,t),qs(i,e)}function Ws(s,t,e){let i=s.style;i.zIndex="10000",i.position="fixed",i.top="0",i.left="0",i.display="flex",i.width="100%",i.height="100%",i.columnGap=`var(${t}, 0)`,i.paddingLeft=`var(${e}, 0)`,i.paddingRight=`var(${e}, 0)`,i.pointerEvents="none",i.visibility="hidden"}function Ae(s,t){s.innerHTML="";let e=Number(window.getComputedStyle(s).getPropertyValue("--grid-columns")),i;for(var n=0;n<e;n++)i=document.createElement("div"),i.style.flex="1 1 0",i.style.backgroundColor=t,s.appendChild(i)}function qs(s,t){window.addEventListener("resize",Ae(s,t));let e=!1,i=!1;document.addEventListener("keydown",n=>{n.key=="Control"?e=!0:e&&n.key=="g"&&(i?s.style.visibility="hidden":s.style.visibility="visible",i=!i)}),document.addEventListener("keyup",n=>{n.key=="Control"&&(e=!1)})}var Vs,Ns,js,Ce=He(()=>{Vs="--grid-gutter",Ns="--grid-margin",js="rgba(255, 0, 0, .1)"});function K(s){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?K=function(t){return typeof t}:K=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},K(s)}function Kt(s,t){if(!(s instanceof t))throw new TypeError("Cannot call a class as a function")}function Gt(s,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(s,i.key,i)}}function Xt(s,t,e){return t&&Gt(s.prototype,t),e&&Gt(s,e),s}function Yt(s,t,e){return t in s?Object.defineProperty(s,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):s[t]=e,s}function Y(s,t){return Ke(s)||Ze(s,t)||Zt(s,t)||Qe()}function Ge(s){return Ye(s)||Xe(s)||Zt(s)||Je()}function Ye(s){if(Array.isArray(s))return vt(s)}function Ke(s){if(Array.isArray(s))return s}function Xe(s){if(typeof Symbol!="undefined"&&Symbol.iterator in Object(s))return Array.from(s)}function Ze(s,t){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(s)))){var e=[],i=!0,n=!1,r=void 0;try{for(var o=s[Symbol.iterator](),a;!(i=(a=o.next()).done)&&(e.push(a.value),!(t&&e.length===t));i=!0);}catch(l){n=!0,r=l}finally{try{!i&&o.return!=null&&o.return()}finally{if(n)throw r}}return e}}function Zt(s,t){if(s){if(typeof s=="string")return vt(s,t);var e=Object.prototype.toString.call(s).slice(8,-1);if(e==="Object"&&s.constructor&&(e=s.constructor.name),e==="Map"||e==="Set")return Array.from(s);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return vt(s,t)}}function vt(s,t){(t==null||t>s.length)&&(t=s.length);for(var e=0,i=new Array(t);e<t;e++)i[e]=s[e];return i}function Je(){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 Qe(){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 U=function(){function s(t){Kt(this,s),this.mAttr="data-"+t.dataName,this.mCaptureEvents=["mouseenter","mouseleave"],this.el=t.el}return Xt(s,[{key:"mInit",value:function(e){var i=this;this.modules=e,this.mCheckEventTarget=this.mCheckEventTarget.bind(this),this.events&&Object.keys(this.events).forEach(function(n){return i.mAddEvent(n)})}},{key:"mUpdate",value:function(e){this.modules=e}},{key:"mDestroy",value:function(){var e=this;this.events&&Object.keys(this.events).forEach(function(i){return e.mRemoveEvent(i)})}},{key:"mAddEvent",value:function(e){var i=!!this.mCaptureEvents.includes(e);this.el.addEventListener(e,this.mCheckEventTarget,i)}},{key:"mRemoveEvent",value:function(e){var i=!!this.mCaptureEvents.includes(e);this.el.removeEventListener(e,this.mCheckEventTarget,i)}},{key:"mCheckEventTarget",value:function(e){var i=this.events[e.type];if(typeof i=="string")this[i](e);else{var n="["+this.mAttr+"]",r=e.target;if(this.mCaptureEvents.includes(e.type))r.matches(n)&&this.mCallEventMethod(e,i,r);else for(;r&&r!==document&&!(r.matches(n)&&this.mCallEventMethod(e,i,r)!="undefined");)r=r.parentNode}}},{key:"mCallEventMethod",value:function(e,i,n){var r=n.getAttribute(this.mAttr);if(i.hasOwnProperty(r)){var o=i[r];e.hasOwnProperty("currentTarget")||Object.defineProperty(e,"currentTarget",{value:n}),e.hasOwnProperty("curTarget")||Object.defineProperty(e,"curTarget",{value:n}),this[o](e)}}},{key:"$",value:function(e,i){var n=e.indexOf("."),r=e.indexOf("#"),o=e.indexOf("["),a=[n,r,o].filter(function(d){return d!=-1}),l=!1,c=e,h="",u=this.el;return a.length&&(l=Math.min.apply(Math,Ge(a)),c=e.slice(0,l),h=e.slice(l)),K(i)=="object"&&(u=i),u.querySelectorAll("["+this.mAttr+"="+c+"]"+h)}},{key:"parent",value:function(e,i){for(var n="["+this.mAttr+"="+e+"]",r=i.parentNode;r&&r!==document;){if(r.matches(n))return r;r=r.parentNode}}},{key:"getData",value:function(e,i){var n=i||this.el;return n.getAttribute(this.mAttr+"-"+e)}},{key:"setData",value:function(e,i,n){var r=n||this.el;return r.setAttribute(this.mAttr+"-"+e,i)}},{key:"call",value:function(e,i,n,r){var o=this;i&&!n&&(n=i,i=!1),this.modules[n]&&(r?this.modules[n][r]&&this.modules[n][r][e](i):Object.keys(this.modules[n]).forEach(function(a){o.modules[n][a][e](i)}))}},{key:"on",value:function(e,i,n,r){var o=this;this.modules[i]&&(r?this.modules[i][r].el.addEventListener(e,function(a){return n(a)}):Object.keys(this.modules[i]).forEach(function(a){o.modules[i][a].el.addEventListener(e,function(l){return n(l)})}))}},{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),s}(),ts=function(){function s(t){Kt(this,s),this.app,this.modules=t.modules,this.currentModules={},this.activeModules={},this.newModules={},this.moduleId=0}return Xt(s,[{key:"init",value:function(e,i){var n=this,r=i||document,o=r.querySelectorAll("*");e&&!this.app&&(this.app=e),this.activeModules.app={app:this.app},o.forEach(function(a){Array.from(a.attributes).forEach(function(l){if(l.name.startsWith("data-module")){var c=!1,h=l.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:a,name:u,dataName:h.join("-")},f=new n.modules[u](d),p=l.value;p||(n.moduleId++,p="m"+n.moduleId,a.setAttribute(l.name,p)),n.addActiveModule(u,p,f);var w=u+"-"+p;i?n.newModules[w]=f:n.currentModules[w]=f}}})}),Object.entries(this.currentModules).forEach(function(a){var l=Y(a,2),c=l[0],h=l[1];if(i){var u=c.split("-"),d=u.shift(),f=u.pop();n.addActiveModule(d,f,h)}else n.initModule(h)})}},{key:"initModule",value:function(e){e.mInit(this.activeModules),e.init()}},{key:"addActiveModule",value:function(e,i,n){this.activeModules[e]?Object.assign(this.activeModules[e],Yt({},i,n)):this.activeModules[e]=Yt({},i,n)}},{key:"update",value:function(e){var i=this;this.init(this.app,e),Object.entries(this.currentModules).forEach(function(n){var r=Y(n,2),o=r[0],a=r[1];a.mUpdate(i.activeModules)}),Object.entries(this.newModules).forEach(function(n){var r=Y(n,2),o=r[0],a=r[1];i.initModule(a)}),Object.assign(this.currentModules,this.newModules)}},{key:"destroy",value:function(e){e?this.destroyScope(e):this.destroyModules()}},{key:"destroyScope",value:function(e){var i=this,n=e.querySelectorAll("*");n.forEach(function(r){Array.from(r.attributes).forEach(function(o){if(o.name.startsWith("data-module")){var a=o.value,l=o.name.split("-").splice(2),c=i.toCamel(l)+"-"+a,h=!1;i.currentModules[c]?h=!0:i.currentModules[i.toUpper(c)]&&(c=i.toUpper(c),h=!0),h&&(i.destroyModule(i.currentModules[c]),delete i.currentModules[c])}})}),this.activeModules={},this.newModules={}}},{key:"destroyModules",value:function(){var e=this;Object.entries(this.currentModules).forEach(function(i){var n=Y(i,2),r=n[0],o=n[1];e.destroyModule(o)}),this.currentModules=[]}},{key:"destroyModule",value:function(e){e.mDestroy(),e.destroy()}},{key:"toCamel",value:function(e){var i=this;return e.reduce(function(n,r){return n+i.toUpper(r)})}},{key:"toUpper",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}]),s}(),Jt=ts;var Vt={};Bt(Vt,{Dialog:()=>X,Load:()=>ot,Scroll:()=>dt});var X=class extends U{constructor(s){super(s),this.$closeBtn=this.$("close")[0]}init(){this.onKeyDown=this.onKeyDown.bind(this)}onKeyDown(s){s.key==="Escape"&&(console.log("ESCAPE"),s.preventDefault(),this.$closeBtn.click())}populate(s){this.el.appendChild(s)}show(){this.el.showModal(),window.addEventListener("keydown",this.onKeyDown)}close(){window.removeEventListener("keydown",this.onKeyDown),this.el.close()}};var wt=new WeakMap;function yt(s,t,e,i){var a,l;if(!s&&!wt.has(t))return!1;let n=(a=wt.get(t))!=null?a:new WeakMap;wt.set(t,n);let r=(l=n.get(e))!=null?l:new Set;n.set(e,r);let o=r.has(i);return s?r.add(i):r.delete(i),o&&s}function es(s,t){let e=s.target;if(e instanceof Text&&(e=e.parentElement),e instanceof Element&&s.currentTarget instanceof Element){let i=e.closest(t);if(i&&s.currentTarget.contains(i))return i}}function ss(s,t,e,i={}){let{signal:n,base:r=document}=i;if(n!=null&&n.aborted)return;let f=i,{once:o}=f,a=G(f,["once"]),l=r instanceof Document?r.documentElement:r,c=Boolean(typeof i=="object"?i.capture:i),h=p=>{let w=es(p,s);if(w){let g=Object.assign(p,{delegateTarget:w});e.call(l,g),o&&(l.removeEventListener(t,h,a),yt(!1,l,e,u))}},u=JSON.stringify({selector:s,type:t,capture:c});yt(!0,l,e,u)||l.addEventListener(t,h,a),n==null||n.addEventListener("abort",()=>{yt(!1,l,e,u)})}var Z=ss;function is(s){for(var t=[],e=0;e<s.length;){var i=s[e];if(i==="*"||i==="+"||i==="?"){t.push({type:"MODIFIER",index:e,value:s[e++]});continue}if(i==="\\"){t.push({type:"ESCAPED_CHAR",index:e++,value:s[e++]});continue}if(i==="{"){t.push({type:"OPEN",index:e,value:s[e++]});continue}if(i==="}"){t.push({type:"CLOSE",index:e,value:s[e++]});continue}if(i===":"){for(var n="",r=e+1;r<s.length;){var o=s.charCodeAt(r);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){n+=s[r++];continue}break}if(!n)throw new TypeError("Missing parameter name at ".concat(e));t.push({type:"NAME",index:e,value:n}),e=r;continue}if(i==="("){var a=1,l="",r=e+1;if(s[r]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(r));for(;r<s.length;){if(s[r]==="\\"){l+=s[r++]+s[r++];continue}if(s[r]===")"){if(a--,a===0){r++;break}}else if(s[r]==="("&&(a++,s[r+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(r));l+=s[r++]}if(a)throw new TypeError("Unbalanced pattern at ".concat(e));if(!l)throw new TypeError("Missing pattern at ".concat(e));t.push({type:"PATTERN",index:e,value:l}),e=r;continue}t.push({type:"CHAR",index:e,value:s[e++]})}return t.push({type:"END",index:e,value:""}),t}function ns(s,t){t===void 0&&(t={});for(var e=is(s),i=t.prefixes,n=i===void 0?"./":i,r="[^".concat(F(t.delimiter||"/#?"),"]+?"),o=[],a=0,l=0,c="",h=function(S){if(l<e.length&&e[l].type===S)return e[l++].value},u=function(S){var _=h(S);if(_!==void 0)return _;var C=e[l],M=C.type,x=C.index;throw new TypeError("Unexpected ".concat(M," at ").concat(x,", expected ").concat(S))},d=function(){for(var S="",_;_=h("CHAR")||h("ESCAPED_CHAR");)S+=_;return S};l<e.length;){var f=h("CHAR"),p=h("NAME"),w=h("PATTERN");if(p||w){var g=f||"";n.indexOf(g)===-1&&(c+=g,g=""),c&&(o.push(c),c=""),o.push({name:p||a++,prefix:g,suffix:"",pattern:w||r,modifier:h("MODIFIER")||""});continue}var m=f||h("ESCAPED_CHAR");if(m){c+=m;continue}c&&(o.push(c),c="");var I=h("OPEN");if(I){var g=d(),O=h("NAME")||"",v=h("PATTERN")||"",b=d();u("CLOSE"),o.push({name:O||(v?a++:""),pattern:O&&!v?r:v,prefix:g,suffix:b,modifier:h("MODIFIER")||""});continue}u("END")}return o}function Qt(s,t){var e=[],i=ee(s,e,t);return rs(i,e,t)}function rs(s,t,e){e===void 0&&(e={});var i=e.decode,n=i===void 0?function(r){return r}:i;return function(r){var o=s.exec(r);if(!o)return!1;for(var a=o[0],l=o.index,c=Object.create(null),h=function(d){if(o[d]===void 0)return"continue";var f=t[d-1];f.modifier==="*"||f.modifier==="+"?c[f.name]=o[d].split(f.prefix+f.suffix).map(function(p){return n(p,f)}):c[f.name]=n(o[d],f)},u=1;u<o.length;u++)h(u);return{path:a,index:l,params:c}}}function F(s){return s.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function te(s){return s&&s.sensitive?"":"i"}function os(s,t){if(!t)return s;for(var e=/\((?:\?<(.*?)>)?(?!\?)/g,i=0,n=e.exec(s.source);n;)t.push({name:n[1]||i++,prefix:"",suffix:"",modifier:"",pattern:""}),n=e.exec(s.source);return s}function as(s,t,e){var i=s.map(function(n){return ee(n,t,e).source});return new RegExp("(?:".concat(i.join("|"),")"),te(e))}function ls(s,t,e){return cs(ns(s,e),t,e)}function cs(s,t,e){e===void 0&&(e={});for(var i=e.strict,n=i===void 0?!1:i,r=e.start,o=r===void 0?!0:r,a=e.end,l=a===void 0?!0:a,c=e.encode,h=c===void 0?function(x){return x}:c,u=e.delimiter,d=u===void 0?"/#?":u,f=e.endsWith,p=f===void 0?"":f,w="[".concat(F(p),"]|$"),g="[".concat(F(d),"]"),m=o?"^":"",I=0,O=s;I<O.length;I++){var v=O[I];if(typeof v=="string")m+=F(h(v));else{var b=F(h(v.prefix)),S=F(h(v.suffix));if(v.pattern)if(t&&t.push(v),b||S)if(v.modifier==="+"||v.modifier==="*"){var _=v.modifier==="*"?"?":"";m+="(?:".concat(b,"((?:").concat(v.pattern,")(?:").concat(S).concat(b,"(?:").concat(v.pattern,"))*)").concat(S,")").concat(_)}else m+="(?:".concat(b,"(").concat(v.pattern,")").concat(S,")").concat(v.modifier);else v.modifier==="+"||v.modifier==="*"?m+="((?:".concat(v.pattern,")").concat(v.modifier,")"):m+="(".concat(v.pattern,")").concat(v.modifier);else m+="(?:".concat(b).concat(S,")").concat(v.modifier)}}if(l)n||(m+="".concat(g,"?")),m+=e.endsWith?"(?=".concat(w,")"):"$";else{var C=s[s.length-1],M=typeof C=="string"?g.indexOf(C[C.length-1])>-1:C===void 0;n||(m+="(?:".concat(g,"(?=").concat(w,"))?")),M||(m+="(?=".concat(g,"|").concat(w,")"))}return new RegExp(m,te(e))}function ee(s,t,e){return s instanceof RegExp?os(s,t):Array.isArray(s)?as(s,t,e):ls(s,t,e)}function R(){return R=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}return s},R.apply(this,arguments)}var st=(s,t)=>String(s).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||t||"",P=({hash:s}={})=>window.location.pathname+window.location.search+(s?window.location.hash:""),hs=(s,t={})=>{let e=R({url:s=s||P({hash:!0}),random:Math.random(),source:"swup"},t);window.history.pushState(e,"",s)},j=(s=null,t={})=>{s=s||P({hash:!0});let e=R({},window.history.state||{},{url:s,random:Math.random(),source:"swup"},t);window.history.replaceState(e,"",s)},us=(s,t,e,i)=>{let n=new AbortController;return i=R({},i,{signal:n.signal}),Z(s,t,e,i),{destroy:()=>n.abort()}},A=class extends URL{constructor(t,e=document.baseURI){super(t.toString(),e),Object.setPrototypeOf(this,A.prototype)}get url(){return this.pathname+this.search}static fromElement(t){let e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new A(e)}static fromUrl(t){return new A(t)}},Ot=(s,t)=>{try{return Qt(s,t)}catch(e){throw new Error(`[swup] Error parsing path "${String(s)}":
|
|
${String(e)}`)}},z=class extends Error{constructor(t,e){super(t),this.url=void 0,this.status=void 0,this.aborted=void 0,this.timedOut=void 0,this.name="FetchError",this.url=e.url,this.status=e.status,this.aborted=e.aborted||!1,this.timedOut=e.timedOut||!1}};function ds(e){return y(this,arguments,function*(s,t={}){var i;s=A.fromUrl(s).url;let{visit:n=this.visit}=t,r=R({},this.options.requestHeaders,t.headers),o=(i=t.timeout)!=null?i:this.options.timeout,a=new AbortController,{signal:l}=a;t=R({},t,{headers:r,signal:l});let c,h=!1,u=null;o&&o>0&&(u=setTimeout(()=>{h=!0,a.abort("timeout")},o));try{c=yield this.hooks.call("fetch:request",n,{url:s,options:t},(m,{url:I,options:O})=>fetch(I,O)),u&&clearTimeout(u)}catch(m){throw h?(this.hooks.call("fetch:timeout",n,{url:s}),new z(`Request timed out: ${s}`,{url:s,timedOut:h})):(m==null?void 0:m.name)==="AbortError"||l.aborted?new z(`Request aborted: ${s}`,{url:s,aborted:!0}):m}let{status:d,url:f}=c,p=yield c.text();if(d===500)throw this.hooks.call("fetch:error",n,{status:d,response:c,url:f}),new z(`Server error: ${f}`,{status:d,url:f});if(!p)throw new z(`Empty response: ${f}`,{status:d,url:f});let{url:w}=A.fromUrl(f),g={url:w,html:p};return!n.cache.write||t.method&&t.method!=="GET"||s!==w||this.cache.set(g.url,g),g})}var bt=class{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){let t=new Map;return this.pages.forEach((e,i)=>{t.set(i,R({},e))}),t}has(t){return this.pages.has(this.resolve(t))}get(t){let e=this.pages.get(this.resolve(t));return e&&R({},e)}set(t,e){e=R({},e,{url:t=this.resolve(t)}),this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);let i=R({},this.get(t),e,{url:t});this.pages.set(t,i)}delete(t){this.pages.delete(this.resolve(t))}clear(){this.pages.clear(),this.swup.hooks.callSync("cache:clear",void 0,void 0)}prune(t){this.pages.forEach((e,i)=>{t(i,e)&&this.delete(i)})}resolve(t){let{url:e}=A.fromUrl(t);return this.swup.resolveUrl(e)}},Et=(s,t=document)=>t.querySelector(s),_t=(s,t=document)=>Array.from(t.querySelectorAll(s)),re=()=>new Promise(s=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{s()})})});function oe(s){return!!s&&(typeof s=="object"||typeof s=="function")&&typeof s.then=="function"}function fs(s,t=[]){return new Promise((e,i)=>{let n=s(...t);oe(n)?n.then(e,i):e(n)})}var se=s=>window.CSS&&window.CSS.escape?CSS.escape(s):s,ie=s=>1e3*Number(s.slice(0,-1).replace(",",".")),St=class{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){let{scope:t}=this.swup.visit.animation;return t==="containers"?this.swup.visit.containers:t==="html"?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?_t(this.selector):[]}add(...t){this.targets.forEach(e=>e.classList.add(...t))}remove(...t){this.targets.forEach(e=>e.classList.remove(...t))}clear(){this.targets.forEach(t=>{let e=t.className.split(" ").filter(i=>this.isSwupClass(i));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}},tt=class{constructor(t,e){this.id=void 0,this.state=void 0,this.from=void 0,this.to=void 0,this.containers=void 0,this.animation=void 0,this.trigger=void 0,this.cache=void 0,this.history=void 0,this.scroll=void 0;let{to:i,from:n=t.currentPageUrl,hash:r,el:o,event:a}=e;this.id=Math.random(),this.state=1,this.from={url:n},this.to={url:i,hash:r},this.containers=t.options.containers,this.animation={animate:!0,wait:!1,name:void 0,native:t.options.native,scope:t.options.animationScope,selector:t.options.animationSelector},this.trigger={el:o,event:a},this.cache={read:t.options.cache,write:t.options.cache},this.history={action:"push",popstate:!1,direction:void 0},this.scroll={reset:!0,target:void 0}}advance(t){this.state<t&&(this.state=t)}abort(){this.state=8}get done(){return this.state>=7}};function ms(s){return new tt(this,s)}var It=class{constructor(t){this.swup=void 0,this.registry=new Map,this.hooks=["animation:out:start","animation:out:await","animation:out:end","animation:in:start","animation:in:await","animation:in:end","animation:skip","cache:clear","cache:set","content:replace","content:scroll","enable","disable","fetch:request","fetch:error","fetch:timeout","history:popstate","link:click","link:self","link:anchor","link:newtab","page:load","page:view","scroll:top","scroll:anchor","visit:start","visit:transition","visit:abort","visit:end"],this.swup=t,this.init()}init(){this.hooks.forEach(t=>this.create(t))}create(t){this.registry.has(t)||this.registry.set(t,new Map)}exists(t){return this.registry.has(t)}get(t){let e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,i={}){let n=this.get(t);if(!n)return console.warn(`Hook '${t}' not found.`),()=>{};let r=R({},i,{id:n.size+1,hook:t,handler:e});return n.set(e,r),()=>this.off(t,e)}before(t,e,i={}){return this.on(t,e,R({},i,{before:!0}))}replace(t,e,i={}){return this.on(t,e,R({},i,{replace:!0}))}once(t,e,i={}){return this.on(t,e,R({},i,{once:!0}))}off(t,e){let i=this.get(t);i&&e?i.delete(e)||console.warn(`Handler for hook '${t}' not found.`):i&&i.clear()}call(t,e,i,n){return y(this,null,function*(){let[r,o,a]=this.parseCallArgs(t,e,i,n),{before:l,handler:c,after:h}=this.getHandlers(t,a);yield this.run(l,r,o);let[u]=yield this.run(c,r,o,!0);return yield this.run(h,r,o),this.dispatchDomEvent(t,r,o),u})}callSync(t,e,i,n){let[r,o,a]=this.parseCallArgs(t,e,i,n),{before:l,handler:c,after:h}=this.getHandlers(t,a);this.runSync(l,r,o);let[u]=this.runSync(c,r,o,!0);return this.runSync(h,r,o),this.dispatchDomEvent(t,r,o),u}parseCallArgs(t,e,i,n){return e instanceof tt||typeof e!="object"&&typeof i!="function"?[e,i,n]:[void 0,e,i]}run(r){return y(this,arguments,function*(t,e=this.swup.visit,i,n=!1){let o=[];for(let{hook:a,handler:l,defaultHandler:c,once:h}of t)if(e==null||!e.done){h&&this.off(a,l);try{let u=yield fs(l,[e,i,c]);o.push(u)}catch(u){if(n)throw u;console.error(`Error in hook '${a}':`,u)}}return o})}runSync(t,e=this.swup.visit,i,n=!1){let r=[];for(let{hook:o,handler:a,defaultHandler:l,once:c}of t)if(e==null||!e.done){c&&this.off(o,a);try{let h=a(e,i,l);r.push(h),oe(h)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${o}'.`)}catch(h){if(n)throw h;console.error(`Error in hook '${o}':`,h)}}return r}getHandlers(t,e){let i=this.get(t);if(!i)return{found:!1,before:[],handler:[],after:[],replaced:!1};let n=Array.from(i.values()),r=this.sortRegistrations,o=n.filter(({before:u,replace:d})=>u&&!d).sort(r),a=n.filter(({replace:u})=>u).filter(u=>!0).sort(r),l=n.filter(({before:u,replace:d})=>!u&&!d).sort(r),c=a.length>0,h=[];if(e&&(h=[{id:0,hook:t,handler:e}],c)){let u=a.length-1,d=f=>{let p=a[f-1];return p?(w,g)=>p.handler(w,g,d(f-1)):e};h=[{id:0,hook:t,handler:a[u].handler,defaultHandler:d(u)}]}return{found:!0,before:o,handler:h,after:l,replaced:c}}sortRegistrations(t,e){var i,n;return((i=t.priority)!=null?i:0)-((n=e.priority)!=null?n:0)||t.id-e.id||0}dispatchDomEvent(t,e,i){if(e!=null&&e.done)return;let n={hook:t,args:i,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:n,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:n,bubbles:!0}))}},ps=s=>{if(s&&s.charAt(0)==="#"&&(s=s.substring(1)),!s)return null;let t=decodeURIComponent(s),e=document.getElementById(s)||document.getElementById(t)||Et(`a[name='${se(s)}']`)||Et(`a[name='${se(t)}']`);return e||s!=="top"||(e=document.body),e},N="transition",J="animation";function gs(e){return y(this,arguments,function*({elements:s,selector:t}){if(t===!1&&!s)return;let i=[];if(s)i=Array.from(s);else if(t&&(i=_t(t,document.body),!i.length))return void console.warn(`[swup] No elements found matching animationSelector \`${t}\``);let n=i.map(r=>function(o){let{type:a,timeout:l,propCount:c}=function(h,u){let d=window.getComputedStyle(h),f=Q(d,`${N}Delay`),p=Q(d,`${N}Duration`),w=ne(f,p),g=Q(d,`${J}Delay`),m=Q(d,`${J}Duration`),I=ne(g,m),O=null,v=0,b=0;return v=Math.max(w,I),O=v>0?w>I?N:J:null,b=O?O===N?p.length:m.length:0,{type:O,timeout:v,propCount:b}}(o);return!(!a||!l)&&new Promise(h=>{let u=`${a}end`,d=performance.now(),f=0,p=()=>{o.removeEventListener(u,w),h()},w=g=>{if(g.target===o){if(!function(m){return[`${N}end`,`${J}end`].includes(m.type)}(g))throw new Error("Not a transition or animation event.");(performance.now()-d)/1e3<g.elapsedTime||++f>=c&&p()}};setTimeout(()=>{f<c&&p()},l+1),o.addEventListener(u,w)})}(r));n.filter(Boolean).length>0?yield Promise.all(n):t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``)})}function Q(s,t){return(s[t]||"").split(", ")}function ne(s,t){for(;s.length<t.length;)s=s.concat(s);return Math.max(...t.map((e,i)=>ie(e)+ie(s[i])))}function vs(s,t={},e={}){if(typeof s!="string")throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(s,{el:e.el,event:e.event}))return void window.location.assign(s);let{url:i,hash:n}=A.fromUrl(s),r=this.createVisit(R({},e,{to:i,hash:n}));this.performNavigation(r,t)}function ws(e){return y(this,arguments,function*(s,t={}){if(this.navigating){if(this.visit.state>=6)return s.state=2,void(this.onVisitEnd=()=>this.performNavigation(s,t));yield this.hooks.call("visit:abort",this.visit,void 0),this.visit.state=8}this.navigating=!0,this.visit=s;let{el:i}=s.trigger;t.referrer=t.referrer||this.currentPageUrl,t.animate===!1&&(s.animation.animate=!1),s.animation.animate||this.classes.clear();let n=t.history||(i==null?void 0:i.getAttribute("data-swup-history"))||void 0;n&&["push","replace"].includes(n)&&(s.history.action=n);let r=t.animation||(i==null?void 0:i.getAttribute("data-swup-animation"))||void 0;var o,a;r&&(s.animation.name=r),typeof t.cache=="object"?(s.cache.read=(o=t.cache.read)!=null?o:s.cache.read,s.cache.write=(a=t.cache.write)!=null?a:s.cache.write):t.cache!==void 0&&(s.cache={read:!!t.cache,write:!!t.cache}),delete t.cache;try{yield this.hooks.call("visit:start",s,void 0),s.state=3;let l=this.hooks.call("page:load",s,{options:t},(c,h)=>y(this,null,function*(){let u;return c.cache.read&&(u=this.cache.get(c.to.url)),h.page=u||(yield this.fetchPage(c.to.url,h.options)),h.cache=!!u,h.page}));if(l.then(({html:c})=>{s.advance(5),s.to.html=c}),!s.history.popstate){let c=s.to.url+s.to.hash;s.history.action==="replace"||s.to.url===this.currentPageUrl?j(c):(this.currentHistoryIndex++,hs(c,{index:this.currentHistoryIndex}))}if(this.currentPageUrl=P(),s.history.popstate&&this.classes.add("is-popstate"),s.animation.name&&this.classes.add(`to-${st(s.animation.name)}`),s.animation.wait&&(yield l),s.done||(yield this.hooks.call("visit:transition",s,void 0,()=>y(this,null,function*(){if(!s.animation.animate)return yield this.hooks.call("animation:skip",void 0),void(yield this.renderPage(s,yield l));s.advance(4),yield this.animatePageOut(s),s.animation.native&&document.startViewTransition?yield document.startViewTransition(()=>y(this,null,function*(){return yield this.renderPage(s,yield l)})).finished:yield this.renderPage(s,yield l),yield this.animatePageIn(s)})),s.done))return;yield this.hooks.call("visit:end",s,void 0,()=>this.classes.clear()),s.state=7,this.navigating=!1,this.onVisitEnd&&(this.onVisitEnd(),this.onVisitEnd=void 0)}catch(l){if(!l||l!=null&&l.aborted)return void(s.state=8);s.state=9,console.error(l),this.options.skipPopStateHandling=()=>(window.location.assign(s.to.url+s.to.hash),!0),window.history.back()}})}var ys=function(s){return y(this,null,function*(){yield this.hooks.call("animation:out:start",s,void 0,()=>{this.classes.add("is-changing","is-animating","is-leaving")}),yield this.hooks.call("animation:out:await",s,{skip:!1},(t,{skip:e})=>{if(!e)return this.awaitAnimations({selector:t.animation.selector})}),yield this.hooks.call("animation:out:end",s,void 0)})},bs=function({html:s},{containers:t}=this.options){var e;let i=new DOMParser().parseFromString(s,"text/html"),n=((e=i.querySelector("title"))==null?void 0:e.innerText)||"";document.title=n;let r=_t('[data-swup-persist]:not([data-swup-persist=""])'),o=t.map(a=>{let l=document.querySelector(a),c=i.querySelector(a);return l&&c?(l.replaceWith(c),!0):(l||console.warn(`[swup] Container missing in current document: ${a}`),c||console.warn(`[swup] Container missing in incoming document: ${a}`),!1)}).filter(Boolean);return r.forEach(a=>{let l=a.getAttribute("data-swup-persist"),c=Et(`[data-swup-persist="${l}"]`);c&&c!==a&&c.replaceWith(a)}),o.length===t.length},Es=function(s){let t={behavior:"auto"},{target:e,reset:i}=s.scroll,n=e!=null?e:s.to.hash,r=!1;return n&&(r=this.hooks.callSync("scroll:anchor",s,{hash:n,options:t},(o,{hash:a,options:l})=>{let c=this.getAnchorElement(a);return c&&c.scrollIntoView(l),!!c})),i&&!r&&(r=this.hooks.callSync("scroll:top",s,{options:t},(o,{options:a})=>(window.scrollTo(R({top:0,left:0},a)),!0))),r},Ss=function(s){return y(this,null,function*(){if(s.done)return;let t=this.hooks.call("animation:in:await",s,{skip:!1},(e,{skip:i})=>{if(!i)return this.awaitAnimations({selector:e.animation.selector})});yield re(),yield this.hooks.call("animation:in:start",s,void 0,()=>{this.classes.remove("is-animating")}),yield t,yield this.hooks.call("animation:in:end",s,void 0)})},Is=function(s,t){return y(this,null,function*(){if(s.done)return;s.advance(6);let{url:e}=t;this.isSameResolvedUrl(P(),e)||(j(e),this.currentPageUrl=P(),s.to.url=this.currentPageUrl),yield this.hooks.call("content:replace",s,{page:t},(i,{page:n})=>{if(this.classes.remove("is-leaving"),i.animation.animate&&this.classes.add("is-rendering"),!this.replaceContent(n,{containers:i.containers}))throw new Error("[swup] Container mismatch, aborting");i.animation.animate&&(this.classes.add("is-changing","is-animating","is-rendering"),i.animation.name&&this.classes.add(`to-${st(i.animation.name)}`))}),yield this.hooks.call("content:scroll",s,void 0,()=>this.scrollToContent(s)),yield this.hooks.call("page:view",s,{url:this.currentPageUrl,title:document.title})})},Os=function(s){var t;if(t=s,Boolean(t==null?void 0:t.isSwupPlugin)){if(s.swup=this,!s._checkRequirements||s._checkRequirements())return s._beforeMount&&s._beforeMount(),s.mount(),this.plugins.push(s),this.plugins}else console.error("Not a swup plugin instance",s)};function _s(s){let t=this.findPlugin(s);if(t)return t.unmount(),t._afterUnmount&&t._afterUnmount(),this.plugins=this.plugins.filter(e=>e!==t),this.plugins;console.error("No such plugin",t)}function Rs(s){return this.plugins.find(t=>t===s||t.name===s||t.name===`Swup${String(s)}`)}function As(s){if(typeof this.options.resolveUrl!="function")return console.warn("[swup] options.resolveUrl expects a callback function."),s;let t=this.options.resolveUrl(s);return t&&typeof t=="string"?t.startsWith("//")||t.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),s):t:(console.warn("[swup] options.resolveUrl needs to return a url"),s)}function Ts(s,t){return this.resolveUrl(s)===this.resolveUrl(t)}var Cs={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],ignoreVisit:(s,{el:t}={})=>!(t==null||!t.closest("[data-no-swup]")),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:s=>s,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:s=>{var t;return((t=s.state)==null?void 0:t.source)!=="swup"},timeout:0},et=class{constructor(t={}){var e,i;this.version="4.5.1",this.options=void 0,this.defaults=Cs,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.currentPageUrl=P(),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=Os,this.unuse=_s,this.findPlugin=Rs,this.log=()=>{},this.navigate=vs,this.performNavigation=ws,this.createVisit=ms,this.delegateEvent=us,this.fetchPage=ds,this.awaitAnimations=gs,this.renderPage=Is,this.replaceContent=bs,this.animatePageIn=Ss,this.animatePageOut=ys,this.scrollToContent=Es,this.getAnchorElement=ps,this.getCurrentUrl=P,this.resolveUrl=As,this.isSameResolvedUrl=Ts,this.options=R({},this.defaults,t),this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new bt(this),this.classes=new St(this),this.hooks=new It(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=(e=(i=window.history.state)==null?void 0:i.index)!=null?e:1,this.checkRequirements()&&this.enable()}checkRequirements(){return typeof Promise!="undefined"||(console.warn("Promise is not supported"),!1)}enable(){return y(this,null,function*(){var t;let{linkSelector:e}=this.options;this.clickDelegate=this.delegateEvent(e,"click",this.handleLinkClick),window.addEventListener("popstate",this.handlePopState),this.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),this.options.native=this.options.native&&!!document.startViewTransition,this.options.plugins.forEach(i=>this.use(i)),((t=window.history.state)==null?void 0:t.source)!=="swup"&&j(null,{index:this.currentHistoryIndex}),yield re(),yield this.hooks.call("enable",void 0,void 0,()=>{let i=document.documentElement;i.classList.add("swup-enabled"),i.classList.toggle("swup-native",this.options.native)})})}destroy(){return y(this,null,function*(){this.clickDelegate.destroy(),window.removeEventListener("popstate",this.handlePopState),this.cache.clear(),this.options.plugins.forEach(t=>this.unuse(t)),yield this.hooks.call("disable",void 0,void 0,()=>{let t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")}),this.hooks.clear()})}shouldIgnoreVisit(t,{el:e,event:i}={}){let{origin:n,url:r,hash:o}=A.fromUrl(t);return n!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(r+o,{el:e,event:i})}handleLinkClick(t){let e=t.delegateTarget,{href:i,url:n,hash:r}=A.fromElement(e);if(this.shouldIgnoreVisit(i,{el:e,event:t}))return;if(this.navigating&&n===this.visit.to.url)return void t.preventDefault();let o=this.createVisit({to:n,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",o,{href:i}):t.button===0&&this.hooks.callSync("link:click",o,{el:e,event:t},()=>{var a;let l=(a=o.from.url)!=null?a:"";t.preventDefault(),n&&n!==l?this.isSameResolvedUrl(n,l)||this.performNavigation(o):r?this.hooks.callSync("link:anchor",o,{hash:r},()=>{j(n+r),this.scrollToContent(o)}):this.hooks.callSync("link:self",o,void 0,()=>{this.options.linkToSelf==="navigate"?this.performNavigation(o):(j(n),this.scrollToContent(o))})})}handlePopState(t){var e,i,n,r;let o=(e=(i=t.state)==null?void 0:i.url)!=null?e:window.location.href;if(this.options.skipPopStateHandling(t)||this.isSameResolvedUrl(P(),this.currentPageUrl))return;let{url:a,hash:l}=A.fromUrl(o),c=this.createVisit({to:a,hash:l,event:t});c.history.popstate=!0;let h=(n=(r=t.state)==null?void 0:r.index)!=null?n:0;h&&h!==this.currentHistoryIndex&&(c.history.direction=h-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=h),c.animation.animate=!1,c.scroll.reset=!1,c.scroll.target=!1,this.options.animateHistoryBrowsing&&(c.animation.animate=!0,c.scroll.reset=!0),this.hooks.callSync("history:popstate",c,{event:t},()=>{this.performNavigation(c)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}};function H(){return H=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}return s},H.apply(this,arguments)}var ae=s=>String(s).split(".").map(t=>String(parseInt(t||"0",10))).concat(["0","0"]).slice(0,3).join("."),it=class{constructor(){this.isSwupPlugin=!0,this.swup=void 0,this.version=void 0,this.requires={},this.handlersToUnregister=[]}mount(){}unmount(){this.handlersToUnregister.forEach(t=>t()),this.handlersToUnregister=[]}_beforeMount(){if(!this.name)throw new Error("You must define a name of plugin when creating a class.")}_afterUnmount(){}_checkRequirements(){return typeof this.requires!="object"||Object.entries(this.requires).forEach(([t,e])=>{if(!function(i,n,r){let o=function(a,l){var c;if(a==="swup")return(c=l.version)!=null?c:"";{var h;let u=l.findPlugin(a);return(h=u==null?void 0:u.version)!=null?h:""}}(i,r);return!!o&&((a,l)=>l.every(c=>{let[,h,u]=c.match(/^([\D]+)?(.*)$/)||[];var d,f;return((p,w)=>{let g={"":m=>m===0,">":m=>m>0,">=":m=>m>=0,"<":m=>m<0,"<=":m=>m<=0};return(g[w]||g[""])(p)})((f=u,d=ae(d=a),f=ae(f),d.localeCompare(f,void 0,{numeric:!0})),h||">=")}))(o,n)}(t,e=Array.isArray(e)?e:[e],this.swup)){let i=`${t} ${e.join(", ")}`;throw new Error(`Plugin version mismatch: ${this.name} requires ${i}`)}}),!0}on(t,e,i={}){var n;e=!(n=e).name.startsWith("bound ")||n.hasOwnProperty("prototype")?e.bind(this):e;let r=this.swup.hooks.on(t,e,i);return this.handlersToUnregister.push(r),r}once(t,e,i={}){return this.on(t,e,H({},i,{once:!0}))}before(t,e,i={}){return this.on(t,e,H({},i,{before:!0}))}replace(t,e,i={}){return this.on(t,e,H({},i,{replace:!0}))}off(t,e){return this.swup.hooks.off(t,e)}};function L(){return L=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}return s},L.apply(this,arguments)}window.process||(window.process={}),window.process.env||(window.process.env={});var he=["test"].includes(String("production")),E=["development","test"].includes(String("production")),ue=(s,t,e)=>s==null?s:`\x1B[${t}m${String(s)}\x1B[${e}m`,Rt=s=>he?s:`\u{1F9E9} ${(t=>ue(t,1,22))(s)}`,T=s=>he?s:(t=>ue(t,94,39))(s),At=class{log(...t){let e=t.shift();console.log(Rt(e),...t)}warn(...t){let e=t.shift();console.warn(Rt(e),...t)}error(...t){let e=t.shift();console.error(Rt(e),...t)}logIf(t,...e){t&&this.log(...e)}warnIf(t,...e){t&&this.warn(...e)}errorIf(t,...e){t&&this.error(...e)}},de=s=>{(function({parsedRules:t,swup:e,logger:i}){let n=e.getCurrentUrl();t.filter(r=>r.matchesFrom(n)||r.matchesTo(n)).forEach(r=>{r.containers.forEach(o=>{let a=nt(`${o}:not([data-swup-fragment])`,e);if(!a)return;let l=a.getAttribute("data-swup-fragment-url");l&&E&&(i==null||i.log(`fragment url ${T(l)} for ${T(o)} provided by server`));let{url:c}=A.fromUrl(l||n);a.setAttribute("data-swup-fragment",""),a.__swupFragment={url:c,selector:o}})})})(s),function({logger:t,swup:e}){let i="data-swup-link-to-fragment";document.querySelectorAll(`a[${i}]`).forEach(n=>{var r;let o=n.getAttribute(i);if(!o)return void(E&&(t==null||t.warn(`[${i}] needs to contain a valid fragment selector`)));let a=nt(o,e);if(!a)return void(E&&(t==null||t.log(`ignoring ${T(`[${i}="${o}"]`)} as ${T(o)} is missing`)));let l=(r=a.__swupFragment)==null?void 0:r.url;l?Ct(l,e.getCurrentUrl())?E&&(t==null||t.warn(`The fragment URL of ${o} is identical to the current URL. This could mean that [data-swup-fragment-url] needs to be provided by the server.`)):n.href=l:E&&(t==null||t.warn(`no fragment infos found on ${o}`))})}(s),function({logger:t}){document.querySelectorAll("dialog[data-swup-fragment]").forEach(e=>{e.__swupFragment?e.__swupFragment.modalShown||(e.__swupFragment.modalShown=!0,e.removeAttribute("open"),e.showModal==null||e.showModal(),e.addEventListener("keydown",i=>i.key==="Escape"&&i.preventDefault())):E&&(t==null||t.warn("fragment properties missing on element:",e))})}(s)},fe=(s,t)=>{var e;let i=(e=s.__swupFragment)==null?void 0:e.url;return!!i&&Ct(i,t)},Ct=(s,t)=>le(s)===le(t),le=s=>{if(!s.trim())return s;let t=A.fromUrl(s);return t.searchParams.sort(),t.pathname.replace(/\/+$/g,"")+t.search},me=s=>{let t=s.from.url,e=s.to.url;if(t&&e)return{from:t,to:e}},Mt=(s,t)=>{if(s==null||!s.name)return;let{name:e,containers:i}=s;i.forEach(n=>{var r;(r=document.querySelector(n))==null||r.classList.toggle(`to-${e}`,t)})},pe=(s,t)=>t.find(e=>e.matches(s));function ge(s){return!!s&&s.containers.every(t=>{var e;return((e=document.querySelector(t))==null||(e=e.tagName)==null?void 0:e.toLowerCase())==="template"})}function nt(s,t){for(let e of t.options.containers){let i=document.querySelector(e);if(i!=null&&i.matches(s))return i;let n=i==null?void 0:i.querySelector(s);if(n)return n}}function ce(s){if(!Array.isArray(s))throw new Error("cloneRules() expects an array of rules");return s.map(t=>L({},t,{from:Array.isArray(t.from)?[...t.from]:t.from,to:Array.isArray(t.to)?[...t.to]:t.to,containers:[...t.containers]}))}var Tt=class{constructor(t){var e,i;this.matchesFrom=void 0,this.matchesTo=void 0,this.swup=void 0,this.from=void 0,this.to=void 0,this.containers=void 0,this.name=void 0,this.scroll=!1,this.focus=void 0,this.logger=void 0,this.swup=t.swup,this.logger=t.logger,this.from=t.from||"",this.to=t.to||"",t.name&&(this.name=st(t.name)),t.scroll!==void 0&&(this.scroll=t.scroll),t.focus!==void 0&&(this.focus=t.focus),this.containers=this.parseContainers(t.containers),E&&((e=this.logger)==null||e.errorIf(!this.to,"Every fragment rule must contain a 'to' path",this),(i=this.logger)==null||i.errorIf(!this.from,"Every fragment rule must contain a 'from' path",this)),this.matchesFrom=Ot(this.from),this.matchesTo=Ot(this.to)}parseContainers(t){var e,i;return Array.isArray(t)&&t.length?(i=t.map(n=>n.trim()),[...new Set(i)]).filter(n=>{var r;let o=this.validateSelector(n);return(r=this.logger)==null||r.errorIf(o instanceof Error,o),o===!0}):(E&&((e=this.logger)==null||e.error("Every fragment rule must contain an array of containers",this.getDebugInfo())),[])}validateSelector(t){return t.startsWith("#")?!t.match(/\s|>/)||new Error(`fragment selectors must not be nested: ${t}`):new Error(`fragment selectors must be IDs: ${t}`)}getDebugInfo(){let{from:t,to:e,containers:i}=this;return{from:String(t),to:String(e),containers:String(i)}}matches(t){let{url:e}=A.fromUrl(t.from),{url:i}=A.fromUrl(t.to);if(!this.matchesFrom(e)||!this.matchesTo(i))return!1;for(let r of this.containers){let o=this.validateFragmentSelectorForMatch(r);var n;if(o instanceof Error)return E&&((n=this.logger)==null||n.error(o,this.getDebugInfo())),!1}return!0}validateFragmentSelectorForMatch(t){return document.querySelector(t)?!!nt(t,this.swup)||new Error(`skipping rule since ${T(t)} is outside of swup's default containers`):new Error(`skipping rule since ${T(t)} doesn't exist in the current document`)}},Ms=function(s){let t=me(s);t&&pe(t,this.parsedRules)&&(s.scroll.reset=!1)},ks=function(s){return y(this,null,function*(){let t=me(s);if(!t)return;let e=this.getFragmentVisit(t);if(!e)return;var i;s.fragmentVisit=e,E&&((i=this.logger)==null||i.log(`fragment visit: ${T(s.fragmentVisit.containers.join(", "))}`)),s.scroll=function(o,a){return typeof o.scroll=="boolean"?L({},a,{reset:o.scroll}):typeof o.scroll!="string"||a.target?a:L({},a,{target:o.scroll})}(e,s.scroll);let n=s.a11y;var r;e.focus!==void 0&&(E&&((r=this.logger)==null||r.errorIf(!n,"Can't set visit.a11y.focus. Is @swup/a11y-plugin installed?")),n&&(n.focus=e.focus)),s.animation.scope=s.fragmentVisit.containers,s.containers=s.fragmentVisit.containers,s.animation.selector=s.fragmentVisit.containers.join(","),Mt(e,!0)})},xs=function(s,t){var e,i;s.fragmentVisit&&ge(s.fragmentVisit)&&(E&&((e=this.logger)==null||e.log(`${T("out")}-animation skipped for ${T((i=s.fragmentVisit)==null?void 0:i.containers.toString())}`)),t.skip=!0)},Ps=function(s,t){var e,i;s.fragmentVisit&&ge(s.fragmentVisit)&&(E&&((e=this.logger)==null||e.log(`${T("in")}-animation skipped for ${T((i=s.fragmentVisit)==null?void 0:i.containers.toString())}`)),t.skip=!0)},$s=function(s,t){var e;if(s.trigger.el||!s.to.url)return;let i=this.swup.cache.get(s.to.url);i&&i.fragmentHtml&&(t.page.html=i.fragmentHtml,E&&((e=this.logger)==null||e.log(`fragment cache used for ${T(s.to.url)}`)))},Ls=function(s){Mt(s.fragmentVisit,!0),de(this),(({swup:t,logger:e})=>{let i=t.getCurrentUrl(),n=t.cache,r=n.get(i);if(!r)return;let o=new DOMParser().parseFromString(r.html,"text/html"),a=[],l=Array.from(document.querySelectorAll("[data-swup-fragment]")).filter(c=>!c.matches("template")&&!fe(c,i));l.length&&(t.options.cache?(l.forEach(c=>{var h,u;if(c.querySelector("[data-swup-fragment]")!=null)return;let d=(h=c.__swupFragment)==null?void 0:h.url;if(!d)return void(E&&(e==null||e.warn("no fragment url found:",c)));let f=(u=c.__swupFragment)==null?void 0:u.selector;if(!f)return void(E&&(e==null||e.warn("no fragment selector found:",c)));let p=n.get(d);if(!p)return;let w=o.querySelector(f);if(!w)return;let g=new DOMParser().parseFromString(p.html,"text/html").querySelector(f);g&&(g.setAttribute("data-swup-fragment-url",d),w.replaceWith(g),a.push(c))}),a.length&&(n.update(i,L({},r,{fragmentHtml:o.documentElement.outerHTML})),a.forEach(c=>{var h,u;let d=((h=c.__swupFragment)==null?void 0:h.url)||"",f=((u=c.__swupFragment)==null?void 0:u.selector)||"";E&&(e==null||e.log(`updated cache with ${T(f)} from ${T(d)}`))}))):E&&(e==null||e.warn("can't cache foreign fragment elements without swup's cache")))})(this)},Us=function(s){Mt(s.fragmentVisit,!1)},rt=class extends it{get parsedRules(){return this._parsedRules}constructor(t){super(),this.name="SwupFragmentPlugin",this.requires={swup:">=4"},this._rawRules=[],this._parsedRules=[],this.options=void 0,this.defaults={rules:[],debug:!1},this.logger=void 0,this.options=L({},this.defaults,t)}mount(){let t=this.swup;var e;this.setRules(this.options.rules),E&&this.options.debug&&(this.logger=new At),this.before("link:self",Ms),this.on("visit:start",ks),this.before("animation:out:await",xs),this.before("animation:in:await",Ps),this.before("content:replace",$s),this.on("content:replace",Ls),this.on("visit:end",Us),E&&((e=this.logger)==null||e.warnIf(!t.options.cache,"fragment caching will only work with swup's cache being active")),de(this)}unmount(){super.unmount(),document.querySelectorAll("[data-swup-fragment]").forEach(t=>{t.removeAttribute("data-swup-fragment-url"),delete t.__swupFragment})}setRules(t){var e;this._rawRules=ce(t),this._parsedRules=t.map(i=>this.parseRule(i)),E&&((e=this.logger)==null||e.log("Updated fragment rules",this.getRules()))}getRules(){return ce(this._rawRules)}prependRule(t){this.setRules([t,...this.getRules()])}appendRule(t){this.setRules([...this.getRules(),t])}parseRule({from:t,to:e,containers:i,name:n,scroll:r,focus:o}){return new Tt({from:t,to:e,containers:i,name:n,scroll:r,focus:o,logger:this.logger,swup:this.swup})}getFragmentVisit(t){let e=pe(t,this.parsedRules);if(!e)return;let i=((a,l,c,h)=>{let u=Ct(a.from,a.to);return l.filter(d=>{let f=document.querySelector(d);return f?nt(d,c)?!(!u&&fe(f,a.to)&&(E&&(h==null||h.log(`ignoring fragment ${T(d)} as it already matches the current URL`)),1)):(E&&(h==null||h.error(`${T(d)} is outside of swup's default containers`)),!1):(E&&(h==null||h.log(`${T(d)} missing in current document`)),!1)})})(t,e.containers,this.swup,this.logger);if(!i.length)return;let{name:n,scroll:r,focus:o}=e;return{containers:i,name:n,scroll:r,focus:o}}};var ot=class extends U{constructor(s){super(s)}init(){let s=new et({containers:["[data-load-container]"],plugins:[new rt({rules:[{from:["/projects/:page?"],to:["/projects/:page?"],containers:["#paginated"]},{from:["/projects/:page?"],to:["/project/:slug"],containers:["#modal"],name:"open-modal"},{from:["/project/:slug"],to:["/project/:slug"],containers:["#modal"],name:"modal-update"},{from:["/project/:slug"],to:["/projects/:page?"],containers:["#modal","#paginated"],name:"close-modal"}]})]});s.hooks.before("content:replace",t=>y(this,null,function*(){console.log("before content replace:",t);for(let e of t.containers){let i=this.el.querySelector(e);console.log("old container: ",i),this.call("destroy",i,"app")}})),s.hooks.on("content:replace",t=>{console.log("On content replace:",t),t.fragmentVisit&&(t.fragmentVisit.name=="open-modal"?(this.call("populate",document.getElementById("modal"),"Dialog"),this.call("show",null,"Dialog")):t.fragmentVisit.name=="close-modal"&&this.call("close",null,"Dialog"));for(let e of t.containers){let i=this.el.querySelector(e);console.log("new container: ",i),i.classList.add("transition-fade"),this.call("update",i,"app")}}),console.log(this,s)}};var kt="production",ve=window.matchMedia("(any-pointer:coarse)").matches,W=Object.freeze({NAME:kt,IS_PROD:kt==="production",IS_DEV:kt==="development",IS_MOBILE:ve,IS_DESKTOP:!ve}),k=Object.freeze({LOADING:"is-loading",LOADED:"is-loaded",READY:"is-ready",FONTS_LOADED:"fonts-loaded",LAZY_CONTAINER:"c-lazy",LAZY_LOADED:"-lazy-loaded"}),we=Object.freeze({RESIZE_END:"loco.resizeEnd"}),ye=Object.freeze({EAGER:[{family:"Source Sans",style:"normal",weight:400},{family:"Source Sans",style:"normal",weight:700}]});var Fs=s=>({url:s.src,width:s.naturalWidth,height:s.naturalHeight,ratio:s.naturalWidth/s.naturalHeight}),zs=(s,t={})=>new Promise((e,i)=>{let n=new Image;t.crossOrigin&&(n.crossOrigin=t.crossOrigin);let r=()=>{e(qt({element:n},Fs(n)))};n.decode?(n.src=s,n.decode().then(r).catch(o=>{i(o)})):(n.onload=r,n.onerror=o=>{i(o)},n.src=s)}),be=[],Ee=(s,t,e)=>y(void 0,null,function*(){let i=t||s.dataset.src,n=be.find(r=>r.url===i);if(!n){if(n=yield zs(i),!n.url)return;be.push(n)}s.src!==i&&(s.tagName==="IMG"?s.src=n.url:s.style.backgroundImage=`url(${n.url})`,requestAnimationFrame(()=>{let r=s.closest(`.${k.LAZY_CONTAINER}`);r&&(r.classList.add(k.LAZY_LOADED),r.style.backgroundImage=""),s.classList.add(k.LAZY_LOADED),e==null||e()}))});function xt(){return xt=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}return s},xt.apply(this,arguments)}function at(s,t,e){return Math.max(s,Math.min(t,e))}var Pt=class{advance(t){var e;if(!this.isRunning)return;let i=!1;if(this.lerp)this.value=(n=this.value,r=this.to,(1-(o=1-Math.exp(-60*this.lerp*t)))*n+o*r),Math.round(this.value)===this.to&&(this.value=this.to,i=!0);else{this.currentTime+=t;let a=at(0,this.currentTime/this.duration,1);i=a>=1;let l=i?1:this.easing(a);this.value=this.from+(this.to-this.from)*l}var n,r,o;(e=this.onUpdate)==null||e.call(this,this.value,i),i&&this.stop()}stop(){this.isRunning=!1}fromTo(t,e,{lerp:i=.1,duration:n=1,easing:r=l=>l,onStart:o,onUpdate:a}){this.from=this.value=t,this.to=e,this.lerp=i,this.duration=n,this.easing=r,this.currentTime=0,this.isRunning=!0,o==null||o(),this.onUpdate=a}},$t=class{constructor({wrapper:t,content:e,autoResize:i=!0}={}){if(this.resize=()=>{this.onWrapperResize(),this.onContentResize()},this.onWrapperResize=()=>{this.wrapper===window?(this.width=window.innerWidth,this.height=window.innerHeight):(this.width=this.wrapper.clientWidth,this.height=this.wrapper.clientHeight)},this.onContentResize=()=>{this.scrollHeight=this.content.scrollHeight,this.scrollWidth=this.content.scrollWidth},this.wrapper=t,this.content=e,i){let n=function(r,o){let a;return function(){let l=arguments,c=this;clearTimeout(a),a=setTimeout(function(){r.apply(c,l)},250)}}(this.resize);this.wrapper!==window&&(this.wrapperResizeObserver=new ResizeObserver(n),this.wrapperResizeObserver.observe(this.wrapper)),this.contentResizeObserver=new ResizeObserver(n),this.contentResizeObserver.observe(this.content)}this.resize()}destroy(){var t,e;(t=this.wrapperResizeObserver)==null||t.disconnect(),(e=this.contentResizeObserver)==null||e.disconnect()}get limit(){return{x:this.scrollWidth-this.width,y:this.scrollHeight-this.height}}},lt=class{constructor(){this.events={}}emit(t,...e){let i=this.events[t]||[];for(let n=0,r=i.length;n<r;n++)i[n](...e)}on(t,e){var i;return(i=this.events[t])!=null&&i.push(e)||(this.events[t]=[e]),()=>{var n;this.events[t]=(n=this.events[t])==null?void 0:n.filter(r=>e!==r)}}off(t,e){var i;this.events[t]=(i=this.events[t])==null?void 0:i.filter(n=>e!==n)}destroy(){this.events={}}},Lt=class{constructor(t,{wheelMultiplier:e=1,touchMultiplier:i=2,normalizeWheel:n=!1}){this.onTouchStart=r=>{let{clientX:o,clientY:a}=r.targetTouches?r.targetTouches[0]:r;this.touchStart.x=o,this.touchStart.y=a,this.lastDelta={x:0,y:0}},this.onTouchMove=r=>{let{clientX:o,clientY:a}=r.targetTouches?r.targetTouches[0]:r,l=-(o-this.touchStart.x)*this.touchMultiplier,c=-(a-this.touchStart.y)*this.touchMultiplier;this.touchStart.x=o,this.touchStart.y=a,this.lastDelta={x:l,y:c},this.emitter.emit("scroll",{deltaX:l,deltaY:c,event:r})},this.onTouchEnd=r=>{this.emitter.emit("scroll",{deltaX:this.lastDelta.x,deltaY:this.lastDelta.y,event:r})},this.onWheel=r=>{let{deltaX:o,deltaY:a}=r;this.normalizeWheel&&(o=at(-100,o,100),a=at(-100,a,100)),o*=this.wheelMultiplier,a*=this.wheelMultiplier,this.emitter.emit("scroll",{deltaX:o,deltaY:a,event:r})},this.element=t,this.wheelMultiplier=e,this.touchMultiplier=i,this.normalizeWheel=n,this.touchStart={x:null,y:null},this.emitter=new lt,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(t,e){return this.emitter.on(t,e)}destroy(){this.emitter.destroy(),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})}},ct=class{constructor({wrapper:t=window,content:e=document.documentElement,wheelEventsTarget:i=t,eventsTarget:n=i,smoothWheel:r=!0,smoothTouch:o=!1,syncTouch:a=!1,syncTouchLerp:l=.1,__iosNoInertiaSyncTouchLerp:c=.4,touchInertiaMultiplier:h=35,duration:u,easing:d=b=>Math.min(1,1.001-Math.pow(2,-10*b)),lerp:f=!u&&.1,infinite:p=!1,orientation:w="vertical",gestureOrientation:g="vertical",touchMultiplier:m=1,wheelMultiplier:I=1,normalizeWheel:O=!1,autoResize:v=!0}={}){this.onVirtualScroll=({deltaX:b,deltaY:S,event:_})=>{if(_.ctrlKey)return;let C=_.type.includes("touch"),M=_.type.includes("wheel");if(this.options.gestureOrientation==="both"&&b===0&&S===0||this.options.gestureOrientation==="vertical"&&S===0||this.options.gestureOrientation==="horizontal"&&b===0||C&&this.options.gestureOrientation==="vertical"&&this.scroll===0&&!this.options.infinite&&S<=0)return;let x=_.composedPath();if(x=x.slice(0,x.indexOf(this.rootElement)),x.find($=>{var jt;return($.hasAttribute==null?void 0:$.hasAttribute("data-lenis-prevent"))||C&&($.hasAttribute==null?void 0:$.hasAttribute("data-lenis-prevent-touch"))||M&&($.hasAttribute==null?void 0:$.hasAttribute("data-lenis-prevent-wheel"))||((jt=$.classList)==null?void 0:jt.contains("lenis"))}))return;if(this.isStopped||this.isLocked)return void _.preventDefault();if(this.isSmooth=(this.options.smoothTouch||this.options.syncTouch)&&C||this.options.smoothWheel&&M,!this.isSmooth)return this.isScrolling=!1,void this.animate.stop();_.preventDefault();let V=S;this.options.gestureOrientation==="both"?V=Math.abs(S)>Math.abs(b)?S:b:this.options.gestureOrientation==="horizontal"&&(V=b);let ze=C&&this.options.syncTouch,Nt=C&&_.type==="touchend"&&Math.abs(V)>1;Nt&&(V=this.velocity*this.options.touchInertiaMultiplier),this.scrollTo(this.targetScroll+V,xt({programmatic:!1},ze&&{lerp:Nt?this.syncTouchLerp:this.options.__iosNoInertiaSyncTouchLerp}))},this.onScroll=()=>{if(!this.isScrolling){let b=this.animatedScroll;this.animatedScroll=this.targetScroll=this.actualScroll,this.velocity=0,this.direction=Math.sign(this.animatedScroll-b),this.emit()}},window.lenisVersion="1.0.27",t!==document.documentElement&&t!==document.body||(t=window),this.options={wrapper:t,content:e,wheelEventsTarget:i,eventsTarget:n,smoothWheel:r,smoothTouch:o,syncTouch:a,syncTouchLerp:l,__iosNoInertiaSyncTouchLerp:c,touchInertiaMultiplier:h,duration:u,easing:d,lerp:f,infinite:p,gestureOrientation:g,orientation:w,touchMultiplier:m,wheelMultiplier:I,normalizeWheel:O,autoResize:v},this.animate=new Pt,this.emitter=new lt,this.dimensions=new $t({wrapper:t,content:e,autoResize:v}),this.toggleClass("lenis",!0),this.velocity=0,this.isLocked=!1,this.isStopped=!1,this.isSmooth=a||r||o,this.isScrolling=!1,this.targetScroll=this.animatedScroll=this.actualScroll,this.options.wrapper.addEventListener("scroll",this.onScroll,{passive:!1}),this.virtualScroll=new Lt(n,{touchMultiplier:m,wheelMultiplier:I,normalizeWheel:O}),this.virtualScroll.on("scroll",this.onVirtualScroll)}destroy(){this.emitter.destroy(),this.options.wrapper.removeEventListener("scroll",this.onScroll,{passive:!1}),this.virtualScroll.destroy(),this.dimensions.destroy(),this.toggleClass("lenis",!1),this.toggleClass("lenis-smooth",!1),this.toggleClass("lenis-scrolling",!1),this.toggleClass("lenis-stopped",!1),this.toggleClass("lenis-locked",!1)}on(t,e){return this.emitter.on(t,e)}off(t,e){return this.emitter.off(t,e)}setScroll(t){this.isHorizontal?this.rootElement.scrollLeft=t:this.rootElement.scrollTop=t}resize(){this.dimensions.resize()}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(t){let e=t-(this.time||t);this.time=t,this.animate.advance(.001*e)}scrollTo(t,{offset:e=0,immediate:i=!1,lock:n=!1,duration:r=this.options.duration,easing:o=this.options.easing,lerp:a=!r&&this.options.lerp,onComplete:l=null,force:c=!1,programmatic:h=!0}={}){if(!this.isStopped&&!this.isLocked||c){if(["top","left","start"].includes(t))t=0;else if(["bottom","right","end"].includes(t))t=this.limit;else{var u;let d;if(typeof t=="string"?d=document.querySelector(t):(u=t)!=null&&u.nodeType&&(d=t),d){if(this.options.wrapper!==window){let p=this.options.wrapper.getBoundingClientRect();e-=this.isHorizontal?p.left:p.top}let f=d.getBoundingClientRect();t=(this.isHorizontal?f.left:f.top)+this.animatedScroll}}if(typeof t=="number"){if(t+=e,t=Math.round(t),this.options.infinite?h&&(this.targetScroll=this.animatedScroll=this.scroll):t=at(0,t,this.limit),i)return this.animatedScroll=this.targetScroll=t,this.setScroll(this.scroll),this.reset(),void(l==null||l(this));if(!h){if(t===this.targetScroll)return;this.targetScroll=t}this.animate.fromTo(this.animatedScroll,t,{duration:r,easing:o,lerp:a,onStart:()=>{n&&(this.isLocked=!0),this.isScrolling=!0},onUpdate:(d,f)=>{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||this.emit(),f&&requestAnimationFrame(()=>{this.reset(),this.emit(),l==null||l(this)})}})}}}get rootElement(){return this.options.wrapper===window?this.options.content:this.options.wrapper}get limit(){return this.dimensions.limit[this.isHorizontal?"x":"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?(this.animatedScroll%(t=this.limit)+t)%t:this.animatedScroll;var t}get progress(){return this.limit===0?1:this.scroll/this.limit}get isSmooth(){return this.__isSmooth}set isSmooth(t){this.__isSmooth!==t&&(this.__isSmooth=t,this.toggleClass("lenis-smooth",t))}get isScrolling(){return this.__isScrolling}set isScrolling(t){this.__isScrolling!==t&&(this.__isScrolling=t,this.toggleClass("lenis-scrolling",t))}get isStopped(){return this.__isStopped}set isStopped(t){this.__isStopped!==t&&(this.__isStopped=t,this.toggleClass("lenis-stopped",t))}get isLocked(){return this.__isLocked}set isLocked(t){this.__isLocked!==t&&(this.__isLocked=t,this.toggleClass("lenis-locked",t))}get className(){let t="lenis";return this.isStopped&&(t+=" lenis-stopped"),this.isLocked&&(t+=" lenis-locked"),this.isScrolling&&(t+=" lenis-scrolling"),this.isSmooth&&(t+=" lenis-smooth"),t}toggleClass(t,e){this.rootElement.classList.toggle(t,e),this.emitter.emit("className change",this)}};function Ut(){return Ut=Object.assign?Object.assign.bind():function(s){for(var t=1;t<arguments.length;t++){var e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(s[i]=e[i])}return s},Ut.apply(this,arguments)}var ht=class{constructor({scrollElements:t,rootMargin:e="-1px -1px -1px -1px",IORaf:i}){this.scrollElements=void 0,this.rootMargin=void 0,this.IORaf=void 0,this.observer=void 0,this.scrollElements=t,this.rootMargin=e,this.IORaf=i,this._init()}_init(){this.observer=new IntersectionObserver(t=>{t.forEach(e=>{let i=this.scrollElements.find(n=>n.$el===e.target);e.isIntersecting?(i&&(i.isAlreadyIntersected=!0),this._setInview(e)):i&&i.isAlreadyIntersected&&this._setOutOfView(e)})},{rootMargin:this.rootMargin});for(let t of this.scrollElements)this.observe(t.$el)}destroy(){this.observer.disconnect()}observe(t){t&&this.observer.observe(t)}unobserve(t){t&&this.observer.unobserve(t)}_setInview(t){let e=this.scrollElements.find(i=>i.$el===t.target);this.IORaf&&(e==null||e.setInteractivityOn()),!this.IORaf&&(e==null||e.setInview())}_setOutOfView(t){let e=this.scrollElements.find(i=>i.$el===t.target);this.IORaf&&(e==null||e.setInteractivityOff()),!this.IORaf&&(e==null||e.setOutOfView()),e!=null&&e.attributes.scrollRepeat||this.IORaf||this.unobserve(t.target)}};function Se(s,t,e,i,n){return e+((n-s)/(t-s)*(i-e)||0)}function Ie(s,t){return s.reduce((e,i)=>Math.abs(i-t)<Math.abs(e-t)?i:e)}var Ft=class{constructor({$el:t,id:e,modularInstance:i,subscribeElementUpdateFn:n,unsubscribeElementUpdateFn:r,needRaf:o,scrollOrientation:a}){var l,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=t,this.id=e,this.needRaf=o,this.scrollOrientation=a,this.modularInstance=i,this.subscribeElementUpdateFn=n,this.unsubscribeElementUpdateFn=r,this.attributes={scrollClass:(l=this.$el.dataset.scrollClass)!=null?l:"is-inview",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:t}){this.currentScroll=t,this._resize()}onRender({currentScroll:t,smooth:e}){let i=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth;if(this.currentScroll=t,this._computeProgress(),this.attributes.scrollSpeed&&!isNaN(this.attributes.scrollSpeed))if(this.attributes.scrollEnableTouchSpeed||e){if(this.isInFold){let n=Math.max(0,this.progress);this.translateValue=n*i*this.attributes.scrollSpeed*-1}else{let n=Se(0,1,-1,1,this.progress);this.translateValue=n*i*this.attributes.scrollSpeed*-1}this.$el.style.transform=this.scrollOrientation==="vertical"?`translate3d(0, ${this.translateValue}px, 0)`:`translate3d(${this.translateValue}px, 0, 0)`}else this.translateValue&&(this.$el.style.transform="translate3d(0, 0, 0)"),this.translateValue=0}setInview(){if(this.isInview)return;this.isInview=!0,this.$el.classList.add(this.attributes.scrollClass);let t=this._getScrollCallFrom();this.attributes.scrollCall&&this._dispatchCall("enter",t)}setOutOfView(){if(!this.isInview||!this.attributes.scrollRepeat)return;this.isInview=!1,this.$el.classList.remove(this.attributes.scrollClass);let t=this._getScrollCallFrom();this.attributes.scrollCall&&this._dispatchCall("leave",t)}setInteractivityOn(){this.isInteractive||(this.isInteractive=!0,this.subscribeElementUpdateFn(this))}setInteractivityOff(){this.isInteractive&&(this.isInteractive=!1,this.unsubscribeElementUpdateFn(this),this.lastProgress!=null&&this._computeProgress(Ie([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:t,left:e,height:i,width:n}=this.metrics.bcr,r=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth,o=this.scrollOrientation==="vertical"?i:n;this.metrics.offsetStart=this.currentScroll+(this.scrollOrientation==="vertical"?t:e)-this.translateValue,this.metrics.offsetEnd=this.metrics.offsetStart+o,this.isInFold=this.metrics.offsetStart<r&&!this.attributes.scrollIgnoreFold}_computeIntersection(){let t=this.scrollOrientation==="vertical"?window.innerHeight:window.innerWidth,e=this.scrollOrientation==="vertical"?this.metrics.bcr.height:this.metrics.bcr.width,i=this.attributes.scrollOffset.split(","),n=i[0]!=null?i[0].trim():"0",r=i[1]!=null?i[1].trim():"0",o=this.attributes.scrollPosition.split(","),a=o[0]!=null?o[0].trim():"start",l=o[1]!=null?o[1].trim():"end",c=n.includes("%")?t*parseInt(n.replace("%","").trim())*.01:parseInt(n),h=r.includes("%")?t*parseInt(r.replace("%","").trim())*.01:parseInt(r);switch(this.isInFold&&(a="fold"),a){case"start":default:this.intersection.start=this.metrics.offsetStart-t+c;break;case"middle":this.intersection.start=this.metrics.offsetStart-t+c+.5*e;break;case"end":this.intersection.start=this.metrics.offsetStart-t+c+e;break;case"fold":this.intersection.start=0}switch(l){case"start":this.intersection.end=this.metrics.offsetStart-h;break;case"middle":this.intersection.end=this.metrics.offsetStart-h+.5*e;break;default:this.intersection.end=this.metrics.offsetStart-h+e}if(this.intersection.end<=this.intersection.start)switch(l){case"start":default:this.intersection.end=this.intersection.start+1;break;case"middle":this.intersection.end=this.intersection.start+.5*e;break;case"end":this.intersection.end=this.intersection.start+e}}_computeProgress(t){let e=t!=null?t:(i=Se(this.intersection.start,this.intersection.end,0,1,this.currentScroll))<0?0:i>1?1:i;var i;if(this.progress=e,e!=this.lastProgress){if(this.lastProgress=e,this.attributes.scrollCssProgress&&this._setCssProgress(e),this.attributes.scrollEventProgress&&this._setCustomEventProgress(e),this.attributes.scrollModuleProgress)for(let n of this.progressModularModules)this.modularInstance&&this.modularInstance.call("onScrollProgress",e,n.moduleName,n.moduleId);e>0&&e<1&&this.setInview(),e===0&&this.setOutOfView(),e===1&&this.setOutOfView()}}_setCssProgress(t=0){this.$el.style.setProperty("--progress",t.toString())}_setCustomEventProgress(t=0){let e=this.attributes.scrollEventProgress;if(!e)return;let i=new CustomEvent(e,{detail:{target:this.$el,progress:t}});window.dispatchEvent(i)}_getProgressModularModules(){if(!this.modularInstance)return;let t=Object.keys(this.$el.dataset).filter(i=>i.includes("module")),e=Object.entries(this.modularInstance.modules);if(t.length)for(let i of t){let n=this.$el.dataset[i];if(!n)return;for(let r of e){let[o,a]=r;n in a&&this.progressModularModules.push({moduleName:o,moduleId:n})}}}_getScrollCallFrom(){let t=Ie([this.intersection.start,this.intersection.end],this.currentScroll);return this.intersection.start===t?"start":"end"}_dispatchCall(t,e){var i,n;let r=(i=this.attributes.scrollCall)==null?void 0:i.split(","),o=(n=this.attributes)==null?void 0:n.scrollCallSelf;if(r&&r.length>1){var a;let[l,c,h]=r,u;u=o?this.$el.dataset[`module${c.trim()}`]:h,this.modularInstance&&this.modularInstance.call(l.trim(),{target:this.$el,way:t,from:e},c.trim(),(a=u)==null?void 0:a.trim())}else if(r){let[l]=r,c=new CustomEvent(l,{detail:{target:this.$el,way:t,from:e}});window.dispatchEvent(c)}}},Ds=["scrollOffset","scrollPosition","scrollModuleProgress","scrollCssProgress","scrollEventProgress","scrollSpeed"],zt=class{constructor({$el:t,modularInstance:e,triggerRootMargin:i,rafRootMargin:n,scrollOrientation:r}){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,t?(this.$scrollContainer=t,this.modularInstance=e,this.scrollOrientation=r,this.triggerRootMargin=i!=null?i:"-1px -1px -1px -1px",this.rafRootMargin=n!=null?n:"100% 100% 100% 100%",this.scrollElements=[],this.triggeredScrollElements=[],this.RAFScrollElements=[],this.scrollElementsToUpdate=[],this._init()):console.error("Please provide a DOM Element as scrollContainer")}_init(){let t=this.$scrollContainer.querySelectorAll("[data-scroll]"),e=Array.from(t);this._subscribeScrollElements(e),this.IOTriggerInstance=new ht({scrollElements:[...this.triggeredScrollElements],rootMargin:this.triggerRootMargin,IORaf:!1}),this.IORafInstance=new ht({scrollElements:[...this.RAFScrollElements],rootMargin:this.rafRootMargin,IORaf:!0})}destroy(){this.IOTriggerInstance.destroy(),this.IORafInstance.destroy(),this._unsubscribeAllScrollElements()}onResize({currentScroll:t}){for(let e of this.RAFScrollElements)e.onResize({currentScroll:t})}onRender({currentScroll:t,smooth:e}){for(let i of this.scrollElementsToUpdate)i.onRender({currentScroll:t,smooth:e})}removeScrollElements(t){let e=t.querySelectorAll("[data-scroll]");if(e.length){for(let i=0;i<this.triggeredScrollElements.length;i++){let n=this.triggeredScrollElements[i];Array.from(e).indexOf(n.$el)>-1&&(this.IOTriggerInstance.unobserve(n.$el),this.triggeredScrollElements.splice(i,1))}for(let i=0;i<this.RAFScrollElements.length;i++){let n=this.RAFScrollElements[i];Array.from(e).indexOf(n.$el)>-1&&(this.IORafInstance.unobserve(n.$el),this.RAFScrollElements.splice(i,1))}e.forEach(i=>{let n=this.scrollElementsToUpdate.find(o=>o.$el===i),r=this.scrollElements.find(o=>o.$el===i);n&&this._unsubscribeElementUpdate(n),r&&(this.scrollElements=this.scrollElements.filter(o=>o.id!=r.id))})}}addScrollElements(t){let e=t.querySelectorAll("[data-scroll]"),i=[];this.scrollElements.forEach(o=>{i.push(o.id)});let n=Math.max(...i)+1,r=Array.from(e);this._subscribeScrollElements(r,n,!0)}_subscribeScrollElements(t,e=0,i=!1){for(let n=0;n<t.length;n++){let r=t[n],o=this._checkRafNeeded(r),a=new Ft({$el:r,id:e+n,scrollOrientation:this.scrollOrientation,modularInstance:this.modularInstance,subscribeElementUpdateFn:this._subscribeElementUpdate.bind(this),unsubscribeElementUpdateFn:this._unsubscribeElementUpdate.bind(this),needRaf:o});this.scrollElements.push(a),o?(this.RAFScrollElements.push(a),i&&(this.IORafInstance.scrollElements.push(a),this.IORafInstance.observe(a.$el))):(this.triggeredScrollElements.push(a),i&&(this.IOTriggerInstance.scrollElements.push(a),this.IOTriggerInstance.observe(a.$el)))}}_unsubscribeAllScrollElements(){this.scrollElements=[],this.RAFScrollElements=[],this.triggeredScrollElements=[],this.scrollElementsToUpdate=[]}_subscribeElementUpdate(t){this.scrollElementsToUpdate.push(t)}_unsubscribeElementUpdate(t){this.scrollElementsToUpdate=this.scrollElementsToUpdate.filter(e=>e.id!=t.id)}_checkRafNeeded(t){let e=[...Ds],i=n=>{e=e.filter(r=>r!=n)};if(t.dataset.scrollOffset){if(t.dataset.scrollOffset.split(",").map(n=>n.replace("%","").trim()).join(",")!="0,0")return!0;i("scrollOffset")}else i("scrollOffset");if(t.dataset.scrollPosition){if(t.dataset.scrollPosition.trim()!="top,bottom")return!0;i("scrollPosition")}else i("scrollPosition");if(t.dataset.scrollSpeed&&!isNaN(parseFloat(t.dataset.scrollSpeed)))return!0;i("scrollSpeed");for(let n of e)if(n in t.dataset)return!0;return!1}},Dt=class{constructor({resizeElements:t,resizeCallback:e=()=>{}}){this.$resizeElements=void 0,this.isFirstObserve=void 0,this.observer=void 0,this.resizeCallback=void 0,this.$resizeElements=t,this.resizeCallback=e,this.isFirstObserve=!0,this._init()}_init(){this.observer=new ResizeObserver(t=>{var e;!this.isFirstObserve&&((e=this.resizeCallback)==null||e.call(this)),this.isFirstObserve=!1});for(let t of this.$resizeElements)this.observer.observe(t)}destroy(){this.observer.disconnect()}},Oe={wrapper:window,content:document.documentElement,eventsTarget:window,lerp:.1,duration:.75,orientation:"vertical",gestureOrientation:"vertical",smoothWheel:!0,smoothTouch:!1,syncTouch:!1,syncTouchLerp:.1,touchInertiaMultiplier:35,wheelMultiplier:1,touchMultiplier:2,normalizeWheel:!1,autoResize:!0,easing:s=>Math.min(1,1.001-Math.pow(2,-10*s))},ut=class{constructor({lenisOptions:t={},modularInstance:e,triggerRootMargin:i,rafRootMargin:n,autoResize:r=!0,autoStart:o=!0,scrollCallback:a=()=>{},initCustomTicker:l,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=Ut({},Oe,t),Object.assign(this,{lenisOptions:t,modularInstance:e,triggerRootMargin:i,rafRootMargin:n,autoResize:r,autoStart:o,scrollCallback:a,initCustomTicker:l,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 t;this.lenisInstance=new ct({wrapper:this.lenisOptions.wrapper,content:this.lenisOptions.content,eventsTarget:this.lenisOptions.eventsTarget,lerp:this.lenisOptions.lerp,duration:this.lenisOptions.duration,orientation:this.lenisOptions.orientation,gestureOrientation:this.lenisOptions.gestureOrientation,smoothWheel:this.lenisOptions.smoothWheel,smoothTouch:this.lenisOptions.smoothTouch,syncTouch:this.lenisOptions.syncTouch,syncTouchLerp:this.lenisOptions.syncTouchLerp,touchInertiaMultiplier:this.lenisOptions.touchInertiaMultiplier,wheelMultiplier:this.lenisOptions.wheelMultiplier,touchMultiplier:this.lenisOptions.touchMultiplier,normalizeWheel:this.lenisOptions.normalizeWheel,easing:this.lenisOptions.easing}),(t=this.lenisInstance)==null||t.on("scroll",this.scrollCallback),document.documentElement.setAttribute("data-scroll-orientation",this.lenisInstance.options.orientation),requestAnimationFrame(()=>{this.coreInstance=new zt({$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 Dt({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(t){let e=t||this.lenisInstance.rootElement,i=e==null?void 0:e.querySelectorAll("[data-scroll-to]");i!=null&&i.length&&i.forEach(n=>{n.addEventListener("click",this._onScrollToBind,!1)})}_unbindScrollToEvents(t){let e=t||this.lenisInstance.rootElement,i=e==null?void 0:e.querySelectorAll("[data-scroll-to]");i!=null&&i.length&&i.forEach(n=>{n.removeEventListener("click",this._onScrollToBind,!1)})}_onResize(){requestAnimationFrame(()=>{var t;(t=this.coreInstance)==null||t.onResize({currentScroll:this.lenisInstance.scroll})})}_onRender(){var t,e;(t=this.lenisInstance)==null||t.raf(Date.now()),(e=this.coreInstance)==null||e.onRender({currentScroll:this.lenisInstance.scroll,smooth:this.lenisInstance.isSmooth})}_onScrollTo(t){var e;t.preventDefault();let i=(e=t.currentTarget)!=null?e:null;if(!i)return;let n=i.getAttribute("data-scroll-to-href")||i.getAttribute("href"),r=i.getAttribute("data-scroll-to-offset")||0,o=i.getAttribute("data-scroll-to-duration")||this.lenisOptions.duration||Oe.duration;n&&this.scrollTo(n,{offset:typeof r=="string"?parseInt(r):r,duration:typeof o=="string"?parseInt(o):o})}start(){var t;this.rafPlaying||((t=this.lenisInstance)==null||t.start(),this.rafPlaying=!0,this.initCustomTicker?this.initCustomTicker(this._onRenderBind):this._raf())}stop(){var t;this.rafPlaying&&((t=this.lenisInstance)==null||t.stop(),this.rafPlaying=!1,this.destroyCustomTicker?this.destroyCustomTicker(this._onRenderBind):this.rafInstance&&cancelAnimationFrame(this.rafInstance))}removeScrollElements(t){var e;t?(this._unbindScrollToEvents(t),(e=this.coreInstance)==null||e.removeScrollElements(t)):console.error("Please provide a DOM Element as $oldContainer")}addScrollElements(t){var e;t?((e=this.coreInstance)==null||e.addScrollElements(t),requestAnimationFrame(()=>{this._bindScrollToEvents(t)})):console.error("Please provide a DOM Element as $newContainer")}resize(){this._onResizeBind()}scrollTo(t,e){var i;(i=this.lenisInstance)==null||i.scrollTo(t,{offset:e==null?void 0:e.offset,lerp:e==null?void 0:e.lerp,duration:e==null?void 0:e.duration,immediate:e==null?void 0:e.immediate,lock:e==null?void 0:e.lock,force:e==null?void 0:e.force,easing:e==null?void 0:e.easing,onComplete:e==null?void 0:e.onComplete})}_raf(){this._onRenderBind(),this.rafInstance=requestAnimationFrame(()=>this._raf())}};var dt=class extends U{constructor(s){super(s)}init(){this.scroll=new ut({modularInstance:this})}lazyLoad(s){Ee(s.target,null,()=>{})}scrollTo(s){var n;let i=s,{target:t}=i,e=G(i,["target"]);e=Object.assign({duration:1},e),(n=this.scroll)==null||n.scrollTo(t,e)}destroy(){this.scroll.destroy()}};var Me=Be(Re(),1);var mt;y(void 0,null,function*(){if(W.IS_DEV){let s=yield Promise.resolve().then(()=>(Ce(),Te));mt=s==null?void 0:s.gridHelper}});function ke(){(0,Me.default)(),mt==null||mt()}var xe=(s,t,e=!1)=>{let i=null;return(...n)=>{clearTimeout(i);let r=()=>{i=null,e||s(...n)};e&&!i&&s(...n),i=setTimeout(r,t)}};var D=document.documentElement,Ki=document.body;var $e="fonts"in document;function Bs(s,t){for(let[e,i]of Object.entries(t))switch(e){case"family":{if(pt(s[e])!==i)return!1;break}case"weight":{if(s[e]!=i)return!1;break}default:{if(s[e]!==i)return!1;break}}return!0}function Gs(s,t){let e=pt(s.family);return pt(e)===t||t.endsWith(pt(e))&&(t.match(s.weight)||t.match(s.style)),!0}function Ys(s){let t=[];for(let e of document.fonts)Bs(e,s)&&t.push(e);return t}function Ks(s){let t=[];for(let e of document.fonts)Gs(e,s)&&t.push(e);return t}function Xs(s){Array.isArray(s)||(s=[s]);let t=new Set;return s.forEach(e=>{if(e)switch(typeof e){case"string":t.add(...Ks(e));return;case"object":t.add(...Ys(e));return}throw new TypeError("Expected font query to be font shorthand or font reference")}),[...t]}function Le(s,t=!1){return y(this,null,function*(){var e;if(((e=s.size)!=null?e:s.length)===0)throw new TypeError("Expected at least one font");return yield Zs([...s],t)})}function Pe(s){return y(this,null,function*(){return yield(s.status==="unloaded"?s.load():s.loaded).then(t=>t,t=>s)})}function Zs(s,t=!1){return y(this,null,function*(){t&&console.group("[loadFonts:API]",s.length,"/",document.fonts.size);let e=[];for(let i of s)i instanceof FontFace?(document.fonts.has(i)||document.fonts.add(i),e.push(Pe(i))):e.push(...Xs(i).map(n=>Pe(n)));return t&&console.groupEnd(),yield Promise.all(e)})}function pt(s){return s.replace(/['"]+/g,"")}var Ue=new Jt({modules:Vt});window.addEventListener("load",s=>{let t=document.getElementById("main-css");t?t.isLoaded?Fe():t.addEventListener("load",e=>{Fe()}):console.warn('The "main-css" stylesheet not found')});function Fe(){ke(),Ue.init(Ue),D.classList.add(k.LOADED),D.classList.add(k.READY),D.classList.remove(k.LOADING);let s=new CustomEvent(we.RESIZE_END);window.addEventListener("resize",()=>{D.style.setProperty("--vw",`${document.documentElement.clientWidth*.01}px`),xe(()=>{window.dispatchEvent(s)},200,!1)}),$e&&Le(ye.EAGER,W.IS_DEV).then(t=>{D.classList.add(k.FONTS_LOADED),W.IS_DEV&&(console.group("Eager fonts loaded!",t.length,"/",document.fonts.size),console.group("State of eager fonts:"),t.forEach(e=>console.log(e.family,e.style,e.weight,e.status)),console.groupEnd(),console.group("State of all fonts:"),document.fonts.forEach(e=>console.log(e.family,e.style,e.weight,e.status)),console.groupEnd())})}})();
|
|
/*! Bundled license information:
|
|
|
|
svg4everybody/dist/svg4everybody.js:
|
|
(*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody *)
|
|
*/
|
|
//# sourceMappingURL=app.js.map
|