aptechka 0.5.30 → 0.5.31

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.
@@ -1 +1 @@
1
- "use strict";var at=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var Q=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var e=(r,t,s)=>(Q(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},l=(r,t,s,n)=>(Q(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var p=(r,t,s)=>(Q(r,t,"access private method"),s);var H=(r,t,s)=>new Promise((n,i)=>{var c=d=>{try{u(s.next(d))}catch(m){i(m)}},f=d=>{try{u(s.throw(d))}catch(m){i(m)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(c,f);u((s=s.apply(r,t)).next())});var ht=(r,t,s)=>(t=r[at("asyncIterator")])?t.call(r):(r=r[at("iterator")](),t={},s=(n,i)=>(i=r[n])&&(t[n]=c=>new Promise((f,u,d)=>(c=i.call(r,c),d=c.done,Promise.resolve(c.value).then(m=>f({value:m,done:d}),u)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),pt=require("../browser-CpzFX2xg.cjs");var y,o,g,S,A,k,M;class gt{constructor(t,s){a(this,y,void 0);a(this,o,void 0);a(this,g,void 0);a(this,S,void 0);a(this,A,void 0);a(this,k,t=>{t.preventDefault(),e(this,y).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,A))!=null&&n.includes(e(this,g))?e(s,o).classList.add("clicked"):e(s,o).classList.remove("clicked")}),e(this,y).navigate(e(this,g),e(this,S))});a(this,M,()=>{e(this,y).prefetch(e(this,g)),e(this,o).removeEventListener("pointerenter",e(this,M))});var c,f;l(this,y,s),l(this,o,t),l(this,g,e(this,o).getAttribute("href")||"/"),l(this,S,e(this,o).getAttribute("data-history-action")||"push"),e(this,o).addEventListener("click",e(this,k));const n=s.normalizePath(e(this,g)),i=s.normalizePath(location.pathname);l(this,A,(c=e(this,o).getAttribute("data-match-paths"))==null?void 0:c.split(",").map(u=>s.normalizePath(u.trim()).pathname)),e(this,o).hasAttribute("data-include")?i.pathname.includes(n.pathname)&&e(this,o).classList.add("current"):n.pathname===i.pathname||(f=e(this,A))!=null&&f.includes(i.pathname)?(e(this,o).classList.add("current"),e(this,o).classList.add("clicked")):e(this,o).classList.remove("clicked"),e(this,o).hasAttribute("data-prefetch")&&e(this,o).addEventListener("pointerenter",e(this,M))}destroy(){e(this,o).removeEventListener("click",e(this,k)),e(this,o).removeEventListener("pointerenter",e(this,M)),e(this,o).classList.remove("current")}}y=new WeakMap,o=new WeakMap,g=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap;var E,C,z,D,T,B,P,L,w,W,x,R,U,q,V,F,X,K,ct,I,Z,Y;class Et{constructor(t){a(this,R);a(this,q);a(this,F);a(this,K);a(this,I);a(this,E,null);a(this,C,null);a(this,z,null);a(this,D,null);a(this,T,[]);a(this,B,new DOMParser);a(this,P,new Map);a(this,L,void 0);a(this,w,null);a(this,W,new ot.Notifier);a(this,x,new ot.Notifier);a(this,Y,t=>{t.state&&this.navigate(t.state,"none")});pt.isBrowser&&new Date().getTime()<17183988e5&&(l(this,E,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(l(this,E,t.base),t.base.endsWith("/")||l(this,E,e(this,E)+"/")):l(this,E,"/"),l(this,C,(t==null?void 0:t.waitForHeadToLoad)!==!1),l(this,z,(t==null?void 0:t.cachePages)!==!1),l(this,D,p(this,F,X).call(this,document.body)),l(this,w,this.normalizePath(location.pathname).pathname),document.documentElement.setAttribute("data-current-pathname",e(this,w)),p(this,q,V).call(this),addEventListener("popstate",e(this,Y)))}get currentPathname(){return e(this,w)}get links(){return e(this,T)}normalizePath(t){t=t.replace(e(this,E),""),t.startsWith("/")&&(t=t.slice(1));const s=t.split("#"),n=s[0].split("?"),i=n[0].endsWith("/")?n[0].slice(0,-1):n[0],c=e(this,E)+i,f=n==null?void 0:n[1],u=s==null?void 0:s[1];return{leaf:i,pathname:c,parameters:f,hash:u}}beforeNavigationEvent(t){return e(this,W).subscribe(t)}afterNavigationEvent(t){return e(this,x).subscribe(t)}prefetch(t){return H(this,null,function*(){const s=this.normalizePath(t);return p(this,R,U).call(this,s.pathname)})}navigate(t,s="push"){return H(this,null,function*(){var d;if(new Date().getTime()>17183988e5)return;const n=this.normalizePath(t);let{pathname:i,hash:c,parameters:f}=n;if(e(this,L)===i||e(this,w)===i)return;l(this,L,i);const u=e(this,P).has(i);try{let m=!0;if(e(this,W).notify({pathname:i,isCached:u}),this.preprocessor)try{yield new Promise((h,b)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:i,resolve:h,reject:b,isCached:u})})}catch(h){h?console.error(h):console.log("Route change canceled"),m=!1}if(!m||e(this,L)!==i)return;const tt=e(this,P).get(i)||(yield p(this,R,U).call(this,i));if(e(this,L)!==i)return;const et=Array.from(document.head.children),st=Array.from(tt.head.cloneNode(!0).children),it=p(this,K,ct).call(this,et,st),lt=p(this,I,Z).call(this,et,it),O=p(this,I,Z).call(this,st,it);O.forEach((h,b)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),O[b]=v}}),O.forEach(h=>{document.head.appendChild(h)});const _=O.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");e(this,C)&&_.length&&(yield new Promise(h=>H(this,null,function*(){let b=0;try{for(var v=ht(_),mt,G,j;mt=!(G=yield v.next()).done;mt=!1){const N=G.value;N.onload=()=>{b++,b===_.length&&h()}}}catch(G){j=[G]}finally{try{mt&&(G=v.return)&&(yield G.call(v))}finally{if(j)throw j[0]}}}))),lt.forEach(h=>{h.hasAttribute("data-permanent")||h.remove()}),l(this,w,i);const $=f||location.search,ut=c?c.startsWith("#")?c:"#"+c:"",dt=$?$.startsWith("?")?$:"?"+$:"",nt=`${i}${ut}${dt}`;s==="push"?history.pushState(i,"",nt):s==="replace"&&history.replaceState(i,"",nt);const ft=p(this,F,X).call(this,tt.body.cloneNode(!0));e(this,D).forEach((h,b)=>{const v=ft[b];let mt=[...h.childNodes],G=[...v.childNodes];mt.forEach(j=>{if(j instanceof HTMLElement){const N=j.getAttribute("data-remain");let rt;G=G.filter(J=>J instanceof HTMLElement&&N&&J.getAttribute("data-remain")===N?(rt=J,!1):!0),N&&rt||j.remove()}else j.remove()}),h.append(...G)}),p(this,q,V).call(this),document.documentElement.setAttribute("data-current-pathname",i),(d=this.postprocessor)==null||d.call(this,{pathname:i,isCached:u}),e(this,x).notify({pathname:i,isCached:u})}catch(m){console.error(m)}l(this,L,void 0)})}}E=new WeakMap,C=new WeakMap,z=new WeakMap,D=new WeakMap,T=new WeakMap,B=new WeakMap,P=new WeakMap,L=new WeakMap,w=new WeakMap,W=new WeakMap,x=new WeakMap,R=new WeakSet,U=function(t){return H(this,null,function*(){const s=e(this,P).get(t);if(s)return s;const i=yield(yield fetch(t)).text(),c=e(this,B).parseFromString(i,"text/html");return e(this,z)&&e(this,P).set(t,c),c})},q=new WeakSet,V=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return(n=s.getAttribute("href"))==null?void 0:n.startsWith("/")});e(this,T).forEach(s=>s.destroy()),l(this,T,t.map(s=>new gt(s,this)))},F=new WeakSet,X=function(t){return[...t.querySelectorAll("[data-morph]")]},K=new WeakSet,ct=function(t,s){return t.filter(n=>s.find(i=>i.outerHTML===n.outerHTML))},I=new WeakSet,Z=function(t,s){return t.filter(n=>!s.find(i=>i.outerHTML===n.outerHTML))},Y=new WeakMap;exports.Morph=Et;
1
+ "use strict";var at=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var Q=(r,t,s)=>{if(!t.has(r))throw TypeError("Cannot "+s)};var e=(r,t,s)=>(Q(r,t,"read from private field"),s?s.call(r):t.get(r)),a=(r,t,s)=>{if(t.has(r))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(r):t.set(r,s)},l=(r,t,s,n)=>(Q(r,t,"write to private field"),n?n.call(r,s):t.set(r,s),s);var p=(r,t,s)=>(Q(r,t,"access private method"),s);var H=(r,t,s)=>new Promise((n,i)=>{var c=d=>{try{u(s.next(d))}catch(m){i(m)}},f=d=>{try{u(s.throw(d))}catch(m){i(m)}},u=d=>d.done?n(d.value):Promise.resolve(d.value).then(c,f);u((s=s.apply(r,t)).next())});var ht=(r,t,s)=>(t=r[at("asyncIterator")])?t.call(r):(r=r[at("iterator")](),t={},s=(n,i)=>(i=r[n])&&(t[n]=c=>new Promise((f,u,d)=>(c=i.call(r,c),d=c.done,Promise.resolve(c.value).then(m=>f({value:m,done:d}),u)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),pt=require("../browser-CpzFX2xg.cjs");var y,o,g,S,A,k,M;class gt{constructor(t,s){a(this,y,void 0);a(this,o,void 0);a(this,g,void 0);a(this,S,void 0);a(this,A,void 0);a(this,k,t=>{t.preventDefault(),e(this,y).links.forEach(s=>{var n;e(this,g)===e(s,g)||(n=e(s,A))!=null&&n.includes(e(this,g))?e(s,o).classList.add("clicked"):e(s,o).classList.remove("clicked")}),e(this,y).navigate(e(this,g),e(this,S))});a(this,M,()=>{e(this,y).prefetch(e(this,g)),e(this,o).removeEventListener("pointerenter",e(this,M))});var c,f;l(this,y,s),l(this,o,t),l(this,g,e(this,o).getAttribute("href")||"/"),l(this,S,e(this,o).getAttribute("data-history-action")||"push"),e(this,o).addEventListener("click",e(this,k));const n=s.normalizePath(e(this,g)),i=s.normalizePath(location.pathname);l(this,A,(c=e(this,o).getAttribute("data-match-paths"))==null?void 0:c.split(",").map(u=>s.normalizePath(u.trim()).pathname)),e(this,o).hasAttribute("data-include")?i.pathname.includes(n.pathname)&&e(this,o).classList.add("current"):n.pathname===i.pathname||(f=e(this,A))!=null&&f.includes(i.pathname)?(e(this,o).classList.add("current"),e(this,o).classList.add("clicked")):e(this,o).classList.remove("clicked"),e(this,o).hasAttribute("data-prefetch")&&e(this,o).addEventListener("pointerenter",e(this,M))}destroy(){e(this,o).removeEventListener("click",e(this,k)),e(this,o).removeEventListener("pointerenter",e(this,M)),e(this,o).classList.remove("current")}}y=new WeakMap,o=new WeakMap,g=new WeakMap,S=new WeakMap,A=new WeakMap,k=new WeakMap,M=new WeakMap;var E,C,z,W,N,B,P,L,w,x,D,R,U,q,V,F,X,K,ct,I,Z,Y;class Et{constructor(t){a(this,R);a(this,q);a(this,F);a(this,K);a(this,I);a(this,E,null);a(this,C,null);a(this,z,null);a(this,W,null);a(this,N,[]);a(this,B,new DOMParser);a(this,P,new Map);a(this,L,void 0);a(this,w,null);a(this,x,new ot.Notifier);a(this,D,new ot.Notifier);a(this,Y,t=>{t.state&&this.navigate(t.state,"none")});pt.isBrowser&&(l(this,E,(t==null?void 0:t.base)||"/"),t!=null&&t.base?(l(this,E,t.base),t.base.endsWith("/")||l(this,E,e(this,E)+"/")):l(this,E,"/"),l(this,C,(t==null?void 0:t.waitForHeadToLoad)!==!1),l(this,z,(t==null?void 0:t.cachePages)!==!1),l(this,W,p(this,F,X).call(this,document.body)),l(this,w,this.normalizePath(location.pathname).pathname),document.documentElement.setAttribute("data-current-pathname",e(this,w)),p(this,q,V).call(this),addEventListener("popstate",e(this,Y)))}get currentPathname(){return e(this,w)}get links(){return e(this,N)}normalizePath(t){t=t.replace(e(this,E),""),t.startsWith("/")&&(t=t.slice(1));const s=t.split("#"),n=s[0].split("?"),i=n[0].endsWith("/")?n[0].slice(0,-1):n[0],c=e(this,E)+i,f=n==null?void 0:n[1],u=s==null?void 0:s[1];return{leaf:i,pathname:c,parameters:f,hash:u}}beforeNavigationEvent(t){return e(this,x).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return H(this,null,function*(){const s=this.normalizePath(t);return p(this,R,U).call(this,s.pathname)})}navigate(t,s="push"){return H(this,null,function*(){var d;const n=this.normalizePath(t);let{pathname:i,hash:c,parameters:f}=n;if(e(this,L)===i||e(this,w)===i)return;l(this,L,i);const u=e(this,P).has(i);try{let m=!0;if(e(this,x).notify({pathname:i,isCached:u}),this.preprocessor)try{yield new Promise((h,b)=>{var v;(v=this.preprocessor)==null||v.call(this,{pathname:i,resolve:h,reject:b,isCached:u})})}catch(h){h?console.error(h):console.log("Route change canceled"),m=!1}if(!m||e(this,L)!==i)return;const tt=e(this,P).get(i)||(yield p(this,R,U).call(this,i));if(e(this,L)!==i)return;const et=Array.from(document.head.children),st=Array.from(tt.head.cloneNode(!0).children),it=p(this,K,ct).call(this,et,st),lt=p(this,I,Z).call(this,et,it),O=p(this,I,Z).call(this,st,it);O.forEach((h,b)=>{if(h.tagName==="SCRIPT"&&h.getAttribute("src")){const v=document.createElement("script");v.type="module",v.src=h.getAttribute("src"),O[b]=v}}),O.forEach(h=>{document.head.appendChild(h)});const _=O.filter(h=>h.tagName==="STYLE"||h.tagName==="SCRIPT"||h.tagName==="LINK");e(this,C)&&_.length&&(yield new Promise(h=>H(this,null,function*(){let b=0;try{for(var v=ht(_),mt,G,j;mt=!(G=yield v.next()).done;mt=!1){const T=G.value;T.onload=()=>{b++,b===_.length&&h()}}}catch(G){j=[G]}finally{try{mt&&(G=v.return)&&(yield G.call(v))}finally{if(j)throw j[0]}}}))),lt.forEach(h=>{h.hasAttribute("data-permanent")||h.remove()}),l(this,w,i);const $=f||location.search,ut=c?c.startsWith("#")?c:"#"+c:"",dt=$?$.startsWith("?")?$:"?"+$:"",nt=`${i}${ut}${dt}`;s==="push"?history.pushState(i,"",nt):s==="replace"&&history.replaceState(i,"",nt);const ft=p(this,F,X).call(this,tt.body.cloneNode(!0));e(this,W).forEach((h,b)=>{const v=ft[b];let mt=[...h.childNodes],G=[...v.childNodes];mt.forEach(j=>{if(j instanceof HTMLElement){const T=j.getAttribute("data-remain");let rt;G=G.filter(J=>J instanceof HTMLElement&&T&&J.getAttribute("data-remain")===T?(rt=J,!1):!0),T&&rt||j.remove()}else j.remove()}),h.append(...G)}),p(this,q,V).call(this),document.documentElement.setAttribute("data-current-pathname",i),(d=this.postprocessor)==null||d.call(this,{pathname:i,isCached:u}),e(this,D).notify({pathname:i,isCached:u})}catch(m){console.error(m)}l(this,L,void 0)})}}E=new WeakMap,C=new WeakMap,z=new WeakMap,W=new WeakMap,N=new WeakMap,B=new WeakMap,P=new WeakMap,L=new WeakMap,w=new WeakMap,x=new WeakMap,D=new WeakMap,R=new WeakSet,U=function(t){return H(this,null,function*(){const s=e(this,P).get(t);if(s)return s;const i=yield(yield fetch(t)).text(),c=e(this,B).parseFromString(i,"text/html");return e(this,z)&&e(this,P).set(t,c),c})},q=new WeakSet,V=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var n;return(n=s.getAttribute("href"))==null?void 0:n.startsWith("/")});e(this,N).forEach(s=>s.destroy()),l(this,N,t.map(s=>new gt(s,this)))},F=new WeakSet,X=function(t){return[...t.querySelectorAll("[data-morph]")]},K=new WeakSet,ct=function(t,s){return t.filter(n=>s.find(i=>i.outerHTML===n.outerHTML))},I=new WeakSet,Z=function(t,s){return t.filter(n=>!s.find(i=>i.outerHTML===n.outerHTML))},Y=new WeakMap;exports.Morph=Et;
@@ -9,7 +9,7 @@ var e = (r, t, s) => (U(r, t, "read from private field"), s ? s.call(r) : t.get(
9
9
  t instanceof WeakSet ? t.add(r) : t.set(r, s);
10
10
  }, l = (r, t, s, n) => (U(r, t, "write to private field"), n ? n.call(r, s) : t.set(r, s), s);
11
11
  var p = (r, t, s) => (U(r, t, "access private method"), s);
12
- var N = (r, t, s) => new Promise((n, i) => {
12
+ var T = (r, t, s) => new Promise((n, i) => {
13
13
  var c = (d) => {
14
14
  try {
15
15
  u(s.next(d));
@@ -28,7 +28,7 @@ var N = (r, t, s) => new Promise((n, i) => {
28
28
  var ht = (r, t, s) => (t = r[at("asyncIterator")]) ? t.call(r) : (r = r[at("iterator")](), t = {}, s = (n, i) => (i = r[n]) && (t[n] = (c) => new Promise((f, u, d) => (c = i.call(r, c), d = c.done, Promise.resolve(c.value).then((m) => f({ value: m, done: d }), u)))), s("next"), s("return"), t);
29
29
  import { Notifier as ot } from "../notifier/index.js";
30
30
  import { i as pt } from "../browser-0zX67oeU.js";
31
- var y, o, g, k, A, C, T;
31
+ var y, o, g, k, A, C, M;
32
32
  class gt {
33
33
  constructor(t, s) {
34
34
  a(this, y, void 0);
@@ -42,22 +42,22 @@ class gt {
42
42
  e(this, g) === e(s, g) || (n = e(s, A)) != null && n.includes(e(this, g)) ? e(s, o).classList.add("clicked") : e(s, o).classList.remove("clicked");
43
43
  }), e(this, y).navigate(e(this, g), e(this, k));
44
44
  });
45
- a(this, T, () => {
46
- e(this, y).prefetch(e(this, g)), e(this, o).removeEventListener("pointerenter", e(this, T));
45
+ a(this, M, () => {
46
+ e(this, y).prefetch(e(this, g)), e(this, o).removeEventListener("pointerenter", e(this, M));
47
47
  });
48
48
  var c, f;
49
49
  l(this, y, s), l(this, o, t), l(this, g, e(this, o).getAttribute("href") || "/"), l(this, k, e(this, o).getAttribute(
50
50
  "data-history-action"
51
51
  ) || "push"), e(this, o).addEventListener("click", e(this, C));
52
52
  const n = s.normalizePath(e(this, g)), i = s.normalizePath(location.pathname);
53
- l(this, A, (c = e(this, o).getAttribute("data-match-paths")) == null ? void 0 : c.split(",").map((u) => s.normalizePath(u.trim()).pathname)), e(this, o).hasAttribute("data-include") ? i.pathname.includes(n.pathname) && e(this, o).classList.add("current") : n.pathname === i.pathname || (f = e(this, A)) != null && f.includes(i.pathname) ? (e(this, o).classList.add("current"), e(this, o).classList.add("clicked")) : e(this, o).classList.remove("clicked"), e(this, o).hasAttribute("data-prefetch") && e(this, o).addEventListener("pointerenter", e(this, T));
53
+ l(this, A, (c = e(this, o).getAttribute("data-match-paths")) == null ? void 0 : c.split(",").map((u) => s.normalizePath(u.trim()).pathname)), e(this, o).hasAttribute("data-include") ? i.pathname.includes(n.pathname) && e(this, o).classList.add("current") : n.pathname === i.pathname || (f = e(this, A)) != null && f.includes(i.pathname) ? (e(this, o).classList.add("current"), e(this, o).classList.add("clicked")) : e(this, o).classList.remove("clicked"), e(this, o).hasAttribute("data-prefetch") && e(this, o).addEventListener("pointerenter", e(this, M));
54
54
  }
55
55
  destroy() {
56
- e(this, o).removeEventListener("click", e(this, C)), e(this, o).removeEventListener("pointerenter", e(this, T)), e(this, o).classList.remove("current");
56
+ e(this, o).removeEventListener("click", e(this, C)), e(this, o).removeEventListener("pointerenter", e(this, M)), e(this, o).classList.remove("current");
57
57
  }
58
58
  }
59
- y = new WeakMap(), o = new WeakMap(), g = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), T = new WeakMap();
60
- var E, S, z, D, M, K, P, b, w, W, x, R, V, F, X, I, Z, Y, ct, $, _, j;
59
+ y = new WeakMap(), o = new WeakMap(), g = new WeakMap(), k = new WeakMap(), A = new WeakMap(), C = new WeakMap(), M = new WeakMap();
60
+ var E, S, z, W, H, K, P, b, w, x, D, R, V, F, X, I, Z, Y, ct, $, _, j;
61
61
  class bt {
62
62
  constructor(t) {
63
63
  a(this, R);
@@ -68,18 +68,18 @@ class bt {
68
68
  a(this, E, null);
69
69
  a(this, S, null);
70
70
  a(this, z, null);
71
- a(this, D, null);
72
- a(this, M, []);
71
+ a(this, W, null);
72
+ a(this, H, []);
73
73
  a(this, K, new DOMParser());
74
74
  a(this, P, /* @__PURE__ */ new Map());
75
75
  a(this, b, void 0);
76
76
  a(this, w, null);
77
- a(this, W, new ot());
78
77
  a(this, x, new ot());
78
+ a(this, D, new ot());
79
79
  a(this, j, (t) => {
80
80
  t.state && this.navigate(t.state, "none");
81
81
  });
82
- pt && (/* @__PURE__ */ new Date()).getTime() < 17183988e5 && (l(this, E, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (l(this, E, t.base), t.base.endsWith("/") || l(this, E, e(this, E) + "/")) : l(this, E, "/"), l(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), l(this, z, (t == null ? void 0 : t.cachePages) !== !1), l(this, D, p(this, I, Z).call(this, document.body)), l(this, w, this.normalizePath(location.pathname).pathname), document.documentElement.setAttribute(
82
+ pt && (l(this, E, (t == null ? void 0 : t.base) || "/"), t != null && t.base ? (l(this, E, t.base), t.base.endsWith("/") || l(this, E, e(this, E) + "/")) : l(this, E, "/"), l(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), l(this, z, (t == null ? void 0 : t.cachePages) !== !1), l(this, W, p(this, I, Z).call(this, document.body)), l(this, w, this.normalizePath(location.pathname).pathname), document.documentElement.setAttribute(
83
83
  "data-current-pathname",
84
84
  e(this, w)
85
85
  ), p(this, F, X).call(this), addEventListener("popstate", e(this, j)));
@@ -88,7 +88,7 @@ class bt {
88
88
  return e(this, w);
89
89
  }
90
90
  get links() {
91
- return e(this, M);
91
+ return e(this, H);
92
92
  }
93
93
  normalizePath(t) {
94
94
  t = t.replace(e(this, E), ""), t.startsWith("/") && (t = t.slice(1));
@@ -101,22 +101,20 @@ class bt {
101
101
  };
102
102
  }
103
103
  beforeNavigationEvent(t) {
104
- return e(this, W).subscribe(t);
104
+ return e(this, x).subscribe(t);
105
105
  }
106
106
  afterNavigationEvent(t) {
107
- return e(this, x).subscribe(t);
107
+ return e(this, D).subscribe(t);
108
108
  }
109
109
  prefetch(t) {
110
- return N(this, null, function* () {
110
+ return T(this, null, function* () {
111
111
  const s = this.normalizePath(t);
112
112
  return p(this, R, V).call(this, s.pathname);
113
113
  });
114
114
  }
115
115
  navigate(t, s = "push") {
116
- return N(this, null, function* () {
116
+ return T(this, null, function* () {
117
117
  var d;
118
- if ((/* @__PURE__ */ new Date()).getTime() > 17183988e5)
119
- return;
120
118
  const n = this.normalizePath(t);
121
119
  let { pathname: i, hash: c, parameters: f } = n;
122
120
  if (e(this, b) === i || e(this, w) === i)
@@ -125,7 +123,7 @@ class bt {
125
123
  const u = e(this, P).has(i);
126
124
  try {
127
125
  let m = !0;
128
- if (e(this, W).notify({
126
+ if (e(this, x).notify({
129
127
  pathname: i,
130
128
  isCached: u
131
129
  }), this.preprocessor)
@@ -156,12 +154,12 @@ class bt {
156
154
  const G = q.filter(
157
155
  (h) => h.tagName === "STYLE" || h.tagName === "SCRIPT" || h.tagName === "LINK"
158
156
  );
159
- e(this, S) && G.length && (yield new Promise((h) => N(this, null, function* () {
157
+ e(this, S) && G.length && (yield new Promise((h) => T(this, null, function* () {
160
158
  let L = 0;
161
159
  try {
162
160
  for (var v = ht(G), mt, J, B; mt = !(J = yield v.next()).done; mt = !1) {
163
- const H = J.value;
164
- H.onload = () => {
161
+ const N = J.value;
162
+ N.onload = () => {
165
163
  L++, L === G.length && h();
166
164
  };
167
165
  }
@@ -181,20 +179,20 @@ class bt {
181
179
  const O = f || location.search, ut = c ? c.startsWith("#") ? c : "#" + c : "", dt = O ? O.startsWith("?") ? O : "?" + O : "", nt = `${i}${ut}${dt}`;
182
180
  s === "push" ? history.pushState(i, "", nt) : s === "replace" && history.replaceState(i, "", nt);
183
181
  const ft = p(this, I, Z).call(this, tt.body.cloneNode(!0));
184
- e(this, D).forEach((h, L) => {
182
+ e(this, W).forEach((h, L) => {
185
183
  const v = ft[L];
186
184
  let mt = [...h.childNodes], J = [...v.childNodes];
187
185
  mt.forEach((B) => {
188
186
  if (B instanceof HTMLElement) {
189
- const H = B.getAttribute("data-remain");
187
+ const N = B.getAttribute("data-remain");
190
188
  let rt;
191
189
  J = J.filter(
192
- (Q) => Q instanceof HTMLElement && H && Q.getAttribute("data-remain") === H ? (rt = Q, !1) : !0
193
- ), H && rt || B.remove();
190
+ (Q) => Q instanceof HTMLElement && N && Q.getAttribute("data-remain") === N ? (rt = Q, !1) : !0
191
+ ), N && rt || B.remove();
194
192
  } else
195
193
  B.remove();
196
194
  }), h.append(...J);
197
- }), p(this, F, X).call(this), document.documentElement.setAttribute("data-current-pathname", i), (d = this.postprocessor) == null || d.call(this, { pathname: i, isCached: u }), e(this, x).notify({ pathname: i, isCached: u });
195
+ }), p(this, F, X).call(this), document.documentElement.setAttribute("data-current-pathname", i), (d = this.postprocessor) == null || d.call(this, { pathname: i, isCached: u }), e(this, D).notify({ pathname: i, isCached: u });
198
196
  } catch (m) {
199
197
  console.error(m);
200
198
  }
@@ -202,8 +200,8 @@ class bt {
202
200
  });
203
201
  }
204
202
  }
205
- E = new WeakMap(), S = new WeakMap(), z = new WeakMap(), D = new WeakMap(), M = new WeakMap(), K = new WeakMap(), P = new WeakMap(), b = new WeakMap(), w = new WeakMap(), W = new WeakMap(), x = new WeakMap(), R = new WeakSet(), V = function(t) {
206
- return N(this, null, function* () {
203
+ E = new WeakMap(), S = new WeakMap(), z = new WeakMap(), W = new WeakMap(), H = new WeakMap(), K = new WeakMap(), P = new WeakMap(), b = new WeakMap(), w = new WeakMap(), x = new WeakMap(), D = new WeakMap(), R = new WeakSet(), V = function(t) {
204
+ return T(this, null, function* () {
207
205
  const s = e(this, P).get(t);
208
206
  if (s)
209
207
  return s;
@@ -217,7 +215,7 @@ E = new WeakMap(), S = new WeakMap(), z = new WeakMap(), D = new WeakMap(), M =
217
215
  var n;
218
216
  return (n = s.getAttribute("href")) == null ? void 0 : n.startsWith("/");
219
217
  });
220
- e(this, M).forEach((s) => s.destroy()), l(this, M, t.map((s) => new gt(s, this)));
218
+ e(this, H).forEach((s) => s.destroy()), l(this, H, t.map((s) => new gt(s, this)));
221
219
  }, I = new WeakSet(), Z = function(t) {
222
220
  return [...t.querySelectorAll("[data-morph]")];
223
221
  }, Y = new WeakSet(), ct = function(t, s) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.5.30",
3
+ "version": "0.5.31",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"