aptechka 0.50.8 → 0.50.11

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 _=s=>{throw TypeError(s)};var M=(s,n,t)=>n.has(s)||_("Cannot "+t);var e=(s,n,t)=>(M(s,n,"read from private field"),t?t.call(s):n.get(s)),i=(s,n,t)=>n.has(s)?_("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(s):n.set(s,t),h=(s,n,t,l)=>(M(s,n,"write to private field"),l?l.call(s,t):n.set(s,t),t),d=(s,n,t)=>(M(s,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../index-Cqw2NKev.cjs"),H=require("../dom-JBOkFLTh.cjs"),D=require("../css-property/index.cjs"),O=require("../events-KVanG9sR.cjs"),z=require("../number-0243DApo.cjs");var f,v,g,c,b,r,A,w,C,T,P,q;class I extends HTMLElement{constructor(){super(...arguments);i(this,r);i(this,f,new D.CSSProperty(this,"--autoplay",!1));i(this,v);i(this,g,!1);i(this,c,[]);i(this,b,0);i(this,C,t=>{h(this,g,t.isIntersecting),e(this,g)?d(this,r,w).call(this):clearInterval(e(this,v))});i(this,T,()=>{clearInterval(e(this,v)),e(this,g)&&h(this,v,setInterval(e(this,q),parseFloat(e(this,f).current||"0")*1e3))});i(this,q,()=>{d(this,r,P).call(this,e(this,b)+1)})}get counter(){return e(this,b)}get itemElements(){return e(this,c)}addItem(t){e(this,c).push(t),d(this,r,A).call(this)}set(t){d(this,r,P).call(this,t),d(this,r,w).call(this)}shift(t){this.set(e(this,b)+t)}connectedCallback(){var t;h(this,c,[...this.querySelectorAll("[data-billboard-item]")]),(t=e(this,c)[0])==null||t.classList.add("current"),d(this,r,A).call(this),e(this,f).subscribe(l=>{l.current?(p.intersector.subscribe(this,e(this,C)),d(this,r,w).call(this)):(h(this,g,!0),p.intersector.unsubscribe(e(this,C)),clearInterval(e(this,v)),d(this,r,P).call(this,0))}),e(this,f).observe()}disconnectedCallback(){e(this,f).unobserve(),p.intersector.unsubscribe(e(this,C)),clearInterval(e(this,v))}}f=new WeakMap,v=new WeakMap,g=new WeakMap,c=new WeakMap,b=new WeakMap,r=new WeakSet,A=function(){e(this,c).length>1?this.classList.add("has-length"):this.classList.remove("has-length")},w=function(){e(this,f).current!==!1&&e(this,T).call(this)},C=new WeakMap,T=new WeakMap,P=function(t){h(this,b,z.loopNumber(t,e(this,c).length)),e(this,c).forEach((l,a)=>{a===e(this,b)?l.classList.add("current"):l.classList.remove("current")}),O.dispatchEvent(this,"billboardChange",{detail:{counter:e(this,b)}})},q=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",I);var o,u,S,B;class j extends HTMLElement{constructor(){super(...arguments);i(this,o,null);i(this,u,[]);i(this,S,t=>{const l=t.currentTarget,a=e(this,u).findIndex(y=>y===l);a>=0&&e(this,o).set(a)});i(this,B,()=>{e(this,u).forEach((t,l)=>{l===e(this,o).counter?t.classList.add("current"):t.classList.remove("current")})})}connectedCallback(){h(this,o,H.findParentElement(this,I)),e(this,o)&&customElements.whenDefined("e-billboard").then(()=>{var t;if(this.isConnected){const l=e(this,o).itemElements.length;for(let a=0;a<l;a++){const y=document.createElement("button");e(this,u).push(y),this.appendChild(y)}e(this,u).forEach(a=>{a.addEventListener("click",e(this,S))}),(t=e(this,o))==null||t.addEventListener("billboardChange",e(this,B)),e(this,B).call(this)}})}disconnectedCallback(){var t;e(this,u).forEach(l=>{l.removeEventListener("click",e(this,S))}),(t=e(this,o))==null||t.removeEventListener("billboardChange",e(this,B)),this.innerHTML="",h(this,u,[])}}o=new WeakMap,u=new WeakMap,S=new WeakMap,B=new WeakMap;p.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",j);var m,E,L;class F extends HTMLElement{constructor(){super();i(this,m,new D.CSSProperty(this,"--index",0));i(this,E,null);i(this,L,()=>{var t;e(this,m).current===((t=e(this,E))==null?void 0:t.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",()=>{e(this,E)&&e(this,E).set(e(this,m).current)})}connectedCallback(){var t;this.tabIndex=0,h(this,E,H.findParentElement(this,I)),(t=e(this,E))==null||t.addEventListener("billboardChange",e(this,L)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&e(this,L).call(this)}),e(this,m).subscribe(e(this,L)),e(this,m).observe()}disconnectedCallback(){var t;this.removeAttribute("tabindex"),e(this,m).unsubscribe(e(this,L)),e(this,m).unobserve(),(t=e(this,E))==null||t.removeEventListener("billboardChange",e(this,L))}}m=new WeakMap,E=new WeakMap,L=new WeakMap;p.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",F);var k,x;class N extends HTMLElement{constructor(){super();i(this,k,new D.CSSProperty(this,"--step",1));i(this,x,null);this.addEventListener("click",()=>{e(this,x)&&e(this,x).shift(e(this,k).current)})}connectedCallback(){this.tabIndex=0,h(this,x,H.findParentElement(this,I)),e(this,k).observe()}disconnectedCallback(){this.removeAttribute("tabindex"),e(this,k).unobserve()}}k=new WeakMap,x=new WeakMap;p.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",N);exports.BillboardBulletsElement=j;exports.BillboardElement=I;exports.BillboardSetButtonElement=F;exports.BillboardStepButtonElement=N;
1
+ "use strict";var _=s=>{throw TypeError(s)};var M=(s,n,t)=>n.has(s)||_("Cannot "+t);var e=(s,n,t)=>(M(s,n,"read from private field"),t?t.call(s):n.get(s)),i=(s,n,t)=>n.has(s)?_("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(s):n.set(s,t),h=(s,n,t,l)=>(M(s,n,"write to private field"),l?l.call(s,t):n.set(s,t),t),d=(s,n,t)=>(M(s,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../index-Cqw2NKev.cjs"),H=require("../dom-JBOkFLTh.cjs"),D=require("../css-property/index.cjs"),N=require("../events-KVanG9sR.cjs"),O=require("../number-0243DApo.cjs"),G=require("../polyfills-Df4r-ETT.cjs");var f,v,L,c,b,r,A,y,C,P,q,T;class S extends HTMLElement{constructor(){super(...arguments);i(this,r);i(this,f,new D.CSSProperty(this,"--autoplay",!1));i(this,v);i(this,L,!1);i(this,c,[]);i(this,b,0);i(this,C,t=>{h(this,L,t.isIntersecting),e(this,L)?d(this,r,y).call(this):clearInterval(e(this,v))});i(this,P,()=>{clearInterval(e(this,v)),e(this,L)&&h(this,v,setInterval(e(this,T),parseFloat(e(this,f).current||"0")*1e3))});i(this,T,()=>{d(this,r,q).call(this,e(this,b)+1)})}get counter(){return e(this,b)}get itemElements(){return e(this,c)}addItem(t){e(this,c).push(t),d(this,r,A).call(this)}set(t){d(this,r,q).call(this,t),d(this,r,y).call(this)}shift(t){this.set(e(this,b)+t)}connectedCallback(){var t;h(this,c,[...this.querySelectorAll("[data-billboard-item]")]),(t=e(this,c)[0])==null||t.classList.add("current"),d(this,r,A).call(this),e(this,f).subscribe(l=>{l.current?(g.intersector.subscribe(this,e(this,C)),d(this,r,y).call(this)):(h(this,L,!0),g.intersector.unsubscribe(e(this,C)),clearInterval(e(this,v)),d(this,r,q).call(this,0))}),e(this,f).observe()}disconnectedCallback(){e(this,f).unobserve(),g.intersector.unsubscribe(e(this,C)),clearInterval(e(this,v))}}f=new WeakMap,v=new WeakMap,L=new WeakMap,c=new WeakMap,b=new WeakMap,r=new WeakSet,A=function(){e(this,c).length>1?this.classList.add("has-length"):this.classList.remove("has-length")},y=function(){e(this,f).current!==!1&&e(this,P).call(this)},C=new WeakMap,P=new WeakMap,q=function(t){h(this,b,O.loopNumber(t,e(this,c).length)),e(this,c).forEach((l,a)=>{a===e(this,b)?l.classList.add("current"):l.classList.remove("current")}),N.dispatchEvent(this,"billboardChange",{detail:{counter:e(this,b)}}),G.requestIdleCallback(()=>{window.dispatchEvent(new Event("resize"))})},T=new WeakMap;customElements.get("e-billboard")||customElements.define("e-billboard",S);var o,u,I,B;class j extends HTMLElement{constructor(){super(...arguments);i(this,o,null);i(this,u,[]);i(this,I,t=>{const l=t.currentTarget,a=e(this,u).findIndex(w=>w===l);a>=0&&e(this,o).set(a)});i(this,B,()=>{e(this,u).forEach((t,l)=>{l===e(this,o).counter?t.classList.add("current"):t.classList.remove("current")})})}connectedCallback(){h(this,o,H.findParentElement(this,S)),e(this,o)&&customElements.whenDefined("e-billboard").then(()=>{var t;if(this.isConnected){const l=e(this,o).itemElements.length;for(let a=0;a<l;a++){const w=document.createElement("button");e(this,u).push(w),this.appendChild(w)}e(this,u).forEach(a=>{a.addEventListener("click",e(this,I))}),(t=e(this,o))==null||t.addEventListener("billboardChange",e(this,B)),e(this,B).call(this)}})}disconnectedCallback(){var t;e(this,u).forEach(l=>{l.removeEventListener("click",e(this,I))}),(t=e(this,o))==null||t.removeEventListener("billboardChange",e(this,B)),this.innerHTML="",h(this,u,[])}}o=new WeakMap,u=new WeakMap,I=new WeakMap,B=new WeakMap;g.isBrowser&&!customElements.get("e-billboard-bullets")&&customElements.define("e-billboard-bullets",j);var m,E,p;class z extends HTMLElement{constructor(){super();i(this,m,new D.CSSProperty(this,"--index",0));i(this,E,null);i(this,p,()=>{var t;e(this,m).current===((t=e(this,E))==null?void 0:t.counter)?this.classList.add("current"):this.classList.remove("current")});this.addEventListener("click",()=>{e(this,E)&&e(this,E).set(e(this,m).current)})}connectedCallback(){var t;this.tabIndex=0,h(this,E,H.findParentElement(this,S)),(t=e(this,E))==null||t.addEventListener("billboardChange",e(this,p)),customElements.whenDefined("e-billboard").then(()=>{this.isConnected&&e(this,p).call(this)}),e(this,m).subscribe(e(this,p)),e(this,m).observe()}disconnectedCallback(){var t;this.removeAttribute("tabindex"),e(this,m).unsubscribe(e(this,p)),e(this,m).unobserve(),(t=e(this,E))==null||t.removeEventListener("billboardChange",e(this,p))}}m=new WeakMap,E=new WeakMap,p=new WeakMap;g.isBrowser&&!customElements.get("e-billboard-set-button")&&customElements.define("e-billboard-set-button",z);var k,x;class F extends HTMLElement{constructor(){super();i(this,k,new D.CSSProperty(this,"--step",1));i(this,x,null);this.addEventListener("click",()=>{e(this,x)&&e(this,x).shift(e(this,k).current)})}connectedCallback(){this.tabIndex=0,h(this,x,H.findParentElement(this,S)),e(this,k).observe()}disconnectedCallback(){this.removeAttribute("tabindex"),e(this,k).unobserve()}}k=new WeakMap,x=new WeakMap;g.isBrowser&&!customElements.get("e-billboard-step-button")&&customElements.define("e-billboard-step-button",F);exports.BillboardBulletsElement=j;exports.BillboardElement=S;exports.BillboardSetButtonElement=z;exports.BillboardStepButtonElement=F;
@@ -1,28 +1,29 @@
1
- var N = (s) => {
1
+ var F = (s) => {
2
2
  throw TypeError(s);
3
3
  };
4
- var H = (s, n, e) => n.has(s) || N("Cannot " + e);
5
- var t = (s, n, e) => (H(s, n, "read from private field"), e ? e.call(s) : n.get(s)), i = (s, n, e) => n.has(s) ? N("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, e), h = (s, n, e, l) => (H(s, n, "write to private field"), l ? l.call(s, e) : n.set(s, e), e), d = (s, n, e) => (H(s, n, "access private method"), e);
6
- import { a as M, i as P } from "../index-euf5anj6.js";
7
- import { b as q } from "../dom-CVWzyXPH.js";
8
- import { CSSProperty as F } from "../css-property/index.js";
9
- import { d as j } from "../events-CsVF98U6.js";
10
- import { l as z } from "../number-DwCxt_Ck.js";
11
- var E, v, p, a, b, r, D, w, g, S, y, T;
4
+ var H = (s, n, e) => n.has(s) || F("Cannot " + e);
5
+ var t = (s, n, e) => (H(s, n, "read from private field"), e ? e.call(s) : n.get(s)), i = (s, n, e) => n.has(s) ? F("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(s) : n.set(s, e), h = (s, n, e, l) => (H(s, n, "write to private field"), l ? l.call(s, e) : n.set(s, e), e), d = (s, n, e) => (H(s, n, "access private method"), e);
6
+ import { a as M, i as D } from "../index-euf5anj6.js";
7
+ import { b as P } from "../dom-CVWzyXPH.js";
8
+ import { CSSProperty as z } from "../css-property/index.js";
9
+ import { d as N } from "../events-CsVF98U6.js";
10
+ import { l as j } from "../number-DwCxt_Ck.js";
11
+ import { r as G } from "../polyfills-DJrTJQky.js";
12
+ var E, v, L, a, b, r, q, B, g, S, y, T;
12
13
  class A extends HTMLElement {
13
14
  constructor() {
14
15
  super(...arguments);
15
16
  i(this, r);
16
- i(this, E, new F(this, "--autoplay", !1));
17
+ i(this, E, new z(this, "--autoplay", !1));
17
18
  i(this, v);
18
- i(this, p, !1);
19
+ i(this, L, !1);
19
20
  i(this, a, []);
20
21
  i(this, b, 0);
21
22
  i(this, g, (e) => {
22
- h(this, p, e.isIntersecting), t(this, p) ? d(this, r, w).call(this) : clearInterval(t(this, v));
23
+ h(this, L, e.isIntersecting), t(this, L) ? d(this, r, B).call(this) : clearInterval(t(this, v));
23
24
  });
24
25
  i(this, S, () => {
25
- clearInterval(t(this, v)), t(this, p) && h(this, v, setInterval(
26
+ clearInterval(t(this, v)), t(this, L) && h(this, v, setInterval(
26
27
  t(this, T),
27
28
  parseFloat(t(this, E).current || "0") * 1e3
28
29
  ));
@@ -38,10 +39,10 @@ class A extends HTMLElement {
38
39
  return t(this, a);
39
40
  }
40
41
  addItem(e) {
41
- t(this, a).push(e), d(this, r, D).call(this);
42
+ t(this, a).push(e), d(this, r, q).call(this);
42
43
  }
43
44
  set(e) {
44
- d(this, r, y).call(this, e), d(this, r, w).call(this);
45
+ d(this, r, y).call(this, e), d(this, r, B).call(this);
45
46
  }
46
47
  shift(e) {
47
48
  this.set(t(this, b) + e);
@@ -50,36 +51,38 @@ class A extends HTMLElement {
50
51
  var e;
51
52
  h(this, a, [
52
53
  ...this.querySelectorAll("[data-billboard-item]")
53
- ]), (e = t(this, a)[0]) == null || e.classList.add("current"), d(this, r, D).call(this), t(this, E).subscribe((l) => {
54
- l.current ? (M.subscribe(this, t(this, g)), d(this, r, w).call(this)) : (h(this, p, !0), M.unsubscribe(t(this, g)), clearInterval(t(this, v)), d(this, r, y).call(this, 0));
54
+ ]), (e = t(this, a)[0]) == null || e.classList.add("current"), d(this, r, q).call(this), t(this, E).subscribe((l) => {
55
+ l.current ? (M.subscribe(this, t(this, g)), d(this, r, B).call(this)) : (h(this, L, !0), M.unsubscribe(t(this, g)), clearInterval(t(this, v)), d(this, r, y).call(this, 0));
55
56
  }), t(this, E).observe();
56
57
  }
57
58
  disconnectedCallback() {
58
59
  t(this, E).unobserve(), M.unsubscribe(t(this, g)), clearInterval(t(this, v));
59
60
  }
60
61
  }
61
- E = new WeakMap(), v = new WeakMap(), p = new WeakMap(), a = new WeakMap(), b = new WeakMap(), r = new WeakSet(), D = function() {
62
+ E = new WeakMap(), v = new WeakMap(), L = new WeakMap(), a = new WeakMap(), b = new WeakMap(), r = new WeakSet(), q = function() {
62
63
  t(this, a).length > 1 ? this.classList.add("has-length") : this.classList.remove("has-length");
63
- }, w = function() {
64
+ }, B = function() {
64
65
  t(this, E).current !== !1 && t(this, S).call(this);
65
66
  }, g = new WeakMap(), S = new WeakMap(), y = function(e) {
66
- h(this, b, z(e, t(this, a).length)), t(this, a).forEach((l, o) => {
67
+ h(this, b, j(e, t(this, a).length)), t(this, a).forEach((l, o) => {
67
68
  o === t(this, b) ? l.classList.add("current") : l.classList.remove("current");
68
- }), j(this, "billboardChange", {
69
+ }), N(this, "billboardChange", {
69
70
  detail: {
70
71
  counter: t(this, b)
71
72
  }
73
+ }), G(() => {
74
+ window.dispatchEvent(new Event("resize"));
72
75
  });
73
76
  }, T = new WeakMap();
74
77
  customElements.get("e-billboard") || customElements.define("e-billboard", A);
75
78
  var c, u, I, C;
76
- class G extends HTMLElement {
79
+ class J extends HTMLElement {
77
80
  constructor() {
78
81
  super(...arguments);
79
82
  i(this, c, null);
80
83
  i(this, u, []);
81
84
  i(this, I, (e) => {
82
- const l = e.currentTarget, o = t(this, u).findIndex((B) => B === l);
85
+ const l = e.currentTarget, o = t(this, u).findIndex((w) => w === l);
83
86
  o >= 0 && t(this, c).set(o);
84
87
  });
85
88
  i(this, C, () => {
@@ -89,13 +92,13 @@ class G extends HTMLElement {
89
92
  });
90
93
  }
91
94
  connectedCallback() {
92
- h(this, c, q(this, A)), t(this, c) && customElements.whenDefined("e-billboard").then(() => {
95
+ h(this, c, P(this, A)), t(this, c) && customElements.whenDefined("e-billboard").then(() => {
93
96
  var e;
94
97
  if (this.isConnected) {
95
98
  const l = t(this, c).itemElements.length;
96
99
  for (let o = 0; o < l; o++) {
97
- const B = document.createElement("button");
98
- t(this, u).push(B), this.appendChild(B);
100
+ const w = document.createElement("button");
101
+ t(this, u).push(w), this.appendChild(w);
99
102
  }
100
103
  t(this, u).forEach((o) => {
101
104
  o.addEventListener("click", t(this, I));
@@ -117,14 +120,14 @@ class G extends HTMLElement {
117
120
  }
118
121
  }
119
122
  c = new WeakMap(), u = new WeakMap(), I = new WeakMap(), C = new WeakMap();
120
- P && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", G);
121
- var m, f, L;
122
- class J extends HTMLElement {
123
+ D && !customElements.get("e-billboard-bullets") && customElements.define("e-billboard-bullets", J);
124
+ var m, f, p;
125
+ class K extends HTMLElement {
123
126
  constructor() {
124
127
  super();
125
- i(this, m, new F(this, "--index", 0));
128
+ i(this, m, new z(this, "--index", 0));
126
129
  i(this, f, null);
127
- i(this, L, () => {
130
+ i(this, p, () => {
128
131
  var e;
129
132
  t(this, m).current === ((e = t(this, f)) == null ? void 0 : e.counter) ? this.classList.add("current") : this.classList.remove("current");
130
133
  });
@@ -134,45 +137,45 @@ class J extends HTMLElement {
134
137
  }
135
138
  connectedCallback() {
136
139
  var e;
137
- this.tabIndex = 0, h(this, f, q(this, A)), (e = t(this, f)) == null || e.addEventListener(
140
+ this.tabIndex = 0, h(this, f, P(this, A)), (e = t(this, f)) == null || e.addEventListener(
138
141
  "billboardChange",
139
- t(this, L)
142
+ t(this, p)
140
143
  ), customElements.whenDefined("e-billboard").then(() => {
141
- this.isConnected && t(this, L).call(this);
142
- }), t(this, m).subscribe(t(this, L)), t(this, m).observe();
144
+ this.isConnected && t(this, p).call(this);
145
+ }), t(this, m).subscribe(t(this, p)), t(this, m).observe();
143
146
  }
144
147
  disconnectedCallback() {
145
148
  var e;
146
- this.removeAttribute("tabindex"), t(this, m).unsubscribe(t(this, L)), t(this, m).unobserve(), (e = t(this, f)) == null || e.removeEventListener(
149
+ this.removeAttribute("tabindex"), t(this, m).unsubscribe(t(this, p)), t(this, m).unobserve(), (e = t(this, f)) == null || e.removeEventListener(
147
150
  "billboardChange",
148
- t(this, L)
151
+ t(this, p)
149
152
  );
150
153
  }
151
154
  }
152
- m = new WeakMap(), f = new WeakMap(), L = new WeakMap();
153
- P && !customElements.get("e-billboard-set-button") && customElements.define("e-billboard-set-button", J);
155
+ m = new WeakMap(), f = new WeakMap(), p = new WeakMap();
156
+ D && !customElements.get("e-billboard-set-button") && customElements.define("e-billboard-set-button", K);
154
157
  var k, x;
155
- class K extends HTMLElement {
158
+ class O extends HTMLElement {
156
159
  constructor() {
157
160
  super();
158
- i(this, k, new F(this, "--step", 1));
161
+ i(this, k, new z(this, "--step", 1));
159
162
  i(this, x, null);
160
163
  this.addEventListener("click", () => {
161
164
  t(this, x) && t(this, x).shift(t(this, k).current);
162
165
  });
163
166
  }
164
167
  connectedCallback() {
165
- this.tabIndex = 0, h(this, x, q(this, A)), t(this, k).observe();
168
+ this.tabIndex = 0, h(this, x, P(this, A)), t(this, k).observe();
166
169
  }
167
170
  disconnectedCallback() {
168
171
  this.removeAttribute("tabindex"), t(this, k).unobserve();
169
172
  }
170
173
  }
171
174
  k = new WeakMap(), x = new WeakMap();
172
- P && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", K);
175
+ D && !customElements.get("e-billboard-step-button") && customElements.define("e-billboard-step-button", O);
173
176
  export {
174
- G as BillboardBulletsElement,
177
+ J as BillboardBulletsElement,
175
178
  A as BillboardElement,
176
- J as BillboardSetButtonElement,
177
- K as BillboardStepButtonElement
179
+ K as BillboardSetButtonElement,
180
+ O as BillboardStepButtonElement
178
181
  };
@@ -1 +1 @@
1
- "use strict";var p=i=>{throw TypeError(i)};var f=(i,t,s)=>t.has(i)||p("Cannot "+s);var e=(i,t,s)=>(f(i,t,"read from private field"),s?s.call(i):t.get(i)),a=(i,t,s)=>t.has(i)?p("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),g=(i,t,s,d)=>(f(i,t,"write to private field"),d?d.call(i,s):t.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../events-KVanG9sR.cjs"),u=require("../function-MthRj-GJ.cjs");require("../index-Cqw2NKev.cjs");var o,n,h,r,c;class v{constructor(){a(this,o,new Map);a(this,n,!1);a(this,h,u.debounce(()=>{e(this,n)||(g(this,n,!0),l.dispatchEvent(window,"loadingStart"),e(this,r).call(this))},0));a(this,r,()=>{if(!e(this,n))return;const t=e(this,o).size,s=Array.from(e(this,o)).filter(w=>w[1]).length,d=s/t;l.dispatchEvent(window,"loadingProgress",{detail:{total:t,loaded:s,progress:d}}),d===1&&e(this,c).call(this)});a(this,c,u.debounce(()=>{g(this,n,!1),l.dispatchEvent(window,"loadingComplete",{detail:{total:e(this,o).size}}),e(this,o).clear()},0))}get map(){return e(this,o)}add(t){e(this,o).set(t,!1),e(this,h).call(this)}complete(t){e(this,o).set(t,!0),e(this,r).call(this)}error(t){e(this,o).has(t)&&(console.error(`Failed to load ${t}`),e(this,o).delete(t),l.dispatchEvent(window,"loadingError",{detail:{name:t}})),e(this,r).call(this)}}o=new WeakMap,n=new WeakMap,h=new WeakMap,r=new WeakMap,c=new WeakMap;const m=new v;exports.loading=m;
1
+ "use strict";var v=i=>{throw TypeError(i)};var E=(i,t,s)=>t.has(i)||v("Cannot "+s);var e=(i,t,s)=>(E(i,t,"read from private field"),s?s.call(i):t.get(i)),r=(i,t,s)=>t.has(i)?v("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),n=(i,t,s,d)=>(E(i,t,"write to private field"),d?d.call(i,s):t.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../events-KVanG9sR.cjs"),b=require("../function-MthRj-GJ.cjs");require("../index-Cqw2NKev.cjs");var o,a,h,l,c,p,g,f;class q{constructor(){r(this,o,new Map);r(this,a,!1);r(this,h,0);r(this,l,0);r(this,c,0);r(this,p,b.debounce(()=>{e(this,a)||(n(this,a,!0),u.dispatchEvent(document,"loadingStart"),e(this,g).call(this))},0));r(this,g,t=>{if(!e(this,a))return;const s=e(this,o).size,d=Array.from(e(this,o)).filter(S=>S[1]).length,m=d/s;n(this,h,s),n(this,l,d),n(this,c,m),u.dispatchEvent(document,"loadingProgress",{detail:{total:s,loaded:d,progress:m,resourceName:t}}),m===1&&e(this,f).call(this)});r(this,f,b.debounce(()=>{n(this,a,!1),u.dispatchEvent(document,"loadingComplete",{detail:{total:e(this,o).size}}),n(this,h,0),n(this,l,0),n(this,c,0),e(this,o).clear()},0))}get total(){return e(this,h)}get loaded(){return e(this,l)}get progress(){return e(this,c)}get map(){return e(this,o)}add(t){e(this,o).set(t,!1),e(this,p).call(this)}complete(t){e(this,o).set(t,!0),e(this,g).call(this,t)}error(t){e(this,o).has(t)&&(console.error(`Failed to load ${t}`),e(this,o).delete(t),u.dispatchEvent(document,"loadingError",{detail:{name:t}})),e(this,g).call(this)}}o=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,c=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap;const y=new q;exports.loading=y;
@@ -3,6 +3,7 @@ export interface LoadingEvents {
3
3
  total: number;
4
4
  loaded: number;
5
5
  progress: number;
6
+ resourceName: string | undefined;
6
7
  }>;
7
8
  loadingStart: CustomEvent<{}>;
8
9
  loadingComplete: CustomEvent<{
@@ -14,6 +15,9 @@ export interface LoadingEvents {
14
15
  }
15
16
  declare class Loading {
16
17
  #private;
18
+ get total(): number;
19
+ get loaded(): number;
20
+ get progress(): number;
17
21
  get map(): Map<string, boolean>;
18
22
  add(resourceName: string): void;
19
23
  complete(resourceName: string): void;
@@ -21,7 +25,7 @@ declare class Loading {
21
25
  }
22
26
  export declare const loading: Loading;
23
27
  declare global {
24
- interface WindowEventMap extends LoadingEvents {
28
+ interface DocumentEventMap extends LoadingEvents {
25
29
  }
26
30
  }
27
31
  export {};
@@ -1,58 +1,71 @@
1
- var c = (s) => {
2
- throw TypeError(s);
1
+ var w = (i) => {
2
+ throw TypeError(i);
3
3
  };
4
- var g = (s, t, e) => t.has(s) || c("Cannot " + e);
5
- var i = (s, t, e) => (g(s, t, "read from private field"), e ? e.call(s) : t.get(s)), r = (s, t, e) => t.has(s) ? c("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), f = (s, t, e, l) => (g(s, t, "write to private field"), l ? l.call(s, e) : t.set(s, e), e);
6
- import { d as n } from "../events-CsVF98U6.js";
7
- import { d as w } from "../function-C10DGppn.js";
4
+ var z = (i, t, e) => t.has(i) || w("Cannot " + e);
5
+ var s = (i, t, e) => (z(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? w("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), a = (i, t, e, d) => (z(i, t, "write to private field"), d ? d.call(i, e) : t.set(i, e), e);
6
+ import { d as c } from "../events-CsVF98U6.js";
7
+ import { d as E } from "../function-C10DGppn.js";
8
8
  import "../index-euf5anj6.js";
9
- var o, a, h, d, p;
10
- class u {
9
+ var o, h, l, n, g, m, p, f;
10
+ class b {
11
11
  constructor() {
12
12
  r(this, o, /* @__PURE__ */ new Map());
13
- r(this, a, !1);
14
- r(this, h, w(() => {
15
- i(this, a) || (f(this, a, !0), n(window, "loadingStart"), i(this, d).call(this));
13
+ r(this, h, !1);
14
+ r(this, l, 0);
15
+ r(this, n, 0);
16
+ r(this, g, 0);
17
+ r(this, m, E(() => {
18
+ s(this, h) || (a(this, h, !0), c(document, "loadingStart"), s(this, p).call(this));
16
19
  }, 0));
17
- r(this, d, () => {
18
- if (!i(this, a))
20
+ r(this, p, (t) => {
21
+ if (!s(this, h))
19
22
  return;
20
- const t = i(this, o).size, e = Array.from(i(this, o)).filter((m) => m[1]).length, l = e / t;
21
- n(window, "loadingProgress", {
23
+ const e = s(this, o).size, d = Array.from(s(this, o)).filter((S) => S[1]).length, u = d / e;
24
+ a(this, l, e), a(this, n, d), a(this, g, u), c(document, "loadingProgress", {
22
25
  detail: {
23
- total: t,
24
- loaded: e,
25
- progress: l
26
+ total: e,
27
+ loaded: d,
28
+ progress: u,
29
+ resourceName: t
26
30
  }
27
- }), l === 1 && i(this, p).call(this);
31
+ }), u === 1 && s(this, f).call(this);
28
32
  });
29
- r(this, p, w(() => {
30
- f(this, a, !1), n(window, "loadingComplete", {
33
+ r(this, f, E(() => {
34
+ a(this, h, !1), c(document, "loadingComplete", {
31
35
  detail: {
32
- total: i(this, o).size
36
+ total: s(this, o).size
33
37
  }
34
- }), i(this, o).clear();
38
+ }), a(this, l, 0), a(this, n, 0), a(this, g, 0), s(this, o).clear();
35
39
  }, 0));
36
40
  }
41
+ get total() {
42
+ return s(this, l);
43
+ }
44
+ get loaded() {
45
+ return s(this, n);
46
+ }
47
+ get progress() {
48
+ return s(this, g);
49
+ }
37
50
  get map() {
38
- return i(this, o);
51
+ return s(this, o);
39
52
  }
40
53
  add(t) {
41
- i(this, o).set(t, !1), i(this, h).call(this);
54
+ s(this, o).set(t, !1), s(this, m).call(this);
42
55
  }
43
56
  complete(t) {
44
- i(this, o).set(t, !0), i(this, d).call(this);
57
+ s(this, o).set(t, !0), s(this, p).call(this, t);
45
58
  }
46
59
  error(t) {
47
- i(this, o).has(t) && (console.error(`Failed to load ${t}`), i(this, o).delete(t), n(window, "loadingError", {
60
+ s(this, o).has(t) && (console.error(`Failed to load ${t}`), s(this, o).delete(t), c(document, "loadingError", {
48
61
  detail: {
49
62
  name: t
50
63
  }
51
- })), i(this, d).call(this);
64
+ })), s(this, p).call(this);
52
65
  }
53
66
  }
54
- o = new WeakMap(), a = new WeakMap(), h = new WeakMap(), d = new WeakMap(), p = new WeakMap();
55
- const k = new u();
67
+ o = new WeakMap(), h = new WeakMap(), l = new WeakMap(), n = new WeakMap(), g = new WeakMap(), m = new WeakMap(), p = new WeakMap(), f = new WeakMap();
68
+ const A = new b();
56
69
  export {
57
- k as loading
70
+ A as loading
58
71
  };
@@ -28,11 +28,16 @@ export interface MorphNavigateOptions {
28
28
  offsetScroll?: number | ElementOrSelector<HTMLElement>;
29
29
  revalidate?: boolean;
30
30
  }
31
+ export interface MorphScrollDetail {
32
+ left: number;
33
+ top: number;
34
+ }
31
35
  export interface MorphEvents {
32
36
  morphStart: CustomEvent<MorphTransitionEntry>;
33
37
  morphComplete: CustomEvent<MorphTransitionEntry>;
34
38
  morphNewChildrenAdded: CustomEvent<MorphChildrenActionEntry>;
35
39
  morphOldChildrenRemoved: CustomEvent<MorphChildrenActionEntry>;
40
+ morphScroll: CustomEvent<MorphScrollDetail>;
36
41
  }
37
42
  export declare class Morph {
38
43
  #private;
@@ -1 +1 @@
1
- "use strict";var pt=(n,t)=>(t=Symbol[n])?t:Symbol.for("Symbol."+n),Et=n=>{throw TypeError(n)};var $=(n,t,s)=>t.has(n)||Et("Cannot "+s);var e=(n,t,s)=>($(n,t,"read from private field"),s?s.call(n):t.get(n)),o=(n,t,s)=>t.has(n)?Et("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,s),a=(n,t,s,i)=>($(n,t,"write to private field"),i?i.call(n,s):t.set(n,s),s),d=(n,t,s)=>($(n,t,"access private method"),s);var M=(n,t,s)=>new Promise((i,u)=>{var f=l=>{try{k(s.next(l))}catch(g){u(g)}},B=l=>{try{k(s.throw(l))}catch(g){u(g)}},k=l=>l.done?i(l.value):Promise.resolve(l.value).then(f,B);k((s=s.apply(n,t)).next())});var gt=(n,t,s)=>(t=n[pt("asyncIterator")])?t.call(n):(n=n[pt("iterator")](),t={},s=(i,u)=>(u=n[i])&&(t[i]=f=>new Promise((B,k,l)=>(f=u.call(n,f),l=f.done,Promise.resolve(f.value).then(g=>B({value:g,done:l}),k)))),s("next"),s("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=require("../index-Cqw2NKev.cjs"),G=require("../events-KVanG9sR.cjs"),Mt=require("../polyfills-Df4r-ETT.cjs"),Tt=require("../scroll-H9zqFeML.cjs"),J=require("../url-CLvdjbII.cjs"),Ht=require("../css-value-parser/index.cjs");class Lt 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)}}St.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",Lt);var w,c,T,W,z;class vt{constructor(t,s){o(this,w);o(this,c);o(this,T);o(this,W,t=>{t.preventDefault();const s=e(this,c).getAttribute("data-history-action")||"push",i=e(this,c).hasAttribute("data-center-scroll"),u=getComputedStyle(e(this,c)).getPropertyValue("--offset-scroll").trim(),f=u?Ht.cssValueParser.parse(u):void 0,B=e(this,c).hasAttribute("data-revalidate");e(this,w).navigate(e(this,T),{historyAction:s,centerScroll:i,offsetScroll:f,revalidate:B})});o(this,z,()=>{e(this,w).prefetch(e(this,T)),e(this,c).removeEventListener("pointerenter",e(this,z))});a(this,w,s),a(this,c,t),a(this,T,e(this,c).getAttribute("href")||"/"),e(this,c).addEventListener("click",e(this,W)),this.checkCurrent(location.pathname),e(this,c).hasAttribute("data-prefetch")&&e(this,c).addEventListener("pointerenter",e(this,z))}get element(){return e(this,c)}checkCurrent(t){const s=e(this,w).normalizePath(t),i=e(this,w).normalizePath(e(this,T));e(this,c).hasAttribute("data-include")&&s.pathname.includes(i.pathname)?e(this,c).classList.add("current"):i.pathname===s.pathname?e(this,c).classList.add("current"):e(this,c).classList.remove("current")}destroy(){e(this,c).removeEventListener("click",e(this,W)),e(this,c).removeEventListener("pointerenter",e(this,z)),e(this,c).classList.remove("current")}}w=new WeakMap,c=new WeakMap,T=new WeakMap,W=new WeakMap,z=new WeakMap;var H,F,p,x,N,b;class yt{constructor(t,s,i){o(this,H);o(this,F);o(this,p,{x:0,y:0});o(this,x);o(this,N,null);o(this,b,null);a(this,H,t),a(this,F,s),a(this,x,i.cloneNode(!0))}get pathname(){return e(this,F)}get scrollState(){return e(this,p)}get document(){return e(this,b)}cloneDocument(){a(this,b,(e(this,N)||e(this,x)).cloneNode(!0))}get title(){let t="";if(e(this,b).title)t=e(this,b).title;else{const s=e(this,b).querySelector("h1");t=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||e(this,F)}return t}clearScrollState(){e(this,p).x=0,e(this,p).y=0}clearDocumentState(){a(this,N,null)}saveScrollState(){e(this,x).documentElement.hasAttribute("data-no-scroll-restoration")?(e(this,p).x=0,e(this,p).y=0):(e(this,p).x=e(this,H).scrollElement.scrollLeft,e(this,p).y=e(this,H).scrollElement.scrollTop)}saveDocumentState(){e(this,x).documentElement.hasAttribute("data-no-page-restoration")?a(this,N,null):a(this,N,document.cloneNode(!0))}restoreScrollPosition(){e(this,H).scrollElement.scroll({top:e(this,p).y,left:e(this,p).x})}}H=new WeakMap,F=new WeakMap,p=new WeakMap,x=new WeakMap,N=new WeakMap,b=new WeakMap;var P,j,E,Q,A,m,U,D,C,I,V,R,h,tt,et,st,wt,it,nt,rt,ot,X;class xt{constructor(t){o(this,h);o(this,P,null);o(this,j,null);o(this,E,[]);o(this,Q,new DOMParser);o(this,A);o(this,m,null);o(this,U);o(this,D,[]);o(this,C,!1);o(this,I,null);o(this,V,new Map);o(this,R,null);o(this,X,t=>M(this,null,function*(){var s;(s=t.state)!=null&&s.path&&(a(this,C,!0),yield this.navigate(t.state.path,{historyAction:"none"}),a(this,C,!1))}));if(St.isBrowser){a(this,P,{base:J.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,j,d(this,h,st).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,X)),J.changeHistory({action:"replace",pathname:e(this,m),searchParameters:s.parameters,hash:s.hash}),a(this,R,new Lt),d(this,h,rt).call(this,document)}}get currentPathname(){return e(this,m)}get previousPathname(){return e(this,U)}get links(){return e(this,E)}get scrollElement(){return e(this,I)}normalizePath(t){return J.splitPath(t,{base:e(this,P).base,trailingSlash:e(this,P).trailingSlash})}prefetch(t){return M(this,null,function*(){const s=this.normalizePath(t);d(this,h,et).call(this,s.pathname)})}navigate(B){return M(this,arguments,function*(t,{historyAction:s="push",centerScroll:i,offsetScroll:u,revalidate:f}={}){if(e(this,D).length)return;const k=this.normalizePath(t);let{pathname:l,hash:g,parameters:bt,leaf:Pt}=k;if(e(this,A)===l||e(this,m)===l){e(this,C)||d(this,h,ot).call(this,g||0,{centerScroll:i,offsetScroll:u,behavior:"smooth"});return}a(this,A,l),e(this,E).forEach(q=>{q.checkCurrent(l)});try{let q=!0;if(this.preprocessor)try{yield new Promise((r,S)=>{var L;(L=this.preprocessor)==null||L.call(this,{pathname:l,resolve:r,reject:S})})}catch(r){r?console.error(r):console.log("Route change canceled"),q=!1}if(!q||e(this,A)!==l){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}const at=yield d(this,h,tt).call(this,e(this,m)),y=yield d(this,h,tt).call(this,l,f);if(e(this,A)!==l){e(this,E).forEach(r=>{r.checkCurrent(e(this,m))});return}at.saveScrollState(),at.saveDocumentState(),e(this,C)||(y.clearScrollState(),y.clearDocumentState()),y.cloneDocument(),e(this,R).textContent=y.title,document.body.appendChild(e(this,R));const ht={pathname:l};G.dispatchEvent(document,"morphStart",{detail:ht});const lt=Array.from(document.head.children),ct=Array.from(y.document.head.children),ut=d(this,h,wt).call(this,lt,ct),At=d(this,h,it).call(this,lt,ut),_=d(this,h,it).call(this,ct,ut);_.forEach((r,S)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const L=document.createElement("script");L.type="module",L.src=r.getAttribute("src"),_[S]=L}}),_.forEach(r=>{document.head.appendChild(r)});const Z=_.filter(r=>{if(r.hasAttribute("data-no-waiting"))return!1;if(d(this,h,nt).call(this,r))return!0});e(this,P).waitForHeadToLoad&&Z.length&&(yield new Promise(r=>M(this,null,function*(){let S=0;try{for(var L=gt(Z),mt,O,ft;mt=!(O=yield L.next()).done;mt=!1){const K=O.value;K.onload=()=>{S++,S===Z.length&&r()}}}catch(O){ft=[O]}finally{try{mt&&(O=L.return)&&(yield O.call(L))}finally{if(ft)throw ft[0]}}})));const dt=[];At.forEach(r=>{r.hasAttribute("data-permanent")||(d(this,h,nt).call(this,r)?dt.push(r):r.remove())});const Ct=d(this,h,st).call(this,y.document.body);d(this,h,rt).call(this,y.document),document.documentElement.setAttribute("data-current-pathname",l),document.documentElement.setAttribute("data-current-leaf",Pt),J.changeHistory({action:s,pathname:l,searchParameters:bt,hash:g}),e(this,R).remove(),a(this,U,e(this,m)),a(this,m,l),e(this,j).forEach((r,S)=>{const L=Ct[S],mt=getComputedStyle(r).getPropertyValue("--morph-duration"),O=[...L.childNodes];if(mt){const ft=[...r.childNodes];ft.forEach(v=>{v instanceof HTMLElement&&v.classList.add("old")}),O.forEach(v=>{v instanceof HTMLElement&&v.classList.add("new")}),r.prepend(...O),Mt.requestIdleCallback(()=>{O.forEach(v=>{v instanceof HTMLElement&&v.classList.add("in")})});const K={morphElement:r,pathname:l};G.dispatchEvent(document,"morphNewChildrenAdded",{detail:K});const kt=new Promise(v=>{setTimeout(()=>{ft.forEach(Y=>Y.remove()),O.forEach(Y=>{Y instanceof HTMLElement&&Y.classList.remove("in","new")}),G.dispatchEvent(document,"morphOldChildrenRemoved",{detail:K}),v()},(parseFloat(mt)||0)*1e3+10)});e(this,D).push(kt)}else r.innerHTML="",r.append(...O)}),g?(y.clearScrollState(),d(this,h,ot).call(this,g,{centerScroll:i,offsetScroll:u})):e(this,C)&&y.restoreScrollPosition(),yield Promise.all(e(this,D)),dt.forEach(r=>r.remove()),a(this,D,[]),this.findLinks(),G.dispatchEvent(document,"morphComplete",{detail:ht}),window.dispatchEvent(new Event("resize"))}catch(q){console.error(q)}a(this,A,void 0)})}addLink(t){e(this,E).push(new vt(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 vt(s,this)))}}P=new WeakMap,j=new WeakMap,E=new WeakMap,Q=new WeakMap,A=new WeakMap,m=new WeakMap,U=new WeakMap,D=new WeakMap,C=new WeakMap,I=new WeakMap,V=new WeakMap,R=new WeakMap,h=new WeakSet,tt=function(t,s=!1){return M(this,null,function*(){let i=e(this,V).get(t);return(!i||s)&&(i=yield d(this,h,et).call(this,t)),i})},et=function(t){return M(this,null,function*(){const i=yield(yield fetch(t)).text(),u=e(this,Q).parseFromString(i,"text/html"),f=new yt(this,t,u);return e(this,V).set(t,f),f})},st=function(t){const s=[...t.querySelectorAll("[data-morph]")];return s.length?s:[t]},wt=function(t,s){return t.filter(i=>s.find(u=>u.outerHTML===i.outerHTML))},it=function(t,s){return t.filter(i=>!s.find(u=>u.outerHTML===i.outerHTML))},nt=function(t){return t.tagName==="SCRIPT"||t.tagName==="STYLE"||t.tagName==="LINK"&&t.getAttribute("rel")==="stylesheet"},rt=function(t){a(this,I,t.querySelector(e(this,P).scrollSelector)||t.documentElement)},ot=function(t,s){const i=typeof t=="string"?document.getElementById(t):t;(typeof i=="number"||i)&&Tt.scrollToElement(i,{scrollElement:e(this,I),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},X=new WeakMap;exports.Morph=xt;
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;