aptechka 0.83.1 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/lib/Animation-BAiM6_n1.js +111 -0
  2. package/lib/Animation-DMWabSR0.cjs +1 -0
  3. package/lib/Composed-B0fvCtZz.cjs +1 -0
  4. package/lib/Composed-CgA9lLWA.js +75 -0
  5. package/lib/Damped-BLo-OAVb.cjs +1 -0
  6. package/lib/Damped-Dcz5UdMH.js +57 -0
  7. package/lib/DerivedArray-DFhxap_z.js +63 -0
  8. package/lib/DerivedArray-DYtWMW0n.cjs +1 -0
  9. package/lib/DragControls-BPHsDeH6.cjs +1 -0
  10. package/lib/DragControls-D2a1Cifp.js +234 -0
  11. package/lib/LocalLinks-BWFJYhGX.cjs +1 -0
  12. package/lib/LocalLinks-Dwgf3No6.js +65 -0
  13. package/lib/PageAnnouncerElement-DPMlVJZG.cjs +1 -0
  14. package/lib/PageAnnouncerElement-DV9pm_od.js +28 -0
  15. package/lib/PageScroll-BAatKJx6.cjs +1 -0
  16. package/lib/PageScroll-m3TsHnzR.js +65 -0
  17. package/lib/SourceElement-941MrYpq.js +265 -0
  18. package/lib/SourceElement-DBLZ7b5k.cjs +5 -0
  19. package/lib/Store-BCW70G3Z.cjs +1 -0
  20. package/lib/Store-uLDYY9ed.js +158 -0
  21. package/lib/Tweened-BvtjLCa3.js +48 -0
  22. package/lib/Tweened-DdXm1dbF.cjs +1 -0
  23. package/lib/Viewport-BiDoiU8M.js +113 -0
  24. package/lib/Viewport-CXGKUyDy.cjs +1 -0
  25. package/lib/accordion/index.cjs +1 -1
  26. package/lib/accordion/index.js +97 -93
  27. package/lib/animation/index.cjs +1 -1
  28. package/lib/animation/index.js +6 -6
  29. package/lib/api-fetcher/index.cjs +1 -1
  30. package/lib/api-fetcher/index.js +67 -66
  31. package/lib/attribute/index.cjs +1 -1
  32. package/lib/attribute/index.js +37 -34
  33. package/lib/attributes-BADnRZpK.cjs +1 -0
  34. package/lib/attributes-FObgMNCf.js +36 -0
  35. package/lib/billboard/index.cjs +1 -1
  36. package/lib/billboard/index.js +240 -232
  37. package/lib/cache/index.cjs +1 -1
  38. package/lib/cache/index.js +26 -23
  39. package/lib/canvas/index.cjs +1 -1
  40. package/lib/canvas/index.js +62 -59
  41. package/lib/canvas-BP1ceie3.cjs +1 -0
  42. package/lib/canvas-DsglKco1.js +40 -0
  43. package/lib/connector/index.cjs +1 -1
  44. package/lib/connector/index.js +44 -41
  45. package/lib/controls/index.cjs +1 -1
  46. package/lib/controls/index.js +6 -6
  47. package/lib/coordinates--JG1U6kQ.js +29 -0
  48. package/lib/coordinates-DQ9XV9M1.cjs +1 -0
  49. package/lib/css-property/index.cjs +1 -1
  50. package/lib/css-property/index.d.ts +1 -1
  51. package/lib/css-property/index.js +40 -37
  52. package/lib/css-unit-parser/index.cjs +2 -2
  53. package/lib/css-unit-parser/index.js +22 -19
  54. package/lib/css-value-parser/index.cjs +1 -1
  55. package/lib/css-value-parser/index.js +13 -11
  56. package/lib/custom-elements-BfZCJde6.cjs +1 -0
  57. package/lib/custom-elements-HEMuF7yH.js +27 -0
  58. package/lib/dev/index.cjs +2 -1
  59. package/lib/dev/index.d.ts +1 -0
  60. package/lib/dev/index.js +25 -10
  61. package/lib/device/index.cjs +1 -1
  62. package/lib/device/index.js +5 -5
  63. package/lib/dom-B40i6NXw.cjs +1 -0
  64. package/lib/dom-D8D-_9ty.js +108 -0
  65. package/lib/easings-BSGJFMAo.js +40 -0
  66. package/lib/easings-BWq0pPLq.cjs +1 -0
  67. package/lib/element-CqD0jqBJ.cjs +1 -0
  68. package/lib/element-DKw5H-Tu.js +10 -0
  69. package/lib/element-linked-store/index.cjs +1 -1
  70. package/lib/element-linked-store/index.js +53 -52
  71. package/lib/element-resizer/index.cjs +1 -1
  72. package/lib/element-resizer/index.js +47 -44
  73. package/lib/en3/index.cjs +4 -4
  74. package/lib/en3/index.js +192 -185
  75. package/lib/events-Ds-TuvYW.js +9 -0
  76. package/lib/events-UlGk63iC.cjs +1 -0
  77. package/lib/file-DwQs6bB6.js +28 -0
  78. package/lib/file-RHfA3OS-.cjs +1 -0
  79. package/lib/function-H4b_gTg6.cjs +1 -0
  80. package/lib/function-UmbPrOHm.js +19 -0
  81. package/lib/gestures-DmKKNnh4.js +14 -0
  82. package/lib/gestures-DtYbQr49.cjs +1 -0
  83. package/lib/history/index.cjs +1 -1
  84. package/lib/history/index.js +24 -21
  85. package/lib/iframe/index.cjs +1 -1
  86. package/lib/iframe/index.js +27 -24
  87. package/lib/image/index.cjs +1 -1
  88. package/lib/image/index.js +17 -13
  89. package/lib/index-BpO2RJ__.cjs +1 -0
  90. package/lib/index-DpKsHe97.js +68 -0
  91. package/lib/intersector/index.cjs +1 -1
  92. package/lib/intersector/index.js +3 -3
  93. package/lib/jsx/ComponentElement.d.ts +4 -0
  94. package/lib/jsx/h.d.ts +7 -16
  95. package/lib/jsx/hooks/component/useStylesheet.d.ts +1 -1
  96. package/lib/jsx/hooks/cssProperty.d.ts +6 -0
  97. package/lib/jsx/hooks/resize.d.ts +4 -0
  98. package/lib/jsx/hooks/store.d.ts +1 -2
  99. package/lib/jsx/hooks/ticker.d.ts +5 -0
  100. package/lib/jsx/index.cjs +1 -1
  101. package/lib/jsx/index.d.ts +4 -4
  102. package/lib/jsx/index.js +171 -349
  103. package/lib/jsx/plugins/vite/index.cjs +49 -0
  104. package/lib/jsx/plugins/vite/index.d.ts +38 -0
  105. package/lib/jsx/plugins/vite/index.js +104 -0
  106. package/lib/jsx/render.d.ts +2 -0
  107. package/lib/jsx/type.d.ts +228 -190
  108. package/lib/ladder/index.cjs +1 -1
  109. package/lib/ladder/index.js +86 -84
  110. package/lib/layout-C26zkY7D.js +35 -0
  111. package/lib/layout-CnGLl7oe.cjs +1 -0
  112. package/lib/layout-box/index.cjs +1 -1
  113. package/lib/layout-box/index.js +221 -217
  114. package/lib/loading/index.cjs +1 -1
  115. package/lib/loading/index.js +48 -45
  116. package/lib/local-links/index.cjs +1 -1
  117. package/lib/local-links/index.js +2 -2
  118. package/lib/masonry-layout/index.cjs +1 -1
  119. package/lib/masonry-layout/index.js +48 -45
  120. package/lib/math-C-knY2TL.cjs +1 -0
  121. package/lib/math-r8V23YFe.js +57 -0
  122. package/lib/media/index.cjs +1 -1
  123. package/lib/media/index.js +28 -25
  124. package/lib/metadata-BNdkmeeD.js +15 -0
  125. package/lib/metadata-BrHUfpV9.cjs +1 -0
  126. package/lib/morph/index.cjs +1 -1
  127. package/lib/morph/index.js +561 -556
  128. package/lib/morph-BtgB1YQP.js +256 -0
  129. package/lib/morph-Buhxq-X0.cjs +1 -0
  130. package/lib/need_redo_tweaker/index.cjs +4 -4
  131. package/lib/need_redo_tweaker/index.js +862 -834
  132. package/lib/notifier/index.cjs +1 -1
  133. package/lib/notifier/index.js +29 -26
  134. package/lib/number-Bu4sGvW7.cjs +1 -0
  135. package/lib/number-DiVt2xnh.js +47 -0
  136. package/lib/object-CiIdEmJx.js +98 -0
  137. package/lib/object-DTY_W6xG.cjs +1 -0
  138. package/lib/order/index.cjs +1 -1
  139. package/lib/order/index.js +3 -3
  140. package/lib/page-announcer/index.cjs +1 -1
  141. package/lib/page-announcer/index.js +2 -2
  142. package/lib/page-scroll/index.cjs +1 -1
  143. package/lib/page-scroll/index.js +2 -2
  144. package/lib/pixel-perfect/index.cjs +4 -4
  145. package/lib/pixel-perfect/index.js +43 -40
  146. package/lib/pointer/index.cjs +1 -1
  147. package/lib/pointer/index.js +125 -122
  148. package/lib/polyfills-CG1XJNia.js +28 -0
  149. package/lib/polyfills-DZCuDBkA.cjs +1 -0
  150. package/lib/popover/index.cjs +1 -1
  151. package/lib/popover/index.js +249 -245
  152. package/lib/radio/index.cjs +1 -1
  153. package/lib/radio/index.js +58 -55
  154. package/lib/render-DLcWVnuH.js +355 -0
  155. package/lib/render-DdomypCo.cjs +1 -0
  156. package/lib/router/index.cjs +1 -1
  157. package/lib/router/index.js +196 -194
  158. package/lib/scroll/index.cjs +1 -1
  159. package/lib/scroll/index.js +890 -877
  160. package/lib/scroll-BvIWh1xB.js +41 -0
  161. package/lib/scroll-CT0lpyRZ.cjs +1 -0
  162. package/lib/scroll-entries/index.cjs +1 -1
  163. package/lib/scroll-entries/index.js +37 -34
  164. package/lib/scroll-kit/index.cjs +1 -1
  165. package/lib/scroll-kit/index.js +214 -209
  166. package/lib/sequence/index.cjs +1 -1
  167. package/lib/sequence/index.js +102 -98
  168. package/lib/size-element/index.cjs +1 -1
  169. package/lib/size-element/index.js +29 -26
  170. package/lib/slicer/index.cjs +1 -1
  171. package/lib/slicer/index.js +118 -113
  172. package/lib/source/index.cjs +1 -1
  173. package/lib/source/index.js +5 -5
  174. package/lib/spa/index.cjs +1 -1
  175. package/lib/spa/index.js +94 -94
  176. package/lib/store/index.cjs +1 -1
  177. package/lib/store/index.d.ts +2 -2
  178. package/lib/store/index.js +10 -8
  179. package/lib/string-B3lm2b7v.js +84 -0
  180. package/lib/string-CbRNzmd9.cjs +1 -0
  181. package/lib/style-DBoQWK0d.js +14 -0
  182. package/lib/style-IDJ6db6n.cjs +1 -0
  183. package/lib/stylesheet-CHvuef16.js +28 -0
  184. package/lib/stylesheet-CQdBaIAA.cjs +1 -0
  185. package/lib/ticker/index.cjs +1 -1
  186. package/lib/ticker/index.js +96 -92
  187. package/lib/url-CPCO10Sy.cjs +1 -0
  188. package/lib/url-CWCY_qe_.js +124 -0
  189. package/lib/utils/attributes.d.ts +2 -0
  190. package/lib/utils/dom.d.ts +1 -0
  191. package/lib/utils/index.cjs +1 -1
  192. package/lib/utils/index.js +245 -226
  193. package/lib/utils/polyfills.d.ts +1 -1
  194. package/lib/video/index.cjs +1 -1
  195. package/lib/video/index.js +36 -33
  196. package/lib/window-resizer/index.cjs +1 -1
  197. package/lib/window-resizer/index.js +27 -24
  198. package/lib/youtube/index.cjs +1 -1
  199. package/lib/youtube/index.js +56 -54
  200. package/package.json +11 -24
  201. package/lib/Animation-BzTjZIE-.js +0 -108
  202. package/lib/Animation-C39Ah-LM.cjs +0 -1
  203. package/lib/Composed-C-TV9te3.cjs +0 -1
  204. package/lib/Composed-DyAWjEXE.js +0 -121
  205. package/lib/Damped-CRusiRIV.js +0 -56
  206. package/lib/Damped-Prr0iKu1.cjs +0 -1
  207. package/lib/DragControls-8rNZwQrs.cjs +0 -1
  208. package/lib/DragControls-DBNdMBA4.js +0 -228
  209. package/lib/LocalLinks-BxhSFv_Q.cjs +0 -1
  210. package/lib/LocalLinks-DFZFpbjs.js +0 -62
  211. package/lib/PageAnnouncerElement-0LxZjtVH.js +0 -24
  212. package/lib/PageAnnouncerElement-AQ0Ja6HM.cjs +0 -1
  213. package/lib/PageScroll-0LxFblry.js +0 -62
  214. package/lib/PageScroll-BXJUQwG7.cjs +0 -1
  215. package/lib/SourceElement-BHqPFbna.cjs +0 -5
  216. package/lib/SourceElement-DjbHjynf.js +0 -260
  217. package/lib/Store-Blf4msDz.cjs +0 -1
  218. package/lib/Store-ZThXYBQd.js +0 -152
  219. package/lib/Tweened-Bw1Cn1PJ.js +0 -47
  220. package/lib/Tweened-DWtk9E-O.cjs +0 -1
  221. package/lib/Viewport-BxCr0GlB.cjs +0 -1
  222. package/lib/Viewport-Dt-d9DPi.js +0 -109
  223. package/lib/attributes-69we3byR.js +0 -10
  224. package/lib/attributes-Bf2svn4j.cjs +0 -1
  225. package/lib/canvas-CU5Xjahf.cjs +0 -1
  226. package/lib/canvas-DeZ0SLUJ.js +0 -34
  227. package/lib/coordinates-CgdGoSYs.js +0 -24
  228. package/lib/coordinates-D8Np3cPD.cjs +0 -1
  229. package/lib/custom-elements-DBnCK7Zx.js +0 -24
  230. package/lib/custom-elements-Dh4TWRDJ.cjs +0 -1
  231. package/lib/dom-BETkVSSZ.js +0 -82
  232. package/lib/dom-CBLlqORw.cjs +0 -1
  233. package/lib/easings-BEmRlrDd.js +0 -38
  234. package/lib/easings-GegIwET5.cjs +0 -1
  235. package/lib/element-CGVl1jA-.js +0 -7
  236. package/lib/element-yhcBhsho.cjs +0 -1
  237. package/lib/events-CsVF98U6.js +0 -6
  238. package/lib/events-KVanG9sR.cjs +0 -1
  239. package/lib/file-DSpfWdd9.cjs +0 -1
  240. package/lib/file-GHShUlue.js +0 -24
  241. package/lib/function-C10DGppn.js +0 -17
  242. package/lib/function-MthRj-GJ.cjs +0 -1
  243. package/lib/gestures-C7gbKx11.cjs +0 -1
  244. package/lib/gestures-CcXV6fCp.js +0 -11
  245. package/lib/index-OE2INULi.cjs +0 -1
  246. package/lib/index-e9eDuagL.js +0 -65
  247. package/lib/jsx/hydrate.d.ts +0 -1
  248. package/lib/jsx/integrations/astro/client.cjs +0 -1
  249. package/lib/jsx/integrations/astro/client.d.ts +0 -2
  250. package/lib/jsx/integrations/astro/client.js +0 -50
  251. package/lib/jsx/integrations/astro/index.cjs +0 -1
  252. package/lib/jsx/integrations/astro/index.d.ts +0 -2
  253. package/lib/jsx/integrations/astro/index.js +0 -54
  254. package/lib/jsx/integrations/astro/server.cjs +0 -1
  255. package/lib/jsx/integrations/astro/server.d.ts +0 -3
  256. package/lib/jsx/integrations/astro/server.js +0 -35
  257. package/lib/jsx/plugins/vite.d.ts +0 -21
  258. package/lib/layout-BSMtwCga.js +0 -29
  259. package/lib/layout-Ctc2p3uz.cjs +0 -1
  260. package/lib/math-BOBiC4TN.js +0 -45
  261. package/lib/math-GDWEqu7y.cjs +0 -1
  262. package/lib/metadata-BcYZ5w3T.cjs +0 -1
  263. package/lib/metadata-jfowcCyz.js +0 -12
  264. package/lib/morph-B6sGhLCi.cjs +0 -1
  265. package/lib/morph-BQErz7qP.js +0 -242
  266. package/lib/number-ChAm68cm.cjs +0 -1
  267. package/lib/number-CumqY64S.js +0 -40
  268. package/lib/object-CcMK4y_r.js +0 -87
  269. package/lib/object-baN9pgbU.cjs +0 -1
  270. package/lib/polyfills-DJrTJQky.js +0 -24
  271. package/lib/polyfills-Df4r-ETT.cjs +0 -1
  272. package/lib/render-DQs7rIoN.cjs +0 -1
  273. package/lib/render-D_0FCWEu.js +0 -18
  274. package/lib/scroll-BA2WnUrb.cjs +0 -1
  275. package/lib/scroll-DY5senkF.js +0 -37
  276. package/lib/string-BlMQbe8b.js +0 -70
  277. package/lib/string-DUXXtU8v.cjs +0 -1
  278. package/lib/style-At6aDoqG.cjs +0 -1
  279. package/lib/style-j2TwriJ_.js +0 -10
  280. package/lib/stylesheet-5_o7PFzM.cjs +0 -1
  281. package/lib/stylesheet-DdBzowZY.js +0 -24
  282. package/lib/url-CHgcNwJ1.cjs +0 -1
  283. package/lib/url-CYgo5vrG.js +0 -113
  284. package/lib/vite-C-i3hVDL.js +0 -75
  285. package/lib/vite-DzanPumM.cjs +0 -44
@@ -1,787 +1,792 @@
1
- var ge = Object.defineProperty, Ee = Object.defineProperties;
2
- var ve = Object.getOwnPropertyDescriptors;
3
- var Zt = Object.getOwnPropertySymbols;
4
- var Le = Object.prototype.hasOwnProperty, Se = Object.prototype.propertyIsEnumerable;
5
- var _t = (o, e) => (e = Symbol[o]) ? e : Symbol.for("Symbol." + o), ee = (o) => {
6
- throw TypeError(o);
1
+ var __defProp = Object.defineProperty, __defProps = Object.defineProperties;
2
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
3
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty, __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name), __typeError = (msg) => {
6
+ throw TypeError(msg);
7
7
  };
8
- var te = (o, e, s) => e in o ? ge(o, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[e] = s, Ut = (o, e) => {
9
- for (var s in e || (e = {}))
10
- Le.call(e, s) && te(o, s, e[s]);
11
- if (Zt)
12
- for (var s of Zt(e))
13
- Se.call(e, s) && te(o, s, e[s]);
14
- return o;
15
- }, Tt = (o, e) => Ee(o, ve(e));
16
- var zt = (o, e, s) => e.has(o) || ee("Cannot " + s);
17
- var t = (o, e, s) => (zt(o, e, "read from private field"), s ? s.call(o) : e.get(o)), h = (o, e, s) => e.has(o) ? ee("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, s), n = (o, e, s, a) => (zt(o, e, "write to private field"), a ? a.call(o, s) : e.set(o, s), s), y = (o, e, s) => (zt(o, e, "access private method"), s);
18
- var J = (o, e, s) => new Promise((a, l) => {
19
- var v = (c) => {
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value, __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);
11
+ if (__getOwnPropSymbols)
12
+ for (var prop of __getOwnPropSymbols(b))
13
+ __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);
14
+ return a;
15
+ }, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)), __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
16
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
17
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
18
+ var __async = (__this, __arguments, generator) => new Promise((resolve, reject) => {
19
+ var fulfilled = (value) => {
20
20
  try {
21
- f(s.next(c));
22
- } catch (p) {
23
- l(p);
21
+ step(generator.next(value));
22
+ } catch (e) {
23
+ reject(e);
24
24
  }
25
- }, S = (c) => {
25
+ }, rejected = (value) => {
26
26
  try {
27
- f(s.throw(c));
28
- } catch (p) {
29
- l(p);
27
+ step(generator.throw(value));
28
+ } catch (e) {
29
+ reject(e);
30
30
  }
31
- }, f = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(v, S);
32
- f((s = s.apply(o, e)).next());
31
+ }, step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
32
+ step((generator = generator.apply(__this, __arguments)).next());
33
33
  });
34
- var se = (o, e, s) => (e = o[_t("asyncIterator")]) ? e.call(o) : (o = o[_t("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);
35
- import { i as oe } from "../index-e9eDuagL.js";
36
- import { i as ye, e as ae, c as ie } from "../dom-BETkVSSZ.js";
37
- import { d as q } from "../events-CsVF98U6.js";
38
- import { w as we, s as be } from "../scroll-DY5senkF.js";
34
+ var __forAwait = (obj, it, method) => (it = obj[__knownSymbol("asyncIterator")]) ? it.call(obj) : (obj = obj[__knownSymbol("iterator")](), it = {}, method = (key, fn) => (fn = obj[key]) && (it[key] = (arg) => new Promise((yes, no, done) => (arg = fn.call(obj, arg), done = arg.done, Promise.resolve(arg.value).then((value) => yes({ value, done }), no)))), method("next"), method("return"), it);
35
+ import { i as isBrowser } from "../index-DpKsHe97.js";
36
+ import { i as intersectElements, e as excludeElements, c as createScriptElement } from "../dom-D8D-_9ty.js";
37
+ import { d as dispatchEvent } from "../events-Ds-TuvYW.js";
38
+ import { w as wait, s as scrollToElement } from "../scroll-BvIWh1xB.js";
39
39
  import "construct-style-sheets-polyfill";
40
- import { a as Pe, c as qt, d as Ae } from "../url-CYgo5vrG.js";
41
- import { cssValueParser as ke } from "../css-value-parser/index.js";
42
- import { c as he } from "../string-BlMQbe8b.js";
43
- class le extends HTMLElement {
40
+ import { a as normalizeBase, c as changeHistory, d as splitPath } from "../url-CWCY_qe_.js";
41
+ import { cssValueParser } from "../css-value-parser/index.js";
42
+ import { c as camelToKebab } from "../string-B3lm2b7v.js";
43
+ const _MorphAnnouncer = class _MorphAnnouncer extends HTMLElement {
44
44
  connectedCallback() {
45
- const e = {
45
+ const attrs = {
46
46
  "aria-live": "assertive",
47
47
  "aria-atomic": "true",
48
48
  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"
49
49
  };
50
- for (const [s, a] of Object.entries(e))
51
- this.setAttribute(s, a);
52
- }
53
- }
54
- oe && !customElements.get("morph-announcer") && customElements.define("morph-announcer", le);
55
- var M, i, T, it, ce, gt, rt;
56
- class It {
57
- constructor(e, s) {
58
- h(this, T);
59
- h(this, M);
60
- h(this, i);
61
- h(this, gt, (e) => {
62
- e.preventDefault(), y(this, T, ce).call(this);
63
- });
64
- h(this, rt, () => {
65
- const e = t(this, i).hasAttribute("data-revalidate");
66
- t(this, M).prefetch(t(this, T, it), e), t(this, i).removeEventListener("pointerenter", t(this, rt));
67
- });
68
- n(this, M, s), n(this, i, e), t(this, i).addEventListener("click", t(this, gt)), this.checkCurrent(location.href.replace(location.origin, "")), t(this, i).hasAttribute("data-prefetch") && t(this, i).addEventListener("pointerenter", t(this, rt));
50
+ for (const [key, value] of Object.entries(attrs))
51
+ this.setAttribute(key, value);
52
+ }
53
+ };
54
+ __name(_MorphAnnouncer, "MorphAnnouncer");
55
+ let MorphAnnouncer = _MorphAnnouncer;
56
+ isBrowser && !customElements.get("morph-announcer") && customElements.define("morph-announcer", MorphAnnouncer);
57
+ var _morph, _element, _MorphLink_instances, path_get, click_fn, _clickListener, _pointerListener;
58
+ const _MorphLink = class _MorphLink {
59
+ constructor(element, morph) {
60
+ __privateAdd(this, _MorphLink_instances);
61
+ __privateAdd(this, _morph);
62
+ __privateAdd(this, _element);
63
+ __privateAdd(this, _clickListener, /* @__PURE__ */ __name((e) => {
64
+ e.preventDefault(), __privateMethod(this, _MorphLink_instances, click_fn).call(this);
65
+ }, "#clickListener"));
66
+ __privateAdd(this, _pointerListener, /* @__PURE__ */ __name(() => {
67
+ const revalidate = __privateGet(this, _element).hasAttribute("data-revalidate");
68
+ __privateGet(this, _morph).prefetch(__privateGet(this, _MorphLink_instances, path_get), revalidate), __privateGet(this, _element).removeEventListener("pointerenter", __privateGet(this, _pointerListener));
69
+ }, "#pointerListener"));
70
+ __privateSet(this, _morph, morph), __privateSet(this, _element, element), __privateGet(this, _element).addEventListener("click", __privateGet(this, _clickListener)), this.checkCurrent(location.href.replace(location.origin, "")), __privateGet(this, _element).hasAttribute("data-prefetch") && __privateGet(this, _element).addEventListener("pointerenter", __privateGet(this, _pointerListener));
69
71
  }
70
72
  get element() {
71
- return t(this, i);
72
- }
73
- checkCurrent(e) {
74
- var p, st;
75
- const s = t(this, M).normalizePath(e), a = t(this, M).normalizePath(t(this, T, it));
76
- 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");
77
- const [l, v] = (st = t(this, T, it).split("#")[0]) == null ? void 0 : st.split("?"), S = new URLSearchParams(v), f = new URLSearchParams(location.search);
78
- let c = 0;
79
- for (const [A] of f)
80
- S.has(A) && f.get(A) === S.get(A) && c++;
81
- c ? (t(this, i).classList.toggle(
73
+ return __privateGet(this, _element);
74
+ }
75
+ checkCurrent(path) {
76
+ var _a, _b;
77
+ const locationUrl = __privateGet(this, _morph).normalizePath(path), linkUrl = __privateGet(this, _morph).normalizePath(__privateGet(this, _MorphLink_instances, path_get));
78
+ __privateGet(this, _element).hasAttribute("data-include") && locationUrl.pathname.includes(linkUrl.pathname) ? __privateGet(this, _element).classList.add("current") : linkUrl.pathname === locationUrl.pathname ? __privateGet(this, _element).classList.add("current") : (_a = __privateGet(this, _element).getAttribute("data-associated-paths")) != null && _a.split(",").find((path2) => locationUrl.pathname.includes(path2)) ? __privateGet(this, _element).classList.add("current") : __privateGet(this, _element).classList.remove("current"), locationUrl.path === linkUrl.path ? __privateGet(this, _element).classList.add("exact") : __privateGet(this, _element).classList.remove("exact");
79
+ const [pathWithoutParams, pathParamsStr] = (_b = __privateGet(this, _MorphLink_instances, path_get).split("#")[0]) == null ? void 0 : _b.split("?"), pathParams = new URLSearchParams(pathParamsStr), locationParams = new URLSearchParams(location.search);
80
+ let matchCounter = 0;
81
+ for (const [key] of locationParams)
82
+ pathParams.has(key) && locationParams.get(key) === pathParams.get(key) && matchCounter++;
83
+ matchCounter ? (__privateGet(this, _element).classList.toggle(
82
84
  "all-params-matched",
83
- f.size === c
84
- ), t(this, i).classList.toggle(
85
+ locationParams.size === matchCounter
86
+ ), __privateGet(this, _element).classList.toggle(
85
87
  "some-params-matched",
86
- f.size !== c
87
- )) : !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"));
88
- for (const A in t(this, i).dataset) {
89
- const at = he(A);
90
- if (at.startsWith("match-param-")) {
91
- const z = at.split("match-param-")[1], b = t(this, i).dataset[A], F = `param-${z}-matched`;
92
- f.has(z) && f.get(z) === b || !f.has(z) && (b === "" || b === "*" || b === "all" || b === "any" || b === "vse") ? t(this, i).classList.add(F) : t(this, i).classList.remove(F);
88
+ locationParams.size !== matchCounter
89
+ )) : !locationParams.size && __privateGet(this, _element).hasAttribute("data-match-no-params") ? __privateGet(this, _element).classList.add("all-params-matched") : (__privateGet(this, _element).classList.remove("all-params-matched"), __privateGet(this, _element).classList.remove("some-params-matched"));
90
+ for (const key in __privateGet(this, _element).dataset) {
91
+ const kebabKey = camelToKebab(key);
92
+ if (kebabKey.startsWith("match-param-")) {
93
+ const name = kebabKey.split("match-param-")[1], value = __privateGet(this, _element).dataset[key], className = `param-${name}-matched`;
94
+ locationParams.has(name) && locationParams.get(name) === value || !locationParams.has(name) && (value === "" || value === "*" || value === "all" || value === "any" || value === "vse") ? __privateGet(this, _element).classList.add(className) : __privateGet(this, _element).classList.remove(className);
93
95
  }
94
96
  }
95
97
  }
96
98
  destroy() {
97
- t(this, i).removeEventListener("click", t(this, gt)), t(this, i).removeEventListener("pointerenter", t(this, rt)), t(this, i).classList.remove("current", "exact");
99
+ __privateGet(this, _element).removeEventListener("click", __privateGet(this, _clickListener)), __privateGet(this, _element).removeEventListener("pointerenter", __privateGet(this, _pointerListener)), __privateGet(this, _element).classList.remove("current", "exact");
98
100
  }
99
- }
100
- M = new WeakMap(), i = new WeakMap(), T = new WeakSet(), it = function() {
101
- const e = new URL(t(this, i).href);
102
- return t(this, M).normalizePath(
103
- e.pathname + e.search + e.hash
101
+ };
102
+ _morph = new WeakMap(), _element = new WeakMap(), _MorphLink_instances = new WeakSet(), path_get = /* @__PURE__ */ __name(function() {
103
+ const url = new URL(__privateGet(this, _element).href);
104
+ return __privateGet(this, _morph).normalizePath(
105
+ url.pathname + url.search + url.hash
104
106
  ).path;
105
- }, ce = function() {
106
- var s;
107
+ }, "#path"), click_fn = /* @__PURE__ */ __name(function() {
108
+ var _a;
107
109
  if (document.documentElement.classList.contains("click-disabled"))
108
110
  return;
109
- if (t(this, i).hasAttribute("data-back") && t(this, M).previousURL)
111
+ if (__privateGet(this, _element).hasAttribute("data-back") && __privateGet(this, _morph).previousURL)
110
112
  history.back();
111
113
  else {
112
- const a = t(this, i).getAttribute(
114
+ const historyAction = __privateGet(this, _element).getAttribute(
113
115
  "data-history-action"
114
- ) || "push", l = t(this, i).hasAttribute("data-center-scroll"), v = getComputedStyle(t(this, i)).getPropertyValue("--offset-scroll").trim(), S = v ? ke.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(
116
+ ) || "push", centerScroll = __privateGet(this, _element).hasAttribute("data-center-scroll"), offsetScrollRawValue = getComputedStyle(__privateGet(this, _element)).getPropertyValue("--offset-scroll").trim(), offsetScroll = offsetScrollRawValue ? cssValueParser.parse(offsetScrollRawValue) : void 0, revalidate = __privateGet(this, _element).hasAttribute("data-revalidate") || __privateGet(this, _element).hasAttribute("data-pagination-more-link") || __privateGet(this, _element).hasAttribute("data-pagination-set-link") || __privateGet(this, _element).hasAttribute("data-pagination-next-link") || __privateGet(this, _element).hasAttribute("data-pagination-prev-link"), keepSearchParameters = __privateGet(this, _element).hasAttribute(
115
117
  "data-keep-search-parameters"
116
- ), p = t(this, i).hasAttribute("data-keep-scroll-position") || t(this, i).hasAttribute("data-pagination-more-link"), st = t(this, i).getAttribute(
118
+ ), keepScrollPosition = __privateGet(this, _element).hasAttribute("data-keep-scroll-position") || __privateGet(this, _element).hasAttribute("data-pagination-more-link"), scrollBehaviour = __privateGet(this, _element).getAttribute(
117
119
  "data-scroll-behaviour"
118
- ), A = (s = t(this, i).getAttribute("data-submorph") || t(this, i).getAttribute("data-submorph-append")) == null ? void 0 : s.split(",").map((b) => b.trim()), at = t(this, i).hasAttribute("data-clear-state");
119
- let z = t(this, T, it);
120
- if (t(this, i).hasAttribute("data-toggle-params")) {
121
- const [b, F] = t(this, T, it).split("?"), At = new URLSearchParams(F), X = new URLSearchParams(location.search), d = new URLSearchParams();
122
- for (const [R] of At)
123
- (!X.has(R) || X.has(R) && X.get(R) !== At.get(R)) && d.append(R, At.get(R));
124
- if (t(this, i).hasAttribute("data-merge-params"))
125
- for (const [R] of X)
126
- At.has(R) || d.append(R, X.get(R));
127
- z = `${b}?${d.toString()}`;
120
+ ), submorph = (_a = __privateGet(this, _element).getAttribute("data-submorph") || __privateGet(this, _element).getAttribute("data-submorph-append")) == null ? void 0 : _a.split(",").map((v) => v.trim()), clearState = __privateGet(this, _element).hasAttribute("data-clear-state");
121
+ let path = __privateGet(this, _MorphLink_instances, path_get);
122
+ if (__privateGet(this, _element).hasAttribute("data-toggle-params")) {
123
+ const [pathWithoutParams, pathParamsStr] = __privateGet(this, _MorphLink_instances, path_get).split("?"), pathParams = new URLSearchParams(pathParamsStr), locationParams = new URLSearchParams(location.search), resultParams = new URLSearchParams();
124
+ for (const [key] of pathParams)
125
+ (!locationParams.has(key) || locationParams.has(key) && locationParams.get(key) !== pathParams.get(key)) && resultParams.append(key, pathParams.get(key));
126
+ if (__privateGet(this, _element).hasAttribute("data-merge-params"))
127
+ for (const [key] of locationParams)
128
+ pathParams.has(key) || resultParams.append(key, locationParams.get(key));
129
+ path = `${pathWithoutParams}?${resultParams.toString()}`;
128
130
  }
129
- t(this, M).navigate(z, {
130
- historyAction: a,
131
- centerScroll: l,
132
- offsetScroll: S,
133
- revalidate: f,
134
- keepSearchParameters: c,
135
- submorph: A,
136
- clearState: at,
137
- keepScrollPosition: p,
138
- scrollBehaviour: st,
139
- submorphAppend: t(this, i).hasAttribute("data-submorph-append"),
140
- mergeParams: t(this, i).hasAttribute("data-merge-params") && !t(this, i).hasAttribute("data-toggle-params"),
141
- detail: t(this, i).getAttribute("data-detail"),
142
- removeParams: t(this, i).getAttribute("data-remove-params") || void 0,
143
- scrollTo: t(this, i).getAttribute("data-scroll-to") || void 0
131
+ __privateGet(this, _morph).navigate(path, {
132
+ historyAction,
133
+ centerScroll,
134
+ offsetScroll,
135
+ revalidate,
136
+ keepSearchParameters,
137
+ submorph,
138
+ clearState,
139
+ keepScrollPosition,
140
+ scrollBehaviour,
141
+ submorphAppend: __privateGet(this, _element).hasAttribute("data-submorph-append"),
142
+ mergeParams: __privateGet(this, _element).hasAttribute("data-merge-params") && !__privateGet(this, _element).hasAttribute("data-toggle-params"),
143
+ detail: __privateGet(this, _element).getAttribute("data-detail"),
144
+ removeParams: __privateGet(this, _element).getAttribute("data-remove-params") || void 0,
145
+ scrollTo: __privateGet(this, _element).getAttribute("data-scroll-to") || void 0
144
146
  });
145
147
  }
146
- }, gt = new WeakMap(), rt = new WeakMap();
147
- var C, nt, Et, Wt, vt;
148
- class Re {
149
- constructor(e) {
150
- h(this, Et);
151
- h(this, C);
152
- h(this, nt, []);
153
- h(this, vt, () => {
154
- y(this, Et, Wt).call(this);
155
- });
156
- n(this, C, e);
157
- for (const s in t(this, C).dataset) {
158
- const a = he(s);
159
- if (a.startsWith("param-")) {
160
- const l = a.split("param-")[1], v = t(this, C).dataset[s];
161
- t(this, nt).push({
162
- name: l,
163
- value: v
148
+ }, "#click"), _clickListener = new WeakMap(), _pointerListener = new WeakMap(), __name(_MorphLink, "MorphLink");
149
+ let MorphLink = _MorphLink;
150
+ var _element2, _params, _MorphParamsDependent_instances, update_fn, _urlChangeListener;
151
+ const _MorphParamsDependent = class _MorphParamsDependent {
152
+ constructor(element) {
153
+ __privateAdd(this, _MorphParamsDependent_instances);
154
+ __privateAdd(this, _element2);
155
+ __privateAdd(this, _params, []);
156
+ __privateAdd(this, _urlChangeListener, /* @__PURE__ */ __name(() => {
157
+ __privateMethod(this, _MorphParamsDependent_instances, update_fn).call(this);
158
+ }, "#urlChangeListener"));
159
+ __privateSet(this, _element2, element);
160
+ for (const key in __privateGet(this, _element2).dataset) {
161
+ const kebabKey = camelToKebab(key);
162
+ if (kebabKey.startsWith("param-")) {
163
+ const name = kebabKey.split("param-")[1], value = __privateGet(this, _element2).dataset[key];
164
+ __privateGet(this, _params).push({
165
+ name,
166
+ value
164
167
  });
165
168
  }
166
169
  }
167
170
  document.addEventListener(
168
171
  "morphURLParametersChange",
169
- t(this, vt)
170
- ), y(this, Et, Wt).call(this);
172
+ __privateGet(this, _urlChangeListener)
173
+ ), __privateMethod(this, _MorphParamsDependent_instances, update_fn).call(this);
171
174
  }
172
175
  destroy() {
173
176
  document.removeEventListener(
174
177
  "morphURLParametersChange",
175
- t(this, vt)
178
+ __privateGet(this, _urlChangeListener)
176
179
  );
177
180
  }
178
- }
179
- C = new WeakMap(), nt = new WeakMap(), Et = new WeakSet(), Wt = function() {
180
- const e = new URLSearchParams(location.search);
181
- let s = !!t(this, nt).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"));
182
- !s && t(this, C).hasAttribute("data-match-no-params") && (s = !t(this, nt).filter((l) => e.has(l.name)).length);
183
- const a = t(this, C).getAttribute("data-hide-class");
184
- 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";
185
- }, vt = new WeakMap();
186
- const Ce = new DOMParser();
187
- var I, Q, U, W, Z, Y, ot, _, $, Lt, ht;
188
- class re {
189
- constructor(e, s) {
190
- h(this, I);
191
- h(this, Q);
192
- h(this, U, { x: 0, y: 0 });
193
- h(this, W, null);
194
- h(this, Z, null);
195
- h(this, Y, null);
196
- h(this, ot, null);
197
- h(this, _, null);
198
- h(this, $, null);
199
- h(this, Lt);
200
- h(this, ht, !1);
201
- n(this, I, e), n(this, Q, s);
181
+ };
182
+ _element2 = new WeakMap(), _params = new WeakMap(), _MorphParamsDependent_instances = new WeakSet(), update_fn = /* @__PURE__ */ __name(function() {
183
+ const locationParams = new URLSearchParams(location.search);
184
+ let matched = !!__privateGet(this, _params).find((param) => locationParams.has(param.name) && (locationParams.get(param.name) === param.value || param.value === "*" || param.value === "all" || param.value === "any" || param.value === "vse" || locationParams.get(param.name) === "*" || locationParams.get(param.name) === "all" || locationParams.get(param.name) === "any" || locationParams.get(param.name) === "vse"));
185
+ !matched && __privateGet(this, _element2).hasAttribute("data-match-no-params") && (matched = !__privateGet(this, _params).filter((param) => locationParams.has(param.name)).length);
186
+ const hideClass = __privateGet(this, _element2).getAttribute("data-hide-class");
187
+ matched ? hideClass ? __privateGet(this, _element2).classList.remove(hideClass) : __privateGet(this, _element2).style.display = "" : hideClass ? __privateGet(this, _element2).classList.add(hideClass) : __privateGet(this, _element2).style.display = "none";
188
+ }, "#update"), _urlChangeListener = new WeakMap(), __name(_MorphParamsDependent, "MorphParamsDependent");
189
+ let MorphParamsDependent = _MorphParamsDependent;
190
+ const domParser = new DOMParser();
191
+ var _morph2, _pathname, _scrollState, _initialDocument, _modifiedDocument, _currentDocument, _savedState, _abortController, _fetching, _headers, _needRavalidation;
192
+ const _MorphRoute = class _MorphRoute {
193
+ constructor(morph, pathname) {
194
+ __privateAdd(this, _morph2);
195
+ __privateAdd(this, _pathname);
196
+ __privateAdd(this, _scrollState, { x: 0, y: 0 });
197
+ __privateAdd(this, _initialDocument, null);
198
+ __privateAdd(this, _modifiedDocument, null);
199
+ __privateAdd(this, _currentDocument, null);
200
+ __privateAdd(this, _savedState, null);
201
+ __privateAdd(this, _abortController, null);
202
+ __privateAdd(this, _fetching, null);
203
+ __privateAdd(this, _headers);
204
+ __privateAdd(this, _needRavalidation, !1);
205
+ __privateSet(this, _morph2, morph), __privateSet(this, _pathname, pathname);
202
206
  }
203
207
  get pathname() {
204
- return t(this, Q);
208
+ return __privateGet(this, _pathname);
205
209
  }
206
210
  get scrollState() {
207
- return t(this, U);
211
+ return __privateGet(this, _scrollState);
208
212
  }
209
213
  get document() {
210
- return t(this, Y);
214
+ return __privateGet(this, _currentDocument);
211
215
  }
212
216
  needRavalidation() {
213
- n(this, ht, !0);
217
+ __privateSet(this, _needRavalidation, !0);
214
218
  }
215
- setHeaders(e) {
216
- n(this, Lt, e);
219
+ setHeaders(headers) {
220
+ __privateSet(this, _headers, headers);
217
221
  }
218
- setInitialDocument(e) {
219
- n(this, W, e.cloneNode(!0));
222
+ setInitialDocument(document2) {
223
+ __privateSet(this, _initialDocument, document2.cloneNode(!0));
220
224
  }
221
225
  abort() {
222
- var e;
223
- return (e = t(this, _)) == null ? void 0 : e.abort(
224
- `[${t(this, Q)}] page loading cancelled`
226
+ var _a;
227
+ return (_a = __privateGet(this, _abortController)) == null ? void 0 : _a.abort(
228
+ `[${__privateGet(this, _pathname)}] page loading cancelled`
225
229
  );
226
230
  }
227
- fetch(e, s, a) {
228
- return J(this, null, function* () {
229
- var l;
230
- if (!a && !t(this, ht)) {
231
- const f = ((l = t(this, W)) == null ? void 0 : l.documentElement.getAttribute("data-cache")) && s !== e, c = t(this, W) && t(this, I).isPopstateNavigation;
232
- if (t(this, $) || f || c)
233
- return t(this, $);
231
+ fetch(path, currentPath, revalidate) {
232
+ return __async(this, null, function* () {
233
+ var _a;
234
+ if (!revalidate && !__privateGet(this, _needRavalidation)) {
235
+ const shouldUseCache = ((_a = __privateGet(this, _initialDocument)) == null ? void 0 : _a.documentElement.getAttribute("data-cache")) && currentPath !== path, isPopstateNavigation = __privateGet(this, _initialDocument) && __privateGet(this, _morph2).isPopstateNavigation;
236
+ if (__privateGet(this, _fetching) || shouldUseCache || isPopstateNavigation)
237
+ return __privateGet(this, _fetching);
234
238
  }
235
- return n(this, $, new Promise((v) => J(this, null, function* () {
239
+ return __privateSet(this, _fetching, new Promise((res) => __async(this, null, function* () {
236
240
  try {
237
- n(this, _, new AbortController());
238
- const f = yield (yield fetch(e, {
239
- signal: t(this, _).signal,
240
- headers: Ut({
241
+ __privateSet(this, _abortController, new AbortController());
242
+ const text = yield (yield fetch(path, {
243
+ signal: __privateGet(this, _abortController).signal,
244
+ headers: __spreadValues({
241
245
  "X-MORPH": "true",
242
- "X-MORPH-REVALIDATE": a ? "true" : "false",
243
- "X-MORPH-CURRENT-PATH": encodeURIComponent(s),
244
- "X-MORPH-NEW-PATH": encodeURIComponent(e)
245
- }, t(this, Lt))
246
- })).text(), c = Ce.parseFromString(f, "text/html");
247
- this.setInitialDocument(c), n(this, ht, !1);
248
- } catch (S) {
249
- console.warn(S);
246
+ "X-MORPH-REVALIDATE": revalidate ? "true" : "false",
247
+ "X-MORPH-CURRENT-PATH": encodeURIComponent(currentPath),
248
+ "X-MORPH-NEW-PATH": encodeURIComponent(path)
249
+ }, __privateGet(this, _headers))
250
+ })).text(), document2 = domParser.parseFromString(text, "text/html");
251
+ this.setInitialDocument(document2), __privateSet(this, _needRavalidation, !1);
252
+ } catch (e) {
253
+ console.warn(e);
250
254
  } finally {
251
- n(this, _, null), n(this, $, null), v();
255
+ __privateSet(this, _abortController, null), __privateSet(this, _fetching, null), res();
252
256
  }
253
- }))), t(this, $);
257
+ }))), __privateGet(this, _fetching);
254
258
  });
255
259
  }
256
260
  cloneDocument() {
257
- n(this, Y, (t(this, Z) || t(this, W)).cloneNode(!0));
261
+ __privateSet(this, _currentDocument, (__privateGet(this, _modifiedDocument) || __privateGet(this, _initialDocument)).cloneNode(!0));
258
262
  }
259
263
  get title() {
260
- let e = "";
261
- if (t(this, Y).title)
262
- e = t(this, Y).title;
264
+ let title = "";
265
+ if (__privateGet(this, _currentDocument).title)
266
+ title = __privateGet(this, _currentDocument).title;
263
267
  else {
264
- const s = t(this, Y).querySelector("h1");
265
- e = (s == null ? void 0 : s.innerText) || (s == null ? void 0 : s.textContent) || t(this, Q);
268
+ const h1 = __privateGet(this, _currentDocument).querySelector("h1");
269
+ title = (h1 == null ? void 0 : h1.innerText) || (h1 == null ? void 0 : h1.textContent) || __privateGet(this, _pathname);
266
270
  }
267
- return e;
271
+ return title;
268
272
  }
269
273
  clearScrollState() {
270
- t(this, U).x = 0, t(this, U).y = 0;
274
+ __privateGet(this, _scrollState).x = 0, __privateGet(this, _scrollState).y = 0;
271
275
  }
272
276
  clearDocumentState() {
273
- n(this, Z, null);
277
+ __privateSet(this, _modifiedDocument, null);
274
278
  }
275
279
  saveScrollState() {
276
- t(this, W).documentElement.hasAttribute(
280
+ __privateGet(this, _initialDocument).documentElement.hasAttribute(
277
281
  "data-no-scroll-restoration"
278
- ) ? (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);
282
+ ) ? (__privateGet(this, _scrollState).x = 0, __privateGet(this, _scrollState).y = 0) : (__privateGet(this, _scrollState).x = __privateGet(this, _morph2).scrollValue.left, __privateGet(this, _scrollState).y = __privateGet(this, _morph2).scrollValue.top);
279
283
  }
280
284
  restoreScrollPosition() {
281
- t(this, I).scrollElement.scroll({
282
- top: t(this, U).y,
283
- left: t(this, U).x,
285
+ __privateGet(this, _morph2).scrollElement.scroll({
286
+ top: __privateGet(this, _scrollState).y,
287
+ left: __privateGet(this, _scrollState).x,
284
288
  behavior: "instant"
285
289
  });
286
290
  }
287
291
  saveDocumentState() {
288
- t(this, W).documentElement.hasAttribute(
292
+ __privateGet(this, _initialDocument).documentElement.hasAttribute(
289
293
  "data-no-page-restoration"
290
- ) ? n(this, Z, null) : n(this, Z, document.cloneNode(!0));
294
+ ) ? __privateSet(this, _modifiedDocument, null) : __privateSet(this, _modifiedDocument, document.cloneNode(!0));
291
295
  }
292
296
  renewScrollPosition() {
293
- t(this, I).scrollElement.scroll({
297
+ __privateGet(this, _morph2).scrollElement.scroll({
294
298
  top: 0,
295
299
  left: 0,
296
300
  behavior: "instant"
297
301
  });
298
302
  }
299
- saveState(e) {
300
- n(this, ot, e);
303
+ saveState(state) {
304
+ __privateSet(this, _savedState, state);
301
305
  }
302
306
  clearState() {
303
- const e = t(this, ot);
304
- return n(this, ot, null), e;
305
- }
306
- }
307
- I = new WeakMap(), Q = new WeakMap(), U = new WeakMap(), W = new WeakMap(), Z = new WeakMap(), Y = new WeakMap(), ot = new WeakMap(), _ = new WeakMap(), $ = new WeakMap(), Lt = new WeakMap(), ht = new WeakMap();
308
- var D, lt, w, j, u, tt, V, G, x, St, O, yt, et, ct, dt, wt, mt, bt, Pt, E, ft, Vt, Ot, Ft, Nt, xt, ut;
309
- const pt = class pt {
310
- constructor(e) {
311
- h(this, E);
312
- h(this, D, null);
313
- h(this, lt, null);
314
- h(this, w, []);
315
- h(this, j);
316
- h(this, u, null);
317
- h(this, tt);
318
- h(this, V, []);
319
- h(this, G, !1);
320
- h(this, x, null);
321
- h(this, St, !1);
322
- h(this, O, /* @__PURE__ */ new Map());
323
- h(this, yt, []);
324
- h(this, et, null);
325
- h(this, ct, 0);
326
- h(this, dt, 0);
327
- h(this, wt);
328
- h(this, mt);
329
- h(this, bt);
330
- h(this, Pt, (e) => {
331
- var s, a;
332
- 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";
333
- });
334
- h(this, xt, (e) => J(this, null, function* () {
335
- e.preventDefault(), n(this, G, !0), yield this.navigate(location.href.replace(location.origin, ""), {
307
+ const state = __privateGet(this, _savedState);
308
+ return __privateSet(this, _savedState, null), state;
309
+ }
310
+ };
311
+ _morph2 = new WeakMap(), _pathname = new WeakMap(), _scrollState = new WeakMap(), _initialDocument = new WeakMap(), _modifiedDocument = new WeakMap(), _currentDocument = new WeakMap(), _savedState = new WeakMap(), _abortController = new WeakMap(), _fetching = new WeakMap(), _headers = new WeakMap(), _needRavalidation = new WeakMap(), __name(_MorphRoute, "MorphRoute");
312
+ let MorphRoute = _MorphRoute;
313
+ var _options, _morphElements, _links, _candidateURL, _currentURL, _previousURL, _promises, _isPopstateNavigation, _currentScrollElement, _isWindowScroll, _routes, _paramDependent, _announcer, _currentScrollX, _currentScrollY, _lastSubmorph, _lastRevalidate, _lastKeepScrollPosition, _checkLink, _Morph_instances, getRoute_fn, getMorphElements_fn, isElementEmitsLoadEvent_fn, updateCurrentScrollElement_fn, tryScrollToElement_fn, _popStateListener, _scrollListener;
314
+ const _Morph = class _Morph {
315
+ constructor(parameters) {
316
+ __privateAdd(this, _Morph_instances);
317
+ __privateAdd(this, _options, null);
318
+ __privateAdd(this, _morphElements, null);
319
+ __privateAdd(this, _links, []);
320
+ __privateAdd(this, _candidateURL);
321
+ __privateAdd(this, _currentURL, null);
322
+ __privateAdd(this, _previousURL);
323
+ __privateAdd(this, _promises, []);
324
+ __privateAdd(this, _isPopstateNavigation, !1);
325
+ __privateAdd(this, _currentScrollElement, null);
326
+ __privateAdd(this, _isWindowScroll, !1);
327
+ __privateAdd(this, _routes, /* @__PURE__ */ new Map());
328
+ __privateAdd(this, _paramDependent, []);
329
+ __privateAdd(this, _announcer, null);
330
+ __privateAdd(this, _currentScrollX, 0);
331
+ __privateAdd(this, _currentScrollY, 0);
332
+ __privateAdd(this, _lastSubmorph);
333
+ __privateAdd(this, _lastRevalidate);
334
+ __privateAdd(this, _lastKeepScrollPosition);
335
+ __privateAdd(this, _checkLink, /* @__PURE__ */ __name((element) => {
336
+ var _a, _b;
337
+ return (((_a = element.getAttribute("href")) == null ? void 0 : _a.startsWith("/")) || ((_b = element.getAttribute("href")) == null ? void 0 : _b.startsWith("?"))) && !element.hasAttribute("download") && !element.hasAttribute("data-morph-skip") && !element.closest("[data-morph-skip]") && element.getAttribute("target") !== "_blank";
338
+ }, "#checkLink"));
339
+ __privateAdd(this, _popStateListener, /* @__PURE__ */ __name((event) => __async(this, null, function* () {
340
+ event.preventDefault(), __privateSet(this, _isPopstateNavigation, !0), yield this.navigate(location.href.replace(location.origin, ""), {
336
341
  historyAction: "none",
337
- submorph: t(this, mt) ? void 0 : t(this, wt),
338
- revalidate: t(this, mt),
339
- keepScrollPosition: t(this, bt)
340
- }), n(this, G, !1);
341
- }));
342
- h(this, ut, () => {
343
- const { left: e, top: s } = this.scrollValue, a = s - t(this, dt), l = e - t(this, ct);
344
- n(this, dt, s), n(this, ct, e), document.documentElement.classList.toggle("scroll-y", s > 0), document.documentElement.classList.toggle("scroll-x", e > 0), document.documentElement.classList.toggle(
342
+ submorph: __privateGet(this, _lastRevalidate) ? void 0 : __privateGet(this, _lastSubmorph),
343
+ revalidate: __privateGet(this, _lastRevalidate),
344
+ keepScrollPosition: __privateGet(this, _lastKeepScrollPosition)
345
+ }), __privateSet(this, _isPopstateNavigation, !1);
346
+ }), "#popStateListener"));
347
+ __privateAdd(this, _scrollListener, /* @__PURE__ */ __name(() => {
348
+ const { left, top } = this.scrollValue, directionY = top - __privateGet(this, _currentScrollY), directionX = left - __privateGet(this, _currentScrollX);
349
+ __privateSet(this, _currentScrollY, top), __privateSet(this, _currentScrollX, left), document.documentElement.classList.toggle("scroll-y", top > 0), document.documentElement.classList.toggle("scroll-x", left > 0), document.documentElement.classList.toggle(
345
350
  "scroll-y-forward",
346
- a > 0
351
+ directionY > 0
347
352
  ), document.documentElement.classList.toggle(
348
353
  "scroll-y-backward",
349
- a < 0
354
+ directionY < 0
350
355
  ), document.documentElement.classList.toggle(
351
356
  "scroll-x-forward",
352
- l > 0
357
+ directionX > 0
353
358
  ), document.documentElement.classList.toggle(
354
359
  "scroll-x-backward",
355
- l < 0
356
- ), q(document, "morphScroll", {
360
+ directionX < 0
361
+ ), dispatchEvent(document, "morphScroll", {
357
362
  detail: {
358
- left: e,
359
- top: s
363
+ left,
364
+ top
360
365
  }
361
366
  });
362
- });
363
- if (oe && !pt.instance) {
364
- pt.instance = this, n(this, D, {
365
- base: Pe(e == null ? void 0 : e.base),
366
- waitForHeadToLoad: (e == null ? void 0 : e.waitForHeadToLoad) !== !1,
367
- trailingSlash: (e == null ? void 0 : e.trailingSlash) || !1,
368
- scrollSelector: e == null ? void 0 : e.scrollSelector,
369
- morphInsideScrollContainer: (e == null ? void 0 : e.morphInsideScrollContainer) || !1
370
- }), n(this, lt, y(this, E, Vt).call(this, document.body));
371
- const s = this.normalizePath(
367
+ }, "#scrollListener"));
368
+ if (isBrowser && !_Morph.instance) {
369
+ _Morph.instance = this, __privateSet(this, _options, {
370
+ base: normalizeBase(parameters == null ? void 0 : parameters.base),
371
+ waitForHeadToLoad: (parameters == null ? void 0 : parameters.waitForHeadToLoad) !== !1,
372
+ trailingSlash: (parameters == null ? void 0 : parameters.trailingSlash) || !1,
373
+ scrollSelector: parameters == null ? void 0 : parameters.scrollSelector,
374
+ morphInsideScrollContainer: (parameters == null ? void 0 : parameters.morphInsideScrollContainer) || !1
375
+ }), __privateSet(this, _morphElements, __privateMethod(this, _Morph_instances, getMorphElements_fn).call(this, document.body));
376
+ const normalizedURL = this.normalizePath(
372
377
  location.pathname + location.search + location.hash
373
378
  );
374
- n(this, u, s);
375
- const a = new re(this, t(this, u).pathname);
376
- a.setInitialDocument(document), t(this, O).set(t(this, u).pathname, a), document.documentElement.setAttribute(
379
+ __privateSet(this, _currentURL, normalizedURL);
380
+ const initialRoute = new MorphRoute(this, __privateGet(this, _currentURL).pathname);
381
+ initialRoute.setInitialDocument(document), __privateGet(this, _routes).set(__privateGet(this, _currentURL).pathname, initialRoute), document.documentElement.setAttribute(
377
382
  "data-current-pathname",
378
- t(this, u).pathname
383
+ __privateGet(this, _currentURL).pathname
379
384
  ), document.documentElement.setAttribute(
380
385
  "data-current-leaf",
381
- s.leaf
382
- ), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", t(this, xt)), qt({
386
+ normalizedURL.leaf
387
+ ), this.findLinks(), this.findParamsDependent(), history.scrollRestoration = "manual", addEventListener("popstate", __privateGet(this, _popStateListener)), changeHistory({
383
388
  action: "replace",
384
- pathname: s.pathname,
385
- searchParameters: s.parameters,
386
- hash: s.hash
387
- }), n(this, et, new le()), y(this, E, Ft).call(this, document);
389
+ pathname: normalizedURL.pathname,
390
+ searchParameters: normalizedURL.parameters,
391
+ hash: normalizedURL.hash
392
+ }), __privateSet(this, _announcer, new MorphAnnouncer()), __privateMethod(this, _Morph_instances, updateCurrentScrollElement_fn).call(this, document);
388
393
  }
389
394
  }
390
395
  get currentURL() {
391
- return t(this, u);
396
+ return __privateGet(this, _currentURL);
392
397
  }
393
398
  get previousURL() {
394
- return t(this, tt);
399
+ return __privateGet(this, _previousURL);
395
400
  }
396
401
  get links() {
397
- return t(this, w);
402
+ return __privateGet(this, _links);
398
403
  }
399
404
  get scrollElement() {
400
- return t(this, x);
405
+ return __privateGet(this, _currentScrollElement);
401
406
  }
402
407
  get isPopstateNavigation() {
403
- return t(this, G);
408
+ return __privateGet(this, _isPopstateNavigation);
404
409
  }
405
410
  get scrollValue() {
406
- let e = 0, s = 0;
407
- return t(this, St) ? (e = window.scrollY, s = window.scrollX) : (e = t(this, x).scrollTop, s = t(this, x).scrollLeft), { top: e, left: s };
411
+ let top = 0, left = 0;
412
+ return __privateGet(this, _isWindowScroll) ? (top = window.scrollY, left = window.scrollX) : (top = __privateGet(this, _currentScrollElement).scrollTop, left = __privateGet(this, _currentScrollElement).scrollLeft), { top, left };
408
413
  }
409
414
  get isNavigating() {
410
- return !!t(this, V).length;
415
+ return !!__privateGet(this, _promises).length;
411
416
  }
412
- saveState(e) {
413
- const s = t(this, O).get(t(this, u).path);
414
- s && s.saveState(e);
417
+ saveState(state) {
418
+ const route = __privateGet(this, _routes).get(__privateGet(this, _currentURL).path);
419
+ route && route.saveState(state);
415
420
  }
416
421
  getState() {
417
- const e = t(this, O).get(t(this, u).path);
418
- return e == null ? void 0 : e.clearState();
419
- }
420
- normalizePath(e, s) {
421
- return Ae(e, {
422
- base: t(this, D).base,
423
- trailingSlash: t(this, D).trailingSlash,
424
- mergeParams: s != null && s.mergeParams ? location.search : "",
425
- removeParams: s == null ? void 0 : s.removeParams
422
+ const route = __privateGet(this, _routes).get(__privateGet(this, _currentURL).path);
423
+ return route == null ? void 0 : route.clearState();
424
+ }
425
+ normalizePath(path, options) {
426
+ return splitPath(path, {
427
+ base: __privateGet(this, _options).base,
428
+ trailingSlash: __privateGet(this, _options).trailingSlash,
429
+ mergeParams: options != null && options.mergeParams ? location.search : "",
430
+ removeParams: options == null ? void 0 : options.removeParams
426
431
  });
427
432
  }
428
- prefetch(e, s) {
429
- return J(this, null, function* () {
430
- var l;
431
- if (t(this, V).length)
433
+ prefetch(path, revalidate) {
434
+ return __async(this, null, function* () {
435
+ var _a;
436
+ if (__privateGet(this, _promises).length)
432
437
  return;
433
- e = ((l = this.pathnameModifier) == null ? void 0 : l.call(this, e)) || e;
434
- const a = y(this, E, ft).call(this, e);
435
- a == null || a.fetch(e, t(this, u).path, s);
438
+ path = ((_a = this.pathnameModifier) == null ? void 0 : _a.call(this, path)) || path;
439
+ const route = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, path);
440
+ route == null || route.fetch(path, __privateGet(this, _currentURL).path, revalidate);
436
441
  });
437
442
  }
438
- excludeHeadChild(e) {
443
+ excludeHeadChild(child) {
439
444
  return !1;
440
445
  }
441
- setHeaders(e) {
442
- }
443
- needRavalidation(e) {
444
- const s = this.normalizePath(e), a = y(this, E, ft).call(this, s.path);
445
- a == null || a.needRavalidation();
446
- }
447
- navigate(At) {
448
- return J(this, arguments, function* (e, {
449
- historyAction: s = "push",
450
- centerScroll: a,
451
- offsetScroll: l,
452
- scrollBehaviour: v,
453
- revalidate: S,
454
- keepSearchParameters: f,
455
- submorph: c,
456
- submorphAppend: p,
457
- clearState: st,
458
- keepScrollPosition: A,
459
- mergeParams: at,
460
- removeParams: z,
461
- detail: b,
462
- scrollTo: F
446
+ setHeaders(path) {
447
+ }
448
+ needRavalidation(path) {
449
+ const normalizedURL = this.normalizePath(path), route = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, normalizedURL.path);
450
+ route == null || route.needRavalidation();
451
+ }
452
+ navigate(_0) {
453
+ return __async(this, arguments, function* (path, {
454
+ historyAction = "push",
455
+ centerScroll,
456
+ offsetScroll,
457
+ scrollBehaviour,
458
+ revalidate,
459
+ keepSearchParameters,
460
+ submorph,
461
+ submorphAppend,
462
+ clearState,
463
+ keepScrollPosition,
464
+ mergeParams,
465
+ removeParams,
466
+ detail,
467
+ scrollTo
463
468
  } = {}) {
464
- var R, Xt, Kt, Bt;
465
- if (t(this, V).length)
469
+ var _a, _b, _c, _d;
470
+ if (__privateGet(this, _promises).length)
466
471
  return;
467
- n(this, wt, c), n(this, mt, S), n(this, bt, A);
468
- const X = ((R = this.pathnameModifier) == null ? void 0 : R.call(this, e)) || e, d = this.normalizePath(X, {
469
- mergeParams: at,
470
- removeParams: z
472
+ __privateSet(this, _lastSubmorph, submorph), __privateSet(this, _lastRevalidate, revalidate), __privateSet(this, _lastKeepScrollPosition, keepScrollPosition);
473
+ const modifiedPath = ((_a = this.pathnameModifier) == null ? void 0 : _a.call(this, path)) || path, normalizedURL = this.normalizePath(modifiedPath, {
474
+ mergeParams,
475
+ removeParams
471
476
  });
472
- if (!S && (((Xt = t(this, j)) == null ? void 0 : Xt.pathname) === d.pathname || t(this, u).pathname === d.pathname)) {
473
- A || y(this, E, Nt).call(this, F || d.hash || 0, {
474
- centerScroll: a,
475
- offsetScroll: l,
477
+ if (!revalidate && (((_b = __privateGet(this, _candidateURL)) == null ? void 0 : _b.pathname) === normalizedURL.pathname || __privateGet(this, _currentURL).pathname === normalizedURL.pathname)) {
478
+ keepScrollPosition || __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, scrollTo || normalizedURL.hash || 0, {
479
+ centerScroll,
480
+ offsetScroll,
476
481
  behavior: "smooth"
477
- }), q(document, "morphSamePath", {
482
+ }), dispatchEvent(document, "morphSamePath", {
478
483
  detail: {
479
- detail: b
484
+ detail
480
485
  }
481
- }), ((Kt = t(this, u)) == null ? void 0 : Kt.parameters) !== d.parameters && (n(this, tt, t(this, u)), n(this, u, d), qt({
482
- action: ((Bt = t(this, u)) == null ? void 0 : Bt.hash) !== d.hash ? "replace" : s,
483
- pathname: d.pathname,
484
- searchParameters: d.parameters,
485
- hash: d.hash
486
- }), q(document, "morphURLParametersChange", {
486
+ }), ((_c = __privateGet(this, _currentURL)) == null ? void 0 : _c.parameters) !== normalizedURL.parameters && (__privateSet(this, _previousURL, __privateGet(this, _currentURL)), __privateSet(this, _currentURL, normalizedURL), changeHistory({
487
+ action: ((_d = __privateGet(this, _currentURL)) == null ? void 0 : _d.hash) !== normalizedURL.hash ? "replace" : historyAction,
488
+ pathname: normalizedURL.pathname,
489
+ searchParameters: normalizedURL.parameters,
490
+ hash: normalizedURL.hash
491
+ }), dispatchEvent(document, "morphURLParametersChange", {
487
492
  detail: {
488
- newURL: t(this, u),
489
- previousURL: t(this, tt),
490
- detail: b
493
+ newURL: __privateGet(this, _currentURL),
494
+ previousURL: __privateGet(this, _previousURL),
495
+ detail
491
496
  }
492
- })), t(this, w).forEach((K) => {
493
- K.checkCurrent(d.path);
497
+ })), __privateGet(this, _links).forEach((link) => {
498
+ link.checkCurrent(normalizedURL.path);
494
499
  });
495
500
  return;
496
501
  } else
497
- t(this, w).forEach((K) => {
498
- K.checkCurrent(d.path);
502
+ __privateGet(this, _links).forEach((link) => {
503
+ link.checkCurrent(normalizedURL.path);
499
504
  });
500
- n(this, j, d);
505
+ __privateSet(this, _candidateURL, normalizedURL);
501
506
  try {
502
- let K = !0;
507
+ let preprocessedSuccesfully = !0;
503
508
  if (this.preprocessor)
504
509
  try {
505
- yield new Promise((r, P) => {
506
- var N;
507
- (N = this.preprocessor) == null || N.call(this, {
508
- url: d,
509
- resolve: r,
510
- reject: P,
511
- submorph: c,
512
- detail: b
510
+ yield new Promise((resolve, reject) => {
511
+ var _a2;
512
+ (_a2 = this.preprocessor) == null || _a2.call(this, {
513
+ url: normalizedURL,
514
+ resolve,
515
+ reject,
516
+ submorph,
517
+ detail
513
518
  });
514
519
  });
515
- } catch (r) {
516
- r ? console.error(r) : console.log("Route change canceled"), K = !1;
520
+ } catch (e) {
521
+ e ? console.error(e) : console.log("Route change canceled"), preprocessedSuccesfully = !1;
517
522
  }
518
- if (!K || t(this, j).pathname !== d.pathname) {
519
- t(this, w).forEach((r) => {
520
- r.checkCurrent(t(this, u).path);
523
+ if (!preprocessedSuccesfully || __privateGet(this, _candidateURL).pathname !== normalizedURL.pathname) {
524
+ __privateGet(this, _links).forEach((link) => {
525
+ link.checkCurrent(__privateGet(this, _currentURL).path);
521
526
  });
522
527
  return;
523
528
  }
524
- const Yt = {
525
- url: d,
526
- submorph: c,
527
- detail: b
529
+ const navigationEntry = {
530
+ url: normalizedURL,
531
+ submorph,
532
+ detail
528
533
  };
529
- c ? p || c.forEach((r) => {
530
- document.querySelectorAll(r).forEach((P) => {
531
- P.classList.add("out"), P.setAttribute("data-morph-out", "");
534
+ submorph ? submorphAppend || submorph.forEach((sel) => {
535
+ document.querySelectorAll(sel).forEach((el) => {
536
+ el.classList.add("out"), el.setAttribute("data-morph-out", "");
532
537
  });
533
- }) : t(this, lt).forEach((r) => {
534
- var P, N;
535
- (P = r.firstElementChild) == null || P.classList.add("out"), (N = r.firstElementChild) == null || N.setAttribute("data-morph-out", "");
536
- }), q(document, "morphNavigation", {
537
- detail: Yt
538
+ }) : __privateGet(this, _morphElements).forEach((el) => {
539
+ var _a2, _b2;
540
+ (_a2 = el.firstElementChild) == null || _a2.classList.add("out"), (_b2 = el.firstElementChild) == null || _b2.setAttribute("data-morph-out", "");
541
+ }), dispatchEvent(document, "morphNavigation", {
542
+ detail: navigationEntry
538
543
  });
539
- const Ht = y(this, E, ft).call(this, t(this, u).pathname), L = y(this, E, ft).call(this, d.pathname);
540
- if (t(this, O).forEach((r) => {
541
- r.pathname !== d.pathname && r.abort();
542
- }), yield L == null ? void 0 : L.fetch(X, t(this, u).path, S), t(this, j).pathname !== d.pathname) {
543
- t(this, w).forEach((r) => {
544
- r.checkCurrent(t(this, u).path);
544
+ const currentRoute = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, __privateGet(this, _currentURL).pathname), nextRoute = __privateMethod(this, _Morph_instances, getRoute_fn).call(this, normalizedURL.pathname);
545
+ if (__privateGet(this, _routes).forEach((el) => {
546
+ el.pathname !== normalizedURL.pathname && el.abort();
547
+ }), yield nextRoute == null ? void 0 : nextRoute.fetch(modifiedPath, __privateGet(this, _currentURL).path, revalidate), __privateGet(this, _candidateURL).pathname !== normalizedURL.pathname) {
548
+ __privateGet(this, _links).forEach((link) => {
549
+ link.checkCurrent(__privateGet(this, _currentURL).path);
545
550
  });
546
551
  return;
547
552
  }
548
- Ht.clearState(), Ht.saveScrollState(), Ht.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));
549
- const kt = Tt(Ut({}, Yt), {
550
- document: L.document
553
+ currentRoute.clearState(), currentRoute.saveScrollState(), currentRoute.saveDocumentState(), (!__privateGet(this, _isPopstateNavigation) || revalidate) && (nextRoute.clearScrollState(), nextRoute.clearDocumentState()), clearState && nextRoute.clearState(), nextRoute.cloneDocument(), __privateGet(this, _announcer).textContent = nextRoute.title, document.body.appendChild(__privateGet(this, _announcer));
554
+ const documentFetchedEntry = __spreadProps(__spreadValues({}, navigationEntry), {
555
+ document: nextRoute.document
551
556
  });
552
- p || kt.document.querySelectorAll("[data-morph-out]").forEach((r) => {
553
- r.classList.remove("out");
554
- }), q(document, "morphStart", {
555
- detail: kt
557
+ submorphAppend || documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach((el) => {
558
+ el.classList.remove("out");
559
+ }), dispatchEvent(document, "morphStart", {
560
+ detail: documentFetchedEntry
556
561
  });
557
- const $t = Array.from(document.head.children), jt = Array.from(L.document.head.children), Gt = ye(
558
- $t,
559
- jt
560
- ), de = ae(
561
- $t,
562
- Gt
563
- ), Rt = ae(
564
- jt,
565
- Gt
566
- ).filter((r) => !this.excludeHeadChild(r));
567
- Rt.forEach((r, P) => {
568
- r.tagName === "SCRIPT" && (Rt[P] = ie(
569
- r
562
+ const currentHeadChildren = Array.from(document.head.children), newHeadChildren = Array.from(nextRoute.document.head.children), identicalHeadChildren = intersectElements(
563
+ currentHeadChildren,
564
+ newHeadChildren
565
+ ), removeHeadChildren = excludeElements(
566
+ currentHeadChildren,
567
+ identicalHeadChildren
568
+ ), addHeadChildren = excludeElements(
569
+ newHeadChildren,
570
+ identicalHeadChildren
571
+ ).filter((child) => !this.excludeHeadChild(child));
572
+ addHeadChildren.forEach((child, index) => {
573
+ child.tagName === "SCRIPT" && (addHeadChildren[index] = createScriptElement(
574
+ child
570
575
  ));
571
- }), Rt.forEach((r) => {
572
- document.head.appendChild(r);
576
+ }), addHeadChildren.forEach((child) => {
577
+ document.head.appendChild(child);
573
578
  });
574
- const Mt = Rt.filter((r) => {
575
- if (r.hasAttribute("data-no-waiting"))
579
+ const elementsWithLoad = addHeadChildren.filter((child) => {
580
+ if (child.hasAttribute("data-no-waiting"))
576
581
  return !1;
577
- if (y(this, E, Ot).call(this, r))
582
+ if (__privateMethod(this, _Morph_instances, isElementEmitsLoadEvent_fn).call(this, child))
578
583
  return !0;
579
584
  });
580
- t(this, D).waitForHeadToLoad && Mt.length && (yield new Promise((r) => J(this, null, function* () {
581
- let P = 0;
585
+ __privateGet(this, _options).waitForHeadToLoad && elementsWithLoad.length && (yield new Promise((res) => __async(this, null, function* () {
586
+ let counter = 0;
582
587
  try {
583
- for (var N = se(Mt), ue, B, H; ue = !(B = yield N.next()).done; ue = !1) {
584
- const Ct = B.value;
585
- Ct.onload = () => {
586
- P++, P === Mt.length && r();
588
+ for (var iter = __forAwait(elementsWithLoad), more, temp, error; more = !(temp = yield iter.next()).done; more = !1) {
589
+ const element = temp.value;
590
+ element.onload = () => {
591
+ counter++, counter === elementsWithLoad.length && res();
587
592
  };
588
593
  }
589
- } catch (B) {
590
- H = [B];
594
+ } catch (temp) {
595
+ error = [temp];
591
596
  } finally {
592
597
  try {
593
- ue && (B = N.return) && (yield B.call(N));
598
+ more && (temp = iter.return) && (yield temp.call(iter));
594
599
  } finally {
595
- if (H)
596
- throw H[0];
600
+ if (error)
601
+ throw error[0];
597
602
  }
598
603
  }
599
- }))), yield we(10);
600
- const Jt = [];
601
- p || de.forEach((r) => {
602
- r.hasAttribute("data-permanent") || (y(this, E, Ot).call(this, r) ? Jt.push(r) : r.remove());
604
+ }))), yield wait(10);
605
+ const oldElementsWithLoadEvent = [];
606
+ submorphAppend || removeHeadChildren.forEach((child) => {
607
+ child.hasAttribute("data-permanent") || (__privateMethod(this, _Morph_instances, isElementEmitsLoadEvent_fn).call(this, child) ? oldElementsWithLoadEvent.push(child) : child.remove());
603
608
  });
604
- const me = y(this, E, Vt).call(this, L.document.body);
605
- !t(this, D).morphInsideScrollContainer && !c && y(this, E, Ft).call(this, L.document), document.documentElement.setAttribute(
609
+ const newMorphElements = __privateMethod(this, _Morph_instances, getMorphElements_fn).call(this, nextRoute.document.body);
610
+ !__privateGet(this, _options).morphInsideScrollContainer && !submorph && __privateMethod(this, _Morph_instances, updateCurrentScrollElement_fn).call(this, nextRoute.document), document.documentElement.setAttribute(
606
611
  "data-current-pathname",
607
- d.pathname
612
+ normalizedURL.pathname
608
613
  ), document.documentElement.setAttribute(
609
614
  "data-current-leaf",
610
- d.leaf
611
- ), qt({
612
- action: s,
613
- pathname: d.pathname,
614
- searchParameters: d.parameters || (f ? location.search : ""),
615
- hash: d.hash
616
- }), t(this, et).remove(), n(this, tt, t(this, u)), n(this, u, d);
617
- const Dt = [];
618
- t(this, lt).forEach((r, P) => {
619
- const N = me[P], ue = getComputedStyle(r).getPropertyValue("--morph-duration");
620
- let B = [], H = [];
621
- c ? (c.forEach((m) => {
622
- const g = r.querySelector(m), k = N.querySelector(m);
623
- g && k && (H.push(g), B.push(k));
624
- }), H.forEach((m) => {
625
- m.parentElement && Dt.push(m.parentElement);
626
- })) : (B.push(...N.childNodes), H.push(...r.childNodes), Dt.push(r));
627
- const Ct = [];
628
- p || H.forEach((m) => {
629
- m instanceof HTMLElement && (this.destroyOldLinks(m), m.classList.add("old"), m.querySelectorAll(
615
+ normalizedURL.leaf
616
+ ), changeHistory({
617
+ action: historyAction,
618
+ pathname: normalizedURL.pathname,
619
+ searchParameters: normalizedURL.parameters || (keepSearchParameters ? location.search : ""),
620
+ hash: normalizedURL.hash
621
+ }), __privateGet(this, _announcer).remove(), __privateSet(this, _previousURL, __privateGet(this, _currentURL)), __privateSet(this, _currentURL, normalizedURL);
622
+ const morphedElements = [];
623
+ __privateGet(this, _morphElements).forEach((morphElement, i) => {
624
+ const newMorphElement = newMorphElements[i], duration = getComputedStyle(morphElement).getPropertyValue("--morph-duration");
625
+ let newMorphElementChildNodes = [], currentMorphElementChildNodes = [];
626
+ submorph ? (submorph.forEach((selector) => {
627
+ const curSubMorphElement = morphElement.querySelector(selector), newSubMorphElement = newMorphElement.querySelector(selector);
628
+ curSubMorphElement && newSubMorphElement && (currentMorphElementChildNodes.push(curSubMorphElement), newMorphElementChildNodes.push(newSubMorphElement));
629
+ }), currentMorphElementChildNodes.forEach((el) => {
630
+ el.parentElement && morphedElements.push(el.parentElement);
631
+ })) : (newMorphElementChildNodes.push(...newMorphElement.childNodes), currentMorphElementChildNodes.push(...morphElement.childNodes), morphedElements.push(morphElement));
632
+ const transfer = [];
633
+ submorphAppend || currentMorphElementChildNodes.forEach((element) => {
634
+ element instanceof HTMLElement && (this.destroyOldLinks(element), element.classList.add("old"), element.querySelectorAll(
630
635
  "[data-morph-transfer]"
631
- ).forEach((k) => {
632
- const pe = k.getAttribute("data-morph-transfer");
633
- Ct.push({
634
- element: k,
635
- selector: pe
636
+ ).forEach((el) => {
637
+ const selector = el.getAttribute("data-morph-transfer");
638
+ transfer.push({
639
+ element: el,
640
+ selector
636
641
  });
637
642
  }));
638
- }), B.forEach((m) => {
639
- m instanceof HTMLElement && (Ct.forEach((g) => {
640
- const k = m.querySelector(g.selector);
641
- k && k.replaceWith(
642
- L.document.importNode(g.element, !0)
643
+ }), newMorphElementChildNodes.forEach((element) => {
644
+ element instanceof HTMLElement && (transfer.forEach((item) => {
645
+ const nestlement = element.querySelector(item.selector);
646
+ nestlement && nestlement.replaceWith(
647
+ nextRoute.document.importNode(item.element, !0)
643
648
  );
644
- }), this.findNewLinks(m), m.classList.add("new"));
645
- }), c ? p ? B.forEach((m, g) => {
646
- H[g] instanceof HTMLElement && H[g].append(...m.childNodes);
647
- }) : B.forEach((m, g) => {
648
- var k;
649
- (k = H[g].parentElement) == null || k.insertBefore(
650
- m,
651
- H[g]
649
+ }), this.findNewLinks(element), element.classList.add("new"));
650
+ }), submorph ? submorphAppend ? newMorphElementChildNodes.forEach((el, i2) => {
651
+ currentMorphElementChildNodes[i2] instanceof HTMLElement && currentMorphElementChildNodes[i2].append(...el.childNodes);
652
+ }) : newMorphElementChildNodes.forEach((el, i2) => {
653
+ var _a2;
654
+ (_a2 = currentMorphElementChildNodes[i2].parentElement) == null || _a2.insertBefore(
655
+ el,
656
+ currentMorphElementChildNodes[i2]
652
657
  );
653
- }) : r.prepend(...B), setTimeout(() => {
654
- p || H.forEach((m) => {
655
- m instanceof HTMLElement && m.classList.add("old-idle");
656
- }), B.forEach((m) => {
657
- var g;
658
- m instanceof HTMLElement && ((g = m.parentElement) == null || g.style.setProperty(
658
+ }) : morphElement.prepend(...newMorphElementChildNodes), setTimeout(() => {
659
+ submorphAppend || currentMorphElementChildNodes.forEach((element) => {
660
+ element instanceof HTMLElement && element.classList.add("old-idle");
661
+ }), newMorphElementChildNodes.forEach((element) => {
662
+ var _a2;
663
+ element instanceof HTMLElement && ((_a2 = element.parentElement) == null || _a2.style.setProperty(
659
664
  "--new-content-height",
660
- m.offsetHeight + "px"
661
- ), m.classList.add("new-idle"));
665
+ element.offsetHeight + "px"
666
+ ), element.classList.add("new-idle"));
662
667
  });
663
668
  }, 0);
664
- const Qt = Tt(Ut({}, kt), {
665
- morphElement: r
669
+ const detail2 = __spreadProps(__spreadValues({}, documentFetchedEntry), {
670
+ morphElement
666
671
  });
667
- q(document, "morphNewChildrenAdded", {
668
- detail: Qt
672
+ dispatchEvent(document, "morphNewChildrenAdded", {
673
+ detail: detail2
669
674
  });
670
- const fe = new Promise((m) => {
675
+ const promise = new Promise((res) => {
671
676
  setTimeout(
672
677
  () => {
673
- p || H.forEach((g) => {
674
- g.remove();
675
- }), B.forEach((g) => {
676
- var k;
677
- g instanceof HTMLElement && ((k = g.parentElement) == null || k.style.removeProperty(
678
+ submorphAppend || currentMorphElementChildNodes.forEach((el) => {
679
+ el.remove();
680
+ }), newMorphElementChildNodes.forEach((element) => {
681
+ var _a2;
682
+ element instanceof HTMLElement && ((_a2 = element.parentElement) == null || _a2.style.removeProperty(
678
683
  "--new-content-height"
679
- ), g.classList.remove("new-idle", "new"));
680
- }), p || q(document, "morphOldChildrenRemoved", {
681
- detail: Qt
682
- }), m();
684
+ ), element.classList.remove("new-idle", "new"));
685
+ }), submorphAppend || dispatchEvent(document, "morphOldChildrenRemoved", {
686
+ detail: detail2
687
+ }), res();
683
688
  },
684
- (parseFloat(ue) || 0) * 1e3 + 10
689
+ (parseFloat(duration) || 0) * 1e3 + 10
685
690
  );
686
691
  });
687
- t(this, V).push(fe);
692
+ __privateGet(this, _promises).push(promise);
688
693
  }), this.isPopstateNavigation ? document.documentElement.style.setProperty(
689
694
  "--new-document-scroll-position",
690
- (this.scrollValue.top - L.scrollState.y) * 1 + "px"
695
+ (this.scrollValue.top - nextRoute.scrollState.y) * 1 + "px"
691
696
  ) : document.documentElement.style.setProperty(
692
697
  "--new-document-scroll-position",
693
698
  this.scrollValue.top + "px"
694
- ), q(document, "morphBeforeNavigationScroll", {
695
- detail: L.scrollState
696
- }), F ? (L.clearScrollState(), y(this, E, Nt).call(this, F, {
697
- centerScroll: a,
698
- offsetScroll: l,
699
- behavior: v
700
- })) : d.hash ? (L.clearScrollState(), y(this, E, Nt).call(this, d.hash, {
701
- centerScroll: a,
702
- offsetScroll: l,
703
- behavior: v
704
- })) : t(this, G) ? L.restoreScrollPosition() : A || L.renewScrollPosition(), yield Promise.all(t(this, V)), p || Jt.forEach((r) => r.remove()), n(this, V, []), Dt.forEach((r) => {
705
- r.querySelectorAll("script").forEach((N) => {
706
- N.replaceWith(ie(N));
699
+ ), dispatchEvent(document, "morphBeforeNavigationScroll", {
700
+ detail: nextRoute.scrollState
701
+ }), scrollTo ? (nextRoute.clearScrollState(), __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, scrollTo, {
702
+ centerScroll,
703
+ offsetScroll,
704
+ behavior: scrollBehaviour
705
+ })) : normalizedURL.hash ? (nextRoute.clearScrollState(), __privateMethod(this, _Morph_instances, tryScrollToElement_fn).call(this, normalizedURL.hash, {
706
+ centerScroll,
707
+ offsetScroll,
708
+ behavior: scrollBehaviour
709
+ })) : __privateGet(this, _isPopstateNavigation) ? nextRoute.restoreScrollPosition() : keepScrollPosition || nextRoute.renewScrollPosition(), yield Promise.all(__privateGet(this, _promises)), submorphAppend || oldElementsWithLoadEvent.forEach((child) => child.remove()), __privateSet(this, _promises, []), morphedElements.forEach((el) => {
710
+ el.querySelectorAll("script").forEach((element) => {
711
+ element.replaceWith(createScriptElement(element));
707
712
  });
708
- }), t(this, w).forEach((r) => {
709
- r.checkCurrent(t(this, u).path);
710
- }), this.findParamsDependent(), q(document, "morphComplete", {
711
- detail: kt
713
+ }), __privateGet(this, _links).forEach((link) => {
714
+ link.checkCurrent(__privateGet(this, _currentURL).path);
715
+ }), this.findParamsDependent(), dispatchEvent(document, "morphComplete", {
716
+ detail: documentFetchedEntry
712
717
  }), document.documentElement.style.removeProperty(
713
718
  "--new-document-scroll-position"
714
719
  ), window.dispatchEvent(new Event("resize"));
715
- } catch (K) {
716
- console.error(K);
720
+ } catch (e) {
721
+ console.error(e);
717
722
  }
718
- n(this, j, void 0);
723
+ __privateSet(this, _candidateURL, void 0);
719
724
  });
720
725
  }
721
- addLink(e) {
722
- t(this, w).push(new It(e, this));
726
+ addLink(element) {
727
+ __privateGet(this, _links).push(new MorphLink(element, this));
723
728
  }
724
- addLinks(e) {
725
- e.forEach((s) => {
726
- this.addLink(s);
729
+ addLinks(elements) {
730
+ elements.forEach((element) => {
731
+ this.addLink(element);
727
732
  });
728
733
  }
729
- removeLink(e) {
730
- n(this, w, t(this, w).filter((s) => s.element === e ? (s.destroy(), !1) : !0));
734
+ removeLink(element) {
735
+ __privateSet(this, _links, __privateGet(this, _links).filter((link) => link.element === element ? (link.destroy(), !1) : !0));
731
736
  }
732
- destroyOldLinks(e) {
733
- n(this, w, t(this, w).filter((s) => e.contains(s.element) ? (s.destroy(), !1) : !0));
737
+ destroyOldLinks(morphElement) {
738
+ __privateSet(this, _links, __privateGet(this, _links).filter((link) => morphElement.contains(link.element) ? (link.destroy(), !1) : !0));
734
739
  }
735
- findNewLinks(e) {
736
- const s = [...e.querySelectorAll("a")].filter(
737
- t(this, Pt)
740
+ findNewLinks(morphElement) {
741
+ const linkElements = [...morphElement.querySelectorAll("a")].filter(
742
+ __privateGet(this, _checkLink)
738
743
  );
739
- t(this, w).push(
740
- ...s.map((a) => new It(a, this))
744
+ __privateGet(this, _links).push(
745
+ ...linkElements.map((element) => new MorphLink(element, this))
741
746
  );
742
747
  }
743
748
  findLinks() {
744
- const e = [
749
+ const linkElements = [
745
750
  ...document.documentElement.querySelectorAll("a")
746
- ].filter(t(this, Pt));
747
- t(this, w).forEach((s) => s.destroy()), n(this, w, e.map((s) => new It(s, this)));
751
+ ].filter(__privateGet(this, _checkLink));
752
+ __privateGet(this, _links).forEach((link) => link.destroy()), __privateSet(this, _links, linkElements.map((element) => new MorphLink(element, this)));
748
753
  }
749
754
  findParamsDependent() {
750
- const e = [
755
+ const elements = [
751
756
  ...document.documentElement.querySelectorAll(
752
757
  "[data-morph-params-dependent]"
753
758
  )
754
759
  ];
755
- t(this, yt).forEach((s) => s.destroy()), n(this, yt, e.map(
756
- (s) => new Re(s)
760
+ __privateGet(this, _paramDependent).forEach((link) => link.destroy()), __privateSet(this, _paramDependent, elements.map(
761
+ (element) => new MorphParamsDependent(element)
757
762
  ));
758
763
  }
759
764
  };
760
- D = new WeakMap(), lt = new WeakMap(), w = new WeakMap(), j = new WeakMap(), u = new WeakMap(), tt = new WeakMap(), V = new WeakMap(), G = new WeakMap(), x = new WeakMap(), St = new WeakMap(), O = new WeakMap(), yt = new WeakMap(), et = new WeakMap(), ct = new WeakMap(), dt = new WeakMap(), wt = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), Pt = new WeakMap(), E = new WeakSet(), ft = function(e) {
761
- const s = this.normalizePath(e);
762
- let a = t(this, O).get(s.pathname);
763
- return a || (a = new re(this, s.pathname), t(this, O).set(s.pathname, a)), a;
764
- }, Vt = function(e) {
765
- const s = [...e.querySelectorAll("[data-morph]")];
766
- return s.length ? s : [e];
767
- }, Ot = function(e) {
768
- return e.tagName === "SCRIPT" || e.tagName === "STYLE" || e.tagName === "LINK" && e.getAttribute("rel") === "stylesheet";
769
- }, Ft = function(e) {
770
- var s, a;
771
- (s = t(this, x)) == null || s.removeEventListener(
765
+ _options = new WeakMap(), _morphElements = new WeakMap(), _links = new WeakMap(), _candidateURL = new WeakMap(), _currentURL = new WeakMap(), _previousURL = new WeakMap(), _promises = new WeakMap(), _isPopstateNavigation = new WeakMap(), _currentScrollElement = new WeakMap(), _isWindowScroll = new WeakMap(), _routes = new WeakMap(), _paramDependent = new WeakMap(), _announcer = new WeakMap(), _currentScrollX = new WeakMap(), _currentScrollY = new WeakMap(), _lastSubmorph = new WeakMap(), _lastRevalidate = new WeakMap(), _lastKeepScrollPosition = new WeakMap(), _checkLink = new WeakMap(), _Morph_instances = new WeakSet(), getRoute_fn = /* @__PURE__ */ __name(function(path) {
766
+ const normalizedURL = this.normalizePath(path);
767
+ let route = __privateGet(this, _routes).get(normalizedURL.pathname);
768
+ return route || (route = new MorphRoute(this, normalizedURL.pathname), __privateGet(this, _routes).set(normalizedURL.pathname, route)), route;
769
+ }, "#getRoute"), getMorphElements_fn = /* @__PURE__ */ __name(function(el) {
770
+ const morphElements = [...el.querySelectorAll("[data-morph]")];
771
+ return morphElements.length ? morphElements : [el];
772
+ }, "#getMorphElements"), isElementEmitsLoadEvent_fn = /* @__PURE__ */ __name(function(element) {
773
+ return element.tagName === "SCRIPT" || element.tagName === "STYLE" || element.tagName === "LINK" && element.getAttribute("rel") === "stylesheet";
774
+ }, "#isElementEmitsLoadEvent"), updateCurrentScrollElement_fn = /* @__PURE__ */ __name(function(document2) {
775
+ var _a, _b;
776
+ (_a = __privateGet(this, _currentScrollElement)) == null || _a.removeEventListener(
772
777
  "scroll",
773
- t(this, ut)
774
- ), n(this, dt, 0), n(this, ct, 0), n(this, x, t(this, D).scrollSelector && e.querySelector(t(this, D).scrollSelector) || window), n(this, St, t(this, x) === window), (a = t(this, x)) == null || a.addEventListener("scroll", t(this, ut)), t(this, ut).call(this);
775
- }, Nt = function(e, s) {
776
- const a = typeof e == "string" ? document.querySelector(e) : e;
777
- (typeof a == "number" || a) && be(a, {
778
- scrollElement: t(this, x),
779
- behavior: (s == null ? void 0 : s.behavior) || "instant",
780
- center: s == null ? void 0 : s.centerScroll,
781
- offset: s == null ? void 0 : s.offsetScroll
778
+ __privateGet(this, _scrollListener)
779
+ ), __privateSet(this, _currentScrollY, 0), __privateSet(this, _currentScrollX, 0), __privateSet(this, _currentScrollElement, __privateGet(this, _options).scrollSelector && document2.querySelector(__privateGet(this, _options).scrollSelector) || window), __privateSet(this, _isWindowScroll, __privateGet(this, _currentScrollElement) === window), (_b = __privateGet(this, _currentScrollElement)) == null || _b.addEventListener("scroll", __privateGet(this, _scrollListener)), __privateGet(this, _scrollListener).call(this);
780
+ }, "#updateCurrentScrollElement"), tryScrollToElement_fn = /* @__PURE__ */ __name(function(id, options) {
781
+ const value = typeof id == "string" ? document.querySelector(id) : id;
782
+ (typeof value == "number" || value) && scrollToElement(value, {
783
+ scrollElement: __privateGet(this, _currentScrollElement),
784
+ behavior: (options == null ? void 0 : options.behavior) || "instant",
785
+ center: options == null ? void 0 : options.centerScroll,
786
+ offset: options == null ? void 0 : options.offsetScroll
782
787
  });
783
- }, xt = new WeakMap(), ut = new WeakMap(), pt.instance = null;
784
- let ne = pt;
788
+ }, "#tryScrollToElement"), _popStateListener = new WeakMap(), _scrollListener = new WeakMap(), __name(_Morph, "Morph"), _Morph.instance = null;
789
+ let Morph = _Morph;
785
790
  export {
786
- ne as Morph
791
+ Morph
787
792
  };