aptechka 0.50.16 → 0.50.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var V=h=>{throw TypeError(h)};var F=(h,n,e)=>n.has(h)||V("Cannot "+e);var t=(h,n,e)=>(F(h,n,"read from private field"),e?e.call(h):n.get(h)),s=(h,n,e)=>n.has(h)?V("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(h):n.set(h,e),i=(h,n,e,r)=>(F(h,n,"write to private field"),r?r.call(h,e):n.set(h,e),e),k=(h,n,e)=>(F(h,n,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("../notifier/index.cjs"),w=require("../index-Cqw2NKev.cjs"),Q=require("../dom-JBOkFLTh.cjs"),q=require("../ticker/index.cjs");require("../Store-DRp_K37w.cjs");const J=require("../easings-GegIwET5.cjs"),Z=require("../Tweened-cJ36zq1A.cjs"),_=require("../gestures-C7gbKx11.cjs"),$=require("../number-0243DApo.cjs"),p=require("../order/index.cjs");var R;class Y{constructor(){s(this,R,new G.Notifier)}get changeEvent(){return t(this,R)}}R=new WeakMap;var b,c,u,H;class ee extends Y{constructor(e){super();s(this,b,null);s(this,c,null);s(this,u,"offsetHeight");s(this,H,e=>{const r=e.shiftKey?-1:1;let a;e.code==="Space"?a=r*t(this,c)[t(this,u)]*.4:e.code==="ArrowLeft"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowRight"?a=1*t(this,c)[t(this,u)]*.2:e.code==="ArrowUp"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowDown"?a=1*t(this,c)[t(this,u)]*.2:e.code==="PageUp"?a=-1*t(this,c)[t(this,u)]:e.code==="PageDown"?a=1*t(this,c)[t(this,u)]:e.code==="Home"?a=0:e.code==="End"&&(a=t(this,u)==="offsetWidth"?t(this,c).scrollWidth:t(this,c).scrollHeight),a&&(e.stopPropagation(),this.changeEvent.notify("keyboard",a,e))});w.isBrowser&&(i(this,b,e!=null&&e.element&&Q.getElement(e.element)||window),i(this,c,t(this,b)instanceof HTMLElement?t(this,b):document.documentElement),this.dimension=e==null?void 0:e.dimension)}set dimension(e){i(this,u,e==="width"?"offsetWidth":"offsetHeight")}connect(){w.isBrowser&&t(this,b).addEventListener("keydown",t(this,H))}disconnect(){w.isBrowser&&t(this,b).removeEventListener("keydown",t(this,H))}}b=new WeakMap,c=new WeakMap,u=new WeakMap,H=new WeakMap;var y,v,P,z,d,T,f,g,O,U,C,W,B;class te extends Y{constructor(e){super();s(this,g);s(this,y);s(this,v);s(this,P);s(this,z);s(this,d);s(this,T);s(this,f);s(this,C);s(this,W);s(this,B);this.direction=1,i(this,d,new Z.Tweened(0,{easing:J.easeInQuad})),i(this,f,!1),i(this,C,r=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",r.timeBetweenFrames*t(this,y)*this.direction*(1-t(this,d).current),r)}),i(this,W,()=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",Math.sign(t(this,y))*this.direction*(1-t(this,d).current),null)}),i(this,B,()=>{t(this,v)&&(document.hidden?t(this,d).set(1,{equalize:!0}):t(this,d).set(0,{equalize:!0}))}),i(this,y,(e==null?void 0:e.speed)||1),i(this,v,(e==null?void 0:e.interval)||!1),i(this,P,e)}set interval(e){i(this,v,e),t(this,f)&&k(this,g,O).call(this)}set speed(e){i(this,y,e),t(this,f)&&k(this,g,O).call(this)}connect(){t(this,f)||(i(this,f,!0),k(this,g,O).call(this))}disconnect(){t(this,f)&&(i(this,f,!1),k(this,g,U).call(this))}pauseAndContinue(e,r){t(this,f)&&e&&(clearTimeout(t(this,T)),t(this,d).set(1,{duration:Math.min(e,1e3),equalize:r}),i(this,T,setTimeout(()=>{t(this,d).set(0,{duration:Math.min(e,5e3),equalize:r})},e)))}}y=new WeakMap,v=new WeakMap,P=new WeakMap,z=new WeakMap,d=new WeakMap,T=new WeakMap,f=new WeakMap,g=new WeakSet,O=function(){k(this,g,U).call(this),t(this,v)?i(this,z,setInterval(t(this,W),Math.abs(t(this,y)))):q.ticker.subscribe(t(this,C),t(this,P)),document.addEventListener("visibilitychange",t(this,B))},U=function(){clearInterval(t(this,z)),q.ticker.unsubscribe(t(this,C)),clearTimeout(t(this,T)),t(this,d).close(),document.removeEventListener("visibilitychange",t(this,B))},C=new WeakMap,W=new WeakMap,B=new WeakMap;var A,L,D,X;class ie extends Y{constructor(e){super();s(this,A,null);s(this,L);s(this,D);s(this,X,e=>{let r=0;if(!(this.axis==="x"&&Math.abs(e.deltaY)>Math.abs(e.deltaX)*1||this.axis==="y"&&Math.abs(e.deltaX)>Math.abs(e.deltaY)*1))if(e.preventDefault(),r=(this.axis==="max"?Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY:this.axis==="x"?e.deltaX:e.deltaY)*this.speed,e.stopPropagation(),this.debounce){const a=Date.now();if(a-t(this,D)>40&&(r=100*Math.sign(r)),i(this,D,a),Math.abs(r)<100||t(this,L))return;this.changeEvent.notify("wheel",r,e),i(this,L,setTimeout(()=>{i(this,L,void 0)},80))}else this.changeEvent.notify("wheel",r,e)});this.axis=(e==null?void 0:e.axis)||"y",this.speed=(e==null?void 0:e.speed)||1,this.debounce=(e==null?void 0:e.debounce)||!1,i(this,D,Date.now()),w.isBrowser&&i(this,A,e!=null&&e.element&&Q.getElement(e.element)||window)}connect(){w.isBrowser&&t(this,A).addEventListener("wheel",t(this,X),{passive:!1})}disconnect(){w.isBrowser&&(t(this,A).removeEventListener("wheel",t(this,X)),clearTimeout(t(this,L)))}}A=new WeakMap,L=new WeakMap,D=new WeakMap,X=new WeakMap;var M,o,l,I,E;const x=class x extends Y{constructor(e){super();s(this,o);s(this,l);s(this,I);s(this,E);this.inertion=1,i(this,o,null),i(this,l,0),i(this,I,r=>{if(r.composedPath().find(m=>m instanceof HTMLElement&&m.hasAttribute("drag-dead-zone")))return;this.swipe||q.ticker.unsubscribe(t(this,E));let a=r,S=!1;i(this,l,0),document.documentElement.classList.add("grabbing");let K=0,N=0;_.setupDrag(m=>{t(x,M)&&t(x,M)!==t(this,o)||(K=a.x-m.x,N=a.y-m.y,this.axis==="x"?i(this,l,K):i(this,l,N),a=m,S=this.axis==="x"&&Math.abs(K)>Math.abs(N)||this.axis==="y"&&Math.abs(N)>Math.abs(K),S&&(document.documentElement.classList.add("dragging"),i(x,M,t(this,o)),this.changeEvent.notify("drag",t(this,l),m)))},m=>{i(x,M,null),S&&!this.swipe&&this.inertion?(i(this,l,t(this,l)*this.inertion),q.ticker.subscribe(t(this,E),{order:p.TICK_ORDER.CONTROLS-1})):this.swipe&&this.changeEvent.notify("drag-end",t(this,l),m),document.documentElement.classList.remove("grabbing"),document.documentElement.classList.remove("dragging")})}),i(this,E,()=>{Math.floor(Math.abs(t(this,l)))||q.ticker.unsubscribe(t(this,E)),i(this,l,t(this,l)*.95),i(this,l,$.preciseNumber(t(this,l),3)),this.changeEvent.notify("drag",t(this,l),null)}),this.axis=(e==null?void 0:e.axis)||"y",this.swipe=(e==null?void 0:e.swipe)||!1,w.isBrowser&&i(this,o,e!=null&&e.element&&Q.getElement(e.element)||document.documentElement)}connect(){w.isBrowser&&t(this,o).addEventListener("pointerdown",t(this,I))}disconnect(){w.isBrowser&&(t(this,o).removeEventListener("pointerdown",t(this,I)),q.ticker.unsubscribe(t(this,E)))}};M=new WeakMap,o=new WeakMap,l=new WeakMap,I=new WeakMap,E=new WeakMap,s(x,M,null);let j=x;exports.AutoplayControls=te;exports.Controls=Y;exports.DragControls=j;exports.KeyboardControls=ee;exports.WheelControls=ie;
1
+ "use strict";var V=h=>{throw TypeError(h)};var F=(h,n,e)=>n.has(h)||V("Cannot "+e);var t=(h,n,e)=>(F(h,n,"read from private field"),e?e.call(h):n.get(h)),s=(h,n,e)=>n.has(h)?V("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(h):n.set(h,e),i=(h,n,e,r)=>(F(h,n,"write to private field"),r?r.call(h,e):n.set(h,e),e),k=(h,n,e)=>(F(h,n,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("../notifier/index.cjs"),w=require("../index-Cqw2NKev.cjs"),Q=require("../dom-JBOkFLTh.cjs"),q=require("../ticker/index.cjs");require("../Store-DRp_K37w.cjs");const J=require("../easings-GegIwET5.cjs"),Z=require("../Tweened-cJ36zq1A.cjs"),_=require("../gestures-C7gbKx11.cjs"),$=require("../number-0243DApo.cjs"),p=require("../order/index.cjs");var R;class Y{constructor(){s(this,R,new G.Notifier)}get changeEvent(){return t(this,R)}}R=new WeakMap;var g,c,u,H;class ee extends Y{constructor(e){super();s(this,g,null);s(this,c,null);s(this,u,"offsetHeight");s(this,H,e=>{const r=e.shiftKey?-1:1;let a;e.code==="Space"?a=r*t(this,c)[t(this,u)]*.4:e.code==="ArrowLeft"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowRight"?a=1*t(this,c)[t(this,u)]*.2:e.code==="ArrowUp"?a=-1*t(this,c)[t(this,u)]*.2:e.code==="ArrowDown"?a=1*t(this,c)[t(this,u)]*.2:e.code==="PageUp"?a=-1*t(this,c)[t(this,u)]:e.code==="PageDown"?a=1*t(this,c)[t(this,u)]:e.code==="Home"?a=0:e.code==="End"&&(a=t(this,u)==="offsetWidth"?t(this,c).scrollWidth:t(this,c).scrollHeight),a&&(e.stopPropagation(),this.changeEvent.notify("keyboard",a,e))});w.isBrowser&&(i(this,g,e!=null&&e.element&&Q.getElement(e.element)||window),i(this,c,t(this,g)instanceof HTMLElement?t(this,g):document.documentElement),this.dimension=e==null?void 0:e.dimension)}set dimension(e){i(this,u,e==="width"?"offsetWidth":"offsetHeight")}connect(){w.isBrowser&&t(this,g).addEventListener("keydown",t(this,H))}disconnect(){w.isBrowser&&t(this,g).removeEventListener("keydown",t(this,H))}}g=new WeakMap,c=new WeakMap,u=new WeakMap,H=new WeakMap;var y,L,P,z,d,T,f,b,O,U,C,W,B;class te extends Y{constructor(e){super();s(this,b);s(this,y);s(this,L);s(this,P);s(this,z);s(this,d);s(this,T);s(this,f);s(this,C);s(this,W);s(this,B);this.direction=1,i(this,d,new Z.Tweened(0,{easing:J.easeInQuad})),i(this,f,!1),i(this,C,r=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",r.timeBetweenFrames*t(this,y)*this.direction*(1-t(this,d).current),r)}),i(this,W,()=>{t(this,d).current!==1&&this.changeEvent.notify("autoplay",Math.sign(t(this,y))*this.direction*(1-t(this,d).current),null)}),i(this,B,()=>{t(this,L)&&(document.hidden?t(this,d).set(1,{equalize:!0}):t(this,d).set(0,{equalize:!0}))}),i(this,y,(e==null?void 0:e.speed)||1),i(this,L,(e==null?void 0:e.interval)||!1),i(this,P,e)}set interval(e){i(this,L,e),t(this,f)&&k(this,b,O).call(this)}set speed(e){i(this,y,e),t(this,f)&&k(this,b,O).call(this)}connect(){t(this,f)||(i(this,f,!0),k(this,b,O).call(this))}disconnect(){t(this,f)&&(i(this,f,!1),k(this,b,U).call(this))}pauseAndContinue(e,r){t(this,f)&&e&&(clearTimeout(t(this,T)),t(this,d).set(1,{duration:Math.min(e,1e3),equalize:r}),i(this,T,setTimeout(()=>{t(this,d).set(0,{duration:Math.min(e,5e3),equalize:r})},e)))}}y=new WeakMap,L=new WeakMap,P=new WeakMap,z=new WeakMap,d=new WeakMap,T=new WeakMap,f=new WeakMap,b=new WeakSet,O=function(){k(this,b,U).call(this),t(this,L)?i(this,z,setInterval(t(this,W),Math.abs(t(this,y)))):q.ticker.subscribe(t(this,C),t(this,P)),document.addEventListener("visibilitychange",t(this,B))},U=function(){clearInterval(t(this,z)),q.ticker.unsubscribe(t(this,C)),clearTimeout(t(this,T)),t(this,d).close(),document.removeEventListener("visibilitychange",t(this,B))},C=new WeakMap,W=new WeakMap,B=new WeakMap;var A,M,D,X;class ie extends Y{constructor(e){super();s(this,A,null);s(this,M);s(this,D);s(this,X,e=>{let r=0;if(!(this.axis==="x"&&Math.abs(e.deltaY)>Math.abs(e.deltaX)*1||this.axis==="y"&&Math.abs(e.deltaX)>Math.abs(e.deltaY)*1))if(e.preventDefault(),r=(this.axis==="max"?Math.abs(e.deltaX)>Math.abs(e.deltaY)?e.deltaX:e.deltaY:this.axis==="x"?e.deltaX:e.deltaY)*this.speed,e.stopPropagation(),this.debounce){const a=Date.now();if(a-t(this,D)>40&&(r=100*Math.sign(r)),i(this,D,a),Math.abs(r)<100||t(this,M))return;this.changeEvent.notify("wheel",r,e),i(this,M,setTimeout(()=>{i(this,M,void 0)},80))}else this.changeEvent.notify("wheel",r,e)});this.axis=(e==null?void 0:e.axis)||"y",this.speed=(e==null?void 0:e.speed)||1,this.debounce=(e==null?void 0:e.debounce)||!1,i(this,D,Date.now()),w.isBrowser&&i(this,A,e!=null&&e.element&&Q.getElement(e.element)||window)}connect(){w.isBrowser&&t(this,A).addEventListener("wheel",t(this,X),{passive:!1})}disconnect(){w.isBrowser&&(t(this,A).removeEventListener("wheel",t(this,X)),clearTimeout(t(this,M)))}}A=new WeakMap,M=new WeakMap,D=new WeakMap,X=new WeakMap;var v,o,l,I,E;const x=class x extends Y{constructor(e){super();s(this,o);s(this,l);s(this,I);s(this,E);this.inertion=1,i(this,o,null),i(this,l,0),i(this,I,r=>{if(r.button!==0||r.composedPath().find(m=>m instanceof HTMLElement&&m.hasAttribute("drag-dead-zone")))return;this.swipe||q.ticker.unsubscribe(t(this,E));let a=r,S=!1;i(this,l,0),document.documentElement.classList.add("grabbing");let K=0,N=0;_.setupDrag(m=>{t(x,v)&&t(x,v)!==t(this,o)||(K=a.x-m.x,N=a.y-m.y,this.axis==="x"?i(this,l,K):i(this,l,N),a=m,S=this.axis==="x"&&Math.abs(K)>Math.abs(N)||this.axis==="y"&&Math.abs(N)>Math.abs(K),S&&(document.documentElement.classList.add("dragging"),i(x,v,t(this,o)),this.changeEvent.notify("drag",t(this,l),m)))},m=>{i(x,v,null),S&&!this.swipe&&this.inertion?(i(this,l,t(this,l)*this.inertion),q.ticker.subscribe(t(this,E),{order:p.TICK_ORDER.CONTROLS-1})):this.swipe&&this.changeEvent.notify("drag-end",t(this,l),m),document.documentElement.classList.remove("grabbing"),document.documentElement.classList.remove("dragging")})}),i(this,E,()=>{Math.floor(Math.abs(t(this,l)))||q.ticker.unsubscribe(t(this,E)),i(this,l,t(this,l)*.95),i(this,l,$.preciseNumber(t(this,l),3)),this.changeEvent.notify("drag",t(this,l),null)}),this.axis=(e==null?void 0:e.axis)||"y",this.swipe=(e==null?void 0:e.swipe)||!1,w.isBrowser&&i(this,o,e!=null&&e.element&&Q.getElement(e.element)||document.documentElement)}connect(){w.isBrowser&&t(this,o).addEventListener("pointerdown",t(this,I))}disconnect(){w.isBrowser&&(t(this,o).removeEventListener("pointerdown",t(this,I)),q.ticker.unsubscribe(t(this,E)))}};v=new WeakMap,o=new WeakMap,l=new WeakMap,I=new WeakMap,E=new WeakMap,s(x,v,null);let j=x;exports.AutoplayControls=te;exports.Controls=Y;exports.DragControls=j;exports.KeyboardControls=ee;exports.WheelControls=ie;
@@ -23,11 +23,11 @@ class B {
23
23
  }
24
24
  }
25
25
  O = new WeakMap();
26
- var w, d, u, P;
26
+ var g, d, u, P;
27
27
  class ue extends B {
28
28
  constructor(e) {
29
29
  super();
30
- s(this, w, null);
30
+ s(this, g, null);
31
31
  s(this, d, null);
32
32
  s(this, u, "offsetHeight");
33
33
  s(this, P, (e) => {
@@ -35,31 +35,31 @@ class ue extends B {
35
35
  let r;
36
36
  e.code === "Space" ? r = a * t(this, d)[t(this, u)] * 0.4 : e.code === "ArrowLeft" ? r = -1 * t(this, d)[t(this, u)] * 0.2 : e.code === "ArrowRight" ? r = 1 * t(this, d)[t(this, u)] * 0.2 : e.code === "ArrowUp" ? r = -1 * t(this, d)[t(this, u)] * 0.2 : e.code === "ArrowDown" ? r = 1 * t(this, d)[t(this, u)] * 0.2 : e.code === "PageUp" ? r = -1 * t(this, d)[t(this, u)] : e.code === "PageDown" ? r = 1 * t(this, d)[t(this, u)] : e.code === "Home" ? r = 0 : e.code === "End" && (r = t(this, u) === "offsetWidth" ? t(this, d).scrollWidth : t(this, d).scrollHeight), r && (e.stopPropagation(), this.changeEvent.notify("keyboard", r, e));
37
37
  });
38
- b && (i(this, w, e != null && e.element && Q(e.element) || window), i(this, d, t(this, w) instanceof HTMLElement ? t(this, w) : document.documentElement), this.dimension = e == null ? void 0 : e.dimension);
38
+ b && (i(this, g, e != null && e.element && Q(e.element) || window), i(this, d, t(this, g) instanceof HTMLElement ? t(this, g) : document.documentElement), this.dimension = e == null ? void 0 : e.dimension);
39
39
  }
40
40
  set dimension(e) {
41
41
  i(this, u, e === "width" ? "offsetWidth" : "offsetHeight");
42
42
  }
43
43
  connect() {
44
- b && t(this, w).addEventListener(
44
+ b && t(this, g).addEventListener(
45
45
  "keydown",
46
46
  t(this, P)
47
47
  );
48
48
  }
49
49
  disconnect() {
50
- b && t(this, w).removeEventListener(
50
+ b && t(this, g).removeEventListener(
51
51
  "keydown",
52
52
  t(this, P)
53
53
  );
54
54
  }
55
55
  }
56
- w = new WeakMap(), d = new WeakMap(), u = new WeakMap(), P = new WeakMap();
57
- var E, L, X, Y, c, C, f, g, K, U, A, q, I;
56
+ g = new WeakMap(), d = new WeakMap(), u = new WeakMap(), P = new WeakMap();
57
+ var y, L, X, Y, c, C, f, w, K, U, A, q, I;
58
58
  class fe extends B {
59
59
  constructor(e) {
60
60
  super();
61
- s(this, g);
62
- s(this, E);
61
+ s(this, w);
62
+ s(this, y);
63
63
  s(this, L);
64
64
  s(this, X);
65
65
  s(this, Y);
@@ -72,30 +72,30 @@ class fe extends B {
72
72
  this.direction = 1, i(this, c, new Z(0, { easing: J })), i(this, f, !1), i(this, A, (a) => {
73
73
  t(this, c).current !== 1 && this.changeEvent.notify(
74
74
  "autoplay",
75
- a.timeBetweenFrames * t(this, E) * this.direction * (1 - t(this, c).current),
75
+ a.timeBetweenFrames * t(this, y) * this.direction * (1 - t(this, c).current),
76
76
  a
77
77
  );
78
78
  }), i(this, q, () => {
79
79
  t(this, c).current !== 1 && this.changeEvent.notify(
80
80
  "autoplay",
81
- Math.sign(t(this, E)) * this.direction * (1 - t(this, c).current),
81
+ Math.sign(t(this, y)) * this.direction * (1 - t(this, c).current),
82
82
  null
83
83
  );
84
84
  }), i(this, I, () => {
85
85
  t(this, L) && (document.hidden ? t(this, c).set(1, { equalize: !0 }) : t(this, c).set(0, { equalize: !0 }));
86
- }), i(this, E, (e == null ? void 0 : e.speed) || 1), i(this, L, (e == null ? void 0 : e.interval) || !1), i(this, X, e);
86
+ }), i(this, y, (e == null ? void 0 : e.speed) || 1), i(this, L, (e == null ? void 0 : e.interval) || !1), i(this, X, e);
87
87
  }
88
88
  set interval(e) {
89
- i(this, L, e), t(this, f) && T(this, g, K).call(this);
89
+ i(this, L, e), t(this, f) && T(this, w, K).call(this);
90
90
  }
91
91
  set speed(e) {
92
- i(this, E, e), t(this, f) && T(this, g, K).call(this);
92
+ i(this, y, e), t(this, f) && T(this, w, K).call(this);
93
93
  }
94
94
  connect() {
95
- t(this, f) || (i(this, f, !0), T(this, g, K).call(this));
95
+ t(this, f) || (i(this, f, !0), T(this, w, K).call(this));
96
96
  }
97
97
  disconnect() {
98
- t(this, f) && (i(this, f, !1), T(this, g, U).call(this));
98
+ t(this, f) && (i(this, f, !1), T(this, w, U).call(this));
99
99
  }
100
100
  pauseAndContinue(e, a) {
101
101
  t(this, f) && e && (clearTimeout(t(this, C)), t(this, c).set(1, {
@@ -109,10 +109,10 @@ class fe extends B {
109
109
  }, e)));
110
110
  }
111
111
  }
112
- E = new WeakMap(), L = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), c = new WeakMap(), C = new WeakMap(), f = new WeakMap(), g = new WeakSet(), K = function() {
113
- T(this, g, U).call(this), t(this, L) ? i(this, Y, setInterval(
112
+ y = new WeakMap(), L = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), c = new WeakMap(), C = new WeakMap(), f = new WeakMap(), w = new WeakSet(), K = function() {
113
+ T(this, w, U).call(this), t(this, L) ? i(this, Y, setInterval(
114
114
  t(this, q),
115
- Math.abs(t(this, E))
115
+ Math.abs(t(this, y))
116
116
  )) : k.subscribe(t(this, A), t(this, X)), document.addEventListener(
117
117
  "visibilitychange",
118
118
  t(this, I)
@@ -123,22 +123,22 @@ E = new WeakMap(), L = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), c =
123
123
  t(this, I)
124
124
  );
125
125
  }, A = new WeakMap(), q = new WeakMap(), I = new WeakMap();
126
- var D, v, H, N;
126
+ var D, M, H, N;
127
127
  class me extends B {
128
128
  constructor(e) {
129
129
  super();
130
130
  s(this, D, null);
131
- s(this, v);
131
+ s(this, M);
132
132
  s(this, H);
133
133
  s(this, N, (e) => {
134
134
  let a = 0;
135
135
  if (!(this.axis === "x" && Math.abs(e.deltaY) > Math.abs(e.deltaX) * 1 || this.axis === "y" && Math.abs(e.deltaX) > Math.abs(e.deltaY) * 1))
136
136
  if (e.preventDefault(), a = (this.axis === "max" ? Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY : this.axis === "x" ? e.deltaX : e.deltaY) * this.speed, e.stopPropagation(), this.debounce) {
137
137
  const r = Date.now();
138
- if (r - t(this, H) > 40 && (a = 100 * Math.sign(a)), i(this, H, r), Math.abs(a) < 100 || t(this, v))
138
+ if (r - t(this, H) > 40 && (a = 100 * Math.sign(a)), i(this, H, r), Math.abs(a) < 100 || t(this, M))
139
139
  return;
140
- this.changeEvent.notify("wheel", a, e), i(this, v, setTimeout(() => {
141
- i(this, v, void 0);
140
+ this.changeEvent.notify("wheel", a, e), i(this, M, setTimeout(() => {
141
+ i(this, M, void 0);
142
142
  }, 80));
143
143
  } else
144
144
  this.changeEvent.notify("wheel", a, e);
@@ -158,39 +158,39 @@ class me extends B {
158
158
  b && (t(this, D).removeEventListener(
159
159
  "wheel",
160
160
  t(this, N)
161
- ), clearTimeout(t(this, v)));
161
+ ), clearTimeout(t(this, M)));
162
162
  }
163
163
  }
164
- D = new WeakMap(), v = new WeakMap(), H = new WeakMap(), N = new WeakMap();
165
- var M, o, l, z, y;
164
+ D = new WeakMap(), M = new WeakMap(), H = new WeakMap(), N = new WeakMap();
165
+ var v, o, l, z, E;
166
166
  const x = class x extends B {
167
167
  constructor(e) {
168
168
  super();
169
169
  s(this, o);
170
170
  s(this, l);
171
171
  s(this, z);
172
- s(this, y);
172
+ s(this, E);
173
173
  this.inertion = 1, i(this, o, null), i(this, l, 0), i(this, z, (a) => {
174
- if (a.composedPath().find(
174
+ if (a.button !== 0 || a.composedPath().find(
175
175
  (m) => m instanceof HTMLElement && m.hasAttribute("drag-dead-zone")
176
176
  ))
177
177
  return;
178
- this.swipe || k.unsubscribe(t(this, y));
178
+ this.swipe || k.unsubscribe(t(this, E));
179
179
  let r = a, F = !1;
180
180
  i(this, l, 0), document.documentElement.classList.add("grabbing");
181
181
  let R = 0, W = 0;
182
182
  $(
183
183
  (m) => {
184
- t(x, M) && t(x, M) !== t(this, o) || (R = r.x - m.x, W = r.y - m.y, this.axis === "x" ? i(this, l, R) : i(this, l, W), r = m, F = this.axis === "x" && Math.abs(R) > Math.abs(W) || this.axis === "y" && Math.abs(W) > Math.abs(R), F && (document.documentElement.classList.add("dragging"), i(x, M, t(this, o)), this.changeEvent.notify("drag", t(this, l), m)));
184
+ t(x, v) && t(x, v) !== t(this, o) || (R = r.x - m.x, W = r.y - m.y, this.axis === "x" ? i(this, l, R) : i(this, l, W), r = m, F = this.axis === "x" && Math.abs(R) > Math.abs(W) || this.axis === "y" && Math.abs(W) > Math.abs(R), F && (document.documentElement.classList.add("dragging"), i(x, v, t(this, o)), this.changeEvent.notify("drag", t(this, l), m)));
185
185
  },
186
186
  (m) => {
187
- i(x, M, null), F && !this.swipe && this.inertion ? (i(this, l, t(this, l) * this.inertion), k.subscribe(t(this, y), {
187
+ i(x, v, null), F && !this.swipe && this.inertion ? (i(this, l, t(this, l) * this.inertion), k.subscribe(t(this, E), {
188
188
  order: _.CONTROLS - 1
189
189
  })) : this.swipe && this.changeEvent.notify("drag-end", t(this, l), m), document.documentElement.classList.remove("grabbing"), document.documentElement.classList.remove("dragging");
190
190
  }
191
191
  );
192
- }), i(this, y, () => {
193
- Math.floor(Math.abs(t(this, l))) || k.unsubscribe(t(this, y)), i(this, l, t(this, l) * 0.95), i(this, l, p(t(this, l), 3)), this.changeEvent.notify("drag", t(this, l), null);
192
+ }), i(this, E, () => {
193
+ Math.floor(Math.abs(t(this, l))) || k.unsubscribe(t(this, E)), i(this, l, t(this, l) * 0.95), i(this, l, p(t(this, l), 3)), this.changeEvent.notify("drag", t(this, l), null);
194
194
  }), this.axis = (e == null ? void 0 : e.axis) || "y", this.swipe = (e == null ? void 0 : e.swipe) || !1, b && i(this, o, e != null && e.element && Q(e.element) || document.documentElement);
195
195
  }
196
196
  connect() {
@@ -200,10 +200,10 @@ const x = class x extends B {
200
200
  b && (t(this, o).removeEventListener(
201
201
  "pointerdown",
202
202
  t(this, z)
203
- ), k.unsubscribe(t(this, y)));
203
+ ), k.unsubscribe(t(this, E)));
204
204
  }
205
205
  };
206
- M = new WeakMap(), o = new WeakMap(), l = new WeakMap(), z = new WeakMap(), y = new WeakMap(), s(x, M, null);
206
+ v = new WeakMap(), o = new WeakMap(), l = new WeakMap(), z = new WeakMap(), E = new WeakMap(), s(x, v, null);
207
207
  let j = x;
208
208
  export {
209
209
  fe as AutoplayControls,
@@ -22,6 +22,7 @@ export interface MorphPreprocessorEntry extends MorphNavigationEntry {
22
22
  }
23
23
  export type MorphPreprocessor = (entry: MorphPreprocessorEntry) => void;
24
24
  export type MorphNavigationCallback = (entry: MorphNavigationEntry) => void;
25
+ export type MorphPathnameModifier = (pathname: string) => string;
25
26
  export interface MorphNavigateOptions {
26
27
  historyAction?: ChangeHistoryAction;
27
28
  centerScroll?: boolean;
@@ -42,6 +43,7 @@ export interface MorphEvents {
42
43
  export declare class Morph {
43
44
  #private;
44
45
  preprocessor?: MorphPreprocessor;
46
+ pathnameModifier?: MorphPathnameModifier;
45
47
  constructor(parameters?: Partial<MorphOptions>);
46
48
  get currentPathname(): string;
47
49
  get previousPathname(): string | undefined;
@@ -1 +1 @@
1
- "use strict";var Et=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),gt=n=>{throw TypeError(n)};var tt=(n,t,s)=>t.has(n)||gt("Cannot "+s);var e=(n,t,s)=>(tt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?gt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(tt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(tt(n,t,"access private method"),s);var M=(n,t,s)=>new Promise((i,u)=>{var f=c=>{try{T(s.next(c))}catch(g){u(g)}},O=c=>{try{T(s.throw(c))}catch(g){u(g)}},T=c=>c.done?i(c.value):Promise.resolve(c.value).then(f,O);T((s=s.apply(n,t)).next())});var vt=(n,t,s)=>(t=n[Et("asyncIterator")])?t.call(n):(n=n[Et("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=f=>new Promise((O,T,c)=>(f=u.call(n,f),c=f.done,Promise.resolve(f.value).then(g=>O({value:g,done:c}),T)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const yt=require("../index-Cqw2NKev.cjs"),j=require("../events-KVanG9sR.cjs"),Mt=require("../polyfills-Df4r-ETT.cjs"),Ht=require("../scroll-H9zqFeML.cjs"),Q=require("../url-CLvdjbII.cjs"),xt=require("../css-value-parser/index.cjs");class wt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}yt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",wt);var b,h,H,U,F;class Lt{constructor(t,s){o(this,b);o(this,h);o(this,H);o(this,U,t=>{t.preventDefault();const s=e(this,h).getAttribute("data-history-action")||"push",i=e(this,h).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),f=u?xt.cssValueParser.parse(u):void 0,O=e(this,h).hasAttribute("data-revalidate");e(this,b).navigate(e(this,H),{historyAction:s,centerScroll:i,offsetScroll:f,revalidate:O})});o(this,F,()=>{e(this,b).prefetch(e(this,H)),e(this,h).removeEventListener("pointerenter",e(this,F))});a(this,b,s),a(this,h,t),a(this,H,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,U)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,F))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,b).normalizePath(t),i=e(this,b).normalizePath(e(this,H));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,U)),e(this,h).removeEventListener("pointerenter",e(this,F)),e(this,h).classList.remove("current")}}b=new WeakMap,h=new WeakMap,H=new WeakMap,U=new WeakMap,F=new WeakMap;var x,I,p,N,D,P;class St{constructor(t,s,i){o(this,x);o(this,I);o(this,p,{x:0,y:0});o(this,N);o(this,D,null);o(this,P,null);a(this,x,t),a(this,I,s),a(this,N,i.cloneNode(!0))}get pathname(){return e(this,I)}get scrollState(){return e(this,p)}get document(){return e(this,P)}cloneDocument(){a(this,P,(e(this,D)||e(this,N)).cloneNode(!0))}get title(){let t="";if(e(this,P).title)t=e(this,P).title;else{const s=e(this,P).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,D,null)}saveScrollState(){e(this,N).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,x).scrollElement.scrollLeft,e(this,p).y=e(this,x).scrollElement.scrollTop)}saveDocumentState(){e(this,N).documentElement.hasAttribute("data-no-page-restoration")?a(this,D,null):a(this,D,document.cloneNode(!0))}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}x=new WeakMap,I=new WeakMap,p=new WeakMap,N=new WeakMap,D=new WeakMap,P=new WeakMap;var A,_,E,X,C,m,K,R,k,L,V,q,l,et,st,it,bt,nt,rt,ot,at,Z,B;class Nt{constructor(t){o(this,l);o(this,A,null);o(this,_,null);o(this,E,[]);o(this,X,new DOMParser);o(this,C);o(this,m,null);o(this,K);o(this,R,[]);o(this,k,!1);o(this,L,null);o(this,V,new Map);o(this,q,null);o(this,Z,t=>M(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,k,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,k,!1))}));o(this,B,()=>{const t=e(this,L).scrollTop,s=e(this,L).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),j.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(yt.isBrowser){a(this,A,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,_,d(this,l,it).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,m,s.pathname),e(this,V).set(e(this,m),new St(this,e(this,m),document)),document.documentElement.setAttribute("data-current-pathname",e(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,Z)),Q.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters,hash:s.hash}),a(this,q,new wt),d(this,l,ot).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,K)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}normalizePath(t){return Q.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t){return M(this,null,function*(){const s=this.normalizePath(t);d(this,l,st).call(this,s.pathname)})}navigate(O){return M(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f}={}){if(e(this,R).length)return;const T=this.normalizePath(t);let{pathname:c,hash:g,parameters:Pt,leaf:At}=T;if(e(this,C)===c||e(this,m)===c){e(this,k)||d(this,l,at).call(this,g||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,C,c),e(this,E).forEach(z=>{z.checkCurrent(c)});try{let z=!0;if(this.preprocessor)try{yield new Promise((r,y)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:c,resolve:r,reject:y})})}catch(r){r?console.error(r):console.log("Route change canceled"),z=!1}if(!z||e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}const lt=yield d(this,l,et).call(this,e(this,m)),S=yield d(this,l,et).call(this,c,f);if(e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}lt.saveScrollState(),lt.saveDocumentState(),e(this,k)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),e(this,q).textContent=S.title,document.body.appendChild(e(this,q));const ct={pathname:c};j.dispatchEvent(document,"morphStart",{detail:ct});const ht=Array.from(document.head.children),ut=Array.from(S.document.head.children),dt=d(this,l,bt).call(this,ht,ut),Ct=d(this,l,nt).call(this,ht,dt),Y=d(this,l,nt).call(this,ut,dt);Y.forEach((r,y)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=r.getAttribute("src"),Y[y]=w}}),Y.forEach(r=>{document.head.appendChild(r)});const $=Y.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,l,rt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&$.length&&(yield new Promise(r=>M(this,null,function*(){let y=0;try{for(var w=vt($),ft,W,pt;ft=!(W=yield w.next()).done;ft=!1){const G=W.value;G.onload=()=>{y++,y===$.length&&r()}}}catch(W){pt=[W]}finally{try{ft&&(W=w.return)&&(yield W.call(w))}finally{if(pt)throw pt[0]}}})));const mt=[];Ct.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,l,rt).call(this,r)?mt.push(r):r.remove())});const kt=d(this,l,it).call(this,S.document.body);d(this,l,ot).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c),document.documentElement.setAttribute("data-current-leaf",At),Q.changeHistory({action:s,pathname:c,searchParameters:Pt,hash:g}),e(this,q).remove(),a(this,K,e(this,m)),a(this,m,c),e(this,_).forEach((r,y)=>{const w=kt[y],ft=getComputedStyle(r).getPropertyValue("--morph-duration"),W=[...w.childNodes];if(ft){const pt=[...r.childNodes];pt.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),r.prepend(...W),Mt.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const G={morphElement:r,pathname:c};j.dispatchEvent(document,"morphNewChildrenAdded",{detail:G});const Tt=new Promise(v=>{setTimeout(()=>{pt.forEach(J=>J.remove()),W.forEach(J=>{J instanceof HTMLElement&&J.classList.remove("in","new")}),j.dispatchEvent(document,"morphOldChildrenRemoved",{detail:G}),v()},(parseFloat(ft)||0)*1e3+10)});e(this,R).push(Tt)}else r.innerHTML="",r.append(...W)}),g?(S.clearScrollState(),d(this,l,at).call(this,g,{centerScroll:i,offsetScroll:u})):e(this,k)&&S.restoreScrollPosition(),yield Promise.all(e(this,R)),mt.forEach(r=>r.remove()),a(this,R,[]),this.findLinks(),j.dispatchEvent(document,"morphComplete",{detail:ct}),window.dispatchEvent(new Event("resize"))}catch(z){console.error(z)}a(this,C,void 0)})}addLink(t){e(this,E).push(new Lt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var i;return((i=s.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,E).forEach(s=>s.destroy()),a(this,E,t.map(s=>new Lt(s,this)))}}A=new WeakMap,_=new WeakMap,E=new WeakMap,X=new WeakMap,C=new WeakMap,m=new WeakMap,K=new WeakMap,R=new WeakMap,k=new WeakMap,L=new WeakMap,V=new WeakMap,q=new WeakMap,l=new WeakSet,et=function(t,s=!1){return M(this,null,function*(){let i=e(this,V).get(t);return(!i||s)&&(i=yield d(this,l,st).call(this,t)),i})},st=function(t){return M(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,X).parseFromString(i,"text/html"),f=new St(this,t,u);return e(this,V).set(t,f),f})},it=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},bt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},nt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},rt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},ot=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,B)),a(this,L,t.querySelector(e(this,A).scrollSelector)||t.documentElement),(i=e(this,L))==null||i.addEventListener("scroll",e(this,B)),e(this,B).call(this)},at=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Ht.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Z=new WeakMap,B=new WeakMap;exports.Morph=Nt;
1
+ "use strict";var gt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),vt=n=>{throw TypeError(n)};var tt=(n,t,s)=>t.has(n)||vt("Cannot "+s);var e=(n,t,s)=>(tt(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>(tt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>(tt(n,t,"access private method"),s);var T=(n,t,s)=>new Promise((i,u)=>{var f=c=>{try{M(s.next(c))}catch(g){u(g)}},O=c=>{try{M(s.throw(c))}catch(g){u(g)}},M=c=>c.done?i(c.value):Promise.resolve(c.value).then(f,O);M((s=s.apply(n,t)).next())});var Lt=(n,t,s)=>(t=n[gt("asyncIterator")])?t.call(n):(n=n[gt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=f=>new Promise((O,M,c)=>(f=u.call(n,f),c=f.done,Promise.resolve(f.value).then(g=>O({value:g,done:c}),M)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const wt=require("../index-Cqw2NKev.cjs"),j=require("../events-KVanG9sR.cjs"),Ht=require("../polyfills-Df4r-ETT.cjs"),xt=require("../scroll-H9zqFeML.cjs"),Q=require("../url-CLvdjbII.cjs"),Nt=require("../css-value-parser/index.cjs");class bt extends HTMLElement{connectedCallback(){const t={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,i]of Object.entries(t))this.setAttribute(s,i)}}wt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",bt);var b,h,H,U,F;class St{constructor(t,s){o(this,b);o(this,h);o(this,H);o(this,U,t=>{t.preventDefault();const s=e(this,h).getAttribute("data-history-action")||"push",i=e(this,h).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,h)).getPropertyValue("--offset-scroll").trim(),f=u?Nt.cssValueParser.parse(u):void 0,O=e(this,h).hasAttribute("data-revalidate");e(this,b).navigate(e(this,H),{historyAction:s,centerScroll:i,offsetScroll:f,revalidate:O})});o(this,F,()=>{e(this,b).prefetch(e(this,H)),e(this,h).removeEventListener("pointerenter",e(this,F))});a(this,b,s),a(this,h,t),a(this,H,e(this,h).getAttribute("href")||"/"),e(this,h).addEventListener("click",e(this,U)),this.checkCurrent(location.pathname),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,F))}get element(){return e(this,h)}checkCurrent(t){const s=e(this,b).normalizePath(t),i=e(this,b).normalizePath(e(this,H));e(this,h).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,h).classList.add("current"):i.pathname===s.pathname?e(this,h).classList.add("current"):e(this,h).classList.remove("current")}destroy(){e(this,h).removeEventListener("click",e(this,U)),e(this,h).removeEventListener("pointerenter",e(this,F)),e(this,h).classList.remove("current")}}b=new WeakMap,h=new WeakMap,H=new WeakMap,U=new WeakMap,F=new WeakMap;var x,I,p,N,D,P;class yt{constructor(t,s,i){o(this,x);o(this,I);o(this,p,{x:0,y:0});o(this,N);o(this,D,null);o(this,P,null);a(this,x,t),a(this,I,s),a(this,N,i.cloneNode(!0))}get pathname(){return e(this,I)}get scrollState(){return e(this,p)}get document(){return e(this,P)}cloneDocument(){a(this,P,(e(this,D)||e(this,N)).cloneNode(!0))}get title(){let t="";if(e(this,P).title)t=e(this,P).title;else{const s=e(this,P).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,I)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,D,null)}saveScrollState(){e(this,N).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,x).scrollElement.scrollLeft,e(this,p).y=e(this,x).scrollElement.scrollTop)}saveDocumentState(){e(this,N).documentElement.hasAttribute("data-no-page-restoration")?a(this,D,null):a(this,D,document.cloneNode(!0))}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}x=new WeakMap,I=new WeakMap,p=new WeakMap,N=new WeakMap,D=new WeakMap,P=new WeakMap;var A,_,E,X,C,m,K,R,k,L,V,q,l,et,st,it,Pt,nt,rt,ot,at,Z,B;class Dt{constructor(t){o(this,l);o(this,A,null);o(this,_,null);o(this,E,[]);o(this,X,new DOMParser);o(this,C);o(this,m,null);o(this,K);o(this,R,[]);o(this,k,!1);o(this,L,null);o(this,V,new Map);o(this,q,null);o(this,Z,t=>T(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),a(this,k,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,k,!1))}));o(this,B,()=>{const t=e(this,L).scrollTop,s=e(this,L).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),j.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(wt.isBrowser){a(this,A,{base:Q.normalizeBase(t==null?void 0:t.base),waitForHeadToLoad:(t==null?void 0:t.waitForHeadToLoad)!==!1,cachePages:(t==null?void 0:t.cachePages)!==!1,trailingSlash:(t==null?void 0:t.trailingSlash)||!1,scrollSelector:(t==null?void 0:t.scrollSelector)||"body"}),a(this,_,d(this,l,it).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);a(this,m,s.pathname),e(this,V).set(e(this,m),new yt(this,e(this,m),document)),document.documentElement.setAttribute("data-current-pathname",e(this,m)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,Z)),Q.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters,hash:s.hash}),a(this,q,new bt),d(this,l,ot).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,K)}get links(){return e(this,E)}get scrollElement(){return e(this,L)}normalizePath(t){return Q.splitPath(t,{base:e(this,A).base,trailingSlash:e(this,A).trailingSlash})}prefetch(t){return T(this,null,function*(){const s=this.normalizePath(t);d(this,l,st).call(this,s.pathname)})}navigate(O){return T(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f}={}){var lt;if(e(this,R).length)return;const M=this.normalizePath(((lt=this.pathnameModifier)==null?void 0:lt.call(this,t))||t);let{pathname:c,hash:g,parameters:At,leaf:Ct}=M;if(e(this,C)===c||e(this,m)===c){e(this,k)||d(this,l,at).call(this,g||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,C,c),e(this,E).forEach(z=>{z.checkCurrent(c)});try{let z=!0;if(this.preprocessor)try{yield new Promise((r,y)=>{var w;(w=this.preprocessor)==null||w.call(this,{pathname:c,resolve:r,reject:y})})}catch(r){r?console.error(r):console.log("Route change canceled"),z=!1}if(!z||e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}const ct=yield d(this,l,et).call(this,e(this,m)),S=yield d(this,l,et).call(this,c,f);if(e(this,C)!==c){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}ct.saveScrollState(),ct.saveDocumentState(),e(this,k)||(S.clearScrollState(),S.clearDocumentState()),S.cloneDocument(),e(this,q).textContent=S.title,document.body.appendChild(e(this,q));const ht={pathname:c};j.dispatchEvent(document,"morphStart",{detail:ht});const ut=Array.from(document.head.children),dt=Array.from(S.document.head.children),mt=d(this,l,Pt).call(this,ut,dt),kt=d(this,l,nt).call(this,ut,mt),Y=d(this,l,nt).call(this,dt,mt);Y.forEach((r,y)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const w=document.createElement("script");w.type="module",w.src=r.getAttribute("src"),Y[y]=w}}),Y.forEach(r=>{document.head.appendChild(r)});const $=Y.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,l,rt).call(this,r))return!0});e(this,A).waitForHeadToLoad&&$.length&&(yield new Promise(r=>T(this,null,function*(){let y=0;try{for(var w=Lt($),pt,W,Et;pt=!(W=yield w.next()).done;pt=!1){const G=W.value;G.onload=()=>{y++,y===$.length&&r()}}}catch(W){Et=[W]}finally{try{pt&&(W=w.return)&&(yield W.call(w))}finally{if(Et)throw Et[0]}}})));const ft=[];kt.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,l,rt).call(this,r)?ft.push(r):r.remove())});const Mt=d(this,l,it).call(this,S.document.body);d(this,l,ot).call(this,S.document),document.documentElement.setAttribute("data-current-pathname",c),document.documentElement.setAttribute("data-current-leaf",Ct),Q.changeHistory({action:s,pathname:c,searchParameters:At,hash:g}),e(this,q).remove(),a(this,K,e(this,m)),a(this,m,c),e(this,_).forEach((r,y)=>{const w=Mt[y],pt=getComputedStyle(r).getPropertyValue("--morph-duration"),W=[...w.childNodes];if(pt){const Et=[...r.childNodes];Et.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),r.prepend(...W),Ht.requestIdleCallback(()=>{W.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const G={morphElement:r,pathname:c};j.dispatchEvent(document,"morphNewChildrenAdded",{detail:G});const Tt=new Promise(v=>{setTimeout(()=>{Et.forEach(J=>J.remove()),W.forEach(J=>{J instanceof HTMLElement&&J.classList.remove("in","new")}),j.dispatchEvent(document,"morphOldChildrenRemoved",{detail:G}),v()},(parseFloat(pt)||0)*1e3+10)});e(this,R).push(Tt)}else r.innerHTML="",r.append(...W)}),g?(S.clearScrollState(),d(this,l,at).call(this,g,{centerScroll:i,offsetScroll:u})):e(this,k)&&S.restoreScrollPosition(),yield Promise.all(e(this,R)),ft.forEach(r=>r.remove()),a(this,R,[]),this.findLinks(),j.dispatchEvent(document,"morphComplete",{detail:ht}),window.dispatchEvent(new Event("resize"))}catch(z){console.error(z)}a(this,C,void 0)})}addLink(t){e(this,E).push(new St(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){a(this,E,e(this,E).filter(s=>s.element===t?(s.destroy(),!1):!0))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(s=>{var i;return((i=s.getAttribute("href"))==null?void 0:i.startsWith("/"))&&!s.hasAttribute("download")&&!s.hasAttribute("data-morph-skip")&&!s.closest("[data-morph-skip]")});e(this,E).forEach(s=>s.destroy()),a(this,E,t.map(s=>new St(s,this)))}}A=new WeakMap,_=new WeakMap,E=new WeakMap,X=new WeakMap,C=new WeakMap,m=new WeakMap,K=new WeakMap,R=new WeakMap,k=new WeakMap,L=new WeakMap,V=new WeakMap,q=new WeakMap,l=new WeakSet,et=function(t,s=!1){return T(this,null,function*(){let i=e(this,V).get(t);return(!i||s)&&(i=yield d(this,l,st).call(this,t)),i})},st=function(t){return T(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,X).parseFromString(i,"text/html"),f=new yt(this,t,u);return e(this,V).set(t,f),f})},it=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Pt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},nt=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},rt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},ot=function(t){var s,i;(s=e(this,L))==null||s.removeEventListener("scroll",e(this,B)),a(this,L,t.querySelector(e(this,A).scrollSelector)||t.documentElement),(i=e(this,L))==null||i.addEventListener("scroll",e(this,B)),e(this,B).call(this)},at=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&xt.scrollToElement(i,{scrollElement:e(this,L),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Z=new WeakMap,B=new WeakMap;exports.Morph=Dt;
@@ -1,8 +1,8 @@
1
- var pt = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), Et = (r) => {
1
+ var Et = (r, t) => (t = Symbol[r]) ? t : Symbol.for("Symbol." + r), gt = (r) => {
2
2
  throw TypeError(r);
3
3
  };
4
- var $ = (r, t, s) => t.has(r) || Et("Cannot " + s);
5
- var e = (r, t, s) => ($(r, t, "read from private field"), s ? s.call(r) : t.get(r)), o = (r, t, s) => t.has(r) ? Et("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), a = (r, t, s, i) => ($(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), d = (r, t, s) => ($(r, t, "access private method"), s);
4
+ var $ = (r, t, s) => t.has(r) || gt("Cannot " + s);
5
+ var e = (r, t, s) => ($(r, t, "read from private field"), s ? s.call(r) : t.get(r)), o = (r, t, s) => t.has(r) ? gt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, s), a = (r, t, s, i) => ($(r, t, "write to private field"), i ? i.call(r, s) : t.set(r, s), s), d = (r, t, s) => ($(r, t, "access private method"), s);
6
6
  var M = (r, t, s) => new Promise((i, u) => {
7
7
  var f = (h) => {
8
8
  try {
@@ -19,14 +19,14 @@ var M = (r, t, s) => new Promise((i, u) => {
19
19
  }, T = (h) => h.done ? i(h.value) : Promise.resolve(h.value).then(f, O);
20
20
  T((s = s.apply(r, t)).next());
21
21
  });
22
- var gt = (r, t, s) => (t = r[pt("asyncIterator")]) ? t.call(r) : (r = r[pt("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (f) => new Promise((O, T, h) => (f = u.call(r, f), h = f.done, Promise.resolve(f.value).then((g) => O({ value: g, done: h }), T)))), s("next"), s("return"), t);
23
- import { i as yt } from "../index-euf5anj6.js";
22
+ var vt = (r, t, s) => (t = r[Et("asyncIterator")]) ? t.call(r) : (r = r[Et("iterator")](), t = {}, s = (i, u) => (u = r[i]) && (t[i] = (f) => new Promise((O, T, h) => (f = u.call(r, f), h = f.done, Promise.resolve(f.value).then((g) => O({ value: g, done: h }), T)))), s("next"), s("return"), t);
23
+ import { i as wt } from "../index-euf5anj6.js";
24
24
  import { d as U } from "../events-CsVF98U6.js";
25
- import { r as Mt } from "../polyfills-DJrTJQky.js";
26
- import { s as Ht } from "../scroll-myLAt-Tq.js";
27
- import { n as xt, c as vt, s as Nt } from "../url-CfcHdBT6.js";
28
- import { cssValueParser as Dt } from "../css-value-parser/index.js";
29
- class wt extends HTMLElement {
25
+ import { r as Ht } from "../polyfills-DJrTJQky.js";
26
+ import { s as xt } from "../scroll-myLAt-Tq.js";
27
+ import { n as Nt, c as Lt, s as Dt } from "../url-CfcHdBT6.js";
28
+ import { cssValueParser as Rt } from "../css-value-parser/index.js";
29
+ class bt extends HTMLElement {
30
30
  connectedCallback() {
31
31
  const t = {
32
32
  "aria-live": "assertive",
@@ -37,9 +37,9 @@ class wt extends HTMLElement {
37
37
  this.setAttribute(s, i);
38
38
  }
39
39
  }
40
- yt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", wt);
40
+ wt && !customElements.get("morph-announcer") && customElements.define("morph-announcer", bt);
41
41
  var b, c, H, j, F;
42
- class Lt {
42
+ class St {
43
43
  constructor(t, s) {
44
44
  o(this, b);
45
45
  o(this, c);
@@ -48,7 +48,7 @@ class Lt {
48
48
  t.preventDefault();
49
49
  const s = e(this, c).getAttribute(
50
50
  "data-history-action"
51
- ) || "push", i = e(this, c).hasAttribute("data-center-scroll"), u = getComputedStyle(e(this, c)).getPropertyValue("--offset-scroll").trim(), f = u ? Dt.parse(u) : void 0, O = e(this, c).hasAttribute("data-revalidate");
51
+ ) || "push", i = e(this, c).hasAttribute("data-center-scroll"), u = getComputedStyle(e(this, c)).getPropertyValue("--offset-scroll").trim(), f = u ? Rt.parse(u) : void 0, O = e(this, c).hasAttribute("data-revalidate");
52
52
  e(this, b).navigate(e(this, H), {
53
53
  historyAction: s,
54
54
  centerScroll: i,
@@ -74,7 +74,7 @@ class Lt {
74
74
  }
75
75
  b = new WeakMap(), c = new WeakMap(), H = new WeakMap(), j = new WeakMap(), F = new WeakMap();
76
76
  var x, I, p, N, D, P;
77
- class St {
77
+ class yt {
78
78
  constructor(t, s, i) {
79
79
  o(this, x);
80
80
  o(this, I);
@@ -130,8 +130,8 @@ class St {
130
130
  }
131
131
  }
132
132
  x = new WeakMap(), I = new WeakMap(), p = new WeakMap(), N = new WeakMap(), D = new WeakMap(), P = new WeakMap();
133
- var A, K, E, X, C, m, Y, R, k, L, V, z, l, tt, et, st, bt, it, rt, nt, ot, Z, B;
134
- class Ot {
133
+ var A, K, E, X, C, m, Y, R, k, L, V, z, l, tt, et, st, Pt, it, rt, nt, ot, Z, B;
134
+ class Wt {
135
135
  constructor(t) {
136
136
  o(this, l);
137
137
  o(this, A, null);
@@ -159,9 +159,9 @@ class Ot {
159
159
  }
160
160
  });
161
161
  });
162
- if (yt) {
162
+ if (wt) {
163
163
  a(this, A, {
164
- base: xt(t == null ? void 0 : t.base),
164
+ base: Nt(t == null ? void 0 : t.base),
165
165
  waitForHeadToLoad: (t == null ? void 0 : t.waitForHeadToLoad) !== !1,
166
166
  cachePages: (t == null ? void 0 : t.cachePages) !== !1,
167
167
  trailingSlash: (t == null ? void 0 : t.trailingSlash) || !1,
@@ -172,19 +172,19 @@ class Ot {
172
172
  );
173
173
  a(this, m, s.pathname), e(this, V).set(
174
174
  e(this, m),
175
- new St(this, e(this, m), document)
175
+ new yt(this, e(this, m), document)
176
176
  ), document.documentElement.setAttribute(
177
177
  "data-current-pathname",
178
178
  e(this, m)
179
179
  ), document.documentElement.setAttribute(
180
180
  "data-current-leaf",
181
181
  s.leaf
182
- ), this.findLinks(), addEventListener("popstate", e(this, Z)), vt({
182
+ ), this.findLinks(), addEventListener("popstate", e(this, Z)), Lt({
183
183
  action: "replace",
184
184
  pathname: e(this, m),
185
185
  searchParameters: s.parameters,
186
186
  hash: s.hash
187
- }), a(this, z, new wt()), d(this, l, nt).call(this, document);
187
+ }), a(this, z, new bt()), d(this, l, nt).call(this, document);
188
188
  }
189
189
  }
190
190
  get currentPathname() {
@@ -200,7 +200,7 @@ class Ot {
200
200
  return e(this, L);
201
201
  }
202
202
  normalizePath(t) {
203
- return Nt(t, {
203
+ return Dt(t, {
204
204
  base: e(this, A).base,
205
205
  trailingSlash: e(this, A).trailingSlash
206
206
  });
@@ -218,10 +218,11 @@ class Ot {
218
218
  offsetScroll: u,
219
219
  revalidate: f
220
220
  } = {}) {
221
+ var at;
221
222
  if (e(this, R).length)
222
223
  return;
223
- const T = this.normalizePath(t);
224
- let { pathname: h, hash: g, parameters: Pt, leaf: At } = T;
224
+ const T = this.normalizePath(((at = this.pathnameModifier) == null ? void 0 : at.call(this, t)) || t);
225
+ let { pathname: h, hash: g, parameters: At, leaf: Ct } = T;
225
226
  if (e(this, C) === h || e(this, m) === h) {
226
227
  e(this, k) || d(this, l, ot).call(this, g || 0, {
227
228
  centerScroll: i,
@@ -254,21 +255,21 @@ class Ot {
254
255
  });
255
256
  return;
256
257
  }
257
- const at = yield d(this, l, tt).call(this, e(this, m)), S = yield d(this, l, tt).call(this, h, f);
258
+ const lt = yield d(this, l, tt).call(this, e(this, m)), S = yield d(this, l, tt).call(this, h, f);
258
259
  if (e(this, C) !== h) {
259
260
  e(this, E).forEach((n) => {
260
261
  n.checkCurrent(e(this, m));
261
262
  });
262
263
  return;
263
264
  }
264
- at.saveScrollState(), at.saveDocumentState(), e(this, k) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, z).textContent = S.title, document.body.appendChild(e(this, z));
265
- const lt = {
265
+ lt.saveScrollState(), lt.saveDocumentState(), e(this, k) || (S.clearScrollState(), S.clearDocumentState()), S.cloneDocument(), e(this, z).textContent = S.title, document.body.appendChild(e(this, z));
266
+ const ht = {
266
267
  pathname: h
267
268
  };
268
269
  U(document, "morphStart", {
269
- detail: lt
270
+ detail: ht
270
271
  });
271
- const ht = Array.from(document.head.children), ct = Array.from(S.document.head.children), ut = d(this, l, bt).call(this, ht, ct), Ct = d(this, l, it).call(this, ht, ut), G = d(this, l, it).call(this, ct, ut);
272
+ const ct = Array.from(document.head.children), ut = Array.from(S.document.head.children), dt = d(this, l, Pt).call(this, ct, ut), kt = d(this, l, it).call(this, ct, dt), G = d(this, l, it).call(this, ut, dt);
272
273
  G.forEach((n, y) => {
273
274
  if (n.tagName === "SCRIPT" && n.getAttribute("src")) {
274
275
  const w = document.createElement("script");
@@ -286,42 +287,42 @@ class Ot {
286
287
  e(this, A).waitForHeadToLoad && _.length && (yield new Promise((n) => M(this, null, function* () {
287
288
  let y = 0;
288
289
  try {
289
- for (var w = gt(_), mt, W, ft; mt = !(W = yield w.next()).done; mt = !1) {
290
+ for (var w = vt(_), ft, W, pt; ft = !(W = yield w.next()).done; ft = !1) {
290
291
  const J = W.value;
291
292
  J.onload = () => {
292
293
  y++, y === _.length && n();
293
294
  };
294
295
  }
295
296
  } catch (W) {
296
- ft = [W];
297
+ pt = [W];
297
298
  } finally {
298
299
  try {
299
- mt && (W = w.return) && (yield W.call(w));
300
+ ft && (W = w.return) && (yield W.call(w));
300
301
  } finally {
301
- if (ft)
302
- throw ft[0];
302
+ if (pt)
303
+ throw pt[0];
303
304
  }
304
305
  }
305
306
  })));
306
- const dt = [];
307
- Ct.forEach((n) => {
308
- n.hasAttribute("data-permanent") || (d(this, l, rt).call(this, n) ? dt.push(n) : n.remove());
307
+ const mt = [];
308
+ kt.forEach((n) => {
309
+ n.hasAttribute("data-permanent") || (d(this, l, rt).call(this, n) ? mt.push(n) : n.remove());
309
310
  });
310
- const kt = d(this, l, st).call(this, S.document.body);
311
- d(this, l, nt).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", h), document.documentElement.setAttribute("data-current-leaf", At), vt({
311
+ const Tt = d(this, l, st).call(this, S.document.body);
312
+ d(this, l, nt).call(this, S.document), document.documentElement.setAttribute("data-current-pathname", h), document.documentElement.setAttribute("data-current-leaf", Ct), Lt({
312
313
  action: s,
313
314
  pathname: h,
314
- searchParameters: Pt,
315
+ searchParameters: At,
315
316
  hash: g
316
317
  }), e(this, z).remove(), a(this, Y, e(this, m)), a(this, m, h), e(this, K).forEach((n, y) => {
317
- const w = kt[y], mt = getComputedStyle(n).getPropertyValue("--morph-duration"), W = [...w.childNodes];
318
- if (mt) {
319
- const ft = [...n.childNodes];
320
- ft.forEach((v) => {
318
+ const w = Tt[y], ft = getComputedStyle(n).getPropertyValue("--morph-duration"), W = [...w.childNodes];
319
+ if (ft) {
320
+ const pt = [...n.childNodes];
321
+ pt.forEach((v) => {
321
322
  v instanceof HTMLElement && v.classList.add("old");
322
323
  }), W.forEach((v) => {
323
324
  v instanceof HTMLElement && v.classList.add("new");
324
- }), n.prepend(...W), Mt(() => {
325
+ }), n.prepend(...W), Ht(() => {
325
326
  W.forEach((v) => {
326
327
  v instanceof HTMLElement && v.classList.add("in");
327
328
  });
@@ -333,20 +334,20 @@ class Ot {
333
334
  U(document, "morphNewChildrenAdded", {
334
335
  detail: J
335
336
  });
336
- const Tt = new Promise((v) => {
337
+ const Mt = new Promise((v) => {
337
338
  setTimeout(() => {
338
- ft.forEach((Q) => Q.remove()), W.forEach((Q) => {
339
+ pt.forEach((Q) => Q.remove()), W.forEach((Q) => {
339
340
  Q instanceof HTMLElement && Q.classList.remove("in", "new");
340
341
  }), U(document, "morphOldChildrenRemoved", {
341
342
  detail: J
342
343
  }), v();
343
- }, (parseFloat(mt) || 0) * 1e3 + 10);
344
+ }, (parseFloat(ft) || 0) * 1e3 + 10);
344
345
  });
345
- e(this, R).push(Tt);
346
+ e(this, R).push(Mt);
346
347
  } else
347
348
  n.innerHTML = "", n.append(...W);
348
- }), g ? (S.clearScrollState(), d(this, l, ot).call(this, g, { centerScroll: i, offsetScroll: u })) : e(this, k) && S.restoreScrollPosition(), yield Promise.all(e(this, R)), dt.forEach((n) => n.remove()), a(this, R, []), this.findLinks(), U(document, "morphComplete", {
349
- detail: lt
349
+ }), g ? (S.clearScrollState(), d(this, l, ot).call(this, g, { centerScroll: i, offsetScroll: u })) : e(this, k) && S.restoreScrollPosition(), yield Promise.all(e(this, R)), mt.forEach((n) => n.remove()), a(this, R, []), this.findLinks(), U(document, "morphComplete", {
350
+ detail: ht
350
351
  }), window.dispatchEvent(new Event("resize"));
351
352
  } catch (q) {
352
353
  console.error(q);
@@ -355,7 +356,7 @@ class Ot {
355
356
  });
356
357
  }
357
358
  addLink(t) {
358
- e(this, E).push(new Lt(t, this));
359
+ e(this, E).push(new St(t, this));
359
360
  }
360
361
  addLinks(t) {
361
362
  t.forEach((s) => {
@@ -374,7 +375,7 @@ class Ot {
374
375
  return ((i = s.getAttribute("href")) == null ? void 0 : i.startsWith("/")) && !s.hasAttribute("download") && !s.hasAttribute("data-morph-skip") && !s.closest("[data-morph-skip]");
375
376
  }
376
377
  );
377
- e(this, E).forEach((s) => s.destroy()), a(this, E, t.map((s) => new Lt(s, this)));
378
+ e(this, E).forEach((s) => s.destroy()), a(this, E, t.map((s) => new St(s, this)));
378
379
  }
379
380
  }
380
381
  A = new WeakMap(), K = new WeakMap(), E = new WeakMap(), X = new WeakMap(), C = new WeakMap(), m = new WeakMap(), Y = new WeakMap(), R = new WeakMap(), k = new WeakMap(), L = new WeakMap(), V = new WeakMap(), z = new WeakMap(), l = new WeakSet(), tt = function(t, s = !1) {
@@ -384,13 +385,13 @@ A = new WeakMap(), K = new WeakMap(), E = new WeakMap(), X = new WeakMap(), C =
384
385
  });
385
386
  }, et = function(t) {
386
387
  return M(this, null, function* () {
387
- const i = yield (yield fetch(t)).text(), u = e(this, X).parseFromString(i, "text/html"), f = new St(this, t, u);
388
+ const i = yield (yield fetch(t)).text(), u = e(this, X).parseFromString(i, "text/html"), f = new yt(this, t, u);
388
389
  return e(this, V).set(t, f), f;
389
390
  });
390
391
  }, st = function(t) {
391
392
  const s = [...t.querySelectorAll("[data-morph]")];
392
393
  return s.length ? s : [t];
393
- }, bt = function(t, s) {
394
+ }, Pt = function(t, s) {
394
395
  return t.filter(
395
396
  (i) => s.find(
396
397
  (u) => u.outerHTML === i.outerHTML
@@ -412,7 +413,7 @@ A = new WeakMap(), K = new WeakMap(), E = new WeakMap(), X = new WeakMap(), C =
412
413
  ), a(this, L, t.querySelector(e(this, A).scrollSelector) || t.documentElement), (i = e(this, L)) == null || i.addEventListener("scroll", e(this, B)), e(this, B).call(this);
413
414
  }, ot = function(t, s) {
414
415
  const i = typeof t == "string" ? document.getElementById(t) : t;
415
- (typeof i == "number" || i) && Ht(i, {
416
+ (typeof i == "number" || i) && xt(i, {
416
417
  scrollElement: e(this, L),
417
418
  behavior: (s == null ? void 0 : s.behavior) || "instant",
418
419
  center: s == null ? void 0 : s.centerScroll,
@@ -420,5 +421,5 @@ A = new WeakMap(), K = new WeakMap(), E = new WeakMap(), X = new WeakMap(), C =
420
421
  });
421
422
  }, Z = new WeakMap(), B = new WeakMap();
422
423
  export {
423
- Ot as Morph
424
+ Wt as Morph
424
425
  };