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 +1 @@
1
- "use strict";var ue=Object.defineProperty,ce=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,fe=Object.prototype.propertyIsEnumerable;var Y=i=>{throw TypeError(i)};var W=(i,e,s)=>e in i?ue(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s,$=(i,e)=>{for(var s in e||(e={}))me.call(e,s)&&W(i,s,e[s]);if(K)for(var s of K(e))fe.call(e,s)&&W(i,s,e[s]);return i},G=(i,e)=>ce(i,de(e));var U=(i,e,s)=>e.has(i)||Y("Cannot "+s);var t=(i,e,s)=>(U(i,e,"read from private field"),s?s.call(i):e.get(i)),n=(i,e,s)=>e.has(i)?Y("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,s),h=(i,e,s,r)=>(U(i,e,"write to private field"),r?r.call(i,s):e.set(i,s),s),d=(i,e,s)=>(U(i,e,"access private method"),s);var J=(i,e,s,r)=>({set _(a){h(i,e,a,s)},get _(){return t(i,e,r)}});var R=(i,e,s)=>new Promise((r,a)=>{var o=f=>{try{g(s.next(f))}catch(N){a(N)}},C=f=>{try{g(s.throw(f))}catch(N){a(N)}},g=f=>f.done?r(f.value):Promise.resolve(f.value).then(o,C);g((s=s.apply(i,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../history/index.cjs"),ge=require("../LocalLinks-BxhSFv_Q.cjs"),Re=require("../PageAnnouncerElement-AQ0Ja6HM.cjs"),we=require("../PageScroll-BXJUQwG7.cjs");require("construct-style-sheets-polyfill");require("../index-OE2INULi.cjs");const Q=require("../url-CHgcNwJ1.cjs"),ve=require("urlpattern-polyfill"),Pe=require("../render-DQs7rIoN.cjs"),be=require("../object-baN9pgbU.cjs");var S,H,q,p,u,T,M,v,P,b,l,X,Z,ee,te,se,ie,re,ae,B,y;class ye{constructor(e,s){n(this,l);n(this,S);n(this,H);n(this,q);n(this,p,null);n(this,u,null);n(this,T,!1);n(this,M,null);n(this,v);n(this,P,[]);n(this,b,[]);n(this,y,e=>{t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),h(this,u,e.detail.element),t(this,u).addEventListener("__hmrInstanceReplace",t(this,y))});h(this,S,e),h(this,H,s),h(this,q,new URLPattern({pathname:t(this,S)})),h(this,v,new MutationObserver(d(this,l,re).bind(this)))}get pattern(){return t(this,S)}get isActive(){return t(this,T)}get element(){return t(this,u)}get nest(){return t(this,M)}testPathname(e){return t(this,q).test({pathname:e})}render(e,s){return R(this,null,function*(){t(this,v).observe(document.head,{childList:!0,subtree:!0}),t(this,p)?d(this,l,Z).call(this):yield d(this,l,X).call(this),yield d(this,l,ae).call(this),t(this,p)&&(yield d(this,l,ee).call(this,e,s)),t(this,v).disconnect()})}close(){d(this,l,se).call(this)}}S=new WeakMap,H=new WeakMap,q=new WeakMap,p=new WeakMap,u=new WeakMap,T=new WeakMap,M=new WeakMap,v=new WeakMap,P=new WeakMap,b=new WeakMap,l=new WeakSet,X=function(){return R(this,null,function*(){const e=yield t(this,H).call(this);h(this,b,[...t(this,P)]),typeof e.default=="function"&&h(this,p,e.default)})},Z=function(){t(this,P).forEach(e=>{document.head.appendChild(e.cloneNode(!0))})},ee=function(e,s){return R(this,null,function*(){var o;const a={urlPatternResult:t(this,q).exec({pathname:s.pathname})};be.isESClass(t(this,p))?(h(this,u,new(t(this,p))(a)),e.appendChild(t(this,u))):h(this,u,Pe.render(e,t(this,p),a)),(o=t(this,u))==null||o.addEventListener("__hmrInstanceReplace",t(this,y)),d(this,l,te).call(this),h(this,T,!0)})},te=function(){var e;t(this,u)&&h(this,M,t(this,u).querySelector("[data-nest]")||((e=t(this,u).shadowRoot)==null?void 0:e.querySelector("[data-nest]"))||t(this,u).shadowRoot||t(this,u))},se=function(){t(this,v).disconnect(),t(this,u)&&(t(this,u).removeEventListener("__hmrInstanceReplace",t(this,y)),t(this,u).remove()),h(this,T,!1),d(this,l,ie).call(this)},ie=function(){t(this,b).forEach(e=>{e.parentNode===document.head&&document.head.removeChild(e)}),h(this,b,[])},re=function(e){e.forEach(s=>{s.addedNodes.forEach(r=>{t(this,p)?t(this,b).push(r):t(this,P).push(r)})})},ae=function(){return R(this,null,function*(){const e=t(this,P).filter(d(this,l,B));yield Promise.all(e.map(s=>new Promise(r=>{d(this,l,B).call(this,s)?s.onload=()=>r():r()})))})},B=function(e){return e instanceof HTMLElement&&(e.tagName==="STYLE"||e.tagName==="SCRIPT"||e.tagName==="LINK")},y=new WeakMap;globalThis.URLPattern=ve.URLPattern;var c,L,k,E,I,_,w,A,m,ne,he,le,z,oe;class Le{constructor(e){n(this,m);n(this,c,null);n(this,L,null);n(this,k,null);n(this,E,null);n(this,I,null);n(this,_,0);n(this,w,[]);n(this,A,null);h(this,c,G($({},e),{rootElement:(e==null?void 0:e.rootElement)||document.body,base:Q.normalizeBase(e==null?void 0:e.base)})),h(this,I,new Re.PageAnnouncerElement),h(this,L,new we.PageScroll(t(this,c).scrollSelector)),t(this,L).update(),h(this,k,new ge.LocalLinks({base:t(this,c).base,trailingSlash:t(this,c).trailingSlash,includeAnchor:e==null?void 0:e.includeAnchor,onClick:(s,r)=>{try{this.navigate(s,r)}catch(a){window.location.assign(s)}}})),t(this,k).update(),h(this,E,new pe.History({onPop:s=>{this.navigate(s)}}))}history(){return t(this,E)}get scroll(){return scroll}get routes(){return t(this,w)}run(){d(this,m,oe).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(e,s){const r=new ye(e,s);t(this,w).push(r)}navigate(e,s){return R(this,null,function*(){var O,j,x,V,D,F;const r=t(this,E).isBack,a=++J(this,_)._;let o=Q.normalizeURL(e,{base:t(this,c).base,trailingSlash:t(this,c).trailingSlash});if(t(this,c).urlModifier&&(o=t(this,c).urlModifier(o)),!(yield d(this,m,ne).call(this,o))||t(this,_)!==a||(yield(j=(O=t(this,c)).beforeNavigation)==null?void 0:j.call(O),t(this,_)!==a))return;const{activeRoutes:C,newRoutes:g,oldRoutes:f,keepRoutes:N}=d(this,m,he).call(this,o);h(this,A,(x=N[N.length-1])!=null?x:null),r||(t(this,E).push(o),((V=s==null?void 0:s.keepScrollPosition)==null||V)&&t(this,L).element.scrollTo({top:0,behavior:"instant"})),t(this,I).create(document,o.pathname),t(this,c).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>d(this,m,z).call(this,f,g,o)).finished:yield d(this,m,z).call(this,f,g,o),t(this,L).update(),t(this,k).update(),t(this,I).done(),yield(F=(D=t(this,c)).afterNavigation)==null?void 0:F.call(D)})}}c=new WeakMap,L=new WeakMap,k=new WeakMap,E=new WeakMap,I=new WeakMap,_=new WeakMap,w=new WeakMap,A=new WeakMap,m=new WeakSet,ne=function(e){return R(this,null,function*(){if(!t(this,c).preprocessor)return!0;try{return yield new Promise((s,r)=>{var a,o;(o=(a=t(this,c)).preprocessor)==null||o.call(a,{url:e,resolve:s,reject:r})}),!0}catch(s){return console.error(s!=null?s:"Route change canceled"),!1}})},he=function(e){let s=e.pathname.replace(t(this,c).base,"");s.startsWith("/")||(s=`/${s}`);const r=t(this,w).filter(a=>a.isActive);return{activeRoutes:r,newRoutes:t(this,w).filter(a=>!r.includes(a)&&a.testPathname(s)),oldRoutes:r.filter(a=>!a.testPathname(s)),keepRoutes:r.filter(a=>a.testPathname(s))}},le=function(e){e.forEach(s=>s.close())},z=function(e,s,r){return R(this,null,function*(){var a,o;d(this,m,le).call(this,e);for(const C of s){const g=(o=(a=t(this,A))==null?void 0:a.nest)!=null?o:t(this,c).rootElement;yield C.render(g,r),h(this,A,C)}})},oe=function(){t(this,w).sort((e,s)=>{const r=e.pattern.split("/").length,a=s.pattern.split("/").length;return r-a})};exports.Router=Le;
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);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);var __privateWrapper=(obj,member,setter,getter)=>({set _(value){__privateSet(obj,member,value,setter)},get _(){return __privateGet(obj,member,getter)}});var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const history_index=require("../history/index.cjs"),LocalLinks=require("../LocalLinks-BWFJYhGX.cjs"),PageAnnouncerElement=require("../PageAnnouncerElement-DPMlVJZG.cjs"),PageScroll=require("../PageScroll-BAatKJx6.cjs");require("construct-style-sheets-polyfill");require("../index-BpO2RJ__.cjs");const url=require("../url-CPCO10Sy.cjs"),urlpatternPolyfill=require("urlpattern-polyfill"),render=require("../render-DdomypCo.cjs"),object=require("../object-DTY_W6xG.cjs");var _pattern,_module,_urlPattern,_elementConstructor,_elementInstance,_isActive,_nestTarget,_mutationObserver,_permanentHeadNodes,_temporalHeadNodes,_Route_instances,initializeRouteModule_fn,appendPermanentHeadNodes_fn,renderRouteComponent_fn,findNestTarget_fn,cleanup_fn,removeTemporalHeadNodes_fn,handleHeadMutations_fn,waitForHeadNodesLoad_fn,isLoadableNode_fn,_instanceReplaceListener;const _Route=class _Route{constructor(pattern,module2){__privateAdd(this,_Route_instances);__privateAdd(this,_pattern);__privateAdd(this,_module);__privateAdd(this,_urlPattern);__privateAdd(this,_elementConstructor,null);__privateAdd(this,_elementInstance,null);__privateAdd(this,_isActive,!1);__privateAdd(this,_nestTarget,null);__privateAdd(this,_mutationObserver);__privateAdd(this,_permanentHeadNodes,[]);__privateAdd(this,_temporalHeadNodes,[]);__privateAdd(this,_instanceReplaceListener,__name(e=>{__privateGet(this,_elementInstance).removeEventListener("__hmrInstanceReplace",__privateGet(this,_instanceReplaceListener)),__privateSet(this,_elementInstance,e.detail.element),__privateGet(this,_elementInstance).addEventListener("__hmrInstanceReplace",__privateGet(this,_instanceReplaceListener))},"#instanceReplaceListener"));__privateSet(this,_pattern,pattern),__privateSet(this,_module,module2),__privateSet(this,_urlPattern,new URLPattern({pathname:__privateGet(this,_pattern)})),__privateSet(this,_mutationObserver,new MutationObserver(__privateMethod(this,_Route_instances,handleHeadMutations_fn).bind(this)))}get pattern(){return __privateGet(this,_pattern)}get isActive(){return __privateGet(this,_isActive)}get element(){return __privateGet(this,_elementInstance)}get nest(){return __privateGet(this,_nestTarget)}testPathname(pathname){return __privateGet(this,_urlPattern).test({pathname})}render(container,url2){return __async(this,null,function*(){__privateGet(this,_mutationObserver).observe(document.head,{childList:!0,subtree:!0}),__privateGet(this,_elementConstructor)?__privateMethod(this,_Route_instances,appendPermanentHeadNodes_fn).call(this):yield __privateMethod(this,_Route_instances,initializeRouteModule_fn).call(this),yield __privateMethod(this,_Route_instances,waitForHeadNodesLoad_fn).call(this),__privateGet(this,_elementConstructor)&&(yield __privateMethod(this,_Route_instances,renderRouteComponent_fn).call(this,container,url2)),__privateGet(this,_mutationObserver).disconnect()})}close(){__privateMethod(this,_Route_instances,cleanup_fn).call(this)}};_pattern=new WeakMap,_module=new WeakMap,_urlPattern=new WeakMap,_elementConstructor=new WeakMap,_elementInstance=new WeakMap,_isActive=new WeakMap,_nestTarget=new WeakMap,_mutationObserver=new WeakMap,_permanentHeadNodes=new WeakMap,_temporalHeadNodes=new WeakMap,_Route_instances=new WeakSet,initializeRouteModule_fn=__name(function(){return __async(this,null,function*(){const content=yield __privateGet(this,_module).call(this);__privateSet(this,_temporalHeadNodes,[...__privateGet(this,_permanentHeadNodes)]),typeof content.default=="function"&&__privateSet(this,_elementConstructor,content.default)})},"#initializeRouteModule"),appendPermanentHeadNodes_fn=__name(function(){__privateGet(this,_permanentHeadNodes).forEach(node=>{document.head.appendChild(node.cloneNode(!0))})},"#appendPermanentHeadNodes"),renderRouteComponent_fn=__name(function(container,url2){return __async(this,null,function*(){var _a;const routeParams={urlPatternResult:__privateGet(this,_urlPattern).exec({pathname:url2.pathname})};object.isESClass(__privateGet(this,_elementConstructor))?(__privateSet(this,_elementInstance,new(__privateGet(this,_elementConstructor))(routeParams)),container.appendChild(__privateGet(this,_elementInstance))):__privateSet(this,_elementInstance,render.render(container,__privateGet(this,_elementConstructor),routeParams)),(_a=__privateGet(this,_elementInstance))==null||_a.addEventListener("__hmrInstanceReplace",__privateGet(this,_instanceReplaceListener)),__privateMethod(this,_Route_instances,findNestTarget_fn).call(this),__privateSet(this,_isActive,!0)})},"#renderRouteComponent"),findNestTarget_fn=__name(function(){var _a;__privateGet(this,_elementInstance)&&__privateSet(this,_nestTarget,__privateGet(this,_elementInstance).querySelector("[data-nest]")||((_a=__privateGet(this,_elementInstance).shadowRoot)==null?void 0:_a.querySelector("[data-nest]"))||__privateGet(this,_elementInstance).shadowRoot||__privateGet(this,_elementInstance))},"#findNestTarget"),cleanup_fn=__name(function(){__privateGet(this,_mutationObserver).disconnect(),__privateGet(this,_elementInstance)&&(__privateGet(this,_elementInstance).removeEventListener("__hmrInstanceReplace",__privateGet(this,_instanceReplaceListener)),__privateGet(this,_elementInstance).remove()),__privateSet(this,_isActive,!1),__privateMethod(this,_Route_instances,removeTemporalHeadNodes_fn).call(this)},"#cleanup"),removeTemporalHeadNodes_fn=__name(function(){__privateGet(this,_temporalHeadNodes).forEach(node=>{node.parentNode===document.head&&document.head.removeChild(node)}),__privateSet(this,_temporalHeadNodes,[])},"#removeTemporalHeadNodes"),handleHeadMutations_fn=__name(function(mutations){mutations.forEach(mutation=>{mutation.addedNodes.forEach(node=>{__privateGet(this,_elementConstructor)?__privateGet(this,_temporalHeadNodes).push(node):__privateGet(this,_permanentHeadNodes).push(node)})})},"#handleHeadMutations"),waitForHeadNodesLoad_fn=__name(function(){return __async(this,null,function*(){const loadableNodes=__privateGet(this,_permanentHeadNodes).filter(__privateMethod(this,_Route_instances,isLoadableNode_fn));yield Promise.all(loadableNodes.map(node=>new Promise(resolve=>{__privateMethod(this,_Route_instances,isLoadableNode_fn).call(this,node)?node.onload=()=>resolve():resolve()})))})},"#waitForHeadNodesLoad"),isLoadableNode_fn=__name(function(node){return node instanceof HTMLElement&&(node.tagName==="STYLE"||node.tagName==="SCRIPT"||node.tagName==="LINK")},"#isLoadableNode"),_instanceReplaceListener=new WeakMap,__name(_Route,"Route");let Route=_Route;globalThis.URLPattern=urlpatternPolyfill.URLPattern;var _options,_scroll,_links,_history,_announcerElement,_updateId,_routes,_lastRoute,_Router_instances,runPreprocessor_fn,categorizeRoutes_fn,closeOldRoutes_fn,renderNewRoutes_fn,sortRoutesByPathDepth_fn;const _Router=class _Router{constructor(options){__privateAdd(this,_Router_instances);__privateAdd(this,_options,null);__privateAdd(this,_scroll,null);__privateAdd(this,_links,null);__privateAdd(this,_history,null);__privateAdd(this,_announcerElement,null);__privateAdd(this,_updateId,0);__privateAdd(this,_routes,[]);__privateAdd(this,_lastRoute,null);__privateSet(this,_options,__spreadProps(__spreadValues({},options),{rootElement:(options==null?void 0:options.rootElement)||document.body,base:url.normalizeBase(options==null?void 0:options.base)})),__privateSet(this,_announcerElement,new PageAnnouncerElement.PageAnnouncerElement),__privateSet(this,_scroll,new PageScroll.PageScroll(__privateGet(this,_options).scrollSelector)),__privateGet(this,_scroll).update(),__privateSet(this,_links,new LocalLinks.LocalLinks({base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,includeAnchor:options==null?void 0:options.includeAnchor,onClick:__name((url2,options2)=>{try{this.navigate(url2,options2)}catch(e){window.location.assign(url2)}},"onClick")})),__privateGet(this,_links).update(),__privateSet(this,_history,new history_index.History({onPop:__name(url2=>{this.navigate(url2)},"onPop")}))}history(){return __privateGet(this,_history)}get scroll(){return scroll}get routes(){return __privateGet(this,_routes)}run(){__privateMethod(this,_Router_instances,sortRoutesByPathDepth_fn).call(this),this.navigate(new URL(location.href),{revalidate:!0})}defineRoute(pattern,module2){const route=new Route(pattern,module2);__privateGet(this,_routes).push(route)}navigate(url$1,options){return __async(this,null,function*(){var _a,_b,_c,_d,_e,_f;const isBack=__privateGet(this,_history).isBack,updateId=++__privateWrapper(this,_updateId)._;let fullUrl=url.normalizeURL(url$1,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash});if(__privateGet(this,_options).urlModifier&&(fullUrl=__privateGet(this,_options).urlModifier(fullUrl)),!(yield __privateMethod(this,_Router_instances,runPreprocessor_fn).call(this,fullUrl))||__privateGet(this,_updateId)!==updateId||(yield(_b=(_a=__privateGet(this,_options)).beforeNavigation)==null?void 0:_b.call(_a),__privateGet(this,_updateId)!==updateId))return;const{activeRoutes,newRoutes,oldRoutes,keepRoutes}=__privateMethod(this,_Router_instances,categorizeRoutes_fn).call(this,fullUrl);__privateSet(this,_lastRoute,(_c=keepRoutes[keepRoutes.length-1])!=null?_c:null),isBack||(__privateGet(this,_history).push(fullUrl),((_d=options==null?void 0:options.keepScrollPosition)==null||_d)&&__privateGet(this,_scroll).element.scrollTo({top:0,behavior:"instant"})),__privateGet(this,_announcerElement).create(document,fullUrl.pathname),__privateGet(this,_options).viewTransition&&document.startViewTransition?yield document.startViewTransition(()=>__privateMethod(this,_Router_instances,renderNewRoutes_fn).call(this,oldRoutes,newRoutes,fullUrl)).finished:yield __privateMethod(this,_Router_instances,renderNewRoutes_fn).call(this,oldRoutes,newRoutes,fullUrl),__privateGet(this,_scroll).update(),__privateGet(this,_links).update(),__privateGet(this,_announcerElement).done(),yield(_f=(_e=__privateGet(this,_options)).afterNavigation)==null?void 0:_f.call(_e)})}};_options=new WeakMap,_scroll=new WeakMap,_links=new WeakMap,_history=new WeakMap,_announcerElement=new WeakMap,_updateId=new WeakMap,_routes=new WeakMap,_lastRoute=new WeakMap,_Router_instances=new WeakSet,runPreprocessor_fn=__name(function(url2){return __async(this,null,function*(){if(!__privateGet(this,_options).preprocessor)return!0;try{return yield new Promise((resolve,reject)=>{var _a,_b;(_b=(_a=__privateGet(this,_options)).preprocessor)==null||_b.call(_a,{url:url2,resolve,reject})}),!0}catch(error){return console.error(error!=null?error:"Route change canceled"),!1}})},"#runPreprocessor"),categorizeRoutes_fn=__name(function(url2){let leaf=url2.pathname.replace(__privateGet(this,_options).base,"");leaf.startsWith("/")||(leaf=`/${leaf}`);const activeRoutes=__privateGet(this,_routes).filter(route=>route.isActive);return{activeRoutes,newRoutes:__privateGet(this,_routes).filter(route=>!activeRoutes.includes(route)&&route.testPathname(leaf)),oldRoutes:activeRoutes.filter(route=>!route.testPathname(leaf)),keepRoutes:activeRoutes.filter(route=>route.testPathname(leaf))}},"#categorizeRoutes"),closeOldRoutes_fn=__name(function(routes){routes.forEach(route=>route.close())},"#closeOldRoutes"),renderNewRoutes_fn=__name(function(oldRoutes,routes,url2){return __async(this,null,function*(){var _a,_b;__privateMethod(this,_Router_instances,closeOldRoutes_fn).call(this,oldRoutes);for(const route of routes){const target=(_b=(_a=__privateGet(this,_lastRoute))==null?void 0:_a.nest)!=null?_b:__privateGet(this,_options).rootElement;yield route.render(target,url2),__privateSet(this,_lastRoute,route)}})},"#renderNewRoutes"),sortRoutesByPathDepth_fn=__name(function(){__privateGet(this,_routes).sort((a,b)=>{const depthA=a.pattern.split("/").length,depthB=b.pattern.split("/").length;return depthA-depthB})},"#sortRoutesByPathDepth"),__name(_Router,"Router");let Router=_Router;exports.Router=Router;
@@ -1,268 +1,270 @@
1
- var lt = Object.defineProperty, ct = Object.defineProperties;
2
- var ut = Object.getOwnPropertyDescriptors;
3
- var K = Object.getOwnPropertySymbols;
4
- var dt = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
5
- var Y = (i) => {
6
- throw TypeError(i);
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 __typeError = (msg) => {
6
+ throw TypeError(msg);
7
7
  };
8
- var W = (i, t, s) => t in i ? lt(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s, j = (i, t) => {
9
- for (var s in t || (t = {}))
10
- dt.call(t, s) && W(i, s, t[s]);
11
- if (K)
12
- for (var s of K(t))
13
- mt.call(t, s) && W(i, s, t[s]);
14
- return i;
15
- }, G = (i, t) => ct(i, ut(t));
16
- var B = (i, t, s) => t.has(i) || Y("Cannot " + s);
17
- var e = (i, t, s) => (B(i, t, "read from private field"), s ? s.call(i) : t.get(i)), n = (i, t, s) => t.has(i) ? Y("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, a) => (B(i, t, "write to private field"), a ? a.call(i, s) : t.set(i, s), s), d = (i, t, s) => (B(i, t, "access private method"), s);
18
- var J = (i, t, s, a) => ({
19
- set _(r) {
20
- h(i, t, r, s);
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 __privateWrapper = (obj, member, setter, getter) => ({
19
+ set _(value) {
20
+ __privateSet(obj, member, value, setter);
21
21
  },
22
22
  get _() {
23
- return e(i, t, a);
23
+ return __privateGet(obj, member, getter);
24
24
  }
25
25
  });
26
- var w = (i, t, s) => new Promise((a, r) => {
27
- var l = (f) => {
26
+ var __async = (__this, __arguments, generator) => new Promise((resolve, reject) => {
27
+ var fulfilled = (value) => {
28
28
  try {
29
- R(s.next(f));
30
- } catch (E) {
31
- r(E);
29
+ step(generator.next(value));
30
+ } catch (e) {
31
+ reject(e);
32
32
  }
33
- }, A = (f) => {
33
+ }, rejected = (value) => {
34
34
  try {
35
- R(s.throw(f));
36
- } catch (E) {
37
- r(E);
35
+ step(generator.throw(value));
36
+ } catch (e) {
37
+ reject(e);
38
38
  }
39
- }, R = (f) => f.done ? a(f.value) : Promise.resolve(f.value).then(l, A);
40
- R((s = s.apply(i, t)).next());
39
+ }, step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
40
+ step((generator = generator.apply(__this, __arguments)).next());
41
41
  });
42
- import { History as ft } from "../history/index.js";
43
- import { L as pt } from "../LocalLinks-DFZFpbjs.js";
44
- import { P as Rt } from "../PageAnnouncerElement-0LxZjtVH.js";
45
- import { P as wt } from "../PageScroll-0LxFblry.js";
42
+ import { History } from "../history/index.js";
43
+ import { L as LocalLinks } from "../LocalLinks-Dwgf3No6.js";
44
+ import { P as PageAnnouncerElement } from "../PageAnnouncerElement-DV9pm_od.js";
45
+ import { P as PageScroll } from "../PageScroll-m3TsHnzR.js";
46
46
  import "construct-style-sheets-polyfill";
47
- import "../index-e9eDuagL.js";
48
- import { a as gt, n as vt } from "../url-CYgo5vrG.js";
49
- import { URLPattern as Pt } from "urlpattern-polyfill";
50
- import { r as Lt } from "../render-D_0FCWEu.js";
51
- import { i as bt } from "../object-CcMK4y_r.js";
52
- var S, U, T, p, c, I, M, v, P, L, o, Q, X, Z, tt, et, st, it, at, z, b;
53
- class Nt {
54
- constructor(t, s) {
55
- n(this, o);
56
- n(this, S);
57
- n(this, U);
58
- n(this, T);
59
- n(this, p, null);
60
- n(this, c, null);
61
- n(this, I, !1);
62
- n(this, M, null);
63
- n(this, v);
64
- n(this, P, []);
65
- n(this, L, []);
66
- n(this, b, (t) => {
67
- e(this, c).removeEventListener(
47
+ import "../index-DpKsHe97.js";
48
+ import { a as normalizeBase, n as normalizeURL } from "../url-CWCY_qe_.js";
49
+ import { URLPattern as URLPattern$1 } from "urlpattern-polyfill";
50
+ import { r as render } from "../render-DLcWVnuH.js";
51
+ import { i as isESClass } from "../object-CiIdEmJx.js";
52
+ var _pattern, _module, _urlPattern, _elementConstructor, _elementInstance, _isActive, _nestTarget, _mutationObserver, _permanentHeadNodes, _temporalHeadNodes, _Route_instances, initializeRouteModule_fn, appendPermanentHeadNodes_fn, renderRouteComponent_fn, findNestTarget_fn, cleanup_fn, removeTemporalHeadNodes_fn, handleHeadMutations_fn, waitForHeadNodesLoad_fn, isLoadableNode_fn, _instanceReplaceListener;
53
+ const _Route = class _Route {
54
+ constructor(pattern, module) {
55
+ __privateAdd(this, _Route_instances);
56
+ __privateAdd(this, _pattern);
57
+ __privateAdd(this, _module);
58
+ __privateAdd(this, _urlPattern);
59
+ __privateAdd(this, _elementConstructor, null);
60
+ __privateAdd(this, _elementInstance, null);
61
+ __privateAdd(this, _isActive, !1);
62
+ __privateAdd(this, _nestTarget, null);
63
+ __privateAdd(this, _mutationObserver);
64
+ __privateAdd(this, _permanentHeadNodes, []);
65
+ __privateAdd(this, _temporalHeadNodes, []);
66
+ __privateAdd(this, _instanceReplaceListener, /* @__PURE__ */ __name((e) => {
67
+ __privateGet(this, _elementInstance).removeEventListener(
68
68
  "__hmrInstanceReplace",
69
- e(this, b)
70
- ), h(this, c, t.detail.element), e(this, c).addEventListener(
69
+ __privateGet(this, _instanceReplaceListener)
70
+ ), __privateSet(this, _elementInstance, e.detail.element), __privateGet(this, _elementInstance).addEventListener(
71
71
  "__hmrInstanceReplace",
72
- e(this, b)
72
+ __privateGet(this, _instanceReplaceListener)
73
73
  );
74
- });
75
- h(this, S, t), h(this, U, s), h(this, T, new URLPattern({ pathname: e(this, S) })), h(this, v, new MutationObserver(
76
- d(this, o, it).bind(this)
74
+ }, "#instanceReplaceListener"));
75
+ __privateSet(this, _pattern, pattern), __privateSet(this, _module, module), __privateSet(this, _urlPattern, new URLPattern({ pathname: __privateGet(this, _pattern) })), __privateSet(this, _mutationObserver, new MutationObserver(
76
+ __privateMethod(this, _Route_instances, handleHeadMutations_fn).bind(this)
77
77
  ));
78
78
  }
79
79
  get pattern() {
80
- return e(this, S);
80
+ return __privateGet(this, _pattern);
81
81
  }
82
82
  get isActive() {
83
- return e(this, I);
83
+ return __privateGet(this, _isActive);
84
84
  }
85
85
  get element() {
86
- return e(this, c);
86
+ return __privateGet(this, _elementInstance);
87
87
  }
88
88
  get nest() {
89
- return e(this, M);
89
+ return __privateGet(this, _nestTarget);
90
90
  }
91
- testPathname(t) {
92
- return e(this, T).test({ pathname: t });
91
+ testPathname(pathname) {
92
+ return __privateGet(this, _urlPattern).test({ pathname });
93
93
  }
94
- render(t, s) {
95
- return w(this, null, function* () {
96
- e(this, v).observe(document.head, {
94
+ render(container, url) {
95
+ return __async(this, null, function* () {
96
+ __privateGet(this, _mutationObserver).observe(document.head, {
97
97
  childList: !0,
98
98
  subtree: !0
99
- }), e(this, p) ? d(this, o, X).call(this) : yield d(this, o, Q).call(this), yield d(this, o, at).call(this), e(this, p) && (yield d(this, o, Z).call(this, t, s)), e(this, v).disconnect();
99
+ }), __privateGet(this, _elementConstructor) ? __privateMethod(this, _Route_instances, appendPermanentHeadNodes_fn).call(this) : yield __privateMethod(this, _Route_instances, initializeRouteModule_fn).call(this), yield __privateMethod(this, _Route_instances, waitForHeadNodesLoad_fn).call(this), __privateGet(this, _elementConstructor) && (yield __privateMethod(this, _Route_instances, renderRouteComponent_fn).call(this, container, url)), __privateGet(this, _mutationObserver).disconnect();
100
100
  });
101
101
  }
102
102
  close() {
103
- d(this, o, et).call(this);
103
+ __privateMethod(this, _Route_instances, cleanup_fn).call(this);
104
104
  }
105
- }
106
- S = new WeakMap(), U = new WeakMap(), T = new WeakMap(), p = new WeakMap(), c = new WeakMap(), I = new WeakMap(), M = new WeakMap(), v = new WeakMap(), P = new WeakMap(), L = new WeakMap(), o = new WeakSet(), Q = function() {
107
- return w(this, null, function* () {
108
- const t = yield e(this, U).call(this);
109
- h(this, L, [...e(this, P)]), typeof t.default == "function" && h(this, p, t.default);
105
+ };
106
+ _pattern = new WeakMap(), _module = new WeakMap(), _urlPattern = new WeakMap(), _elementConstructor = new WeakMap(), _elementInstance = new WeakMap(), _isActive = new WeakMap(), _nestTarget = new WeakMap(), _mutationObserver = new WeakMap(), _permanentHeadNodes = new WeakMap(), _temporalHeadNodes = new WeakMap(), _Route_instances = new WeakSet(), initializeRouteModule_fn = /* @__PURE__ */ __name(function() {
107
+ return __async(this, null, function* () {
108
+ const content = yield __privateGet(this, _module).call(this);
109
+ __privateSet(this, _temporalHeadNodes, [...__privateGet(this, _permanentHeadNodes)]), typeof content.default == "function" && __privateSet(this, _elementConstructor, content.default);
110
110
  });
111
- }, X = function() {
112
- e(this, P).forEach((t) => {
113
- document.head.appendChild(t.cloneNode(!0));
111
+ }, "#initializeRouteModule"), appendPermanentHeadNodes_fn = /* @__PURE__ */ __name(function() {
112
+ __privateGet(this, _permanentHeadNodes).forEach((node) => {
113
+ document.head.appendChild(node.cloneNode(!0));
114
114
  });
115
- }, Z = function(t, s) {
116
- return w(this, null, function* () {
117
- var l;
118
- const r = { urlPatternResult: e(this, T).exec({ pathname: s.pathname }) };
119
- bt(e(this, p)) ? (h(this, c, new (e(this, p))(r)), t.appendChild(e(this, c))) : h(this, c, Lt(
120
- t,
121
- e(this, p),
122
- r
123
- )), (l = e(this, c)) == null || l.addEventListener(
115
+ }, "#appendPermanentHeadNodes"), renderRouteComponent_fn = /* @__PURE__ */ __name(function(container, url) {
116
+ return __async(this, null, function* () {
117
+ var _a;
118
+ const routeParams = { urlPatternResult: __privateGet(this, _urlPattern).exec({ pathname: url.pathname }) };
119
+ isESClass(__privateGet(this, _elementConstructor)) ? (__privateSet(this, _elementInstance, new (__privateGet(this, _elementConstructor))(routeParams)), container.appendChild(__privateGet(this, _elementInstance))) : __privateSet(this, _elementInstance, render(
120
+ container,
121
+ __privateGet(this, _elementConstructor),
122
+ routeParams
123
+ )), (_a = __privateGet(this, _elementInstance)) == null || _a.addEventListener(
124
124
  "__hmrInstanceReplace",
125
- e(this, b)
126
- ), d(this, o, tt).call(this), h(this, I, !0);
125
+ __privateGet(this, _instanceReplaceListener)
126
+ ), __privateMethod(this, _Route_instances, findNestTarget_fn).call(this), __privateSet(this, _isActive, !0);
127
127
  });
128
- }, tt = function() {
129
- var t;
130
- e(this, c) && h(this, M, e(this, c).querySelector("[data-nest]") || ((t = e(this, c).shadowRoot) == null ? void 0 : t.querySelector("[data-nest]")) || e(this, c).shadowRoot || e(this, c));
131
- }, et = function() {
132
- e(this, v).disconnect(), e(this, c) && (e(this, c).removeEventListener(
128
+ }, "#renderRouteComponent"), findNestTarget_fn = /* @__PURE__ */ __name(function() {
129
+ var _a;
130
+ __privateGet(this, _elementInstance) && __privateSet(this, _nestTarget, __privateGet(this, _elementInstance).querySelector("[data-nest]") || ((_a = __privateGet(this, _elementInstance).shadowRoot) == null ? void 0 : _a.querySelector("[data-nest]")) || __privateGet(this, _elementInstance).shadowRoot || __privateGet(this, _elementInstance));
131
+ }, "#findNestTarget"), cleanup_fn = /* @__PURE__ */ __name(function() {
132
+ __privateGet(this, _mutationObserver).disconnect(), __privateGet(this, _elementInstance) && (__privateGet(this, _elementInstance).removeEventListener(
133
133
  "__hmrInstanceReplace",
134
- e(this, b)
135
- ), e(this, c).remove()), h(this, I, !1), d(this, o, st).call(this);
136
- }, st = function() {
137
- e(this, L).forEach((t) => {
138
- t.parentNode === document.head && document.head.removeChild(t);
139
- }), h(this, L, []);
140
- }, it = function(t) {
141
- t.forEach((s) => {
142
- s.addedNodes.forEach((a) => {
143
- e(this, p) ? e(this, L).push(a) : e(this, P).push(a);
134
+ __privateGet(this, _instanceReplaceListener)
135
+ ), __privateGet(this, _elementInstance).remove()), __privateSet(this, _isActive, !1), __privateMethod(this, _Route_instances, removeTemporalHeadNodes_fn).call(this);
136
+ }, "#cleanup"), removeTemporalHeadNodes_fn = /* @__PURE__ */ __name(function() {
137
+ __privateGet(this, _temporalHeadNodes).forEach((node) => {
138
+ node.parentNode === document.head && document.head.removeChild(node);
139
+ }), __privateSet(this, _temporalHeadNodes, []);
140
+ }, "#removeTemporalHeadNodes"), handleHeadMutations_fn = /* @__PURE__ */ __name(function(mutations) {
141
+ mutations.forEach((mutation) => {
142
+ mutation.addedNodes.forEach((node) => {
143
+ __privateGet(this, _elementConstructor) ? __privateGet(this, _temporalHeadNodes).push(node) : __privateGet(this, _permanentHeadNodes).push(node);
144
144
  });
145
145
  });
146
- }, at = function() {
147
- return w(this, null, function* () {
148
- const t = e(this, P).filter(d(this, o, z));
146
+ }, "#handleHeadMutations"), waitForHeadNodesLoad_fn = /* @__PURE__ */ __name(function() {
147
+ return __async(this, null, function* () {
148
+ const loadableNodes = __privateGet(this, _permanentHeadNodes).filter(__privateMethod(this, _Route_instances, isLoadableNode_fn));
149
149
  yield Promise.all(
150
- t.map(
151
- (s) => new Promise((a) => {
152
- d(this, o, z).call(this, s) ? s.onload = () => a() : a();
150
+ loadableNodes.map(
151
+ (node) => new Promise((resolve) => {
152
+ __privateMethod(this, _Route_instances, isLoadableNode_fn).call(this, node) ? node.onload = () => resolve() : resolve();
153
153
  })
154
154
  )
155
155
  );
156
156
  });
157
- }, z = function(t) {
158
- return t instanceof HTMLElement && (t.tagName === "STYLE" || t.tagName === "SCRIPT" || t.tagName === "LINK");
159
- }, b = new WeakMap();
160
- globalThis.URLPattern = Pt;
161
- var u, N, k, y, C, H, g, _, m, rt, nt, ht, O, ot;
162
- class Bt {
163
- constructor(t) {
164
- n(this, m);
165
- n(this, u, null);
166
- n(this, N, null);
167
- n(this, k, null);
168
- n(this, y, null);
169
- n(this, C, null);
170
- n(this, H, 0);
171
- n(this, g, []);
172
- n(this, _, null);
173
- h(this, u, G(j({}, t), {
174
- rootElement: (t == null ? void 0 : t.rootElement) || document.body,
175
- base: gt(t == null ? void 0 : t.base)
176
- })), h(this, C, new Rt()), h(this, N, new wt(e(this, u).scrollSelector)), e(this, N).update(), h(this, k, new pt({
177
- base: e(this, u).base,
178
- trailingSlash: e(this, u).trailingSlash,
179
- includeAnchor: t == null ? void 0 : t.includeAnchor,
180
- onClick: (s, a) => {
157
+ }, "#waitForHeadNodesLoad"), isLoadableNode_fn = /* @__PURE__ */ __name(function(node) {
158
+ return node instanceof HTMLElement && (node.tagName === "STYLE" || node.tagName === "SCRIPT" || node.tagName === "LINK");
159
+ }, "#isLoadableNode"), _instanceReplaceListener = new WeakMap(), __name(_Route, "Route");
160
+ let Route = _Route;
161
+ globalThis.URLPattern = URLPattern$1;
162
+ var _options, _scroll, _links, _history, _announcerElement, _updateId, _routes, _lastRoute, _Router_instances, runPreprocessor_fn, categorizeRoutes_fn, closeOldRoutes_fn, renderNewRoutes_fn, sortRoutesByPathDepth_fn;
163
+ const _Router = class _Router {
164
+ constructor(options) {
165
+ __privateAdd(this, _Router_instances);
166
+ __privateAdd(this, _options, null);
167
+ __privateAdd(this, _scroll, null);
168
+ __privateAdd(this, _links, null);
169
+ __privateAdd(this, _history, null);
170
+ __privateAdd(this, _announcerElement, null);
171
+ __privateAdd(this, _updateId, 0);
172
+ __privateAdd(this, _routes, []);
173
+ __privateAdd(this, _lastRoute, null);
174
+ __privateSet(this, _options, __spreadProps(__spreadValues({}, options), {
175
+ rootElement: (options == null ? void 0 : options.rootElement) || document.body,
176
+ base: normalizeBase(options == null ? void 0 : options.base)
177
+ })), __privateSet(this, _announcerElement, new PageAnnouncerElement()), __privateSet(this, _scroll, new PageScroll(__privateGet(this, _options).scrollSelector)), __privateGet(this, _scroll).update(), __privateSet(this, _links, new LocalLinks({
178
+ base: __privateGet(this, _options).base,
179
+ trailingSlash: __privateGet(this, _options).trailingSlash,
180
+ includeAnchor: options == null ? void 0 : options.includeAnchor,
181
+ onClick: /* @__PURE__ */ __name((url, options2) => {
181
182
  try {
182
- this.navigate(s, a);
183
- } catch (r) {
184
- window.location.assign(s);
183
+ this.navigate(url, options2);
184
+ } catch (e) {
185
+ window.location.assign(url);
185
186
  }
186
- }
187
- })), e(this, k).update(), h(this, y, new ft({
188
- onPop: (s) => {
189
- this.navigate(s);
190
- }
187
+ }, "onClick")
188
+ })), __privateGet(this, _links).update(), __privateSet(this, _history, new History({
189
+ onPop: /* @__PURE__ */ __name((url) => {
190
+ this.navigate(url);
191
+ }, "onPop")
191
192
  }));
192
193
  }
193
194
  history() {
194
- return e(this, y);
195
+ return __privateGet(this, _history);
195
196
  }
196
197
  get scroll() {
197
198
  return scroll;
198
199
  }
199
200
  get routes() {
200
- return e(this, g);
201
+ return __privateGet(this, _routes);
201
202
  }
202
203
  run() {
203
- d(this, m, ot).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
204
+ __privateMethod(this, _Router_instances, sortRoutesByPathDepth_fn).call(this), this.navigate(new URL(location.href), { revalidate: !0 });
204
205
  }
205
- defineRoute(t, s) {
206
- const a = new Nt(t, s);
207
- e(this, g).push(a);
206
+ defineRoute(pattern, module) {
207
+ const route = new Route(pattern, module);
208
+ __privateGet(this, _routes).push(route);
208
209
  }
209
- navigate(t, s) {
210
- return w(this, null, function* () {
211
- var q, x, V, $, D, F;
212
- const a = e(this, y).isBack, r = ++J(this, H)._;
213
- let l = vt(t, {
214
- base: e(this, u).base,
215
- trailingSlash: e(this, u).trailingSlash
210
+ navigate(url, options) {
211
+ return __async(this, null, function* () {
212
+ var _a, _b, _c, _d, _e, _f;
213
+ const isBack = __privateGet(this, _history).isBack, updateId = ++__privateWrapper(this, _updateId)._;
214
+ let fullUrl = normalizeURL(url, {
215
+ base: __privateGet(this, _options).base,
216
+ trailingSlash: __privateGet(this, _options).trailingSlash
216
217
  });
217
- if (e(this, u).urlModifier && (l = e(this, u).urlModifier(l)), !(yield d(this, m, rt).call(this, l)) || e(this, H) !== r || (yield (x = (q = e(this, u)).beforeNavigation) == null ? void 0 : x.call(q), e(this, H) !== r))
218
+ if (__privateGet(this, _options).urlModifier && (fullUrl = __privateGet(this, _options).urlModifier(fullUrl)), !(yield __privateMethod(this, _Router_instances, runPreprocessor_fn).call(this, fullUrl)) || __privateGet(this, _updateId) !== updateId || (yield (_b = (_a = __privateGet(this, _options)).beforeNavigation) == null ? void 0 : _b.call(_a), __privateGet(this, _updateId) !== updateId))
218
219
  return;
219
- const { activeRoutes: A, newRoutes: R, oldRoutes: f, keepRoutes: E } = d(this, m, nt).call(this, l);
220
- h(this, _, (V = E[E.length - 1]) != null ? V : null), a || (e(this, y).push(l), (($ = s == null ? void 0 : s.keepScrollPosition) == null || $) && e(this, N).element.scrollTo({ top: 0, behavior: "instant" })), e(this, C).create(document, l.pathname), e(this, u).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => d(this, m, O).call(this, f, R, l)).finished : yield d(this, m, O).call(this, f, R, l), e(this, N).update(), e(this, k).update(), e(this, C).done(), yield (F = (D = e(this, u)).afterNavigation) == null ? void 0 : F.call(D);
220
+ const { activeRoutes, newRoutes, oldRoutes, keepRoutes } = __privateMethod(this, _Router_instances, categorizeRoutes_fn).call(this, fullUrl);
221
+ __privateSet(this, _lastRoute, (_c = keepRoutes[keepRoutes.length - 1]) != null ? _c : null), isBack || (__privateGet(this, _history).push(fullUrl), ((_d = options == null ? void 0 : options.keepScrollPosition) == null || _d) && __privateGet(this, _scroll).element.scrollTo({ top: 0, behavior: "instant" })), __privateGet(this, _announcerElement).create(document, fullUrl.pathname), __privateGet(this, _options).viewTransition && document.startViewTransition ? yield document.startViewTransition(() => __privateMethod(this, _Router_instances, renderNewRoutes_fn).call(this, oldRoutes, newRoutes, fullUrl)).finished : yield __privateMethod(this, _Router_instances, renderNewRoutes_fn).call(this, oldRoutes, newRoutes, fullUrl), __privateGet(this, _scroll).update(), __privateGet(this, _links).update(), __privateGet(this, _announcerElement).done(), yield (_f = (_e = __privateGet(this, _options)).afterNavigation) == null ? void 0 : _f.call(_e);
221
222
  });
222
223
  }
223
- }
224
- u = new WeakMap(), N = new WeakMap(), k = new WeakMap(), y = new WeakMap(), C = new WeakMap(), H = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), m = new WeakSet(), rt = function(t) {
225
- return w(this, null, function* () {
226
- if (!e(this, u).preprocessor)
224
+ };
225
+ _options = new WeakMap(), _scroll = new WeakMap(), _links = new WeakMap(), _history = new WeakMap(), _announcerElement = new WeakMap(), _updateId = new WeakMap(), _routes = new WeakMap(), _lastRoute = new WeakMap(), _Router_instances = new WeakSet(), runPreprocessor_fn = /* @__PURE__ */ __name(function(url) {
226
+ return __async(this, null, function* () {
227
+ if (!__privateGet(this, _options).preprocessor)
227
228
  return !0;
228
229
  try {
229
- return yield new Promise((s, a) => {
230
- var r, l;
231
- (l = (r = e(this, u)).preprocessor) == null || l.call(r, { url: t, resolve: s, reject: a });
230
+ return yield new Promise((resolve, reject) => {
231
+ var _a, _b;
232
+ (_b = (_a = __privateGet(this, _options)).preprocessor) == null || _b.call(_a, { url, resolve, reject });
232
233
  }), !0;
233
- } catch (s) {
234
- return console.error(s != null ? s : "Route change canceled"), !1;
234
+ } catch (error) {
235
+ return console.error(error != null ? error : "Route change canceled"), !1;
235
236
  }
236
237
  });
237
- }, nt = function(t) {
238
- let s = t.pathname.replace(e(this, u).base, "");
239
- s.startsWith("/") || (s = `/${s}`);
240
- const a = e(this, g).filter((r) => r.isActive);
238
+ }, "#runPreprocessor"), categorizeRoutes_fn = /* @__PURE__ */ __name(function(url) {
239
+ let leaf = url.pathname.replace(__privateGet(this, _options).base, "");
240
+ leaf.startsWith("/") || (leaf = `/${leaf}`);
241
+ const activeRoutes = __privateGet(this, _routes).filter((route) => route.isActive);
241
242
  return {
242
- activeRoutes: a,
243
- newRoutes: e(this, g).filter(
244
- (r) => !a.includes(r) && r.testPathname(s)
243
+ activeRoutes,
244
+ newRoutes: __privateGet(this, _routes).filter(
245
+ (route) => !activeRoutes.includes(route) && route.testPathname(leaf)
245
246
  ),
246
- oldRoutes: a.filter((r) => !r.testPathname(s)),
247
- keepRoutes: a.filter((r) => r.testPathname(s))
247
+ oldRoutes: activeRoutes.filter((route) => !route.testPathname(leaf)),
248
+ keepRoutes: activeRoutes.filter((route) => route.testPathname(leaf))
248
249
  };
249
- }, ht = function(t) {
250
- t.forEach((s) => s.close());
251
- }, O = function(t, s, a) {
252
- return w(this, null, function* () {
253
- var r, l;
254
- d(this, m, ht).call(this, t);
255
- for (const A of s) {
256
- const R = (l = (r = e(this, _)) == null ? void 0 : r.nest) != null ? l : e(this, u).rootElement;
257
- yield A.render(R, a), h(this, _, A);
250
+ }, "#categorizeRoutes"), closeOldRoutes_fn = /* @__PURE__ */ __name(function(routes) {
251
+ routes.forEach((route) => route.close());
252
+ }, "#closeOldRoutes"), renderNewRoutes_fn = /* @__PURE__ */ __name(function(oldRoutes, routes, url) {
253
+ return __async(this, null, function* () {
254
+ var _a, _b;
255
+ __privateMethod(this, _Router_instances, closeOldRoutes_fn).call(this, oldRoutes);
256
+ for (const route of routes) {
257
+ const target = (_b = (_a = __privateGet(this, _lastRoute)) == null ? void 0 : _a.nest) != null ? _b : __privateGet(this, _options).rootElement;
258
+ yield route.render(target, url), __privateSet(this, _lastRoute, route);
258
259
  }
259
260
  });
260
- }, ot = function() {
261
- e(this, g).sort((t, s) => {
262
- const a = t.pattern.split("/").length, r = s.pattern.split("/").length;
263
- return a - r;
261
+ }, "#renderNewRoutes"), sortRoutesByPathDepth_fn = /* @__PURE__ */ __name(function() {
262
+ __privateGet(this, _routes).sort((a, b) => {
263
+ const depthA = a.pattern.split("/").length, depthB = b.pattern.split("/").length;
264
+ return depthA - depthB;
264
265
  });
265
- };
266
+ }, "#sortRoutesByPathDepth"), __name(_Router, "Router");
267
+ let Router = _Router;
266
268
  export {
267
- Bt as Router
269
+ Router
268
270
  };