aptechka 0.47.10 → 0.47.11

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.
@@ -3,5 +3,6 @@ export declare class MorphLink {
3
3
  #private;
4
4
  constructor(element: HTMLAnchorElement, morph: Morph);
5
5
  get element(): HTMLAnchorElement;
6
+ checkCurrent(pathname: string): void;
6
7
  destroy(): void;
7
8
  }
@@ -1 +1 @@
1
- "use strict";var pt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Et=n=>{throw TypeError(n)};var $=(n,t,s)=>t.has(n)||Et("Cannot "+s);var e=(n,t,s)=>($(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?Et("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>($(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>($(n,t,"access private method"),s);var T=(n,t,s)=>new Promise((i,c)=>{var m=h=>{try{M(s.next(h))}catch(E){c(E)}},V=h=>{try{M(s.throw(h))}catch(E){c(E)}},M=h=>h.done?i(h.value):Promise.resolve(h.value).then(m,V);M((s=s.apply(n,t)).next())});var gt=(n,t,s)=>(t=n[pt("asyncIterator")])?t.call(n):(n=n[pt("iterator")](),t={},s=(i,c)=>(c=n[i])&&(t[i]=m=>new Promise((V,M,h)=>(m=c.call(n,m),h=m.done,Promise.resolve(m.value).then(E=>V({value:E,done:h}),M)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("../index-Cqw2NKev.cjs"),J=require("../events-KVanG9sR.cjs"),Ct=require("../polyfills-Df4r-ETT.cjs"),Ht=require("../scroll-H9zqFeML.cjs"),Q=require("../url-CLvdjbII.cjs"),kt=require("../css-value-parser/index.cjs");class wt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}St.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",wt);var R,u,C,O,q;class vt{constructor(t,s){o(this,R);o(this,u);o(this,C);o(this,O,t=>{t.preventDefault();const s=e(this,u).getAttribute("data-history-action")||"push",i=e(this,u).hasAttribute("data-center-scroll"),c=getComputedStyle(e(this,u)).getPropertyValue("--offset-scroll").trim(),m=c?kt.cssValueParser.parse(c):void 0,V=e(this,u).hasAttribute("data-revalidate");e(this,R).navigate(e(this,C),{historyAction:s,centerScroll:i,offsetScroll:m,revalidate:V})});o(this,q,()=>{e(this,R).prefetch(e(this,C)),e(this,u).removeEventListener("pointerenter",e(this,q))});a(this,R,s),a(this,u,t),a(this,C,e(this,u).getAttribute("href")||"/"),e(this,u).addEventListener("click",e(this,O));const i=s.normalizePath(e(this,C)),c=s.normalizePath(location.pathname);e(this,u).hasAttribute("data-include")&&c.pathname.includes(i.pathname)?e(this,u).classList.add("current"):i.pathname===c.pathname&&e(this,u).classList.add("current"),e(this,u).hasAttribute("data-prefetch")&&e(this,u).addEventListener("pointerenter",e(this,q))}get element(){return e(this,u)}destroy(){e(this,u).removeEventListener("click",e(this,O)),e(this,u).removeEventListener("pointerenter",e(this,q)),e(this,u).classList.remove("current")}}R=new WeakMap,u=new WeakMap,C=new WeakMap,O=new WeakMap,q=new WeakMap;var H,z,p,k,x,L;class yt{constructor(t,s,i){o(this,H);o(this,z);o(this,p,{x:0,y:0});o(this,k);o(this,x,null);o(this,L,null);a(this,H,t),a(this,z,s),a(this,k,i.cloneNode(!0))}get pathname(){return e(this,z)}get scrollState(){return e(this,p)}get document(){return e(this,L)}cloneDocument(){a(this,L,(e(this,x)||e(this,k)).cloneNode(!0))}get title(){let t="";if(e(this,L).title)t=e(this,L).title;else{const s=e(this,L).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,z)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,x,null)}saveScrollState(){e(this,k).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,H).scrollElement.scrollLeft,e(this,p).y=e(this,H).scrollElement.scrollTop)}saveDocumentState(){e(this,k).documentElement.hasAttribute("data-no-page-restoration")?a(this,x,null):a(this,x,document.cloneNode(!0))}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}H=new WeakMap,z=new WeakMap,p=new WeakMap,k=new WeakMap,x=new WeakMap,L=new WeakMap;var b,W,y,U,P,f,j,N,A,F,I,D,l,tt,et,st,Lt,it,nt,rt,ot,X;class xt{constructor(t){o(this,l);o(this,b,null);o(this,W,null);o(this,y,[]);o(this,U,new DOMParser);o(this,P);o(this,f,null);o(this,j);o(this,N,[]);o(this,A,!1);o(this,F,null);o(this,I,new Map);o(this,D,null);o(this,X,t=>T(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(a(this,A,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,A,!1))}));if(St.isBrowser){a(this,b,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,W,d(this,l,st).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,f,s.pathname),e(this,I).set(e(this,f),new yt(this,e(this,f),document)),document.documentElement.setAttribute("data-current-pathname",e(this,f)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),Q.changeHistory({action:"replace",pathname:e(this,f),searchParameters:s.parameters,hash:s.hash}),a(this,D,new wt),d(this,l,rt).call(this,document)}}get currentPathname(){return e(this,f)}get previousPathname(){return e(this,j)}get links(){return e(this,y)}get scrollElement(){return e(this,F)}normalizePath(t){return Q.splitPath(t,{base:e(this,b).base,trailingSlash:e(this,b).trailingSlash})}prefetch(t){return T(this,null,function*(){const s=this.normalizePath(t);d(this,l,et).call(this,s.pathname)})}navigate(V){return T(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:c,revalidate:m}={}){if(e(this,N).length)return;const M=this.normalizePath(t);let{pathname:h,hash:E,parameters:bt,leaf:Pt}=M;if(e(this,P)===h||e(this,f)===h){e(this,A)||d(this,l,ot).call(this,E||0,{centerScroll:i,offsetScroll:c,behavior:"smooth"});return}a(this,P,h);try{let _=!0;if(this.preprocessor)try{yield new Promise((r,S)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:h,resolve:r,reject:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),_=!1}if(!_||e(this,P)!==h)return;const at=yield d(this,l,tt).call(this,e(this,f)),v=yield d(this,l,tt).call(this,h,m);if(e(this,P)!==h)return;at.saveScrollState(),at.saveDocumentState(),e(this,A)||(v.clearScrollState(),v.clearDocumentState()),v.cloneDocument(),e(this,D).textContent=v.title,document.body.appendChild(e(this,D));const lt={pathname:h};J.dispatchEvent(document,"morphStart",{detail:lt});const ht=Array.from(document.head.children),ct=Array.from(v.document.head.children),ut=d(this,l,Lt).call(this,ht,ct),At=d(this,l,it).call(this,ht,ut),K=d(this,l,it).call(this,ct,ut);K.forEach((r,S)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=r.getAttribute("src"),K[S]=w}}),K.forEach(r=>{document.head.appendChild(r)});const Z=K.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,l,nt).call(this,r))return!0});e(this,b).waitForHeadToLoad&&Z.length&&(yield new Promise(r=>T(this,null,function*(){let S=0;try{for(var w=gt(Z),mt,B,ft;mt=!(B=yield w.next()).done;mt=!1){const Y=B.value;Y.onload=()=>{S++,S===Z.length&&r()}}}catch(B){ft=[B]}finally{try{mt&&(B=w.return)&&(yield B.call(w))}finally{if(ft)throw ft[0]}}})));const dt=[];At.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,l,nt).call(this,r)?dt.push(r):r.remove())});const Mt=d(this,l,st).call(this,v.document.body);d(this,l,rt).call(this,v.document),document.documentElement.setAttribute("data-current-pathname",h),document.documentElement.setAttribute("data-current-leaf",Pt),Q.changeHistory({action:s,pathname:h,searchParameters:bt,hash:E}),e(this,D).remove(),a(this,j,e(this,f)),a(this,f,h),e(this,W).forEach((r,S)=>{const w=Mt[S],mt=getComputedStyle(r).getPropertyValue("--morph-duration"),B=[...w.childNodes];if(mt){const ft=[...r.childNodes];ft.forEach(g=>{g instanceof HTMLElement&&g.classList.add("old")}),B.forEach(g=>{g instanceof HTMLElement&&g.classList.add("new")}),r.prepend(...B),Ct.requestIdleCallback(()=>{B.forEach(g=>{g instanceof HTMLElement&&g.classList.add("in")})});const Y={morphElement:r,pathname:h};J.dispatchEvent(document,"morphNewChildrenAdded",{detail:Y});const Tt=new Promise(g=>{setTimeout(()=>{ft.forEach(G=>G.remove()),B.forEach(G=>{G instanceof HTMLElement&&G.classList.remove("in","new")}),J.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Y}),g()},(parseFloat(mt)||0)*1e3+10)});e(this,N).push(Tt)}else r.innerHTML="",r.append(...B)}),E?(v.clearScrollState(),d(this,l,ot).call(this,E,{centerScroll:i,offsetScroll:c})):e(this,A)&&v.restoreScrollPosition(),yield Promise.all(e(this,N)),dt.forEach(r=>r.remove()),a(this,N,[]),this.findLinks(),J.dispatchEvent(document,"morphComplete",{detail:lt}),window.dispatchEvent(new Event("resize"))}catch(_){console.error(_)}a(this,P,void 0)})}addLink(t){e(this,y).push(new vt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,y,e(this,y).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var i;return((i=s.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,y).forEach(s=>s.destroy()),a(this,y,t.map(s=>new vt(s,this)))}}b=new WeakMap,W=new WeakMap,y=new WeakMap,U=new WeakMap,P=new WeakMap,f=new WeakMap,j=new WeakMap,N=new WeakMap,A=new WeakMap,F=new WeakMap,I=new WeakMap,D=new WeakMap,l=new WeakSet,tt=function(t,s=!1){return T(this,null,function*(){let i=e(this,I).get(t);return(!i||s)&&(i=yield d(this,l,et).call(this,t)),i})},et=function(t){return T(this,null,function*(){const i=yield(yield fetch(t)).text(),c=e(this,U).parseFromString(i,"text/html"),m=new yt(this,t,c);return e(this,I).set(t,m),m})},st=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(i=>s.find(c=>c.outerHTML===i.outerHTML))},it=function(t,s){return t.filter(i=>!s.find(c=>c.outerHTML===i.outerHTML))},nt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},rt=function(t){a(this,F,t.querySelector(e(this,b).scrollSelector)||t.documentElement)},ot=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ht.scrollToElement(i,{scrollElement:e(this,F),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},X=new WeakMap;exports.Morph=xt;
1
+ "use strict";var pt=(i,t)=>(t=Symbol[i])?t:Symbol.for("Symbol."+i),Et=i=>{throw TypeError(i)};var $=(i,t,s)=>t.has(i)||Et("Cannot "+s);var e=(i,t,s)=>($(i,t,"read from private field"),s?s.call(i):t.get(i)),o=(i,t,s)=>t.has(i)?Et("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),a=(i,t,s,r)=>($(i,t,"write to private field"),r?r.call(i,s):t.set(i,s),s),d=(i,t,s)=>($(i,t,"access private method"),s);var M=(i,t,s)=>new Promise((r,u)=>{var f=l=>{try{k(s.next(l))}catch(g){u(g)}},B=l=>{try{k(s.throw(l))}catch(g){u(g)}},k=l=>l.done?r(l.value):Promise.resolve(l.value).then(f,B);k((s=s.apply(i,t)).next())});var gt=(i,t,s)=>(t=i[pt("asyncIterator")])?t.call(i):(i=i[pt("iterator")](),t={},s=(r,u)=>(u=i[r])&&(t[r]=f=>new Promise((B,k,l)=>(f=u.call(i,f),l=f.done,Promise.resolve(f.value).then(g=>B({value:g,done:l}),k)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("../index-Cqw2NKev.cjs"),G=require("../events-KVanG9sR.cjs"),Mt=require("../polyfills-Df4r-ETT.cjs"),Tt=require("../scroll-H9zqFeML.cjs"),J=require("../url-CLvdjbII.cjs"),Ht=require("../css-value-parser/index.cjs");class wt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,r]of Object.entries(t))this.setAttribute(s,r)}}St.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",wt);var L,c,T,W,z;class vt{constructor(t,s){o(this,L);o(this,c);o(this,T);o(this,W,t=>{t.preventDefault();const s=e(this,c).getAttribute("data-history-action")||"push",r=e(this,c).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,c)).getPropertyValue("--offset-scroll").trim(),f=u?Ht.cssValueParser.parse(u):void 0,B=e(this,c).hasAttribute("data-revalidate");e(this,L).navigate(e(this,T),{historyAction:s,centerScroll:r,offsetScroll:f,revalidate:B})});o(this,z,()=>{e(this,L).prefetch(e(this,T)),e(this,c).removeEventListener("pointerenter",e(this,z))});a(this,L,s),a(this,c,t),a(this,T,e(this,c).getAttribute("href")||"/"),e(this,c).addEventListener("click",e(this,W)),this.checkCurrent(e(this,L).normalizePath(e(this,T)).pathname),e(this,c).hasAttribute("data-prefetch")&&e(this,c).addEventListener("pointerenter",e(this,z))}get element(){return e(this,c)}checkCurrent(t){const s=e(this,L).normalizePath(location.pathname);e(this,c).hasAttribute("data-include")&&s.pathname.includes(t)?e(this,c).classList.add("current"):t===s.pathname&&e(this,c).classList.add("current")}destroy(){e(this,c).removeEventListener("click",e(this,W)),e(this,c).removeEventListener("pointerenter",e(this,z)),e(this,c).classList.remove("current")}}L=new WeakMap,c=new WeakMap,T=new WeakMap,W=new WeakMap,z=new WeakMap;var H,F,p,x,N,b;class yt{constructor(t,s,r){o(this,H);o(this,F);o(this,p,{x:0,y:0});o(this,x);o(this,N,null);o(this,b,null);a(this,H,t),a(this,F,s),a(this,x,r.cloneNode(!0))}get pathname(){return e(this,F)}get scrollState(){return e(this,p)}get document(){return e(this,b)}cloneDocument(){a(this,b,(e(this,N)||e(this,x)).cloneNode(!0))}get title(){let t="";if(e(this,b).title)t=e(this,b).title;else{const s=e(this,b).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,F)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,N,null)}saveScrollState(){e(this,x).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,H).scrollElement.scrollLeft,e(this,p).y=e(this,H).scrollElement.scrollTop)}saveDocumentState(){e(this,x).documentElement.hasAttribute("data-no-page-restoration")?a(this,N,null):a(this,N,document.cloneNode(!0))}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}H=new WeakMap,F=new WeakMap,p=new WeakMap,x=new WeakMap,N=new WeakMap,b=new WeakMap;var P,j,E,Q,A,m,_,D,C,I,V,R,h,tt,et,st,Lt,it,rt,nt,ot,X;class xt{constructor(t){o(this,h);o(this,P,null);o(this,j,null);o(this,E,[]);o(this,Q,new DOMParser);o(this,A);o(this,m,null);o(this,_);o(this,D,[]);o(this,C,!1);o(this,I,null);o(this,V,new Map);o(this,R,null);o(this,X,t=>M(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(a(this,C,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,C,!1))}));if(St.isBrowser){a(this,P,{base:J.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,j,d(this,h,st).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,m,s.pathname),e(this,V).set(e(this,m),new yt(this,e(this,m),document)),document.documentElement.setAttribute("data-current-pathname",e(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,X)),J.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters,hash:s.hash}),a(this,R,new wt),d(this,h,nt).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,_)}get links(){return e(this,E)}get scrollElement(){return e(this,I)}normalizePath(t){return J.splitPath(t,{base:e(this,P).base,trailingSlash:e(this,P).trailingSlash})}prefetch(t){return M(this,null,function*(){const s=this.normalizePath(t);d(this,h,et).call(this,s.pathname)})}navigate(B){return M(this,arguments,function*(t,{historyAction:s="push",centerScroll:r,offsetScroll:u,revalidate:f}={}){if(e(this,D).length)return;const k=this.normalizePath(t);let{pathname:l,hash:g,parameters:bt,leaf:Pt}=k;if(e(this,A)===l||e(this,m)===l){e(this,C)||d(this,h,ot).call(this,g||0,{centerScroll:r,offsetScroll:u,behavior:"smooth"});return}e(this,E).forEach(q=>{q.checkCurrent(l)}),a(this,A,l);try{let q=!0;if(this.preprocessor)try{yield new Promise((n,S)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:l,resolve:n,reject:S})})}catch(n){n?console.error(n):console.log("Route change canceled"),q=!1}if(!q||e(this,A)!==l){e(this,E).forEach(n=>{n.checkCurrent(e(this,m))});return}const at=yield d(this,h,tt).call(this,e(this,m)),y=yield d(this,h,tt).call(this,l,f);if(e(this,A)!==l){e(this,E).forEach(n=>{n.checkCurrent(e(this,m))});return}at.saveScrollState(),at.saveDocumentState(),e(this,C)||(y.clearScrollState(),y.clearDocumentState()),y.cloneDocument(),e(this,R).textContent=y.title,document.body.appendChild(e(this,R));const ht={pathname:l};G.dispatchEvent(document,"morphStart",{detail:ht});const lt=Array.from(document.head.children),ct=Array.from(y.document.head.children),ut=d(this,h,Lt).call(this,lt,ct),At=d(this,h,it).call(this,lt,ut),K=d(this,h,it).call(this,ct,ut);K.forEach((n,S)=>{if(n.tagName==="SCRIPT"&&n.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=n.getAttribute("src"),K[S]=w}}),K.forEach(n=>{document.head.appendChild(n)});const Z=K.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(d(this,h,rt).call(this,n))return!0});e(this,P).waitForHeadToLoad&&Z.length&&(yield new Promise(n=>M(this,null,function*(){let S=0;try{for(var w=gt(Z),mt,O,ft;mt=!(O=yield w.next()).done;mt=!1){const U=O.value;U.onload=()=>{S++,S===Z.length&&n()}}}catch(O){ft=[O]}finally{try{mt&&(O=w.return)&&(yield O.call(w))}finally{if(ft)throw ft[0]}}})));const dt=[];At.forEach(n=>{n.hasAttribute("data-permanent")||(d(this,h,rt).call(this,n)?dt.push(n):n.remove())});const Ct=d(this,h,st).call(this,y.document.body);d(this,h,nt).call(this,y.document),document.documentElement.setAttribute("data-current-pathname",l),document.documentElement.setAttribute("data-current-leaf",Pt),J.changeHistory({action:s,pathname:l,searchParameters:bt,hash:g}),e(this,R).remove(),a(this,_,e(this,m)),a(this,m,l),e(this,j).forEach((n,S)=>{const w=Ct[S],mt=getComputedStyle(n).getPropertyValue("--morph-duration"),O=[...w.childNodes];if(mt){const ft=[...n.childNodes];ft.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),O.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),n.prepend(...O),Mt.requestIdleCallback(()=>{O.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const U={morphElement:n,pathname:l};G.dispatchEvent(document,"morphNewChildrenAdded",{detail:U});const kt=new Promise(v=>{setTimeout(()=>{ft.forEach(Y=>Y.remove()),O.forEach(Y=>{Y instanceof HTMLElement&&Y.classList.remove("in","new")}),G.dispatchEvent(document,"morphOldChildrenRemoved",{detail:U}),v()},(parseFloat(mt)||0)*1e3+10)});e(this,D).push(kt)}else n.innerHTML="",n.append(...O)}),g?(y.clearScrollState(),d(this,h,ot).call(this,g,{centerScroll:r,offsetScroll:u})):e(this,C)&&y.restoreScrollPosition(),yield Promise.all(e(this,D)),dt.forEach(n=>n.remove()),a(this,D,[]),this.findLinks(),G.dispatchEvent(document,"morphComplete",{detail:ht}),window.dispatchEvent(new Event("resize"))}catch(q){console.error(q)}a(this,A,void 0)})}addLink(t){e(this,E).push(new vt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var r;return((r=s.getAttribute("href"))==null?void 0:r.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,E).forEach(s=>s.destroy()),a(this,E,t.map(s=>new vt(s,this)))}}P=new WeakMap,j=new WeakMap,E=new WeakMap,Q=new WeakMap,A=new WeakMap,m=new WeakMap,_=new WeakMap,D=new WeakMap,C=new WeakMap,I=new WeakMap,V=new WeakMap,R=new WeakMap,h=new WeakSet,tt=function(t,s=!1){return M(this,null,function*(){let r=e(this,V).get(t);return(!r||s)&&(r=yield d(this,h,et).call(this,t)),r})},et=function(t){return M(this,null,function*(){const r=yield(yield fetch(t)).text(),u=e(this,Q).parseFromString(r,"text/html"),f=new yt(this,t,u);return e(this,V).set(t,f),f})},st=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Lt=function(t,s){return t.filter(r=>s.find(u=>u.outerHTML===r.outerHTML))},it=function(t,s){return t.filter(r=>!s.find(u=>u.outerHTML===r.outerHTML))},rt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},nt=function(t){a(this,I,t.querySelector(e(this,P).scrollSelector)||t.documentElement)},ot=function(t,s){const r=typeof t=="string"?document.getElementById(t):t;(typeof r=="number"||r)&&Tt.scrollToElement(r,{scrollElement:e(this,I),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},X=new WeakMap;exports.Morph=xt;
@@ -1,30 +1,30 @@
1
- var ft = (n, t) => (t = Symbol[n]) ? t : Symbol.for("Symbol." + n), pt = (n) => {
2
- throw TypeError(n);
1
+ var ft = (i, t) => (t = Symbol[i]) ? t : Symbol.for("Symbol." + i), pt = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var _ = (n, t, s) => t.has(n) || pt("Cannot " + s);
5
- var e = (n, t, s) => (_(n, t, "read from private field"), s ? s.call(n) : t.get(n)), o = (n, t, s) => t.has(n) ? pt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s), a = (n, t, s, i) => (_(n, t, "write to private field"), i ? i.call(n, s) : t.set(n, s), s), d = (n, t, s) => (_(n, t, "access private method"), s);
6
- var C = (n, t, s) => new Promise((i, c) => {
7
- var m = (h) => {
4
+ var _ = (i, t, s) => t.has(i) || pt("Cannot " + s);
5
+ var e = (i, t, s) => (_(i, t, "read from private field"), s ? s.call(i) : t.get(i)), o = (i, t, s) => t.has(i) ? pt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), a = (i, t, s, r) => (_(i, t, "write to private field"), r ? r.call(i, s) : t.set(i, s), s), d = (i, t, s) => (_(i, t, "access private method"), s);
6
+ var T = (i, t, s) => new Promise((r, u) => {
7
+ var f = (l) => {
8
8
  try {
9
- T(s.next(h));
10
- } catch (E) {
11
- c(E);
9
+ k(s.next(l));
10
+ } catch (g) {
11
+ u(g);
12
12
  }
13
- }, V = (h) => {
13
+ }, B = (l) => {
14
14
  try {
15
- T(s.throw(h));
16
- } catch (E) {
17
- c(E);
15
+ k(s.throw(l));
16
+ } catch (g) {
17
+ u(g);
18
18
  }
19
- }, T = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(m, V);
20
- T((s = s.apply(n, t)).next());
19
+ }, k = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(f, B);
20
+ k((s = s.apply(i, t)).next());
21
21
  });
22
- var Et = (n, t, s) => (t = n[ft("asyncIterator")]) ? t.call(n) : (n = n[ft("iterator")](), t = {}, s = (i, c) => (c = n[i]) && (t[i] = (m) => new Promise((V, T, h) => (m = c.call(n, m), h = m.done, Promise.resolve(m.value).then((E) => V({ value: E, done: h }), T)))), s("next"), s("return"), t);
22
+ var Et = (i, t, s) => (t = i[ft("asyncIterator")]) ? t.call(i) : (i = i[ft("iterator")](), t = {}, s = (r, u) => (u = i[r]) && (t[r] = (f) => new Promise((B, k, l) => (f = u.call(i, f), l = f.done, Promise.resolve(f.value).then((g) => B({ value: g, done: l }), k)))), s("next"), s("return"), t);
23
23
  import { i as yt } from "../index-euf5anj6.js";
24
- import { d as Q } from "../events-CsVF98U6.js";
25
- import { r as Mt } from "../polyfills-DJrTJQky.js";
26
- import { s as Ht } from "../scroll-myLAt-Tq.js";
27
- import { n as kt, c as gt, s as xt } from "../url-CfcHdBT6.js";
24
+ import { d as J } from "../events-CsVF98U6.js";
25
+ import { r as Tt } from "../polyfills-DJrTJQky.js";
26
+ import { s as Mt } from "../scroll-myLAt-Tq.js";
27
+ import { n as Ht, c as gt, s as xt } from "../url-CfcHdBT6.js";
28
28
  import { cssValueParser as Nt } from "../css-value-parser/index.js";
29
29
  class Lt extends HTMLElement {
30
30
  connectedCallback() {
@@ -33,74 +33,76 @@ class Lt extends HTMLElement {
33
33
  "aria-atomic": "true",
34
34
  style: "position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"
35
35
  };
36
- for (const [s, i] of Object.entries(t))
37
- this.setAttribute(s, i);
36
+ for (const [s, r] of Object.entries(t))
37
+ this.setAttribute(s, r);
38
38
  }
39
39
  }
40
40
  yt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", Lt);
41
- var R, u, M, O, z;
41
+ var w, c, M, W, q;
42
42
  class vt {
43
43
  constructor(t, s) {
44
- o(this, R);
45
- o(this, u);
44
+ o(this, w);
45
+ o(this, c);
46
46
  o(this, M);
47
- o(this, O, (t) => {
47
+ o(this, W, (t) => {
48
48
  t.preventDefault();
49
- const s = e(this, u).getAttribute(
49
+ const s = e(this, c).getAttribute(
50
50
  "data-history-action"
51
- ) || "push", i = e(this, u).hasAttribute("data-center-scroll"), c = getComputedStyle(e(this, u)).getPropertyValue("--offset-scroll").trim(), m = c ? Nt.parse(c) : void 0, V = e(this, u).hasAttribute("data-revalidate");
52
- e(this, R).navigate(e(this, M), {
51
+ ) || "push", r = e(this, c).hasAttribute("data-center-scroll"), u = getComputedStyle(e(this, c)).getPropertyValue("--offset-scroll").trim(), f = u ? Nt.parse(u) : void 0, B = e(this, c).hasAttribute("data-revalidate");
52
+ e(this, w).navigate(e(this, M), {
53
53
  historyAction: s,
54
- centerScroll: i,
55
- offsetScroll: m,
56
- revalidate: V
54
+ centerScroll: r,
55
+ offsetScroll: f,
56
+ revalidate: B
57
57
  });
58
58
  });
59
- o(this, z, () => {
60
- e(this, R).prefetch(e(this, M)), e(this, u).removeEventListener("pointerenter", e(this, z));
59
+ o(this, q, () => {
60
+ e(this, w).prefetch(e(this, M)), e(this, c).removeEventListener("pointerenter", e(this, q));
61
61
  });
62
- a(this, R, s), a(this, u, t), a(this, M, e(this, u).getAttribute("href") || "/"), e(this, u).addEventListener("click", e(this, O));
63
- const i = s.normalizePath(e(this, M)), c = s.normalizePath(location.pathname);
64
- e(this, u).hasAttribute("data-include") && c.pathname.includes(i.pathname) ? e(this, u).classList.add("current") : i.pathname === c.pathname && e(this, u).classList.add("current"), e(this, u).hasAttribute("data-prefetch") && e(this, u).addEventListener("pointerenter", e(this, z));
62
+ a(this, w, s), a(this, c, t), a(this, M, e(this, c).getAttribute("href") || "/"), e(this, c).addEventListener("click", e(this, W)), this.checkCurrent(e(this, w).normalizePath(e(this, M)).pathname), e(this, c).hasAttribute("data-prefetch") && e(this, c).addEventListener("pointerenter", e(this, q));
65
63
  }
66
64
  get element() {
67
- return e(this, u);
65
+ return e(this, c);
66
+ }
67
+ checkCurrent(t) {
68
+ const s = e(this, w).normalizePath(location.pathname);
69
+ e(this, c).hasAttribute("data-include") && s.pathname.includes(t) ? e(this, c).classList.add("current") : t === s.pathname && e(this, c).classList.add("current");
68
70
  }
69
71
  destroy() {
70
- e(this, u).removeEventListener("click", e(this, O)), e(this, u).removeEventListener("pointerenter", e(this, z)), e(this, u).classList.remove("current");
72
+ e(this, c).removeEventListener("click", e(this, W)), e(this, c).removeEventListener("pointerenter", e(this, q)), e(this, c).classList.remove("current");
71
73
  }
72
74
  }
73
- R = new WeakMap(), u = new WeakMap(), M = new WeakMap(), O = new WeakMap(), z = new WeakMap();
74
- var H, q, p, k, x, w;
75
+ w = new WeakMap(), c = new WeakMap(), M = new WeakMap(), W = new WeakMap(), q = new WeakMap();
76
+ var H, F, p, x, N, b;
75
77
  class St {
76
- constructor(t, s, i) {
78
+ constructor(t, s, r) {
77
79
  o(this, H);
78
- o(this, q);
80
+ o(this, F);
79
81
  o(this, p, { x: 0, y: 0 });
80
- o(this, k);
81
- o(this, x, null);
82
- o(this, w, null);
83
- a(this, H, t), a(this, q, s), a(this, k, i.cloneNode(!0));
82
+ o(this, x);
83
+ o(this, N, null);
84
+ o(this, b, null);
85
+ a(this, H, t), a(this, F, s), a(this, x, r.cloneNode(!0));
84
86
  }
85
87
  get pathname() {
86
- return e(this, q);
88
+ return e(this, F);
87
89
  }
88
90
  get scrollState() {
89
91
  return e(this, p);
90
92
  }
91
93
  get document() {
92
- return e(this, w);
94
+ return e(this, b);
93
95
  }
94
96
  cloneDocument() {
95
- a(this, w, (e(this, x) || e(this, k)).cloneNode(!0));
97
+ a(this, b, (e(this, N) || e(this, x)).cloneNode(!0));
96
98
  }
97
99
  get title() {
98
100
  let t = "";
99
- if (e(this, w).title)
100
- t = e(this, w).title;
101
+ if (e(this, b).title)
102
+ t = e(this, b).title;
101
103
  else {
102
- const s = e(this, w).querySelector("h1");
103
- t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, q);
104
+ const s = e(this, b).querySelector("h1");
105
+ t = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || e(this, F);
104
106
  }
105
107
  return t;
106
108
  }
@@ -108,17 +110,17 @@ class St {
108
110
  e(this, p).x = 0, e(this, p).y = 0;
109
111
  }
110
112
  clearDocumentState() {
111
- a(this, x, null);
113
+ a(this, N, null);
112
114
  }
113
115
  saveScrollState() {
114
- e(this, k).documentElement.hasAttribute(
116
+ e(this, x).documentElement.hasAttribute(
115
117
  "data-no-scroll-restoration"
116
118
  ) ? (e(this, p).x = 0, e(this, p).y = 0) : (e(this, p).x = e(this, H).scrollElement.scrollLeft, e(this, p).y = e(this, H).scrollElement.scrollTop);
117
119
  }
118
120
  saveDocumentState() {
119
- e(this, k).documentElement.hasAttribute(
121
+ e(this, x).documentElement.hasAttribute(
120
122
  "data-no-page-restoration"
121
- ) ? a(this, x, null) : a(this, x, document.cloneNode(!0));
123
+ ) ? a(this, N, null) : a(this, N, document.cloneNode(!0));
122
124
  }
123
125
  restoreScrollPosition() {
124
126
  e(this, H).scrollElement.scroll({
@@ -127,155 +129,165 @@ class St {
127
129
  });
128
130
  }
129
131
  }
130
- H = new WeakMap(), q = new WeakMap(), p = new WeakMap(), k = new WeakMap(), x = new WeakMap(), w = new WeakMap();
131
- var b, W, S, U, P, f, j, N, A, F, I, D, l, $, tt, et, wt, st, it, nt, rt, X;
132
+ H = new WeakMap(), F = new WeakMap(), p = new WeakMap(), x = new WeakMap(), N = new WeakMap(), b = new WeakMap();
133
+ var P, j, E, Q, A, m, K, D, C, I, V, R, h, $, tt, et, wt, st, it, rt, nt, X;
132
134
  class Bt {
133
135
  constructor(t) {
134
- o(this, l);
135
- o(this, b, null);
136
- o(this, W, null);
137
- o(this, S, []);
138
- o(this, U, new DOMParser());
139
- o(this, P);
140
- o(this, f, null);
141
- o(this, j);
142
- o(this, N, []);
143
- o(this, A, !1);
144
- o(this, F, null);
145
- o(this, I, /* @__PURE__ */ new Map());
146
- o(this, D, null);
147
- o(this, X, (t) => C(this, null, function* () {
136
+ o(this, h);
137
+ o(this, P, null);
138
+ o(this, j, null);
139
+ o(this, E, []);
140
+ o(this, Q, new DOMParser());
141
+ o(this, A);
142
+ o(this, m, null);
143
+ o(this, K);
144
+ o(this, D, []);
145
+ o(this, C, !1);
146
+ o(this, I, null);
147
+ o(this, V, /* @__PURE__ */ new Map());
148
+ o(this, R, null);
149
+ o(this, X, (t) => T(this, null, function* () {
148
150
  var s;
149
- (s = t.state) != null && s.path && (a(this, A, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, A, !1));
151
+ (s = t.state) != null && s.path && (a(this, C, !0), yield this.navigate(t.state.path, { historyAction: "none" }), a(this, C, !1));
150
152
  }));
151
153
  if (yt) {
152
- a(this, b, {
153
- base: kt(t == null ? void 0 : t.base),
154
+ a(this, P, {
155
+ base: Ht(t == null ? void 0 : t.base),
154
156
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
155
157
  cachePages: (t == null ? void 0 : t.cachePages) !== !1,
156
158
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
157
159
  scrollSelector: (t == null ? void 0 : t.scrollSelector) || "body"
158
- }), a(this, W, d(this, l, et).call(this, document.body));
160
+ }), a(this, j, d(this, h, et).call(this, document.body));
159
161
  const s = this.normalizePath(
160
162
  location.pathname + location.hash
161
163
  );
162
- a(this, f, s.pathname), e(this, I).set(
163
- e(this, f),
164
- new St(this, e(this, f), document)
164
+ a(this, m, s.pathname), e(this, V).set(
165
+ e(this, m),
166
+ new St(this, e(this, m), document)
165
167
  ), document.documentElement.setAttribute(
166
168
  "data-current-pathname",
167
- e(this, f)
169
+ e(this, m)
168
170
  ), document.documentElement.setAttribute(
169
171
  "data-current-leaf",
170
172
  s.leaf
171
173
  ), this.findLinks(), addEventListener("popstate", e(this, X)), gt({
172
174
  action: "replace",
173
- pathname: e(this, f),
175
+ pathname: e(this, m),
174
176
  searchParameters: s.parameters,
175
177
  hash: s.hash
176
- }), a(this, D, new Lt()), d(this, l, nt).call(this, document);
178
+ }), a(this, R, new Lt()), d(this, h, rt).call(this, document);
177
179
  }
178
180
  }
179
181
  get currentPathname() {
180
- return e(this, f);
182
+ return e(this, m);
181
183
  }
182
184
  get previousPathname() {
183
- return e(this, j);
185
+ return e(this, K);
184
186
  }
185
187
  get links() {
186
- return e(this, S);
188
+ return e(this, E);
187
189
  }
188
190
  get scrollElement() {
189
- return e(this, F);
191
+ return e(this, I);
190
192
  }
191
193
  normalizePath(t) {
192
194
  return xt(t, {
193
- base: e(this, b).base,
194
- trailingSlash: e(this, b).trailingSlash
195
+ base: e(this, P).base,
196
+ trailingSlash: e(this, P).trailingSlash
195
197
  });
196
198
  }
197
199
  prefetch(t) {
198
- return C(this, null, function* () {
200
+ return T(this, null, function* () {
199
201
  const s = this.normalizePath(t);
200
- d(this, l, tt).call(this, s.pathname);
202
+ d(this, h, tt).call(this, s.pathname);
201
203
  });
202
204
  }
203
- navigate(V) {
204
- return C(this, arguments, function* (t, {
205
+ navigate(B) {
206
+ return T(this, arguments, function* (t, {
205
207
  historyAction: s = "push",
206
- centerScroll: i,
207
- offsetScroll: c,
208
- revalidate: m
208
+ centerScroll: r,
209
+ offsetScroll: u,
210
+ revalidate: f
209
211
  } = {}) {
210
- if (e(this, N).length)
212
+ if (e(this, D).length)
211
213
  return;
212
- const T = this.normalizePath(t);
213
- let { pathname: h, hash: E, parameters: bt, leaf: Pt } = T;
214
- if (e(this, P) === h || e(this, f) === h) {
215
- e(this, A) || d(this, l, rt).call(this, E || 0, {
216
- centerScroll: i,
217
- offsetScroll: c,
214
+ const k = this.normalizePath(t);
215
+ let { pathname: l, hash: g, parameters: bt, leaf: Pt } = k;
216
+ if (e(this, A) === l || e(this, m) === l) {
217
+ e(this, C) || d(this, h, nt).call(this, g || 0, {
218
+ centerScroll: r,
219
+ offsetScroll: u,
218
220
  behavior: "smooth"
219
221
  });
220
222
  return;
221
223
  }
222
- a(this, P, h);
224
+ e(this, E).forEach((z) => {
225
+ z.checkCurrent(l);
226
+ }), a(this, A, l);
223
227
  try {
224
- let K = !0;
228
+ let z = !0;
225
229
  if (this.preprocessor)
226
230
  try {
227
- yield new Promise((r, y) => {
231
+ yield new Promise((n, y) => {
228
232
  var L;
229
233
  (L = this.preprocessor) == null || L.call(this, {
230
- pathname: h,
231
- resolve: r,
234
+ pathname: l,
235
+ resolve: n,
232
236
  reject: y
233
237
  });
234
238
  });
235
- } catch (r) {
236
- r ? console.error(r) : console.log("Route change canceled"), K = !1;
239
+ } catch (n) {
240
+ n ? console.error(n) : console.log("Route change canceled"), z = !1;
237
241
  }
238
- if (!K || e(this, P) !== h)
242
+ if (!z || e(this, A) !== l) {
243
+ e(this, E).forEach((n) => {
244
+ n.checkCurrent(e(this, m));
245
+ });
239
246
  return;
240
- const ot = yield d(this, l, $).call(this, e(this, f)), v = yield d(this, l, $).call(this, h, m);
241
- if (e(this, P) !== h)
247
+ }
248
+ const ot = yield d(this, h, $).call(this, e(this, m)), S = yield d(this, h, $).call(this, l, f);
249
+ if (e(this, A) !== l) {
250
+ e(this, E).forEach((n) => {
251
+ n.checkCurrent(e(this, m));
252
+ });
242
253
  return;
243
- ot.saveScrollState(), ot.saveDocumentState(), e(this, A) || (v.clearScrollState(), v.clearDocumentState()), v.cloneDocument(), e(this, D).textContent = v.title, document.body.appendChild(e(this, D));
254
+ }
255
+ ot.saveScrollState(), ot.saveDocumentState(), e(this, C) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, R).textContent = S.title, document.body.appendChild(e(this, R));
244
256
  const at = {
245
- pathname: h
257
+ pathname: l
246
258
  };
247
- Q(document, "morphStart", {
259
+ J(document, "morphStart", {
248
260
  detail: at
249
261
  });
250
- const lt = Array.from(document.head.children), ht = Array.from(v.document.head.children), ct = d(this, l, wt).call(this, lt, ht), At = d(this, l, st).call(this, lt, ct), Y = d(this, l, st).call(this, ht, ct);
251
- Y.forEach((r, y) => {
252
- if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
262
+ const ht = Array.from(document.head.children), lt = Array.from(S.document.head.children), ct = d(this, h, wt).call(this, ht, lt), At = d(this, h, st).call(this, ht, ct), U = d(this, h, st).call(this, lt, ct);
263
+ U.forEach((n, y) => {
264
+ if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
253
265
  const L = document.createElement("script");
254
- L.type = "module", L.src = r.getAttribute("src"), Y[y] = L;
266
+ L.type = "module", L.src = n.getAttribute("src"), U[y] = L;
255
267
  }
256
- }), Y.forEach((r) => {
257
- document.head.appendChild(r);
268
+ }), U.forEach((n) => {
269
+ document.head.appendChild(n);
258
270
  });
259
- const Z = Y.filter((r) => {
260
- if (r.hasAttribute("data-no-waiting"))
271
+ const Z = U.filter((n) => {
272
+ if (n.hasAttribute("data-no-waiting"))
261
273
  return !1;
262
- if (d(this, l, it).call(this, r))
274
+ if (d(this, h, it).call(this, n))
263
275
  return !0;
264
276
  });
265
- e(this, b).waitForHeadToLoad && Z.length && (yield new Promise((r) => C(this, null, function* () {
277
+ e(this, P).waitForHeadToLoad && Z.length && (yield new Promise((n) => T(this, null, function* () {
266
278
  let y = 0;
267
279
  try {
268
- for (var L = Et(Z), dt, B, mt; dt = !(B = yield L.next()).done; dt = !1) {
269
- const G = B.value;
270
- G.onload = () => {
271
- y++, y === Z.length && r();
280
+ for (var L = Et(Z), dt, O, mt; dt = !(O = yield L.next()).done; dt = !1) {
281
+ const Y = O.value;
282
+ Y.onload = () => {
283
+ y++, y === Z.length && n();
272
284
  };
273
285
  }
274
- } catch (B) {
275
- mt = [B];
286
+ } catch (O) {
287
+ mt = [O];
276
288
  } finally {
277
289
  try {
278
- dt && (B = L.return) && (yield B.call(L));
290
+ dt && (O = L.return) && (yield O.call(L));
279
291
  } finally {
280
292
  if (mt)
281
293
  throw mt[0];
@@ -283,58 +295,58 @@ class Bt {
283
295
  }
284
296
  })));
285
297
  const ut = [];
286
- At.forEach((r) => {
287
- r.hasAttribute("data-permanent") || (d(this, l, it).call(this, r) ? ut.push(r) : r.remove());
298
+ At.forEach((n) => {
299
+ n.hasAttribute("data-permanent") || (d(this, h, it).call(this, n) ? ut.push(n) : n.remove());
288
300
  });
289
- const Tt = d(this, l, et).call(this, v.document.body);
290
- d(this, l, nt).call(this, v.document), document.documentElement.setAttribute("data-current-pathname", h), document.documentElement.setAttribute("data-current-leaf", Pt), gt({
301
+ const Ct = d(this, h, et).call(this, S.document.body);
302
+ d(this, h, rt).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", l), document.documentElement.setAttribute("data-current-leaf", Pt), gt({
291
303
  action: s,
292
- pathname: h,
304
+ pathname: l,
293
305
  searchParameters: bt,
294
- hash: E
295
- }), e(this, D).remove(), a(this, j, e(this, f)), a(this, f, h), e(this, W).forEach((r, y) => {
296
- const L = Tt[y], dt = getComputedStyle(r).getPropertyValue("--morph-duration"), B = [...L.childNodes];
306
+ hash: g
307
+ }), e(this, R).remove(), a(this, K, e(this, m)), a(this, m, l), e(this, j).forEach((n, y) => {
308
+ const L = Ct[y], dt = getComputedStyle(n).getPropertyValue("--morph-duration"), O = [...L.childNodes];
297
309
  if (dt) {
298
- const mt = [...r.childNodes];
299
- mt.forEach((g) => {
300
- g instanceof HTMLElement && g.classList.add("old");
301
- }), B.forEach((g) => {
302
- g instanceof HTMLElement && g.classList.add("new");
303
- }), r.prepend(...B), Mt(() => {
304
- B.forEach((g) => {
305
- g instanceof HTMLElement && g.classList.add("in");
310
+ const mt = [...n.childNodes];
311
+ mt.forEach((v) => {
312
+ v instanceof HTMLElement && v.classList.add("old");
313
+ }), O.forEach((v) => {
314
+ v instanceof HTMLElement && v.classList.add("new");
315
+ }), n.prepend(...O), Tt(() => {
316
+ O.forEach((v) => {
317
+ v instanceof HTMLElement && v.classList.add("in");
306
318
  });
307
319
  });
308
- const G = {
309
- morphElement: r,
310
- pathname: h
320
+ const Y = {
321
+ morphElement: n,
322
+ pathname: l
311
323
  };
312
- Q(document, "morphNewChildrenAdded", {
313
- detail: G
324
+ J(document, "morphNewChildrenAdded", {
325
+ detail: Y
314
326
  });
315
- const Ct = new Promise((g) => {
327
+ const kt = new Promise((v) => {
316
328
  setTimeout(() => {
317
- mt.forEach((J) => J.remove()), B.forEach((J) => {
318
- J instanceof HTMLElement && J.classList.remove("in", "new");
319
- }), Q(document, "morphOldChildrenRemoved", {
320
- detail: G
321
- }), g();
329
+ mt.forEach((G) => G.remove()), O.forEach((G) => {
330
+ G instanceof HTMLElement && G.classList.remove("in", "new");
331
+ }), J(document, "morphOldChildrenRemoved", {
332
+ detail: Y
333
+ }), v();
322
334
  }, (parseFloat(dt) || 0) * 1e3 + 10);
323
335
  });
324
- e(this, N).push(Ct);
336
+ e(this, D).push(kt);
325
337
  } else
326
- r.innerHTML = "", r.append(...B);
327
- }), E ? (v.clearScrollState(), d(this, l, rt).call(this, E, { centerScroll: i, offsetScroll: c })) : e(this, A) && v.restoreScrollPosition(), yield Promise.all(e(this, N)), ut.forEach((r) => r.remove()), a(this, N, []), this.findLinks(), Q(document, "morphComplete", {
338
+ n.innerHTML = "", n.append(...O);
339
+ }), g ? (S.clearScrollState(), d(this, h, nt).call(this, g, { centerScroll: r, offsetScroll: u })) : e(this, C) && S.restoreScrollPosition(), yield Promise.all(e(this, D)), ut.forEach((n) => n.remove()), a(this, D, []), this.findLinks(), J(document, "morphComplete", {
328
340
  detail: at
329
341
  }), window.dispatchEvent(new Event("resize"));
330
- } catch (K) {
331
- console.error(K);
342
+ } catch (z) {
343
+ console.error(z);
332
344
  }
333
- a(this, P, void 0);
345
+ a(this, A, void 0);
334
346
  });
335
347
  }
336
348
  addLink(t) {
337
- e(this, S).push(new vt(t, this));
349
+ e(this, E).push(new vt(t, this));
338
350
  }
339
351
  addLinks(t) {
340
352
  t.forEach((s) => {
@@ -342,53 +354,53 @@ class Bt {
342
354
  });
343
355
  }
344
356
  removeLink(t) {
345
- a(this, S, e(this, S).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
357
+ a(this, E, e(this, E).filter((s) => s.element === t ? (s.destroy(), !1) : !0));
346
358
  }
347
359
  findLinks() {
348
360
  const t = [
349
361
  ...document.documentElement.querySelectorAll("a")
350
362
  ].filter(
351
363
  (s) => {
352
- var i;
353
- return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
364
+ var r;
365
+ return ((r = s.getAttribute("href")) == null ? void 0 : r.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
354
366
  }
355
367
  );
356
- e(this, S).forEach((s) => s.destroy()), a(this, S, t.map((s) => new vt(s, this)));
368
+ e(this, E).forEach((s) => s.destroy()), a(this, E, t.map((s) => new vt(s, this)));
357
369
  }
358
370
  }
359
- b = new WeakMap(), W = new WeakMap(), S = new WeakMap(), U = new WeakMap(), P = new WeakMap(), f = new WeakMap(), j = new WeakMap(), N = new WeakMap(), A = new WeakMap(), F = new WeakMap(), I = new WeakMap(), D = new WeakMap(), l = new WeakSet(), $ = function(t, s = !1) {
360
- return C(this, null, function* () {
361
- let i = e(this, I).get(t);
362
- return (!i || s) && (i = yield d(this, l, tt).call(this, t)), i;
371
+ P = new WeakMap(), j = new WeakMap(), E = new WeakMap(), Q = new WeakMap(), A = new WeakMap(), m = new WeakMap(), K = new WeakMap(), D = new WeakMap(), C = new WeakMap(), I = new WeakMap(), V = new WeakMap(), R = new WeakMap(), h = new WeakSet(), $ = function(t, s = !1) {
372
+ return T(this, null, function* () {
373
+ let r = e(this, V).get(t);
374
+ return (!r || s) && (r = yield d(this, h, tt).call(this, t)), r;
363
375
  });
364
376
  }, tt = function(t) {
365
- return C(this, null, function* () {
366
- const i = yield (yield fetch(t)).text(), c = e(this, U).parseFromString(i, "text/html"), m = new St(this, t, c);
367
- return e(this, I).set(t, m), m;
377
+ return T(this, null, function* () {
378
+ const r = yield (yield fetch(t)).text(), u = e(this, Q).parseFromString(r, "text/html"), f = new St(this, t, u);
379
+ return e(this, V).set(t, f), f;
368
380
  });
369
381
  }, et = function(t) {
370
382
  const s = [...t.querySelectorAll("[data-morph]")];
371
383
  return s.length ? s : [t];
372
384
  }, wt = function(t, s) {
373
385
  return t.filter(
374
- (i) => s.find(
375
- (c) => c.outerHTML === i.outerHTML
386
+ (r) => s.find(
387
+ (u) => u.outerHTML === r.outerHTML
376
388
  )
377
389
  );
378
390
  }, st = function(t, s) {
379
391
  return t.filter(
380
- (i) => !s.find(
381
- (c) => c.outerHTML === i.outerHTML
392
+ (r) => !s.find(
393
+ (u) => u.outerHTML === r.outerHTML
382
394
  )
383
395
  );
384
396
  }, it = function(t) {
385
397
  return t.tagName === "SCRIPT" || t.tagName === "STYLE" || t.tagName === "LINK" && t.getAttribute("rel") === "stylesheet";
386
- }, nt = function(t) {
387
- a(this, F, t.querySelector(e(this, b).scrollSelector) || t.documentElement);
388
- }, rt = function(t, s) {
389
- const i = typeof t == "string" ? document.getElementById(t) : t;
390
- (typeof i == "number" || i) && Ht(i, {
391
- scrollElement: e(this, F),
398
+ }, rt = function(t) {
399
+ a(this, I, t.querySelector(e(this, P).scrollSelector) || t.documentElement);
400
+ }, nt = function(t, s) {
401
+ const r = typeof t == "string" ? document.getElementById(t) : t;
402
+ (typeof r == "number" || r) && Mt(r, {
403
+ scrollElement: e(this, I),
392
404
  behavior: (s == null ? void 0 : s.behavior) || "instant",
393
405
  center: s == null ? void 0 : s.centerScroll,
394
406
  offset: s == null ? void 0 : s.offsetScroll
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.47.10",
3
+ "version": "0.47.11",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"