aptechka 0.76.1 → 0.76.3
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/media/index.cjs +1 -1
- package/lib/media/index.js +21 -16
- package/lib/morph/index.cjs +1 -1
- package/lib/morph/index.js +191 -191
- package/package.json +1 -1
package/lib/media/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var a=e=>{throw TypeError(e)};var d=(e,r,s)=>r.has(e)||a("Cannot "+s);var o=(e,r,s)=>(d(e,r,"read from private field"),s?s.call(e):r.get(e)),u=(e,r,s)=>r.has(e)?a("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(e):r.set(e,s),n=(e,r,s,i)=>(d(e,r,"write to private field"),i?i.call(e,s):r.set(e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../order/index.cjs"),h=require("../window-resizer/index.cjs"),b=require("../Store-Cd1GlEmZ.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");var t,c;class q extends b.Store{constructor(s){super(!1);u(this,t);u(this,c);n(this,t,s);const i=()=>{matchMedia(o(this,t)).matches?this.current=!0:this.current=!1};n(this,c,h.windowResizer.subscribe(i,l.RESIZE_ORDER.MEDIA)),i()}close(){super.close(),o(this,c).call(this)}}t=new WeakMap,c=new WeakMap;exports.Media=q;
|
package/lib/media/index.js
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var u = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var h = (e, r
|
|
5
|
-
var
|
|
6
|
-
import { RESIZE_ORDER as
|
|
4
|
+
var h = (s, e, r) => e.has(s) || u("Cannot " + r);
|
|
5
|
+
var c = (s, e, r) => (h(s, e, "read from private field"), r ? r.call(s) : e.get(s)), m = (s, e, r) => e.has(s) ? u("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(s) : e.set(s, r), a = (s, e, r, t) => (h(s, e, "write to private field"), t ? t.call(s, r) : e.set(s, r), r);
|
|
6
|
+
import { RESIZE_ORDER as l } from "../order/index.js";
|
|
7
7
|
import { windowResizer as n } from "../window-resizer/index.js";
|
|
8
|
-
import { S as
|
|
8
|
+
import { S as p } from "../Store-0BVty6AZ.js";
|
|
9
9
|
import "construct-style-sheets-polyfill";
|
|
10
10
|
import "../index-Bv9zgfdb.js";
|
|
11
|
-
var
|
|
12
|
-
class M extends
|
|
13
|
-
constructor(
|
|
11
|
+
var i, o;
|
|
12
|
+
class M extends p {
|
|
13
|
+
constructor(r) {
|
|
14
14
|
super(!1);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
m(this, i);
|
|
16
|
+
m(this, o);
|
|
17
|
+
a(this, i, r);
|
|
18
|
+
const t = () => {
|
|
19
|
+
matchMedia(c(this, i)).matches ? this.current = !0 : this.current = !1;
|
|
20
|
+
};
|
|
21
|
+
a(this, o, n.subscribe(
|
|
22
|
+
t,
|
|
23
|
+
l.MEDIA
|
|
24
|
+
)), t();
|
|
20
25
|
}
|
|
21
26
|
close() {
|
|
22
|
-
super.close(),
|
|
27
|
+
super.close(), c(this, o).call(this);
|
|
23
28
|
}
|
|
24
29
|
}
|
|
25
|
-
|
|
30
|
+
i = new WeakMap(), o = new WeakMap();
|
|
26
31
|
export {
|
|
27
32
|
M as Media
|
|
28
33
|
};
|
package/lib/morph/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ue=Object.defineProperty,de=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Jt=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Qt=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),_t=o=>{throw TypeError(o)};var Zt=(o,e,s)=>e in o?ue(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,Rt=(o,e)=>{for(var s in e||(e={}))fe.call(e,s)&&Zt(o,s,e[s]);if(Jt)for(var s of Jt(e))pe.call(e,s)&&Zt(o,s,e[s]);return o},Dt=(o,e)=>de(o,me(e));var qt=(o,e,s)=>e.has(o)||_t("Cannot "+s);var t=(o,e,s)=>(qt(o,e,"read from private field"),s?s.call(o):e.get(o)),h=(o,e,s)=>e.has(o)?_t("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,s),r=(o,e,s,i)=>(qt(o,e,"write to private field"),i?i.call(o,s):e.set(o,s),s),g=(o,e,s)=>(qt(o,e,"access private method"),s);var G=(o,e,s)=>new Promise((i,l)=>{var S=c=>{try{E(s.next(c))}catch(v){l(v)}},p=c=>{try{E(s.throw(c))}catch(v){l(v)}},E=c=>c.done?i(c.value):Promise.resolve(c.value).then(S,p);E((s=s.apply(o,e)).next())});var te=(o,e,s)=>(e=o[Qt("asyncIterator")])?e.call(o):(o=o[Qt("iterator")](),e={},s=(i,l)=>(l=o[i])&&(e[i]=S=>new Promise((p,E,c)=>(S=l.call(o,S),c=S.done,Promise.resolve(S.value).then(v=>p({value:v,done:c}),E)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("../index-DekP7OZe.cjs"),q=require("../events-KVanG9sR.cjs"),ee=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const dt=require("../url-Dns-01WU.cjs"),ge=require("../css-value-parser/index.cjs"),Ee=require("../string-DUXXtU8v.cjs");class ae extends HTMLElement{connectedCallback(){const e={"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(e))this.setAttribute(s,i)}}ie.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",ae);var H,a,U,st,Ht,ft,it;class It{constructor(e,s){h(this,st);h(this,H);h(this,a);h(this,U);h(this,ft,e=>{var i;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,H).previousURL)history.back();else{r(this,U,t(this,a).getAttribute("href")||"/");const l=t(this,a).getAttribute("data-history-action")||"push",S=t(this,a).hasAttribute("data-center-scroll"),p=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),E=p?ge.cssValueParser.parse(p):void 0,c=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),v=t(this,a).hasAttribute("data-keep-search-parameters"),D=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),ut=t(this,a).getAttribute("data-scroll-behaviour"),et=g(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));et&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,H).links.forEach(T=>{T.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),et.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,H).links.forEach(T=>{T.updatePagination(et.currentPage+1,et.selector)}));const re=((i=t(this,a).getAttribute("data-submorph"))==null?void 0:i.split(",").map(T=>T.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,Pt=t(this,a).hasAttribute("data-clear-state");let u=t(this,U);if(t(this,a).hasAttribute("data-toggle-params")){const[T,wt]=t(this,U).split("?"),j=new URLSearchParams(wt),O=new URLSearchParams(location.search),A=new URLSearchParams;for(const[w]of j)(!O.has(w)||O.has(w)&&O.get(w)!==j.get(w))&&A.append(w,j.get(w));if(t(this,a).hasAttribute("data-merge-params"))for(const[w]of O)j.has(w)||A.append(w,O.get(w));u=`${T}?${A.toString()}`}t(this,H).navigate(u,{historyAction:l,centerScroll:S,offsetScroll:E,revalidate:c,keepSearchParameters:v,submorph:re,clearState:Pt,keepScrollPosition:D,scrollBehaviour:ut,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link"),mergeParams:t(this,a).hasAttribute("data-merge-params")&&!t(this,a).hasAttribute("data-toggle-params")})}});h(this,it,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,H).prefetch(t(this,U),e),t(this,a).removeEventListener("pointerenter",t(this,it))});r(this,H,s),r(this,a,e),t(this,a).addEventListener("click",t(this,ft)),r(this,U,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const i=g(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));i&&this.updatePagination(i.currentPage,i.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,it))}get element(){return t(this,a)}checkCurrent(e){var v;const s=t(this,H).normalizePath(e),i=t(this,H).normalizePath(t(this,U));t(this,a).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,a).classList.add("current"):i.pathname===s.pathname?t(this,a).classList.add("current"):(v=t(this,a).getAttribute("data-associated-paths"))!=null&&v.split(",").find(D=>s.pathname.includes(D))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),s.path===i.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact");const[l,S]=t(this,U).split("?"),p=new URLSearchParams(S),E=new URLSearchParams(location.search);let c=0;for(const[D]of E)p.has(D)&&E.get(D)===p.get(D)&&c++;c?(t(this,a).classList.toggle("all-params-matched",E.size===c),t(this,a).classList.toggle("some-params-matched",E.size!==c)):(t(this,a).classList.remove("all-params-matched"),t(this,a).classList.remove("some-params-matched"))}updatePagination(e,s){const i=g(this,st,Ht).call(this,s);if(i)if(i.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<i.totalPages){t(this,a).style.display="";const l=t(this,a).querySelector("[data-pagination-more-link-counter]");l&&(l.textContent=(i.totalPages-e).toString());const S=t(this,a).getAttribute("href"),p=new URL(S,window.location.origin);p.searchParams.set("page",(e+1).toString());const E=p.href.replace(p.origin,"").toString();t(this,a).setAttribute("href",E),this.checkCurrent(E)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,ft)),t(this,a).removeEventListener("pointerenter",t(this,it)),t(this,a).classList.remove("current","exact","pagination-current")}}H=new WeakMap,a=new WeakMap,U=new WeakMap,st=new WeakSet,Ht=function(e){if(!e)return;const s=document.querySelector(e);if(s){const i=parseInt(s.getAttribute("data-current-page")||"1"),l=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:i,totalPages:l,selector:e}}},ft=new WeakMap,it=new WeakMap;const ve=new DOMParser;var I,J,k,z,Q,B,at,Z,X,pt;class se{constructor(e,s){h(this,I);h(this,J);h(this,k,{x:0,y:0});h(this,z,null);h(this,Q,null);h(this,B,null);h(this,at,null);h(this,Z,null);h(this,X,null);h(this,pt);r(this,I,e),r(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,k)}get document(){return t(this,B)}setHeaders(e){r(this,pt,e)}setInitialDocument(e){r(this,z,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,i){return G(this,null,function*(){var l;if(!i){const E=((l=t(this,z))==null?void 0:l.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,z)&&t(this,I).isPopstateNavigation;if(t(this,X)||E||c)return t(this,X)}return r(this,X,new Promise(S=>G(this,null,function*(){try{r(this,Z,new AbortController);const E=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,pt))})).text(),c=ve.parseFromString(E,"text/html");this.setInitialDocument(c)}catch(p){console.warn(p)}finally{r(this,Z,null),r(this,X,null),S()}}))),t(this,X)})}cloneDocument(){r(this,B,(t(this,Q)||t(this,z)).cloneNode(!0))}get title(){let e="";if(t(this,B).title)e=t(this,B).title;else{const s=t(this,B).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){r(this,Q,null)}saveScrollState(){t(this,z).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,I).scrollValue.left,t(this,k).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,z).documentElement.hasAttribute("data-no-page-restoration")?r(this,Q,null):r(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,at,e)}clearState(){const e=t(this,at);return r(this,at,null),e}}I=new WeakMap,J=new WeakMap,k=new WeakMap,z=new WeakMap,Q=new WeakMap,B=new WeakMap,at=new WeakMap,Z=new WeakMap,X=new WeakMap,pt=new WeakMap;var C,nt,gt,zt,Et;class Se{constructor(e){h(this,gt);h(this,C);h(this,nt,[]);h(this,Et,()=>{g(this,gt,zt).call(this)});r(this,C,e);for(const s in t(this,C).dataset){const i=Ee.camelToKebab(s);if(i.startsWith("param-")){const l=i.split("param-")[1],S=t(this,C).dataset[s];t(this,nt).push({name:l,value:S})}}document.addEventListener("morphURLParametersChange",t(this,Et)),g(this,gt,zt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Et))}}C=new WeakMap,nt=new WeakMap,gt=new WeakSet,zt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,nt).find(l=>e.has(l.name)&&(e.get(l.name)===l.value||l.value==="*"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,nt).filter(l=>e.has(l.name)).length);const i=t(this,C).getAttribute("data-hide-class");s?i?t(this,C).classList.remove(i):t(this,C).style.display="":i?t(this,C).classList.add(i):t(this,C).style.display="none"},Et=new WeakMap;var N,rt,y,K,f,_,Y,$,M,vt,V,St,tt,ot,ht,Lt,lt,bt,m,Ot,yt,Mt,Wt,ne,Ft,Bt,Xt,Kt,Tt,ct;const mt=class mt{constructor(e){h(this,m);h(this,N,null);h(this,rt,null);h(this,y,[]);h(this,K);h(this,f,null);h(this,_);h(this,Y,[]);h(this,$,!1);h(this,M,null);h(this,vt,!1);h(this,V,new Map);h(this,St,[]);h(this,tt,null);h(this,ot,0);h(this,ht,0);h(this,Lt);h(this,lt);h(this,bt);h(this,yt,e=>{var s;return((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});h(this,Tt,e=>G(this,null,function*(){e.preventDefault(),r(this,$,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,lt)?void 0:t(this,Lt),revalidate:t(this,lt),keepScrollPosition:t(this,bt)}),r(this,$,!1)}));h(this,ct,()=>{const{left:e,top:s}=this.scrollValue,i=s-t(this,ht),l=e-t(this,ot);r(this,ht,s),r(this,ot,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",l>0),document.documentElement.classList.toggle("scroll-x-backward",l<0),q.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ie.isBrowser&&!mt.instance){mt.instance=this,r(this,N,{base:dt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,rt,g(this,m,Wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);r(this,f,s);const i=new se(this,t(this,f).pathname);i.setInitialDocument(document),t(this,V).set(t(this,f).pathname,i),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),dt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,tt,new ae),g(this,m,Xt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,_)}get links(){return t(this,y)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,$)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,V).get(t(this,f).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return dt.splitPath(e,{base:t(this,N).base,trailingSlash:t(this,N).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var l;if(t(this,Y).length)return;e=((l=this.pathnameModifier)==null?void 0:l.call(this,e))||e;const i=g(this,m,Mt).call(this,e);i==null||i.fetch(e,t(this,f).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(re){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:l,scrollBehaviour:S,revalidate:p,keepSearchParameters:E,submorph:c,submorphAppend:v,clearState:D,keepScrollPosition:ut,mergeParams:et}={}){var T,wt,j,O;if(t(this,Y).length)return;r(this,Lt,c),r(this,lt,p),r(this,bt,ut);const Pt=((T=this.pathnameModifier)==null?void 0:T.call(this,e))||e,u=this.normalizePath(Pt,{mergeParams:et});if(!p&&(((wt=t(this,K))==null?void 0:wt.pathname)===u.pathname||t(this,f).pathname===u.pathname)){ut||g(this,m,Kt).call(this,u.hash||0,{centerScroll:i,offsetScroll:l,behavior:"smooth"}),q.dispatchEvent(document,"morphSamePath",{custom:!0}),((j=t(this,f))==null?void 0:j.parameters)!==u.parameters&&(r(this,_,t(this,f)),r(this,f,u),dt.changeHistory({action:((O=t(this,f))==null?void 0:O.hash)!==u.hash?"replace":s,pathname:u.pathname,searchParameters:u.parameters,hash:u.hash}),q.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,_)}})),t(this,y).forEach(A=>{A.checkCurrent(u.path)});return}else t(this,y).forEach(A=>{A.checkCurrent(u.path)});r(this,K,u);try{let A=!0;if(this.preprocessor)try{yield new Promise((n,P)=>{var R;(R=this.preprocessor)==null||R.call(this,{url:u,resolve:n,reject:P,submorph:c})})}catch(n){n?console.error(n):console.log("Route change canceled"),A=!1}if(!A||t(this,K).pathname!==u.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}const w={url:u,submorph:c};c?v||c.forEach(n=>{document.querySelectorAll(n).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,rt).forEach(n=>{var P,R;(P=n.firstElementChild)==null||P.classList.add("out"),(R=n.firstElementChild)==null||R.setAttribute("data-morph-out","")}),q.dispatchEvent(document,"morphNavigation",{detail:w});const xt=g(this,m,Mt).call(this,t(this,f).pathname),L=g(this,m,Mt).call(this,u.pathname);if(t(this,V).forEach(n=>{n.pathname!==u.pathname&&n.abort()}),yield L==null?void 0:L.fetch(Pt,t(this,f).path,p),t(this,K).pathname!==u.pathname){t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)});return}xt.clearState(),xt.saveScrollState(),xt.saveDocumentState(),(!t(this,$)||p)&&(L.clearScrollState(),L.clearDocumentState()),D&&L.clearState(),L.cloneDocument(),t(this,tt).textContent=L.title,document.body.appendChild(t(this,tt));const At=Dt(Rt({},w),{document:L.document});v||At.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),q.dispatchEvent(document,"morphStart",{detail:At});const Yt=Array.from(document.head.children),$t=Array.from(L.document.head.children),jt=g(this,m,ne).call(this,Yt,$t),oe=g(this,m,Ft).call(this,Yt,jt),kt=g(this,m,Ft).call(this,$t,jt).filter(n=>!this.excludeHeadChild(n));kt.forEach((n,P)=>{n.tagName==="SCRIPT"&&(kt[P]=g(this,m,Ot).call(this,n))}),kt.forEach(n=>{document.head.appendChild(n)});const Ut=kt.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(g(this,m,Bt).call(this,n))return!0});t(this,N).waitForHeadToLoad&&Ut.length&&(yield new Promise(n=>G(this,null,function*(){let P=0;try{for(var R=te(Ut),le,W,x;le=!(W=yield R.next()).done;le=!1){const Ct=W.value;Ct.onload=()=>{P++,P===Ut.length&&n()}}}catch(W){x=[W]}finally{try{le&&(W=R.return)&&(yield W.call(R))}finally{if(x)throw x[0]}}}))),yield ee.wait(10);const Gt=[];v||oe.forEach(n=>{n.hasAttribute("data-permanent")||(g(this,m,Bt).call(this,n)?Gt.push(n):n.remove())});const he=g(this,m,Wt).call(this,L.document.body);!t(this,N).morphInsideScrollContainer&&!c&&g(this,m,Xt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),dt.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(E?location.search:""),hash:u.hash}),t(this,tt).remove(),r(this,_,t(this,f)),r(this,f,u);const Nt=[];t(this,rt).forEach((n,P)=>{const R=he[P],le=getComputedStyle(n).getPropertyValue("--morph-duration");let W=[],x=[];c?(c.forEach(d=>{const b=n.querySelector(d),F=R.querySelector(d);b&&F&&(x.push(b),W.push(F))}),x.forEach(d=>{d.parentElement&&Nt.push(d.parentElement)})):(W.push(...R.childNodes),x.push(...n.childNodes),Nt.push(n)),v||x.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),W.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),c?v?W.forEach((d,b)=>{x[b]instanceof HTMLElement&&x[b].append(...d.childNodes)}):W.forEach((d,b)=>{var F;(F=x[b].parentElement)==null||F.insertBefore(d,x[b])}):n.prepend(...W),setTimeout(()=>{v||x.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),W.forEach(d=>{var b;d instanceof HTMLElement&&((b=d.parentElement)==null||b.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})},0);const Ct=Dt(Rt({},At),{morphElement:n});q.dispatchEvent(document,"morphNewChildrenAdded",{detail:Ct});const ce=new Promise(d=>{setTimeout(()=>{v||x.forEach(b=>b.remove()),W.forEach(b=>{var F;b instanceof HTMLElement&&((F=b.parentElement)==null||F.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),v||q.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Ct}),d()},(parseFloat(le)||0)*1e3+10)});t(this,Y).push(ce)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-L.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),q.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),u.hash?(L.clearScrollState(),g(this,m,Kt).call(this,u.hash,{centerScroll:i,offsetScroll:l,behavior:S})):t(this,$)?L.restoreScrollPosition():ut||L.renewScrollPosition(),yield Promise.all(t(this,Y)),v||Gt.forEach(n=>n.remove()),r(this,Y,[]),Nt.forEach(n=>{n.querySelectorAll("script").forEach(R=>{R.replaceWith(g(this,m,Ot).call(this,R))})}),t(this,y).forEach(n=>{n.checkCurrent(t(this,f).path)}),this.findParamsDependent(),q.dispatchEvent(document,"morphComplete",{detail:At}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(A){console.error(A)}r(this,K,void 0)})}addLink(e){t(this,y).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){r(this,y,t(this,y).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){r(this,y,t(this,y).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,yt));t(this,y).push(...s.map(i=>new It(i,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,yt));t(this,y).forEach(s=>s.destroy()),r(this,y,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,St).forEach(s=>s.destroy()),r(this,St,e.map(s=>new Se(s)))}};N=new WeakMap,rt=new WeakMap,y=new WeakMap,K=new WeakMap,f=new WeakMap,_=new WeakMap,Y=new WeakMap,$=new WeakMap,M=new WeakMap,vt=new WeakMap,V=new WeakMap,St=new WeakMap,tt=new WeakMap,ot=new WeakMap,ht=new WeakMap,Lt=new WeakMap,lt=new WeakMap,bt=new WeakMap,m=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let i=0;i<e.attributes.length;i++){const l=e.attributes[i];s.setAttribute(l.name,l.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},yt=new WeakMap,Mt=function(e){const s=this.normalizePath(e);let i=t(this,V).get(s.pathname);return i||(i=new se(this,s.pathname),t(this,V).set(s.pathname,i)),i},Wt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ne=function(e,s){return e.filter(i=>s.find(l=>l.outerHTML===i.outerHTML))},Ft=function(e,s){return e.filter(i=>!s.find(l=>l.outerHTML===i.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,i;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,ct)),r(this,ht,0),r(this,ot,0),r(this,M,t(this,N).scrollSelector&&e.querySelector(t(this,N).scrollSelector)||window),r(this,vt,t(this,M)===window),(i=t(this,M))==null||i.addEventListener("scroll",t(this,ct)),t(this,ct).call(this)},Kt=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&ee.scrollToElement(i,{scrollElement:t(this,M),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ct=new WeakMap,mt.instance=null;let Vt=mt;exports.Morph=Vt;
|
|
1
|
+
"use strict";var ue=Object.defineProperty,de=Object.defineProperties;var me=Object.getOwnPropertyDescriptors;var Jt=Object.getOwnPropertySymbols;var fe=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var Qt=(h,e)=>(e=Symbol[h])?e:Symbol.for("Symbol."+h),_t=h=>{throw TypeError(h)};var Zt=(h,e,s)=>e in h?ue(h,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):h[e]=s,Rt=(h,e)=>{for(var s in e||(e={}))fe.call(e,s)&&Zt(h,s,e[s]);if(Jt)for(var s of Jt(e))pe.call(e,s)&&Zt(h,s,e[s]);return h},Dt=(h,e)=>de(h,me(e));var qt=(h,e,s)=>e.has(h)||_t("Cannot "+s);var t=(h,e,s)=>(qt(h,e,"read from private field"),s?s.call(h):e.get(h)),l=(h,e,s)=>e.has(h)?_t("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(h):e.set(h,s),o=(h,e,s,i)=>(qt(h,e,"write to private field"),i?i.call(h,s):e.set(h,s),s),E=(h,e,s)=>(qt(h,e,"access private method"),s);var G=(h,e,s)=>new Promise((i,n)=>{var S=c=>{try{g(s.next(c))}catch(v){n(v)}},p=c=>{try{g(s.throw(c))}catch(v){n(v)}},g=c=>c.done?i(c.value):Promise.resolve(c.value).then(S,p);g((s=s.apply(h,e)).next())});var te=(h,e,s)=>(e=h[Qt("asyncIterator")])?e.call(h):(h=h[Qt("iterator")](),e={},s=(i,n)=>(n=h[i])&&(e[i]=S=>new Promise((p,g,c)=>(S=n.call(h,S),c=S.done,Promise.resolve(S.value).then(v=>p({value:v,done:c}),g)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("../index-DekP7OZe.cjs"),q=require("../events-KVanG9sR.cjs"),ee=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const dt=require("../url-Dns-01WU.cjs"),ge=require("../css-value-parser/index.cjs"),Ee=require("../string-DUXXtU8v.cjs");class ae extends HTMLElement{connectedCallback(){const e={"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(e))this.setAttribute(s,i)}}ie.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",ae);var H,a,U,st,Ht,ft,it;class It{constructor(e,s){l(this,st);l(this,H);l(this,a);l(this,U);l(this,ft,e=>{var i;if(e.preventDefault(),document.documentElement.classList.contains("click-disabled"))return;if(t(this,a).hasAttribute("data-back")&&t(this,H).previousURL)history.back();else{o(this,U,t(this,a).getAttribute("href")||"/");const n=t(this,a).getAttribute("data-history-action")||"push",S=t(this,a).hasAttribute("data-center-scroll"),p=getComputedStyle(t(this,a)).getPropertyValue("--offset-scroll").trim(),g=p?ge.cssValueParser.parse(p):void 0,c=t(this,a).hasAttribute("data-revalidate")||t(this,a).hasAttribute("data-pagination-more-link")||t(this,a).hasAttribute("data-pagination-set-link"),v=t(this,a).hasAttribute("data-keep-search-parameters"),D=t(this,a).hasAttribute("data-keep-scroll-position")||t(this,a).hasAttribute("data-pagination-more-link"),ut=t(this,a).getAttribute("data-scroll-behaviour"),et=E(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));et&&(t(this,a).hasAttribute("data-pagination-set-link")?t(this,H).links.forEach(T=>{T.updatePagination(parseInt(t(this,a).getAttribute("data-value")||"1"),et.selector)}):t(this,a).hasAttribute("data-pagination-more-link")&&t(this,H).links.forEach(T=>{T.updatePagination(et.currentPage+1,et.selector)}));const re=((i=t(this,a).getAttribute("data-submorph"))==null?void 0:i.split(",").map(T=>T.trim()))||t(this,a).hasAttribute("data-pagination-more-link")&&[t(this,a).getAttribute("data-pagination-more-link")]||t(this,a).hasAttribute("data-pagination-set-link")&&[t(this,a).getAttribute("data-pagination-set-link")]||void 0,Pt=t(this,a).hasAttribute("data-clear-state");let u=t(this,U);if(t(this,a).hasAttribute("data-toggle-params")){const[T,wt]=t(this,U).split("?"),j=new URLSearchParams(wt),O=new URLSearchParams(location.search),A=new URLSearchParams;for(const[w]of j)(!O.has(w)||O.has(w)&&O.get(w)!==j.get(w))&&A.append(w,j.get(w));if(t(this,a).hasAttribute("data-merge-params"))for(const[w]of O)j.has(w)||A.append(w,O.get(w));u=`${T}?${A.toString()}`}t(this,H).navigate(u,{historyAction:n,centerScroll:S,offsetScroll:g,revalidate:c,keepSearchParameters:v,submorph:re,clearState:Pt,keepScrollPosition:D,scrollBehaviour:ut,submorphAppend:t(this,a).hasAttribute("data-pagination-more-link"),mergeParams:t(this,a).hasAttribute("data-merge-params")&&!t(this,a).hasAttribute("data-toggle-params")})}});l(this,it,()=>{const e=t(this,a).hasAttribute("data-revalidate");t(this,H).prefetch(t(this,U),e),t(this,a).removeEventListener("pointerenter",t(this,it))});o(this,H,s),o(this,a,e),t(this,a).addEventListener("click",t(this,ft)),o(this,U,t(this,a).getAttribute("href")||"/"),this.checkCurrent(location.href.replace(location.origin,""));const i=E(this,st,Ht).call(this,t(this,a).getAttribute("data-pagination-set-link")||t(this,a).getAttribute("data-pagination-more-link"));i&&this.updatePagination(i.currentPage,i.selector),t(this,a).hasAttribute("data-prefetch")&&t(this,a).addEventListener("pointerenter",t(this,it))}get element(){return t(this,a)}checkCurrent(e){var v;const s=t(this,H).normalizePath(e),i=t(this,H).normalizePath(t(this,U));t(this,a).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?t(this,a).classList.add("current"):i.pathname===s.pathname?t(this,a).classList.add("current"):(v=t(this,a).getAttribute("data-associated-paths"))!=null&&v.split(",").find(D=>s.pathname.includes(D))?t(this,a).classList.add("current"):t(this,a).classList.remove("current"),s.path===i.path?t(this,a).classList.add("exact"):t(this,a).classList.remove("exact");const[n,S]=t(this,U).split("?"),p=new URLSearchParams(S),g=new URLSearchParams(location.search);let c=0;for(const[D]of g)p.has(D)&&g.get(D)===p.get(D)&&c++;c?(t(this,a).classList.toggle("all-params-matched",g.size===c),t(this,a).classList.toggle("some-params-matched",g.size!==c)):!g.size&&t(this,a).hasAttribute("data-match-no-params")?t(this,a).classList.add("all-params-matched"):(t(this,a).classList.remove("all-params-matched"),t(this,a).classList.remove("some-params-matched"))}updatePagination(e,s){const i=E(this,st,Ht).call(this,s);if(i)if(i.element.setAttribute("data-current-page",e.toString()),t(this,a).hasAttribute("data-pagination-more-link"))if(e<i.totalPages){t(this,a).style.display="";const n=t(this,a).querySelector("[data-pagination-more-link-counter]");n&&(n.textContent=(i.totalPages-e).toString());const S=t(this,a).getAttribute("href"),p=new URL(S,window.location.origin);p.searchParams.set("page",(e+1).toString());const g=p.href.replace(p.origin,"").toString();t(this,a).setAttribute("href",g),this.checkCurrent(g)}else t(this,a).style.display="none";else t(this,a).hasAttribute("data-pagination-set-link")&&(t(this,a).getAttribute("data-value")===e.toString()?t(this,a).classList.add("pagination-current"):t(this,a).classList.remove("pagination-current"))}destroy(){t(this,a).removeEventListener("click",t(this,ft)),t(this,a).removeEventListener("pointerenter",t(this,it)),t(this,a).classList.remove("current","exact","pagination-current")}}H=new WeakMap,a=new WeakMap,U=new WeakMap,st=new WeakSet,Ht=function(e){if(!e)return;const s=document.querySelector(e);if(s){const i=parseInt(s.getAttribute("data-current-page")||"1"),n=parseInt(s.getAttribute("data-total-pages")||"1");return{element:s,currentPage:i,totalPages:n,selector:e}}},ft=new WeakMap,it=new WeakMap;const ve=new DOMParser;var I,J,k,z,Q,B,at,Z,X,pt;class se{constructor(e,s){l(this,I);l(this,J);l(this,k,{x:0,y:0});l(this,z,null);l(this,Q,null);l(this,B,null);l(this,at,null);l(this,Z,null);l(this,X,null);l(this,pt);o(this,I,e),o(this,J,s)}get pathname(){return t(this,J)}get scrollState(){return t(this,k)}get document(){return t(this,B)}setHeaders(e){o(this,pt,e)}setInitialDocument(e){o(this,z,e.cloneNode(!0))}abort(){var e;return(e=t(this,Z))==null?void 0:e.abort(`[${t(this,J)}] page loading cancelled`)}fetch(e,s,i){return G(this,null,function*(){var n;if(!i){const g=((n=t(this,z))==null?void 0:n.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,z)&&t(this,I).isPopstateNavigation;if(t(this,X)||g||c)return t(this,X)}return o(this,X,new Promise(S=>G(this,null,function*(){try{o(this,Z,new AbortController);const g=yield(yield fetch(e,{signal:t(this,Z).signal,headers:Rt({"X-MORPH":"true","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,pt))})).text(),c=ve.parseFromString(g,"text/html");this.setInitialDocument(c)}catch(p){console.warn(p)}finally{o(this,Z,null),o(this,X,null),S()}}))),t(this,X)})}cloneDocument(){o(this,B,(t(this,Q)||t(this,z)).cloneNode(!0))}get title(){let e="";if(t(this,B).title)e=t(this,B).title;else{const s=t(this,B).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,J)}return e}clearScrollState(){t(this,k).x=0,t(this,k).y=0}clearDocumentState(){o(this,Q,null)}saveScrollState(){t(this,z).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,k).x=0,t(this,k).y=0):(t(this,k).x=t(this,I).scrollValue.left,t(this,k).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,k).y,left:t(this,k).x,behavior:"instant"})}saveDocumentState(){t(this,z).documentElement.hasAttribute("data-no-page-restoration")?o(this,Q,null):o(this,Q,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){o(this,at,e)}clearState(){const e=t(this,at);return o(this,at,null),e}}I=new WeakMap,J=new WeakMap,k=new WeakMap,z=new WeakMap,Q=new WeakMap,B=new WeakMap,at=new WeakMap,Z=new WeakMap,X=new WeakMap,pt=new WeakMap;var C,nt,gt,zt,Et;class Se{constructor(e){l(this,gt);l(this,C);l(this,nt,[]);l(this,Et,()=>{E(this,gt,zt).call(this)});o(this,C,e);for(const s in t(this,C).dataset){const i=Ee.camelToKebab(s);if(i.startsWith("param-")){const n=i.split("param-")[1],S=t(this,C).dataset[s];t(this,nt).push({name:n,value:S})}}document.addEventListener("morphURLParametersChange",t(this,Et)),E(this,gt,zt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,Et))}}C=new WeakMap,nt=new WeakMap,gt=new WeakSet,zt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,nt).find(n=>e.has(n.name)&&(e.get(n.name)===n.value||n.value==="*"||n.value==="all"||n.value==="any"||n.value==="vse"||e.get(n.name)==="*"||e.get(n.name)==="all"||e.get(n.name)==="any"||e.get(n.name)==="vse"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,nt).filter(n=>e.has(n.name)).length);const i=t(this,C).getAttribute("data-hide-class");s?i?t(this,C).classList.remove(i):t(this,C).style.display="":i?t(this,C).classList.add(i):t(this,C).style.display="none"},Et=new WeakMap;var N,rt,y,K,f,_,Y,$,M,vt,V,St,tt,ot,ht,Lt,lt,bt,m,Ot,yt,Mt,Wt,ne,Ft,Bt,Xt,Kt,Tt,ct;const mt=class mt{constructor(e){l(this,m);l(this,N,null);l(this,rt,null);l(this,y,[]);l(this,K);l(this,f,null);l(this,_);l(this,Y,[]);l(this,$,!1);l(this,M,null);l(this,vt,!1);l(this,V,new Map);l(this,St,[]);l(this,tt,null);l(this,ot,0);l(this,ht,0);l(this,Lt);l(this,lt);l(this,bt);l(this,yt,e=>{var s;return((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});l(this,Tt,e=>G(this,null,function*(){e.preventDefault(),o(this,$,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,lt)?void 0:t(this,Lt),revalidate:t(this,lt),keepScrollPosition:t(this,bt)}),o(this,$,!1)}));l(this,ct,()=>{const{left:e,top:s}=this.scrollValue,i=s-t(this,ht),n=e-t(this,ot);o(this,ht,s),o(this,ot,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",i>0),document.documentElement.classList.toggle("scroll-y-backward",i<0),document.documentElement.classList.toggle("scroll-x-forward",n>0),document.documentElement.classList.toggle("scroll-x-backward",n<0),q.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(ie.isBrowser&&!mt.instance){mt.instance=this,o(this,N,{base:dt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),o(this,rt,E(this,m,Wt).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);o(this,f,s);const i=new se(this,t(this,f).pathname);i.setInitialDocument(document),t(this,V).set(t(this,f).pathname,i),document.documentElement.setAttribute("data-current-pathname",t(this,f).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Tt)),dt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),o(this,tt,new ae),E(this,m,Xt).call(this,document)}}get currentURL(){return t(this,f)}get previousURL(){return t(this,_)}get links(){return t(this,y)}get scrollElement(){return t(this,M)}get isPopstateNavigation(){return t(this,$)}get scrollValue(){let e=0,s=0;return t(this,vt)?(e=window.scrollY,s=window.scrollX):(e=t(this,M).scrollTop,s=t(this,M).scrollLeft),{top:e,left:s}}saveState(e){const s=t(this,V).get(t(this,f).path);s&&s.saveState(e)}getState(){const e=t(this,V).get(t(this,f).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return dt.splitPath(e,{base:t(this,N).base,trailingSlash:t(this,N).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:""})}prefetch(e,s){return G(this,null,function*(){var n;if(t(this,Y).length)return;e=((n=this.pathnameModifier)==null?void 0:n.call(this,e))||e;const i=E(this,m,Mt).call(this,e);i==null||i.fetch(e,t(this,f).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}navigate(re){return G(this,arguments,function*(e,{historyAction:s="push",centerScroll:i,offsetScroll:n,scrollBehaviour:S,revalidate:p,keepSearchParameters:g,submorph:c,submorphAppend:v,clearState:D,keepScrollPosition:ut,mergeParams:et}={}){var T,wt,j,O;if(t(this,Y).length)return;o(this,Lt,c),o(this,lt,p),o(this,bt,ut);const Pt=((T=this.pathnameModifier)==null?void 0:T.call(this,e))||e,u=this.normalizePath(Pt,{mergeParams:et});if(!p&&(((wt=t(this,K))==null?void 0:wt.pathname)===u.pathname||t(this,f).pathname===u.pathname)){ut||E(this,m,Kt).call(this,u.hash||0,{centerScroll:i,offsetScroll:n,behavior:"smooth"}),q.dispatchEvent(document,"morphSamePath",{custom:!0}),((j=t(this,f))==null?void 0:j.parameters)!==u.parameters&&(o(this,_,t(this,f)),o(this,f,u),dt.changeHistory({action:((O=t(this,f))==null?void 0:O.hash)!==u.hash?"replace":s,pathname:u.pathname,searchParameters:u.parameters,hash:u.hash}),q.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,f),previousURL:t(this,_)}})),t(this,y).forEach(A=>{A.checkCurrent(u.path)});return}else t(this,y).forEach(A=>{A.checkCurrent(u.path)});o(this,K,u);try{let A=!0;if(this.preprocessor)try{yield new Promise((r,P)=>{var R;(R=this.preprocessor)==null||R.call(this,{url:u,resolve:r,reject:P,submorph:c})})}catch(r){r?console.error(r):console.log("Route change canceled"),A=!1}if(!A||t(this,K).pathname!==u.pathname){t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)});return}const w={url:u,submorph:c};c?v||c.forEach(r=>{document.querySelectorAll(r).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,rt).forEach(r=>{var P,R;(P=r.firstElementChild)==null||P.classList.add("out"),(R=r.firstElementChild)==null||R.setAttribute("data-morph-out","")}),q.dispatchEvent(document,"morphNavigation",{detail:w});const xt=E(this,m,Mt).call(this,t(this,f).pathname),L=E(this,m,Mt).call(this,u.pathname);if(t(this,V).forEach(r=>{r.pathname!==u.pathname&&r.abort()}),yield L==null?void 0:L.fetch(Pt,t(this,f).path,p),t(this,K).pathname!==u.pathname){t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)});return}xt.clearState(),xt.saveScrollState(),xt.saveDocumentState(),(!t(this,$)||p)&&(L.clearScrollState(),L.clearDocumentState()),D&&L.clearState(),L.cloneDocument(),t(this,tt).textContent=L.title,document.body.appendChild(t(this,tt));const At=Dt(Rt({},w),{document:L.document});v||At.document.querySelectorAll("[data-morph-out]").forEach(r=>{r.classList.remove("out")}),q.dispatchEvent(document,"morphStart",{detail:At});const Yt=Array.from(document.head.children),$t=Array.from(L.document.head.children),jt=E(this,m,ne).call(this,Yt,$t),oe=E(this,m,Ft).call(this,Yt,jt),kt=E(this,m,Ft).call(this,$t,jt).filter(r=>!this.excludeHeadChild(r));kt.forEach((r,P)=>{r.tagName==="SCRIPT"&&(kt[P]=E(this,m,Ot).call(this,r))}),kt.forEach(r=>{document.head.appendChild(r)});const Ut=kt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(E(this,m,Bt).call(this,r))return!0});t(this,N).waitForHeadToLoad&&Ut.length&&(yield new Promise(r=>G(this,null,function*(){let P=0;try{for(var R=te(Ut),le,W,x;le=!(W=yield R.next()).done;le=!1){const Ct=W.value;Ct.onload=()=>{P++,P===Ut.length&&r()}}}catch(W){x=[W]}finally{try{le&&(W=R.return)&&(yield W.call(R))}finally{if(x)throw x[0]}}}))),yield ee.wait(10);const Gt=[];v||oe.forEach(r=>{r.hasAttribute("data-permanent")||(E(this,m,Bt).call(this,r)?Gt.push(r):r.remove())});const he=E(this,m,Wt).call(this,L.document.body);!t(this,N).morphInsideScrollContainer&&!c&&E(this,m,Xt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",u.pathname),document.documentElement.setAttribute("data-current-leaf",u.leaf),dt.changeHistory({action:s,pathname:u.pathname,searchParameters:u.parameters||(g?location.search:""),hash:u.hash}),t(this,tt).remove(),o(this,_,t(this,f)),o(this,f,u);const Nt=[];t(this,rt).forEach((r,P)=>{const R=he[P],le=getComputedStyle(r).getPropertyValue("--morph-duration");let W=[],x=[];c?(c.forEach(d=>{const b=r.querySelector(d),F=R.querySelector(d);b&&F&&(x.push(b),W.push(F))}),x.forEach(d=>{d.parentElement&&Nt.push(d.parentElement)})):(W.push(...R.childNodes),x.push(...r.childNodes),Nt.push(r)),v||x.forEach(d=>{d instanceof HTMLElement&&(this.destroyOldLinks(d),d.classList.add("old"))}),W.forEach(d=>{d instanceof HTMLElement&&(this.findNewLinks(d),d.classList.add("new"))}),c?v?W.forEach((d,b)=>{x[b]instanceof HTMLElement&&x[b].append(...d.childNodes)}):W.forEach((d,b)=>{var F;(F=x[b].parentElement)==null||F.insertBefore(d,x[b])}):r.prepend(...W),setTimeout(()=>{v||x.forEach(d=>{d instanceof HTMLElement&&d.classList.add("old-idle")}),W.forEach(d=>{var b;d instanceof HTMLElement&&((b=d.parentElement)==null||b.style.setProperty("--new-content-height",d.offsetHeight+"px"),d.classList.add("new-idle"))})},0);const Ct=Dt(Rt({},At),{morphElement:r});q.dispatchEvent(document,"morphNewChildrenAdded",{detail:Ct});const ce=new Promise(d=>{setTimeout(()=>{v||x.forEach(b=>b.remove()),W.forEach(b=>{var F;b instanceof HTMLElement&&((F=b.parentElement)==null||F.style.removeProperty("--new-content-height"),b.classList.remove("new-idle","new"))}),v||q.dispatchEvent(document,"morphOldChildrenRemoved",{detail:Ct}),d()},(parseFloat(le)||0)*1e3+10)});t(this,Y).push(ce)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-L.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),q.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),u.hash?(L.clearScrollState(),E(this,m,Kt).call(this,u.hash,{centerScroll:i,offsetScroll:n,behavior:S})):t(this,$)?L.restoreScrollPosition():ut||L.renewScrollPosition(),yield Promise.all(t(this,Y)),v||Gt.forEach(r=>r.remove()),o(this,Y,[]),Nt.forEach(r=>{r.querySelectorAll("script").forEach(R=>{R.replaceWith(E(this,m,Ot).call(this,R))})}),t(this,y).forEach(r=>{r.checkCurrent(t(this,f).path)}),this.findParamsDependent(),q.dispatchEvent(document,"morphComplete",{detail:At}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(A){console.error(A)}o(this,K,void 0)})}addLink(e){t(this,y).push(new It(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){o(this,y,t(this,y).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){o(this,y,t(this,y).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,yt));t(this,y).push(...s.map(i=>new It(i,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,yt));t(this,y).forEach(s=>s.destroy()),o(this,y,e.map(s=>new It(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,St).forEach(s=>s.destroy()),o(this,St,e.map(s=>new Se(s)))}};N=new WeakMap,rt=new WeakMap,y=new WeakMap,K=new WeakMap,f=new WeakMap,_=new WeakMap,Y=new WeakMap,$=new WeakMap,M=new WeakMap,vt=new WeakMap,V=new WeakMap,St=new WeakMap,tt=new WeakMap,ot=new WeakMap,ht=new WeakMap,Lt=new WeakMap,lt=new WeakMap,bt=new WeakMap,m=new WeakSet,Ot=function(e){const s=document.createElement("script");for(let i=0;i<e.attributes.length;i++){const n=e.attributes[i];s.setAttribute(n.name,n.value)}return e.hasAttribute("src")||(s.innerHTML=e.innerHTML),s},yt=new WeakMap,Mt=function(e){const s=this.normalizePath(e);let i=t(this,V).get(s.pathname);return i||(i=new se(this,s.pathname),t(this,V).set(s.pathname,i)),i},Wt=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},ne=function(e,s){return e.filter(i=>s.find(n=>n.outerHTML===i.outerHTML))},Ft=function(e,s){return e.filter(i=>!s.find(n=>n.outerHTML===i.outerHTML))},Bt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Xt=function(e){var s,i;(s=t(this,M))==null||s.removeEventListener("scroll",t(this,ct)),o(this,ht,0),o(this,ot,0),o(this,M,t(this,N).scrollSelector&&e.querySelector(t(this,N).scrollSelector)||window),o(this,vt,t(this,M)===window),(i=t(this,M))==null||i.addEventListener("scroll",t(this,ct)),t(this,ct).call(this)},Kt=function(e,s){const i=typeof e=="string"?document.getElementById(e):e;(typeof i=="number"||i)&&ee.scrollToElement(i,{scrollElement:t(this,M),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Tt=new WeakMap,ct=new WeakMap,mt.instance=null;let Vt=mt;exports.Morph=Vt;
|
package/lib/morph/index.js
CHANGED
|
@@ -2,36 +2,36 @@ var ce = Object.defineProperty, de = Object.defineProperties;
|
|
|
2
2
|
var ue = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Gt = Object.getOwnPropertySymbols;
|
|
4
4
|
var me = Object.prototype.hasOwnProperty, fe = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var Jt = (
|
|
6
|
-
throw TypeError(
|
|
5
|
+
var Jt = (h, e) => (e = Symbol[h]) ? e : Symbol.for("Symbol." + h), Zt = (h) => {
|
|
6
|
+
throw TypeError(h);
|
|
7
7
|
};
|
|
8
|
-
var Qt = (
|
|
8
|
+
var Qt = (h, e, s) => e in h ? ce(h, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : h[e] = s, Ct = (h, e) => {
|
|
9
9
|
for (var s in e || (e = {}))
|
|
10
|
-
me.call(e, s) && Qt(
|
|
10
|
+
me.call(e, s) && Qt(h, s, e[s]);
|
|
11
11
|
if (Gt)
|
|
12
12
|
for (var s of Gt(e))
|
|
13
|
-
fe.call(e, s) && Qt(
|
|
14
|
-
return
|
|
15
|
-
}, Nt = (
|
|
16
|
-
var Dt = (
|
|
17
|
-
var t = (
|
|
18
|
-
var G = (
|
|
13
|
+
fe.call(e, s) && Qt(h, s, e[s]);
|
|
14
|
+
return h;
|
|
15
|
+
}, Nt = (h, e) => de(h, ue(e));
|
|
16
|
+
var Dt = (h, e, s) => e.has(h) || Zt("Cannot " + s);
|
|
17
|
+
var t = (h, e, s) => (Dt(h, e, "read from private field"), s ? s.call(h) : e.get(h)), l = (h, e, s) => e.has(h) ? Zt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(h) : e.set(h, s), o = (h, e, s, i) => (Dt(h, e, "write to private field"), i ? i.call(h, s) : e.set(h, s), s), E = (h, e, s) => (Dt(h, e, "access private method"), s);
|
|
18
|
+
var G = (h, e, s) => new Promise((i, n) => {
|
|
19
19
|
var S = (c) => {
|
|
20
20
|
try {
|
|
21
|
-
|
|
21
|
+
g(s.next(c));
|
|
22
22
|
} catch (L) {
|
|
23
|
-
|
|
23
|
+
n(L);
|
|
24
24
|
}
|
|
25
25
|
}, p = (c) => {
|
|
26
26
|
try {
|
|
27
|
-
|
|
27
|
+
g(s.throw(c));
|
|
28
28
|
} catch (L) {
|
|
29
|
-
|
|
29
|
+
n(L);
|
|
30
30
|
}
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
}, g = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(S, p);
|
|
32
|
+
g((s = s.apply(h, e)).next());
|
|
33
33
|
});
|
|
34
|
-
var _t = (
|
|
34
|
+
var _t = (h, e, s) => (e = h[Jt("asyncIterator")]) ? e.call(h) : (h = h[Jt("iterator")](), e = {}, s = (i, n) => (n = h[i]) && (e[i] = (S) => new Promise((p, g, c) => (S = n.call(h, S), c = S.done, Promise.resolve(S.value).then((L) => p({ value: L, done: c }), g)))), s("next"), s("return"), e);
|
|
35
35
|
import { i as se } from "../index-Bv9zgfdb.js";
|
|
36
36
|
import { d as I } from "../events-CsVF98U6.js";
|
|
37
37
|
import { w as pe, s as ge } from "../scroll-DNGJVxa2.js";
|
|
@@ -52,27 +52,27 @@ class ie extends HTMLElement {
|
|
|
52
52
|
}
|
|
53
53
|
se && !customElements.get("morph-announcer") && customElements.define("morph-announcer", ie);
|
|
54
54
|
var H, a, U, st, Rt, mt, it;
|
|
55
|
-
class
|
|
55
|
+
class zt {
|
|
56
56
|
constructor(e, s) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
l(this, st);
|
|
58
|
+
l(this, H);
|
|
59
|
+
l(this, a);
|
|
60
|
+
l(this, U);
|
|
61
|
+
l(this, mt, (e) => {
|
|
62
62
|
var i;
|
|
63
63
|
if (e.preventDefault(), document.documentElement.classList.contains("click-disabled"))
|
|
64
64
|
return;
|
|
65
65
|
if (t(this, a).hasAttribute("data-back") && t(this, H).previousURL)
|
|
66
66
|
history.back();
|
|
67
67
|
else {
|
|
68
|
-
|
|
69
|
-
const
|
|
68
|
+
o(this, U, t(this, a).getAttribute("href") || "/");
|
|
69
|
+
const n = t(this, a).getAttribute(
|
|
70
70
|
"data-history-action"
|
|
71
|
-
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), p = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(),
|
|
71
|
+
) || "push", S = t(this, a).hasAttribute("data-center-scroll"), p = getComputedStyle(t(this, a)).getPropertyValue("--offset-scroll").trim(), g = p ? Se.parse(p) : void 0, c = t(this, a).hasAttribute("data-revalidate") || t(this, a).hasAttribute("data-pagination-more-link") || t(this, a).hasAttribute("data-pagination-set-link"), L = t(this, a).hasAttribute(
|
|
72
72
|
"data-keep-search-parameters"
|
|
73
73
|
), D = t(this, a).hasAttribute("data-keep-scroll-position") || t(this, a).hasAttribute("data-pagination-more-link"), dt = t(this, a).getAttribute(
|
|
74
74
|
"data-scroll-behaviour"
|
|
75
|
-
), et =
|
|
75
|
+
), et = E(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
|
|
76
76
|
et && (t(this, a).hasAttribute("data-pagination-set-link") ? t(this, H).links.forEach((M) => {
|
|
77
77
|
M.updatePagination(
|
|
78
78
|
parseInt(t(this, a).getAttribute("data-value") || "1"),
|
|
@@ -100,9 +100,9 @@ class qt {
|
|
|
100
100
|
d = `${M}?${A.toString()}`;
|
|
101
101
|
}
|
|
102
102
|
t(this, H).navigate(d, {
|
|
103
|
-
historyAction:
|
|
103
|
+
historyAction: n,
|
|
104
104
|
centerScroll: S,
|
|
105
|
-
offsetScroll:
|
|
105
|
+
offsetScroll: g,
|
|
106
106
|
revalidate: c,
|
|
107
107
|
keepSearchParameters: L,
|
|
108
108
|
submorph: ne,
|
|
@@ -114,12 +114,12 @@ class qt {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
});
|
|
117
|
-
|
|
117
|
+
l(this, it, () => {
|
|
118
118
|
const e = t(this, a).hasAttribute("data-revalidate");
|
|
119
119
|
t(this, H).prefetch(t(this, U), e), t(this, a).removeEventListener("pointerenter", t(this, it));
|
|
120
120
|
});
|
|
121
|
-
|
|
122
|
-
const i =
|
|
121
|
+
o(this, H, s), o(this, a, e), t(this, a).addEventListener("click", t(this, mt)), o(this, U, t(this, a).getAttribute("href") || "/"), this.checkCurrent(location.href.replace(location.origin, ""));
|
|
122
|
+
const i = E(this, st, Rt).call(this, t(this, a).getAttribute("data-pagination-set-link") || t(this, a).getAttribute("data-pagination-more-link"));
|
|
123
123
|
i && this.updatePagination(
|
|
124
124
|
i.currentPage,
|
|
125
125
|
i.selector
|
|
@@ -132,20 +132,20 @@ class qt {
|
|
|
132
132
|
var L;
|
|
133
133
|
const s = t(this, H).normalizePath(e), i = t(this, H).normalizePath(t(this, U));
|
|
134
134
|
t(this, a).hasAttribute("data-include") && s.pathname.includes(i.pathname) ? t(this, a).classList.add("current") : i.pathname === s.pathname ? t(this, a).classList.add("current") : (L = t(this, a).getAttribute("data-associated-paths")) != null && L.split(",").find((D) => s.pathname.includes(D)) ? t(this, a).classList.add("current") : t(this, a).classList.remove("current"), s.path === i.path ? t(this, a).classList.add("exact") : t(this, a).classList.remove("exact");
|
|
135
|
-
const [
|
|
135
|
+
const [n, S] = t(this, U).split("?"), p = new URLSearchParams(S), g = new URLSearchParams(location.search);
|
|
136
136
|
let c = 0;
|
|
137
|
-
for (const [D] of
|
|
138
|
-
p.has(D) &&
|
|
137
|
+
for (const [D] of g)
|
|
138
|
+
p.has(D) && g.get(D) === p.get(D) && c++;
|
|
139
139
|
c ? (t(this, a).classList.toggle(
|
|
140
140
|
"all-params-matched",
|
|
141
|
-
|
|
141
|
+
g.size === c
|
|
142
142
|
), t(this, a).classList.toggle(
|
|
143
143
|
"some-params-matched",
|
|
144
|
-
|
|
145
|
-
)) : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
|
|
144
|
+
g.size !== c
|
|
145
|
+
)) : !g.size && t(this, a).hasAttribute("data-match-no-params") ? t(this, a).classList.add("all-params-matched") : (t(this, a).classList.remove("all-params-matched"), t(this, a).classList.remove("some-params-matched"));
|
|
146
146
|
}
|
|
147
147
|
updatePagination(e, s) {
|
|
148
|
-
const i =
|
|
148
|
+
const i = E(this, st, Rt).call(this, s);
|
|
149
149
|
if (i)
|
|
150
150
|
if (i.element.setAttribute(
|
|
151
151
|
"data-current-page",
|
|
@@ -153,14 +153,14 @@ class qt {
|
|
|
153
153
|
), t(this, a).hasAttribute("data-pagination-more-link"))
|
|
154
154
|
if (e < i.totalPages) {
|
|
155
155
|
t(this, a).style.display = "";
|
|
156
|
-
const
|
|
156
|
+
const n = t(this, a).querySelector(
|
|
157
157
|
"[data-pagination-more-link-counter]"
|
|
158
158
|
);
|
|
159
|
-
|
|
159
|
+
n && (n.textContent = (i.totalPages - e).toString());
|
|
160
160
|
const S = t(this, a).getAttribute("href"), p = new URL(S, window.location.origin);
|
|
161
161
|
p.searchParams.set("page", (e + 1).toString());
|
|
162
|
-
const
|
|
163
|
-
t(this, a).setAttribute("href",
|
|
162
|
+
const g = p.href.replace(p.origin, "").toString();
|
|
163
|
+
t(this, a).setAttribute("href", g), this.checkCurrent(g);
|
|
164
164
|
} else
|
|
165
165
|
t(this, a).style.display = "none";
|
|
166
166
|
else t(this, a).hasAttribute("data-pagination-set-link") && (t(this, a).getAttribute("data-value") === e.toString() ? t(this, a).classList.add("pagination-current") : t(this, a).classList.remove("pagination-current"));
|
|
@@ -176,32 +176,32 @@ H = new WeakMap(), a = new WeakMap(), U = new WeakMap(), st = new WeakSet(), Rt
|
|
|
176
176
|
if (s) {
|
|
177
177
|
const i = parseInt(
|
|
178
178
|
s.getAttribute("data-current-page") || "1"
|
|
179
|
-
),
|
|
179
|
+
), n = parseInt(
|
|
180
180
|
s.getAttribute("data-total-pages") || "1"
|
|
181
181
|
);
|
|
182
182
|
return {
|
|
183
183
|
element: s,
|
|
184
184
|
currentPage: i,
|
|
185
|
-
totalPages:
|
|
185
|
+
totalPages: n,
|
|
186
186
|
selector: e
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
189
|
}, mt = new WeakMap(), it = new WeakMap();
|
|
190
190
|
const be = new DOMParser();
|
|
191
|
-
var
|
|
191
|
+
var z, J, k, q, Q, B, at, Z, X, ft;
|
|
192
192
|
class te {
|
|
193
193
|
constructor(e, s) {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
l(this, z);
|
|
195
|
+
l(this, J);
|
|
196
|
+
l(this, k, { x: 0, y: 0 });
|
|
197
|
+
l(this, q, null);
|
|
198
|
+
l(this, Q, null);
|
|
199
|
+
l(this, B, null);
|
|
200
|
+
l(this, at, null);
|
|
201
|
+
l(this, Z, null);
|
|
202
|
+
l(this, X, null);
|
|
203
|
+
l(this, ft);
|
|
204
|
+
o(this, z, e), o(this, J, s);
|
|
205
205
|
}
|
|
206
206
|
get pathname() {
|
|
207
207
|
return t(this, J);
|
|
@@ -213,10 +213,10 @@ class te {
|
|
|
213
213
|
return t(this, B);
|
|
214
214
|
}
|
|
215
215
|
setHeaders(e) {
|
|
216
|
-
|
|
216
|
+
o(this, ft, e);
|
|
217
217
|
}
|
|
218
218
|
setInitialDocument(e) {
|
|
219
|
-
|
|
219
|
+
o(this, q, e.cloneNode(!0));
|
|
220
220
|
}
|
|
221
221
|
abort() {
|
|
222
222
|
var e;
|
|
@@ -226,34 +226,34 @@ class te {
|
|
|
226
226
|
}
|
|
227
227
|
fetch(e, s, i) {
|
|
228
228
|
return G(this, null, function* () {
|
|
229
|
-
var
|
|
229
|
+
var n;
|
|
230
230
|
if (!i) {
|
|
231
|
-
const
|
|
232
|
-
if (t(this, X) ||
|
|
231
|
+
const g = ((n = t(this, q)) == null ? void 0 : n.documentElement.getAttribute("data-cache")) && s !== e, c = t(this, q) && t(this, z).isPopstateNavigation;
|
|
232
|
+
if (t(this, X) || g || c)
|
|
233
233
|
return t(this, X);
|
|
234
234
|
}
|
|
235
|
-
return
|
|
235
|
+
return o(this, X, new Promise((S) => G(this, null, function* () {
|
|
236
236
|
try {
|
|
237
|
-
|
|
238
|
-
const
|
|
237
|
+
o(this, Z, new AbortController());
|
|
238
|
+
const g = yield (yield fetch(e, {
|
|
239
239
|
signal: t(this, Z).signal,
|
|
240
240
|
headers: Ct({
|
|
241
241
|
"X-MORPH": "true",
|
|
242
242
|
"X-MORPH-CURRENT-PATH": encodeURIComponent(s),
|
|
243
243
|
"X-MORPH-NEW-PATH": encodeURIComponent(e)
|
|
244
244
|
}, t(this, ft))
|
|
245
|
-
})).text(), c = be.parseFromString(
|
|
245
|
+
})).text(), c = be.parseFromString(g, "text/html");
|
|
246
246
|
this.setInitialDocument(c);
|
|
247
247
|
} catch (p) {
|
|
248
248
|
console.warn(p);
|
|
249
249
|
} finally {
|
|
250
|
-
|
|
250
|
+
o(this, Z, null), o(this, X, null), S();
|
|
251
251
|
}
|
|
252
252
|
}))), t(this, X);
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
255
|
cloneDocument() {
|
|
256
|
-
|
|
256
|
+
o(this, B, (t(this, Q) || t(this, q)).cloneNode(!0));
|
|
257
257
|
}
|
|
258
258
|
get title() {
|
|
259
259
|
let e = "";
|
|
@@ -269,57 +269,57 @@ class te {
|
|
|
269
269
|
t(this, k).x = 0, t(this, k).y = 0;
|
|
270
270
|
}
|
|
271
271
|
clearDocumentState() {
|
|
272
|
-
|
|
272
|
+
o(this, Q, null);
|
|
273
273
|
}
|
|
274
274
|
saveScrollState() {
|
|
275
|
-
t(this,
|
|
275
|
+
t(this, q).documentElement.hasAttribute(
|
|
276
276
|
"data-no-scroll-restoration"
|
|
277
|
-
) ? (t(this, k).x = 0, t(this, k).y = 0) : (t(this, k).x = t(this,
|
|
277
|
+
) ? (t(this, k).x = 0, t(this, k).y = 0) : (t(this, k).x = t(this, z).scrollValue.left, t(this, k).y = t(this, z).scrollValue.top);
|
|
278
278
|
}
|
|
279
279
|
restoreScrollPosition() {
|
|
280
|
-
t(this,
|
|
280
|
+
t(this, z).scrollElement.scroll({
|
|
281
281
|
top: t(this, k).y,
|
|
282
282
|
left: t(this, k).x,
|
|
283
283
|
behavior: "instant"
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
saveDocumentState() {
|
|
287
|
-
t(this,
|
|
287
|
+
t(this, q).documentElement.hasAttribute(
|
|
288
288
|
"data-no-page-restoration"
|
|
289
|
-
) ?
|
|
289
|
+
) ? o(this, Q, null) : o(this, Q, document.cloneNode(!0));
|
|
290
290
|
}
|
|
291
291
|
renewScrollPosition() {
|
|
292
|
-
t(this,
|
|
292
|
+
t(this, z).scrollElement.scroll({
|
|
293
293
|
top: 0,
|
|
294
294
|
left: 0,
|
|
295
295
|
behavior: "instant"
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
298
|
saveState(e) {
|
|
299
|
-
|
|
299
|
+
o(this, at, e);
|
|
300
300
|
}
|
|
301
301
|
clearState() {
|
|
302
302
|
const e = t(this, at);
|
|
303
|
-
return
|
|
303
|
+
return o(this, at, null), e;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
var C, nt, pt,
|
|
306
|
+
z = new WeakMap(), J = new WeakMap(), k = new WeakMap(), q = new WeakMap(), Q = new WeakMap(), B = new WeakMap(), at = new WeakMap(), Z = new WeakMap(), X = new WeakMap(), ft = new WeakMap();
|
|
307
|
+
var C, nt, pt, qt, gt;
|
|
308
308
|
class ye {
|
|
309
309
|
constructor(e) {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
l(this, pt);
|
|
311
|
+
l(this, C);
|
|
312
|
+
l(this, nt, []);
|
|
313
|
+
l(this, gt, () => {
|
|
314
|
+
E(this, pt, qt).call(this);
|
|
315
315
|
});
|
|
316
|
-
|
|
316
|
+
o(this, C, e);
|
|
317
317
|
for (const s in t(this, C).dataset) {
|
|
318
318
|
const i = ve(s);
|
|
319
319
|
if (i.startsWith("param-")) {
|
|
320
|
-
const
|
|
320
|
+
const n = i.split("param-")[1], S = t(this, C).dataset[s];
|
|
321
321
|
t(this, nt).push({
|
|
322
|
-
name:
|
|
322
|
+
name: n,
|
|
323
323
|
value: S
|
|
324
324
|
});
|
|
325
325
|
}
|
|
@@ -327,7 +327,7 @@ class ye {
|
|
|
327
327
|
document.addEventListener(
|
|
328
328
|
"morphURLParametersChange",
|
|
329
329
|
t(this, gt)
|
|
330
|
-
),
|
|
330
|
+
), E(this, pt, qt).call(this);
|
|
331
331
|
}
|
|
332
332
|
destroy() {
|
|
333
333
|
document.removeEventListener(
|
|
@@ -336,50 +336,50 @@ class ye {
|
|
|
336
336
|
);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
C = new WeakMap(), nt = new WeakMap(), pt = new WeakSet(),
|
|
339
|
+
C = new WeakMap(), nt = new WeakMap(), pt = new WeakSet(), qt = function() {
|
|
340
340
|
const e = new URLSearchParams(location.search);
|
|
341
|
-
let s = !!t(this, nt).find((
|
|
342
|
-
!s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((
|
|
341
|
+
let s = !!t(this, nt).find((n) => e.has(n.name) && (e.get(n.name) === n.value || n.value === "*" || n.value === "all" || n.value === "any" || n.value === "vse" || e.get(n.name) === "*" || e.get(n.name) === "all" || e.get(n.name) === "any" || e.get(n.name) === "vse"));
|
|
342
|
+
!s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((n) => e.has(n.name)).length);
|
|
343
343
|
const i = t(this, C).getAttribute("data-hide-class");
|
|
344
344
|
s ? i ? t(this, C).classList.remove(i) : t(this, C).style.display = "" : i ? t(this, C).classList.add(i) : t(this, C).style.display = "none";
|
|
345
345
|
}, gt = new WeakMap();
|
|
346
346
|
var N, rt, y, K, f, _, Y, $, T, Et, V, Lt, tt, ot, ht, St, lt, vt, m, Vt, bt, Ht, Wt, ae, Ft, Ot, Bt, Xt, Tt, ct;
|
|
347
347
|
const ut = class ut {
|
|
348
348
|
constructor(e) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
349
|
+
l(this, m);
|
|
350
|
+
l(this, N, null);
|
|
351
|
+
l(this, rt, null);
|
|
352
|
+
l(this, y, []);
|
|
353
|
+
l(this, K);
|
|
354
|
+
l(this, f, null);
|
|
355
|
+
l(this, _);
|
|
356
|
+
l(this, Y, []);
|
|
357
|
+
l(this, $, !1);
|
|
358
|
+
l(this, T, null);
|
|
359
|
+
l(this, Et, !1);
|
|
360
|
+
l(this, V, /* @__PURE__ */ new Map());
|
|
361
|
+
l(this, Lt, []);
|
|
362
|
+
l(this, tt, null);
|
|
363
|
+
l(this, ot, 0);
|
|
364
|
+
l(this, ht, 0);
|
|
365
|
+
l(this, St);
|
|
366
|
+
l(this, lt);
|
|
367
|
+
l(this, vt);
|
|
368
|
+
l(this, bt, (e) => {
|
|
369
369
|
var s;
|
|
370
370
|
return ((s = e.getAttribute("href")) == null ? void 0 : s.startsWith("/")) && !e.hasAttribute("download") && !e.hasAttribute("data-morph-skip") && !e.closest("[data-morph-skip]") && e.getAttribute("target") !== "_blank";
|
|
371
371
|
});
|
|
372
|
-
|
|
373
|
-
e.preventDefault(),
|
|
372
|
+
l(this, Tt, (e) => G(this, null, function* () {
|
|
373
|
+
e.preventDefault(), o(this, $, !0), yield this.navigate(location.href.replace(location.origin, ""), {
|
|
374
374
|
historyAction: "none",
|
|
375
375
|
submorph: t(this, lt) ? void 0 : t(this, St),
|
|
376
376
|
revalidate: t(this, lt),
|
|
377
377
|
keepScrollPosition: t(this, vt)
|
|
378
|
-
}),
|
|
378
|
+
}), o(this, $, !1);
|
|
379
379
|
}));
|
|
380
|
-
|
|
381
|
-
const { left: e, top: s } = this.scrollValue, i = s - t(this, ht),
|
|
382
|
-
|
|
380
|
+
l(this, ct, () => {
|
|
381
|
+
const { left: e, top: s } = this.scrollValue, i = s - t(this, ht), n = e - t(this, ot);
|
|
382
|
+
o(this, ht, s), o(this, ot, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
|
|
383
383
|
"scroll-y-forward",
|
|
384
384
|
i > 0
|
|
385
385
|
), document.documentElement.classList.toggle(
|
|
@@ -387,10 +387,10 @@ const ut = class ut {
|
|
|
387
387
|
i < 0
|
|
388
388
|
), document.documentElement.classList.toggle(
|
|
389
389
|
"scroll-x-forward",
|
|
390
|
-
|
|
390
|
+
n > 0
|
|
391
391
|
), document.documentElement.classList.toggle(
|
|
392
392
|
"scroll-x-backward",
|
|
393
|
-
|
|
393
|
+
n < 0
|
|
394
394
|
), I(document, "morphScroll", {
|
|
395
395
|
detail: {
|
|
396
396
|
left: e,
|
|
@@ -399,17 +399,17 @@ const ut = class ut {
|
|
|
399
399
|
});
|
|
400
400
|
});
|
|
401
401
|
if (se && !ut.instance) {
|
|
402
|
-
ut.instance = this,
|
|
402
|
+
ut.instance = this, o(this, N, {
|
|
403
403
|
base: Ee(e == null ? void 0 : e.base),
|
|
404
404
|
waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
|
|
405
405
|
trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
|
|
406
406
|
scrollSelector: e == null ? void 0 : e.scrollSelector,
|
|
407
407
|
morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
|
|
408
|
-
}),
|
|
408
|
+
}), o(this, rt, E(this, m, Wt).call(this, document.body));
|
|
409
409
|
const s = this.normalizePath(
|
|
410
410
|
location.pathname + location.search + location.hash
|
|
411
411
|
);
|
|
412
|
-
|
|
412
|
+
o(this, f, s);
|
|
413
413
|
const i = new te(this, t(this, f).pathname);
|
|
414
414
|
i.setInitialDocument(document), t(this, V).set(t(this, f).pathname, i), document.documentElement.setAttribute(
|
|
415
415
|
"data-current-pathname",
|
|
@@ -422,7 +422,7 @@ const ut = class ut {
|
|
|
422
422
|
pathname: s.pathname,
|
|
423
423
|
searchParameters: s.parameters,
|
|
424
424
|
hash: s.hash
|
|
425
|
-
}),
|
|
425
|
+
}), o(this, tt, new ie()), E(this, m, Bt).call(this, document);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
get currentURL() {
|
|
@@ -461,11 +461,11 @@ const ut = class ut {
|
|
|
461
461
|
}
|
|
462
462
|
prefetch(e, s) {
|
|
463
463
|
return G(this, null, function* () {
|
|
464
|
-
var
|
|
464
|
+
var n;
|
|
465
465
|
if (t(this, Y).length)
|
|
466
466
|
return;
|
|
467
|
-
e = ((
|
|
468
|
-
const i =
|
|
467
|
+
e = ((n = this.pathnameModifier) == null ? void 0 : n.call(this, e)) || e;
|
|
468
|
+
const i = E(this, m, Ht).call(this, e);
|
|
469
469
|
i == null || i.fetch(e, t(this, f).path, s);
|
|
470
470
|
});
|
|
471
471
|
}
|
|
@@ -478,10 +478,10 @@ const ut = class ut {
|
|
|
478
478
|
return G(this, arguments, function* (e, {
|
|
479
479
|
historyAction: s = "push",
|
|
480
480
|
centerScroll: i,
|
|
481
|
-
offsetScroll:
|
|
481
|
+
offsetScroll: n,
|
|
482
482
|
scrollBehaviour: S,
|
|
483
483
|
revalidate: p,
|
|
484
|
-
keepSearchParameters:
|
|
484
|
+
keepSearchParameters: g,
|
|
485
485
|
submorph: c,
|
|
486
486
|
submorphAppend: L,
|
|
487
487
|
clearState: D,
|
|
@@ -491,18 +491,18 @@ const ut = class ut {
|
|
|
491
491
|
var M, Pt, j, W;
|
|
492
492
|
if (t(this, Y).length)
|
|
493
493
|
return;
|
|
494
|
-
|
|
494
|
+
o(this, St, c), o(this, lt, p), o(this, vt, dt);
|
|
495
495
|
const yt = ((M = this.pathnameModifier) == null ? void 0 : M.call(this, e)) || e, d = this.normalizePath(yt, {
|
|
496
496
|
mergeParams: et
|
|
497
497
|
});
|
|
498
498
|
if (!p && (((Pt = t(this, K)) == null ? void 0 : Pt.pathname) === d.pathname || t(this, f).pathname === d.pathname)) {
|
|
499
|
-
dt ||
|
|
499
|
+
dt || E(this, m, Xt).call(this, d.hash || 0, {
|
|
500
500
|
centerScroll: i,
|
|
501
|
-
offsetScroll:
|
|
501
|
+
offsetScroll: n,
|
|
502
502
|
behavior: "smooth"
|
|
503
503
|
}), I(document, "morphSamePath", {
|
|
504
504
|
custom: !0
|
|
505
|
-
}), ((j = t(this, f)) == null ? void 0 : j.parameters) !== d.parameters && (
|
|
505
|
+
}), ((j = t(this, f)) == null ? void 0 : j.parameters) !== d.parameters && (o(this, _, t(this, f)), o(this, f, d), It({
|
|
506
506
|
action: ((W = t(this, f)) == null ? void 0 : W.hash) !== d.hash ? "replace" : s,
|
|
507
507
|
pathname: d.pathname,
|
|
508
508
|
searchParameters: d.parameters,
|
|
@@ -520,26 +520,26 @@ const ut = class ut {
|
|
|
520
520
|
t(this, y).forEach((A) => {
|
|
521
521
|
A.checkCurrent(d.path);
|
|
522
522
|
});
|
|
523
|
-
|
|
523
|
+
o(this, K, d);
|
|
524
524
|
try {
|
|
525
525
|
let A = !0;
|
|
526
526
|
if (this.preprocessor)
|
|
527
527
|
try {
|
|
528
|
-
yield new Promise((
|
|
528
|
+
yield new Promise((r, P) => {
|
|
529
529
|
var R;
|
|
530
530
|
(R = this.preprocessor) == null || R.call(this, {
|
|
531
531
|
url: d,
|
|
532
|
-
resolve:
|
|
532
|
+
resolve: r,
|
|
533
533
|
reject: P,
|
|
534
534
|
submorph: c
|
|
535
535
|
});
|
|
536
536
|
});
|
|
537
|
-
} catch (
|
|
538
|
-
|
|
537
|
+
} catch (r) {
|
|
538
|
+
r ? console.error(r) : console.log("Route change canceled"), A = !1;
|
|
539
539
|
}
|
|
540
540
|
if (!A || t(this, K).pathname !== d.pathname) {
|
|
541
|
-
t(this, y).forEach((
|
|
542
|
-
|
|
541
|
+
t(this, y).forEach((r) => {
|
|
542
|
+
r.checkCurrent(t(this, f).path);
|
|
543
543
|
});
|
|
544
544
|
return;
|
|
545
545
|
}
|
|
@@ -547,22 +547,22 @@ const ut = class ut {
|
|
|
547
547
|
url: d,
|
|
548
548
|
submorph: c
|
|
549
549
|
};
|
|
550
|
-
c ? L || c.forEach((
|
|
551
|
-
document.querySelectorAll(
|
|
550
|
+
c ? L || c.forEach((r) => {
|
|
551
|
+
document.querySelectorAll(r).forEach((P) => {
|
|
552
552
|
P.classList.add("out"), P.setAttribute("data-morph-out", "");
|
|
553
553
|
});
|
|
554
|
-
}) : t(this, rt).forEach((
|
|
554
|
+
}) : t(this, rt).forEach((r) => {
|
|
555
555
|
var P, R;
|
|
556
|
-
(P =
|
|
556
|
+
(P = r.firstElementChild) == null || P.classList.add("out"), (R = r.firstElementChild) == null || R.setAttribute("data-morph-out", "");
|
|
557
557
|
}), I(document, "morphNavigation", {
|
|
558
558
|
detail: w
|
|
559
559
|
});
|
|
560
|
-
const Mt =
|
|
561
|
-
if (t(this, V).forEach((
|
|
562
|
-
|
|
560
|
+
const Mt = E(this, m, Ht).call(this, t(this, f).pathname), v = E(this, m, Ht).call(this, d.pathname);
|
|
561
|
+
if (t(this, V).forEach((r) => {
|
|
562
|
+
r.pathname !== d.pathname && r.abort();
|
|
563
563
|
}), yield v == null ? void 0 : v.fetch(yt, t(this, f).path, p), t(this, K).pathname !== d.pathname) {
|
|
564
|
-
t(this, y).forEach((
|
|
565
|
-
|
|
564
|
+
t(this, y).forEach((r) => {
|
|
565
|
+
r.checkCurrent(t(this, f).path);
|
|
566
566
|
});
|
|
567
567
|
return;
|
|
568
568
|
}
|
|
@@ -570,30 +570,30 @@ const ut = class ut {
|
|
|
570
570
|
const wt = Nt(Ct({}, w), {
|
|
571
571
|
document: v.document
|
|
572
572
|
});
|
|
573
|
-
L || wt.document.querySelectorAll("[data-morph-out]").forEach((
|
|
574
|
-
|
|
573
|
+
L || wt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
|
|
574
|
+
r.classList.remove("out");
|
|
575
575
|
}), I(document, "morphStart", {
|
|
576
576
|
detail: wt
|
|
577
577
|
});
|
|
578
|
-
const Kt = Array.from(document.head.children), Yt = Array.from(v.document.head.children), $t =
|
|
579
|
-
At.forEach((
|
|
580
|
-
|
|
581
|
-
}), At.forEach((
|
|
582
|
-
document.head.appendChild(
|
|
578
|
+
const Kt = Array.from(document.head.children), Yt = Array.from(v.document.head.children), $t = E(this, m, ae).call(this, Kt, Yt), re = E(this, m, Ft).call(this, Kt, $t), At = E(this, m, Ft).call(this, Yt, $t).filter((r) => !this.excludeHeadChild(r));
|
|
579
|
+
At.forEach((r, P) => {
|
|
580
|
+
r.tagName === "SCRIPT" && (At[P] = E(this, m, Vt).call(this, r));
|
|
581
|
+
}), At.forEach((r) => {
|
|
582
|
+
document.head.appendChild(r);
|
|
583
583
|
});
|
|
584
|
-
const xt = At.filter((
|
|
585
|
-
if (
|
|
584
|
+
const xt = At.filter((r) => {
|
|
585
|
+
if (r.hasAttribute("data-no-waiting"))
|
|
586
586
|
return !1;
|
|
587
|
-
if (
|
|
587
|
+
if (E(this, m, Ot).call(this, r))
|
|
588
588
|
return !0;
|
|
589
589
|
});
|
|
590
|
-
t(this, N).waitForHeadToLoad && xt.length && (yield new Promise((
|
|
590
|
+
t(this, N).waitForHeadToLoad && xt.length && (yield new Promise((r) => G(this, null, function* () {
|
|
591
591
|
let P = 0;
|
|
592
592
|
try {
|
|
593
593
|
for (var R = _t(xt), he, F, x; he = !(F = yield R.next()).done; he = !1) {
|
|
594
594
|
const kt = F.value;
|
|
595
595
|
kt.onload = () => {
|
|
596
|
-
P++, P === xt.length &&
|
|
596
|
+
P++, P === xt.length && r();
|
|
597
597
|
};
|
|
598
598
|
}
|
|
599
599
|
} catch (F) {
|
|
@@ -608,11 +608,11 @@ const ut = class ut {
|
|
|
608
608
|
}
|
|
609
609
|
}))), yield pe(10);
|
|
610
610
|
const jt = [];
|
|
611
|
-
L || re.forEach((
|
|
612
|
-
|
|
611
|
+
L || re.forEach((r) => {
|
|
612
|
+
r.hasAttribute("data-permanent") || (E(this, m, Ot).call(this, r) ? jt.push(r) : r.remove());
|
|
613
613
|
});
|
|
614
|
-
const oe =
|
|
615
|
-
!t(this, N).morphInsideScrollContainer && !c &&
|
|
614
|
+
const oe = E(this, m, Wt).call(this, v.document.body);
|
|
615
|
+
!t(this, N).morphInsideScrollContainer && !c && E(this, m, Bt).call(this, v.document), document.documentElement.setAttribute(
|
|
616
616
|
"data-current-pathname",
|
|
617
617
|
d.pathname
|
|
618
618
|
), document.documentElement.setAttribute(
|
|
@@ -621,19 +621,19 @@ const ut = class ut {
|
|
|
621
621
|
), It({
|
|
622
622
|
action: s,
|
|
623
623
|
pathname: d.pathname,
|
|
624
|
-
searchParameters: d.parameters || (
|
|
624
|
+
searchParameters: d.parameters || (g ? location.search : ""),
|
|
625
625
|
hash: d.hash
|
|
626
|
-
}), t(this, tt).remove(),
|
|
626
|
+
}), t(this, tt).remove(), o(this, _, t(this, f)), o(this, f, d);
|
|
627
627
|
const Ut = [];
|
|
628
|
-
t(this, rt).forEach((
|
|
629
|
-
const R = oe[P], he = getComputedStyle(
|
|
628
|
+
t(this, rt).forEach((r, P) => {
|
|
629
|
+
const R = oe[P], he = getComputedStyle(r).getPropertyValue("--morph-duration");
|
|
630
630
|
let F = [], x = [];
|
|
631
631
|
c ? (c.forEach((u) => {
|
|
632
|
-
const b =
|
|
632
|
+
const b = r.querySelector(u), O = R.querySelector(u);
|
|
633
633
|
b && O && (x.push(b), F.push(O));
|
|
634
634
|
}), x.forEach((u) => {
|
|
635
635
|
u.parentElement && Ut.push(u.parentElement);
|
|
636
|
-
})) : (F.push(...R.childNodes), x.push(...
|
|
636
|
+
})) : (F.push(...R.childNodes), x.push(...r.childNodes), Ut.push(r)), L || x.forEach((u) => {
|
|
637
637
|
u instanceof HTMLElement && (this.destroyOldLinks(u), u.classList.add("old"));
|
|
638
638
|
}), F.forEach((u) => {
|
|
639
639
|
u instanceof HTMLElement && (this.findNewLinks(u), u.classList.add("new"));
|
|
@@ -645,7 +645,7 @@ const ut = class ut {
|
|
|
645
645
|
u,
|
|
646
646
|
x[b]
|
|
647
647
|
);
|
|
648
|
-
}) :
|
|
648
|
+
}) : r.prepend(...F), setTimeout(() => {
|
|
649
649
|
L || x.forEach((u) => {
|
|
650
650
|
u instanceof HTMLElement && u.classList.add("old-idle");
|
|
651
651
|
}), F.forEach((u) => {
|
|
@@ -657,7 +657,7 @@ const ut = class ut {
|
|
|
657
657
|
});
|
|
658
658
|
}, 0);
|
|
659
659
|
const kt = Nt(Ct({}, wt), {
|
|
660
|
-
morphElement:
|
|
660
|
+
morphElement: r
|
|
661
661
|
});
|
|
662
662
|
I(document, "morphNewChildrenAdded", {
|
|
663
663
|
detail: kt
|
|
@@ -683,16 +683,16 @@ const ut = class ut {
|
|
|
683
683
|
this.scrollValue.top + "px"
|
|
684
684
|
), I(document, "morphBeforeNavigationScroll", {
|
|
685
685
|
detail: v.scrollState
|
|
686
|
-
}), d.hash ? (v.clearScrollState(),
|
|
686
|
+
}), d.hash ? (v.clearScrollState(), E(this, m, Xt).call(this, d.hash, {
|
|
687
687
|
centerScroll: i,
|
|
688
|
-
offsetScroll:
|
|
688
|
+
offsetScroll: n,
|
|
689
689
|
behavior: S
|
|
690
|
-
})) : t(this, $) ? v.restoreScrollPosition() : dt || v.renewScrollPosition(), yield Promise.all(t(this, Y)), L || jt.forEach((
|
|
691
|
-
|
|
692
|
-
R.replaceWith(
|
|
690
|
+
})) : t(this, $) ? v.restoreScrollPosition() : dt || v.renewScrollPosition(), yield Promise.all(t(this, Y)), L || jt.forEach((r) => r.remove()), o(this, Y, []), Ut.forEach((r) => {
|
|
691
|
+
r.querySelectorAll("script").forEach((R) => {
|
|
692
|
+
R.replaceWith(E(this, m, Vt).call(this, R));
|
|
693
693
|
});
|
|
694
|
-
}), t(this, y).forEach((
|
|
695
|
-
|
|
694
|
+
}), t(this, y).forEach((r) => {
|
|
695
|
+
r.checkCurrent(t(this, f).path);
|
|
696
696
|
}), this.findParamsDependent(), I(document, "morphComplete", {
|
|
697
697
|
detail: wt
|
|
698
698
|
}), document.documentElement.style.removeProperty(
|
|
@@ -701,11 +701,11 @@ const ut = class ut {
|
|
|
701
701
|
} catch (A) {
|
|
702
702
|
console.error(A);
|
|
703
703
|
}
|
|
704
|
-
|
|
704
|
+
o(this, K, void 0);
|
|
705
705
|
});
|
|
706
706
|
}
|
|
707
707
|
addLink(e) {
|
|
708
|
-
t(this, y).push(new
|
|
708
|
+
t(this, y).push(new zt(e, this));
|
|
709
709
|
}
|
|
710
710
|
addLinks(e) {
|
|
711
711
|
e.forEach((s) => {
|
|
@@ -713,24 +713,24 @@ const ut = class ut {
|
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
removeLink(e) {
|
|
716
|
-
|
|
716
|
+
o(this, y, t(this, y).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
|
|
717
717
|
}
|
|
718
718
|
destroyOldLinks(e) {
|
|
719
|
-
|
|
719
|
+
o(this, y, t(this, y).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
|
|
720
720
|
}
|
|
721
721
|
findNewLinks(e) {
|
|
722
722
|
const s = [...e.querySelectorAll("a")].filter(
|
|
723
723
|
t(this, bt)
|
|
724
724
|
);
|
|
725
725
|
t(this, y).push(
|
|
726
|
-
...s.map((i) => new
|
|
726
|
+
...s.map((i) => new zt(i, this))
|
|
727
727
|
);
|
|
728
728
|
}
|
|
729
729
|
findLinks() {
|
|
730
730
|
const e = [
|
|
731
731
|
...document.documentElement.querySelectorAll("a")
|
|
732
732
|
].filter(t(this, bt));
|
|
733
|
-
t(this, y).forEach((s) => s.destroy()),
|
|
733
|
+
t(this, y).forEach((s) => s.destroy()), o(this, y, e.map((s) => new zt(s, this)));
|
|
734
734
|
}
|
|
735
735
|
findParamsDependent() {
|
|
736
736
|
const e = [
|
|
@@ -738,7 +738,7 @@ const ut = class ut {
|
|
|
738
738
|
"[data-morph-params-dependent]"
|
|
739
739
|
)
|
|
740
740
|
];
|
|
741
|
-
t(this, Lt).forEach((s) => s.destroy()),
|
|
741
|
+
t(this, Lt).forEach((s) => s.destroy()), o(this, Lt, e.map(
|
|
742
742
|
(s) => new ye(s)
|
|
743
743
|
));
|
|
744
744
|
}
|
|
@@ -746,8 +746,8 @@ const ut = class ut {
|
|
|
746
746
|
N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f = new WeakMap(), _ = new WeakMap(), Y = new WeakMap(), $ = new WeakMap(), T = new WeakMap(), Et = new WeakMap(), V = new WeakMap(), Lt = new WeakMap(), tt = new WeakMap(), ot = new WeakMap(), ht = new WeakMap(), St = new WeakMap(), lt = new WeakMap(), vt = new WeakMap(), m = new WeakSet(), Vt = function(e) {
|
|
747
747
|
const s = document.createElement("script");
|
|
748
748
|
for (let i = 0; i < e.attributes.length; i++) {
|
|
749
|
-
const
|
|
750
|
-
s.setAttribute(
|
|
749
|
+
const n = e.attributes[i];
|
|
750
|
+
s.setAttribute(n.name, n.value);
|
|
751
751
|
}
|
|
752
752
|
return e.hasAttribute("src") || (s.innerHTML = e.innerHTML), s;
|
|
753
753
|
}, bt = new WeakMap(), Ht = function(e) {
|
|
@@ -760,13 +760,13 @@ N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f =
|
|
|
760
760
|
}, ae = function(e, s) {
|
|
761
761
|
return e.filter(
|
|
762
762
|
(i) => s.find(
|
|
763
|
-
(
|
|
763
|
+
(n) => n.outerHTML === i.outerHTML
|
|
764
764
|
)
|
|
765
765
|
);
|
|
766
766
|
}, Ft = function(e, s) {
|
|
767
767
|
return e.filter(
|
|
768
768
|
(i) => !s.find(
|
|
769
|
-
(
|
|
769
|
+
(n) => n.outerHTML === i.outerHTML
|
|
770
770
|
)
|
|
771
771
|
);
|
|
772
772
|
}, Ot = function(e) {
|
|
@@ -776,7 +776,7 @@ N = new WeakMap(), rt = new WeakMap(), y = new WeakMap(), K = new WeakMap(), f =
|
|
|
776
776
|
(s = t(this, T)) == null || s.removeEventListener(
|
|
777
777
|
"scroll",
|
|
778
778
|
t(this, ct)
|
|
779
|
-
),
|
|
779
|
+
), o(this, ht, 0), o(this, ot, 0), o(this, T, t(this, N).scrollSelector && e.querySelector(t(this, N).scrollSelector) || window), o(this, Et, t(this, T) === window), (i = t(this, T)) == null || i.addEventListener("scroll", t(this, ct)), t(this, ct).call(this);
|
|
780
780
|
}, Xt = function(e, s) {
|
|
781
781
|
const i = typeof e == "string" ? document.getElementById(e) : e;
|
|
782
782
|
(typeof i == "number" || i) && ge(i, {
|