aptechka 0.64.9 → 0.65.0

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.
@@ -8,8 +8,8 @@ import { g as Z } from "./dom-CVWzyXPH.js";
8
8
  import "construct-style-sheets-polyfill";
9
9
  import { ticker as D } from "./ticker/index.js";
10
10
  import "./Store-0BVty6AZ.js";
11
- import { a as ee } from "./easings-BEmRlrDd.js";
12
- import { T as te } from "./Tweened-_pF0zXXN.js";
11
+ import { a as ee } from "./easings-DngMp9IN.js";
12
+ import { T as te } from "./Tweened-CtbUoAvI.js";
13
13
  import { s as ie } from "./gestures-CcXV6fCp.js";
14
14
  import { p as se } from "./number-CbdpfO3u.js";
15
15
  import { TICK_ORDER as he } from "./order/index.js";
@@ -15,7 +15,7 @@ var c = (a, r, e) => r in a ? O(a, r, { enumerable: !0, configurable: !0, writab
15
15
  }, g = (a, r) => b(a, x(r));
16
16
  var A = (a, r, e) => r.has(a) || f("Cannot " + e);
17
17
  var s = (a, r, e) => (A(a, r, "read from private field"), e ? e.call(a) : r.get(a)), n = (a, r, e) => r.has(a) ? f("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(a) : r.set(a, e), u = (a, r, e, i) => (A(a, r, "write to private field"), i ? i.call(a, e) : r.set(a, e), e);
18
- import { l as h, e as T } from "./easings-BEmRlrDd.js";
18
+ import { l as h, e as T } from "./easings-DngMp9IN.js";
19
19
  import { c as q } from "./math-BOBiC4TN.js";
20
20
  import { p as w } from "./number-CbdpfO3u.js";
21
21
  import { n as z } from "./polyfills-DJrTJQky.js";
@@ -1,6 +1,6 @@
1
1
  import { A as r } from "../Animation-D29tc5VS.js";
2
2
  import { D as m } from "../Damped-YrqW5V4w.js";
3
- import { T as t } from "../Tweened-_pF0zXXN.js";
3
+ import { T as t } from "../Tweened-CtbUoAvI.js";
4
4
  export {
5
5
  r as Animation,
6
6
  m as Damped,
@@ -1,4 +1,4 @@
1
- import { A as r, C as a, D as l, K as t, W as C } from "../DragControls-DGDUw6bM.js";
1
+ import { A as r, C as a, D as l, K as t, W as C } from "../DragControls-DNwpgJ9b.js";
2
2
  export {
3
3
  r as AutoplayControls,
4
4
  a as Controls,
@@ -0,0 +1,20 @@
1
+ import { whenDefined } from '../utils';
2
+ export type CustomElementDisconnectCallback = () => void;
3
+ export type CustomElementConnectCallback = () => void | CustomElementDisconnectCallback;
4
+ export interface CustomElementAttributeChangeCallbackEntry {
5
+ name: string;
6
+ oldValue: string | null;
7
+ newValue: string;
8
+ }
9
+ export type CustomElementAttributeChangeCallback = (entry: CustomElementAttributeChangeCallbackEntry) => void;
10
+ export type CustomElementQueryCallback<T extends Element = Element> = (element: T) => void | CustomElementDisconnectCallback;
11
+ export declare class CustomElement extends HTMLElement {
12
+ #private;
13
+ protected dependsOn(...args: Parameters<typeof whenDefined>): void;
14
+ protected onConnect(callback: CustomElementConnectCallback): void;
15
+ protected onDisconnect(callback: CustomElementDisconnectCallback): void;
16
+ protected onAttributeChange(callback: CustomElementAttributeChangeCallback): void;
17
+ protected connectedCallback(): Promise<void>;
18
+ protected disconnectedCallback(): void;
19
+ protected attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
20
+ }
@@ -1 +1 @@
1
- "use strict";var v=l=>{throw TypeError(l)};var k=(l,o,s)=>o.has(l)||v("Cannot "+s);var t=(l,o,s)=>(k(l,o,"read from private field"),s?s.call(l):o.get(l)),h=(l,o,s)=>o.has(l)?v("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(l):o.set(l,s),c=(l,o,s,e)=>(k(l,o,"write to private field"),e?e.call(l,s):o.set(l,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("../index-DekP7OZe.cjs"),H=require("../dom-JBOkFLTh.cjs"),w=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const E=require("../ticker/index.cjs");var i,n,m,a,r,d,f,y,p,u,g;class T extends HTMLElement{constructor(){super(...arguments);h(this,i,null);h(this,n,null);h(this,m,0);h(this,a,0);h(this,r,!1);h(this,d);h(this,f,()=>{this.classList.add("active"),clearTimeout(t(this,d));const e=(t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop)/t(this,a)*t(this,m);t(this,r)?t(this,n).style.transform=`translate3d(${e}px, 0px, 0px)`:t(this,n).style.transform=`translate3d(0px, ${e}px, 0px)`,c(this,d,setTimeout(()=>{this.classList.remove("active")},1e3))});h(this,y,()=>{const s=t(this,r)?this.offsetWidth:this.offsetHeight;c(this,a,t(this,r)?t(this,i).scrollWidth-t(this,i).offsetWidth:t(this,i).scrollHeight-t(this,i).offsetHeight);let e=s*s/(t(this,a)+s);e=Math.max(e,30),t(this,r)?(t(this,n).style.width=e+"px",t(this,n).style.height="100%"):(t(this,n).style.width="100%",t(this,n).style.height=e+"px"),c(this,m,s-e),t(this,r)&&!(t(this,i).scrollWidth>t(this,i).offsetWidth)||!t(this,r)&&!(t(this,i).scrollHeight>t(this,i).offsetHeight)?this.style.display="none":this.style.display="block"});h(this,p,s=>{document.documentElement.classList.add("grabbing");const e=t(this,r)?t(this,i).scrollLeft:t(this,i).scrollTop,b=t(this,r)?s.x:s.y;w.setupDrag(x=>{const q=t(this,a)/t(this,m),S=(t(this,r)?x.x-b:x.y-b)*q;t(this,r)?t(this,i).scroll({left:e+S,behavior:"instant"}):t(this,i).scroll({top:e+S,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});h(this,u,()=>{t(this,y).call(this)});h(this,g,s=>{s.isIntersecting?(E.ticker.subscribe(t(this,u),{maxFPS:5}),t(this,u).call(this)):E.ticker.unsubscribe(t(this,u))})}connectedCallback(){const s=this.getAttribute("data-scroll");c(this,r,this.hasAttribute("horisontal"));let e=null;s&&(s==="parent"?e=this.parentElement:e=document.querySelector(s)),e||(e=H.findScrollParentElement(this));const b=this.querySelector("[data-thumb]");e&&b&&(c(this,i,e),c(this,n,b),t(this,i).addEventListener("scroll",t(this,f)),t(this,n).addEventListener("pointerdown",t(this,p)),L.intersector.subscribe(this.parentElement,t(this,g)))}disconnectedCallback(){t(this,i).removeEventListener("scroll",t(this,f)),t(this,n).removeEventListener("pointerdown",t(this,p)),clearTimeout(t(this,d)),L.intersector.unsubscribe(t(this,g)),E.ticker.unsubscribe(t(this,u))}}i=new WeakMap,n=new WeakMap,m=new WeakMap,a=new WeakMap,r=new WeakMap,d=new WeakMap,f=new WeakMap,y=new WeakMap,p=new WeakMap,u=new WeakMap,g=new WeakMap;L.isBrowser&&!customElements.get("e-custom-scrollbar")&&customElements.define("e-custom-scrollbar",T);exports.CustomScrollbarElement=T;
1
+ "use strict";var T=n=>{throw TypeError(n)};var W=(n,l,e)=>l.has(n)||T("Cannot "+e);var t=(n,l,e)=>(W(n,l,"read from private field"),e?e.call(n):l.get(n)),r=(n,l,e)=>l.has(n)?T("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(n):l.set(n,e),u=(n,l,e,s)=>(W(n,l,"write to private field"),s?s.call(n,e):l.set(n,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("../index-DekP7OZe.cjs"),q=require("../dom-JBOkFLTh.cjs"),P=require("../gestures-C7gbKx11.cjs");require("construct-style-sheets-polyfill");const x=require("../ticker/index.cjs");var i,c,f,a,o,g,h,H,z,k,E,L,y,b,p;class w extends HTMLElement{constructor(){super(...arguments);r(this,h);r(this,i,null);r(this,c,null);r(this,f,0);r(this,a,0);r(this,o,!1);r(this,g);r(this,E,()=>{this.classList.add("active"),clearTimeout(t(this,g));const s=t(this,h,H)/t(this,a)*t(this,f);t(this,o)?t(this,c).style.transform=`translate3d(${s}px, 0px, 0px)`:t(this,c).style.transform=`translate3d(0px, ${s}px, 0px)`,u(this,g,setTimeout(()=>{this.classList.remove("active")},1e3))});r(this,L,()=>{const e=t(this,o)?this.offsetWidth:this.offsetHeight,s=t(this,h,z),m=t(this,h,k);u(this,a,s-m);let d=e*e/(t(this,a)+e);d=Math.max(d,30),t(this,o)?(t(this,c).style.width=d+"px",t(this,c).style.height="100%"):(t(this,c).style.width="100%",t(this,c).style.height=d+"px"),u(this,f,e-d),s<=m?this.style.display="none":this.style.display="block"});r(this,y,e=>{document.documentElement.classList.add("grabbing");const s=t(this,h,H),m=t(this,o)?e.x:e.y;P.setupDrag(d=>{const M=t(this,a)/t(this,f),v=(t(this,o)?d.x-m:d.y-m)*M;t(this,o)?t(this,i).scroll({left:s+v,behavior:"instant"}):t(this,i).scroll({top:s+v,behavior:"instant"})},()=>{document.documentElement.classList.remove("grabbing")})});r(this,b,()=>{t(this,L).call(this)});r(this,p,e=>{e.isIntersecting?(x.ticker.subscribe(t(this,b),{maxFPS:5}),t(this,b).call(this)):x.ticker.unsubscribe(t(this,b))})}connectedCallback(){const e=this.getAttribute("data-scroll");u(this,o,this.hasAttribute("horisontal"));let s=null;e&&(e==="parent"?s=this.parentElement:s=document.querySelector(e)),s||(s=q.findScrollParentElement(this),s===document.body&&(s=window));const m=this.querySelector("[data-thumb]");s&&m&&(u(this,i,s),u(this,c,m),t(this,i).addEventListener("scroll",t(this,E)),t(this,c).addEventListener("pointerdown",t(this,y)),S.intersector.subscribe(this.parentElement===document.body?this:this.parentElement,t(this,p)))}disconnectedCallback(){t(this,i).removeEventListener("scroll",t(this,E)),t(this,c).removeEventListener("pointerdown",t(this,y)),clearTimeout(t(this,g)),S.intersector.unsubscribe(t(this,p)),x.ticker.unsubscribe(t(this,b))}}i=new WeakMap,c=new WeakMap,f=new WeakMap,a=new WeakMap,o=new WeakMap,g=new WeakMap,h=new WeakSet,H=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).scrollLeft:t(this,i).scrollTop:t(this,o)?t(this,i).scrollX:t(this,i).scrollY},z=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).scrollWidth:t(this,i).scrollHeight:t(this,o)?Math.max(document.body.scrollWidth,document.documentElement.scrollWidth,document.body.offsetWidth,document.documentElement.offsetWidth,document.body.clientWidth,document.documentElement.clientWidth):Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},k=function(){return t(this,i)instanceof HTMLElement?t(this,o)?t(this,i).offsetWidth:t(this,i).offsetHeight:t(this,o)?innerWidth:innerHeight},E=new WeakMap,L=new WeakMap,y=new WeakMap,b=new WeakMap,p=new WeakMap;S.isBrowser&&!customElements.get("e-custom-scrollbar")&&customElements.define("e-custom-scrollbar",w);exports.CustomScrollbarElement=w;
@@ -1,47 +1,48 @@
1
- var v = (l) => {
2
- throw TypeError(l);
1
+ var v = (o) => {
2
+ throw TypeError(o);
3
3
  };
4
- var S = (l, h, s) => h.has(l) || v("Cannot " + s);
5
- var t = (l, h, s) => (S(l, h, "read from private field"), s ? s.call(l) : h.get(l)), r = (l, h, s) => h.has(l) ? v("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(l) : h.set(l, s), c = (l, h, s, i) => (S(l, h, "write to private field"), i ? i.call(l, s) : h.set(l, s), s);
6
- import { i as k, a as H } from "../index-Bv9zgfdb.js";
7
- import { f as w } from "../dom-CVWzyXPH.js";
8
- import { s as z } from "../gestures-CcXV6fCp.js";
4
+ var W = (o, n, e) => n.has(o) || v("Cannot " + e);
5
+ var t = (o, n, e) => (W(o, n, "read from private field"), e ? e.call(o) : n.get(o)), r = (o, n, e) => n.has(o) ? v("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, e), a = (o, n, e, s) => (W(o, n, "write to private field"), s ? s.call(o, e) : n.set(o, e), e);
6
+ import { i as k, a as w } from "../index-Bv9zgfdb.js";
7
+ import { f as P } from "../dom-CVWzyXPH.js";
8
+ import { s as C } from "../gestures-CcXV6fCp.js";
9
9
  import "construct-style-sheets-polyfill";
10
- import { ticker as E } from "../ticker/index.js";
11
- var e, n, u, a, o, d, b, L, p, m, g;
12
- class W extends HTMLElement {
10
+ import { ticker as x } from "../ticker/index.js";
11
+ var i, h, b, u, l, p, c, H, z, T, E, L, g, f, y;
12
+ class q extends HTMLElement {
13
13
  constructor() {
14
14
  super(...arguments);
15
- r(this, e, null);
16
- r(this, n, null);
15
+ r(this, c);
16
+ r(this, i, null);
17
+ r(this, h, null);
18
+ r(this, b, 0);
17
19
  r(this, u, 0);
18
- r(this, a, 0);
19
- r(this, o, !1);
20
- r(this, d);
21
- r(this, b, () => {
22
- this.classList.add("active"), clearTimeout(t(this, d));
23
- const i = (t(this, o) ? t(this, e).scrollLeft : t(this, e).scrollTop) / t(this, a) * t(this, u);
24
- t(this, o) ? t(this, n).style.transform = `translate3d(${i}px, 0px, 0px)` : t(this, n).style.transform = `translate3d(0px, ${i}px, 0px)`, c(this, d, setTimeout(() => {
20
+ r(this, l, !1);
21
+ r(this, p);
22
+ r(this, E, () => {
23
+ this.classList.add("active"), clearTimeout(t(this, p));
24
+ const s = t(this, c, H) / t(this, u) * t(this, b);
25
+ t(this, l) ? t(this, h).style.transform = `translate3d(${s}px, 0px, 0px)` : t(this, h).style.transform = `translate3d(0px, ${s}px, 0px)`, a(this, p, setTimeout(() => {
25
26
  this.classList.remove("active");
26
27
  }, 1e3));
27
28
  });
28
29
  r(this, L, () => {
29
- const s = t(this, o) ? this.offsetWidth : this.offsetHeight;
30
- c(this, a, t(this, o) ? t(this, e).scrollWidth - t(this, e).offsetWidth : t(this, e).scrollHeight - t(this, e).offsetHeight);
31
- let i = s * s / (t(this, a) + s);
32
- i = Math.max(i, 30), t(this, o) ? (t(this, n).style.width = i + "px", t(this, n).style.height = "100%") : (t(this, n).style.width = "100%", t(this, n).style.height = i + "px"), c(this, u, s - i), t(this, o) && !(t(this, e).scrollWidth > t(this, e).offsetWidth) || !t(this, o) && !(t(this, e).scrollHeight > t(this, e).offsetHeight) ? this.style.display = "none" : this.style.display = "block";
30
+ const e = t(this, l) ? this.offsetWidth : this.offsetHeight, s = t(this, c, z), m = t(this, c, T);
31
+ a(this, u, s - m);
32
+ let d = e * e / (t(this, u) + e);
33
+ d = Math.max(d, 30), t(this, l) ? (t(this, h).style.width = d + "px", t(this, h).style.height = "100%") : (t(this, h).style.width = "100%", t(this, h).style.height = d + "px"), a(this, b, e - d), s <= m ? this.style.display = "none" : this.style.display = "block";
33
34
  });
34
- r(this, p, (s) => {
35
+ r(this, g, (e) => {
35
36
  document.documentElement.classList.add("grabbing");
36
- const i = t(this, o) ? t(this, e).scrollLeft : t(this, e).scrollTop, f = t(this, o) ? s.x : s.y;
37
- z(
38
- (x) => {
39
- const T = t(this, a) / t(this, u), y = (t(this, o) ? x.x - f : x.y - f) * T;
40
- t(this, o) ? t(this, e).scroll({
41
- left: i + y,
37
+ const s = t(this, c, H), m = t(this, l) ? e.x : e.y;
38
+ C(
39
+ (d) => {
40
+ const M = t(this, u) / t(this, b), S = (t(this, l) ? d.x - m : d.y - m) * M;
41
+ t(this, l) ? t(this, i).scroll({
42
+ left: s + S,
42
43
  behavior: "instant"
43
- }) : t(this, e).scroll({
44
- top: i + y,
44
+ }) : t(this, i).scroll({
45
+ top: s + S,
45
46
  behavior: "instant"
46
47
  });
47
48
  },
@@ -50,27 +51,50 @@ class W extends HTMLElement {
50
51
  }
51
52
  );
52
53
  });
53
- r(this, m, () => {
54
+ r(this, f, () => {
54
55
  t(this, L).call(this);
55
56
  });
56
- r(this, g, (s) => {
57
- s.isIntersecting ? (E.subscribe(t(this, m), { maxFPS: 5 }), t(this, m).call(this)) : E.unsubscribe(t(this, m));
57
+ r(this, y, (e) => {
58
+ e.isIntersecting ? (x.subscribe(t(this, f), { maxFPS: 5 }), t(this, f).call(this)) : x.unsubscribe(t(this, f));
58
59
  });
59
60
  }
60
61
  connectedCallback() {
61
- const s = this.getAttribute("data-scroll");
62
- c(this, o, this.hasAttribute("horisontal"));
63
- let i = null;
64
- s && (s === "parent" ? i = this.parentElement : i = document.querySelector(s)), i || (i = w(this));
65
- const f = this.querySelector("[data-thumb]");
66
- i && f && (c(this, e, i), c(this, n, f), t(this, e).addEventListener("scroll", t(this, b)), t(this, n).addEventListener("pointerdown", t(this, p)), H.subscribe(this.parentElement, t(this, g)));
62
+ const e = this.getAttribute("data-scroll");
63
+ a(this, l, this.hasAttribute("horisontal"));
64
+ let s = null;
65
+ e && (e === "parent" ? s = this.parentElement : s = document.querySelector(e)), s || (s = P(this), s === document.body && (s = window));
66
+ const m = this.querySelector("[data-thumb]");
67
+ s && m && (a(this, i, s), a(this, h, m), t(this, i).addEventListener("scroll", t(this, E)), t(this, h).addEventListener("pointerdown", t(this, g)), w.subscribe(
68
+ this.parentElement === document.body ? this : this.parentElement,
69
+ t(this, y)
70
+ ));
67
71
  }
68
72
  disconnectedCallback() {
69
- t(this, e).removeEventListener("scroll", t(this, b)), t(this, n).removeEventListener("pointerdown", t(this, p)), clearTimeout(t(this, d)), H.unsubscribe(t(this, g)), E.unsubscribe(t(this, m));
73
+ t(this, i).removeEventListener("scroll", t(this, E)), t(this, h).removeEventListener("pointerdown", t(this, g)), clearTimeout(t(this, p)), w.unsubscribe(t(this, y)), x.unsubscribe(t(this, f));
70
74
  }
71
75
  }
72
- e = new WeakMap(), n = new WeakMap(), u = new WeakMap(), a = new WeakMap(), o = new WeakMap(), d = new WeakMap(), b = new WeakMap(), L = new WeakMap(), p = new WeakMap(), m = new WeakMap(), g = new WeakMap();
73
- k && !customElements.get("e-custom-scrollbar") && customElements.define("e-custom-scrollbar", W);
76
+ i = new WeakMap(), h = new WeakMap(), b = new WeakMap(), u = new WeakMap(), l = new WeakMap(), p = new WeakMap(), c = new WeakSet(), H = function() {
77
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).scrollLeft : t(this, i).scrollTop : t(this, l) ? t(this, i).scrollX : t(this, i).scrollY;
78
+ }, z = function() {
79
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).scrollWidth : t(this, i).scrollHeight : t(this, l) ? Math.max(
80
+ document.body.scrollWidth,
81
+ document.documentElement.scrollWidth,
82
+ document.body.offsetWidth,
83
+ document.documentElement.offsetWidth,
84
+ document.body.clientWidth,
85
+ document.documentElement.clientWidth
86
+ ) : Math.max(
87
+ document.body.scrollHeight,
88
+ document.documentElement.scrollHeight,
89
+ document.body.offsetHeight,
90
+ document.documentElement.offsetHeight,
91
+ document.body.clientHeight,
92
+ document.documentElement.clientHeight
93
+ );
94
+ }, T = function() {
95
+ return t(this, i) instanceof HTMLElement ? t(this, l) ? t(this, i).offsetWidth : t(this, i).offsetHeight : t(this, l) ? innerWidth : innerHeight;
96
+ }, E = new WeakMap(), L = new WeakMap(), g = new WeakMap(), f = new WeakMap(), y = new WeakMap();
97
+ k && !customElements.get("e-custom-scrollbar") && customElements.define("e-custom-scrollbar", q);
74
98
  export {
75
- W as CustomScrollbarElement
99
+ q as CustomScrollbarElement
76
100
  };
@@ -19,20 +19,20 @@ const n = (e) => e, s = (e) => e * e, a = (e) => e * (2 - e), r = (e) => e < 0.5
19
19
  }, Symbol.toStringTag, { value: "Module" }));
20
20
  export {
21
21
  s as a,
22
- a as b,
23
- r as c,
24
- u as d,
22
+ g as b,
23
+ a as c,
24
+ r as d,
25
25
  x as e,
26
- o as f,
27
- c as g,
28
- O as h,
29
- i,
30
- I as j,
31
- Q as k,
26
+ u as f,
27
+ o as g,
28
+ c as h,
29
+ O as i,
30
+ i as j,
31
+ I as k,
32
32
  n as l,
33
- b as m,
34
- l as n,
35
- p as o,
36
- d as p,
37
- g as q
33
+ Q as m,
34
+ b as n,
35
+ l as o,
36
+ p,
37
+ d as q
38
38
  };
@@ -1,11 +1,12 @@
1
1
  import { ChangeHistoryAction, ElementOrSelector } from '../utils';
2
2
  import { MorphLink } from './MorphLink';
3
+ import { MorphRouteScrollState } from './MorphRoute';
3
4
  export interface MorphOptions {
4
5
  base: string;
5
6
  waitForHeadToLoad: boolean;
6
7
  cachePages: boolean;
7
8
  trailingSlash: boolean;
8
- scrollSelector: string;
9
+ scrollSelector: string | undefined;
9
10
  morphInsideScrollContainer: boolean;
10
11
  }
11
12
  export interface MorphNavigationEntry {
@@ -42,6 +43,7 @@ export interface MorphEvents {
42
43
  morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
43
44
  morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
44
45
  morphScroll: CustomEvent<MorphScrollDetail>;
46
+ morphNavigationScroll: CustomEvent<MorphRouteScrollState>;
45
47
  }
46
48
  export interface MorphGetRouteOptions {
47
49
  searchParameters?: string;
@@ -56,8 +58,12 @@ export declare class Morph {
56
58
  get currentPathname(): string;
57
59
  get previousPathname(): string | undefined;
58
60
  get links(): MorphLink[];
59
- get scrollElement(): HTMLElement;
61
+ get scrollElement(): HTMLElement | Window;
60
62
  get isPopstateNavigation(): boolean;
63
+ get scrollValue(): {
64
+ top: number;
65
+ left: number;
66
+ };
61
67
  saveState(state: any): void;
62
68
  getState(): any;
63
69
  normalizePath(path: string): {
@@ -1 +1 @@
1
- "use strict";var kt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Ct=n=>{throw TypeError(n)};var dt=(n,t,s)=>t.has(n)||Ct("Cannot "+s);var e=(n,t,s)=>(dt(n,t,"read from private field"),s?s.call(n):t.get(n)),a=(n,t,s)=>t.has(n)?Ct("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),o=(n,t,s,i)=>(dt(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),m=(n,t,s)=>(dt(n,t,"access private method"),s);var z=(n,t,s)=>new Promise((i,d)=>{var v=E=>{try{S(s.next(E))}catch(D){d(D)}},b=E=>{try{S(s.throw(E))}catch(D){d(D)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(n,t)).next())});var Tt=(n,t,s)=>(t=n[kt("asyncIterator")])?t.call(n):(n=n[kt("iterator")](),t={},s=(i,d)=>(d=n[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=d.call(n,v),E=v.done,Promise.resolve(v.value).then(D=>b({value:D,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xt=require("../index-DekP7OZe.cjs"),$=require("../events-KVanG9sR.cjs"),Bt=require("../polyfills-Df4r-ETT.cjs"),Mt=require("../scroll-CFDCeArT.cjs");require("construct-style-sheets-polyfill");const rt=require("../url-lnBE_6yf.cjs"),Ft=require("../css-value-parser/index.cjs");class Nt 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)}}xt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Nt);var k,l,I,_,K;class mt{constructor(t,s){a(this,k);a(this,l);a(this,I);a(this,_,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,k).previousPathname)history.back();else{const d=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Ft.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),D=e(this,l).hasAttribute("data-keep-search-parameters"),lt=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(W=>W.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,k).navigate(e(this,I),{historyAction:d,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:D,submorph:lt,clearState:f})}});a(this,K,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,k).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,K))});o(this,k,s),o(this,l,t),o(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,_)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,K))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,k).normalizePath(t),i=e(this,k).normalizePath(e(this,I));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,_)),e(this,l).removeEventListener("pointerenter",e(this,K)),e(this,l).classList.remove("current")}}k=new WeakMap,l=new WeakMap,I=new WeakMap,_=new WeakMap,K=new WeakMap;var H,Y,w,O,B,x,G;class Ht{constructor(t,s,i){a(this,H);a(this,Y);a(this,w,{x:0,y:0});a(this,O);a(this,B,null);a(this,x,null);a(this,G,null);o(this,H,t),o(this,Y,s),o(this,O,i.cloneNode(!0))}get pathname(){return e(this,Y)}get scrollState(){return e(this,w)}get document(){return e(this,x)}cloneDocument(){o(this,x,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,x).title)t=e(this,x).title;else{const s=e(this,x).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,Y)}return t}clearScrollState(){e(this,w).x=0,e(this,w).y=0}clearDocumentState(){o(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,w).x=0,e(this,w).y=0):(e(this,w).x=e(this,H).scrollElement.scrollLeft,e(this,w).y=e(this,H).scrollElement.scrollTop)}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,w).y,left:e(this,w).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?o(this,B,null):o(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,H).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){o(this,G,t)}clearState(){const t=e(this,G);return o(this,G,null),t}}H=new WeakMap,Y=new WeakMap,w=new WeakMap,O=new WeakMap,B=new WeakMap,x=new WeakMap,G=new WeakMap;var C,J,p,at,N,u,tt,F,T,P,q,V,et,c,nt,qt,pt,Dt,Et,gt,St,vt,ot,Q;const Z=class Z{constructor(t){a(this,c);a(this,C,null);a(this,J,null);a(this,p,[]);a(this,at,new DOMParser);a(this,N);a(this,u,null);a(this,tt);a(this,F,[]);a(this,T,!1);a(this,P,null);a(this,q,new Map);a(this,V,null);a(this,et,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});a(this,ot,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),o(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),o(this,T,!1))}));a(this,Q,()=>{const t=e(this,P).scrollTop,s=e(this,P).scrollLeft;document.documentElement.classList.toggle("top-scrolled",t>0),document.documentElement.classList.toggle("left-scrolled",s>0),$.dispatchEvent(document,"morphScroll",{detail:{left:s,top:t}})});if(xt.isBrowser&&!Z.instance){Z.instance=this,o(this,C,{base:rt.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",morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),o(this,J,m(this,c,pt).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);o(this,u,s.pathname),e(this,q).set(e(this,u),new Ht(this,e(this,u),document)),document.documentElement.setAttribute("data-current-pathname",e(this,u)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),addEventListener("popstate",e(this,ot)),rt.changeHistory({action:"replace",pathname:e(this,u),searchParameters:s.parameters||location.search,hash:s.hash}),o(this,V,new Nt),m(this,c,St).call(this,document)}}get currentPathname(){return e(this,u)}get previousPathname(){return e(this,tt)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}saveState(t){const s=e(this,q).get(e(this,u));s&&s.saveState(t)}getState(){const t=e(this,q).get(e(this,u));return t==null?void 0:t.clearState()}normalizePath(t){return rt.splitPath(t,{base:e(this,C).base,trailingSlash:e(this,C).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,nt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(D){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:d,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var wt;if(e(this,F).length)return;const lt=this.normalizePath(((wt=this.pathnameModifier)==null?void 0:wt.call(this,t))||t);let{pathname:f,hash:W,parameters:yt,leaf:Rt}=lt;if(e(this,N)===f||e(this,u)===f){e(this,T)||m(this,c,vt).call(this,W||0,{centerScroll:i,offsetScroll:d,behavior:"smooth"});return}o(this,N,f),e(this,p).forEach(j=>{j.checkCurrent(f)});try{let j=!0;if(this.preprocessor)try{yield new Promise((r,A)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:A,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),j=!1}if(!j||e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}const ct={pathname:f,submorph:S};$.dispatchEvent(document,"morphNavigation",{detail:ct});const ht=yield m(this,c,nt).call(this,e(this,u)),L=yield m(this,c,nt).call(this,f,{searchParameters:yt,revalidate:v});if(e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,u))});return}ht.clearState(),ht.saveScrollState(),ht.saveDocumentState(),e(this,T)||(L.clearScrollState(),L.clearDocumentState()),E&&L.clearState(),L.cloneDocument(),e(this,V).textContent=L.title,document.body.appendChild(e(this,V)),$.dispatchEvent(document,"morphStart",{detail:ct});const bt=Array.from(document.head.children),Lt=Array.from(L.document.head.children),Pt=m(this,c,Dt).call(this,bt,Lt),zt=m(this,c,Et).call(this,bt,Pt),st=m(this,c,Et).call(this,Lt,Pt);st.forEach((r,A)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),st[A]=y}}),st.forEach(r=>{document.head.appendChild(r)});const ut=st.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,gt).call(this,r))return!0});e(this,C).waitForHeadToLoad&&ut.length&&(yield new Promise(r=>z(this,null,function*(){let A=0;try{for(var y=Tt(ut),X,R,U;X=!(R=yield y.next()).done;X=!1){const it=R.value;it.onload=()=>{A++,A===ut.length&&r()}}}catch(R){U=[R]}finally{try{X&&(R=y.return)&&(yield R.call(y))}finally{if(U)throw U[0]}}}))),yield Mt.wait(10);const At=[];zt.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,gt).call(this,r)?At.push(r):r.remove())});const It=m(this,c,pt).call(this,L.document.body);e(this,C).morphInsideScrollContainer||m(this,c,St).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",Rt),rt.changeHistory({action:s,pathname:f,searchParameters:yt||(b?location.search:""),hash:W}),e(this,V).remove(),o(this,tt,e(this,u)),o(this,u,f),e(this,J).forEach((r,A)=>{const y=It[A],X=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],U=[];S?S.forEach(h=>{const g=r.querySelector(h),M=y.querySelector(h);g&&M&&(U.push(g),R.push(M))}):(R.push(...y.childNodes),U.push(...r.childNodes)),U.forEach(h=>{h instanceof HTMLElement&&(this.destroyOldLinks(h),h.classList.add("old"))}),R.forEach(h=>{h instanceof HTMLElement&&(this.findNewLinks(h),h.classList.add("new"))}),S?R.forEach((h,g)=>{var M;(M=U[g].parentElement)==null||M.insertBefore(h,U[g])}):r.prepend(...R),Bt.requestIdleCallback(()=>{R.forEach(h=>{var g;h instanceof HTMLElement&&((g=h.parentElement)==null||g.style.setProperty("--new-content-height",h.offsetHeight+"px"),h.classList.add("in"))})});const it={morphElement:r,pathname:f};$.dispatchEvent(document,"morphNewChildrenAdded",{detail:it});const Ot=new Promise(h=>{setTimeout(()=>{U.forEach(g=>g.remove()),R.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),$.dispatchEvent(document,"morphOldChildrenRemoved",{detail:it}),h()},(parseFloat(X)||0)*1e3+10)});e(this,F).push(Ot)}),W?(L.clearScrollState(),m(this,c,vt).call(this,W,{centerScroll:i,offsetScroll:d})):e(this,T)?L.restoreScrollPosition():L.renewScrollPosition(),yield Promise.all(e(this,F)),At.forEach(r=>r.remove()),o(this,F,[]),e(this,J).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const X=document.createElement("script");X.type="module",X.src=y.getAttribute("src"),y.replaceWith(X)})}),$.dispatchEvent(document,"morphComplete",{detail:ct}),window.dispatchEvent(new Event("resize"))}catch(j){console.error(j)}o(this,N,void 0)})}addLink(t){e(this,p).push(new mt(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){o(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){o(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,et));e(this,p).push(...s.map(i=>new mt(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,et));e(this,p).forEach(s=>s.destroy()),o(this,p,t.map(s=>new mt(s,this)))}};C=new WeakMap,J=new WeakMap,p=new WeakMap,at=new WeakMap,N=new WeakMap,u=new WeakMap,tt=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,q=new WeakMap,V=new WeakMap,et=new WeakMap,c=new WeakSet,nt=function(t,s){return z(this,null,function*(){let i=e(this,q).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,qt).call(this,t,s==null?void 0:s.searchParameters)),i})},qt=function(t,s){return z(this,null,function*(){const d=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,at).parseFromString(d,"text/html"),b=new Ht(this,t,v);return e(this,q).set(t,b),b})},pt=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Dt=function(t,s){return t.filter(i=>s.find(d=>d.outerHTML===i.outerHTML))},Et=function(t,s){return t.filter(i=>!s.find(d=>d.outerHTML===i.outerHTML))},gt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},St=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Q)),o(this,P,t.querySelector(e(this,C).scrollSelector)||t.documentElement),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Q)),e(this,Q).call(this)},vt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Mt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ot=new WeakMap,Q=new WeakMap,Z.instance=null;let ft=Z;exports.Morph=ft;
1
+ "use strict";var Mt=(a,t)=>(t=Symbol[a])?t:Symbol.for("Symbol."+a),xt=a=>{throw TypeError(a)};var pt=(a,t,s)=>t.has(a)||xt("Cannot "+s);var e=(a,t,s)=>(pt(a,t,"read from private field"),s?s.call(a):t.get(a)),o=(a,t,s)=>t.has(a)?xt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(a):t.set(a,s),n=(a,t,s,i)=>(pt(a,t,"write to private field"),i?i.call(a,s):t.set(a,s),s),m=(a,t,s)=>(pt(a,t,"access private method"),s);var z=(a,t,s)=>new Promise((i,h)=>{var v=E=>{try{S(s.next(E))}catch(D){h(D)}},b=E=>{try{S(s.throw(E))}catch(D){h(D)}},S=E=>E.done?i(E.value):Promise.resolve(E.value).then(v,b);S((s=s.apply(a,t)).next())});var Ht=(a,t,s)=>(t=a[Mt("asyncIterator")])?t.call(a):(a=a[Mt("iterator")](),t={},s=(i,h)=>(h=a[i])&&(t[i]=v=>new Promise((b,S,E)=>(v=h.call(a,v),E=v.done,Promise.resolve(v.value).then(D=>b({value:D,done:E}),S)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Dt=require("../index-DekP7OZe.cjs"),V=require("../events-KVanG9sR.cjs"),Wt=require("../polyfills-Df4r-ETT.cjs"),Nt=require("../scroll-CIdNtj3G.cjs");require("construct-style-sheets-polyfill");const ot=require("../url-lnBE_6yf.cjs"),Yt=require("../css-value-parser/index.cjs");class Rt 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)}}Dt.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Rt);var C,l,I,et,U;class Et{constructor(t,s){o(this,C);o(this,l);o(this,I);o(this,et,t=>{var i;if(t.preventDefault(),e(this,l).hasAttribute("data-back")&&e(this,C).previousPathname)history.back();else{const h=e(this,l).getAttribute("data-history-action")||"push",v=e(this,l).hasAttribute("data-center-scroll"),b=getComputedStyle(e(this,l)).getPropertyValue("--offset-scroll").trim(),S=b?Yt.cssValueParser.parse(b):void 0,E=e(this,l).hasAttribute("data-revalidate"),D=e(this,l).hasAttribute("data-keep-search-parameters"),ut=(i=e(this,l).getAttribute("data-submorph"))==null?void 0:i.split(",").map(Y=>Y.trim()),f=e(this,l).hasAttribute("data-clear-state");e(this,C).navigate(e(this,I),{historyAction:h,centerScroll:v,offsetScroll:S,revalidate:E,keepSearchParameters:D,submorph:ut,clearState:f})}});o(this,U,()=>{const t=e(this,l).hasAttribute("data-revalidate");e(this,C).prefetch(e(this,I),t),e(this,l).removeEventListener("pointerenter",e(this,U))});n(this,C,s),n(this,l,t),n(this,I,e(this,l).getAttribute("href")||"/"),e(this,l).addEventListener("click",e(this,et)),this.checkCurrent(location.pathname),e(this,l).hasAttribute("data-prefetch")&&e(this,l).addEventListener("pointerenter",e(this,U))}get element(){return e(this,l)}checkCurrent(t){const s=e(this,C).normalizePath(t),i=e(this,C).normalizePath(e(this,I));e(this,l).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,l).classList.add("current"):i.pathname===s.pathname?e(this,l).classList.add("current"):e(this,l).classList.remove("current")}destroy(){e(this,l).removeEventListener("click",e(this,et)),e(this,l).removeEventListener("pointerenter",e(this,U)),e(this,l).classList.remove("current")}}C=new WeakMap,l=new WeakMap,I=new WeakMap,et=new WeakMap,U=new WeakMap;var x,$,L,O,B,H,K;class qt{constructor(t,s,i){o(this,x);o(this,$);o(this,L,{x:0,y:0});o(this,O);o(this,B,null);o(this,H,null);o(this,K,null);n(this,x,t),n(this,$,s),n(this,O,i.cloneNode(!0))}get pathname(){return e(this,$)}get scrollState(){return e(this,L)}get document(){return e(this,H)}cloneDocument(){n(this,H,(e(this,B)||e(this,O)).cloneNode(!0))}get title(){let t="";if(e(this,H).title)t=e(this,H).title;else{const s=e(this,H).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,$)}return t}clearScrollState(){e(this,L).x=0,e(this,L).y=0}clearDocumentState(){n(this,B,null)}saveScrollState(){e(this,O).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,L).x=0,e(this,L).y=0):(e(this,L).x=e(this,x).scrollValue.left,e(this,L).y=e(this,x).scrollValue.top)}restoreScrollPosition(){e(this,x).scrollElement.scroll({top:e(this,L).y,left:e(this,L).x,behavior:"instant"})}saveDocumentState(){e(this,O).documentElement.hasAttribute("data-no-page-restoration")?n(this,B,null):n(this,B,document.cloneNode(!0))}renewScrollPosition(){e(this,x).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(t){n(this,K,t)}clearState(){const t=e(this,K);return n(this,K,null),t}}x=new WeakMap,$=new WeakMap,L=new WeakMap,O=new WeakMap,B=new WeakMap,H=new WeakMap,K=new WeakMap;var k,G,p,ct,N,d,st,F,T,P,it,q,W,J,Q,rt,c,lt,zt,St,Vt,vt,wt,yt,Lt,ht,Z;const tt=class tt{constructor(t){o(this,c);o(this,k,null);o(this,G,null);o(this,p,[]);o(this,ct,new DOMParser);o(this,N);o(this,d,null);o(this,st);o(this,F,[]);o(this,T,!1);o(this,P,null);o(this,it,!1);o(this,q,new Map);o(this,W,null);o(this,J,0);o(this,Q,0);o(this,rt,t=>{var s;return((s=t.getAttribute("href"))==null?void 0:s.startsWith("/"))&&!t.hasAttribute("download")&&!t.hasAttribute("data-morph-skip")&&!t.closest("[data-morph-skip]")&&t.getAttribute("target")!=="_blank"});o(this,ht,t=>z(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(t.preventDefault(),n(this,T,!0),yield this.navigate(t.state.path,{historyAction:"none"}),n(this,T,!1))}));o(this,Z,()=>{const{left:t,top:s}=this.scrollValue,i=s-e(this,Q),h=t-e(this,J);n(this,Q,s),n(this,J,t),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",t>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",h>0),document.documentElement.classList.toggle("scroll-x-backward",h<0),V.dispatchEvent(document,"morphScroll",{detail:{left:t,top:s}})});if(Dt.isBrowser&&!tt.instance){tt.instance=this,n(this,k,{base:ot.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,morphInsideScrollContainer:(t==null?void 0:t.morphInsideScrollContainer)||!1}),n(this,G,m(this,c,St).call(this,document.body));const s=this.normalizePath(location.pathname+location.hash);n(this,d,s.pathname),e(this,q).set(e(this,d),new qt(this,e(this,d),document)),document.documentElement.setAttribute("data-current-pathname",e(this,d)),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),history.scrollRestoration="manual",addEventListener("popstate",e(this,ht)),ot.changeHistory({action:"replace",pathname:e(this,d),searchParameters:s.parameters||location.search,hash:s.hash}),n(this,W,new Rt),m(this,c,yt).call(this,document)}}get currentPathname(){return e(this,d)}get previousPathname(){return e(this,st)}get links(){return e(this,p)}get scrollElement(){return e(this,P)}get isPopstateNavigation(){return e(this,T)}get scrollValue(){let t=0,s=0;return e(this,it)?(t=window.scrollY,s=window.scrollX):(t=e(this,P).scrollTop,s=e(this,P).scrollLeft),{top:t,left:s}}saveState(t){const s=e(this,q).get(e(this,d));s&&s.saveState(t)}getState(){const t=e(this,q).get(e(this,d));return t==null?void 0:t.clearState()}normalizePath(t){return ot.splitPath(t,{base:e(this,k).base,trailingSlash:e(this,k).trailingSlash})}prefetch(t,s){return z(this,null,function*(){const i=this.normalizePath(t);m(this,c,lt).call(this,i.pathname,{searchParameters:i.parameters,revalidate:s})})}navigate(D){return z(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:h,revalidate:v,keepSearchParameters:b,submorph:S,clearState:E}={}){var Pt;if(e(this,F).length)return;const ut=this.normalizePath(((Pt=this.pathnameModifier)==null?void 0:Pt.call(this,t))||t);let{pathname:f,hash:Y,parameters:bt,leaf:It}=ut;if(e(this,N)===f||e(this,d)===f){e(this,T)||m(this,c,Lt).call(this,Y||0,{centerScroll:i,offsetScroll:h,behavior:"smooth"});return}n(this,N,f),e(this,p).forEach(X=>{X.checkCurrent(f)});try{let X=!0;if(this.preprocessor)try{yield new Promise((r,A)=>{var y;(y=this.preprocessor)==null||y.call(this,{pathname:f,resolve:r,reject:A,submorph:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),X=!1}if(!X||e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}const dt={pathname:f,submorph:S};V.dispatchEvent(document,"morphNavigation",{detail:dt});const mt=yield m(this,c,lt).call(this,e(this,d)),w=yield m(this,c,lt).call(this,f,{searchParameters:bt,revalidate:v});if(e(this,N)!==f){e(this,p).forEach(r=>{r.checkCurrent(e(this,d))});return}mt.clearState(),mt.saveScrollState(),mt.saveDocumentState(),e(this,T)||(w.clearScrollState(),w.clearDocumentState()),E&&w.clearState(),w.cloneDocument(),e(this,W).textContent=w.title,document.body.appendChild(e(this,W)),V.dispatchEvent(document,"morphStart",{detail:dt});const kt=Array.from(document.head.children),At=Array.from(w.document.head.children),Ct=m(this,c,Vt).call(this,kt,At),Ot=m(this,c,vt).call(this,kt,Ct),nt=m(this,c,vt).call(this,At,Ct);nt.forEach((r,A)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const y=document.createElement("script");y.type="module",y.src=r.getAttribute("src"),nt[A]=y}}),nt.forEach(r=>{document.head.appendChild(r)});const ft=nt.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(m(this,c,wt).call(this,r))return!0});e(this,k).waitForHeadToLoad&&ft.length&&(yield new Promise(r=>z(this,null,function*(){let A=0;try{for(var y=Ht(ft),_,R,j;_=!(R=yield y.next()).done;_=!1){const at=R.value;at.onload=()=>{A++,A===ft.length&&r()}}}catch(R){j=[R]}finally{try{_&&(R=y.return)&&(yield R.call(y))}finally{if(j)throw j[0]}}}))),yield Nt.wait(10);const Tt=[];Ot.forEach(r=>{r.hasAttribute("data-permanent")||(m(this,c,wt).call(this,r)?Tt.push(r):r.remove())});const Bt=m(this,c,St).call(this,w.document.body);e(this,k).morphInsideScrollContainer||m(this,c,yt).call(this,w.document),document.documentElement.setAttribute("data-current-pathname",f),document.documentElement.setAttribute("data-current-leaf",It),ot.changeHistory({action:s,pathname:f,searchParameters:bt||(b?location.search:""),hash:Y}),e(this,W).remove(),n(this,st,e(this,d)),n(this,d,f),e(this,G).forEach((r,A)=>{const y=Bt[A],_=getComputedStyle(r).getPropertyValue("--morph-duration");let R=[],j=[];S?S.forEach(u=>{const g=r.querySelector(u),M=y.querySelector(u);g&&M&&(j.push(g),R.push(M))}):(R.push(...y.childNodes),j.push(...r.childNodes)),j.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"))}),R.forEach(u=>{u instanceof HTMLElement&&(this.findNewLinks(u),u.classList.add("new"))}),S?R.forEach((u,g)=>{var M;(M=j[g].parentElement)==null||M.insertBefore(u,j[g])}):r.prepend(...R),Wt.requestIdleCallback(()=>{R.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("in"))})});const at={morphElement:r,pathname:f};V.dispatchEvent(document,"morphNewChildrenAdded",{detail:at});const Ft=new Promise(u=>{setTimeout(()=>{j.forEach(g=>g.remove()),R.forEach(g=>{var M;g instanceof HTMLElement&&((M=g.parentElement)==null||M.style.removeProperty("--new-content-height"),g.classList.remove("in","new"))}),V.dispatchEvent(document,"morphOldChildrenRemoved",{detail:at}),u()},(parseFloat(_)||0)*1e3+10)});e(this,F).push(Ft)}),Y?(w.clearScrollState(),m(this,c,Lt).call(this,Y,{centerScroll:i,offsetScroll:h})):e(this,T)?w.restoreScrollPosition():w.renewScrollPosition(),V.dispatchEvent(document,"morphNavigationScroll",{detail:w.scrollState}),yield Promise.all(e(this,F)),Tt.forEach(r=>r.remove()),n(this,F,[]),e(this,G).forEach(r=>{r.querySelectorAll("script").forEach(y=>{const _=document.createElement("script");_.type="module",_.src=y.getAttribute("src"),y.replaceWith(_)})}),V.dispatchEvent(document,"morphComplete",{detail:dt}),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}n(this,N,void 0)})}addLink(t){e(this,p).push(new Et(t,this))}addLinks(t){t.forEach(s=>{this.addLink(s)})}removeLink(t){n(this,p,e(this,p).filter(s=>s.element===t?(s.destroy(),!1):!0))}destroyOldLinks(t){n(this,p,e(this,p).filter(s=>t.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(t){const s=[...t.querySelectorAll("a")].filter(e(this,rt));e(this,p).push(...s.map(i=>new Et(i,this)))}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(e(this,rt));e(this,p).forEach(s=>s.destroy()),n(this,p,t.map(s=>new Et(s,this)))}};k=new WeakMap,G=new WeakMap,p=new WeakMap,ct=new WeakMap,N=new WeakMap,d=new WeakMap,st=new WeakMap,F=new WeakMap,T=new WeakMap,P=new WeakMap,it=new WeakMap,q=new WeakMap,W=new WeakMap,J=new WeakMap,Q=new WeakMap,rt=new WeakMap,c=new WeakSet,lt=function(t,s){return z(this,null,function*(){let i=e(this,q).get(t);return(!i||s!=null&&s.revalidate)&&(i=yield m(this,c,zt).call(this,t,s==null?void 0:s.searchParameters)),i})},zt=function(t,s){return z(this,null,function*(){const h=yield(yield fetch(`${t}${s?"?"+s:""}`)).text(),v=e(this,ct).parseFromString(h,"text/html"),b=new qt(this,t,v);return e(this,q).set(t,b),b})},St=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},Vt=function(t,s){return t.filter(i=>s.find(h=>h.outerHTML===i.outerHTML))},vt=function(t,s){return t.filter(i=>!s.find(h=>h.outerHTML===i.outerHTML))},wt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},yt=function(t){var s,i;(s=e(this,P))==null||s.removeEventListener("scroll",e(this,Z)),n(this,Q,0),n(this,J,0),n(this,P,e(this,k).scrollSelector&&t.querySelector(e(this,k).scrollSelector)||window),n(this,it,e(this,P)===window),(i=e(this,P))==null||i.addEventListener("scroll",e(this,Z)),e(this,Z).call(this)},Lt=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Nt.scrollToElement(i,{scrollElement:e(this,P),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},ht=new WeakMap,Z=new WeakMap,tt.instance=null;let gt=tt;exports.Morph=gt;