aptechka 0.83.0 → 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 (276) 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 +8 -2
  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 +5 -2
  102. package/lib/jsx/index.js +171 -124
  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 +3 -1
  107. package/lib/jsx/type.d.ts +13 -6
  108. package/lib/jsx/utils/children/createElement.d.ts +1 -0
  109. package/lib/jsx/utils/children/hydrateTextNode.d.ts +1 -0
  110. package/lib/ladder/index.cjs +1 -1
  111. package/lib/ladder/index.js +86 -84
  112. package/lib/layout-C26zkY7D.js +35 -0
  113. package/lib/layout-CnGLl7oe.cjs +1 -0
  114. package/lib/layout-box/index.cjs +1 -1
  115. package/lib/layout-box/index.js +221 -217
  116. package/lib/loading/index.cjs +1 -1
  117. package/lib/loading/index.js +48 -45
  118. package/lib/local-links/index.cjs +1 -1
  119. package/lib/local-links/index.js +2 -2
  120. package/lib/masonry-layout/index.cjs +1 -1
  121. package/lib/masonry-layout/index.js +48 -45
  122. package/lib/math-C-knY2TL.cjs +1 -0
  123. package/lib/math-r8V23YFe.js +57 -0
  124. package/lib/media/index.cjs +1 -1
  125. package/lib/media/index.js +28 -25
  126. package/lib/metadata-BNdkmeeD.js +15 -0
  127. package/lib/metadata-BrHUfpV9.cjs +1 -0
  128. package/lib/morph/index.cjs +1 -1
  129. package/lib/morph/index.js +561 -556
  130. package/lib/morph-BtgB1YQP.js +256 -0
  131. package/lib/morph-Buhxq-X0.cjs +1 -0
  132. package/lib/need_redo_tweaker/index.cjs +4 -4
  133. package/lib/need_redo_tweaker/index.js +862 -834
  134. package/lib/notifier/index.cjs +1 -1
  135. package/lib/notifier/index.js +29 -26
  136. package/lib/number-Bu4sGvW7.cjs +1 -0
  137. package/lib/number-DiVt2xnh.js +47 -0
  138. package/lib/object-CiIdEmJx.js +98 -0
  139. package/lib/object-DTY_W6xG.cjs +1 -0
  140. package/lib/order/index.cjs +1 -1
  141. package/lib/order/index.js +3 -3
  142. package/lib/page-announcer/index.cjs +1 -1
  143. package/lib/page-announcer/index.js +2 -2
  144. package/lib/page-scroll/index.cjs +1 -1
  145. package/lib/page-scroll/index.js +2 -2
  146. package/lib/pixel-perfect/index.cjs +4 -4
  147. package/lib/pixel-perfect/index.js +43 -40
  148. package/lib/pointer/index.cjs +1 -1
  149. package/lib/pointer/index.js +125 -122
  150. package/lib/polyfills-CG1XJNia.js +28 -0
  151. package/lib/polyfills-DZCuDBkA.cjs +1 -0
  152. package/lib/popover/index.cjs +1 -1
  153. package/lib/popover/index.js +249 -245
  154. package/lib/radio/index.cjs +1 -1
  155. package/lib/radio/index.js +58 -55
  156. package/lib/render-DLcWVnuH.js +355 -0
  157. package/lib/render-DdomypCo.cjs +1 -0
  158. package/lib/router/index.cjs +1 -1
  159. package/lib/router/index.js +196 -194
  160. package/lib/scroll/index.cjs +1 -1
  161. package/lib/scroll/index.js +890 -877
  162. package/lib/scroll-BvIWh1xB.js +41 -0
  163. package/lib/scroll-CT0lpyRZ.cjs +1 -0
  164. package/lib/scroll-entries/index.cjs +1 -1
  165. package/lib/scroll-entries/index.js +37 -34
  166. package/lib/scroll-kit/index.cjs +1 -1
  167. package/lib/scroll-kit/index.js +214 -209
  168. package/lib/sequence/index.cjs +1 -1
  169. package/lib/sequence/index.js +102 -98
  170. package/lib/size-element/index.cjs +1 -1
  171. package/lib/size-element/index.js +29 -26
  172. package/lib/slicer/index.cjs +1 -1
  173. package/lib/slicer/index.js +118 -113
  174. package/lib/source/index.cjs +1 -1
  175. package/lib/source/index.js +5 -5
  176. package/lib/spa/index.cjs +1 -1
  177. package/lib/spa/index.js +94 -94
  178. package/lib/store/index.cjs +1 -1
  179. package/lib/store/index.d.ts +2 -2
  180. package/lib/store/index.js +11 -10
  181. package/lib/string-B3lm2b7v.js +84 -0
  182. package/lib/string-CbRNzmd9.cjs +1 -0
  183. package/lib/style-DBoQWK0d.js +14 -0
  184. package/lib/style-IDJ6db6n.cjs +1 -0
  185. package/lib/stylesheet-CHvuef16.js +28 -0
  186. package/lib/stylesheet-CQdBaIAA.cjs +1 -0
  187. package/lib/ticker/index.cjs +1 -1
  188. package/lib/ticker/index.js +96 -92
  189. package/lib/url-CPCO10Sy.cjs +1 -0
  190. package/lib/url-CWCY_qe_.js +124 -0
  191. package/lib/utils/attributes.d.ts +2 -0
  192. package/lib/utils/dom.d.ts +1 -0
  193. package/lib/utils/index.cjs +1 -1
  194. package/lib/utils/index.js +245 -226
  195. package/lib/video/index.cjs +1 -1
  196. package/lib/video/index.js +36 -33
  197. package/lib/window-resizer/index.cjs +1 -1
  198. package/lib/window-resizer/index.js +27 -24
  199. package/lib/youtube/index.cjs +1 -1
  200. package/lib/youtube/index.js +56 -54
  201. package/package.json +15 -3
  202. package/lib/Animation-BzTjZIE-.js +0 -108
  203. package/lib/Animation-C39Ah-LM.cjs +0 -1
  204. package/lib/Composed-C-mnUGX6.js +0 -70
  205. package/lib/Composed-RFcm2x5c.cjs +0 -1
  206. package/lib/Damped-CRusiRIV.js +0 -56
  207. package/lib/Damped-Prr0iKu1.cjs +0 -1
  208. package/lib/DerivedArray-DdCR-Oy7.cjs +0 -1
  209. package/lib/DerivedArray-opbeygTL.js +0 -59
  210. package/lib/DragControls-8rNZwQrs.cjs +0 -1
  211. package/lib/DragControls-DBNdMBA4.js +0 -228
  212. package/lib/LocalLinks-BxhSFv_Q.cjs +0 -1
  213. package/lib/LocalLinks-DRAQ-fxE.js +0 -62
  214. package/lib/PageAnnouncerElement-0LxZjtVH.js +0 -24
  215. package/lib/PageAnnouncerElement-AQ0Ja6HM.cjs +0 -1
  216. package/lib/PageScroll-0LxFblry.js +0 -62
  217. package/lib/PageScroll-BXJUQwG7.cjs +0 -1
  218. package/lib/SourceElement-BHqPFbna.cjs +0 -5
  219. package/lib/SourceElement-DjbHjynf.js +0 -260
  220. package/lib/Store-Blf4msDz.cjs +0 -1
  221. package/lib/Store-ZThXYBQd.js +0 -152
  222. package/lib/Tweened-Bw1Cn1PJ.js +0 -47
  223. package/lib/Tweened-DWtk9E-O.cjs +0 -1
  224. package/lib/Viewport-BxCr0GlB.cjs +0 -1
  225. package/lib/Viewport-Dt-d9DPi.js +0 -109
  226. package/lib/attributes-69we3byR.js +0 -10
  227. package/lib/attributes-Bf2svn4j.cjs +0 -1
  228. package/lib/canvas-CU5Xjahf.cjs +0 -1
  229. package/lib/canvas-DeZ0SLUJ.js +0 -34
  230. package/lib/coordinates-CgdGoSYs.js +0 -24
  231. package/lib/coordinates-D8Np3cPD.cjs +0 -1
  232. package/lib/custom-elements-DBnCK7Zx.js +0 -24
  233. package/lib/custom-elements-Dh4TWRDJ.cjs +0 -1
  234. package/lib/dom-BETkVSSZ.js +0 -82
  235. package/lib/dom-CBLlqORw.cjs +0 -1
  236. package/lib/easings-BEmRlrDd.js +0 -38
  237. package/lib/easings-GegIwET5.cjs +0 -1
  238. package/lib/element-CGVl1jA-.js +0 -7
  239. package/lib/element-yhcBhsho.cjs +0 -1
  240. package/lib/events-CsVF98U6.js +0 -6
  241. package/lib/events-KVanG9sR.cjs +0 -1
  242. package/lib/file-DSpfWdd9.cjs +0 -1
  243. package/lib/file-GHShUlue.js +0 -24
  244. package/lib/function-C10DGppn.js +0 -17
  245. package/lib/function-MthRj-GJ.cjs +0 -1
  246. package/lib/gestures-C7gbKx11.cjs +0 -1
  247. package/lib/gestures-CcXV6fCp.js +0 -11
  248. package/lib/index-OE2INULi.cjs +0 -1
  249. package/lib/index-e9eDuagL.js +0 -65
  250. package/lib/jsx/plugins/hmr.d.ts +0 -13
  251. package/lib/layout-BSMtwCga.js +0 -29
  252. package/lib/layout-Ctc2p3uz.cjs +0 -1
  253. package/lib/math-BOBiC4TN.js +0 -45
  254. package/lib/math-GDWEqu7y.cjs +0 -1
  255. package/lib/metadata-BcYZ5w3T.cjs +0 -1
  256. package/lib/metadata-jfowcCyz.js +0 -12
  257. package/lib/morph-B6sGhLCi.cjs +0 -1
  258. package/lib/morph-D_ybmXWR.js +0 -242
  259. package/lib/number-ChAm68cm.cjs +0 -1
  260. package/lib/number-CumqY64S.js +0 -40
  261. package/lib/object-CcMK4y_r.js +0 -87
  262. package/lib/object-baN9pgbU.cjs +0 -1
  263. package/lib/polyfills-DJrTJQky.js +0 -24
  264. package/lib/polyfills-Df4r-ETT.cjs +0 -1
  265. package/lib/render-1u700s93.js +0 -212
  266. package/lib/render-BIOfUddT.cjs +0 -1
  267. package/lib/scroll-BA2WnUrb.cjs +0 -1
  268. package/lib/scroll-DY5senkF.js +0 -37
  269. package/lib/string-BlMQbe8b.js +0 -70
  270. package/lib/string-DUXXtU8v.cjs +0 -1
  271. package/lib/style-At6aDoqG.cjs +0 -1
  272. package/lib/style-j2TwriJ_.js +0 -10
  273. package/lib/stylesheet-5_o7PFzM.cjs +0 -1
  274. package/lib/stylesheet-DdBzowZY.js +0 -24
  275. package/lib/url-CHgcNwJ1.cjs +0 -1
  276. package/lib/url-CYgo5vrG.js +0 -113
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
6
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
+ 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);
8
+ import { N as NODE_TYPE_ELEMENT } from "./morph-BtgB1YQP.js";
9
+ import "construct-style-sheets-polyfill";
10
+ import "./index-DpKsHe97.js";
11
+ import { n as normalizeURL, i as isLocalUrl } from "./url-CWCY_qe_.js";
12
+ var _options, _LocalLinks_instances, isElement_fn, processClickEvent_fn, _clickListener;
13
+ const _LocalLinks = class _LocalLinks {
14
+ constructor(options) {
15
+ __privateAdd(this, _LocalLinks_instances);
16
+ __privateAdd(this, _options);
17
+ __privateAdd(this, _clickListener, /* @__PURE__ */ __name((event) => {
18
+ var _a, _b, _c;
19
+ event.preventDefault();
20
+ const { url, options = {} } = (_a = __privateMethod(this, _LocalLinks_instances, processClickEvent_fn).call(this, event)) != null ? _a : {};
21
+ url && (event.preventDefault(), (_c = (_b = __privateGet(this, _options)).onClick) == null || _c.call(_b, url, options));
22
+ }, "#clickListener"));
23
+ __privateSet(this, _options, options), window.addEventListener("click", __privateGet(this, _clickListener));
24
+ }
25
+ destroy() {
26
+ window.removeEventListener("click", __privateGet(this, _clickListener));
27
+ }
28
+ update() {
29
+ document.querySelectorAll("a").forEach((link) => {
30
+ normalizeURL(link.getAttribute("href"), {
31
+ base: __privateGet(this, _options).base,
32
+ trailingSlash: __privateGet(this, _options).trailingSlash
33
+ }).pathname === location.pathname ? link.classList.add("current") : link.classList.remove("current");
34
+ });
35
+ }
36
+ };
37
+ _options = new WeakMap(), _LocalLinks_instances = new WeakSet(), isElement_fn = /* @__PURE__ */ __name(function(target) {
38
+ return (target == null ? void 0 : target.nodeType) === NODE_TYPE_ELEMENT;
39
+ }, "#isElement"), processClickEvent_fn = /* @__PURE__ */ __name(function(e) {
40
+ const target = e.composedPath()[0];
41
+ if (!__privateMethod(this, _LocalLinks_instances, isElement_fn).call(this, target))
42
+ return;
43
+ const anchorElement = target.closest("a");
44
+ if (!anchorElement || typeof __privateGet(this, _options).includeAnchor == "function" && !__privateGet(this, _options).includeAnchor(anchorElement) || anchorElement.closest("[data-router-ignore]"))
45
+ return;
46
+ const { href } = anchorElement;
47
+ if (!isLocalUrl(href))
48
+ return;
49
+ const options = {
50
+ keepScrollPosition: "keepScrollPosition" in anchorElement.dataset,
51
+ cache: "cache" in anchorElement.dataset,
52
+ revalidate: "revalidate" in anchorElement.dataset
53
+ };
54
+ return {
55
+ url: normalizeURL(new URL(href), {
56
+ base: __privateGet(this, _options).base,
57
+ trailingSlash: __privateGet(this, _options).trailingSlash
58
+ }),
59
+ options
60
+ };
61
+ }, "#processClickEvent"), _clickListener = new WeakMap(), __name(_LocalLinks, "LocalLinks");
62
+ let LocalLinks = _LocalLinks;
63
+ export {
64
+ LocalLinks as L
65
+ };
@@ -0,0 +1 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});const intersector_index=require("./index-BpO2RJ__.cjs");require("construct-style-sheets-polyfill");const _PageAnnouncerElement=class _PageAnnouncerElement extends HTMLElement{create(document2,title){this.textContent!==title&&(this.textContent=title),this.dataset.persist="",document2.body.appendChild(this)}done(){var _a;(_a=document.activeElement)!=null&&_a.closest("[data-persist]")||document.body.focus(),delete this.dataset.persist}connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_PageAnnouncerElement,"PageAnnouncerElement");let PageAnnouncerElement=_PageAnnouncerElement;intersector_index.isBrowser&&!customElements.get("e-page-announcer")&&customElements.define("e-page-announcer",PageAnnouncerElement);exports.PageAnnouncerElement=PageAnnouncerElement;
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
3
+ import { i as isBrowser } from "./index-DpKsHe97.js";
4
+ import "construct-style-sheets-polyfill";
5
+ const _PageAnnouncerElement = class _PageAnnouncerElement extends HTMLElement {
6
+ create(document2, title) {
7
+ this.textContent !== title && (this.textContent = title), this.dataset.persist = "", document2.body.appendChild(this);
8
+ }
9
+ done() {
10
+ var _a;
11
+ (_a = document.activeElement) != null && _a.closest("[data-persist]") || document.body.focus(), delete this.dataset.persist;
12
+ }
13
+ connectedCallback() {
14
+ const attrs = {
15
+ "aria-live": "assertive",
16
+ "aria-atomic": "true",
17
+ 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"
18
+ };
19
+ for (const [key, value] of Object.entries(attrs))
20
+ this.setAttribute(key, value);
21
+ }
22
+ };
23
+ __name(_PageAnnouncerElement, "PageAnnouncerElement");
24
+ let PageAnnouncerElement = _PageAnnouncerElement;
25
+ isBrowser && !customElements.get("e-page-announcer") && customElements.define("e-page-announcer", PageAnnouncerElement);
26
+ export {
27
+ PageAnnouncerElement as P
28
+ };
@@ -0,0 +1 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __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);const events=require("./events-UlGk63iC.cjs");require("construct-style-sheets-polyfill");require("./index-BpO2RJ__.cjs");var _element,_x,_y,_isWindow,_selector,_scrollListener;const _PageScroll=class _PageScroll{constructor(selector){__privateAdd(this,_element,null);__privateAdd(this,_x,0);__privateAdd(this,_y,0);__privateAdd(this,_isWindow,!1);__privateAdd(this,_selector);__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.value,directionY=top-__privateGet(this,_y),directionX=left-__privateGet(this,_x);__privateSet(this,_y,top),__privateSet(this,_x,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"pageScrollEvent",{detail:this.value})},"#scrollListener"));__privateSet(this,_selector,selector)}get element(){return __privateGet(this,_element)}get x(){return __privateGet(this,_x)}get y(){return __privateGet(this,_y)}get value(){let top=0,left=0;return __privateGet(this,_isWindow)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_element).scrollTop,left=__privateGet(this,_element).scrollLeft),{top,left}}destroy(){var _a;(_a=__privateGet(this,_element))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),document.documentElement.classList.remove("scroll-y"),document.documentElement.classList.remove("scroll-x"),document.documentElement.classList.remove("scroll-y-forward"),document.documentElement.classList.remove("scroll-y-backward"),document.documentElement.classList.remove("scroll-x-forward"),document.documentElement.classList.remove("scroll-x-backward")}update(){var _a,_b;(_a=__privateGet(this,_element))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_y,0),__privateSet(this,_x,0),__privateSet(this,_element,__privateGet(this,_selector)&&document.querySelector(__privateGet(this,_selector))||window),__privateSet(this,_isWindow,__privateGet(this,_element)===window),(_b=__privateGet(this,_element))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)}};_element=new WeakMap,_x=new WeakMap,_y=new WeakMap,_isWindow=new WeakMap,_selector=new WeakMap,_scrollListener=new WeakMap,__name(_PageScroll,"PageScroll");let PageScroll=_PageScroll;exports.PageScroll=PageScroll;
@@ -0,0 +1,65 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
6
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
+ 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);
8
+ import { d as dispatchEvent } from "./events-Ds-TuvYW.js";
9
+ import "construct-style-sheets-polyfill";
10
+ import "./index-DpKsHe97.js";
11
+ var _element, _x, _y, _isWindow, _selector, _scrollListener;
12
+ const _PageScroll = class _PageScroll {
13
+ constructor(selector) {
14
+ __privateAdd(this, _element, null);
15
+ __privateAdd(this, _x, 0);
16
+ __privateAdd(this, _y, 0);
17
+ __privateAdd(this, _isWindow, !1);
18
+ __privateAdd(this, _selector);
19
+ __privateAdd(this, _scrollListener, /* @__PURE__ */ __name(() => {
20
+ const { left, top } = this.value, directionY = top - __privateGet(this, _y), directionX = left - __privateGet(this, _x);
21
+ __privateSet(this, _y, top), __privateSet(this, _x, left), document.documentElement.classList.toggle("scroll-y", top > 0), document.documentElement.classList.toggle("scroll-x", left > 0), document.documentElement.classList.toggle(
22
+ "scroll-y-forward",
23
+ directionY > 0
24
+ ), document.documentElement.classList.toggle(
25
+ "scroll-y-backward",
26
+ directionY < 0
27
+ ), document.documentElement.classList.toggle(
28
+ "scroll-x-forward",
29
+ directionX > 0
30
+ ), document.documentElement.classList.toggle(
31
+ "scroll-x-backward",
32
+ directionX < 0
33
+ ), dispatchEvent(document, "pageScrollEvent", {
34
+ detail: this.value
35
+ });
36
+ }, "#scrollListener"));
37
+ __privateSet(this, _selector, selector);
38
+ }
39
+ get element() {
40
+ return __privateGet(this, _element);
41
+ }
42
+ get x() {
43
+ return __privateGet(this, _x);
44
+ }
45
+ get y() {
46
+ return __privateGet(this, _y);
47
+ }
48
+ get value() {
49
+ let top = 0, left = 0;
50
+ return __privateGet(this, _isWindow) ? (top = window.scrollY, left = window.scrollX) : (top = __privateGet(this, _element).scrollTop, left = __privateGet(this, _element).scrollLeft), { top, left };
51
+ }
52
+ destroy() {
53
+ var _a;
54
+ (_a = __privateGet(this, _element)) == null || _a.removeEventListener("scroll", __privateGet(this, _scrollListener)), document.documentElement.classList.remove("scroll-y"), document.documentElement.classList.remove("scroll-x"), document.documentElement.classList.remove("scroll-y-forward"), document.documentElement.classList.remove("scroll-y-backward"), document.documentElement.classList.remove("scroll-x-forward"), document.documentElement.classList.remove("scroll-x-backward");
55
+ }
56
+ update() {
57
+ var _a, _b;
58
+ (_a = __privateGet(this, _element)) == null || _a.removeEventListener("scroll", __privateGet(this, _scrollListener)), __privateSet(this, _y, 0), __privateSet(this, _x, 0), __privateSet(this, _element, __privateGet(this, _selector) && document.querySelector(__privateGet(this, _selector)) || window), __privateSet(this, _isWindow, __privateGet(this, _element) === window), (_b = __privateGet(this, _element)) == null || _b.addEventListener("scroll", __privateGet(this, _scrollListener)), __privateGet(this, _scrollListener).call(this);
59
+ }
60
+ };
61
+ _element = new WeakMap(), _x = new WeakMap(), _y = new WeakMap(), _isWindow = new WeakMap(), _selector = new WeakMap(), _scrollListener = new WeakMap(), __name(_PageScroll, "PageScroll");
62
+ let PageScroll = _PageScroll;
63
+ export {
64
+ PageScroll as P
65
+ };
@@ -0,0 +1,265 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __typeError = (msg) => {
3
+ throw TypeError(msg);
4
+ };
5
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
6
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
+ 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);
8
+ import { ElementLinkedStore } from "./element-linked-store/index.js";
9
+ import { loading } from "./loading/index.js";
10
+ import { i as isBrowser } from "./index-DpKsHe97.js";
11
+ import { d as dispatchEvent } from "./events-Ds-TuvYW.js";
12
+ import { k as kebabToCamel } from "./string-B3lm2b7v.js";
13
+ import { f as formatMediaDuration } from "./metadata-BNdkmeeD.js";
14
+ import "construct-style-sheets-polyfill";
15
+ import { RESIZE_ORDER } from "./order/index.js";
16
+ import { windowResizer } from "./window-resizer/index.js";
17
+ import { S as Store } from "./Store-uLDYY9ed.js";
18
+ var _url, _name, _density, _query, _queryValue, _queryType, _extension;
19
+ const _Source = class _Source {
20
+ constructor(url) {
21
+ __privateAdd(this, _url);
22
+ __privateAdd(this, _name);
23
+ __privateAdd(this, _density);
24
+ __privateAdd(this, _query);
25
+ __privateAdd(this, _queryValue);
26
+ __privateAdd(this, _queryType);
27
+ __privateAdd(this, _extension);
28
+ __privateSet(this, _url, url);
29
+ let splitted = url.split(".");
30
+ const xpattern = /\b\d{1,2}x\b/g, xmatch = splitted.find((s) => s.match(xpattern) && parseInt(s));
31
+ __privateSet(this, _density, xmatch ? parseInt(xmatch) : 1), xmatch && (splitted = splitted.slice(0, -1)), __privateSet(this, _name, splitted.length > 1 ? splitted.slice(0, -1).join(".") : splitted.join("."));
32
+ const maxpattern = /\d+max/g, minpattern = /\d+min/g, maxAspectPattern = /\d+mar/g, minAspectPattern = /\d+mir/g, maxmatch = splitted.find((s) => s.match(maxpattern)), minmatch = splitted.find((s) => s.match(minpattern)), maxRatioMatch = splitted.find((s) => s.match(maxAspectPattern)), minRatioMatch = splitted.find((s) => s.match(minAspectPattern));
33
+ maxRatioMatch ? (__privateSet(this, _queryValue, parseInt(maxRatioMatch)), __privateSet(this, _queryType, "max"), __privateSet(this, _query, `(max-aspect-ratio: ${__privateGet(this, _queryValue)})`)) : minRatioMatch ? (__privateSet(this, _queryValue, parseInt(minRatioMatch)), __privateSet(this, _queryType, "max"), __privateSet(this, _query, `(min-aspect-ratio: ${__privateGet(this, _queryValue)})`)) : maxmatch ? (__privateSet(this, _queryValue, parseInt(maxmatch)), __privateSet(this, _queryType, "max"), __privateSet(this, _query, `(max-width: ${__privateGet(this, _queryValue)}px)`)) : minmatch ? (__privateSet(this, _queryValue, parseInt(minmatch)), __privateSet(this, _query, `(min-width: ${__privateGet(this, _queryValue)}px)`), __privateSet(this, _queryType, "min")) : (__privateSet(this, _queryValue, 0), __privateSet(this, _query, `(min-width: ${__privateGet(this, _queryValue)}px)`), __privateSet(this, _queryType, "min")), __privateSet(this, _name, __privateGet(this, _name).replace(
34
+ `.${__privateGet(this, _queryValue)}${__privateGet(this, _queryType)}`,
35
+ ""
36
+ )), __privateSet(this, _extension, splitted[splitted.length - 1] === __privateGet(this, _name) ? "" : "." + splitted[splitted.length - 1]), __privateSet(this, _extension, __privateGet(this, _extension).replace(
37
+ `.${__privateGet(this, _queryValue)}${__privateGet(this, _queryType)}`,
38
+ ""
39
+ ));
40
+ }
41
+ get url() {
42
+ return __privateGet(this, _url);
43
+ }
44
+ get name() {
45
+ return __privateGet(this, _name);
46
+ }
47
+ get density() {
48
+ return __privateGet(this, _density);
49
+ }
50
+ get query() {
51
+ return __privateGet(this, _query);
52
+ }
53
+ get extension() {
54
+ return __privateGet(this, _extension);
55
+ }
56
+ get queryType() {
57
+ return __privateGet(this, _queryType);
58
+ }
59
+ get queryValue() {
60
+ return __privateGet(this, _queryValue);
61
+ }
62
+ };
63
+ _url = new WeakMap(), _name = new WeakMap(), _density = new WeakMap(), _query = new WeakMap(), _queryValue = new WeakMap(), _queryType = new WeakMap(), _extension = new WeakMap(), __name(_Source, "Source");
64
+ let Source = _Source;
65
+ var _mediaBuckets;
66
+ const _SourceSet = class _SourceSet {
67
+ constructor(sourceSet, options) {
68
+ __privateAdd(this, _mediaBuckets);
69
+ __privateSet(this, _mediaBuckets, /* @__PURE__ */ new Map());
70
+ const allowMediaBuckets = (options == null ? void 0 : options.mediaBuckets) !== !1, mediaBuckets = typeof sourceSet == "string" ? allowMediaBuckets ? sourceSet.trim().split(",").map((u) => u.trim()).filter((u) => !!u) : [sourceSet] : sourceSet, tmp = [];
71
+ mediaBuckets.forEach((v) => {
72
+ const source = new Source(v);
73
+ tmp.push([source.query, source]);
74
+ });
75
+ const max = tmp.filter((v) => v[1].queryType.includes("max")).sort((a, b) => b[1].queryValue - a[1].queryValue), min = tmp.filter((v) => v[1].queryType.includes("min") && v[1].queryValue !== 0).sort((a, b) => a[1].queryValue - b[1].queryValue), defaultMatch = tmp.filter((t) => t[0] === "(min-width: 0px)");
76
+ (defaultMatch ? [...defaultMatch, ...max, ...min] : [...max, ...min]).forEach((v) => {
77
+ __privateGet(this, _mediaBuckets).has(v[0]) || __privateGet(this, _mediaBuckets).set(v[0], []), __privateGet(this, _mediaBuckets).get(v[0]).push(v[1]);
78
+ });
79
+ }
80
+ get mediaBuckets() {
81
+ return __privateGet(this, _mediaBuckets);
82
+ }
83
+ };
84
+ _mediaBuckets = new WeakMap(), __name(_SourceSet, "SourceSet");
85
+ let SourceSet = _SourceSet;
86
+ var _srcset, _resizeListener;
87
+ const _SourceManager = class _SourceManager extends Store {
88
+ constructor(parameters) {
89
+ super(void 0);
90
+ __privateAdd(this, _srcset);
91
+ __privateAdd(this, _resizeListener, /* @__PURE__ */ __name(() => {
92
+ let matchedSources;
93
+ __privateGet(this, _srcset).mediaBuckets.forEach((sources, query) => {
94
+ matchMedia(query).matches && (matchedSources = sources);
95
+ });
96
+ let matchedSouce, maxDensity = 0;
97
+ matchedSources == null || matchedSources.forEach((s) => {
98
+ s.density > maxDensity && s.density <= Math.max(devicePixelRatio, 1) && (maxDensity = s.density, matchedSouce = s);
99
+ }), matchedSources != null && matchedSources.length && !matchedSouce && (matchedSouce = matchedSources[0]), this.current = matchedSouce;
100
+ }, "#resizeListener"));
101
+ __privateSet(this, _srcset, new SourceSet(parameters.srcset, parameters.sourceSetOptions));
102
+ }
103
+ updateSource(parameters) {
104
+ __privateSet(this, _srcset, new SourceSet(parameters.srcset, parameters.sourceSetOptions)), __privateGet(this, _resizeListener).call(this);
105
+ }
106
+ close() {
107
+ super.close(), this.disconnect();
108
+ }
109
+ connect() {
110
+ windowResizer.subscribe(__privateGet(this, _resizeListener), RESIZE_ORDER.SOURCE_MANAGER), __privateGet(this, _resizeListener).call(this);
111
+ }
112
+ disconnect() {
113
+ windowResizer.unsubscribe(__privateGet(this, _resizeListener));
114
+ }
115
+ };
116
+ _srcset = new WeakMap(), _resizeListener = new WeakMap(), __name(_SourceManager, "SourceManager");
117
+ let SourceManager = _SourceManager, id = 0;
118
+ var _sourceManager, _consumerElement, _consumerHolderElement, _isFirstLoadHappened, _lazyLoaded, _isLazy, _id, _idWithUrl, _status, _intersectionObserver, _clearTimeoutId, _currentURL, _sourceSetOptions, _SourceElement_instances, loadSource_fn, _intersectionListener, _loadListener, _errorListener, _playListener, _pauseListener, _loadedmetadataListener;
119
+ const _SourceElement = class _SourceElement extends HTMLElement {
120
+ constructor(options) {
121
+ super();
122
+ __privateAdd(this, _SourceElement_instances);
123
+ __privateAdd(this, _sourceManager, null);
124
+ __privateAdd(this, _consumerElement, null);
125
+ __privateAdd(this, _consumerHolderElement, this);
126
+ __privateAdd(this, _isFirstLoadHappened, !1);
127
+ __privateAdd(this, _lazyLoaded, !1);
128
+ __privateAdd(this, _isLazy, !1);
129
+ __privateAdd(this, _id, "");
130
+ __privateAdd(this, _idWithUrl, "");
131
+ __privateAdd(this, _status, new ElementLinkedStore(this, {
132
+ loading: !1,
133
+ loaded: !1,
134
+ error: !1,
135
+ clear: !1,
136
+ playing: !1,
137
+ metadata: !1
138
+ }));
139
+ __privateAdd(this, _intersectionObserver, null);
140
+ __privateAdd(this, _clearTimeoutId);
141
+ __privateAdd(this, _currentURL, null);
142
+ __privateAdd(this, _sourceSetOptions);
143
+ __privateAdd(this, _intersectionListener, /* @__PURE__ */ __name((entries) => {
144
+ const entry = entries[0];
145
+ __privateGet(this, _isLazy) && (!__privateGet(this, _lazyLoaded) || this.hasAttribute("reload-source")) && entry.isIntersecting && this.triggerLazyLoad(), entry.isIntersecting ? dispatchEvent(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && (__privateMethod(this, _SourceElement_instances, loadSource_fn).call(this, void 0), __privateSet(this, _lazyLoaded, !1)), dispatchEvent(this, "sourceRelease", { custom: !0 }));
146
+ }, "#intersectionListener"));
147
+ __privateAdd(this, _loadListener, /* @__PURE__ */ __name(() => {
148
+ __privateGet(this, _status).set("loaded", !0), __privateGet(this, _status).set("error", !1), __privateGet(this, _status).set("loading", !1), !__privateGet(this, _isLazy) && !__privateGet(this, _isFirstLoadHappened) && loading.complete(__privateGet(this, _idWithUrl)), dispatchEvent(this, "sourceLoaded", { custom: !0 });
149
+ const clearDuration = getComputedStyle(this).getPropertyValue("--clear-duration");
150
+ clearDuration ? __privateSet(this, _clearTimeoutId, setTimeout(
151
+ () => {
152
+ __privateGet(this, _status).set("clear", !0);
153
+ },
154
+ parseFloat(clearDuration) * 1e3
155
+ )) : __privateGet(this, _status).set("clear", !0), __privateSet(this, _isFirstLoadHappened, !0);
156
+ }, "#loadListener"));
157
+ __privateAdd(this, _errorListener, /* @__PURE__ */ __name((url) => {
158
+ __privateGet(this, _status).set("loaded", !1), __privateGet(this, _status).set("error", !0), __privateGet(this, _status).set("loading", !1), !__privateGet(this, _isLazy) && !__privateGet(this, _isFirstLoadHappened) && loading.error(__privateGet(this, _idWithUrl)), dispatchEvent(this, "sourceError", { custom: !0 }), __privateSet(this, _isFirstLoadHappened, !0);
159
+ }, "#errorListener"));
160
+ __privateAdd(this, _playListener, /* @__PURE__ */ __name(() => {
161
+ __privateGet(this, _status).set("playing", !0), dispatchEvent(this, "sourcePlay", { custom: !0 });
162
+ }, "#playListener"));
163
+ __privateAdd(this, _pauseListener, /* @__PURE__ */ __name(() => {
164
+ __privateGet(this, _status).set("playing", !1), dispatchEvent(this, "sourcePause", { custom: !0 });
165
+ }, "#pauseListener"));
166
+ __privateAdd(this, _loadedmetadataListener, /* @__PURE__ */ __name(() => {
167
+ const consumerElement = __privateGet(this, _consumerElement);
168
+ (consumerElement.tagName === "VIDEO" || consumerElement.tagName === "AUDIO") && consumerElement.readyState >= 1 && (__privateGet(this, _status).set("metadata", !0), dispatchEvent(this, "sourceMetadataLoaded", { custom: !0 }), this.querySelectorAll("[data-source-duration]").forEach((el) => {
169
+ el.textContent = formatMediaDuration(consumerElement.duration);
170
+ }));
171
+ }, "#loadedmetadataListener"));
172
+ __privateSet(this, _sourceSetOptions, options == null ? void 0 : options.sourceSetOptions), isBrowser && window.IntersectionObserver && __privateSet(this, _intersectionObserver, new IntersectionObserver(
173
+ __privateGet(this, _intersectionListener)
174
+ )), __privateGet(this, _status).subscribe((e) => {
175
+ var _a;
176
+ const globalClasses = (_a = this.getAttribute("data-global-play-class")) == null ? void 0 : _a.split(
177
+ ","
178
+ );
179
+ globalClasses != null && globalClasses.length && (e.current.playing ? globalClasses.forEach((className) => {
180
+ document.documentElement.classList.add(className.trim());
181
+ }) : globalClasses.forEach((className) => {
182
+ document.documentElement.classList.remove(className.trim());
183
+ }));
184
+ });
185
+ }
186
+ get consumerElement() {
187
+ return __privateGet(this, _consumerElement);
188
+ }
189
+ get consumerHolderElement() {
190
+ return __privateGet(this, _consumerHolderElement);
191
+ }
192
+ get sourceManager() {
193
+ return __privateGet(this, _sourceManager);
194
+ }
195
+ get status() {
196
+ return __privateGet(this, _status);
197
+ }
198
+ get isLazy() {
199
+ return __privateGet(this, _isLazy);
200
+ }
201
+ get currentURL() {
202
+ return __privateGet(this, _currentURL);
203
+ }
204
+ get isFirstLoadHappened() {
205
+ return __privateGet(this, _isFirstLoadHappened);
206
+ }
207
+ triggerLazyLoad() {
208
+ !__privateGet(this, _lazyLoaded) && __privateGet(this, _sourceManager).current && __privateGet(this, _sourceManager).current !== __privateGet(this, _sourceManager).previous && (__privateSet(this, _lazyLoaded, !0), __privateMethod(this, _SourceElement_instances, loadSource_fn).call(this, __privateGet(this, _sourceManager).current));
209
+ }
210
+ connectedCallback() {
211
+ __privateSet(this, _id, `source-consumer-${++id}`);
212
+ const srcset = this.getAttribute("srcset") || "", notifyElement = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
213
+ notifyElement && __privateGet(this, _status).addElement(notifyElement), __privateSet(this, _consumerHolderElement, this.querySelector("[data-consumer-holder]") || this), this.querySelectorAll(".source-consumer").forEach((el) => el == null ? void 0 : el.remove()), __privateSet(this, _consumerElement, this.createConsumer()), __privateGet(this, _consumerElement).style.cssText = `
214
+ display: block;
215
+ width: 100%;
216
+ height: 100%;
217
+ `, __privateGet(this, _consumerElement).classList.add("source-consumer"), __privateGet(this, _consumerElement).addEventListener("play", __privateGet(this, _playListener)), __privateGet(this, _consumerElement).addEventListener("pause", __privateGet(this, _pauseListener)), __privateGet(this, _consumerElement).addEventListener(
218
+ "loadedmetadata",
219
+ __privateGet(this, _loadedmetadataListener)
220
+ ), __privateGet(this, _loadedmetadataListener).call(this), Array.from(this.attributes).forEach((attr) => {
221
+ if (attr.name !== "srcset") {
222
+ const value = attr.nodeValue || "", camelCased = kebabToCamel(attr.name);
223
+ camelCased in __privateGet(this, _consumerElement) && (__privateGet(this, _consumerElement)[camelCased] = value || !0);
224
+ }
225
+ });
226
+ for (const key in this.dataset) {
227
+ const value = this.dataset[key], camelCased = kebabToCamel(key);
228
+ camelCased in __privateGet(this, _consumerElement) && (__privateGet(this, _consumerElement)[camelCased] = value ? value === "false" ? !1 : value : !0);
229
+ }
230
+ __privateGet(this, _consumerHolderElement).appendChild(__privateGet(this, _consumerElement)), __privateSet(this, _sourceManager, new SourceManager({
231
+ srcset,
232
+ sourceSetOptions: __privateGet(this, _sourceSetOptions)
233
+ })), __privateSet(this, _isLazy, this.hasAttribute("lazy")), __privateGet(this, _sourceManager).subscribe((d) => {
234
+ (!__privateGet(this, _isLazy) || __privateGet(this, _isLazy) && __privateGet(this, _lazyLoaded)) && __privateMethod(this, _SourceElement_instances, loadSource_fn).call(this, d.current);
235
+ }), __privateGet(this, _sourceManager).connect(), __privateGet(this, _intersectionObserver).observe(this);
236
+ }
237
+ disconnectedCallback() {
238
+ var _a;
239
+ clearTimeout(__privateGet(this, _clearTimeoutId)), __privateGet(this, _intersectionObserver).disconnect(), (_a = __privateGet(this, _sourceManager)) == null || _a.close(), __privateGet(this, _consumerElement) && (this.consumeSource(null), __privateGet(this, _consumerElement).removeEventListener("play", __privateGet(this, _playListener)), __privateGet(this, _consumerElement).removeEventListener("pause", __privateGet(this, _pauseListener)), __privateGet(this, _consumerElement).removeEventListener(
240
+ "loadedmetadata",
241
+ __privateGet(this, _loadedmetadataListener)
242
+ ), __privateGet(this, _consumerElement).onloadeddata = null, __privateGet(this, _consumerElement).onload = null, __privateGet(this, _consumerElement).onerror = null, __privateGet(this, _consumerElement).onerror = null, __privateGet(this, _consumerElement).remove()), __privateSet(this, _isFirstLoadHappened, !1), __privateSet(this, _lazyLoaded, !1), __privateGet(this, _status).reset();
243
+ }
244
+ };
245
+ _sourceManager = new WeakMap(), _consumerElement = new WeakMap(), _consumerHolderElement = new WeakMap(), _isFirstLoadHappened = new WeakMap(), _lazyLoaded = new WeakMap(), _isLazy = new WeakMap(), _id = new WeakMap(), _idWithUrl = new WeakMap(), _status = new WeakMap(), _intersectionObserver = new WeakMap(), _clearTimeoutId = new WeakMap(), _currentURL = new WeakMap(), _sourceSetOptions = new WeakMap(), _SourceElement_instances = new WeakSet(), loadSource_fn = /* @__PURE__ */ __name(function(source) {
246
+ if (clearTimeout(__privateGet(this, _clearTimeoutId)), __privateGet(this, _consumerElement).onloadeddata = null, __privateGet(this, _consumerElement).onload = null, __privateGet(this, _consumerElement).onerror = null, __privateGet(this, _status).set("loaded", !1), __privateGet(this, _status).set("error", !1), __privateGet(this, _status).set("loading", !1), __privateGet(this, _status).set("clear", !1), __privateGet(this, _status).set("playing", !1), __privateGet(this, _status).set("metadata", !1), source) {
247
+ __privateSet(this, _idWithUrl, `${__privateGet(this, _id)}-${source.url}`);
248
+ const isKeepSourceParameters = this.hasAttribute("keep-source-parameters");
249
+ __privateGet(this, _status).set("loading", !0), __privateSet(this, _currentURL, isKeepSourceParameters ? source.url : source.name + source.extension), this.consumeSource(__privateGet(this, _currentURL)), !__privateGet(this, _isLazy) && !__privateGet(this, _isFirstLoadHappened) && loading.add(__privateGet(this, _idWithUrl)), __privateGet(this, _consumerElement).onloadeddata = () => {
250
+ __privateGet(this, _loadListener).call(this);
251
+ }, __privateGet(this, _consumerElement).onload = () => {
252
+ __privateGet(this, _loadListener).call(this);
253
+ }, __privateGet(this, _consumerElement).onerror = () => {
254
+ __privateGet(this, _errorListener).call(this, __privateGet(this, _currentURL));
255
+ };
256
+ } else
257
+ __privateSet(this, _currentURL, null), this.consumeSource(null);
258
+ }, "#loadSource"), _intersectionListener = new WeakMap(), _loadListener = new WeakMap(), _errorListener = new WeakMap(), _playListener = new WeakMap(), _pauseListener = new WeakMap(), _loadedmetadataListener = new WeakMap(), __name(_SourceElement, "SourceElement");
259
+ let SourceElement = _SourceElement;
260
+ export {
261
+ Source as S,
262
+ SourceElement as a,
263
+ SourceSet as b,
264
+ SourceManager as c
265
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __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);const elementLinkedStore_index=require("./element-linked-store/index.cjs"),loading_index=require("./loading/index.cjs"),intersector_index=require("./index-BpO2RJ__.cjs"),events=require("./events-UlGk63iC.cjs"),string=require("./string-CbRNzmd9.cjs"),metadata=require("./metadata-BrHUfpV9.cjs");require("construct-style-sheets-polyfill");const order_index=require("./order/index.cjs"),windowResizer_index=require("./window-resizer/index.cjs"),Store=require("./Store-BCW70G3Z.cjs");var _url,_name,_density,_query,_queryValue,_queryType,_extension;const _Source=class _Source{constructor(url){__privateAdd(this,_url);__privateAdd(this,_name);__privateAdd(this,_density);__privateAdd(this,_query);__privateAdd(this,_queryValue);__privateAdd(this,_queryType);__privateAdd(this,_extension);__privateSet(this,_url,url);let splitted=url.split(".");const xpattern=/\b\d{1,2}x\b/g,xmatch=splitted.find(s=>s.match(xpattern)&&parseInt(s));__privateSet(this,_density,xmatch?parseInt(xmatch):1),xmatch&&(splitted=splitted.slice(0,-1)),__privateSet(this,_name,splitted.length>1?splitted.slice(0,-1).join("."):splitted.join("."));const maxpattern=/\d+max/g,minpattern=/\d+min/g,maxAspectPattern=/\d+mar/g,minAspectPattern=/\d+mir/g,maxmatch=splitted.find(s=>s.match(maxpattern)),minmatch=splitted.find(s=>s.match(minpattern)),maxRatioMatch=splitted.find(s=>s.match(maxAspectPattern)),minRatioMatch=splitted.find(s=>s.match(minAspectPattern));maxRatioMatch?(__privateSet(this,_queryValue,parseInt(maxRatioMatch)),__privateSet(this,_queryType,"max"),__privateSet(this,_query,`(max-aspect-ratio: ${__privateGet(this,_queryValue)})`)):minRatioMatch?(__privateSet(this,_queryValue,parseInt(minRatioMatch)),__privateSet(this,_queryType,"max"),__privateSet(this,_query,`(min-aspect-ratio: ${__privateGet(this,_queryValue)})`)):maxmatch?(__privateSet(this,_queryValue,parseInt(maxmatch)),__privateSet(this,_queryType,"max"),__privateSet(this,_query,`(max-width: ${__privateGet(this,_queryValue)}px)`)):minmatch?(__privateSet(this,_queryValue,parseInt(minmatch)),__privateSet(this,_query,`(min-width: ${__privateGet(this,_queryValue)}px)`),__privateSet(this,_queryType,"min")):(__privateSet(this,_queryValue,0),__privateSet(this,_query,`(min-width: ${__privateGet(this,_queryValue)}px)`),__privateSet(this,_queryType,"min")),__privateSet(this,_name,__privateGet(this,_name).replace(`.${__privateGet(this,_queryValue)}${__privateGet(this,_queryType)}`,"")),__privateSet(this,_extension,splitted[splitted.length-1]===__privateGet(this,_name)?"":"."+splitted[splitted.length-1]),__privateSet(this,_extension,__privateGet(this,_extension).replace(`.${__privateGet(this,_queryValue)}${__privateGet(this,_queryType)}`,""))}get url(){return __privateGet(this,_url)}get name(){return __privateGet(this,_name)}get density(){return __privateGet(this,_density)}get query(){return __privateGet(this,_query)}get extension(){return __privateGet(this,_extension)}get queryType(){return __privateGet(this,_queryType)}get queryValue(){return __privateGet(this,_queryValue)}};_url=new WeakMap,_name=new WeakMap,_density=new WeakMap,_query=new WeakMap,_queryValue=new WeakMap,_queryType=new WeakMap,_extension=new WeakMap,__name(_Source,"Source");let Source=_Source;var _mediaBuckets;const _SourceSet=class _SourceSet{constructor(sourceSet,options){__privateAdd(this,_mediaBuckets);__privateSet(this,_mediaBuckets,new Map);const allowMediaBuckets=(options==null?void 0:options.mediaBuckets)!==!1,mediaBuckets=typeof sourceSet=="string"?allowMediaBuckets?sourceSet.trim().split(",").map(u=>u.trim()).filter(u=>!!u):[sourceSet]:sourceSet,tmp=[];mediaBuckets.forEach(v=>{const source=new Source(v);tmp.push([source.query,source])});const max=tmp.filter(v=>v[1].queryType.includes("max")).sort((a,b)=>b[1].queryValue-a[1].queryValue),min=tmp.filter(v=>v[1].queryType.includes("min")&&v[1].queryValue!==0).sort((a,b)=>a[1].queryValue-b[1].queryValue),defaultMatch=tmp.filter(t=>t[0]==="(min-width: 0px)");(defaultMatch?[...defaultMatch,...max,...min]:[...max,...min]).forEach(v=>{__privateGet(this,_mediaBuckets).has(v[0])||__privateGet(this,_mediaBuckets).set(v[0],[]),__privateGet(this,_mediaBuckets).get(v[0]).push(v[1])})}get mediaBuckets(){return __privateGet(this,_mediaBuckets)}};_mediaBuckets=new WeakMap,__name(_SourceSet,"SourceSet");let SourceSet=_SourceSet;var _srcset,_resizeListener;const _SourceManager=class _SourceManager extends Store.Store{constructor(parameters){super(void 0);__privateAdd(this,_srcset);__privateAdd(this,_resizeListener,__name(()=>{let matchedSources;__privateGet(this,_srcset).mediaBuckets.forEach((sources,query)=>{matchMedia(query).matches&&(matchedSources=sources)});let matchedSouce,maxDensity=0;matchedSources==null||matchedSources.forEach(s=>{s.density>maxDensity&&s.density<=Math.max(devicePixelRatio,1)&&(maxDensity=s.density,matchedSouce=s)}),matchedSources!=null&&matchedSources.length&&!matchedSouce&&(matchedSouce=matchedSources[0]),this.current=matchedSouce},"#resizeListener"));__privateSet(this,_srcset,new SourceSet(parameters.srcset,parameters.sourceSetOptions))}updateSource(parameters){__privateSet(this,_srcset,new SourceSet(parameters.srcset,parameters.sourceSetOptions)),__privateGet(this,_resizeListener).call(this)}close(){super.close(),this.disconnect()}connect(){windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.SOURCE_MANAGER),__privateGet(this,_resizeListener).call(this)}disconnect(){windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener))}};_srcset=new WeakMap,_resizeListener=new WeakMap,__name(_SourceManager,"SourceManager");let SourceManager=_SourceManager,id=0;var _sourceManager,_consumerElement,_consumerHolderElement,_isFirstLoadHappened,_lazyLoaded,_isLazy,_id,_idWithUrl,_status,_intersectionObserver,_clearTimeoutId,_currentURL,_sourceSetOptions,_SourceElement_instances,loadSource_fn,_intersectionListener,_loadListener,_errorListener,_playListener,_pauseListener,_loadedmetadataListener;const _SourceElement=class _SourceElement extends HTMLElement{constructor(options){super();__privateAdd(this,_SourceElement_instances);__privateAdd(this,_sourceManager,null);__privateAdd(this,_consumerElement,null);__privateAdd(this,_consumerHolderElement,this);__privateAdd(this,_isFirstLoadHappened,!1);__privateAdd(this,_lazyLoaded,!1);__privateAdd(this,_isLazy,!1);__privateAdd(this,_id,"");__privateAdd(this,_idWithUrl,"");__privateAdd(this,_status,new elementLinkedStore_index.ElementLinkedStore(this,{loading:!1,loaded:!1,error:!1,clear:!1,playing:!1,metadata:!1}));__privateAdd(this,_intersectionObserver,null);__privateAdd(this,_clearTimeoutId);__privateAdd(this,_currentURL,null);__privateAdd(this,_sourceSetOptions);__privateAdd(this,_intersectionListener,__name(entries=>{const entry=entries[0];__privateGet(this,_isLazy)&&(!__privateGet(this,_lazyLoaded)||this.hasAttribute("reload-source"))&&entry.isIntersecting&&this.triggerLazyLoad(),entry.isIntersecting?events.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&(__privateMethod(this,_SourceElement_instances,loadSource_fn).call(this,void 0),__privateSet(this,_lazyLoaded,!1)),events.dispatchEvent(this,"sourceRelease",{custom:!0}))},"#intersectionListener"));__privateAdd(this,_loadListener,__name(()=>{__privateGet(this,_status).set("loaded",!0),__privateGet(this,_status).set("error",!1),__privateGet(this,_status).set("loading",!1),!__privateGet(this,_isLazy)&&!__privateGet(this,_isFirstLoadHappened)&&loading_index.loading.complete(__privateGet(this,_idWithUrl)),events.dispatchEvent(this,"sourceLoaded",{custom:!0});const clearDuration=getComputedStyle(this).getPropertyValue("--clear-duration");clearDuration?__privateSet(this,_clearTimeoutId,setTimeout(()=>{__privateGet(this,_status).set("clear",!0)},parseFloat(clearDuration)*1e3)):__privateGet(this,_status).set("clear",!0),__privateSet(this,_isFirstLoadHappened,!0)},"#loadListener"));__privateAdd(this,_errorListener,__name(url=>{__privateGet(this,_status).set("loaded",!1),__privateGet(this,_status).set("error",!0),__privateGet(this,_status).set("loading",!1),!__privateGet(this,_isLazy)&&!__privateGet(this,_isFirstLoadHappened)&&loading_index.loading.error(__privateGet(this,_idWithUrl)),events.dispatchEvent(this,"sourceError",{custom:!0}),__privateSet(this,_isFirstLoadHappened,!0)},"#errorListener"));__privateAdd(this,_playListener,__name(()=>{__privateGet(this,_status).set("playing",!0),events.dispatchEvent(this,"sourcePlay",{custom:!0})},"#playListener"));__privateAdd(this,_pauseListener,__name(()=>{__privateGet(this,_status).set("playing",!1),events.dispatchEvent(this,"sourcePause",{custom:!0})},"#pauseListener"));__privateAdd(this,_loadedmetadataListener,__name(()=>{const consumerElement=__privateGet(this,_consumerElement);(consumerElement.tagName==="VIDEO"||consumerElement.tagName==="AUDIO")&&consumerElement.readyState>=1&&(__privateGet(this,_status).set("metadata",!0),events.dispatchEvent(this,"sourceMetadataLoaded",{custom:!0}),this.querySelectorAll("[data-source-duration]").forEach(el=>{el.textContent=metadata.formatMediaDuration(consumerElement.duration)}))},"#loadedmetadataListener"));__privateSet(this,_sourceSetOptions,options==null?void 0:options.sourceSetOptions),intersector_index.isBrowser&&window.IntersectionObserver&&__privateSet(this,_intersectionObserver,new IntersectionObserver(__privateGet(this,_intersectionListener))),__privateGet(this,_status).subscribe(e=>{var _a;const globalClasses=(_a=this.getAttribute("data-global-play-class"))==null?void 0:_a.split(",");globalClasses!=null&&globalClasses.length&&(e.current.playing?globalClasses.forEach(className=>{document.documentElement.classList.add(className.trim())}):globalClasses.forEach(className=>{document.documentElement.classList.remove(className.trim())}))})}get consumerElement(){return __privateGet(this,_consumerElement)}get consumerHolderElement(){return __privateGet(this,_consumerHolderElement)}get sourceManager(){return __privateGet(this,_sourceManager)}get status(){return __privateGet(this,_status)}get isLazy(){return __privateGet(this,_isLazy)}get currentURL(){return __privateGet(this,_currentURL)}get isFirstLoadHappened(){return __privateGet(this,_isFirstLoadHappened)}triggerLazyLoad(){!__privateGet(this,_lazyLoaded)&&__privateGet(this,_sourceManager).current&&__privateGet(this,_sourceManager).current!==__privateGet(this,_sourceManager).previous&&(__privateSet(this,_lazyLoaded,!0),__privateMethod(this,_SourceElement_instances,loadSource_fn).call(this,__privateGet(this,_sourceManager).current))}connectedCallback(){__privateSet(this,_id,`source-consumer-${++id}`);const srcset=this.getAttribute("srcset")||"",notifyElement=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;notifyElement&&__privateGet(this,_status).addElement(notifyElement),__privateSet(this,_consumerHolderElement,this.querySelector("[data-consumer-holder]")||this),this.querySelectorAll(".source-consumer").forEach(el=>el==null?void 0:el.remove()),__privateSet(this,_consumerElement,this.createConsumer()),__privateGet(this,_consumerElement).style.cssText=`
2
+ display: block;
3
+ width: 100%;
4
+ height: 100%;
5
+ `,__privateGet(this,_consumerElement).classList.add("source-consumer"),__privateGet(this,_consumerElement).addEventListener("play",__privateGet(this,_playListener)),__privateGet(this,_consumerElement).addEventListener("pause",__privateGet(this,_pauseListener)),__privateGet(this,_consumerElement).addEventListener("loadedmetadata",__privateGet(this,_loadedmetadataListener)),__privateGet(this,_loadedmetadataListener).call(this),Array.from(this.attributes).forEach(attr=>{if(attr.name!=="srcset"){const value=attr.nodeValue||"",camelCased=string.kebabToCamel(attr.name);camelCased in __privateGet(this,_consumerElement)&&(__privateGet(this,_consumerElement)[camelCased]=value||!0)}});for(const key in this.dataset){const value=this.dataset[key],camelCased=string.kebabToCamel(key);camelCased in __privateGet(this,_consumerElement)&&(__privateGet(this,_consumerElement)[camelCased]=value?value==="false"?!1:value:!0)}__privateGet(this,_consumerHolderElement).appendChild(__privateGet(this,_consumerElement)),__privateSet(this,_sourceManager,new SourceManager({srcset,sourceSetOptions:__privateGet(this,_sourceSetOptions)})),__privateSet(this,_isLazy,this.hasAttribute("lazy")),__privateGet(this,_sourceManager).subscribe(d=>{(!__privateGet(this,_isLazy)||__privateGet(this,_isLazy)&&__privateGet(this,_lazyLoaded))&&__privateMethod(this,_SourceElement_instances,loadSource_fn).call(this,d.current)}),__privateGet(this,_sourceManager).connect(),__privateGet(this,_intersectionObserver).observe(this)}disconnectedCallback(){var _a;clearTimeout(__privateGet(this,_clearTimeoutId)),__privateGet(this,_intersectionObserver).disconnect(),(_a=__privateGet(this,_sourceManager))==null||_a.close(),__privateGet(this,_consumerElement)&&(this.consumeSource(null),__privateGet(this,_consumerElement).removeEventListener("play",__privateGet(this,_playListener)),__privateGet(this,_consumerElement).removeEventListener("pause",__privateGet(this,_pauseListener)),__privateGet(this,_consumerElement).removeEventListener("loadedmetadata",__privateGet(this,_loadedmetadataListener)),__privateGet(this,_consumerElement).onloadeddata=null,__privateGet(this,_consumerElement).onload=null,__privateGet(this,_consumerElement).onerror=null,__privateGet(this,_consumerElement).onerror=null,__privateGet(this,_consumerElement).remove()),__privateSet(this,_isFirstLoadHappened,!1),__privateSet(this,_lazyLoaded,!1),__privateGet(this,_status).reset()}};_sourceManager=new WeakMap,_consumerElement=new WeakMap,_consumerHolderElement=new WeakMap,_isFirstLoadHappened=new WeakMap,_lazyLoaded=new WeakMap,_isLazy=new WeakMap,_id=new WeakMap,_idWithUrl=new WeakMap,_status=new WeakMap,_intersectionObserver=new WeakMap,_clearTimeoutId=new WeakMap,_currentURL=new WeakMap,_sourceSetOptions=new WeakMap,_SourceElement_instances=new WeakSet,loadSource_fn=__name(function(source){if(clearTimeout(__privateGet(this,_clearTimeoutId)),__privateGet(this,_consumerElement).onloadeddata=null,__privateGet(this,_consumerElement).onload=null,__privateGet(this,_consumerElement).onerror=null,__privateGet(this,_status).set("loaded",!1),__privateGet(this,_status).set("error",!1),__privateGet(this,_status).set("loading",!1),__privateGet(this,_status).set("clear",!1),__privateGet(this,_status).set("playing",!1),__privateGet(this,_status).set("metadata",!1),source){__privateSet(this,_idWithUrl,`${__privateGet(this,_id)}-${source.url}`);const isKeepSourceParameters=this.hasAttribute("keep-source-parameters");__privateGet(this,_status).set("loading",!0),__privateSet(this,_currentURL,isKeepSourceParameters?source.url:source.name+source.extension),this.consumeSource(__privateGet(this,_currentURL)),!__privateGet(this,_isLazy)&&!__privateGet(this,_isFirstLoadHappened)&&loading_index.loading.add(__privateGet(this,_idWithUrl)),__privateGet(this,_consumerElement).onloadeddata=()=>{__privateGet(this,_loadListener).call(this)},__privateGet(this,_consumerElement).onload=()=>{__privateGet(this,_loadListener).call(this)},__privateGet(this,_consumerElement).onerror=()=>{__privateGet(this,_errorListener).call(this,__privateGet(this,_currentURL))}}else __privateSet(this,_currentURL,null),this.consumeSource(null)},"#loadSource"),_intersectionListener=new WeakMap,_loadListener=new WeakMap,_errorListener=new WeakMap,_playListener=new WeakMap,_pauseListener=new WeakMap,_loadedmetadataListener=new WeakMap,__name(_SourceElement,"SourceElement");let SourceElement=_SourceElement;exports.Source=Source;exports.SourceElement=SourceElement;exports.SourceManager=SourceManager;exports.SourceSet=SourceSet;
@@ -0,0 +1 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __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);const notifier_index=require("./notifier/index.cjs"),string=require("./string-CbRNzmd9.cjs");require("construct-style-sheets-polyfill");const intersector_index=require("./index-BpO2RJ__.cjs");var _loadedState;const _StoreRegistry=class _StoreRegistry{constructor(){__privateAdd(this,_loadedState);this.storage=null,this.name="store-registry",__privateSet(this,_loadedState,null),intersector_index.isBrowser&&(this.storage=localStorage)}get loadedState(){return __privateGet(this,_loadedState)}saveState(){const fullState=this.getState(),stringState=JSON.stringify(fullState);localStorage.setItem(this.name,stringState)}loadState(state=localStorage.getItem(this.name)){state&&(typeof state=="string"?__privateSet(this,_loadedState,JSON.parse(state)):__privateSet(this,_loadedState,state),activeStores.current.forEach(store=>{store.name&&this.updateStore(store)}))}resetState(){activeStores.current.forEach(store=>{store.name&&store.reset()}),this.saveState()}updateStore(store){var _a,_b;if(!Array.isArray((_a=__privateGet(this,_loadedState))==null?void 0:_a.stores))return store;if(store.name){const match=(_b=__privateGet(this,_loadedState))==null?void 0:_b.stores.find(s=>s.name===store.name);match&&(store.current=match.value)}return store}getState(){const state={stores:[]};return activeStores.current.forEach(store=>{store.name&&(state.stores.find(s=>s.name===store.name)||state.stores.push({value:store.current,name:store.name}))}),state}};_loadedState=new WeakMap,__name(_StoreRegistry,"StoreRegistry");let StoreRegistry=_StoreRegistry;const storeRegistry=new StoreRegistry;var _name,_state,_equalityCheck,_notifier,_skipSubscribeNotification,_middlewares,_notifyAndClose,_invisible,_id;const _Store=class _Store{constructor(value,options){__privateAdd(this,_name);__privateAdd(this,_state);__privateAdd(this,_equalityCheck);__privateAdd(this,_notifier,new notifier_index.Notifier);__privateAdd(this,_skipSubscribeNotification);__privateAdd(this,_middlewares);__privateAdd(this,_notifyAndClose);__privateAdd(this,_invisible);__privateAdd(this,_id,"store-"+string.generateId(10));__privateSet(this,_name,options==null?void 0:options.name),this.__manager=options==null?void 0:options.__manager,__privateSet(this,_state,{initial:value,previous:void 0,current:value}),__privateSet(this,_equalityCheck,(options==null?void 0:options.equalityCheck)||((currentValue,newValue)=>currentValue===newValue)),options!=null&&options.validate&&this.addMiddleware(options.validate),__privateSet(this,_notifyAndClose,(options==null?void 0:options.notifyAndClose)||!1),__privateSet(this,_invisible,(options==null?void 0:options.invisible)||!1),__privateSet(this,_skipSubscribeNotification,(options==null?void 0:options.skipSubscribeNotification)||!1),__privateGet(this,_name)&&storeRegistry.updateStore(this)}get id(){return __privateGet(this,_id)}get name(){return __privateGet(this,_name)}get initial(){return __privateGet(this,_state).initial}get previous(){return __privateGet(this,_state).previous}get current(){return __privateGet(this,_state).current}set current(value){if(!__privateGet(this,_equalityCheck).call(this,__privateGet(this,_state).current,value)){if(__privateGet(this,_state).previous=__privateGet(this,_state).current,__privateGet(this,_middlewares))for(const middleware of __privateGet(this,_middlewares))value=middleware(value);__privateGet(this,_state).current=value,this.notify(),__privateGet(this,_notifyAndClose)&&this.close()}}setCurrent(value){this.current=value}update(callback){this.current=callback(this.current)}add(value){Array.isArray(this.current)&&(this.current=[...this.current,value])}filter(callback){Array.isArray(this.current)&&(this.current=this.current.filter(callback))}get subscribers(){return __privateGet(this,_notifier).subscribers}notify(){__privateGet(this,_notifier).notify(__privateGet(this,_state))}addMiddleware(middleware){__privateGet(this,_middlewares)||__privateSet(this,_middlewares,new Set),__privateGet(this,_middlewares).add(middleware)}removeMiddleware(middleware){var _a,_b;(_a=__privateGet(this,_middlewares))==null||_a.delete(middleware),(_b=__privateGet(this,_middlewares))!=null&&_b.size||__privateSet(this,_middlewares,void 0)}subscribe(callback,order){return!__privateGet(this,_invisible)&&!__privateGet(this,_notifier).size&&shareStore(this),__privateGet(this,_notifier).subscribe(callback,order),__privateGet(this,_skipSubscribeNotification)||callback(__privateGet(this,_state)),()=>{this.unsubscribe(callback)}}unsubscribe(callback){__privateGet(this,_notifier).unsubscribe(callback),__privateGet(this,_notifier).size||unshareStore(this)}reset(){this.current=Array.isArray(this.initial)?[...this.initial]:this.initial}close(){__privateGet(this,_notifier).close(),__privateGet(this,_state).previous=void 0,__privateGet(this,_state).current=__privateGet(this,_state).initial,unshareStore(this)}};_name=new WeakMap,_state=new WeakMap,_equalityCheck=new WeakMap,_notifier=new WeakMap,_skipSubscribeNotification=new WeakMap,_middlewares=new WeakMap,_notifyAndClose=new WeakMap,_invisible=new WeakMap,_id=new WeakMap,__name(_Store,"Store");let Store=_Store;const activeStores=new Store([],{invisible:!0});function shareStore(store){activeStores.current.includes(store)||(activeStores.current=[...activeStores.current,store])}__name(shareStore,"shareStore");function unshareStore(store){activeStores.current.includes(store)&&(activeStores.current=activeStores.current.filter(s=>s!==store))}__name(unshareStore,"unshareStore");exports.Store=Store;exports.activeStores=activeStores;exports.storeRegistry=storeRegistry;