hexo-theme-gnix 8.0.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/include/hexo/feed.js +6 -5
- package/include/hexo/filter.js +25 -1
- package/include/hexo/generator/archive.js +116 -0
- package/include/hexo/generator/home.js +64 -0
- package/include/hexo/generator/index.js +82 -0
- package/include/hexo/generator/md_generator.js +87 -0
- package/include/hexo/generator/page.js +55 -0
- package/include/hexo/generator/tag.js +84 -0
- package/include/hexo/helper.js +38 -0
- package/include/hexo/i18n.js +183 -0
- package/include/util/article_font.js +132 -0
- package/include/util/i18n.js +280 -0
- package/include/util/theme.js +84 -0
- package/languages/en.yml +28 -0
- package/languages/zh-CN.yml +28 -0
- package/layout/archive.jsx +131 -127
- package/layout/common/article.jsx +316 -34
- package/layout/common/article_info.jsx +339 -0
- package/layout/common/article_media.jsx +11 -4
- package/layout/common/comment.jsx +15 -7
- package/layout/common/footer.jsx +6 -5
- package/layout/common/head.jsx +122 -33
- package/layout/common/navbar.jsx +195 -65
- package/layout/common/theme_selector.jsx +16 -14
- package/layout/layout.jsx +43 -5
- package/layout/misc/open_graph.jsx +162 -66
- package/layout/misc/paginator.jsx +2 -8
- package/layout/plugin/cookie_consent.jsx +252 -53
- package/layout/plugin/swup.jsx +1 -1
- package/layout/search/insight.jsx +1 -1
- package/layout/tag.jsx +3 -2
- package/layout/tags.jsx +81 -73
- package/package.json +5 -5
- package/scripts/index.js +1 -0
- package/source/css/archive.css +225 -180
- package/source/css/default.css +1223 -126
- package/source/css/responsive.css +426 -0
- package/source/css/shiki/shiki.css +12 -2081
- package/source/css/tags.css +183 -0
- package/source/css/twikoo.css +1053 -1049
- package/source/img/favicon.svg +1 -6
- package/source/img/og_image.webp +0 -0
- package/source/js/article-font-utils.js +99 -0
- package/source/js/busuanzi.js +91 -24
- package/source/js/components/chat.js +169 -50
- package/source/js/components/image-carousel.js +152 -108
- package/source/js/components/sidenote.js +210 -0
- package/source/js/components/text-image-section.js +78 -90
- package/source/js/components/theme-stacked.js +65 -33
- package/source/js/components/tree.js +30 -16
- package/source/js/decrypt.js +7 -2
- package/source/js/main.js +428 -5
- package/source/js/swup.js +39 -0
- package/source/js/theme-selector.js +26 -16
- package/include/hexo/generator.js +0 -53
- package/layout/misc/article_licensing.jsx +0 -99
- package/source/css/responsive/desktop.css +0 -36
- package/source/css/responsive/mobile.css +0 -38
- package/source/css/responsive/tablet.css +0 -43
- package/source/css/responsive/touch.css +0 -155
- package/source/img/logo.svg +0 -9
- package/source/js/archive-breadcrumb.js +0 -132
- package/source/js/host/cookieconsent/3.1.1/build/cookieconsent.min.css +0 -6
- package/source/js/host/cookieconsent/3.1.1/build/cookieconsent.min.js +0 -1
- package/source/js/swup.bundle.js +0 -1
package/source/js/swup.bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var y=new WeakMap;function k(f,S,z,G){if(!f&&!y.has(S))return!1;let J=y.get(S)??new WeakMap;y.set(S,J);let K=J.get(z)??new Set;J.set(z,K);let Y=K.has(G);if(f)K.add(G);else K.delete(G);return Y&&f}function Gf(f,S){let z=f.target;if(z instanceof Text)z=z.parentElement;if(z instanceof Element&&f.currentTarget instanceof Node){let G=z.closest(S);if(G&&f.currentTarget.contains(G))return G}}function Jf(f,S,z,G={}){let{signal:J,base:K=document}=G;if(J?.aborted)return;let{once:Y,...Z}=G,X=K instanceof Document?K.documentElement:K,Q=Boolean(typeof G==="object"?G.capture:G),q=(D)=>{let W=Gf(D,String(f));if(W){let V=Object.assign(D,{delegateTarget:W});if(z.call(X,V),Y)X.removeEventListener(S,q,Z),k(!1,X,z,B)}},B=JSON.stringify({selector:f,type:S,capture:Q});if(!k(!0,X,z,B))X.addEventListener(S,q,Z);J?.addEventListener("abort",()=>{k(!1,X,z,B)})}var w=Jf;function $(){return $=Object.assign?Object.assign.bind():function(f){for(var S=1;S<arguments.length;S++){var z=arguments[S];for(var G in z)({}).hasOwnProperty.call(z,G)&&(f[G]=z[G])}return f},$.apply(null,arguments)}var o=(f,S)=>String(f).toLowerCase().replace(/[\s/_.]+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+|-+$/g,"")||S||"",T=({hash:f}={})=>window.location.pathname+window.location.search+(f?window.location.hash:""),Kf=(f,S={})=>{let z=$({url:f=f||T({hash:!0}),random:Math.random(),source:"swup"},S);window.history.pushState(z,"",f)},O=(f=null,S={})=>{f=f||T({hash:!0});let z=$({},window.history.state||{},{url:f,random:Math.random(),source:"swup"},S);window.history.replaceState(z,"",f)},Qf=(f,S,z,G)=>{let J=new AbortController;return G=$({},G,{signal:J.signal}),w(f,S,z,G),{destroy:()=>J.abort()}};class F extends URL{constructor(f,S=document.baseURI){super(f.toString(),S),Object.setPrototypeOf(this,F.prototype)}get url(){return this.pathname+this.search}static fromElement(f){let S=f.getAttribute("href")||f.getAttribute("xlink:href")||"";return new F(S)}static fromUrl(f){return new F(f)}}class _ extends Error{constructor(f,S){super(f),this.url=void 0,this.status=void 0,this.aborted=void 0,this.timedOut=void 0,this.name="FetchError",this.url=S.url,this.status=S.status,this.aborted=S.aborted||!1,this.timedOut=S.timedOut||!1}}async function Xf(f,S={}){var z;f=F.fromUrl(f).url;let{visit:G=this.visit}=S,J=$({},this.options.requestHeaders,S.headers),K=(z=S.timeout)!=null?z:this.options.timeout,Y=new AbortController,{signal:Z}=Y;S=$({},S,{headers:J,signal:Z});let X,Q=!1,q=null;K&&K>0&&(q=setTimeout(()=>{Q=!0,Y.abort("timeout")},K));try{X=await this.hooks.call("fetch:request",G,{url:f,options:S},(P,{url:C,options:N})=>fetch(C,N)),q&&clearTimeout(q)}catch(P){if(Q)throw this.hooks.call("fetch:timeout",G,{url:f}),new _(`Request timed out: ${f}`,{url:f,timedOut:Q});if((P==null?void 0:P.name)==="AbortError"||Z.aborted)throw new _(`Request aborted: ${f}`,{url:f,aborted:!0});throw P}let{status:B,url:I}=X,D=await X.text();if(B===500)throw this.hooks.call("fetch:error",G,{status:B,response:X,url:I}),new _(`Server error: ${I}`,{status:B,url:I});if(!D)throw new _(`Empty response: ${I}`,{status:B,url:I});let{url:W}=F.fromUrl(I),V={url:W,html:D};return!G.cache.write||S.method&&S.method!=="GET"||f!==W||this.cache.set(V.url,V),V}class l{constructor(f){this.swup=void 0,this.pages=new Map,this.swup=f}get size(){return this.pages.size}get all(){let f=new Map;return this.pages.forEach((S,z)=>{f.set(z,$({},S))}),f}has(f){return this.pages.has(this.resolve(f))}get(f){let S=this.pages.get(this.resolve(f));return S?$({},S):S}set(f,S){S=$({},S,{url:f=this.resolve(f)}),this.pages.set(f,S),this.swup.hooks.callSync("cache:set",void 0,{page:S})}update(f,S){f=this.resolve(f);let z=$({},this.get(f),S,{url:f});this.pages.set(f,z)}delete(f){this.pages.delete(this.resolve(f))}clear(){this.pages.clear(),this.swup.hooks.callSync("cache:clear",void 0,void 0)}prune(f){this.pages.forEach((S,z)=>{f(z,S)&&this.delete(z)})}resolve(f){let{url:S}=F.fromUrl(f);return this.swup.resolveUrl(S)}}var h=(f,S=document)=>S.querySelector(f),m=(f,S=document)=>Array.from(S.querySelectorAll(f)),r=()=>new Promise((f)=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{f()})})});function i(f){return!!f&&(typeof f=="object"||typeof f=="function")&&typeof f.then=="function"}function Yf(f,S=[]){return new Promise((z,G)=>{let J=f(...S);i(J)?J.then(z,G):z(J)})}function p(f,S){let z=f==null?void 0:f.closest(`[${S}]`);return z!=null&&z.hasAttribute(S)?(z==null?void 0:z.getAttribute(S))||!0:void 0}class n{constructor(f){this.swup=void 0,this.swupClasses=["to-","is-changing","is-rendering","is-popstate","is-animating","is-leaving"],this.swup=f}get selectors(){let{scope:f}=this.swup.visit.animation;return f==="containers"?this.swup.visit.containers:f==="html"?["html"]:Array.isArray(f)?f:[]}get selector(){return this.selectors.join(",")}get targets(){return this.selector.trim()?m(this.selector):[]}add(...f){this.targets.forEach((S)=>S.classList.add(...f))}remove(...f){this.targets.forEach((S)=>S.classList.remove(...f))}clear(){this.targets.forEach((f)=>{let S=f.className.split(" ").filter((z)=>this.isSwupClass(z));f.classList.remove(...S)})}isSwupClass(f){return this.swupClasses.some((S)=>f.startsWith(S))}}class v{constructor(f,S){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;let{to:z,from:G,hash:J,el:K,event:Y}=S;this.id=Math.random(),this.state=1,this.from={url:G!=null?G:f.location.url,hash:f.location.hash},this.to={url:z,hash:J},this.containers=f.options.containers,this.animation={animate:!0,wait:!1,name:void 0,native:f.options.native,scope:f.options.animationScope,selector:f.options.animationSelector},this.trigger={el:K,event:Y},this.cache={read:f.options.cache,write:f.options.cache},this.history={action:"push",popstate:!1,direction:void 0},this.scroll={reset:!0,target:void 0},this.meta={}}advance(f){this.state<f&&(this.state=f)}abort(){this.state=8}get done(){return this.state>=7}}function Zf(f){return new v(this,f)}class s{constructor(f){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=f,this.init()}init(){this.hooks.forEach((f)=>this.create(f))}create(f){this.registry.has(f)||this.registry.set(f,new Map)}exists(f){return this.registry.has(f)}get(f){let S=this.registry.get(f);if(S)return S;console.error(`Unknown hook '${f}'`)}clear(){this.registry.forEach((f)=>f.clear())}on(f,S,z={}){let G=this.get(f);if(!G)return console.warn(`Hook '${f}' not found.`),()=>{};let J=$({},z,{id:G.size+1,hook:f,handler:S});return G.set(S,J),()=>this.off(f,S)}before(f,S,z={}){return this.on(f,S,$({},z,{before:!0}))}replace(f,S,z={}){return this.on(f,S,$({},z,{replace:!0}))}once(f,S,z={}){return this.on(f,S,$({},z,{once:!0}))}off(f,S){let z=this.get(f);z&&S?z.delete(S)||console.warn(`Handler for hook '${f}' not found.`):z&&z.clear()}async call(f,S,z,G){let[J,K,Y]=this.parseCallArgs(f,S,z,G),{before:Z,handler:X,after:Q}=this.getHandlers(f,Y);await this.run(Z,J,K);let[q]=await this.run(X,J,K,!0);return await this.run(Q,J,K),this.dispatchDomEvent(f,J,K),q}callSync(f,S,z,G){let[J,K,Y]=this.parseCallArgs(f,S,z,G),{before:Z,handler:X,after:Q}=this.getHandlers(f,Y);this.runSync(Z,J,K);let[q]=this.runSync(X,J,K,!0);return this.runSync(Q,J,K),this.dispatchDomEvent(f,J,K),q}parseCallArgs(f,S,z,G){return S instanceof v||typeof S!="object"&&typeof z!="function"?[S,z,G]:[void 0,S,z]}async run(f,S=this.swup.visit,z,G=!1){let J=[];for(let{hook:K,handler:Y,defaultHandler:Z,once:X}of f)if(S==null||!S.done){X&&this.off(K,Y);try{let Q=await Yf(Y,[S,z,Z]);J.push(Q)}catch(Q){if(G)throw Q;console.error(`Error in hook '${K}':`,Q)}}return J}runSync(f,S=this.swup.visit,z,G=!1){let J=[];for(let{hook:K,handler:Y,defaultHandler:Z,once:X}of f)if(S==null||!S.done){X&&this.off(K,Y);try{let Q=Y(S,z,Z);J.push(Q),i(Q)&&console.warn(`Swup will not await Promises in handler for synchronous hook '${K}'.`)}catch(Q){if(G)throw Q;console.error(`Error in hook '${K}':`,Q)}}return J}getHandlers(f,S){let z=this.get(f);if(!z)return{found:!1,before:[],handler:[],after:[],replaced:!1};let G=Array.from(z.values()),J=this.sortRegistrations,K=G.filter(({before:q,replace:B})=>q&&!B).sort(J),Y=G.filter(({replace:q})=>q).filter((q)=>!0).sort(J),Z=G.filter(({before:q,replace:B})=>!q&&!B).sort(J),X=Y.length>0,Q=[];if(S&&(Q=[{id:0,hook:f,handler:S}],X)){let q=Y.length-1,{handler:B,once:I}=Y[q],D=(W)=>{let V=Y[W-1];return V?(P,C)=>V.handler(P,C,D(W-1)):S};Q=[{id:0,hook:f,once:I,handler:B,defaultHandler:D(q)}]}return{found:!0,before:K,handler:Q,after:Z,replaced:X}}sortRegistrations(f,S){var z,G;return((z=f.priority)!=null?z:0)-((G=S.priority)!=null?G:0)||f.id-S.id||0}dispatchDomEvent(f,S,z){if(S!=null&&S.done)return;let G={hook:f,args:z,visit:S||this.swup.visit};document.dispatchEvent(new CustomEvent("swup:any",{detail:G,bubbles:!0})),document.dispatchEvent(new CustomEvent(`swup:${f}`,{detail:G,bubbles:!0}))}parseName(f){let[S,...z]=f.split(".");return[S,z.reduce((G,J)=>$({},G,{[J]:!0}),{})]}}var qf=(f)=>{if(f&&f.charAt(0)==="#"&&(f=f.substring(1)),!f)return null;let S=decodeURIComponent(f),z=document.getElementById(f)||document.getElementById(S)||h(`a[name='${CSS.escape(f)}']`)||h(`a[name='${CSS.escape(S)}']`);return z||f!=="top"||(z=document.body),z},M="transition",E="animation";async function Bf({selector:f,elements:S}){if(f===!1&&!S)return;let z=[];if(S)z=Array.from(S);else if(f&&(z=m(f,document.body),!z.length))return void console.warn(`[swup] No elements found matching animationSelector \`${f}\``);let G=z.map((J)=>function(K){let{type:Y,timeout:Z,propCount:X}=function(Q){let q=window.getComputedStyle(Q),B=U(q,`${M}Delay`),I=U(q,`${M}Duration`),D=c(B,I),W=U(q,`${E}Delay`),V=U(q,`${E}Duration`),P=c(W,V),C=Math.max(D,P),N=C>0?D>P?M:E:null;return{type:N,timeout:C,propCount:N?N===M?I.length:V.length:0}}(K);return!(!Y||!Z)&&new Promise((Q)=>{let q=`${Y}end`,B=performance.now(),I=0,D=()=>{K.removeEventListener(q,W),Q()},W=(V)=>{V.target===K&&((performance.now()-B)/1000<V.elapsedTime||++I>=X&&D())};setTimeout(()=>{I<X&&D()},Z+1),K.addEventListener(q,W)})}(J));G.filter(Boolean).length>0?await Promise.all(G):f&&console.warn(`[swup] No CSS animation duration defined on elements matching \`${f}\``)}function U(f,S){return(f[S]||"").split(", ")}function c(f,S){for(;f.length<S.length;)f=f.concat(f);return Math.max(...S.map((z,G)=>a(z)+a(f[G])))}function a(f){return 1000*parseFloat(f)}function Df(f,S={},z={}){if(typeof f!="string")throw Error("swup.navigate() requires a URL parameter");if(this.shouldIgnoreVisit(f,{el:z.el,event:z.event}))return void window.location.assign(f);let{url:G,hash:J}=F.fromUrl(f),K=this.createVisit($({},z,{to:G,hash:J}));this.performNavigation(K,S)}async function If(f,S={}){if(this.navigating){if(this.visit.state>=6)return f.state=2,void(this.onVisitEnd=()=>this.performNavigation(f,S));await this.hooks.call("visit:abort",this.visit,void 0),delete this.visit.to.document,this.visit.state=8}this.navigating=!0,this.visit=f;let{el:z}=f.trigger;S.referrer=S.referrer||this.location.url,S.animate===!1&&(f.animation.animate=!1),f.animation.animate||this.classes.clear();let G=S.history||p(z,"data-swup-history");typeof G=="string"&&["push","replace"].includes(G)&&(f.history.action=G);let J=S.animation||p(z,"data-swup-animation");var K,Y;typeof J=="string"&&(f.animation.name=J),f.meta=S.meta||{},typeof S.cache=="object"?(f.cache.read=(K=S.cache.read)!=null?K:f.cache.read,f.cache.write=(Y=S.cache.write)!=null?Y:f.cache.write):S.cache!==void 0&&(f.cache={read:!!S.cache,write:!!S.cache}),delete S.cache;try{await this.hooks.call("visit:start",f,void 0),f.state=3;let Z=this.hooks.call("page:load",f,{options:S},async(Q,q)=>{let B;return Q.cache.read&&(B=this.cache.get(Q.to.url)),q.page=B||await this.fetchPage(Q.to.url,q.options),q.cache=!!B,q.page});Z.then(({html:Q})=>{f.advance(5),f.to.html=Q,f.to.document=new DOMParser().parseFromString(Q,"text/html")});let X=f.to.url+f.to.hash;if(f.history.popstate||(f.history.action==="replace"||f.to.url===this.location.url?O(X):(this.currentHistoryIndex++,Kf(X,{index:this.currentHistoryIndex}))),this.location=F.fromUrl(X),f.history.popstate&&this.classes.add("is-popstate"),f.animation.name&&this.classes.add(`to-${o(f.animation.name)}`),f.animation.wait&&await Z,f.done)return;if(await this.hooks.call("visit:transition",f,void 0,async()=>{if(!f.animation.animate)return await this.hooks.call("animation:skip",void 0),void await this.renderPage(f,await Z);f.advance(4),await this.animatePageOut(f),f.animation.native&&document.startViewTransition?await document.startViewTransition(async()=>await this.renderPage(f,await Z)).finished:await this.renderPage(f,await Z),await this.animatePageIn(f)}),f.done)return;await this.hooks.call("visit:end",f,void 0,()=>this.classes.clear()),f.state=7,this.navigating=!1,this.onVisitEnd&&(this.onVisitEnd(),this.onVisitEnd=void 0)}catch(Z){if(!Z||Z!=null&&Z.aborted)return void(f.state=8);f.state=9,console.error(Z),this.options.skipPopStateHandling=()=>(window.location.assign(f.to.url+f.to.hash),!0),window.history.back()}finally{delete f.to.document}}var Nf=async function(f){await this.hooks.call("animation:out:start",f,void 0,()=>{this.classes.add("is-changing","is-animating","is-leaving")}),await this.hooks.call("animation:out:await",f,{skip:!1},(S,{skip:z})=>{if(!z)return this.awaitAnimations({selector:S.animation.selector})}),await this.hooks.call("animation:out:end",f,void 0)},Pf=function(f){var S;let z=f.to.document;if(!z)return!1;let G=((S=z.querySelector("title"))==null?void 0:S.innerText)||"";document.title=G;let J=m('[data-swup-persist]:not([data-swup-persist=""])'),K=f.containers.map((Y)=>{let Z=document.querySelector(Y),X=z.querySelector(Y);return Z&&X?(Z.replaceWith(X.cloneNode(!0)),!0):(Z||console.warn(`[swup] Container missing in current document: ${Y}`),X||console.warn(`[swup] Container missing in incoming document: ${Y}`),!1)}).filter(Boolean);return J.forEach((Y)=>{let Z=Y.getAttribute("data-swup-persist"),X=h(`[data-swup-persist="${Z}"]`);X&&X!==Y&&X.replaceWith(Y)}),K.length===f.containers.length},Vf=function(f){let S={behavior:"auto"},{target:z,reset:G}=f.scroll,J=z!=null?z:f.to.hash,K=!1;return J&&(K=this.hooks.callSync("scroll:anchor",f,{hash:J,options:S},(Y,{hash:Z,options:X})=>{let Q=this.getAnchorElement(Z);return Q&&Q.scrollIntoView(X),!!Q})),G&&!K&&(K=this.hooks.callSync("scroll:top",f,{options:S},(Y,{options:Z})=>(window.scrollTo($({top:0,left:0},Z)),!0))),K},Wf=async function(f){if(f.done)return;let S=this.hooks.call("animation:in:await",f,{skip:!1},(z,{skip:G})=>{if(!G)return this.awaitAnimations({selector:z.animation.selector})});await r(),await this.hooks.call("animation:in:start",f,void 0,()=>{this.classes.remove("is-animating")}),await S,await this.hooks.call("animation:in:end",f,void 0)},$f=async function(f,S){if(f.done)return;f.advance(6);let{url:z}=S;this.isSameResolvedUrl(T(),z)||(O(z),this.location=F.fromUrl(z),f.to.url=this.location.url,f.to.hash=this.location.hash),await this.hooks.call("content:replace",f,{page:S},(G,{})=>{if(this.classes.remove("is-leaving"),G.animation.animate&&this.classes.add("is-rendering"),!this.replaceContent(G))throw Error("[swup] Container mismatch, aborting");G.animation.animate&&(this.classes.add("is-changing","is-animating","is-rendering"),G.animation.name&&this.classes.add(`to-${o(G.animation.name)}`))}),await this.hooks.call("content:scroll",f,void 0,()=>this.scrollToContent(f)),await this.hooks.call("page:view",f,{url:this.location.url,title:document.title})},Cf=function(f){var S;if(S=f,Boolean(S==null?void 0:S.isSwupPlugin)){if(f.swup=this,!f._checkRequirements||f._checkRequirements())return f._beforeMount&&f._beforeMount(),f.mount(),this.plugins.push(f),this.plugins}else console.error("Not a swup plugin instance",f)};function Ff(f){let S=this.findPlugin(f);if(S)return S.unmount(),S._afterUnmount&&S._afterUnmount(),this.plugins=this.plugins.filter((z)=>z!==S),this.plugins;console.error("No such plugin",S)}function Hf(f){return this.plugins.find((S)=>S===f||S.name===f||S.name===`Swup${String(f)}`)}function _f(f){if(typeof this.options.resolveUrl!="function")return console.warn("[swup] options.resolveUrl expects a callback function."),f;let S=this.options.resolveUrl(f);return S&&typeof S=="string"?S.startsWith("//")||S.startsWith("http")?(console.warn("[swup] options.resolveUrl needs to return a relative url"),f):S:(console.warn("[swup] options.resolveUrl needs to return a url"),f)}function Of(f,S){return this.resolveUrl(f)===this.resolveUrl(S)}var Tf={animateHistoryBrowsing:!1,animationSelector:'[class*="transition-"]',animationScope:"html",cache:!0,containers:["#swup"],hooks:{},ignoreVisit:(f,{el:S}={})=>!(S==null||!S.closest("[data-no-swup]")),linkSelector:"a[href]",linkToSelf:"scroll",native:!1,plugins:[],resolveUrl:(f)=>f,requestHeaders:{"X-Requested-With":"swup",Accept:"text/html, application/xhtml+xml"},skipPopStateHandling:(f)=>{var S;return((S=f.state)==null?void 0:S.source)!=="swup"},timeout:0};class u{get currentPageUrl(){return this.location.url}constructor(f={}){var S,z;this.version="4.8.3",this.options=void 0,this.defaults=Tf,this.plugins=[],this.visit=void 0,this.cache=void 0,this.hooks=void 0,this.classes=void 0,this.location=F.fromUrl(window.location.href),this.currentHistoryIndex=void 0,this.clickDelegate=void 0,this.navigating=!1,this.onVisitEnd=void 0,this.use=Cf,this.unuse=Ff,this.findPlugin=Hf,this.log=()=>{},this.navigate=Df,this.performNavigation=If,this.createVisit=Zf,this.delegateEvent=Qf,this.fetchPage=Xf,this.awaitAnimations=Bf,this.renderPage=$f,this.replaceContent=Pf,this.animatePageIn=Wf,this.animatePageOut=Nf,this.scrollToContent=Vf,this.getAnchorElement=qf,this.getCurrentUrl=T,this.resolveUrl=_f,this.isSameResolvedUrl=Of,this.options=$({},this.defaults,f),this.handleLinkClick=this.handleLinkClick.bind(this),this.handlePopState=this.handlePopState.bind(this),this.cache=new l(this),this.classes=new n(this),this.hooks=new s(this),this.visit=this.createVisit({to:""}),this.currentHistoryIndex=(S=(z=window.history.state)==null?void 0:z.index)!=null?S:1,this.enable()}async enable(){var f;let{linkSelector:S}=this.options;this.clickDelegate=this.delegateEvent(S,"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((z)=>this.use(z));for(let[z,G]of Object.entries(this.options.hooks)){let[J,K]=this.hooks.parseName(z);this.hooks.on(J,G,K)}((f=window.history.state)==null?void 0:f.source)!=="swup"&&O(null,{index:this.currentHistoryIndex}),await r(),await this.hooks.call("enable",void 0,void 0,()=>{let z=document.documentElement;z.classList.add("swup-enabled"),z.classList.toggle("swup-native",this.options.native)})}async destroy(){this.clickDelegate.destroy(),window.removeEventListener("popstate",this.handlePopState),this.cache.clear(),this.options.plugins.forEach((f)=>this.unuse(f)),await this.hooks.call("disable",void 0,void 0,()=>{let f=document.documentElement;f.classList.remove("swup-enabled"),f.classList.remove("swup-native")}),this.hooks.clear()}shouldIgnoreVisit(f,{el:S,event:z}={}){let{origin:G,url:J,hash:K}=F.fromUrl(f);return G!==window.location.origin||!(!S||!this.triggerWillOpenNewWindow(S))||!!this.options.ignoreVisit(J+K,{el:S,event:z})}handleLinkClick(f){let S=f.delegateTarget,{href:z,url:G,hash:J}=F.fromElement(S);if(this.shouldIgnoreVisit(z,{el:S,event:f}))return;if(this.navigating&&G===this.visit.to.url)return void f.preventDefault();let K=this.createVisit({to:G,hash:J,el:S,event:f});f.metaKey||f.ctrlKey||f.shiftKey||f.altKey?this.hooks.callSync("link:newtab",K,{href:z}):f.button===0&&this.hooks.callSync("link:click",K,{el:S,event:f},()=>{var Y;let Z=(Y=K.from.url)!=null?Y:"";f.preventDefault(),G&&G!==Z?this.isSameResolvedUrl(G,Z)||this.performNavigation(K):J?this.hooks.callSync("link:anchor",K,{hash:J},()=>{O(G+J),this.scrollToContent(K)}):this.hooks.callSync("link:self",K,void 0,()=>{this.options.linkToSelf==="navigate"?this.performNavigation(K):(O(G),this.scrollToContent(K))})})}handlePopState(f){var S,z,G,J;let K=(S=(z=f.state)==null?void 0:z.url)!=null?S:window.location.href;if(this.options.skipPopStateHandling(f))return;if(this.isSameResolvedUrl(T(),this.location.url))return;let{url:Y,hash:Z}=F.fromUrl(K),X=this.createVisit({to:Y,hash:Z,event:f});X.history.popstate=!0;let Q=(G=(J=f.state)==null?void 0:J.index)!=null?G:0;Q&&Q!==this.currentHistoryIndex&&(X.history.direction=Q-this.currentHistoryIndex>0?"forwards":"backwards",this.currentHistoryIndex=Q),X.animation.animate=!1,X.scroll.reset=!1,X.scroll.target=!1,this.options.animateHistoryBrowsing&&(X.animation.animate=!0,X.scroll.reset=!0),this.hooks.callSync("history:popstate",X,{event:f},()=>{this.performNavigation(X)})}triggerWillOpenNewWindow(f){return!!f.matches('[download], [target="_blank"]')}}function A(){return A=Object.assign?Object.assign.bind():function(f){for(var S=1;S<arguments.length;S++){var z=arguments[S];for(var G in z)Object.prototype.hasOwnProperty.call(z,G)&&(f[G]=z[G])}return f},A.apply(this,arguments)}var e=(f)=>String(f).split(".").map((S)=>String(parseInt(S||"0",10))).concat(["0","0"]).slice(0,3).join(".");class x{constructor(){this.isSwupPlugin=!0,this.swup=void 0,this.version=void 0,this.requires={},this.handlersToUnregister=[]}mount(){}unmount(){this.handlersToUnregister.forEach((f)=>f()),this.handlersToUnregister=[]}_beforeMount(){if(!this.name)throw Error("You must define a name of plugin when creating a class.")}_afterUnmount(){}_checkRequirements(){return typeof this.requires!="object"||Object.entries(this.requires).forEach(([f,S])=>{if(!function(z,G,J){let K=function(Y,Z){var X;if(Y==="swup")return(X=Z.version)!=null?X:"";{var Q;let q=Z.findPlugin(Y);return(Q=q==null?void 0:q.version)!=null?Q:""}}(z,J);return!!K&&((Y,Z)=>Z.every((X)=>{let[,Q,q]=X.match(/^([\D]+)?(.*)$/)||[];var B,I;return((D,W)=>{let V={"":(P)=>P===0,">":(P)=>P>0,">=":(P)=>P>=0,"<":(P)=>P<0,"<=":(P)=>P<=0};return(V[W]||V[""])(D)})((I=q,B=e(B=Y),I=e(I),B.localeCompare(I,void 0,{numeric:!0})),Q||">=")}))(K,G)}(f,S=Array.isArray(S)?S:[S],this.swup)){let z=`${f} ${S.join(", ")}`;throw Error(`Plugin version mismatch: ${this.name} requires ${z}`)}}),!0}on(f,S,z={}){var G;S=!(G=S).name.startsWith("bound ")||G.hasOwnProperty("prototype")?S.bind(this):S;let J=this.swup.hooks.on(f,S,z);return this.handlersToUnregister.push(J),J}once(f,S,z={}){return this.on(f,S,A({},z,{once:!0}))}before(f,S,z={}){return this.on(f,S,A({},z,{before:!0}))}replace(f,S,z={}){return this.on(f,S,A({},z,{replace:!0}))}off(f,S){return this.swup.hooks.off(f,S)}}function L(){return L=Object.assign?Object.assign.bind():function(f){for(var S=1;S<arguments.length;S++){var z=arguments[S];for(var G in z)({}).hasOwnProperty.call(z,G)&&(f[G]=z[G])}return f},L.apply(null,arguments)}function t(f){return f.localName!=="title"&&!f.matches("[data-swup-theme]")}function ff(f,S){return f.outerHTML===S.outerHTML}function Sf(f,S=[]){let z=Array.from(f.attributes);return S.length?z.filter(({name:G})=>S.some((J)=>J instanceof RegExp?J.test(G):G===J)):z}function Af(f){return f.matches("link[rel=stylesheet][href]")}class g extends x{constructor(f={}){var S;super(),S=this,this.name="SwupHeadPlugin",this.requires={swup:">=4.6"},this.defaults={persistTags:!1,persistAssets:!1,awaitAssets:!1,attributes:["lang","dir"],timeout:3000},this.options=void 0,this.updateHead=async function(z,{page:{}}){let{awaitAssets:G,attributes:J,timeout:K}=S.options,Y=z.to.document,{removed:Z,added:X}=function(Q,q,{shouldPersist:B=()=>!1}={}){let I=Array.from(Q.children),D=Array.from(q.children),W=(V=I,D.reduce((N,H,R)=>(V.some((j)=>ff(H,j))||N.push({el:H,index:R}),N),[]));var V;let P=function(N,H){return N.reduce((R,j)=>(H.some((zf)=>ff(j,zf))||R.push({el:j}),R),[])}(I,D);P.reverse().filter(({el:N})=>t(N)).filter(({el:N})=>!B(N)).forEach(({el:N})=>Q.removeChild(N));let C=W.filter(({el:N})=>t(N)).map((N)=>{let H=N.el.cloneNode(!0);return Q.insertBefore(H,Q.children[(N.index||0)+1]||null),L({},N,{el:H})});return{removed:P.map(({el:N})=>N),added:C.map(({el:N})=>N)}}(document.head,Y.head,{shouldPersist:(Q)=>S.isPersistentTag(Q)});if(S.swup.log(`Removed ${Z.length} / added ${X.length} tags in head`),J!=null&&J.length&&function(Q,q,B=[]){let I=new Set;for(let{name:D,value:W}of Sf(q,B))Q.setAttribute(D,W),I.add(D);for(let{name:D}of Sf(Q,B))I.has(D)||Q.removeAttribute(D)}(document.documentElement,Y.documentElement,J),G){let Q=function(q,B=0){return q.filter(Af).map((I)=>function(D,W=0){let V,P=(C)=>{D.sheet?C():V=setTimeout(()=>P(C),10)};return new Promise((C)=>{P(()=>C(D)),W>0&&setTimeout(()=>{V&&clearTimeout(V),C(D)},W)})}(I,B))}(X,K);Q.length&&(S.swup.log(`Waiting for ${Q.length} assets to load`),await Promise.all(Q))}},this.options=L({},this.defaults,f),this.options.persistAssets&&!this.options.persistTags&&(this.options.persistTags="link[rel=stylesheet], script[src], style")}mount(){this.before("content:replace",this.updateHead)}isPersistentTag(f){let{persistTags:S}=this.options;return typeof S=="function"?S(f):typeof S=="string"&&S.length>0?f.matches(S):Boolean(S)}}function b(){return b=Object.assign?Object.assign.bind():function(f){for(var S=1;S<arguments.length;S++){var z=arguments[S];for(var G in z)Object.prototype.hasOwnProperty.call(z,G)&&(f[G]=z[G])}return f},b.apply(this,arguments)}class d extends x{constructor(f={}){super(),this.name="SwupScriptsPlugin",this.requires={swup:">=4"},this.defaults={head:!0,body:!0,optin:!1},this.options=void 0,this.options=b({},this.defaults,f)}mount(){this.on("content:replace",this.runScripts)}runScripts(){let{head:f,body:S,optin:z}=this.options,G=this.getScope({head:f,body:S});if(!G)return;let J=Array.from(G.querySelectorAll(z?"script[data-swup-reload-script]":"script:not([data-swup-ignore-script])"));J.forEach((K)=>this.runScript(K)),this.swup.log(`Executed ${J.length} scripts.`)}runScript(f){let S=document.createElement("script");for(let{name:z,value:G}of f.attributes)S.setAttribute(z,G);return S.textContent=f.textContent,f.replaceWith(S),S}getScope({head:f,body:S}){return f&&S?document:f?document.head:S?document.body:null}}var xf=new u({containers:["#swup"],cache:!0,native:!0,animationSelector:!1,plugins:[new g({persistTags:!0}),new d({optin:!0})]});window.swup=xf;
|