@supersoniks/concorde 5.0.0 → 5.0.2

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 (314) hide show
  1. package/.gitlab-ci.yml +0 -13
  2. package/build-infos.json +1 -1
  3. package/concorde-core.bundle.js +606 -689
  4. package/concorde-core.es.js +4511 -4329
  5. package/dist/concorde-core.bundle.js +606 -689
  6. package/dist/concorde-core.es.js +4511 -4329
  7. package/gitlab/job_tests.sh +25 -12
  8. package/index.html +3 -3
  9. package/package.json +16 -1
  10. package/scripts/post-build-docs.js +0 -0
  11. package/scripts/post-build.mjs +0 -0
  12. package/src/core/components/functional/fetch/fetch.md +0 -0
  13. package/src/core/components/functional/if/if.md +0 -0
  14. package/src/core/components/functional/list/list.demo.ts +0 -0
  15. package/src/core/components/functional/list/list.md +0 -0
  16. package/src/core/components/functional/list/list.ts +0 -0
  17. package/src/core/components/functional/router/router.md +0 -0
  18. package/src/core/components/functional/router/router.ts +0 -0
  19. package/src/core/components/functional/sdui/sdui.md +0 -0
  20. package/src/core/components/functional/states/states.md +0 -0
  21. package/src/core/components/functional/submit/submit.md +0 -0
  22. package/src/core/components/ui/_css/rounded.ts +36 -0
  23. package/src/core/components/ui/_css/size.ts +0 -0
  24. package/src/core/components/ui/_css/type.ts +49 -0
  25. package/src/core/components/ui/_i18n/ui-aria-labels.ts +104 -0
  26. package/src/core/components/ui/alert/alert.md +128 -72
  27. package/src/core/components/ui/alert/alert.spec.ts +145 -0
  28. package/src/core/components/ui/alert/alert.ts +86 -91
  29. package/src/core/components/ui/alert-messages/alert-messages.ts +1 -1
  30. package/src/core/components/ui/badge/badge.md +126 -78
  31. package/src/core/components/ui/badge/badge.ts +29 -81
  32. package/src/core/components/ui/button/button.md +1 -0
  33. package/src/core/components/ui/button/button.ts +11 -8
  34. package/src/core/components/ui/captcha/altchaStyles.ts +0 -0
  35. package/src/core/components/ui/captcha/captcha.md +0 -0
  36. package/src/core/components/ui/card/card-header.ts +7 -2
  37. package/src/core/components/ui/card/card.md +120 -65
  38. package/src/core/components/ui/divider/divider.ts +4 -9
  39. package/src/core/components/ui/form/fieldset/legend-description.ts +1 -1
  40. package/src/core/components/ui/form/fieldset/legend.ts +1 -1
  41. package/src/core/components/ui/form/input/input.md +1 -1
  42. package/src/core/components/ui/form/input/input.ts +19 -15
  43. package/src/core/components/ui/form/radio/radio.md +0 -0
  44. package/src/core/components/ui/form/select/select.md +0 -0
  45. package/src/core/components/ui/form/switch/switch.md +0 -0
  46. package/src/core/components/ui/form/textarea/textarea.md +1 -1
  47. package/src/core/components/ui/image/image.md +147 -53
  48. package/src/core/components/ui/image/image.ts +10 -44
  49. package/src/core/components/ui/link/link.md +2 -2
  50. package/src/core/components/ui/link/link.ts +42 -37
  51. package/src/core/components/ui/loader/loader.md +0 -0
  52. package/src/core/components/ui/menu/menu.md +0 -0
  53. package/src/core/components/ui/modal/modal-close.ts +8 -12
  54. package/src/core/components/ui/modal/modal.md +0 -0
  55. package/src/core/components/ui/modal/modal.ts +18 -18
  56. package/src/core/components/ui/pop/pop.md +105 -1
  57. package/src/core/components/ui/pop/pop.ts +143 -148
  58. package/src/core/components/ui/table/table-caption.ts +0 -0
  59. package/src/core/components/ui/table/table.md +0 -0
  60. package/src/core/components/ui/table/table.ts +2 -8
  61. package/src/core/components/ui/theme/theme.ts +1 -1
  62. package/src/core/components/ui/toast/dismissed.ts +14 -0
  63. package/src/core/components/ui/toast/toast-item.ts +139 -91
  64. package/src/core/components/ui/toast/toast.ts +4 -7
  65. package/src/core/components/ui/tooltip/tooltip.ts +176 -154
  66. package/src/core/utils/LocationHandler.ts +12 -5
  67. package/src/core/utils/dismissed.ts +22 -0
  68. package/src/core/utils/positioning.spec.ts +208 -0
  69. package/src/core/utils/positioning.ts +183 -0
  70. package/src/core/utils/route.ts +0 -0
  71. package/src/directives.ts +2 -3
  72. package/src/docs/_core-concept/subscriber.md +0 -0
  73. package/src/docs/_getting-started/concorde-outside.md +3 -3
  74. package/src/docs/_getting-started/my-first-subscriber.md +0 -0
  75. package/src/docs/_getting-started/pubsub.md +0 -0
  76. package/src/docs/_getting-started/start.md +0 -0
  77. package/src/docs/code.ts +3 -1
  78. package/src/docs/example/users.ts +0 -0
  79. package/src/docs/search/docs-search.json +651 -21
  80. package/src/docs/search/page.ts +0 -0
  81. package/src/docs/tailwind/css/tailwind.css +13 -6
  82. package/src/tsconfig.json +45 -0
  83. package/src/tsconfig.tsbuildinfo +1 -1
  84. package/tailwind.config.js +50 -3
  85. package/vitest.setup.ts +49 -13
  86. package/.github/workflows/ci.yml +0 -21
  87. package/.github-export-ignore +0 -30
  88. package/CONTRIBUTING.md +0 -59
  89. package/DEV.md +0 -54
  90. package/LICENSE +0 -21
  91. package/OPEN_SOURCE_CHECKPOINT.md +0 -133
  92. package/concorde-3d.bundle.js +0 -3960
  93. package/concorde-3d.es.js +0 -33433
  94. package/concorde-hugging-face-infer.bundle.js +0 -32
  95. package/concorde-hugging-face-infer.es.js +0 -2952
  96. package/concorde-shader.bundle.js +0 -116
  97. package/concorde-shader.es.js +0 -8353
  98. package/concorde-webgpu.bundle.js +0 -307
  99. package/concorde-webgpu.es.js +0 -8627
  100. package/docs/altcha-widget.js +0 -2662
  101. package/docs/assets/index-BZiZXMU-.css +0 -1
  102. package/docs/assets/index-FmK4JaIM.js +0 -11992
  103. package/docs/crawl/core/components/functional/date/date.html +0 -190
  104. package/docs/crawl/core/components/functional/fetch/fetch.html +0 -109
  105. package/docs/crawl/core/components/functional/if/if.html +0 -27
  106. package/docs/crawl/core/components/functional/jsonata/jsonata.html +0 -79
  107. package/docs/crawl/core/components/functional/list/list.html +0 -70
  108. package/docs/crawl/core/components/functional/mix/mix.html +0 -45
  109. package/docs/crawl/core/components/functional/queue/queue.html +0 -96
  110. package/docs/crawl/core/components/functional/router/router.html +0 -106
  111. package/docs/crawl/core/components/functional/sdui/sdui.html +0 -269
  112. package/docs/crawl/core/components/functional/states/states.html +0 -66
  113. package/docs/crawl/core/components/functional/submit/submit.html +0 -160
  114. package/docs/crawl/core/components/functional/subscriber/subscriber.html +0 -67
  115. package/docs/crawl/core/components/functional/value/value.html +0 -51
  116. package/docs/crawl/core/components/ui/alert/alert.html +0 -110
  117. package/docs/crawl/core/components/ui/alert-messages/alert-messages.html +0 -23
  118. package/docs/crawl/core/components/ui/badge/badge.html +0 -119
  119. package/docs/crawl/core/components/ui/button/button.html +0 -149
  120. package/docs/crawl/core/components/ui/captcha/captcha.html +0 -30
  121. package/docs/crawl/core/components/ui/card/card.html +0 -99
  122. package/docs/crawl/core/components/ui/divider/divider.html +0 -58
  123. package/docs/crawl/core/components/ui/form/checkbox/checkbox.html +0 -73
  124. package/docs/crawl/core/components/ui/form/fieldset/fieldset.html +0 -135
  125. package/docs/crawl/core/components/ui/form/form-actions/form-actions.html +0 -79
  126. package/docs/crawl/core/components/ui/form/form-layout/form-layout.html +0 -62
  127. package/docs/crawl/core/components/ui/form/input/input.html +0 -109
  128. package/docs/crawl/core/components/ui/form/input-autocomplete/input-autocomplete.html +0 -106
  129. package/docs/crawl/core/components/ui/form/radio/radio.html +0 -56
  130. package/docs/crawl/core/components/ui/form/select/select.html +0 -73
  131. package/docs/crawl/core/components/ui/form/switch/switch.html +0 -56
  132. package/docs/crawl/core/components/ui/form/textarea/textarea.html +0 -59
  133. package/docs/crawl/core/components/ui/group/group.html +0 -82
  134. package/docs/crawl/core/components/ui/icon/icon.html +0 -133
  135. package/docs/crawl/core/components/ui/image/image.html +0 -110
  136. package/docs/crawl/core/components/ui/link/link.html +0 -42
  137. package/docs/crawl/core/components/ui/loader/loader.html +0 -50
  138. package/docs/crawl/core/components/ui/menu/menu.html +0 -322
  139. package/docs/crawl/core/components/ui/modal/modal.html +0 -117
  140. package/docs/crawl/core/components/ui/pop/pop.html +0 -102
  141. package/docs/crawl/core/components/ui/progress/progress.html +0 -58
  142. package/docs/crawl/core/components/ui/table/table.html +0 -413
  143. package/docs/crawl/core/components/ui/toast/toast.html +0 -122
  144. package/docs/crawl/core/components/ui/tooltip/tooltip.html +0 -79
  145. package/docs/crawl/docs/_core-concept/dataFlow.html +0 -177
  146. package/docs/crawl/docs/_core-concept/overview.html +0 -66
  147. package/docs/crawl/docs/_core-concept/subscriber.html +0 -75
  148. package/docs/crawl/docs/_decorators/ancestor-attribute.html +0 -116
  149. package/docs/crawl/docs/_decorators/auto-subscribe.html +0 -202
  150. package/docs/crawl/docs/_decorators/bind.html +0 -141
  151. package/docs/crawl/docs/_decorators/get.html +0 -149
  152. package/docs/crawl/docs/_decorators/handle.html +0 -165
  153. package/docs/crawl/docs/_decorators/on-assign.html +0 -355
  154. package/docs/crawl/docs/_decorators/patch.html +0 -78
  155. package/docs/crawl/docs/_decorators/post.html +0 -139
  156. package/docs/crawl/docs/_decorators/publish.html +0 -61
  157. package/docs/crawl/docs/_decorators/put.html +0 -78
  158. package/docs/crawl/docs/_decorators/subscribe.html +0 -109
  159. package/docs/crawl/docs/_decorators/wait-for-ancestors.html +0 -137
  160. package/docs/crawl/docs/_directives/sub.html +0 -93
  161. package/docs/crawl/docs/_getting-started/ai-agents.html +0 -173
  162. package/docs/crawl/docs/_getting-started/concorde-manual-install.html +0 -100
  163. package/docs/crawl/docs/_getting-started/concorde-outside.html +0 -58
  164. package/docs/crawl/docs/_getting-started/create-a-component.html +0 -111
  165. package/docs/crawl/docs/_getting-started/my-first-component.html +0 -189
  166. package/docs/crawl/docs/_getting-started/my-first-subscriber.html +0 -110
  167. package/docs/crawl/docs/_getting-started/pubsub.html +0 -62
  168. package/docs/crawl/docs/_getting-started/start.html +0 -76
  169. package/docs/crawl/docs/_getting-started/theming.html +0 -85
  170. package/docs/crawl/docs/_misc/api-configuration.html +0 -149
  171. package/docs/crawl/docs/_misc/dataProviderKey.html +0 -135
  172. package/docs/crawl/docs/_misc/docs-mock-api.html +0 -158
  173. package/docs/crawl/docs/_misc/dynamic-path.html +0 -180
  174. package/docs/crawl/docs/_misc/endpoint.html +0 -50
  175. package/docs/crawl/docs/_misc/formelement-subscriber-removal.html +0 -138
  176. package/docs/crawl/docs/_misc/html-integration.html +0 -48
  177. package/docs/crawl/hubs/decorators.html +0 -547
  178. package/docs/crawl/hubs/form-components.html +0 -357
  179. package/docs/crawl/hubs/remote-data.html +0 -452
  180. package/docs/crawl/index.html +0 -101
  181. package/docs/css/docs.css +0 -0
  182. package/docs/docs-mock-api-sw.js +0 -720
  183. package/docs/docs-mock-api-sw.js.map +0 -7
  184. package/docs/fonts/ClashGrotesk-Bold.eot +0 -0
  185. package/docs/fonts/ClashGrotesk-Bold.ttf +0 -0
  186. package/docs/fonts/ClashGrotesk-Bold.woff +0 -0
  187. package/docs/fonts/ClashGrotesk-Bold.woff2 +0 -0
  188. package/docs/fonts/ClashGrotesk-Extralight.eot +0 -0
  189. package/docs/fonts/ClashGrotesk-Extralight.ttf +0 -0
  190. package/docs/fonts/ClashGrotesk-Extralight.woff +0 -0
  191. package/docs/fonts/ClashGrotesk-Extralight.woff2 +0 -0
  192. package/docs/fonts/ClashGrotesk-Light.eot +0 -0
  193. package/docs/fonts/ClashGrotesk-Light.ttf +0 -0
  194. package/docs/fonts/ClashGrotesk-Light.woff +0 -0
  195. package/docs/fonts/ClashGrotesk-Light.woff2 +0 -0
  196. package/docs/fonts/ClashGrotesk-Medium.eot +0 -0
  197. package/docs/fonts/ClashGrotesk-Medium.ttf +0 -0
  198. package/docs/fonts/ClashGrotesk-Medium.woff +0 -0
  199. package/docs/fonts/ClashGrotesk-Medium.woff2 +0 -0
  200. package/docs/fonts/ClashGrotesk-Regular.eot +0 -0
  201. package/docs/fonts/ClashGrotesk-Regular.ttf +0 -0
  202. package/docs/fonts/ClashGrotesk-Regular.woff +0 -0
  203. package/docs/fonts/ClashGrotesk-Regular.woff2 +0 -0
  204. package/docs/fonts/ClashGrotesk-Semibold.eot +0 -0
  205. package/docs/fonts/ClashGrotesk-Semibold.ttf +0 -0
  206. package/docs/fonts/ClashGrotesk-Semibold.woff +0 -0
  207. package/docs/fonts/ClashGrotesk-Semibold.woff2 +0 -0
  208. package/docs/fonts/ClashGrotesk-Variable.eot +0 -0
  209. package/docs/fonts/ClashGrotesk-Variable.ttf +0 -0
  210. package/docs/fonts/ClashGrotesk-Variable.woff +0 -0
  211. package/docs/fonts/ClashGrotesk-Variable.woff2 +0 -0
  212. package/docs/img/concorde-icon.svg +0 -5
  213. package/docs/img/concorde-logo.svg +0 -1
  214. package/docs/img/concorde.png +0 -0
  215. package/docs/img/concorde_def.png +0 -0
  216. package/docs/img/concorde_seuil.png.webp +0 -0
  217. package/docs/img/concorde_seuil_invert.png +0 -0
  218. package/docs/img/paul_metrand.jpg +0 -0
  219. package/docs/img/paul_metrand_xs.jpg +0 -0
  220. package/docs/index.html +0 -93
  221. package/docs/llms-full.txt +0 -5787
  222. package/docs/llms.txt +0 -104
  223. package/docs/robots.txt +0 -16
  224. package/docs/sitemap.xml +0 -237
  225. package/docs/src/core/components/functional/date/date.md +0 -290
  226. package/docs/src/core/components/functional/fetch/fetch.md +0 -125
  227. package/docs/src/core/components/functional/if/if.md +0 -9
  228. package/docs/src/core/components/functional/jsonata/jsonata.md +0 -56
  229. package/docs/src/core/components/functional/list/list.md +0 -65
  230. package/docs/src/core/components/functional/mix/mix.md +0 -41
  231. package/docs/src/core/components/functional/queue/queue.md +0 -72
  232. package/docs/src/core/components/functional/router/router.md +0 -94
  233. package/docs/src/core/components/functional/sdui/default-library.json +0 -108
  234. package/docs/src/core/components/functional/sdui/example.json +0 -99
  235. package/docs/src/core/components/functional/sdui/sdui.md +0 -356
  236. package/docs/src/core/components/functional/states/states.md +0 -87
  237. package/docs/src/core/components/functional/submit/submit.md +0 -114
  238. package/docs/src/core/components/functional/subscriber/subscriber.md +0 -91
  239. package/docs/src/core/components/functional/value/value.md +0 -35
  240. package/docs/src/core/components/ui/alert/alert.md +0 -121
  241. package/docs/src/core/components/ui/alert-messages/alert-messages.md +0 -0
  242. package/docs/src/core/components/ui/badge/badge.md +0 -127
  243. package/docs/src/core/components/ui/button/button.md +0 -182
  244. package/docs/src/core/components/ui/captcha/captcha.md +0 -12
  245. package/docs/src/core/components/ui/card/card.md +0 -97
  246. package/docs/src/core/components/ui/divider/divider.md +0 -35
  247. package/docs/src/core/components/ui/form/checkbox/checkbox.md +0 -77
  248. package/docs/src/core/components/ui/form/fieldset/fieldset.md +0 -129
  249. package/docs/src/core/components/ui/form/form-actions/form-actions.md +0 -77
  250. package/docs/src/core/components/ui/form/form-layout/form-layout.md +0 -44
  251. package/docs/src/core/components/ui/form/input/input.md +0 -142
  252. package/docs/src/core/components/ui/form/input-autocomplete/input-autocomplete.md +0 -133
  253. package/docs/src/core/components/ui/form/radio/radio.md +0 -57
  254. package/docs/src/core/components/ui/form/select/select.md +0 -71
  255. package/docs/src/core/components/ui/form/switch/switch.md +0 -57
  256. package/docs/src/core/components/ui/form/textarea/textarea.md +0 -65
  257. package/docs/src/core/components/ui/group/group.md +0 -75
  258. package/docs/src/core/components/ui/icon/icon.md +0 -125
  259. package/docs/src/core/components/ui/icon/icons.json +0 -1
  260. package/docs/src/core/components/ui/image/image.md +0 -107
  261. package/docs/src/core/components/ui/link/link.md +0 -43
  262. package/docs/src/core/components/ui/loader/loader.md +0 -55
  263. package/docs/src/core/components/ui/menu/menu.md +0 -329
  264. package/docs/src/core/components/ui/modal/modal.md +0 -119
  265. package/docs/src/core/components/ui/pop/pop.md +0 -96
  266. package/docs/src/core/components/ui/progress/progress.md +0 -63
  267. package/docs/src/core/components/ui/table/table.md +0 -455
  268. package/docs/src/core/components/ui/toast/toast.md +0 -166
  269. package/docs/src/core/components/ui/tooltip/tooltip.md +0 -82
  270. package/docs/src/docs/_core-concept/dataFlow.md +0 -88
  271. package/docs/src/docs/_core-concept/overview.md +0 -57
  272. package/docs/src/docs/_core-concept/subscriber.md +0 -75
  273. package/docs/src/docs/_decorators/ancestor-attribute.md +0 -127
  274. package/docs/src/docs/_decorators/auto-subscribe.md +0 -202
  275. package/docs/src/docs/_decorators/bind.md +0 -167
  276. package/docs/src/docs/_decorators/get.md +0 -162
  277. package/docs/src/docs/_decorators/handle.md +0 -175
  278. package/docs/src/docs/_decorators/on-assign.md +0 -390
  279. package/docs/src/docs/_decorators/patch.md +0 -70
  280. package/docs/src/docs/_decorators/post.md +0 -146
  281. package/docs/src/docs/_decorators/publish.md +0 -55
  282. package/docs/src/docs/_decorators/put.md +0 -70
  283. package/docs/src/docs/_decorators/subscribe.md +0 -100
  284. package/docs/src/docs/_decorators/wait-for-ancestors.md +0 -163
  285. package/docs/src/docs/_directives/sub.md +0 -91
  286. package/docs/src/docs/_getting-started/ai-agents.md +0 -76
  287. package/docs/src/docs/_getting-started/concorde-manual-install.md +0 -133
  288. package/docs/src/docs/_getting-started/concorde-outside.md +0 -33
  289. package/docs/src/docs/_getting-started/create-a-component.md +0 -139
  290. package/docs/src/docs/_getting-started/my-first-component.md +0 -236
  291. package/docs/src/docs/_getting-started/my-first-subscriber.md +0 -120
  292. package/docs/src/docs/_getting-started/pubsub.md +0 -37
  293. package/docs/src/docs/_getting-started/start.md +0 -47
  294. package/docs/src/docs/_getting-started/theming.md +0 -91
  295. package/docs/src/docs/_misc/api-configuration.md +0 -81
  296. package/docs/src/docs/_misc/dataProviderKey.md +0 -168
  297. package/docs/src/docs/_misc/docs-mock-api.md +0 -63
  298. package/docs/src/docs/_misc/dynamic-path.md +0 -71
  299. package/docs/src/docs/_misc/endpoint.md +0 -45
  300. package/docs/src/docs/_misc/formelement-subscriber-removal.md +0 -115
  301. package/docs/src/docs/_misc/html-integration.md +0 -15
  302. package/docs/src/docs/search/docs-search.json +0 -9512
  303. package/docs/src/tag-list.json +0 -1
  304. package/docs/src/tsconfig-model.json +0 -23
  305. package/docs/src/tsconfig.declarations.json +0 -22
  306. package/docs/src/tsconfig.emit.json +0 -23
  307. package/docs/src/tsconfig.json +0 -858
  308. package/docs/svg/regular/plane.svg +0 -1
  309. package/docs/svg/solid/plane.svg +0 -1
  310. package/gitlab/job_github_mirror.sh +0 -39
  311. package/scripts/github-export.mjs +0 -150
  312. package/src/css.d.ts +0 -19
  313. package/src/tsconfig.declarations.json +0 -22
  314. package/src/tsconfig.emit.json +0 -23
@@ -1,307 +0,0 @@
1
- var ConcordeWebGpu=(function(ue){"use strict";/**
2
- * @license
3
- * Copyright 2019 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */var fe,Le;const Qt=globalThis,_r=Qt.ShadowRoot&&(Qt.ShadyCSS===void 0||Qt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Sr=Symbol(),en=new WeakMap;let tn=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Sr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(_r&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=en.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&en.set(t,e))}return e}toString(){return this.cssText}};const oi=n=>new tn(typeof n=="string"?n:n+"",void 0,Sr),ui=(n,...e)=>{const t=n.length===1?n[0]:e.reduce(((r,i,u)=>r+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[u+1]),n[0]);return new tn(t,n,Sr)},ci=(n,e)=>{if(_r)n.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const r=document.createElement("style"),i=Qt.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},rn=_r?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return oi(t)})(n):n;/**
6
- * @license
7
- * Copyright 2017 Google LLC
8
- * SPDX-License-Identifier: BSD-3-Clause
9
- */const{is:li,defineProperty:fi,getOwnPropertyDescriptor:hi,getOwnPropertyNames:di,getOwnPropertySymbols:pi,getPrototypeOf:mi}=Object,er=globalThis,nn=er.trustedTypes,gi=nn?nn.emptyScript:"",vi=er.reactiveElementPolyfillSupport,Dt=(n,e)=>n,tr={toAttribute(n,e){switch(e){case Boolean:n=n?gi:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ar=(n,e)=>!li(n,e),sn={attribute:!0,type:String,converter:tr,reflect:!1,useDefault:!1,hasChanged:Ar};Symbol.metadata??=Symbol("metadata"),er.litPropertyMetadata??=new WeakMap;let _t=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=sn){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&fi(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:u}=hi(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const h=i?.call(this);u?.call(this,a),this.requestUpdate(e,h,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??sn}static _$Ei(){if(this.hasOwnProperty(Dt("elementProperties")))return;const e=mi(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Dt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Dt("properties"))){const t=this.properties,r=[...di(t),...pi(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(rn(i))}else e!==void 0&&t.push(rn(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ci(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const u=(r.converter?.toAttribute!==void 0?r.converter:tr).toAttribute(t,r.type);this._$Em=e,u==null?this.removeAttribute(i):this.setAttribute(i,u),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const u=r.getPropertyOptions(i),a=typeof u.converter=="function"?{fromAttribute:u.converter}:u.converter?.fromAttribute!==void 0?u.converter:tr;this._$Em=i;const h=a.fromAttribute(t,u.type);this[i]=h??this._$Ej?.get(i)??h,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const i=this.constructor,u=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??Ar)(u,t)||r.useDefault&&r.reflect&&u===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:u},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),u!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,u]of this._$Ep)this[i]=u;this._$Ep=void 0}const r=this.constructor.elementProperties;if(r.size>0)for(const[i,u]of r){const{wrapped:a}=u,h=this[i];a!==!0||this._$AL.has(i)||h===void 0||this.C(i,void 0,u,h)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((r=>r.hostUpdate?.())),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};_t.elementStyles=[],_t.shadowRootOptions={mode:"open"},_t[Dt("elementProperties")]=new Map,_t[Dt("finalized")]=new Map,vi?.({ReactiveElement:_t}),(er.reactiveElementVersions??=[]).push("2.1.1");/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const Tr=globalThis,rr=Tr.trustedTypes,an=rr?rr.createPolicy("lit-html",{createHTML:n=>n}):void 0,on="$lit$",lt=`lit$${Math.random().toFixed(9).slice(2)}$`,un="?"+lt,yi=`<${un}>`,mt=document,Ot=()=>mt.createComment(""),Mt=n=>n===null||typeof n!="object"&&typeof n!="function",kr=Array.isArray,bi=n=>kr(n)||typeof n?.[Symbol.iterator]=="function",Pr=`[
14
- \f\r]`,Ft=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,cn=/-->/g,ln=/>/g,gt=RegExp(`>|${Pr}(?:([^\\s"'>=/]+)(${Pr}*=${Pr}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),fn=/'/g,hn=/"/g,dn=/^(?:script|style|textarea|title)$/i,wi=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),xr=wi(1),St=Symbol.for("lit-noChange"),Fe=Symbol.for("lit-nothing"),pn=new WeakMap,vt=mt.createTreeWalker(mt,129);function mn(n,e){if(!kr(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return an!==void 0?an.createHTML(e):e}const Ei=(n,e)=>{const t=n.length-1,r=[];let i,u=e===2?"<svg>":e===3?"<math>":"",a=Ft;for(let h=0;h<t;h++){const v=n[h];let x,D,P=-1,E=0;for(;E<v.length&&(a.lastIndex=E,D=a.exec(v),D!==null);)E=a.lastIndex,a===Ft?D[1]==="!--"?a=cn:D[1]!==void 0?a=ln:D[2]!==void 0?(dn.test(D[2])&&(i=RegExp("</"+D[2],"g")),a=gt):D[3]!==void 0&&(a=gt):a===gt?D[0]===">"?(a=i??Ft,P=-1):D[1]===void 0?P=-2:(P=a.lastIndex-D[2].length,x=D[1],a=D[3]===void 0?gt:D[3]==='"'?hn:fn):a===hn||a===fn?a=gt:a===cn||a===ln?a=Ft:(a=gt,i=void 0);const C=a===gt&&n[h+1].startsWith("/>")?" ":"";u+=a===Ft?v+yi:P>=0?(r.push(x),v.slice(0,P)+on+v.slice(P)+lt+C):v+lt+(P===-2?h:C)}return[mn(n,u+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};class $t{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let u=0,a=0;const h=e.length-1,v=this.parts,[x,D]=Ei(e,t);if(this.el=$t.createElement(x,r),vt.currentNode=this.el.content,t===2||t===3){const P=this.el.content.firstChild;P.replaceWith(...P.childNodes)}for(;(i=vt.nextNode())!==null&&v.length<h;){if(i.nodeType===1){if(i.hasAttributes())for(const P of i.getAttributeNames())if(P.endsWith(on)){const E=D[a++],C=i.getAttribute(P).split(lt),O=/([.?@])?(.*)/.exec(E);v.push({type:1,index:u,name:O[2],strings:C,ctor:O[1]==="."?Si:O[1]==="?"?Ai:O[1]==="@"?Ti:nr}),i.removeAttribute(P)}else P.startsWith(lt)&&(v.push({type:6,index:u}),i.removeAttribute(P));if(dn.test(i.tagName)){const P=i.textContent.split(lt),E=P.length-1;if(E>0){i.textContent=rr?rr.emptyScript:"";for(let C=0;C<E;C++)i.append(P[C],Ot()),vt.nextNode(),v.push({type:2,index:++u});i.append(P[E],Ot())}}}else if(i.nodeType===8)if(i.data===un)v.push({type:2,index:u});else{let P=-1;for(;(P=i.data.indexOf(lt,P+1))!==-1;)v.push({type:7,index:u}),P+=lt.length-1}u++}}static createElement(e,t){const r=mt.createElement("template");return r.innerHTML=e,r}}function At(n,e,t=n,r){if(e===St)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl;const u=Mt(e)?void 0:e._$litDirective$;return i?.constructor!==u&&(i?._$AO?.(!1),u===void 0?i=void 0:(i=new u(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=At(n,i._$AS(n,e.values),i,r)),e}class _i{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??mt).importNode(t,!0);vt.currentNode=i;let u=vt.nextNode(),a=0,h=0,v=r[0];for(;v!==void 0;){if(a===v.index){let x;v.type===2?x=new Nt(u,u.nextSibling,this,e):v.type===1?x=new v.ctor(u,v.name,v.strings,this,e):v.type===6&&(x=new ki(u,this,e)),this._$AV.push(x),v=r[++h]}a!==v?.index&&(u=vt.nextNode(),a++)}return vt.currentNode=mt,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class Nt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=Fe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=At(this,e,t),Mt(e)?e===Fe||e==null||e===""?(this._$AH!==Fe&&this._$AR(),this._$AH=Fe):e!==this._$AH&&e!==St&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):bi(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Fe&&Mt(this._$AH)?this._$AA.nextSibling.data=e:this.T(mt.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=$t.createElement(mn(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const u=new _i(i,this),a=u.u(this.options);u.p(t),this.T(a),this._$AH=u}}_$AC(e){let t=pn.get(e.strings);return t===void 0&&pn.set(e.strings,t=new $t(e)),t}k(e){kr(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const u of e)i===t.length?t.push(r=new Nt(this.O(Ot()),this.O(Ot()),this,this.options)):r=t[i],r._$AI(u),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class nr{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,u){this.type=1,this._$AH=Fe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=u,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Fe}_$AI(e,t=this,r,i){const u=this.strings;let a=!1;if(u===void 0)e=At(this,e,t,0),a=!Mt(e)||e!==this._$AH&&e!==St,a&&(this._$AH=e);else{const h=e;let v,x;for(e=u[0],v=0;v<u.length-1;v++)x=At(this,h[r+v],t,v),x===St&&(x=this._$AH[v]),a||=!Mt(x)||x!==this._$AH[v],x===Fe?e=Fe:e!==Fe&&(e+=(x??"")+u[v+1]),this._$AH[v]=x}a&&!i&&this.j(e)}j(e){e===Fe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Si extends nr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Fe?void 0:e}}class Ai extends nr{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Fe)}}class Ti extends nr{constructor(e,t,r,i,u){super(e,t,r,i,u),this.type=5}_$AI(e,t=this){if((e=At(this,e,t,0)??Fe)===St)return;const r=this._$AH,i=e===Fe&&r!==Fe||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,u=e!==Fe&&(r===Fe||i);i&&this.element.removeEventListener(this.name,this,r),u&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ki{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){At(this,e)}}const Pi=Tr.litHtmlPolyfillSupport;Pi?.($t,Nt),(Tr.litHtmlVersions??=[]).push("3.3.1");const xi=(n,e,t)=>{const r=t?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const u=t?.renderBefore??null;r._$litPart$=i=new Nt(e.insertBefore(Ot(),u),u,void 0,t??{})}return i._$AI(n),i};/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */const Cr=globalThis;class It extends _t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=xi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return St}}It._$litElement$=!0,It.finalized=!0,Cr.litElementHydrateSupport?.({LitElement:It});const Ci=Cr.litElementPolyfillSupport;Ci?.({LitElement:It}),(Cr.litElementVersions??=[]).push("4.2.1");/**
20
- * @license
21
- * Copyright 2017 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const Ri=n=>(e,t)=>{t!==void 0?t.addInitializer((()=>{customElements.define(n,e)})):customElements.define(n,e)};/**
24
- * @license
25
- * Copyright 2017 Google LLC
26
- * SPDX-License-Identifier: BSD-3-Clause
27
- */const Li={attribute:!0,type:String,converter:tr,reflect:!1,hasChanged:Ar},Ui=(n=Li,e,t)=>{const{kind:r,metadata:i}=t;let u=globalThis.litPropertyMetadata.get(i);if(u===void 0&&globalThis.litPropertyMetadata.set(i,u=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),u.set(t.name,n),r==="accessor"){const{name:a}=t;return{set(h){const v=e.get.call(this);e.set.call(this,h),this.requestUpdate(a,v,n)},init(h){return h!==void 0&&this.C(a,void 0,n,h),h}}}if(r==="setter"){const{name:a}=t;return function(h){const v=this[a];e.call(this,h),this.requestUpdate(a,v,n)}}throw Error("Unsupported decorator location: "+r)};function Re(n){return(e,t)=>typeof t=="object"?Ui(n,e,t):((r,i,u)=>{const a=i.hasOwnProperty(u);return i.constructor.createProperty(u,r),a?Object.getOwnPropertyDescriptor(i,u):void 0})(n,e,t)}/**
28
- * @license
29
- * Copyright 2017 Google LLC
30
- * SPDX-License-Identifier: BSD-3-Clause
31
- */function gn(n){return Re({...n,state:!0,attribute:!1})}function Rr(n){if(!n||typeof n!="object")return!1;const e=n;return typeof e.getFrameCanvas=="function"&&typeof e.frameSeq=="number"}function vn(n){if(!n||typeof n!="object")return!1;const e=n;return typeof e.registerFrameConsumer=="function"&&typeof e.unregisterFrameConsumer=="function"}class Di{constructor(){this.tokens=new Map}sync(e){const t=new Set;for(const r of e)r&&vn(r)&&t.add(r);for(const[r,i]of[...this.tokens])t.has(r)||(vn(r)&&r.unregisterFrameConsumer(i),this.tokens.delete(r));for(const r of t){if(this.tokens.has(r))continue;const i={};r.registerFrameConsumer(i),this.tokens.set(r,i)}}clear(){this.sync([])}}const yn="#__sonic_frame_";let Oi=0;const Lr=new Map,bn=new WeakMap;function Mi(n){const e=bn.get(n);if(e)return e;const t=`${yn}${++Oi}`;return Lr.set(t,n),bn.set(n,t),t}function Fi(n){if(!n.startsWith(yn))return null;const e=Lr.get(n)??null;return e&&!e.isConnected?(Lr.delete(n),null):e}function $i(n){if(n==null)return null;if(typeof n=="string"){const e=n.trim();return e?e.startsWith("#")?e:`#${e}`:null}return typeof Element<"u"&&n instanceof Element?n.id?`#${n.id}`:Mi(n):null}function Ur(n){return typeof n!="string"?null:n.trim()||null}function Ni(n){if(n==null||n==="")return null;if(typeof n=="string")return Ur(n);if(typeof n!="object")return null;const e=n;return Ur(e.url)??Ur(e.blobUrl)}function Ii(n){for(const e of n)try{URL.revokeObjectURL(e)}catch{}}const Gi=4,Bi=.001,qi=.45,ji="rgb(38, 89, 217)";class Dr{constructor(e,t){this.backend="canvas2d",this.images=[null,null,null,null],this.channelUrls=["","","",""],this.channelSizes=[null,null,null,null],this.channelLoadTokens=[0,0,0,0],this.disposed=!1,this.canvas=e,this.ctx=t}static create(e){const t=e.getContext("2d",{alpha:!0});if(!t)throw new Error("Canvas2D indisponible");return new Dr(e,t)}async setShader(e){this.assertAlive()}async setChannel(e,t){this.assertAlive();const r=t.trim();if(this.channelUrls[e]===r&&this.images[e])return;this.channelUrls[e]=r;const i=++this.channelLoadTokens[e];if(!r){this.images[e]=null,this.channelSizes[e]=null;return}const u=await Wi(r);i!==this.channelLoadTokens[e]||this.disposed||(this.images[e]=u,this.channelSizes[e]={width:u.naturalWidth,height:u.naturalHeight})}getTextureSize(e){const t=this.channelUrls.indexOf(e.trim());return t<0?null:this.channelSizes[t]}resize(e,t){this.assertAlive();const r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t));this.canvas.width===r&&this.canvas.height===i||(this.canvas.width=r,this.canvas.height=i)}draw(e){this.assertAlive();const{ctx:t,canvas:r}=this,i=r.width,u=r.height;t.clearRect(0,0,i,u);const a=this.images[0],h=Math.min(1,Math.max(0,e.params[0]??0));if(a)t.drawImage(a,0,0,i,u),h>Bi&&(t.save(),t.globalAlpha=h*qi,t.fillStyle=ji,t.fillRect(0,0,i,u),t.restore());else{const v=t.createLinearGradient(0,0,i,u);v.addColorStop(0,`rgb(38,${Math.round(40+h*80)},80)`),v.addColorStop(1,`rgb(90,${Math.round(60+h*40)},120)`),t.fillStyle=v,t.fillRect(0,0,i,u)}}dispose(e=!1){if(!this.disposed){this.disposed=!0;for(let t=0;t<Gi;t++)this.channelLoadTokens[t]++;this.images=[null,null,null,null]}}assertAlive(){if(this.disposed)throw new Error("Canvas2D fallback disposed")}}async function Wi(n){const e=new Image;return e.crossOrigin="anonymous",await new Promise((t,r)=>{e.onload=()=>t(),e.onerror=()=>r(new Error(`Failed to load texture: ${n}`)),e.src=n}),e}const Or="1";function zi(n){const e=n.trim();if(!e)return!1;try{const t=new URL(e,"https://example.invalid/");return t.protocol==="http:"||t.protocol==="https:"||t.protocol==="blob:"}catch{return!1}}let st=class ze{static getLanguage(){const e=document.documentElement.lang;return localStorage.getItem("SonicSelectedLanguage")||e}static getCookies(){return document.cookie.split(";").reduce((e,t)=>{const r=t.indexOf("=");return e[t.substring(0,r).trim()]=t.substring(r+1),e},{})}static nextComposedAncestor(e){return e instanceof Element&&e.assignedSlot?e.assignedSlot:e.parentNode||e.host||null}static everyAncestors(e,t){let r=e;for(;r;){if(!t(r))return;r=r.parentNode||r.host}}static overflowMatches(e,t){return t.includes(e.overflowY)||t.includes(e.overflowX)}static findAncestorByOverflow(e,t){let r=e;for(;r;){if(r instanceof Element&&r.nodeType===1){const i=window.getComputedStyle(r);if(ze.overflowMatches(i,t))return r}r=ze.nextComposedAncestor(r)}return null}static getScrollableAncestor(e){return ze.findAncestorByOverflow(e,["auto","scroll","hidden","overlay"])}static getScrollingAncestor(e){return ze.findAncestorByOverflow(e,["auto","scroll","overlay"])}static scopeAttributeNames(e){const t=e.toLowerCase();return t===e?[e]:[e,t]}static readScopeAttributeOnElement(e,t){for(const r of ze.scopeAttributeNames(t))if(e.hasAttribute(r))return e.getAttribute(r)??"";return null}static getAncestorAttributeValue(e,t){if(!e)return null;let r=e;for(;r;){if(r instanceof HTMLElement){const u=ze.readScopeAttributeOnElement(r,t);if(u!=null)return u}const i=r.parentNode||r.host;if(!i)break;r=i}return null}static getApiConfiguration(e){const t=ze.getAncestorAttributeValue(e,"token"),r=ze.getAncestorAttributeValue(e,"addHTTPResponse")!=null,i=ze.getAncestorAttributeValue(e,"serviceURL");let u=null,a=null;const h=ze.getAncestorAttributeValue(e,"tokenProvider"),v=ze.getAncestorAttributeValue(e,"eventsApiToken");t||(u=ze.getAncestorAttributeValue(e,"userName"),a=ze.getAncestorAttributeValue(e,"password"));const x=ze.getAncestorAttributeValue(e,"credentials")||void 0,D=e.getAttribute("cache"),P=e.hasAttribute("blockUntilDone"),E=e.hasAttribute("keepAlive");return{serviceURL:i,token:t,userName:u,password:a,authToken:v,tokenProvider:h,addHTTPResponse:r,credentials:x,cache:D,blockUntilDone:P,keepAlive:E}}static getClosestElement(e,t){let r=e;for(;r&&!(r.nodeName&&r.nodeName.toLowerCase()===t);){const i=r.parentNode||r.host;if(!i){r=null;break}r=i}return r?.nodeName?r:null}static getClosestForm(e){return ze.getClosestElement(e,"form")}static getAncestorsByTagNames(e,t){const r=new Set(t.map(a=>a.toLowerCase())),i=[];let u=e.parentNode||e.host;for(;u;)u instanceof Element&&r.has(u.tagName.toLowerCase())&&i.push(u),u=u.parentNode||u.host;return i}static getAncestorsBySelectors(e,t){const r=[];let i=e.parentNode||e.host;for(;i;){if(i instanceof Element)for(const u of t)try{if(i.matches(u)){r.push(i);break}}catch{}i=i.parentNode||i.host}return r}static async loadJS(e){if(!zi(e))return!1;const t=typeof document<"u"?new URL(e,document.baseURI).href:e,r=Array.from(document.scripts).find(u=>u.src===t);if(r)return r.dataset.concordeLoaded===Or?!0:new Promise(u=>{let a=!1;const h=x=>{a||(a=!0,x&&(r.dataset.concordeLoaded=Or),u(x))};r.addEventListener("load",()=>h(!0),{once:!0}),r.addEventListener("error",()=>h(!1),{once:!0});const v=r.readyState;if(v==="complete"||v==="loaded"){h(!0);return}Promise.resolve().then(()=>{Promise.resolve().then(()=>{a||h(!0)})})});const i=/\.es\.js(\?|#|$)/.test(e)||/[?&]module(?:&|=|$)/.test(e);return new Promise(u=>{const a=document.createElement("script");a.src=e,i&&(a.type="module"),a.onload=()=>{a.dataset.concordeLoaded=Or,u(!0)},a.onerror=()=>u(!1),document.head.appendChild(a)})}static async loadCSS(e){return new Promise(t=>{const r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,r.onload=()=>t(!0),r.onerror=()=>t(!0),document.head.appendChild(r)})}},Hi=class{static async queueTaskPromise(){return new Promise(e=>{window.queueMicrotask(()=>e(null))})}static async delayPromise(e){return new Promise(t=>{setTimeout(t,e)})}},wn="sonic";typeof __SONIC_PREFIX__<"u"&&(wn=__SONIC_PREFIX__);let En=wn.replace(/-([a-z])/g,n=>n[1].toUpperCase());const Vi=En.charAt(0).toUpperCase()+En.slice(1);let Xi=class Et{static areEqual(e,t){return e.length===t.length?e.every((r,i)=>r===t[i]):!1}static from2d(e){return{to1D:()=>{let t=[];return e.forEach(r=>t=t.concat(r)),this.from(t)}}}static from(e){return{get:()=>e||[],everyItem:()=>({has:()=>({same:()=>({value:()=>({forKey:t=>{if(e.length<1)return!0;const r=(e[0]||{})[t];return e.every(i=>(i||{})[t]==r)}})})}),value:()=>({forKey:t=>Et.from(e.map(r=>r[t]))}),copy:()=>({fromKey:t=>({toKey:r=>{e.forEach(i=>{i[r]=Array.isArray(i[t])?[...i[t]]:typeof i[t]=="object"&&i[t]!=null?{...i[t]}:i[t]})}})})}),map:t=>Et.from(e.map(t)),filter:t=>Et.from(e.filter(t)),find:t=>e.find(t),some:t=>e.some(t),every:t=>e.every(t),group:()=>({byKey:t=>{const r=[],i=new Map;for(const u of e){const a=u[t];if(!i.has(a)){const h=r.length;i.set(a,h);const v={items:[]};v[t]=a,r.push(v)}r[i.get(a)].items.push(u)}return Et.from(r)}}),without:()=>({duplicates:()=>({forKey:t=>{const r=[...new Set(e.map(i=>i[t]))];return Et.from(r.map(i=>e.find(u=>u[t]==i)))}}),itemsIn:t=>({havingSameValue:()=>({forKey:r=>{const i=(u,a)=>h=>u[a]!=h[a];return Et.from(e.filter(u=>t.every(i(u,r))))}})})})}}},Mr=class{static ucFirst(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.substring(1)}static minutesDuration(e,t="",r="long"){t||(t=st.getLanguage());const i=(x,D)=>[Math.floor(x/D),x%D];function u(x,D,P){return new Intl.NumberFormat(x,{style:"unit",unit:D,unitDisplay:P}).format}const[a,h]=i(e,60),v=[];return a&&v.push(u(t,"hour",r)(a)),h&&v.push(u(t,"minute",r)(h)),new Intl.ListFormat(t,{style:"long",type:"conjunction"}).format(v)}static js(e){try{return Function("return "+e)()}catch{return""}}};class _n{constructor(e){this.path=e}toString(){return this.path}}function Sn(n){return new Proxy(n,{get(e,t){if(t==="path")return e.path;if(t==="toString")return e.toString.bind(e);if(t===Symbol.toStringTag)return"DataProviderKey";if(typeof t=="symbol")return e[t];const r=e.path?`${e.path}.${String(t)}`:String(t);return Sn(new _n(r))}})}const Yi=/\$\{|\{\$/;function Ji(n){return Yi.test(n)}function Ki(n){const e=n;if(Ji(e))throw new Error("Static publisher path required for get/set/dp. Use @subscribe, @publish, or @handle for dynamic DataProviderKey paths.");return e}const ir=function(n){return this instanceof ir?Sn(new _n(n)):new ir(n)};let sr=class ct{static shallowEqual(e,t,r=!0){const i=Object.keys(e),u=Object.keys(t);if(i.length!==u.length&&r)return!1;for(const a of i){const h=e[a],v=t[a];if(r?h!==v:h!=v)return!1}return!0}static deepEqual(e,t,r=!0){const i=Object.keys(e),u=Object.keys(t);if(i.length!==u.length&&r)return!1;for(const a of i){const h=e[a],v=t[a],x=ct.isObject(h)&&ct.isObject(v),D=r?h!==v:h!=v;if(x&&!ct.deepEqual(h,v)||!x&&D)return!1}return!0}static isObject(e){return e!=null&&typeof e=="object"}static isUndefindOrNull(e){return e==null}static isEmpty(e){return ct.isUndefindOrNull(e)?!0:Object.keys(e).length===0}static traverse(e,t,r=!1){for(const i of t){const u=e[i];if(u===void 0)return;r&&ct.isObject(u)?e=Object.assign(Array.isArray(u)?[]:{},e,u):e=e[i]}return e}static traverseDotNotation(e,t,r=!1){return ct.traverse(e,t.split("."),r)}static getURLSearchArray(e,t=""){let r=[];for(let i in e){const u=e[i];t&&(i=t+"["+i+"]"),ct.isObject(u)?r=[...r,...this.getURLSearchArray(u,i)]:r.push(`${i}=${u}`)}return r}static getURLSearchString(e){return ct.getURLSearchArray(e,"").join("&")}};sr.traverseDotNotation;function Zi(n){return!1}function ar(n){return Object.prototype.hasOwnProperty.call(n,"__value")}function ft(n){return typeof n=="object"&&n!==null}let Tt="sonic";typeof __SONIC_PREFIX__>"u"&&(Tt="sonic");const Fr=Tt=="sonic"?"publisher-proxies-data":Tt+"-publisher-proxies-data",ht=class ht{constructor(e,t,r){for(this._proxies_=new Map,this._is_savable_=!1,this._expiration_delay_=432e5,this._invalidate_on_page_show_=!1,this._invalidateListeners_=new Set,this._formInvalidateListeners_=new Set,this._assignListeners_=new Set,this._mutationListeners_=new Set,this._fillListeners_=new Set,this._templateFillListeners_=new Set,this._lockInternalMutationPublishing_=!1,this._instanceCounter_=0,this._assignmentId_=0,this._value_=e,this.parent=t||null,this._parentKey_=r,this.root=this,this._instanceCounter_=0;this.root.parent;)this.root=this.root.parent}delete(){for(const e in this._proxies_.keys())e!="_parent_"&&this._proxies_.get(e)?.delete();this._invalidateListeners_.clear(),this._formInvalidateListeners_.clear(),this._assignListeners_.clear(),this._mutationListeners_.clear(),this._fillListeners_.clear(),this._templateFillListeners_.clear(),this._proxies_.clear(),ht.instances.delete(this._instanceCounter_)}hasListener(){return this._templateFillListeners_.size>0||this._assignListeners_.size>0||this._invalidateListeners_.size>0||this._formInvalidateListeners_.size>0||this._mutationListeners_.size>0||this._fillListeners_.size>0}_publishInternalMutation_(e=!1){if(this._mutationListeners_.forEach(t=>t()),this._is_savable_&&!$e.changed){$e.changed=!0,$e.saveId++;const t=$e.saveId;setTimeout(()=>$e.getInstance().saveToLocalStorage(t),1e3)}e||this.parent&&this.parent._publishInternalMutation_()}async _publishAssignement_(e=!1){if(this._assignmentId_++,this._assignmentId_!==this._assignmentId_)return;const r=this.get();this._assignListeners_.forEach(i=>{i(r)}),this._publishInternalMutation_(e)}_publishInvalidation_(){this._invalidateListeners_.forEach(e=>e())}_publishFormInvalidation_(){this._formInvalidateListeners_.forEach(e=>e())}_publishDynamicFilling_(e,t){this._fillListeners_.forEach(r=>{r[e]!==t&&(r[e]=t)}),this._publishTemplateFilling_(e,t)}_publishTemplateFilling_(e,t){this._templateFillListeners_.forEach(r=>{const i=Object.getOwnPropertyDescriptor(r,e);i&&!i.set&&!i.writable||(r.propertyMap&&r.propertyMap[e]&&(e=r.propertyMap[e]),typeof r[e]<"u"&&r[e]!==t&&(r[e]=t))})}onAssign(e,t=!0){typeof e=="function"&&(this._assignListeners_.has(e)||(this._assignListeners_.add(e),t&&e(this.get())))}offAssign(e){this._assignListeners_.delete(e)}onInvalidate(e){typeof e=="function"&&this._invalidateListeners_.add(e)}offInvalidate(e){typeof e=="function"&&this._invalidateListeners_.delete(e)}invalidate(){this._publishInvalidation_()}onFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.add(e)}offFormInvalidate(e){typeof e=="function"&&this._formInvalidateListeners_.delete(e)}invalidateForm(){this._publishFormInvalidation_()}onInternalMutation(e){typeof e=="function"&&(this._mutationListeners_.add(e),e())}offInternalMutation(e){typeof e=="function"&&this._mutationListeners_.delete(e)}startTemplateFilling(e){if(this._templateFillListeners_.add(e),typeof this._value_=="object")for(const t in this._value_){let r=t;const i=this._value_[t];e.propertyMap&&e.propertyMap[t]&&(r=e.propertyMap[t]),typeof e[t]<"u"&&e[t]!==i&&(e[r]=i)}}stopTemplateFilling(e){this._templateFillListeners_.delete(e)}startDynamicFilling(e){this._fillListeners_.add(e);for(const t in this._value_){const r=this._value_[t];e[t]!==r&&(e[t]=r)}}stopDynamicFilling(e){this._fillListeners_.delete(e)}set(e,t=!1){if(this._value_===e||ft(this._value_)&&ft(e)&&e&&ar(this._value_)&&ar(e)&&this._value_.__value===e.__value||!ft(e)&&e===this._value_.__value)return!0;this._value_=ft(e)?e:{__value:e},this._cachedGet_=void 0;const r=ar(this._value_);if(this._parentKey_&&this.parent){const i=ar(this._value_)?this._value_.__value:this._value_;if(this.parent?.get()==null&&this.parent?.get()==null)if(isNaN(Number(this._parentKey_)))this.parent.set({[this._parentKey_]:i});else{const u=[];u[Number(this._parentKey_)]=i,this.parent.set(u)}else this.parent._value_[this._parentKey_]=i}if(r)return this._proxies_.forEach((i,u)=>{u!="_parent_"&&(i.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(t),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_.__value),!0;for(const i in this._value_)this._value_[i]===void 0&&delete this._value_[i];if(this._proxies_.forEach((i,u)=>{const a=this._value_[u];u!="_parent_"&&a===void 0&&a!==null&&isNaN(Number(u))&&(i.set(null),this._publishDynamicFilling_(u,null))}),this._publishAssignement_(),this.parent&&this._parentKey_&&this.parent._publishDynamicFilling_(this._parentKey_,this._value_),ft(this._value_))for(const i in this._value_){const u=e[i],h=ft(u)?u:{__value:u};if(!this._proxies_.has(i)){this._publishDynamicFilling_(i,u);continue}this._proxies_.get(i)?.set(h,!0),this._publishDynamicFilling_(i,u)}return!0}get(){if(Qi(this),this._cachedGet_!==void 0)return this._cachedGet_;if(Object.prototype.hasOwnProperty.call(this._value_,"__value")){const e=this._value_.__value;return this._cachedGet_=e??null}return this._cachedGet_=this._value_!=null?this._value_:null}get $tag(){return this._instanceCounter_||(ht.instancesCounter++,this._instanceCounter_=ht.instancesCounter),ht.instances.set(this._instanceCounter_,this),"<"+Tt+'-publisher-proxy publisher="'+this._instanceCounter_+'"></'+Tt+"-publisher-proxy>"}};ht.instances=new Map,ht.instancesCounter=0;let or=ht;const An=[];function Qi(n){An.length>0&&An[0].add(n)}const me=class me{constructor(){if(this.enabledLocaStorageProxies=[],this.publishers=new Map,this.localStorageData={},this.isLocalStrorageReady=null,this.initialisedData=[],me.instance!=null)throw"Singleton / use getInstance";me.instance=this,this.isLocalStrorageReady=this.cleanStorageData(),me.initPageShowHandler()}static initPageShowHandler(){me.pageShowHandlerInitialized||(me.pageShowHandlerInitialized=!0,window.addEventListener("pageshow",e=>{e.persisted&&me.getInstance().invalidateAll()}))}invalidateAll(){this.publishers.forEach(e=>{e._invalidate_on_page_show_&&e.invalidate()})}async cleanStorageData(){return new Promise(e=>{(async()=>{try{let r=localStorage.getItem(Fr),i=null;if(r&&(i=await this.decompress(r,"gzip")),i)try{this.localStorageData=JSON.parse(i)}catch{this.localStorageData={}}else r=await this.compress("{}","gzip"),localStorage.setItem(Fr,r),this.localStorageData={};const u=1e3*60*60*12;for(const a in this.localStorageData){const h=this.localStorageData[a],v=new Date().getTime()-(h.expirationDelayMs||u);h.lastModifiationMS<v&&delete this.localStorageData[a]}e(!0)}catch{window.requestAnimationFrame(()=>{e(!1)}),console.warn("no publisher cache in this browser")}})()})}static getInstance(e){if(e){const t=me.instances.get(e);return t||(console.warn("No PublisherManager instance registered with id:",e,"creating new one"),new me)}return me.instance==null?new me:me.instance}static get(e,t){return me.getInstance().get(e,t)}async setLocalData(e,t){await this.isLocalStrorageReady,e.set(this.localStorageData[t+"¤lang_"+st.getLanguage()]?.data||e.get())}get(e,t){const r=t?.localStorageMode==="enabled",i=t?.invalidateOnPageShow===!0;if(!this.publishers.has(e)){const h=$r({});this.set(e,h)}const u=this.publishers.get(e);return r&&this.initialisedData.indexOf(e)===-1&&(t?.expirationDelayMs&&(u._expiration_delay_=t.expirationDelayMs),u._is_savable_=!0,this.initialisedData.push(e),this.setLocalData(u,e)),i&&(u._invalidate_on_page_show_=i),this.publishers.get(e)}set(e,t){this.publishers.set(e,t)}delete(e){return this.publishers.has(e)?(this.publishers.delete(e),!0):!1}async saveToLocalStorage(e=0){if(!(e!==me.saveId&&e%10!=0))try{if(!me.changed||me.saving)return;me.saving=!0,me.changed=!1;const t=Array.from(this.publishers.keys());let r=!1;for(const i of t){const u=this.publishers.get(i);if(!u?._is_savable_)continue;const a=u?.get();a&&(this.localStorageData[i+"¤lang_"+st.getLanguage()]={lastModifiationMS:new Date().getTime(),expirationDelayMs:u._expiration_delay_,data:a},r=!0)}if(r){const i=await this.compress(JSON.stringify(this.localStorageData),"gzip");localStorage.setItem(Fr,i)}if(me.saving=!1,me.changed){me.saveId++;const i=me.saveId;setTimeout(()=>this.saveToLocalStorage(i),1e3)}}catch{me.saving=!1}}async compress(e,t){const r=new TextEncoder().encode(e),i=window,u=new i.CompressionStream(t),a=u.writable.getWriter();a.write(r),a.close();const h=await new Response(u.readable).arrayBuffer(),v=new Uint8Array(h);let x="";for(let D=0;D<v.length;D++)x+=String.fromCharCode(v[D]);return btoa(x)}async decompress(e,t){const r=atob(e),u=Uint8Array.from(r,D=>D.charCodeAt(0)).buffer,a=window,h=new a.DecompressionStream(t),v=h.writable.getWriter();v.write(u),v.close();const x=await new Response(h.readable).arrayBuffer();return new TextDecoder().decode(x)}};me.buildDate="Wed Sep 30 2026 10:44:53 GMT+0200 (Central European Summer Time)",me.changed=!1,me.saving=!1,me.saveId=0,me.instance=null,me.instances=new Map,me.pageShowHandlerInitialized=!1;let $e=me;if(typeof window<"u"){const n=window,e=Vi+"PublisherManager",t=n[e]||$e;if(n[e]||(n[e]=$e),t!==$e){const r=["instance","instances","changed","saving","saveId","pageShowHandlerInitialized"];for(const i of r)Object.defineProperty($e,i,{configurable:!0,get(){return t[i]},set(u){t[i]=u}})}}const es=new Set(["invalidate","onInvalidate","offInvalidate","invalidateForm","onFormInvalidate","offFormInvalidate","onAssign","offAssign","startDynamicFilling","stopDynamicFilling","startTemplateFilling","stopTemplateFilling","onInternalMutation","offInternalMutation","set","get","$tag","_cachedGet_","_templateFillListeners_","_fillListeners_","_assignListeners_","_invalidateListeners_","_formInvalidateListeners_","_publishInternalMutation_","hasListener","delete","_mutationListeners_","_publishDynamicFilling_","_publishInvalidation_","_publishFormInvalidation_","_publishTemplateFilling_","_publishAssignement_","_proxies_","parent","_parentKey_","_value_","_is_savable_","_expiration_delay_","_lockInternalMutationPublishing_","_instanceCounter_","_assignmentId_","_invalidate_on_page_show_"]);function ts(n,e){return{get:function(t,r){if(typeof r=="string"&&es.has(r))return n[r];if(r==Symbol.toPrimitive)return()=>e().get();if(!n._proxies_.has(r)){const i=n._value_[r],u=$r(ft(i)?i:{__value:i},n,r);u._proxies_.set("_parent_",e()),n._proxies_.set(r,u)}return n._proxies_.get(r)},set:function(t,r,i){if(r=="_value_")return n._value_=i,!0;if(r=="_cachedGet_")return n._cachedGet_=i,!0;if(r=="_assignmentId_")return n._assignmentId_=i,!0;if(r=="_is_savable_")return n._is_savable_=i,!0;if(r=="_expiration_delay_")return n._expiration_delay_=i,!0;if(r=="_invalidate_on_page_show_")return n._invalidate_on_page_show_=i,!0;if(r=="_instanceCounter_")return n._instanceCounter_=i,!0;if(!n._proxies_.has(r)){const a=$r({},n,r);a._proxies_.set("_parent_",e()),n._proxies_.set(r,a)}return n._value_[r]!==i&&(n._value_[r]=i,n._publishDynamicFilling_(r,i),n._proxies_.get(r)?.set(ft(i)?i:{__value:i})),!0},deleteProperty:function(t,r){return n._publishDynamicFilling_(r,null),n._proxies_.get(r)?.set(null),delete n._value_[r]},has:function(t,r){return r in n._value_&&r!="_lockInternalMutationPublishing_"},defineProperty:function(t,r,i){return i&&"value"in i&&(n._value_[r]=i.value),!0},getOwnPropertyDescriptor:function(t,r){return{enumerable:!0,configurable:!0}},ownKeys:function(t){return n._value_.__value?Object.keys(n._value_.__value):Object.keys(n._value_)}}}function $r(n,e=null,t){const r=new or(n,e,t);let i=null;const u=ts(r,()=>i);return i=new Proxy(r,u),i}class rs extends HTMLElement{constructor(){super(),this.publisherId="",this.onAssign=e=>{this.innerHTML=e.toString()}}connectedCallback(){this.publisherId=this.getAttribute("publisher")||"",this.publisher=or.instances.get(parseInt(this.publisherId)),this.publisher?.onAssign(this.onAssign)}disconnectedCallback(){this.publisher?.offAssign(this.onAssign)}}try{customElements.define(Tt+"-publisher-proxy",rs)}catch{}const ns=(n,e)=>{{const t=n.split("."),r=t.shift()||"";let i=$e.get(r,e);i=sr.traverse(i,t);const u=new Set;return u.add(i),u}};function Tn(n,e,t){const r=Ki(n);return ns(r,t).values().next().value}function is(n,e){return Zi()?Tn(n,void 0,e):Tn(n)}let Nr=(fe=class{static disable(){this.enabled&&(this.enabled=!1,Array.from(fe.observedElements.keys()).forEach(e=>fe.unObserve(e)))}static observe(e){if(!e||!fe.enabled||fe.observedElements.has(e))return;const t=new MutationObserver(fe.onMutation),r={};r.childList=!0,r.subtree=!0,r.attributes=!0,r.attributeFilter=["data-bind"],t.observe(e,r),e.querySelectorAll("[data-bind]").forEach(i=>fe.addPublisherListeners(i)),fe.observedElements.set(e,t)}static unObserve(e){if(!e)return;const t=this.observedElements.get(e);t&&(t.disconnect(),e.querySelectorAll("[data-bind]").forEach(r=>fe.removePublisherListeners(r)))}static onAdded(e){e.hasAttribute&&e.hasAttribute("data-bind")&&fe.addPublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>fe.addPublisherListeners(t)):e.childNodes.forEach(t=>fe.onAdded(t))}static onRemoved(e){e.hasAttribute&&e.hasAttribute("data-bind")&&fe.removePublisherListeners(e),e.querySelectorAll?e.querySelectorAll("[data-bind]").forEach(t=>fe.removePublisherListeners(t)):e.childNodes.forEach(t=>fe.onRemoved(t))}static onMutation(e){for(const t of e)switch(t.type){case"attributes":fe.addPublisherListeners(t.target);break;case"childList":t.addedNodes.forEach(r=>{fe.onAdded(r)}),t.removedNodes.forEach(r=>{fe.onRemoved(r)});break}}static removePublisherListeners(e){const t=fe.publisherListeners.get(e);t&&(fe.publisherListeners.delete(e),t.forEach(r=>{r.publisher?.offAssign(r.onAssign)}))}static getVariablesDescriptor(e){let t=e.match(/(\$(?:\w+\\?\.?)+)/g);return t?t=t.map(r=>r.replace("$","")):t=[e],t=t.filter(r=>r.length>0),{expression:e.replace("\\",""),variables:t.map(r=>r.split(/\b\.\b/).map(i=>i.replace("\\","")))}}static getDataBindItems(e){return"attributes"in e?Array.from(e.attributes).filter(t=>t.name.indexOf("::")==0).map(t=>({propertyToUpdate:t.name.substring(2).replace(/-((html)|\w)/g,i=>i.substring(1).toUpperCase()),bindedVariablesDescriptor:fe.getVariablesDescriptor(t.value)})):[]}static getSubPublisher(e,t){if(!t)return e;for(const r of t)if(r!="_self_"){if(!e)return null;e=e[r]}return e}static addPublisherListeners(e){fe.removePublisherListeners(e);const t=st.getAncestorAttributeValue(e.parentNode||e.host||e,"dataProvider");if(!t)return;const r=$e.getInstance().get(t),i=fe.getDataBindItems(e),u=[];i.forEach(a=>{const h=a.bindedVariablesDescriptor,v=a.propertyToUpdate;for(const x of h.variables){const D=x;let P=r;P=fe.getSubPublisher(r,D);const E=e,C={publisher:P,onAssign:()=>{const O=h.variables.map(J=>fe.getSubPublisher(r,J)?.get());let G=h.expression,ee=!1;if(O.length==1&&h.variables[0].join(".")==G.substring(1)){let J=O[0];J===null&&(J=""),E[v]=J;return}for(let J=0;J<O.length;J++){let _=O[J];const g=h.variables[J];_===null&&(ee=!0,_=void 0),G=G.replace("$"+g.join("."),_)}if(G.indexOf("|")!=-1){const J=G.indexOf("|");if(J==0)G=Mr.js(G.substring(1));else{const _=G.substring(0,J),g=G.substring(J+1),U=Mr[_];G=ee?"":U?U(g):G}}else G=ee?"":G;E[v]=G}};P?.onAssign(C.onAssign),u.push(C)}}),fe.publisherListeners.set(e,u)}},fe.observedElements=new Map,fe.enabled=!0,fe.publisherListeners=new Map,fe);Nr.observe(document.documentElement),window.SonicDataBindObserver||(window.SonicDataBindObserver=Nr);let ss=(Le=class{static listen(){if(!Le.listening)return;const e=document.location?.href.replace(document.location.origin,"");Le.prevURL&&Le.prevURL!=e&&(Le.prevURL=e,Le.listeners.forEach(t=>{t.location=e})),window.requestAnimationFrame(Le.listen)}static offChange(e){const t=Le.listeners.indexOf(e);t!=-1&&(Le.listeners.splice(t,1),Le.listeners.length==0&&(Le.listening=!1))}static onChange(e){Le.listening||(Le.listening=!0,Le.listen()),Le.listeners.push(e),e.location=this.prevURL}static changeFromComponent(e){const t=e.goBack,r=document.referrer;if(t!=null){const x=document.location.origin,D=(t||x).toString(),E=r.indexOf("http")==0?new URL(r).origin!=x:!1,C=r=="",O=history.length<3,G=C&&O,ee=D!=document.location.href;if(E&&ee||G){const _=history.state||{};_.concorde=_.concorde||{},_.concorde.hasDoneHistoryBack=!0,history.pushState(_,document.title),history.back(),document.location.replace(D)}else history.back();return}let i=e.getAttribute("to")||"";if(i||(i=e.href?.toString()||""),!i)return;if(i.indexOf("#")==0){document.location.hash=i.substring(1);return}const u=new URL(i,document.location.href),a=u.pathname.split("/"),h=[];let v="";for(const x of a)x!=v&&h.push(x),v=x;i="/"+h.join("/")+u.search+(u.hash?+u.hash:""),e.hasAttribute("pushState")?history.pushState(null,"",i):e.hasAttribute("replaceState")?history.replaceState(null,"",i):document.location.href=i}static updateComponentActiveState(e){if(e.autoActive=="disabled")return;const t=e.href?.toString()||"";if(e.href&&t.indexOf("http")!=0){const r=new URL(t,document.location.href),i=new URL(e.location||"",document.location.origin);let u=!1;e.autoActive=="strict"?u=r.pathname==i.pathname&&r.hash==i.hash&&r.search==i.search:e.autoActive=="strict-path-only"?u=r.pathname==i.pathname&&r.hash==i.hash:u=i.href.indexOf(r.href)==0,u?e.setAttribute("active","true"):e.removeAttribute("active")}}},Le.listeners=[],Le.listening=!1,Le.prevURL=document.location?.href.replace(document.location.origin,""),Le);function kn(n){if(n==null||typeof n!="object"||Array.isArray(n))return n;const e={...n};return delete e._sonic_http_response_,e}const ve=class ve{constructor(e){this.addHTTPResponse=!1,this.cache="default",this.isServiceSimulated=!1,this.blockUntilDone=!1,this.keepAlive=!1,this.serviceURL=e.serviceURL,this.blockUntilDone=e.blockUntilDone||!1,this.serviceURL=="publisher://"&&(this.isServiceSimulated=!0),this.serviceURL||(this.serviceURL=document.location.origin),this.userName=e.userName,this.password=e.password,e.token&&(this.token=e.token),this.tokenProvider=e.tokenProvider,this.authToken=e.authToken,this.addHTTPResponse=e.addHTTPResponse||!1,this.credentials=e.credentials,this.cache=e.cache||"default",this.keepAlive=e.keepAlive||!1}set token(e){if(this._token=e,!e){ve.tokens.delete(this.serviceURL);return}ve.invalidTokens.includes(e)||ve.tokens.set(this.serviceURL,e)}get token(){return ve.invalidTokens.includes(this._token)?ve.tokens.get(this.serviceURL):this._token}handleInvalidToken(e){e&&(ve.invalidTokens.includes(e)||(ve.invalidTokens.push(e),this.token=null))}async handleResult(e,t){ve.firstCallDoneFlags.set(this.serviceURL,"done"),this.lastResult=e;const r=e.headers.get("content-type")?.toLowerCase(),i=e.status;let u={};if(!r||r.indexOf("text/")==0)u={text:await e.text()};else try{u=await e.json()}catch{u={}}if(this.addHTTPResponse&&sr.isObject(u)&&(u._sonic_http_response_=e),i===498&&!ve.failledTokenUpdates.has(this.serviceURL))if(this.handleInvalidToken(this.token),t.apiMethod==="get"){const h=await this.get(t.path,t.additionalHeaders);if(h==null)throw new Error("GET retry failed after token refresh");u=h}else u=await this[t.apiMethod](t.path,t.data,t.method,t.additionalHeaders);return is("sonic-api").lastResponse.set({http:e,processed:u}),u}async auth(){if(this.token)return;if(ve.tokens.has(this.serviceURL)){this.token=ve.tokens.get(this.serviceURL);return}if(!this.tokenProvider)return;let e={};this.userName&&this.password?e={Authorization:"Basic "+window.btoa(unescape(encodeURIComponent(this.userName+":"+this.password)))}:this.authToken&&(e={Authorization:"Bearer "+this.authToken});const t=new URL(this.serviceURL),r=t.protocol+"//"+t.host,i=await fetch(this.computeURL(this.tokenProvider,{serviceHost:r}),{headers:e,credentials:this.credentials,keepalive:this.keepAlive});try{const u=await i.json();u.token?this.token=u.token:ve.failledTokenUpdates.set(this.serviceURL,!0)}catch{ve.failledTokenUpdates.set(this.serviceURL,!0)}}async localGet(e,t){const r=$e.get(e),i=new URLSearchParams(t.split("?")[1]||""),u=r.get();let a=[];Array.isArray(u)?a=u:a=[u];const h=[];let v=Number.POSITIVE_INFINITY,x=0,D=0;if(i.has("limit")&&(v=parseInt(i.get("limit")||"0"),D++),i.has("offset")&&(x=parseInt(i.get("offset")||"0"),D++),D>0&&(i.delete("limit"),i.delete("offset")),i.size===0)return a.slice(x,x+v);for(const[P,E]of i.entries()){const C=E.split(",").map(O=>O.trim());for(const O of C)for(const G of a)if(typeof G!="object")isNaN(+G)?G.toString().toLowerCase().includes(E.toLowerCase())&&h.push(G):G===E&&h.push(G);else{const ee=G;if(!ee[P])continue;isNaN(+ee[P])?ee[P]?.toString().toLowerCase().includes(O.toLowerCase())&&h.push(G):ee[P]===O&&h.push(G)}}return h.slice(x,x+v)}firstCallDone(){return new Promise(e=>{if(!ve.firstCallDoneFlags.has(this.serviceURL))ve.firstCallDoneFlags.set(this.serviceURL,"loading"),e(!0);else{const t=()=>{[void 0,"loading"].includes(ve.firstCallDoneFlags.get(this.serviceURL))?window.requestAnimationFrame(t):e(!0)};t()}})}async get(e,t){const r=/dataProvider\((.*?)\)(.*?)$/;if(r.test(e)){this.blockUntilDone&&(await this.firstCallDone(),ve.firstCallDoneFlags.set(this.serviceURL,"loading"));const x=e.match(r);if(!x)throw new Error("dataProvider path is not valid");return await this.localGet(x[1],x[2])}const i={apiMethod:"get",path:e,additionalHeaders:t},u=await this.createHeaders(t),a=this.computeURL(e),h=JSON.stringify({url:a,headers:u,credentials:this.credentials,cache:this.cache,keepAlive:this.keepAlive});if(this.blockUntilDone&&(await this.firstCallDone(),ve.firstCallDoneFlags.set(this.serviceURL,"loading")),!ve.loadingGetPromises.has(h)){const x=new Promise(async D=>{try{const P=await fetch(a,{headers:u,credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),E=await this.handleResult(P,i);D({processed:E,response:this.lastResult})}catch{ve.firstCallDoneFlags.set(this.serviceURL,"error"),D(null)}});ve.loadingGetPromises.set(h,x)}const v=await ve.loadingGetPromises.get(h);return ve.loadingGetPromises.delete(h),v?(this.lastResult=v.response,v.processed):null}async getDetailed(e,t){const r=/dataProvider\((.*?)\)(.*?)$/.test(e),i=await this.get(e,t);if(i==null)return;const u=kn(i),a=this.computeURL(e);if(r)return{request:new Request(a,{method:"GET"}),result:u};const h=await this.createHeaders(t);return{request:new Request(a,{method:"GET",headers:new Headers(h),credentials:this.credentials,cache:this.cache,keepalive:this.keepAlive}),response:this.lastResult,result:u}}async sendDetailed(e,t,r,i){const u=await this.send(e,t,r,i);if(u==null)return;const a=kn(u),h=this.computeURL(e),v=await this.createHeaders({Accept:"application/json","Content-Type":"application/json",...i});return{request:new Request(h,{method:r,headers:new Headers(v),credentials:this.credentials,body:JSON.stringify(t),keepalive:this.keepAlive}),response:this.lastResult,result:a}}async postDetailed(e,t,r){return this.sendDetailed(e,t,"POST",r)}async putDetailed(e,t,r){return this.sendDetailed(e,t,"PUT",r)}async patchDetailed(e,t,r){return this.sendDetailed(e,t,"PATCH",r)}async createHeaders(e){await this.auth();const t={};return this.token&&(t.Authorization="Bearer "+this.token),t["Accept-Language"]=st.getLanguage(),e&&Object.assign(t,e),t}computeURL(e,t={}){let r="";e.startsWith("http")?r=e:r=this.serviceURL+"/"+e,r.startsWith("http")||(r=window.location.origin+r);const i=new URL(r);for(const u in t)i.searchParams.set(u,t[u]);return i.toString().replace(/([^(https?:)])\/{2,}/g,"$1/")}async send(e,t,r="POST",i){const u={apiMethod:"send",path:e,additionalHeaders:i,method:r,data:t},a=await this.createHeaders(i);a.Accept="application/json",a["Content-Type"]="application/json";const h=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:r,body:JSON.stringify(t),keepalive:this.keepAlive});return await this.handleResult(h,u)}async submitFormData(e,t,r="POST",i){const u={apiMethod:"submitFormData",path:e,additionalHeaders:i,method:r,data:t},a=await this.createHeaders(i);a.Accept="application/json";const h=new FormData,v=t;for(const D in v)h.set(D,v[D]);const x=await fetch(this.computeURL(e),{headers:a,credentials:this.credentials,method:r,body:h,keepalive:this.keepAlive});return await this.handleResult(x,u)}async put(e,t,r){return this.send(e,t,"PUT",r)}async post(e,t,r){return this.send(e,t,"POST",r)}async patch(e,t,r){return this.send(e,t,"PATCH",r)}async delete(e,t,r){return this.send(e,t,"delete",r)}};ve.loadingGetPromises=new Map,ve.tokens=new Map,ve.invalidTokens=[],ve.failledTokenUpdates=new Map,ve.firstCallDoneFlags=new Map;let Ir=ve;st.getApiConfiguration(document.body||document.documentElement);var Pn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function as(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Gt={exports:{}},os=Gt.exports,xn;function us(){return xn||(xn=1,(function(n,e){var t=[].slice;(function(r,i){return e!==null?n.exports=i():r.UrlPattern=i()})(os,function(){var r,i,u,a,h,v,x,D,P,E,C,O,G,ee,J;return P=function(_){return _.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},x=function(_,g){var U,w,k;for(k=[],U=-1,w=_.length;++U<w;)k=k.concat(g(_[U]));return k},ee=function(_,g){var U,w,k;for(k="",U=-1,w=_.length;++U<w;)k+=g(_[U]);return k},G=function(_){return new RegExp(_.toString()+"|").exec("").length-1},C=function(_,g){var U,w,k,W,F;for(W={},U=-1,k=_.length;++U<k;)w=_[U],F=g[U],F!=null&&(W[w]!=null?(Array.isArray(W[w])||(W[w]=[W[w]]),W[w].push(F)):W[w]=F);return W},r={},r.Result=function(_,g){this.value=_,this.rest=g},r.Tagged=function(_,g){this.tag=_,this.value=g},r.tag=function(_,g){return function(U){var w,k;if(w=g(U),w!=null)return k=new r.Tagged(_,w.value),new r.Result(k,w.rest)}},r.regex=function(_){return function(g){var U,w;if(U=_.exec(g),U!=null)return w=U[0],new r.Result(w,g.slice(w.length))}},r.sequence=function(){var _;return _=1<=arguments.length?t.call(arguments,0):[],function(g){var U,w,k,W,F,Z;for(U=-1,w=_.length,Z=[],W=g;++U<w;){if(k=_[U],F=k(W),F==null)return;Z.push(F.value),W=F.rest}return new r.Result(Z,W)}},r.pick=function(){var _,g;return _=arguments[0],g=2<=arguments.length?t.call(arguments,1):[],function(U){var w,k;if(k=r.sequence.apply(r,g)(U),k!=null)return w=k.value,k.value=w[_],k}},r.string=function(_){var g;return g=_.length,function(U){if(U.slice(0,g)===_)return new r.Result(_,U.slice(g))}},r.lazy=function(_){var g;return g=null,function(U){return g==null&&(g=_()),g(U)}},r.baseMany=function(_,g,U,w,k){var W,F,Z,ne;for(Z=k,ne=U?"":[];!(g!=null&&(W=g(Z),W!=null)||(F=_(Z),F==null));)U?ne+=F.value:ne.push(F.value),Z=F.rest;if(!(w&&ne.length===0))return new r.Result(ne,Z)},r.many1=function(_){return function(g){return r.baseMany(_,null,!1,!0,g)}},r.concatMany1Till=function(_,g){return function(U){return r.baseMany(_,g,!0,!0,U)}},r.firstChoice=function(){var _;return _=1<=arguments.length?t.call(arguments,0):[],function(g){var U,w,k,W;for(U=-1,w=_.length;++U<w;)if(k=_[U],W=k(g),W!=null)return W}},O=function(_){var g;return g={},g.wildcard=r.tag("wildcard",r.string(_.wildcardChar)),g.optional=r.tag("optional",r.pick(1,r.string(_.optionalSegmentStartChar),r.lazy(function(){return g.pattern}),r.string(_.optionalSegmentEndChar))),g.name=r.regex(new RegExp("^["+_.segmentNameCharset+"]+")),g.named=r.tag("named",r.pick(1,r.string(_.segmentNameStartChar),r.lazy(function(){return g.name}))),g.escapedChar=r.pick(1,r.string(_.escapeChar),r.regex(/^./)),g.static=r.tag("static",r.concatMany1Till(r.firstChoice(r.lazy(function(){return g.escapedChar}),r.regex(/^./)),r.firstChoice(r.string(_.segmentNameStartChar),r.string(_.optionalSegmentStartChar),r.string(_.optionalSegmentEndChar),g.wildcard))),g.token=r.lazy(function(){return r.firstChoice(g.wildcard,g.optional,g.named,g.static)}),g.pattern=r.many1(r.lazy(function(){return g.token})),g},D={escapeChar:"\\",segmentNameStartChar:":",segmentValueCharset:"a-zA-Z0-9-_~ %",segmentNameCharset:"a-zA-Z0-9",optionalSegmentStartChar:"(",optionalSegmentEndChar:")",wildcardChar:"*"},v=function(_,g){if(Array.isArray(_))return ee(_,function(U){return v(U,g)});switch(_.tag){case"wildcard":return"(.*?)";case"named":return"(["+g+"]+)";case"static":return P(_.value);case"optional":return"(?:"+v(_.value,g)+")?"}},h=function(_,g){return g==null&&(g=D.segmentValueCharset),"^"+v(_,g)+"$"},a=function(_){if(Array.isArray(_))return x(_,a);switch(_.tag){case"wildcard":return["_"];case"named":return[_.value];case"static":return[];case"optional":return a(_.value)}},E=function(_,g,U,w){var k,W,F,Z;if(w==null&&(w=!1),Z=_[g],Z==null){if(w)throw new Error("no values provided for key `"+g+"`");return}if(k=U[g]||0,W=Array.isArray(Z)?Z.length-1:0,k>W){if(w)throw new Error("too few values provided for key `"+g+"`");return}return F=Array.isArray(Z)?Z[k]:Z,w&&(U[g]=k+1),F},u=function(_,g,U){var w,k;if(Array.isArray(_)){for(w=-1,k=_.length;++w<k;)if(u(_[w],g,U))return!0;return!1}switch(_.tag){case"wildcard":return E(g,"_",U,!1)!=null;case"named":return E(g,_.value,U,!1)!=null;case"static":return!1;case"optional":return u(_.value,g,U)}},J=function(_,g,U){if(Array.isArray(_))return ee(_,function(w){return J(w,g,U)});switch(_.tag){case"wildcard":return E(g,"_",U,!0);case"named":return E(g,_.value,U,!0);case"static":return _.value;case"optional":return u(_.value,g,U)?J(_.value,g,U):""}},i=function(_,g){var U,w,k,W,F;if(_ instanceof i){this.isRegex=_.isRegex,this.regex=_.regex,this.ast=_.ast,this.names=_.names;return}if(this.isRegex=_ instanceof RegExp,!(typeof _=="string"||this.isRegex))throw new TypeError("argument must be a regex or a string");if(this.isRegex){if(this.regex=_,g!=null){if(!Array.isArray(g))throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");if(U=G(this.regex),g.length!==U)throw new Error("regex contains "+U+" groups but array of group names contains "+g.length);this.names=g}return}if(_==="")throw new Error("argument must not be the empty string");if(F=_.replace(/\s+/g,""),F!==_)throw new Error("argument must not contain whitespace");if(w={escapeChar:g?.escapeChar||D.escapeChar,segmentNameStartChar:g?.segmentNameStartChar||D.segmentNameStartChar,segmentNameCharset:g?.segmentNameCharset||D.segmentNameCharset,segmentValueCharset:g?.segmentValueCharset||D.segmentValueCharset,optionalSegmentStartChar:g?.optionalSegmentStartChar||D.optionalSegmentStartChar,optionalSegmentEndChar:g?.optionalSegmentEndChar||D.optionalSegmentEndChar,wildcardChar:g?.wildcardChar||D.wildcardChar},W=O(w),k=W.pattern(_),k==null)throw new Error("couldn't parse pattern");if(k.rest!=="")throw new Error("could only partially parse pattern");this.ast=k.value,this.regex=new RegExp(h(this.ast,w.segmentValueCharset)),this.names=a(this.ast)},i.prototype.match=function(_){var g,U;return U=this.regex.exec(_),U==null?null:(g=U.slice(1),this.names?C(this.names,g):g)},i.prototype.stringify=function(_){if(_==null&&(_={}),this.isRegex)throw new Error("can't stringify patterns generated from a regex");if(_!==Object(_))throw new Error("argument must be an object or undefined");return J(this.ast,_,{})},i.escapeForRegex=P,i.concatMap=x,i.stringConcatMap=ee,i.regexGroupCount=G,i.keysAndValuesToObject=C,i.P=r,i.newParser=O,i.defaultOptions=D,i.astNodeToRegexString=h,i.astNodeToNames=a,i.getParam=E,i.astNodeContainsSegmentsForProvidedParams=u,i.stringify=J,i})})(Gt,Gt.exports)),Gt.exports}var cs=us();const ls=as(cs);class Gr{constructor(e){this.path=Gr.normalizePath(e)}getDataProviderKey(){return new ir(this.path)}static normalizePath(e){const t=String(e).trim();if(!t)throw new RangeError("Endpoint: path cannot be empty");if(/^https?:\/\//i.test(t)){let v;try{v=new URL(t)}catch{throw new RangeError("Endpoint: invalid absolute URL")}return v.pathname=v.pathname.replace(/\/+/g,"/"),v.href}const r=t.indexOf("?"),i=t.indexOf("#");let u=t.length;r>=0&&(u=Math.min(u,r)),i>=0&&(u=Math.min(u,i));let a=t.slice(0,u);const h=t.slice(u);if(a=a.replace(/^\/+/,""),a=a.replace(/\/+/g,"/"),!a&&h)throw new RangeError("Endpoint: path cannot be empty");return a+h}static isNonEmpty(e){return String(e).trim().length>0}static looksLikeDataProviderPath(e){return/^\s*dataProvider\s*\(/i.test(String(e))}toString(){return this.path}}function ur(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Br={exports:{}},Cn;function fs(){return Cn||(Cn=1,(function(n,e){(function(t){n.exports=t()})(function(){return(function(){function t(r,i,u){function a(x,D){if(!i[x]){if(!r[x]){var P=typeof ur=="function"&&ur;if(!D&&P)return P(x,!0);if(h)return h(x,!0);var E=new Error("Cannot find module '"+x+"'");throw E.code="MODULE_NOT_FOUND",E}var C=i[x]={exports:{}};r[x][0].call(C.exports,function(O){var G=r[x][1][O];return a(G||O)},C,C.exports,t,r,i,u)}return i[x].exports}for(var h=typeof ur=="function"&&ur,v=0;v<u.length;v++)a(u[v]);return a}return t})()({1:[function(t,r,i){const u=t("./utils"),a=(function(){const h=u.stringToArray,v=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],x=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],D=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],P=["Thousand","Million","Billion","Trillion"];function E(S,R){var T=function(B,N,L){var q="";if(B<=19)q=(N?" and ":"")+(L?x[B]:v[B]);else if(B<100){const le=Math.floor(B/10),se=B%10;q=(N?" and ":"")+D[le-2],se>0?q+="-"+T(se,!1,L):L&&(q=q.substring(0,q.length-1)+"ieth")}else if(B<1e3){const le=Math.floor(B/100),se=B%100;q=(N?", ":"")+v[le]+" Hundred",se>0?q+=T(se,!0,L):L&&(q+="th")}else{var V=Math.floor(Math.log10(B)/3);V>P.length&&(V=P.length);const le=Math.pow(10,V*3),se=Math.floor(B/le),K=B-se*le;q=(N?", ":"")+T(se,!1,!1)+" "+P[V-1],K>0?q+=T(K,!0,L):L&&(q+="th")}return q},M=T(S,!1,R);return M}const C=Object.create(null);v.forEach(function(S,R){C[S.toLowerCase()]=R}),x.forEach(function(S,R){C[S.toLowerCase()]=R}),D.forEach(function(S,R){const T=S.toLowerCase();C[T]=(R+2)*10,C[T.substring(0,S.length-1)+"ieth"]=C[T]}),C.hundredth=100,P.forEach(function(S,R){const T=S.toLowerCase(),M=Math.pow(10,(R+1)*3);C[T]=M,C[T+"th"]=M});function O(S){const T=S.split(/,\s|\sand\s|[\s\\-]/).map(N=>C[N]);let M=[0];return T.forEach(N=>{if(N<100){let L=M.pop();L>=1e3&&(M.push(L),L=0),M.push(L+N)}else M.push(M.pop()*N)}),M.reduce((N,L)=>N+L,0)}const G=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],ee={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function J(S){for(var R=0;R<G.length;R++){const T=G[R];if(S>=T[0])return T[1]+J(S-T[0])}return""}function _(S){for(var R=0,T=1,M=S.length-1;M>=0;M--){const B=S[M],N=ee[B];N<T?R-=N:(T=N,R+=N)}return R}function g(S,R){for(var T=[],M=R.charCodeAt(0);S>0;)T.unshift(String.fromCharCode((S-1)%26+M)),S=Math.floor((S-1)/26);return T.join("")}function U(S,R){for(var T=R.charCodeAt(0),M=0,B=0;B<S.length;B++)M+=(S.charCodeAt(S.length-B-1)-T+1)*Math.pow(26,B);return M}function w(S,R){if(typeof S>"u")return;S=Math.floor(S);const T=ne(R);return F(S,T)}const k={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},W={UPPER:"upper",LOWER:"lower",TITLE:"title"};function F(S,R){let T;const M=S<0;switch(S=Math.abs(S),R.primary){case k.LETTERS:T=g(S,R.case===W.UPPER?"A":"a");break;case k.ROMAN:T=J(S),R.case===W.UPPER&&(T=T.toUpperCase());break;case k.WORDS:T=E(S,R.ordinal),R.case===W.UPPER?T=T.toUpperCase():R.case===W.LOWER&&(T=T.toLowerCase());break;case k.DECIMAL:T=""+S;var B=R.mandatoryDigits-T.length;if(B>0){var N=new Array(B+1).join("0");T=N+T}if(R.zeroCode!==48&&(T=h(T).map(le=>String.fromCodePoint(le.codePointAt(0)+R.zeroCode-48)).join("")),R.regular){const le=Math.floor((T.length-1)/R.groupingSeparators.position);for(let se=le;se>0;se--){const K=T.length-se*R.groupingSeparators.position;T=T.substr(0,K)+R.groupingSeparators.character+T.substr(K)}}else R.groupingSeparators.reverse().forEach(le=>{const se=T.length-le.position;T=T.substr(0,se)+le.character+T.substr(se)});if(R.ordinal){var L={1:"st",2:"nd",3:"rd"},q=T[T.length-1],V=L[q];(!V||T.length>1&&T[T.length-2]==="1")&&(V="th"),T=T+V}break;case k.SEQUENCE:throw{code:"D3130",value:R.token}}return M&&(T="-"+T),T}const Z=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function ne(S){const R={type:"integer",primary:k.DECIMAL,case:W.LOWER,ordinal:!1};let T,M;const B=S.lastIndexOf(";");switch(B===-1?T=S:(T=S.substring(0,B),M=S.substring(B+1),M[0]==="o"&&(R.ordinal=!0)),T){case"A":R.case=W.UPPER;case"a":R.primary=k.LETTERS;break;case"I":R.case=W.UPPER;case"i":R.primary=k.ROMAN;break;case"W":R.case=W.UPPER,R.primary=k.WORDS;break;case"Ww":R.case=W.TITLE,R.primary=k.WORDS;break;case"w":R.primary=k.WORDS;break;default:{let N=null,L=0,q=0,V=[],le=0;if(h(T).map(K=>K.codePointAt(0)).reverse().forEach(K=>{let X=!1;for(let oe=0;oe<Z.length;oe++){const Y=Z[oe];if(K>=Y&&K<=Y+9){if(X=!0,L++,le++,N===null)N=Y;else if(Y!==N)throw{code:"D3131"};break}}X||(K===35?(le++,q++):V.push({position:le,character:String.fromCodePoint(K)}))}),L>0){R.primary=k.DECIMAL,R.zeroCode=N,R.mandatoryDigits=L,R.optionalDigits=q;const X=function(oe){if(oe.length===0)return 0;const Y=oe[0].character;for(let Ue=1;Ue<oe.length;Ue++)if(oe[Ue].character!==Y)return 0;const Ne=oe.map(Ue=>Ue.position),Ze=function(Ue,Be){return Be===0?Ue:Ze(Be,Ue%Be)},Ge=Ne.reduce(Ze);for(let Ue=1;Ue<=Ne.length;Ue++)if(Ne.indexOf(Ue*Ge)===-1)return 0;return Ge}(V);X>0?(R.regular=!0,R.groupingSeparators={position:X,character:V[0].character}):(R.regular=!1,R.groupingSeparators=V)}else R.primary=k.SEQUENCE,R.token=T}}return R}const we={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function pe(S){var R=[];const T={type:"datetime",parts:R},M=function(X,oe){if(oe>X){let Y=S.substring(X,oe);Y=Y.split("]]").join("]"),R.push({type:"literal",value:Y})}};for(var B=0,N=0;N<S.length;){if(S.charAt(N)==="["){if(S.charAt(N+1)==="["){M(B,N),R.push({type:"literal",value:"["}),N+=2,B=N;continue}if(M(B,N),B=N,N=S.indexOf("]",B),N===-1)throw{code:"D3135"};let X=S.substring(B+1,N);X=X.split(/\s+/).join("");var L={type:"marker",component:X.charAt(0)},q=X.lastIndexOf(","),V;if(q!==-1){const oe=X.substring(q+1),Y=oe.indexOf("-");let Ne,Ze;const Ge=function(Be){if(!(typeof Be>"u"||Be==="*"))return parseInt(Be)};Y===-1?Ne=oe:(Ne=oe.substring(0,Y),Ze=oe.substring(Y+1));const Ue={min:Ge(Ne),max:Ge(Ze)};L.width=Ue,V=X.substring(1,q)}else V=X.substring(1);if(V.length===1)L.presentation1=V;else if(V.length>1){var le=V.charAt(V.length-1);"atco".indexOf(le)!==-1?(L.presentation2=le,le==="o"&&(L.ordinal=!0),L.presentation1=V.substring(0,V.length-1)):L.presentation1=V}else L.presentation1=we[L.component];if(typeof L.presentation1>"u")throw{code:"D3132",value:L.component};if(L.presentation1[0]==="n")L.names=W.LOWER;else if(L.presentation1[0]==="N")L.presentation1[1]==="n"?L.names=W.TITLE:L.names=W.UPPER;else if("YMDdFWwXxHhmsf".indexOf(L.component)!==-1){var se=L.presentation1;if(L.presentation2&&(se+=";"+L.presentation2),L.integerFormat=ne(se),L.width&&L.width.min!==void 0&&L.integerFormat.mandatoryDigits<L.width.min&&(L.integerFormat.mandatoryDigits=L.width.min),L.component==="Y")if(L.n=-1,L.width&&L.width.max!==void 0)L.n=L.width.max,L.integerFormat.mandatoryDigits=L.n;else{var K=L.integerFormat.mandatoryDigits+L.integerFormat.optionalDigits;K>=2&&(L.n=K)}const oe=R[R.length-1];oe&&oe.integerFormat&&(oe.integerFormat.parseWidth=oe.integerFormat.mandatoryDigits)}(L.component==="Z"||L.component==="z")&&(L.integerFormat=ne(L.presentation1)),R.push(L),B=N+1}N++}return M(B,N),T}const he=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],Pe=["January","February","March","April","May","June","July","August","September","October","November","December"],Ye=1e3*60*60*24,ae=function(S){const R=Date.UTC(S.year,S.month);var T=new Date(R).getUTCDay();return T===0&&(T=7),T>4?R+(8-T)*Ye:R-(T-1)*Ye},de=function(S,R){return{year:S,month:R,nextMonth:function(){return R===11?de(S+1,0):de(S,R+1)},previousMonth:function(){return R===0?de(S-1,11):de(S,R-1)},nextYear:function(){return de(S+1,R)},previousYear:function(){return de(S-1,R)}}},He=function(S,R){return(R-S)/(Ye*7)+1},te=(S,R)=>{let T;switch(R){case"Y":T=S.getUTCFullYear();break;case"M":T=S.getUTCMonth()+1;break;case"D":T=S.getUTCDate();break;case"d":{const M=Date.UTC(S.getUTCFullYear(),S.getUTCMonth(),S.getUTCDate()),B=Date.UTC(S.getUTCFullYear(),0);T=(M-B)/Ye+1;break}case"F":T=S.getUTCDay(),T===0&&(T=7);break;case"W":{const M=de(S.getUTCFullYear(),0),B=ae(M),N=Date.UTC(M.year,S.getUTCMonth(),S.getUTCDate());let L=He(B,N);if(L>52){const q=ae(M.nextYear());N>=q&&(L=1)}else if(L<1){const q=ae(M.previousYear());L=He(q,N)}T=Math.floor(L);break}case"w":{const M=de(S.getUTCFullYear(),S.getUTCMonth()),B=ae(M),N=Date.UTC(M.year,M.month,S.getUTCDate());let L=He(B,N);if(L>4){const q=ae(M.nextMonth());N>=q&&(L=1)}else if(L<1){const q=ae(M.previousMonth());L=He(q,N)}T=Math.floor(L);break}case"X":{const M=de(S.getUTCFullYear(),0),B=ae(M),N=ae(M.nextYear()),L=S.getTime();L<B?T=M.year-1:L>=N?T=M.year+1:T=M.year;break}case"x":{const M=de(S.getUTCFullYear(),S.getUTCMonth()),B=ae(M),N=M.nextMonth(),L=ae(N),q=S.getTime();q<B?T=M.previousMonth().month+1:q>=L?T=N.month+1:T=M.month+1;break}case"H":T=S.getUTCHours();break;case"h":T=S.getUTCHours(),T=T%12,T===0&&(T=12);break;case"P":T=S.getUTCHours()>=12?"pm":"am";break;case"m":T=S.getUTCMinutes();break;case"s":T=S.getUTCSeconds();break;case"f":T=S.getUTCMilliseconds();break;case"Z":case"z":break;case"C":T="ISO";break;case"E":T="ISO";break}return T};let xe=null;function rt(S,R,T){var M=0,B=0;if(typeof T<"u"){const se=parseInt(T);M=Math.floor(se/100),B=se%100}var N=function(se,K){var X=te(se,K.component);if("YMDdFWwXxHhms".indexOf(K.component)!==-1)if(K.component==="Y"&&K.n!==-1&&(X=X%Math.pow(10,K.n)),K.names){if(K.component==="M"||K.component==="x")X=Pe[X-1];else if(K.component==="F")X=he[X];else throw{code:"D3133",value:K.component};K.names===W.UPPER?X=X.toUpperCase():K.names===W.LOWER&&(X=X.toLowerCase()),K.width&&X.length>K.width.max&&(X=X.substring(0,K.width.max))}else X=F(X,K.integerFormat);else if(K.component==="f")X=F(X,K.integerFormat);else if(K.component==="Z"||K.component==="z"){const oe=M*100+B;if(K.integerFormat.regular)X=F(oe,K.integerFormat);else{const Y=K.integerFormat.mandatoryDigits;if(Y===1||Y===2)X=F(M,K.integerFormat),B!==0&&(X+=":"+w(B,"00"));else if(Y===3||Y===4)X=F(oe,K.integerFormat);else throw{code:"D3134",value:Y}}oe>=0&&(X="+"+X),K.component==="z"&&(X="GMT"+X),oe===0&&K.presentation2==="t"&&(X="Z")}else K.component==="P"&&K.names===W.UPPER&&(X=X.toUpperCase());return X};let L;typeof R>"u"?(xe===null&&(xe=pe("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),L=xe):L=pe(R);const q=(60*M+B)*60*1e3,V=new Date(S+q);let le="";return L.parts.forEach(function(se){se.type==="literal"?le+=se.value:le+=N(V,se)}),le}function d(S){var R=Object.create(null);if(S.type==="datetime")R.type="datetime",R.parts=S.parts.map(function(T){var M=Object.create(null);if(T.type==="literal")M.regex=T.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if(T.component==="Z"||T.component==="z"){let N;Array.isArray(T.integerFormat.groupingSeparators)||(N=T.integerFormat.groupingSeparators),M.regex="",T.component==="z"&&(M.regex="GMT"),M.regex+="[-+][0-9]+",N&&(M.regex+=N.character+"[0-9]+"),M.parse=function(L){T.component==="z"&&(L=L.substring(3));let q=0,V=0;return N?(q=Number.parseInt(L.substring(0,L.indexOf(N.character))),V=Number.parseInt(L.substring(L.indexOf(N.character)+1))):L.length-1<=2?q=Number.parseInt(L):(q=Number.parseInt(L.substring(0,3)),V=Number.parseInt(L.substring(3))),q*60+V}}else if(T.component==="f")M.regex="[0-9]+",M.parse=function(N){return parseFloat("0."+N.substring(0,3))*1e3};else if(T.integerFormat)M=d(T.integerFormat);else{M.regex="[a-zA-Z]+";var B=Object.create(null);if(T.component==="M"||T.component==="x")Pe.forEach(function(N,L){T.width&&T.width.max?B[N.substring(0,T.width.max)]=L+1:B[N]=L+1});else if(T.component==="F")he.forEach(function(N,L){L>0&&(T.width&&T.width.max?B[N.substring(0,T.width.max)]=L:B[N]=L)});else if(T.component==="P")B={am:0,AM:0,pm:1,PM:1};else throw{code:"D3133",value:T.component};M.parse=function(N){return B[N]}}return M.component=T.component,M});else{R.type="integer";const T=S.case===W.UPPER;switch(S.primary){case k.LETTERS:R.regex=T?"[A-Z]+":"[a-z]+",R.parse=function(M){return U(M,T?"A":"a")};break;case k.ROMAN:R.regex=T?"[MDCLXVI]+":"[mdclxvi]+",R.parse=function(M){return _(T?M:M.toUpperCase())};break;case k.WORDS:R.regex="(?:"+u.keys(C).concat("and","[\\-, ]").join("|")+")+",R.parse=function(M){return O(M.toLowerCase())};break;case k.DECIMAL:R.regex="[0-9]",S.parseWidth?R.regex+=`{${S.parseWidth}}`:R.regex+="+",S.ordinal&&(R.regex+="(?:th|st|nd|rd)"),R.parse=function(M){let B=M;return S.ordinal&&(B=M.substring(0,M.length-2)),S.regular?B=B.split(",").join(""):S.groupingSeparators.forEach(N=>{B=B.split(N.character).join("")}),S.zeroCode!==48&&(B=B.split("").map(N=>String.fromCodePoint(N.codePointAt(0)-S.zeroCode+48)).join("")),parseInt(B)};break;case k.SEQUENCE:throw{code:"D3130",value:S.token}}}return R}function b(S,R){if(typeof S>"u")return;const T=ne(R);return d(T).parse(S)}function z(S,R){const T=pe(R),M=d(T),B="^"+M.parts.map(V=>"("+V.regex+")").join("")+"$";var L=new RegExp(B,"i").exec(S);if(L!==null){const Y=Object.create(null);for(let c=1;c<L.length;c++){const f=M.parts[c-1];f.parse&&(Y[f.component]=f.parse(L[c]))}if(Object.getOwnPropertyNames(Y).length===0)return;let Ne=0;const Ze=c=>{Ne<<=1,Ne+=c?1:0},Ge=c=>!(~c&Ne)&&!!(c&Ne);"YXMxWwdD".split("").forEach(c=>Ze(Y[c]));const Be=!Ge(161)&&Ge(130),ot=Ge(84),Ct=!ot&&Ge(72);Ne=0,"PHhmsf".split("").forEach(c=>Ze(Y[c]));const j=!Ge(23)&&Ge(47),et=(Be?"YD":ot?"XxwF":Ct?"XWF":"YMD")+(j?"Phmsf":"Hmsf"),Yt=this.environment.timestamp;let nt=!1,bt=!1;if(et.split("").forEach(c=>{if(typeof Y[c]>"u")nt?(Y[c]="MDd".indexOf(c)!==-1?1:0,bt=!0):Y[c]=te(Yt,c);else if(nt=!0,bt)throw{code:"D3136"}}),Y.M>0?Y.M-=1:Y.M=0,Be){const c=Date.UTC(Y.Y,0),f=(Y.d-1)*1e3*60*60*24,p=new Date(c+f);Y.M=p.getUTCMonth(),Y.D=p.getUTCDate()}if(ot)throw{code:"D3136"};if(Ct)throw{code:"D3136"};j&&(Y.H=Y.h===12?0:Y.h,Y.P===1&&(Y.H+=12));var q=Date.UTC(Y.Y,Y.M,Y.D,Y.H,Y.m,Y.s,Y.f);return(Y.Z||Y.z)&&(q-=(Y.Z||Y.z)*60*1e3),q}}var ce=new RegExp("^\\d{4}(-[01]\\d)?(-[0-3]\\d)?(T[0-2]\\d:[0-5]\\d:[0-5]\\d)?(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");function Ee(S,R){if(!(typeof S>"u"))if(typeof R>"u"){if(!ce.test(S))throw{stack:new Error().stack,code:"D3110",value:S};return Date.parse(S)}else return z.call(this,S,R)}function ye(S,R,T){if(!(typeof S>"u"))return rt.call(this,S,R,T)}return{formatInteger:w,parseInteger:b,fromMillis:ye,toMillis:Ee}})();r.exports=a},{"./utils":6}],2:[function(t,r,i){(function(u){(function(){var a=t("./utils");const h=(()=>{var v=a.isNumeric,x=a.isArrayOfStrings,D=a.isArrayOfNumbers,P=a.isSequence,E=a.isFunction,C=a.isLambda,O=a.isPromise,G=a.getFunctionArity,ee=a.isDeepEqual,J=a.stringToArray;function _(s){if(!(typeof s>"u")){var o=0;return s.forEach(function(l){o+=l}),o}}function g(s){return typeof s>"u"?0:s.length}function U(s){if(!(typeof s>"u"||s.length===0))return Math.max.apply(Math,s)}function w(s){if(!(typeof s>"u"||s.length===0))return Math.min.apply(Math,s)}function k(s){if(!(typeof s>"u"||s.length===0)){var o=0;return s.forEach(function(l){o+=l}),o/s.length}}function W(s,o=!1){if(!(typeof s>"u")){var l;if(typeof s=="string")l=s;else if(E(s))l="";else{if(typeof s=="number"&&!isFinite(s))throw{code:"D3001",value:s,stack:new Error().stack};var y=o?2:0;Array.isArray(s)&&s.outerWrapper&&(s=s[0]),l=JSON.stringify(s,function(m,A){return typeof A<"u"&&A!==null&&v(A)?A.toPrecision&&!Number.isInteger(A)?Number(A.toPrecision(15)):A:A&&E(A)?"":A},y)}return l}}function F(s,o,l){if(!(typeof s>"u")){var y=J(s),m=y.length;if(m+o<0&&(o=0),typeof l<"u"){if(l<=0)return"";var A=o>=0?o+l:m+o+l;return y.slice(o,A).join("")}return y.slice(o).join("")}}function Z(s,o){if(!(typeof s>"u")){var l=s.indexOf(o);return l>-1?s.substr(0,l):s}}function ne(s,o){if(!(typeof s>"u")){var l=s.indexOf(o);return l>-1?s.substr(l+o.length):s}}function we(s){if(!(typeof s>"u"))return s.toLowerCase()}function pe(s){if(!(typeof s>"u"))return s.toUpperCase()}function he(s){if(!(typeof s>"u"))return J(s).length}function Pe(s){if(!(typeof s>"u")){var o=s.replace(/[ \t\n\r]+/gm," ");return o.charAt(0)===" "&&(o=o.substring(1)),o.charAt(o.length-1)===" "&&(o=o.substring(0,o.length-1)),o}}function Ye(s,o,l){if(!(typeof s>"u")){(typeof l>"u"||l.length===0)&&(l=" ");var y;o=Math.trunc(o);var m=Math.abs(o)-he(s);if(m>0){var A=new Array(m+1).join(l);l.length>1&&(A=F(A,0,m)),o>0?y=s+A:y=A+s}else y=s;return y}}async function ae(s,o){var l=s.apply(this,[o]);if(O(l)&&(l=await l),l&&!(typeof l.start=="number"||l.end==="number"||Array.isArray(l.groups)||E(l.next)))throw{code:"T1010",stack:new Error().stack};return l}async function de(s,o){if(!(typeof s>"u"||typeof o>"u")){var l;if(typeof o=="string")l=s.indexOf(o)!==-1;else{var y=await ae(o,s);l=typeof y<"u"}return l}}async function He(s,o,l){if(!(typeof s>"u")){if(l<0)throw{stack:new Error().stack,value:l,code:"D3040",index:3};var y=this.createSequence();if(typeof l>"u"||l>0){var m=0,A=await ae(o,s);if(typeof A<"u")for(;typeof A<"u"&&(typeof l>"u"||m<l);)y.push({match:A.match,index:A.start,groups:A.groups}),A=await ae(A.next),m++}return y}}async function te(s,o,l,y){if(!(typeof s>"u")){var m=this;if(o==="")throw{code:"D3010",stack:new Error().stack,value:o,index:2};if(y<0)throw{code:"D3011",stack:new Error().stack,value:y,index:4};var A;typeof l=="string"?A=function(Se){for(var De="",ge=0,Ce=l.indexOf("$",ge);Ce!==-1&&ge<l.length;){De+=l.substring(ge,Ce),ge=Ce+1;var Qe=l.charAt(ge);if(Qe==="$")De+="$",ge++;else if(Qe==="0")De+=Se.match,ge++;else{var qe;if(Se.groups.length===0?qe=1:qe=Math.floor(Math.log(Se.groups.length)*Math.LOG10E)+1,Ce=parseInt(l.substring(ge,ge+qe),10),qe>1&&Ce>Se.groups.length&&(Ce=parseInt(l.substring(ge,ge+qe-1),10)),isNaN(Ce))De+="$";else{if(Se.groups.length>0){var it=Se.groups[Ce-1];typeof it<"u"&&(De+=it)}ge+=Ce.toString().length}}Ce=l.indexOf("$",ge)}return De+=l.substring(ge),De}:A=l;var $="",I=0;if(typeof y>"u"||y>0){var re=0;if(typeof o=="string"){for(var H=s.indexOf(o,I);H!==-1&&(typeof y>"u"||re<y);)$+=s.substring(I,H),$+=l,I=H+o.length,re++,H=s.indexOf(o,I);$+=s.substring(I)}else{var be=await ae(o,s);if(typeof be<"u"){for(;typeof be<"u"&&(typeof y>"u"||re<y);){$+=s.substring(I,be.start);var _e=A.apply(m,[be]);if(O(_e)&&(_e=await _e),typeof _e=="string")$+=_e;else throw{code:"D3012",stack:new Error().stack,value:_e};I=be.start+be.match.length,re++,be=await ae(be.next)}$+=s.substring(I)}else $=s}}else $=s;return $}}function xe(s){if(!(typeof s>"u")){var o=typeof window<"u"?window.btoa:function(l){return new u.Buffer.from(l,"binary").toString("base64")};return o(s)}}function rt(s){if(!(typeof s>"u")){var o=typeof window<"u"?window.atob:function(l){return new u.Buffer.from(l,"base64").toString("binary")};return o(s)}}function d(s){if(!(typeof s>"u")){var o;try{o=encodeURIComponent(s)}catch{throw{code:"D3140",stack:new Error().stack,value:s,functionName:"encodeUrlComponent"}}return o}}function b(s){if(!(typeof s>"u")){var o;try{o=encodeURI(s)}catch{throw{code:"D3140",stack:new Error().stack,value:s,functionName:"encodeUrl"}}return o}}function z(s){if(!(typeof s>"u")){var o;try{o=decodeURIComponent(s)}catch{throw{code:"D3140",stack:new Error().stack,value:s,functionName:"decodeUrlComponent"}}return o}}function ce(s){if(!(typeof s>"u")){var o;try{o=decodeURI(s)}catch{throw{code:"D3140",stack:new Error().stack,value:s,functionName:"decodeUrl"}}return o}}async function Ee(s,o,l){if(!(typeof s>"u")){if(l<0)throw{code:"D3020",stack:new Error().stack,value:l,index:3};var y=[];if(typeof l>"u"||l>0)if(typeof o=="string")y=s.split(o,l);else{var m=0,A=await ae(o,s);if(typeof A<"u"){for(var $=0;typeof A<"u"&&(typeof l>"u"||m<l);)y.push(s.substring($,A.start)),$=A.end,A=await ae(A.next),m++;(typeof l>"u"||m<l)&&y.push(s.substring($))}else y.push(s)}return y}}function ye(s,o){if(!(typeof s>"u"))return typeof o>"u"&&(o=""),s.join(o)}function S(s,o,l){if(!(typeof s>"u")){var y={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"},m=y;typeof l<"u"&&a.keys(l).forEach(function(Q){m[Q]=l[Q]});for(var A=[],$=m["zero-digit"].charCodeAt(0),I=$;I<$+10;I++)A.push(String.fromCharCode(I));var re=A.concat([m["decimal-separator"],m["exponent-separator"],m["grouping-separator"],m.digit,m["pattern-separator"]]),H=o.split(m["pattern-separator"]);if(H.length>2)throw{code:"D3080",stack:new Error().stack};var be=function(Q){var ke=(function(){for(var Me,Ke=0;Ke<Q.length;Ke++)if(Me=Q.charAt(Ke),re.indexOf(Me)!==-1&&Me!==m["exponent-separator"])return Q.substring(0,Ke);return""})(),We=(function(){for(var Me,Ke=Q.length-1;Ke>=0;Ke--)if(Me=Q.charAt(Ke),re.indexOf(Me)!==-1&&Me!==m["exponent-separator"])return Q.substring(Ke+1);return""})(),Ae=Q.substring(ke.length,Q.length-We.length),Ve,pt,Xe,wt,Je=Q.indexOf(m["exponent-separator"],ke.length);Je===-1||Je>Q.length-We.length?(Ve=Ae,pt=void 0):(Ve=Ae.substring(0,Je),pt=Ae.substring(Je+1));var tt=Ve.indexOf(m["decimal-separator"]);return tt===-1?(Xe=Ve,wt=We):(Xe=Ve.substring(0,tt),wt=Ve.substring(tt+1)),{prefix:ke,suffix:We,activePart:Ae,mantissaPart:Ve,exponentPart:pt,integerPart:Xe,fractionalPart:wt,subpicture:Q}},_e=function(Q){var ke,We,Ae=Q.subpicture,Ve=Ae.indexOf(m["decimal-separator"]);Ve!==Ae.lastIndexOf(m["decimal-separator"])&&(ke="D3081"),Ae.indexOf(m.percent)!==Ae.lastIndexOf(m.percent)&&(ke="D3082"),Ae.indexOf(m["per-mille"])!==Ae.lastIndexOf(m["per-mille"])&&(ke="D3083"),Ae.indexOf(m.percent)!==-1&&Ae.indexOf(m["per-mille"])!==-1&&(ke="D3084");var pt=!1;for(We=0;We<Q.mantissaPart.length;We++){var Xe=Q.mantissaPart.charAt(We);if(A.indexOf(Xe)!==-1||Xe===m.digit){pt=!0;break}}pt||(ke="D3085");var wt=Q.activePart.split("").map(function(Me){return re.indexOf(Me)===-1?"p":"a"}).join("");wt.indexOf("p")!==-1&&(ke="D3086"),Ve!==-1?(Ae.charAt(Ve-1)===m["grouping-separator"]||Ae.charAt(Ve+1)===m["grouping-separator"])&&(ke="D3087"):Q.integerPart.charAt(Q.integerPart.length-1)===m["grouping-separator"]&&(ke="D3088"),Ae.indexOf(m["grouping-separator"]+m["grouping-separator"])!==-1&&(ke="D3089");var Je=Q.integerPart.indexOf(m.digit);Je!==-1&&Q.integerPart.substring(0,Je).split("").filter(function(Me){return A.indexOf(Me)>-1}).length>0&&(ke="D3090"),Je=Q.fractionalPart.lastIndexOf(m.digit),Je!==-1&&Q.fractionalPart.substring(Je).split("").filter(function(Me){return A.indexOf(Me)>-1}).length>0&&(ke="D3091");var tt=typeof Q.exponentPart=="string";if(tt&&Q.exponentPart.length>0&&(Ae.indexOf(m.percent)!==-1||Ae.indexOf(m["per-mille"])!==-1)&&(ke="D3092"),tt&&(Q.exponentPart.length===0||Q.exponentPart.split("").filter(function(Me){return A.indexOf(Me)===-1}).length>0)&&(ke="D3093"),ke)throw{code:ke,stack:new Error().stack}},Se=function(Q){var ke=function(Ie,wr){for(var Zt=[],ut=Ie.indexOf(m["grouping-separator"]);ut!==-1;){var Er=(wr?Ie.substring(0,ut):Ie.substring(ut)).split("").filter(function(Ut){return A.indexOf(Ut)!==-1||Ut===m.digit}).length;Zt.push(Er),ut=Q.integerPart.indexOf(m["grouping-separator"],ut+1)}return Zt},We=ke(Q.integerPart),Ae=function(Ie){if(Ie.length===0)return 0;for(var wr=function(Er,Ut){return Ut===0?Er:wr(Ut,Er%Ut)},Zt=Ie.reduce(wr),ut=1;ut<=Ie.length;ut++)if(Ie.indexOf(ut*Zt)===-1)return 0;return Zt},Ve=Ae(We),pt=ke(Q.fractionalPart,!0),Xe=Q.integerPart.split("").filter(function(Ie){return A.indexOf(Ie)!==-1}).length,wt=Xe,Je=Q.fractionalPart.split(""),tt=Je.filter(function(Ie){return A.indexOf(Ie)!==-1}).length,Me=Je.filter(function(Ie){return A.indexOf(Ie)!==-1||Ie===m.digit}).length,Ke=typeof Q.exponentPart=="string";Xe===0&&Me===0&&(Ke?(tt=1,Me=1):Xe=1),Ke&&Xe===0&&Q.integerPart.indexOf(m.digit)!==-1&&(Xe=1),Xe===0&&tt===0&&(tt=1);var ai=0;return Ke&&(ai=Q.exponentPart.split("").filter(function(Ie){return A.indexOf(Ie)!==-1}).length),{integerPartGroupingPositions:We,regularGrouping:Ve,minimumIntegerPartSize:Xe,scalingFactor:wt,prefix:Q.prefix,fractionalPartGroupingPositions:pt,minimumFactionalPartSize:tt,maximumFactionalPartSize:Me,minimumExponentSize:ai,suffix:Q.suffix,picture:Q.subpicture}},De=H.map(be);De.forEach(_e);var ge=De.map(Se),Ce=m["minus-sign"],Qe=m["zero-digit"],qe=m["decimal-separator"],it=m["grouping-separator"];ge.length===1&&(ge.push(JSON.parse(JSON.stringify(ge[0]))),ge[1].prefix=Ce+ge[1].prefix);var Oe;s>=0?Oe=ge[0]:Oe=ge[1];var Jt;Oe.picture.indexOf(m.percent)!==-1?Jt=s*100:Oe.picture.indexOf(m["per-mille"])!==-1?Jt=s*1e3:Jt=s;var dt,Lt;if(Oe.minimumExponentSize===0)dt=Jt;else{var pa=Math.pow(10,Oe.scalingFactor),ma=Math.pow(10,Oe.scalingFactor-1);if(dt=Jt,Lt=0,dt!==0){for(;Math.abs(dt)<ma;)dt*=10,Lt-=1;for(;Math.abs(dt)>pa;)dt/=10,Lt+=1}}var ga=L(dt,Oe.maximumFactionalPartSize),ii=function(Q,ke){var We=Math.abs(Q).toFixed(ke);return Qe!=="0"&&(We=We.split("").map(function(Ae){return Ae>="0"&&Ae<="9"?A[Ae.charCodeAt(0)-48]:Ae}).join("")),We},ie=ii(ga,Oe.maximumFactionalPartSize),je=ie.indexOf(".");for(je===-1?ie=ie+qe:ie=ie.replace(".",qe);ie.charAt(0)===Qe;)ie=ie.substring(1);for(;ie.charAt(ie.length-1)===Qe;)ie=ie.substring(0,ie.length-1);je=ie.indexOf(qe);var Kt=Oe.minimumIntegerPartSize-je,si=Oe.minimumFactionalPartSize-(ie.length-je-1);if(ie=(Kt>0?new Array(Kt+1).join(Qe):"")+ie,ie=ie+(si>0?new Array(si+1).join(Qe):""),je=ie.indexOf(qe),Oe.regularGrouping>0)for(var va=Math.floor((je-1)/Oe.regularGrouping),yr=1;yr<=va;yr++)ie=[ie.slice(0,je-yr*Oe.regularGrouping),it,ie.slice(je-yr*Oe.regularGrouping)].join("");else Oe.integerPartGroupingPositions.forEach(function(Q){ie=[ie.slice(0,je-Q),it,ie.slice(je-Q)].join(""),je++});if(je=ie.indexOf(qe),Oe.fractionalPartGroupingPositions.forEach(function(Q){ie=[ie.slice(0,Q+je+1),it,ie.slice(Q+je+1)].join("")}),je=ie.indexOf(qe),(Oe.picture.indexOf(qe)===-1||je===ie.length-1)&&(ie=ie.substring(0,ie.length-1)),typeof Lt<"u"){var br=ii(Lt,0);Kt=Oe.minimumExponentSize-br.length,Kt>0&&(br=new Array(Kt+1).join(Qe)+br),ie=ie+m["exponent-separator"]+(Lt<0?Ce:"")+br}return ie=Oe.prefix+ie+Oe.suffix,ie}}function R(s,o){if(!(typeof s>"u")){if(s=L(s),typeof o>"u"?o=10:o=L(o),o<2||o>36)throw{code:"D3100",stack:new Error().stack,value:o};var l=s.toString(o);return l}}function T(s){var o;if(!(typeof s>"u")){if(typeof s=="number")o=s;else if(typeof s=="string"&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(s)&&!isNaN(parseFloat(s))&&isFinite(s))o=parseFloat(s);else if(typeof s=="string"&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(s))o=Number(s);else if(s===!0)o=1;else if(s===!1)o=0;else throw{code:"D3030",value:s,stack:new Error().stack,index:1};return o}}function M(s){var o;if(!(typeof s>"u"))return o=Math.abs(s),o}function B(s){var o;if(!(typeof s>"u"))return o=Math.floor(s),o}function N(s){var o;if(!(typeof s>"u"))return o=Math.ceil(s),o}function L(s,o){var l;if(!(typeof s>"u")){if(o){var y=s.toString().split("e");s=+(y[0]+"e"+(y[1]?+y[1]+o:o))}l=Math.round(s);var m=l-s;return Math.abs(m)===.5&&Math.abs(l%2)===1&&(l=l-1),o&&(y=l.toString().split("e"),l=+(y[0]+"e"+(y[1]?+y[1]-o:-o))),Object.is(l,-0)&&(l=0),l}}function q(s){var o;if(!(typeof s>"u")){if(s<0)throw{stack:new Error().stack,code:"D3060",index:1,value:s};return o=Math.sqrt(s),o}}function V(s,o){var l;if(!(typeof s>"u")){if(l=Math.pow(s,o),!isFinite(l))throw{stack:new Error().stack,code:"D3061",index:1,value:s,exp:o};return l}}function le(){return Math.random()}function se(s){if(!(typeof s>"u")){var o=!1;if(Array.isArray(s)){if(s.length===1)o=se(s[0]);else if(s.length>1){var l=s.filter(function(y){return se(y)});o=l.length>0}}else typeof s=="string"?s.length>0&&(o=!0):v(s)?s!==0&&(o=!0):s!==null&&typeof s=="object"&&!E(s)?a.keys(s).length>0&&(o=!0):typeof s=="boolean"&&s===!0&&(o=!0);return o}}function K(s){if(!(typeof s>"u"))return!se(s)}function X(s,o,l,y){var m=[o],A=G(s);return A>=2&&m.push(l),A>=3&&m.push(y),m}async function oe(s,o){if(!(typeof s>"u")){for(var l=this.createSequence(),y=0;y<s.length;y++){var m=X(o,s[y],y,s),A=await o.apply(this,m);typeof A<"u"&&l.push(A)}return l}}async function Y(s,o){if(!(typeof s>"u")){for(var l=this.createSequence(),y=0;y<s.length;y++){var m=s[y],A=X(o,m,y,s),$=await o.apply(this,A);se($)&&l.push(m)}return l}}async function Ne(s,o){if(!(typeof s>"u")){for(var l=!1,y,m=0;m<s.length;m++){var A=s[m],$=!0;if(typeof o<"u"){var I=X(o,A,m,s),re=await o.apply(this,I);$=se(re)}if($)if(!l)y=A,l=!0;else throw{stack:new Error().stack,code:"D3138",index:m}}if(!l)throw{stack:new Error().stack,code:"D3139"};return y}}function Ze(){for(var s=[],o=Array.prototype.slice.call(arguments),l=Math.min.apply(Math,o.map(function(A){return Array.isArray(A)?A.length:0})),y=0;y<l;y++){var m=o.map(A=>A[y]);s.push(m)}return s}async function Ge(s,o,l){if(!(typeof s>"u")){var y,m=G(o);if(m<2)throw{stack:new Error().stack,code:"D3050",index:1};var A;for(typeof l>"u"&&s.length>0?(y=s[0],A=1):(y=l,A=0);A<s.length;){var $=[y,s[A]];m>=3&&$.push(A),m>=4&&$.push(s),y=await o.apply(this,$),A++}return y}}function Ue(s){var o=this.createSequence();if(Array.isArray(s)){for(var l=Object.create(null),y=0;y<s.length;y++){var m=Ue.call(this,s[y]);m.forEach(function(A){l[A]=!0})}o=Ue.call(this,l)}else s!==null&&typeof s=="object"&&!E(s)&&a.keys(s).forEach(A=>o.push(A));return o}function Be(s,o){var l;if(Array.isArray(s)){l=this.createSequence();for(var y=0;y<s.length;y++){var m=Be.call(this,s[y],o);typeof m<"u"&&(Array.isArray(m)?m.forEach(A=>l.push(A)):l.push(m))}}else s!==null&&typeof s=="object"&&Object.prototype.hasOwnProperty.call(s,o)&&!E(s)&&(l=s[o]);return l}function ot(s,o){if(typeof s>"u")return o;if(typeof o>"u")return s;Array.isArray(s)||(s=this.createSequence(s)),Array.isArray(o)||(o=[o]);const l=s.length+o.length;if(this.options&&l>this.options.sequence)throw{code:"D2015",stack:new Error().stack,value:l};return s.concat(o)}function Ct(s){return!(typeof s>"u")}function Rt(s){var o=this.createSequence();if(Array.isArray(s))for(var l=0;l<s.length;l++)o=ot.call(this,o,Rt.call(this,s[l]));else if(s!==null&&typeof s=="object"&&!C(s))for(const m of a.keys(s)){var y=Object.create(null);y[m]=s[m],o.push(y)}else o=s;return o}function j(s){if(!(typeof s>"u")){var o=Object.create(null);return s.forEach(function(l){for(const y of a.keys(l))o[y]=l[y]}),o}}function gr(s){if(!(typeof s>"u")){if(s.length<=1)return s;for(var o=s.length,l=new Array(o),y=0;y<o;y++)l[o-y-1]=s[y];return l}}async function vr(s,o){var l=this.createSequence();for(const A of a.keys(s)){var y=X(o,s[A],A,s),m=await o.apply(this,y);typeof m<"u"&&l.push(m)}return l}function et(s){throw{code:"D3137",stack:new Error().stack,message:s||"$error() function evaluated"}}function Yt(s,o){if(!s)throw{code:"D3141",stack:new Error().stack,message:o||"$assert() statement failed"}}function nt(s){if(s!==void 0)return s===null?"null":v(s)?"number":typeof s=="string"?"string":typeof s=="boolean"?"boolean":Array.isArray(s)?"array":E(s)?"function":"object"}async function bt(s,o){if(!(typeof s>"u")){if(s.length<=1)return s;var l;if(typeof o>"u"){if(!D(s)&&!x(s))throw{stack:new Error().stack,code:"D3070",index:1};l=async function($,I){return $>I}}else l=o;var y=async function($,I){var re=async function(be,_e,Se){_e.length===0?Array.prototype.push.apply(be,Se):Se.length===0?Array.prototype.push.apply(be,_e):await l(_e[0],Se[0])?(be.push(Se[0]),await re(be,_e,Se.slice(1))):(be.push(_e[0]),await re(be,_e.slice(1),Se))},H=[];return await re(H,$,I),H},m=async function($){if(!Array.isArray($)||$.length<=1)return $;var I=Math.floor($.length/2),re=$.slice(0,I),H=$.slice(I);return re=await m(re),H=await m(H),await y(re,H)},A=await m(s);return A}}function c(s){if(!(typeof s>"u")){if(s.length<=1)return s;for(var o=new Array(s.length),l=0;l<s.length;l++){var y=Math.floor(Math.random()*(l+1));l!==y&&(o[l]=o[y]),o[y]=s[l]}return o}}function f(s){if(!(typeof s>"u")){if(!Array.isArray(s)||s.length<=1)return s;for(var o=P(s)?this.createSequence():[],l=0;l<s.length;l++){for(var y=s[l],m=!1,A=0;A<o.length;A++)if(ee(y,o[A])){m=!0;break}m||o.push(y)}return o}}async function p(s,o){var l=Object.create(null);for(const $ of a.keys(s)){var y=s[$],m=X(o,y,$,s),A=await o.apply(this,m);se(A)&&(l[$]=y)}return a.keys(l).length===0&&(l=void 0),l}return{sum:_,count:g,max:U,min:w,average:k,string:W,substring:F,substringBefore:Z,substringAfter:ne,lowercase:we,uppercase:pe,length:he,trim:Pe,pad:Ye,match:He,contains:de,replace:te,split:Ee,join:ye,formatNumber:S,formatBase:R,number:T,floor:B,ceil:N,round:L,abs:M,sqrt:q,power:V,random:le,boolean:se,not:K,map:oe,zip:Ze,filter:Y,single:Ne,foldLeft:Ge,sift:p,keys:Ue,lookup:Be,append:ot,exists:Ct,spread:Rt,merge:j,reverse:gr,each:vr,error:et,assert:Yt,type:nt,sort:bt,shuffle:c,distinct:f,base64encode:xe,base64decode:rt,encodeUrlComponent:d,encodeUrl:b,decodeUrlComponent:z,decodeUrl:ce}})();r.exports=h}).call(this)}).call(this,typeof Pn<"u"?Pn:typeof self<"u"?self:typeof window<"u"?window:{})},{"./utils":6}],3:[function(t,r,i){var u=t("./datetime"),a=t("./functions"),h=t("./utils"),v=t("./parser"),x=t("./signature"),D=(function(){var P=h.isNumeric,E=h.isArrayOfStrings,C=h.isArrayOfNumbers,O=h.isSequence,G=h.isFunction,ee=h.isLambda,J=h.isIterable,_=h.isPromise,g=h.getFunctionArity,U=h.isDeepEqual,w=et(null);async function k(c,f,p){var s;p.base.depth++,p.base.guardrails();var o=p.lookup(Symbol.for("jsonata.__evaluate_entry"));switch(o&&await o(c,f,p),c.type){case"path":s=await W(c,f,p);break;case"binary":s=await he(c,f,p);break;case"unary":s=await Pe(c,f,p);break;case"name":s=Ye(c,f,p);break;case"string":case"number":case"value":s=ae(c);break;case"wildcard":s=de(c,f,p);break;case"descendant":s=te(c,f,p);break;case"parent":s=p.lookup(c.slot.label);break;case"condition":s=await B(c,f,p);break;case"block":s=await N(c,f,p);break;case"bind":s=await M(c,f,p);break;case"regex":s=L(c,f,p);break;case"function":s=await X(c,f,p);break;case"variable":s=q(c,f,p);break;case"lambda":s=Ne(c,f,p);break;case"partial":s=await Ze(c,f,p);break;case"apply":s=await K(c,f,p);break;case"transform":s=le(c,f,p);break}if(Object.prototype.hasOwnProperty.call(c,"predicate"))for(var l=0;l<c.predicate.length;l++)s=await pe(c.predicate[l].expr,s,p);c.type!=="path"&&Object.prototype.hasOwnProperty.call(c,"group")&&(s=await S(c.group,s,p));var y=p.lookup(Symbol.for("jsonata.__evaluate_exit"));return y&&await y(c,f,p,s),s&&O(s)&&!s.tupleStream&&(c.keepArray&&(s.keepSingleton=!0),s.length===0?s=void 0:s.length===1&&(s=s.keepSingleton?s:s[0])),p.base.depth--,s}async function W(c,f,p){var s;Array.isArray(f)&&c.steps[0].type!=="variable"?s=f:s=p.base.createSequence(f);for(var o,l=!1,y=void 0,m=0;m<c.steps.length;m++){var A=c.steps[m];if(A.tuple&&(l=!0),m===0&&A.consarray?o=await k(A,s,p):l?y=await we(A,s,y,p):o=await Z(A,s,p,m===c.steps.length-1),!l&&(typeof o>"u"||o.length===0))break;typeof A.focus>"u"&&(s=o)}if(l)if(c.tuple)o=y;else for(o=p.base.createSequence(),m=0;m<y.length;m++)o.push(y[m]["@"]);return c.keepSingletonArray&&(Array.isArray(o)&&o.cons&&!o.sequence&&(o=p.base.createSequence(o)),o.keepSingleton=!0),Object.prototype.hasOwnProperty.call(c,"group")&&(o=await S(c.group,l?y:o,p)),o}function F(c,f){var p=et(c);for(const s of h.keys(f))p.bind(s,f[s]);return p}async function Z(c,f,p,s){var o;if(c.type==="sort")return o=await V(c,f,p),c.stages&&(o=await ne(c.stages,o,p)),o;o=p.base.createSequence();for(var l=0;l<f.length;l++){var y=await k(c,f[l],p);if(c.stages)for(var m=0;m<c.stages.length;m++)y=await pe(c.stages[m].expr,y,p);typeof y<"u"&&o.push(y)}var A=p.base.createSequence();return s&&o.length===1&&Array.isArray(o[0])&&!O(o[0])?A=o[0]:Array.prototype.forEach.call(o,function($){!Array.isArray($)||$.cons?A.push($):Array.prototype.forEach.call($,I=>A.push(I))}),A}async function ne(c,f,p){for(var s=f,o=0;o<c.length;o++){var l=c[o];switch(l.type){case"filter":s=await pe(l.expr,s,p);break;case"index":for(var y=0;y<s.length;y++){var m=s[y];m[l.value]=y}break}}return s}async function we(c,f,p,s){var o;if(c.type==="sort"){if(p)o=await V(c,p,s);else{var l=await V(c,f,s);o=s.base.createSequence(),o.tupleStream=!0;for(var y=0;y<l.length;y++){var m={"@":l[y]};m[c.index]=y,o.push(m)}}return c.stages&&(o=await ne(c.stages,o,s)),o}o=s.base.createSequence(),o.tupleStream=!0;var A=s;p===void 0&&(p=f.map(H=>({"@":H})));for(var $=0;$<p.length;$++){A=F(s,p[$]);var I=await k(c,p[$]["@"],A);if(typeof I<"u"){Array.isArray(I)||(I=[I]);for(var re=0;re<I.length;re++)m=Object.create(null),Object.assign(m,p[$]),I.tupleStream?Object.assign(m,I[re]):(c.focus?(m[c.focus]=I[re],m["@"]=p[$]["@"]):m["@"]=I[re],c.index&&(m[c.index]=re),c.ancestor&&(m[c.ancestor.label]=p[$]["@"])),o.push(m)}}return c.stages&&(o=await ne(c.stages,o,s)),o}async function pe(c,f,p){var s=p.base.createSequence();if(f&&f.tupleStream&&(s.tupleStream=!0),Array.isArray(f)||(f=p.base.createSequence(f)),c.type==="number"){var o=Math.floor(c.value);o<0&&(o=f.length+o);var l=await f[o];typeof l<"u"&&(Array.isArray(l)?s=l:s.push(l))}else for(o=0;o<f.length;o++){var l=f[o],y=l,m=p;f.tupleStream&&(y=l["@"],m=F(p,l));var A=await k(c,y,m);P(A)&&(A=[A]),C(A)?Array.prototype.forEach.call(A,function(I){var re=Math.floor(I);re<0&&(re=f.length+re),re===o&&s.push(l)}):a.boolean(A)&&s.push(l)}return s}async function he(c,f,p){var s,o=await k(c.lhs,f,p),l=c.value,y=async()=>await k(c.rhs,f,p);if(l==="and"||l==="or")try{return await ce(o,y,l)}catch(A){throw A.position=c.position,A.token=l,A}var m=await y();try{switch(l){case"+":case"-":case"*":case"/":case"%":s=rt(o,m,l);break;case"=":case"!=":s=d(o,m,l);break;case"<":case"<=":case">":case">=":s=b(o,m,l);break;case"&":s=ye(o,m);break;case"..":s=T(o,m,p);break;case"in":s=z(o,m);break}}catch(A){throw A.position=c.position,A.token=l,A}return s}async function Pe(c,f,p){var s,o={options:p.base.options,createSequence:p.base.createSequence};switch(c.value){case"-":if(s=await k(c.expression,f,p),typeof s>"u")s=void 0;else if(P(s))s=-s;else throw{code:"D1002",stack:new Error().stack,position:c.position,token:c.value,value:s};break;case"[":s=[];let m=await Promise.all(c.expressions.map(async(A,$)=>(p.isParallelCall=$>0,[A,await k(A,f,p)])));for(let A of m){var[l,y]=A;typeof y<"u"&&(l.value==="["?s.push(y):s=a.append.call(o,s,y))}c.consarray&&Object.defineProperty(s,"cons",{enumerable:!1,configurable:!1,value:!0});break;case"{":s=await S(c,f,p);break}return s}function Ye(c,f,p){var s={createSequence:p.base.createSequence};return a.lookup.call(s,f,c.value)}function ae(c){return c.value}function de(c,f,p){var s={options:p.base.options,createSequence:p.base.createSequence},o=s.createSequence();return Array.isArray(f)&&f.outerWrapper&&f.length>0&&(f=f[0]),f!==null&&typeof f=="object"&&!G(f)&&h.keys(f).forEach(function(l){var y=f[l];Array.isArray(y)?(y=He(y),o=a.append.call(s,o,y)):o.push(y)}),o}function He(c,f){return typeof f>"u"&&(f=[]),Array.isArray(c)?Array.prototype.forEach.call(c,function(p){He(p,f)}):f.push(c),f}function te(c,f,p){var s,o=p.base.createSequence();return typeof f<"u"&&(xe(f,o),o.length===1?s=o[0]:s=o),s}function xe(c,f){Array.isArray(c)||f.push(c),Array.isArray(c)?Array.prototype.forEach.call(c,function(p){xe(p,f)}):c!==null&&typeof c=="object"&&!G(c)&&h.keys(c).forEach(function(p){xe(c[p],f)})}function rt(c,f,p){var s;if(typeof c<"u"&&!P(c))throw{code:"T2001",stack:new Error().stack,value:c};if(typeof f<"u"&&!P(f))throw{code:"T2002",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u")return s;switch(p){case"+":s=c+f;break;case"-":s=c-f;break;case"*":s=c*f;break;case"/":s=c/f;break;case"%":s=c%f;break}return s}function d(c,f,p){var s,o=typeof c,l=typeof f;if(o==="undefined"||l==="undefined")return!1;switch(p){case"=":s=U(c,f);break;case"!=":s=!U(c,f);break}return s}function b(c,f,p){var s,o=typeof c,l=typeof f,y=o==="undefined"||o==="string"||o==="number",m=l==="undefined"||l==="string"||l==="number";if(!y||!m)throw{code:"T2010",stack:new Error().stack,value:o==="string"||o==="number"?f:c};if(!(o==="undefined"||l==="undefined")){if(o!==l)throw{code:"T2009",stack:new Error().stack,value:c,value2:f};switch(p){case"<":s=c<f;break;case"<=":s=c<=f;break;case">":s=c>f;break;case">=":s=c>=f;break}return s}}function z(c,f){var p=!1;if(typeof c>"u"||typeof f>"u")return!1;Array.isArray(f)||(f=[f]);for(var s=0;s<f.length;s++)if(f[s]===c){p=!0;break}return p}async function ce(c,f,p){var s,o=Ee(c);switch(p){case"and":s=o&&Ee(await f());break;case"or":s=o||Ee(await f());break}return s}function Ee(c){var f=a.boolean(c);return typeof f>"u"?!1:f}function ye(c,f){var p,s="",o="";return typeof c<"u"&&(s=a.string(c)),typeof f<"u"&&(o=a.string(f)),p=s.concat(o),p}async function S(c,f,p){var s=Object.create(null),o=Object.create(null),l=!!(f&&f.tupleStream),y={options:p.base.options,createSequence:p.base.createSequence};Array.isArray(f)||(p.base.options,f=y.createSequence(f)),f.length===0&&!l&&f.push(void 0);for(var m=0;m<f.length;m++)for(var A=f[m],$=l?F(p,A):p,I=0;I<c.lhs.length;I++){var re=c.lhs[I],H=await k(re[0],l?A["@"]:A,$);if(typeof H!="string"&&H!==void 0)throw{code:"T1003",stack:new Error().stack,position:c.position,value:H};if(H!==void 0){if(H==="_jsonata_lambda"||H==="_jsonata_function")throw{code:"D1013",stack:new Error().stack,position:c.position,value:H};var be={data:A,exprIndex:I};if(Object.prototype.hasOwnProperty.call(o,H)){if(o[H].exprIndex!==I)throw{code:"D1009",stack:new Error().stack,position:c.position,value:H};o[H].data=a.append.call(y,o[H].data,A)}else o[H]=be}}let _e=await Promise.all(h.keys(o).map(async(De,ge)=>{let Ce=o[De];var Qe=Ce.data,qe=p;if(l){var it=R(Ce.data,p);Qe=it["@"],delete it["@"],qe=F(p,it)}return p.isParallelCall=ge>0,[De,await k(c.lhs[Ce.exprIndex][1],Qe,qe)]}));for(let De of _e){var[H,Se]=await De;typeof Se<"u"&&(s[H]=Se)}return s}function R(c,f){if(!Array.isArray(c))return c;var p=Object.create(null),s={options:f.base.options,createSequence:f.base.createSequence};Object.assign(p,c[0]);for(var o=1;o<c.length;o++)for(const l of h.keys(c[o]))p[l]=a.append.call(s,p[l],c[o][l]);return p}function T(c,f,p){var s;if(typeof c<"u"&&!Number.isInteger(c))throw{code:"T2003",stack:new Error().stack,value:c};if(typeof f<"u"&&!Number.isInteger(f))throw{code:"T2004",stack:new Error().stack,value:f};if(typeof c>"u"||typeof f>"u"||c>f)return s;var o=f-c+1;if(o>1e7)throw{code:"D2014",stack:new Error().stack,value:o};if(p.base.options&&o>p.base.options.sequence)throw{code:"D2015",stack:new Error().stack,value:o};s=new Array(o);for(var l=c,y=0;l<=f;l++,y++)s[y]=l;return s.sequence=!0,s}async function M(c,f,p){var s=await k(c.rhs,f,p);return p.bind(c.lhs.value,s),s}async function B(c,f,p){var s,o=await k(c.condition,f,p);return a.boolean(o)?s=await k(c.then,f,p):typeof c.else<"u"&&(s=await k(c.else,f,p)),s}async function N(c,f,p){for(var s,o=et(p),l=0;l<c.expressions.length;l++)s=await k(c.expressions[l],f,o);return s}function L(c,f,p){var s=new p.base.RegexEngine(c.value),o=function(l,y){var m;s.lastIndex=y||0;var A=s.exec(l);if(A!==null){if(m={match:A[0],start:A.index,end:A.index+A[0].length,groups:[]},A.length>1)for(var $=1;$<A.length;$++)m.groups.push(A[$]);m.next=function(){if(!(s.lastIndex>=l.length)){var I=o(l,s.lastIndex);if(I&&I.match==="")throw{code:"D1004",stack:new Error().stack,position:c.position,value:c.value.source};return I}}}return m};return o}function q(c,f,p){var s;return c.value===""?s=f&&f.outerWrapper?f[0]:f:s=p.lookup(c.value),s}async function V(c,f,p){var s,o=f,l=!!f.tupleStream,y=async function(A,$){for(var I=0,re=0;I===0&&re<c.terms.length;re++){var H=c.terms[re],be=A,_e=p;l&&(be=A["@"],_e=F(p,A));var Se=await k(H.expression,be,_e);be=$,_e=p,l&&(be=$["@"],_e=F(p,$));var De=await k(H.expression,be,_e),ge=typeof Se,Ce=typeof De;if(ge==="undefined"){I=Ce==="undefined"?0:1;continue}if(Ce==="undefined"){I=-1;continue}if(!(ge==="string"||ge==="number")||!(Ce==="string"||Ce==="number"))throw{code:"T2008",stack:new Error().stack,position:c.position,value:ge==="string"||ge==="number"?De:Se};if(ge!==Ce)throw{code:"T2007",stack:new Error().stack,position:c.position,value:Se,value2:De};Se!==De&&(Se<De?I=-1:I=1,H.descending===!0&&(I=-I))}return I===1},m={environment:p,input:f};return s=await a.sort.apply(m,[o,y]),s}function le(c,f,p){var s=async function(o){if(!(typeof o>"u")){var l=p.lookup("clone");if(!G(l))throw{code:"T2013",stack:new Error().stack,position:c.position};var y=await oe(l,[o],null,p),m=await k(c.pattern,y,p);if(typeof m<"u"){Array.isArray(m)||(m=[m]);for(var A=0;A<m.length;A++){var $=m[A],I=await k(c.update,$,p),re=typeof I;if(re!=="undefined"){if(re!=="object"||I===null||Array.isArray(I))throw{code:"T2011",stack:new Error().stack,position:c.update.position,value:I};for(const Se of h.keys(I))$[Se]=I[Se]}if(typeof c.delete<"u"){var H=await k(c.delete,$,p);if(typeof H<"u"){var be=H;if(Array.isArray(H)||(H=[H]),!E(H))throw{code:"T2012",stack:new Error().stack,position:c.delete.position,value:be};for(var _e=0;_e<H.length;_e++)typeof $=="object"&&$!==null&&delete $[H[_e]]}}}}return y}};return j(s,"<(oa):o>")}var se=v("function($f, $g) { function($x){ $g($f($x)) } }");async function K(c,f,p){var s,o=await k(c.lhs,f,p);if(c.rhs.type==="function")s=await X(c.rhs,f,p,{context:o});else{var l=await k(c.rhs,f,p);if(!G(l))throw{code:"T2006",stack:new Error().stack,position:c.position,value:l};if(G(o)){var y=await k(se,null,p);s=await oe(y,[o,l],null,p)}else s=await oe(l,[o],null,p)}return s}async function X(c,f,p,s){var o,l=await k(c.procedure,f,p);if(typeof l>"u"&&c.procedure.type==="path"&&p.lookup(c.procedure.steps[0].value))throw{code:"T1005",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};var y=[];typeof s<"u"&&y.push(s.context);for(var m=0;m<c.arguments.length;m++){const $=await k(c.arguments[m],f,p);if(G($)){const I=async function(...re){return await oe($,re,null,p)};I.arity=g($),y.push(I)}else y.push($)}var A=c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value;try{typeof l=="object"&&(l.token=A,l.position=c.position),o=await oe(l,y,f,p)}catch($){throw $.position||($.position=c.position),$.token||($.token=A),$}return o}async function oe(c,f,p,s){var o;for(o=await Y(c,f,p,s);ee(o)&&o.thunk===!0;){var l=await k(o.body.procedure,o.input,o.environment);o.body.procedure.type==="variable"&&(l.token=o.body.procedure.value),l.position=o.body.procedure.position;for(var y=[],m=0;m<o.body.arguments.length;m++)y.push(await k(o.body.arguments[m],o.input,o.environment));o=await Y(l,y,p,s)}return o}async function Y(c,f,p,s){var o;try{var l=f;if(c&&(l=Ge(c.signature,f,p)),ee(c))o=await Ue(c,l);else if(c&&c._jsonata_function===!0){var y={environment:s,input:p,options:s.base.options,createSequence:s.base.createSequence};o=c.implementation.apply(y,l),J(o)&&(o=o.next().value),_(o)&&(o=await o)}else if(typeof c=="function")o=c.apply(p,l),_(o)&&(o=await o);else throw{code:"T1006",stack:new Error().stack}}catch(m){throw c&&(typeof m.token>"u"&&typeof c.token<"u"&&(m.token=c.token),m.position=c.position||m.position),m}return o}function Ne(c,f,p){var s={_jsonata_lambda:!0,input:f,environment:p,arguments:c.arguments,signature:c.signature,body:c.body};return c.thunk===!0&&(s.thunk=!0),s.apply=async function(o,l){return await oe(s,l,f,o?o.environment:p)},s}async function Ze(c,f,p){for(var s,o=[],l=0;l<c.arguments.length;l++){var y=c.arguments[l];y.type==="operator"&&y.value==="?"?o.push(y):o.push(await k(y,f,p))}var m=await k(c.procedure,f,p);if(typeof m>"u"&&c.procedure.type==="path"&&p.lookup(c.procedure.steps[0].value))throw{code:"T1007",stack:new Error().stack,position:c.position,token:c.procedure.steps[0].value};if(ee(m))s=Be(m,o,p);else if(m&&m._jsonata_function===!0)s=ot(m.implementation,o,p);else if(typeof m=="function")s=ot(m,o,p);else throw{code:"T1008",stack:new Error().stack,position:c.position,token:c.procedure.type==="path"?c.procedure.steps[0].value:c.procedure.value};return s}function Ge(c,f,p){if(typeof c>"u")return f;var s=c.validate(f,p);return s}async function Ue(c,f){var p,s=et(c.environment);return Array.prototype.forEach.call(c.arguments,function(o,l){s.bind(o.value,f[l])}),typeof c.body=="function"?p=await Ct(c.body,s):p=await k(c.body,c.input,s),p}function Be(c,f,p){var s=et(c.environment||p),o=[];Array.prototype.forEach.call(c.arguments,function(y,m){var A=f[m];A&&A.type==="operator"&&A.value==="?"?o.push(y):s.bind(y.value,A)});var l={_jsonata_lambda:!0,input:c.input,environment:s,arguments:o,body:c.body};return l}function ot(c,f,p){var s=Rt(c);s=s.map(function(m){return"$"+m.trim()});var o="function("+s.join(", ")+"){ _ }",l=v(o);l.body=c;var y=Be(l,f,p);return y}async function Ct(c,f){var p=Rt(c),s=p.map(function(y){return f.lookup(y.trim())}),o={environment:f,createSequence:f.base.createSequence},l=c.apply(o,s);return _(l)&&(l=await l),l}function Rt(c){var f=c.toString(),p=/\(([^)]*)\)/.exec(f)[1],s=p.split(",");return s}function j(c,f){var p={_jsonata_function:!0,implementation:c};return typeof f<"u"&&(p.signature=x(f)),p}async function gr(c,f){if(!(typeof c>"u")){var p=this.input;typeof f<"u"&&(p=f,Array.isArray(p)&&!O(p)&&(p=this.createSequence(p),p.outerWrapper=!0));try{var s=v(c,!1)}catch(l){throw nt(l),{stack:new Error().stack,code:"D3120",value:l.message,error:l}}try{var o=await k(s,p,this.environment)}catch(l){throw nt(l),{stack:new Error().stack,code:"D3121",value:l.message,error:l}}return o}}function vr(c){if(!(typeof c>"u"))return JSON.parse(a.string(c))}function et(c){var f=Object.create(null);const p={bind:function(o,l){f[o]=l},lookup:function(o){var l;return Object.prototype.hasOwnProperty.call(f,o)?l=f[o]:c&&(l=c.lookup(o)),l},timestamp:c?c.timestamp:null,async:c?c.async:!1,isParallelCall:c?c.isParallelCall:!1,global:c?c.global:{ancestry:[null]}};if(c){var s=c.lookup(Symbol.for("jsonata.__createFrame_push"));s&&s(c,p),p.base=c.base}return p}w.bind("sum",j(a.sum,"<a<n>:n>")),w.bind("count",j(a.count,"<a:n>")),w.bind("max",j(a.max,"<a<n>:n>")),w.bind("min",j(a.min,"<a<n>:n>")),w.bind("average",j(a.average,"<a<n>:n>")),w.bind("string",j(a.string,"<x-b?:s>")),w.bind("substring",j(a.substring,"<s-nn?:s>")),w.bind("substringBefore",j(a.substringBefore,"<s-s:s>")),w.bind("substringAfter",j(a.substringAfter,"<s-s:s>")),w.bind("lowercase",j(a.lowercase,"<s-:s>")),w.bind("uppercase",j(a.uppercase,"<s-:s>")),w.bind("length",j(a.length,"<s-:n>")),w.bind("trim",j(a.trim,"<s-:s>")),w.bind("pad",j(a.pad,"<s-ns?:s>")),w.bind("match",j(a.match,"<s-f<s:o>n?:a<o>>")),w.bind("contains",j(a.contains,"<s-(sf):b>")),w.bind("replace",j(a.replace,"<s-(sf)(sf)n?:s>")),w.bind("split",j(a.split,"<s-(sf)n?:a<s>>")),w.bind("join",j(a.join,"<a<s>s?:s>")),w.bind("formatNumber",j(a.formatNumber,"<n-so?:s>")),w.bind("formatBase",j(a.formatBase,"<n-n?:s>")),w.bind("formatInteger",j(u.formatInteger,"<n-s:s>")),w.bind("parseInteger",j(u.parseInteger,"<s-s:n>")),w.bind("number",j(a.number,"<(nsb)-:n>")),w.bind("floor",j(a.floor,"<n-:n>")),w.bind("ceil",j(a.ceil,"<n-:n>")),w.bind("round",j(a.round,"<n-n?:n>")),w.bind("abs",j(a.abs,"<n-:n>")),w.bind("sqrt",j(a.sqrt,"<n-:n>")),w.bind("power",j(a.power,"<n-n:n>")),w.bind("random",j(a.random,"<:n>")),w.bind("boolean",j(a.boolean,"<x-:b>")),w.bind("not",j(a.not,"<x-:b>")),w.bind("map",j(a.map,"<af>")),w.bind("zip",j(a.zip,"<a+>")),w.bind("filter",j(a.filter,"<af>")),w.bind("single",j(a.single,"<af?>")),w.bind("reduce",j(a.foldLeft,"<afj?:j>")),w.bind("sift",j(a.sift,"<o-f?:o>")),w.bind("keys",j(a.keys,"<x-:a<s>>")),w.bind("lookup",j(a.lookup,"<x-s:x>")),w.bind("append",j(a.append,"<xx:a>")),w.bind("exists",j(a.exists,"<x:b>")),w.bind("spread",j(a.spread,"<x-:a<o>>")),w.bind("merge",j(a.merge,"<a<o>:o>")),w.bind("reverse",j(a.reverse,"<a:a>")),w.bind("each",j(a.each,"<o-f:a>")),w.bind("error",j(a.error,"<s?:x>")),w.bind("assert",j(a.assert,"<bs?:x>")),w.bind("type",j(a.type,"<x:s>")),w.bind("sort",j(a.sort,"<af?:a>")),w.bind("shuffle",j(a.shuffle,"<a:a>")),w.bind("distinct",j(a.distinct,"<x:x>")),w.bind("base64encode",j(a.base64encode,"<s-:s>")),w.bind("base64decode",j(a.base64decode,"<s-:s>")),w.bind("encodeUrlComponent",j(a.encodeUrlComponent,"<s-:s>")),w.bind("encodeUrl",j(a.encodeUrl,"<s-:s>")),w.bind("decodeUrlComponent",j(a.decodeUrlComponent,"<s-:s>")),w.bind("decodeUrl",j(a.decodeUrl,"<s-:s>")),w.bind("eval",j(gr,"<sx?:x>")),w.bind("toMillis",j(u.toMillis,"<s-s?:n>")),w.bind("fromMillis",j(u.fromMillis,"<n-s?s?:s>")),w.bind("clone",j(vr,"<(oa)-:o>"));var Yt={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",D1011:"Stack overflow. Check for non-terminating recursive function. Consider rewriting as tail-recursive",D1012:"Evaluation timeout after {{value}} milliseconds. Check for infinite loop",D1013:"Object property names starting with _jsonata_ are reserved for internal use: {{value}}",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e7. Attempted to allocate {{value}}.",D2015:"The maximum sequence length of {{value}} was exceeded.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function nt(c){var f=Yt[c.code];if(typeof f<"u"){var p=f.replace(/\{\{\{([^}]+)}}}/g,function(){return c[arguments[1]]});p=p.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(c[arguments[1]])}),c.message=p}}function bt(c,f){var p,s;try{p=v(c,f&&f.recover),s=p.errors,delete p.errors}catch(y){throw nt(y),y}var o=et(w),l=new Date;return o.bind("now",j(function(y,m){return u.fromMillis(l.getTime(),y,m)},"<s?s?:s>")),o.bind("millis",j(function(){return l.getTime()},"<:n>")),{evaluate:async function(y,m,A){if(typeof s<"u"){var $={code:"S0500",position:0};throw nt($),$}const I=et(o);for(const H of h.keys(m))I.bind(H,m[H]);if(I.bind("$",y),l=new Date,I.timestamp=l,I.options=f,I.createSequence=function(){var H=[];return f&&f.sequence&&(H.push=function(...be){if(H.length+be.length>f.sequence)throw{code:"D2015",stack:new Error().stack,value:f.sequence};return Array.prototype.push.apply(H,be)}),H.sequence=!0,arguments.length===1&&H.push(arguments[0]),H},Array.isArray(y)&&!O(y)&&(y=I.createSequence(y),y.outerWrapper=!0),f&&(f.timeout||f.stack)){const H=Date.now();I.guardrails=function(){if(f.stack>0&&I.depth>f.stack)throw{code:"D1011",value:f.stack,stack:new Error().stack};if(f.timeout>0&&Date.now()-H>f.timeout)throw{code:"D1012",value:f.timeout,stack:new Error().stack}}}else I.guardrails=function(){};I.base=I,I.depth=0,f&&f.RegexEngine?I.RegexEngine=f.RegexEngine:I.RegexEngine=RegExp;var re;try{return re=await k(p,y,I),typeof A=="function"&&A(null,re),re}catch(H){throw nt(H),H}},assign:function(y,m){o.bind(y,m)},registerFunction:function(y,m,A){var $=j(m,A);o.bind(y,$)},ast:function(){return p},errors:function(){return s}}}return bt.parser=v,bt})();r.exports=D},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(t,r,i){var u=t("./signature");const a=(()=>{var h={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,"?:":40,"??":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},v={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
32
- `,r:"\r",t:" "},x=function(P){var E=0,C=P.length,O=function(J,_){var g={type:J,value:_,position:E};return g},G=function(){for(var J=E,_=0,g,U,w=function(W){if(P.charAt(W)==="/"&&_===0){for(var F=0;P.charAt(W-(F+1))==="\\";)F++;if(F%2===0)return!0}return!1};E<C;){var k=P.charAt(E);if(w(E)){if(g=P.substring(J,E),g==="")throw{code:"S0301",stack:new Error().stack,position:E};for(E++,k=P.charAt(E),J=E;k==="i"||k==="m";)E++,k=P.charAt(E);return U=P.substring(J,E)+"g",new RegExp(g,U)}(k==="("||k==="["||k==="{")&&P.charAt(E-1)!=="\\"&&_++,(k===")"||k==="]"||k==="}")&&P.charAt(E-1)!=="\\"&&_--,E++}throw{code:"S0302",stack:new Error().stack,position:E}},ee=function(J){if(E>=C)return null;for(var _=P.charAt(E);E<C&&`
33
- \r\v`.indexOf(_)>-1;)E++,_=P.charAt(E);if(_==="/"&&P.charAt(E+1)==="*"){var g=E;for(E+=2,_=P.charAt(E);!(_==="*"&&P.charAt(E+1)==="/");)if(_=P.charAt(++E),E>=C)throw{code:"S0106",stack:new Error().stack,position:g};return E+=2,_=P.charAt(E),ee(J)}if(J!==!0&&_==="/")return E++,O("regex",G());if(_==="."&&P.charAt(E+1)===".")return E+=2,O("operator","..");if(_===":"&&P.charAt(E+1)==="=")return E+=2,O("operator",":=");if(_==="!"&&P.charAt(E+1)==="=")return E+=2,O("operator","!=");if(_===">"&&P.charAt(E+1)==="=")return E+=2,O("operator",">=");if(_==="<"&&P.charAt(E+1)==="=")return E+=2,O("operator","<=");if(_==="*"&&P.charAt(E+1)==="*")return E+=2,O("operator","**");if(_==="~"&&P.charAt(E+1)===">")return E+=2,O("operator","~>");if(_==="?"&&P.charAt(E+1)===":")return E+=2,O("operator","?:");if(_==="?"&&P.charAt(E+1)==="?")return E+=2,O("operator","??");if(Object.prototype.hasOwnProperty.call(h,_))return E++,O("operator",_);if(_==='"'||_==="'"){var U=_;E++;for(var w="";E<C;){if(_=P.charAt(E),_==="\\")if(E++,_=P.charAt(E),Object.prototype.hasOwnProperty.call(v,_))w+=v[_];else if(_==="u"){var k=P.substr(E+1,4);if(/^[0-9a-fA-F]+$/.test(k)){var W=parseInt(k,16);w+=String.fromCharCode(W),E+=4}else throw{code:"S0104",stack:new Error().stack,position:E}}else throw{code:"S0103",stack:new Error().stack,position:E,token:_};else{if(_===U)return E++,O("string",w);w+=_}E++}throw{code:"S0101",stack:new Error().stack,position:E}}var F=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,Z=F.exec(P.substring(E));if(Z!==null){var ne=parseFloat(Z[0]);if(!isNaN(ne)&&isFinite(ne))return E+=Z[0].length,O("number",ne);throw{code:"S0102",stack:new Error().stack,position:E,token:Z[0]}}var we;if(_==="`"){E++;var pe=P.indexOf("`",E);if(pe!==-1)return we=P.substring(E,pe),E=pe+1,O("name",we);throw E=C,{code:"S0105",stack:new Error().stack,position:E}}for(var he=E,Pe;;)if(Pe=P.charAt(he),he===C||`
34
- \r\v`.indexOf(Pe)>-1||Object.prototype.hasOwnProperty.call(h,Pe)){if(P.charAt(E)==="$")return we=P.substring(E+1,he),E=he,O("variable",we);switch(we=P.substring(E,he),E=he,we){case"or":case"in":case"and":return O("operator",we);case"true":return O("value",!0);case"false":return O("value",!1);case"null":return O("value",null);default:return E===C&&we===""?null:O("name",we)}}else he++};return ee},D=function(P,E){var C,O,G=Object.create(null),ee=[],J=function(){var d=[];C.id!=="(end)"&&d.push({type:C.type,value:C.value,position:C.position});for(var b=O();b!==null;)d.push(b),b=O();return d},_={nud:function(){var d={code:"S0211",token:this.value,position:this.position};if(E)return d.remaining=J(),d.type="error",ee.push(d),d;throw d.stack=new Error().stack,d}},g=function(d,b){var z=G[d];return b=b||0,z?b>=z.lbp&&(z.lbp=b):(z=Object.create(_),z.id=z.value=d,z.lbp=b,G[d]=z),z},U=function(d){if(E){d.remaining=J(),ee.push(d);var b=G["(error)"];return C=Object.create(b),C.error=d,C.type="(error)",C}else throw d.stack=new Error().stack,d},w=function(d,b){if(d&&C.id!==d){var z;C.id==="(end)"?z="S0203":z="S0202";var ce={code:z,position:C.position,token:C.value,value:d};return U(ce)}var Ee=O(b);if(Ee===null)return C=G["(end)"],C.position=P.length,C;var ye=Ee.value,S=Ee.type,R;switch(S){case"name":case"variable":R=G["(name)"];break;case"operator":if(R=G[ye],!R)return U({code:"S0204",stack:new Error().stack,position:Ee.position,token:ye});break;case"string":case"number":case"value":R=G["(literal)"];break;case"regex":S="regex",R=G["(regex)"];break;default:return U({code:"S0205",stack:new Error().stack,position:Ee.position,token:ye})}return C=Object.create(R),C.value=ye,C.type=S,C.position=Ee.position,C},k=function(d){var b,z=C;for(w(null,!0),b=z.nud();d<C.lbp;)z=C,w(),b=z.led(b);return b},W=function(d){var b=g(d,0);b.nud=function(){return this}},F=function(d,b,z){var ce=b||h[d],Ee=g(d,ce);return Ee.led=z||function(ye){return this.lhs=ye,this.rhs=k(ce),this.type="binary",this},Ee},Z=function(d,b,z){var ce=g(d,b);return ce.led=z,ce},ne=function(d,b){var z=g(d);return z.nud=b||function(){return this.expression=k(70),this.type="unary",this},z};W("(end)"),W("(name)"),W("(literal)"),W("(regex)"),g(":"),g(";"),g(","),g(")"),g("]"),g("}"),g(".."),F("."),F("+"),F("-"),F("*"),F("/"),F("%"),F("="),F("<"),F(">"),F("!="),F("<="),F(">="),F("&"),F("and"),F("or"),F("in"),W("and"),W("or"),W("in"),ne("-"),F("~>"),F("??",h["??"],function(d){return this.type="condition",this.condition={type:"function",value:"(",procedure:{type:"variable",value:"exists"},arguments:[JSON.parse(JSON.stringify(d))]},this.then=d,this.else=k(0),this}),Z("(error)",10,function(d){return this.lhs=d,this.error=C.error,this.remaining=J(),this.type="error",this}),ne("*",function(){return this.type="wildcard",this}),ne("**",function(){return this.type="descendant",this}),ne("%",function(){return this.type="parent",this}),F("(",h["("],function(d){if(this.procedure=d,this.type="function",this.arguments=[],C.id!==")")for(;C.type==="operator"&&C.id==="?"?(this.type="partial",this.arguments.push(C),w("?")):this.arguments.push(k(0)),C.id===",";)w(",");if(w(")",!0),d.type==="name"&&(d.value==="function"||d.value==="λ")){if(this.arguments.forEach(function(ye,S){if(ye.type!=="variable")return U({code:"S0208",stack:new Error().stack,position:ye.position,token:ye.value,value:S+1})}),this.type="lambda",C.id==="<"){for(var b=C.position,z=1,ce="<";z>0&&C.id!=="{"&&C.id!=="(end)";){var Ee=w();Ee.id===">"?z--:Ee.id==="<"&&z++,ce+=Ee.value}w(">");try{this.signature=u(ce)}catch(ye){return ye.position=b+ye.offset,U(ye)}}w("{"),this.body=k(0),w("}")}return this}),ne("(",function(){for(var d=[];C.id!==")"&&(d.push(k(0)),C.id===";");)w(";");return w(")",!0),this.type="block",this.expressions=d,this}),ne("[",function(){var d=[];if(C.id!=="]")for(;;){var b=k(0);if(C.id===".."){var z={type:"binary",value:"..",position:C.position,lhs:b};w(".."),z.rhs=k(0),b=z}if(d.push(b),C.id!==",")break;w(",")}return w("]",!0),this.expressions=d,this.type="unary",this}),F("[",h["["],function(d){if(C.id==="]"){for(var b=d;b&&b.type==="binary"&&b.value==="[";)b=b.lhs;return b.keepArray=!0,w("]"),d}else return this.lhs=d,this.rhs=k(h["]"]),this.type="binary",w("]",!0),this}),F("^",h["^"],function(d){w("(");for(var b=[];;){var z={descending:!1};if(C.id==="<"?w("<"):C.id===">"&&(z.descending=!0,w(">")),z.expression=k(0),b.push(z),C.id!==",")break;w(",")}return w(")"),this.lhs=d,this.rhs=b,this.type="binary",this});var we=function(d){var b=[];if(C.id!=="}")for(;;){var z=k(0);w(":");var ce=k(0);if(b.push([z,ce]),C.id!==",")break;w(",")}return w("}",!0),typeof d>"u"?(this.lhs=b,this.type="unary"):(this.lhs=d,this.rhs=b,this.type="binary"),this};ne("{",we),F("{",h["{"],we),Z(":=",h[":="],function(d){return d.type!=="variable"?U({code:"S0212",stack:new Error().stack,position:d.position,token:d.value}):(this.lhs=d,this.rhs=k(h[":="]-1),this.type="binary",this)}),F("@",h["@"],function(d){return this.lhs=d,this.rhs=k(h["@"]),this.rhs.type!=="variable"?U({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),F("#",h["#"],function(d){return this.lhs=d,this.rhs=k(h["#"]),this.rhs.type!=="variable"?U({code:"S0214",stack:new Error().stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),F("?",h["?"],function(d){return this.type="condition",this.condition=d,this.then=k(0),C.id===":"&&(w(":"),this.else=k(0)),this}),F("?:",h["?:"],function(d){return this.type="condition",this.condition=JSON.parse(JSON.stringify(d)),this.then=d,this.else=k(0),this}),ne("|",function(){return this.type="transform",this.pattern=k(0),w("|"),this.update=k(0),C.id===","&&(w(","),this.delete=k(0)),w("|"),this});var pe=function(d){var b;if(d.type==="function"&&!d.predicate){var z={type:"lambda",thunk:!0,arguments:[],position:d.position};z.body=d,b=z}else if(d.type==="condition")d.then=pe(d.then),typeof d.else<"u"&&(d.else=pe(d.else)),b=d;else if(d.type==="block"){var ce=d.expressions.length;ce>0&&(d.expressions[ce-1]=pe(d.expressions[ce-1])),b=d}else b=d;return b},he=0,Pe=0,Ye=[],ae=function(d,b){switch(d.type){case"name":case"wildcard":b.level--,b.level===0&&(typeof d.ancestor>"u"||(Ye[b.index].slot.label=d.ancestor.label),d.ancestor=b,d.tuple=!0);break;case"parent":b.level++;break;case"block":d.expressions.length>0&&(d.tuple=!0,b=ae(d.expressions[d.expressions.length-1],b));break;case"path":d.tuple=!0;var z=d.steps.length-1;for(b=ae(d.steps[z--],b);b.level>0&&z>=0;)b=ae(d.steps[z--],b);break;default:throw{code:"S0217",token:d.type,position:d.position}}return b},de=function(d,b){if(typeof b.seekingParent<"u"||b.type==="parent"){var z=typeof b.seekingParent<"u"?b.seekingParent:[];b.type==="parent"&&z.push(b.slot),typeof d.seekingParent>"u"?d.seekingParent=z:Array.prototype.push.apply(d.seekingParent,z)}},He=function(d){var b=d.steps.length-1,z=d.steps[b],ce=typeof z.seekingParent<"u"?z.seekingParent:[];z.type==="parent"&&ce.push(z.slot);for(var Ee=0;Ee<ce.length;Ee++){var ye=ce[Ee];for(b=d.steps.length-2;ye.level>0;){if(b<0){typeof d.seekingParent>"u"?d.seekingParent=[ye]:d.seekingParent.push(ye);break}for(var S=d.steps[b--];b>=0&&S.focus&&d.steps[b].focus;)S=d.steps[b--];ye=ae(S,ye)}}},te=function(d){var b;switch(d.type){case"binary":switch(d.value){case".":var z=te(d.lhs);z.type==="path"?b=z:b={type:"path",steps:[z]},z.type==="parent"&&(b.seekingParent=[z.slot]);var ce=te(d.rhs);ce.type==="path"?Array.prototype.push.apply(b.steps,ce.steps):(typeof ce.predicate<"u"&&(ce.stages=ce.predicate,delete ce.predicate),b.steps.push(ce)),b.steps.filter(function(q){if(q.type==="number"||q.type==="value")throw{code:"S0213",stack:new Error().stack,position:q.position,value:q.value};return q.type==="string"}).forEach(function(q){q.type="name"}),b.steps.filter(function(q){return q.keepArray===!0}).length>0&&(b.keepSingletonArray=!0);var Ee=b.steps[0];Ee.type==="unary"&&Ee.value==="["&&(Ee.consarray=!0);var ye=b.steps[b.steps.length-1];ye.type==="unary"&&ye.value==="["&&(ye.consarray=!0),He(b);break;case"[":b=te(d.lhs);var S=b,R="predicate";if(b.type==="path"&&(S=b.steps[b.steps.length-1],R="stages"),typeof S.group<"u")throw{code:"S0209",stack:new Error().stack,position:d.position};typeof S[R]>"u"&&(S[R]=[]);var T=te(d.rhs);typeof T.seekingParent<"u"&&(T.seekingParent.forEach(q=>{q.level===1?ae(S,q):q.level--}),de(S,T)),S[R].push({type:"filter",expr:T,position:d.position});break;case"{":if(b=te(d.lhs),typeof b.group<"u")throw{code:"S0210",stack:new Error().stack,position:d.position};b.group={lhs:d.rhs.map(function(q){return[te(q[0]),te(q[1])]}),position:d.position};break;case"^":b=te(d.lhs),b.type!=="path"&&(b={type:"path",steps:[b]});var M={type:"sort",position:d.position};M.terms=d.rhs.map(function(q){var V=te(q.expression);return de(M,V),{descending:q.descending,expression:V}}),b.steps.push(M),He(b);break;case":=":b={type:"bind",value:d.value,position:d.position},b.lhs=te(d.lhs),b.rhs=te(d.rhs),de(b,b.rhs);break;case"@":if(b=te(d.lhs),S=b,b.type==="path"&&(S=b.steps[b.steps.length-1]),typeof S.stages<"u"||typeof S.predicate<"u")throw{code:"S0215",stack:new Error().stack,position:d.position};if(S.type==="sort")throw{code:"S0216",stack:new Error().stack,position:d.position};d.keepArray&&(S.keepArray=!0),S.focus=d.rhs.value,S.tuple=!0;break;case"#":b=te(d.lhs),S=b,b.type==="path"?S=b.steps[b.steps.length-1]:(b={type:"path",steps:[b]},typeof S.predicate<"u"&&(S.stages=S.predicate,delete S.predicate)),typeof S.stages>"u"?S.index=d.rhs.value:S.stages.push({type:"index",value:d.rhs.value,position:d.position}),S.tuple=!0;break;case"~>":b={type:"apply",value:d.value,position:d.position},b.lhs=te(d.lhs),b.rhs=te(d.rhs),b.keepArray=b.lhs.keepArray||b.rhs.keepArray;break;default:b={type:d.type,value:d.value,position:d.position},b.lhs=te(d.lhs),b.rhs=te(d.rhs),de(b,b.lhs),de(b,b.rhs)}break;case"unary":b={type:d.type,value:d.value,position:d.position},d.value==="["?b.expressions=d.expressions.map(function(q){var V=te(q);return de(b,V),V}):d.value==="{"?b.lhs=d.lhs.map(function(q){var V=te(q[0]);de(b,V);var le=te(q[1]);return de(b,le),[V,le]}):(b.expression=te(d.expression),d.value==="-"&&b.expression.type==="number"?(b=b.expression,b.value=-b.value):de(b,b.expression));break;case"function":case"partial":b={type:d.type,name:d.name,value:d.value,position:d.position},b.arguments=d.arguments.map(function(q){var V=te(q);return de(b,V),V}),b.procedure=te(d.procedure);break;case"lambda":b={type:d.type,arguments:d.arguments,signature:d.signature,position:d.position};var B=te(d.body);b.body=pe(B);break;case"condition":b={type:d.type,position:d.position},b.condition=te(d.condition),de(b,b.condition),b.then=te(d.then),de(b,b.then),typeof d.else<"u"&&(b.else=te(d.else),de(b,b.else));break;case"transform":b={type:d.type,position:d.position},b.pattern=te(d.pattern),b.update=te(d.update),typeof d.delete<"u"&&(b.delete=te(d.delete));break;case"block":b={type:d.type,position:d.position},b.expressions=d.expressions.map(function(q){var V=te(q);return de(b,V),(V.consarray||V.type==="path"&&V.steps[0].consarray)&&(b.consarray=!0),V});break;case"name":b={type:"path",steps:[d]},d.keepArray&&(b.keepSingletonArray=!0);break;case"parent":b={type:"parent",slot:{label:"!"+he++,level:1,index:Pe++}},Ye.push(b);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":b=d;break;case"operator":if(d.value==="and"||d.value==="or"||d.value==="in")d.type="name",b=te(d);else if(d.value==="?")b=d;else throw{code:"S0201",stack:new Error().stack,position:d.position,token:d.value};break;case"error":b=d,d.lhs&&(b=te(d.lhs));break;default:var N="S0206";d.id==="(end)"&&(N="S0207");var L={code:N,position:d.position,token:d.value};if(E)return ee.push(L),{type:"error",error:L};throw L.stack=new Error().stack,L}return d.keepArray&&(b.keepArray=!0),b};O=x(P),w();var xe=k(0);if(C.id!=="(end)"){var rt={code:"S0201",position:C.position,token:C.value};U(rt)}if(xe=te(xe),xe.type==="parent"||typeof xe.seekingParent<"u")throw{code:"S0217",token:xe.type,position:xe.position};return ee.length>0&&(xe.errors=ee),xe};return D})();r.exports=a},{"./signature":5}],5:[function(t,r,i){var u=t("./utils");const a=(()=>{var h={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};function v(x){for(var D=1,P=[],E=Object.create(null),C=E;D<x.length;){var O=x.charAt(D);if(O===":")break;var G=function(){P.push(E),C=E,E=Object.create(null)},ee=function(F,Z,ne,we){for(var pe=1,he=Z;he<F.length;)if(he++,O=F.charAt(he),O===we){if(pe--,pe===0)break}else O===ne&&pe++;return he};switch(O){case"s":case"n":case"b":case"l":case"o":E.regex="["+O+"m]",E.type=O,G();break;case"a":E.regex="[asnblfom]",E.type=O,E.array=!0,G();break;case"f":E.regex="f",E.type=O,G();break;case"j":E.regex="[asnblom]",E.type=O,G();break;case"x":E.regex="[asnblfom]",E.type=O,G();break;case"-":C.context=!0,C.contextRegex=new RegExp(C.regex),C.regex+="?";break;case"?":case"+":C.regex+=O;break;case"(":var J=ee(x,D,"(",")"),_=x.substring(D+1,J);if(_.indexOf("<")===-1)E.regex="["+_+"m]";else throw{code:"S0402",stack:new Error().stack,value:_,offset:D};E.type="("+_+")",D=J,G();break;case"<":if(C.type==="a"||C.type==="f"){var g=ee(x,D,"<",">");C.subtype=x.substring(D+1,g),D=g}else throw{code:"S0401",stack:new Error().stack,value:C.type,offset:D};break}D++}var U="^"+P.map(function(F){return"("+F.regex+")"}).join("")+"$",w=new RegExp(U),k=function(F){var Z;if(u.isFunction(F))Z="f";else{var ne=typeof F;switch(ne){case"string":Z="s";break;case"number":Z="n";break;case"boolean":Z="b";break;case"object":F===null?Z="l":Array.isArray(F)?Z="a":Z="o";break;case"undefined":default:Z="m"}}return Z},W=function(F,Z){for(var ne="^",we=0,pe=0;pe<P.length;pe++){ne+=P[pe].regex;var he=Z.match(ne);if(he===null)throw{code:"T0410",stack:new Error().stack,value:F[we],index:we+1};we=he[0].length}throw{code:"T0410",stack:new Error().stack,value:F[we],index:we+1}};return{definition:x,validate:function(F,Z){var ne="";F.forEach(function(Pe){ne+=k(Pe)});var we=w.exec(ne);if(we){var pe=[],he=0;return P.forEach(function(Pe,Ye){var ae=F[he],de=we[Ye+1];if(de==="")if(Pe.context&&Pe.contextRegex){var He=k(Z);if(Pe.contextRegex.test(He))pe.push(Z);else throw{code:"T0411",stack:new Error().stack,value:Z,index:he+1}}else pe.push(ae),he++;else de.split("").forEach(function(te){if(ae=F[he],Pe.type==="a"){if(te==="m")ae=void 0;else{var xe=!0;if(typeof Pe.subtype<"u"){if(te!=="a"&&de!==Pe.subtype)xe=!1;else if(te==="a"&&ae.length>0){var rt=k(ae[0]);if(rt!==Pe.subtype.charAt(0))xe=!1;else{var d=ae.filter(function(b){return k(b)!==rt});xe=d.length===0}}}if(!xe)throw{code:"T0412",stack:new Error().stack,value:ae,index:he+1,type:h[Pe.subtype]};te!=="a"&&(ae=[ae])}pe.push(ae),he++}else pe.push(ae),he++})}),pe}W(F,ne)}}}return v})();r.exports=a},{"./utils":6}],6:[function(t,r,i){const u=(()=>{function a(g){var U=!1;if(typeof g=="number"&&(U=!isNaN(g),U&&!isFinite(g)))throw{code:"D1001",value:g,stack:new Error().stack};return U}function h(g){var U=!1;return Array.isArray(g)&&(U=g.filter(function(w){return typeof w!="string"}).length===0),U}function v(g){var U=!1;return Array.isArray(g)&&(U=g.filter(function(w){return!a(w)}).length===0),U}function x(g){return g.sequence===!0&&Array.isArray(g)}function D(g){return g&&(g._jsonata_function===!0||g._jsonata_lambda===!0)||typeof g=="function"}function P(g){var U=typeof g.arity=="number"?g.arity:typeof g.implementation=="function"?g.implementation.length:typeof g.length=="number"?g.length:g.arguments.length;return U}function E(g){return g&&g._jsonata_lambda===!0}var C=(typeof Symbol=="function"?Symbol:{}).iterator||"@@iterator";function O(g){return typeof g=="object"&&g!==null&&C in g&&"next"in g&&typeof g.next=="function"}function G(g,U){if(g===U)return!0;if(typeof g=="object"&&typeof U=="object"&&g!==null&&U!==null){if(Array.isArray(g)&&Array.isArray(U)){if(g.length!==U.length)return!1;for(var w=0;w<g.length;w++)if(!G(g[w],U[w]))return!1;return!0}var k=Object.getOwnPropertyNames(g),W=Object.getOwnPropertyNames(U);if(k.length!==W.length)return!1;for(k=k.sort(),W=W.sort(),w=0;w<k.length;w++)if(k[w]!==W[w])return!1;for(w=0;w<k.length;w++){var F=k[w];if(!G(g[F],U[F]))return!1}return!0}return!1}function ee(g){return typeof g=="object"&&g!==null&&"then"in g&&typeof g.then=="function"}function J(g){var U=[];for(let w of g)U.push(w);return U}function _(g){return typeof g=="object"&&g!==null?Object.keys(g):[]}return{isNumeric:a,isArrayOfStrings:h,isArrayOfNumbers:v,isSequence:x,isFunction:D,isLambda:E,isIterable:O,getFunctionArity:P,isDeepEqual:G,stringToArray:J,isPromise:ee,keys:_}})();r.exports=u},{}]},{},[3])(3)})})(Br)),Br.exports}fs();const hs=150,Rn=10,ds=200,ps=16,Ln=new WeakMap;let Un=!1;function cr(){return typeof navigator>"u"?!1:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Bt(n){if(n===window)return{x:window.scrollX,y:window.scrollY};const e=n;return{x:e.scrollLeft,y:e.scrollTop}}function ms(n,e,t){if(n===window){window.scrollTo(e,t);return}const r=n;typeof r.scrollTo=="function"?r.scrollTo(e,t):(r.scrollLeft=e,r.scrollTop=t)}function gs(n){if(n===window){const t=document.documentElement;return Math.max(0,t.scrollHeight-window.innerHeight)}const e=n;return Math.max(0,e.scrollHeight-e.clientHeight)}function kt(n){let e=Ln.get(n);if(!e){const t=Bt(n);e={x:t.x,y:t.y,restoring:!1,watching:!1,userEngaged:!1,raf:0,stickyFrames:0},Ln.set(n,e)}return e}function lr(n){kt(n).userEngaged=!0}function fr(n){const e=kt(n);clearTimeout(e.settleTimer),e.settleTimer=setTimeout(()=>{e.userEngaged=!1,e.settleTimer=void 0},hs)}function Dn(n,e){return e-n>=ds}function Pt(n){if(!cr())return;const e=kt(n);if(e.restoring)return;const t=Bt(n);if(Dn(t.y,e.y)){qr(n);return}e.x=t.x,e.y=t.y}function vs(n){if(!cr())return;const e=kt(n),t=gs(n),r=e.x,i=t>0?Math.min(e.y,t):e.y,{x:u,y:a}=Bt(n);if(!(Math.abs(r-u)<=Rn&&Math.abs(i-a)<=Rn)){e.restoring=!0;try{ms(n,r,i)}finally{requestAnimationFrame(()=>{e.restoring=!1})}}}function qr(n){const e=kt(n);if(e.stickyFrames=ps,e.raf)return;const t=()=>{e.raf=0,vs(n),e.stickyFrames>0&&(e.stickyFrames--,e.raf=requestAnimationFrame(t))};e.raf=requestAnimationFrame(t)}function jr(n){qr(n)}function qt(n){if(!cr())return;const e=kt(n);if(e.watching)return;e.watching=!0;const t=n===window?window:n,r=()=>{if(e.restoring)return;const{y:O}=Bt(n);if(Dn(O,e.y)){qr(n);return}if(e.userEngaged){Pt(n),fr(n);return}Pt(n)},i=O=>On(O)===n,u=O=>{i(O)&&(Pt(n),lr(n))},a=O=>{i(O)&&fr(n)},h=O=>{i(O)&&(Pt(n),lr(n),fr(n))};t.addEventListener("scroll",r,{passive:!0}),t.addEventListener("touchstart",u,{passive:!0}),t.addEventListener("touchend",a,{passive:!0}),t.addEventListener("touchcancel",a,{passive:!0}),t.addEventListener("wheel",h,{passive:!0}),t.addEventListener("pointerdown",u,{passive:!0}),t.addEventListener("pointerup",a,{passive:!0}),t.addEventListener("pointercancel",a,{passive:!0});const v=Bt(n);if(e.x=v.x,e.y=v.y,n===window){const O=new ResizeObserver(()=>jr(window));O.observe(document.documentElement),e.resizeObserver=O;return}const x=n,D=new ResizeObserver(()=>jr(x));D.observe(x);for(const O of Array.from(x.children))D.observe(O);e.resizeObserver=D;const P=()=>jr(x),E=new MutationObserver(O=>{for(const G of O)if(G.type==="childList")for(const ee of Array.from(G.addedNodes))ee instanceof Element&&D.observe(ee);P()});E.observe(x,{childList:!0,subtree:!0,characterData:!0});const C=x.getRootNode();C instanceof ShadowRoot&&C.host&&E.observe(C.host,{childList:!0,subtree:!0,characterData:!0}),e.mutationObserver=E}function On(n){for(const e of n.composedPath())if(!(e===window||e===document)&&e instanceof HTMLElement&&Mn(e))return e;return window}function Mn(n){if(!(n instanceof HTMLElement)||n===document.documentElement||n===document.body)return!1;const e=getComputedStyle(n).overflowY;return e==="auto"||e==="scroll"||e==="overlay"}function Wr(n){for(const t of n.composedPath())t===window||t===document||t instanceof HTMLElement&&Mn(t)&&qt(t);const e=On(n);qt(e),n.type==="wheel"?(Pt(e),lr(e),fr(e)):(n.type==="touchstart"||n.type==="pointerdown")&&(Pt(e),lr(e))}function hr(n){n instanceof Element&&n.classList?.contains("custom-scroll")&&qt(n),n.querySelectorAll?.(".custom-scroll").forEach(e=>{e instanceof HTMLElement&&qt(e)})}function zr(n){hr(n),new MutationObserver(t=>{for(const r of t)for(const i of Array.from(r.addedNodes))i instanceof Element&&hr(i)}).observe(n,{childList:!0,subtree:!0})}function Hr(n){n.querySelectorAll?.("*").forEach(e=>{e.shadowRoot&&(zr(e.shadowRoot),Hr(e.shadowRoot))})}function ys(){const n=Element.prototype;if(n.__safariScrollGuardPatched)return;n.__safariScrollGuardPatched=!0;const e=n.attachShadow;n.attachShadow=function(r){const i=e.call(this,r);return zr(i),i}}function bs(){if(typeof window>"u"||Un||(Un=!0,!cr()))return;qt(window),ys();const n={capture:!0,passive:!0};window.addEventListener("wheel",Wr,n),window.addEventListener("touchstart",Wr,n),window.addEventListener("pointerdown",Wr,n);const e=()=>{hr(document),Hr(document)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e(),new MutationObserver(r=>{for(const i of r)for(const u of Array.from(i.addedNodes))u instanceof Element&&(hr(u),u.shadowRoot&&zr(u.shadowRoot),Hr(u))}).observe(document.documentElement,{childList:!0,subtree:!0})}const ws=Hi,Es=Xi,_s=Nr,Ss=Mr,As=st,Ts=ss,ks=sr,Ps=Ir,xs=ls;bs(),window["concorde-utils"]=window["concorde-utils"]||{},window["concorde-utils"]={Utils:ws,Arrays:Es,DataBindObserver:_s,Format:Ss,HTML:As,LocationHandler:Ts,Objects:ks,PublisherManager:$e,api:Ps,URLPattern:xs,Endpoint:Gr,DataProviderKey:ir};const jt="[sonic-webgpu]",Cs=["time","frame","mouseX","mouseY","hovering"],Fn=["param0","param1","param2","param3"],$n=["channel0","channel1","channel2","channel3"],Rs=["frameUrl","snapshot"];function Ls(){return typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches}function Vr(n,e){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"&&n.trim()!==""){const t=Number(n);if(Number.isFinite(t))return t}return e}function Us(n){if(n===null||n==="")return"";if(typeof n=="string")return n.trim();const e=Ni(n);if(e)return e;if(n&&typeof n=="object"){const t=n.element,r=$i(t);return r||void 0}return""}function Xr(n){const e=n.dataProvider?.trim();return e||st.getAncestorAttributeValue(n,"dataProvider")||st.getAncestorAttributeValue(n,"formDataProvider")||""}function Nn(n){n.formPublisher&&(n.formPublisher.offInternalMutation(n.onFormMutation),n.formPublisher=null)}function Ds(n){Nn(n);const e=Xr(n);e&&(n.formPublisher=$e.get(e),n.formPublisher.onInternalMutation(n.onFormMutation),n.onFormMutation())}function Os(n){const e=n.outDataProvider?.trim()||Xr(n)||"";n.outPublisher=e?$e.get(e):null}function Ms(n,e){for(const t of $n){if(!(t in e))continue;const r=Us(e[t]);r!==void 0&&n[t]!==r&&(n[t]=r)}for(const t of Fn){if(!(t in e))continue;const r=Vr(e[t],NaN);Number.isFinite(r)&&n[t]!==r&&(n[t]=r)}if("targetX"in e||"targetY"in e){const t=Vr(e.targetX,NaN),r=Vr(e.targetY,NaN);Number.isFinite(t)&&Number.isFinite(r)&&t>=0&&t<=1&&r>=0&&r<=1?(n.remoteTarget={x:t,y:r},In(n)):(n.remoteTarget=null,n.mouseVec[0]=0,n.mouseVec[1]=0)}}function In(n){if(!n.remoteTarget||!n.runtime||n.mouse&&n.hovering)return;const e=n.runtime.canvas.width,t=n.runtime.canvas.height;e<2||t<2||(n.mouseVec[0]=n.remoteTarget.x*e,n.mouseVec[1]=(1-n.remoteTarget.y)*t)}const yt={resolveFormProviderId:Xr,unbindFormProvider:Nn,bindFormProvider:Ds,bindOutPublisher:Os,applyFormParams:Ms,applyRemoteMouse:In},Fs=`#version 300 es
35
- `,$s=`precision highp float;
36
- precision highp int;
37
- precision mediump sampler2D;
38
-
39
- uniform vec3 iResolution;
40
- uniform float iTime;
41
- uniform float iTimeDelta;
42
- uniform float iFrameRate;
43
- uniform int iFrame;
44
- uniform float iChannelTime[4];
45
- uniform vec3 iChannelResolution[4];
46
- uniform vec4 iMouse;
47
- uniform vec4 iDate;
48
- uniform float iSampleRate;
49
- uniform sampler2D iChannel0;
50
- uniform sampler2D iChannel1;
51
- uniform sampler2D iChannel2;
52
- uniform sampler2D iChannel3;
53
- uniform float uParam0;
54
- uniform float uParam1;
55
- uniform float uParam2;
56
- uniform float uParam3;
57
- /** Near / far caméra (0 dans sonic-shader standalone). */
58
- uniform float uNear;
59
- uniform float uFar;
60
-
61
- out vec4 sonicFragColor;
62
-
63
- /** Profondeur linéaire monde depuis une DepthTexture (0–1). */
64
- float sonicLinearDepth(float d) {
65
- float z = d * 2.0 - 1.0;
66
- float n = max(uNear, 1e-4);
67
- float f = max(uFar, n + 1e-4);
68
- return (2.0 * n * f) / (f + n - z * (f - n));
69
- }
70
-
71
- `,Ns=`
72
- void main() {
73
- mainImage(sonicFragColor, gl_FragCoord.xy);
74
- }
75
- `,Is=`#version 300 es
76
- precision highp float;
77
- layout(location = 0) in vec2 aPos;
78
- void main() {
79
- gl_Position = vec4(aPos, 0.0, 1.0);
80
- }
81
- `;function Gs(n,e){return $s+(n?n+`
82
- `:"")+e+`
83
- `+Ns}function Bs(n,e){return Fs+Gs(n,e)}function qs(n){const e=(n??"").trim().toLowerCase();return e==="rgba16f"||e==="rgba16"||e==="half"?"rgba16f":e==="rgba32f"||e==="rgba32"||e==="float"?"rgba32f":"rgba8"}class Wt extends Error{constructor(e,t,r){super(e),this.pass=t,this.infoLog=r,this.name="ShaderCompileError"}}const js=["bufferA","bufferB","bufferC","bufferD","image"],Gn=["bufferA","bufferB","bufferC","bufferD"];function Bn(n,e,t){if(!n)return{upload:!1,texSource:null};if(typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement){const r=n.currentSrc||n.src||"";return!r||!n.complete||n.naturalWidth<1?{upload:!1,texSource:null}:t===r&&e>0?{upload:!1,texSource:null,nextSrc:r}:{upload:!0,texSource:n,nextSrc:r}}if(typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement)return n.readyState<2||n.videoWidth<1?{upload:!1,texSource:null}:{upload:!0,texSource:n};if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement)return n.width<1||n.height<1?{upload:!1,texSource:null}:{upload:!0,texSource:n};if(Rr(n)){if(n.frameSeq===e)return{upload:!1,texSource:null};const r=n.getFrameCanvas();return!r||r.width<1||r.height<1?{upload:!1,texSource:null}:{upload:!0,texSource:r}}return{upload:!1,texSource:null}}function Ws(n){return/\.(webm|mp4|ogg|mov)(\?|#|$)/i.test(n)}function zs(n){return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?{width:n.videoWidth||1,height:n.videoHeight||1}:typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement?{width:n.naturalWidth||n.width||1,height:n.naturalHeight||n.height||1}:"width"in n&&"height"in n?{width:Math.max(1,Number(n.width)||1),height:Math.max(1,Number(n.height)||1)}:{width:1,height:1}}function qn(n,e,t,r){const i=n.createShader(e);if(!i)throw new Wt("Unable to create shader",r,"");if(n.shaderSource(i,t),n.compileShader(i),!n.getShaderParameter(i,n.COMPILE_STATUS)){const u=n.getShaderInfoLog(i)||"";throw n.deleteShader(i),new Wt(`Compile error (${r}): ${u}`,r,u)}return i}function Hs(n,e,t,r){const i=n.createProgram();if(!i)throw new Wt("Unable to create program","link","");if(n.attachShader(i,e),n.attachShader(i,t),n.linkProgram(i),!n.getProgramParameter(i,n.LINK_STATUS)){const u=n.getProgramInfoLog(i)||"";throw n.deleteProgram(i),new Wt(`Link error (${r}): ${u}`,"link",u)}return i}function Vs(n,e){return{iResolution:n.getUniformLocation(e,"iResolution"),iTime:n.getUniformLocation(e,"iTime"),iTimeDelta:n.getUniformLocation(e,"iTimeDelta"),iFrameRate:n.getUniformLocation(e,"iFrameRate"),iFrame:n.getUniformLocation(e,"iFrame"),iMouse:n.getUniformLocation(e,"iMouse"),iDate:n.getUniformLocation(e,"iDate"),iSampleRate:n.getUniformLocation(e,"iSampleRate"),iChannelTime:n.getUniformLocation(e,"iChannelTime[0]")||n.getUniformLocation(e,"iChannelTime"),iChannelResolution:n.getUniformLocation(e,"iChannelResolution[0]")||n.getUniformLocation(e,"iChannelResolution"),iChannel:[0,1,2,3].map(t=>n.getUniformLocation(e,`iChannel${t}`)),uParam:[0,1,2,3].map(t=>n.getUniformLocation(e,`uParam${t}`))}}let jn=!1;function Yr(n,e){const t=qs(e);if(t==="rgba8")return{requested:t,active:"rgba8",internal:n.RGBA8,format:n.RGBA,type:n.UNSIGNED_BYTE,filter:n.LINEAR,float:!1};if(!n.getExtension("EXT_color_buffer_float"))return jn||(jn=!0,console.warn(`[sonic-shader] buffer-format="${t}" indisponible (pas d'EXT_color_buffer_float) → rgba8`)),Yr(n,"rgba8");if(t==="rgba16f")return{requested:t,active:"rgba16f",internal:n.RGBA16F,format:n.RGBA,type:n.HALF_FLOAT,filter:n.LINEAR,float:!0};const i=!!n.getExtension("OES_texture_float_linear");return{requested:t,active:"rgba32f",internal:n.RGBA32F,format:n.RGBA,type:n.FLOAT,filter:i?n.LINEAR:n.NEAREST,float:!0}}function Jr(n,e,t,r){const i=r??{internal:n.RGBA8,format:n.RGBA,type:n.UNSIGNED_BYTE,filter:n.LINEAR},u=n.createTexture();if(!u)throw new Error("Unable to create texture");return n.bindTexture(n.TEXTURE_2D,u),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i.filter),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i.filter),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texImage2D(n.TEXTURE_2D,0,i.internal,e,t,0,i.format,i.type,null),u}function Wn(n,e){const t=n.createFramebuffer();if(!t)throw new Error("Unable to create framebuffer");n.bindFramebuffer(n.FRAMEBUFFER,t),n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e,0);const r=n.checkFramebufferStatus(n.FRAMEBUFFER);if(r!==n.FRAMEBUFFER_COMPLETE)throw new Error(`Incomplete framebuffer: ${r}`);return n.bindFramebuffer(n.FRAMEBUFFER,null),t}function Kr(n,e,t,r){const i=[Jr(n,e,t,r),Jr(n,e,t,r)],u=[Wn(n,i[0]),Wn(n,i[1])];return{textures:i,framebuffers:u,index:0}}function dr(n,e){for(const t of e.textures)n.deleteTexture(t);for(const t of e.framebuffers)n.deleteFramebuffer(t)}function pr(n,e){const t=(n??"").trim();if(!t){const i=e.trim();return i.startsWith("#")?{kind:"element",key:i}:i?{kind:"url",url:i}:{kind:"none"}}if(t.startsWith("#"))return{kind:"element",key:t};const r=t.toLowerCase();return r==="self"?{kind:"self"}:r==="buffer-a"||r==="buffera"||r==="a"?{kind:"buffer",buffer:"bufferA"}:r==="buffer-b"||r==="bufferb"||r==="b"?{kind:"buffer",buffer:"bufferB"}:r==="buffer-c"||r==="bufferc"||r==="c"?{kind:"buffer",buffer:"bufferC"}:r==="buffer-d"||r==="bufferd"||r==="d"?{kind:"buffer",buffer:"bufferD"}:r==="none"||r==="null"?{kind:"none"}:{kind:"url",url:t}}class Xs{constructor(e){this.vao=null,this.vertexShader=null,this.programs=new Map,this.buffers=new Map,this.external=new Map,this.width=0,this.height=0,this.passChannels=new Map,this.activePasses=[],this.blackTexture=null,this.elementResolver=null;const t=e.getContext("webgl2",{antialias:!1,alpha:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!0,powerPreference:"default"});if(!t||t.isContextLost())throw new Error("WebGL2 not available");this.canvas=e,this.gl=t,this.bufferFmt=Yr(t,"rgba8"),this.initGeometry(),this.blackTexture=Jr(t,1,1),t.bindTexture(t.TEXTURE_2D,this.blackTexture),t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255]))}get activeBufferFormat(){return this.bufferFmt.active}setBufferFormat(e){const t=Yr(this.gl,e);if(t.active===this.bufferFmt.active&&t.filter===this.bufferFmt.filter)return this.bufferFmt=t,t.active;if(this.bufferFmt=t,this.width>=1&&this.height>=1)for(const r of Gn){const i=this.buffers.get(r);i&&dr(this.gl,i),this.programs.has(r)?this.buffers.set(r,Kr(this.gl,this.width,this.height,this.bufferFmt)):this.buffers.delete(r)}return t.active}get isLost(){return this.gl.isContextLost()}initGeometry(){const e=this.gl,t=e.createVertexArray();if(!t)throw new Error("Unable to create VAO");this.vao=t,e.bindVertexArray(t);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,3,-1,-1,3]),e.STATIC_DRAW),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,2,e.FLOAT,!1,0,0),e.bindVertexArray(null)}resize(e,t){const r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t));if(!(r===this.width&&i===this.height)){this.width=r,this.height=i,this.canvas.width=r,this.canvas.height=i;for(const u of Gn){const a=this.buffers.get(u);a&&dr(this.gl,a),this.programs.has(u)&&this.buffers.set(u,Kr(this.gl,r,i,this.bufferFmt))}}}setSources(e,t){if(this.gl.isContextLost())throw new Error("WebGL context lost");this.disposePrograms(),this.passChannels=t,this.activePasses=[],this.vertexShader=qn(this.gl,this.gl.VERTEX_SHADER,Is,"vertex");for(const r of js){const i=r==="image"?e.image:e[r];if(!i?.trim())continue;const u=Bs(e.common||"",i),a=qn(this.gl,this.gl.FRAGMENT_SHADER,u,r),h=Hs(this.gl,this.vertexShader,a,r);if(this.gl.deleteShader(a),this.programs.set(r,{program:h,uniforms:Vs(this.gl,h)}),this.activePasses.push(r),r!=="image"&&this.width>0){const v=this.buffers.get(r);v&&dr(this.gl,v),this.buffers.set(r,Kr(this.gl,this.width,this.height,this.bufferFmt))}}if(!this.programs.has("image"))throw new Wt("image pass is required","image","Missing image shader source")}setPassChannels(e){if(this.gl.isContextLost())throw new Error("WebGL context lost");this.passChannels=e}async ensureTextures(e){const t=[...new Set(e.filter(Boolean))];await Promise.all(t.map(r=>this.loadTexture(r)))}ensureElementTexture(e){if(this.external.has(e))return;const t=this.gl,r=t.createTexture();r&&(t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([0,0,0,255])),this.external.set(e,{texture:r,width:1,height:1,url:e,lastSeq:0}))}updateElementTextures(e){const t=this.gl;for(const[r,i]of this.external){let u=i.video??i.source??null;r.startsWith("#")&&e&&(u=e(r),i.source=u),typeof HTMLVideoElement<"u"&&u instanceof HTMLVideoElement&&(i.video=u);const a=Bn(u,i.lastSeq,i.lastSrc);if(!a.upload||!a.texSource)continue;const h=zs(a.texSource);t.bindTexture(t.TEXTURE_2D,i.texture),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,1),i.width===h.width&&i.height===h.height&&i.lastSeq>0?t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,a.texSource):(t.texImage2D(t.TEXTURE_2D,0,t.RGBA8,t.RGBA,t.UNSIGNED_BYTE,a.texSource),i.width=h.width,i.height=h.height),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,0),Rr(u)?i.lastSeq=u.frameSeq:i.lastSeq=(i.lastSeq||0)+1,a.nextSrc!==void 0&&(i.lastSrc=a.nextSrc)}}updateVideoTextures(){this.updateElementTextures()}setVideosPlaying(e){for(const t of this.external.values()){const r=t.video||(typeof HTMLVideoElement<"u"&&t.source instanceof HTMLVideoElement?t.source:null);r&&(e?r.play().catch(()=>{}):r.pause())}}getTextureSize(e){const t=this.external.get(e);return!t||t.width<1||t.height<1?null:{width:t.width,height:t.height}}loadTexture(e){return this.external.get(e)?Promise.resolve():Ws(e)?this.loadVideoTexture(e):new Promise((r,i)=>{const u=new Image;u.crossOrigin="anonymous",u.onload=()=>{const a=this.gl,h=a.createTexture();if(!h){i(new Error("Unable to create texture"));return}a.bindTexture(a.TEXTURE_2D,h),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,1),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texImage2D(a.TEXTURE_2D,0,a.RGBA8,a.RGBA,a.UNSIGNED_BYTE,u),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:h,width:u.naturalWidth||u.width,height:u.naturalHeight||u.height,url:e,lastSeq:0}),r()},u.onerror=()=>i(new Error(`Failed to load texture: ${e}`)),u.src=e})}loadVideoTexture(e){return new Promise((t,r)=>{const i=document.createElement("video");i.crossOrigin="anonymous",i.muted=!0,i.loop=!0,i.playsInline=!0,i.preload="auto";let u=!1;const a=()=>{u||(u=!0,r(new Error(`Failed to load video: ${e}`)))},h=()=>{if(u||!i.videoWidth)return;u=!0;const v=this.gl,x=v.createTexture();if(!x){r(new Error("Unable to create texture"));return}v.bindTexture(v.TEXTURE_2D,x),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,1),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texImage2D(v.TEXTURE_2D,0,v.RGBA8,v.RGBA,v.UNSIGNED_BYTE,i),v.pixelStorei(v.UNPACK_FLIP_Y_WEBGL,0),this.external.set(e,{texture:x,width:i.videoWidth,height:i.videoHeight,url:e,video:i,lastSeq:0}),i.play().catch(()=>{}),t()};i.addEventListener("loadeddata",h),i.addEventListener("error",a),i.src=e,i.load()})}resolveChannel(e,t){const r={texture:this.blackTexture,width:1,height:1};if(t.kind==="none")return r;if(t.kind==="url"||t.kind==="element"){const a=t.kind==="url"?t.url:t.key,h=this.external.get(a);return h?{texture:h.texture,width:h.width,height:h.height}:r}const i=t.kind==="self"?e==="image"?null:e:t.buffer;if(!i)return r;const u=this.buffers.get(i);return u?{texture:u.textures[u.index],width:this.width,height:this.height}:r}bindChannels(e,t){const r=this.gl,i=this.passChannels.get(e)||[{kind:"none"},{kind:"none"},{kind:"none"},{kind:"none"}],u=[];for(let a=0;a<4;a++){const h=this.resolveChannel(e,i[a]);r.activeTexture(r.TEXTURE0+a),r.bindTexture(r.TEXTURE_2D,h.texture),t.iChannel[a]&&r.uniform1i(t.iChannel[a],a),u.push(h.width,h.height,1)}t.iChannelResolution&&r.uniform3fv(t.iChannelResolution,u),t.iChannelTime&&r.uniform1fv(t.iChannelTime,[0,0,0,0])}setCommonUniforms(e,t){const r=this.gl,i=this.width,u=this.height;if(e.iResolution&&r.uniform3f(e.iResolution,i,u,1),e.iTime&&r.uniform1f(e.iTime,t.time),e.iTimeDelta&&r.uniform1f(e.iTimeDelta,t.timeDelta),e.iFrameRate&&r.uniform1f(e.iFrameRate,t.timeDelta>0?1/t.timeDelta:60),e.iFrame&&r.uniform1i(e.iFrame,t.frame),e.iMouse&&r.uniform4f(e.iMouse,t.mouse[0],t.mouse[1],t.mouse[2],t.mouse[3]),e.iDate){const a=new Date;r.uniform4f(e.iDate,a.getFullYear(),a.getMonth(),a.getDate(),a.getHours()*3600+a.getMinutes()*60+a.getSeconds()+a.getMilliseconds()*.001)}e.iSampleRate&&r.uniform1f(e.iSampleRate,44100);for(let a=0;a<4;a++)e.uParam[a]&&r.uniform1f(e.uParam[a],t.params[a])}setElementResolver(e){this.elementResolver=e}render(e){const t=this.gl;if(!this.vao||this.width<1||this.height<1)return;this.updateElementTextures(this.elementResolver??void 0),t.bindVertexArray(this.vao),t.viewport(0,0,this.width,this.height),t.disable(t.DEPTH_TEST),t.disable(t.BLEND);for(const i of this.activePasses){if(i==="image")continue;const u=this.programs.get(i),a=this.buffers.get(i);if(!u||!a)continue;const h=1-a.index;t.bindFramebuffer(t.FRAMEBUFFER,a.framebuffers[h]),t.viewport(0,0,this.width,this.height),t.useProgram(u.program),this.setCommonUniforms(u.uniforms,e),this.bindChannels(i,u.uniforms),t.drawArrays(t.TRIANGLES,0,3),a.index=h}const r=this.programs.get("image");r&&(t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,this.width,this.height),t.useProgram(r.program),this.setCommonUniforms(r.uniforms,e),this.bindChannels("image",r.uniforms),t.drawArrays(t.TRIANGLES,0,3),t.bindVertexArray(null))}readRect(e,t,r,i){return this.readFramebufferRect(null,e,t,r,i)}readBufferRect(e,t,r,i,u){if(e==="image")return this.readRect(t,r,i,u);const a=this.buffers.get(e);return a?this.readFramebufferRect(a.framebuffers[a.index],t,r,i,u,this.bufferFmt.float):null}readPixel(e,t){const r=this.readRect(Math.floor(e),Math.floor(t),1,1);return!r||r.data.length<4?[0,0,0,0]:[r.data[0],r.data[1],r.data[2],r.data[3]]}readFramebufferRect(e,t,r,i,u,a=!1){const h=this.gl;if(h.isContextLost()||this.width<1||this.height<1)return null;let v=Math.floor(t),x=Math.floor(r),D=Math.floor(i),P=Math.floor(u);if(D<1||P<1||(v<0&&(D+=v,v=0),x<0&&(P+=x,x=0),v+D>this.width&&(D=this.width-v),x+P>this.height&&(P=this.height-x),D<1||P<1))return null;h.bindFramebuffer(h.FRAMEBUFFER,e);let E;return a?(E=new Float32Array(D*P*4),h.readPixels(v,x,D,P,h.RGBA,h.FLOAT,E)):(E=new Uint8Array(D*P*4),h.readPixels(v,x,D,P,h.RGBA,h.UNSIGNED_BYTE,E)),h.bindFramebuffer(h.FRAMEBUFFER,null),{x:v,y:x,width:D,height:P,data:E}}get size(){return{width:this.width,height:this.height}}disposePrograms(){for(const e of this.programs.values())this.gl.deleteProgram(e.program);this.programs.clear(),this.activePasses=[],this.vertexShader&&(this.gl.deleteShader(this.vertexShader),this.vertexShader=null)}dispose(e=!0){if(this.gl.isContextLost())this.programs.clear(),this.buffers.clear(),this.external.clear(),this.blackTexture=null,this.vao=null,this.vertexShader=null;else{this.disposePrograms();for(const t of this.buffers.values())dr(this.gl,t);this.buffers.clear();for(const t of this.external.values())t.video&&(t.video.pause(),t.video.removeAttribute("src"),t.video.load()),this.gl.deleteTexture(t.texture);this.external.clear(),this.blackTexture&&(this.gl.deleteTexture(this.blackTexture),this.blackTexture=null),this.vao&&(this.gl.deleteVertexArray(this.vao),this.vao=null),e&&this.gl.getExtension("WEBGL_lose_context")?.loseContext()}}}const Ys={common:"",image:`
84
- void mainImage(out vec4 fragColor, in vec2 fragCoord) {
85
- vec2 uv = fragCoord / iResolution.xy;
86
- vec4 c = texture(iChannel0, uv);
87
- float has = step(0.001, c.a + c.r + c.g + c.b);
88
- // Souris en UV (origine bas-gauche, comme fragCoord)
89
- vec2 muv = iMouse.xy / max(iResolution.xy, vec2(1.0));
90
- float m = length(uv - muv);
91
- // Halo souris toujours visible + mix global via uParam0
92
- float glow = exp(-m * 8.0) * (0.35 + 0.65 * uParam0);
93
- vec4 tint = vec4(0.15, 0.45, 0.95, 1.0);
94
- vec4 mixed = mix(c, tint, clamp(uParam0 * 0.35 + glow, 0.0, 1.0));
95
- float g = 0.15 + 0.25 * uv.y;
96
- vec4 grad = vec4(g, g * 0.85 + 0.08 * uParam0, 0.35 + 0.4 * uv.x, 1.0);
97
- fragColor = mix(grad, mixed, has);
98
- }
99
- `,bufferA:"",bufferB:"",bufferC:"",bufferD:""};class zt{constructor(e,t){this.backend="webgl2",this.channelUrls=["","","",""],this.lastTime=0,this.disposed=!1,this.channelQueue=Promise.resolve(),this.elementResolver=null,this.canvas=e,this.toy=t,this.applySources()}static create(e){const t=new Xs(e);return new zt(e,t)}setElementResolver(e){this.elementResolver=e,this.toy.setElementResolver(e)}async setShader(e){this.assertAlive()}async setChannel(e,t){return this.channelQueue=this.channelQueue.then(()=>this.setChannelNow(e,t)),this.channelQueue}async setChannelNow(e,t){this.assertAlive();const r=t.trim();if(this.channelUrls[e]===r){if(r.startsWith("#")){this.toy.ensureElementTexture(r);return}r&&!this.toy.getTextureSize(r)&&await this.toy.ensureTextures([r]);return}this.channelUrls[e]=r,this.applySources(),await this.ensureChannelAssets()}async setChannels(e){return this.channelQueue=this.channelQueue.then(async()=>{this.assertAlive(),this.channelUrls=[e[0].trim(),e[1].trim(),e[2].trim(),e[3].trim()],this.applySources(),await this.ensureChannelAssets()}),this.channelQueue}getTextureSize(e){return this.toy.getTextureSize(e.trim())}resize(e,t){this.assertAlive(),this.toy.resize(e,t)}updateLiveChannels(e){this.assertAlive(),this.toy.updateElementTextures(e)}draw(e){if(this.assertAlive(),this.toy.isLost)return;this.elementResolver&&this.toy.updateElementTextures(this.elementResolver);const t=this.lastTime>0?Math.max(0,e.time-this.lastTime):0;this.lastTime=e.time;const r={time:e.time,timeDelta:t,frame:Math.floor(e.frame),mouse:e.mouse,params:e.params};this.toy.render(r)}dispose(e=!0){this.disposed||(this.disposed=!0,this.toy.dispose(e))}async ensureChannelAssets(){const e=this.channelUrls.filter(t=>t&&!t.startsWith("#"));e.length&&await this.toy.ensureTextures(e);for(const t of this.channelUrls)t.startsWith("#")&&this.toy.ensureElementTexture(t)}applySources(){const e=new Map([["image",[pr(this.channelUrls[0],""),pr(this.channelUrls[1],""),pr(this.channelUrls[2],""),pr(this.channelUrls[3],"")]]]);this.toy.setSources(Ys,e)}assertAlive(){if(this.disposed)throw new Error("WebGL2 fallback disposed")}}class Ht extends Error{constructor(e,t){super(e),this.infoLog=t,this.name="WebGpuCompileError"}}function zn(n){const e=String(n??"auto").trim().toLowerCase();return e==="webgpu"||e==="webgl2"||e==="auto"?e:"auto"}function Js(n){const e=String(n??"").trim().toLowerCase();return e==="particles"||e==="image"?e:""}const Hn=`
100
- fn mainImage(uv: vec2f, fragCoord: vec2f) -> vec4f {
101
- _ = fragCoord;
102
- let c = iChannel0(uv);
103
- if (c.a > 0.001 || c.r + c.g + c.b > 0.001) {
104
- return c;
105
- }
106
- let g = 0.15 + 0.25 * uv.y;
107
- return vec4f(g, g * 0.85 + 0.08 * u.params.x, 0.35 + 0.4 * uv.x, 1.0);
108
- }
109
- `.trim(),Ks=`
110
- struct SonicUniforms {
111
- resolution: vec2f,
112
- time: f32,
113
- frame: f32,
114
- mouse: vec4f,
115
- params: vec4f,
116
- }
117
-
118
- @group(0) @binding(0) var<uniform> u: SonicUniforms;
119
- @group(0) @binding(1) var channel0Tex: texture_2d<f32>;
120
- @group(0) @binding(2) var channel1Tex: texture_2d<f32>;
121
- @group(0) @binding(3) var channel2Tex: texture_2d<f32>;
122
- @group(0) @binding(4) var channel3Tex: texture_2d<f32>;
123
- @group(0) @binding(5) var texSampler: sampler;
124
-
125
- fn iChannel0(uv: vec2f) -> vec4f {
126
- return textureSample(channel0Tex, texSampler, uv);
127
- }
128
- fn iChannel1(uv: vec2f) -> vec4f {
129
- return textureSample(channel1Tex, texSampler, uv);
130
- }
131
- fn iChannel2(uv: vec2f) -> vec4f {
132
- return textureSample(channel2Tex, texSampler, uv);
133
- }
134
- fn iChannel3(uv: vec2f) -> vec4f {
135
- return textureSample(channel3Tex, texSampler, uv);
136
- }
137
-
138
- struct VsOut {
139
- @builtin(position) position: vec4f,
140
- @location(0) uv: vec2f,
141
- }
142
-
143
- @vertex
144
- fn vs_main(@builtin(vertex_index) vi: u32) -> VsOut {
145
- var pos = array<vec2f, 3>(
146
- vec2f(-1.0, -1.0),
147
- vec2f(3.0, -1.0),
148
- vec2f(-1.0, 3.0),
149
- );
150
- var out: VsOut;
151
- out.position = vec4f(pos[vi], 0.0, 1.0);
152
- out.uv = pos[vi] * 0.5 + vec2f(0.5);
153
- return out;
154
- }
155
-
156
- @fragment
157
- fn fs_main(in: VsOut) -> @location(0) vec4f {
158
- let fragCoord = vec2f(in.uv.x * u.resolution.x, in.uv.y * u.resolution.y);
159
- return mainImage(in.uv, fragCoord);
160
- }
161
- `.trim();function Vn(n){const e=n.trim()||Hn;if(!/\bfn\s+mainImage\s*\(/.test(e))throw new Error("WGSL invalide : définir `fn mainImage(uv: vec2f, fragCoord: vec2f) -> vec4f`.");return`${Ks}
162
-
163
- ${e}
164
- `}const Xn=64,Yn=4;function Zs(n,e,t){return n?n.width!==e||n.height!==t:!0}function Qs(n){return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?{width:n.videoWidth||1,height:n.videoHeight||1}:typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement?{width:n.naturalWidth||n.width||1,height:n.naturalHeight||n.height||1}:"width"in n&&"height"in n?{width:Math.max(1,Number(n.width)||1),height:Math.max(1,Number(n.height)||1)}:{width:1,height:1}}async function Zr(n=navigator.gpu){return await n.requestAdapter({powerPreference:"high-performance"})??await n.requestAdapter({powerPreference:"low-power"})??await n.requestAdapter()}async function ea(n){const e=n.createTexture({size:[1,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return n.queue.writeTexture({texture:e},new Uint8Array([0,0,0,0]),{bytesPerRow:4},[1,1]),e}class xt{constructor(e,t,r,i){this.backend="webgpu",this.pipeline=null,this.channelTextures=[null,null,null,null],this.channelViews=[null,null,null,null],this.channelSizes=[null,null,null,null],this.channelUrls=["","","",""],this.channelLastSeq=[0,0,0,0],this.channelLastSrc=[void 0,void 0,void 0,void 0],this.placeholder=null,this.placeholderView=null,this.bindGroup=null,this.disposed=!1,this.channelLoadTokens=[0,0,0,0],this.canvas=e,this.device=t,this.context=r,this.format=i,this.uniformBuffer=t.createBuffer({size:Xn,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.sampler=t.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"})}static async probe(){const e=navigator.gpu;if(!e)return"WebGPU indisponible (pas de navigator.gpu)";try{const t=await Zr(e);return t?((await t.requestDevice()).destroy(),null):"WebGPU adapter indisponible"}catch(t){return t instanceof Error?t.message:String(t)}}static async create(e){const t=navigator.gpu;if(!t)throw new Error("WebGPU indisponible (pas de navigator.gpu)");const r=await Zr(t);if(!r)throw new Error("WebGPU adapter indisponible");const i=await r.requestDevice(),u=e.getContext("webgpu");if(!u)throw i.destroy(),new Error("WebGPU canvas context indisponible");const a=navigator.gpu.getPreferredCanvasFormat();u.configure({device:i,format:a,alphaMode:"premultiplied"});const h=new xt(e,i,u,a);return h.placeholder=await ea(i),h.placeholderView=h.placeholder.createView(),h}async setShader(e){this.assertAlive();let t;try{t=Vn(e)}catch(a){const h=a instanceof Error?a.message:String(a);throw new Ht(h)}const r=this.device.createShaderModule({code:t}),u=(await r.getCompilationInfo()).messages.filter(a=>a.type==="error");if(u.length)throw new Ht("WGSL compile error",u.map(a=>a.message).join(`
165
- `));this.pipeline=this.device.createRenderPipeline({layout:"auto",vertex:{module:r,entryPoint:"vs_main"},fragment:{module:r,entryPoint:"fs_main",targets:[{format:this.format}]},primitive:{topology:"triangle-list"}}),this.bindGroup=null}async setChannel(e,t){this.assertAlive();const r=t.trim();if(r.startsWith("#")){this.bindElementChannel(e,r);return}if(this.channelUrls[e]===r&&this.channelTextures[e])return;this.channelUrls[e]=r,this.channelLastSeq[e]=0,this.channelLastSrc[e]=void 0;const i=++this.channelLoadTokens[e];if(!r){this.destroyChannel(e),this.bindGroup=null;return}const u=await ta(r);i!==this.channelLoadTokens[e]||this.disposed||this.uploadExternal(e,u,!1)}updateLiveChannels(e){this.assertAlive();for(let t=0;t<Yn;t++){const r=this.channelUrls[t];if(!r.startsWith("#"))continue;const i=e(r),u=Bn(i,this.channelLastSeq[t],this.channelLastSrc[t]);!u.upload||!u.texSource||(this.uploadExternal(t,u.texSource,!0),Rr(i)?this.channelLastSeq[t]=i.frameSeq:this.channelLastSeq[t]=(this.channelLastSeq[t]||0)+1,u.nextSrc!==void 0&&(this.channelLastSrc[t]=u.nextSrc))}}getTextureSize(e){const t=this.channelUrls.indexOf(e.trim());return t<0?null:this.channelSizes[t]}resize(e,t){this.assertAlive();const r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t));this.canvas.width===r&&this.canvas.height===i||(this.canvas.width=r,this.canvas.height=i,this.context.configure({device:this.device,format:this.format,alphaMode:"premultiplied"}))}draw(e){if(this.assertAlive(),!this.pipeline||!this.placeholderView)return;this.writeUniforms(e),this.bindGroup||(this.bindGroup=this.device.createBindGroup({layout:this.pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniformBuffer}},{binding:1,resource:this.channelViews[0]??this.placeholderView},{binding:2,resource:this.channelViews[1]??this.placeholderView},{binding:3,resource:this.channelViews[2]??this.placeholderView},{binding:4,resource:this.channelViews[3]??this.placeholderView},{binding:5,resource:this.sampler}]}));const t=this.device.createCommandEncoder(),r=t.beginRenderPass({colorAttachments:[{view:this.context.getCurrentTexture().createView(),clearValue:{r:0,g:0,b:0,a:1},loadOp:"clear",storeOp:"store"}]});r.setPipeline(this.pipeline),r.setBindGroup(0,this.bindGroup),r.draw(3),r.end(),this.device.queue.submit([t.finish()])}dispose(e=!1){if(!this.disposed){this.disposed=!0;for(let t=0;t<Yn;t++)this.channelLoadTokens[t]++,this.destroyChannel(t);this.placeholder?.destroy(),this.placeholder=null,this.placeholderView=null,this.uniformBuffer.destroy(),this.pipeline=null,this.bindGroup=null;try{this.context.unconfigure()}catch{}if(e)try{this.device.destroy()}catch{}}}bindElementChannel(e,t){if(!(this.channelUrls[e]===t&&this.channelTextures[e])&&(this.channelUrls[e]=t,this.channelLastSeq[e]=0,this.channelLastSrc[e]=void 0,this.channelLoadTokens[e]++,!this.channelTextures[e])){const r=this.device.createTexture({size:[1,1],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});this.device.queue.writeTexture({texture:r},new Uint8Array([0,0,0,255]),{bytesPerRow:4},[1,1]),this.channelTextures[e]=r,this.channelViews[e]=r.createView(),this.channelSizes[e]={width:1,height:1},this.bindGroup=null}}uploadExternal(e,t,r){const{width:i,height:u}=Qs(t),a=Math.max(1,i),h=Math.max(1,u),v=this.channelTextures[e];if(v&&!Zs(this.channelSizes[e],a,h)){this.device.queue.copyExternalImageToTexture({source:t,flipY:r},{texture:v},[a,h]);return}const x=this.device.createTexture({size:[a,h],format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});this.device.queue.copyExternalImageToTexture({source:t,flipY:r},{texture:x},[a,h]),this.destroyChannel(e),this.channelTextures[e]=x,this.channelViews[e]=x.createView(),this.channelSizes[e]={width:a,height:h},this.bindGroup=null}writeUniforms(e){const t=new ArrayBuffer(Xn),r=new Float32Array(t);r[0]=e.width,r[1]=e.height,r[2]=e.time,r[3]=e.frame,r[4]=e.mouse[0],r[5]=e.mouse[1],r[6]=e.mouse[2],r[7]=e.mouse[3],r[8]=e.params[0],r[9]=e.params[1],r[10]=e.params[2],r[11]=e.params[3],this.device.queue.writeBuffer(this.uniformBuffer,0,t)}destroyChannel(e){this.channelTextures[e]?.destroy(),this.channelTextures[e]=null,this.channelViews[e]=null,this.channelSizes[e]=null}assertAlive(){if(this.disposed)throw new Error("WebGPU runtime disposed")}}async function ta(n){const e=await fetch(n);if(!e.ok)throw new Error(`Failed to load texture: ${n}`);const t=await e.blob();return createImageBitmap(t)}function Jn(n){if(n.outEventListeners>0||n.frameOut&&n.outPublisher)return!0;const e=n.outPublisher;if(!e?._proxies_)return!1;for(const t of[...Cs,...Rs])if(e._proxies_.get(t)?.hasListener?.())return!0;return!1}function ra(n,e,t){if(!Jn(n)||e-n.lastOutAt<n.outInterval)return;n.lastOutAt=e;const r={time:t,frame:n.frame,mouseX:n.mouseVec[0],mouseY:n.mouseVec[1],hovering:n.hovering,param0:n.param0,param1:n.param1,param2:n.param2,param3:n.param3,backend:n.runtime?.backend};n.dispatchEvent(new CustomEvent("out",{detail:r,bubbles:!0,composed:!0}));const i=n.outPublisher;if(i){const u=yt.resolveFormProviderId(n)===(n.outDataProvider?.trim()||yt.resolveFormProviderId(n)),a={time:r.time,frame:r.frame,mouseX:r.mouseX,mouseY:r.mouseY,hovering:r.hovering};if(!u)for(const h of Fn)a[h]=r[h];i.set(a)}n.frameOut&&Kn(n)}async function Kn(n){if(n.frameOutBusy||!n.runtime)return;const e=n.runtime.canvas;if(e.width<1||e.height<1)return;n.frameOutBusy=!0;const t=++n.frameOutSeq,r=e.width,i=e.height;try{const u=await new Promise(h=>{try{e.toBlob(v=>h(v),"image/png")}catch{h(null)}});if(t!==n.frameOutSeq||!u||!n.outPublisher)return;const a=URL.createObjectURL(u);Zn(n),n.lastFrameUrl=a,n.outPublisher.set({frameUrl:a,snapshot:{url:a,width:r,height:i,mime:"image/png"}})}finally{t===n.frameOutSeq&&(n.frameOutBusy=!1)}}function Zn(n){n.lastFrameUrl&&(Ii([n.lastFrameUrl]),n.lastFrameUrl="")}const Qn={hasOutConsumer:Jn,maybePublishOut:ra,publishFrameSnapshot:Kn,revokeFrameUrl:Zn},at=1200,Vt=4,ei=4,ti=64,na=6,ri=16,ni=`
166
- struct Uniforms {
167
- resolution: vec2f,
168
- time: f32,
169
- dt: f32,
170
- mouse: vec2f,
171
- _pad: vec2f,
172
- params: vec4f,
173
- }
174
- `,ia=`
175
- ${ni}
176
- struct Particle {
177
- pos: vec2f,
178
- vel: vec2f,
179
- }
180
- const COUNT: u32 = ${at}u;
181
- @group(0) @binding(0) var<uniform> u: Uniforms;
182
- @group(0) @binding(1) var<storage, read_write> particles: array<Particle, COUNT>;
183
-
184
- @compute @workgroup_size(${ti})
185
- fn cs_main(@builtin(global_invocation_id) id: vec3u) {
186
- let i = id.x;
187
- if (i >= COUNT) { return; }
188
- var p = particles[i];
189
- let speed = 0.35 + u.params.x * 2.2;
190
- let attract = u.params.y;
191
- let damp = 0.98;
192
- var force = vec2f(0.0);
193
- if (attract > 0.001 && length(u.mouse) > 0.5) {
194
- let toM = u.mouse - p.pos;
195
- let d = max(length(toM), 12.0);
196
- force += normalize(toM) * (attract * 6000.0 / (d * d));
197
- }
198
- let c = u.resolution * 0.5;
199
- let toC = p.pos - c;
200
- force += vec2f(-toC.y, toC.x) * 0.0025 * speed;
201
- let stepDt = max(u.dt, 0.008);
202
- p.vel = (p.vel + force * stepDt) * damp;
203
- p.pos += p.vel * stepDt * 60.0 * speed;
204
- if (p.pos.x < 0.0) { p.pos.x += u.resolution.x; }
205
- if (p.pos.x > u.resolution.x) { p.pos.x -= u.resolution.x; }
206
- if (p.pos.y < 0.0) { p.pos.y += u.resolution.y; }
207
- if (p.pos.y > u.resolution.y) { p.pos.y -= u.resolution.y; }
208
- particles[i] = p;
209
- }
210
- `,sa=`
211
- ${ni}
212
- struct Particle {
213
- pos: vec2f,
214
- vel: vec2f,
215
- }
216
- const COUNT: u32 = ${at}u;
217
- struct VsOut {
218
- @builtin(position) position: vec4f,
219
- @location(0) speed: f32,
220
- @location(1) local: vec2f,
221
- }
222
- @group(0) @binding(0) var<uniform> u: Uniforms;
223
- @group(0) @binding(1) var<storage, read> particles: array<Particle, COUNT>;
224
-
225
- @vertex
226
- fn vs_main(@builtin(vertex_index) vi: u32) -> VsOut {
227
- let i = vi / 6u;
228
- let c = vi % 6u;
229
- var local = vec2f(0.0);
230
- if (c == 0u) { local = vec2f(-1.0, -1.0); }
231
- else if (c == 1u) { local = vec2f(1.0, -1.0); }
232
- else if (c == 2u) { local = vec2f(-1.0, 1.0); }
233
- else if (c == 3u) { local = vec2f(-1.0, 1.0); }
234
- else if (c == 4u) { local = vec2f(1.0, -1.0); }
235
- else { local = vec2f(1.0, 1.0); }
236
-
237
- let p = particles[i];
238
- let radius = 2.8;
239
- let pos = p.pos + local * radius;
240
- let ndc = (pos / max(u.resolution, vec2f(1.0))) * 2.0 - vec2f(1.0);
241
- var out: VsOut;
242
- out.position = vec4f(ndc.x, -ndc.y, 0.0, 1.0);
243
- out.speed = length(p.vel);
244
- out.local = local;
245
- return out;
246
- }
247
-
248
- @fragment
249
- fn fs_main(in: VsOut) -> @location(0) vec4f {
250
- let d = length(in.local);
251
- if (d > 1.0) { discard; }
252
- let soft = 1.0 - smoothstep(0.55, 1.0, d);
253
- let t = clamp(in.speed * 0.08, 0.0, 1.0);
254
- let col = mix(vec3f(0.25, 0.65, 1.0), vec3f(1.0, 0.5, 0.2), t);
255
- return vec4f(col * soft, soft);
256
- }
257
- `;class mr{constructor(e,t){this.device=null,this.context=null,this.format="bgra8unorm",this.uniformBuffer=null,this.particleBuffer=null,this.computePipeline=null,this.renderPipeline=null,this.bindGroup=null,this.ctx2d=null,this.lastTime=0,this.disposed=!1,this.seeded=!1,this.canvas=e,this.backend=t,this.cpu=new Float32Array(at*Vt)}static async create(e){const t=navigator.gpu;if(t)try{const u=await Zr(t);if(u){const a=await u.requestDevice(),h=e.getContext("webgpu");if(h){const v=t.getPreferredCanvasFormat();h.configure({device:a,format:v,alphaMode:"premultiplied"});const x=new mr(e,"webgpu");return x.device=a,x.context=h,x.format=v,x.initGpu(),x}a.destroy()}}catch{}const r=e.getContext("2d",{alpha:!0});if(!r)throw new Error("Particles: ni WebGPU ni Canvas2D");const i=new mr(e,"canvas2d");return i.ctx2d=r,i}async setShader(e){}async setChannel(e,t){}getTextureSize(e){return null}resize(e,t){const r=Math.max(1,Math.floor(e)),i=Math.max(1,Math.floor(t));this.canvas.width===r&&this.canvas.height===i||(this.canvas.width=r,this.canvas.height=i,this.context&&this.device&&this.context.configure({device:this.device,format:this.format,alphaMode:"premultiplied"}),this.seed(r,i))}draw(e){if(this.disposed||e.width<2||e.height<2)return;this.seeded||this.seed(e.width,e.height);const t=this.lastTime>0?Math.min(.05,Math.max(.001,e.time-this.lastTime)):.016;this.lastTime=e.time,this.backend==="webgpu"?this.drawGpu(e,t):this.drawCpu(e,t)}dispose(e=!0){if(!this.disposed){this.disposed=!0,this.uniformBuffer?.destroy(),this.particleBuffer?.destroy();try{this.context?.unconfigure()}catch{}this.device?.destroy(),this.device=null}}initGpu(){const e=this.device;this.uniformBuffer=e.createBuffer({size:ri*ei,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.particleBuffer=e.createBuffer({size:at*Vt*ei,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});const t=e.createShaderModule({code:ia}),r=e.createShaderModule({code:sa});this.computePipeline=e.createComputePipeline({layout:"auto",compute:{module:t,entryPoint:"cs_main"}}),this.renderPipeline=e.createRenderPipeline({layout:"auto",vertex:{module:r,entryPoint:"vs_main"},fragment:{module:r,entryPoint:"fs_main",targets:[{format:this.format,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list"}})}ensureBindGroups(){const e=this.device;!this.computePipeline||!this.renderPipeline||this.bindGroup||(this.bindGroup=e.createBindGroup({layout:this.computePipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniformBuffer}},{binding:1,resource:{buffer:this.particleBuffer}}]}))}drawGpu(e,t){const r=this.device,i=this.context;if(!this.computePipeline||!this.renderPipeline)return;const u={...e,mouse:[e.mouse[0],e.height-e.mouse[1],e.mouse[2],e.height-e.mouse[3]]};this.writeUniforms(u,t),this.ensureBindGroups();const a=r.createBindGroup({layout:this.renderPipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniformBuffer}},{binding:1,resource:{buffer:this.particleBuffer}}]}),h=r.createCommandEncoder(),v=h.beginComputePass();v.setPipeline(this.computePipeline),v.setBindGroup(0,this.bindGroup),v.dispatchWorkgroups(Math.ceil(at/ti)),v.end();const x=h.beginRenderPass({colorAttachments:[{view:i.getCurrentTexture().createView(),clearValue:{r:.04,g:.05,b:.08,a:1},loadOp:"clear",storeOp:"store"}]});x.setPipeline(this.renderPipeline),x.setBindGroup(0,a),x.draw(at*na),x.end(),r.queue.submit([h.finish()])}drawCpu(e,t){const r=this.ctx2d,i=e.width,u=e.height,a=.35+e.params[0]*2.2,h=e.params[1],v=e.mouse[0],x=u-e.mouse[1];for(let D=0;D<at;D++){const P=D*Vt;let E=this.cpu[P],C=this.cpu[P+1],O=this.cpu[P+2],G=this.cpu[P+3],ee=0,J=0;if(h>.001&&(v>.5||x>.5)){const U=v-E,w=x-C,k=Math.max(Math.hypot(U,w),8),W=h*4e3/(k*k);ee+=U/k*W,J+=w/k*W}const _=i*.5,g=u*.5;ee+=-(C-g)*8e-4*a,J+=(E-_)*8e-4*a,O=(O+ee*t)*.985,G=(G+J*t)*.985,E+=O*t*60*a,C+=G*t*60*a,E<0&&(E+=i),E>i&&(E-=i),C<0&&(C+=u),C>u&&(C-=u),this.cpu[P]=E,this.cpu[P+1]=C,this.cpu[P+2]=O,this.cpu[P+3]=G}r.fillStyle="rgb(10, 12, 20)",r.fillRect(0,0,i,u);for(let D=0;D<at;D++){const P=D*Vt,E=Math.hypot(this.cpu[P+2],this.cpu[P+3]),C=Math.min(1,E*.08),O=Math.round(51+C*204),G=Math.round(140-C*25),ee=Math.round(255-C*204);r.fillStyle=`rgba(${O},${G},${ee},0.85)`,r.fillRect(this.cpu[P],this.cpu[P+1],2,2)}}writeUniforms(e,t){const r=new Float32Array(ri);r[0]=e.width,r[1]=e.height,r[2]=e.time,r[3]=t,r[4]=e.mouse[0],r[5]=e.mouse[1],r[6]=0,r[7]=0,r[8]=e.params[0],r[9]=e.params[1],r[10]=e.params[2],r[11]=e.params[3],this.device.queue.writeBuffer(this.uniformBuffer,0,r.buffer,r.byteOffset,r.byteLength)}seed(e,t){for(let r=0;r<at;r++){const i=r*Vt;this.cpu[i]=Math.random()*e,this.cpu[i+1]=Math.random()*t,this.cpu[i+2]=(Math.random()-.5)*2,this.cpu[i+3]=(Math.random()-.5)*2}this.device&&this.particleBuffer&&this.device.queue.writeBuffer(this.particleBuffer,0,this.cpu.buffer,this.cpu.byteOffset,this.cpu.byteLength),this.seeded=!0}}function Qr(n,e){if(!n.mouse||!n.runtime)return;const t=n.getBoundingClientRect();if(t.width<1||t.height<1)return;const r=n.runtime.canvas.width/Math.max(t.width,1),i=(e.clientX-t.left)*r,u=(t.height-(e.clientY-t.top))*r;if(n.mouseVec[0]=i,n.mouseVec[1]=u,!n.raf&&n.ready&&n.runtime){const a=n.startTime?(performance.now()-n.startTime)/1e3:0;n.runtime.draw({width:n.runtime.canvas.width,height:n.runtime.canvas.height,time:a,frame:n.frame,mouse:n.mouseVec,params:[n.param0,n.param1,n.param2,n.param3]})}}function aa(n,e){Qr(n,e)}function oa(n,e){Qr(n,e),n.mouseVec[2]=n.mouseVec[0],n.mouseVec[3]=n.mouseVec[1]}function ua(n){n.mouseVec[2]=0,n.mouseVec[3]=0}function ca(n){n.hovering=!0}function la(n){n.hovering=!1,n.mouseVec[2]=0,n.mouseVec[3]=0}const Xt={pointerToMouse:Qr,onMove:aa,onDown:oa,onUp:ua,onEnter:ca,onLeave:la};var fa=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,Te=(n,e,t,r)=>{for(var i=r>1?void 0:r?ha(e,t):e,u=n.length-1,a;u>=0;u--)(a=n[u])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&fa(e,t,i),i};const da="sonic-webgpu";return ue.SonicWebGpu=class extends It{constructor(){super(...arguments),this.shader="",this.kernel="",this.backendPrefer="auto",this.activeBackend="",this.channel0="",this.channel1="",this.channel2="",this.channel3="",this.play=!0,this.mouse=!0,this.releaseOffscreen=!1,this.dprMax=2,this.param0=0,this.param1=0,this.param2=0,this.param3=0,this.dataProvider="",this.outDataProvider="",this.outInterval=80,this.frameOut=!1,this.aspectRatio="",this.errorMessage="",this.fallbackNotice="",this.canvasEl=null,this.runtime=null,this.raf=0,this.startTime=0,this.frame=0,this.frameSeq=0,this.mouseVec=[0,0,0,0],this.remoteTarget=null,this.hovering=!1,this.outEventListeners=0,this.releasing=!1,this.inView=!0,this.resizeObserver=null,this.intersectionObserver=null,this.rebuildToken=0,this.frameConsumers=new Di,this.ready=!1,this.boot=null,this.formPublisher=null,this.outPublisher=null,this.lastOutAt=0,this.lastFrameUrl="",this.frameOutBusy=!1,this.frameOutSeq=0,this.onFormMutation=()=>{const e=this.formPublisher?.get()??{};yt.applyFormParams(this,e)},this.onPointerMove=e=>Xt.onMove(this,e),this.onPointerDown=e=>Xt.onDown(this,e),this.onPointerUp=()=>Xt.onUp(this),this.onPointerEnter=()=>Xt.onEnter(this),this.onPointerLeave=()=>Xt.onLeave(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointerleave",this.onPointerLeave),this.addEventListener("pointerenter",this.onPointerEnter),this.bindFormProvider(),this.bindOutPublisher()}addEventListener(e,t,r){e==="out"&&t&&this.outEventListeners++,super.addEventListener(e,t,r)}removeEventListener(e,t,r){e==="out"&&t&&(this.outEventListeners=Math.max(0,this.outEventListeners-1)),super.removeEventListener(e,t,r)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointerleave",this.onPointerLeave),this.removeEventListener("pointerenter",this.onPointerEnter),this.unbindFormProvider(),this.revokeFrameUrl(),this.frameConsumers.clear(),this.frameOutSeq++,this.frameOutBusy=!1,this.resizeObserver?.disconnect(),this.intersectionObserver?.disconnect(),this.rebuildToken++,this.releasing=!0,this.releaseRuntime(),this.outPublisher=null,this.releasing=!1}firstUpdated(){this.ensureCanvas(),this.resizeObserver=new ResizeObserver(()=>{this.syncSize(),this.ready&&this.runtime&&this.syncPlayback()}),this.resizeObserver.observe(this),this.intersectionObserver=new IntersectionObserver(e=>{this.inView=e.some(t=>t.isIntersecting),this.syncVisibility()},{threshold:0,rootMargin:"80px 0px"}),this.intersectionObserver.observe(this),this.bindFormProvider(),this.bindOutPublisher(),requestAnimationFrame(()=>{this.ensureRuntime()})}updated(e){if((e.has("backendPrefer")||e.has("kernel"))&&(this.runtime||this.boot)){this.releaseRuntime(),this.activeBackend="",this.ensureRuntime();return}if(!this.runtime)return;["shader",...$n].some(r=>e.has(r))&&(e.has("shader")&&this.runtime.backend==="webgl2"&&(this.fallbackNotice=this.shader.trim()?"WebGL2 (fallback) — WGSL ignoré, canaux/params OK":"WebGL2 (fallback)"),this.rebuild()),e.has("play")&&this.syncPlayback(),(e.has("dataProvider")||e.has("outDataProvider"))&&(this.bindFormProvider(),this.bindOutPublisher()),e.has("aspectRatio")&&this.applyAspectRatio()}applyAspectRatio(e){const t=this.aspectRatio.trim();if(t){this.style.setProperty("--sonic-webgpu-ar",t.includes("/")?t:t.replace(":"," / "));return}const r=e||this.channel0,i=r?this.runtime?.getTextureSize(r):null;if(i){this.style.setProperty("--sonic-webgpu-ar",`${i.width} / ${i.height}`);return}this.style.removeProperty("--sonic-webgpu-ar")}unbindFormProvider(){yt.unbindFormProvider(this)}bindFormProvider(){yt.bindFormProvider(this)}bindOutPublisher(){yt.bindOutPublisher(this)}applyRemoteMouse(){yt.applyRemoteMouse(this)}ensureRuntime(){return this.runtime||this.releasing?this.boot??Promise.resolve():(this.boot||(this.boot=this.bootRuntime().finally(()=>{this.boot=null})),this.boot)}async bootRuntime(){this.ensureCanvas();const e=zn(this.backendPrefer),t=Js(this.kernel),r=[];try{let i=null;if(t==="particles")try{i=await mr.create(this.ensureCanvas()),r.push(`particles:${i.backend}`)}catch(v){const x=v instanceof Error?v.message:String(v);throw new Error(`particles:${x}`)}else{const v=()=>{try{return i=zt.create(this.ensureCanvas()),r.push("webgl2:ok"),!0}catch(D){const P=D instanceof Error?D.message:String(D);return r.push(`webgl2:${P}`),console.warn(`${jt} WebGL2 failed:`,P),this.replaceCanvas(),!1}},x=async()=>{if(typeof navigator.gpu>"u")return r.push("webgpu:no-navigator.gpu"),!1;const D=await xt.probe();if(D)return r.push(`webgpu:probe:${D}`),!1;try{return i=await xt.create(this.ensureCanvas()),r.push("webgpu:ok"),!0}catch(P){const E=P instanceof Error?P.message:String(P);return r.push(`webgpu:create:${E}`),console.warn(`${jt} WebGPU failed:`,E),this.replaceCanvas(),!1}};if(e==="webgpu"){if(!await x())throw new Error(r.join(" → ")||"WebGPU indisponible")}else if(e==="webgl2"){if(!v())throw new Error(r.join(" → ")||"WebGL2 indisponible")}else if(!(!!this.shader.trim()?await x()||v():v()||await x()))try{i=Dr.create(this.ensureCanvas()),r.push("canvas2d:ok")}catch(E){const C=E instanceof Error?E.message:String(E);throw new Error([...r,`canvas2d:${C}`].join(" → "))}}if(!i)throw new Error(r.join(" → ")||"Aucun backend GPU");if(this.releasing){i.dispose(!0);return}this.runtime=i,this.runtime.setElementResolver?.(v=>this.lookupElement(v));const a=i.backend;this.activeBackend=a;let h="";t==="particles"?h=a==="webgpu"?"Compute particles (WebGPU)":"Particles (Canvas2D fallback)":a==="webgl2"&&this.shader.trim()?h="WebGL2 — WGSL ignoré (canaux/params OK)":a==="canvas2d"&&(h=`Canvas2D — ${r.filter(v=>!v.endsWith(":ok")).join(" · ")||"GPU indisponible"}`),this.fallbackNotice=h,this.errorMessage="",console.info(`${jt} backend:`,a,"kernel:",t,r),this.dispatchEvent(new CustomEvent("backend",{detail:{backend:a,prefer:e,kernel:t,log:r},bubbles:!0,composed:!0})),await this.rebuild()}catch(i){this.errorMessage=i instanceof Error?i.message:String(i),this.activeBackend="",this.fallbackNotice="",console.error(`${jt} boot failed:`,this.errorMessage,r),this.dispatchEvent(new CustomEvent("error",{detail:{message:this.errorMessage,log:r},bubbles:!0,composed:!0}))}}ensureCanvas(){if(this.canvasEl?.isConnected)return this.canvasEl;const e=this.renderRoot.querySelector(".stage")??this.renderRoot;let t=e.querySelector?.("canvas");return t||(t=document.createElement("canvas"),t.setAttribute("part","canvas"),e.appendChild(t)),t.style.touchAction="none",t.style.cursor=this.mouse?"crosshair":"default",this.canvasEl=t,t}replaceCanvas(){const e=this.renderRoot.querySelector(".stage")??this.renderRoot;this.canvasEl?.parentNode&&this.canvasEl.parentNode.removeChild(this.canvasEl);const t=document.createElement("canvas");return t.setAttribute("part","canvas"),e.appendChild(t),this.canvasEl=t,t}lookupElement(e){if(!e.startsWith("#"))return null;const t=Fi(e);if(t)return t;const r=e.slice(1);if(!r||r.startsWith("__sonic_frame_"))return null;const i=this.getRootNode();if(i instanceof Document||i instanceof ShadowRoot){const u=i.getElementById(r);if(u)return u}return typeof document<"u"?document.getElementById(r):null}releaseRuntime(){this.stopLoop(),this.ready=!1,this.runtime?.dispose(!0),this.runtime=null,this.canvasEl?.parentNode&&this.canvasEl.parentNode.removeChild(this.canvasEl),this.canvasEl=null}syncFrameConsumers(){const e=[this.channel0,this.channel1,this.channel2,this.channel3];this.frameConsumers.sync(e.filter(t=>t.startsWith("#")).map(t=>this.lookupElement(t)))}async rebuild(){if(!this.runtime)return;const e=++this.rebuildToken;this.ready=!1;try{if(await this.runtime.setShader(this.shader),e!==this.rebuildToken||(this.runtime instanceof zt?await this.runtime.setChannels([this.channel0,this.channel1,this.channel2,this.channel3]):await Promise.all([this.runtime.setChannel(0,this.channel0),this.runtime.setChannel(1,this.channel1),this.runtime.setChannel(2,this.channel2),this.runtime.setChannel(3,this.channel3)]),e!==this.rebuildToken))return;this.syncFrameConsumers(),this.errorMessage="",this.ready=!0,this.syncSize(),this.applyAspectRatio(this.channel0),this.startTime=performance.now(),this.frame=0,this.syncPlayback()}catch(t){const r=t instanceof Ht?t.infoLog?`${t.message}
258
- ${t.infoLog}`:t.message:t instanceof Error?t.message:String(t);this.errorMessage=r,this.dispatchEvent(new CustomEvent("error",{detail:{message:r,infoLog:t instanceof Ht?t.infoLog:void 0},bubbles:!0,composed:!0}))}}syncSize(){if(!this.runtime)return;const e=this.getBoundingClientRect(),t=Math.min(typeof devicePixelRatio=="number"?devicePixelRatio:1,Number.isFinite(this.dprMax)&&this.dprMax>0?this.dprMax:2);this.runtime.resize(e.width*t,e.height*t)}syncVisibility(){if(!this.inView&&this.releaseOffscreen){this.stopLoop();return}if(!this.runtime){this.ensureRuntime();return}this.syncSize(),this.syncPlayback()}shouldPlay(){return!!this.play&&!!this.runtime&&this.ready&&!this.errorMessage&&!Ls()&&(this.inView||!this.releaseOffscreen)}syncPlayback(){!this.ready||!this.runtime||(this.shouldPlay()?this.startLoop():this.stopLoop())}startLoop(){if(this.raf)return;const e=t=>{if(this.raf=0,this.runtime&&this.ready){this.syncSize();const r=this.runtime.canvas.width,i=this.runtime.canvas.height;if(r>=2&&i>=2)try{this.startTime||(this.startTime=t);const u=(t-this.startTime)/1e3;this.applyRemoteMouse(),this.runtime instanceof xt&&this.runtime.updateLiveChannels(a=>this.lookupElement(a)),this.runtime.draw({width:r,height:i,time:u,frame:this.frame,mouse:this.mouseVec,params:[this.param0,this.param1,this.param2,this.param3]}),this.frame++,this.frameSeq++,this.maybePublishOut(t,u)}catch(u){console.warn(`${jt} frame skip:`,u)}}this.shouldPlay()&&(this.raf=requestAnimationFrame(e))};this.raf=requestAnimationFrame(e)}stopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=0)}maybePublishOut(e,t){Qn.maybePublishOut(this,e,t)}getFrameCanvas(){return!this.ready||this.errorMessage?null:this.canvasEl}revokeFrameUrl(){Qn.revokeFrameUrl(this)}render(){return xr`
259
- <div class="stage" part="stage"></div>
260
- ${this.errorMessage?xr`<div class="err" part="error">${this.errorMessage}</div>`:this.fallbackNotice?xr`<div class="notice" part="notice">${this.fallbackNotice}</div>`:null}
261
- `}},ue.SonicWebGpu.styles=ui`
262
- :host {
263
- display: block;
264
- position: relative;
265
- width: 100%;
266
- max-width: 100%;
267
- height: auto;
268
- aspect-ratio: var(--sonic-webgpu-ar, 16 / 9);
269
- overflow: hidden;
270
- background: #0a0a0a;
271
- color: #f87171;
272
- font: 12px/1.4 ui-monospace, monospace;
273
- }
274
- canvas {
275
- position: absolute;
276
- inset: 0;
277
- width: 100%;
278
- height: 100%;
279
- display: block;
280
- touch-action: none;
281
- }
282
- .stage {
283
- position: absolute;
284
- inset: 0;
285
- }
286
- .err {
287
- position: absolute;
288
- inset: 0;
289
- z-index: 1;
290
- padding: 0.75rem;
291
- background: rgba(0, 0, 0, 0.85);
292
- white-space: pre-wrap;
293
- overflow: auto;
294
- }
295
- .notice {
296
- position: absolute;
297
- left: 0.5rem;
298
- bottom: 0.5rem;
299
- z-index: 1;
300
- padding: 0.25rem 0.5rem;
301
- border-radius: 0.25rem;
302
- background: rgba(0, 0, 0, 0.65);
303
- color: #fbbf24;
304
- font-size: 11px;
305
- pointer-events: none;
306
- }
307
- `,Te([Re()],ue.SonicWebGpu.prototype,"shader",2),Te([Re({type:String})],ue.SonicWebGpu.prototype,"kernel",2),Te([Re({type:String,attribute:"backend"})],ue.SonicWebGpu.prototype,"backendPrefer",2),Te([Re({type:String,reflect:!0,attribute:"active-backend"})],ue.SonicWebGpu.prototype,"activeBackend",2),Te([Re()],ue.SonicWebGpu.prototype,"channel0",2),Te([Re()],ue.SonicWebGpu.prototype,"channel1",2),Te([Re()],ue.SonicWebGpu.prototype,"channel2",2),Te([Re()],ue.SonicWebGpu.prototype,"channel3",2),Te([Re({type:Boolean,reflect:!0})],ue.SonicWebGpu.prototype,"play",2),Te([Re({type:Boolean})],ue.SonicWebGpu.prototype,"mouse",2),Te([Re({type:Boolean,attribute:"release-offscreen"})],ue.SonicWebGpu.prototype,"releaseOffscreen",2),Te([Re({type:Number,attribute:"dpr-max"})],ue.SonicWebGpu.prototype,"dprMax",2),Te([Re({type:Number,attribute:"param0"})],ue.SonicWebGpu.prototype,"param0",2),Te([Re({type:Number,attribute:"param1"})],ue.SonicWebGpu.prototype,"param1",2),Te([Re({type:Number,attribute:"param2"})],ue.SonicWebGpu.prototype,"param2",2),Te([Re({type:Number,attribute:"param3"})],ue.SonicWebGpu.prototype,"param3",2),Te([Re({type:String})],ue.SonicWebGpu.prototype,"dataProvider",2),Te([Re({type:String,attribute:"out-data-provider"})],ue.SonicWebGpu.prototype,"outDataProvider",2),Te([Re({type:Number,attribute:"out-interval"})],ue.SonicWebGpu.prototype,"outInterval",2),Te([Re({type:Boolean,attribute:"frame-out"})],ue.SonicWebGpu.prototype,"frameOut",2),Te([Re({type:String,attribute:"aspect-ratio"})],ue.SonicWebGpu.prototype,"aspectRatio",2),Te([gn()],ue.SonicWebGpu.prototype,"errorMessage",2),Te([gn()],ue.SonicWebGpu.prototype,"fallbackNotice",2),ue.SonicWebGpu=Te([Ri(da)],ue.SonicWebGpu),ue.DEFAULT_MAIN_IMAGE=Hn,ue.WebGl2FallbackRuntime=zt,ue.WebGpuCompileError=Ht,ue.WebGpuRuntime=xt,ue.buildWgslSource=Vn,ue.parseBackendPrefer=zn,Object.defineProperty(ue,Symbol.toStringTag,{value:"Module"}),ue})({});