aptechka 0.8.3 → 0.8.4
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/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +33 -33
- package/package.json +1 -1
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var at=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var U=(n,t,i)=>{if(!t.has(n))throw TypeError("Cannot "+i)};var e=(n,t,i)=>(U(n,t,"read from private field"),i?i.call(n):t.get(n)),r=(n,t,i)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,i)},c=(n,t,i,a)=>(U(n,t,"write to private field"),a?a.call(n,i):t.set(n,i),i);var d=(n,t,i)=>(U(n,t,"access private method"),i);var T=(n,t,i)=>new Promise((a,s)=>{var u=l=>{try{f(i.next(l))}catch(g){s(g)}},p=l=>{try{f(i.throw(l))}catch(g){s(g)}},f=l=>l.done?a(l.value):Promise.resolve(l.value).then(u,p);f((i=i.apply(n,t)).next())});var ot=(n,t,i)=>(t=n[at("asyncIterator")])?t.call(n):(n=n[at("iterator")](),t={},i=(a,s)=>(s=n[a])&&(t[a]=u=>new Promise((p,f,l)=>(u=s.call(n,u),l=u.done,Promise.resolve(u.value).then(g=>p({value:g,done:l}),f)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ht=require("../notifier/index.cjs"),mt=require("../browser-CpzFX2xg.cjs"),V=require("../url-C3dWnJQg.cjs");var w,h,m,k,P,C,A;class ft{constructor(t,i){r(this,w,void 0);r(this,h,void 0);r(this,m,void 0);r(this,k,void 0);r(this,P,void 0);r(this,C,t=>{t.preventDefault(),e(this,w).links.forEach(i=>{var a;e(this,m)===e(i,m)||(a=e(i,P))!=null&&a.includes(e(this,m))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,w).navigate(e(this,m),e(this,k))});r(this,A,()=>{e(this,w).prefetch(e(this,m)),e(this,h).removeEventListener("pointerenter",e(this,A))});var u,p;c(this,w,i),c(this,h,t),c(this,m,e(this,h).getAttribute("href")||"/"),c(this,k,e(this,h).getAttribute("data-history-action")||"push"),e(this,h).addEventListener("click",e(this,C));const a=i.normalizePath(e(this,m)),s=i.normalizePath(location.pathname);c(this,P,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(f=>i.normalizePath(f.trim()).pathname)),e(this,h).hasAttribute("data-include")?s.pathname.includes(a.pathname)&&e(this,h).classList.add("current"):a.pathname===s.pathname||(p=e(this,P))!=null&&p.includes(s.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,A))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,A)),e(this,h).classList.remove("current")}}w=new WeakMap,h=new WeakMap,m=new WeakMap,k=new WeakMap,P=new WeakMap,C=new WeakMap,A=new WeakMap;var M,S,z,q,H,K,y,v,L,x,D,R,X,F,Z,I,$,Y,ct,O,tt,_;class pt{constructor(t){r(this,R);r(this,F);r(this,I);r(this,Y);r(this,O);r(this,M,null);r(this,S,null);r(this,z,null);r(this,q,null);r(this,H,[]);r(this,K,new DOMParser);r(this,y,new Map);r(this,v,void 0);r(this,L,null);r(this,x,new ht.Notifier);r(this,D,new ht.Notifier);r(this,_,t=>{t.state&&this.navigate(t.state,"none")});if(mt.isBrowser){t!=null&&t.base?c(this,M,V.normalizeBase(t.base)):c(this,M,"/"),c(this,S,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,z,(t==null?void 0:t.cachePages)!==!1),c(this,q,d(this,I,$).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,L,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",i.leaf),d(this,F,Z).call(this),addEventListener("popstate",e(this,_))}}get currentPathname(){return e(this,L)}get links(){return e(this,H)}normalizePath(t){return V.splitPath(t,e(this,M))}beforeNavigationEvent(t){return e(this,x).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return T(this,null,function*(){const i=this.normalizePath(t);return d(this,R,X).call(this,i.pathname)})}navigate(t,i="push"){return T(this,null,function*(){var g;const a=this.normalizePath(t);let{pathname:s,hash:u,parameters:p,leaf:f}=a;if(e(this,v)===s||e(this,L)===s)return;c(this,v,s);const l=e(this,y).has(s);try{let B=!0;if(e(this,x).notify({pathname:s,isCached:l}),this.preprocessor)try{yield new Promise((o,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:s,resolve:o,reject:E,isCached:l})})}catch(o){o?console.error(o):console.log("Route change canceled"),B=!1}if(!B||e(this,v)!==s)return;const et=e(this,y).get(s)||(yield d(this,R,X).call(this,s));if(e(this,v)!==s)return;const it=Array.from(document.head.children),st=Array.from(et.head.cloneNode(!0).children),nt=d(this,Y,ct).call(this,it,st),lt=d(this,O,tt).call(this,it,nt),W=d(this,O,tt).call(this,st,nt);W.forEach((o,E)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=o.getAttribute("src"),W[E]=b}}),W.forEach(o=>{document.head.appendChild(o)});const G=W.filter(o=>o.tagName==="STYLE"||o.tagName==="SCRIPT"||o.tagName==="LINK");e(this,S)&&G.length&&(yield new Promise(o=>T(this,null,function*(){let E=0;try{for(var b=ot(G),dt,J,j;dt=!(J=yield b.next()).done;dt=!1){const N=J.value;N.onload=()=>{E++,E===G.length&&o()}}}catch(J){j=[J]}finally{try{dt&&(J=b.return)&&(yield J.call(b))}finally{if(j)throw j[0]}}}))),lt.forEach(o=>{o.hasAttribute("data-permanent")||o.remove()}),c(this,L,s),V.changeHistory(i,s,p,u);const ut=d(this,I,$).call(this,et.body.cloneNode(!0));e(this,q).forEach((o,E)=>{const b=ut[E];let dt=[...o.childNodes],J=[...b.childNodes];dt.forEach(j=>{if(j instanceof HTMLElement){const N=j.getAttribute("data-remain");let rt;J=J.filter(Q=>Q instanceof HTMLElement&&N&&Q.getAttribute("data-remain")===N?(rt=Q,!1):!0),N&&rt||j.remove()}else j.remove()}),o.append(...J)}),d(this,F,Z).call(this),document.documentElement.setAttribute("data-current-pathname",s),document.documentElement.setAttribute("data-current-leaf",f),(g=this.postprocessor)==null||g.call(this,{pathname:s,isCached:l}),e(this,D).notify({pathname:s,isCached:l})}catch(B){console.error(B)}c(this,v,void 0)})}}M=new WeakMap,S=new WeakMap,z=new WeakMap,q=new WeakMap,H=new WeakMap,K=new WeakMap,y=new WeakMap,v=new WeakMap,L=new WeakMap,x=new WeakMap,D=new WeakMap,R=new WeakSet,X=function(t){return T(this,null,function*(){const i=e(this,y).get(t);if(i)return i;const s=yield(yield fetch(t)).text(),u=e(this,K).parseFromString(s,"text/html");return e(this,z)&&e(this,y).set(t,u),u})},F=new WeakSet,Z=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var a;return(a=i.getAttribute("href"))==null?void 0:a.startsWith("/")});e(this,H).forEach(i=>i.destroy()),c(this,H,t.map(i=>new ft(i,this)))},I=new WeakSet,$=function(t){return[...t.querySelectorAll("[data-morph]")]},Y=new WeakSet,ct=function(t,i){return t.filter(a=>i.find(s=>s.outerHTML===a.outerHTML))},O=new WeakSet,tt=function(t,i){return t.filter(a=>!i.find(s=>s.outerHTML===a.outerHTML))},_=new WeakMap;exports.Morph=pt;
|
|
1
|
+
"use strict";var at=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n);var U=(n,t,i)=>{if(!t.has(n))throw TypeError("Cannot "+i)};var e=(n,t,i)=>(U(n,t,"read from private field"),i?i.call(n):t.get(n)),r=(n,t,i)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,i)},c=(n,t,i,a)=>(U(n,t,"write to private field"),a?a.call(n,i):t.set(n,i),i);var d=(n,t,i)=>(U(n,t,"access private method"),i);var T=(n,t,i)=>new Promise((a,s)=>{var u=l=>{try{f(i.next(l))}catch(g){s(g)}},p=l=>{try{f(i.throw(l))}catch(g){s(g)}},f=l=>l.done?a(l.value):Promise.resolve(l.value).then(u,p);f((i=i.apply(n,t)).next())});var ot=(n,t,i)=>(t=n[at("asyncIterator")])?t.call(n):(n=n[at("iterator")](),t={},i=(a,s)=>(s=n[a])&&(t[a]=u=>new Promise((p,f,l)=>(u=s.call(n,u),l=u.done,Promise.resolve(u.value).then(g=>p({value:g,done:l}),f)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ht=require("../notifier/index.cjs"),mt=require("../browser-CpzFX2xg.cjs"),V=require("../url-C3dWnJQg.cjs");var w,h,m,k,P,C,A;class ft{constructor(t,i){r(this,w,void 0);r(this,h,void 0);r(this,m,void 0);r(this,k,void 0);r(this,P,void 0);r(this,C,t=>{t.preventDefault(),e(this,w).links.forEach(i=>{var a;e(this,m)===e(i,m)||(a=e(i,P))!=null&&a.includes(e(this,m))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,w).navigate(e(this,m),e(this,k))});r(this,A,()=>{e(this,w).prefetch(e(this,m)),e(this,h).removeEventListener("pointerenter",e(this,A))});var u,p;c(this,w,i),c(this,h,t),c(this,m,e(this,h).getAttribute("href")||"/"),c(this,k,e(this,h).getAttribute("data-history-action")||"push"),e(this,h).addEventListener("click",e(this,C));const a=i.normalizePath(e(this,m)),s=i.normalizePath(location.pathname);c(this,P,(u=e(this,h).getAttribute("data-match-paths"))==null?void 0:u.split(",").map(f=>i.normalizePath(f.trim()).pathname)),e(this,h).hasAttribute("data-include")?s.pathname.includes(a.pathname)&&e(this,h).classList.add("current"):a.pathname===s.pathname||(p=e(this,P))!=null&&p.includes(s.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,A))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,A)),e(this,h).classList.remove("current")}}w=new WeakMap,h=new WeakMap,m=new WeakMap,k=new WeakMap,P=new WeakMap,C=new WeakMap,A=new WeakMap;var M,S,z,q,H,K,y,v,L,x,D,R,X,F,Z,I,$,Y,ct,O,tt,_;class pt{constructor(t){r(this,R);r(this,F);r(this,I);r(this,Y);r(this,O);r(this,M,null);r(this,S,null);r(this,z,null);r(this,q,null);r(this,H,[]);r(this,K,new DOMParser);r(this,y,new Map);r(this,v,void 0);r(this,L,null);r(this,x,new ht.Notifier);r(this,D,new ht.Notifier);r(this,_,t=>{t.state&&this.navigate(t.state,"none")});if(mt.isBrowser){t!=null&&t.base?c(this,M,V.normalizeBase(t.base)):c(this,M,"/"),c(this,S,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,z,(t==null?void 0:t.cachePages)!==!1),c(this,q,d(this,I,$).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,L,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,L)),document.documentElement.setAttribute("data-current-leaf",i.leaf),d(this,F,Z).call(this),addEventListener("popstate",e(this,_))}}get currentPathname(){return e(this,L)}get links(){return e(this,H)}normalizePath(t){return V.splitPath(t,e(this,M))}beforeNavigationEvent(t){return e(this,x).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return T(this,null,function*(){const i=this.normalizePath(t);return d(this,R,X).call(this,i.pathname)})}navigate(t,i="push"){return T(this,null,function*(){var g;const a=this.normalizePath(t);let{pathname:s,hash:u,parameters:p,leaf:f}=a;if(e(this,v)===s||e(this,L)===s)return;c(this,v,s);const l=e(this,y).has(s);try{let B=!0;if(e(this,x).notify({pathname:s,isCached:l}),this.preprocessor)try{yield new Promise((o,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:s,resolve:o,reject:E,isCached:l})})}catch(o){o?console.error(o):console.log("Route change canceled"),B=!1}if(!B||e(this,v)!==s)return;const et=e(this,y).get(s)||(yield d(this,R,X).call(this,s));if(e(this,v)!==s)return;const it=Array.from(document.head.children),st=Array.from(et.head.cloneNode(!0).children),nt=d(this,Y,ct).call(this,it,st),lt=d(this,O,tt).call(this,it,nt),W=d(this,O,tt).call(this,st,nt);W.forEach((o,E)=>{if(o.tagName==="SCRIPT"&&o.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=o.getAttribute("src"),W[E]=b}}),W.forEach(o=>{document.head.appendChild(o)});const G=W.filter(o=>(o.tagName==="STYLE"||o.tagName==="SCRIPT"||o.tagName==="LINK")&&o.getAttribute("rel")!=="canonical");e(this,S)&&G.length&&(yield new Promise(o=>T(this,null,function*(){let E=0;try{for(var b=ot(G),dt,J,j;dt=!(J=yield b.next()).done;dt=!1){const N=J.value;N.onload=()=>{E++,E===G.length&&o()}}}catch(J){j=[J]}finally{try{dt&&(J=b.return)&&(yield J.call(b))}finally{if(j)throw j[0]}}}))),lt.forEach(o=>{o.hasAttribute("data-permanent")||o.remove()}),c(this,L,s),V.changeHistory(i,s,p,u);const ut=d(this,I,$).call(this,et.body.cloneNode(!0));e(this,q).forEach((o,E)=>{const b=ut[E];let dt=[...o.childNodes],J=[...b.childNodes];dt.forEach(j=>{if(j instanceof HTMLElement){const N=j.getAttribute("data-remain");let rt;J=J.filter(Q=>Q instanceof HTMLElement&&N&&Q.getAttribute("data-remain")===N?(rt=Q,!1):!0),N&&rt||j.remove()}else j.remove()}),o.append(...J)}),d(this,F,Z).call(this),document.documentElement.setAttribute("data-current-pathname",s),document.documentElement.setAttribute("data-current-leaf",f),(g=this.postprocessor)==null||g.call(this,{pathname:s,isCached:l}),e(this,D).notify({pathname:s,isCached:l})}catch(B){console.error(B)}c(this,v,void 0)})}}M=new WeakMap,S=new WeakMap,z=new WeakMap,q=new WeakMap,H=new WeakMap,K=new WeakMap,y=new WeakMap,v=new WeakMap,L=new WeakMap,x=new WeakMap,D=new WeakMap,R=new WeakSet,X=function(t){return T(this,null,function*(){const i=e(this,y).get(t);if(i)return i;const s=yield(yield fetch(t)).text(),u=e(this,K).parseFromString(s,"text/html");return e(this,z)&&e(this,y).set(t,u),u})},F=new WeakSet,Z=function(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var a;return(a=i.getAttribute("href"))==null?void 0:a.startsWith("/")});e(this,H).forEach(i=>i.destroy()),c(this,H,t.map(i=>new ft(i,this)))},I=new WeakSet,$=function(t){return[...t.querySelectorAll("[data-morph]")]},Y=new WeakSet,ct=function(t,i){return t.filter(a=>i.find(s=>s.outerHTML===a.outerHTML))},O=new WeakSet,tt=function(t,i){return t.filter(a=>!i.find(s=>s.outerHTML===a.outerHTML))},_=new WeakMap;exports.Morph=pt;
|
package/lib/morph/index.js
CHANGED
|
@@ -13,52 +13,52 @@ var T = (n, t, i) => new Promise((r, s) => {
|
|
|
13
13
|
var u = (l) => {
|
|
14
14
|
try {
|
|
15
15
|
f(i.next(l));
|
|
16
|
-
} catch (
|
|
17
|
-
s(
|
|
16
|
+
} catch (g) {
|
|
17
|
+
s(g);
|
|
18
18
|
}
|
|
19
19
|
}, p = (l) => {
|
|
20
20
|
try {
|
|
21
21
|
f(i.throw(l));
|
|
22
|
-
} catch (
|
|
23
|
-
s(
|
|
22
|
+
} catch (g) {
|
|
23
|
+
s(g);
|
|
24
24
|
}
|
|
25
25
|
}, f = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(u, p);
|
|
26
26
|
f((i = i.apply(n, t)).next());
|
|
27
27
|
});
|
|
28
|
-
var rt = (n, t, i) => (t = n[at("asyncIterator")]) ? t.call(n) : (n = n[at("iterator")](), t = {}, i = (r, s) => (s = n[r]) && (t[r] = (u) => new Promise((p, f, l) => (u = s.call(n, u), l = u.done, Promise.resolve(u.value).then((
|
|
28
|
+
var rt = (n, t, i) => (t = n[at("asyncIterator")]) ? t.call(n) : (n = n[at("iterator")](), t = {}, i = (r, s) => (s = n[r]) && (t[r] = (u) => new Promise((p, f, l) => (u = s.call(n, u), l = u.done, Promise.resolve(u.value).then((g) => p({ value: g, done: l }), f)))), i("next"), i("return"), t);
|
|
29
29
|
import { Notifier as ot } from "../notifier/index.js";
|
|
30
30
|
import { i as dt } from "../browser-0zX67oeU.js";
|
|
31
31
|
import { n as mt, s as ft, c as pt } from "../url-DMNfW7uN.js";
|
|
32
|
-
var w, h, m, k,
|
|
33
|
-
class
|
|
32
|
+
var w, h, m, k, P, C, y;
|
|
33
|
+
class gt {
|
|
34
34
|
constructor(t, i) {
|
|
35
35
|
a(this, w, void 0);
|
|
36
36
|
a(this, h, void 0);
|
|
37
37
|
a(this, m, void 0);
|
|
38
38
|
a(this, k, void 0);
|
|
39
|
-
a(this,
|
|
39
|
+
a(this, P, void 0);
|
|
40
40
|
a(this, C, (t) => {
|
|
41
41
|
t.preventDefault(), e(this, w).links.forEach((i) => {
|
|
42
42
|
var r;
|
|
43
|
-
e(this, m) === e(i, m) || (r = e(i,
|
|
43
|
+
e(this, m) === e(i, m) || (r = e(i, P)) != null && r.includes(e(this, m)) ? e(i, h).classList.add("clicked") : e(i, h).classList.remove("clicked");
|
|
44
44
|
}), e(this, w).navigate(e(this, m), e(this, k));
|
|
45
45
|
});
|
|
46
|
-
a(this,
|
|
47
|
-
e(this, w).prefetch(e(this, m)), e(this, h).removeEventListener("pointerenter", e(this,
|
|
46
|
+
a(this, y, () => {
|
|
47
|
+
e(this, w).prefetch(e(this, m)), e(this, h).removeEventListener("pointerenter", e(this, y));
|
|
48
48
|
});
|
|
49
49
|
var u, p;
|
|
50
50
|
c(this, w, i), c(this, h, t), c(this, m, e(this, h).getAttribute("href") || "/"), c(this, k, e(this, h).getAttribute(
|
|
51
51
|
"data-history-action"
|
|
52
52
|
) || "push"), e(this, h).addEventListener("click", e(this, C));
|
|
53
53
|
const r = i.normalizePath(e(this, m)), s = i.normalizePath(location.pathname);
|
|
54
|
-
c(this,
|
|
54
|
+
c(this, P, (u = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : u.split(",").map((f) => i.normalizePath(f.trim()).pathname)), e(this, h).hasAttribute("data-include") ? s.pathname.includes(r.pathname) && e(this, h).classList.add("current") : r.pathname === s.pathname || (p = e(this, P)) != null && p.includes(s.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, y));
|
|
55
55
|
}
|
|
56
56
|
destroy() {
|
|
57
|
-
e(this, h).removeEventListener("click", e(this, C)), e(this, h).removeEventListener("pointerenter", e(this,
|
|
57
|
+
e(this, h).removeEventListener("click", e(this, C)), e(this, h).removeEventListener("pointerenter", e(this, y)), e(this, h).classList.remove("current");
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
w = new WeakMap(), h = new WeakMap(), m = new WeakMap(), k = new WeakMap(),
|
|
61
|
-
var H, z, S, x, M, Y,
|
|
60
|
+
w = new WeakMap(), h = new WeakMap(), m = new WeakMap(), k = new WeakMap(), P = new WeakMap(), C = new WeakMap(), y = new WeakMap();
|
|
61
|
+
var H, z, S, x, M, Y, A, v, b, D, R, F, X, I, Z, q, _, j, ht, B, $, G;
|
|
62
62
|
class wt {
|
|
63
63
|
constructor(t) {
|
|
64
64
|
a(this, F);
|
|
@@ -72,7 +72,7 @@ class wt {
|
|
|
72
72
|
a(this, x, null);
|
|
73
73
|
a(this, M, []);
|
|
74
74
|
a(this, Y, new DOMParser());
|
|
75
|
-
a(this,
|
|
75
|
+
a(this, A, /* @__PURE__ */ new Map());
|
|
76
76
|
a(this, v, void 0);
|
|
77
77
|
a(this, b, null);
|
|
78
78
|
a(this, D, new ot());
|
|
@@ -115,13 +115,13 @@ class wt {
|
|
|
115
115
|
}
|
|
116
116
|
navigate(t, i = "push") {
|
|
117
117
|
return T(this, null, function* () {
|
|
118
|
-
var
|
|
118
|
+
var g;
|
|
119
119
|
const r = this.normalizePath(t);
|
|
120
120
|
let { pathname: s, hash: u, parameters: p, leaf: f } = r;
|
|
121
121
|
if (e(this, v) === s || e(this, b) === s)
|
|
122
122
|
return;
|
|
123
123
|
c(this, v, s);
|
|
124
|
-
const l = e(this,
|
|
124
|
+
const l = e(this, A).has(s);
|
|
125
125
|
try {
|
|
126
126
|
let O = !0;
|
|
127
127
|
if (e(this, D).notify({
|
|
@@ -129,39 +129,39 @@ class wt {
|
|
|
129
129
|
isCached: l
|
|
130
130
|
}), this.preprocessor)
|
|
131
131
|
try {
|
|
132
|
-
yield new Promise((o,
|
|
132
|
+
yield new Promise((o, E) => {
|
|
133
133
|
var L;
|
|
134
|
-
(L = this.preprocessor) == null || L.call(this, { pathname: s, resolve: o, reject:
|
|
134
|
+
(L = this.preprocessor) == null || L.call(this, { pathname: s, resolve: o, reject: E, isCached: l });
|
|
135
135
|
});
|
|
136
136
|
} catch (o) {
|
|
137
137
|
o ? console.error(o) : console.log("Route change canceled"), O = !1;
|
|
138
138
|
}
|
|
139
139
|
if (!O || e(this, v) !== s)
|
|
140
140
|
return;
|
|
141
|
-
const tt = e(this,
|
|
141
|
+
const tt = e(this, A).get(s) || (yield d(this, F, X).call(this, s));
|
|
142
142
|
if (e(this, v) !== s)
|
|
143
143
|
return;
|
|
144
144
|
const et = Array.from(document.head.children), it = Array.from(
|
|
145
145
|
tt.head.cloneNode(!0).children
|
|
146
146
|
), st = d(this, j, ht).call(this, et, it), ct = d(this, B, $).call(this, et, st), W = d(this, B, $).call(this, it, st);
|
|
147
|
-
W.forEach((o,
|
|
147
|
+
W.forEach((o, E) => {
|
|
148
148
|
if (o.tagName === "SCRIPT" && o.getAttribute("src")) {
|
|
149
149
|
const L = document.createElement("script");
|
|
150
|
-
L.type = "module", L.src = o.getAttribute("src"), W[
|
|
150
|
+
L.type = "module", L.src = o.getAttribute("src"), W[E] = L;
|
|
151
151
|
}
|
|
152
152
|
}), W.forEach((o) => {
|
|
153
153
|
document.head.appendChild(o);
|
|
154
154
|
});
|
|
155
155
|
const J = W.filter(
|
|
156
|
-
(o) => o.tagName === "STYLE" || o.tagName === "SCRIPT" || o.tagName === "LINK"
|
|
156
|
+
(o) => (o.tagName === "STYLE" || o.tagName === "SCRIPT" || o.tagName === "LINK") && o.getAttribute("rel") !== "canonical"
|
|
157
157
|
);
|
|
158
158
|
e(this, z) && J.length && (yield new Promise((o) => T(this, null, function* () {
|
|
159
|
-
let
|
|
159
|
+
let E = 0;
|
|
160
160
|
try {
|
|
161
161
|
for (var L = rt(J), ut, Q, K; ut = !(Q = yield L.next()).done; ut = !1) {
|
|
162
162
|
const N = Q.value;
|
|
163
163
|
N.onload = () => {
|
|
164
|
-
|
|
164
|
+
E++, E === J.length && o();
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
} catch (Q) {
|
|
@@ -178,8 +178,8 @@ class wt {
|
|
|
178
178
|
o.hasAttribute("data-permanent") || o.remove();
|
|
179
179
|
}), c(this, b, s), pt(i, s, p, u);
|
|
180
180
|
const lt = d(this, q, _).call(this, tt.body.cloneNode(!0));
|
|
181
|
-
e(this, x).forEach((o,
|
|
182
|
-
const L = lt[
|
|
181
|
+
e(this, x).forEach((o, E) => {
|
|
182
|
+
const L = lt[E];
|
|
183
183
|
let ut = [...o.childNodes], Q = [...L.childNodes];
|
|
184
184
|
ut.forEach((K) => {
|
|
185
185
|
if (K instanceof HTMLElement) {
|
|
@@ -191,7 +191,7 @@ class wt {
|
|
|
191
191
|
} else
|
|
192
192
|
K.remove();
|
|
193
193
|
}), o.append(...Q);
|
|
194
|
-
}), d(this, I, Z).call(this), document.documentElement.setAttribute("data-current-pathname", s), document.documentElement.setAttribute("data-current-leaf", f), (
|
|
194
|
+
}), d(this, I, Z).call(this), document.documentElement.setAttribute("data-current-pathname", s), document.documentElement.setAttribute("data-current-leaf", f), (g = this.postprocessor) == null || g.call(this, { pathname: s, isCached: l }), e(this, R).notify({ pathname: s, isCached: l });
|
|
195
195
|
} catch (O) {
|
|
196
196
|
console.error(O);
|
|
197
197
|
}
|
|
@@ -199,13 +199,13 @@ class wt {
|
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
H = new WeakMap(), z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), M = new WeakMap(), Y = new WeakMap(),
|
|
202
|
+
H = new WeakMap(), z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), M = new WeakMap(), Y = new WeakMap(), A = new WeakMap(), v = new WeakMap(), b = new WeakMap(), D = new WeakMap(), R = new WeakMap(), F = new WeakSet(), X = function(t) {
|
|
203
203
|
return T(this, null, function* () {
|
|
204
|
-
const i = e(this,
|
|
204
|
+
const i = e(this, A).get(t);
|
|
205
205
|
if (i)
|
|
206
206
|
return i;
|
|
207
207
|
const s = yield (yield fetch(t)).text(), u = e(this, Y).parseFromString(s, "text/html");
|
|
208
|
-
return e(this, S) && e(this,
|
|
208
|
+
return e(this, S) && e(this, A).set(t, u), u;
|
|
209
209
|
});
|
|
210
210
|
}, I = new WeakSet(), Z = function() {
|
|
211
211
|
const t = [
|
|
@@ -214,7 +214,7 @@ H = new WeakMap(), z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), M =
|
|
|
214
214
|
var r;
|
|
215
215
|
return (r = i.getAttribute("href")) == null ? void 0 : r.startsWith("/");
|
|
216
216
|
});
|
|
217
|
-
e(this, M).forEach((i) => i.destroy()), c(this, M, t.map((i) => new
|
|
217
|
+
e(this, M).forEach((i) => i.destroy()), c(this, M, t.map((i) => new gt(i, this)));
|
|
218
218
|
}, q = new WeakSet(), _ = function(t) {
|
|
219
219
|
return [...t.querySelectorAll("[data-morph]")];
|
|
220
220
|
}, j = new WeakSet(), ht = function(t, i) {
|