aptechka 0.82.6 → 0.83.1

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.
Files changed (59) hide show
  1. package/lib/Composed-C-TV9te3.cjs +1 -0
  2. package/lib/Composed-DyAWjEXE.js +121 -0
  3. package/lib/{LocalLinks-Baf0xWZ3.cjs → LocalLinks-BxhSFv_Q.cjs} +1 -1
  4. package/lib/{LocalLinks-Z9pxKguG.js → LocalLinks-DFZFpbjs.js} +2 -2
  5. package/lib/api-fetcher/index.cjs +1 -0
  6. package/lib/api-fetcher/index.d.ts +16 -0
  7. package/lib/api-fetcher/index.js +100 -0
  8. package/lib/jsx/h.d.ts +15 -0
  9. package/lib/jsx/hydrate.d.ts +1 -0
  10. package/lib/jsx/index.cjs +1 -1
  11. package/lib/jsx/index.d.ts +4 -1
  12. package/lib/jsx/index.js +312 -87
  13. package/lib/jsx/integrations/astro/client.cjs +1 -0
  14. package/lib/jsx/integrations/astro/client.d.ts +2 -0
  15. package/lib/jsx/integrations/astro/client.js +50 -0
  16. package/lib/jsx/integrations/astro/index.cjs +1 -0
  17. package/lib/jsx/integrations/astro/index.d.ts +2 -0
  18. package/lib/jsx/integrations/astro/index.js +54 -0
  19. package/lib/jsx/integrations/astro/server.cjs +1 -0
  20. package/lib/jsx/integrations/astro/server.d.ts +3 -0
  21. package/lib/jsx/integrations/astro/server.js +35 -0
  22. package/lib/jsx/plugins/vite.d.ts +21 -0
  23. package/lib/jsx/render.d.ts +1 -1
  24. package/lib/jsx/type.d.ts +190 -221
  25. package/lib/jsx/utils/children/createElement.d.ts +1 -0
  26. package/lib/jsx/utils/children/hydrateTextNode.d.ts +1 -0
  27. package/lib/local-links/index.cjs +1 -1
  28. package/lib/local-links/index.js +1 -1
  29. package/lib/morph/index.cjs +1 -1
  30. package/lib/morph/index.js +72 -72
  31. package/lib/{morph-D_ybmXWR.js → morph-BQErz7qP.js} +8 -8
  32. package/lib/popover/index.cjs +1 -1
  33. package/lib/popover/index.js +1 -1
  34. package/lib/render-DQs7rIoN.cjs +1 -0
  35. package/lib/render-D_0FCWEu.js +18 -0
  36. package/lib/router/index.cjs +1 -1
  37. package/lib/router/index.js +3 -3
  38. package/lib/spa/index.cjs +1 -1
  39. package/lib/spa/index.js +3 -3
  40. package/lib/store/index.cjs +1 -1
  41. package/lib/store/index.js +6 -7
  42. package/lib/url-CHgcNwJ1.cjs +1 -0
  43. package/lib/url-CYgo5vrG.js +113 -0
  44. package/lib/utils/index.cjs +1 -1
  45. package/lib/utils/index.js +45 -43
  46. package/lib/utils/polyfills.d.ts +1 -1
  47. package/lib/utils/url.d.ts +6 -0
  48. package/lib/vite-C-i3hVDL.js +75 -0
  49. package/lib/vite-DzanPumM.cjs +44 -0
  50. package/package.json +40 -7
  51. package/lib/Composed-C-mnUGX6.js +0 -70
  52. package/lib/Composed-RFcm2x5c.cjs +0 -1
  53. package/lib/DerivedArray-DdCR-Oy7.cjs +0 -1
  54. package/lib/DerivedArray-opbeygTL.js +0 -59
  55. package/lib/jsx/plugins/hmr.d.ts +0 -13
  56. package/lib/render-1u700s93.js +0 -212
  57. package/lib/render-BIOfUddT.cjs +0 -1
  58. package/lib/url-CPgw9bd5.cjs +0 -1
  59. package/lib/url-DAl-mgbC.js +0 -97
package/lib/jsx/type.d.ts CHANGED
@@ -1,228 +1,197 @@
1
1
  import { Store } from '../store';
2
2
  import { ClassListInput } from './utils/attributes/class';
3
3
  import { StyleAttribute } from './utils/attributes/style';
4
- type StoreOr<T> = T | Store<T | null | undefined>
5
-
6
4
  declare global {
7
- namespace JSX {
8
- export type Children = Array<
9
- | Element
10
- | string
11
- | number
12
- | null
13
- | undefined
14
- | Store<any>
15
- | Array<Children>
16
- >
17
-
18
- type Fragment = any
19
-
20
- type StoreOr<T> = T | Store<any>
21
-
22
- type Ref<T = unknown> = { value: T }
23
-
24
- type ComponentBaseProps = {
25
- children?: Children
5
+ type StoreOr<T> = T | Store<T | null | undefined>;
6
+ namespace JSX {
7
+ type Children = Array<Element | string | number | null | undefined | Store<any> | Array<Children>>;
8
+ type Fragment = any;
9
+ type StoreOr<T> = T | Store<any>;
10
+ type Ref<T = unknown> = {
11
+ value: T;
12
+ };
13
+ type ComponentBaseProps = {
14
+ children?: Children | Children[number];
15
+ };
16
+ type Component<TProps extends object = object> = {
17
+ formAssociated?: boolean;
18
+ template?: boolean;
19
+ (props: ComponentBaseProps & TProps): Children[number];
20
+ };
21
+ type EventMap = keyof HTMLElementEventMap | keyof SVGElementEventMap;
22
+ type Events = Partial<{
23
+ [K in `on${Capitalize<EventMap>}`]: (event: (HTMLElementEventMap & SVGElementEventMap)[Extract<Uncapitalize<Extract<K, `on${string}`>>, EventMap>]) => void;
24
+ }>;
25
+ interface KnownAttributes {
26
+ accept?: StoreOr<string>;
27
+ acceptCharset?: StoreOr<string>;
28
+ accessKey?: StoreOr<string>;
29
+ action?: StoreOr<string>;
30
+ allowFullScreen?: StoreOr<boolean>;
31
+ allowTransparency?: StoreOr<boolean>;
32
+ alt?: StoreOr<string>;
33
+ as?: StoreOr<string>;
34
+ async?: StoreOr<boolean>;
35
+ autocomplete?: StoreOr<string>;
36
+ autoComplete?: StoreOr<string>;
37
+ autocorrect?: StoreOr<string>;
38
+ autoCorrect?: StoreOr<string>;
39
+ autofocus?: StoreOr<boolean>;
40
+ autoFocus?: StoreOr<boolean>;
41
+ autoPlay?: StoreOr<boolean>;
42
+ capture?: StoreOr<boolean | string>;
43
+ cellPadding?: StoreOr<number | string>;
44
+ cellSpacing?: StoreOr<number | string>;
45
+ charSet?: StoreOr<string>;
46
+ challenge?: StoreOr<string>;
47
+ checked?: StoreOr<boolean>;
48
+ class?: ClassListInput;
49
+ className?: ClassListInput;
50
+ cols?: StoreOr<number>;
51
+ colSpan?: StoreOr<number>;
52
+ content?: StoreOr<string>;
53
+ contentEditable?: StoreOr<boolean>;
54
+ contextMenu?: StoreOr<string>;
55
+ controls?: StoreOr<boolean>;
56
+ controlsList?: StoreOr<string>;
57
+ coords?: StoreOr<string>;
58
+ crossOrigin?: StoreOr<string>;
59
+ data?: StoreOr<string>;
60
+ dateTime?: StoreOr<string>;
61
+ default?: StoreOr<boolean>;
62
+ defer?: StoreOr<boolean>;
63
+ dir?: StoreOr<'auto' | 'rtl' | 'ltr'>;
64
+ disabled?: StoreOr<boolean>;
65
+ disableRemotePlayback?: StoreOr<boolean>;
66
+ download?: StoreOr<string>;
67
+ draggable?: StoreOr<'false' | true>;
68
+ encType?: StoreOr<string>;
69
+ form?: StoreOr<string>;
70
+ formAction?: StoreOr<string>;
71
+ formEncType?: StoreOr<string>;
72
+ formMethod?: StoreOr<string>;
73
+ formNoValidate?: StoreOr<boolean>;
74
+ formTarget?: StoreOr<string>;
75
+ frameBorder?: StoreOr<number | string>;
76
+ headers?: StoreOr<string>;
77
+ height?: StoreOr<number | string>;
78
+ hidden?: StoreOr<boolean>;
79
+ high?: StoreOr<number>;
80
+ href?: StoreOr<string>;
81
+ hrefLang?: StoreOr<string>;
82
+ for?: StoreOr<string>;
83
+ htmlFor?: StoreOr<string>;
84
+ httpEquiv?: StoreOr<string>;
85
+ icon?: StoreOr<string>;
86
+ id?: StoreOr<string>;
87
+ inputMode?: StoreOr<string>;
88
+ integrity?: StoreOr<string>;
89
+ is?: StoreOr<string>;
90
+ keyParams?: StoreOr<string>;
91
+ keyType?: StoreOr<string>;
92
+ kind?: StoreOr<string>;
93
+ label?: StoreOr<string>;
94
+ lang?: StoreOr<string>;
95
+ list?: StoreOr<string>;
96
+ loading?: StoreOr<'eager' | 'lazy'>;
97
+ loop?: StoreOr<boolean>;
98
+ low?: StoreOr<number>;
99
+ manifest?: StoreOr<string>;
100
+ marginHeight?: StoreOr<number>;
101
+ marginWidth?: StoreOr<number>;
102
+ max?: StoreOr<number | string>;
103
+ maxLength?: StoreOr<number>;
104
+ media?: StoreOr<string>;
105
+ mediaGroup?: StoreOr<string>;
106
+ method?: StoreOr<string>;
107
+ min?: StoreOr<number | string>;
108
+ minLength?: StoreOr<number>;
109
+ multiple?: StoreOr<boolean>;
110
+ muted?: StoreOr<boolean>;
111
+ name?: StoreOr<string>;
112
+ nonce?: StoreOr<string>;
113
+ noValidate?: StoreOr<boolean>;
114
+ open?: StoreOr<boolean>;
115
+ optimum?: StoreOr<number>;
116
+ pattern?: StoreOr<string>;
117
+ placeholder?: StoreOr<string>;
118
+ playsInline?: StoreOr<boolean>;
119
+ poster?: StoreOr<string>;
120
+ preload?: StoreOr<string>;
121
+ radioGroup?: StoreOr<string>;
122
+ readOnly?: StoreOr<boolean>;
123
+ rel?: StoreOr<string>;
124
+ required?: StoreOr<boolean>;
125
+ role?: StoreOr<string>;
126
+ rows?: StoreOr<number>;
127
+ rowSpan?: StoreOr<number>;
128
+ sandbox?: StoreOr<string>;
129
+ scope?: StoreOr<string>;
130
+ scoped?: StoreOr<boolean>;
131
+ scrolling?: StoreOr<string>;
132
+ seamless?: StoreOr<boolean>;
133
+ selected?: StoreOr<boolean>;
134
+ shape?: StoreOr<string>;
135
+ size?: StoreOr<number>;
136
+ sizes?: StoreOr<string>;
137
+ slot?: StoreOr<string>;
138
+ span?: StoreOr<number>;
139
+ spellcheck?: StoreOr<boolean>;
140
+ src?: StoreOr<string>;
141
+ srcset?: StoreOr<string>;
142
+ srcDoc?: StoreOr<string>;
143
+ srcLang?: StoreOr<string>;
144
+ srcSet?: StoreOr<string>;
145
+ start?: StoreOr<number>;
146
+ step?: StoreOr<number | string>;
147
+ style?: StyleAttribute | string;
148
+ summary?: StoreOr<string>;
149
+ tabIndex?: StoreOr<number>;
150
+ target?: StoreOr<string>;
151
+ title?: StoreOr<string>;
152
+ type?: StoreOr<string>;
153
+ useMap?: StoreOr<string>;
154
+ value?: StoreOr<string | string[] | number>;
155
+ volume?: StoreOr<number>;
156
+ width?: StoreOr<number | string>;
157
+ wmode?: StoreOr<string>;
158
+ wrap?: StoreOr<string>;
159
+ about?: StoreOr<string>;
160
+ datatype?: StoreOr<string>;
161
+ inlist?: StoreOr<boolean>;
162
+ prefix?: StoreOr<string>;
163
+ property?: StoreOr<string>;
164
+ resource?: StoreOr<string>;
165
+ typeof?: StoreOr<string>;
166
+ vocab?: StoreOr<string>;
167
+ itemProp?: StoreOr<string>;
168
+ itemScope?: StoreOr<boolean>;
169
+ itemType?: StoreOr<string>;
170
+ itemID?: StoreOr<string>;
171
+ itemRef?: StoreOr<string>;
172
+ ref?: Ref<any> | Array<Ref<any>>;
173
+ key?: string;
174
+ setHtml?: any;
175
+ }
176
+ type UnknownAttributes = {
177
+ [key: string]: any;
178
+ };
179
+ type Attributes = KnownAttributes & Events & {
180
+ [key: string]: any;
181
+ } & UnknownAttributes;
182
+ type TagNameMap = 'component' | 'shadow' | 'nest' | `${string}-${string}` | keyof HTMLElementTagNameMap | keyof SVGElementTagNameMap;
183
+ type IntrinsicElementsHTML = {
184
+ [TKey in TagNameMap]?: Attributes;
185
+ };
186
+ type IntrinsicElements = IntrinsicElementsHTML;
26
187
  }
27
-
28
- type Component<TProps extends object = object> = {
29
- formAssociated?: boolean
30
- template?: boolean
31
- (props: ComponentBaseProps & TProps): Children['number']
188
+ interface Node {
189
+ __storeId: string;
190
+ __key: string;
32
191
  }
33
-
34
- type EventMap = keyof HTMLElementEventMap | keyof SVGElementEventMap
35
-
36
- type Events = Partial<{
37
- [K in `on${Capitalize<EventMap>}`]: (
38
- event: (HTMLElementEventMap & SVGElementEventMap)[Uncapitalize<
39
- Extract<K, `on${string}`> extends `on${infer T}` ? T : never
40
- >],
41
- ) => void
42
- }>
43
-
44
- interface KnownAttributes {
45
- accept?: StoreOr<string>
46
- acceptCharset?: StoreOr<string>
47
- accessKey?: StoreOr<string>
48
- action?: StoreOr<string>
49
- allowFullScreen?: StoreOr<boolean>
50
- allowTransparency?: StoreOr<boolean>
51
- alt?: StoreOr<string>
52
- as?: StoreOr<string>
53
- async?: StoreOr<boolean>
54
- autocomplete?: StoreOr<string>
55
- autoComplete?: StoreOr<string>
56
- autocorrect?: StoreOr<string>
57
- autoCorrect?: StoreOr<string>
58
- autofocus?: StoreOr<boolean>
59
- autoFocus?: StoreOr<boolean>
60
- autoPlay?: StoreOr<boolean>
61
- capture?: StoreOr<boolean | string>
62
- cellPadding?: StoreOr<number | string>
63
- cellSpacing?: StoreOr<number | string>
64
- charSet?: StoreOr<string>
65
- challenge?: StoreOr<string>
66
- checked?: StoreOr<boolean>
67
- class?: ClassListInput
68
- className?: ClassListInput
69
- cols?: StoreOr<number>
70
- colSpan?: StoreOr<number>
71
- content?: StoreOr<string>
72
- contentEditable?: StoreOr<boolean>
73
- contextMenu?: StoreOr<string>
74
- controls?: StoreOr<boolean>
75
- controlsList?: StoreOr<string>
76
- coords?: StoreOr<string>
77
- crossOrigin?: StoreOr<string>
78
- data?: StoreOr<string>
79
- dateTime?: StoreOr<string>
80
- default?: StoreOr<boolean>
81
- defer?: StoreOr<boolean>
82
- dir?: StoreOr<'auto' | 'rtl' | 'ltr'>
83
- disabled?: StoreOr<boolean>
84
- disableRemotePlayback?: StoreOr<boolean>
85
- download?: StoreOr<string>
86
- draggable?: StoreOr<'false' | true>
87
- encType?: StoreOr<string>
88
- form?: StoreOr<string>
89
- formAction?: StoreOr<string>
90
- formEncType?: StoreOr<string>
91
- formMethod?: StoreOr<string>
92
- formNoValidate?: StoreOr<boolean>
93
- formTarget?: StoreOr<string>
94
- frameBorder?: StoreOr<number | string>
95
- headers?: StoreOr<string>
96
- height?: StoreOr<number | string>
97
- hidden?: StoreOr<boolean>
98
- high?: StoreOr<number>
99
- href?: StoreOr<string>
100
- hrefLang?: StoreOr<string>
101
- for?: StoreOr<string>
102
- htmlFor?: StoreOr<string>
103
- httpEquiv?: StoreOr<string>
104
- icon?: StoreOr<string>
105
- id?: StoreOr<string>
106
- inputMode?: StoreOr<string>
107
- integrity?: StoreOr<string>
108
- is?: StoreOr<string>
109
- keyParams?: StoreOr<string>
110
- keyType?: StoreOr<string>
111
- kind?: StoreOr<string>
112
- label?: StoreOr<string>
113
- lang?: StoreOr<string>
114
- list?: StoreOr<string>
115
- loading?: StoreOr<'eager' | 'lazy'>
116
- loop?: StoreOr<boolean>
117
- low?: StoreOr<number>
118
- manifest?: StoreOr<string>
119
- marginHeight?: StoreOr<number>
120
- marginWidth?: StoreOr<number>
121
- max?: StoreOr<number | string>
122
- maxLength?: StoreOr<number>
123
- media?: StoreOr<string>
124
- mediaGroup?: StoreOr<string>
125
- method?: StoreOr<string>
126
- min?: StoreOr<number | string>
127
- minLength?: StoreOr<number>
128
- multiple?: StoreOr<boolean>
129
- muted?: StoreOr<boolean>
130
- name?: StoreOr<string>
131
- nonce?: StoreOr<string>
132
- noValidate?: StoreOr<boolean>
133
- open?: StoreOr<boolean>
134
- optimum?: StoreOr<number>
135
- pattern?: StoreOr<string>
136
- placeholder?: StoreOr<string>
137
- playsInline?: StoreOr<boolean>
138
- poster?: StoreOr<string>
139
- preload?: StoreOr<string>
140
- radioGroup?: StoreOr<string>
141
- readOnly?: StoreOr<boolean>
142
- rel?: StoreOr<string>
143
- required?: StoreOr<boolean>
144
- role?: StoreOr<string>
145
- rows?: StoreOr<number>
146
- rowSpan?: StoreOr<number>
147
- sandbox?: StoreOr<string>
148
- scope?: StoreOr<string>
149
- scoped?: StoreOr<boolean>
150
- scrolling?: StoreOr<string>
151
- seamless?: StoreOr<boolean>
152
- selected?: StoreOr<boolean>
153
- shape?: StoreOr<string>
154
- size?: StoreOr<number>
155
- sizes?: StoreOr<string>
156
- slot?: StoreOr<string>
157
- span?: StoreOr<number>
158
- spellcheck?: StoreOr<boolean>
159
- src?: StoreOr<string>
160
- srcset?: StoreOr<string>
161
- srcDoc?: StoreOr<string>
162
- srcLang?: StoreOr<string>
163
- srcSet?: StoreOr<string>
164
- start?: StoreOr<number>
165
- step?: StoreOr<number | string>
166
- style?: StyleAttribute | string
167
- summary?: StoreOr<string>
168
- tabIndex?: StoreOr<number>
169
- target?: StoreOr<string>
170
- title?: StoreOr<string>
171
- type?: StoreOr<string>
172
- useMap?: StoreOr<string>
173
- value?: StoreOr<string | string[] | number>
174
- volume?: StoreOr<number>
175
- width?: StoreOr<number | string>
176
- wmode?: StoreOr<string>
177
- wrap?: StoreOr<string>
178
-
179
- about?: StoreOr<string>
180
- datatype?: StoreOr<string>
181
- inlist?: StoreOr<boolean>
182
- prefix?: StoreOr<string>
183
- property?: StoreOr<string>
184
- resource?: StoreOr<string>
185
- typeof?: StoreOr<string>
186
- vocab?: StoreOr<string>
187
-
188
- itemProp?: StoreOr<string>
189
- itemScope?: StoreOr<boolean>
190
- itemType?: StoreOr<string>
191
- itemID?: StoreOr<string>
192
- itemRef?: StoreOr<string>
193
-
194
- ref?: Ref<any> | Array<Ref<any>>
195
- key?: string
196
- }
197
-
198
- type UnknownAttributes = { [key: string]: any }
199
-
200
- type Attributes = KnownAttributes &
201
- Events & {
202
- [key: string]: any
203
- } & UnknownAttributes
204
-
205
- type TagNameMap =
206
- | 'component'
207
- | 'shadow'
208
- | 'nest'
209
- | `${string}-${string}`
210
- | keyof HTMLElementTagNameMap
211
- | keyof SVGElementTagNameMap
212
-
213
- type IntrinsicElementsHTML = {
214
- [TKey in TagNameMap]?: Attributes
215
- }
216
-
217
- type IntrinsicElements = IntrinsicElementsHTML
218
- }
219
-
220
- interface Node {
221
- __storeId: string
222
- __key: string
223
- }
224
-
225
- var Fragment: {
226
- (props: { children?: any }): any
227
- }
192
+ var Fragment: {
193
+ (props: {
194
+ children?: any;
195
+ }): any;
196
+ };
228
197
  }
@@ -0,0 +1 @@
1
+ export declare function createElement(tag: string, isSVG: boolean): HTMLElement | SVGElement;
@@ -0,0 +1 @@
1
+ export declare function hydrateTextNode(element: Element, newChild: any, index: number): void;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../LocalLinks-Baf0xWZ3.cjs");exports.LocalLinks=e.LocalLinks;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../LocalLinks-BxhSFv_Q.cjs");exports.LocalLinks=e.LocalLinks;
@@ -1,4 +1,4 @@
1
- import { L as a } from "../LocalLinks-Z9pxKguG.js";
1
+ import { L as a } from "../LocalLinks-DFZFpbjs.js";
2
2
  export {
3
3
  a as LocalLinks
4
4
  };
@@ -1 +1 @@
1
- "use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var ee=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),ae=o=>{throw TypeError(o)};var se=(o,e,s)=>e in o?ge(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,Ht=(o,e)=>{for(var s in e||(e={}))Le.call(e,s)&&se(o,s,e[s]);if(te)for(var s of te(e))Se.call(e,s)&&se(o,s,e[s]);return o},zt=(o,e)=>Ee(o,ve(e));var It=(o,e,s)=>e.has(o)||ae("Cannot "+s);var t=(o,e,s)=>(It(o,e,"read from private field"),s?s.call(o):e.get(o)),h=(o,e,s)=>e.has(o)?ae("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,s),r=(o,e,s,a)=>(It(o,e,"write to private field"),a?a.call(o,s):e.set(o,s),s),y=(o,e,s)=>(It(o,e,"access private method"),s);var J=(o,e,s)=>new Promise((a,l)=>{var v=c=>{try{f(s.next(c))}catch(p){l(p)}},S=c=>{try{f(s.throw(c))}catch(p){l(p)}},f=c=>c.done?a(c.value):Promise.resolve(c.value).then(v,S);f((s=s.apply(o,e)).next())});var ie=(o,e,s)=>(e=o[ee("asyncIterator")])?e.call(o):(o=o[ee("iterator")](),e={},s=(a,l)=>(l=o[a])&&(e[a]=v=>new Promise((S,f,c)=>(v=l.call(o,v),c=v.done,Promise.resolve(v.value).then(p=>S({value:p,done:c}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../index-OE2INULi.cjs"),ft=require("../dom-CBLlqORw.cjs"),z=require("../events-KVanG9sR.cjs"),ne=require("../scroll-BA2WnUrb.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-CPgw9bd5.cjs"),ye=require("../css-value-parser/index.cjs"),he=require("../string-DUXXtU8v.cjs");class le extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}oe.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",le);var M,i,D,it,ce,vt,nt;class Vt{constructor(e,s){h(this,D);h(this,M);h(this,i);h(this,vt,e=>{e.preventDefault(),y(this,D,ce).call(this)});h(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,M).prefetch(t(this,D,it),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});r(this,M,s),r(this,i,e),t(this,i).addEventListener("click",t(this,vt)),this.checkCurrent(location.href.replace(location.origin,"")),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var p,st;const s=t(this,M).normalizePath(e),a=t(this,M).normalizePath(t(this,D,it));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(p=t(this,i).getAttribute("data-associated-paths"))!=null&&p.split(",").find(A=>s.pathname.includes(A))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[l,v]=(st=t(this,D,it).split("#")[0])==null?void 0:st.split("?"),S=new URLSearchParams(v),f=new URLSearchParams(location.search);let c=0;for(const[A]of f)S.has(A)&&f.get(A)===S.get(A)&&c++;c?(t(this,i).classList.toggle("all-params-matched",f.size===c),t(this,i).classList.toggle("some-params-matched",f.size!==c)):!f.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const A in t(this,i).dataset){const at=he.camelToKebab(A);if(at.startsWith("match-param-")){const q=at.split("match-param-")[1],w=t(this,i).dataset[A],G=`param-${q}-matched`;f.has(q)&&f.get(q)===w||!f.has(q)&&(w===""||w==="*"||w==="all"||w==="any"||w==="vse")?t(this,i).classList.add(G):t(this,i).classList.remove(G)}}}destroy(){t(this,i).removeEventListener("click",t(this,vt)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact")}}M=new WeakMap,i=new WeakMap,D=new WeakSet,it=function(){const e=new URL(t(this,i).href);return t(this,M).normalizePath(e.pathname+e.search+e.hash).path},ce=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,M).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",l=t(this,i).hasAttribute("data-center-scroll"),v=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),S=v?ye.cssValueParser.parse(v):void 0,f=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),c=t(this,i).hasAttribute("data-keep-search-parameters"),p=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),st=t(this,i).getAttribute("data-scroll-behaviour"),A=(s=t(this,i).getAttribute("data-submorph")||t(this,i).getAttribute("data-submorph-append"))==null?void 0:s.split(",").map(w=>w.trim()),at=t(this,i).hasAttribute("data-clear-state");let q=t(this,D,it);if(t(this,i).hasAttribute("data-toggle-params")){const[w,G]=t(this,D,it).split("?"),Rt=new URLSearchParams(G),F=new URLSearchParams(location.search),d=new URLSearchParams;for(const[R]of Rt)(!F.has(R)||F.has(R)&&F.get(R)!==Rt.get(R))&&d.append(R,Rt.get(R));if(t(this,i).hasAttribute("data-merge-params"))for(const[R]of F)Rt.has(R)||d.append(R,F.get(R));q=`${w}?${d.toString()}`}t(this,M).navigate(q,{historyAction:a,centerScroll:l,offsetScroll:S,revalidate:f,keepSearchParameters:c,submorph:A,clearState:at,keepScrollPosition:p,scrollBehaviour:st,submorphAppend:t(this,i).hasAttribute("data-submorph-append"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params"),detail:t(this,i).getAttribute("data-detail"),removeParams:t(this,i).getAttribute("data-remove-params")||void 0,scrollTo:t(this,i).getAttribute("data-scroll-to")||void 0})}},vt=new WeakMap,nt=new WeakMap;var C,rt,Lt,Wt,St;class be{constructor(e){h(this,Lt);h(this,C);h(this,rt,[]);h(this,St,()=>{y(this,Lt,Wt).call(this)});r(this,C,e);for(const s in t(this,C).dataset){const a=he.camelToKebab(s);if(a.startsWith("param-")){const l=a.split("param-")[1],v=t(this,C).dataset[s];t(this,rt).push({name:l,value:v})}}document.addEventListener("morphURLParametersChange",t(this,St)),y(this,Lt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,St))}}C=new WeakMap,rt=new WeakMap,Lt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,rt).find(l=>e.has(l.name)&&(e.get(l.name)===l.value||l.value==="*"||l.value==="all"||l.value==="any"||l.value==="vse"||e.get(l.name)==="*"||e.get(l.name)==="all"||e.get(l.name)==="any"||e.get(l.name)==="vse"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,rt).filter(l=>e.has(l.name)).length);const a=t(this,C).getAttribute("data-hide-class");s?a?t(this,C).classList.remove(a):t(this,C).style.display="":a?t(this,C).classList.add(a):t(this,C).style.display="none"},St=new WeakMap;const we=new DOMParser;var I,Q,U,V,Z,K,ot,_,Y,yt,ht;class re{constructor(e,s){h(this,I);h(this,Q);h(this,U,{x:0,y:0});h(this,V,null);h(this,Z,null);h(this,K,null);h(this,ot,null);h(this,_,null);h(this,Y,null);h(this,yt);h(this,ht,!1);r(this,I,e),r(this,Q,s)}get pathname(){return t(this,Q)}get scrollState(){return t(this,U)}get document(){return t(this,K)}needRavalidation(){r(this,ht,!0)}setHeaders(e){r(this,yt,e)}setInitialDocument(e){r(this,V,e.cloneNode(!0))}abort(){var e;return(e=t(this,_))==null?void 0:e.abort(`[${t(this,Q)}] page loading cancelled`)}fetch(e,s,a){return J(this,null,function*(){var l;if(!a&&!t(this,ht)){const f=((l=t(this,V))==null?void 0:l.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,V)&&t(this,I).isPopstateNavigation;if(t(this,Y)||f||c)return t(this,Y)}return r(this,Y,new Promise(v=>J(this,null,function*(){try{r(this,_,new AbortController);const f=yield(yield fetch(e,{signal:t(this,_).signal,headers:Ht({"X-MORPH":"true","X-MORPH-REVALIDATE":a?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,yt))})).text(),c=we.parseFromString(f,"text/html");this.setInitialDocument(c),r(this,ht,!1)}catch(S){console.warn(S)}finally{r(this,_,null),r(this,Y,null),v()}}))),t(this,Y)})}cloneDocument(){r(this,K,(t(this,Z)||t(this,V)).cloneNode(!0))}get title(){let e="";if(t(this,K).title)e=t(this,K).title;else{const s=t(this,K).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,Q)}return e}clearScrollState(){t(this,U).x=0,t(this,U).y=0}clearDocumentState(){r(this,Z,null)}saveScrollState(){t(this,V).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,U).x=0,t(this,U).y=0):(t(this,U).x=t(this,I).scrollValue.left,t(this,U).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,U).y,left:t(this,U).x,behavior:"instant"})}saveDocumentState(){t(this,V).documentElement.hasAttribute("data-no-page-restoration")?r(this,Z,null):r(this,Z,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,ot,e)}clearState(){const e=t(this,ot);return r(this,ot,null),e}}I=new WeakMap,Q=new WeakMap,U=new WeakMap,V=new WeakMap,Z=new WeakMap,K=new WeakMap,ot=new WeakMap,_=new WeakMap,Y=new WeakMap,yt=new WeakMap,ht=new WeakMap;var T,lt,b,$,m,tt,W,j,H,bt,O,wt,et,ct,dt,Pt,ut,At,kt,E,gt,Ft,Xt,Bt,Nt,Mt,mt;const Et=class Et{constructor(e){h(this,E);h(this,T,null);h(this,lt,null);h(this,b,[]);h(this,$);h(this,m,null);h(this,tt);h(this,W,[]);h(this,j,!1);h(this,H,null);h(this,bt,!1);h(this,O,new Map);h(this,wt,[]);h(this,et,null);h(this,ct,0);h(this,dt,0);h(this,Pt);h(this,ut);h(this,At);h(this,kt,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});h(this,Mt,e=>J(this,null,function*(){e.preventDefault(),r(this,j,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,Pt),revalidate:t(this,ut),keepScrollPosition:t(this,At)}),r(this,j,!1)}));h(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),l=e-t(this,ct);r(this,dt,s),r(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",l>0),document.documentElement.classList.toggle("scroll-x-backward",l<0),z.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(oe.isBrowser&&!Et.instance){Et.instance=this,r(this,T,{base:pt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,lt,y(this,E,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);r(this,m,s);const a=new re(this,t(this,m).pathname);a.setInitialDocument(document),t(this,O).set(t(this,m).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Mt)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,et,new le),y(this,E,Bt).call(this,document)}}get currentURL(){return t(this,m)}get previousURL(){return t(this,tt)}get links(){return t(this,b)}get scrollElement(){return t(this,H)}get isPopstateNavigation(){return t(this,j)}get scrollValue(){let e=0,s=0;return t(this,bt)?(e=window.scrollY,s=window.scrollX):(e=t(this,H).scrollTop,s=t(this,H).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,W).length}saveState(e){const s=t(this,O).get(t(this,m).path);s&&s.saveState(e)}getState(){const e=t(this,O).get(t(this,m).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,T).base,trailingSlash:t(this,T).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:"",removeParams:s==null?void 0:s.removeParams})}prefetch(e,s){return J(this,null,function*(){var l;if(t(this,W).length)return;e=((l=this.pathnameModifier)==null?void 0:l.call(this,e))||e;const a=y(this,E,gt).call(this,e);a==null||a.fetch(e,t(this,m).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=y(this,E,gt).call(this,s.path);a==null||a.needRavalidation()}navigate(Rt){return J(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:l,scrollBehaviour:v,revalidate:S,keepSearchParameters:f,submorph:c,submorphAppend:p,clearState:st,keepScrollPosition:A,mergeParams:at,removeParams:q,detail:w,scrollTo:G}={}){var R,Kt,Yt,$t;if(t(this,W).length)return;r(this,Pt,c),r(this,ut,S),r(this,At,A);const F=((R=this.pathnameModifier)==null?void 0:R.call(this,e))||e,d=this.normalizePath(F,{mergeParams:at,removeParams:q});if(!S&&(((Kt=t(this,$))==null?void 0:Kt.pathname)===d.pathname||t(this,m).pathname===d.pathname)){A||y(this,E,Nt).call(this,d.hash||0,{centerScroll:a,offsetScroll:l,behavior:"smooth"}),z.dispatchEvent(document,"morphSamePath",{detail:{detail:w}}),((Yt=t(this,m))==null?void 0:Yt.parameters)!==d.parameters&&(r(this,tt,t(this,m)),r(this,m,d),pt.changeHistory({action:(($t=t(this,m))==null?void 0:$t.hash)!==d.hash?"replace":s,pathname:d.pathname,searchParameters:d.parameters,hash:d.hash}),z.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,m),previousURL:t(this,tt),detail:w}})),t(this,b).forEach(X=>{X.checkCurrent(d.path)});return}else t(this,b).forEach(X=>{X.checkCurrent(d.path)});r(this,$,d);try{let X=!0;if(this.preprocessor)try{yield new Promise((n,P)=>{var x;(x=this.preprocessor)==null||x.call(this,{url:d,resolve:n,reject:P,submorph:c,detail:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),X=!1}if(!X||t(this,$).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}const jt={url:d,submorph:c,detail:w};c?p||c.forEach(n=>{document.querySelectorAll(n).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,lt).forEach(n=>{var P,x;(P=n.firstElementChild)==null||P.classList.add("out"),(x=n.firstElementChild)==null||x.setAttribute("data-morph-out","")}),z.dispatchEvent(document,"morphNavigation",{detail:jt});const Tt=y(this,E,gt).call(this,t(this,m).pathname),L=y(this,E,gt).call(this,d.pathname);if(t(this,O).forEach(n=>{n.pathname!==d.pathname&&n.abort()}),yield L==null?void 0:L.fetch(F,t(this,m).path,S),t(this,$).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}Tt.clearState(),Tt.saveScrollState(),Tt.saveDocumentState(),(!t(this,j)||S)&&(L.clearScrollState(),L.clearDocumentState()),st&&L.clearState(),L.cloneDocument(),t(this,et).textContent=L.title,document.body.appendChild(t(this,et));const Ct=zt(Ht({},jt),{document:L.document});p||Ct.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),z.dispatchEvent(document,"morphStart",{detail:Ct});const Gt=Array.from(document.head.children),Jt=Array.from(L.document.head.children),Qt=ft.intersectElements(Gt,Jt),de=ft.excludeElements(Gt,Qt),Ut=ft.excludeElements(Jt,Qt).filter(n=>!this.excludeHeadChild(n));Ut.forEach((n,P)=>{n.tagName==="SCRIPT"&&(Ut[P]=ft.createScriptElement(n))}),Ut.forEach(n=>{document.head.appendChild(n)});const Dt=Ut.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(y(this,E,Xt).call(this,n))return!0});t(this,T).waitForHeadToLoad&&Dt.length&&(yield new Promise(n=>J(this,null,function*(){let P=0;try{for(var x=ie(Dt),me,B,N;me=!(B=yield x.next()).done;me=!1){const xt=B.value;xt.onload=()=>{P++,P===Dt.length&&n()}}}catch(B){N=[B]}finally{try{me&&(B=x.return)&&(yield B.call(x))}finally{if(N)throw N[0]}}}))),yield ne.wait(10);const Zt=[];p||de.forEach(n=>{n.hasAttribute("data-permanent")||(y(this,E,Xt).call(this,n)?Zt.push(n):n.remove())});const ue=y(this,E,Ft).call(this,L.document.body);!t(this,T).morphInsideScrollContainer&&!c&&y(this,E,Bt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),pt.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(f?location.search:""),hash:d.hash}),t(this,et).remove(),r(this,tt,t(this,m)),r(this,m,d);const qt=[];t(this,lt).forEach((n,P)=>{const x=ue[P],me=getComputedStyle(n).getPropertyValue("--morph-duration");let B=[],N=[];c?(c.forEach(u=>{const g=n.querySelector(u),k=x.querySelector(u);g&&k&&(N.push(g),B.push(k))}),N.forEach(u=>{u.parentElement&&qt.push(u.parentElement)})):(B.push(...x.childNodes),N.push(...n.childNodes),qt.push(n));const xt=[];p||N.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"),u.querySelectorAll("[data-morph-transfer]").forEach(k=>{const pe=k.getAttribute("data-morph-transfer");xt.push({element:k,selector:pe})}))}),B.forEach(u=>{u instanceof HTMLElement&&(xt.forEach(g=>{const k=u.querySelector(g.selector);k&&k.replaceWith(L.document.importNode(g.element,!0))}),this.findNewLinks(u),u.classList.add("new"))}),c?p?B.forEach((u,g)=>{N[g]instanceof HTMLElement&&N[g].append(...u.childNodes)}):B.forEach((u,g)=>{var k;(k=N[g].parentElement)==null||k.insertBefore(u,N[g])}):n.prepend(...B),setTimeout(()=>{p||N.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),B.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const _t=zt(Ht({},Ct),{morphElement:n});z.dispatchEvent(document,"morphNewChildrenAdded",{detail:_t});const fe=new Promise(u=>{setTimeout(()=>{p||N.forEach(g=>{g.remove()}),B.forEach(g=>{var k;g instanceof HTMLElement&&((k=g.parentElement)==null||k.style.removeProperty("--new-content-height"),g.classList.remove("new-idle","new"))}),p||z.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_t}),u()},(parseFloat(me)||0)*1e3+10)});t(this,W).push(fe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-L.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),z.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),G?(L.clearScrollState(),y(this,E,Nt).call(this,G,{centerScroll:a,offsetScroll:l,behavior:v})):d.hash?(L.clearScrollState(),y(this,E,Nt).call(this,d.hash,{centerScroll:a,offsetScroll:l,behavior:v})):t(this,j)?L.restoreScrollPosition():A||L.renewScrollPosition(),yield Promise.all(t(this,W)),p||Zt.forEach(n=>n.remove()),r(this,W,[]),qt.forEach(n=>{n.querySelectorAll("script").forEach(x=>{x.replaceWith(ft.createScriptElement(x))})}),t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)}),this.findParamsDependent(),z.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(X){console.error(X)}r(this,$,void 0)})}addLink(e){t(this,b).push(new Vt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){r(this,b,t(this,b).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){r(this,b,t(this,b).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,b).push(...s.map(a=>new Vt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,b).forEach(s=>s.destroy()),r(this,b,e.map(s=>new Vt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,wt).forEach(s=>s.destroy()),r(this,wt,e.map(s=>new be(s)))}};T=new WeakMap,lt=new WeakMap,b=new WeakMap,$=new WeakMap,m=new WeakMap,tt=new WeakMap,W=new WeakMap,j=new WeakMap,H=new WeakMap,bt=new WeakMap,O=new WeakMap,wt=new WeakMap,et=new WeakMap,ct=new WeakMap,dt=new WeakMap,Pt=new WeakMap,ut=new WeakMap,At=new WeakMap,kt=new WeakMap,E=new WeakSet,gt=function(e){const s=this.normalizePath(e);let a=t(this,O).get(s.pathname);return a||(a=new re(this,s.pathname),t(this,O).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},Xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Bt=function(e){var s,a;(s=t(this,H))==null||s.removeEventListener("scroll",t(this,mt)),r(this,dt,0),r(this,ct,0),r(this,H,t(this,T).scrollSelector&&e.querySelector(t(this,T).scrollSelector)||window),r(this,bt,t(this,H)===window),(a=t(this,H))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Nt=function(e,s){const a=typeof e=="string"?document.getElementById(e):e;(typeof a=="number"||a)&&ne.scrollToElement(a,{scrollElement:t(this,H),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Mt=new WeakMap,mt=new WeakMap,Et.instance=null;let Ot=Et;exports.Morph=Ot;
1
+ "use strict";var ge=Object.defineProperty,Ee=Object.defineProperties;var ve=Object.getOwnPropertyDescriptors;var te=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var ee=(o,e)=>(e=Symbol[o])?e:Symbol.for("Symbol."+o),ae=o=>{throw TypeError(o)};var se=(o,e,s)=>e in o?ge(o,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):o[e]=s,Ht=(o,e)=>{for(var s in e||(e={}))Le.call(e,s)&&se(o,s,e[s]);if(te)for(var s of te(e))Se.call(e,s)&&se(o,s,e[s]);return o},zt=(o,e)=>Ee(o,ve(e));var It=(o,e,s)=>e.has(o)||ae("Cannot "+s);var t=(o,e,s)=>(It(o,e,"read from private field"),s?s.call(o):e.get(o)),h=(o,e,s)=>e.has(o)?ae("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,s),r=(o,e,s,a)=>(It(o,e,"write to private field"),a?a.call(o,s):e.set(o,s),s),y=(o,e,s)=>(It(o,e,"access private method"),s);var J=(o,e,s)=>new Promise((a,l)=>{var v=c=>{try{f(s.next(c))}catch(p){l(p)}},S=c=>{try{f(s.throw(c))}catch(p){l(p)}},f=c=>c.done?a(c.value):Promise.resolve(c.value).then(v,S);f((s=s.apply(o,e)).next())});var ie=(o,e,s)=>(e=o[ee("asyncIterator")])?e.call(o):(o=o[ee("iterator")](),e={},s=(a,l)=>(l=o[a])&&(e[a]=v=>new Promise((S,f,c)=>(v=l.call(o,v),c=v.done,Promise.resolve(v.value).then(p=>S({value:p,done:c}),f)))),s("next"),s("return"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("../index-OE2INULi.cjs"),ft=require("../dom-CBLlqORw.cjs"),z=require("../events-KVanG9sR.cjs"),ne=require("../scroll-BA2WnUrb.cjs");require("construct-style-sheets-polyfill");const pt=require("../url-CHgcNwJ1.cjs"),ye=require("../css-value-parser/index.cjs"),he=require("../string-DUXXtU8v.cjs");class le extends HTMLElement{connectedCallback(){const e={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[s,a]of Object.entries(e))this.setAttribute(s,a)}}oe.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",le);var M,i,D,it,ce,vt,nt;class Vt{constructor(e,s){h(this,D);h(this,M);h(this,i);h(this,vt,e=>{e.preventDefault(),y(this,D,ce).call(this)});h(this,nt,()=>{const e=t(this,i).hasAttribute("data-revalidate");t(this,M).prefetch(t(this,D,it),e),t(this,i).removeEventListener("pointerenter",t(this,nt))});r(this,M,s),r(this,i,e),t(this,i).addEventListener("click",t(this,vt)),this.checkCurrent(location.href.replace(location.origin,"")),t(this,i).hasAttribute("data-prefetch")&&t(this,i).addEventListener("pointerenter",t(this,nt))}get element(){return t(this,i)}checkCurrent(e){var p,st;const s=t(this,M).normalizePath(e),a=t(this,M).normalizePath(t(this,D,it));t(this,i).hasAttribute("data-include")&&s.pathname.includes(a.pathname)?t(this,i).classList.add("current"):a.pathname===s.pathname?t(this,i).classList.add("current"):(p=t(this,i).getAttribute("data-associated-paths"))!=null&&p.split(",").find(A=>s.pathname.includes(A))?t(this,i).classList.add("current"):t(this,i).classList.remove("current"),s.path===a.path?t(this,i).classList.add("exact"):t(this,i).classList.remove("exact");const[l,v]=(st=t(this,D,it).split("#")[0])==null?void 0:st.split("?"),S=new URLSearchParams(v),f=new URLSearchParams(location.search);let c=0;for(const[A]of f)S.has(A)&&f.get(A)===S.get(A)&&c++;c?(t(this,i).classList.toggle("all-params-matched",f.size===c),t(this,i).classList.toggle("some-params-matched",f.size!==c)):!f.size&&t(this,i).hasAttribute("data-match-no-params")?t(this,i).classList.add("all-params-matched"):(t(this,i).classList.remove("all-params-matched"),t(this,i).classList.remove("some-params-matched"));for(const A in t(this,i).dataset){const at=he.camelToKebab(A);if(at.startsWith("match-param-")){const q=at.split("match-param-")[1],w=t(this,i).dataset[A],F=`param-${q}-matched`;f.has(q)&&f.get(q)===w||!f.has(q)&&(w===""||w==="*"||w==="all"||w==="any"||w==="vse")?t(this,i).classList.add(F):t(this,i).classList.remove(F)}}}destroy(){t(this,i).removeEventListener("click",t(this,vt)),t(this,i).removeEventListener("pointerenter",t(this,nt)),t(this,i).classList.remove("current","exact")}}M=new WeakMap,i=new WeakMap,D=new WeakSet,it=function(){const e=new URL(t(this,i).href);return t(this,M).normalizePath(e.pathname+e.search+e.hash).path},ce=function(){var s;if(document.documentElement.classList.contains("click-disabled"))return;if(t(this,i).hasAttribute("data-back")&&t(this,M).previousURL)history.back();else{const a=t(this,i).getAttribute("data-history-action")||"push",l=t(this,i).hasAttribute("data-center-scroll"),v=getComputedStyle(t(this,i)).getPropertyValue("--offset-scroll").trim(),S=v?ye.cssValueParser.parse(v):void 0,f=t(this,i).hasAttribute("data-revalidate")||t(this,i).hasAttribute("data-pagination-more-link")||t(this,i).hasAttribute("data-pagination-set-link")||t(this,i).hasAttribute("data-pagination-next-link")||t(this,i).hasAttribute("data-pagination-prev-link"),c=t(this,i).hasAttribute("data-keep-search-parameters"),p=t(this,i).hasAttribute("data-keep-scroll-position")||t(this,i).hasAttribute("data-pagination-more-link"),st=t(this,i).getAttribute("data-scroll-behaviour"),A=(s=t(this,i).getAttribute("data-submorph")||t(this,i).getAttribute("data-submorph-append"))==null?void 0:s.split(",").map(w=>w.trim()),at=t(this,i).hasAttribute("data-clear-state");let q=t(this,D,it);if(t(this,i).hasAttribute("data-toggle-params")){const[w,F]=t(this,D,it).split("?"),Rt=new URLSearchParams(F),X=new URLSearchParams(location.search),d=new URLSearchParams;for(const[R]of Rt)(!X.has(R)||X.has(R)&&X.get(R)!==Rt.get(R))&&d.append(R,Rt.get(R));if(t(this,i).hasAttribute("data-merge-params"))for(const[R]of X)Rt.has(R)||d.append(R,X.get(R));q=`${w}?${d.toString()}`}t(this,M).navigate(q,{historyAction:a,centerScroll:l,offsetScroll:S,revalidate:f,keepSearchParameters:c,submorph:A,clearState:at,keepScrollPosition:p,scrollBehaviour:st,submorphAppend:t(this,i).hasAttribute("data-submorph-append"),mergeParams:t(this,i).hasAttribute("data-merge-params")&&!t(this,i).hasAttribute("data-toggle-params"),detail:t(this,i).getAttribute("data-detail"),removeParams:t(this,i).getAttribute("data-remove-params")||void 0,scrollTo:t(this,i).getAttribute("data-scroll-to")||void 0})}},vt=new WeakMap,nt=new WeakMap;var C,rt,Lt,Wt,St;class be{constructor(e){h(this,Lt);h(this,C);h(this,rt,[]);h(this,St,()=>{y(this,Lt,Wt).call(this)});r(this,C,e);for(const s in t(this,C).dataset){const a=he.camelToKebab(s);if(a.startsWith("param-")){const l=a.split("param-")[1],v=t(this,C).dataset[s];t(this,rt).push({name:l,value:v})}}document.addEventListener("morphURLParametersChange",t(this,St)),y(this,Lt,Wt).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",t(this,St))}}C=new WeakMap,rt=new WeakMap,Lt=new WeakSet,Wt=function(){const e=new URLSearchParams(location.search);let s=!!t(this,rt).find(l=>e.has(l.name)&&(e.get(l.name)===l.value||l.value==="*"||l.value==="all"||l.value==="any"||l.value==="vse"||e.get(l.name)==="*"||e.get(l.name)==="all"||e.get(l.name)==="any"||e.get(l.name)==="vse"));!s&&t(this,C).hasAttribute("data-match-no-params")&&(s=!t(this,rt).filter(l=>e.has(l.name)).length);const a=t(this,C).getAttribute("data-hide-class");s?a?t(this,C).classList.remove(a):t(this,C).style.display="":a?t(this,C).classList.add(a):t(this,C).style.display="none"},St=new WeakMap;const we=new DOMParser;var I,Q,U,V,Z,Y,ot,_,$,yt,ht;class re{constructor(e,s){h(this,I);h(this,Q);h(this,U,{x:0,y:0});h(this,V,null);h(this,Z,null);h(this,Y,null);h(this,ot,null);h(this,_,null);h(this,$,null);h(this,yt);h(this,ht,!1);r(this,I,e),r(this,Q,s)}get pathname(){return t(this,Q)}get scrollState(){return t(this,U)}get document(){return t(this,Y)}needRavalidation(){r(this,ht,!0)}setHeaders(e){r(this,yt,e)}setInitialDocument(e){r(this,V,e.cloneNode(!0))}abort(){var e;return(e=t(this,_))==null?void 0:e.abort(`[${t(this,Q)}] page loading cancelled`)}fetch(e,s,a){return J(this,null,function*(){var l;if(!a&&!t(this,ht)){const f=((l=t(this,V))==null?void 0:l.documentElement.getAttribute("data-cache"))&&s!==e,c=t(this,V)&&t(this,I).isPopstateNavigation;if(t(this,$)||f||c)return t(this,$)}return r(this,$,new Promise(v=>J(this,null,function*(){try{r(this,_,new AbortController);const f=yield(yield fetch(e,{signal:t(this,_).signal,headers:Ht({"X-MORPH":"true","X-MORPH-REVALIDATE":a?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(s),"X-MORPH-NEW-PATH":encodeURIComponent(e)},t(this,yt))})).text(),c=we.parseFromString(f,"text/html");this.setInitialDocument(c),r(this,ht,!1)}catch(S){console.warn(S)}finally{r(this,_,null),r(this,$,null),v()}}))),t(this,$)})}cloneDocument(){r(this,Y,(t(this,Z)||t(this,V)).cloneNode(!0))}get title(){let e="";if(t(this,Y).title)e=t(this,Y).title;else{const s=t(this,Y).querySelector("h1");e=(s==null?void 0:s.innerText)||(s==null?void 0:s.textContent)||t(this,Q)}return e}clearScrollState(){t(this,U).x=0,t(this,U).y=0}clearDocumentState(){r(this,Z,null)}saveScrollState(){t(this,V).documentElement.hasAttribute("data-no-scroll-restoration")?(t(this,U).x=0,t(this,U).y=0):(t(this,U).x=t(this,I).scrollValue.left,t(this,U).y=t(this,I).scrollValue.top)}restoreScrollPosition(){t(this,I).scrollElement.scroll({top:t(this,U).y,left:t(this,U).x,behavior:"instant"})}saveDocumentState(){t(this,V).documentElement.hasAttribute("data-no-page-restoration")?r(this,Z,null):r(this,Z,document.cloneNode(!0))}renewScrollPosition(){t(this,I).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(e){r(this,ot,e)}clearState(){const e=t(this,ot);return r(this,ot,null),e}}I=new WeakMap,Q=new WeakMap,U=new WeakMap,V=new WeakMap,Z=new WeakMap,Y=new WeakMap,ot=new WeakMap,_=new WeakMap,$=new WeakMap,yt=new WeakMap,ht=new WeakMap;var T,lt,b,j,m,tt,W,G,H,bt,O,wt,et,ct,dt,Pt,ut,At,kt,E,gt,Ft,Xt,Kt,Nt,Mt,mt;const Et=class Et{constructor(e){h(this,E);h(this,T,null);h(this,lt,null);h(this,b,[]);h(this,j);h(this,m,null);h(this,tt);h(this,W,[]);h(this,G,!1);h(this,H,null);h(this,bt,!1);h(this,O,new Map);h(this,wt,[]);h(this,et,null);h(this,ct,0);h(this,dt,0);h(this,Pt);h(this,ut);h(this,At);h(this,kt,e=>{var s,a;return(((s=e.getAttribute("href"))==null?void 0:s.startsWith("/"))||((a=e.getAttribute("href"))==null?void 0:a.startsWith("?")))&&!e.hasAttribute("download")&&!e.hasAttribute("data-morph-skip")&&!e.closest("[data-morph-skip]")&&e.getAttribute("target")!=="_blank"});h(this,Mt,e=>J(this,null,function*(){e.preventDefault(),r(this,G,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:t(this,ut)?void 0:t(this,Pt),revalidate:t(this,ut),keepScrollPosition:t(this,At)}),r(this,G,!1)}));h(this,mt,()=>{const{left:e,top:s}=this.scrollValue,a=s-t(this,dt),l=e-t(this,ct);r(this,dt,s),r(this,ct,e),document.documentElement.classList.toggle("scroll-y",s>0),document.documentElement.classList.toggle("scroll-x",e>0),document.documentElement.classList.toggle("scroll-y-forward",a>0),document.documentElement.classList.toggle("scroll-y-backward",a<0),document.documentElement.classList.toggle("scroll-x-forward",l>0),document.documentElement.classList.toggle("scroll-x-backward",l<0),z.dispatchEvent(document,"morphScroll",{detail:{left:e,top:s}})});if(oe.isBrowser&&!Et.instance){Et.instance=this,r(this,T,{base:pt.normalizeBase(e==null?void 0:e.base),waitForHeadToLoad:(e==null?void 0:e.waitForHeadToLoad)!==!1,trailingSlash:(e==null?void 0:e.trailingSlash)||!1,scrollSelector:e==null?void 0:e.scrollSelector,morphInsideScrollContainer:(e==null?void 0:e.morphInsideScrollContainer)||!1}),r(this,lt,y(this,E,Ft).call(this,document.body));const s=this.normalizePath(location.pathname+location.search+location.hash);r(this,m,s);const a=new re(this,t(this,m).pathname);a.setInitialDocument(document),t(this,O).set(t(this,m).pathname,a),document.documentElement.setAttribute("data-current-pathname",t(this,m).pathname),document.documentElement.setAttribute("data-current-leaf",s.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",t(this,Mt)),pt.changeHistory({action:"replace",pathname:s.pathname,searchParameters:s.parameters,hash:s.hash}),r(this,et,new le),y(this,E,Kt).call(this,document)}}get currentURL(){return t(this,m)}get previousURL(){return t(this,tt)}get links(){return t(this,b)}get scrollElement(){return t(this,H)}get isPopstateNavigation(){return t(this,G)}get scrollValue(){let e=0,s=0;return t(this,bt)?(e=window.scrollY,s=window.scrollX):(e=t(this,H).scrollTop,s=t(this,H).scrollLeft),{top:e,left:s}}get isNavigating(){return!!t(this,W).length}saveState(e){const s=t(this,O).get(t(this,m).path);s&&s.saveState(e)}getState(){const e=t(this,O).get(t(this,m).path);return e==null?void 0:e.clearState()}normalizePath(e,s){return pt.splitPath(e,{base:t(this,T).base,trailingSlash:t(this,T).trailingSlash,mergeParams:s!=null&&s.mergeParams?location.search:"",removeParams:s==null?void 0:s.removeParams})}prefetch(e,s){return J(this,null,function*(){var l;if(t(this,W).length)return;e=((l=this.pathnameModifier)==null?void 0:l.call(this,e))||e;const a=y(this,E,gt).call(this,e);a==null||a.fetch(e,t(this,m).path,s)})}excludeHeadChild(e){return!1}setHeaders(e){}needRavalidation(e){const s=this.normalizePath(e),a=y(this,E,gt).call(this,s.path);a==null||a.needRavalidation()}navigate(Rt){return J(this,arguments,function*(e,{historyAction:s="push",centerScroll:a,offsetScroll:l,scrollBehaviour:v,revalidate:S,keepSearchParameters:f,submorph:c,submorphAppend:p,clearState:st,keepScrollPosition:A,mergeParams:at,removeParams:q,detail:w,scrollTo:F}={}){var R,Bt,Yt,$t;if(t(this,W).length)return;r(this,Pt,c),r(this,ut,S),r(this,At,A);const X=((R=this.pathnameModifier)==null?void 0:R.call(this,e))||e,d=this.normalizePath(X,{mergeParams:at,removeParams:q});if(!S&&(((Bt=t(this,j))==null?void 0:Bt.pathname)===d.pathname||t(this,m).pathname===d.pathname)){A||y(this,E,Nt).call(this,F||d.hash||0,{centerScroll:a,offsetScroll:l,behavior:"smooth"}),z.dispatchEvent(document,"morphSamePath",{detail:{detail:w}}),((Yt=t(this,m))==null?void 0:Yt.parameters)!==d.parameters&&(r(this,tt,t(this,m)),r(this,m,d),pt.changeHistory({action:(($t=t(this,m))==null?void 0:$t.hash)!==d.hash?"replace":s,pathname:d.pathname,searchParameters:d.parameters,hash:d.hash}),z.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:t(this,m),previousURL:t(this,tt),detail:w}})),t(this,b).forEach(K=>{K.checkCurrent(d.path)});return}else t(this,b).forEach(K=>{K.checkCurrent(d.path)});r(this,j,d);try{let K=!0;if(this.preprocessor)try{yield new Promise((n,P)=>{var x;(x=this.preprocessor)==null||x.call(this,{url:d,resolve:n,reject:P,submorph:c,detail:w})})}catch(n){n?console.error(n):console.log("Route change canceled"),K=!1}if(!K||t(this,j).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}const jt={url:d,submorph:c,detail:w};c?p||c.forEach(n=>{document.querySelectorAll(n).forEach(P=>{P.classList.add("out"),P.setAttribute("data-morph-out","")})}):t(this,lt).forEach(n=>{var P,x;(P=n.firstElementChild)==null||P.classList.add("out"),(x=n.firstElementChild)==null||x.setAttribute("data-morph-out","")}),z.dispatchEvent(document,"morphNavigation",{detail:jt});const Tt=y(this,E,gt).call(this,t(this,m).pathname),L=y(this,E,gt).call(this,d.pathname);if(t(this,O).forEach(n=>{n.pathname!==d.pathname&&n.abort()}),yield L==null?void 0:L.fetch(X,t(this,m).path,S),t(this,j).pathname!==d.pathname){t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)});return}Tt.clearState(),Tt.saveScrollState(),Tt.saveDocumentState(),(!t(this,G)||S)&&(L.clearScrollState(),L.clearDocumentState()),st&&L.clearState(),L.cloneDocument(),t(this,et).textContent=L.title,document.body.appendChild(t(this,et));const Ct=zt(Ht({},jt),{document:L.document});p||Ct.document.querySelectorAll("[data-morph-out]").forEach(n=>{n.classList.remove("out")}),z.dispatchEvent(document,"morphStart",{detail:Ct});const Gt=Array.from(document.head.children),Jt=Array.from(L.document.head.children),Qt=ft.intersectElements(Gt,Jt),de=ft.excludeElements(Gt,Qt),Ut=ft.excludeElements(Jt,Qt).filter(n=>!this.excludeHeadChild(n));Ut.forEach((n,P)=>{n.tagName==="SCRIPT"&&(Ut[P]=ft.createScriptElement(n))}),Ut.forEach(n=>{document.head.appendChild(n)});const Dt=Ut.filter(n=>{if(n.hasAttribute("data-no-waiting"))return!1;if(y(this,E,Xt).call(this,n))return!0});t(this,T).waitForHeadToLoad&&Dt.length&&(yield new Promise(n=>J(this,null,function*(){let P=0;try{for(var x=ie(Dt),me,B,N;me=!(B=yield x.next()).done;me=!1){const xt=B.value;xt.onload=()=>{P++,P===Dt.length&&n()}}}catch(B){N=[B]}finally{try{me&&(B=x.return)&&(yield B.call(x))}finally{if(N)throw N[0]}}}))),yield ne.wait(10);const Zt=[];p||de.forEach(n=>{n.hasAttribute("data-permanent")||(y(this,E,Xt).call(this,n)?Zt.push(n):n.remove())});const ue=y(this,E,Ft).call(this,L.document.body);!t(this,T).morphInsideScrollContainer&&!c&&y(this,E,Kt).call(this,L.document),document.documentElement.setAttribute("data-current-pathname",d.pathname),document.documentElement.setAttribute("data-current-leaf",d.leaf),pt.changeHistory({action:s,pathname:d.pathname,searchParameters:d.parameters||(f?location.search:""),hash:d.hash}),t(this,et).remove(),r(this,tt,t(this,m)),r(this,m,d);const qt=[];t(this,lt).forEach((n,P)=>{const x=ue[P],me=getComputedStyle(n).getPropertyValue("--morph-duration");let B=[],N=[];c?(c.forEach(u=>{const g=n.querySelector(u),k=x.querySelector(u);g&&k&&(N.push(g),B.push(k))}),N.forEach(u=>{u.parentElement&&qt.push(u.parentElement)})):(B.push(...x.childNodes),N.push(...n.childNodes),qt.push(n));const xt=[];p||N.forEach(u=>{u instanceof HTMLElement&&(this.destroyOldLinks(u),u.classList.add("old"),u.querySelectorAll("[data-morph-transfer]").forEach(k=>{const pe=k.getAttribute("data-morph-transfer");xt.push({element:k,selector:pe})}))}),B.forEach(u=>{u instanceof HTMLElement&&(xt.forEach(g=>{const k=u.querySelector(g.selector);k&&k.replaceWith(L.document.importNode(g.element,!0))}),this.findNewLinks(u),u.classList.add("new"))}),c?p?B.forEach((u,g)=>{N[g]instanceof HTMLElement&&N[g].append(...u.childNodes)}):B.forEach((u,g)=>{var k;(k=N[g].parentElement)==null||k.insertBefore(u,N[g])}):n.prepend(...B),setTimeout(()=>{p||N.forEach(u=>{u instanceof HTMLElement&&u.classList.add("old-idle")}),B.forEach(u=>{var g;u instanceof HTMLElement&&((g=u.parentElement)==null||g.style.setProperty("--new-content-height",u.offsetHeight+"px"),u.classList.add("new-idle"))})},0);const _t=zt(Ht({},Ct),{morphElement:n});z.dispatchEvent(document,"morphNewChildrenAdded",{detail:_t});const fe=new Promise(u=>{setTimeout(()=>{p||N.forEach(g=>{g.remove()}),B.forEach(g=>{var k;g instanceof HTMLElement&&((k=g.parentElement)==null||k.style.removeProperty("--new-content-height"),g.classList.remove("new-idle","new"))}),p||z.dispatchEvent(document,"morphOldChildrenRemoved",{detail:_t}),u()},(parseFloat(me)||0)*1e3+10)});t(this,W).push(fe)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-L.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),z.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:L.scrollState}),F?(L.clearScrollState(),y(this,E,Nt).call(this,F,{centerScroll:a,offsetScroll:l,behavior:v})):d.hash?(L.clearScrollState(),y(this,E,Nt).call(this,d.hash,{centerScroll:a,offsetScroll:l,behavior:v})):t(this,G)?L.restoreScrollPosition():A||L.renewScrollPosition(),yield Promise.all(t(this,W)),p||Zt.forEach(n=>n.remove()),r(this,W,[]),qt.forEach(n=>{n.querySelectorAll("script").forEach(x=>{x.replaceWith(ft.createScriptElement(x))})}),t(this,b).forEach(n=>{n.checkCurrent(t(this,m).path)}),this.findParamsDependent(),z.dispatchEvent(document,"morphComplete",{detail:Ct}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(K){console.error(K)}r(this,j,void 0)})}addLink(e){t(this,b).push(new Vt(e,this))}addLinks(e){e.forEach(s=>{this.addLink(s)})}removeLink(e){r(this,b,t(this,b).filter(s=>s.element===e?(s.destroy(),!1):!0))}destroyOldLinks(e){r(this,b,t(this,b).filter(s=>e.contains(s.element)?(s.destroy(),!1):!0))}findNewLinks(e){const s=[...e.querySelectorAll("a")].filter(t(this,kt));t(this,b).push(...s.map(a=>new Vt(a,this)))}findLinks(){const e=[...document.documentElement.querySelectorAll("a")].filter(t(this,kt));t(this,b).forEach(s=>s.destroy()),r(this,b,e.map(s=>new Vt(s,this)))}findParamsDependent(){const e=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];t(this,wt).forEach(s=>s.destroy()),r(this,wt,e.map(s=>new be(s)))}};T=new WeakMap,lt=new WeakMap,b=new WeakMap,j=new WeakMap,m=new WeakMap,tt=new WeakMap,W=new WeakMap,G=new WeakMap,H=new WeakMap,bt=new WeakMap,O=new WeakMap,wt=new WeakMap,et=new WeakMap,ct=new WeakMap,dt=new WeakMap,Pt=new WeakMap,ut=new WeakMap,At=new WeakMap,kt=new WeakMap,E=new WeakSet,gt=function(e){const s=this.normalizePath(e);let a=t(this,O).get(s.pathname);return a||(a=new re(this,s.pathname),t(this,O).set(s.pathname,a)),a},Ft=function(e){const s=[...e.querySelectorAll("[data-morph]")];return s.length?s:[e]},Xt=function(e){return e.tagName==="SCRIPT"||e.tagName==="STYLE"||e.tagName==="LINK"&&e.getAttribute("rel")==="stylesheet"},Kt=function(e){var s,a;(s=t(this,H))==null||s.removeEventListener("scroll",t(this,mt)),r(this,dt,0),r(this,ct,0),r(this,H,t(this,T).scrollSelector&&e.querySelector(t(this,T).scrollSelector)||window),r(this,bt,t(this,H)===window),(a=t(this,H))==null||a.addEventListener("scroll",t(this,mt)),t(this,mt).call(this)},Nt=function(e,s){const a=typeof e=="string"?document.querySelector(e):e;(typeof a=="number"||a)&&ne.scrollToElement(a,{scrollElement:t(this,H),behavior:(s==null?void 0:s.behavior)||"instant",center:s==null?void 0:s.centerScroll,offset:s==null?void 0:s.offsetScroll})},Mt=new WeakMap,mt=new WeakMap,Et.instance=null;let Ot=Et;exports.Morph=Ot;