summaryrefslogtreecommitdiff
path: root/node_modules/swup
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-10-13 10:37:19 +0800
commite29b244aeab08ea36fb385c7beb2ad0560217039 (patch)
treec66b744dc29573f1acc871862937a23f1b80e6bf /node_modules/swup
parent62c2881629e6413a8fec6d3dd092e4568e2a81dc (diff)
bump: @babel/cli 7.25.6 → 7.25.7, @babel/core 7.25.2 → 7.25.8, @babel/preset-env 7.25.4 → 7.25.8, postcss 8.4.41 → 8.4.47, swup 4.7.0 → 4.8.1
Diffstat (limited to 'node_modules/swup')
-rw-r--r--node_modules/swup/dist/Swup.cjs2
-rw-r--r--node_modules/swup/dist/Swup.cjs.map2
-rw-r--r--node_modules/swup/dist/Swup.modern.js2
-rw-r--r--node_modules/swup/dist/Swup.modern.js.map2
-rw-r--r--node_modules/swup/dist/Swup.module.js2
-rw-r--r--node_modules/swup/dist/Swup.module.js.map2
-rw-r--r--node_modules/swup/dist/Swup.umd.js2
-rw-r--r--node_modules/swup/dist/Swup.umd.js.map2
-rw-r--r--node_modules/swup/dist/types/Swup.d.ts10
-rw-r--r--node_modules/swup/dist/types/Swup.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/helpers/delegateEvent.d.ts4
-rw-r--r--node_modules/swup/dist/types/helpers/delegateEvent.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/helpers/matchPath.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/modules/Hooks.d.ts12
-rw-r--r--node_modules/swup/dist/types/modules/Hooks.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/modules/Visit.d.ts2
-rw-r--r--node_modules/swup/dist/types/modules/Visit.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/modules/navigate.d.ts2
-rw-r--r--node_modules/swup/dist/types/modules/navigate.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/modules/renderPage.d.ts.map2
-rw-r--r--node_modules/swup/dist/types/utils/index.d.ts.map2
-rwxr-xr-xnode_modules/swup/package.json8
-rw-r--r--node_modules/swup/src/Swup.ts13
-rw-r--r--node_modules/swup/src/modules/Hooks.ts26
-rw-r--r--node_modules/swup/src/modules/Visit.ts4
-rwxr-xr-xnode_modules/swup/src/modules/navigate.ts5
26 files changed, 87 insertions, 31 deletions
diff --git a/node_modules/swup/dist/Swup.cjs b/node_modules/swup/dist/Swup.cjs
index 9648cac9..c766d499 100644
--- a/node_modules/swup/dist/Swup.cjs
+++ b/node_modules/swup/dist/Swup.cjs
@@ -1,2 +1,2 @@
-var t=require("delegate-it"),e=require("path-to-regexp");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=/*#__PURE__*/n(t);const r=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",i=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),s=(t,e={})=>{const n={url:t=t||i({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)},a=(t=null,e={})=>{t=t||i({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},c=(t,e,n,r)=>{const i=new AbortController;return r={...r,signal:i.signal},o.default(t,e,n,r),{destroy:()=>i.abort()}};class l extends URL{constructor(t,e=document.baseURI){super(t.toString(),e),Object.setPrototypeOf(this,l.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new l(e)}static fromUrl(t){return new l(t)}}const h=function(t,e={}){try{const o=this;function n(n){const{status:i,url:s}=h;return Promise.resolve(h.text()).then(function(n){if(500===i)throw o.hooks.call("fetch:error",r,{status:i,response:h,url:s}),new u(`Server error: ${s}`,{status:i,url:s});if(!n)throw new u(`Empty response: ${s}`,{status:i,url:s});const{url:a}=l.fromUrl(s),c={url:a,html:n};return!r.cache.write||e.method&&"GET"!==e.method||t!==a||o.cache.set(c.url,c),c})}t=l.fromUrl(t).url;const{visit:r=o.visit}=e,i={...o.options.requestHeaders,...e.headers},s=e.timeout??o.options.timeout,a=new AbortController,{signal:c}=a;e={...e,headers:i,signal:c};let h,d=!1,f=null;s&&s>0&&(f=setTimeout(()=>{d=!0,a.abort("timeout")},s));const m=function(n,i){try{var s=Promise.resolve(o.hooks.call("fetch:request",r,{url:t,options:e},(t,{url:e,options:n})=>fetch(e,n))).then(function(t){h=t,f&&clearTimeout(f)})}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",r,{url:t}),new u(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||c.aborted)throw new u(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(m&&m.then?m.then(n):n())}catch(p){return Promise.reject(p)}};class u 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}}class d{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=l.fromUrl(t);return this.swup.resolveUrl(e)}}const f=(t,e=document)=>e.querySelector(t),m=(t,e=document)=>Array.from(e.querySelectorAll(t)),p=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function v(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function g(t,e=[]){return new Promise((n,o)=>{const r=t(...e);v(r)?r.then(n,o):n(r)})}function w(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class y{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class P{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;const{to:n,from:o,hash:r,el:i,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,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:i,event:s},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 k(t){return new P(this,t)}const b="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function S(t,e,n){if(!t.s){if(n instanceof E){if(!n.s)return void(n.o=S.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(S.bind(null,t,e),S.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const E=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{S(o,1,t(this.v))}catch(t){S(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?S(o,1,e?e(r):r):n?S(o,1,n(r)):S(o,2,r)}catch(t){S(o,2,t)}},o},t}();function x(t){return t instanceof E&&1&t.s}class C{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n={}){const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const r={...n,id:o.size+1,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n={}){return this.on(t,e,{...n,before:!0})}replace(t,e,n={}){return this.on(t,e,{...n,replace:!0})}once(t,e,n={}){return this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const r=this,[i,s,a]=r.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=r.getHandlers(t,a);return Promise.resolve(r.run(c,i,s)).then(function(){return Promise.resolve(r.run(l,i,s,!0)).then(function([e]){return Promise.resolve(r.run(h,i,s)).then(function(){return r.dispatchDomEvent(t,i,s),e})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[r,i,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,r,i);const[h]=this.runSync(c,r,i,!0);return this.runSync(l,r,i),this.dispatchDomEvent(t,r,i),h}parseCallArgs(t,e,n,o){return e instanceof P||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o=!1){try{let r;const i=this;void 0===e&&(e=i.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[b]){var o,r,i,s=t[b]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!x(a))return void a.then(t,i||(i=S.bind(null,r=new E,2)));a=a.v}r?S(r,1,a):r=a}catch(t){S(r||(r=new E),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,function(t){throw a(t)});a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,r,i=-1;return function s(a){try{for(;++i<t.length&&(!n||!n());)if((a=e(i))&&a.then){if(!x(a))return void a.then(s,r||(r=S.bind(null,o=new E,2)));a=a.v}o?S(o,1,a):o=a}catch(t){S(o||(o=new E),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function({hook:t,handler:r,defaultHandler:a,once:c}){if(!e?.done)return c&&i.off(t,r),function(t,o){try{var i=Promise.resolve(g(r,[e,n,a])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(e){if(o)throw e;console.error(`Error in hook '${t}':`,e)})},function(){return r});return Promise.resolve(a&&a.then?a.then(function(t){return r?t:s}):r?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e=this.swup.visit,n,o=!1){const r=[];for(const{hook:i,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(i,s);try{const t=s(e,n,a);r.push(t),v(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${i}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)}}return r}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),r=this.sortRegistrations,i=o.filter(({before:t,replace:e})=>t&&!e).sort(r),s=o.filter(({replace:t})=>t).filter(t=>!0).sort(r),a=o.filter(({before:t,replace:e})=>!t&&!e).sort(r),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,o=t=>{const n=s[t-1];return n?(e,r)=>n.handler(e,r,o(t-1)):e};l=[{id:0,hook:t,handler:s[n].handler,defaultHandler:o(n)}]}return{found:!0,before:i,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}}const U=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||f(`a[name='${CSS.escape(t)}']`)||f(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},$=function({selector:t,elements:e}){try{if(!1===t&&!e)return Promise.resolve();let n=[];if(e)n=Array.from(e);else if(t&&(n=m(t,document.body),!n.length))return console.warn(`[swup] No elements found matching animationSelector \`${t}\``),Promise.resolve();const o=n.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=q(e,`${A}Delay`),o=q(e,`${A}Duration`),r=j(n,o),i=q(e,`${H}Delay`),s=q(e,`${H}Duration`),a=j(i,s),c=Math.max(r,a),l=c>0?r>a?A:H:null;return{type:l,timeout:c,propCount:l?l===A?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(r=>{const i=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(i,l),r()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(i,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},A="transition",H="animation";function q(t,e){return(t[e]||"").split(", ")}function j(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>R(e)+R(t[n])))}function R(t){return 1e3*parseFloat(t)}const L=function(t,e={}){try{let o;const i=this;function n(n){if(o)return n;i.navigating=!0,i.visit=t;const{el:c}=t.trigger;e.referrer=e.referrer||i.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||i.classes.clear();const h=e.history||w(c,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||w(c,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(n,o){try{var c=function(n,o){try{var c=Promise.resolve(i.hooks.call("visit:start",t,void 0)).then(function(){function n(){if(!t.done)return Promise.resolve(i.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(i.animatePageOut(t)).then(function(){function e(){return Promise.resolve(i.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=i.renderPage;return Promise.resolve(o).then(function(n){return Promise.resolve(e.call(i,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=i.renderPage;return Promise.resolve(o).then(function(n){return Promise.resolve(e.call(i,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const r=function(){if(!t.animation.animate)return Promise.resolve(i.hooks.call("animation:skip",void 0)).then(function(){const e=i.renderPage;return Promise.resolve(o).then(function(o){return Promise.resolve(e.call(i,t,o)).then(function(){n=1})})})}();return Promise.resolve(r&&r.then?r.then(e):e(r))}catch(s){return Promise.reject(s)}})).then(function(){if(!t.done)return Promise.resolve(i.hooks.call("visit:end",t,void 0,()=>i.classes.clear())).then(function(){t.state=7,i.navigating=!1,i.onVisitEnd&&(i.onVisitEnd(),i.onVisitEnd=void 0)})})}t.state=3;const o=i.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=i.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(i.fetchPage(t.to.url,e.options)).then(n))}catch(r){return Promise.reject(r)}});o.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const c=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===i.location.url?a(c):(i.currentHistoryIndex++,s(c,{index:i.currentHistoryIndex}))),i.location=l.fromUrl(c),t.history.popstate&&i.classes.add("is-popstate"),t.animation.name&&i.classes.add(`to-${r(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(o).then(function(){})}();return h&&h.then?h.then(n):n()})}catch(t){return o(t)}return c&&c.then?c.then(void 0,o):c}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),i.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return o(!0,t)}return c&&c.then?c.then(o.bind(null,!1),o.bind(null,!0)):o(!1,c)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const c=function(){if(i.navigating)return function(){if(!(i.visit.state>=6))return Promise.resolve(i.hooks.call("visit:abort",i.visit,void 0)).then(function(){delete i.visit.to.document,i.visit.state=8});t.state=2,i.onVisitEnd=()=>i.performNavigation(t,e),o=1}()}();return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(h){return Promise.reject(h)}};function T(t,e={},n={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:r}=l.fromUrl(t),i=this.createVisit({...n,to:o,hash:r});this.performNavigation(i,e)}const V=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},I=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=m('[data-swup-persist]:not([data-swup-persist=""])'),r=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=f(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),r.length===t.containers.length},N=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,r=n??t.to.hash;let i=!1;return r&&(i=this.hooks.callSync("scroll:anchor",t,{hash:r,options:e},(t,{hash:e,options:n})=>{const o=this.getAnchorElement(e);return o&&o.scrollIntoView(n),!!o})),o&&!i&&(i=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo({top:0,left:0,...e}),!0))),i},D=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(p()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},M=function(t,e){try{const n=this;if(t.done)return Promise.resolve();t.advance(6);const{url:o}=e;return n.isSameResolvedUrl(i(),o)||(a(o),n.location=l.fromUrl(o),t.to.url=n.location.url,t.to.hash=n.location.hash),Promise.resolve(n.hooks.call("content:replace",t,{page:e},(t,{})=>{if(n.classes.remove("is-leaving"),t.animation.animate&&n.classes.add("is-rendering"),!n.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(n.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&n.classes.add(`to-${r(t.animation.name)}`))})).then(function(){return Promise.resolve(n.hooks.call("content:scroll",t,void 0,()=>n.scrollToContent(t))).then(function(){return Promise.resolve(n.hooks.call("page:view",t,{url:n.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},O=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function W(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function B(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function _(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function F(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const K={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],ignoreVisit:(t,{el:e}={})=>!!e?.closest("[data-no-swup]"),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};exports.Location=l,exports.classify=r,exports.createHistoryRecord=s,exports.default=class{get currentPageUrl(){return this.location.url}constructor(t={}){this.version="4.7.0",this.options=void 0,this.defaults=K,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=l.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=O,this.unuse=W,this.findPlugin=B,this.log=()=>{},this.navigate=T,this.performNavigation=L,this.createVisit=k,this.delegateEvent=c,this.fetchPage=h,this.awaitAnimations=$,this.renderPage=M,this.replaceContent=I,this.animatePageIn=D,this.animatePageOut=V,this.scrollToContent=N,this.getAnchorElement=U,this.getCurrentUrl=i,this.resolveUrl=_,this.isSameResolvedUrl=F,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new d(this),this.classes=new y(this),this.hooks=new C(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;return t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e)),"swup"!==window.history.state?.source&&a(null,{index:t.currentHistoryIndex}),Promise.resolve(p()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,{el:e,event:n}={}){const{origin:o,url:r,hash:i}=l.fromUrl(t);return o!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(r+i,{el:e,event:n})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=l.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const i=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",i,{href:n}):0===t.button&&this.hooks.callSync("link:click",i,{el:e,event:t},()=>{const e=i.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(i):r?this.hooks.callSync("link:anchor",i,{hash:r},()=>{a(o+r),this.scrollToContent(i)}):this.hooks.callSync("link:self",i,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(i):(a(o),this.scrollToContent(i))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(i(),this.location.url))return;const{url:n,hash:o}=l.fromUrl(e),r=this.createVisit({to:n,hash:o,event:t});r.history.popstate=!0;const s=t.state?.index??0;s&&s!==this.currentHistoryIndex&&(r.history.direction=s-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=s),r.animation.animate=!1,r.scroll.reset=!1,r.scroll.target=!1,this.options.animateHistoryBrowsing&&(r.animation.animate=!0,r.scroll.reset=!0),this.hooks.callSync("history:popstate",r,{event:t},()=>{this.performNavigation(r)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}},exports.delegateEvent=c,exports.forceReflow=function(t){t=t||document.body,t?.getBoundingClientRect()},exports.getContextualAttr=w,exports.getCurrentUrl=i,exports.isPromise=v,exports.matchPath=(t,n)=>{try{return e.match(t,n)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}},exports.nextTick=p,exports.query=f,exports.queryAll=m,exports.runAsPromise=g,exports.updateHistoryRecord=a;
+var t=require("delegate-it"),e=require("path-to-regexp");function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=/*#__PURE__*/n(t);const r=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",i=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),s=(t,e={})=>{const n={url:t=t||i({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)},a=(t=null,e={})=>{t=t||i({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},c=(t,e,n,r)=>{const i=new AbortController;return r={...r,signal:i.signal},o.default(t,e,n,r),{destroy:()=>i.abort()}};class l extends URL{constructor(t,e=document.baseURI){super(t.toString(),e),Object.setPrototypeOf(this,l.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new l(e)}static fromUrl(t){return new l(t)}}const h=function(t,e={}){try{const o=this;function n(n){const{status:i,url:s}=h;return Promise.resolve(h.text()).then(function(n){if(500===i)throw o.hooks.call("fetch:error",r,{status:i,response:h,url:s}),new u(`Server error: ${s}`,{status:i,url:s});if(!n)throw new u(`Empty response: ${s}`,{status:i,url:s});const{url:a}=l.fromUrl(s),c={url:a,html:n};return!r.cache.write||e.method&&"GET"!==e.method||t!==a||o.cache.set(c.url,c),c})}t=l.fromUrl(t).url;const{visit:r=o.visit}=e,i={...o.options.requestHeaders,...e.headers},s=e.timeout??o.options.timeout,a=new AbortController,{signal:c}=a;e={...e,headers:i,signal:c};let h,d=!1,m=null;s&&s>0&&(m=setTimeout(()=>{d=!0,a.abort("timeout")},s));const f=function(n,i){try{var s=Promise.resolve(o.hooks.call("fetch:request",r,{url:t,options:e},(t,{url:e,options:n})=>fetch(e,n))).then(function(t){h=t,m&&clearTimeout(m)})}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",r,{url:t}),new u(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||c.aborted)throw new u(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(f&&f.then?f.then(n):n())}catch(p){return Promise.reject(p)}};class u 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}}class d{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=l.fromUrl(t);return this.swup.resolveUrl(e)}}const m=(t,e=document)=>e.querySelector(t),f=(t,e=document)=>Array.from(e.querySelectorAll(t)),p=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function v(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function g(t,e=[]){return new Promise((n,o)=>{const r=t(...e);v(r)?r.then(n,o):n(r)})}function w(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class y{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?f(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class k{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,this.meta=void 0;const{to:n,from:o,hash:r,el:i,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,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:i,event:s},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},this.meta={}}advance(t){this.state<t&&(this.state=t)}abort(){this.state=8}get done(){return this.state>=7}}function P(t){return new k(this,t)}const b="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function S(t,e,n){if(!t.s){if(n instanceof E){if(!n.s)return void(n.o=S.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(S.bind(null,t,e),S.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const E=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{S(o,1,t(this.v))}catch(t){S(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?S(o,1,e?e(r):r):n?S(o,1,n(r)):S(o,2,r)}catch(t){S(o,2,t)}},o},t}();function x(t){return t instanceof E&&1&t.s}class C{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n={}){const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const r={...n,id:o.size+1,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n={}){return this.on(t,e,{...n,before:!0})}replace(t,e,n={}){return this.on(t,e,{...n,replace:!0})}once(t,e,n={}){return this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const r=this,[i,s,a]=r.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=r.getHandlers(t,a);return Promise.resolve(r.run(c,i,s)).then(function(){return Promise.resolve(r.run(l,i,s,!0)).then(function([e]){return Promise.resolve(r.run(h,i,s)).then(function(){return r.dispatchDomEvent(t,i,s),e})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[r,i,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,r,i);const[h]=this.runSync(c,r,i,!0);return this.runSync(l,r,i),this.dispatchDomEvent(t,r,i),h}parseCallArgs(t,e,n,o){return e instanceof k||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o=!1){try{let r;const i=this;void 0===e&&(e=i.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[b]){var o,r,i,s=t[b]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!x(a))return void a.then(t,i||(i=S.bind(null,r=new E,2)));a=a.v}r?S(r,1,a):r=a}catch(t){S(r||(r=new E),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,function(t){throw a(t)});a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,r,i=-1;return function s(a){try{for(;++i<t.length&&(!n||!n());)if((a=e(i))&&a.then){if(!x(a))return void a.then(s,r||(r=S.bind(null,o=new E,2)));a=a.v}o?S(o,1,a):o=a}catch(t){S(o||(o=new E),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function({hook:t,handler:r,defaultHandler:a,once:c}){if(!e?.done)return c&&i.off(t,r),function(t,o){try{var i=Promise.resolve(g(r,[e,n,a])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(e){if(o)throw e;console.error(`Error in hook '${t}':`,e)})},function(){return r});return Promise.resolve(a&&a.then?a.then(function(t){return r?t:s}):r?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e=this.swup.visit,n,o=!1){const r=[];for(const{hook:i,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(i,s);try{const t=s(e,n,a);r.push(t),v(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${i}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)}}return r}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),r=this.sortRegistrations,i=o.filter(({before:t,replace:e})=>t&&!e).sort(r),s=o.filter(({replace:t})=>t).filter(t=>!0).sort(r),a=o.filter(({before:t,replace:e})=>!t&&!e).sort(r),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,{handler:o,once:r}=s[n],i=t=>{const n=s[t-1];return n?(e,o)=>n.handler(e,o,i(t-1)):e};l=[{id:0,hook:t,once:r,handler:o,defaultHandler:i(n)}]}return{found:!0,before:i,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}parseName(t){const[e,...n]=t.split(".");return[e,n.reduce((t,e)=>({...t,[e]:!0}),{})]}}const U=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||m(`a[name='${CSS.escape(t)}']`)||m(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},$=function({selector:t,elements:e}){try{if(!1===t&&!e)return Promise.resolve();let n=[];if(e)n=Array.from(e);else if(t&&(n=f(t,document.body),!n.length))return console.warn(`[swup] No elements found matching animationSelector \`${t}\``),Promise.resolve();const o=n.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=j(e,`${A}Delay`),o=j(e,`${A}Duration`),r=q(n,o),i=j(e,`${H}Delay`),s=j(e,`${H}Duration`),a=q(i,s),c=Math.max(r,a),l=c>0?r>a?A:H:null;return{type:l,timeout:c,propCount:l?l===A?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(r=>{const i=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(i,l),r()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(i,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},A="transition",H="animation";function j(t,e){return(t[e]||"").split(", ")}function q(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>R(e)+R(t[n])))}function R(t){return 1e3*parseFloat(t)}const L=function(t,e={}){try{let o;const i=this;function n(n){if(o)return n;i.navigating=!0,i.visit=t;const{el:c}=t.trigger;e.referrer=e.referrer||i.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||i.classes.clear();const h=e.history||w(c,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||w(c,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),t.meta=e.meta||{},"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(n,o){try{var c=function(n,o){try{var c=Promise.resolve(i.hooks.call("visit:start",t,void 0)).then(function(){function n(){if(!t.done)return Promise.resolve(i.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(i.animatePageOut(t)).then(function(){function e(){return Promise.resolve(i.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=i.renderPage;return Promise.resolve(o).then(function(n){return Promise.resolve(e.call(i,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=i.renderPage;return Promise.resolve(o).then(function(n){return Promise.resolve(e.call(i,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const r=function(){if(!t.animation.animate)return Promise.resolve(i.hooks.call("animation:skip",void 0)).then(function(){const e=i.renderPage;return Promise.resolve(o).then(function(o){return Promise.resolve(e.call(i,t,o)).then(function(){n=1})})})}();return Promise.resolve(r&&r.then?r.then(e):e(r))}catch(s){return Promise.reject(s)}})).then(function(){if(!t.done)return Promise.resolve(i.hooks.call("visit:end",t,void 0,()=>i.classes.clear())).then(function(){t.state=7,i.navigating=!1,i.onVisitEnd&&(i.onVisitEnd(),i.onVisitEnd=void 0)})})}t.state=3;const o=i.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=i.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(i.fetchPage(t.to.url,e.options)).then(n))}catch(r){return Promise.reject(r)}});o.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const c=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===i.location.url?a(c):(i.currentHistoryIndex++,s(c,{index:i.currentHistoryIndex}))),i.location=l.fromUrl(c),t.history.popstate&&i.classes.add("is-popstate"),t.animation.name&&i.classes.add(`to-${r(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(o).then(function(){})}();return h&&h.then?h.then(n):n()})}catch(t){return o(t)}return c&&c.then?c.then(void 0,o):c}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),i.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return o(!0,t)}return c&&c.then?c.then(o.bind(null,!1),o.bind(null,!0)):o(!1,c)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const c=function(){if(i.navigating)return function(){if(!(i.visit.state>=6))return Promise.resolve(i.hooks.call("visit:abort",i.visit,void 0)).then(function(){delete i.visit.to.document,i.visit.state=8});t.state=2,i.onVisitEnd=()=>i.performNavigation(t,e),o=1}()}();return Promise.resolve(c&&c.then?c.then(n):n(c))}catch(h){return Promise.reject(h)}};function T(t,e={},n={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:r}=l.fromUrl(t),i=this.createVisit({...n,to:o,hash:r});this.performNavigation(i,e)}const V=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},I=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=f('[data-swup-persist]:not([data-swup-persist=""])'),r=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=m(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),r.length===t.containers.length},N=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,r=n??t.to.hash;let i=!1;return r&&(i=this.hooks.callSync("scroll:anchor",t,{hash:r,options:e},(t,{hash:e,options:n})=>{const o=this.getAnchorElement(e);return o&&o.scrollIntoView(n),!!o})),o&&!i&&(i=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo({top:0,left:0,...e}),!0))),i},D=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(p()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},O=function(t,e){try{const n=this;if(t.done)return Promise.resolve();t.advance(6);const{url:o}=e;return n.isSameResolvedUrl(i(),o)||(a(o),n.location=l.fromUrl(o),t.to.url=n.location.url,t.to.hash=n.location.hash),Promise.resolve(n.hooks.call("content:replace",t,{page:e},(t,{})=>{if(n.classes.remove("is-leaving"),t.animation.animate&&n.classes.add("is-rendering"),!n.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(n.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&n.classes.add(`to-${r(t.animation.name)}`))})).then(function(){return Promise.resolve(n.hooks.call("content:scroll",t,void 0,()=>n.scrollToContent(t))).then(function(){return Promise.resolve(n.hooks.call("page:view",t,{url:n.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},M=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function W(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function B(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function _(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function F(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const K={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:(t,{el:e}={})=>!!e?.closest("[data-no-swup]"),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};exports.Location=l,exports.classify=r,exports.createHistoryRecord=s,exports.default=class{get currentPageUrl(){return this.location.url}constructor(t={}){this.version="4.8.1",this.options=void 0,this.defaults=K,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=l.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=M,this.unuse=W,this.findPlugin=B,this.log=()=>{},this.navigate=T,this.performNavigation=L,this.createVisit=P,this.delegateEvent=c,this.fetchPage=h,this.awaitAnimations=$,this.renderPage=O,this.replaceContent=I,this.animatePageIn=D,this.animatePageOut=V,this.scrollToContent=N,this.getAnchorElement=U,this.getCurrentUrl=i,this.resolveUrl=_,this.isSameResolvedUrl=F,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new d(this),this.classes=new y(this),this.hooks=new C(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e));for(const[e,n]of Object.entries(t.options.hooks)){const[o,r]=t.hooks.parseName(e);t.hooks.on(o,n,r)}return"swup"!==window.history.state?.source&&a(null,{index:t.currentHistoryIndex}),Promise.resolve(p()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,{el:e,event:n}={}){const{origin:o,url:r,hash:i}=l.fromUrl(t);return o!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(r+i,{el:e,event:n})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=l.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const i=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",i,{href:n}):0===t.button&&this.hooks.callSync("link:click",i,{el:e,event:t},()=>{const e=i.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(i):r?this.hooks.callSync("link:anchor",i,{hash:r},()=>{a(o+r),this.scrollToContent(i)}):this.hooks.callSync("link:self",i,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(i):(a(o),this.scrollToContent(i))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(i(),this.location.url))return;const{url:n,hash:o}=l.fromUrl(e),r=this.createVisit({to:n,hash:o,event:t});r.history.popstate=!0;const s=t.state?.index??0;s&&s!==this.currentHistoryIndex&&(r.history.direction=s-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=s),r.animation.animate=!1,r.scroll.reset=!1,r.scroll.target=!1,this.options.animateHistoryBrowsing&&(r.animation.animate=!0,r.scroll.reset=!0),this.hooks.callSync("history:popstate",r,{event:t},()=>{this.performNavigation(r)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}},exports.delegateEvent=c,exports.forceReflow=function(t){t=t||document.body,t?.getBoundingClientRect()},exports.getContextualAttr=w,exports.getCurrentUrl=i,exports.isPromise=v,exports.matchPath=(t,n)=>{try{return e.match(t,n)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}},exports.nextTick=p,exports.query=m,exports.queryAll=f,exports.runAsPromise=g,exports.updateHistoryRecord=a;
//# sourceMappingURL=Swup.cjs.map
diff --git a/node_modules/swup/dist/Swup.cjs.map b/node_modules/swup/dist/Swup.cjs.map
index 99d06ce6..08861bfc 100644
--- a/node_modules/swup/dist/Swup.cjs.map
+++ b/node_modules/swup/dist/Swup.cjs.map
@@ -1 +1 @@
-{"version":3,"file":"Swup.cjs","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts","../src/helpers/matchPath.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t}\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst replacingHandler = replace[index].handler;\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [\n\t\t\t\t\t{ id: 0, hook, handler: replacingHandler, defaultHandler: nestedDefaultHandler }\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","random","Math","source","history","pushState","updateHistoryRecord","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","call","visit","FetchError","finalUrl","page","cache","write","method","set","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_temp","fetch","_this$hooks$call","clearTimeout","_catch","error","name","aborted","e","reject","Error","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","has","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","runAsPromise","func","args","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","body","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_result2","found","replaced","sort","sortRegistrations","T","index","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","getAnchorElement","charAt","substring","decoded","decodeURIComponent","element","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","skipPopStateHandling","assign","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches","getBoundingClientRect","matchPath","path","match"],"mappings":"yJACa,MAAAA,EAAWA,CAACC,EAAcC,IACvBC,OAAOF,GACpBG,cAGAC,QAAQ,YAAa,KACrBA,QAAQ,WAAY,IACpBA,QAAQ,OAAQ,KAChBA,QAAQ,WAAY,KACLH,GAAY,GCTjBI,EAAgBA,EAAGC,QAA6B,CAAE,IACvDC,OAAOC,SAASC,SAAWF,OAAOC,SAASE,QAAUJ,EAAOC,OAAOC,SAASF,KAAO,ICW9EK,EAAsBA,CAACC,EAAaC,EAAoB,CAAA,KAEpE,MAAMC,EAAsB,CAC3BF,IAFDA,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IAGlCS,OAAQC,KAAKD,SACbE,OAAQ,UACLJ,GAEJN,OAAOW,QAAQC,UAAUL,EAAO,GAAIF,EACrC,EAGaQ,EAAsBA,CAACR,EAAqB,KAAMC,EAAoB,CAAA,KAClFD,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IACnC,MACMQ,EAAsB,IADNP,OAAOW,QAAQJ,OAA0B,CAAE,EAGhEF,MACAG,OAAQC,KAAKD,SACbE,OAAQ,UACLJ,GAEJN,OAAOW,QAAQG,aAAaP,EAAO,GAAIF,EACxC,ECxBaU,EAAgBA,CAK5BC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAAa,IAAIC,gBAGvB,OAFAF,EAAU,IAAKA,EAASG,OAAQF,EAAWE,QAC3CC,EAAAA,QAAqCP,EAAUC,EAAMC,EAAUC,GACxD,CAAEK,QAASA,IAAMJ,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E3R,KAAK2R,oBAAsBvF,GAI5BhL,EAAMwE,UAAUwB,SAAU,EAC1BhG,EAAM8F,OAAOW,OAAQ,EACrBzG,EAAM8F,OAAO7B,QAAS,EAGlBrF,KAAKjB,QAAQ8V,yBAChBzT,EAAMwE,UAAUwB,SAAU,EAC1BhG,EAAM8F,OAAOW,OAAQ,GAGtB7H,KAAKkB,MAAMyC,SAAS,mBAAoBvC,EAAO,CAAE+F,SAAS,KACzDnH,KAAK6P,kBAAkBzO,IAEzB,CAGUyU,wBAAAA,CAAyBQ,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB,+Cd/Te,SAAYpJ,GAC3BA,EAAUA,GAAWxN,SAASoL,KAC9BoC,GAASqJ,uBACV,4FexCyBC,CACxBC,EACA1X,KAEA,IACC,OAAO2X,EAAAA,MAASD,EAAM1X,EACvB,CAAE,MAAOwD,GACR,MAAM,IAAIK,MAAM,8BAA8BrF,OAAOkZ,SAAYlZ,OAAOgF,KACzE"} \ No newline at end of file
+{"version":3,"file":"Swup.cjs","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts","../src/helpers/matchPath.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\t/** User-defined metadata */\n\tmeta: Record<string, unknown>;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t\tthis.meta = {};\n\t}\n\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\nexport type HookNameWithModifier = `${HookName}.${HookModifier}`;\n\ntype HookModifier = 'once' | 'before' | 'replace';\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\nexport type HookInitOptions = {\n\t[K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;\n} & {\n\t[K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst { handler: replacingHandler, once } = replace[index];\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [{ id: 0, hook, once, handler: replacingHandler, defaultHandler: nestedDefaultHandler }]; // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n\n\t/**\n\t * Parse a hook name into the name and any modifiers.\n\t * @param hook Name of the hook.\n\t */\n\tparseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>] {\n\t\tconst [name, ...modifiers] = hook.split('.');\n\t\tconst options = modifiers.reduce((acc, mod) => ({ ...acc, [mod]: true }), {});\n\t\treturn [name as HookName, options];\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n\t/** Custom metadata associated with this visit. */\n\tmeta?: Record<string, unknown>;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Get custom metadata from option\n\tvisit.meta = options.meta || {};\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks, type HookName, type HookInitOptions } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Hook handlers to register. */\n\thooks: Partial<HookInitOptions>;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\thooks: {},\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Install user hooks\n\t\tfor (const [key, handler] of Object.entries(this.options.hooks)) {\n\t\t\t// Build hook options from modifier suffix: 'content:replace.before' => { before: true }\n\t\t\tconst [hook, modifiers] = this.hooks.parseName(key as HookName);\n\t\t\t// @ts-expect-error: object.entries() does not preserve key/value types\n\t\t\tthis.hooks.on(hook, handler, modifiers);\n\t\t}\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","random","Math","source","history","pushState","updateHistoryRecord","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","call","visit","FetchError","finalUrl","page","cache","write","method","set","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_temp","fetch","_this$hooks$call","clearTimeout","_catch","error","name","aborted","e","reject","Error","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","has","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","runAsPromise","func","args","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","meta","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","body","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_result2","found","replaced","sort","sortRegistrations","T","index","replacingHandler","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","parseName","modifiers","reduce","acc","mod","getAnchorElement","charAt","substring","decoded","decodeURIComponent","element","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","skipPopStateHandling","assign","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","entries","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches","getBoundingClientRect","matchPath","path","match"],"mappings":"yJACa,MAAAA,EAAWA,CAACC,EAAcC,I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AAI/I,EAAKN,OAAMyJ,UAGhDhG,EAAM7C,QAAQqJ,UAAW,EAGzB,MAAMyE,EAASjF,EAAMjJ,OAAwBkO,OAAS,EAClDA,GAASA,IAAUrM,KAAKkS,sBAE3B9Q,EAAM7C,QAAQsJ,UADIwE,EAAQrM,KAAKkS,oBAAsB,EAAI,WAAa,YAEtElS,KAAKkS,oBAAsB7F,GAI5BjL,EAAMwE,UAAUyB,SAAU,EAC1BjG,EAAM8F,OAAOY,OAAQ,EACrB1G,EAAM8F,OAAO7B,QAAS,EAGlBrF,KAAKjB,QAAQqW,yBAChBhU,EAAMwE,UAAUyB,SAAU,EAC1BjG,EAAM8F,OAAOY,OAAQ,GAGtB9H,KAAKkB,MAAMyC,SAAS,mBAAoBvC,EAAO,CAAEgG,SAAS,KACzDpH,KAAKoQ,kBAAkBhP,EACxB,EACD,CAGUiV,wBAAAA,CAAyBQ,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB,+Cd1Ue,SAAYrJ,GAC3BA,EAAUA,GAAW/N,SAASqL,KAC9B0C,GAASsJ,uBACV,4FexCyBC,CACxBC,EACAlY,KAEA,IACC,OAAOmY,EAAAA,MAASD,EAAMlY,EACvB,CAAE,MAAOwD,GACR,MAAM,IAAIK,MAAM,8BAA8BrF,OAAO0Z,SAAY1Z,OAAOgF,KACzE"} \ No newline at end of file
diff --git a/node_modules/swup/dist/Swup.modern.js b/node_modules/swup/dist/Swup.modern.js
index 680a0981..7a6f80f5 100644
--- a/node_modules/swup/dist/Swup.modern.js
+++ b/node_modules/swup/dist/Swup.modern.js
@@ -1,2 +1,2 @@
-import t from"delegate-it";import{match as e}from"path-to-regexp";function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)({}).hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},i.apply(null,arguments)}const s=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",n=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),o=(t,e={})=>{const s=i({url:t=t||n({hash:!0}),random:Math.random(),source:"swup"},e);window.history.pushState(s,"",t)},r=(t=null,e={})=>{t=t||n({hash:!0});const s=i({},window.history.state||{},{url:t,random:Math.random(),source:"swup"},e);window.history.replaceState(s,"",t)},a=(e,s,n,o)=>{const r=new AbortController;return o=i({},o,{signal:r.signal}),t(e,s,n,o),{destroy:()=>r.abort()}};class l extends URL{constructor(t,e=document.baseURI){super(t.toString(),e),Object.setPrototypeOf(this,l.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new l(e)}static fromUrl(t){return new l(t)}}const h=(t,i)=>{try{return e(t,i)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}};class c 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}}async function u(t,e={}){var s;t=l.fromUrl(t).url;const{visit:n=this.visit}=e,o=i({},this.options.requestHeaders,e.headers),r=null!=(s=e.timeout)?s:this.options.timeout,a=new AbortController,{signal:h}=a;e=i({},e,{headers:o,signal:h});let u,d=!1,p=null;r&&r>0&&(p=setTimeout(()=>{d=!0,a.abort("timeout")},r));try{u=await this.hooks.call("fetch:request",n,{url:t,options:e},(t,{url:e,options:i})=>fetch(e,i)),p&&clearTimeout(p)}catch(e){if(d)throw this.hooks.call("fetch:timeout",n,{url:t}),new c(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===(null==e?void 0:e.name)||h.aborted)throw new c(`Request aborted: ${t}`,{url:t,aborted:!0});throw e}const{status:m,url:w}=u,g=await u.text();if(500===m)throw this.hooks.call("fetch:error",n,{status:m,response:u,url:w}),new c(`Server error: ${w}`,{status:m,url:w});if(!g)throw new c(`Empty response: ${w}`,{status:m,url:w});const{url:f}=l.fromUrl(w),v={url:f,html:g};return!n.cache.write||e.method&&"GET"!==e.method||t!==f||this.cache.set(v.url,v),v}class d{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,s)=>{t.set(s,i({},e))}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?i({},e):e}set(t,e){e=i({},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);const s=i({},this.get(t),e,{url:t});this.pages.set(t,s)}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){const{url:e}=l.fromUrl(t);return this.swup.resolveUrl(e)}}const p=(t,e=document)=>e.querySelector(t),m=(t,e=document)=>Array.from(e.querySelectorAll(t)),w=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function g(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function f(t,e=[]){return new Promise((i,s)=>{const n=t(...e);g(n)?n.then(i,s):i(n)})}function v(t){var e;null==(e=t=t||document.body)||e.getBoundingClientRect()}function y(t,e){const i=null==t?void 0:t.closest(`[${e}]`);return null!=i&&i.hasAttribute(e)?(null==i?void 0:i.getAttribute(e))||!0:void 0}class k{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(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=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class b{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;const{to:i,from:s,hash:n,el:o,event:r}=e;this.id=Math.random(),this.state=1,this.from={url:null!=s?s:t.location.url,hash:t.location.hash},this.to={url:i,hash:n},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:r},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 S(t){return new b(this,t)}class E{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,s={}){const n=this.get(t);if(!n)return console.warn(`Hook '${t}' not found.`),()=>{};const o=i({},s,{id:n.size+1,hook:t,handler:e});return n.set(e,o),()=>this.off(t,e)}before(t,e,s={}){return this.on(t,e,i({},s,{before:!0}))}replace(t,e,s={}){return this.on(t,e,i({},s,{replace:!0}))}once(t,e,s={}){return this.on(t,e,i({},s,{once:!0}))}off(t,e){const i=this.get(t);i&&e?i.delete(e)||console.warn(`Handler for hook '${t}' not found.`):i&&i.clear()}async call(t,e,i,s){const[n,o,r]=this.parseCallArgs(t,e,i,s),{before:a,handler:l,after:h}=this.getHandlers(t,r);await this.run(a,n,o);const[c]=await this.run(l,n,o,!0);return await this.run(h,n,o),this.dispatchDomEvent(t,n,o),c}callSync(t,e,i,s){const[n,o,r]=this.parseCallArgs(t,e,i,s),{before:a,handler:l,after:h}=this.getHandlers(t,r);this.runSync(a,n,o);const[c]=this.runSync(l,n,o,!0);return this.runSync(h,n,o),this.dispatchDomEvent(t,n,o),c}parseCallArgs(t,e,i,s){return e instanceof b||"object"!=typeof e&&"function"!=typeof i?[e,i,s]:[void 0,e,i]}async run(t,e=this.swup.visit,i,s=!1){const n=[];for(const{hook:o,handler:r,defaultHandler:a,once:l}of t)if(null==e||!e.done){l&&this.off(o,r);try{const t=await f(r,[e,i,a]);n.push(t)}catch(t){if(s)throw t;console.error(`Error in hook '${o}':`,t)}}return n}runSync(t,e=this.swup.visit,i,s=!1){const n=[];for(const{hook:o,handler:r,defaultHandler:a,once:l}of t)if(null==e||!e.done){l&&this.off(o,r);try{const t=r(e,i,a);n.push(t),g(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${o}'.`)}catch(t){if(s)throw t;console.error(`Error in hook '${o}':`,t)}}return n}getHandlers(t,e){const i=this.get(t);if(!i)return{found:!1,before:[],handler:[],after:[],replaced:!1};const s=Array.from(i.values()),n=this.sortRegistrations,o=s.filter(({before:t,replace:e})=>t&&!e).sort(n),r=s.filter(({replace:t})=>t).filter(t=>!0).sort(n),a=s.filter(({before:t,replace:e})=>!t&&!e).sort(n),l=r.length>0;let h=[];if(e&&(h=[{id:0,hook:t,handler:e}],l)){const i=r.length-1,s=t=>{const i=r[t-1];return i?(e,n)=>i.handler(e,n,s(t-1)):e};h=[{id:0,hook:t,handler:r[i].handler,defaultHandler:s(i)}]}return{found:!0,before:o,handler:h,after:a,replaced:l}}sortRegistrations(t,e){var i,s;return(null!=(i=t.priority)?i:0)-(null!=(s=e.priority)?s:0)||t.id-e.id||0}dispatchDomEvent(t,e,i){if(null!=e&&e.done)return;const s={hook:t,args:i,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:s,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:s,bubbles:!0}))}}const C=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let i=document.getElementById(t)||document.getElementById(e)||p(`a[name='${CSS.escape(t)}']`)||p(`a[name='${CSS.escape(e)}']`);return i||"top"!==t||(i=document.body),i},U="transition",P="animation";async function $({selector:t,elements:e}){if(!1===t&&!e)return;let i=[];if(e)i=Array.from(e);else if(t&&(i=m(t,document.body),!i.length))return void console.warn(`[swup] No elements found matching animationSelector \`${t}\``);const s=i.map(t=>function(t){const{type:e,timeout:i,propCount:s}=function(t){const e=window.getComputedStyle(t),i=x(e,`${U}Delay`),s=x(e,`${U}Duration`),n=A(i,s),o=x(e,`${P}Delay`),r=x(e,`${P}Duration`),a=A(o,r),l=Math.max(n,a),h=l>0?n>a?U:P:null;return{type:h,timeout:l,propCount:h?h===U?s.length:r.length:0}}(t);return!(!e||!i)&&new Promise(n=>{const o=`${e}end`,r=performance.now();let a=0;const l=()=>{t.removeEventListener(o,h),n()},h=e=>{e.target===t&&((performance.now()-r)/1e3<e.elapsedTime||++a>=s&&l())};setTimeout(()=>{a<s&&l()},i+1),t.addEventListener(o,h)})}(t));s.filter(Boolean).length>0?await Promise.all(s):t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``)}function x(t,e){return(t[e]||"").split(", ")}function A(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,i)=>H(e)+H(t[i])))}function H(t){return 1e3*parseFloat(t)}function V(t,e={},s={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:s.el,event:s.event}))return void window.location.assign(t);const{url:n,hash:o}=l.fromUrl(t),r=this.createVisit(i({},s,{to:n,hash:o}));this.performNavigation(r,e)}async function I(t,e={}){if(this.navigating){if(this.visit.state>=6)return t.state=2,void(this.onVisitEnd=()=>this.performNavigation(t,e));await this.hooks.call("visit:abort",this.visit,void 0),delete this.visit.to.document,this.visit.state=8}this.navigating=!0,this.visit=t;const{el:i}=t.trigger;e.referrer=e.referrer||this.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||this.classes.clear();const n=e.history||y(i,"data-swup-history");"string"==typeof n&&["push","replace"].includes(n)&&(t.history.action=n);const a=e.animation||y(i,"data-swup-animation");var h,c;"string"==typeof a&&(t.animation.name=a),"object"==typeof e.cache?(t.cache.read=null!=(h=e.cache.read)?h:t.cache.read,t.cache.write=null!=(c=e.cache.write)?c:t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache;try{await this.hooks.call("visit:start",t,void 0),t.state=3;const i=this.hooks.call("page:load",t,{options:e},async(t,e)=>{let i;return t.cache.read&&(i=this.cache.get(t.to.url)),e.page=i||await this.fetchPage(t.to.url,e.options),e.cache=!!i,e.page});i.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const n=t.to.url+t.to.hash;if(t.history.popstate||("replace"===t.history.action||t.to.url===this.location.url?r(n):(this.currentHistoryIndex++,o(n,{index:this.currentHistoryIndex}))),this.location=l.fromUrl(n),t.history.popstate&&this.classes.add("is-popstate"),t.animation.name&&this.classes.add(`to-${s(t.animation.name)}`),t.animation.wait&&await i,t.done)return;if(await this.hooks.call("visit:transition",t,void 0,async()=>{if(!t.animation.animate)return await this.hooks.call("animation:skip",void 0),void await this.renderPage(t,await i);t.advance(4),await this.animatePageOut(t),t.animation.native&&document.startViewTransition?await document.startViewTransition(async()=>await this.renderPage(t,await i)).finished:await this.renderPage(t,await i),await this.animatePageIn(t)}),t.done)return;await this.hooks.call("visit:end",t,void 0,()=>this.classes.clear()),t.state=7,this.navigating=!1,this.onVisitEnd&&(this.onVisitEnd(),this.onVisitEnd=void 0)}catch(e){if(!e||null!=e&&e.aborted)return void(t.state=8);t.state=9,console.error(e),this.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()}finally{delete t.to.document}}const L=async function(t){await this.hooks.call("animation:out:start",t,void 0,()=>{this.classes.add("is-changing","is-animating","is-leaving")}),await this.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:e})=>{if(!e)return this.awaitAnimations({selector:t.animation.selector})}),await this.hooks.call("animation:out:end",t,void 0)},q=function(t){var e;const i=t.to.document;if(!i)return!1;const s=(null==(e=i.querySelector("title"))?void 0:e.innerText)||"";document.title=s;const n=m('[data-swup-persist]:not([data-swup-persist=""])'),o=t.containers.map(t=>{const e=document.querySelector(t),s=i.querySelector(t);return e&&s?(e.replaceWith(s.cloneNode(!0)),!0):(e||console.warn(`[swup] Container missing in current document: ${t}`),s||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return n.forEach(t=>{const e=t.getAttribute("data-swup-persist"),i=p(`[data-swup-persist="${e}"]`);i&&i!==t&&i.replaceWith(t)}),o.length===t.containers.length},R=function(t){const e={behavior:"auto"},{target:s,reset:n}=t.scroll,o=null!=s?s:t.to.hash;let r=!1;return o&&(r=this.hooks.callSync("scroll:anchor",t,{hash:o,options:e},(t,{hash:e,options:i})=>{const s=this.getAnchorElement(e);return s&&s.scrollIntoView(i),!!s})),n&&!r&&(r=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo(i({top:0,left:0},e)),!0))),r},T=async function(t){if(t.done)return;const e=this.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:e})=>{if(!e)return this.awaitAnimations({selector:t.animation.selector})});await w(),await this.hooks.call("animation:in:start",t,void 0,()=>{this.classes.remove("is-animating")}),await e,await this.hooks.call("animation:in:end",t,void 0)},N=async function(t,e){if(t.done)return;t.advance(6);const{url:i}=e;this.isSameResolvedUrl(n(),i)||(r(i),this.location=l.fromUrl(i),t.to.url=this.location.url,t.to.hash=this.location.hash),await this.hooks.call("content:replace",t,{page:e},(t,{})=>{if(this.classes.remove("is-leaving"),t.animation.animate&&this.classes.add("is-rendering"),!this.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(this.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&this.classes.add(`to-${s(t.animation.name)}`))}),await this.hooks.call("content:scroll",t,void 0,()=>this.scrollToContent(t)),await this.hooks.call("page:view",t,{url:this.location.url,title:document.title})},O=function(t){var e;if(e=t,Boolean(null==e?void 0:e.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function D(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function M(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function W(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function B(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const _={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],ignoreVisit:(t,{el:e}={})=>!(null==e||!e.closest("[data-no-swup]")),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>{var e;return"swup"!==(null==(e=t.state)?void 0:e.source)},timeout:0};class j{get currentPageUrl(){return this.location.url}constructor(t={}){var e,s;this.version="4.7.0",this.options=void 0,this.defaults=_,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=l.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=O,this.unuse=D,this.findPlugin=M,this.log=()=>{},this.navigate=V,this.performNavigation=I,this.createVisit=S,this.delegateEvent=a,this.fetchPage=u,this.awaitAnimations=$,this.renderPage=N,this.replaceContent=q,this.animatePageIn=T,this.animatePageOut=L,this.scrollToContent=R,this.getAnchorElement=C,this.getCurrentUrl=n,this.resolveUrl=W,this.isSameResolvedUrl=B,this.options=i({},this.defaults,t),this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new d(this),this.classes=new k(this),this.hooks=new E(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=null!=(e=null==(s=window.history.state)?void 0:s.index)?e:1,this.enable()}async enable(){var t;const{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(t=>this.use(t)),"swup"!==(null==(t=window.history.state)?void 0:t.source)&&r(null,{index:this.currentHistoryIndex}),await w(),await this.hooks.call("enable",void 0,void 0,()=>{const t=document.documentElement;t.classList.add("swup-enabled"),t.classList.toggle("swup-native",this.options.native)})}async destroy(){this.clickDelegate.destroy(),window.removeEventListener("popstate",this.handlePopState),this.cache.clear(),this.options.plugins.forEach(t=>this.unuse(t)),await this.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")}),this.hooks.clear()}shouldIgnoreVisit(t,{el:e,event:i}={}){const{origin:s,url:n,hash:o}=l.fromUrl(t);return s!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(n+o,{el:e,event:i})}handleLinkClick(t){const e=t.delegateTarget,{href:i,url:s,hash:n}=l.fromElement(e);if(this.shouldIgnoreVisit(i,{el:e,event:t}))return;if(this.navigating&&s===this.visit.to.url)return void t.preventDefault();const o=this.createVisit({to:s,hash:n,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",o,{href:i}):0===t.button&&this.hooks.callSync("link:click",o,{el:e,event:t},()=>{var e;const i=null!=(e=o.from.url)?e:"";t.preventDefault(),s&&s!==i?this.isSameResolvedUrl(s,i)||this.performNavigation(o):n?this.hooks.callSync("link:anchor",o,{hash:n},()=>{r(s+n),this.scrollToContent(o)}):this.hooks.callSync("link:self",o,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(o):(r(s),this.scrollToContent(o))})})}handlePopState(t){var e,i,s,o;const r=null!=(e=null==(i=t.state)?void 0:i.url)?e:window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(n(),this.location.url))return;const{url:a,hash:h}=l.fromUrl(r),c=this.createVisit({to:a,hash:h,event:t});c.history.popstate=!0;const u=null!=(s=null==(o=t.state)?void 0:o.index)?s:0;u&&u!==this.currentHistoryIndex&&(c.history.direction=u-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=u),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"]')}}export{l as Location,s as classify,o as createHistoryRecord,j as default,a as delegateEvent,v as forceReflow,y as getContextualAttr,n as getCurrentUrl,g as isPromise,h as matchPath,w as nextTick,p as query,m as queryAll,f as runAsPromise,r as updateHistoryRecord};
+import t from"delegate-it";import{match as e}from"path-to-regexp";function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var s in i)({}).hasOwnProperty.call(i,s)&&(t[s]=i[s])}return t},i.apply(null,arguments)}const s=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",n=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),o=(t,e={})=>{const s=i({url:t=t||n({hash:!0}),random:Math.random(),source:"swup"},e);window.history.pushState(s,"",t)},r=(t=null,e={})=>{t=t||n({hash:!0});const s=i({},window.history.state||{},{url:t,random:Math.random(),source:"swup"},e);window.history.replaceState(s,"",t)},a=(e,s,n,o)=>{const r=new AbortController;return o=i({},o,{signal:r.signal}),t(e,s,n,o),{destroy:()=>r.abort()}};class l extends URL{constructor(t,e=document.baseURI){super(t.toString(),e),Object.setPrototypeOf(this,l.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new l(e)}static fromUrl(t){return new l(t)}}const h=(t,i)=>{try{return e(t,i)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}};class c 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}}async function u(t,e={}){var s;t=l.fromUrl(t).url;const{visit:n=this.visit}=e,o=i({},this.options.requestHeaders,e.headers),r=null!=(s=e.timeout)?s:this.options.timeout,a=new AbortController,{signal:h}=a;e=i({},e,{headers:o,signal:h});let u,d=!1,p=null;r&&r>0&&(p=setTimeout(()=>{d=!0,a.abort("timeout")},r));try{u=await this.hooks.call("fetch:request",n,{url:t,options:e},(t,{url:e,options:i})=>fetch(e,i)),p&&clearTimeout(p)}catch(e){if(d)throw this.hooks.call("fetch:timeout",n,{url:t}),new c(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===(null==e?void 0:e.name)||h.aborted)throw new c(`Request aborted: ${t}`,{url:t,aborted:!0});throw e}const{status:m,url:w}=u,f=await u.text();if(500===m)throw this.hooks.call("fetch:error",n,{status:m,response:u,url:w}),new c(`Server error: ${w}`,{status:m,url:w});if(!f)throw new c(`Empty response: ${w}`,{status:m,url:w});const{url:g}=l.fromUrl(w),v={url:g,html:f};return!n.cache.write||e.method&&"GET"!==e.method||t!==g||this.cache.set(v.url,v),v}class d{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,s)=>{t.set(s,i({},e))}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?i({},e):e}set(t,e){e=i({},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);const s=i({},this.get(t),e,{url:t});this.pages.set(t,s)}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){const{url:e}=l.fromUrl(t);return this.swup.resolveUrl(e)}}const p=(t,e=document)=>e.querySelector(t),m=(t,e=document)=>Array.from(e.querySelectorAll(t)),w=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function f(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function g(t,e=[]){return new Promise((i,s)=>{const n=t(...e);f(n)?n.then(i,s):i(n)})}function v(t){var e;null==(e=t=t||document.body)||e.getBoundingClientRect()}function y(t,e){const i=null==t?void 0:t.closest(`[${e}]`);return null!=i&&i.hasAttribute(e)?(null==i?void 0:i.getAttribute(e))||!0:void 0}class k{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(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=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class b{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,this.meta=void 0;const{to:i,from:s,hash:n,el:o,event:r}=e;this.id=Math.random(),this.state=1,this.from={url:null!=s?s:t.location.url,hash:t.location.hash},this.to={url:i,hash:n},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:r},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},this.meta={}}advance(t){this.state<t&&(this.state=t)}abort(){this.state=8}get done(){return this.state>=7}}function S(t){return new b(this,t)}class E{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,s={}){const n=this.get(t);if(!n)return console.warn(`Hook '${t}' not found.`),()=>{};const o=i({},s,{id:n.size+1,hook:t,handler:e});return n.set(e,o),()=>this.off(t,e)}before(t,e,s={}){return this.on(t,e,i({},s,{before:!0}))}replace(t,e,s={}){return this.on(t,e,i({},s,{replace:!0}))}once(t,e,s={}){return this.on(t,e,i({},s,{once:!0}))}off(t,e){const i=this.get(t);i&&e?i.delete(e)||console.warn(`Handler for hook '${t}' not found.`):i&&i.clear()}async call(t,e,i,s){const[n,o,r]=this.parseCallArgs(t,e,i,s),{before:a,handler:l,after:h}=this.getHandlers(t,r);await this.run(a,n,o);const[c]=await this.run(l,n,o,!0);return await this.run(h,n,o),this.dispatchDomEvent(t,n,o),c}callSync(t,e,i,s){const[n,o,r]=this.parseCallArgs(t,e,i,s),{before:a,handler:l,after:h}=this.getHandlers(t,r);this.runSync(a,n,o);const[c]=this.runSync(l,n,o,!0);return this.runSync(h,n,o),this.dispatchDomEvent(t,n,o),c}parseCallArgs(t,e,i,s){return e instanceof b||"object"!=typeof e&&"function"!=typeof i?[e,i,s]:[void 0,e,i]}async run(t,e=this.swup.visit,i,s=!1){const n=[];for(const{hook:o,handler:r,defaultHandler:a,once:l}of t)if(null==e||!e.done){l&&this.off(o,r);try{const t=await g(r,[e,i,a]);n.push(t)}catch(t){if(s)throw t;console.error(`Error in hook '${o}':`,t)}}return n}runSync(t,e=this.swup.visit,i,s=!1){const n=[];for(const{hook:o,handler:r,defaultHandler:a,once:l}of t)if(null==e||!e.done){l&&this.off(o,r);try{const t=r(e,i,a);n.push(t),f(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${o}'.`)}catch(t){if(s)throw t;console.error(`Error in hook '${o}':`,t)}}return n}getHandlers(t,e){const i=this.get(t);if(!i)return{found:!1,before:[],handler:[],after:[],replaced:!1};const s=Array.from(i.values()),n=this.sortRegistrations,o=s.filter(({before:t,replace:e})=>t&&!e).sort(n),r=s.filter(({replace:t})=>t).filter(t=>!0).sort(n),a=s.filter(({before:t,replace:e})=>!t&&!e).sort(n),l=r.length>0;let h=[];if(e&&(h=[{id:0,hook:t,handler:e}],l)){const i=r.length-1,{handler:s,once:n}=r[i],o=t=>{const i=r[t-1];return i?(e,s)=>i.handler(e,s,o(t-1)):e};h=[{id:0,hook:t,once:n,handler:s,defaultHandler:o(i)}]}return{found:!0,before:o,handler:h,after:a,replaced:l}}sortRegistrations(t,e){var i,s;return(null!=(i=t.priority)?i:0)-(null!=(s=e.priority)?s:0)||t.id-e.id||0}dispatchDomEvent(t,e,i){if(null!=e&&e.done)return;const s={hook:t,args:i,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:s,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:s,bubbles:!0}))}parseName(t){const[e,...s]=t.split(".");return[e,s.reduce((t,e)=>i({},t,{[e]:!0}),{})]}}const C=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let i=document.getElementById(t)||document.getElementById(e)||p(`a[name='${CSS.escape(t)}']`)||p(`a[name='${CSS.escape(e)}']`);return i||"top"!==t||(i=document.body),i},U="transition",P="animation";async function $({selector:t,elements:e}){if(!1===t&&!e)return;let i=[];if(e)i=Array.from(e);else if(t&&(i=m(t,document.body),!i.length))return void console.warn(`[swup] No elements found matching animationSelector \`${t}\``);const s=i.map(t=>function(t){const{type:e,timeout:i,propCount:s}=function(t){const e=window.getComputedStyle(t),i=x(e,`${U}Delay`),s=x(e,`${U}Duration`),n=A(i,s),o=x(e,`${P}Delay`),r=x(e,`${P}Duration`),a=A(o,r),l=Math.max(n,a),h=l>0?n>a?U:P:null;return{type:h,timeout:l,propCount:h?h===U?s.length:r.length:0}}(t);return!(!e||!i)&&new Promise(n=>{const o=`${e}end`,r=performance.now();let a=0;const l=()=>{t.removeEventListener(o,h),n()},h=e=>{e.target===t&&((performance.now()-r)/1e3<e.elapsedTime||++a>=s&&l())};setTimeout(()=>{a<s&&l()},i+1),t.addEventListener(o,h)})}(t));s.filter(Boolean).length>0?await Promise.all(s):t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``)}function x(t,e){return(t[e]||"").split(", ")}function A(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,i)=>H(e)+H(t[i])))}function H(t){return 1e3*parseFloat(t)}function V(t,e={},s={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:s.el,event:s.event}))return void window.location.assign(t);const{url:n,hash:o}=l.fromUrl(t),r=this.createVisit(i({},s,{to:n,hash:o}));this.performNavigation(r,e)}async function I(t,e={}){if(this.navigating){if(this.visit.state>=6)return t.state=2,void(this.onVisitEnd=()=>this.performNavigation(t,e));await this.hooks.call("visit:abort",this.visit,void 0),delete this.visit.to.document,this.visit.state=8}this.navigating=!0,this.visit=t;const{el:i}=t.trigger;e.referrer=e.referrer||this.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||this.classes.clear();const n=e.history||y(i,"data-swup-history");"string"==typeof n&&["push","replace"].includes(n)&&(t.history.action=n);const a=e.animation||y(i,"data-swup-animation");var h,c;"string"==typeof a&&(t.animation.name=a),t.meta=e.meta||{},"object"==typeof e.cache?(t.cache.read=null!=(h=e.cache.read)?h:t.cache.read,t.cache.write=null!=(c=e.cache.write)?c:t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache;try{await this.hooks.call("visit:start",t,void 0),t.state=3;const i=this.hooks.call("page:load",t,{options:e},async(t,e)=>{let i;return t.cache.read&&(i=this.cache.get(t.to.url)),e.page=i||await this.fetchPage(t.to.url,e.options),e.cache=!!i,e.page});i.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const n=t.to.url+t.to.hash;if(t.history.popstate||("replace"===t.history.action||t.to.url===this.location.url?r(n):(this.currentHistoryIndex++,o(n,{index:this.currentHistoryIndex}))),this.location=l.fromUrl(n),t.history.popstate&&this.classes.add("is-popstate"),t.animation.name&&this.classes.add(`to-${s(t.animation.name)}`),t.animation.wait&&await i,t.done)return;if(await this.hooks.call("visit:transition",t,void 0,async()=>{if(!t.animation.animate)return await this.hooks.call("animation:skip",void 0),void await this.renderPage(t,await i);t.advance(4),await this.animatePageOut(t),t.animation.native&&document.startViewTransition?await document.startViewTransition(async()=>await this.renderPage(t,await i)).finished:await this.renderPage(t,await i),await this.animatePageIn(t)}),t.done)return;await this.hooks.call("visit:end",t,void 0,()=>this.classes.clear()),t.state=7,this.navigating=!1,this.onVisitEnd&&(this.onVisitEnd(),this.onVisitEnd=void 0)}catch(e){if(!e||null!=e&&e.aborted)return void(t.state=8);t.state=9,console.error(e),this.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()}finally{delete t.to.document}}const L=async function(t){await this.hooks.call("animation:out:start",t,void 0,()=>{this.classes.add("is-changing","is-animating","is-leaving")}),await this.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:e})=>{if(!e)return this.awaitAnimations({selector:t.animation.selector})}),await this.hooks.call("animation:out:end",t,void 0)},q=function(t){var e;const i=t.to.document;if(!i)return!1;const s=(null==(e=i.querySelector("title"))?void 0:e.innerText)||"";document.title=s;const n=m('[data-swup-persist]:not([data-swup-persist=""])'),o=t.containers.map(t=>{const e=document.querySelector(t),s=i.querySelector(t);return e&&s?(e.replaceWith(s.cloneNode(!0)),!0):(e||console.warn(`[swup] Container missing in current document: ${t}`),s||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return n.forEach(t=>{const e=t.getAttribute("data-swup-persist"),i=p(`[data-swup-persist="${e}"]`);i&&i!==t&&i.replaceWith(t)}),o.length===t.containers.length},R=function(t){const e={behavior:"auto"},{target:s,reset:n}=t.scroll,o=null!=s?s:t.to.hash;let r=!1;return o&&(r=this.hooks.callSync("scroll:anchor",t,{hash:o,options:e},(t,{hash:e,options:i})=>{const s=this.getAnchorElement(e);return s&&s.scrollIntoView(i),!!s})),n&&!r&&(r=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo(i({top:0,left:0},e)),!0))),r},T=async function(t){if(t.done)return;const e=this.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:e})=>{if(!e)return this.awaitAnimations({selector:t.animation.selector})});await w(),await this.hooks.call("animation:in:start",t,void 0,()=>{this.classes.remove("is-animating")}),await e,await this.hooks.call("animation:in:end",t,void 0)},N=async function(t,e){if(t.done)return;t.advance(6);const{url:i}=e;this.isSameResolvedUrl(n(),i)||(r(i),this.location=l.fromUrl(i),t.to.url=this.location.url,t.to.hash=this.location.hash),await this.hooks.call("content:replace",t,{page:e},(t,{})=>{if(this.classes.remove("is-leaving"),t.animation.animate&&this.classes.add("is-rendering"),!this.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(this.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&this.classes.add(`to-${s(t.animation.name)}`))}),await this.hooks.call("content:scroll",t,void 0,()=>this.scrollToContent(t)),await this.hooks.call("page:view",t,{url:this.location.url,title:document.title})},O=function(t){var e;if(e=t,Boolean(null==e?void 0:e.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function D(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function M(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function W(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function B(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const j={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:(t,{el:e}={})=>!(null==e||!e.closest("[data-no-swup]")),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>{var e;return"swup"!==(null==(e=t.state)?void 0:e.source)},timeout:0};class _{get currentPageUrl(){return this.location.url}constructor(t={}){var e,s;this.version="4.8.1",this.options=void 0,this.defaults=j,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=l.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=O,this.unuse=D,this.findPlugin=M,this.log=()=>{},this.navigate=V,this.performNavigation=I,this.createVisit=S,this.delegateEvent=a,this.fetchPage=u,this.awaitAnimations=$,this.renderPage=N,this.replaceContent=q,this.animatePageIn=T,this.animatePageOut=L,this.scrollToContent=R,this.getAnchorElement=C,this.getCurrentUrl=n,this.resolveUrl=W,this.isSameResolvedUrl=B,this.options=i({},this.defaults,t),this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new d(this),this.classes=new k(this),this.hooks=new E(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=null!=(e=null==(s=window.history.state)?void 0:s.index)?e:1,this.enable()}async enable(){var t;const{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(t=>this.use(t));for(const[t,e]of Object.entries(this.options.hooks)){const[i,s]=this.hooks.parseName(t);this.hooks.on(i,e,s)}"swup"!==(null==(t=window.history.state)?void 0:t.source)&&r(null,{index:this.currentHistoryIndex}),await w(),await this.hooks.call("enable",void 0,void 0,()=>{const t=document.documentElement;t.classList.add("swup-enabled"),t.classList.toggle("swup-native",this.options.native)})}async destroy(){this.clickDelegate.destroy(),window.removeEventListener("popstate",this.handlePopState),this.cache.clear(),this.options.plugins.forEach(t=>this.unuse(t)),await this.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")}),this.hooks.clear()}shouldIgnoreVisit(t,{el:e,event:i}={}){const{origin:s,url:n,hash:o}=l.fromUrl(t);return s!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(n+o,{el:e,event:i})}handleLinkClick(t){const e=t.delegateTarget,{href:i,url:s,hash:n}=l.fromElement(e);if(this.shouldIgnoreVisit(i,{el:e,event:t}))return;if(this.navigating&&s===this.visit.to.url)return void t.preventDefault();const o=this.createVisit({to:s,hash:n,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",o,{href:i}):0===t.button&&this.hooks.callSync("link:click",o,{el:e,event:t},()=>{var e;const i=null!=(e=o.from.url)?e:"";t.preventDefault(),s&&s!==i?this.isSameResolvedUrl(s,i)||this.performNavigation(o):n?this.hooks.callSync("link:anchor",o,{hash:n},()=>{r(s+n),this.scrollToContent(o)}):this.hooks.callSync("link:self",o,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(o):(r(s),this.scrollToContent(o))})})}handlePopState(t){var e,i,s,o;const r=null!=(e=null==(i=t.state)?void 0:i.url)?e:window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(n(),this.location.url))return;const{url:a,hash:h}=l.fromUrl(r),c=this.createVisit({to:a,hash:h,event:t});c.history.popstate=!0;const u=null!=(s=null==(o=t.state)?void 0:o.index)?s:0;u&&u!==this.currentHistoryIndex&&(c.history.direction=u-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=u),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"]')}}export{l as Location,s as classify,o as createHistoryRecord,_ as default,a as delegateEvent,v as forceReflow,y as getContextualAttr,n as getCurrentUrl,f as isPromise,h as matchPath,w as nextTick,p as query,m as queryAll,g as runAsPromise,r as updateHistoryRecord};
//# sourceMappingURL=Swup.modern.js.map
diff --git a/node_modules/swup/dist/Swup.modern.js.map b/node_modules/swup/dist/Swup.modern.js.map
index 546acd85..2812349c 100644
--- a/node_modules/swup/dist/Swup.modern.js.map
+++ b/node_modules/swup/dist/Swup.modern.js.map
@@ -1 +1 @@
-{"version":3,"file":"Swup.modern.js","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/helpers/matchPath.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t}\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst replacingHandler = replace[index].handler;\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [\n\t\t\t\t\t{ id: 0, hook, handler: replacingHandler, defaultHandler: nestedDefaultHandler }\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","_extends","random","Math","source","history","pushState","updateHistoryRecord","currentState","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","matchPath","path","match","error","Error","FetchError","message","details","status","aborted","timedOut","name","async","fetchPage","_options$timeout","visit","headers","requestHeaders","timeout","response","timeoutId","setTimeout","hooks","call","fetch","clearTimeout","responseUrl","html","finalUrl","page","cache","write","method","set","Cache","swup","pages","Map","size","all","copy","forEach","key","has","resolve","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","Promise","requestAnimationFrame","isPromise","obj","then","runAsPromise","func","args","reject","forceReflow","element","_element","body","getBoundingClientRect","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classes","classList","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","results","push","found","replaced","values","sort","sortRegistrations","T","length","index","createDefaultHandler","next","a","b","_a$priority","_b$priority","priority","detail","dispatchEvent","CustomEvent","bubbles","getAnchorElement","charAt","substring","decoded","decodeURIComponent","getElementById","CSS","escape","TRANSITION","ANIMATION","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","i","toMs","time","parseFloat","navigate","shouldIgnoreVisit","assign","performNavigation","navigating","onVisitEnd","referrer","includes","_options$cache$read","_options$cache$write","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","renderPage","animatePageOut","startViewTransition","finished","animatePageIn","skipPopStateHandling","back","skip","replaceContent","_incomingDocument$que","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","_event$state","Swup","currentPageUrl","_window$history$state","_window$history$state2","version","clickDelegate","log","handleLinkClick","bind","handlePopState","enable","_window$history$state3","scrollRestoration","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","_visit$from$url","_event$state$url","_event$state2","_event$state$index","_event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,KAAKiP,sBAE3B3N,EAAMhD,QAAQwJ,UADIyC,EAAQvK,KAAKiP,oBAAsB,EAAI,WAAa,YAEtEjP,KAAKiP,oBAAsB1E,GAI5BjJ,EAAMyE,UAAUuB,SAAU,EAC1BhG,EAAM8F,OAAOW,OAAQ,EACrBzG,EAAM8F,OAAO5B,QAAS,EAGlBxF,KAAKjB,QAAQmT,yBAChB5Q,EAAMyE,UAAUuB,SAAU,EAC1BhG,EAAM8F,OAAOW,OAAQ,GAGtB/H,KAAK6B,MAAMyB,SAAS,mBAAoBhC,EAAO,CAAE+F,SAAS,KACzDrH,KAAKsO,kBAAkBhN,EACxB,EACD,CAGUkS,wBAAAA,CAAyBa,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
+{"version":3,"file":"Swup.modern.js","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/helpers/matchPath.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\t/** User-defined metadata */\n\tmeta: Record<string, unknown>;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t\tthis.meta = {};\n\t}\n\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\nexport type HookNameWithModifier = `${HookName}.${HookModifier}`;\n\ntype HookModifier = 'once' | 'before' | 'replace';\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\nexport type HookInitOptions = {\n\t[K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;\n} & {\n\t[K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst { handler: replacingHandler, once } = replace[index];\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [{ id: 0, hook, once, handler: replacingHandler, defaultHandler: nestedDefaultHandler }]; // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n\n\t/**\n\t * Parse a hook name into the name and any modifiers.\n\t * @param hook Name of the hook.\n\t */\n\tparseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>] {\n\t\tconst [name, ...modifiers] = hook.split('.');\n\t\tconst options = modifiers.reduce((acc, mod) => ({ ...acc, [mod]: true }), {});\n\t\treturn [name as HookName, options];\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n\t/** Custom metadata associated with this visit. */\n\tmeta?: Record<string, unknown>;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Get custom metadata from option\n\tvisit.meta = options.meta || {};\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks, type HookName, type HookInitOptions } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Hook handlers to register. */\n\thooks: Partial<HookInitOptions>;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\thooks: {},\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Install user hooks\n\t\tfor (const [key, handler] of Object.entries(this.options.hooks)) {\n\t\t\t// Build hook options from modifier suffix: 'content:replace.before' => { before: true }\n\t\t\tconst [hook, modifiers] = this.hooks.parseName(key as HookName);\n\t\t\t// @ts-expect-error: object.entries() does not preserve key/value types\n\t\t\tthis.hooks.on(hook, handler, modifiers);\n\t\t}\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","_extends","random","Math","source","history","pushState","updateHistoryRecord","currentState","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","matchPath","path","match","error","Error","FetchError","message","details","status","aborted","timedOut","name","async","fetchPage","_options$timeout","visit","headers","requestHeaders","timeout","response","timeoutId","setTimeout","hooks","call","fetch","clearTimeout","responseUrl","html","finalUrl","page","cache","write","method","set","Cache","swup","pages","Map","size","all","copy","forEach","key","has","resolve","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","Promise","requestAnimationFrame","isPromise","obj","then","runAsPromise","func","args","reject","forceReflow","element","_element","body","getBoundingClientRect","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classes","classList","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","meta","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","results","push","found","replaced","values","sort","sortRegistrations","T","length","index","replacingHandler","createDefaultHandler","next","a","b","_a$priority","_b$priority","priority","detail","dispatchEvent","CustomEvent","bubbles","parseName","modifiers","reduce","acc","mod","getAnchorElement","charAt","substring","decoded","decodeURIComponent","getElementById","CSS","escape","TRANSITION","ANIMATION","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","i","toMs","time","parseFloat","navigate","shouldIgnoreVisit","assign","performNavigation","navigating","onVisitEnd","referrer","includes","_options$cache$read","_options$cache$write","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","renderPage","animatePageOut","startViewTransition","finished","animatePageIn","skipPopStateHandling","back","skip","replaceContent","_incomingDocument$que","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","_event$state","Swup","currentPageUrl","_window$history$state","_window$history$state2","version","clickDelegate","log","handleLinkClick","bind","handlePopState","enable","_window$history$state3","scrollRestoration","entries","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","_visit$from$url","_event$state$url","_event$state2","_event$state$index","_event$state3","triggerEl","matches"],"mappings":"0RACa,MAAAA,EAAWA,CAACC,EAAcC,IACvBC,OAAOF,GACpBG,cAGAC,QAAQ,YAAa,KACrBA,QAAQ,WAAY,IACpBA,QAAQ,OAAQ,KAChBA,QAAQ,WAAY,KACLH,GAAY,GCTjBI,EAAgBA,EAAGC,QAA6B,CAAE,IACvDC,OAAOC,SAASC,SAAWF,OAAOC,SAASE,QAAUJ,EAAOC,OAAOC,SAASF,KAAO,ICW9EK,EAAsBA,CAACC,EAAaC,EAAoB,CAAA,KAEpE,MAA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KAAEA,GAAS6B,EAASgB,QAAQF,GAEjCkB,EAAQtB,KAAKmI,YAAY,CAAEjB,GAAInJ,EAAKN,OAAM6J,UAGhDhG,EAAMhD,QAAQwJ,UAAW,EAGzB,MAAM0C,EAA4C,OAAvCmK,SAAAC,EAAItN,EAAMrJ,cAAN2W,EAA8BpK,OAAKmK,EAAI,EAClDnK,GAASA,IAAUxK,KAAKwP,sBAE3BlO,EAAMhD,QAAQyJ,UADIyC,EAAQxK,KAAKwP,oBAAsB,EAAI,WAAa,YAEtExP,KAAKwP,oBAAsBhF,GAI5BlJ,EAAMyE,UAAUwB,SAAU,EAC1BjG,EAAM8F,OAAOY,OAAQ,EACrB1G,EAAM8F,OAAO5B,QAAS,EAGlBxF,KAAKjB,QAAQ0T,yBAChBnR,EAAMyE,UAAUwB,SAAU,EAC1BjG,EAAM8F,OAAOY,OAAQ,GAGtBhI,KAAK6B,MAAMyB,SAAS,mBAAoBhC,EAAO,CAAEgG,SAAS,KACzDtH,KAAK6O,kBAAkBvN,EACxB,EACD,CAGU0S,wBAAAA,CAAyBa,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
diff --git a/node_modules/swup/dist/Swup.module.js b/node_modules/swup/dist/Swup.module.js
index 714f0be0..ef0bf9e1 100644
--- a/node_modules/swup/dist/Swup.module.js
+++ b/node_modules/swup/dist/Swup.module.js
@@ -1,2 +1,2 @@
-import t from"delegate-it";import{match as e}from"path-to-regexp";const n=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",o=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),r=(t,e={})=>{const n={url:t=t||o({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)},i=(t=null,e={})=>{t=t||o({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},s=(e,n,o,r)=>{const i=new AbortController;return r={...r,signal:i.signal},t(e,n,o,r),{destroy:()=>i.abort()}};class a 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){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new a(e)}static fromUrl(t){return new a(t)}}const c=(t,n)=>{try{return e(t,n)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}},l=function(t,e={}){try{const o=this;function n(n){const{status:i,url:s}=u;return Promise.resolve(u.text()).then(function(n){if(500===i)throw o.hooks.call("fetch:error",r,{status:i,response:u,url:s}),new h(`Server error: ${s}`,{status:i,url:s});if(!n)throw new h(`Empty response: ${s}`,{status:i,url:s});const{url:c}=a.fromUrl(s),l={url:c,html:n};return!r.cache.write||e.method&&"GET"!==e.method||t!==c||o.cache.set(l.url,l),l})}t=a.fromUrl(t).url;const{visit:r=o.visit}=e,i={...o.options.requestHeaders,...e.headers},s=e.timeout??o.options.timeout,c=new AbortController,{signal:l}=c;e={...e,headers:i,signal:l};let u,d=!1,m=null;s&&s>0&&(m=setTimeout(()=>{d=!0,c.abort("timeout")},s));const f=function(n,i){try{var s=Promise.resolve(o.hooks.call("fetch:request",r,{url:t,options:e},(t,{url:e,options:n})=>fetch(e,n))).then(function(t){u=t,m&&clearTimeout(m)})}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",r,{url:t}),new h(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||l.aborted)throw new h(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(f&&f.then?f.then(n):n())}catch(p){return Promise.reject(p)}};class h 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}}class u{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=a.fromUrl(t);return this.swup.resolveUrl(e)}}const d=(t,e=document)=>e.querySelector(t),m=(t,e=document)=>Array.from(e.querySelectorAll(t)),f=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function p(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function v(t,e=[]){return new Promise((n,o)=>{const r=t(...e);p(r)?r.then(n,o):n(r)})}function g(t){t=t||document.body,t?.getBoundingClientRect()}function w(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class y{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class k{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;const{to:n,from:o,hash:r,el:i,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,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:i,event:s},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 P(t){return new k(this,t)}const b="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function S(t,e,n){if(!t.s){if(n instanceof E){if(!n.s)return void(n.o=S.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(S.bind(null,t,e),S.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const E=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{S(o,1,t(this.v))}catch(t){S(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?S(o,1,e?e(r):r):n?S(o,1,n(r)):S(o,2,r)}catch(t){S(o,2,t)}},o},t}();function C(t){return t instanceof E&&1&t.s}class U{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n={}){const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const r={...n,id:o.size+1,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n={}){return this.on(t,e,{...n,before:!0})}replace(t,e,n={}){return this.on(t,e,{...n,replace:!0})}once(t,e,n={}){return this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const r=this,[i,s,a]=r.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=r.getHandlers(t,a);return Promise.resolve(r.run(c,i,s)).then(function(){return Promise.resolve(r.run(l,i,s,!0)).then(function([e]){return Promise.resolve(r.run(h,i,s)).then(function(){return r.dispatchDomEvent(t,i,s),e})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[r,i,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,r,i);const[h]=this.runSync(c,r,i,!0);return this.runSync(l,r,i),this.dispatchDomEvent(t,r,i),h}parseCallArgs(t,e,n,o){return e instanceof k||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o=!1){try{let r;const i=this;void 0===e&&(e=i.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[b]){var o,r,i,s=t[b]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!C(a))return void a.then(t,i||(i=S.bind(null,r=new E,2)));a=a.v}r?S(r,1,a):r=a}catch(t){S(r||(r=new E),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,function(t){throw a(t)});a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,r,i=-1;return function s(a){try{for(;++i<t.length&&(!n||!n());)if((a=e(i))&&a.then){if(!C(a))return void a.then(s,r||(r=S.bind(null,o=new E,2)));a=a.v}o?S(o,1,a):o=a}catch(t){S(o||(o=new E),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function({hook:t,handler:r,defaultHandler:a,once:c}){if(!e?.done)return c&&i.off(t,r),function(t,o){try{var i=Promise.resolve(v(r,[e,n,a])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(e){if(o)throw e;console.error(`Error in hook '${t}':`,e)})},function(){return r});return Promise.resolve(a&&a.then?a.then(function(t){return r?t:s}):r?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e=this.swup.visit,n,o=!1){const r=[];for(const{hook:i,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(i,s);try{const t=s(e,n,a);r.push(t),p(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${i}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)}}return r}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),r=this.sortRegistrations,i=o.filter(({before:t,replace:e})=>t&&!e).sort(r),s=o.filter(({replace:t})=>t).filter(t=>!0).sort(r),a=o.filter(({before:t,replace:e})=>!t&&!e).sort(r),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,o=t=>{const n=s[t-1];return n?(e,r)=>n.handler(e,r,o(t-1)):e};l=[{id:0,hook:t,handler:s[n].handler,defaultHandler:o(n)}]}return{found:!0,before:i,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}}const $=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||d(`a[name='${CSS.escape(t)}']`)||d(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},x=function({selector:t,elements:e}){try{if(!1===t&&!e)return Promise.resolve();let n=[];if(e)n=Array.from(e);else if(t&&(n=m(t,document.body),!n.length))return console.warn(`[swup] No elements found matching animationSelector \`${t}\``),Promise.resolve();const o=n.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=j(e,`${A}Delay`),o=j(e,`${A}Duration`),r=V(n,o),i=j(e,`${H}Delay`),s=j(e,`${H}Duration`),a=V(i,s),c=Math.max(r,a),l=c>0?r>a?A:H:null;return{type:l,timeout:c,propCount:l?l===A?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(r=>{const i=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(i,l),r()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(i,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},A="transition",H="animation";function j(t,e){return(t[e]||"").split(", ")}function V(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>I(e)+I(t[n])))}function I(t){return 1e3*parseFloat(t)}const L=function(t,e={}){try{let s;const c=this;function o(o){if(s)return o;c.navigating=!0,c.visit=t;const{el:l}=t.trigger;e.referrer=e.referrer||c.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||c.classes.clear();const h=e.history||w(l,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||w(l,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(o,s){try{var l=function(o,s){try{var l=Promise.resolve(c.hooks.call("visit:start",t,void 0)).then(function(){function o(){if(!t.done)return Promise.resolve(c.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(c.animatePageOut(t)).then(function(){function e(){return Promise.resolve(c.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=c.renderPage;return Promise.resolve(s).then(function(n){return Promise.resolve(e.call(c,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=c.renderPage;return Promise.resolve(s).then(function(n){return Promise.resolve(e.call(c,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const o=function(){if(!t.animation.animate)return Promise.resolve(c.hooks.call("animation:skip",void 0)).then(function(){const e=c.renderPage;return Promise.resolve(s).then(function(o){return Promise.resolve(e.call(c,t,o)).then(function(){n=1})})})}();return Promise.resolve(o&&o.then?o.then(e):e(o))}catch(r){return Promise.reject(r)}})).then(function(){if(!t.done)return Promise.resolve(c.hooks.call("visit:end",t,void 0,()=>c.classes.clear())).then(function(){t.state=7,c.navigating=!1,c.onVisitEnd&&(c.onVisitEnd(),c.onVisitEnd=void 0)})})}t.state=3;const s=c.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=c.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(c.fetchPage(t.to.url,e.options)).then(n))}catch(r){return Promise.reject(r)}});s.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const l=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===c.location.url?i(l):(c.currentHistoryIndex++,r(l,{index:c.currentHistoryIndex}))),c.location=a.fromUrl(l),t.history.popstate&&c.classes.add("is-popstate"),t.animation.name&&c.classes.add(`to-${n(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(s).then(function(){})}();return h&&h.then?h.then(o):o()})}catch(t){return s(t)}return l&&l.then?l.then(void 0,s):l}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),c.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return s(!0,t)}return l&&l.then?l.then(s.bind(null,!1),s.bind(null,!0)):s(!1,l)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const l=function(){if(c.navigating)return function(){if(!(c.visit.state>=6))return Promise.resolve(c.hooks.call("visit:abort",c.visit,void 0)).then(function(){delete c.visit.to.document,c.visit.state=8});t.state=2,c.onVisitEnd=()=>c.performNavigation(t,e),s=1}()}();return Promise.resolve(l&&l.then?l.then(o):o(l))}catch(h){return Promise.reject(h)}};function T(t,e={},n={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:r}=a.fromUrl(t),i=this.createVisit({...n,to:o,hash:r});this.performNavigation(i,e)}const q=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},R=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=m('[data-swup-persist]:not([data-swup-persist=""])'),r=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=d(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),r.length===t.containers.length},N=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,r=n??t.to.hash;let i=!1;return r&&(i=this.hooks.callSync("scroll:anchor",t,{hash:r,options:e},(t,{hash:e,options:n})=>{const o=this.getAnchorElement(e);return o&&o.scrollIntoView(n),!!o})),o&&!i&&(i=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo({top:0,left:0,...e}),!0))),i},D=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(f()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},M=function(t,e){try{const r=this;if(t.done)return Promise.resolve();t.advance(6);const{url:s}=e;return r.isSameResolvedUrl(o(),s)||(i(s),r.location=a.fromUrl(s),t.to.url=r.location.url,t.to.hash=r.location.hash),Promise.resolve(r.hooks.call("content:replace",t,{page:e},(t,{})=>{if(r.classes.remove("is-leaving"),t.animation.animate&&r.classes.add("is-rendering"),!r.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(r.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&r.classes.add(`to-${n(t.animation.name)}`))})).then(function(){return Promise.resolve(r.hooks.call("content:scroll",t,void 0,()=>r.scrollToContent(t))).then(function(){return Promise.resolve(r.hooks.call("page:view",t,{url:r.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},O=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function W(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function B(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function _(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function F(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const K={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],ignoreVisit:(t,{el:e}={})=>!!e?.closest("[data-no-swup]"),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};class z{get currentPageUrl(){return this.location.url}constructor(t={}){this.version="4.7.0",this.options=void 0,this.defaults=K,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=a.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=O,this.unuse=W,this.findPlugin=B,this.log=()=>{},this.navigate=T,this.performNavigation=L,this.createVisit=P,this.delegateEvent=s,this.fetchPage=l,this.awaitAnimations=x,this.renderPage=M,this.replaceContent=R,this.animatePageIn=D,this.animatePageOut=q,this.scrollToContent=N,this.getAnchorElement=$,this.getCurrentUrl=o,this.resolveUrl=_,this.isSameResolvedUrl=F,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new u(this),this.classes=new y(this),this.hooks=new U(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;return t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e)),"swup"!==window.history.state?.source&&i(null,{index:t.currentHistoryIndex}),Promise.resolve(f()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,{el:e,event:n}={}){const{origin:o,url:r,hash:i}=a.fromUrl(t);return o!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(r+i,{el:e,event:n})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=a.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const s=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",s,{href:n}):0===t.button&&this.hooks.callSync("link:click",s,{el:e,event:t},()=>{const e=s.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(s):r?this.hooks.callSync("link:anchor",s,{hash:r},()=>{i(o+r),this.scrollToContent(s)}):this.hooks.callSync("link:self",s,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(s):(i(o),this.scrollToContent(s))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(o(),this.location.url))return;const{url:n,hash:r}=a.fromUrl(e),i=this.createVisit({to:n,hash:r,event:t});i.history.popstate=!0;const s=t.state?.index??0;s&&s!==this.currentHistoryIndex&&(i.history.direction=s-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=s),i.animation.animate=!1,i.scroll.reset=!1,i.scroll.target=!1,this.options.animateHistoryBrowsing&&(i.animation.animate=!0,i.scroll.reset=!0),this.hooks.callSync("history:popstate",i,{event:t},()=>{this.performNavigation(i)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}}export{a as Location,n as classify,r as createHistoryRecord,z as default,s as delegateEvent,g as forceReflow,w as getContextualAttr,o as getCurrentUrl,p as isPromise,c as matchPath,f as nextTick,d as query,m as queryAll,v as runAsPromise,i as updateHistoryRecord};
+import t from"delegate-it";import{match as e}from"path-to-regexp";const n=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",o=({hash:t}={})=>window.location.pathname+window.location.search+(t?window.location.hash:""),r=(t,e={})=>{const n={url:t=t||o({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)},i=(t=null,e={})=>{t=t||o({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},s=(e,n,o,r)=>{const i=new AbortController;return r={...r,signal:i.signal},t(e,n,o,r),{destroy:()=>i.abort()}};class a 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){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new a(e)}static fromUrl(t){return new a(t)}}const c=(t,n)=>{try{return e(t,n)}catch(e){throw new Error(`[swup] Error parsing path "${String(t)}":\n${String(e)}`)}},l=function(t,e={}){try{const o=this;function n(n){const{status:i,url:s}=u;return Promise.resolve(u.text()).then(function(n){if(500===i)throw o.hooks.call("fetch:error",r,{status:i,response:u,url:s}),new h(`Server error: ${s}`,{status:i,url:s});if(!n)throw new h(`Empty response: ${s}`,{status:i,url:s});const{url:c}=a.fromUrl(s),l={url:c,html:n};return!r.cache.write||e.method&&"GET"!==e.method||t!==c||o.cache.set(l.url,l),l})}t=a.fromUrl(t).url;const{visit:r=o.visit}=e,i={...o.options.requestHeaders,...e.headers},s=e.timeout??o.options.timeout,c=new AbortController,{signal:l}=c;e={...e,headers:i,signal:l};let u,d=!1,m=null;s&&s>0&&(m=setTimeout(()=>{d=!0,c.abort("timeout")},s));const f=function(n,i){try{var s=Promise.resolve(o.hooks.call("fetch:request",r,{url:t,options:e},(t,{url:e,options:n})=>fetch(e,n))).then(function(t){u=t,m&&clearTimeout(m)})}catch(t){return i(t)}return s&&s.then?s.then(void 0,i):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",r,{url:t}),new h(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||l.aborted)throw new h(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(f&&f.then?f.then(n):n())}catch(p){return Promise.reject(p)}};class h 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}}class u{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=a.fromUrl(t);return this.swup.resolveUrl(e)}}const d=(t,e=document)=>e.querySelector(t),m=(t,e=document)=>Array.from(e.querySelectorAll(t)),f=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function p(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function v(t,e=[]){return new Promise((n,o)=>{const r=t(...e);p(r)?r.then(n,o):n(r)})}function g(t){t=t||document.body,t?.getBoundingClientRect()}function w(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class y{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class k{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,this.meta=void 0;const{to:n,from:o,hash:r,el:i,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,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:i,event:s},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},this.meta={}}advance(t){this.state<t&&(this.state=t)}abort(){this.state=8}get done(){return this.state>=7}}function P(t){return new k(this,t)}const b="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function S(t,e,n){if(!t.s){if(n instanceof E){if(!n.s)return void(n.o=S.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(S.bind(null,t,e),S.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const E=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,r=this.s;if(r){const t=1&r?e:n;if(t){try{S(o,1,t(this.v))}catch(t){S(o,2,t)}return o}return this}return this.o=function(t){try{const r=t.v;1&t.s?S(o,1,e?e(r):r):n?S(o,1,n(r)):S(o,2,r)}catch(t){S(o,2,t)}},o},t}();function C(t){return t instanceof E&&1&t.s}class U{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n={}){const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const r={...n,id:o.size+1,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n={}){return this.on(t,e,{...n,before:!0})}replace(t,e,n={}){return this.on(t,e,{...n,replace:!0})}once(t,e,n={}){return this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const r=this,[i,s,a]=r.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=r.getHandlers(t,a);return Promise.resolve(r.run(c,i,s)).then(function(){return Promise.resolve(r.run(l,i,s,!0)).then(function([e]){return Promise.resolve(r.run(h,i,s)).then(function(){return r.dispatchDomEvent(t,i,s),e})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[r,i,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,r,i);const[h]=this.runSync(c,r,i,!0);return this.runSync(l,r,i),this.dispatchDomEvent(t,r,i),h}parseCallArgs(t,e,n,o){return e instanceof k||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o=!1){try{let r;const i=this;void 0===e&&(e=i.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[b]){var o,r,i,s=t[b]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!C(a))return void a.then(t,i||(i=S.bind(null,r=new E,2)));a=a.v}r?S(r,1,a):r=a}catch(t){S(r||(r=new E),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(r&&r.then)return r.then(a,function(t){throw a(t)});a()}return r}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,r,i=-1;return function s(a){try{for(;++i<t.length&&(!n||!n());)if((a=e(i))&&a.then){if(!C(a))return void a.then(s,r||(r=S.bind(null,o=new E,2)));a=a.v}o?S(o,1,a):o=a}catch(t){S(o||(o=new E),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function({hook:t,handler:r,defaultHandler:a,once:c}){if(!e?.done)return c&&i.off(t,r),function(t,o){try{var i=Promise.resolve(v(r,[e,n,a])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(e){if(o)throw e;console.error(`Error in hook '${t}':`,e)})},function(){return r});return Promise.resolve(a&&a.then?a.then(function(t){return r?t:s}):r?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e=this.swup.visit,n,o=!1){const r=[];for(const{hook:i,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(i,s);try{const t=s(e,n,a);r.push(t),p(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${i}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)}}return r}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),r=this.sortRegistrations,i=o.filter(({before:t,replace:e})=>t&&!e).sort(r),s=o.filter(({replace:t})=>t).filter(t=>!0).sort(r),a=o.filter(({before:t,replace:e})=>!t&&!e).sort(r),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,{handler:o,once:r}=s[n],i=t=>{const n=s[t-1];return n?(e,o)=>n.handler(e,o,i(t-1)):e};l=[{id:0,hook:t,once:r,handler:o,defaultHandler:i(n)}]}return{found:!0,before:i,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}parseName(t){const[e,...n]=t.split(".");return[e,n.reduce((t,e)=>({...t,[e]:!0}),{})]}}const $=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||d(`a[name='${CSS.escape(t)}']`)||d(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},x=function({selector:t,elements:e}){try{if(!1===t&&!e)return Promise.resolve();let n=[];if(e)n=Array.from(e);else if(t&&(n=m(t,document.body),!n.length))return console.warn(`[swup] No elements found matching animationSelector \`${t}\``),Promise.resolve();const o=n.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=j(e,`${A}Delay`),o=j(e,`${A}Duration`),r=V(n,o),i=j(e,`${H}Delay`),s=j(e,`${H}Duration`),a=V(i,s),c=Math.max(r,a),l=c>0?r>a?A:H:null;return{type:l,timeout:c,propCount:l?l===A?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(r=>{const i=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(i,l),r()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(i,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(t&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${t}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},A="transition",H="animation";function j(t,e){return(t[e]||"").split(", ")}function V(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>I(e)+I(t[n])))}function I(t){return 1e3*parseFloat(t)}const L=function(t,e={}){try{let s;const c=this;function o(o){if(s)return o;c.navigating=!0,c.visit=t;const{el:l}=t.trigger;e.referrer=e.referrer||c.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||c.classes.clear();const h=e.history||w(l,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||w(l,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),t.meta=e.meta||{},"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(o,s){try{var l=function(o,s){try{var l=Promise.resolve(c.hooks.call("visit:start",t,void 0)).then(function(){function o(){if(!t.done)return Promise.resolve(c.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(c.animatePageOut(t)).then(function(){function e(){return Promise.resolve(c.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=c.renderPage;return Promise.resolve(s).then(function(n){return Promise.resolve(e.call(c,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=c.renderPage;return Promise.resolve(s).then(function(n){return Promise.resolve(e.call(c,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const o=function(){if(!t.animation.animate)return Promise.resolve(c.hooks.call("animation:skip",void 0)).then(function(){const e=c.renderPage;return Promise.resolve(s).then(function(o){return Promise.resolve(e.call(c,t,o)).then(function(){n=1})})})}();return Promise.resolve(o&&o.then?o.then(e):e(o))}catch(r){return Promise.reject(r)}})).then(function(){if(!t.done)return Promise.resolve(c.hooks.call("visit:end",t,void 0,()=>c.classes.clear())).then(function(){t.state=7,c.navigating=!1,c.onVisitEnd&&(c.onVisitEnd(),c.onVisitEnd=void 0)})})}t.state=3;const s=c.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=c.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(c.fetchPage(t.to.url,e.options)).then(n))}catch(r){return Promise.reject(r)}});s.then(({html:e})=>{t.advance(5),t.to.html=e,t.to.document=(new DOMParser).parseFromString(e,"text/html")});const l=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===c.location.url?i(l):(c.currentHistoryIndex++,r(l,{index:c.currentHistoryIndex}))),c.location=a.fromUrl(l),t.history.popstate&&c.classes.add("is-popstate"),t.animation.name&&c.classes.add(`to-${n(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(s).then(function(){})}();return h&&h.then?h.then(o):o()})}catch(t){return s(t)}return l&&l.then?l.then(void 0,s):l}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),c.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return s(!0,t)}return l&&l.then?l.then(s.bind(null,!1),s.bind(null,!0)):s(!1,l)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const l=function(){if(c.navigating)return function(){if(!(c.visit.state>=6))return Promise.resolve(c.hooks.call("visit:abort",c.visit,void 0)).then(function(){delete c.visit.to.document,c.visit.state=8});t.state=2,c.onVisitEnd=()=>c.performNavigation(t,e),s=1}()}();return Promise.resolve(l&&l.then?l.then(o):o(l))}catch(h){return Promise.reject(h)}};function T(t,e={},n={}){if("string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:r}=a.fromUrl(t),i=this.createVisit({...n,to:o,hash:r});this.performNavigation(i,e)}const q=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},R=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=m('[data-swup-persist]:not([data-swup-persist=""])'),r=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=d(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),r.length===t.containers.length},N=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,r=n??t.to.hash;let i=!1;return r&&(i=this.hooks.callSync("scroll:anchor",t,{hash:r,options:e},(t,{hash:e,options:n})=>{const o=this.getAnchorElement(e);return o&&o.scrollIntoView(n),!!o})),o&&!i&&(i=this.hooks.callSync("scroll:top",t,{options:e},(t,{options:e})=>(window.scrollTo({top:0,left:0,...e}),!0))),i},D=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,{skip:n})=>{if(!n)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(f()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},O=function(t,e){try{const r=this;if(t.done)return Promise.resolve();t.advance(6);const{url:s}=e;return r.isSameResolvedUrl(o(),s)||(i(s),r.location=a.fromUrl(s),t.to.url=r.location.url,t.to.hash=r.location.hash),Promise.resolve(r.hooks.call("content:replace",t,{page:e},(t,{})=>{if(r.classes.remove("is-leaving"),t.animation.animate&&r.classes.add("is-rendering"),!r.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(r.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&r.classes.add(`to-${n(t.animation.name)}`))})).then(function(){return Promise.resolve(r.hooks.call("content:scroll",t,void 0,()=>r.scrollToContent(t))).then(function(){return Promise.resolve(r.hooks.call("page:view",t,{url:r.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},M=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function W(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function B(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function _(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function F(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const K={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:(t,{el:e}={})=>!!e?.closest("[data-no-swup]"),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};class z{get currentPageUrl(){return this.location.url}constructor(t={}){this.version="4.8.1",this.options=void 0,this.defaults=K,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=a.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=M,this.unuse=W,this.findPlugin=B,this.log=()=>{},this.navigate=T,this.performNavigation=L,this.createVisit=P,this.delegateEvent=s,this.fetchPage=l,this.awaitAnimations=x,this.renderPage=O,this.replaceContent=R,this.animatePageIn=D,this.animatePageOut=q,this.scrollToContent=N,this.getAnchorElement=$,this.getCurrentUrl=o,this.resolveUrl=_,this.isSameResolvedUrl=F,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new u(this),this.classes=new y(this),this.hooks=new U(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e));for(const[e,n]of Object.entries(t.options.hooks)){const[o,r]=t.hooks.parseName(e);t.hooks.on(o,n,r)}return"swup"!==window.history.state?.source&&i(null,{index:t.currentHistoryIndex}),Promise.resolve(f()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,{el:e,event:n}={}){const{origin:o,url:r,hash:i}=a.fromUrl(t);return o!==window.location.origin||!(!e||!this.triggerWillOpenNewWindow(e))||!!this.options.ignoreVisit(r+i,{el:e,event:n})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=a.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const s=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",s,{href:n}):0===t.button&&this.hooks.callSync("link:click",s,{el:e,event:t},()=>{const e=s.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(s):r?this.hooks.callSync("link:anchor",s,{hash:r},()=>{i(o+r),this.scrollToContent(s)}):this.hooks.callSync("link:self",s,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(s):(i(o),this.scrollToContent(s))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(o(),this.location.url))return;const{url:n,hash:r}=a.fromUrl(e),i=this.createVisit({to:n,hash:r,event:t});i.history.popstate=!0;const s=t.state?.index??0;s&&s!==this.currentHistoryIndex&&(i.history.direction=s-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=s),i.animation.animate=!1,i.scroll.reset=!1,i.scroll.target=!1,this.options.animateHistoryBrowsing&&(i.animation.animate=!0,i.scroll.reset=!0),this.hooks.callSync("history:popstate",i,{event:t},()=>{this.performNavigation(i)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}}export{a as Location,n as classify,r as createHistoryRecord,z as default,s as delegateEvent,g as forceReflow,w as getContextualAttr,o as getCurrentUrl,p as isPromise,c as matchPath,f as nextTick,d as query,m as queryAll,v as runAsPromise,i as updateHistoryRecord};
//# sourceMappingURL=Swup.module.js.map
diff --git a/node_modules/swup/dist/Swup.module.js.map b/node_modules/swup/dist/Swup.module.js.map
index 7d983961..e77de9a3 100644
--- a/node_modules/swup/dist/Swup.module.js.map
+++ b/node_modules/swup/dist/Swup.module.js.map
@@ -1 +1 @@
-{"version":3,"file":"Swup.module.js","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/helpers/matchPath.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t}\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst replacingHandler = replace[index].handler;\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [\n\t\t\t\t\t{ id: 0, hook, handler: replacingHandler, defaultHandler: nestedDefaultHandler }\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","random","Math","source","history","pushState","updateHistoryRecord","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","matchPath","path","match","error","Error","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","call","visit","FetchError","finalUrl","page","cache","write","method","set","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_temp","fetch","_this$hooks$call","clearTimeout","_catch","name","aborted","e","reject","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","has","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","runAsPromise","func","args","forceReflow","element","body","getBoundingClientRect","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_result2","found","replaced","sort","sortRegistrations","T","index","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","getAnchorElement","charAt","substring","decoded","decodeURIComponent","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","skipPopStateHandling","assign","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","Swup","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches"],"mappings":"kEACa,MAAAA,EAAWA,CAACC,EAAcC,IACvBC,OAAOF,GACpBG,cAGAC,QAAQ,YAAa,KACrBA,QAAQ,WAAY,IACpBA,QAAQ,OAAQ,KAChBA,QAAQ,WAAY,KACLH,GAAY,GCTjBI,EAAgBA,EAAGC,QAA6B,CAAE,IACvDC,OAAOC,SAASC,SAAWF,OAAOC,SAASE,QAAUJ,EAAOC,OAAOC,SAASF,KAAO,ICW9EK,EAAsBA,CAACC,EAAaC,EAAoB,CAAA,KAEpE,MAAMC,EAAsB,CAC3BF,IAFDA,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IAGlCS,OAAQC,KAAKD,SACbE,OAAQ,UACLJ,GAEJN,OAAOW,QAAQC,UAAUL,EAAO,GAAIF,EACrC,EAGaQ,EAAsBA,CAACR,EAAqB,KAAMC,EAAoB,CAAA,KAClFD,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IACnC,MACMQ,EAAsB,IADNP,OAAOW,Q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Q,kBAAkBzO,IAEvBhD,EAAoBR,GACpB+B,KAAKsT,gBAAgB7R,GACtB,EAYyB,EAE9B,CAEUoU,cAAAA,CAAenO,GACxB,MAAMtH,EAAgBsH,EAAMvJ,OAAwBF,KAAOL,OAAOC,SAASuC,KAG3E,GAAIJ,KAAKjB,QAAQkT,qBAAqBvK,GACrC,OAID,GAAI1H,KAAK+T,kBAAkBrW,IAAiBsC,KAAKnC,SAASI,KACzD,OAGD,MAAMA,IAAEA,EAAGN,KAAEA,GAAS2B,EAASgB,QAAQF,GAEjCqB,EAAQzB,KAAKuI,YAAY,CAAEhB,GAAItJ,EAAKN,OAAM+J,UAGhDjG,EAAMlD,QAAQ2J,UAAW,EAGzB,MAAMwE,EAAShF,EAAMvJ,OAAwBuO,OAAS,EAClDA,GAASA,IAAU1M,KAAKgS,sBAE3BvQ,EAAMlD,QAAQ4J,UADIuE,EAAQ1M,KAAKgS,oBAAsB,EAAI,WAAa,YAEtEhS,KAAKgS,oBAAsBtF,GAI5BjL,EAAM0E,UAAUwB,SAAU,EAC1BlG,EAAMgG,OAAOW,OAAQ,EACrB3G,EAAMgG,OAAO7B,QAAS,EAGlB5F,KAAKjB,QAAQmW,yBAChBzT,EAAM0E,UAAUwB,SAAU,EAC1BlG,EAAMgG,OAAOW,OAAQ,GAGtBpI,KAAKuB,MAAMuC,SAAS,mBAAoBrC,EAAO,CAAEiG,SAAS,KACzD1H,KAAKkQ,kBAAkBzO,IAEzB,CAGU0U,wBAAAA,CAAyBQ,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
+{"version":3,"file":"Swup.module.js","sources":["../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/helpers/matchPath.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import { match } from 'path-to-regexp';\n\nimport type {\n\tPath,\n\tParseOptions,\n\tTokensToRegexpOptions,\n\tRegexpToFunctionOptions,\n\tMatchFunction\n} from 'path-to-regexp';\n\nexport { type Path };\n\n/** Create a match function from a path pattern that checks if a URLs matches it. */\nexport const matchPath = <P extends object = object>(\n\tpath: Path,\n\toptions?: ParseOptions & TokensToRegexpOptions & RegexpToFunctionOptions\n): MatchFunction<P> => {\n\ttry {\n\t\treturn match<P>(path, options);\n\t} catch (error) {\n\t\tthrow new Error(`[swup] Error parsing path \"${String(path)}\":\\n${String(error)}`);\n\t}\n};\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\t/** User-defined metadata */\n\tmeta: Record<string, unknown>;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t\tthis.meta = {};\n\t}\n\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\nexport type HookNameWithModifier = `${HookName}.${HookModifier}`;\n\ntype HookModifier = 'once' | 'before' | 'replace';\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\nexport type HookInitOptions = {\n\t[K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;\n} & {\n\t[K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst { handler: replacingHandler, once } = replace[index];\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [{ id: 0, hook, once, handler: replacingHandler, defaultHandler: nestedDefaultHandler }]; // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n\n\t/**\n\t * Parse a hook name into the name and any modifiers.\n\t * @param hook Name of the hook.\n\t */\n\tparseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>] {\n\t\tconst [name, ...modifiers] = hook.split('.');\n\t\tconst options = modifiers.reduce((acc, mod) => ({ ...acc, [mod]: true }), {});\n\t\treturn [name as HookName, options];\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n\t/** Custom metadata associated with this visit. */\n\tmeta?: Record<string, unknown>;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Get custom metadata from option\n\tvisit.meta = options.meta || {};\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks, type HookName, type HookInitOptions } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Hook handlers to register. */\n\thooks: Partial<HookInitOptions>;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\thooks: {},\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Install user hooks\n\t\tfor (const [key, handler] of Object.entries(this.options.hooks)) {\n\t\t\t// Build hook options from modifier suffix: 'content:replace.before' => { before: true }\n\t\t\tconst [hook, modifiers] = this.hooks.parseName(key as HookName);\n\t\t\t// @ts-expect-error: object.entries() does not preserve key/value types\n\t\t\tthis.hooks.on(hook, handler, modifiers);\n\t\t}\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","hash","window","location","pathname","search","createHistoryRecord","url","data","state","random","Math","source","history","pushState","updateHistoryRecord","replaceState","delegateEvent","selector","type","callback","options","controller","AbortController","signal","delegate","destroy","abort","Location","URL","constructor","base","document","baseURI","super","toString","Object","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","matchPath","path","match","error","Error","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","call","visit","FetchError","finalUrl","page","cache","write","method","set","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_temp","fetch","_this$hooks$call","clearTimeout","_catch","name","aborted","e","reject","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","has","get","result","callSync","undefined","update","payload","delete","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","runAsPromise","func","args","forceReflow","element","body","getBoundingClientRect","getContextualAttr","attr","target","closest","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","add","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","meta","event","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","ledger","console","on","handler","warn","registration","off","before","once","arg1","arg2","arg3","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_result2","found","replaced","sort","sortRegistrations","T","index","replacingHandler","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","parseName","modifiers","reduce","acc","mod","getAnchorElement","charAt","substring","decoded","decodeURIComponent","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","removeEventListener","onEnd","elapsedTime","addEventListener","awaitAnimationsOnElement","Boolean","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","skipPopStateHandling","assign","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","Swup","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","entries","documentElement","toggle","origin","triggerWillOpenNewWindow","delegateTarget","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches"],"mappings":"kEACa,MAAAA,EAAWA,CAACC,EAAcC,IACvBC,OAAOF,GACpBG,cAGAC,QAAQ,YAAa,KACrBA,QAAQ,WAAY,IACpBA,QAAQ,OAAQ,KAChBA,QAAQ,WAAY,KACLH,GAAY,GCTjBI,EAAgBA,EAAGC,QAA6B,CAAE,IACvDC,OAAOC,SAASC,SAAWF,OAAOC,SAASE,QAAUJ,EAAOC,OAAOC,SAASF,KAAO,ICW9EK,EAAsBA,CAACC,EAAaC,EAAoB,CAAA,KAEpE,MAAMC,EAAsB,CAC3BF,IAFDA,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IAGlCS,OAAQC,KAAKD,SACbE,OAAQ,UACLJ,GAEJN,OAAOW,QAAQC,UAAUL,EAAO,GAAIF,EACrC,EAGaQ,EAAsBA,CAACR,EAAqB,KAAMC,EAAoB,CAAA,KAClFD,EAAMA,GAAOP,EAAc,CAAEC,MAAM,IACnC,MACMQ,EAAsB,IADNP,OAAOW,QAAQJ,OAA0B,CAAE,EAGhEF,MACAG,OAAQC,KAAKD,SACbE,OAAQ,UACLJ,GAEJN,OAAOW,QAAQG,aAAaP,EAAO,GAAIF,EACxC,ECxBaU,EAAgBA,CAK5BC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAAa,IAAIC,gBAGvB,OAFAF,EAAU,IAAKA,EAASG,OAAQF,EAAWE,QAC3CC,EAAqCP,EAAUC,EAAMC,EAAUC,GACxD,CAAEK,QAASA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AClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
diff --git a/node_modules/swup/dist/Swup.umd.js b/node_modules/swup/dist/Swup.umd.js
index 53741f33..3edd3095 100644
--- a/node_modules/swup/dist/Swup.umd.js
+++ b/node_modules/swup/dist/Swup.umd.js
@@ -1,2 +1,2 @@
-!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).Swup=e()}(this,function(){const t=new WeakMap;function e(e,n,o,i){if(!e&&!t.has(n))return!1;const r=t.get(n)??new WeakMap;t.set(n,r);const s=r.get(o)??new Set;r.set(o,s);const a=s.has(i);return e?s.add(i):s.delete(i),a&&e}const n=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",o=function(t){let{hash:e}=void 0===t?{}:t;return window.location.pathname+window.location.search+(e?window.location.hash:"")},i=function(t,e){void 0===t&&(t=null),void 0===e&&(e={}),t=t||o({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},r=(t,n,o,i)=>{const r=new AbortController;return function(t,n,o,i={}){const{signal:r,base:s=document}=i;if(r?.aborted)return;const{once:a,...c}=i,l=s instanceof Document?s.documentElement:s,h=Boolean("object"==typeof i?i.capture:i),u=i=>{const r=function(t,e){let n=t.target;if(n instanceof Text&&(n=n.parentElement),n instanceof Element&&t.currentTarget instanceof Element){const o=n.closest(e);if(o&&t.currentTarget.contains(o))return o}}(i,t);if(r){const t=Object.assign(i,{delegateTarget:r});o.call(l,t),a&&(l.removeEventListener(n,u,c),e(!1,l,o,d))}},d=JSON.stringify({selector:t,type:n,capture:h});e(!0,l,o,d)||l.addEventListener(n,u,c),r?.addEventListener("abort",()=>{e(!1,l,o,d)})}(t,n,o,i={...i,signal:r.signal}),{destroy:()=>r.abort()}};class s extends URL{constructor(t,e){void 0===e&&(e=document.baseURI),super(t.toString(),e),Object.setPrototypeOf(this,s.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new s(e)}static fromUrl(t){return new s(t)}}const a=function(t,e){void 0===e&&(e={});try{const o=this;function n(n){const{status:r,url:a}=u;return Promise.resolve(u.text()).then(function(n){if(500===r)throw o.hooks.call("fetch:error",i,{status:r,response:u,url:a}),new c(`Server error: ${a}`,{status:r,url:a});if(!n)throw new c(`Empty response: ${a}`,{status:r,url:a});const{url:l}=s.fromUrl(a),h={url:l,html:n};return!i.cache.write||e.method&&"GET"!==e.method||t!==l||o.cache.set(h.url,h),h})}t=s.fromUrl(t).url;const{visit:i=o.visit}=e,r={...o.options.requestHeaders,...e.headers},a=e.timeout??o.options.timeout,l=new AbortController,{signal:h}=l;e={...e,headers:r,signal:h};let u,d=!1,f=null;a&&a>0&&(f=setTimeout(()=>{d=!0,l.abort("timeout")},a));const m=function(n,r){try{var s=Promise.resolve(o.hooks.call("fetch:request",i,{url:t,options:e},(t,e)=>{let{url:n,options:o}=e;return fetch(n,o)})).then(function(t){u=t,f&&clearTimeout(f)})}catch(t){return r(t)}return s&&s.then?s.then(void 0,r):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",i,{url:t}),new c(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||h.aborted)throw new c(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(m&&m.then?m.then(n):n())}catch(p){return Promise.reject(p)}};class c 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}}class l{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=s.fromUrl(t);return this.swup.resolveUrl(e)}}const h=function(t,e){return void 0===e&&(e=document),e.querySelector(t)},u=function(t,e){return void 0===e&&(e=document),Array.from(e.querySelectorAll(t))},d=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function f(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function m(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class p{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?u(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class v{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;const{to:n,from:o,hash:i,el:r,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,hash:i},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:r,event:s},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 g(t){return new v(this,t)}const w="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function y(t,e,n){if(!t.s){if(n instanceof k){if(!n.s)return void(n.o=y.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(y.bind(null,t,e),y.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const k=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,i=this.s;if(i){const t=1&i?e:n;if(t){try{y(o,1,t(this.v))}catch(t){y(o,2,t)}return o}return this}return this.o=function(t){try{const i=t.v;1&t.s?y(o,1,e?e(i):i):n?y(o,1,n(i)):y(o,2,i)}catch(t){y(o,2,t)}},o},t}();function P(t){return t instanceof k&&1&t.s}class b{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n){void 0===n&&(n={});const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const i=o.size+1,r={...n,id:i,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,before:!0})}replace(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,replace:!0})}once(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const i=this,[r,s,a]=i.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=i.getHandlers(t,a);return Promise.resolve(i.run(c,r,s)).then(function(){return Promise.resolve(i.run(l,r,s,!0)).then(function(e){let[n]=e;return Promise.resolve(i.run(h,r,s)).then(function(){return i.dispatchDomEvent(t,r,s),n})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[i,r,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,i,r);const[h]=this.runSync(c,i,r,!0);return this.runSync(l,i,r),this.dispatchDomEvent(t,i,r),h}parseCallArgs(t,e,n,o){return e instanceof v||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o){void 0===o&&(o=!1);try{let i;const r=this;void 0===e&&(e=r.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[w]){var o,i,r,s=t[w]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!P(a))return void a.then(t,r||(r=y.bind(null,i=new k,2)));a=a.v}i?y(i,1,a):i=a}catch(t){y(i||(i=new k),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(i&&i.then)return i.then(a,function(t){throw a(t)});a()}return i}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,i,r=-1;return function s(a){try{for(;++r<t.length&&(!n||!n());)if((a=e(r))&&a.then){if(!P(a))return void a.then(s,i||(i=y.bind(null,o=new k,2)));a=a.v}o?y(o,1,a):o=a}catch(t){y(o||(o=new k),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function(t){let{hook:i,handler:a,defaultHandler:c,once:l}=t;if(!e?.done)return l&&r.off(i,a),function(t,o){try{var i=Promise.resolve(function(t,e){return void 0===e&&(e=[]),new Promise((n,o)=>{const i=t(...e);f(i)?i.then(n,o):n(i)})}(a,[e,n,c])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)})},function(){return i});return Promise.resolve(a&&a.then?a.then(function(t){return i?t:s}):i?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e,n,o){void 0===e&&(e=this.swup.visit),void 0===o&&(o=!1);const i=[];for(const{hook:r,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(r,s);try{const t=s(e,n,a);i.push(t),f(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${r}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${r}':`,t)}}return i}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),i=this.sortRegistrations,r=o.filter(t=>{let{before:e,replace:n}=t;return e&&!n}).sort(i),s=o.filter(t=>{let{replace:e}=t;return e}).filter(t=>!0).sort(i),a=o.filter(t=>{let{before:e,replace:n}=t;return!e&&!n}).sort(i),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,o=t=>{const n=s[t-1];return n?(e,i)=>n.handler(e,i,o(t-1)):e};l=[{id:0,hook:t,handler:s[n].handler,defaultHandler:o(n)}]}return{found:!0,before:r,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}}const S=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||h(`a[name='${CSS.escape(t)}']`)||h(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},E=function(t){let{selector:e,elements:n}=t;try{if(!1===e&&!n)return Promise.resolve();let t=[];if(n)t=Array.from(n);else if(e&&(t=u(e,document.body),!t.length))return console.warn(`[swup] No elements found matching animationSelector \`${e}\``),Promise.resolve();const o=t.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=x(e,`${C}Delay`),o=x(e,`${C}Duration`),i=$(n,o),r=x(e,`${U}Delay`),s=x(e,`${U}Duration`),a=$(r,s),c=Math.max(i,a),l=c>0?i>a?C:U:null;return{type:l,timeout:c,propCount:l?l===C?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(i=>{const r=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(r,l),i()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(r,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(e&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${e}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},C="transition",U="animation";function x(t,e){return(t[e]||"").split(", ")}function $(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>A(e)+A(t[n])))}function A(t){return 1e3*parseFloat(t)}const H=function(t,e){void 0===e&&(e={});try{let a;const c=this;function r(r){if(a)return r;c.navigating=!0,c.visit=t;const{el:l}=t.trigger;e.referrer=e.referrer||c.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||c.classes.clear();const h=e.history||m(l,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||m(l,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(r,a){try{var l=function(r,a){try{var l=Promise.resolve(c.hooks.call("visit:start",t,void 0)).then(function(){function r(){if(!t.done)return Promise.resolve(c.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(c.animatePageOut(t)).then(function(){function e(){return Promise.resolve(c.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=c.renderPage;return Promise.resolve(a).then(function(n){return Promise.resolve(e.call(c,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=c.renderPage;return Promise.resolve(a).then(function(n){return Promise.resolve(e.call(c,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const o=function(){if(!t.animation.animate)return Promise.resolve(c.hooks.call("animation:skip",void 0)).then(function(){const e=c.renderPage;return Promise.resolve(a).then(function(o){return Promise.resolve(e.call(c,t,o)).then(function(){n=1})})})}();return Promise.resolve(o&&o.then?o.then(e):e(o))}catch(i){return Promise.reject(i)}})).then(function(){if(!t.done)return Promise.resolve(c.hooks.call("visit:end",t,void 0,()=>c.classes.clear())).then(function(){t.state=7,c.navigating=!1,c.onVisitEnd&&(c.onVisitEnd(),c.onVisitEnd=void 0)})})}t.state=3;const a=c.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=c.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(c.fetchPage(t.to.url,e.options)).then(n))}catch(i){return Promise.reject(i)}});a.then(e=>{let{html:n}=e;t.advance(5),t.to.html=n,t.to.document=(new DOMParser).parseFromString(n,"text/html")});const l=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===c.location.url?i(l):(c.currentHistoryIndex++,function(t,e){void 0===e&&(e={});const n={url:t=t||o({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)}(l,{index:c.currentHistoryIndex}))),c.location=s.fromUrl(l),t.history.popstate&&c.classes.add("is-popstate"),t.animation.name&&c.classes.add(`to-${n(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(a).then(function(){})}();return h&&h.then?h.then(r):r()})}catch(t){return a(t)}return l&&l.then?l.then(void 0,a):l}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),c.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return a(!0,t)}return l&&l.then?l.then(a.bind(null,!1),a.bind(null,!0)):a(!1,l)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const l=function(){if(c.navigating)return function(){if(!(c.visit.state>=6))return Promise.resolve(c.hooks.call("visit:abort",c.visit,void 0)).then(function(){delete c.visit.to.document,c.visit.state=8});t.state=2,c.onVisitEnd=()=>c.performNavigation(t,e),a=1}()}();return Promise.resolve(l&&l.then?l.then(r):r(l))}catch(h){return Promise.reject(h)}};function T(t,e,n){if(void 0===e&&(e={}),void 0===n&&(n={}),"string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:i}=s.fromUrl(t),r=this.createVisit({...n,to:o,hash:i});this.performNavigation(r,e)}const j=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,n)=>{let{skip:o}=n;if(!o)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},L=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=u('[data-swup-persist]:not([data-swup-persist=""])'),i=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=h(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),i.length===t.containers.length},V=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,i=n??t.to.hash;let r=!1;return i&&(r=this.hooks.callSync("scroll:anchor",t,{hash:i,options:e},(t,e)=>{let{hash:n,options:o}=e;const i=this.getAnchorElement(n);return i&&i.scrollIntoView(o),!!i})),o&&!r&&(r=this.hooks.callSync("scroll:top",t,{options:e},(t,e)=>{let{options:n}=e;return window.scrollTo({top:0,left:0,...n}),!0})),r},I=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,n)=>{let{skip:o}=n;if(!o)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(d()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},q=function(t,e){try{const r=this;if(t.done)return Promise.resolve();t.advance(6);const{url:a}=e;return r.isSameResolvedUrl(o(),a)||(i(a),r.location=s.fromUrl(a),t.to.url=r.location.url,t.to.hash=r.location.hash),Promise.resolve(r.hooks.call("content:replace",t,{page:e},(t,e)=>{if(r.classes.remove("is-leaving"),t.animation.animate&&r.classes.add("is-rendering"),!r.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(r.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&r.classes.add(`to-${n(t.animation.name)}`))})).then(function(){return Promise.resolve(r.hooks.call("content:scroll",t,void 0,()=>r.scrollToContent(t))).then(function(){return Promise.resolve(r.hooks.call("page:view",t,{url:r.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},R=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function N(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function D(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function M(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function O(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const W={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],ignoreVisit:function(t,e){let{el:n}=void 0===e?{}:e;return!!n?.closest("[data-no-swup]")},linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};return class{get currentPageUrl(){return this.location.url}constructor(t){void 0===t&&(t={}),this.version="4.7.0",this.options=void 0,this.defaults=W,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=s.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=R,this.unuse=N,this.findPlugin=D,this.log=()=>{},this.navigate=T,this.performNavigation=H,this.createVisit=g,this.delegateEvent=r,this.fetchPage=a,this.awaitAnimations=E,this.renderPage=q,this.replaceContent=L,this.animatePageIn=I,this.animatePageOut=j,this.scrollToContent=V,this.getAnchorElement=S,this.getCurrentUrl=o,this.resolveUrl=M,this.isSameResolvedUrl=O,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new l(this),this.classes=new p(this),this.hooks=new b(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;return t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e)),"swup"!==window.history.state?.source&&i(null,{index:t.currentHistoryIndex}),Promise.resolve(d()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,e){let{el:n,event:o}=void 0===e?{}:e;const{origin:i,url:r,hash:a}=s.fromUrl(t);return i!==window.location.origin||!(!n||!this.triggerWillOpenNewWindow(n))||!!this.options.ignoreVisit(r+a,{el:n,event:o})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=s.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const a=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",a,{href:n}):0===t.button&&this.hooks.callSync("link:click",a,{el:e,event:t},()=>{const e=a.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(a):r?this.hooks.callSync("link:anchor",a,{hash:r},()=>{i(o+r),this.scrollToContent(a)}):this.hooks.callSync("link:self",a,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(a):(i(o),this.scrollToContent(a))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(o(),this.location.url))return;const{url:n,hash:i}=s.fromUrl(e),r=this.createVisit({to:n,hash:i,event:t});r.history.popstate=!0;const a=t.state?.index??0;a&&a!==this.currentHistoryIndex&&(r.history.direction=a-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=a),r.animation.animate=!1,r.scroll.reset=!1,r.scroll.target=!1,this.options.animateHistoryBrowsing&&(r.animation.animate=!0,r.scroll.reset=!0),this.hooks.callSync("history:popstate",r,{event:t},()=>{this.performNavigation(r)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}}});
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).Swup=e()}(this,function(){const t=new WeakMap;function e(e,n,o,i){if(!e&&!t.has(n))return!1;const r=t.get(n)??new WeakMap;t.set(n,r);const s=r.get(o)??new Set;r.set(o,s);const a=s.has(i);return e?s.add(i):s.delete(i),a&&e}const n=(t,e)=>String(t).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||e||"",o=function(t){let{hash:e}=void 0===t?{}:t;return window.location.pathname+window.location.search+(e?window.location.hash:"")},i=function(t,e){void 0===t&&(t=null),void 0===e&&(e={}),t=t||o({hash:!0});const n={...window.history.state||{},url:t,random:Math.random(),source:"swup",...e};window.history.replaceState(n,"",t)},r=(t,n,o,i)=>{const r=new AbortController;return function(t,n,o,i={}){const{signal:r,base:s=document}=i;if(r?.aborted)return;const{once:a,...c}=i,l=s instanceof Document?s.documentElement:s,h=Boolean("object"==typeof i?i.capture:i),u=i=>{const r=function(t,e){let n=t.target;if(n instanceof Text&&(n=n.parentElement),n instanceof Element&&t.currentTarget instanceof Element){const o=n.closest(e);if(o&&t.currentTarget.contains(o))return o}}(i,String(t));if(r){const t=Object.assign(i,{delegateTarget:r});o.call(l,t),a&&(l.removeEventListener(n,u,c),e(!1,l,o,d))}},d=JSON.stringify({selector:t,type:n,capture:h});e(!0,l,o,d)||l.addEventListener(n,u,c),r?.addEventListener("abort",()=>{e(!1,l,o,d)})}(t,n,o,i={...i,signal:r.signal}),{destroy:()=>r.abort()}};class s extends URL{constructor(t,e){void 0===e&&(e=document.baseURI),super(t.toString(),e),Object.setPrototypeOf(this,s.prototype)}get url(){return this.pathname+this.search}static fromElement(t){const e=t.getAttribute("href")||t.getAttribute("xlink:href")||"";return new s(e)}static fromUrl(t){return new s(t)}}const a=function(t,e){void 0===e&&(e={});try{const o=this;function n(n){const{status:r,url:a}=u;return Promise.resolve(u.text()).then(function(n){if(500===r)throw o.hooks.call("fetch:error",i,{status:r,response:u,url:a}),new c(`Server error: ${a}`,{status:r,url:a});if(!n)throw new c(`Empty response: ${a}`,{status:r,url:a});const{url:l}=s.fromUrl(a),h={url:l,html:n};return!i.cache.write||e.method&&"GET"!==e.method||t!==l||o.cache.set(h.url,h),h})}t=s.fromUrl(t).url;const{visit:i=o.visit}=e,r={...o.options.requestHeaders,...e.headers},a=e.timeout??o.options.timeout,l=new AbortController,{signal:h}=l;e={...e,headers:r,signal:h};let u,d=!1,f=null;a&&a>0&&(f=setTimeout(()=>{d=!0,l.abort("timeout")},a));const m=function(n,r){try{var s=Promise.resolve(o.hooks.call("fetch:request",i,{url:t,options:e},(t,e)=>{let{url:n,options:o}=e;return fetch(n,o)})).then(function(t){u=t,f&&clearTimeout(f)})}catch(t){return r(t)}return s&&s.then?s.then(void 0,r):s}(0,function(e){if(d)throw o.hooks.call("fetch:timeout",i,{url:t}),new c(`Request timed out: ${t}`,{url:t,timedOut:d});if("AbortError"===e?.name||h.aborted)throw new c(`Request aborted: ${t}`,{url:t,aborted:!0});throw e});return Promise.resolve(m&&m.then?m.then(n):n())}catch(p){return Promise.reject(p)}};class c 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}}class l{constructor(t){this.swup=void 0,this.pages=new Map,this.swup=t}get size(){return this.pages.size}get all(){const t=new Map;return this.pages.forEach((e,n)=>{t.set(n,{...e})}),t}has(t){return this.pages.has(this.resolve(t))}get(t){const e=this.pages.get(this.resolve(t));return e?{...e}:e}set(t,e){t=this.resolve(t),e={...e,url:t},this.pages.set(t,e),this.swup.hooks.callSync("cache:set",void 0,{page:e})}update(t,e){t=this.resolve(t);const n={...this.get(t),...e,url:t};this.pages.set(t,n)}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,n)=>{t(n,e)&&this.delete(n)})}resolve(t){const{url:e}=s.fromUrl(t);return this.swup.resolveUrl(e)}}const h=function(t,e){return void 0===e&&(e=document),e.querySelector(t)},u=function(t,e){return void 0===e&&(e=document),Array.from(e.querySelectorAll(t))},d=()=>new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})});function f(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}function m(t,e){const n=t?.closest(`[${e}]`);return n?.hasAttribute(e)?n?.getAttribute(e)||!0:void 0}class p{constructor(t){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=t}get selectors(){const{scope:t}=this.swup.visit.animation;return"containers"===t?this.swup.visit.containers:"html"===t?["html"]:Array.isArray(t)?t:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?u(this.selector):[]}add(){this.targets.forEach(t=>t.classList.add(...[].slice.call(arguments)))}remove(){this.targets.forEach(t=>t.classList.remove(...[].slice.call(arguments)))}clear(){this.targets.forEach(t=>{const e=t.className.split(" ").filter(t=>this.isSwupClass(t));t.classList.remove(...e)})}isSwupClass(t){return this.swupClasses.some(e=>t.startsWith(e))}}class v{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,this.meta=void 0;const{to:n,from:o,hash:i,el:r,event:s}=e;this.id=Math.random(),this.state=1,this.from={url:o??t.location.url,hash:t.location.hash},this.to={url:n,hash:i},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:r,event:s},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},this.meta={}}advance(t){this.state<t&&(this.state=t)}abort(){this.state=8}get done(){return this.state>=7}}function g(t){return new v(this,t)}const w="undefined"!=typeof Symbol?Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")):"@@iterator";function y(t,e,n){if(!t.s){if(n instanceof k){if(!n.s)return void(n.o=y.bind(null,t,e));1&e&&(e=n.s),n=n.v}if(n&&n.then)return void n.then(y.bind(null,t,e),y.bind(null,t,2));t.s=e,t.v=n;const o=t.o;o&&o(t)}}const k=/*#__PURE__*/function(){function t(){}return t.prototype.then=function(e,n){const o=new t,i=this.s;if(i){const t=1&i?e:n;if(t){try{y(o,1,t(this.v))}catch(t){y(o,2,t)}return o}return this}return this.o=function(t){try{const i=t.v;1&t.s?y(o,1,e?e(i):i):n?y(o,1,n(i)):y(o,2,i)}catch(t){y(o,2,t)}},o},t}();function P(t){return t instanceof k&&1&t.s}class b{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){const e=this.registry.get(t);if(e)return e;console.error(`Unknown hook '${t}'`)}clear(){this.registry.forEach(t=>t.clear())}on(t,e,n){void 0===n&&(n={});const o=this.get(t);if(!o)return console.warn(`Hook '${t}' not found.`),()=>{};const i=o.size+1,r={...n,id:i,hook:t,handler:e};return o.set(e,r),()=>this.off(t,e)}before(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,before:!0})}replace(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,replace:!0})}once(t,e,n){return void 0===n&&(n={}),this.on(t,e,{...n,once:!0})}off(t,e){const n=this.get(t);n&&e?n.delete(e)||console.warn(`Handler for hook '${t}' not found.`):n&&n.clear()}call(t,e,n,o){try{const i=this,[r,s,a]=i.parseCallArgs(t,e,n,o),{before:c,handler:l,after:h}=i.getHandlers(t,a);return Promise.resolve(i.run(c,r,s)).then(function(){return Promise.resolve(i.run(l,r,s,!0)).then(function(e){let[n]=e;return Promise.resolve(i.run(h,r,s)).then(function(){return i.dispatchDomEvent(t,r,s),n})})})}catch(t){return Promise.reject(t)}}callSync(t,e,n,o){const[i,r,s]=this.parseCallArgs(t,e,n,o),{before:a,handler:c,after:l}=this.getHandlers(t,s);this.runSync(a,i,r);const[h]=this.runSync(c,i,r,!0);return this.runSync(l,i,r),this.dispatchDomEvent(t,i,r),h}parseCallArgs(t,e,n,o){return e instanceof v||"object"!=typeof e&&"function"!=typeof n?[e,n,o]:[void 0,e,n]}run(t,e,n,o){void 0===o&&(o=!1);try{let i;const r=this;void 0===e&&(e=r.swup.visit);const s=[],a=function(t,e,n){if("function"==typeof t[w]){var o,i,r,s=t[w]();if(function t(a){try{for(;!((o=s.next()).done||n&&n());)if((a=e(o.value))&&a.then){if(!P(a))return void a.then(t,r||(r=y.bind(null,i=new k,2)));a=a.v}i?y(i,1,a):i=a}catch(t){y(i||(i=new k),2,t)}}(),s.return){var a=function(t){try{o.done||s.return()}catch(t){}return t};if(i&&i.then)return i.then(a,function(t){throw a(t)});a()}return i}if(!("length"in t))throw new TypeError("Object is not iterable");for(var c=[],l=0;l<t.length;l++)c.push(t[l]);return function(t,e,n){var o,i,r=-1;return function s(a){try{for(;++r<t.length&&(!n||!n());)if((a=e(r))&&a.then){if(!P(a))return void a.then(s,i||(i=y.bind(null,o=new k,2)));a=a.v}o?y(o,1,a):o=a}catch(t){y(o||(o=new k),2,t)}}(),o}(c,function(t){return e(c[t])},n)}(t,function(t){let{hook:i,handler:a,defaultHandler:c,once:l}=t;if(!e?.done)return l&&r.off(i,a),function(t,o){try{var i=Promise.resolve(function(t,e){return void 0===e&&(e=[]),new Promise((n,o)=>{const i=t(...e);f(i)?i.then(n,o):n(i)})}(a,[e,n,c])).then(function(t){s.push(t)})}catch(t){return o(t)}return i&&i.then?i.then(void 0,o):i}(0,function(t){if(o)throw t;console.error(`Error in hook '${i}':`,t)})},function(){return i});return Promise.resolve(a&&a.then?a.then(function(t){return i?t:s}):i?a:s)}catch(t){return Promise.reject(t)}}runSync(t,e,n,o){void 0===e&&(e=this.swup.visit),void 0===o&&(o=!1);const i=[];for(const{hook:r,handler:s,defaultHandler:a,once:c}of t)if(!e?.done){c&&this.off(r,s);try{const t=s(e,n,a);i.push(t),f(t)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${r}'.`)}catch(t){if(o)throw t;console.error(`Error in hook '${r}':`,t)}}return i}getHandlers(t,e){const n=this.get(t);if(!n)return{found:!1,before:[],handler:[],after:[],replaced:!1};const o=Array.from(n.values()),i=this.sortRegistrations,r=o.filter(t=>{let{before:e,replace:n}=t;return e&&!n}).sort(i),s=o.filter(t=>{let{replace:e}=t;return e}).filter(t=>!0).sort(i),a=o.filter(t=>{let{before:e,replace:n}=t;return!e&&!n}).sort(i),c=s.length>0;let l=[];if(e&&(l=[{id:0,hook:t,handler:e}],c)){const n=s.length-1,{handler:o,once:i}=s[n],r=t=>{const n=s[t-1];return n?(e,o)=>n.handler(e,o,r(t-1)):e};l=[{id:0,hook:t,once:i,handler:o,defaultHandler:r(n)}]}return{found:!0,before:r,handler:l,after:a,replaced:c}}sortRegistrations(t,e){return(t.priority??0)-(e.priority??0)||t.id-e.id||0}dispatchDomEvent(t,e,n){if(e?.done)return;const o={hook:t,args:n,visit:e||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:o,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${t}`,{detail:o,bubbles:!0}))}parseName(t){const[e,...n]=t.split(".");return[e,n.reduce((t,e)=>({...t,[e]:!0}),{})]}}const S=t=>{if(t&&"#"===t.charAt(0)&&(t=t.substring(1)),!t)return null;const e=decodeURIComponent(t);let n=document.getElementById(t)||document.getElementById(e)||h(`a[name='${CSS.escape(t)}']`)||h(`a[name='${CSS.escape(e)}']`);return n||"top"!==t||(n=document.body),n},E=function(t){let{selector:e,elements:n}=t;try{if(!1===e&&!n)return Promise.resolve();let t=[];if(n)t=Array.from(n);else if(e&&(t=u(e,document.body),!t.length))return console.warn(`[swup] No elements found matching animationSelector \`${e}\``),Promise.resolve();const o=t.map(t=>function(t){const{type:e,timeout:n,propCount:o}=function(t){const e=window.getComputedStyle(t),n=x(e,`${C}Delay`),o=x(e,`${C}Duration`),i=$(n,o),r=x(e,`${U}Delay`),s=x(e,`${U}Duration`),a=$(r,s),c=Math.max(i,a),l=c>0?i>a?C:U:null;return{type:l,timeout:c,propCount:l?l===C?o.length:s.length:0}}(t);return!(!e||!n)&&new Promise(i=>{const r=`${e}end`,s=performance.now();let a=0;const c=()=>{t.removeEventListener(r,l),i()},l=e=>{e.target===t&&((performance.now()-s)/1e3<e.elapsedTime||++a>=o&&c())};setTimeout(()=>{a<o&&c()},n+1),t.addEventListener(r,l)})}(t));return o.filter(Boolean).length>0?Promise.resolve(Promise.all(o)).then(function(){}):(e&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${e}\``),Promise.resolve())}catch(t){return Promise.reject(t)}},C="transition",U="animation";function x(t,e){return(t[e]||"").split(", ")}function $(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((e,n)=>A(e)+A(t[n])))}function A(t){return 1e3*parseFloat(t)}const H=function(t,e){void 0===e&&(e={});try{let a;const c=this;function r(r){if(a)return r;c.navigating=!0,c.visit=t;const{el:l}=t.trigger;e.referrer=e.referrer||c.location.url,!1===e.animate&&(t.animation.animate=!1),t.animation.animate||c.classes.clear();const h=e.history||m(l,"data-swup-history");"string"==typeof h&&["push","replace"].includes(h)&&(t.history.action=h);const u=e.animation||m(l,"data-swup-animation");return"string"==typeof u&&(t.animation.name=u),t.meta=e.meta||{},"object"==typeof e.cache?(t.cache.read=e.cache.read??t.cache.read,t.cache.write=e.cache.write??t.cache.write):void 0!==e.cache&&(t.cache={read:!!e.cache,write:!!e.cache}),delete e.cache,function(r,a){try{var l=function(r,a){try{var l=Promise.resolve(c.hooks.call("visit:start",t,void 0)).then(function(){function r(){if(!t.done)return Promise.resolve(c.hooks.call("visit:transition",t,void 0,function(){try{let n;function e(e){return n?e:(t.advance(4),Promise.resolve(c.animatePageOut(t)).then(function(){function e(){return Promise.resolve(c.animatePageIn(t)).then(function(){})}const n=function(){if(t.animation.native&&document.startViewTransition)return Promise.resolve(document.startViewTransition(function(){try{const e=c.renderPage;return Promise.resolve(a).then(function(n){return Promise.resolve(e.call(c,t,n))})}catch(t){return Promise.reject(t)}}).finished).then(function(){});{const e=c.renderPage;return Promise.resolve(a).then(function(n){return Promise.resolve(e.call(c,t,n)).then(function(){})})}}();return n&&n.then?n.then(e):e()}))}const o=function(){if(!t.animation.animate)return Promise.resolve(c.hooks.call("animation:skip",void 0)).then(function(){const e=c.renderPage;return Promise.resolve(a).then(function(o){return Promise.resolve(e.call(c,t,o)).then(function(){n=1})})})}();return Promise.resolve(o&&o.then?o.then(e):e(o))}catch(i){return Promise.reject(i)}})).then(function(){if(!t.done)return Promise.resolve(c.hooks.call("visit:end",t,void 0,()=>c.classes.clear())).then(function(){t.state=7,c.navigating=!1,c.onVisitEnd&&(c.onVisitEnd(),c.onVisitEnd=void 0)})})}t.state=3;const a=c.hooks.call("page:load",t,{options:e},function(t,e){try{function n(t){return e.page=t,e.cache=!!o,e.page}let o;return t.cache.read&&(o=c.cache.get(t.to.url)),Promise.resolve(o?n(o):Promise.resolve(c.fetchPage(t.to.url,e.options)).then(n))}catch(i){return Promise.reject(i)}});a.then(e=>{let{html:n}=e;t.advance(5),t.to.html=n,t.to.document=(new DOMParser).parseFromString(n,"text/html")});const l=t.to.url+t.to.hash;t.history.popstate||("replace"===t.history.action||t.to.url===c.location.url?i(l):(c.currentHistoryIndex++,function(t,e){void 0===e&&(e={});const n={url:t=t||o({hash:!0}),random:Math.random(),source:"swup",...e};window.history.pushState(n,"",t)}(l,{index:c.currentHistoryIndex}))),c.location=s.fromUrl(l),t.history.popstate&&c.classes.add("is-popstate"),t.animation.name&&c.classes.add(`to-${n(t.animation.name)}`);const h=function(){if(t.animation.wait)return Promise.resolve(a).then(function(){})}();return h&&h.then?h.then(r):r()})}catch(t){return a(t)}return l&&l.then?l.then(void 0,a):l}(0,function(e){e&&!e?.aborted?(t.state=9,console.error(e),c.options.skipPopStateHandling=()=>(window.location.assign(t.to.url+t.to.hash),!0),window.history.back()):t.state=8})}catch(t){return a(!0,t)}return l&&l.then?l.then(a.bind(null,!1),a.bind(null,!0)):a(!1,l)}(0,function(e,n){if(delete t.to.document,e)throw n;return n})}const l=function(){if(c.navigating)return function(){if(!(c.visit.state>=6))return Promise.resolve(c.hooks.call("visit:abort",c.visit,void 0)).then(function(){delete c.visit.to.document,c.visit.state=8});t.state=2,c.onVisitEnd=()=>c.performNavigation(t,e),a=1}()}();return Promise.resolve(l&&l.then?l.then(r):r(l))}catch(h){return Promise.reject(h)}};function T(t,e,n){if(void 0===e&&(e={}),void 0===n&&(n={}),"string"!=typeof t)throw new Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(t,{el:n.el,event:n.event}))return void window.location.assign(t);const{url:o,hash:i}=s.fromUrl(t),r=this.createVisit({...n,to:o,hash:i});this.performNavigation(r,e)}const j=function(t){try{const e=this;return Promise.resolve(e.hooks.call("animation:out:start",t,void 0,()=>{e.classes.add("is-changing","is-animating","is-leaving")})).then(function(){return Promise.resolve(e.hooks.call("animation:out:await",t,{skip:!1},(t,n)=>{let{skip:o}=n;if(!o)return e.awaitAnimations({selector:t.animation.selector})})).then(function(){return Promise.resolve(e.hooks.call("animation:out:end",t,void 0)).then(function(){})})})}catch(t){return Promise.reject(t)}},L=function(t){const e=t.to.document;if(!e)return!1;const n=e.querySelector("title")?.innerText||"";document.title=n;const o=u('[data-swup-persist]:not([data-swup-persist=""])'),i=t.containers.map(t=>{const n=document.querySelector(t),o=e.querySelector(t);return n&&o?(n.replaceWith(o.cloneNode(!0)),!0):(n||console.warn(`[swup] Container missing in current document: ${t}`),o||console.warn(`[swup] Container missing in incoming document: ${t}`),!1)}).filter(Boolean);return o.forEach(t=>{const e=t.getAttribute("data-swup-persist"),n=h(`[data-swup-persist="${e}"]`);n&&n!==t&&n.replaceWith(t)}),i.length===t.containers.length},V=function(t){const e={behavior:"auto"},{target:n,reset:o}=t.scroll,i=n??t.to.hash;let r=!1;return i&&(r=this.hooks.callSync("scroll:anchor",t,{hash:i,options:e},(t,e)=>{let{hash:n,options:o}=e;const i=this.getAnchorElement(n);return i&&i.scrollIntoView(o),!!i})),o&&!r&&(r=this.hooks.callSync("scroll:top",t,{options:e},(t,e)=>{let{options:n}=e;return window.scrollTo({top:0,left:0,...n}),!0})),r},I=function(t){try{const e=this;if(t.done)return Promise.resolve();const n=e.hooks.call("animation:in:await",t,{skip:!1},(t,n)=>{let{skip:o}=n;if(!o)return e.awaitAnimations({selector:t.animation.selector})});return Promise.resolve(d()).then(function(){return Promise.resolve(e.hooks.call("animation:in:start",t,void 0,()=>{e.classes.remove("is-animating")})).then(function(){return Promise.resolve(n).then(function(){return Promise.resolve(e.hooks.call("animation:in:end",t,void 0)).then(function(){})})})})}catch(t){return Promise.reject(t)}},q=function(t,e){try{const r=this;if(t.done)return Promise.resolve();t.advance(6);const{url:a}=e;return r.isSameResolvedUrl(o(),a)||(i(a),r.location=s.fromUrl(a),t.to.url=r.location.url,t.to.hash=r.location.hash),Promise.resolve(r.hooks.call("content:replace",t,{page:e},(t,e)=>{if(r.classes.remove("is-leaving"),t.animation.animate&&r.classes.add("is-rendering"),!r.replaceContent(t))throw new Error("[swup] Container mismatch, aborting");t.animation.animate&&(r.classes.add("is-changing","is-animating","is-rendering"),t.animation.name&&r.classes.add(`to-${n(t.animation.name)}`))})).then(function(){return Promise.resolve(r.hooks.call("content:scroll",t,void 0,()=>r.scrollToContent(t))).then(function(){return Promise.resolve(r.hooks.call("page:view",t,{url:r.location.url,title:document.title})).then(function(){})})})}catch(t){return Promise.reject(t)}},N=function(t){var e;if(e=t,Boolean(e?.isSwupPlugin)){if(t.swup=this,!t._checkRequirements||t._checkRequirements())return t._beforeMount&&t._beforeMount(),t.mount(),this.plugins.push(t),this.plugins}else console.error("Not a swup plugin instance",t)};function R(t){const e=this.findPlugin(t);if(e)return e.unmount(),e._afterUnmount&&e._afterUnmount(),this.plugins=this.plugins.filter(t=>t!==e),this.plugins;console.error("No such plugin",e)}function O(t){return this.plugins.find(e=>e===t||e.name===t||e.name===`Swup${String(t)}`)}function D(t){if("function"!=typeof this.options.resolveUrl)return console.warn("[swup] options.resolveUrl expects a callback function."),t;const e=this.options.resolveUrl(t);return e&&"string"==typeof e?e.startsWith("//")||e.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),t):e:(console.warn("[swup] options.resolveUrl needs to return a url"),t)}function M(t,e){return this.resolveUrl(t)===this.resolveUrl(e)}const W={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:function(t,e){let{el:n}=void 0===e?{}:e;return!!n?.closest("[data-no-swup]")},linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:t=>t,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:t=>"swup"!==t.state?.source,timeout:0};return class{get currentPageUrl(){return this.location.url}constructor(t){void 0===t&&(t={}),this.version="4.8.1",this.options=void 0,this.defaults=W,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=s.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=N,this.unuse=R,this.findPlugin=O,this.log=()=>{},this.navigate=T,this.performNavigation=H,this.createVisit=g,this.delegateEvent=r,this.fetchPage=a,this.awaitAnimations=E,this.renderPage=q,this.replaceContent=L,this.animatePageIn=I,this.animatePageOut=j,this.scrollToContent=V,this.getAnchorElement=S,this.getCurrentUrl=o,this.resolveUrl=D,this.isSameResolvedUrl=M,this.options={...this.defaults,...t},this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new l(this),this.classes=new p(this),this.hooks=new b(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=window.history.state?.index??1,this.enable()}enable(){try{const t=this,{linkSelector:e}=t.options;t.clickDelegate=t.delegateEvent(e,"click",t.handleLinkClick),window.addEventListener("popstate",t.handlePopState),t.options.animateHistoryBrowsing&&(window.history.scrollRestoration="manual"),t.options.native=t.options.native&&!!document.startViewTransition,t.options.plugins.forEach(e=>t.use(e));for(const[e,n]of Object.entries(t.options.hooks)){const[o,i]=t.hooks.parseName(e);t.hooks.on(o,n,i)}return"swup"!==window.history.state?.source&&i(null,{index:t.currentHistoryIndex}),Promise.resolve(d()).then(function(){return Promise.resolve(t.hooks.call("enable",void 0,void 0,()=>{const e=document.documentElement;e.classList.add("swup-enabled"),e.classList.toggle("swup-native",t.options.native)})).then(function(){})})}catch(t){return Promise.reject(t)}}destroy(){try{const t=this;return t.clickDelegate.destroy(),window.removeEventListener("popstate",t.handlePopState),t.cache.clear(),t.options.plugins.forEach(e=>t.unuse(e)),Promise.resolve(t.hooks.call("disable",void 0,void 0,()=>{const t=document.documentElement;t.classList.remove("swup-enabled"),t.classList.remove("swup-native")})).then(function(){t.hooks.clear()})}catch(t){return Promise.reject(t)}}shouldIgnoreVisit(t,e){let{el:n,event:o}=void 0===e?{}:e;const{origin:i,url:r,hash:a}=s.fromUrl(t);return i!==window.location.origin||!(!n||!this.triggerWillOpenNewWindow(n))||!!this.options.ignoreVisit(r+a,{el:n,event:o})}handleLinkClick(t){const e=t.delegateTarget,{href:n,url:o,hash:r}=s.fromElement(e);if(this.shouldIgnoreVisit(n,{el:e,event:t}))return;if(this.navigating&&o===this.visit.to.url)return void t.preventDefault();const a=this.createVisit({to:o,hash:r,el:e,event:t});t.metaKey||t.ctrlKey||t.shiftKey||t.altKey?this.hooks.callSync("link:newtab",a,{href:n}):0===t.button&&this.hooks.callSync("link:click",a,{el:e,event:t},()=>{const e=a.from.url??"";t.preventDefault(),o&&o!==e?this.isSameResolvedUrl(o,e)||this.performNavigation(a):r?this.hooks.callSync("link:anchor",a,{hash:r},()=>{i(o+r),this.scrollToContent(a)}):this.hooks.callSync("link:self",a,void 0,()=>{"navigate"===this.options.linkToSelf?this.performNavigation(a):(i(o),this.scrollToContent(a))})})}handlePopState(t){const e=t.state?.url??window.location.href;if(this.options.skipPopStateHandling(t))return;if(this.isSameResolvedUrl(o(),this.location.url))return;const{url:n,hash:i}=s.fromUrl(e),r=this.createVisit({to:n,hash:i,event:t});r.history.popstate=!0;const a=t.state?.index??0;a&&a!==this.currentHistoryIndex&&(r.history.direction=a-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=a),r.animation.animate=!1,r.scroll.reset=!1,r.scroll.target=!1,this.options.animateHistoryBrowsing&&(r.animation.animate=!0,r.scroll.reset=!0),this.hooks.callSync("history:popstate",r,{event:t},()=>{this.performNavigation(r)})}triggerWillOpenNewWindow(t){return!!t.matches('[download], [target="_blank"]')}}});
//# sourceMappingURL=Swup.umd.js.map
diff --git a/node_modules/swup/dist/Swup.umd.js.map b/node_modules/swup/dist/Swup.umd.js.map
index 973a17c6..d51a380c 100644
--- a/node_modules/swup/dist/Swup.umd.js.map
+++ b/node_modules/swup/dist/Swup.umd.js.map
@@ -1 +1 @@
-{"version":3,"file":"Swup.umd.js","sources":["../node_modules/delegate-it/delegate.js","../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Keeps track of raw listeners added to the base elements to avoid duplication */\nconst ledger = new WeakMap();\nfunction editLedger(wanted, baseElement, callback, setup) {\n if (!wanted && !ledger.has(baseElement)) {\n return false;\n }\n const elementMap = ledger.get(baseElement)\n ?? new WeakMap();\n ledger.set(baseElement, elementMap);\n const setups = elementMap.get(callback) ?? new Set();\n elementMap.set(callback, setups);\n const existed = setups.has(setup);\n if (wanted) {\n setups.add(setup);\n }\n else {\n setups.delete(setup);\n }\n return existed && wanted;\n}\nfunction safeClosest(event, selector) {\n let target = event.target;\n if (target instanceof Text) {\n target = target.parentElement;\n }\n if (target instanceof Element && event.currentTarget instanceof Element) {\n // `.closest()` may match ancestors of `currentTarget` but we only need its children\n const closest = target.closest(selector);\n if (closest && event.currentTarget.contains(closest)) {\n return closest;\n }\n }\n}\n// This type isn't exported as a declaration, so it needs to be duplicated above\nfunction delegate(selector, type, callback, options = {}) {\n const { signal, base = document } = options;\n if (signal?.aborted) {\n return;\n }\n // Don't pass `once` to `addEventListener` because it needs to be handled in `delegate-it`\n const { once, ...nativeListenerOptions } = options;\n // `document` should never be the base, it's just an easy way to define \"global event listeners\"\n const baseElement = base instanceof Document ? base.documentElement : base;\n // Handle the regular Element usage\n const capture = Boolean(typeof options === 'object' ? options.capture : options);\n const listenerFunction = (event) => {\n const delegateTarget = safeClosest(event, selector);\n if (delegateTarget) {\n const delegateEvent = Object.assign(event, { delegateTarget });\n callback.call(baseElement, delegateEvent);\n if (once) {\n baseElement.removeEventListener(type, listenerFunction, nativeListenerOptions);\n editLedger(false, baseElement, callback, setup);\n }\n }\n };\n const setup = JSON.stringify({ selector, type, capture });\n const isAlreadyListening = editLedger(true, baseElement, callback, setup);\n if (!isAlreadyListening) {\n baseElement.addEventListener(type, listenerFunction, nativeListenerOptions);\n }\n signal?.addEventListener('abort', () => {\n editLedger(false, baseElement, callback, setup);\n });\n}\nexport default delegate;\n","/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t}\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst replacingHandler = replace[index].handler;\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [\n\t\t\t\t\t{ id: 0, hook, handler: replacingHandler, defaultHandler: nestedDefaultHandler }\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["ledger","WeakMap","editLedger","wanted","baseElement","callback","setup","has","elementMap","get","set","setups","Set","existed","add","delete","classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","_temp","hash","window","location","pathname","search","updateHistoryRecord","url","data","state","history","random","Math","source","replaceState","delegateEvent","selector","type","options","controller","AbortController","signal","base","document","aborted","once","nativeListenerOptions","Document","documentElement","capture","Boolean","listenerFunction","event","delegateTarget","target","Text","parentElement","Element","currentTarget","closest","contains","safeClosest","Object","assign","call","removeEventListener","JSON","stringify","addEventListener","delegate","destroy","abort","Location","URL","constructor","baseURI","super","toString","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","visit","FetchError","finalUrl","page","cache","write","method","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_ref","fetch","_this$hooks$call","clearTimeout","_catch","error","name","e","reject","Error","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","result","callSync","undefined","update","payload","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","getContextualAttr","attr","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","console","on","handler","warn","registration","off","before","arg1","arg2","arg3","args","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","body","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_ref2","func","runAsPromise","_result2","found","replaced","sort","sortRegistrations","_ref3","_ref4","T","_ref5","index","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","getAnchorElement","charAt","substring","decoded","decodeURIComponent","element","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","onEnd","elapsedTime","awaitAnimationsOnElement","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","pushState","createHistoryRecord","skipPopStateHandling","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","toggle","origin","triggerWillOpenNewWindow","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches"],"mappings":"uNACA,MAAMA,EAAS,IAAIC,QACnB,SAASC,EAAWC,EAAQC,EAAaC,EAAUC,GAC/C,IAAKH,IAAWH,EAAOO,IAAIH,GACvB,OAAO,EAEX,MAAMI,EAAa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pR,GACtB,EAYyB,EAE9B,CAEU0T,cAAAA,CAAexW,GACxB,MAAM+B,EAAgB/B,EAAMvB,OAAwBF,KAAOL,OAAOC,SAAS4D,KAG3E,GAAIJ,KAAKzC,QAAQ4T,qBAAqB9S,GACrC,OAID,GAAI2B,KAAKgT,kBAAkB5W,IAAiB4D,KAAKxD,SAASI,KACzD,OAGD,MAAMA,IAAEA,EAAGN,KAAEA,GAASmD,EAASa,QAAQF,GAEjCe,EAAQnB,KAAKmH,YAAY,CAAEf,GAAIxJ,EAAKN,OAAM+B,UAGhD8C,EAAMpE,QAAQ+J,UAAW,EAGzB,MAAM8E,EAASvN,EAAMvB,OAAwB8O,OAAS,EAClDA,GAASA,IAAU5L,KAAKgR,sBAE3B7P,EAAMpE,QAAQgK,UADI6E,EAAQ5L,KAAKgR,oBAAsB,EAAI,WAAa,YAEtEhR,KAAKgR,oBAAsBpF,GAI5BzK,EAAM8D,UAAUsB,SAAU,EAC1BpF,EAAMmF,OAAOU,OAAQ,EACrB7F,EAAMmF,OAAO/H,QAAS,EAGlByB,KAAKzC,QAAQ4W,yBAChBhT,EAAM8D,UAAUsB,SAAU,EAC1BpF,EAAMmF,OAAOU,OAAQ,GAGtBhH,KAAKkB,MAAMoC,SAAS,mBAAoBnC,EAAO,CAAE9C,SAAS,KACzD2B,KAAKkP,kBAAkB/N,EACxB,EACD,CAGU+T,wBAAAA,CAAyBO,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
+{"version":3,"file":"Swup.umd.js","sources":["../node_modules/delegate-it/delegate.js","../src/helpers/classify.ts","../src/helpers/getCurrentUrl.ts","../src/helpers/history.ts","../src/helpers/delegateEvent.ts","../src/helpers/Location.ts","../src/modules/fetchPage.ts","../src/modules/Cache.ts","../src/utils/index.ts","../src/modules/Classes.ts","../src/modules/Visit.ts","../src/modules/Hooks.ts","../src/modules/getAnchorElement.ts","../src/modules/awaitAnimations.ts","../src/modules/navigate.ts","../src/modules/animatePageOut.ts","../src/modules/replaceContent.ts","../src/modules/scrollToContent.ts","../src/modules/animatePageIn.ts","../src/modules/renderPage.ts","../src/modules/plugins.ts","../src/modules/resolveUrl.ts","../src/Swup.ts"],"sourcesContent":["/** Keeps track of raw listeners added to the base elements to avoid duplication */\nconst ledger = new WeakMap();\nfunction editLedger(wanted, baseElement, callback, setup) {\n if (!wanted && !ledger.has(baseElement)) {\n return false;\n }\n const elementMap = ledger.get(baseElement)\n ?? new WeakMap();\n ledger.set(baseElement, elementMap);\n const setups = elementMap.get(callback) ?? new Set();\n elementMap.set(callback, setups);\n const existed = setups.has(setup);\n if (wanted) {\n setups.add(setup);\n }\n else {\n setups.delete(setup);\n }\n return existed && wanted;\n}\nfunction safeClosest(event, selector) {\n let target = event.target;\n if (target instanceof Text) {\n target = target.parentElement;\n }\n if (target instanceof Element && event.currentTarget instanceof Element) {\n // `.closest()` may match ancestors of `currentTarget` but we only need its children\n const closest = target.closest(selector);\n if (closest && event.currentTarget.contains(closest)) {\n return closest;\n }\n }\n}\n// This type isn't exported as a declaration, so it needs to be duplicated above\nfunction delegate(selector, type, callback, options = {}) {\n const { signal, base = document } = options;\n if (signal?.aborted) {\n return;\n }\n // Don't pass `once` to `addEventListener` because it needs to be handled in `delegate-it`\n const { once, ...nativeListenerOptions } = options;\n // `document` should never be the base, it's just an easy way to define \"global event listeners\"\n const baseElement = base instanceof Document ? base.documentElement : base;\n // Handle the regular Element usage\n const capture = Boolean(typeof options === 'object' ? options.capture : options);\n const listenerFunction = (event) => {\n const delegateTarget = safeClosest(event, String(selector));\n if (delegateTarget) {\n const delegateEvent = Object.assign(event, { delegateTarget });\n callback.call(baseElement, delegateEvent);\n if (once) {\n baseElement.removeEventListener(type, listenerFunction, nativeListenerOptions);\n editLedger(false, baseElement, callback, setup);\n }\n }\n };\n const setup = JSON.stringify({ selector, type, capture });\n const isAlreadyListening = editLedger(true, baseElement, callback, setup);\n if (!isAlreadyListening) {\n baseElement.addEventListener(type, listenerFunction, nativeListenerOptions);\n }\n signal?.addEventListener('abort', () => {\n editLedger(false, baseElement, callback, setup);\n });\n}\nexport default delegate;\n","/** Turn a string into a slug by lowercasing and replacing whitespace. */\nexport const classify = (text: string, fallback?: string): string => {\n\tconst output = String(text)\n\t\t.toLowerCase()\n\t\t// .normalize('NFD') // split an accented letter in the base letter and the acent\n\t\t// .replace(/[\\u0300-\\u036f]/g, '') // remove all previously split accents\n\t\t.replace(/[\\s/_.]+/g, '-') // replace spaces and _./ with '-'\n\t\t.replace(/[^\\w-]+/g, '') // remove all non-word chars\n\t\t.replace(/--+/g, '-') // replace repeating '-' with single '-'\n\t\t.replace(/^-+|-+$/g, ''); // trim '-' from edges\n\treturn output || fallback || '';\n};\n","/** Get the current page URL: path name + query params. Optionally including hash. */\nexport const getCurrentUrl = ({ hash }: { hash?: boolean } = {}): string => {\n\treturn window.location.pathname + window.location.search + (hash ? window.location.hash : '');\n};\n","import { getCurrentUrl } from './getCurrentUrl.js';\n\nexport interface HistoryState {\n\turl: string;\n\tsource: 'swup';\n\trandom: number;\n\tindex?: number;\n\t[key: string]: unknown;\n}\n\ntype HistoryData = Record<string, unknown>;\n\n/** Create a new history record with a custom swup identifier. */\nexport const createHistoryRecord = (url: string, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst state: HistoryState = {\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.pushState(state, '', url);\n};\n\n/** Update the current history record with a custom swup identifier. */\nexport const updateHistoryRecord = (url: string | null = null, data: HistoryData = {}): void => {\n\turl = url || getCurrentUrl({ hash: true });\n\tconst currentState = (window.history.state as HistoryState) || {};\n\tconst state: HistoryState = {\n\t\t...currentState,\n\t\turl,\n\t\trandom: Math.random(),\n\t\tsource: 'swup',\n\t\t...data\n\t};\n\twindow.history.replaceState(state, '', url);\n};\n","import delegate, {\n\ttype DelegateEventHandler,\n\ttype DelegateOptions,\n\ttype EventType\n} from 'delegate-it';\nimport type { ParseSelector } from 'typed-query-selector/parser.js';\n\nexport type DelegateEventUnsubscribe = {\n\tdestroy: () => void;\n};\n\n/** Register a delegated event listener. */\nexport const delegateEvent = <\n\tSelector extends string,\n\tTElement extends Element = ParseSelector<Selector, HTMLElement>,\n\tTEvent extends EventType = EventType\n>(\n\tselector: Selector,\n\ttype: TEvent,\n\tcallback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>,\n\toptions?: DelegateOptions\n): DelegateEventUnsubscribe => {\n\tconst controller = new AbortController();\n\toptions = { ...options, signal: controller.signal };\n\tdelegate<Selector, TElement, TEvent>(selector, type, callback, options);\n\treturn { destroy: () => controller.abort() };\n};\n","/**\n * A helper for creating a Location from either an element\n * or a URL object/string\n *\n */\nexport class Location extends URL {\n\tconstructor(url: URL | string, base: string = document.baseURI) {\n\t\tsuper(url.toString(), base);\n\t\t// Fix Safari bug with extending native classes\n\t\tObject.setPrototypeOf(this, Location.prototype);\n\t}\n\n\t/**\n\t * The full local path including query params.\n\t */\n\tget url(): string {\n\t\treturn this.pathname + this.search;\n\t}\n\n\t/**\n\t * Instantiate a Location from an element's href attribute\n\t * @param el\n\t * @returns new Location instance\n\t */\n\tstatic fromElement(el: Element): Location {\n\t\tconst href = el.getAttribute('href') || el.getAttribute('xlink:href') || '';\n\t\treturn new Location(href);\n\t}\n\n\t/**\n\t * Instantiate a Location from a URL object or string\n\t * @param url\n\t * @returns new Location instance\n\t */\n\tstatic fromUrl(url: URL | string): Location {\n\t\treturn new Location(url);\n\t}\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport type { Visit } from './Visit.js';\n\n/** A page object as used by swup and its cache. */\nexport interface PageData {\n\t/** The URL of the page */\n\turl: string;\n\t/** The complete HTML response received from the server */\n\thtml: string;\n}\n\n/** Define how a page is fetched. */\nexport interface FetchOptions extends Omit<RequestInit, 'cache'> {\n\t/** The request method. */\n\tmethod?: 'GET' | 'POST';\n\t/** The body of the request: raw string, form data object or URL params. */\n\tbody?: string | FormData | URLSearchParams;\n\t/** The request timeout in milliseconds. */\n\ttimeout?: number;\n\t/** Optional visit object with additional context. @internal */\n\tvisit?: Visit;\n}\n\nexport class FetchError extends Error {\n\turl: string;\n\tstatus?: number;\n\taborted: boolean;\n\ttimedOut: boolean;\n\tconstructor(\n\t\tmessage: string,\n\t\tdetails: { url: string; status?: number; aborted?: boolean; timedOut?: boolean }\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'FetchError';\n\t\tthis.url = details.url;\n\t\tthis.status = details.status;\n\t\tthis.aborted = details.aborted || false;\n\t\tthis.timedOut = details.timedOut || false;\n\t}\n}\n\n/**\n * Fetch a page from the server, return it and cache it.\n */\nexport async function fetchPage(\n\tthis: Swup,\n\turl: URL | string,\n\toptions: FetchOptions = {}\n): Promise<PageData> {\n\turl = Location.fromUrl(url).url;\n\n\tconst { visit = this.visit } = options;\n\tconst headers = { ...this.options.requestHeaders, ...options.headers };\n\tconst timeout = options.timeout ?? this.options.timeout;\n\tconst controller = new AbortController();\n\tconst { signal } = controller;\n\toptions = { ...options, headers, signal };\n\n\tlet timedOut = false;\n\tlet timeoutId: ReturnType<typeof setTimeout> | null = null;\n\tif (timeout && timeout > 0) {\n\t\ttimeoutId = setTimeout(() => {\n\t\t\ttimedOut = true;\n\t\t\tcontroller.abort('timeout');\n\t\t}, timeout);\n\t}\n\n\t// Allow hooking before this and returning a custom response-like object (e.g. custom fetch implementation)\n\tlet response: Response;\n\ttry {\n\t\tresponse = await this.hooks.call(\n\t\t\t'fetch:request',\n\t\t\tvisit,\n\t\t\t{ url, options },\n\t\t\t(visit, { url, options }) => fetch(url, options)\n\t\t);\n\t\tif (timeoutId) {\n\t\t\tclearTimeout(timeoutId);\n\t\t}\n\t} catch (error) {\n\t\tif (timedOut) {\n\t\t\tthis.hooks.call('fetch:timeout', visit, { url });\n\t\t\tthrow new FetchError(`Request timed out: ${url}`, { url, timedOut });\n\t\t}\n\t\tif ((error as Error)?.name === 'AbortError' || signal.aborted) {\n\t\t\tthrow new FetchError(`Request aborted: ${url}`, { url, aborted: true });\n\t\t}\n\t\tthrow error;\n\t}\n\n\tconst { status, url: responseUrl } = response;\n\tconst html = await response.text();\n\n\tif (status === 500) {\n\t\tthis.hooks.call('fetch:error', visit, { status, response, url: responseUrl });\n\t\tthrow new FetchError(`Server error: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\tif (!html) {\n\t\tthrow new FetchError(`Empty response: ${responseUrl}`, { status, url: responseUrl });\n\t}\n\n\t// Resolve real url after potential redirect\n\tconst { url: finalUrl } = Location.fromUrl(responseUrl);\n\tconst page = { url: finalUrl, html };\n\n\t// Write to cache for safe methods and non-redirects\n\tif (visit.cache.write && (!options.method || options.method === 'GET') && url === finalUrl) {\n\t\tthis.cache.set(page.url, page);\n\t}\n\n\treturn page;\n}\n","import type Swup from '../Swup.js';\nimport { Location } from '../helpers.js';\nimport { type PageData } from './fetchPage.js';\n\nexport interface CacheData extends PageData {}\n\n/**\n * In-memory page cache.\n */\nexport class Cache {\n\t/** Swup instance this cache belongs to */\n\tprotected swup: Swup;\n\n\t/** Cached pages, indexed by URL */\n\tprotected pages: Map<string, CacheData> = new Map();\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\t/** Number of cached pages in memory. */\n\tget size(): number {\n\t\treturn this.pages.size;\n\t}\n\n\t/** All cached pages. */\n\tget all() {\n\t\tconst copy = new Map();\n\t\tthis.pages.forEach((page, key) => {\n\t\t\tcopy.set(key, { ...page });\n\t\t});\n\t\treturn copy;\n\t}\n\n\t/** Check if the given URL has been cached. */\n\thas(url: string): boolean {\n\t\treturn this.pages.has(this.resolve(url));\n\t}\n\n\t/** Return a shallow copy of the cached page object if available. */\n\tget(url: string): CacheData | undefined {\n\t\tconst result = this.pages.get(this.resolve(url));\n\t\tif (!result) return result;\n\t\treturn { ...result };\n\t}\n\n\t/** Create a cache record for the specified URL. */\n\tset(url: string, page: CacheData) {\n\t\turl = this.resolve(url);\n\t\tpage = { ...page, url };\n\t\tthis.pages.set(url, page);\n\t\tthis.swup.hooks.callSync('cache:set', undefined, { page });\n\t}\n\n\t/** Update a cache record, overwriting or adding custom data. */\n\tupdate(url: string, payload: object) {\n\t\turl = this.resolve(url);\n\t\tconst page = { ...this.get(url), ...payload, url } as CacheData;\n\t\tthis.pages.set(url, page);\n\t}\n\n\t/** Delete a cache record. */\n\tdelete(url: string): void {\n\t\tthis.pages.delete(this.resolve(url));\n\t}\n\n\t/** Empty the cache. */\n\tclear(): void {\n\t\tthis.pages.clear();\n\t\tthis.swup.hooks.callSync('cache:clear', undefined, undefined);\n\t}\n\n\t/** Remove all cache entries that return true for a given predicate function. */\n\tprune(predicate: (url: string, page: CacheData) => boolean): void {\n\t\tthis.pages.forEach((page, url) => {\n\t\t\tif (predicate(url, page)) {\n\t\t\t\tthis.delete(url);\n\t\t\t}\n\t\t});\n\t}\n\n\t/** Resolve URLs by making them local and letting swup resolve them. */\n\tprotected resolve(urlToResolve: string): string {\n\t\tconst { url } = Location.fromUrl(urlToResolve);\n\t\treturn this.swup.resolveUrl(url);\n\t}\n}\n","/** Find an element by selector. */\nexport const query = (selector: string, context: Document | Element = document) => {\n\treturn context.querySelector<HTMLElement>(selector);\n};\n\n/** Find a set of elements by selector. */\nexport const queryAll = (\n\tselector: string,\n\tcontext: Document | Element = document\n): HTMLElement[] => {\n\treturn Array.from(context.querySelectorAll(selector));\n};\n\n/** Return a Promise that resolves after the next event loop. */\nexport const nextTick = (): Promise<void> => {\n\treturn new Promise((resolve) => {\n\t\trequestAnimationFrame(() => {\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t});\n};\n\n/** Check if an object is a Promise or a Thenable */\nexport function isPromise<T>(obj: unknown): obj is PromiseLike<T> {\n\treturn (\n\t\t!!obj &&\n\t\t(typeof obj === 'object' || typeof obj === 'function') &&\n\t\ttypeof (obj as Record<string, unknown>).then === 'function'\n\t);\n}\n\n/** Call a function as a Promise. Resolves with the returned Promsise or immediately. */\n// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any\nexport function runAsPromise(func: Function, args: unknown[] = []): Promise<unknown> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst result: unknown = func(...args);\n\t\tif (isPromise(result)) {\n\t\t\tresult.then(resolve, reject);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n}\n\n/**\n * Force a layout reflow, e.g. after adding classnames\n * @see https://stackoverflow.com/a/21665117/3759615\n */\nexport function forceReflow(element?: HTMLElement): void {\n\telement = element || document.body;\n\telement?.getBoundingClientRect();\n}\n\n/**\n * Read data attribute from closest element with that attribute.\n *\n * Returns `undefined` if no element is found or attribute is missing.\n * Returns `true` if attribute is present without a value.\n */\nexport function getContextualAttr(\n\tel: Element | undefined,\n\tattr: string\n): string | boolean | undefined {\n\tconst target = el?.closest(`[${attr}]`);\n\treturn target?.hasAttribute(attr) ? target?.getAttribute(attr) || true : undefined;\n}\n","import type Swup from '../Swup.js';\nimport { queryAll } from '../utils.js';\n\nexport class Classes {\n\tprotected swup: Swup;\n\tprotected swupClasses = [\n\t\t'to-',\n\t\t'is-changing',\n\t\t'is-rendering',\n\t\t'is-popstate',\n\t\t'is-animating',\n\t\t'is-leaving'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t}\n\n\tprotected get selectors(): string[] {\n\t\tconst { scope } = this.swup.visit.animation;\n\t\tif (scope === 'containers') return this.swup.visit.containers;\n\t\tif (scope === 'html') return ['html'];\n\t\tif (Array.isArray(scope)) return scope;\n\t\treturn [];\n\t}\n\n\tprotected get selector(): string {\n\t\treturn this.selectors.join(',');\n\t}\n\n\tprotected get targets(): HTMLElement[] {\n\t\tif (!this.selector.trim()) return [];\n\t\treturn queryAll(this.selector);\n\t}\n\n\tadd(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.add(...classes));\n\t}\n\n\tremove(...classes: string[]): void {\n\t\tthis.targets.forEach((target) => target.classList.remove(...classes));\n\t}\n\n\tclear(): void {\n\t\tthis.targets.forEach((target) => {\n\t\t\tconst remove = target.className.split(' ').filter((c) => this.isSwupClass(c));\n\t\t\ttarget.classList.remove(...remove);\n\t\t});\n\t}\n\n\tprotected isSwupClass(className: string): boolean {\n\t\treturn this.swupClasses.some((c) => className.startsWith(c));\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\nimport type { HistoryAction, HistoryDirection } from './navigate.js';\n\n/** See below for the class Visit {} definition */\n// export interface Visit {}\n\nexport interface VisitFrom {\n\t/** The URL of the previous page */\n\turl: string;\n\t/** The hash of the previous page */\n\thash?: string;\n}\n\nexport interface VisitTo {\n\t/** The URL of the next page */\n\turl: string;\n\t/** The hash of the next page */\n\thash?: string;\n\t/** The HTML content of the next page */\n\thtml?: string;\n\t/** The parsed document of the next page, available during visit */\n\tdocument?: Document;\n}\n\nexport interface VisitAnimation {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate: boolean;\n\t/** Whether to wait for the next page to load before starting the animation. Default: `false` */\n\twait: boolean;\n\t/** Name of a custom animation to run. */\n\tname?: string;\n\t/** Whether this animation uses the native browser ViewTransition API. Default: `false` */\n\tnative: boolean;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tscope: 'html' | 'containers' | string[];\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tselector: Options['animationSelector'];\n}\n\nexport interface VisitScroll {\n\t/** Whether to reset the scroll position after the visit. Default: `true` */\n\treset: boolean;\n\t/** Anchor element to scroll to on the next page. */\n\ttarget?: string | false;\n}\n\nexport interface VisitTrigger {\n\t/** DOM element that triggered this visit. */\n\tel?: Element;\n\t/** DOM event that triggered this visit. */\n\tevent?: Event;\n}\n\nexport interface VisitCache {\n\t/** Whether this visit will try to load the requested page from cache. */\n\tread: boolean;\n\t/** Whether this visit will save the loaded page in cache. */\n\twrite: boolean;\n}\n\nexport interface VisitHistory {\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\taction: HistoryAction;\n\t/** Whether this visit was triggered by a browser history navigation. */\n\tpopstate: boolean;\n\t/** The direction of travel in case of a browser history navigation: backward or forward. */\n\tdirection: HistoryDirection | undefined;\n}\n\nexport interface VisitInitOptions {\n\tto: string;\n\tfrom?: string;\n\thash?: string;\n\tel?: Element;\n\tevent?: Event;\n}\n\n/** @internal */\nexport const VisitState = {\n\tCREATED: 1,\n\tQUEUED: 2,\n\tSTARTED: 3,\n\tLEAVING: 4,\n\tLOADED: 5,\n\tENTERING: 6,\n\tCOMPLETED: 7,\n\tABORTED: 8,\n\tFAILED: 9\n} as const;\n\n/** @internal */\nexport type VisitState = (typeof VisitState)[keyof typeof VisitState];\n\n/** An object holding details about the current visit. */\nexport class Visit {\n\t/** A unique ID to identify this visit */\n\tid: number;\n\t/** The current state of this visit @internal */\n\tstate: VisitState;\n\t/** The previous page, about to leave */\n\tfrom: VisitFrom;\n\t/** The next page, about to enter */\n\tto: VisitTo;\n\t/** The content containers, about to be replaced */\n\tcontainers: Options['containers'];\n\t/** Information about animated page transitions */\n\tanimation: VisitAnimation;\n\t/** What triggered this visit */\n\ttrigger: VisitTrigger;\n\t/** Cache behavior for this visit */\n\tcache: VisitCache;\n\t/** Browser history behavior on this visit */\n\thistory: VisitHistory;\n\t/** Scroll behavior on this visit */\n\tscroll: VisitScroll;\n\t/** User-defined metadata */\n\tmeta: Record<string, unknown>;\n\n\tconstructor(swup: Swup, options: VisitInitOptions) {\n\t\tconst { to, from, hash, el, event } = options;\n\n\t\tthis.id = Math.random();\n\t\tthis.state = VisitState.CREATED;\n\t\tthis.from = { url: from ?? swup.location.url, hash: swup.location.hash };\n\t\tthis.to = { url: to, hash };\n\t\tthis.containers = swup.options.containers;\n\t\tthis.animation = {\n\t\t\tanimate: true,\n\t\t\twait: false,\n\t\t\tname: undefined,\n\t\t\tnative: swup.options.native,\n\t\t\tscope: swup.options.animationScope,\n\t\t\tselector: swup.options.animationSelector\n\t\t};\n\t\tthis.trigger = { el, event };\n\t\tthis.cache = {\n\t\t\tread: swup.options.cache,\n\t\t\twrite: swup.options.cache\n\t\t};\n\t\tthis.history = {\n\t\t\taction: 'push',\n\t\t\tpopstate: false,\n\t\t\tdirection: undefined\n\t\t};\n\t\tthis.scroll = {\n\t\t\treset: true,\n\t\t\ttarget: undefined\n\t\t};\n\t\tthis.meta = {};\n\t}\n\n\t/** @internal */\n\tadvance(state: VisitState) {\n\t\tif (this.state < state) {\n\t\t\tthis.state = state;\n\t\t}\n\t}\n\n\t/** @internal */\n\tabort() {\n\t\tthis.state = VisitState.ABORTED;\n\t}\n\n\t/** Is this visit done, i.e. completed, failed, or aborted? */\n\tget done(): boolean {\n\t\treturn this.state >= VisitState.COMPLETED;\n\t}\n}\n\n/** Create a new visit object. */\nexport function createVisit(this: Swup, options: VisitInitOptions): Visit {\n\treturn new Visit(this, options);\n}\n","import type { DelegateEvent } from 'delegate-it';\n\nimport type Swup from '../Swup.js';\nimport { isPromise, runAsPromise } from '../utils.js';\nimport { Visit } from './Visit.js';\nimport type { FetchOptions, PageData } from './fetchPage.js';\n\nexport interface HookDefinitions {\n\t'animation:out:start': undefined;\n\t'animation:out:await': { skip: boolean };\n\t'animation:out:end': undefined;\n\t'animation:in:start': undefined;\n\t'animation:in:await': { skip: boolean };\n\t'animation:in:end': undefined;\n\t'animation:skip': undefined;\n\t'cache:clear': undefined;\n\t'cache:set': { page: PageData };\n\t'content:replace': { page: PageData };\n\t'content:scroll': undefined;\n\t'enable': undefined;\n\t'disable': undefined;\n\t'fetch:request': { url: string; options: FetchOptions };\n\t'fetch:error': { url: string; status: number; response: Response };\n\t'fetch:timeout': { url: string };\n\t'history:popstate': { event: PopStateEvent };\n\t'link:click': { el: HTMLAnchorElement; event: DelegateEvent<MouseEvent> };\n\t'link:self': undefined;\n\t'link:anchor': { hash: string };\n\t'link:newtab': { href: string };\n\t'page:load': { page?: PageData; cache?: boolean; options: FetchOptions };\n\t'page:view': { url: string; title: string };\n\t'scroll:top': { options: ScrollIntoViewOptions };\n\t'scroll:anchor': { hash: string; options: ScrollIntoViewOptions };\n\t'visit:start': undefined;\n\t'visit:transition': undefined;\n\t'visit:abort': undefined;\n\t'visit:end': undefined;\n}\n\nexport interface HookReturnValues {\n\t'content:scroll': Promise<boolean> | boolean;\n\t'fetch:request': Promise<Response>;\n\t'page:load': Promise<PageData>;\n\t'scroll:top': boolean;\n\t'scroll:anchor': boolean;\n}\n\nexport type HookArguments<T extends HookName> = HookDefinitions[T];\n\nexport type HookName = keyof HookDefinitions;\n\nexport type HookNameWithModifier = `${HookName}.${HookModifier}`;\n\ntype HookModifier = 'once' | 'before' | 'replace';\n\n/** A generic hook handler. */\nexport type HookHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>\n) => Promise<unknown> | unknown;\n\n/** A default hook handler with an expected return type. */\nexport type HookDefaultHandler<T extends HookName> = (\n\t/** Context about the current visit. */\n\tvisit: Visit,\n\t/** Local arguments passed into the handler. */\n\targs: HookArguments<T>,\n\t/** Default handler to be executed. Available if replacing an internal hook handler. */\n\tdefaultHandler?: HookDefaultHandler<T>\n) => T extends keyof HookReturnValues ? HookReturnValues[T] : Promise<unknown> | unknown;\n\nexport type Handlers = {\n\t[K in HookName]: HookHandler<K>[];\n};\n\nexport type HookInitOptions = {\n\t[K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;\n} & {\n\t[K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;\n};\n\n/** Unregister a previously registered hook handler. */\nexport type HookUnregister = () => void;\n\n/** Define when and how a hook handler is executed. */\nexport type HookOptions = {\n\t/** Execute the hook once, then remove the handler */\n\tonce?: boolean;\n\t/** Execute the hook before the internal default handler */\n\tbefore?: boolean;\n\t/** Set a priority for when to execute this hook. Lower numbers execute first. Default: `0` */\n\tpriority?: number;\n\t/** Replace the internal default handler with this hook handler */\n\treplace?: boolean;\n};\n\nexport type HookRegistration<\n\tT extends HookName,\n\tH extends HookHandler<T> | HookDefaultHandler<T> = HookHandler<T>\n> = {\n\tid: number;\n\thook: T;\n\thandler: H;\n\tdefaultHandler?: HookDefaultHandler<T>;\n} & HookOptions;\n\ntype HookEventDetail = {\n\thook: HookName;\n\targs: unknown;\n\tvisit: Visit;\n};\n\nexport type HookEvent = CustomEvent<HookEventDetail>;\n\ntype HookLedger<T extends HookName> = Map<HookHandler<T>, HookRegistration<T>>;\n\ninterface HookRegistry extends Map<HookName, HookLedger<HookName>> {\n\tget<K extends HookName>(key: K): HookLedger<K> | undefined;\n\tset<K extends HookName>(key: K, value: HookLedger<K>): this;\n}\n\n/**\n * Hook registry.\n *\n * Create, trigger and handle hooks.\n *\n */\nexport class Hooks {\n\t/** Swup instance this registry belongs to */\n\tprotected swup: Swup;\n\n\t/** Map of all registered hook handlers. */\n\tprotected registry: HookRegistry = new Map();\n\n\t// Can we deduplicate this somehow? Or make it error when not in sync with HookDefinitions?\n\t// https://stackoverflow.com/questions/53387838/how-to-ensure-an-arrays-values-the-keys-of-a-typescript-interface/53395649\n\tprotected readonly hooks: HookName[] = [\n\t\t'animation:out:start',\n\t\t'animation:out:await',\n\t\t'animation:out:end',\n\t\t'animation:in:start',\n\t\t'animation:in:await',\n\t\t'animation:in:end',\n\t\t'animation:skip',\n\t\t'cache:clear',\n\t\t'cache:set',\n\t\t'content:replace',\n\t\t'content:scroll',\n\t\t'enable',\n\t\t'disable',\n\t\t'fetch:request',\n\t\t'fetch:error',\n\t\t'fetch:timeout',\n\t\t'history:popstate',\n\t\t'link:click',\n\t\t'link:self',\n\t\t'link:anchor',\n\t\t'link:newtab',\n\t\t'page:load',\n\t\t'page:view',\n\t\t'scroll:top',\n\t\t'scroll:anchor',\n\t\t'visit:start',\n\t\t'visit:transition',\n\t\t'visit:abort',\n\t\t'visit:end'\n\t];\n\n\tconstructor(swup: Swup) {\n\t\tthis.swup = swup;\n\t\tthis.init();\n\t}\n\n\t/**\n\t * Create ledgers for all core hooks.\n\t */\n\tprotected init() {\n\t\tthis.hooks.forEach((hook) => this.create(hook));\n\t}\n\n\t/**\n\t * Create a new hook type.\n\t */\n\tcreate(hook: string) {\n\t\tif (!this.registry.has(hook as HookName)) {\n\t\t\tthis.registry.set(hook as HookName, new Map());\n\t\t}\n\t}\n\n\t/**\n\t * Check if a hook type exists.\n\t */\n\texists(hook: HookName): boolean {\n\t\treturn this.registry.has(hook);\n\t}\n\n\t/**\n\t * Get the ledger with all registrations for a hook.\n\t */\n\tprotected get<T extends HookName>(hook: T): HookLedger<T> | undefined {\n\t\tconst ledger = this.registry.get(hook);\n\t\tif (ledger) {\n\t\t\treturn ledger;\n\t\t}\n\t\tconsole.error(`Unknown hook '${hook}'`);\n\t}\n\n\t/**\n\t * Remove all handlers of all hooks.\n\t */\n\tclear() {\n\t\tthis.registry.forEach((ledger) => ledger.clear());\n\t}\n\n\t/**\n\t * Register a new hook handler.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Object to specify how and when the handler is executed\n\t * Available options:\n\t * - `once`: Only execute the handler once\n\t * - `before`: Execute the handler before the default handler\n\t * - `priority`: Specify the order in which the handlers are executed\n\t * - `replace`: Replace the default handler with this handler\n\t * @returns A function to unregister the handler\n\t */\n\n\t// Overload: replacing default handler\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookDefaultHandler<T>, options: O & { replace: true }): HookUnregister; // prettier-ignore\n\t// Overload: passed in handler options\n\ton<T extends HookName, O extends HookOptions>(hook: T, handler: HookHandler<T>, options: O): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\ton<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\ton<T extends HookName, O extends HookOptions>(\n\t\thook: T,\n\t\thandler: O['replace'] extends true ? HookDefaultHandler<T> : HookHandler<T>,\n\t\toptions: Partial<O> = {}\n\t): HookUnregister {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\tconsole.warn(`Hook '${hook}' not found.`);\n\t\t\treturn () => {};\n\t\t}\n\n\t\tconst id = ledger.size + 1;\n\t\tconst registration: HookRegistration<T> = { ...options, id, hook, handler };\n\t\tledger.set(handler, registration);\n\n\t\treturn () => this.off(hook, handler);\n\t}\n\n\t/**\n\t * Register a new hook handler to run before the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { before: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tbefore<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tbefore<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, before: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to replace the default handler.\n\t * Shortcut for `hooks.on(hook, handler, { replace: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute instead of the default handler\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @returns A function to unregister the handler\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\treplace<T extends HookName>(hook: T, handler: HookDefaultHandler<T>): HookUnregister; // prettier-ignore\n\t// Implementation\n\treplace<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookDefaultHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, replace: true });\n\t}\n\n\t/**\n\t * Register a new hook handler to run once.\n\t * Shortcut for `hooks.on(hook, handler, { once: true })`.\n\t * @param hook Name of the hook to listen for\n\t * @param handler The handler function to execute\n\t * @param options Any other event options (see `hooks.on()` for details)\n\t * @see on\n\t */\n\t// Overload: passed in handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>, options: HookOptions): HookUnregister; // prettier-ignore\n\t// Overload: no handler options\n\tonce<T extends HookName>(hook: T, handler: HookHandler<T>): HookUnregister;\n\t// Implementation\n\tonce<T extends HookName>(\n\t\thook: T,\n\t\thandler: HookHandler<T>,\n\t\toptions: HookOptions = {}\n\t): HookUnregister {\n\t\treturn this.on(hook, handler, { ...options, once: true });\n\t}\n\n\t/**\n\t * Unregister a hook handler.\n\t * @param hook Name of the hook the handler is registered for\n\t * @param handler The handler function that was registered.\n\t * If omitted, all handlers for the hook will be removed.\n\t */\n\t// Overload: unregister a specific handler\n\toff<T extends HookName>(hook: T, handler: HookHandler<T> | HookDefaultHandler<T>): void;\n\t// Overload: unregister all handlers\n\toff<T extends HookName>(hook: T): void;\n\t// Implementation\n\toff<T extends HookName>(hook: T, handler?: HookHandler<T> | HookDefaultHandler<T>): void {\n\t\tconst ledger = this.get(hook);\n\t\tif (ledger && handler) {\n\t\t\tconst deleted = ledger.delete(handler);\n\t\t\tif (!deleted) {\n\t\t\t\tconsole.warn(`Handler for hook '${hook}' not found.`);\n\t\t\t}\n\t\t} else if (ledger) {\n\t\t\tledger.clear();\n\t\t}\n\t}\n\n\t/**\n\t * Trigger a hook asynchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order and `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The resolved return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tasync call<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tasync call<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>>; // prettier-ignore\n\t// Implementation\n\tasync call<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tawait this.run(before, visit, args);\n\t\tconst [result] = await this.run(handler, visit, args, true);\n\t\tawait this.run(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Trigger a hook synchronously, executing its default handler and all registered handlers.\n\t * Will execute all handlers in order, but will **not** `await` any `Promise`s they return.\n\t * @param hook Name of the hook to trigger\n\t * @param visit The visit object this hook belongs to\n\t * @param args Arguments to pass to the handler\n\t * @param defaultHandler A default implementation of this hook to execute\n\t * @returns The (possibly unresolved) return value of the executed default handler\n\t */\n\t// Overload: default order of arguments\n\tcallSync<T extends HookName>(hook: T, visit: Visit | undefined, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Overload: legacy order of arguments, with visit missing\n\tcallSync<T extends HookName>(hook: T, args: HookArguments<T>, defaultHandler?: HookDefaultHandler<T>): ReturnType<HookDefaultHandler<T>>; // prettier-ignore\n\t// Implementation\n\tcallSync<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T>,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): ReturnType<HookDefaultHandler<T>> {\n\t\tconst [visit, args, defaultHandler] = this.parseCallArgs(hook, arg1, arg2, arg3);\n\t\tconst { before, handler, after } = this.getHandlers(hook, defaultHandler);\n\t\tthis.runSync(before, visit, args);\n\t\tconst [result] = this.runSync(handler, visit, args, true);\n\t\tthis.runSync(after, visit, args);\n\t\tthis.dispatchDomEvent(hook, visit, args);\n\t\treturn result;\n\t}\n\n\t/**\n\t * Parse the call arguments for call() and callSync() to allow legacy argument order.\n\t */\n\tprotected parseCallArgs<T extends HookName>(\n\t\thook: T,\n\t\targ1: Visit | HookArguments<T> | undefined,\n\t\targ2: HookArguments<T> | HookDefaultHandler<T>,\n\t\targ3?: HookDefaultHandler<T>\n\t): [Visit | undefined, HookArguments<T>, HookDefaultHandler<T> | undefined] {\n\t\tconst isLegacyOrder =\n\t\t\t!(arg1 instanceof Visit) && (typeof arg1 === 'object' || typeof arg2 === 'function');\n\t\tif (isLegacyOrder) {\n\t\t\t// Legacy positioning: arguments in second or handler passed in third place\n\t\t\treturn [undefined, arg1 as HookArguments<T>, arg2 as HookDefaultHandler<T>];\n\t\t} else {\n\t\t\t// Default positioning: visit passed in as first argument\n\t\t\treturn [arg1, arg2 as HookArguments<T>, arg3];\n\t\t}\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, as `Promise`s that will be `await`ed.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): Promise<Awaited<ReturnType<HookDefaultHandler<T>>>[]>; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected async run<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): Promise<unknown[]>; // prettier-ignore\n\t// Implementation\n\tprotected async run<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): Promise<Awaited<ReturnType<HookDefaultHandler<T>>> | unknown[]> {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = await runAsPromise(handler, [visit, args, defaultHandler]);\n\t\t\t\tresults.push(result);\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Execute the handlers for a hook, in order, without `await`ing any returned `Promise`s.\n\t * @param registrations The registrations (handler + options) to execute\n\t * @param args Arguments to pass to the handler\n\t */\n\n\t// Overload: running HookDefaultHandler: expect HookDefaultHandler return type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T, HookDefaultHandler<T>>[], visit: Visit | undefined, args: HookArguments<T>, rethrow: true): ReturnType<HookDefaultHandler<T>>[]; // prettier-ignore\n\t// Overload: running user handler: expect no specific type\n\tprotected runSync<T extends HookName>(registrations: HookRegistration<T>[], visit: Visit | undefined, args: HookArguments<T>): unknown[]; // prettier-ignore\n\t// Implementation\n\tprotected runSync<T extends HookName, R extends HookRegistration<T>[]>(\n\t\tregistrations: R,\n\t\tvisit: Visit | undefined = this.swup.visit,\n\t\targs: HookArguments<T>,\n\t\trethrow: boolean = false\n\t): (ReturnType<HookDefaultHandler<T>> | unknown)[] {\n\t\tconst results = [];\n\t\tfor (const { hook, handler, defaultHandler, once } of registrations) {\n\t\t\tif (visit?.done) continue;\n\t\t\tif (once) this.off(hook, handler);\n\t\t\ttry {\n\t\t\t\tconst result = (handler as HookDefaultHandler<T>)(visit, args, defaultHandler);\n\t\t\t\tresults.push(result);\n\t\t\t\tif (isPromise(result)) {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Swup will not await Promises in handler for synchronous hook '${hook}'.`\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (rethrow) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.error(`Error in hook '${hook}':`, error);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Get all registered handlers for a hook, sorted by priority and registration order.\n\t * @param hook Name of the hook\n\t * @param defaultHandler The optional default handler of this hook\n\t * @returns An object with the handlers sorted into `before` and `after` arrays,\n\t * as well as a flag indicating if the original handler was replaced\n\t */\n\tprotected getHandlers<T extends HookName>(hook: T, defaultHandler?: HookDefaultHandler<T>) {\n\t\tconst ledger = this.get(hook);\n\t\tif (!ledger) {\n\t\t\treturn { found: false, before: [], handler: [], after: [], replaced: false };\n\t\t}\n\n\t\tconst registrations = Array.from(ledger.values());\n\n\t\t// Let TypeScript know that replaced handlers are default handlers by filtering to true\n\t\tconst def = (T: HookRegistration<T>): T is HookRegistration<T, HookDefaultHandler<T>> => true; // prettier-ignore\n\t\tconst sort = this.sortRegistrations;\n\n\t\t// Filter into before, after, and replace handlers\n\t\tconst before = registrations.filter(({ before, replace }) => before && !replace).sort(sort);\n\t\tconst replace = registrations.filter(({ replace }) => replace).filter(def).sort(sort); // prettier-ignore\n\t\tconst after = registrations.filter(({ before, replace }) => !before && !replace).sort(sort);\n\t\tconst replaced = replace.length > 0;\n\n\t\t// Define main handler registration\n\t\t// Created as HookRegistration[] array to allow passing it into hooks.run() directly\n\t\tlet handler: HookRegistration<T, HookDefaultHandler<T>>[] = [];\n\t\tif (defaultHandler) {\n\t\t\thandler = [{ id: 0, hook, handler: defaultHandler }];\n\t\t\tif (replaced) {\n\t\t\t\tconst index = replace.length - 1;\n\t\t\t\tconst { handler: replacingHandler, once } = replace[index];\n\t\t\t\tconst createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {\n\t\t\t\t\tconst next = replace[index - 1];\n\t\t\t\t\tif (next) {\n\t\t\t\t\t\treturn (visit, args) =>\n\t\t\t\t\t\t\tnext.handler(visit, args, createDefaultHandler(index - 1));\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn defaultHandler;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tconst nestedDefaultHandler = createDefaultHandler(index);\n\t\t\t\thandler = [{ id: 0, hook, once, handler: replacingHandler, defaultHandler: nestedDefaultHandler }]; // prettier-ignore\n\t\t\t}\n\t\t}\n\n\t\treturn { found: true, before, handler, after, replaced };\n\t}\n\n\t/**\n\t * Sort two hook registrations by priority and registration order.\n\t * @param a The registration object to compare\n\t * @param b The other registration object to compare with\n\t * @returns The sort direction\n\t */\n\tprotected sortRegistrations<T extends HookName>(\n\t\ta: HookRegistration<T>,\n\t\tb: HookRegistration<T>\n\t): number {\n\t\tconst priority = (a.priority ?? 0) - (b.priority ?? 0);\n\t\tconst id = a.id - b.id;\n\t\treturn priority || id || 0;\n\t}\n\n\t/**\n\t * Dispatch a custom event on the `document` for a hook. Prefixed with `swup:`\n\t * @param hook Name of the hook.\n\t */\n\tprotected dispatchDomEvent<T extends HookName>(\n\t\thook: T,\n\t\tvisit: Visit | undefined,\n\t\targs?: HookArguments<T>\n\t): void {\n\t\tif (visit?.done) return;\n\n\t\tconst detail: HookEventDetail = { hook, args, visit: visit || this.swup.visit };\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:any`, { detail, bubbles: true })\n\t\t);\n\t\tdocument.dispatchEvent(\n\t\t\tnew CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })\n\t\t);\n\t}\n\n\t/**\n\t * Parse a hook name into the name and any modifiers.\n\t * @param hook Name of the hook.\n\t */\n\tparseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>] {\n\t\tconst [name, ...modifiers] = hook.split('.');\n\t\tconst options = modifiers.reduce((acc, mod) => ({ ...acc, [mod]: true }), {});\n\t\treturn [name as HookName, options];\n\t}\n}\n","import { query } from '../utils.js';\n\n/**\n * Find the anchor element for a given hash.\n *\n * @param hash Hash with or without leading '#'\n * @returns The element, if found, or null.\n *\n * @see https://html.spec.whatwg.org/#find-a-potential-indicated-element\n */\nexport const getAnchorElement = (hash?: string): Element | null => {\n\tif (hash && hash.charAt(0) === '#') {\n\t\thash = hash.substring(1);\n\t}\n\n\tif (!hash) {\n\t\treturn null;\n\t}\n\n\tconst decoded = decodeURIComponent(hash);\n\tlet element =\n\t\tdocument.getElementById(hash) ||\n\t\tdocument.getElementById(decoded) ||\n\t\tquery(`a[name='${CSS.escape(hash)}']`) ||\n\t\tquery(`a[name='${CSS.escape(decoded)}']`);\n\n\tif (!element && hash === 'top') {\n\t\telement = document.body;\n\t}\n\n\treturn element;\n};\n","import { queryAll } from '../utils.js';\nimport type Swup from '../Swup.js';\nimport type { Options } from '../Swup.js';\n\nconst TRANSITION = 'transition';\nconst ANIMATION = 'animation';\n\ntype AnimationType = typeof TRANSITION | typeof ANIMATION;\ntype AnimationEndEvent = `${AnimationType}end`;\ntype AnimationProperty = 'Delay' | 'Duration';\ntype AnimationStyleKey = `${AnimationType}${AnimationProperty}` | 'transitionProperty';\n\nexport type AnimationDirection = 'in' | 'out';\n\n/**\n * Return a Promise that resolves when all CSS animations and transitions\n * are done on the page. Filters by selector or takes elements directly.\n */\nexport async function awaitAnimations(\n\tthis: Swup,\n\t{\n\t\tselector,\n\t\telements\n\t}: {\n\t\tselector: Options['animationSelector'];\n\t\telements?: NodeListOf<HTMLElement> | HTMLElement[];\n\t}\n): Promise<void> {\n\t// Allow usage of swup without animations: { animationSelector: false }\n\tif (selector === false && !elements) {\n\t\treturn;\n\t}\n\n\t// Allow passing in elements\n\tlet animatedElements: HTMLElement[] = [];\n\tif (elements) {\n\t\tanimatedElements = Array.from(elements);\n\t} else if (selector) {\n\t\tanimatedElements = queryAll(selector, document.body);\n\t\t// Warn if no elements match the selector, but keep things going\n\t\tif (!animatedElements.length) {\n\t\t\tconsole.warn(`[swup] No elements found matching animationSelector \\`${selector}\\``);\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst awaitedAnimations = animatedElements.map((el) => awaitAnimationsOnElement(el));\n\tconst hasAnimations = awaitedAnimations.filter(Boolean).length > 0;\n\tif (!hasAnimations) {\n\t\tif (selector) {\n\t\t\tconsole.warn(\n\t\t\t\t`[swup] No CSS animation duration defined on elements matching \\`${selector}\\``\n\t\t\t);\n\t\t}\n\t\treturn;\n\t}\n\n\tawait Promise.all(awaitedAnimations);\n}\n\nfunction awaitAnimationsOnElement(element: HTMLElement): Promise<void> | false {\n\tconst { type, timeout, propCount } = getTransitionInfo(element);\n\n\t// Resolve immediately if no transition defined\n\tif (!type || !timeout) {\n\t\treturn false;\n\t}\n\n\treturn new Promise((resolve) => {\n\t\tconst endEvent: AnimationEndEvent = `${type}end`;\n\t\tconst startTime = performance.now();\n\t\tlet propsTransitioned = 0;\n\n\t\tconst end = () => {\n\t\t\telement.removeEventListener(endEvent, onEnd);\n\t\t\tresolve();\n\t\t};\n\n\t\tconst onEnd = (event: TransitionEvent | AnimationEvent) => {\n\t\t\t// Skip transitions on child elements\n\t\t\tif (event.target !== element) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Skip transitions that happened before we started listening\n\t\t\tconst elapsedTime = (performance.now() - startTime) / 1000;\n\t\t\tif (elapsedTime < event.elapsedTime) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End if all properties have transitioned\n\t\t\tif (++propsTransitioned >= propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t};\n\n\t\tsetTimeout(() => {\n\t\t\tif (propsTransitioned < propCount) {\n\t\t\t\tend();\n\t\t\t}\n\t\t}, timeout + 1);\n\n\t\telement.addEventListener(endEvent, onEnd);\n\t});\n}\n\nfunction getTransitionInfo(element: Element) {\n\tconst styles = window.getComputedStyle(element);\n\n\tconst transitionDelays = getStyleProperties(styles, `${TRANSITION}Delay`);\n\tconst transitionDurations = getStyleProperties(styles, `${TRANSITION}Duration`);\n\tconst transitionTimeout = calculateTimeout(transitionDelays, transitionDurations);\n\n\tconst animationDelays = getStyleProperties(styles, `${ANIMATION}Delay`);\n\tconst animationDurations = getStyleProperties(styles, `${ANIMATION}Duration`);\n\tconst animationTimeout = calculateTimeout(animationDelays, animationDurations);\n\n\tconst timeout = Math.max(transitionTimeout, animationTimeout);\n\tconst type: AnimationType | null =\n\t\ttimeout > 0 ? (transitionTimeout > animationTimeout ? TRANSITION : ANIMATION) : null;\n\tconst propCount = type\n\t\t? type === TRANSITION\n\t\t\t? transitionDurations.length\n\t\t\t: animationDurations.length\n\t\t: 0;\n\n\treturn {\n\t\ttype,\n\t\ttimeout,\n\t\tpropCount\n\t};\n}\n\nexport function getStyleProperties(styles: CSSStyleDeclaration, key: AnimationStyleKey): string[] {\n\treturn (styles[key] || '').split(', ');\n}\n\nexport function calculateTimeout(delays: string[], durations: string[]): number {\n\twhile (delays.length < durations.length) {\n\t\tdelays = delays.concat(delays);\n\t}\n\n\treturn Math.max(...durations.map((duration, i) => toMs(duration) + toMs(delays[i])));\n}\n\nexport function toMs(time: string): number {\n\treturn parseFloat(time) * 1000;\n}\n","import type Swup from '../Swup.js';\nimport { FetchError, type FetchOptions, type PageData } from './fetchPage.js';\nimport { type VisitInitOptions, type Visit, VisitState } from './Visit.js';\nimport { createHistoryRecord, updateHistoryRecord, Location, classify } from '../helpers.js';\nimport { getContextualAttr } from '../utils.js';\n\nexport type HistoryAction = 'push' | 'replace';\nexport type HistoryDirection = 'forwards' | 'backwards';\nexport type NavigationToSelfAction = 'scroll' | 'navigate';\nexport type CacheControl = Partial<{ read: boolean; write: boolean }>;\n\n/** Define how to navigate to a page. */\ntype NavigationOptions = {\n\t/** Whether this visit is animated. Default: `true` */\n\tanimate?: boolean;\n\t/** Name of a custom animation to run. */\n\tanimation?: string;\n\t/** History action to perform: `push` for creating a new history entry, `replace` for replacing the current entry. Default: `push` */\n\thistory?: HistoryAction;\n\t/** Whether this visit should read from or write to the cache. */\n\tcache?: CacheControl;\n\t/** Custom metadata associated with this visit. */\n\tmeta?: Record<string, unknown>;\n};\n\n/**\n * Navigate to a new URL.\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport function navigate(\n\tthis: Swup,\n\turl: string,\n\toptions: NavigationOptions & FetchOptions = {},\n\tinit: Omit<VisitInitOptions, 'to'> = {}\n) {\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(`swup.navigate() requires a URL parameter`);\n\t}\n\n\t// Check if the visit should be ignored\n\tif (this.shouldIgnoreVisit(url, { el: init.el, event: init.event })) {\n\t\twindow.location.assign(url);\n\t\treturn;\n\t}\n\n\tconst { url: to, hash } = Location.fromUrl(url);\n\n\tconst visit = this.createVisit({ ...init, to, hash });\n\tthis.performNavigation(visit, options);\n}\n\n/**\n * Start a visit to a new URL.\n *\n * Internal method that assumes the visit context has already been created.\n *\n * As a user, you should call `swup.navigate(url)` instead.\n *\n * @param url The URL to navigate to.\n * @param options Options for how to perform this visit.\n * @returns Promise<void>\n */\nexport async function performNavigation(\n\tthis: Swup,\n\tvisit: Visit,\n\toptions: NavigationOptions & FetchOptions = {}\n): Promise<void> {\n\tif (this.navigating) {\n\t\tif (this.visit.state >= VisitState.ENTERING) {\n\t\t\t// Currently navigating and content already loaded? Finish and queue\n\t\t\tvisit.state = VisitState.QUEUED;\n\t\t\tthis.onVisitEnd = () => this.performNavigation(visit, options);\n\t\t\treturn;\n\t\t} else {\n\t\t\t// Currently navigating and content not loaded? Abort running visit\n\t\t\tawait this.hooks.call('visit:abort', this.visit, undefined);\n\t\t\tdelete this.visit.to.document;\n\t\t\tthis.visit.state = VisitState.ABORTED;\n\t\t}\n\t}\n\n\tthis.navigating = true;\n\tthis.visit = visit;\n\n\tconst { el } = visit.trigger;\n\toptions.referrer = options.referrer || this.location.url;\n\n\tif (options.animate === false) {\n\t\tvisit.animation.animate = false;\n\t}\n\n\t// Clean up old animation classes\n\tif (!visit.animation.animate) {\n\t\tthis.classes.clear();\n\t}\n\n\t// Get history action from option or attribute on trigger element\n\tconst history = options.history || getContextualAttr(el, 'data-swup-history');\n\tif (typeof history === 'string' && ['push', 'replace'].includes(history)) {\n\t\tvisit.history.action = history as HistoryAction;\n\t}\n\n\t// Get custom animation name from option or attribute on trigger element\n\tconst animation = options.animation || getContextualAttr(el, 'data-swup-animation');\n\tif (typeof animation === 'string') {\n\t\tvisit.animation.name = animation;\n\t}\n\n\t// Get custom metadata from option\n\tvisit.meta = options.meta || {};\n\n\t// Sanitize cache option\n\tif (typeof options.cache === 'object') {\n\t\tvisit.cache.read = options.cache.read ?? visit.cache.read;\n\t\tvisit.cache.write = options.cache.write ?? visit.cache.write;\n\t} else if (options.cache !== undefined) {\n\t\tvisit.cache = { read: !!options.cache, write: !!options.cache };\n\t}\n\t// Delete this so that window.fetch doesn't mis-interpret it\n\tdelete options.cache;\n\n\ttry {\n\t\tawait this.hooks.call('visit:start', visit, undefined);\n\n\t\tvisit.state = VisitState.STARTED;\n\n\t\t// Begin loading page\n\t\tconst page = this.hooks.call('page:load', visit, { options }, async (visit, args) => {\n\t\t\t// Read from cache\n\t\t\tlet cachedPage: PageData | undefined;\n\t\t\tif (visit.cache.read) {\n\t\t\t\tcachedPage = this.cache.get(visit.to.url);\n\t\t\t}\n\n\t\t\targs.page = cachedPage || (await this.fetchPage(visit.to.url, args.options));\n\t\t\targs.cache = !!cachedPage;\n\n\t\t\treturn args.page;\n\t\t});\n\n\t\t/**\n\t\t * When the page is loaded: mark the visit as loaded and save\n\t\t * the raw html and a parsed document of the received page in the visit object\n\t\t */\n\t\tpage.then(({ html }) => {\n\t\t\tvisit.advance(VisitState.LOADED);\n\t\t\tvisit.to.html = html;\n\t\t\tvisit.to.document = new DOMParser().parseFromString(html, 'text/html');\n\t\t});\n\n\t\t// Create/update history record if this is not a popstate call or leads to the same URL\n\t\tconst newUrl = visit.to.url + visit.to.hash;\n\t\tif (!visit.history.popstate) {\n\t\t\tif (visit.history.action === 'replace' || visit.to.url === this.location.url) {\n\t\t\t\tupdateHistoryRecord(newUrl);\n\t\t\t} else {\n\t\t\t\tthis.currentHistoryIndex++;\n\t\t\t\tcreateHistoryRecord(newUrl, { index: this.currentHistoryIndex });\n\t\t\t}\n\t\t}\n\t\tthis.location = Location.fromUrl(newUrl);\n\n\t\t// Mark visit type with classes\n\t\tif (visit.history.popstate) {\n\t\t\tthis.classes.add('is-popstate');\n\t\t}\n\t\tif (visit.animation.name) {\n\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t}\n\n\t\t// Wait for page before starting to animate out?\n\t\tif (visit.animation.wait) {\n\t\t\tawait page;\n\t\t}\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Perform the actual transition: animate and replace content\n\t\tawait this.hooks.call('visit:transition', visit, undefined, async () => {\n\t\t\t// No animation? Just await page and render\n\t\t\tif (!visit.animation.animate) {\n\t\t\t\tawait this.hooks.call('animation:skip', undefined);\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Animate page out, render page, animate page in\n\t\t\tvisit.advance(VisitState.LEAVING);\n\t\t\tawait this.animatePageOut(visit);\n\t\t\tif (visit.animation.native && document.startViewTransition) {\n\t\t\t\tawait document.startViewTransition(\n\t\t\t\t\tasync () => await this.renderPage(visit, await page)\n\t\t\t\t).finished;\n\t\t\t} else {\n\t\t\t\tawait this.renderPage(visit, await page);\n\t\t\t}\n\t\t\tawait this.animatePageIn(visit);\n\t\t});\n\n\t\t// Check if failed/aborted in the meantime\n\t\tif (visit.done) return;\n\n\t\t// Finalize visit\n\t\tawait this.hooks.call('visit:end', visit, undefined, () => this.classes.clear());\n\t\tvisit.state = VisitState.COMPLETED;\n\t\tthis.navigating = false;\n\n\t\t/** Run eventually queued function */\n\t\tif (this.onVisitEnd) {\n\t\t\tthis.onVisitEnd();\n\t\t\tthis.onVisitEnd = undefined;\n\t\t}\n\t} catch (error) {\n\t\t// Return early if error is undefined or signals an aborted request\n\t\tif (!error || (error as FetchError)?.aborted) {\n\t\t\tvisit.state = VisitState.ABORTED;\n\t\t\treturn;\n\t\t}\n\n\t\tvisit.state = VisitState.FAILED;\n\n\t\t// Log to console\n\t\tconsole.error(error);\n\n\t\t// Remove current history entry, then load requested url in browser\n\t\tthis.options.skipPopStateHandling = () => {\n\t\t\twindow.location.assign(visit.to.url + visit.to.hash);\n\t\t\treturn true;\n\t\t};\n\n\t\t// Go back to the actual page we're still at\n\t\twindow.history.back();\n\t} finally {\n\t\tdelete visit.to.document;\n\t}\n}\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the out/leave animation of the current page.\n * @returns Promise<void>\n */\nexport const animatePageOut = async function (this: Swup, visit: Visit) {\n\tawait this.hooks.call('animation:out:start', visit, undefined, () => {\n\t\tthis.classes.add('is-changing', 'is-animating', 'is-leaving');\n\t});\n\n\tawait this.hooks.call('animation:out:await', visit, { skip: false }, (visit, { skip }) => {\n\t\tif (skip) return;\n\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t});\n\n\tawait this.hooks.call('animation:out:end', visit, undefined);\n};\n","import type Swup from '../Swup.js';\nimport { query, queryAll } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the replacement of content after loading a page.\n *\n * @returns Whether all containers were replaced.\n */\nexport const replaceContent = function (this: Swup, visit: Visit): boolean {\n\tconst incomingDocument = visit.to.document;\n\tif (!incomingDocument) return false;\n\n\t// Update browser title\n\tconst title = incomingDocument.querySelector('title')?.innerText || '';\n\tdocument.title = title;\n\n\t// Save persisted elements\n\tconst persistedElements = queryAll('[data-swup-persist]:not([data-swup-persist=\"\"])');\n\n\t// Update content containers\n\tconst replaced = visit.containers\n\t\t.map((selector) => {\n\t\t\tconst currentEl = document.querySelector(selector);\n\t\t\tconst incomingEl = incomingDocument.querySelector(selector);\n\t\t\tif (currentEl && incomingEl) {\n\t\t\t\tcurrentEl.replaceWith(incomingEl.cloneNode(true));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (!currentEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in current document: ${selector}`);\n\t\t\t}\n\t\t\tif (!incomingEl) {\n\t\t\t\tconsole.warn(`[swup] Container missing in incoming document: ${selector}`);\n\t\t\t}\n\t\t\treturn false;\n\t\t})\n\t\t.filter(Boolean);\n\n\t// Restore persisted elements\n\tpersistedElements.forEach((existing) => {\n\t\tconst key = existing.getAttribute('data-swup-persist');\n\t\tconst replacement = query(`[data-swup-persist=\"${key}\"]`);\n\t\tif (replacement && replacement !== existing) {\n\t\t\treplacement.replaceWith(existing);\n\t\t}\n\t});\n\n\t// Return true if all containers were replaced\n\treturn replaced.length === visit.containers.length;\n};\n","import type Swup from '../Swup.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Update the scroll position after page render.\n * @returns Promise<boolean>\n */\nexport const scrollToContent = function (this: Swup, visit: Visit): boolean {\n\tconst options: ScrollIntoViewOptions = { behavior: 'auto' };\n\tconst { target, reset } = visit.scroll;\n\tconst scrollTarget = target ?? visit.to.hash;\n\n\tlet scrolled = false;\n\n\tif (scrollTarget) {\n\t\tscrolled = this.hooks.callSync(\n\t\t\t'scroll:anchor',\n\t\t\tvisit,\n\t\t\t{ hash: scrollTarget, options },\n\t\t\t(visit, { hash, options }) => {\n\t\t\t\tconst anchor = this.getAnchorElement(hash);\n\t\t\t\tif (anchor) {\n\t\t\t\t\tanchor.scrollIntoView(options);\n\t\t\t\t}\n\t\t\t\treturn !!anchor;\n\t\t\t}\n\t\t);\n\t}\n\n\tif (reset && !scrolled) {\n\t\tscrolled = this.hooks.callSync('scroll:top', visit, { options }, (visit, { options }) => {\n\t\t\twindow.scrollTo({ top: 0, left: 0, ...options });\n\t\t\treturn true;\n\t\t});\n\t}\n\n\treturn scrolled;\n};\n","import type Swup from '../Swup.js';\nimport { nextTick } from '../utils.js';\nimport type { Visit } from './Visit.js';\n\n/**\n * Perform the in/enter animation of the next page.\n * @returns Promise<void>\n */\nexport const animatePageIn = async function (this: Swup, visit: Visit) {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tconst animation = this.hooks.call(\n\t\t'animation:in:await',\n\t\tvisit,\n\t\t{ skip: false },\n\t\t(visit, { skip }) => {\n\t\t\tif (skip) return;\n\t\t\treturn this.awaitAnimations({ selector: visit.animation.selector });\n\t\t}\n\t);\n\n\tawait nextTick();\n\n\tawait this.hooks.call('animation:in:start', visit, undefined, () => {\n\t\tthis.classes.remove('is-animating');\n\t});\n\n\tawait animation;\n\n\tawait this.hooks.call('animation:in:end', visit, undefined);\n};\n","import { updateHistoryRecord, getCurrentUrl, classify, Location } from '../helpers.js';\nimport type Swup from '../Swup.js';\nimport type { PageData } from './fetchPage.js';\nimport { VisitState, type Visit } from './Visit.js';\n\n/**\n * Render the next page: replace the content and update scroll position.\n */\nexport const renderPage = async function (this: Swup, visit: Visit, page: PageData): Promise<void> {\n\t// Check if failed/aborted in the meantime\n\tif (visit.done) return;\n\n\tvisit.advance(VisitState.ENTERING);\n\n\tconst { url } = page;\n\n\t// update state if the url was redirected\n\tif (!this.isSameResolvedUrl(getCurrentUrl(), url)) {\n\t\tupdateHistoryRecord(url);\n\t\tthis.location = Location.fromUrl(url);\n\t\tvisit.to.url = this.location.url;\n\t\tvisit.to.hash = this.location.hash;\n\t}\n\n\t// replace content: allow handlers and plugins to overwrite paga data and containers\n\tawait this.hooks.call('content:replace', visit, { page }, (visit, { page }) => {\n\t\tthis.classes.remove('is-leaving');\n\t\t// only add for animated page loads\n\t\tif (visit.animation.animate) {\n\t\t\tthis.classes.add('is-rendering');\n\t\t}\n\t\tconst success = this.replaceContent(visit);\n\t\tif (!success) {\n\t\t\tthrow new Error('[swup] Container mismatch, aborting');\n\t\t}\n\t\tif (visit.animation.animate) {\n\t\t\t// Make sure to add these classes to new containers as well\n\t\t\tthis.classes.add('is-changing', 'is-animating', 'is-rendering');\n\t\t\tif (visit.animation.name) {\n\t\t\t\tthis.classes.add(`to-${classify(visit.animation.name)}`);\n\t\t\t}\n\t\t}\n\t});\n\n\t// scroll into view: either anchor or top of page\n\tawait this.hooks.call('content:scroll', visit, undefined, () => {\n\t\treturn this.scrollToContent(visit);\n\t});\n\n\tawait this.hooks.call('page:view', visit, { url: this.location.url, title: document.title });\n};\n","import type Swup from '../Swup.js';\n\nexport type Plugin = {\n\t/** Identify as a swup plugin */\n\tisSwupPlugin: true;\n\t/** Name of this plugin */\n\tname: string;\n\t/** Version of this plugin. Currently not in use, defined here for backward compatiblity. */\n\tversion?: string;\n\t/** The swup instance that mounted this plugin */\n\tswup?: Swup;\n\t/** Version requirements of this plugin. Example: `{ swup: '>=4' }` */\n\trequires?: Record<string, string | string[]>;\n\t/** Run on mount */\n\tmount: () => void;\n\t/** Run on unmount */\n\tunmount: () => void;\n\t_beforeMount?: () => void;\n\t_afterUnmount?: () => void;\n\t_checkRequirements?: () => boolean;\n};\n\nconst isSwupPlugin = (maybeInvalidPlugin: unknown): maybeInvalidPlugin is Plugin => {\n\t// @ts-ignore: this might be anything, object or no\n\treturn Boolean(maybeInvalidPlugin?.isSwupPlugin);\n};\n\n/** Install a plugin. */\nexport const use = function (this: Swup, plugin: unknown) {\n\tif (!isSwupPlugin(plugin)) {\n\t\tconsole.error('Not a swup plugin instance', plugin);\n\t\treturn;\n\t}\n\n\tplugin.swup = this;\n\tif (plugin._checkRequirements) {\n\t\tif (!plugin._checkRequirements()) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (plugin._beforeMount) {\n\t\tplugin._beforeMount();\n\t}\n\tplugin.mount();\n\n\tthis.plugins.push(plugin);\n\n\treturn this.plugins;\n};\n\n/** Uninstall a plugin. */\nexport function unuse(this: Swup, pluginOrName: Plugin | string) {\n\tconst plugin = this.findPlugin(pluginOrName);\n\tif (!plugin) {\n\t\tconsole.error('No such plugin', plugin);\n\t\treturn;\n\t}\n\n\tplugin.unmount();\n\tif (plugin._afterUnmount) {\n\t\tplugin._afterUnmount();\n\t}\n\n\tthis.plugins = this.plugins.filter((p) => p !== plugin);\n\n\treturn this.plugins;\n}\n\n/** Find a plugin by name or reference. */\nexport function findPlugin(this: Swup, pluginOrName: Plugin | string) {\n\treturn this.plugins.find(\n\t\t(plugin) =>\n\t\t\tplugin === pluginOrName ||\n\t\t\tplugin.name === pluginOrName ||\n\t\t\tplugin.name === `Swup${String(pluginOrName)}`\n\t);\n}\n","import type Swup from '../Swup.js';\n\n/**\n * Utility function to validate and run the global option 'resolveUrl'\n * @param {string} url\n * @returns {string} the resolved url\n */\nexport function resolveUrl(this: Swup, url: string): string {\n\tif (typeof this.options.resolveUrl !== 'function') {\n\t\tconsole.warn(`[swup] options.resolveUrl expects a callback function.`);\n\t\treturn url;\n\t}\n\tconst result = this.options.resolveUrl(url);\n\tif (!result || typeof result !== 'string') {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a url`);\n\t\treturn url;\n\t}\n\tif (result.startsWith('//') || result.startsWith('http')) {\n\t\tconsole.warn(`[swup] options.resolveUrl needs to return a relative url`);\n\t\treturn url;\n\t}\n\treturn result;\n}\n\n/**\n * Compares the resolved version of two paths and returns true if they are the same\n * @param {string} url1\n * @param {string} url2\n * @returns {boolean}\n */\nexport function isSameResolvedUrl(this: Swup, url1: string, url2: string): boolean {\n\treturn this.resolveUrl(url1) === this.resolveUrl(url2);\n}\n","import { type DelegateEvent } from 'delegate-it';\n\nimport version from './config/version.js';\n\nimport { delegateEvent, getCurrentUrl, Location, updateHistoryRecord } from './helpers.js';\nimport { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';\n\nimport { Cache } from './modules/Cache.js';\nimport { Classes } from './modules/Classes.js';\nimport { type Visit, createVisit } from './modules/Visit.js';\nimport { Hooks, type HookName, type HookInitOptions } from './modules/Hooks.js';\nimport { getAnchorElement } from './modules/getAnchorElement.js';\nimport { awaitAnimations } from './modules/awaitAnimations.js';\nimport { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';\nimport { fetchPage } from './modules/fetchPage.js';\nimport { animatePageOut } from './modules/animatePageOut.js';\nimport { replaceContent } from './modules/replaceContent.js';\nimport { scrollToContent } from './modules/scrollToContent.js';\nimport { animatePageIn } from './modules/animatePageIn.js';\nimport { renderPage } from './modules/renderPage.js';\nimport { use, unuse, findPlugin, type Plugin } from './modules/plugins.js';\nimport { isSameResolvedUrl, resolveUrl } from './modules/resolveUrl.js';\nimport { nextTick } from './utils.js';\nimport { type HistoryState } from './helpers/history.js';\n\n/** Options for customizing swup's behavior. */\nexport type Options = {\n\t/** Whether history visits are animated. Default: `false` */\n\tanimateHistoryBrowsing: boolean;\n\t/** Selector for detecting animation timing. Default: `[class*=\"transition-\"]` */\n\tanimationSelector: string | false;\n\t/** Elements on which to add animation classes. Default: `html` element */\n\tanimationScope: 'html' | 'containers';\n\t/** Enable in-memory page cache. Default: `true` */\n\tcache: boolean;\n\t/** Content containers to be replaced on page visits. Default: `['#swup']` */\n\tcontainers: string[];\n\t/** Callback for ignoring visits. Receives the element and event that triggered the visit. */\n\tignoreVisit: (url: string, { el, event }: { el?: Element; event?: Event }) => boolean;\n\t/** Selector for links that trigger visits. Default: `'a[href]'` */\n\tlinkSelector: string;\n\t/** How swup handles links to the same page. Default: `scroll` */\n\tlinkToSelf: NavigationToSelfAction;\n\t/** Enable native animations using the View Transitions API. */\n\tnative: boolean;\n\t/** Hook handlers to register. */\n\thooks: Partial<HookInitOptions>;\n\t/** Plugins to register on startup. */\n\tplugins: Plugin[];\n\t/** Custom headers sent along with fetch requests. */\n\trequestHeaders: Record<string, string>;\n\t/** Rewrite URLs before loading them. */\n\tresolveUrl: (url: string) => string;\n\t/** Callback for telling swup to ignore certain popstate events. */\n\tskipPopStateHandling: (event: PopStateEvent) => boolean;\n\t/** Request timeout in milliseconds. */\n\ttimeout: number;\n};\n\nconst defaults: Options = {\n\tanimateHistoryBrowsing: false,\n\tanimationSelector: '[class*=\"transition-\"]',\n\tanimationScope: 'html',\n\tcache: true,\n\tcontainers: ['#swup'],\n\thooks: {},\n\tignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),\n\tlinkSelector: 'a[href]',\n\tlinkToSelf: 'scroll',\n\tnative: false,\n\tplugins: [],\n\tresolveUrl: (url) => url,\n\trequestHeaders: {\n\t\t'X-Requested-With': 'swup',\n\t\t'Accept': 'text/html, application/xhtml+xml'\n\t},\n\tskipPopStateHandling: (event) => (event.state as HistoryState)?.source !== 'swup',\n\ttimeout: 0\n};\n\n/** Swup page transition library. */\nexport default class Swup {\n\t/** Library version */\n\treadonly version: string = version;\n\t/** Options passed into the instance */\n\toptions: Options;\n\t/** Default options before merging user options */\n\treadonly defaults: Options = defaults;\n\t/** Registered plugin instances */\n\tplugins: Plugin[] = [];\n\t/** Data about the current visit */\n\tvisit: Visit;\n\t/** Cache instance */\n\treadonly cache: Cache;\n\t/** Hook registry */\n\treadonly hooks: Hooks;\n\t/** Animation class manager */\n\treadonly classes: Classes;\n\t/** Location of the currently visible page */\n\tlocation: Location = Location.fromUrl(window.location.href);\n\t/** URL of the currently visible page @deprecated Use swup.location.url instead */\n\tget currentPageUrl(): string {\n\t\treturn this.location.url;\n\t}\n\t/** Index of the current history entry */\n\tprotected currentHistoryIndex: number;\n\t/** Delegated event subscription handle */\n\tprotected clickDelegate?: DelegateEventUnsubscribe;\n\t/** Navigation status */\n\tprotected navigating: boolean = false;\n\t/** Run anytime a visit ends */\n\tprotected onVisitEnd?: () => Promise<unknown>;\n\n\t/** Install a plugin */\n\tuse = use;\n\t/** Uninstall a plugin */\n\tunuse = unuse;\n\t/** Find a plugin by name or instance */\n\tfindPlugin = findPlugin;\n\n\t/** Log a message. Has no effect unless debug plugin is installed */\n\tlog: (message: string, context?: unknown) => void = () => {};\n\n\t/** Navigate to a new URL */\n\tnavigate = navigate;\n\t/** Actually perform a navigation */\n\tprotected performNavigation = performNavigation;\n\t/** Create a new context for this visit */\n\tprotected createVisit = createVisit;\n\t/** Register a delegated event listener */\n\tdelegateEvent = delegateEvent;\n\t/** Fetch a page from the server */\n\tfetchPage = fetchPage;\n\t/** Resolve when animations on the page finish */\n\tawaitAnimations = awaitAnimations;\n\tprotected renderPage = renderPage;\n\t/** Replace the content after page load */\n\treplaceContent = replaceContent;\n\tprotected animatePageIn = animatePageIn;\n\tprotected animatePageOut = animatePageOut;\n\tprotected scrollToContent = scrollToContent;\n\t/** Find the anchor element for a given hash */\n\tgetAnchorElement = getAnchorElement;\n\n\t/** Get the current page URL */\n\tgetCurrentUrl = getCurrentUrl;\n\t/** Resolve a URL to its final location */\n\tresolveUrl = resolveUrl;\n\t/** Check if two URLs resolve to the same location */\n\tprotected isSameResolvedUrl = isSameResolvedUrl;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\t// Merge defaults and options\n\t\tthis.options = { ...this.defaults, ...options };\n\n\t\tthis.handleLinkClick = this.handleLinkClick.bind(this);\n\t\tthis.handlePopState = this.handlePopState.bind(this);\n\n\t\tthis.cache = new Cache(this);\n\t\tthis.classes = new Classes(this);\n\t\tthis.hooks = new Hooks(this);\n\t\tthis.visit = this.createVisit({ to: '' });\n\n\t\tthis.currentHistoryIndex = (window.history.state as HistoryState)?.index ?? 1;\n\n\t\tthis.enable();\n\t}\n\n\t/** Enable this instance, adding listeners and classnames. */\n\tasync enable() {\n\t\t// Add event listener\n\t\tconst { linkSelector } = this.options;\n\t\tthis.clickDelegate = this.delegateEvent(linkSelector, 'click', this.handleLinkClick);\n\n\t\twindow.addEventListener('popstate', this.handlePopState);\n\n\t\t// Set scroll restoration to manual if animating history visits\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t// Initial save to cache\n\t\tif (this.options.cache) {\n\t\t\t// Disabled to avoid caching modified dom state: logic moved to preload plugin\n\t\t\t// https://github.com/swup/swup/issues/475\n\t\t}\n\n\t\t// Sanitize/check native option\n\t\tthis.options.native = this.options.native && !!document.startViewTransition;\n\n\t\t// Mount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.use(plugin));\n\n\t\t// Install user hooks\n\t\tfor (const [key, handler] of Object.entries(this.options.hooks)) {\n\t\t\t// Build hook options from modifier suffix: 'content:replace.before' => { before: true }\n\t\t\tconst [hook, modifiers] = this.hooks.parseName(key as HookName);\n\t\t\t// @ts-expect-error: object.entries() does not preserve key/value types\n\t\t\tthis.hooks.on(hook, handler, modifiers);\n\t\t}\n\n\t\t// Create initial history record\n\t\tif ((window.history.state as HistoryState)?.source !== 'swup') {\n\t\t\tupdateHistoryRecord(null, { index: this.currentHistoryIndex });\n\t\t}\n\n\t\t// Give consumers a chance to hook into enable\n\t\tawait nextTick();\n\n\t\t// Trigger enable hook\n\t\tawait this.hooks.call('enable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.add('swup-enabled');\n\t\t\thtml.classList.toggle('swup-native', this.options.native);\n\t\t});\n\t}\n\n\t/** Disable this instance, removing listeners and classnames. */\n\tasync destroy() {\n\t\t// remove delegated listener\n\t\tthis.clickDelegate!.destroy();\n\n\t\t// remove popstate listener\n\t\twindow.removeEventListener('popstate', this.handlePopState);\n\n\t\t// empty cache\n\t\tthis.cache.clear();\n\n\t\t// unmount plugins\n\t\tthis.options.plugins.forEach((plugin) => this.unuse(plugin));\n\n\t\t// trigger disable hook\n\t\tawait this.hooks.call('disable', undefined, undefined, () => {\n\t\t\tconst html = document.documentElement;\n\t\t\thtml.classList.remove('swup-enabled');\n\t\t\thtml.classList.remove('swup-native');\n\t\t});\n\n\t\t// remove handlers\n\t\tthis.hooks.clear();\n\t}\n\n\t/** Determine if a visit should be ignored by swup, based on URL or trigger element. */\n\tshouldIgnoreVisit(href: string, { el, event }: { el?: Element; event?: Event } = {}) {\n\t\tconst { origin, url, hash } = Location.fromUrl(href);\n\n\t\t// Ignore if the new origin doesn't match the current one\n\t\tif (origin !== window.location.origin) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the link/form would open a new window (or none at all)\n\t\tif (el && this.triggerWillOpenNewWindow(el)) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Ignore if the visit should be ignored as per user options\n\t\tif (this.options.ignoreVisit(url + hash, { el, event })) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Finally, allow the visit\n\t\treturn false;\n\t}\n\n\tprotected handleLinkClick(event: DelegateEvent<MouseEvent>) {\n\t\tconst el = event.delegateTarget as HTMLAnchorElement;\n\t\tconst { href, url, hash } = Location.fromElement(el);\n\n\t\t// Exit early if the link should be ignored\n\t\tif (this.shouldIgnoreVisit(href, { el, event })) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Ignore if swup is currently navigating towards the link's URL\n\t\tif (this.navigating && url === this.visit.to.url) {\n\t\t\tevent.preventDefault();\n\t\t\treturn;\n\t\t}\n\n\t\tconst visit = this.createVisit({ to: url, hash, el, event });\n\n\t\t// Exit early if control key pressed\n\t\tif (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {\n\t\t\tthis.hooks.callSync('link:newtab', visit, { href });\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if other than left mouse button\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.hooks.callSync('link:click', visit, { el, event }, () => {\n\t\t\tconst from = visit.from.url ?? '';\n\n\t\t\tevent.preventDefault();\n\n\t\t\t// Handle links to the same page\n\t\t\tif (!url || url === from) {\n\t\t\t\tif (hash) {\n\t\t\t\t\t// With hash: scroll to anchor\n\t\t\t\t\tthis.hooks.callSync('link:anchor', visit, { hash }, () => {\n\t\t\t\t\t\tupdateHistoryRecord(url + hash);\n\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Without hash: scroll to top or load/reload page\n\t\t\t\t\tthis.hooks.callSync('link:self', visit, undefined, () => {\n\t\t\t\t\t\tif (this.options.linkToSelf === 'navigate') {\n\t\t\t\t\t\t\tthis.performNavigation(visit);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tupdateHistoryRecord(url);\n\t\t\t\t\t\t\tthis.scrollToContent(visit);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Exit early if the resolved path hasn't changed\n\t\t\tif (this.isSameResolvedUrl(url, from)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Finally, proceed with loading the page\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\tprotected handlePopState(event: PopStateEvent) {\n\t\tconst href: string = (event.state as HistoryState)?.url ?? window.location.href;\n\n\t\t// Exit early if this event should be ignored\n\t\tif (this.options.skipPopStateHandling(event)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Exit early if the resolved path hasn't changed\n\t\tif (this.isSameResolvedUrl(getCurrentUrl(), this.location.url)) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { url, hash } = Location.fromUrl(href);\n\n\t\tconst visit = this.createVisit({ to: url, hash, event });\n\n\t\t// Mark as history visit\n\t\tvisit.history.popstate = true;\n\n\t\t// Determine direction of history visit\n\t\tconst index = (event.state as HistoryState)?.index ?? 0;\n\t\tif (index && index !== this.currentHistoryIndex) {\n\t\t\tconst direction = index - this.currentHistoryIndex > 0 ? 'forwards' : 'backwards';\n\t\t\tvisit.history.direction = direction;\n\t\t\tthis.currentHistoryIndex = index;\n\t\t}\n\n\t\t// Disable animation & scrolling for history visits\n\t\tvisit.animation.animate = false;\n\t\tvisit.scroll.reset = false;\n\t\tvisit.scroll.target = false;\n\n\t\t// Animated history visit: re-enable animation & scroll reset\n\t\tif (this.options.animateHistoryBrowsing) {\n\t\t\tvisit.animation.animate = true;\n\t\t\tvisit.scroll.reset = true;\n\t\t}\n\n\t\tthis.hooks.callSync('history:popstate', visit, { event }, () => {\n\t\t\tthis.performNavigation(visit);\n\t\t});\n\t}\n\n\t/** Determine whether an element will open a new tab when clicking/activating. */\n\tprotected triggerWillOpenNewWindow(triggerEl: Element) {\n\t\tif (triggerEl.matches('[download], [target=\"_blank\"]')) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"names":["ledger","WeakMap","editLedger","wanted","baseElement","callback","setup","has","elementMap","get","set","setups","Set","existed","add","delete","classify","text","fallback","String","toLowerCase","replace","getCurrentUrl","_temp","hash","window","location","pathname","search","updateHistoryRecord","url","data","state","history","random","Math","source","replaceState","delegateEvent","selector","type","options","controller","AbortController","signal","base","document","aborted","once","nativeListenerOptions","Document","documentElement","capture","Boolean","listenerFunction","event","delegateTarget","target","Text","parentElement","Element","currentTarget","closest","contains","safeClosest","Object","assign","call","removeEventListener","JSON","stringify","addEventListener","delegate","destroy","abort","Location","URL","constructor","baseURI","super","toString","setPrototypeOf","this","prototype","fromElement","el","href","getAttribute","fromUrl","fetchPage","_this","_temp2","_result","status","responseUrl","response","Promise","resolve","then","html","hooks","visit","FetchError","finalUrl","page","cache","write","method","headers","requestHeaders","timeout","timedOut","timeoutId","setTimeout","_ref","fetch","_this$hooks$call","clearTimeout","_catch","error","name","e","reject","Error","message","details","Cache","swup","pages","Map","size","all","copy","forEach","key","result","callSync","undefined","update","payload","clear","prune","predicate","urlToResolve","resolveUrl","query","context","querySelector","queryAll","Array","from","querySelectorAll","nextTick","requestAnimationFrame","isPromise","obj","getContextualAttr","attr","hasAttribute","Classes","swupClasses","selectors","scope","animation","containers","isArray","join","targets","trim","classList","slice","arguments","remove","className","split","filter","c","isSwupClass","some","startsWith","Visit","id","to","trigger","scroll","meta","animate","wait","native","animationScope","animationSelector","read","action","popstate","direction","reset","advance","done","createVisit","_iteratorSymbol","Symbol","iterator","pact","value","s","_Pact","o","_settle","bind","v","observer","onFulfilled","onRejected","thenable","Hooks","registry","init","hook","create","exists","console","on","handler","warn","registration","off","before","arg1","arg2","arg3","args","defaultHandler","parseCallArgs","after","getHandlers","run","dispatchDomEvent","runSync","registrations","rethrow","_exit","_this2","results","body","check","step","_cycle","next","return","_fixup","TypeError","i","length","push","array","_isSettledPact","_forTo","values","_forOf","_ref2","func","runAsPromise","_result2","found","replaced","sort","sortRegistrations","_ref3","_ref4","T","_ref5","index","replacingHandler","createDefaultHandler","a","b","priority","detail","dispatchEvent","CustomEvent","bubbles","parseName","modifiers","reduce","acc","mod","getAnchorElement","charAt","substring","decoded","decodeURIComponent","element","getElementById","CSS","escape","awaitAnimations","elements","animatedElements","awaitedAnimations","map","propCount","styles","getComputedStyle","transitionDelays","getStyleProperties","TRANSITION","transitionDurations","transitionTimeout","calculateTimeout","animationDelays","ANIMATION","animationDurations","animationTimeout","max","getTransitionInfo","endEvent","startTime","performance","now","propsTransitioned","end","onEnd","elapsedTime","awaitAnimationsOnElement","delays","durations","concat","duration","toMs","time","parseFloat","performNavigation","_temp4","navigating","referrer","classes","includes","_exit2","_temp8","_result4","animatePageOut","_temp6","animatePageIn","_temp5","startViewTransition","_renderPage3","renderPage","_page3","finished","_renderPage2","_page2","_temp7","_renderPage","_page","onVisitEnd","_temp9","_this$fetchPage","cachedPage","DOMParser","parseFromString","newUrl","currentHistoryIndex","pushState","createHistoryRecord","skipPopStateHandling","back","_finallyRethrows","_wasThrown","_result3","_temp3","navigate","shouldIgnoreVisit","skip","replaceContent","incomingDocument","title","innerText","persistedElements","currentEl","incomingEl","replaceWith","cloneNode","existing","replacement","scrollToContent","behavior","scrollTarget","scrolled","anchor","scrollIntoView","scrollTo","top","left","isSameResolvedUrl","use","plugin","maybeInvalidPlugin","isSwupPlugin","_checkRequirements","_beforeMount","mount","plugins","unuse","pluginOrName","findPlugin","unmount","_afterUnmount","p","find","url1","url2","defaults","animateHistoryBrowsing","ignoreVisit","linkSelector","linkToSelf","Accept","currentPageUrl","version","clickDelegate","log","handleLinkClick","handlePopState","enable","scrollRestoration","entries","toggle","origin","triggerWillOpenNewWindow","preventDefault","metaKey","ctrlKey","shiftKey","altKey","button","triggerEl","matches"],"mappings":"uNACA,MAAMA,EAAS,IAAIC,QACnB,SAASC,E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AUuB,SAAU,EAC1BrF,EAAMmF,OAAOW,OAAQ,EACrB9F,EAAMmF,OAAO/H,QAAS,EAGlByB,KAAKzC,QAAQmX,yBAChBvT,EAAM8D,UAAUuB,SAAU,EAC1BrF,EAAMmF,OAAOW,OAAQ,GAGtBjH,KAAKkB,MAAMoC,SAAS,mBAAoBnC,EAAO,CAAE9C,SAAS,KACzD2B,KAAKyP,kBAAkBtO,EACxB,EACD,CAGUuU,wBAAAA,CAAyBO,GAClC,QAAIA,EAAUC,QAAQ,gCAIvB"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/Swup.d.ts b/node_modules/swup/dist/types/Swup.d.ts
index 523a9969..17bfc0d9 100644
--- a/node_modules/swup/dist/types/Swup.d.ts
+++ b/node_modules/swup/dist/types/Swup.d.ts
@@ -4,7 +4,7 @@ import { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';
import { Cache } from './modules/Cache.js';
import { Classes } from './modules/Classes.js';
import { type Visit, createVisit } from './modules/Visit.js';
-import { Hooks } from './modules/Hooks.js';
+import { Hooks, type HookInitOptions } from './modules/Hooks.js';
import { awaitAnimations } from './modules/awaitAnimations.js';
import { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';
import { fetchPage } from './modules/fetchPage.js';
@@ -33,6 +33,8 @@ export type Options = {
linkToSelf: NavigationToSelfAction;
/** Enable native animations using the View Transitions API. */
native: boolean;
+ /** Hook handlers to register. */
+ hooks: Partial<HookInitOptions>;
/** Plugins to register on startup. */
plugins: Plugin[];
/** Custom headers sent along with fetch requests. */
@@ -89,7 +91,7 @@ export default class Swup {
/** Create a new context for this visit */
protected createVisit: typeof createVisit;
/** Register a delegated event listener */
- delegateEvent: <Selector extends string, TElement extends Element = import("typed-query-selector/parser.js").ParseSelector<Selector, HTMLElement>, TEvent extends keyof GlobalEventHandlersEventMap = keyof GlobalEventHandlersEventMap>(selector: Selector, type: TEvent, callback: import("delegate-it").DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>, options?: import("delegate-it").DelegateOptions | undefined) => DelegateEventUnsubscribe;
+ delegateEvent: <Selector extends string, TElement extends Element = import("typed-query-selector/parser.js").ParseSelector<Selector, HTMLElement>, TEvent extends import("delegate-it").EventType = keyof GlobalEventHandlersEventMap>(selector: Selector, type: TEvent, callback: import("delegate-it").DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>, options?: import("delegate-it").DelegateOptions) => DelegateEventUnsubscribe;
/** Fetch a page from the server */
fetchPage: typeof fetchPage;
/** Resolve when animations on the page finish */
@@ -101,10 +103,10 @@ export default class Swup {
protected animatePageOut: (this: Swup, visit: Visit) => Promise<void>;
protected scrollToContent: (this: Swup, visit: Visit) => boolean;
/** Find the anchor element for a given hash */
- getAnchorElement: (hash?: string | undefined) => Element | null;
+ getAnchorElement: (hash?: string) => Element | null;
/** Get the current page URL */
getCurrentUrl: ({ hash }?: {
- hash?: boolean | undefined;
+ hash?: boolean;
}) => string;
/** Resolve a URL to its final location */
resolveUrl: typeof resolveUrl;
diff --git a/node_modules/swup/dist/types/Swup.d.ts.map b/node_modules/swup/dist/types/Swup.d.ts.map
index 7fa2d96b..d3d81efa 100644
--- a/node_modules/swup/dist/types/Swup.d.ts.map
+++ b/node_modules/swup/dist/types/Swup.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"Swup.d.ts","sourceRoot":"","sources":["../../src/Swup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,OAAO,EAAgC,QAAQ,EAAuB,MAAM,cAAc,CAAC;AAC3F,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,KAAK,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,KAA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S,EAAE,OAAO;CAMrD"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/helpers/delegateEvent.d.ts b/node_modules/swup/dist/types/helpers/delegateEvent.d.ts
index 9fa626dc..bfb7f0b6 100644
--- a/node_modules/swup/dist/types/helpers/delegateEvent.d.ts
+++ b/node_modules/swup/dist/types/helpers/delegateEvent.d.ts
@@ -1,8 +1,8 @@
-import { type DelegateEventHandler, type DelegateOptions } from 'delegate-it';
+import { type DelegateEventHandler, type DelegateOptions, type EventType } from 'delegate-it';
import type { ParseSelector } from 'typed-query-selector/parser.js';
export type DelegateEventUnsubscribe = {
destroy: () => void;
};
/** Register a delegated event listener. */
-export declare const delegateEvent: <Selector extends string, TElement extends Element = ParseSelector<Selector, HTMLElement>, TEvent extends keyof GlobalEventHandlersEventMap = keyof GlobalEventHandlersEventMap>(selector: Selector, type: TEvent, callback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>, options?: DelegateOptions) => DelegateEventUnsubscribe;
+export declare const delegateEvent: <Selector extends string, TElement extends Element = ParseSelector<Selector, HTMLElement>, TEvent extends EventType = keyof GlobalEventHandlersEventMap>(selector: Selector, type: TEvent, callback: DelegateEventHandler<GlobalEventHandlersEventMap[TEvent], TElement>, options?: DelegateOptions) => DelegateEventUnsubscribe;
//# sourceMappingURL=delegateEvent.d.ts.map \ No newline at end of file
diff --git a/node_modules/swup/dist/types/helpers/delegateEvent.d.ts.map b/node_modules/swup/dist/types/helpers/delegateEvent.d.ts.map
index 14d4c0a6..1add1a02 100644
--- a/node_modules/swup/dist/types/helpers/delegateEvent.d.ts.map
+++ b/node_modules/swup/dist/types/helpers/delegateEvent.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"delegateEvent.d.ts","sourceRoot":"","sources":["../../../src/helpers/delegateEvent.ts"],"names":[],"mappings":"AAAA,OAAiB,EAChB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EAEpB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,6LAKf,QAAQ,QACZ,MAAM,YACF,qBAAqB,2BAA2B,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,YACnE,eAAe,KACvB,wBAKF,CAAC"} \ No newline at end of file
+{"version":3,"file":"delegateEvent.d.ts","sourceRoot":"","sources":["../../../src/helpers/delegateEvent.ts"],"names":[],"mappings":"AAAA,OAAiB,EAChB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG;IACtC,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,GACzB,QAAQ,SAAS,MAAM,EACvB,QAAQ,SAAS,OAAO,yCACxB,MAAM,SAAS,SAAS,gDAEd,QAAQ,QACZ,MAAM,YACF,oBAAoB,CAAC,2BAA2B,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,YACnE,eAAe,KACvB,wBAKF,CAAC"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/helpers/matchPath.d.ts.map b/node_modules/swup/dist/types/helpers/matchPath.d.ts.map
index 3878e3d7..b70c0762 100644
--- a/node_modules/swup/dist/types/helpers/matchPath.d.ts.map
+++ b/node_modules/swup/dist/types/helpers/matchPath.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,IAAI,EACJ,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,oFAAoF;AACpF,eAAO,MAAM,SAAS,oCACf,IAAI,YACA,YAAY,GAAG,qBAAqB,GAAG,uBAAuB,KACtE,cAAc,CAAC,CAMjB,CAAC"} \ No newline at end of file
+{"version":3,"file":"matchPath.d.ts","sourceRoot":"","sources":["../../../src/helpers/matchPath.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,IAAI,EACJ,YAAY,EACZ,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC;AAErB,oFAAoF;AACpF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,iBACnC,IAAI,YACA,YAAY,GAAG,qBAAqB,GAAG,uBAAuB,KACtE,aAAa,CAAC,CAAC,CAMjB,CAAC"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/modules/Hooks.d.ts b/node_modules/swup/dist/types/modules/Hooks.d.ts
index 2de88cc9..172892d5 100644
--- a/node_modules/swup/dist/types/modules/Hooks.d.ts
+++ b/node_modules/swup/dist/types/modules/Hooks.d.ts
@@ -80,6 +80,8 @@ export interface HookReturnValues {
}
export type HookArguments<T extends HookName> = HookDefinitions[T];
export type HookName = keyof HookDefinitions;
+export type HookNameWithModifier = `${HookName}.${HookModifier}`;
+type HookModifier = 'once' | 'before' | 'replace';
/** A generic hook handler. */
export type HookHandler<T extends HookName> = (
/** Context about the current visit. */
@@ -97,6 +99,11 @@ defaultHandler?: HookDefaultHandler<T>) => T extends keyof HookReturnValues ? Ho
export type Handlers = {
[K in HookName]: HookHandler<K>[];
};
+export type HookInitOptions = {
+ [K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;
+} & {
+ [K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;
+};
/** Unregister a previously registered hook handler. */
export type HookUnregister = () => void;
/** Define when and how a hook handler is executed. */
@@ -283,6 +290,11 @@ export declare class Hooks {
* @param hook Name of the hook.
*/
protected dispatchDomEvent<T extends HookName>(hook: T, visit: Visit | undefined, args?: HookArguments<T>): void;
+ /**
+ * Parse a hook name into the name and any modifiers.
+ * @param hook Name of the hook.
+ */
+ parseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>];
}
export {};
//# sourceMappingURL=Hooks.d.ts.map \ No newline at end of file
diff --git a/node_modules/swup/dist/types/modules/Hooks.d.ts.map b/node_modules/swup/dist/types/modules/Hooks.d.ts.map
index bbdee701..e6e6d82e 100644
--- a/node_modules/swup/dist/types/modules/Hooks.d.ts.map
+++ b/node_modules/swup/dist/types/modules/Hooks.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"Hooks.d.ts","sourceRoot":"","sources":["../../../src/modules/Hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,WAAW,eAAe;IAC/B,qBAAqB,EAAE,SAAS,CAAC;IACjC,qBAAqB,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACzC,mBAAmB,EAAE,SAAS,CAAC;IAC/B,oBAAoB,EAAE,SAAS,CAAC;IAChC,oBAAoB,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACxC,kBAAkB,EAAE,SAAS,CAAC;IAC9B,gBAAgB,EAAE,SAAS,CAAC;IAC5B,aAAa,EAAE,SAAS,CAAC;IACzB,WAAW,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IAChC,iBAAiB,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IACtC,gBAAgB,EAAE,SAAS,CAAC;IAC5B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E,QAAQ,GAAG,oBAAoB,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CAKlF"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/modules/Visit.d.ts b/node_modules/swup/dist/types/modules/Visit.d.ts
index 7fb15ec6..728a1c19 100644
--- a/node_modules/swup/dist/types/modules/Visit.d.ts
+++ b/node_modules/swup/dist/types/modules/Visit.d.ts
@@ -85,6 +85,8 @@ export declare class Visit {
history: VisitHistory;
/** Scroll behavior on this visit */
scroll: VisitScroll;
+ /** User-defined metadata */
+ meta: Record<string, unknown>;
constructor(swup: Swup, options: VisitInitOptions);
/** Is this visit done, i.e. completed, failed, or aborted? */
get done(): boolean;
diff --git a/node_modules/swup/dist/types/modules/Visit.d.ts.map b/node_modules/swup/dist/types/modules/Visit.d.ts.map
index e70e36ec..48734a80 100644
--- a/node_modules/swup/dist/types/modules/Visit.d.ts.map
+++ b/node_modules/swup/dist/types/modules/Visit.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"Visit.d.ts","sourceRoot":"","sources":["../../../src/modules/Visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErE,kDAAkD;AAGlD,MAAM,WAAW,SAAS;IACzB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,OAAO;IACvB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED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AS,CAAC;IAChB,oCAAoC;IACpC,EAAE,EAAE,OAAO,CAAC;IACZ,mDAAmD;IACnD,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,kDAAkD;IAClD,SAAS,EAAE,cAAc,CAAC;IAC1B,gCAAgC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,oCAAoC;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,6CAA6C;IAC7C,OAAO,EAAE,YAAY,CAAC;IACtB,oCAAoC;IACpC,MAAM,EAAE,WAAW,CAAC;gBAER,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB;IA2CjD,8DAA8D;IAC9D,IAAI,IAAI,IAAI,OAAO,CAElB;CACD;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,CAExE"} \ No newline at end of file
+{"version":3,"file":"Visit.d.ts","sourceRoot":"","sources":["../../../src/modules/Visit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAErE,kDAAkD;AAGlD,MAAM,WAAW,SAAS;IACzB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,OAAO;IACvB,+BAA+B;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC9B,sDAAsD;IACtD,OAAO,EAAE,OAAO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,mDAAmD;IACnD,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAClC,kDAAkD;IAClD,SAAS,EAAE,cAAc,CAAC;IAC1B,gCAAgC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,oCAAoC;IACpC,KAAK,EAAE,UAAU,CAAC;IAClB,6CAA6C;IAC7C,OAAO,EAAE,YAAY,CAAC;IACtB,oCAAoC;IACpC,MAAM,EAAE,WAAW,CAAC;IACpB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAElB,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB;IA6CjD,8DAA8D;IAC9D,IAAI,IAAI,IAAI,OAAO,CAElB;CACD;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,GAAG,KAAK,CAExE"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/modules/navigate.d.ts b/node_modules/swup/dist/types/modules/navigate.d.ts
index b4b74a2d..a40667c6 100644
--- a/node_modules/swup/dist/types/modules/navigate.d.ts
+++ b/node_modules/swup/dist/types/modules/navigate.d.ts
@@ -18,6 +18,8 @@ type NavigationOptions = {
history?: HistoryAction;
/** Whether this visit should read from or write to the cache. */
cache?: CacheControl;
+ /** Custom metadata associated with this visit. */
+ meta?: Record<string, unknown>;
};
/**
* Navigate to a new URL.
diff --git a/node_modules/swup/dist/types/modules/navigate.d.ts.map b/node_modules/swup/dist/types/modules/navigate.d.ts.map
index 9ca0c759..f38abccf 100644
--- a/node_modules/swup/dist/types/modules/navigate.d.ts.map
+++ b/node_modules/swup/dist/types/modules/navigate.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"navigate.d.ts","sourceRoot":"","sources":["../../../src/modules/navigate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAc,KAAK,YAAY,EAAiB,M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KAAK,EAAc,MAAM,YAAY,CAAC;AAI3E,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/C,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,CAAC;AACxD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEtE,wCAAwC;AACxC,KAAK,iBAAiB,GAAG;IACxB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qIAAqI;IACrI,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,iEAAiE;IACjE,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,QAAQ,CACvB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,iBAAiB,GAAG,YAAiB,EAC9C,IAAI,GAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAM,QAgBvC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,iBAAiB,GAAG,YAAiB,GAC5C,OAAO,CAAC,IAAI,CAAC,CA0Kf"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/modules/renderPage.d.ts.map b/node_modules/swup/dist/types/modules/renderPage.d.ts.map
index 6916e317..aca397ac 100644
--- a/node_modules/swup/dist/types/modules/renderPage.d.ts.map
+++ b/node_modules/swup/dist/types/modules/renderPage.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"renderPage.d.ts","sourceRoot":"","sources":["../../../src/modules/renderPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,UAAU,SAAyB,IAAI,SAAS,KAAK,QAAQ,QAAQ,KAAG,QAAQ,IAAI,CA0ChG,CAAC"} \ No newline at end of file
+{"version":3,"file":"renderPage.d.ts","sourceRoot":"","sources":["../../../src/modules/renderPage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAc,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,UAAU,SAAyB,IAAI,SAAS,KAAK,QAAQ,QAAQ,KAAG,OAAO,CAAC,IAAI,CA0ChG,CAAC"} \ No newline at end of file
diff --git a/node_modules/swup/dist/types/utils/index.d.ts.map b/node_modules/swup/dist/types/utils/index.d.ts.map
index 7a4b4460..391876d6 100644
--- a/node_modules/swup/dist/types/utils/index.d.ts.map
+++ b/node_modules/swup/dist/types/utils/index.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,eAAO,MAAM,KAAK,aAAc,MAAM,YAAW,QAAQ,GAAG,OAAO,uBAElE,CAAC;AAEF,0CAA0C;AAC1C,eAAO,MAAM,QAAQ,aACV,MAAM,YACP,QAAQ,GAAG,OAAO,KACzB,WAAW,EAEb,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,QAAQ,QAAO,QAAQ,IAAI,CAQvC,CAAC;AAEF,oDAAoD;AACpD,wBAAgB,SA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AG,SAAS,CAG9B"} \ No newline at end of file
diff --git a/node_modules/swup/package.json b/node_modules/swup/package.json
index a7d8652c..9987e7c9 100755
--- a/node_modules/swup/package.json
+++ b/node_modules/swup/package.json
@@ -1,7 +1,7 @@
{
"name": "swup",
"amdName": "Swup",
- "version": "4.7.0",
+ "version": "4.8.1",
"description": "Versatile and extensible page transition library for server-rendered websites",
"type": "module",
"source": "./src/Swup.ts",
@@ -44,7 +44,7 @@
"test:e2e:instrument": "nyc instrument --compact=false dist tests/fixtures/dist",
"test:e2e:serve": "npx serve -n -S -L -p 8274 --config ./tests/config/serve.json",
"test:e2e:start": "npm run test:e2e:instrument && npm run test:e2e:serve",
- "prepare": "husky install"
+ "prepare": "husky"
},
"author": "Georgy Marchuk",
"license": "MIT",
@@ -79,14 +79,14 @@
"eslint-plugin-prettier": "^5.0.1",
"husky": "^9.0.11",
"istanbul-lib-coverage": "^3.2.0",
- "jsdom": "^24.1.0",
+ "jsdom": "^25.0.1",
"microbundle": "^0.15.0",
"nyc": "^17.0.0",
"prettier": "^3.1.0",
"serve": "^14.2.1",
"typed-query-selector": "^2.11.0",
"typescript": "^5.2.2",
- "vitest": "^1.0.2"
+ "vitest": "^2.1.1"
},
"collective": {
"type": "opencollective",
diff --git a/node_modules/swup/src/Swup.ts b/node_modules/swup/src/Swup.ts
index 8d5d769e..7fb76f06 100644
--- a/node_modules/swup/src/Swup.ts
+++ b/node_modules/swup/src/Swup.ts
@@ -8,7 +8,7 @@ import { type DelegateEventUnsubscribe } from './helpers/delegateEvent.js';
import { Cache } from './modules/Cache.js';
import { Classes } from './modules/Classes.js';
import { type Visit, createVisit } from './modules/Visit.js';
-import { Hooks } from './modules/Hooks.js';
+import { Hooks, type HookName, type HookInitOptions } from './modules/Hooks.js';
import { getAnchorElement } from './modules/getAnchorElement.js';
import { awaitAnimations } from './modules/awaitAnimations.js';
import { navigate, performNavigation, type NavigationToSelfAction } from './modules/navigate.js';
@@ -43,6 +43,8 @@ export type Options = {
linkToSelf: NavigationToSelfAction;
/** Enable native animations using the View Transitions API. */
native: boolean;
+ /** Hook handlers to register. */
+ hooks: Partial<HookInitOptions>;
/** Plugins to register on startup. */
plugins: Plugin[];
/** Custom headers sent along with fetch requests. */
@@ -61,6 +63,7 @@ const defaults: Options = {
animationScope: 'html',
cache: true,
containers: ['#swup'],
+ hooks: {},
ignoreVisit: (url, { el } = {}) => !!el?.closest('[data-no-swup]'),
linkSelector: 'a[href]',
linkToSelf: 'scroll',
@@ -188,6 +191,14 @@ export default class Swup {
// Mount plugins
this.options.plugins.forEach((plugin) => this.use(plugin));
+ // Install user hooks
+ for (const [key, handler] of Object.entries(this.options.hooks)) {
+ // Build hook options from modifier suffix: 'content:replace.before' => { before: true }
+ const [hook, modifiers] = this.hooks.parseName(key as HookName);
+ // @ts-expect-error: object.entries() does not preserve key/value types
+ this.hooks.on(hook, handler, modifiers);
+ }
+
// Create initial history record
if ((window.history.state as HistoryState)?.source !== 'swup') {
updateHistoryRecord(null, { index: this.currentHistoryIndex });
diff --git a/node_modules/swup/src/modules/Hooks.ts b/node_modules/swup/src/modules/Hooks.ts
index 36af2bf7..e3fb459c 100644
--- a/node_modules/swup/src/modules/Hooks.ts
+++ b/node_modules/swup/src/modules/Hooks.ts
@@ -49,6 +49,10 @@ export type HookArguments<T extends HookName> = HookDefinitions[T];
export type HookName = keyof HookDefinitions;
+export type HookNameWithModifier = `${HookName}.${HookModifier}`;
+
+type HookModifier = 'once' | 'before' | 'replace';
+
/** A generic hook handler. */
export type HookHandler<T extends HookName> = (
/** Context about the current visit. */
@@ -71,6 +75,12 @@ export type Handlers = {
[K in HookName]: HookHandler<K>[];
};
+export type HookInitOptions = {
+ [K in HookName as K | `${K}.${HookModifier}`]: HookHandler<K>;
+} & {
+ [K in HookName as K | `${K}.${HookModifier}.${HookModifier}`]: HookHandler<K>;
+};
+
/** Unregister a previously registered hook handler. */
export type HookUnregister = () => void;
@@ -516,7 +526,7 @@ export class Hooks {
handler = [{ id: 0, hook, handler: defaultHandler }];
if (replaced) {
const index = replace.length - 1;
- const replacingHandler = replace[index].handler;
+ const { handler: replacingHandler, once } = replace[index];
const createDefaultHandler = (index: number): HookDefaultHandler<T> | undefined => {
const next = replace[index - 1];
if (next) {
@@ -527,9 +537,7 @@ export class Hooks {
}
};
const nestedDefaultHandler = createDefaultHandler(index);
- handler = [
- { id: 0, hook, handler: replacingHandler, defaultHandler: nestedDefaultHandler }
- ];
+ handler = [{ id: 0, hook, once, handler: replacingHandler, defaultHandler: nestedDefaultHandler }]; // prettier-ignore
}
}
@@ -570,4 +578,14 @@ export class Hooks {
new CustomEvent<HookEventDetail>(`swup:${hook}`, { detail, bubbles: true })
);
}
+
+ /**
+ * Parse a hook name into the name and any modifiers.
+ * @param hook Name of the hook.
+ */
+ parseName(hook: HookName | HookNameWithModifier): [HookName, Partial<HookOptions>] {
+ const [name, ...modifiers] = hook.split('.');
+ const options = modifiers.reduce((acc, mod) => ({ ...acc, [mod]: true }), {});
+ return [name as HookName, options];
+ }
}
diff --git a/node_modules/swup/src/modules/Visit.ts b/node_modules/swup/src/modules/Visit.ts
index b0d5d271..17ed6c7d 100644
--- a/node_modules/swup/src/modules/Visit.ts
+++ b/node_modules/swup/src/modules/Visit.ts
@@ -114,6 +114,8 @@ export class Visit {
history: VisitHistory;
/** Scroll behavior on this visit */
scroll: VisitScroll;
+ /** User-defined metadata */
+ meta: Record<string, unknown>;
constructor(swup: Swup, options: VisitInitOptions) {
const { to, from, hash, el, event } = options;
@@ -145,7 +147,9 @@ export class Visit {
reset: true,
target: undefined
};
+ this.meta = {};
}
+
/** @internal */
advance(state: VisitState) {
if (this.state < state) {
diff --git a/node_modules/swup/src/modules/navigate.ts b/node_modules/swup/src/modules/navigate.ts
index 7793f891..ac88935b 100755
--- a/node_modules/swup/src/modules/navigate.ts
+++ b/node_modules/swup/src/modules/navigate.ts
@@ -19,6 +19,8 @@ type NavigationOptions = {
history?: HistoryAction;
/** Whether this visit should read from or write to the cache. */
cache?: CacheControl;
+ /** Custom metadata associated with this visit. */
+ meta?: Record<string, unknown>;
};
/**
@@ -106,6 +108,9 @@ export async function performNavigation(
visit.animation.name = animation;
}
+ // Get custom metadata from option
+ visit.meta = options.meta || {};
+
// Sanitize cache option
if (typeof options.cache === 'object') {
visit.cache.read = options.cache.read ?? visit.cache.read;