{"version":3,"file":"index.cjs","sources":["../node_modules/swup/dist/Swup.modern.js","../src/index.ts"],"sourcesContent":["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)=>{Array.isArray(t)&&!t.length&&(t=\"\");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=A(e,`${U}Delay`),s=A(e,`${U}Duration`),n=x(i,s),o=A(e,`${P}Delay`),r=A(e,`${P}Duration`),a=x(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 A(t,e){return(t[e]||\"\").split(\", \")}function x(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.2\",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};\n//# sourceMappingURL=Swup.modern.js.map\n","import Plugin from '@swup/plugin';\nimport { type Handler, type Visit, queryAll } from 'swup';\nimport { compute as computeRequiredScrollActions } from 'compute-scroll-into-view';\n\nexport type OffsetCallback = (\n\tscrollTarget: Element,\n\tscrollContainer: Element,\n\tposition: ScrollPosition\n) => number | ScrollPosition;\n\nexport type Options = {\n\tdoScrollingRightAway: boolean;\n\tanimateScroll: {\n\t\tbetweenPages: boolean;\n\t\tsamePageWithHash: boolean;\n\t\tsamePage: boolean;\n\t};\n\tgetAnchorElement?: (hash: string) => Element | null;\n\toffset: number | ScrollPosition | OffsetCallback;\n\tscrollContainers: `[data-swup-scroll-container]`;\n\tshouldResetScrollPosition: (trigger: Element) => boolean;\n\tmarkScrollTarget?: boolean;\n\tscrollFunction?: (\n\t\tel: Element,\n\t\ttop: number,\n\t\tleft: number,\n\t\tanimate: boolean,\n\t\tstart: () => void,\n\t\tend: () => void\n\t) => void;\n};\n\ntype ScrollPosition = {\n\ttop: number;\n\tleft: number;\n};\n\ntype ScrollPositionsCacheEntry = {\n\twindow: ScrollPosition;\n\tcontainers: ScrollPosition[];\n};\n\ntype ScrollPositionsCache = Record<string, ScrollPositionsCacheEntry>;\n\ndeclare module 'swup' {\n\texport interface Swup {\n\t\tscrollTo?: (\n\t\t\tposition: number | ScrollPosition,\n\t\t\tanimate?: boolean,\n\t\t\tscrollContainer?: Element\n\t\t) => void;\n\t}\n\n\texport interface VisitScroll {\n\t\t/** Whether scrolling is animated. Set by Scroll Plugin. */\n\t\tanimate?: boolean;\n\t\t/** Whether the scroll position was reset after page load. Set by Scroll Plugin. */\n\t\tscrolledToContent?: boolean;\n\t}\n\n\texport interface HookDefinitions {\n\t\t'scroll:start': undefined;\n\t\t'scroll:end': undefined;\n\t}\n}\n\n/**\n * Scroll Plugin\n */\nexport default class SwupScrollPlugin extends Plugin {\n\tname = 'SwupScrollPlugin';\n\n\trequires = { swup: '>=4.2.0' };\n\n\tdefaults: Options = {\n\t\tdoScrollingRightAway: false,\n\t\tanimateScroll: {\n\t\t\tbetweenPages: true,\n\t\t\tsamePageWithHash: true,\n\t\t\tsamePage: true\n\t\t},\n\t\tgetAnchorElement: undefined,\n\t\toffset: 0,\n\t\tscrollContainers: `[data-swup-scroll-container]`,\n\t\tshouldResetScrollPosition: () => true,\n\t\tmarkScrollTarget: false,\n\t\tscrollFunction: undefined\n\t};\n\n\toptions: Options;\n\n\tcachedScrollPositions: ScrollPositionsCache = {};\n\tpreviousScrollRestoration?: ScrollRestoration;\n\tcurrentCacheKey?: string;\n\n\tconstructor(options: Partial<Options> = {}) {\n\t\tsuper();\n\t\tthis.options = { ...this.defaults, ...options };\n\t}\n\n\t/**\n\t * Run when the plugin is mounted\n\t */\n\tmount() {\n\t\tconst swup = this.swup;\n\n\t\tswup.hooks.create('scroll:start');\n\t\tswup.hooks.create('scroll:end');\n\n\t\t/* Add scrollTo method to swup instance */\n\t\tswup.scrollTo = this.scrollTo.bind(this);\n\n\t\t/**\n\t\t * Disable browser scroll restoration for history visits\n\t\t * if `swup.options.animateHistoryBrowsing` is true\n\t\t * Store the previous setting to be able to properly restore it on unmount\n\t\t */\n\t\tthis.previousScrollRestoration = window.history.scrollRestoration;\n\t\tif (swup.options.animateHistoryBrowsing) {\n\t\t\twindow.history.scrollRestoration = 'manual';\n\t\t}\n\n\t\t/**\n\t\t * Mark the current scroll target element with a `data-swup-scroll-target` attribute\n\t\t */\n\t\tthis.updateScrollTarget = this.updateScrollTarget.bind(this);\n\t\tif (this.options.markScrollTarget) {\n\t\t\twindow.addEventListener('popstate', this.updateScrollTarget);\n\t\t\twindow.addEventListener('hashchange', this.updateScrollTarget);\n\t\t\tthis.on('page:view', this.updateScrollTarget);\n\t\t\tthis.on('link:anchor', this.updateScrollTarget);\n\t\t\tthis.on('link:self', this.updateScrollTarget);\n\t\t\tthis.updateScrollTarget();\n\t\t}\n\n\t\t// scroll to the top of the page when a visit starts, before replacing the content\n\t\tthis.before('visit:start', this.onBeforeVisitStart, { priority: -1 });\n\t\tthis.on('visit:start', this.onVisitStart, { priority: 1 });\n\n\t\t// scroll to the top or target element after replacing the content\n\t\tthis.replace('content:scroll', this.handleScrollToContent);\n\n\t\t// scroll to the top of the same page\n\t\tthis.before('link:self', this.onBeforeLinkToSelf, { priority: -1 });\n\t\tthis.replace('scroll:top', this.handleScrollToTop);\n\n\t\t// scroll to an anchor on the same page\n\t\tthis.before('link:anchor', this.onBeforeLinkToAnchor, { priority: -1 });\n\t\tthis.replace('scroll:anchor', this.handleScrollToAnchor);\n\t}\n\n\t/**\n\t * Run when the plugin is unmounted\n\t */\n\tunmount() {\n\t\tsuper.unmount();\n\n\t\tif (this.previousScrollRestoration) {\n\t\t\twindow.history.scrollRestoration = this.previousScrollRestoration;\n\t\t}\n\n\t\twindow.removeEventListener('popstate', this.updateScrollTarget);\n\t\twindow.removeEventListener('hashchange', this.updateScrollTarget);\n\n\t\tthis.cachedScrollPositions = {};\n\t\tdelete this.swup.scrollTo;\n\t}\n\n\t/**\n\t * Detect if a scroll should be animated, based on context\n\t */\n\tshouldAnimate(context: keyof Options['animateScroll']): boolean {\n\t\tif (typeof this.options.animateScroll === 'boolean') {\n\t\t\treturn this.options.animateScroll;\n\t\t}\n\t\treturn this.options.animateScroll[context];\n\t}\n\n\t/**\n\t * Get an element based on anchor\n\t */\n\tgetAnchorElement = (hash: string = ''): Element | null => {\n\t\t// Look for a custom function provided via the plugin options\n\t\tif (typeof this.options.getAnchorElement === 'function') {\n\t\t\treturn this.options.getAnchorElement(hash);\n\t\t}\n\n\t\treturn this.swup.getAnchorElement(hash);\n\t};\n\n\t/**\n\t * Get the offset for a scroll\n\t */\n\tgetOffset = (\n\t\tscrollTarget: Element,\n\t\tscrollContainer: Element,\n\t\tposition: ScrollPosition\n\t): ScrollPosition => {\n\t\tlet offset: number | ScrollPosition;\n\n\t\t// If options.offset is a function, apply and return it\n\t\t// Otherwise, use the actual offset value\n\t\tif (typeof this.options.offset === 'function') {\n\t\t\toffset = this.options.offset(scrollTarget, scrollContainer, position);\n\t\t} else {\n\t\t\toffset = this.options.offset;\n\t\t}\n\n\t\t/**\n\t\t * Normalize offset to an object\n\t\t * If offset is a number, use it as top and set left to 0\n\t\t */\n\t\tif (\n\t\t\ttypeof offset === 'object' &&\n\t\t\ttypeof offset.top === 'number' &&\n\t\t\ttypeof offset.left === 'number'\n\t\t) {\n\t\t\treturn offset;\n\t\t} else {\n\t\t\tconst top = parseInt(String(offset ?? ''), 10) || 0;\n\t\t\treturn { top, left: 0 };\n\t\t}\n\t};\n\n\t/**\n\t * Store scroll animation status in visit object before scrolling up\n\t */\n\tonBeforeLinkToSelf: Handler<'link:self'> = (visit) => {\n\t\tvisit.scroll.animate = this.shouldAnimate('samePage');\n\t};\n\n\t/**\n\t * Scroll to top/left on `scroll:top` hook\n\t */\n\thandleScrollToTop: Handler<'scroll:top'> = (visit) => {\n\t\tthis.scrollTo({ top: 0, left: 0 }, visit.scroll.animate);\n\t\treturn true;\n\t};\n\n\t/**\n\t * Store scroll animation status in visit object before scrolling to anchor\n\t */\n\tonBeforeLinkToAnchor: Handler<'link:anchor'> = (visit) => {\n\t\tvisit.scroll.animate = this.shouldAnimate('samePageWithHash');\n\t};\n\n\t/**\n\t * Scroll to anchor on `scroll:anchor` hook\n\t */\n\thandleScrollToAnchor: Handler<'scroll:anchor'> = (visit, { hash }) => {\n\t\treturn this.maybeScrollToAnchor(hash, visit.scroll.animate);\n\t};\n\n\t/**\n\t * Attempt to scroll to an anchor\n\t */\n\tmaybeScrollToAnchor(hash?: string, animate: boolean = false): boolean {\n\t\tif (!hash) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst element = this.getAnchorElement(hash);\n\t\tif (!element) {\n\t\t\tconsole.warn(`Anchor target ${hash} not found`);\n\t\t\treturn false;\n\t\t}\n\t\tif (!(element instanceof Element)) {\n\t\t\tconsole.warn(`Anchor target ${hash} is not a DOM node`);\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.scrollElementIntoView(element, animate);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Prepare scrolling before visit:start hook\n\t */\n\tonBeforeVisitStart: Handler<'visit:start'> = (visit) => {\n\t\tvisit.scroll.scrolledToContent = false;\n\t\tvisit.scroll.animate = this.shouldAnimate('betweenPages');\n\t};\n\n\t/**\n\t * Check whether to scroll in `visit:start` hook\n\t */\n\tonVisitStart: Handler<'visit:start'> = (visit) => {\n\t\tthis.cacheScrollPositions(visit.from.url);\n\t\tthis.maybeResetScrollPositions(visit);\n\n\t\tconst scrollTarget = visit.scroll.target ?? visit.to.hash;\n\n\t\t// Conditions for scrolling before content replace:\n\t\t// - scroll is animated (otherwise the effect is useless)\n\t\t// - no scroll target is defined (needs to wait until new content is there)\n\t\tif (visit.scroll.animate && this.options.doScrollingRightAway && !scrollTarget) {\n\t\t\tthis.doScrollingBetweenPages(visit);\n\t\t}\n\t};\n\n\t/**\n\t * Check whether to scroll in `content:scroll` hook\n\t */\n\thandleScrollToContent: Handler<'content:scroll'> = (visit) => {\n\t\tif (!visit.scroll.scrolledToContent) {\n\t\t\tthis.doScrollingBetweenPages(visit);\n\t\t}\n\t\tthis.restoreScrollContainers(visit.to.url);\n\t};\n\n\t/**\n\t * Scroll between pages\n\t */\n\tdoScrollingBetweenPages = (visit: Visit): void => {\n\t\t// Bail early on popstate if not animated: browser will handle it\n\t\tif (visit.history.popstate && !visit.animation.animate) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Try scrolling to a given anchor\n\t\tconst scrollTarget = visit.scroll.target ?? visit.to.hash;\n\t\tif (scrollTarget && this.maybeScrollToAnchor(scrollTarget, visit.scroll.animate)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Allow not resetting scroll position\n\t\tif (!visit.scroll.reset) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Finally, scroll to either the stored scroll position or to the very top of the page\n\t\tconst scrollPositions = this.getCachedScrollPositions(visit.to.url);\n\t\tconst { top = 0, left = 0 } = scrollPositions?.window || { top: 0, left: 0 };\n\n\t\t// Give possible JavaScript time to execute before scrolling\n\t\trequestAnimationFrame(() => this.scrollTo({ top, left }, visit.scroll.animate));\n\n\t\tvisit.scroll.scrolledToContent = true;\n\t};\n\n\t/**\n\t * Reset cached scroll positions. Do not reset if:\n\t * - the visit is a history visit\n\t * - the visit is triggered by a link and shouldResetScrollPosition(link) returns false\n\t */\n\tmaybeResetScrollPositions = (visit: Visit): void => {\n\t\tconst { popstate } = visit.history;\n\t\tconst { url } = visit.to;\n\t\tconst { el } = visit.trigger;\n\t\tif (popstate) {\n\t\t\treturn;\n\t\t}\n\t\tif (el && !this.options.shouldResetScrollPosition(el)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.resetScrollPositions(url);\n\t};\n\n\t/**\n\t * Store the scroll positions for the current URL\n\t */\n\tcacheScrollPositions(url: string): void {\n\t\tconst cacheKey = this.swup.resolveUrl(url);\n\n\t\t// retrieve the current scroll position for all containers\n\t\tconst containers = queryAll(this.options.scrollContainers).map((el) => ({\n\t\t\ttop: el.scrollTop,\n\t\t\tleft: el.scrollLeft\n\t\t}));\n\n\t\t// construct the final object entry, with the window scroll positions added\n\t\tconst positions = {\n\t\t\twindow: { top: window.scrollY, left: window.scrollX },\n\t\t\tcontainers\n\t\t};\n\n\t\tthis.cachedScrollPositions[cacheKey] = positions;\n\t}\n\n\t/**\n\t * Resets stored scroll positions for a given URL\n\t */\n\tresetScrollPositions(url: string): void {\n\t\tconst cacheKey = this.swup.resolveUrl(url);\n\t\tdelete this.cachedScrollPositions[cacheKey];\n\t}\n\n\t/**\n\t * Get the stored scroll positions for a given URL from the cache\n\t */\n\tgetCachedScrollPositions(url: string): ScrollPositionsCacheEntry | undefined {\n\t\tconst cacheKey = this.swup.resolveUrl(url);\n\t\treturn this.cachedScrollPositions[cacheKey];\n\t}\n\n\t/**\n\t * Restore the scroll positions for all matching scrollContainers\n\t */\n\trestoreScrollContainers(url: string): void {\n\t\t// get the stored scroll positions from the cache\n\t\tconst scrollPositions = this.getCachedScrollPositions(url);\n\t\tif (!scrollPositions || scrollPositions.containers.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// cycle through all containers on the current page and restore their scroll positions, if appropriate\n\t\tqueryAll(this.options.scrollContainers).forEach((el, index) => {\n\t\t\tconst scrollPosition = scrollPositions.containers[index];\n\t\t\tif (scrollPosition == null) return;\n\t\t\tel.scrollTop = scrollPosition.top;\n\t\t\tel.scrollLeft = scrollPosition.left;\n\t\t});\n\t}\n\n\tupdateScrollTarget(): void {\n\t\tconst { hash } = window.location;\n\t\tconst currentTarget = document.querySelector('[data-swup-scroll-target]');\n\t\tlet newTarget = this.getAnchorElement(hash);\n\t\tif (newTarget instanceof HTMLBodyElement) {\n\t\t\t// Special case: '#top' fragment returns <body> element\n\t\t\tnewTarget = null;\n\t\t}\n\t\tif (currentTarget === newTarget) {\n\t\t\treturn;\n\t\t}\n\t\tcurrentTarget?.removeAttribute('data-swup-scroll-target');\n\t\tnewTarget?.setAttribute('data-swup-scroll-target', '');\n\t}\n\n\t/**\n\t * Get the root scrolling element\n\t */\n\tgetRootScrollContainer() {\n\t\treturn document.scrollingElement instanceof HTMLElement\n\t\t\t? document.scrollingElement\n\t\t\t: document.documentElement;\n\t}\n\n\t/**\n\t * Scroll to a specific offset, with optional animation.\n\t */\n\tscrollTo(position: number | ScrollPosition, animate = true, scrollContainer?: Element): void {\n\t\t// Create dummy visit\n\t\t// @ts-expect-error: createVisit is currently private, need to make this semi-public somehow\n\t\tconst visit = this.swup.createVisit({ to: this.swup.location.url });\n\n\t\tconst { top = 0, left = 0 } = typeof position === 'number' ? { top: position } : position;\n\t\tscrollContainer ??= this.getRootScrollContainer();\n\n\t\tconst start = () => this.swup.hooks.callSync('scroll:start', visit, undefined);\n\t\tconst end = () => this.swup.hooks.callSync('scroll:end', visit, undefined);\n\n\t\t// Apply scroll via user-supplied scroll function or default one\n\t\tconst scrollFunction = this.options.scrollFunction ?? this.applyScroll;\n\t\tscrollFunction(scrollContainer, top, left, animate, start, end);\n\t}\n\n\t/**\n\t * Default scroll function\n\t */\n\tapplyScroll(\n\t\tel: Element,\n\t\ttop: number,\n\t\tleft: number,\n\t\tanimate: boolean,\n\t\tstart: () => void,\n\t\tend: () => void\n\t) {\n\t\tconst eventTarget =\n\t\t\tel instanceof HTMLHtmlElement || el instanceof HTMLBodyElement ? window : el;\n\n\t\t// Dispatch the scroll:start hook immediately\n\t\tstart();\n\n\t\t// Dispatch the scroll:end hook upon completion\n\t\teventTarget.addEventListener('scrollend', end, { once: true });\n\n\t\t// Cancel the scroll upon user interaction\n\t\teventTarget.addEventListener(\n\t\t\t'wheel',\n\t\t\t() => {\n\t\t\t\tel.scrollTo({\n\t\t\t\t\ttop: el.scrollTop,\n\t\t\t\t\tleft: el.scrollLeft,\n\t\t\t\t\tbehavior: 'instant'\n\t\t\t\t});\n\t\t\t},\n\t\t\t{ once: true }\n\t\t);\n\n\t\tconst behavior = animate ? 'smooth' : 'instant';\n\n\t\tel.scrollTo({ top, left, behavior });\n\t}\n\n\t/**\n\t * Scroll an element into view by recursively scrolling all scrollable ancestors\n\t * Mimics browser's native scrollIntoView behavior for nested scrollable containers\n\t */\n\tscrollElementIntoView(scrollTarget: Element, animate: boolean = false): void {\n\t\tconst scrollActions = computeRequiredScrollActions(scrollTarget, {\n\t\t\tscrollMode: 'always',\n\t\t\tblock: 'start',\n\t\t\tinline: 'start'\n\t\t});\n\n\t\tscrollActions.forEach(({ top, left, el: scrollContainer }) => {\n\t\t\tconst { top: topOffset = 0, left: leftOffset = 0 } = this.getOffset(\n\t\t\t\tscrollTarget,\n\t\t\t\tscrollContainer,\n\t\t\t\t{ top, left }\n\t\t\t);\n\t\t\tthis.scrollTo(\n\t\t\t\t{ top: top - topOffset, left: left - leftOffset },\n\t\t\t\tanimate,\n\t\t\t\tscrollContainer\n\t\t\t);\n\t\t});\n\t}\n}\n"],"names":["m","t","e","document","Array","from","querySelectorAll","Plugin","constructor","options","super","this","name","requires","swup","defaults","doScrollingRightAway","animateScroll","betweenPages","samePageWithHash","samePage","getAnchorElement","undefined","offset","scrollContainers","shouldResetScrollPosition","markScrollTarget","scrollFunction","cachedScrollPositions","previousScrollRestoration","currentCacheKey","hash","getOffset","scrollTarget","scrollContainer","position","top","left","parseInt","String","onBeforeLinkToSelf","visit","scroll","animate","shouldAnimate","handleScrollToTop","scrollTo","onBeforeLinkToAnchor","handleScrollToAnchor","maybeScrollToAnchor","onBeforeVisitStart","scrolledToContent","onVisitStart","cacheScrollPositions","url","maybeResetScrollPositions","target","to","doScrollingBetweenPages","handleScrollToContent","restoreScrollContainers","history","popstate","animation","reset","scrollPositions","getCachedScrollPositions","window","requestAnimationFrame","el","trigger","resetScrollPositions","mount","hooks","create","bind","scrollRestoration","animateHistoryBrowsing","updateScrollTarget","addEventListener","on","before","priority","replace","unmount","removeEventListener","context","element","Element","scrollElementIntoView","console","warn","cacheKey","resolveUrl","containers","queryAll","map","scrollTop","scrollLeft","positions","scrollY","scrollX","length","forEach","index","scrollPosition","location","currentTarget","querySelector","newTarget","HTMLBodyElement","removeAttribute","setAttribute","getRootScrollContainer","scrollingElement","HTMLElement","documentElement","createVisit","applyScroll","start","callSync","end","eventTarget","HTMLHtmlElement","once","behavior","computeRequiredScrollActions","scrollMode","block","inline","topOffset","leftOffset"],"mappings":"oKAAoyG,MAAsCA,EAAE,CAACC,EAAEC,EAAEC,WAAWC,MAAMC,KAAKH,EAAEI,iBAAiBL,mBCqEr2G,cAAyBM,EAAM,QA0BnDC,WAAAA,CAAYC,EAA4B,CAAA,GACvCC,QAAQC,KA1BTC,KAAO,mBAEPC,KAAAA,SAAW,CAAEC,KAAM,WAAWH,KAE9BI,SAAoB,CACnBC,sBAAsB,EACtBC,cAAe,CACdC,cAAc,EACdC,kBAAkB,EAClBC,UAAU,GAEXC,sBAAkBC,EAClBC,OAAQ,EACRC,iBAAkB,+BAClBC,0BAA2BA,KAAM,EACjCC,kBAAkB,EAClBC,oBAAgBL,GAGjBb,KAAAA,oBAEAmB,sBAA8C,GAC9CC,KAAAA,sCACAC,qBAAe,EAAAnB,KAwFfU,iBAAmB,CAACU,EAAe,KAEW,mBAAlCpB,KAAKF,QAAQY,iBAChBV,KAAKF,QAAQY,iBAAiBU,GAG3BpB,KAACG,KAAKO,iBAAiBU,QAMnCC,UAAY,CACXC,EACAC,EACAC,KAEA,IAAIZ,EAc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