@stencil/core 4.43.1 → 5.0.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/bin/stencil.mjs +2 -0
  2. package/dist/chunk-ClPoSABd.mjs +21 -0
  3. package/dist/client-DR9zhmKG.mjs +4449 -0
  4. package/dist/compiler/index.d.mts +187 -0
  5. package/dist/compiler/index.mjs +9 -0
  6. package/dist/compiler/utils/index.d.mts +3 -0
  7. package/dist/compiler/utils/index.mjs +5 -0
  8. package/dist/declarations/stencil-public-compiler.d.ts +4401 -0
  9. package/dist/declarations/stencil-public-compiler.js +53 -0
  10. package/dist/declarations/stencil-public-runtime.d.ts +1857 -0
  11. package/dist/index-Bxo2jCf6.d.mts +77 -0
  12. package/dist/index-szczUd2l.d.mts +6851 -0
  13. package/{internal/stencil-core/index.d.ts → dist/index.d.mts} +7 -3
  14. package/dist/index.mjs +4 -0
  15. package/dist/mock-doc.d.mts +1 -0
  16. package/dist/mock-doc.mjs +3 -0
  17. package/dist/node-sys-BGURUNOZ.mjs +1954 -0
  18. package/{internal → dist/runtime}/app-data/index.d.ts +11 -7
  19. package/dist/runtime/app-data/index.js +100 -0
  20. package/dist/runtime/app-globals/index.d.ts +5 -0
  21. package/dist/runtime/app-globals/index.js +6 -0
  22. package/dist/runtime/client/index.d.ts +2286 -0
  23. package/dist/runtime/client/index.js +4839 -0
  24. package/dist/runtime/index.d.ts +221 -0
  25. package/dist/runtime/index.js +4819 -0
  26. package/dist/runtime/server/index.d.mts +1277 -0
  27. package/dist/runtime/server/index.mjs +5376 -0
  28. package/dist/runtime/server/runner.d.mts +298 -0
  29. package/dist/runtime/server/runner.mjs +1976 -0
  30. package/dist/serialize-BJvhE9aQ.mjs +775 -0
  31. package/dist/stencil-private-Cgcr414u.d.ts +1893 -0
  32. package/dist/sys/node/index.d.mts +33 -0
  33. package/dist/sys/node/index.mjs +7 -0
  34. package/dist/sys/node/worker.d.mts +1 -0
  35. package/dist/sys/node/worker.mjs +60 -0
  36. package/dist/testing/index.d.mts +207 -0
  37. package/dist/testing/index.mjs +1188 -0
  38. package/dist/transpile-CJQcQEVa.mjs +21854 -0
  39. package/dist/validation-BdcPruW_.mjs +1451 -0
  40. package/package.json +88 -232
  41. package/bin/stencil +0 -57
  42. package/cli/config-flags.d.ts +0 -132
  43. package/cli/index.cjs +0 -5816
  44. package/cli/index.d.ts +0 -19
  45. package/cli/index.js +0 -5809
  46. package/cli/package.json +0 -14
  47. package/compiler/lib.d.ts +0 -22
  48. package/compiler/lib.decorators.d.ts +0 -384
  49. package/compiler/lib.decorators.legacy.d.ts +0 -22
  50. package/compiler/lib.dom.asynciterable.d.ts +0 -41
  51. package/compiler/lib.dom.d.ts +0 -29610
  52. package/compiler/lib.dom.iterable.d.ts +0 -493
  53. package/compiler/lib.es2015.collection.d.ts +0 -147
  54. package/compiler/lib.es2015.core.d.ts +0 -597
  55. package/compiler/lib.es2015.d.ts +0 -28
  56. package/compiler/lib.es2015.generator.d.ts +0 -77
  57. package/compiler/lib.es2015.iterable.d.ts +0 -605
  58. package/compiler/lib.es2015.promise.d.ts +0 -81
  59. package/compiler/lib.es2015.proxy.d.ts +0 -128
  60. package/compiler/lib.es2015.reflect.d.ts +0 -144
  61. package/compiler/lib.es2015.symbol.d.ts +0 -46
  62. package/compiler/lib.es2015.symbol.wellknown.d.ts +0 -326
  63. package/compiler/lib.es2016.array.include.d.ts +0 -116
  64. package/compiler/lib.es2016.d.ts +0 -21
  65. package/compiler/lib.es2016.full.d.ts +0 -23
  66. package/compiler/lib.es2016.intl.d.ts +0 -31
  67. package/compiler/lib.es2017.arraybuffer.d.ts +0 -21
  68. package/compiler/lib.es2017.d.ts +0 -26
  69. package/compiler/lib.es2017.date.d.ts +0 -31
  70. package/compiler/lib.es2017.full.d.ts +0 -23
  71. package/compiler/lib.es2017.intl.d.ts +0 -44
  72. package/compiler/lib.es2017.object.d.ts +0 -49
  73. package/compiler/lib.es2017.sharedmemory.d.ts +0 -135
  74. package/compiler/lib.es2017.string.d.ts +0 -45
  75. package/compiler/lib.es2017.typedarrays.d.ts +0 -53
  76. package/compiler/lib.es2018.asyncgenerator.d.ts +0 -77
  77. package/compiler/lib.es2018.asynciterable.d.ts +0 -53
  78. package/compiler/lib.es2018.d.ts +0 -24
  79. package/compiler/lib.es2018.full.d.ts +0 -24
  80. package/compiler/lib.es2018.intl.d.ts +0 -83
  81. package/compiler/lib.es2018.promise.d.ts +0 -30
  82. package/compiler/lib.es2018.regexp.d.ts +0 -37
  83. package/compiler/lib.es2019.array.d.ts +0 -79
  84. package/compiler/lib.es2019.d.ts +0 -24
  85. package/compiler/lib.es2019.full.d.ts +0 -24
  86. package/compiler/lib.es2019.intl.d.ts +0 -23
  87. package/compiler/lib.es2019.object.d.ts +0 -33
  88. package/compiler/lib.es2019.string.d.ts +0 -37
  89. package/compiler/lib.es2019.symbol.d.ts +0 -24
  90. package/compiler/lib.es2020.bigint.d.ts +0 -765
  91. package/compiler/lib.es2020.d.ts +0 -27
  92. package/compiler/lib.es2020.date.d.ts +0 -42
  93. package/compiler/lib.es2020.full.d.ts +0 -24
  94. package/compiler/lib.es2020.intl.d.ts +0 -474
  95. package/compiler/lib.es2020.number.d.ts +0 -28
  96. package/compiler/lib.es2020.promise.d.ts +0 -47
  97. package/compiler/lib.es2020.sharedmemory.d.ts +0 -99
  98. package/compiler/lib.es2020.string.d.ts +0 -44
  99. package/compiler/lib.es2020.symbol.wellknown.d.ts +0 -41
  100. package/compiler/lib.es2021.d.ts +0 -23
  101. package/compiler/lib.es2021.full.d.ts +0 -24
  102. package/compiler/lib.es2021.intl.d.ts +0 -166
  103. package/compiler/lib.es2021.promise.d.ts +0 -48
  104. package/compiler/lib.es2021.string.d.ts +0 -33
  105. package/compiler/lib.es2021.weakref.d.ts +0 -78
  106. package/compiler/lib.es2022.array.d.ts +0 -121
  107. package/compiler/lib.es2022.d.ts +0 -25
  108. package/compiler/lib.es2022.error.d.ts +0 -75
  109. package/compiler/lib.es2022.full.d.ts +0 -24
  110. package/compiler/lib.es2022.intl.d.ts +0 -121
  111. package/compiler/lib.es2022.object.d.ts +0 -26
  112. package/compiler/lib.es2022.regexp.d.ts +0 -39
  113. package/compiler/lib.es2022.string.d.ts +0 -25
  114. package/compiler/lib.es2023.array.d.ts +0 -924
  115. package/compiler/lib.es2023.collection.d.ts +0 -21
  116. package/compiler/lib.es2023.d.ts +0 -22
  117. package/compiler/lib.es2023.full.d.ts +0 -24
  118. package/compiler/lib.es2023.intl.d.ts +0 -56
  119. package/compiler/lib.es2024.arraybuffer.d.ts +0 -65
  120. package/compiler/lib.es2024.collection.d.ts +0 -29
  121. package/compiler/lib.es2024.d.ts +0 -26
  122. package/compiler/lib.es2024.full.d.ts +0 -24
  123. package/compiler/lib.es2024.object.d.ts +0 -29
  124. package/compiler/lib.es2024.promise.d.ts +0 -35
  125. package/compiler/lib.es2024.regexp.d.ts +0 -25
  126. package/compiler/lib.es2024.sharedmemory.d.ts +0 -68
  127. package/compiler/lib.es2024.string.d.ts +0 -29
  128. package/compiler/lib.es5.d.ts +0 -4594
  129. package/compiler/lib.es6.d.ts +0 -23
  130. package/compiler/lib.esnext.array.d.ts +0 -35
  131. package/compiler/lib.esnext.collection.d.ts +0 -96
  132. package/compiler/lib.esnext.d.ts +0 -27
  133. package/compiler/lib.esnext.decorators.d.ts +0 -28
  134. package/compiler/lib.esnext.disposable.d.ts +0 -193
  135. package/compiler/lib.esnext.float16.d.ts +0 -443
  136. package/compiler/lib.esnext.full.d.ts +0 -24
  137. package/compiler/lib.esnext.intl.d.ts +0 -21
  138. package/compiler/lib.esnext.iterator.d.ts +0 -148
  139. package/compiler/lib.esnext.promise.d.ts +0 -34
  140. package/compiler/lib.scripthost.d.ts +0 -322
  141. package/compiler/lib.webworker.asynciterable.d.ts +0 -41
  142. package/compiler/lib.webworker.d.ts +0 -9894
  143. package/compiler/lib.webworker.importscripts.d.ts +0 -23
  144. package/compiler/lib.webworker.iterable.d.ts +0 -287
  145. package/compiler/package.json +0 -8
  146. package/compiler/stencil.d.ts +0 -73
  147. package/compiler/stencil.js +0 -287696
  148. package/compiler/sys/in-memory-fs.d.ts +0 -227
  149. package/compiler/transpile.d.ts +0 -32
  150. package/dev-server/client/app-error.d.ts +0 -20
  151. package/dev-server/client/events.d.ts +0 -6
  152. package/dev-server/client/hmr-components.d.ts +0 -12
  153. package/dev-server/client/hmr-external-styles.d.ts +0 -1
  154. package/dev-server/client/hmr-images.d.ts +0 -1
  155. package/dev-server/client/hmr-inline-styles.d.ts +0 -1
  156. package/dev-server/client/hmr-util.d.ts +0 -39
  157. package/dev-server/client/hmr-window.d.ts +0 -10
  158. package/dev-server/client/index.d.ts +0 -6
  159. package/dev-server/client/index.js +0 -793
  160. package/dev-server/client/logger.d.ts +0 -6
  161. package/dev-server/client/package.json +0 -8
  162. package/dev-server/client/progress.d.ts +0 -3
  163. package/dev-server/client/status.d.ts +0 -4
  164. package/dev-server/client/test/hmr-util.spec.d.ts +0 -1
  165. package/dev-server/client/test/status.spec.d.ts +0 -1
  166. package/dev-server/connector.html +0 -6
  167. package/dev-server/index.d.ts +0 -3
  168. package/dev-server/index.js +0 -247
  169. package/dev-server/package.json +0 -8
  170. package/dev-server/server-process.js +0 -12095
  171. package/dev-server/server-worker-thread.js +0 -39
  172. package/dev-server/static/favicon.ico +0 -0
  173. package/dev-server/templates/directory-index.html +0 -176
  174. package/dev-server/templates/initial-load.html +0 -168
  175. package/dev-server/visualstudio.vbs +0 -82
  176. package/dev-server/xdg-open +0 -1066
  177. package/internal/app-data/index.cjs +0 -119
  178. package/internal/app-data/index.js +0 -92
  179. package/internal/app-data/package.json +0 -15
  180. package/internal/app-globals/index.d.ts +0 -2
  181. package/internal/app-globals/index.js +0 -14
  182. package/internal/app-globals/package.json +0 -14
  183. package/internal/child_process.d.ts +0 -7
  184. package/internal/client/index.js +0 -4727
  185. package/internal/client/package.json +0 -10
  186. package/internal/client/patch-browser.js +0 -45
  187. package/internal/client/polyfills/core-js.js +0 -11
  188. package/internal/client/polyfills/dom.js +0 -79
  189. package/internal/client/polyfills/es5-html-element.js +0 -1
  190. package/internal/client/polyfills/index.js +0 -34
  191. package/internal/client/polyfills/system.js +0 -6
  192. package/internal/client/shadow-css.js +0 -414
  193. package/internal/hydrate/index.js +0 -6664
  194. package/internal/hydrate/package.json +0 -7
  195. package/internal/hydrate/runner.d.ts +0 -287
  196. package/internal/hydrate/runner.js +0 -17947
  197. package/internal/index.d.ts +0 -4
  198. package/internal/index.js +0 -2
  199. package/internal/package.json +0 -9
  200. package/internal/stencil-core/index.cjs +0 -1
  201. package/internal/stencil-core/index.js +0 -18
  202. package/internal/stencil-core/jsx-dev-runtime.cjs +0 -7
  203. package/internal/stencil-core/jsx-dev-runtime.d.ts +0 -41
  204. package/internal/stencil-core/jsx-dev-runtime.js +0 -2
  205. package/internal/stencil-core/jsx-runtime.cjs +0 -8
  206. package/internal/stencil-core/jsx-runtime.d.ts +0 -40
  207. package/internal/stencil-core/jsx-runtime.js +0 -2
  208. package/internal/stencil-private.d.ts +0 -2538
  209. package/internal/stencil-public-compiler.d.ts +0 -2867
  210. package/internal/stencil-public-runtime.d.ts +0 -1860
  211. package/internal/testing/index.js +0 -6517
  212. package/internal/testing/jsx-dev-runtime.d.ts +0 -2
  213. package/internal/testing/jsx-dev-runtime.js +0 -8
  214. package/internal/testing/jsx-runtime.d.ts +0 -2
  215. package/internal/testing/jsx-runtime.js +0 -9
  216. package/internal/testing/package.json +0 -7
  217. package/internal/utils/index.d.ts +0 -1
  218. package/internal/utils/result.d.ts +0 -112
  219. package/mock-doc/index.cjs +0 -10162
  220. package/mock-doc/index.d.ts +0 -1171
  221. package/mock-doc/index.js +0 -10141
  222. package/mock-doc/package.json +0 -15
  223. package/readme.md +0 -94
  224. package/screenshot/compare/assets/favicon.ico +0 -0
  225. package/screenshot/compare/assets/logo.png +0 -0
  226. package/screenshot/compare/build/app.css +0 -1
  227. package/screenshot/compare/build/app.esm.js +0 -1
  228. package/screenshot/compare/build/app.js +0 -33
  229. package/screenshot/compare/build/p-081b0641.js +0 -1
  230. package/screenshot/compare/build/p-227a1e18.entry.js +0 -1
  231. package/screenshot/compare/build/p-2c298727.entry.js +0 -1
  232. package/screenshot/compare/build/p-5479268c.entry.js +0 -1
  233. package/screenshot/compare/build/p-573ec8a4.entry.js +0 -1
  234. package/screenshot/compare/build/p-6ba08604.entry.js +0 -1
  235. package/screenshot/compare/build/p-6bc63295.entry.js +0 -1
  236. package/screenshot/compare/build/p-7a3759fd.entry.js +0 -1
  237. package/screenshot/compare/build/p-7b4e3ba7.js +0 -1
  238. package/screenshot/compare/build/p-988eb362.css +0 -1
  239. package/screenshot/compare/build/p-9b6a9315.js +0 -1
  240. package/screenshot/compare/build/p-b4cc611c.entry.js +0 -1
  241. package/screenshot/compare/build/p-d1bf53f5.entry.js +0 -1
  242. package/screenshot/compare/build/p-e2efe0df.js +0 -1
  243. package/screenshot/compare/build/p-e8ca6d97.entry.js +0 -1
  244. package/screenshot/compare/build/p-ec2f13e0.entry.js +0 -1
  245. package/screenshot/compare/build/p-f0b99977.entry.js +0 -1
  246. package/screenshot/compare/build/p-f4745c2f.entry.js +0 -1
  247. package/screenshot/compare/build/p-fbbae598.js +0 -1
  248. package/screenshot/compare/host.config.json +0 -15
  249. package/screenshot/compare/index.html +0 -1
  250. package/screenshot/compare/manifest.json +0 -13
  251. package/screenshot/connector-base.d.ts +0 -42
  252. package/screenshot/connector-local.d.ts +0 -7
  253. package/screenshot/connector.js +0 -2
  254. package/screenshot/index.d.ts +0 -3
  255. package/screenshot/index.js +0 -2433
  256. package/screenshot/local-connector.js +0 -2
  257. package/screenshot/package.json +0 -15
  258. package/screenshot/pixel-match.d.ts +0 -1
  259. package/screenshot/pixel-match.js +0 -2315
  260. package/screenshot/screenshot-compare.d.ts +0 -20
  261. package/screenshot/screenshot-fs.d.ts +0 -14
  262. package/sys/node/460.node-fetch.js +0 -451
  263. package/sys/node/autoprefixer.js +0 -9
  264. package/sys/node/glob.js +0 -1
  265. package/sys/node/graceful-fs.js +0 -1
  266. package/sys/node/index.d.ts +0 -39
  267. package/sys/node/index.js +0 -64
  268. package/sys/node/node-fetch.js +0 -12
  269. package/sys/node/package.json +0 -8
  270. package/sys/node/prompts.js +0 -1
  271. package/sys/node/worker.js +0 -4
  272. package/testing/index.d.ts +0 -9
  273. package/testing/index.js +0 -13063
  274. package/testing/jest/jest-27-and-under/jest-config.d.ts +0 -16
  275. package/testing/jest/jest-27-and-under/jest-environment.d.ts +0 -2
  276. package/testing/jest/jest-27-and-under/jest-facade.d.ts +0 -155
  277. package/testing/jest/jest-27-and-under/jest-preprocessor.d.ts +0 -59
  278. package/testing/jest/jest-27-and-under/jest-preset.d.ts +0 -3
  279. package/testing/jest/jest-27-and-under/jest-runner.d.ts +0 -11
  280. package/testing/jest/jest-27-and-under/jest-screenshot.d.ts +0 -2
  281. package/testing/jest/jest-27-and-under/jest-serializer.d.ts +0 -4
  282. package/testing/jest/jest-27-and-under/jest-setup-test-framework.d.ts +0 -9
  283. package/testing/jest/jest-27-and-under/matchers/attributes.d.ts +0 -14
  284. package/testing/jest/jest-27-and-under/matchers/class-list.d.ts +0 -12
  285. package/testing/jest/jest-27-and-under/matchers/events.d.ts +0 -25
  286. package/testing/jest/jest-27-and-under/matchers/html.d.ts +0 -13
  287. package/testing/jest/jest-27-and-under/matchers/index.d.ts +0 -24
  288. package/testing/jest/jest-27-and-under/matchers/screenshot.d.ts +0 -5
  289. package/testing/jest/jest-27-and-under/matchers/text.d.ts +0 -4
  290. package/testing/jest/jest-27-and-under/test/jest-config.spec.d.ts +0 -1
  291. package/testing/jest/jest-27-and-under/test/jest-preprocessor.spec.d.ts +0 -1
  292. package/testing/jest/jest-27-and-under/test/jest-runner.spec.d.ts +0 -1
  293. package/testing/jest/jest-27-and-under/test/jest-serializer.spec.d.ts +0 -1
  294. package/testing/jest/jest-27-and-under/test/jest-setup-test-framework.spec.d.ts +0 -1
  295. package/testing/jest/jest-28/jest-config.d.ts +0 -16
  296. package/testing/jest/jest-28/jest-environment.d.ts +0 -2
  297. package/testing/jest/jest-28/jest-facade.d.ts +0 -134
  298. package/testing/jest/jest-28/jest-preprocessor.d.ts +0 -35
  299. package/testing/jest/jest-28/jest-preset.d.ts +0 -3
  300. package/testing/jest/jest-28/jest-runner.d.ts +0 -11
  301. package/testing/jest/jest-28/jest-screenshot.d.ts +0 -2
  302. package/testing/jest/jest-28/jest-serializer.d.ts +0 -4
  303. package/testing/jest/jest-28/jest-setup-test-framework.d.ts +0 -9
  304. package/testing/jest/jest-28/matchers/attributes.d.ts +0 -14
  305. package/testing/jest/jest-28/matchers/class-list.d.ts +0 -12
  306. package/testing/jest/jest-28/matchers/events.d.ts +0 -25
  307. package/testing/jest/jest-28/matchers/html.d.ts +0 -13
  308. package/testing/jest/jest-28/matchers/index.d.ts +0 -24
  309. package/testing/jest/jest-28/matchers/screenshot.d.ts +0 -5
  310. package/testing/jest/jest-28/matchers/text.d.ts +0 -4
  311. package/testing/jest/jest-28/test/jest-config.spec.d.ts +0 -1
  312. package/testing/jest/jest-28/test/jest-preprocessor.spec.d.ts +0 -1
  313. package/testing/jest/jest-28/test/jest-runner.spec.d.ts +0 -1
  314. package/testing/jest/jest-28/test/jest-serializer.spec.d.ts +0 -1
  315. package/testing/jest/jest-28/test/jest-setup-test-framework.spec.d.ts +0 -1
  316. package/testing/jest/jest-29/jest-config.d.ts +0 -16
  317. package/testing/jest/jest-29/jest-environment.d.ts +0 -2
  318. package/testing/jest/jest-29/jest-facade.d.ts +0 -136
  319. package/testing/jest/jest-29/jest-preprocessor.d.ts +0 -35
  320. package/testing/jest/jest-29/jest-preset.d.ts +0 -3
  321. package/testing/jest/jest-29/jest-runner.d.ts +0 -11
  322. package/testing/jest/jest-29/jest-screenshot.d.ts +0 -2
  323. package/testing/jest/jest-29/jest-serializer.d.ts +0 -4
  324. package/testing/jest/jest-29/jest-setup-test-framework.d.ts +0 -9
  325. package/testing/jest/jest-29/matchers/attributes.d.ts +0 -14
  326. package/testing/jest/jest-29/matchers/class-list.d.ts +0 -12
  327. package/testing/jest/jest-29/matchers/events.d.ts +0 -25
  328. package/testing/jest/jest-29/matchers/html.d.ts +0 -13
  329. package/testing/jest/jest-29/matchers/index.d.ts +0 -24
  330. package/testing/jest/jest-29/matchers/screenshot.d.ts +0 -5
  331. package/testing/jest/jest-29/matchers/text.d.ts +0 -4
  332. package/testing/jest/jest-29/test/jest-config.spec.d.ts +0 -1
  333. package/testing/jest/jest-29/test/jest-preprocessor.spec.d.ts +0 -1
  334. package/testing/jest/jest-29/test/jest-runner.spec.d.ts +0 -1
  335. package/testing/jest/jest-29/test/jest-serializer.spec.d.ts +0 -1
  336. package/testing/jest/jest-29/test/jest-setup-test-framework.spec.d.ts +0 -1
  337. package/testing/jest/jest-apis.d.ts +0 -86
  338. package/testing/jest/jest-facade.d.ts +0 -74
  339. package/testing/jest/jest-stencil-connector.d.ts +0 -65
  340. package/testing/jest/test/jest-stencil-connector.spec.d.ts +0 -1
  341. package/testing/jest-environment.js +0 -3
  342. package/testing/jest-preprocessor.js +0 -3
  343. package/testing/jest-preset.js +0 -2
  344. package/testing/jest-runner.js +0 -3
  345. package/testing/jest-setuptestframework.js +0 -3
  346. package/testing/mock-fetch.d.ts +0 -11
  347. package/testing/mocks.d.ts +0 -56
  348. package/testing/package.json +0 -8
  349. package/testing/puppeteer/index.d.ts +0 -2
  350. package/testing/puppeteer/puppeteer-browser.d.ts +0 -6
  351. package/testing/puppeteer/puppeteer-declarations.d.ts +0 -414
  352. package/testing/puppeteer/puppeteer-element.d.ts +0 -67
  353. package/testing/puppeteer/puppeteer-emulate.d.ts +0 -2
  354. package/testing/puppeteer/puppeteer-events.d.ts +0 -21
  355. package/testing/puppeteer/puppeteer-page.d.ts +0 -2
  356. package/testing/puppeteer/puppeteer-screenshot.d.ts +0 -27
  357. package/testing/puppeteer/test/puppeteer-screenshot.spec.d.ts +0 -1
  358. package/testing/reset-build-conditionals.d.ts +0 -12
  359. package/testing/spec-page.d.ts +0 -7
  360. package/testing/test/testing-utils.spec.d.ts +0 -1
  361. package/testing/test-transpile.d.ts +0 -2
  362. package/testing/testing-logger.d.ts +0 -26
  363. package/testing/testing-sys.d.ts +0 -6
  364. package/testing/testing-utils.d.ts +0 -80
  365. package/testing/testing.d.ts +0 -2
  366. /package/{internal → dist/declarations}/stencil-ext-modules.d.ts +0 -0
  367. /package/{internal → dist/declarations}/stencil-public-docs.d.ts +0 -0
  368. /package/{screenshot/compare/build/index.esm.js → dist/declarations/stencil-public-runtime.js} +0 -0
@@ -1,4727 +0,0 @@
1
- /*
2
- Stencil Client Platform v4.43.1 | MIT Licensed | https://stenciljs.com
3
- */
4
-
5
- // src/client/client-build.ts
6
- import { BUILD } from "@stencil/core/internal/app-data";
7
- var Build = {
8
- isDev: BUILD.isDev ? true : false,
9
- isBrowser: true,
10
- isServer: false,
11
- isTesting: BUILD.isTesting ? true : false
12
- };
13
-
14
- // src/client/client-host-ref.ts
15
- import { BUILD as BUILD3 } from "@stencil/core/internal/app-data";
16
-
17
- // src/utils/constants.ts
18
- var SVG_NS = "http://www.w3.org/2000/svg";
19
- var HTML_NS = "http://www.w3.org/1999/xhtml";
20
- var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
21
- PrimitiveType2["Undefined"] = "undefined";
22
- PrimitiveType2["Null"] = "null";
23
- PrimitiveType2["String"] = "string";
24
- PrimitiveType2["Number"] = "number";
25
- PrimitiveType2["SpecialNumber"] = "number";
26
- PrimitiveType2["Boolean"] = "boolean";
27
- PrimitiveType2["BigInt"] = "bigint";
28
- return PrimitiveType2;
29
- })(PrimitiveType || {});
30
- var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
31
- NonPrimitiveType2["Array"] = "array";
32
- NonPrimitiveType2["Date"] = "date";
33
- NonPrimitiveType2["Map"] = "map";
34
- NonPrimitiveType2["Object"] = "object";
35
- NonPrimitiveType2["RegularExpression"] = "regexp";
36
- NonPrimitiveType2["Set"] = "set";
37
- NonPrimitiveType2["Channel"] = "channel";
38
- NonPrimitiveType2["Symbol"] = "symbol";
39
- return NonPrimitiveType2;
40
- })(NonPrimitiveType || {});
41
- var TYPE_CONSTANT = "type";
42
- var VALUE_CONSTANT = "value";
43
- var SERIALIZED_PREFIX = "serialized:";
44
-
45
- // src/utils/es2022-rewire-class-members.ts
46
- import { BUILD as BUILD2 } from "@stencil/core/internal/app-data";
47
- var reWireGetterSetter = (instance, hostRef) => {
48
- var _a;
49
- const cmpMeta = hostRef.$cmpMeta$;
50
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
51
- members.map(([memberName, [memberFlags]]) => {
52
- if ((BUILD2.state || BUILD2.prop) && (memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
53
- const ogValue = instance[memberName];
54
- const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
55
- if (ogDescriptor) {
56
- Object.defineProperty(instance, memberName, {
57
- get() {
58
- return ogDescriptor.get.call(this);
59
- },
60
- set(newValue) {
61
- ogDescriptor.set.call(this, newValue);
62
- },
63
- configurable: true,
64
- enumerable: true
65
- });
66
- }
67
- instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
68
- }
69
- });
70
- };
71
- function getPropertyDescriptor(obj, memberName) {
72
- while (obj) {
73
- const desc = Object.getOwnPropertyDescriptor(obj, memberName);
74
- if (desc == null ? void 0 : desc.get) return desc;
75
- obj = Object.getPrototypeOf(obj);
76
- }
77
- return void 0;
78
- }
79
-
80
- // src/client/client-host-ref.ts
81
- var getHostRef = (ref) => {
82
- if (ref.__stencil__getHostRef) {
83
- return ref.__stencil__getHostRef();
84
- }
85
- return void 0;
86
- };
87
- var registerInstance = (lazyInstance, hostRef) => {
88
- if (!hostRef) return;
89
- lazyInstance.__stencil__getHostRef = () => hostRef;
90
- hostRef.$lazyInstance$ = lazyInstance;
91
- if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD3.state || BUILD3.prop)) {
92
- reWireGetterSetter(lazyInstance, hostRef);
93
- }
94
- };
95
- var registerHost = (hostElement, cmpMeta) => {
96
- const hostRef = {
97
- $flags$: 0,
98
- $hostElement$: hostElement,
99
- $cmpMeta$: cmpMeta,
100
- $instanceValues$: /* @__PURE__ */ new Map(),
101
- $serializerValues$: /* @__PURE__ */ new Map()
102
- };
103
- if (BUILD3.isDev) {
104
- hostRef.$renderCount$ = 0;
105
- }
106
- if (BUILD3.method && BUILD3.lazyLoad) {
107
- hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
108
- }
109
- if (BUILD3.asyncLoading) {
110
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
111
- hostElement["s-p"] = [];
112
- hostElement["s-rc"] = [];
113
- }
114
- if (BUILD3.lazyLoad) {
115
- hostRef.$fetchedCbList$ = [];
116
- }
117
- const ref = hostRef;
118
- hostElement.__stencil__getHostRef = () => ref;
119
- if (!BUILD3.lazyLoad && cmpMeta.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD3.state || BUILD3.prop)) {
120
- reWireGetterSetter(hostElement, hostRef);
121
- }
122
- return ref;
123
- };
124
- var isMemberInElement = (elm, memberName) => memberName in elm;
125
-
126
- // src/client/client-load-module.ts
127
- import { BUILD as BUILD5 } from "@stencil/core/internal/app-data";
128
-
129
- // src/client/client-log.ts
130
- import { BUILD as BUILD4 } from "@stencil/core/internal/app-data";
131
- var customError;
132
- var consoleError = (e, el) => (customError || console.error)(e, el);
133
- var STENCIL_DEV_MODE = BUILD4.isTesting ? ["STENCIL:"] : [
134
- "%cstencil",
135
- "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
136
- ];
137
- var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
138
- var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
139
- var consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
140
- var setErrorHandler = (handler) => customError = handler;
141
-
142
- // src/client/client-load-module.ts
143
- var cmpModules = /* @__PURE__ */ new Map();
144
- var MODULE_IMPORT_PREFIX = "./";
145
- var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
146
- const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
147
- const bundleId = cmpMeta.$lazyBundleId$;
148
- if (BUILD5.isDev && typeof bundleId !== "string") {
149
- consoleDevError(
150
- `Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`
151
- );
152
- return void 0;
153
- } else if (!bundleId) {
154
- return void 0;
155
- }
156
- const module = !BUILD5.hotModuleReplacement ? cmpModules.get(bundleId) : false;
157
- if (module) {
158
- return module[exportName];
159
- }
160
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
161
- return import(
162
- /* @vite-ignore */
163
- /* webpackInclude: /\.entry\.js$/ */
164
- /* webpackExclude: /\.system\.entry\.js$/ */
165
- /* webpackMode: "lazy" */
166
- `./${bundleId}.entry.js${BUILD5.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
167
- ).then(
168
- (importedModule) => {
169
- if (!BUILD5.hotModuleReplacement) {
170
- cmpModules.set(bundleId, importedModule);
171
- }
172
- return importedModule[exportName];
173
- },
174
- (e) => {
175
- consoleError(e, hostRef.$hostElement$);
176
- }
177
- );
178
- };
179
-
180
- // src/client/client-style.ts
181
- var styles = /* @__PURE__ */ new Map();
182
- var modeResolutionChain = [];
183
- var setScopedSSR = (_opts) => {
184
- };
185
- var needsScopedSSR = () => false;
186
-
187
- // src/client/client-task-queue.ts
188
- import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
189
-
190
- // src/runtime/runtime-constants.ts
191
- var CONTENT_REF_ID = "r";
192
- var ORG_LOCATION_ID = "o";
193
- var SLOT_NODE_ID = "s";
194
- var TEXT_NODE_ID = "t";
195
- var COMMENT_NODE_ID = "c";
196
- var HYDRATE_ID = "s-id";
197
- var HYDRATED_STYLE_ID = "sty-id";
198
- var HYDRATE_CHILD_ID = "c-id";
199
- var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
200
- var STENCIL_DOC_DATA = "_stencilDocData";
201
- var DEFAULT_DOC_DATA = {
202
- hostIds: 0,
203
- rootLevelIds: 0,
204
- staticComponents: /* @__PURE__ */ new Set()
205
- };
206
- var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
207
- var XLINK_NS = "http://www.w3.org/1999/xlink";
208
- var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
209
- "formAssociatedCallback",
210
- "formResetCallback",
211
- "formDisabledCallback",
212
- "formStateRestoreCallback"
213
- ];
214
-
215
- // src/client/client-window.ts
216
- import { BUILD as BUILD6 } from "@stencil/core/internal/app-data";
217
- var win = typeof window !== "undefined" ? window : {};
218
- var H = win.HTMLElement || class {
219
- };
220
- var plt = {
221
- $flags$: 0,
222
- $resourcesUrl$: "",
223
- jmp: (h2) => h2(),
224
- raf: (h2) => requestAnimationFrame(h2),
225
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
226
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
227
- ce: (eventName, opts) => new CustomEvent(eventName, opts)
228
- };
229
- var setPlatformHelpers = (helpers) => {
230
- Object.assign(plt, helpers);
231
- };
232
- var supportsShadow = BUILD6.shadowDom;
233
- var supportsListenerOptions = /* @__PURE__ */ (() => {
234
- var _a;
235
- let supportsListenerOptions2 = false;
236
- try {
237
- (_a = win.document) == null ? void 0 : _a.addEventListener(
238
- "e",
239
- null,
240
- Object.defineProperty({}, "passive", {
241
- get() {
242
- supportsListenerOptions2 = true;
243
- }
244
- })
245
- );
246
- } catch (e) {
247
- }
248
- return supportsListenerOptions2;
249
- })();
250
- var promiseResolve = (v) => Promise.resolve(v);
251
- var supportsConstructableStylesheets = BUILD6.constructableCSS ? /* @__PURE__ */ (() => {
252
- try {
253
- if (!win.document.adoptedStyleSheets) {
254
- return false;
255
- }
256
- new CSSStyleSheet();
257
- return typeof new CSSStyleSheet().replaceSync === "function";
258
- } catch (e) {
259
- }
260
- return false;
261
- })() : false;
262
- var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
263
-
264
- // src/client/client-task-queue.ts
265
- var queueCongestion = 0;
266
- var queuePending = false;
267
- var queueDomReads = [];
268
- var queueDomWrites = [];
269
- var queueDomWritesLow = [];
270
- var queueTask = (queue, write) => (cb) => {
271
- queue.push(cb);
272
- if (!queuePending) {
273
- queuePending = true;
274
- if (write && plt.$flags$ & 4 /* queueSync */) {
275
- nextTick(flush);
276
- } else {
277
- plt.raf(flush);
278
- }
279
- }
280
- };
281
- var consume = (queue) => {
282
- for (let i2 = 0; i2 < queue.length; i2++) {
283
- try {
284
- queue[i2](performance.now());
285
- } catch (e) {
286
- consoleError(e);
287
- }
288
- }
289
- queue.length = 0;
290
- };
291
- var consumeTimeout = (queue, timeout) => {
292
- let i2 = 0;
293
- let ts = 0;
294
- while (i2 < queue.length && (ts = performance.now()) < timeout) {
295
- try {
296
- queue[i2++](ts);
297
- } catch (e) {
298
- consoleError(e);
299
- }
300
- }
301
- if (i2 === queue.length) {
302
- queue.length = 0;
303
- } else if (i2 !== 0) {
304
- queue.splice(0, i2);
305
- }
306
- };
307
- var flush = () => {
308
- if (BUILD7.asyncQueue) {
309
- queueCongestion++;
310
- }
311
- consume(queueDomReads);
312
- if (BUILD7.asyncQueue) {
313
- const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
314
- consumeTimeout(queueDomWrites, timeout);
315
- consumeTimeout(queueDomWritesLow, timeout);
316
- if (queueDomWrites.length > 0) {
317
- queueDomWritesLow.push(...queueDomWrites);
318
- queueDomWrites.length = 0;
319
- }
320
- if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) {
321
- plt.raf(flush);
322
- } else {
323
- queueCongestion = 0;
324
- }
325
- } else {
326
- consume(queueDomWrites);
327
- if (queuePending = queueDomReads.length > 0) {
328
- plt.raf(flush);
329
- }
330
- }
331
- };
332
- var nextTick = (cb) => promiseResolve().then(cb);
333
- var readTask = /* @__PURE__ */ queueTask(queueDomReads, false);
334
- var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
335
-
336
- // src/client/index.ts
337
- import { BUILD as BUILD31, Env, NAMESPACE as NAMESPACE2 } from "@stencil/core/internal/app-data";
338
-
339
- // src/runtime/asset-path.ts
340
- var getAssetPath = (path) => {
341
- const assetUrl = new URL(path, plt.$resourcesUrl$);
342
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
343
- };
344
- var setAssetPath = (path) => plt.$resourcesUrl$ = path;
345
-
346
- // src/runtime/bootstrap-custom-element.ts
347
- import { BUILD as BUILD27 } from "@stencil/core/internal/app-data";
348
-
349
- // src/utils/shadow-root.ts
350
- import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
351
- import { globalStyles } from "@stencil/core/internal/app-globals";
352
-
353
- // src/utils/style.ts
354
- function createStyleSheetIfNeededAndSupported(styles2) {
355
- if (!styles2 || !supportsConstructableStylesheets) return void 0;
356
- const sheet = new CSSStyleSheet();
357
- sheet.replaceSync(styles2);
358
- return sheet;
359
- }
360
-
361
- // src/utils/shadow-root.ts
362
- var globalStyleSheet;
363
- var GLOBAL_STYLE_ID = "sc-global";
364
- function createShadowRoot(cmpMeta) {
365
- var _a;
366
- const opts = { mode: "open" };
367
- if (BUILD8.shadowDelegatesFocus) {
368
- opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
369
- }
370
- if (BUILD8.shadowSlotAssignmentManual) {
371
- const isManual = !!(cmpMeta.$flags$ & 1024 /* shadowSlotAssignmentManual */);
372
- if (isManual) {
373
- opts.slotAssignment = "manual";
374
- }
375
- }
376
- const shadowRoot = this.attachShadow(opts);
377
- if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
378
- if (globalStyleSheet) {
379
- if (supportsMutableAdoptedStyleSheets) {
380
- shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
381
- } else {
382
- shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
383
- }
384
- } else if (globalStyles && !supportsConstructableStylesheets) {
385
- const styleElm = document.createElement("style");
386
- styleElm.innerHTML = globalStyles;
387
- if (BUILD8.hotModuleReplacement) {
388
- styleElm.setAttribute(HYDRATED_STYLE_ID, GLOBAL_STYLE_ID);
389
- }
390
- shadowRoot.prepend(styleElm);
391
- }
392
- }
393
-
394
- // src/runtime/connected-callback.ts
395
- import { BUILD as BUILD25 } from "@stencil/core/internal/app-data";
396
-
397
- // src/runtime/client-hydrate.ts
398
- import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
399
-
400
- // src/runtime/dom-extras.ts
401
- import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
402
-
403
- // src/runtime/slot-polyfill-utils.ts
404
- import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
405
- var updateFallbackSlotVisibility = (elm) => {
406
- const childNodes = internalCall(elm, "childNodes");
407
- if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
408
- getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
409
- if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
410
- if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
411
- slotNode.hidden = true;
412
- } else {
413
- slotNode.hidden = false;
414
- }
415
- }
416
- });
417
- }
418
- let i2 = 0;
419
- for (i2 = 0; i2 < childNodes.length; i2++) {
420
- const childNode = childNodes[i2];
421
- if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
422
- updateFallbackSlotVisibility(childNode);
423
- }
424
- }
425
- };
426
- var getSlottedChildNodes = (childNodes) => {
427
- const result = [];
428
- for (let i2 = 0; i2 < childNodes.length; i2++) {
429
- const slottedNode = childNodes[i2]["s-nr"] || void 0;
430
- if (slottedNode && slottedNode.isConnected) {
431
- result.push(slottedNode);
432
- }
433
- }
434
- return result;
435
- };
436
- function getHostSlotNodes(childNodes, hostName, slotName) {
437
- let i2 = 0;
438
- let slottedNodes = [];
439
- let childNode;
440
- for (; i2 < childNodes.length; i2++) {
441
- childNode = childNodes[i2];
442
- if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
443
- slottedNodes.push(childNode);
444
- if (typeof slotName !== "undefined") return slottedNodes;
445
- }
446
- slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
447
- }
448
- return slottedNodes;
449
- }
450
- var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
451
- const childNodes = [];
452
- if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
453
- let node = slot;
454
- while (node = node.nextSibling) {
455
- if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
456
- }
457
- return childNodes;
458
- };
459
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
460
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
461
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
462
- return true;
463
- }
464
- if (nodeToRelocate.getAttribute("slot") === slotName) {
465
- return true;
466
- }
467
- return false;
468
- }
469
- if (nodeToRelocate["s-sn"] === slotName) {
470
- return true;
471
- }
472
- return slotName === "";
473
- };
474
- var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
475
- if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
476
- return;
477
- }
478
- const slottedNodeLocation = document.createTextNode("");
479
- slottedNodeLocation["s-nr"] = newChild;
480
- if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
481
- const parent = slotNode["s-cr"].parentNode;
482
- const appendMethod = prepend ? internalCall(parent, "prepend") : internalCall(parent, "appendChild");
483
- if (BUILD9.hydrateClientSide && typeof position !== "undefined") {
484
- slottedNodeLocation["s-oo"] = position;
485
- const childNodes = internalCall(parent, "childNodes");
486
- const slotRelocateNodes = [slottedNodeLocation];
487
- childNodes.forEach((n) => {
488
- if (n["s-nr"]) slotRelocateNodes.push(n);
489
- });
490
- slotRelocateNodes.sort((a, b) => {
491
- if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
492
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
493
- return 0;
494
- });
495
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
496
- } else {
497
- appendMethod.call(parent, slottedNodeLocation);
498
- }
499
- newChild["s-ol"] = slottedNodeLocation;
500
- newChild["s-sh"] = slotNode["s-hn"];
501
- };
502
- var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
503
- function patchSlotNode(node) {
504
- if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
505
- const assignedFactory = (elementsOnly) => (function(opts) {
506
- const toReturn = [];
507
- const slotName = this["s-sn"];
508
- if (opts == null ? void 0 : opts.flatten) {
509
- console.error(`
510
- Flattening is not supported for Stencil non-shadow slots.
511
- You can use \`.childNodes\` to nested slot fallback content.
512
- If you have a particular use case, please open an issue on the Stencil repo.
513
- `);
514
- }
515
- const parent = this["s-cr"].parentElement;
516
- const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
517
- slottedNodes.forEach((n) => {
518
- if (slotName === getSlotName(n)) {
519
- toReturn.push(n);
520
- }
521
- });
522
- if (elementsOnly) {
523
- return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
524
- }
525
- return toReturn;
526
- }).bind(node);
527
- node.assignedElements = assignedFactory(true);
528
- node.assignedNodes = assignedFactory(false);
529
- }
530
- function dispatchSlotChangeEvent(elm) {
531
- elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
532
- }
533
- function findSlotFromSlottedNode(slottedNode, parentHost) {
534
- var _a;
535
- parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
536
- if (!parentHost) return { slotNode: null, slotName: "" };
537
- const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
538
- const childNodes = internalCall(parentHost, "childNodes");
539
- const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
540
- return { slotNode, slotName };
541
- }
542
-
543
- // src/runtime/dom-extras.ts
544
- var patchPseudoShadowDom = (hostElementPrototype) => {
545
- patchCloneNode(hostElementPrototype);
546
- patchSlotAppendChild(hostElementPrototype);
547
- patchSlotAppend(hostElementPrototype);
548
- patchSlotPrepend(hostElementPrototype);
549
- patchSlotInsertAdjacentElement(hostElementPrototype);
550
- patchSlotInsertAdjacentHTML(hostElementPrototype);
551
- patchSlotInsertAdjacentText(hostElementPrototype);
552
- patchInsertBefore(hostElementPrototype);
553
- patchTextContent(hostElementPrototype);
554
- patchChildSlotNodes(hostElementPrototype);
555
- patchSlotRemoveChild(hostElementPrototype);
556
- };
557
- var patchCloneNode = (HostElementPrototype) => {
558
- if (HostElementPrototype.__cloneNode) return;
559
- const orgCloneNode = HostElementPrototype.__cloneNode = HostElementPrototype.cloneNode;
560
- HostElementPrototype.cloneNode = function(deep) {
561
- const srcNode = this;
562
- const isShadowDom = BUILD10.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
563
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
564
- if (BUILD10.slot && !isShadowDom && deep) {
565
- let i2 = 0;
566
- let slotted, nonStencilNode;
567
- const stencilPrivates = [
568
- "s-id",
569
- "s-cr",
570
- "s-lr",
571
- "s-rc",
572
- "s-sc",
573
- "s-p",
574
- "s-cn",
575
- "s-sr",
576
- "s-sn",
577
- "s-hn",
578
- "s-ol",
579
- "s-nr",
580
- "s-si",
581
- "s-rf",
582
- "s-scs"
583
- ];
584
- const childNodes = this.__childNodes || this.childNodes;
585
- for (; i2 < childNodes.length; i2++) {
586
- slotted = childNodes[i2]["s-nr"];
587
- nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
588
- if (slotted) {
589
- if (BUILD10.appendChildSlotFix && clonedNode.__appendChild) {
590
- clonedNode.__appendChild(slotted.cloneNode(true));
591
- } else {
592
- clonedNode.appendChild(slotted.cloneNode(true));
593
- }
594
- }
595
- if (nonStencilNode) {
596
- clonedNode.appendChild(childNodes[i2].cloneNode(true));
597
- }
598
- }
599
- }
600
- return clonedNode;
601
- };
602
- };
603
- var patchSlotAppendChild = (HostElementPrototype) => {
604
- if (HostElementPrototype.__appendChild) return;
605
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
606
- HostElementPrototype.appendChild = function(newChild) {
607
- const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
608
- if (slotNode) {
609
- addSlotRelocateNode(newChild, slotNode);
610
- const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
611
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
612
- const parent = internalCall(appendAfter, "parentNode");
613
- const insertedNode = internalCall(parent, "insertBefore")(newChild, appendAfter.nextSibling);
614
- dispatchSlotChangeEvent(slotNode);
615
- updateFallbackSlotVisibility(this);
616
- return insertedNode;
617
- }
618
- return this.__appendChild(newChild);
619
- };
620
- };
621
- var patchSlotRemoveChild = (ElementPrototype) => {
622
- if (ElementPrototype.__removeChild) return;
623
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
624
- ElementPrototype.removeChild = function(toRemove) {
625
- if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
626
- const childNodes = this.__childNodes || this.childNodes;
627
- const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
628
- if (slotNode && toRemove.isConnected) {
629
- toRemove.remove();
630
- updateFallbackSlotVisibility(this);
631
- return;
632
- }
633
- }
634
- return this.__removeChild(toRemove);
635
- };
636
- };
637
- var patchSlotPrepend = (HostElementPrototype) => {
638
- if (HostElementPrototype.__prepend) return;
639
- HostElementPrototype.__prepend = HostElementPrototype.prepend;
640
- HostElementPrototype.prepend = function(...newChildren) {
641
- newChildren.forEach((newChild) => {
642
- if (typeof newChild === "string") {
643
- newChild = this.ownerDocument.createTextNode(newChild);
644
- }
645
- const slotName = (newChild["s-sn"] = getSlotName(newChild)) || "";
646
- const childNodes = internalCall(this, "childNodes");
647
- const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
648
- if (slotNode) {
649
- addSlotRelocateNode(newChild, slotNode, true);
650
- const slotChildNodes = getSlotChildSiblings(slotNode, slotName);
651
- const appendAfter = slotChildNodes[0];
652
- const parent = internalCall(appendAfter, "parentNode");
653
- const toReturn = internalCall(parent, "insertBefore")(newChild, internalCall(appendAfter, "nextSibling"));
654
- dispatchSlotChangeEvent(slotNode);
655
- return toReturn;
656
- }
657
- if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
658
- newChild.hidden = true;
659
- }
660
- return HostElementPrototype.__prepend(newChild);
661
- });
662
- };
663
- };
664
- var patchSlotAppend = (HostElementPrototype) => {
665
- if (HostElementPrototype.__append) return;
666
- HostElementPrototype.__append = HostElementPrototype.append;
667
- HostElementPrototype.append = function(...newChildren) {
668
- newChildren.forEach((newChild) => {
669
- if (typeof newChild === "string") {
670
- newChild = this.ownerDocument.createTextNode(newChild);
671
- }
672
- this.appendChild(newChild);
673
- });
674
- };
675
- };
676
- var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
677
- if (HostElementPrototype.__insertAdjacentHTML) return;
678
- const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
679
- HostElementPrototype.insertAdjacentHTML = function(position, text) {
680
- if (position !== "afterbegin" && position !== "beforeend") {
681
- return originalInsertAdjacentHtml.call(this, position, text);
682
- }
683
- const container = this.ownerDocument.createElement("_");
684
- let node;
685
- container.innerHTML = text;
686
- if (position === "afterbegin") {
687
- while (node = container.firstChild) {
688
- this.prepend(node);
689
- }
690
- } else if (position === "beforeend") {
691
- while (node = container.firstChild) {
692
- this.append(node);
693
- }
694
- }
695
- };
696
- };
697
- var patchSlotInsertAdjacentText = (HostElementPrototype) => {
698
- HostElementPrototype.insertAdjacentText = function(position, text) {
699
- this.insertAdjacentHTML(position, text);
700
- };
701
- };
702
- var patchInsertBefore = (HostElementPrototype) => {
703
- if (HostElementPrototype.__insertBefore) return;
704
- const eleProto = HostElementPrototype;
705
- if (eleProto.__insertBefore) return;
706
- eleProto.__insertBefore = HostElementPrototype.insertBefore;
707
- HostElementPrototype.insertBefore = function(newChild, currentChild) {
708
- const { slotName, slotNode } = findSlotFromSlottedNode(newChild, this);
709
- const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
710
- if (slotNode) {
711
- let found = false;
712
- slottedNodes.forEach((childNode) => {
713
- if (childNode === currentChild || currentChild === null) {
714
- found = true;
715
- if (currentChild === null || slotName !== currentChild["s-sn"]) {
716
- this.appendChild(newChild);
717
- return;
718
- }
719
- if (slotName === currentChild["s-sn"]) {
720
- addSlotRelocateNode(newChild, slotNode);
721
- const parent = internalCall(currentChild, "parentNode");
722
- internalCall(parent, "insertBefore")(newChild, currentChild);
723
- dispatchSlotChangeEvent(slotNode);
724
- }
725
- return;
726
- }
727
- });
728
- if (found) return newChild;
729
- }
730
- const parentNode = currentChild == null ? void 0 : currentChild.__parentNode;
731
- if (parentNode && !this.isSameNode(parentNode)) {
732
- return this.appendChild(newChild);
733
- }
734
- return this.__insertBefore(newChild, currentChild);
735
- };
736
- };
737
- var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
738
- if (HostElementPrototype.__insertAdjacentElement) return;
739
- const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
740
- HostElementPrototype.insertAdjacentElement = function(position, element) {
741
- if (position !== "afterbegin" && position !== "beforeend") {
742
- return originalInsertAdjacentElement.call(this, position, element);
743
- }
744
- if (position === "afterbegin") {
745
- this.prepend(element);
746
- return element;
747
- } else if (position === "beforeend") {
748
- this.append(element);
749
- return element;
750
- }
751
- return element;
752
- };
753
- };
754
- var patchTextContent = (hostElementPrototype) => {
755
- patchHostOriginalAccessor("textContent", hostElementPrototype);
756
- Object.defineProperty(hostElementPrototype, "textContent", {
757
- get: function() {
758
- let text = "";
759
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
760
- childNodes.forEach((node) => text += node.textContent || "");
761
- return text;
762
- },
763
- set: function(value) {
764
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
765
- childNodes.forEach((node) => {
766
- if (node["s-ol"]) node["s-ol"].remove();
767
- node.remove();
768
- });
769
- this.insertAdjacentHTML("beforeend", value);
770
- }
771
- });
772
- };
773
- var patchChildSlotNodes = (elm) => {
774
- class FakeNodeList extends Array {
775
- item(n) {
776
- return this[n];
777
- }
778
- }
779
- patchHostOriginalAccessor("children", elm);
780
- Object.defineProperty(elm, "children", {
781
- get() {
782
- return this.childNodes.filter((n) => n.nodeType === 1);
783
- }
784
- });
785
- Object.defineProperty(elm, "childElementCount", {
786
- get() {
787
- return this.children.length;
788
- }
789
- });
790
- patchHostOriginalAccessor("firstChild", elm);
791
- Object.defineProperty(elm, "firstChild", {
792
- get() {
793
- return this.childNodes[0];
794
- }
795
- });
796
- patchHostOriginalAccessor("lastChild", elm);
797
- Object.defineProperty(elm, "lastChild", {
798
- get() {
799
- return this.childNodes[this.childNodes.length - 1];
800
- }
801
- });
802
- patchHostOriginalAccessor("childNodes", elm);
803
- Object.defineProperty(elm, "childNodes", {
804
- get() {
805
- const result = new FakeNodeList();
806
- result.push(...getSlottedChildNodes(this.__childNodes));
807
- return result;
808
- }
809
- });
810
- };
811
- var patchSlottedNode = (node) => {
812
- if (!node || node.__nextSibling !== void 0 || !globalThis.Node) return;
813
- patchNextSibling(node);
814
- patchPreviousSibling(node);
815
- patchParentNode(node);
816
- if (node.nodeType === Node.ELEMENT_NODE) {
817
- patchNextElementSibling(node);
818
- patchPreviousElementSibling(node);
819
- }
820
- };
821
- var patchNextSibling = (node) => {
822
- if (!node || node.__nextSibling) return;
823
- patchHostOriginalAccessor("nextSibling", node);
824
- Object.defineProperty(node, "nextSibling", {
825
- get: function() {
826
- var _a;
827
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
828
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
829
- if (parentNodes && index > -1) {
830
- return parentNodes[index + 1];
831
- }
832
- return this.__nextSibling;
833
- }
834
- });
835
- };
836
- var patchNextElementSibling = (element) => {
837
- if (!element || element.__nextElementSibling) return;
838
- patchHostOriginalAccessor("nextElementSibling", element);
839
- Object.defineProperty(element, "nextElementSibling", {
840
- get: function() {
841
- var _a;
842
- const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
843
- const index = parentEles == null ? void 0 : parentEles.indexOf(this);
844
- if (parentEles && index > -1) {
845
- return parentEles[index + 1];
846
- }
847
- return this.__nextElementSibling;
848
- }
849
- });
850
- };
851
- var patchPreviousSibling = (node) => {
852
- if (!node || node.__previousSibling) return;
853
- patchHostOriginalAccessor("previousSibling", node);
854
- Object.defineProperty(node, "previousSibling", {
855
- get: function() {
856
- var _a;
857
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
858
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
859
- if (parentNodes && index > -1) {
860
- return parentNodes[index - 1];
861
- }
862
- return this.__previousSibling;
863
- }
864
- });
865
- };
866
- var patchPreviousElementSibling = (element) => {
867
- if (!element || element.__previousElementSibling) return;
868
- patchHostOriginalAccessor("previousElementSibling", element);
869
- Object.defineProperty(element, "previousElementSibling", {
870
- get: function() {
871
- var _a;
872
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
873
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
874
- if (parentNodes && index > -1) {
875
- return parentNodes[index - 1];
876
- }
877
- return this.__previousElementSibling;
878
- }
879
- });
880
- };
881
- var patchParentNode = (node) => {
882
- if (!node || node.__parentNode) return;
883
- patchHostOriginalAccessor("parentNode", node);
884
- Object.defineProperty(node, "parentNode", {
885
- get: function() {
886
- var _a;
887
- return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
888
- },
889
- set: function(value) {
890
- this.__parentNode = value;
891
- }
892
- });
893
- };
894
- var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
895
- var validNodesPatches = [
896
- "childNodes",
897
- "firstChild",
898
- "lastChild",
899
- "nextSibling",
900
- "previousSibling",
901
- "textContent",
902
- "parentNode"
903
- ];
904
- function patchHostOriginalAccessor(accessorName, node) {
905
- if (!globalThis.Node || !globalThis.Element) {
906
- return;
907
- }
908
- let accessor;
909
- if (validElementPatches.includes(accessorName)) {
910
- accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
911
- } else if (validNodesPatches.includes(accessorName)) {
912
- accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
913
- }
914
- if (!accessor) {
915
- accessor = Object.getOwnPropertyDescriptor(node, accessorName);
916
- }
917
- if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
918
- }
919
- function internalCall(node, method) {
920
- if ("__" + method in node) {
921
- const toReturn = node["__" + method];
922
- if (typeof toReturn !== "function") return toReturn;
923
- return toReturn.bind(node);
924
- } else {
925
- if (typeof node[method] !== "function") return node[method];
926
- return node[method].bind(node);
927
- }
928
- }
929
-
930
- // src/runtime/profile.ts
931
- import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
932
- var i = 0;
933
- var createTime = (fnName, tagName = "") => {
934
- if (BUILD11.profile && performance.mark) {
935
- const key = `st:${fnName}:${tagName}:${i++}`;
936
- performance.mark(key);
937
- return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
938
- } else {
939
- return () => {
940
- return;
941
- };
942
- }
943
- };
944
- var uniqueTime = (key, measureText) => {
945
- if (BUILD11.profile && performance.mark) {
946
- if (performance.getEntriesByName(key, "mark").length === 0) {
947
- performance.mark(key);
948
- }
949
- return () => {
950
- if (performance.getEntriesByName(measureText, "measure").length === 0) {
951
- performance.measure(measureText, key);
952
- }
953
- };
954
- } else {
955
- return () => {
956
- return;
957
- };
958
- }
959
- };
960
- var inspect = (ref) => {
961
- const hostRef = getHostRef(ref);
962
- if (!hostRef) {
963
- return void 0;
964
- }
965
- const flags = hostRef.$flags$;
966
- const hostElement = hostRef.$hostElement$;
967
- return {
968
- renderCount: hostRef.$renderCount$,
969
- flags: {
970
- hasRendered: !!(flags & 2 /* hasRendered */),
971
- hasConnected: !!(flags & 1 /* hasConnected */),
972
- isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
973
- isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
974
- isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
975
- hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
976
- hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
977
- isWatchReady: !!(flags & 128 /* isWatchReady */),
978
- isListenReady: !!(flags & 256 /* isListenReady */),
979
- needsRerender: !!(flags & 512 /* needsRerender */)
980
- },
981
- instanceValues: hostRef.$instanceValues$,
982
- serializerValues: hostRef.$serializerValues$,
983
- ancestorComponent: hostRef.$ancestorComponent$,
984
- hostElement,
985
- lazyInstance: hostRef.$lazyInstance$,
986
- vnode: hostRef.$vnode$,
987
- modeName: hostRef.$modeName$,
988
- fetchedCbList: hostRef.$fetchedCbList$,
989
- onReadyPromise: hostRef.$onReadyPromise$,
990
- onReadyResolve: hostRef.$onReadyResolve$,
991
- onInstancePromise: hostRef.$onInstancePromise$,
992
- onInstanceResolve: hostRef.$onInstanceResolve$,
993
- onRenderResolve: hostRef.$onRenderResolve$,
994
- queuedListeners: hostRef.$queuedListeners$,
995
- rmListeners: hostRef.$rmListeners$,
996
- ["s-id"]: hostElement["s-id"],
997
- ["s-cr"]: hostElement["s-cr"],
998
- ["s-lr"]: hostElement["s-lr"],
999
- ["s-p"]: hostElement["s-p"],
1000
- ["s-rc"]: hostElement["s-rc"],
1001
- ["s-sc"]: hostElement["s-sc"]
1002
- };
1003
- };
1004
- var installDevTools = () => {
1005
- if (BUILD11.devTools) {
1006
- const stencil = win.stencil = win.stencil || {};
1007
- const originalInspect = stencil.inspect;
1008
- stencil.inspect = (ref) => {
1009
- let result = inspect(ref);
1010
- if (!result && typeof originalInspect === "function") {
1011
- result = originalInspect(ref);
1012
- }
1013
- return result;
1014
- };
1015
- }
1016
- };
1017
-
1018
- // src/runtime/styles.ts
1019
- import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
1020
-
1021
- // src/utils/query-nonce-meta-tag-content.ts
1022
- function queryNonceMetaTagContent(doc) {
1023
- var _a, _b, _c;
1024
- return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
1025
- }
1026
-
1027
- // src/runtime/styles.ts
1028
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1029
- var registerStyle = (scopeId2, cssText, allowCS) => {
1030
- let style = styles.get(scopeId2);
1031
- if (supportsConstructableStylesheets && allowCS) {
1032
- style = style || new CSSStyleSheet();
1033
- if (typeof style === "string") {
1034
- style = cssText;
1035
- } else {
1036
- style.replaceSync(cssText);
1037
- }
1038
- } else {
1039
- style = cssText;
1040
- }
1041
- styles.set(scopeId2, style);
1042
- };
1043
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
1044
- var _a, _b, _c;
1045
- const scopeId2 = getScopeId(cmpMeta, mode);
1046
- const style = styles.get(scopeId2);
1047
- if (!BUILD12.attachStyles || !win.document) {
1048
- return scopeId2;
1049
- }
1050
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1051
- if (style) {
1052
- if (typeof style === "string") {
1053
- styleContainerNode = styleContainerNode.head || styleContainerNode;
1054
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1055
- let styleElm;
1056
- if (!appliedStyles) {
1057
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1058
- }
1059
- const existingStyleElm = (BUILD12.hydrateClientSide || BUILD12.hotModuleReplacement) && styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
1060
- if (existingStyleElm) {
1061
- existingStyleElm.textContent = style;
1062
- } else if (!appliedStyles.has(scopeId2)) {
1063
- styleElm = win.document.createElement("style");
1064
- styleElm.textContent = style;
1065
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1066
- if (nonce != null) {
1067
- styleElm.setAttribute("nonce", nonce);
1068
- }
1069
- if ((BUILD12.hydrateServerSide || BUILD12.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */ || cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1070
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1071
- }
1072
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1073
- if (styleContainerNode.nodeName === "HEAD") {
1074
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1075
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1076
- styleContainerNode.insertBefore(
1077
- styleElm,
1078
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1079
- );
1080
- } else if ("host" in styleContainerNode) {
1081
- if (supportsConstructableStylesheets) {
1082
- const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
1083
- const stylesheet = new currentWindow.CSSStyleSheet();
1084
- stylesheet.replaceSync(style);
1085
- if (supportsMutableAdoptedStyleSheets) {
1086
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1087
- } else {
1088
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1089
- }
1090
- } else {
1091
- const existingStyleContainer = styleContainerNode.querySelector("style");
1092
- if (existingStyleContainer && !BUILD12.hotModuleReplacement) {
1093
- existingStyleContainer.textContent = style + existingStyleContainer.textContent;
1094
- } else {
1095
- styleContainerNode.prepend(styleElm);
1096
- }
1097
- }
1098
- } else {
1099
- styleContainerNode.append(styleElm);
1100
- }
1101
- }
1102
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1103
- styleContainerNode.insertBefore(styleElm, null);
1104
- }
1105
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1106
- styleElm.textContent += SLOT_FB_CSS;
1107
- }
1108
- if (appliedStyles) {
1109
- appliedStyles.add(scopeId2);
1110
- }
1111
- }
1112
- } else if (BUILD12.constructableCSS) {
1113
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1114
- if (!appliedStyles) {
1115
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1116
- }
1117
- if (!appliedStyles.has(scopeId2)) {
1118
- const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
1119
- let stylesheet;
1120
- if (style.constructor === currentWindow.CSSStyleSheet) {
1121
- stylesheet = style;
1122
- } else {
1123
- stylesheet = new currentWindow.CSSStyleSheet();
1124
- for (let i2 = 0; i2 < style.cssRules.length; i2++) {
1125
- stylesheet.insertRule(style.cssRules[i2].cssText, i2);
1126
- }
1127
- }
1128
- if (supportsMutableAdoptedStyleSheets) {
1129
- styleContainerNode.adoptedStyleSheets.push(stylesheet);
1130
- } else {
1131
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
1132
- }
1133
- appliedStyles.add(scopeId2);
1134
- if (BUILD12.hydrateClientSide && "host" in styleContainerNode) {
1135
- const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
1136
- if (ssrStyleElm) {
1137
- writeTask(() => ssrStyleElm.remove());
1138
- }
1139
- }
1140
- }
1141
- }
1142
- }
1143
- return scopeId2;
1144
- };
1145
- var attachStyles = (hostRef) => {
1146
- const cmpMeta = hostRef.$cmpMeta$;
1147
- const elm = hostRef.$hostElement$;
1148
- const flags = cmpMeta.$flags$;
1149
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1150
- const scopeId2 = addStyle(
1151
- BUILD12.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1152
- cmpMeta,
1153
- hostRef.$modeName$
1154
- );
1155
- if ((BUILD12.shadowDom || BUILD12.scoped) && BUILD12.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1156
- elm["s-sc"] = scopeId2;
1157
- elm.classList.add(scopeId2 + "-h");
1158
- }
1159
- endAttachStyles();
1160
- };
1161
- var getScopeId = (cmp, mode) => "sc-" + (BUILD12.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1162
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1163
- var hydrateScopedToShadow = () => {
1164
- if (!win.document) {
1165
- return;
1166
- }
1167
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1168
- let i2 = 0;
1169
- for (; i2 < styles2.length; i2++) {
1170
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1171
- }
1172
- };
1173
-
1174
- // src/runtime/vdom/h.ts
1175
- import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
1176
-
1177
- // src/utils/helpers.ts
1178
- var isDef = (v) => v != null && v !== void 0;
1179
- var isComplexType = (o) => {
1180
- o = typeof o;
1181
- return o === "object" || o === "function";
1182
- };
1183
-
1184
- // src/runtime/vdom/h.ts
1185
- var h = (nodeName, vnodeData, ...children) => {
1186
- if (typeof nodeName === "string") {
1187
- nodeName = transformTag(nodeName);
1188
- }
1189
- let child = null;
1190
- let key = null;
1191
- let slotName = null;
1192
- let simple = false;
1193
- let lastSimple = false;
1194
- const vNodeChildren = [];
1195
- const walk = (c) => {
1196
- for (let i2 = 0; i2 < c.length; i2++) {
1197
- child = c[i2];
1198
- if (Array.isArray(child)) {
1199
- walk(child);
1200
- } else if (child != null && typeof child !== "boolean") {
1201
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1202
- child = String(child);
1203
- } else if (BUILD13.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1204
- consoleDevError(`vNode passed as children has unexpected type.
1205
- Make sure it's using the correct h() function.
1206
- Empty objects can also be the cause, look for JSX comments that became objects.`);
1207
- }
1208
- if (simple && lastSimple) {
1209
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
1210
- } else {
1211
- vNodeChildren.push(simple ? newVNode(null, child) : child);
1212
- }
1213
- lastSimple = simple;
1214
- }
1215
- }
1216
- };
1217
- walk(children);
1218
- if (vnodeData) {
1219
- if (BUILD13.isDev && nodeName === "input") {
1220
- validateInputProperties(vnodeData);
1221
- }
1222
- if (BUILD13.vdomKey && vnodeData.key) {
1223
- key = vnodeData.key;
1224
- }
1225
- if (BUILD13.slotRelocation && vnodeData.name) {
1226
- slotName = vnodeData.name;
1227
- }
1228
- if (BUILD13.vdomClass) {
1229
- const classData = vnodeData.className || vnodeData.class;
1230
- if (classData) {
1231
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1232
- }
1233
- }
1234
- }
1235
- if (BUILD13.isDev && vNodeChildren.some(isHost)) {
1236
- consoleDevError(`The <Host> must be the single root component. Make sure:
1237
- - You are NOT using hostData() and <Host> in the same component.
1238
- - <Host> is used once, and it's the single root component of the render() function.`);
1239
- }
1240
- if (BUILD13.vdomFunctional && typeof nodeName === "function") {
1241
- return nodeName(
1242
- vnodeData === null ? {} : vnodeData,
1243
- vNodeChildren,
1244
- vdomFnUtils
1245
- );
1246
- }
1247
- const vnode = newVNode(nodeName, null);
1248
- vnode.$attrs$ = vnodeData;
1249
- if (vNodeChildren.length > 0) {
1250
- vnode.$children$ = vNodeChildren;
1251
- }
1252
- if (BUILD13.vdomKey) {
1253
- vnode.$key$ = key;
1254
- }
1255
- if (BUILD13.slotRelocation) {
1256
- vnode.$name$ = slotName;
1257
- }
1258
- return vnode;
1259
- };
1260
- var newVNode = (tag, text) => {
1261
- const vnode = {
1262
- $flags$: 0,
1263
- $tag$: tag,
1264
- // Normalize undefined to null to prevent rendering "undefined" as text
1265
- $text$: text != null ? text : null,
1266
- $elm$: null,
1267
- $children$: null
1268
- };
1269
- if (BUILD13.vdomAttribute) {
1270
- vnode.$attrs$ = null;
1271
- }
1272
- if (BUILD13.vdomKey) {
1273
- vnode.$key$ = null;
1274
- }
1275
- if (BUILD13.slotRelocation) {
1276
- vnode.$name$ = null;
1277
- }
1278
- return vnode;
1279
- };
1280
- var Host = {};
1281
- var isHost = (node) => node && node.$tag$ === Host;
1282
- var vdomFnUtils = {
1283
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
1284
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
1285
- };
1286
- var convertToPublic = (node) => ({
1287
- vattrs: node.$attrs$,
1288
- vchildren: node.$children$,
1289
- vkey: node.$key$,
1290
- vname: node.$name$,
1291
- vtag: node.$tag$,
1292
- vtext: node.$text$
1293
- });
1294
- var convertToPrivate = (node) => {
1295
- if (typeof node.vtag === "function") {
1296
- const vnodeData = { ...node.vattrs };
1297
- if (node.vkey) {
1298
- vnodeData.key = node.vkey;
1299
- }
1300
- if (node.vname) {
1301
- vnodeData.name = node.vname;
1302
- }
1303
- return h(node.vtag, vnodeData, ...node.vchildren || []);
1304
- }
1305
- const vnode = newVNode(node.vtag, node.vtext);
1306
- vnode.$attrs$ = node.vattrs;
1307
- vnode.$children$ = node.vchildren;
1308
- vnode.$key$ = node.vkey;
1309
- vnode.$name$ = node.vname;
1310
- return vnode;
1311
- };
1312
- var validateInputProperties = (inputElm) => {
1313
- const props = Object.keys(inputElm);
1314
- const value = props.indexOf("value");
1315
- if (value === -1) {
1316
- return;
1317
- }
1318
- const typeIndex = props.indexOf("type");
1319
- const minIndex = props.indexOf("min");
1320
- const maxIndex = props.indexOf("max");
1321
- const stepIndex = props.indexOf("step");
1322
- if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
1323
- consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
1324
- }
1325
- };
1326
-
1327
- // src/runtime/client-hydrate.ts
1328
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1329
- var _a, _b, _c, _d;
1330
- const endHydrate = createTime("hydrateClient", tagName);
1331
- const shadowRoot = hostElm.shadowRoot;
1332
- const childRenderNodes = [];
1333
- const slotNodes = [];
1334
- const slottedNodes = [];
1335
- const shadowRootNodes = BUILD14.shadowDom && shadowRoot ? [] : null;
1336
- const vnode = newVNode(tagName, null);
1337
- vnode.$elm$ = hostElm;
1338
- let scopeId2;
1339
- if (BUILD14.scoped) {
1340
- const cmpMeta = hostRef.$cmpMeta$;
1341
- if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1342
- scopeId2 = hostElm["s-sc"];
1343
- hostElm.classList.add(scopeId2 + "-h");
1344
- } else if (hostElm["s-sc"]) {
1345
- delete hostElm["s-sc"];
1346
- }
1347
- }
1348
- if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
1349
- initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1350
- }
1351
- hostElm[HYDRATE_ID] = hostId;
1352
- hostElm.removeAttribute(HYDRATE_ID);
1353
- hostRef.$vnode$ = clientHydrate(
1354
- vnode,
1355
- childRenderNodes,
1356
- slotNodes,
1357
- shadowRootNodes,
1358
- hostElm,
1359
- hostElm,
1360
- hostId,
1361
- slottedNodes
1362
- );
1363
- let crIndex = 0;
1364
- const crLength = childRenderNodes.length;
1365
- let childRenderNode;
1366
- for (crIndex; crIndex < crLength; crIndex++) {
1367
- childRenderNode = childRenderNodes[crIndex];
1368
- const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1369
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1370
- const node = childRenderNode.$elm$;
1371
- if (!shadowRoot) {
1372
- node["s-hn"] = transformTag(tagName).toUpperCase();
1373
- if (childRenderNode.$tag$ === "slot") {
1374
- node["s-cr"] = hostElm["s-cr"];
1375
- }
1376
- } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
1377
- const cmpMeta = getHostRef(childRenderNode.$elm$);
1378
- if (cmpMeta) {
1379
- const scopeId3 = getScopeId(
1380
- cmpMeta.$cmpMeta$,
1381
- BUILD14.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1382
- );
1383
- const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1384
- if (styleSheet) {
1385
- shadowRootNodes.unshift(styleSheet.cloneNode(true));
1386
- }
1387
- }
1388
- }
1389
- if (childRenderNode.$tag$ === "slot") {
1390
- childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
1391
- if (childRenderNode.$children$) {
1392
- childRenderNode.$flags$ |= 2 /* isSlotFallback */;
1393
- if (!childRenderNode.$elm$.childNodes.length) {
1394
- childRenderNode.$children$.forEach((c) => {
1395
- childRenderNode.$elm$.appendChild(c.$elm$);
1396
- });
1397
- }
1398
- } else {
1399
- childRenderNode.$flags$ |= 1 /* isSlotReference */;
1400
- }
1401
- }
1402
- if (orgLocationNode && orgLocationNode.isConnected) {
1403
- if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1404
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1405
- }
1406
- orgLocationNode.parentNode.removeChild(orgLocationNode);
1407
- if (!shadowRoot) {
1408
- node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1409
- }
1410
- }
1411
- if (orgLocationNode && !orgLocationNode["s-id"]) {
1412
- plt.$orgLocNodes$.delete(orgLocationId);
1413
- }
1414
- }
1415
- const hosts = [];
1416
- const snLen = slottedNodes.length;
1417
- let snIndex = 0;
1418
- let slotGroup;
1419
- let snGroupIdx;
1420
- let snGroupLen;
1421
- let slottedItem;
1422
- let currentPos = 0;
1423
- for (snIndex; snIndex < snLen; snIndex++) {
1424
- slotGroup = slottedNodes[snIndex];
1425
- if (!slotGroup || !slotGroup.length) continue;
1426
- snGroupLen = slotGroup.length;
1427
- snGroupIdx = 0;
1428
- for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1429
- slottedItem = slotGroup[snGroupIdx];
1430
- if (!hosts[slottedItem.hostId]) {
1431
- hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1432
- }
1433
- if (!hosts[slottedItem.hostId]) continue;
1434
- const hostEle = hosts[slottedItem.hostId];
1435
- if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1436
- hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
1437
- }
1438
- if (!hostEle.shadowRoot || !shadowRoot) {
1439
- if (!slottedItem.slot["s-cr"]) {
1440
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1441
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1442
- slottedItem.slot["s-cr"] = hostEle;
1443
- } else {
1444
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1445
- }
1446
- }
1447
- addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
1448
- if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
1449
- slottedItem.node.removeAttribute("slot");
1450
- }
1451
- if (BUILD14.experimentalSlotFixes) {
1452
- patchSlottedNode(slottedItem.node);
1453
- }
1454
- }
1455
- currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
1456
- }
1457
- }
1458
- if (BUILD14.scoped && scopeId2 && slotNodes.length) {
1459
- slotNodes.forEach((slot) => {
1460
- slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1461
- });
1462
- }
1463
- if (BUILD14.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1464
- let rnIdex = 0;
1465
- const rnLen = shadowRootNodes.length;
1466
- if (rnLen) {
1467
- for (rnIdex; rnIdex < rnLen; rnIdex++) {
1468
- const node = shadowRootNodes[rnIdex];
1469
- if (node) {
1470
- shadowRoot.appendChild(node);
1471
- }
1472
- }
1473
- Array.from(hostElm.childNodes).forEach((node) => {
1474
- if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1475
- if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1476
- node.removeAttribute("hidden");
1477
- } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
1478
- node.parentNode.removeChild(node);
1479
- }
1480
- }
1481
- });
1482
- }
1483
- }
1484
- hostRef.$hostElement$ = hostElm;
1485
- endHydrate();
1486
- };
1487
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1488
- let childNodeType;
1489
- let childIdSplt;
1490
- let childVNode;
1491
- let i2;
1492
- const scopeId2 = hostElm["s-sc"];
1493
- if (node.nodeType === 1 /* ElementNode */) {
1494
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1495
- if (childNodeType) {
1496
- childIdSplt = childNodeType.split(".");
1497
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1498
- childVNode = createSimpleVNode({
1499
- $flags$: 0,
1500
- $hostId$: childIdSplt[0],
1501
- $nodeId$: childIdSplt[1],
1502
- $depth$: childIdSplt[2],
1503
- $index$: childIdSplt[3],
1504
- $tag$: node.tagName.toLowerCase(),
1505
- $elm$: node,
1506
- // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1507
- // won't try to reconcile them. Classes set on the node will be blown away.
1508
- $attrs$: { class: node.className || "" }
1509
- });
1510
- childRenderNodes.push(childVNode);
1511
- node.removeAttribute(HYDRATE_CHILD_ID);
1512
- if (!parentVNode.$children$) {
1513
- parentVNode.$children$ = [];
1514
- }
1515
- if (BUILD14.scoped && scopeId2 && childIdSplt[0] === hostId) {
1516
- node["s-si"] = scopeId2;
1517
- childVNode.$attrs$.class += " " + scopeId2;
1518
- }
1519
- const slotName = childVNode.$elm$.getAttribute("s-sn");
1520
- if (typeof slotName === "string") {
1521
- if (childVNode.$tag$ === "slot-fb") {
1522
- addSlot(
1523
- slotName,
1524
- childIdSplt[2],
1525
- childVNode,
1526
- node,
1527
- parentVNode,
1528
- childRenderNodes,
1529
- slotNodes,
1530
- shadowRootNodes,
1531
- slottedNodes
1532
- );
1533
- if (BUILD14.scoped && scopeId2) {
1534
- node.classList.add(scopeId2);
1535
- }
1536
- }
1537
- childVNode.$elm$["s-sn"] = slotName;
1538
- childVNode.$elm$.removeAttribute("s-sn");
1539
- }
1540
- if (childVNode.$index$ !== void 0) {
1541
- parentVNode.$children$[childVNode.$index$] = childVNode;
1542
- }
1543
- parentVNode = childVNode;
1544
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1545
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1546
- }
1547
- }
1548
- }
1549
- if (node.shadowRoot) {
1550
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1551
- clientHydrate(
1552
- parentVNode,
1553
- childRenderNodes,
1554
- slotNodes,
1555
- shadowRootNodes,
1556
- hostElm,
1557
- node.shadowRoot.childNodes[i2],
1558
- hostId,
1559
- slottedNodes
1560
- );
1561
- }
1562
- }
1563
- const nonShadowNodes = node.__childNodes || node.childNodes;
1564
- for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1565
- clientHydrate(
1566
- parentVNode,
1567
- childRenderNodes,
1568
- slotNodes,
1569
- shadowRootNodes,
1570
- hostElm,
1571
- nonShadowNodes[i2],
1572
- hostId,
1573
- slottedNodes
1574
- );
1575
- }
1576
- } else if (node.nodeType === 8 /* CommentNode */) {
1577
- childIdSplt = node.nodeValue.split(".");
1578
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1579
- childNodeType = childIdSplt[0];
1580
- childVNode = createSimpleVNode({
1581
- $hostId$: childIdSplt[1],
1582
- $nodeId$: childIdSplt[2],
1583
- $depth$: childIdSplt[3],
1584
- $index$: childIdSplt[4] || "0",
1585
- $elm$: node,
1586
- $attrs$: null,
1587
- $children$: null,
1588
- $key$: null,
1589
- $name$: null,
1590
- $tag$: null,
1591
- $text$: null
1592
- });
1593
- if (childNodeType === TEXT_NODE_ID) {
1594
- childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
1595
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1596
- childVNode.$text$ = childVNode.$elm$.textContent;
1597
- childRenderNodes.push(childVNode);
1598
- node.remove();
1599
- if (hostId === childVNode.$hostId$) {
1600
- if (!parentVNode.$children$) {
1601
- parentVNode.$children$ = [];
1602
- }
1603
- parentVNode.$children$[childVNode.$index$] = childVNode;
1604
- }
1605
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1606
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1607
- }
1608
- }
1609
- } else if (childNodeType === COMMENT_NODE_ID) {
1610
- childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
1611
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1612
- childRenderNodes.push(childVNode);
1613
- node.remove();
1614
- }
1615
- } else if (childVNode.$hostId$ === hostId) {
1616
- if (childNodeType === SLOT_NODE_ID) {
1617
- const slotName = node["s-sn"] = childIdSplt[5] || "";
1618
- addSlot(
1619
- slotName,
1620
- childIdSplt[2],
1621
- childVNode,
1622
- node,
1623
- parentVNode,
1624
- childRenderNodes,
1625
- slotNodes,
1626
- shadowRootNodes,
1627
- slottedNodes
1628
- );
1629
- } else if (childNodeType === CONTENT_REF_ID) {
1630
- if (BUILD14.shadowDom && shadowRootNodes) {
1631
- node.remove();
1632
- } else if (BUILD14.slotRelocation) {
1633
- hostElm["s-cr"] = node;
1634
- node["s-cn"] = true;
1635
- }
1636
- }
1637
- }
1638
- }
1639
- } else if (parentVNode && parentVNode.$tag$ === "style") {
1640
- const vnode = newVNode(null, node.textContent);
1641
- vnode.$elm$ = node;
1642
- vnode.$index$ = "0";
1643
- parentVNode.$children$ = [vnode];
1644
- }
1645
- return parentVNode;
1646
- };
1647
- var initializeDocumentHydrate = (node, orgLocNodes) => {
1648
- if (node.nodeType === 1 /* ElementNode */) {
1649
- const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1650
- if (componentId) {
1651
- orgLocNodes.set(componentId, node);
1652
- }
1653
- let i2 = 0;
1654
- if (node.shadowRoot) {
1655
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1656
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1657
- }
1658
- }
1659
- const nonShadowNodes = node.__childNodes || node.childNodes;
1660
- for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1661
- initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1662
- }
1663
- } else if (node.nodeType === 8 /* CommentNode */) {
1664
- const childIdSplt = node.nodeValue.split(".");
1665
- if (childIdSplt[0] === ORG_LOCATION_ID) {
1666
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1667
- node.nodeValue = "";
1668
- node["s-en"] = childIdSplt[3];
1669
- }
1670
- }
1671
- };
1672
- var createSimpleVNode = (vnode) => {
1673
- const defaultVNode = {
1674
- $flags$: 0,
1675
- $hostId$: null,
1676
- $nodeId$: null,
1677
- $depth$: null,
1678
- $index$: "0",
1679
- $elm$: null,
1680
- $attrs$: null,
1681
- $children$: null,
1682
- $key$: null,
1683
- $name$: null,
1684
- $tag$: null,
1685
- $text$: null
1686
- };
1687
- return { ...defaultVNode, ...vnode };
1688
- };
1689
- function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1690
- node["s-sr"] = true;
1691
- childVNode.$name$ = slotName || null;
1692
- childVNode.$tag$ = "slot";
1693
- const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1694
- if (BUILD14.shadowDom && shadowRootNodes && win.document) {
1695
- const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1696
- if (childVNode.$name$) {
1697
- childVNode.$elm$.setAttribute("name", slotName);
1698
- }
1699
- if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1700
- internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1701
- } else {
1702
- internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1703
- }
1704
- addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1705
- node.remove();
1706
- if (childVNode.$depth$ === "0") {
1707
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1708
- }
1709
- } else {
1710
- const slot = childVNode.$elm$;
1711
- const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1712
- addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1713
- patchSlotNode(node);
1714
- if (shouldMove) {
1715
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1716
- }
1717
- }
1718
- childRenderNodes.push(childVNode);
1719
- slotNodes.push(childVNode);
1720
- if (!parentVNode.$children$) {
1721
- parentVNode.$children$ = [];
1722
- }
1723
- parentVNode.$children$[childVNode.$index$] = childVNode;
1724
- }
1725
- var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1726
- var _a, _b;
1727
- let slottedNode = slotNode.nextSibling;
1728
- slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1729
- if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
1730
- do {
1731
- if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
1732
- slottedNode["s-sn"] = slotName;
1733
- slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1734
- }
1735
- slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
1736
- } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
1737
- };
1738
- var findCorrespondingNode = (node, type) => {
1739
- let sibling = node;
1740
- do {
1741
- sibling = sibling.nextSibling;
1742
- } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
1743
- return sibling;
1744
- };
1745
-
1746
- // src/runtime/initialize-component.ts
1747
- import { BUILD as BUILD24 } from "@stencil/core/internal/app-data";
1748
-
1749
- // src/utils/regular-expression.ts
1750
- var escapeRegExpSpecialCharacters = (text) => {
1751
- return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1752
- };
1753
-
1754
- // src/utils/shadow-css.ts
1755
- /**
1756
- * @license
1757
- * Copyright Google Inc. All Rights Reserved.
1758
- *
1759
- * Use of this source code is governed by an MIT-style license that can be
1760
- * found in the LICENSE file at https://angular.io/license
1761
- *
1762
- * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
1763
- * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
1764
- * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
1765
- */
1766
- var safeSelector = (selector) => {
1767
- const placeholders = [];
1768
- let index = 0;
1769
- selector = selector.replace(/(\[\s*part~=\s*("[^"]*"|'[^']*')\s*\])/g, (_, keep) => {
1770
- const replaceBy = `__part-${index}__`;
1771
- placeholders.push(keep);
1772
- index++;
1773
- return replaceBy;
1774
- });
1775
- selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => {
1776
- const replaceBy = `__ph-${index}__`;
1777
- placeholders.push(keep);
1778
- index++;
1779
- return replaceBy;
1780
- });
1781
- const content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => {
1782
- const replaceBy = `__ph-${index}__`;
1783
- placeholders.push(exp);
1784
- index++;
1785
- return pseudo + replaceBy;
1786
- });
1787
- const ss = {
1788
- content,
1789
- placeholders
1790
- };
1791
- return ss;
1792
- };
1793
- var restoreSafeSelector = (placeholders, content) => {
1794
- content = content.replace(/__part-(\d+)__/g, (_, index) => placeholders[+index]);
1795
- return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]);
1796
- };
1797
- var _polyfillHost = "-shadowcsshost";
1798
- var _polyfillSlotted = "-shadowcssslotted";
1799
- var _polyfillHostContext = "-shadowcsscontext";
1800
- var _parenSuffix = ")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)";
1801
- var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
1802
- var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
1803
- var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
1804
- var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
1805
- var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
1806
- var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
1807
- var _safePartRe = /__part-(\d+)__/g;
1808
- var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
1809
- var _polyfillHostRe = /-shadowcsshost/gim;
1810
- var createSupportsRuleRe = (selector) => {
1811
- const safeSelector2 = escapeRegExpSpecialCharacters(selector);
1812
- return new RegExp(
1813
- // First capture group: match any context before the selector that's not inside @supports selector()
1814
- // Using negative lookahead to avoid matching inside @supports selector(...) condition
1815
- `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
1816
- "g"
1817
- );
1818
- };
1819
- var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
1820
- var stripComments = (input) => {
1821
- return input.replace(_commentRe, "");
1822
- };
1823
- var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
1824
- var extractCommentsWithHash = (input) => {
1825
- return input.match(_commentWithHashRe) || [];
1826
- };
1827
- var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
1828
- var _curlyRe = /([{}])/g;
1829
- var _selectorPartsRe = /(^.*?[^\\])??((:+)(.*)|$)/;
1830
- var OPEN_CURLY = "{";
1831
- var CLOSE_CURLY = "}";
1832
- var BLOCK_PLACEHOLDER = "%BLOCK%";
1833
- var processRules = (input, ruleCallback) => {
1834
- const inputWithEscapedBlocks = escapeBlocks(input);
1835
- let nextBlockIndex = 0;
1836
- return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => {
1837
- const selector = m[2];
1838
- let content = "";
1839
- let suffix = m[4];
1840
- let contentPrefix = "";
1841
- if (suffix && suffix.startsWith("{" + BLOCK_PLACEHOLDER)) {
1842
- content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
1843
- suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
1844
- contentPrefix = "{";
1845
- }
1846
- const cssRule = {
1847
- selector,
1848
- content
1849
- };
1850
- const rule = ruleCallback(cssRule);
1851
- return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`;
1852
- });
1853
- };
1854
- var escapeBlocks = (input) => {
1855
- const inputParts = input.split(_curlyRe);
1856
- const resultParts = [];
1857
- const escapedBlocks = [];
1858
- let bracketCount = 0;
1859
- let currentBlockParts = [];
1860
- for (let partIndex = 0; partIndex < inputParts.length; partIndex++) {
1861
- const part = inputParts[partIndex];
1862
- if (part === CLOSE_CURLY) {
1863
- bracketCount--;
1864
- }
1865
- if (bracketCount > 0) {
1866
- currentBlockParts.push(part);
1867
- } else {
1868
- if (currentBlockParts.length > 0) {
1869
- escapedBlocks.push(currentBlockParts.join(""));
1870
- resultParts.push(BLOCK_PLACEHOLDER);
1871
- currentBlockParts = [];
1872
- }
1873
- resultParts.push(part);
1874
- }
1875
- if (part === OPEN_CURLY) {
1876
- bracketCount++;
1877
- }
1878
- }
1879
- if (currentBlockParts.length > 0) {
1880
- escapedBlocks.push(currentBlockParts.join(""));
1881
- resultParts.push(BLOCK_PLACEHOLDER);
1882
- }
1883
- const strEscapedBlocks = {
1884
- escapedString: resultParts.join(""),
1885
- blocks: escapedBlocks
1886
- };
1887
- return strEscapedBlocks;
1888
- };
1889
- var insertPolyfillHostInCssText = (cssText) => {
1890
- const supportsBlocks = [];
1891
- cssText = cssText.replace(/@supports\s+selector\s*\(\s*([^)]*)\s*\)/g, (_, selectorContent) => {
1892
- const placeholder = `__supports_${supportsBlocks.length}__`;
1893
- supportsBlocks.push(selectorContent);
1894
- return `@supports selector(${placeholder})`;
1895
- });
1896
- const _colonSlottedRe = createSupportsRuleRe("::slotted");
1897
- const _colonHostRe = createSupportsRuleRe(":host");
1898
- const _colonHostContextRe = createSupportsRuleRe(":host-context");
1899
- cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
1900
- supportsBlocks.forEach((originalSelector, index) => {
1901
- cssText = cssText.replace(`__supports_${index}__`, originalSelector);
1902
- });
1903
- return cssText;
1904
- };
1905
- var convertColonRule = (cssText, regExp, partReplacer) => {
1906
- return cssText.replace(regExp, (...m) => {
1907
- if (m[2]) {
1908
- const parts = m[2].split(",");
1909
- const r = [];
1910
- for (let i2 = 0; i2 < parts.length; i2++) {
1911
- const p = parts[i2].trim();
1912
- if (!p) break;
1913
- r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
1914
- }
1915
- return r.join(",");
1916
- } else {
1917
- return _polyfillHostNoCombinator + m[3];
1918
- }
1919
- });
1920
- };
1921
- var colonHostPartReplacer = (host, part, suffix) => {
1922
- return host + part.replace(_polyfillHost, "") + suffix;
1923
- };
1924
- var convertColonHost = (cssText) => {
1925
- return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer);
1926
- };
1927
- var colonHostContextPartReplacer = (host, part, suffix) => {
1928
- if (part.indexOf(_polyfillHost) > -1) {
1929
- return colonHostPartReplacer(host, part, suffix);
1930
- } else {
1931
- return host + part + suffix + ", " + part + " " + host + suffix;
1932
- }
1933
- };
1934
- var convertColonSlotted = (cssText, slotScopeId) => {
1935
- const slotClass = "." + slotScopeId + " > ";
1936
- const selectors = [];
1937
- cssText = cssText.replace(_cssColonSlottedRe, (...m) => {
1938
- if (m[2]) {
1939
- const compound = m[2].trim();
1940
- const suffix = m[3];
1941
- const slottedSelector = slotClass + compound + suffix;
1942
- let prefixSelector = "";
1943
- for (let i2 = m[4] - 1; i2 >= 0; i2--) {
1944
- const char = m[5][i2];
1945
- if (char === "}" || char === ",") {
1946
- break;
1947
- }
1948
- prefixSelector = char + prefixSelector;
1949
- }
1950
- const orgSelector = (prefixSelector + slottedSelector).trim();
1951
- const addedSelector = `${prefixSelector.trimEnd()}${slottedSelector.trim()}`.trim();
1952
- if (orgSelector !== addedSelector) {
1953
- const updatedSelector = `${addedSelector}, ${orgSelector}`;
1954
- selectors.push({
1955
- orgSelector,
1956
- updatedSelector
1957
- });
1958
- }
1959
- return slottedSelector;
1960
- } else {
1961
- return _polyfillHostNoCombinator + m[3];
1962
- }
1963
- });
1964
- return {
1965
- selectors,
1966
- cssText
1967
- };
1968
- };
1969
- var convertColonHostContext = (cssText) => {
1970
- return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer);
1971
- };
1972
- var convertShadowDOMSelectors = (cssText) => {
1973
- return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, " "), cssText);
1974
- };
1975
- var makeScopeMatcher = (scopeSelector2) => {
1976
- const lre = /\[/g;
1977
- const rre = /\]/g;
1978
- scopeSelector2 = scopeSelector2.replace(lre, "\\[").replace(rre, "\\]");
1979
- return new RegExp("^(" + scopeSelector2 + ")" + _selectorReSuffix, "m");
1980
- };
1981
- var selectorNeedsScoping = (selector, scopeSelector2) => {
1982
- const re = makeScopeMatcher(scopeSelector2);
1983
- return !re.test(selector);
1984
- };
1985
- var injectScopingSelector = (selector, scopingSelector) => {
1986
- return selector.replace(_selectorPartsRe, (_, before = "", _colonGroup, colon = "", after = "") => {
1987
- return before + scopingSelector + colon + after;
1988
- });
1989
- };
1990
- var applySimpleSelectorScope = (selector, scopeSelector2, hostSelector) => {
1991
- _polyfillHostRe.lastIndex = 0;
1992
- if (_polyfillHostRe.test(selector)) {
1993
- const replaceBy = `.${hostSelector}`;
1994
- return selector.replace(_polyfillHostNoCombinatorRe, (_, selector2) => injectScopingSelector(selector2, replaceBy)).replace(_polyfillHostRe, replaceBy + " ");
1995
- }
1996
- return scopeSelector2 + " " + selector;
1997
- };
1998
- var applyStrictSelectorScope = (selector, scopeSelector2, hostSelector) => {
1999
- const isRe = /\[is=([^\]]*)\]/g;
2000
- scopeSelector2 = scopeSelector2.replace(isRe, (_, ...parts) => parts[0]);
2001
- const className = "." + scopeSelector2;
2002
- const _scopeSelectorPart = (p) => {
2003
- let scopedP = p.trim();
2004
- if (!scopedP) {
2005
- return "";
2006
- }
2007
- if (p.indexOf(_polyfillHostNoCombinator) > -1) {
2008
- scopedP = applySimpleSelectorScope(p, scopeSelector2, hostSelector);
2009
- } else {
2010
- const t = p.replace(_polyfillHostRe, "");
2011
- if (t.length > 0) {
2012
- scopedP = injectScopingSelector(t, className);
2013
- }
2014
- }
2015
- return scopedP;
2016
- };
2017
- const safeContent = safeSelector(selector);
2018
- selector = safeContent.content;
2019
- let scopedSelector = "";
2020
- let startIndex = 0;
2021
- let res;
2022
- const sep = /( |>|\+|~(?!=))(?=(?:[^()]*\([^()]*\))*[^()]*$)\s*/g;
2023
- const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
2024
- let shouldScope = !hasHost;
2025
- while ((res = sep.exec(selector)) !== null) {
2026
- const separator = res[1];
2027
- const part2 = selector.slice(startIndex, res.index).trim();
2028
- shouldScope = shouldScope || part2.indexOf(_polyfillHostNoCombinator) > -1;
2029
- const scopedPart = shouldScope ? _scopeSelectorPart(part2) : part2;
2030
- scopedSelector += `${scopedPart} ${separator} `;
2031
- startIndex = sep.lastIndex;
2032
- }
2033
- const part = selector.substring(startIndex);
2034
- shouldScope = !part.match(_safePartRe) && (shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1);
2035
- scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
2036
- return restoreSafeSelector(safeContent.placeholders, scopedSelector);
2037
- };
2038
- var scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => {
2039
- return selector.split(",").map((shallowPart) => {
2040
- if (slotSelector && shallowPart.indexOf("." + slotSelector) > -1) {
2041
- return shallowPart.trim();
2042
- }
2043
- if (selectorNeedsScoping(shallowPart, scopeSelectorText)) {
2044
- return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim();
2045
- } else {
2046
- return shallowPart.trim();
2047
- }
2048
- }).join(", ");
2049
- };
2050
- var scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => {
2051
- return processRules(cssText, (rule) => {
2052
- let selector = rule.selector;
2053
- let content = rule.content;
2054
- if (rule.selector[0] !== "@") {
2055
- selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector);
2056
- } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
2057
- content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector);
2058
- }
2059
- const cssRule = {
2060
- selector: selector.replace(/\s{2,}/g, " ").trim(),
2061
- content
2062
- };
2063
- return cssRule;
2064
- });
2065
- };
2066
- var scopeCssText = (cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector) => {
2067
- cssText = insertPolyfillHostInCssText(cssText);
2068
- cssText = convertColonHost(cssText);
2069
- cssText = convertColonHostContext(cssText);
2070
- const slotted = convertColonSlotted(cssText, slotScopeId);
2071
- cssText = slotted.cssText;
2072
- cssText = convertShadowDOMSelectors(cssText);
2073
- if (scopeId2) {
2074
- cssText = scopeSelectors(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
2075
- }
2076
- cssText = replaceShadowCssHost(cssText, hostScopeId);
2077
- cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, " $1 ");
2078
- return {
2079
- cssText: cssText.trim(),
2080
- // We need to replace the shadow CSS host string in each of these selectors since we created
2081
- // them prior to the replacement happening in the components CSS text.
2082
- slottedSelectors: slotted.selectors.map((ref) => ({
2083
- orgSelector: replaceShadowCssHost(ref.orgSelector, hostScopeId),
2084
- updatedSelector: replaceShadowCssHost(ref.updatedSelector, hostScopeId)
2085
- }))
2086
- };
2087
- };
2088
- var replaceShadowCssHost = (cssText, hostScopeId) => {
2089
- return cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`);
2090
- };
2091
- var expandPartSelectors = (cssText) => {
2092
- const partSelectorRe = /([^\s,{][^,{]*?)::part\(\s*([^)]+?)\s*\)((?:[:.][^,{]*)*)/g;
2093
- return processRules(cssText, (rule) => {
2094
- if (rule.selector[0] === "@") {
2095
- return rule;
2096
- }
2097
- const selectors = rule.selector.split(",").map((sel) => {
2098
- const out = [sel.trim()];
2099
- let m;
2100
- while ((m = partSelectorRe.exec(sel)) !== null) {
2101
- const before = m[1].trimEnd();
2102
- const partNames = m[2].trim().split(/\s+/);
2103
- const after = m[3] || "";
2104
- const partAttr = partNames.flatMap((p) => {
2105
- if (!rule.selector.includes(`[part~="${p}"]`)) {
2106
- return [`[part~="${p}"]`];
2107
- }
2108
- return [];
2109
- }).join("");
2110
- const expanded = `${before} ${partAttr}${after}`;
2111
- if (!!partAttr && expanded !== sel.trim()) {
2112
- out.push(expanded);
2113
- }
2114
- }
2115
- return out.join(", ");
2116
- });
2117
- rule.selector = selectors.join(", ");
2118
- return rule;
2119
- });
2120
- };
2121
- var scopeCss = (cssText, scopeId2, commentOriginalSelector) => {
2122
- const hostScopeId = scopeId2 + "-h";
2123
- const slotScopeId = scopeId2 + "-s";
2124
- const commentsWithHash = extractCommentsWithHash(cssText);
2125
- cssText = stripComments(cssText);
2126
- const orgSelectors = [];
2127
- if (commentOriginalSelector) {
2128
- const processCommentedSelector = (rule) => {
2129
- const placeholder = `/*!@___${orgSelectors.length}___*/`;
2130
- const comment = `/*!@${rule.selector}*/`;
2131
- orgSelectors.push({ placeholder, comment });
2132
- rule.selector = placeholder + rule.selector;
2133
- return rule;
2134
- };
2135
- cssText = processRules(cssText, (rule) => {
2136
- if (rule.selector[0] !== "@") {
2137
- return processCommentedSelector(rule);
2138
- } else if (rule.selector.startsWith("@media") || rule.selector.startsWith("@supports") || rule.selector.startsWith("@page") || rule.selector.startsWith("@document")) {
2139
- rule.content = processRules(rule.content, processCommentedSelector);
2140
- return rule;
2141
- }
2142
- return rule;
2143
- });
2144
- }
2145
- const scoped = scopeCssText(cssText, scopeId2, hostScopeId, slotScopeId, commentOriginalSelector);
2146
- cssText = [scoped.cssText, ...commentsWithHash].join("\n");
2147
- if (commentOriginalSelector) {
2148
- orgSelectors.forEach(({ placeholder, comment }) => {
2149
- cssText = cssText.replace(placeholder, comment);
2150
- });
2151
- }
2152
- scoped.slottedSelectors.forEach((slottedSelector) => {
2153
- const regex = new RegExp(escapeRegExpSpecialCharacters(slottedSelector.orgSelector) + "(?=\\s*[,{]|$)", "g");
2154
- cssText = cssText.replace(regex, slottedSelector.updatedSelector);
2155
- });
2156
- cssText = expandPartSelectors(cssText);
2157
- return cssText;
2158
- };
2159
-
2160
- // src/runtime/mode.ts
2161
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
2162
- var setMode = (handler) => modeResolutionChain.push(handler);
2163
- var getMode = (ref) => {
2164
- var _a;
2165
- return (_a = getHostRef(ref)) == null ? void 0 : _a.$modeName$;
2166
- };
2167
-
2168
- // src/runtime/proxy-component.ts
2169
- import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
2170
-
2171
- // src/runtime/set-value.ts
2172
- import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
2173
-
2174
- // src/runtime/parse-property-value.ts
2175
- import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
2176
-
2177
- // src/utils/remote-value.ts
2178
- var RemoteValue = class _RemoteValue {
2179
- /**
2180
- * Deserializes a LocalValue serialized object back to its original JavaScript representation
2181
- *
2182
- * @param serialized The serialized LocalValue object
2183
- * @returns The original JavaScript value/object
2184
- */
2185
- static fromLocalValue(serialized) {
2186
- const type = serialized[TYPE_CONSTANT];
2187
- const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
2188
- switch (type) {
2189
- case "string" /* String */:
2190
- return value;
2191
- case "boolean" /* Boolean */:
2192
- return value;
2193
- case "bigint" /* BigInt */:
2194
- return BigInt(value);
2195
- case "undefined" /* Undefined */:
2196
- return void 0;
2197
- case "null" /* Null */:
2198
- return null;
2199
- case "number" /* Number */:
2200
- if (value === "NaN") return NaN;
2201
- if (value === "-0") return -0;
2202
- if (value === "Infinity") return Infinity;
2203
- if (value === "-Infinity") return -Infinity;
2204
- return value;
2205
- case "array" /* Array */:
2206
- return value.map((item) => _RemoteValue.fromLocalValue(item));
2207
- case "date" /* Date */:
2208
- return new Date(value);
2209
- case "map" /* Map */:
2210
- const map = /* @__PURE__ */ new Map();
2211
- for (const [key, val] of value) {
2212
- const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
2213
- const deserializedValue = _RemoteValue.fromLocalValue(val);
2214
- map.set(deserializedKey, deserializedValue);
2215
- }
2216
- return map;
2217
- case "object" /* Object */:
2218
- const obj = {};
2219
- for (const [key, val] of value) {
2220
- obj[key] = _RemoteValue.fromLocalValue(val);
2221
- }
2222
- return obj;
2223
- case "regexp" /* RegularExpression */:
2224
- const { pattern, flags } = value;
2225
- return new RegExp(pattern, flags);
2226
- case "set" /* Set */:
2227
- const set = /* @__PURE__ */ new Set();
2228
- for (const item of value) {
2229
- set.add(_RemoteValue.fromLocalValue(item));
2230
- }
2231
- return set;
2232
- case "symbol" /* Symbol */:
2233
- return Symbol(value);
2234
- default:
2235
- throw new Error(`Unsupported type: ${type}`);
2236
- }
2237
- }
2238
- /**
2239
- * Utility method to deserialize multiple LocalValues at once
2240
- *
2241
- * @param serializedValues Array of serialized LocalValue objects
2242
- * @returns Array of deserialized JavaScript values
2243
- */
2244
- static fromLocalValueArray(serializedValues) {
2245
- return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
2246
- }
2247
- /**
2248
- * Verifies if the given object matches the structure of a serialized LocalValue
2249
- *
2250
- * @param obj Object to verify
2251
- * @returns boolean indicating if the object has LocalValue structure
2252
- */
2253
- static isLocalValueObject(obj) {
2254
- if (typeof obj !== "object" || obj === null) {
2255
- return false;
2256
- }
2257
- if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
2258
- return false;
2259
- }
2260
- const type = obj[TYPE_CONSTANT];
2261
- const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
2262
- if (!hasTypeProperty) {
2263
- return false;
2264
- }
2265
- if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
2266
- return obj.hasOwnProperty(VALUE_CONSTANT);
2267
- }
2268
- return true;
2269
- }
2270
- };
2271
-
2272
- // src/utils/serialize.ts
2273
- function deserializeProperty(value) {
2274
- if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
2275
- return value;
2276
- }
2277
- return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
2278
- }
2279
-
2280
- // src/runtime/parse-property-value.ts
2281
- var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2282
- if ((BUILD15.hydrateClientSide || BUILD15.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2283
- propValue = deserializeProperty(propValue);
2284
- return propValue;
2285
- }
2286
- if (propValue != null && !isComplexType(propValue)) {
2287
- if (BUILD15.propBoolean && propType & 4 /* Boolean */) {
2288
- if (BUILD15.formAssociated && isFormAssociated && typeof propValue === "string") {
2289
- return propValue === "" || !!propValue;
2290
- } else {
2291
- return propValue === "false" ? false : propValue === "" || !!propValue;
2292
- }
2293
- }
2294
- if (BUILD15.propNumber && propType & 2 /* Number */) {
2295
- return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2296
- }
2297
- if (BUILD15.propString && propType & 1 /* String */) {
2298
- return String(propValue);
2299
- }
2300
- return propValue;
2301
- }
2302
- return propValue;
2303
- };
2304
-
2305
- // src/runtime/update-component.ts
2306
- import { BUILD as BUILD21, NAMESPACE } from "@stencil/core/internal/app-data";
2307
-
2308
- // src/runtime/event-emitter.ts
2309
- import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2310
-
2311
- // src/runtime/element.ts
2312
- import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
2313
- var getElement = (ref) => {
2314
- var _a;
2315
- return BUILD16.lazyLoad ? (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ : ref;
2316
- };
2317
-
2318
- // src/runtime/event-emitter.ts
2319
- var createEvent = (ref, name, flags) => {
2320
- const elm = getElement(ref);
2321
- return {
2322
- emit: (detail) => {
2323
- if (BUILD17.isDev && !elm.isConnected) {
2324
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2325
- }
2326
- return emitEvent(elm, name, {
2327
- bubbles: !!(flags & 4 /* Bubbles */),
2328
- composed: !!(flags & 2 /* Composed */),
2329
- cancelable: !!(flags & 1 /* Cancellable */),
2330
- detail
2331
- });
2332
- }
2333
- };
2334
- };
2335
- var emitEvent = (elm, name, opts) => {
2336
- const ev = plt.ce(name, opts);
2337
- elm.dispatchEvent(ev);
2338
- return ev;
2339
- };
2340
-
2341
- // src/runtime/vdom/vdom-render.ts
2342
- import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
2343
-
2344
- // src/runtime/vdom/update-element.ts
2345
- import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
2346
-
2347
- // src/runtime/vdom/set-accessor.ts
2348
- import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
2349
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
2350
- if (oldValue === newValue) {
2351
- return;
2352
- }
2353
- let isProp = isMemberInElement(elm, memberName);
2354
- let ln = memberName.toLowerCase();
2355
- if (BUILD18.vdomClass && memberName === "class") {
2356
- const classList = elm.classList;
2357
- const oldClasses = parseClassList(oldValue);
2358
- let newClasses = parseClassList(newValue);
2359
- if (BUILD18.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2360
- const scopeId2 = elm["s-sc"] || elm["s-si"];
2361
- newClasses.push(scopeId2);
2362
- oldClasses.forEach((c) => {
2363
- if (c.startsWith(scopeId2)) newClasses.push(c);
2364
- });
2365
- newClasses = [...new Set(newClasses)].filter((c) => c);
2366
- classList.add(...newClasses);
2367
- } else {
2368
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
2369
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
2370
- }
2371
- } else if (BUILD18.vdomStyle && memberName === "style") {
2372
- if (BUILD18.updatable) {
2373
- for (const prop in oldValue) {
2374
- if (!newValue || newValue[prop] == null) {
2375
- if (!BUILD18.hydrateServerSide && prop.includes("-")) {
2376
- elm.style.removeProperty(prop);
2377
- } else {
2378
- elm.style[prop] = "";
2379
- }
2380
- }
2381
- }
2382
- }
2383
- for (const prop in newValue) {
2384
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
2385
- if (!BUILD18.hydrateServerSide && prop.includes("-")) {
2386
- elm.style.setProperty(prop, newValue[prop]);
2387
- } else {
2388
- elm.style[prop] = newValue[prop];
2389
- }
2390
- }
2391
- }
2392
- } else if (BUILD18.vdomKey && memberName === "key") {
2393
- } else if (BUILD18.vdomRef && memberName === "ref") {
2394
- if (newValue) {
2395
- queueRefAttachment(newValue, elm);
2396
- }
2397
- } else if (BUILD18.vdomListener && (BUILD18.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
2398
- if (memberName[2] === "-") {
2399
- memberName = memberName.slice(3);
2400
- } else if (isMemberInElement(win, ln)) {
2401
- memberName = ln.slice(2);
2402
- } else {
2403
- memberName = ln[2] + memberName.slice(3);
2404
- }
2405
- if (oldValue || newValue) {
2406
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
2407
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
2408
- if (oldValue) {
2409
- plt.rel(elm, memberName, oldValue, capture);
2410
- }
2411
- if (newValue) {
2412
- plt.ael(elm, memberName, newValue, capture);
2413
- }
2414
- }
2415
- } else if (BUILD18.vdomPropOrAttr && memberName[0] === "a" && memberName.startsWith("attr:")) {
2416
- const propName = memberName.slice(5);
2417
- let attrName;
2418
- if (BUILD18.member) {
2419
- const hostRef = getHostRef(elm);
2420
- if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
2421
- const memberMeta = hostRef.$cmpMeta$.$members$[propName];
2422
- if (memberMeta && memberMeta[1]) {
2423
- attrName = memberMeta[1];
2424
- }
2425
- }
2426
- }
2427
- if (!attrName) {
2428
- attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2429
- }
2430
- if (newValue == null || newValue === false) {
2431
- if (newValue !== false || elm.getAttribute(attrName) === "") {
2432
- elm.removeAttribute(attrName);
2433
- }
2434
- } else {
2435
- elm.setAttribute(attrName, newValue === true ? "" : newValue);
2436
- }
2437
- return;
2438
- } else if (BUILD18.vdomPropOrAttr && memberName[0] === "p" && memberName.startsWith("prop:")) {
2439
- const propName = memberName.slice(5);
2440
- try {
2441
- elm[propName] = newValue;
2442
- } catch (e) {
2443
- }
2444
- return;
2445
- } else if (BUILD18.vdomPropOrAttr) {
2446
- const isComplex = isComplexType(newValue);
2447
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
2448
- try {
2449
- if (!elm.tagName.includes("-")) {
2450
- const n = newValue == null ? "" : newValue;
2451
- if (memberName === "list") {
2452
- isProp = false;
2453
- } else if (oldValue == null || elm[memberName] !== n) {
2454
- if (typeof elm.__lookupSetter__(memberName) === "function") {
2455
- elm[memberName] = n;
2456
- } else {
2457
- elm.setAttribute(memberName, n);
2458
- }
2459
- }
2460
- } else if (elm[memberName] !== newValue) {
2461
- elm[memberName] = newValue;
2462
- }
2463
- } catch (e) {
2464
- }
2465
- }
2466
- let xlink = false;
2467
- if (BUILD18.vdomXlink) {
2468
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
2469
- memberName = ln;
2470
- xlink = true;
2471
- }
2472
- }
2473
- if (newValue == null || newValue === false) {
2474
- if (newValue !== false || elm.getAttribute(memberName) === "") {
2475
- if (BUILD18.vdomXlink && xlink) {
2476
- elm.removeAttributeNS(XLINK_NS, memberName);
2477
- } else {
2478
- elm.removeAttribute(memberName);
2479
- }
2480
- }
2481
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
2482
- newValue = newValue === true ? "" : newValue;
2483
- if (BUILD18.vdomXlink && xlink) {
2484
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
2485
- } else {
2486
- elm.setAttribute(memberName, newValue);
2487
- }
2488
- }
2489
- }
2490
- };
2491
- var parseClassListRegex = /\s/;
2492
- var parseClassList = (value) => {
2493
- if (typeof value === "object" && value && "baseVal" in value) {
2494
- value = value.baseVal;
2495
- }
2496
- if (!value || typeof value !== "string") {
2497
- return [];
2498
- }
2499
- return value.split(parseClassListRegex);
2500
- };
2501
- var CAPTURE_EVENT_SUFFIX = "Capture";
2502
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
2503
-
2504
- // src/runtime/vdom/update-element.ts
2505
- var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
2506
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
2507
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
2508
- const newVnodeAttrs = newVnode.$attrs$ || {};
2509
- if (BUILD19.updatable) {
2510
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
2511
- if (!(memberName in newVnodeAttrs)) {
2512
- setAccessor(
2513
- elm,
2514
- memberName,
2515
- oldVnodeAttrs[memberName],
2516
- void 0,
2517
- isSvgMode2,
2518
- newVnode.$flags$,
2519
- isInitialRender
2520
- );
2521
- }
2522
- }
2523
- }
2524
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
2525
- setAccessor(
2526
- elm,
2527
- memberName,
2528
- oldVnodeAttrs[memberName],
2529
- newVnodeAttrs[memberName],
2530
- isSvgMode2,
2531
- newVnode.$flags$,
2532
- isInitialRender
2533
- );
2534
- }
2535
- };
2536
- function sortedAttrNames(attrNames) {
2537
- return attrNames.includes("ref") ? (
2538
- // we need to sort these to ensure that `'ref'` is the last attr
2539
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
2540
- ) : (
2541
- // no need to sort, return the original array
2542
- attrNames
2543
- );
2544
- }
2545
-
2546
- // src/runtime/vdom/vdom-render.ts
2547
- var scopeId;
2548
- var contentRef;
2549
- var hostTagName;
2550
- var useNativeShadowDom = false;
2551
- var checkSlotFallbackVisibility = false;
2552
- var checkSlotRelocate = false;
2553
- var isSvgMode = false;
2554
- var refCallbacksToRemove = [];
2555
- var refCallbacksToAttach = [];
2556
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2557
- var _a;
2558
- const newVNode2 = newParentVNode.$children$[childIndex];
2559
- let i2 = 0;
2560
- let elm;
2561
- let childNode;
2562
- let oldVNode;
2563
- if (BUILD20.slotRelocation && !useNativeShadowDom) {
2564
- checkSlotRelocate = true;
2565
- if (newVNode2.$tag$ === "slot") {
2566
- newVNode2.$flags$ |= newVNode2.$children$ ? (
2567
- // slot element has fallback content
2568
- // still create an element that "mocks" the slot element
2569
- 2 /* isSlotFallback */
2570
- ) : (
2571
- // slot element does not have fallback content
2572
- // create an html comment we'll use to always reference
2573
- // where actual slot content should sit next to
2574
- 1 /* isSlotReference */
2575
- );
2576
- }
2577
- }
2578
- if (BUILD20.isDev && newVNode2.$elm$) {
2579
- consoleDevError(
2580
- `The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`
2581
- );
2582
- }
2583
- if (BUILD20.vdomText && newVNode2.$text$ != null) {
2584
- elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
2585
- } else if (BUILD20.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
2586
- elm = newVNode2.$elm$ = BUILD20.isDebug || BUILD20.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : win.document.createTextNode("");
2587
- if (BUILD20.vdomAttribute) {
2588
- updateElement(null, newVNode2, isSvgMode);
2589
- }
2590
- } else {
2591
- if (BUILD20.svg && !isSvgMode) {
2592
- isSvgMode = newVNode2.$tag$ === "svg";
2593
- }
2594
- if (!win.document) {
2595
- throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
2596
- }
2597
- elm = newVNode2.$elm$ = BUILD20.svg ? win.document.createElementNS(
2598
- isSvgMode ? SVG_NS : HTML_NS,
2599
- !useNativeShadowDom && BUILD20.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2600
- ) : win.document.createElement(
2601
- !useNativeShadowDom && BUILD20.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
2602
- );
2603
- if (BUILD20.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
2604
- isSvgMode = false;
2605
- }
2606
- if (BUILD20.vdomAttribute) {
2607
- updateElement(null, newVNode2, isSvgMode);
2608
- }
2609
- if ((BUILD20.scoped || BUILD20.hydrateServerSide && 128 /* shadowNeedsScopedCss */) && isDef(scopeId) && elm["s-si"] !== scopeId) {
2610
- elm.classList.add(elm["s-si"] = scopeId);
2611
- }
2612
- if (newVNode2.$children$) {
2613
- const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
2614
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
2615
- childNode = createElm(oldParentVNode, newVNode2, i2);
2616
- if (childNode) {
2617
- appendTarget.appendChild(childNode);
2618
- }
2619
- }
2620
- }
2621
- if (BUILD20.svg) {
2622
- if (newVNode2.$tag$ === "svg") {
2623
- isSvgMode = false;
2624
- } else if (elm.tagName === "foreignObject") {
2625
- isSvgMode = true;
2626
- }
2627
- }
2628
- }
2629
- elm["s-hn"] = hostTagName;
2630
- if (BUILD20.slotRelocation) {
2631
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
2632
- elm["s-sr"] = true;
2633
- elm["s-cr"] = contentRef;
2634
- elm["s-sn"] = newVNode2.$name$ || "";
2635
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
2636
- patchSlotNode(elm);
2637
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
2638
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
2639
- relocateToHostRoot(oldParentVNode.$elm$);
2640
- }
2641
- if (BUILD20.scoped || BUILD20.hydrateServerSide && 128 /* shadowNeedsScopedCss */) {
2642
- addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
2643
- }
2644
- }
2645
- }
2646
- return elm;
2647
- };
2648
- var relocateToHostRoot = (parentElm) => {
2649
- plt.$flags$ |= 1 /* isTmpDisconnected */;
2650
- const host = parentElm.closest(hostTagName.toLowerCase());
2651
- if (host != null) {
2652
- const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
2653
- (ref) => ref["s-cr"]
2654
- );
2655
- const childNodeArray = Array.from(
2656
- parentElm.__childNodes || parentElm.childNodes
2657
- );
2658
- for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
2659
- if (childNode["s-sh"] != null) {
2660
- insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
2661
- childNode["s-sh"] = void 0;
2662
- checkSlotRelocate = true;
2663
- }
2664
- }
2665
- }
2666
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
2667
- };
2668
- var putBackInOriginalLocation = (parentElm, recursive) => {
2669
- plt.$flags$ |= 1 /* isTmpDisconnected */;
2670
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
2671
- if (parentElm["s-sr"]) {
2672
- let node = parentElm;
2673
- while (node = node.nextSibling) {
2674
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
2675
- oldSlotChildNodes.push(node);
2676
- }
2677
- }
2678
- }
2679
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
2680
- const childNode = oldSlotChildNodes[i2];
2681
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
2682
- insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
2683
- childNode["s-ol"].remove();
2684
- childNode["s-ol"] = void 0;
2685
- childNode["s-sh"] = void 0;
2686
- checkSlotRelocate = true;
2687
- }
2688
- if (recursive) {
2689
- putBackInOriginalLocation(childNode, recursive);
2690
- }
2691
- }
2692
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
2693
- };
2694
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
2695
- let containerElm = BUILD20.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
2696
- let childNode;
2697
- if (BUILD20.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
2698
- containerElm = containerElm.shadowRoot;
2699
- }
2700
- if (parentVNode.$tag$ === "template") {
2701
- containerElm = containerElm.content;
2702
- }
2703
- for (; startIdx <= endIdx; ++startIdx) {
2704
- if (vnodes[startIdx]) {
2705
- childNode = createElm(null, parentVNode, startIdx);
2706
- if (childNode) {
2707
- vnodes[startIdx].$elm$ = childNode;
2708
- insertBefore(containerElm, childNode, BUILD20.slotRelocation ? referenceNode(before) : before);
2709
- }
2710
- }
2711
- }
2712
- };
2713
- var removeVnodes = (vnodes, startIdx, endIdx) => {
2714
- for (let index = startIdx; index <= endIdx; ++index) {
2715
- const vnode = vnodes[index];
2716
- if (vnode) {
2717
- const elm = vnode.$elm$;
2718
- nullifyVNodeRefs(vnode);
2719
- if (elm) {
2720
- if (BUILD20.slotRelocation) {
2721
- checkSlotFallbackVisibility = true;
2722
- if (elm["s-ol"]) {
2723
- elm["s-ol"].remove();
2724
- } else {
2725
- putBackInOriginalLocation(elm, true);
2726
- }
2727
- }
2728
- elm.remove();
2729
- }
2730
- }
2731
- }
2732
- };
2733
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
2734
- let oldStartIdx = 0;
2735
- let newStartIdx = 0;
2736
- let idxInOld = 0;
2737
- let i2 = 0;
2738
- let oldEndIdx = oldCh.length - 1;
2739
- let oldStartVnode = oldCh[0];
2740
- let oldEndVnode = oldCh[oldEndIdx];
2741
- let newEndIdx = newCh.length - 1;
2742
- let newStartVnode = newCh[0];
2743
- let newEndVnode = newCh[newEndIdx];
2744
- let node;
2745
- let elmToMove;
2746
- const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
2747
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
2748
- if (oldStartVnode == null) {
2749
- oldStartVnode = oldCh[++oldStartIdx];
2750
- } else if (oldEndVnode == null) {
2751
- oldEndVnode = oldCh[--oldEndIdx];
2752
- } else if (newStartVnode == null) {
2753
- newStartVnode = newCh[++newStartIdx];
2754
- } else if (newEndVnode == null) {
2755
- newEndVnode = newCh[--newEndIdx];
2756
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
2757
- patch(oldStartVnode, newStartVnode, isInitialRender);
2758
- oldStartVnode = oldCh[++oldStartIdx];
2759
- newStartVnode = newCh[++newStartIdx];
2760
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
2761
- patch(oldEndVnode, newEndVnode, isInitialRender);
2762
- oldEndVnode = oldCh[--oldEndIdx];
2763
- newEndVnode = newCh[--newEndIdx];
2764
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
2765
- if (BUILD20.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
2766
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
2767
- }
2768
- patch(oldStartVnode, newEndVnode, isInitialRender);
2769
- insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
2770
- oldStartVnode = oldCh[++oldStartIdx];
2771
- newEndVnode = newCh[--newEndIdx];
2772
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
2773
- if (BUILD20.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
2774
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
2775
- }
2776
- patch(oldEndVnode, newStartVnode, isInitialRender);
2777
- insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
2778
- oldEndVnode = oldCh[--oldEndIdx];
2779
- newStartVnode = newCh[++newStartIdx];
2780
- } else {
2781
- idxInOld = -1;
2782
- if (BUILD20.vdomKey) {
2783
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
2784
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
2785
- idxInOld = i2;
2786
- break;
2787
- }
2788
- }
2789
- }
2790
- if (BUILD20.vdomKey && idxInOld >= 0) {
2791
- elmToMove = oldCh[idxInOld];
2792
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
2793
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
2794
- } else {
2795
- patch(elmToMove, newStartVnode, isInitialRender);
2796
- oldCh[idxInOld] = void 0;
2797
- node = elmToMove.$elm$;
2798
- }
2799
- newStartVnode = newCh[++newStartIdx];
2800
- } else {
2801
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
2802
- newStartVnode = newCh[++newStartIdx];
2803
- }
2804
- if (node) {
2805
- if (BUILD20.slotRelocation) {
2806
- insertBefore(
2807
- referenceNode(oldStartVnode.$elm$).parentNode,
2808
- node,
2809
- referenceNode(oldStartVnode.$elm$)
2810
- );
2811
- } else {
2812
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
2813
- }
2814
- }
2815
- }
2816
- }
2817
- if (oldStartIdx > oldEndIdx) {
2818
- addVnodes(
2819
- parentElm,
2820
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
2821
- newVNode2,
2822
- newCh,
2823
- newStartIdx,
2824
- newEndIdx
2825
- );
2826
- } else if (BUILD20.updatable && newStartIdx > newEndIdx) {
2827
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
2828
- }
2829
- };
2830
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
2831
- if (leftVNode.$tag$ === rightVNode.$tag$) {
2832
- if (BUILD20.slotRelocation && leftVNode.$tag$ === "slot") {
2833
- return leftVNode.$name$ === rightVNode.$name$;
2834
- }
2835
- if (BUILD20.vdomKey && !isInitialRender) {
2836
- return leftVNode.$key$ === rightVNode.$key$;
2837
- }
2838
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
2839
- leftVNode.$key$ = rightVNode.$key$;
2840
- }
2841
- return true;
2842
- }
2843
- return false;
2844
- };
2845
- var referenceNode = (node) => node && node["s-ol"] || node;
2846
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2847
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
2848
- const oldChildren = oldVNode.$children$;
2849
- const newChildren = newVNode2.$children$;
2850
- const tag = newVNode2.$tag$;
2851
- const text = newVNode2.$text$;
2852
- let defaultHolder;
2853
- if (!BUILD20.vdomText || text == null) {
2854
- if (BUILD20.svg) {
2855
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
2856
- }
2857
- if (BUILD20.vdomAttribute || BUILD20.reflect) {
2858
- if (BUILD20.slot && tag === "slot" && !useNativeShadowDom) {
2859
- if (oldVNode.$name$ !== newVNode2.$name$) {
2860
- newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2861
- relocateToHostRoot(newVNode2.$elm$.parentElement);
2862
- }
2863
- }
2864
- updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
2865
- }
2866
- if (BUILD20.updatable && oldChildren !== null && newChildren !== null) {
2867
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
2868
- } else if (newChildren !== null) {
2869
- if (BUILD20.updatable && BUILD20.vdomText && oldVNode.$text$ !== null) {
2870
- elm.textContent = "";
2871
- }
2872
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
2873
- } else if (
2874
- // don't do this on initial render as it can cause non-hydrated content to be removed
2875
- !isInitialRender && BUILD20.updatable && oldChildren !== null
2876
- ) {
2877
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
2878
- } else if (BUILD20.hydrateClientSide && isInitialRender && BUILD20.updatable && oldChildren !== null && newChildren === null) {
2879
- newVNode2.$children$ = oldChildren;
2880
- }
2881
- if (BUILD20.svg && isSvgMode && tag === "svg") {
2882
- isSvgMode = false;
2883
- }
2884
- } else if (BUILD20.vdomText && BUILD20.slotRelocation && (defaultHolder = elm["s-cr"])) {
2885
- defaultHolder.parentNode.textContent = text;
2886
- } else if (BUILD20.vdomText && oldVNode.$text$ !== text) {
2887
- elm.data = text;
2888
- }
2889
- };
2890
- var relocateNodes = [];
2891
- var markSlotContentForRelocation = (elm) => {
2892
- let node;
2893
- let hostContentNodes;
2894
- let j;
2895
- const children = elm.__childNodes || elm.childNodes;
2896
- for (const childNode of children) {
2897
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
2898
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
2899
- const slotName = childNode["s-sn"];
2900
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
2901
- node = hostContentNodes[j];
2902
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
2903
- if (isNodeLocatedInSlot(node, slotName)) {
2904
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2905
- checkSlotFallbackVisibility = true;
2906
- node["s-sn"] = node["s-sn"] || slotName;
2907
- if (relocateNodeData) {
2908
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
2909
- relocateNodeData.$slotRefNode$ = childNode;
2910
- } else {
2911
- node["s-sh"] = childNode["s-hn"];
2912
- relocateNodes.push({
2913
- $slotRefNode$: childNode,
2914
- $nodeToRelocate$: node
2915
- });
2916
- }
2917
- if (node["s-sr"]) {
2918
- relocateNodes.map((relocateNode) => {
2919
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
2920
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2921
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
2922
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
2923
- }
2924
- }
2925
- });
2926
- }
2927
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
2928
- relocateNodes.push({
2929
- $nodeToRelocate$: node
2930
- });
2931
- }
2932
- }
2933
- }
2934
- }
2935
- if (childNode.nodeType === 1 /* ElementNode */) {
2936
- markSlotContentForRelocation(childNode);
2937
- }
2938
- }
2939
- };
2940
- var nullifyVNodeRefs = (vNode) => {
2941
- if (BUILD20.vdomRef) {
2942
- if (vNode.$attrs$ && vNode.$attrs$.ref) {
2943
- refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
2944
- }
2945
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
2946
- }
2947
- };
2948
- var queueRefAttachment = (refCallback, elm) => {
2949
- if (BUILD20.vdomRef) {
2950
- refCallbacksToAttach.push(() => refCallback(elm));
2951
- }
2952
- };
2953
- var flushQueuedRefCallbacks = () => {
2954
- if (BUILD20.vdomRef) {
2955
- refCallbacksToRemove.forEach((cb) => cb());
2956
- refCallbacksToRemove.length = 0;
2957
- refCallbacksToAttach.forEach((cb) => cb());
2958
- refCallbacksToAttach.length = 0;
2959
- }
2960
- };
2961
- var insertBefore = (parent, newNode, reference, isInitialLoad) => {
2962
- if (BUILD20.slotRelocation) {
2963
- if (BUILD20.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
2964
- addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2965
- } else if (typeof newNode["s-sn"] === "string") {
2966
- if (BUILD20.experimentalSlotFixes && parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2967
- patchParentNode(newNode);
2968
- }
2969
- parent.insertBefore(newNode, reference);
2970
- const { slotNode } = findSlotFromSlottedNode(newNode);
2971
- if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
2972
- return newNode;
2973
- }
2974
- }
2975
- if (parent.__insertBefore) {
2976
- return parent.__insertBefore(newNode, reference);
2977
- } else {
2978
- return parent == null ? void 0 : parent.insertBefore(newNode, reference);
2979
- }
2980
- };
2981
- function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
2982
- var _a, _b;
2983
- let scopeId2;
2984
- if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
2985
- const scopeName = slotNode["s-sn"];
2986
- const hostName = slotNode["s-hn"];
2987
- (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
2988
- if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + "-s"))) {
2989
- let child = (oldParent.__childNodes || oldParent.childNodes)[0];
2990
- let found = false;
2991
- while (child) {
2992
- if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
2993
- found = true;
2994
- break;
2995
- }
2996
- child = child.nextSibling;
2997
- }
2998
- if (!found) oldParent.classList.remove(scopeId2 + "-s");
2999
- }
3000
- }
3001
- }
3002
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
3003
- var _a, _b, _c, _d, _e;
3004
- const hostElm = hostRef.$hostElement$;
3005
- const cmpMeta = hostRef.$cmpMeta$;
3006
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
3007
- const isHostElement = isHost(renderFnResults);
3008
- const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
3009
- hostTagName = hostElm.tagName;
3010
- if (BUILD20.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
3011
- throw new Error(`The <Host> must be the single root component.
3012
- Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
3013
-
3014
- The render() function should look like this instead:
3015
-
3016
- render() {
3017
- // Do not return an array
3018
- return (
3019
- <Host>{content}</Host>
3020
- );
3021
- }
3022
- `);
3023
- }
3024
- if (BUILD20.reflect && cmpMeta.$attrsToReflect$) {
3025
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
3026
- cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {
3027
- if (BUILD20.serializer && hostRef.$serializerValues$.has(propName)) {
3028
- rootVnode.$attrs$[attribute] = hostRef.$serializerValues$.get(propName);
3029
- } else {
3030
- rootVnode.$attrs$[attribute] = hostElm[propName];
3031
- }
3032
- });
3033
- }
3034
- if (isInitialLoad && rootVnode.$attrs$) {
3035
- for (const key of Object.keys(rootVnode.$attrs$)) {
3036
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
3037
- rootVnode.$attrs$[key] = hostElm[key];
3038
- }
3039
- }
3040
- }
3041
- rootVnode.$tag$ = null;
3042
- rootVnode.$flags$ |= 4 /* isHost */;
3043
- hostRef.$vnode$ = rootVnode;
3044
- rootVnode.$elm$ = oldVNode.$elm$ = BUILD20.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
3045
- if (BUILD20.scoped || BUILD20.shadowDom) {
3046
- scopeId = hostElm["s-sc"];
3047
- }
3048
- useNativeShadowDom = supportsShadow && !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
3049
- if (BUILD20.slotRelocation) {
3050
- contentRef = hostElm["s-cr"];
3051
- checkSlotFallbackVisibility = false;
3052
- }
3053
- patch(oldVNode, rootVnode, isInitialLoad);
3054
- if (BUILD20.slotRelocation) {
3055
- plt.$flags$ |= 1 /* isTmpDisconnected */;
3056
- if (checkSlotRelocate) {
3057
- markSlotContentForRelocation(rootVnode.$elm$);
3058
- for (const relocateData of relocateNodes) {
3059
- const nodeToRelocate = relocateData.$nodeToRelocate$;
3060
- if (!nodeToRelocate["s-ol"] && win.document) {
3061
- const orgLocationNode = BUILD20.isDebug || BUILD20.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : win.document.createTextNode("");
3062
- orgLocationNode["s-nr"] = nodeToRelocate;
3063
- insertBefore(
3064
- nodeToRelocate.parentNode,
3065
- nodeToRelocate["s-ol"] = orgLocationNode,
3066
- nodeToRelocate,
3067
- isInitialLoad
3068
- );
3069
- }
3070
- }
3071
- for (const relocateData of relocateNodes) {
3072
- const nodeToRelocate = relocateData.$nodeToRelocate$;
3073
- const slotRefNode = relocateData.$slotRefNode$;
3074
- if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
3075
- nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
3076
- }
3077
- if (slotRefNode) {
3078
- const parentNodeRef = slotRefNode.parentNode;
3079
- let insertBeforeNode = slotRefNode.nextSibling;
3080
- if (!BUILD20.hydrateServerSide && insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
3081
- let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
3082
- while (orgLocationNode) {
3083
- let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
3084
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
3085
- refNode = refNode.nextSibling;
3086
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
3087
- refNode = refNode == null ? void 0 : refNode.nextSibling;
3088
- }
3089
- if (!refNode || !refNode["s-nr"]) {
3090
- insertBeforeNode = refNode;
3091
- break;
3092
- }
3093
- }
3094
- orgLocationNode = orgLocationNode.previousSibling;
3095
- }
3096
- }
3097
- const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
3098
- const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
3099
- if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
3100
- if (nodeToRelocate !== insertBeforeNode) {
3101
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
3102
- if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
3103
- const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
3104
- textNode["s-hn"] = nodeToRelocate["s-hn"];
3105
- textNode["s-sn"] = nodeToRelocate["s-sn"];
3106
- textNode["s-sh"] = nodeToRelocate["s-sh"];
3107
- textNode["s-sr"] = nodeToRelocate["s-sr"];
3108
- textNode["s-ol"] = nodeToRelocate["s-ol"];
3109
- textNode["s-ol"]["s-nr"] = textNode;
3110
- insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
3111
- nodeToRelocate.parentNode.removeChild(nodeToRelocate);
3112
- }
3113
- if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
3114
- nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
3115
- }
3116
- }
3117
- }
3118
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
3119
- } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
3120
- nodeToRelocate.hidden = true;
3121
- }
3122
- }
3123
- }
3124
- if (checkSlotFallbackVisibility) {
3125
- updateFallbackSlotVisibility(rootVnode.$elm$);
3126
- }
3127
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
3128
- relocateNodes.length = 0;
3129
- }
3130
- if (BUILD20.slotRelocation && !useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm["s-cr"]) {
3131
- const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
3132
- for (const childNode of children) {
3133
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
3134
- if (isInitialLoad && childNode["s-ih"] == null) {
3135
- childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
3136
- }
3137
- if (childNode.nodeType === 1 /* ElementNode */) {
3138
- childNode.hidden = true;
3139
- } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {
3140
- const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
3141
- textCommentNode["s-sn"] = childNode["s-sn"];
3142
- insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
3143
- childNode.parentNode.removeChild(childNode);
3144
- }
3145
- }
3146
- }
3147
- }
3148
- contentRef = void 0;
3149
- flushQueuedRefCallbacks();
3150
- };
3151
- var slotReferenceDebugNode = (slotVNode) => {
3152
- var _a;
3153
- return (_a = win.document) == null ? void 0 : _a.createComment(
3154
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
3155
- );
3156
- };
3157
- var originalLocationDebugNode = (nodeToRelocate) => {
3158
- var _a;
3159
- return (_a = win.document) == null ? void 0 : _a.createComment(
3160
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
3161
- );
3162
- };
3163
-
3164
- // src/runtime/update-component.ts
3165
- var attachToAncestor = (hostRef, ancestorComponent) => {
3166
- if (BUILD21.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
3167
- const index = ancestorComponent["s-p"].push(
3168
- new Promise(
3169
- (r) => hostRef.$onRenderResolve$ = () => {
3170
- ancestorComponent["s-p"].splice(index - 1, 1);
3171
- r();
3172
- }
3173
- )
3174
- );
3175
- }
3176
- };
3177
- var scheduleUpdate = (hostRef, isInitialLoad) => {
3178
- if (BUILD21.taskQueue && BUILD21.updatable) {
3179
- hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
3180
- }
3181
- if (BUILD21.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
3182
- hostRef.$flags$ |= 512 /* needsRerender */;
3183
- return;
3184
- }
3185
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
3186
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
3187
- if (isInitialLoad) {
3188
- queueMicrotask(() => {
3189
- dispatch();
3190
- });
3191
- return;
3192
- }
3193
- return BUILD21.taskQueue ? writeTask(dispatch) : dispatch();
3194
- };
3195
- var dispatchHooks = (hostRef, isInitialLoad) => {
3196
- const elm = hostRef.$hostElement$;
3197
- const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
3198
- const instance = BUILD21.lazyLoad ? hostRef.$lazyInstance$ : elm;
3199
- if (!instance) {
3200
- throw new Error(
3201
- `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
3202
- );
3203
- }
3204
- let maybePromise;
3205
- if (isInitialLoad) {
3206
- if (BUILD21.lazyLoad) {
3207
- if (BUILD21.slotRelocation && hostRef.$deferredConnectedCallback$) {
3208
- hostRef.$deferredConnectedCallback$ = false;
3209
- safeCall(instance, "connectedCallback", void 0, elm);
3210
- }
3211
- if (BUILD21.hostListener) {
3212
- hostRef.$flags$ |= 256 /* isListenReady */;
3213
- if (hostRef.$queuedListeners$) {
3214
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
3215
- hostRef.$queuedListeners$ = void 0;
3216
- }
3217
- }
3218
- if (hostRef.$fetchedCbList$.length) {
3219
- hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
3220
- }
3221
- }
3222
- emitLifecycleEvent(elm, "componentWillLoad");
3223
- maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
3224
- } else {
3225
- emitLifecycleEvent(elm, "componentWillUpdate");
3226
- maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
3227
- }
3228
- emitLifecycleEvent(elm, "componentWillRender");
3229
- maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
3230
- endSchedule();
3231
- return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
3232
- };
3233
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
3234
- console.error(err);
3235
- fn();
3236
- }) : fn();
3237
- var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
3238
- var updateComponent = async (hostRef, instance, isInitialLoad) => {
3239
- var _a;
3240
- const elm = hostRef.$hostElement$;
3241
- const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
3242
- const rc = elm["s-rc"];
3243
- if (BUILD21.style && isInitialLoad) {
3244
- attachStyles(hostRef);
3245
- }
3246
- const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
3247
- if (BUILD21.isDev) {
3248
- hostRef.$flags$ |= 1024 /* devOnRender */;
3249
- }
3250
- if (BUILD21.hydrateServerSide) {
3251
- await callRender(hostRef, instance, elm, isInitialLoad);
3252
- } else {
3253
- callRender(hostRef, instance, elm, isInitialLoad);
3254
- }
3255
- if (BUILD21.isDev) {
3256
- hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
3257
- hostRef.$flags$ &= ~1024 /* devOnRender */;
3258
- }
3259
- if (BUILD21.hydrateServerSide) {
3260
- try {
3261
- serverSideConnected(elm);
3262
- if (isInitialLoad) {
3263
- if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
3264
- elm["s-en"] = "";
3265
- } else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
3266
- elm["s-en"] = "c";
3267
- }
3268
- }
3269
- } catch (e) {
3270
- consoleError(e, elm);
3271
- }
3272
- }
3273
- if (BUILD21.asyncLoading && rc) {
3274
- rc.map((cb) => cb());
3275
- elm["s-rc"] = void 0;
3276
- }
3277
- endRender();
3278
- endUpdate();
3279
- if (BUILD21.asyncLoading) {
3280
- const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
3281
- const postUpdate = () => postUpdateComponent(hostRef);
3282
- if (childrenPromises.length === 0) {
3283
- postUpdate();
3284
- } else {
3285
- Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
3286
- hostRef.$flags$ |= 4 /* isWaitingForChildren */;
3287
- childrenPromises.length = 0;
3288
- }
3289
- } else {
3290
- postUpdateComponent(hostRef);
3291
- }
3292
- };
3293
- var renderingRef = null;
3294
- var callRender = (hostRef, instance, elm, isInitialLoad) => {
3295
- const allRenderFn = BUILD21.allRenderFn ? true : false;
3296
- const lazyLoad = BUILD21.lazyLoad ? true : false;
3297
- const taskQueue = BUILD21.taskQueue ? true : false;
3298
- const updatable = BUILD21.updatable ? true : false;
3299
- try {
3300
- renderingRef = instance;
3301
- instance = allRenderFn ? instance.render() : instance.render && instance.render();
3302
- if (updatable && taskQueue) {
3303
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
3304
- }
3305
- if (updatable || lazyLoad) {
3306
- hostRef.$flags$ |= 2 /* hasRendered */;
3307
- }
3308
- if (BUILD21.hasRenderFn || BUILD21.reflect) {
3309
- if (BUILD21.vdomRender || BUILD21.reflect) {
3310
- if (BUILD21.hydrateServerSide) {
3311
- return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
3312
- } else {
3313
- renderVdom(hostRef, instance, isInitialLoad);
3314
- }
3315
- } else {
3316
- const shadowRoot = elm.shadowRoot;
3317
- if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
3318
- shadowRoot.textContent = instance;
3319
- } else {
3320
- elm.textContent = instance;
3321
- }
3322
- }
3323
- }
3324
- } catch (e) {
3325
- consoleError(e, hostRef.$hostElement$);
3326
- }
3327
- renderingRef = null;
3328
- return null;
3329
- };
3330
- var getRenderingRef = () => renderingRef;
3331
- var postUpdateComponent = (hostRef) => {
3332
- const tagName = hostRef.$cmpMeta$.$tagName$;
3333
- const elm = hostRef.$hostElement$;
3334
- const endPostUpdate = createTime("postUpdate", tagName);
3335
- const instance = BUILD21.lazyLoad ? hostRef.$lazyInstance$ : elm;
3336
- const ancestorComponent = hostRef.$ancestorComponent$;
3337
- if (BUILD21.isDev) {
3338
- hostRef.$flags$ |= 1024 /* devOnRender */;
3339
- }
3340
- safeCall(instance, "componentDidRender", void 0, elm);
3341
- if (BUILD21.isDev) {
3342
- hostRef.$flags$ &= ~1024 /* devOnRender */;
3343
- }
3344
- emitLifecycleEvent(elm, "componentDidRender");
3345
- if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
3346
- hostRef.$flags$ |= 64 /* hasLoadedComponent */;
3347
- if (BUILD21.asyncLoading && BUILD21.cssAnnotations) {
3348
- addHydratedFlag(elm);
3349
- }
3350
- if (BUILD21.isDev) {
3351
- hostRef.$flags$ |= 2048 /* devOnDidLoad */;
3352
- }
3353
- safeCall(instance, "componentDidLoad", void 0, elm);
3354
- if (BUILD21.isDev) {
3355
- hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
3356
- }
3357
- emitLifecycleEvent(elm, "componentDidLoad");
3358
- endPostUpdate();
3359
- if (BUILD21.asyncLoading) {
3360
- hostRef.$onReadyResolve$(elm);
3361
- if (!ancestorComponent) {
3362
- appDidLoad(tagName);
3363
- }
3364
- }
3365
- } else {
3366
- if (BUILD21.isDev) {
3367
- hostRef.$flags$ |= 1024 /* devOnRender */;
3368
- }
3369
- safeCall(instance, "componentDidUpdate", void 0, elm);
3370
- if (BUILD21.isDev) {
3371
- hostRef.$flags$ &= ~1024 /* devOnRender */;
3372
- }
3373
- emitLifecycleEvent(elm, "componentDidUpdate");
3374
- endPostUpdate();
3375
- }
3376
- if (BUILD21.method && BUILD21.lazyLoad) {
3377
- hostRef.$onInstanceResolve$(elm);
3378
- }
3379
- if (BUILD21.asyncLoading) {
3380
- if (hostRef.$onRenderResolve$) {
3381
- hostRef.$onRenderResolve$();
3382
- hostRef.$onRenderResolve$ = void 0;
3383
- }
3384
- if (hostRef.$flags$ & 512 /* needsRerender */) {
3385
- nextTick(() => scheduleUpdate(hostRef, false));
3386
- }
3387
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
3388
- }
3389
- };
3390
- var forceUpdate = (ref) => {
3391
- var _a;
3392
- if (BUILD21.updatable && (Build.isBrowser || Build.isTesting)) {
3393
- const hostRef = getHostRef(ref);
3394
- const isConnected = (_a = hostRef == null ? void 0 : hostRef.$hostElement$) == null ? void 0 : _a.isConnected;
3395
- if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
3396
- scheduleUpdate(hostRef, false);
3397
- }
3398
- return isConnected;
3399
- }
3400
- return false;
3401
- };
3402
- var appDidLoad = (who) => {
3403
- var _a;
3404
- if (BUILD21.asyncQueue) {
3405
- plt.$flags$ |= 2 /* appLoaded */;
3406
- }
3407
- nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
3408
- if (BUILD21.hydrateClientSide) {
3409
- if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3410
- plt.$orgLocNodes$.clear();
3411
- }
3412
- }
3413
- if (BUILD21.profile && performance.measure) {
3414
- performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
3415
- }
3416
- };
3417
- var safeCall = (instance, method, arg, elm) => {
3418
- if (instance && instance[method]) {
3419
- try {
3420
- return instance[method](arg);
3421
- } catch (e) {
3422
- consoleError(e, elm);
3423
- }
3424
- }
3425
- return void 0;
3426
- };
3427
- var emitLifecycleEvent = (elm, lifecycleName) => {
3428
- if (BUILD21.lifecycleDOMEvents) {
3429
- emitEvent(elm, "stencil_" + lifecycleName, {
3430
- bubbles: true,
3431
- composed: true,
3432
- detail: {
3433
- namespace: NAMESPACE
3434
- }
3435
- });
3436
- }
3437
- };
3438
- var addHydratedFlag = (elm) => {
3439
- var _a, _b;
3440
- return BUILD21.hydratedClass ? elm.classList.add((_a = BUILD21.hydratedSelectorName) != null ? _a : "hydrated") : BUILD21.hydratedAttribute ? elm.setAttribute((_b = BUILD21.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
3441
- };
3442
- var serverSideConnected = (elm) => {
3443
- const children = elm.children;
3444
- if (children != null) {
3445
- for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
3446
- const childElm = children[i2];
3447
- if (typeof childElm.connectedCallback === "function") {
3448
- childElm.connectedCallback();
3449
- }
3450
- serverSideConnected(childElm);
3451
- }
3452
- }
3453
- };
3454
-
3455
- // src/runtime/set-value.ts
3456
- var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
3457
- var setValue = (ref, propName, newVal, cmpMeta) => {
3458
- const hostRef = getHostRef(ref);
3459
- if (!hostRef) {
3460
- return;
3461
- }
3462
- if (BUILD22.lazyLoad && !hostRef) {
3463
- throw new Error(
3464
- `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
3465
- );
3466
- }
3467
- if (BUILD22.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newVal) {
3468
- return;
3469
- }
3470
- const elm = BUILD22.lazyLoad ? hostRef.$hostElement$ : ref;
3471
- const oldVal = hostRef.$instanceValues$.get(propName);
3472
- const flags = hostRef.$flags$;
3473
- const instance = BUILD22.lazyLoad ? hostRef.$lazyInstance$ : elm;
3474
- newVal = parsePropertyValue(
3475
- newVal,
3476
- cmpMeta.$members$[propName][0],
3477
- BUILD22.formAssociated && !!(cmpMeta.$flags$ & 64 /* formAssociated */)
3478
- );
3479
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
3480
- const didValueChange = newVal !== oldVal && !areBothNaN;
3481
- if ((!BUILD22.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
3482
- hostRef.$instanceValues$.set(propName, newVal);
3483
- if (BUILD22.serializer && BUILD22.reflect && cmpMeta.$attrsToReflect$) {
3484
- if (cmpMeta.$serializers$ && cmpMeta.$serializers$[propName]) {
3485
- const runSerializer = (inst) => {
3486
- let attrVal = newVal;
3487
- for (const serializer of cmpMeta.$serializers$[propName]) {
3488
- const [[methodName]] = Object.entries(serializer);
3489
- attrVal = inst[methodName](attrVal, propName);
3490
- }
3491
- hostRef.$serializerValues$.set(propName, attrVal);
3492
- };
3493
- if (instance) {
3494
- runSerializer(instance);
3495
- } else {
3496
- hostRef.$fetchedCbList$.push(() => {
3497
- runSerializer(hostRef.$lazyInstance$);
3498
- });
3499
- }
3500
- }
3501
- }
3502
- if (BUILD22.isDev) {
3503
- if (hostRef.$flags$ & 1024 /* devOnRender */) {
3504
- consoleDevWarn(
3505
- `The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
3506
- "\nElement",
3507
- elm,
3508
- "\nNew value",
3509
- newVal,
3510
- "\nOld value",
3511
- oldVal
3512
- );
3513
- } else if (hostRef.$flags$ & 2048 /* devOnDidLoad */) {
3514
- consoleDevWarn(
3515
- `The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`,
3516
- "\nElement",
3517
- elm,
3518
- "\nNew value",
3519
- newVal,
3520
- "\nOld value",
3521
- oldVal
3522
- );
3523
- }
3524
- }
3525
- if (BUILD22.propChangeCallback && cmpMeta.$watchers$) {
3526
- const watchMethods = cmpMeta.$watchers$[propName];
3527
- if (watchMethods) {
3528
- watchMethods.map((watcher) => {
3529
- try {
3530
- const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3531
- if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
3532
- if (!instance) {
3533
- hostRef.$fetchedCbList$.push(() => {
3534
- hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
3535
- });
3536
- } else {
3537
- instance[watchMethodName](newVal, oldVal, propName);
3538
- }
3539
- }
3540
- } catch (e) {
3541
- consoleError(e, elm);
3542
- }
3543
- });
3544
- }
3545
- }
3546
- if (BUILD22.updatable && flags & 2 /* hasRendered */) {
3547
- if (instance.componentShouldUpdate) {
3548
- const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
3549
- if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
3550
- return;
3551
- }
3552
- }
3553
- if (!(flags & 16 /* isQueuedForUpdate */)) {
3554
- scheduleUpdate(hostRef, false);
3555
- }
3556
- }
3557
- }
3558
- };
3559
-
3560
- // src/runtime/proxy-component.ts
3561
- var proxyComponent = (Cstr, cmpMeta, flags) => {
3562
- var _a, _b;
3563
- const prototype = Cstr.prototype;
3564
- if (BUILD23.isTesting) {
3565
- if (prototype.__stencilAugmented) {
3566
- return;
3567
- }
3568
- prototype.__stencilAugmented = true;
3569
- }
3570
- if (BUILD23.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
3571
- FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
3572
- const originalFormAssociatedCallback = prototype[cbName];
3573
- Object.defineProperty(prototype, cbName, {
3574
- value(...args) {
3575
- var _a2;
3576
- const hostRef = getHostRef(this);
3577
- const instance = BUILD23.lazyLoad ? hostRef == null ? void 0 : hostRef.$lazyInstance$ : this;
3578
- if (!instance) {
3579
- (_a2 = hostRef == null ? void 0 : hostRef.$onReadyPromise$) == null ? void 0 : _a2.then((asyncInstance) => {
3580
- const cb = asyncInstance[cbName];
3581
- typeof cb === "function" && cb.call(asyncInstance, ...args);
3582
- });
3583
- } else {
3584
- const cb = BUILD23.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
3585
- typeof cb === "function" && cb.call(instance, ...args);
3586
- }
3587
- }
3588
- });
3589
- });
3590
- }
3591
- if (BUILD23.member && cmpMeta.$members$ || BUILD23.propChangeCallback) {
3592
- if (BUILD23.propChangeCallback) {
3593
- if (Cstr.watchers && !cmpMeta.$watchers$) {
3594
- cmpMeta.$watchers$ = Cstr.watchers;
3595
- }
3596
- if (Cstr.deserializers && !cmpMeta.$deserializers$) {
3597
- cmpMeta.$deserializers$ = Cstr.deserializers;
3598
- }
3599
- if (Cstr.serializers && !cmpMeta.$serializers$) {
3600
- cmpMeta.$serializers$ = Cstr.serializers;
3601
- }
3602
- }
3603
- const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
3604
- members.map(([memberName, [memberFlags]]) => {
3605
- if ((BUILD23.prop || BUILD23.state) && (memberFlags & 31 /* Prop */ || (!BUILD23.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
3606
- const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
3607
- if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
3608
- if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
3609
- if (flags & 1 /* isElementConstructor */ || !origGetter) {
3610
- Object.defineProperty(prototype, memberName, {
3611
- get() {
3612
- if (BUILD23.lazyLoad) {
3613
- if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
3614
- return getValue(this, memberName);
3615
- }
3616
- const ref = getHostRef(this);
3617
- const instance = ref ? ref.$lazyInstance$ : prototype;
3618
- if (!instance) return;
3619
- return instance[memberName];
3620
- }
3621
- if (!BUILD23.lazyLoad) {
3622
- return origGetter ? origGetter.apply(this) : getValue(this, memberName);
3623
- }
3624
- },
3625
- configurable: true,
3626
- enumerable: true
3627
- });
3628
- }
3629
- Object.defineProperty(prototype, memberName, {
3630
- set(newValue) {
3631
- const ref = getHostRef(this);
3632
- if (!ref) {
3633
- return;
3634
- }
3635
- if (BUILD23.isDev) {
3636
- if (
3637
- // we are proxying the instance (not element)
3638
- (flags & 1 /* isElementConstructor */) === 0 && // if the class has a setter, then the Element can update instance values, so ignore
3639
- (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0 && // the element is not constructing
3640
- (ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
3641
- (memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
3642
- (memberFlags & 1024 /* Mutable */) === 0
3643
- ) {
3644
- consoleDevWarn(
3645
- `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
3646
- More information: https://stenciljs.com/docs/properties#prop-mutability`
3647
- );
3648
- }
3649
- }
3650
- if (origSetter) {
3651
- const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
3652
- if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
3653
- newValue = ref.$instanceValues$.get(memberName);
3654
- }
3655
- origSetter.apply(this, [
3656
- parsePropertyValue(
3657
- newValue,
3658
- memberFlags,
3659
- BUILD23.formAssociated && !!(cmpMeta.$flags$ & 64 /* formAssociated */)
3660
- )
3661
- ]);
3662
- newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
3663
- setValue(this, memberName, newValue, cmpMeta);
3664
- return;
3665
- }
3666
- if (!BUILD23.lazyLoad) {
3667
- setValue(this, memberName, newValue, cmpMeta);
3668
- return;
3669
- }
3670
- if (BUILD23.lazyLoad) {
3671
- if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
3672
- setValue(this, memberName, newValue, cmpMeta);
3673
- if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
3674
- ref.$fetchedCbList$.push(() => {
3675
- if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
3676
- ref.$lazyInstance$[memberName] = newValue;
3677
- }
3678
- });
3679
- }
3680
- return;
3681
- }
3682
- const setterSetVal = () => {
3683
- const currentValue = ref.$lazyInstance$[memberName];
3684
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
3685
- ref.$instanceValues$.set(memberName, currentValue);
3686
- }
3687
- ref.$lazyInstance$[memberName] = parsePropertyValue(
3688
- newValue,
3689
- memberFlags,
3690
- BUILD23.formAssociated && !!(cmpMeta.$flags$ & 64 /* formAssociated */)
3691
- );
3692
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
3693
- };
3694
- if (ref.$lazyInstance$) {
3695
- setterSetVal();
3696
- } else {
3697
- ref.$fetchedCbList$.push(() => {
3698
- setterSetVal();
3699
- });
3700
- }
3701
- }
3702
- }
3703
- });
3704
- } else if (BUILD23.lazyLoad && BUILD23.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
3705
- Object.defineProperty(prototype, memberName, {
3706
- value(...args) {
3707
- var _a2;
3708
- const ref = getHostRef(this);
3709
- return (_a2 = ref == null ? void 0 : ref.$onInstancePromise$) == null ? void 0 : _a2.then(() => {
3710
- var _a3;
3711
- return (_a3 = ref.$lazyInstance$) == null ? void 0 : _a3[memberName](...args);
3712
- });
3713
- }
3714
- });
3715
- }
3716
- });
3717
- if (BUILD23.observeAttribute && (!BUILD23.lazyLoad || flags & 1 /* isElementConstructor */)) {
3718
- const attrNameToPropName = /* @__PURE__ */ new Map();
3719
- prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
3720
- plt.jmp(() => {
3721
- var _a2;
3722
- const propName = attrNameToPropName.get(attrName);
3723
- const hostRef = getHostRef(this);
3724
- if (BUILD23.serializer && hostRef.$serializerValues$.has(propName) && hostRef.$serializerValues$.get(propName) === newValue) {
3725
- return;
3726
- }
3727
- if (this.hasOwnProperty(propName) && BUILD23.lazyLoad) {
3728
- newValue = this[propName];
3729
- delete this[propName];
3730
- }
3731
- if (BUILD23.deserializer && cmpMeta.$deserializers$ && cmpMeta.$deserializers$[propName]) {
3732
- const setVal = (methodName, instance) => {
3733
- const deserializeVal = instance == null ? void 0 : instance[methodName](newValue, propName);
3734
- if (deserializeVal !== this[propName]) {
3735
- this[propName] = deserializeVal;
3736
- }
3737
- };
3738
- for (const deserializer of cmpMeta.$deserializers$[propName]) {
3739
- const [[methodName]] = Object.entries(deserializer);
3740
- if (BUILD23.lazyLoad) {
3741
- if (hostRef.$lazyInstance$) {
3742
- setVal(methodName, hostRef.$lazyInstance$);
3743
- } else {
3744
- hostRef.$fetchedCbList$.push(() => {
3745
- setVal(methodName, hostRef.$lazyInstance$);
3746
- });
3747
- }
3748
- } else {
3749
- setVal(methodName, this);
3750
- }
3751
- }
3752
- return;
3753
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
3754
- this[propName] == newValue) {
3755
- return;
3756
- } else if (propName == null) {
3757
- const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
3758
- if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
3759
- const elm = BUILD23.lazyLoad ? hostRef.$hostElement$ : this;
3760
- const instance = BUILD23.lazyLoad ? hostRef.$lazyInstance$ : elm;
3761
- const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
3762
- entry == null ? void 0 : entry.forEach((watcher) => {
3763
- const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
3764
- if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
3765
- instance[watchMethodName].call(instance, newValue, oldValue, attrName);
3766
- }
3767
- });
3768
- }
3769
- return;
3770
- }
3771
- const propFlags = members.find(([m]) => m === propName);
3772
- if (propFlags && propFlags[1][0] & 4 /* Boolean */) {
3773
- newValue = newValue === null || newValue === "false" ? false : true;
3774
- }
3775
- const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
3776
- if (newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
3777
- this[propName] = newValue;
3778
- }
3779
- });
3780
- };
3781
- Cstr.observedAttributes = Array.from(
3782
- /* @__PURE__ */ new Set([
3783
- ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
3784
- ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
3785
- var _a2;
3786
- const attrName = m[1] || propName;
3787
- attrNameToPropName.set(attrName, propName);
3788
- if (BUILD23.reflect && m[0] & 512 /* ReflectAttr */) {
3789
- (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
3790
- }
3791
- return attrName;
3792
- })
3793
- ])
3794
- );
3795
- }
3796
- }
3797
- return Cstr;
3798
- };
3799
-
3800
- // src/runtime/initialize-component.ts
3801
- var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
3802
- let Cstr;
3803
- try {
3804
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
3805
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
3806
- const bundleId = cmpMeta.$lazyBundleId$;
3807
- if (BUILD24.lazyLoad && bundleId) {
3808
- const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
3809
- if (CstrImport && "then" in CstrImport) {
3810
- const endLoad = uniqueTime(
3811
- `st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`,
3812
- `[Stencil] Load module for <${cmpMeta.$tagName$}>`
3813
- );
3814
- Cstr = await CstrImport;
3815
- endLoad();
3816
- } else {
3817
- Cstr = CstrImport;
3818
- }
3819
- if (!Cstr) {
3820
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
3821
- }
3822
- if (BUILD24.member && !Cstr.isProxied) {
3823
- if (BUILD24.propChangeCallback) {
3824
- cmpMeta.$watchers$ = Cstr.watchers;
3825
- cmpMeta.$serializers$ = Cstr.serializers;
3826
- cmpMeta.$deserializers$ = Cstr.deserializers;
3827
- }
3828
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
3829
- Cstr.isProxied = true;
3830
- }
3831
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
3832
- if (BUILD24.member) {
3833
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
3834
- }
3835
- try {
3836
- new Cstr(hostRef);
3837
- } catch (e) {
3838
- consoleError(e, elm);
3839
- }
3840
- if (BUILD24.member) {
3841
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
3842
- }
3843
- if (BUILD24.propChangeCallback) {
3844
- hostRef.$flags$ |= 128 /* isWatchReady */;
3845
- }
3846
- endNewInstance();
3847
- const needsDeferredCallback = BUILD24.slotRelocation && cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
3848
- if (!needsDeferredCallback) {
3849
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
3850
- } else {
3851
- hostRef.$deferredConnectedCallback$ = true;
3852
- }
3853
- } else {
3854
- Cstr = elm.constructor;
3855
- const cmpTag = elm.localName;
3856
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
3857
- }
3858
- if (BUILD24.style && Cstr && Cstr.style) {
3859
- let style;
3860
- if (typeof Cstr.style === "string") {
3861
- style = Cstr.style;
3862
- } else if (BUILD24.mode && typeof Cstr.style !== "string") {
3863
- hostRef.$modeName$ = computeMode(elm);
3864
- if (hostRef.$modeName$) {
3865
- style = Cstr.style[hostRef.$modeName$];
3866
- }
3867
- if (BUILD24.hydrateServerSide && hostRef.$modeName$) {
3868
- elm.setAttribute("s-mode", hostRef.$modeName$);
3869
- }
3870
- }
3871
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
3872
- if (!styles.has(scopeId2) || BUILD24.hotModuleReplacement && hmrVersionId) {
3873
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
3874
- if (BUILD24.hydrateServerSide && BUILD24.shadowDom) {
3875
- if (cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */) {
3876
- style = scopeCss(style, scopeId2, true);
3877
- } else if (needsScopedSSR()) {
3878
- style = expandPartSelectors(style);
3879
- }
3880
- }
3881
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
3882
- endRegisterStyles();
3883
- }
3884
- }
3885
- }
3886
- const ancestorComponent = hostRef.$ancestorComponent$;
3887
- const schedule = () => scheduleUpdate(hostRef, true);
3888
- if (BUILD24.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
3889
- ancestorComponent["s-rc"].push(schedule);
3890
- } else {
3891
- schedule();
3892
- }
3893
- } catch (e) {
3894
- consoleError(e, elm);
3895
- if (BUILD24.asyncLoading && hostRef.$onRenderResolve$) {
3896
- hostRef.$onRenderResolve$();
3897
- hostRef.$onRenderResolve$ = void 0;
3898
- }
3899
- if (BUILD24.asyncLoading && hostRef.$onReadyResolve$) {
3900
- hostRef.$onReadyResolve$(elm);
3901
- }
3902
- }
3903
- };
3904
- var fireConnectedCallback = (instance, elm) => {
3905
- if (BUILD24.lazyLoad) {
3906
- safeCall(instance, "connectedCallback", void 0, elm);
3907
- }
3908
- };
3909
-
3910
- // src/runtime/connected-callback.ts
3911
- var connectedCallback = (elm) => {
3912
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
3913
- const hostRef = getHostRef(elm);
3914
- if (!hostRef) {
3915
- return;
3916
- }
3917
- const cmpMeta = hostRef.$cmpMeta$;
3918
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
3919
- if (BUILD25.hostListenerTargetParent) {
3920
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
3921
- }
3922
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
3923
- hostRef.$flags$ |= 1 /* hasConnected */;
3924
- let hostId;
3925
- if (BUILD25.hydrateClientSide) {
3926
- hostId = elm.getAttribute(HYDRATE_ID);
3927
- if (hostId) {
3928
- if (BUILD25.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3929
- const scopeId2 = BUILD25.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
3930
- elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
3931
- } else if (BUILD25.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3932
- const scopeId2 = getScopeId(cmpMeta, BUILD25.mode ? elm.getAttribute("s-mode") : void 0);
3933
- elm["s-sc"] = scopeId2;
3934
- }
3935
- initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
3936
- }
3937
- }
3938
- if (BUILD25.slotRelocation && !hostId) {
3939
- if (BUILD25.hydrateServerSide || (BUILD25.slot || BUILD25.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3940
- cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3941
- setContentReference(elm);
3942
- }
3943
- }
3944
- if (BUILD25.asyncLoading) {
3945
- let ancestorComponent = elm;
3946
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
3947
- if (BUILD25.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
3948
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
3949
- break;
3950
- }
3951
- }
3952
- }
3953
- if (BUILD25.prop && !BUILD25.hydrateServerSide && cmpMeta.$members$) {
3954
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
3955
- if (memberFlags & 31 /* Prop */ && memberName in elm && elm[memberName] !== Object.prototype[memberName]) {
3956
- const value = elm[memberName];
3957
- delete elm[memberName];
3958
- elm[memberName] = value;
3959
- }
3960
- });
3961
- }
3962
- if (BUILD25.initializeNextTick) {
3963
- nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
3964
- } else {
3965
- initializeComponent(elm, hostRef, cmpMeta);
3966
- }
3967
- } else {
3968
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
3969
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
3970
- fireConnectedCallback(hostRef.$lazyInstance$, elm);
3971
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
3972
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
3973
- }
3974
- }
3975
- endConnected();
3976
- }
3977
- };
3978
- var setContentReference = (elm) => {
3979
- if (!win.document) {
3980
- return;
3981
- }
3982
- const contentRefElm = elm["s-cr"] = win.document.createComment(
3983
- BUILD25.isDebug ? `content-ref (host=${elm.localName})` : ""
3984
- );
3985
- contentRefElm["s-cn"] = true;
3986
- insertBefore(elm, contentRefElm, elm.firstChild);
3987
- };
3988
-
3989
- // src/runtime/disconnected-callback.ts
3990
- import { BUILD as BUILD26 } from "@stencil/core/internal/app-data";
3991
- var disconnectInstance = (instance, elm) => {
3992
- if (BUILD26.lazyLoad) {
3993
- safeCall(instance, "disconnectedCallback", void 0, elm || instance);
3994
- }
3995
- };
3996
- var disconnectedCallback = async (elm) => {
3997
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
3998
- const hostRef = getHostRef(elm);
3999
- if (BUILD26.hostListener) {
4000
- if (hostRef == null ? void 0 : hostRef.$rmListeners$) {
4001
- hostRef.$rmListeners$.map((rmListener) => rmListener());
4002
- hostRef.$rmListeners$ = void 0;
4003
- }
4004
- }
4005
- if (!BUILD26.lazyLoad) {
4006
- disconnectInstance(elm);
4007
- } else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
4008
- disconnectInstance(hostRef.$lazyInstance$, elm);
4009
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
4010
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
4011
- }
4012
- }
4013
- if (rootAppliedStyles.has(elm)) {
4014
- rootAppliedStyles.delete(elm);
4015
- }
4016
- if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
4017
- rootAppliedStyles.delete(elm.shadowRoot);
4018
- }
4019
- };
4020
-
4021
- // src/runtime/bootstrap-custom-element.ts
4022
- var defineCustomElement = (Cstr, compactMeta) => {
4023
- customElements.define(
4024
- transformTag(compactMeta[1]),
4025
- proxyCustomElement(Cstr, compactMeta)
4026
- );
4027
- };
4028
- var proxyCustomElement = (Cstr, compactMeta) => {
4029
- const cmpMeta = {
4030
- $flags$: compactMeta[0],
4031
- $tagName$: compactMeta[1]
4032
- };
4033
- try {
4034
- if (BUILD27.member) {
4035
- cmpMeta.$members$ = compactMeta[2];
4036
- }
4037
- if (BUILD27.hostListener) {
4038
- cmpMeta.$listeners$ = compactMeta[3];
4039
- }
4040
- if (BUILD27.propChangeCallback) {
4041
- cmpMeta.$watchers$ = Cstr.$watchers$;
4042
- cmpMeta.$deserializers$ = Cstr.$deserializers$;
4043
- cmpMeta.$serializers$ = Cstr.$serializers$;
4044
- }
4045
- if (BUILD27.reflect) {
4046
- cmpMeta.$attrsToReflect$ = [];
4047
- }
4048
- if (BUILD27.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4049
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
4050
- }
4051
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
4052
- if (BUILD27.experimentalSlotFixes) {
4053
- patchPseudoShadowDom(Cstr.prototype);
4054
- } else {
4055
- if (BUILD27.slotChildNodesFix) {
4056
- patchChildSlotNodes(Cstr.prototype);
4057
- }
4058
- if (BUILD27.cloneNodeFix) {
4059
- patchCloneNode(Cstr.prototype);
4060
- }
4061
- if (BUILD27.appendChildSlotFix) {
4062
- patchSlotAppendChild(Cstr.prototype);
4063
- }
4064
- if (BUILD27.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
4065
- patchTextContent(Cstr.prototype);
4066
- }
4067
- }
4068
- } else if (BUILD27.cloneNodeFix) {
4069
- patchCloneNode(Cstr.prototype);
4070
- }
4071
- if (BUILD27.hydrateClientSide && BUILD27.shadowDom) {
4072
- hydrateScopedToShadow();
4073
- }
4074
- const originalConnectedCallback = Cstr.prototype.connectedCallback;
4075
- const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
4076
- Object.assign(Cstr.prototype, {
4077
- __hasHostListenerAttached: false,
4078
- __registerHost() {
4079
- registerHost(this, cmpMeta);
4080
- },
4081
- connectedCallback() {
4082
- if (!this.__hasHostListenerAttached) {
4083
- const hostRef = getHostRef(this);
4084
- if (!hostRef) {
4085
- return;
4086
- }
4087
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
4088
- this.__hasHostListenerAttached = true;
4089
- }
4090
- connectedCallback(this);
4091
- if (originalConnectedCallback) {
4092
- originalConnectedCallback.call(this);
4093
- }
4094
- },
4095
- disconnectedCallback() {
4096
- disconnectedCallback(this);
4097
- if (originalDisconnectedCallback) {
4098
- originalDisconnectedCallback.call(this);
4099
- }
4100
- },
4101
- __attachShadow() {
4102
- if (supportsShadow) {
4103
- if (!this.shadowRoot) {
4104
- createShadowRoot.call(this, cmpMeta);
4105
- } else {
4106
- if (this.shadowRoot.mode !== "open") {
4107
- throw new Error(
4108
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`
4109
- );
4110
- }
4111
- }
4112
- } else {
4113
- this.shadowRoot = this;
4114
- }
4115
- }
4116
- });
4117
- Object.defineProperty(Cstr, "is", {
4118
- value: cmpMeta.$tagName$,
4119
- configurable: true
4120
- });
4121
- return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
4122
- } catch (e) {
4123
- consoleError(e);
4124
- return Cstr;
4125
- }
4126
- };
4127
- var forceModeUpdate = (elm) => {
4128
- if (BUILD27.style && BUILD27.mode && !BUILD27.lazyLoad) {
4129
- const mode = computeMode(elm);
4130
- const hostRef = getHostRef(elm);
4131
- if (hostRef && hostRef.$modeName$ !== mode) {
4132
- const cmpMeta = hostRef.$cmpMeta$;
4133
- const oldScopeId = elm["s-sc"];
4134
- const scopeId2 = getScopeId(cmpMeta, mode);
4135
- const style = elm.constructor.style[mode];
4136
- const flags = cmpMeta.$flags$;
4137
- if (style) {
4138
- if (!styles.has(scopeId2)) {
4139
- registerStyle(scopeId2, style, !!(flags & 1 /* shadowDomEncapsulation */));
4140
- }
4141
- hostRef.$modeName$ = mode;
4142
- elm.classList.remove(oldScopeId + "-h", oldScopeId + "-s");
4143
- attachStyles(hostRef);
4144
- forceUpdate(elm);
4145
- }
4146
- }
4147
- }
4148
- };
4149
-
4150
- // src/runtime/bootstrap-lazy.ts
4151
- import { BUILD as BUILD28 } from "@stencil/core/internal/app-data";
4152
-
4153
- // src/runtime/hmr-component.ts
4154
- var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
4155
- const hostRef = getHostRef(hostElement);
4156
- if (!hostRef) {
4157
- return;
4158
- }
4159
- hostRef.$flags$ = 1 /* hasConnected */;
4160
- initializeComponent(hostElement, hostRef, cmpMeta, hmrVersionId);
4161
- };
4162
-
4163
- // src/runtime/bootstrap-lazy.ts
4164
- var bootstrapLazy = (lazyBundles, options = {}) => {
4165
- var _a;
4166
- if (BUILD28.profile && performance.mark) {
4167
- performance.mark("st:app:start");
4168
- }
4169
- installDevTools();
4170
- if (!win.document) {
4171
- console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
4172
- return;
4173
- }
4174
- const endBootstrap = createTime("bootstrapLazy");
4175
- const cmpTags = [];
4176
- const exclude = options.exclude || [];
4177
- const customElements2 = win.customElements;
4178
- const head = win.document.head;
4179
- const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
4180
- const dataStyles = /* @__PURE__ */ win.document.createElement("style");
4181
- const deferredConnectedCallbacks = [];
4182
- let appLoadFallback;
4183
- let isBootstrapping = true;
4184
- Object.assign(plt, options);
4185
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
4186
- if (BUILD28.asyncQueue) {
4187
- if (options.syncQueue) {
4188
- plt.$flags$ |= 4 /* queueSync */;
4189
- }
4190
- }
4191
- if (BUILD28.hydrateClientSide) {
4192
- plt.$flags$ |= 2 /* appLoaded */;
4193
- }
4194
- if (BUILD28.hydrateClientSide && BUILD28.shadowDom) {
4195
- hydrateScopedToShadow();
4196
- }
4197
- let hasSlotRelocation = false;
4198
- lazyBundles.map((lazyBundle) => {
4199
- lazyBundle[1].map((compactMeta) => {
4200
- var _a2, _b, _c;
4201
- const cmpMeta = {
4202
- $flags$: compactMeta[0],
4203
- $tagName$: compactMeta[1],
4204
- $members$: compactMeta[2],
4205
- $listeners$: compactMeta[3]
4206
- };
4207
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
4208
- hasSlotRelocation = true;
4209
- }
4210
- if (BUILD28.member) {
4211
- cmpMeta.$members$ = compactMeta[2];
4212
- }
4213
- if (BUILD28.hostListener) {
4214
- cmpMeta.$listeners$ = compactMeta[3];
4215
- }
4216
- if (BUILD28.reflect) {
4217
- cmpMeta.$attrsToReflect$ = [];
4218
- }
4219
- if (BUILD28.propChangeCallback) {
4220
- cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
4221
- cmpMeta.$serializers$ = (_b = compactMeta[5]) != null ? _b : {};
4222
- cmpMeta.$deserializers$ = (_c = compactMeta[6]) != null ? _c : {};
4223
- }
4224
- if (BUILD28.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4225
- cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
4226
- }
4227
- const tagName = BUILD28.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : transformTag(cmpMeta.$tagName$);
4228
- const HostElement = class extends HTMLElement {
4229
- ["s-p"];
4230
- ["s-rc"];
4231
- hasRegisteredEventListeners = false;
4232
- // StencilLazyHost
4233
- constructor(self) {
4234
- super(self);
4235
- self = this;
4236
- registerHost(self, cmpMeta);
4237
- if (BUILD28.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
4238
- if (supportsShadow) {
4239
- if (!self.shadowRoot) {
4240
- createShadowRoot.call(self, cmpMeta);
4241
- } else {
4242
- if (self.shadowRoot.mode !== "open") {
4243
- throw new Error(
4244
- `Unable to re-use existing shadow root for ${cmpMeta.$tagName$}! Mode is set to ${self.shadowRoot.mode} but Stencil only supports open shadow roots.`
4245
- );
4246
- }
4247
- }
4248
- } else if (!BUILD28.hydrateServerSide && !("shadowRoot" in self)) {
4249
- self.shadowRoot = self;
4250
- }
4251
- }
4252
- }
4253
- connectedCallback() {
4254
- const hostRef = getHostRef(this);
4255
- if (!hostRef) {
4256
- return;
4257
- }
4258
- if (!this.hasRegisteredEventListeners) {
4259
- this.hasRegisteredEventListeners = true;
4260
- addHostEventListeners(this, hostRef, cmpMeta.$listeners$, false);
4261
- }
4262
- if (appLoadFallback) {
4263
- clearTimeout(appLoadFallback);
4264
- appLoadFallback = null;
4265
- }
4266
- if (isBootstrapping) {
4267
- deferredConnectedCallbacks.push(this);
4268
- } else {
4269
- plt.jmp(() => connectedCallback(this));
4270
- }
4271
- }
4272
- disconnectedCallback() {
4273
- plt.jmp(() => disconnectedCallback(this));
4274
- plt.raf(() => {
4275
- var _a3;
4276
- const hostRef = getHostRef(this);
4277
- if (!hostRef) {
4278
- return;
4279
- }
4280
- const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
4281
- if (i2 > -1) {
4282
- deferredConnectedCallbacks.splice(i2, 1);
4283
- }
4284
- if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
4285
- delete hostRef.$vnode$.$elm$;
4286
- }
4287
- });
4288
- }
4289
- componentOnReady() {
4290
- var _a3;
4291
- return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
4292
- }
4293
- };
4294
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && cmpMeta.$flags$ & 256 /* hasSlot */) {
4295
- if (BUILD28.experimentalSlotFixes) {
4296
- patchPseudoShadowDom(HostElement.prototype);
4297
- } else {
4298
- if (BUILD28.slotChildNodesFix) {
4299
- patchChildSlotNodes(HostElement.prototype);
4300
- }
4301
- if (BUILD28.cloneNodeFix) {
4302
- patchCloneNode(HostElement.prototype);
4303
- }
4304
- if (BUILD28.appendChildSlotFix) {
4305
- patchSlotAppendChild(HostElement.prototype);
4306
- }
4307
- if (BUILD28.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
4308
- patchTextContent(HostElement.prototype);
4309
- }
4310
- }
4311
- } else if (BUILD28.cloneNodeFix) {
4312
- patchCloneNode(HostElement.prototype);
4313
- }
4314
- if (BUILD28.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
4315
- HostElement.formAssociated = true;
4316
- }
4317
- if (BUILD28.hotModuleReplacement) {
4318
- HostElement.prototype["s-hmr"] = function(hmrVersionId) {
4319
- hmrStart(this, cmpMeta, hmrVersionId);
4320
- };
4321
- }
4322
- cmpMeta.$lazyBundleId$ = lazyBundle[0];
4323
- if (!exclude.includes(tagName) && !customElements2.get(tagName)) {
4324
- cmpTags.push(tagName);
4325
- customElements2.define(
4326
- tagName,
4327
- proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)
4328
- );
4329
- }
4330
- });
4331
- });
4332
- if (cmpTags.length > 0) {
4333
- if (BUILD28.slotRelocation && hasSlotRelocation) {
4334
- dataStyles.textContent += SLOT_FB_CSS;
4335
- }
4336
- if (BUILD28.invisiblePrehydration && (BUILD28.hydratedClass || BUILD28.hydratedAttribute)) {
4337
- dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
4338
- }
4339
- if (dataStyles.innerHTML.length) {
4340
- dataStyles.setAttribute("data-styles", "");
4341
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
4342
- if (nonce != null) {
4343
- dataStyles.setAttribute("nonce", nonce);
4344
- }
4345
- head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
4346
- }
4347
- }
4348
- isBootstrapping = false;
4349
- if (deferredConnectedCallbacks.length) {
4350
- deferredConnectedCallbacks.map((host) => host.connectedCallback());
4351
- } else {
4352
- if (BUILD28.profile) {
4353
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, "timeout"));
4354
- } else {
4355
- plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
4356
- }
4357
- }
4358
- endBootstrap();
4359
- };
4360
-
4361
- // src/runtime/fragment.ts
4362
- var Fragment = (_, children) => children;
4363
-
4364
- // src/runtime/host-listener.ts
4365
- import { BUILD as BUILD29 } from "@stencil/core/internal/app-data";
4366
- var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
4367
- if (BUILD29.hostListener && listeners && win.document) {
4368
- if (BUILD29.hostListenerTargetParent) {
4369
- if (attachParentListeners) {
4370
- listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
4371
- } else {
4372
- listeners = listeners.filter(([flags]) => !(flags & 32 /* TargetParent */));
4373
- }
4374
- }
4375
- listeners.map(([flags, name, method]) => {
4376
- const target = BUILD29.hostListenerTarget ? getHostListenerTarget(win.document, elm, flags) : elm;
4377
- const handler = hostListenerProxy(hostRef, method);
4378
- const opts = hostListenerOpts(flags);
4379
- plt.ael(target, name, handler, opts);
4380
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
4381
- });
4382
- }
4383
- };
4384
- var hostListenerProxy = (hostRef, methodName) => (ev) => {
4385
- var _a;
4386
- try {
4387
- if (BUILD29.lazyLoad) {
4388
- if (hostRef.$flags$ & 256 /* isListenReady */) {
4389
- (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
4390
- } else {
4391
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
4392
- }
4393
- } else {
4394
- hostRef.$hostElement$[methodName](ev);
4395
- }
4396
- } catch (e) {
4397
- consoleError(e, hostRef.$hostElement$);
4398
- }
4399
- };
4400
- var getHostListenerTarget = (doc, elm, flags) => {
4401
- if (BUILD29.hostListenerTargetDocument && flags & 4 /* TargetDocument */) {
4402
- return doc;
4403
- }
4404
- if (BUILD29.hostListenerTargetWindow && flags & 8 /* TargetWindow */) {
4405
- return win;
4406
- }
4407
- if (BUILD29.hostListenerTargetBody && flags & 16 /* TargetBody */) {
4408
- return doc.body;
4409
- }
4410
- if (BUILD29.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement) {
4411
- return elm.parentElement;
4412
- }
4413
- return elm;
4414
- };
4415
- var hostListenerOpts = (flags) => supportsListenerOptions ? {
4416
- passive: (flags & 1 /* Passive */) !== 0,
4417
- capture: (flags & 2 /* Capture */) !== 0
4418
- } : (flags & 2 /* Capture */) !== 0;
4419
-
4420
- // src/runtime/mixin.ts
4421
- import { BUILD as BUILD30 } from "@stencil/core/internal/app-data";
4422
- var baseClass = BUILD30.lazyLoad ? class {
4423
- } : globalThis.HTMLElement || class {
4424
- };
4425
- function Mixin(...mixins) {
4426
- return mixins.reduceRight((acc, mixin) => mixin(acc), baseClass);
4427
- }
4428
-
4429
- // src/runtime/nonce.ts
4430
- var setNonce = (nonce) => plt.$nonce$ = nonce;
4431
-
4432
- // src/runtime/platform-options.ts
4433
- var setPlatformOptions = (opts) => Object.assign(plt, opts);
4434
-
4435
- // src/runtime/render.ts
4436
- function render(vnode, container) {
4437
- const cmpMeta = {
4438
- $flags$: 0,
4439
- $tagName$: container.tagName
4440
- };
4441
- const ref = {
4442
- $flags$: 0,
4443
- $cmpMeta$: cmpMeta,
4444
- $hostElement$: container
4445
- };
4446
- renderVdom(ref, vnode);
4447
- }
4448
-
4449
- // src/runtime/tag-transform.ts
4450
- var tagTransformer = void 0;
4451
- function transformTag(tag) {
4452
- if (!tagTransformer) return tag;
4453
- return tagTransformer(tag);
4454
- }
4455
- function setTagTransformer(transformer) {
4456
- if (tagTransformer) {
4457
- console.warn(`
4458
- A tagTransformer has already been set.
4459
- Overwriting it may lead to error and unexpected results if your components have already been defined.
4460
- `);
4461
- }
4462
- tagTransformer = transformer;
4463
- }
4464
-
4465
- // src/runtime/vdom/jsx-dev-runtime.ts
4466
- function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
4467
- const propsObj = props || {};
4468
- const { children, ...rest } = propsObj;
4469
- let vnodeData = rest;
4470
- if (key !== void 0 && !("key" in rest)) {
4471
- vnodeData = { ...rest, key };
4472
- }
4473
- if (vnodeData && Object.keys(vnodeData).length === 0) {
4474
- vnodeData = null;
4475
- }
4476
- if (children !== void 0) {
4477
- if (Array.isArray(children)) {
4478
- return h(type, vnodeData, ...children);
4479
- }
4480
- if (typeof children === "object" && children !== null && "$flags$" in children) {
4481
- return h(type, vnodeData, children);
4482
- }
4483
- return h(type, vnodeData, children);
4484
- }
4485
- return h(type, vnodeData);
4486
- }
4487
-
4488
- // src/runtime/vdom/jsx-runtime.ts
4489
- function jsx(type, props, key) {
4490
- const propsObj = props || {};
4491
- const { children, ...rest } = propsObj;
4492
- let vnodeData = rest;
4493
- if (key !== void 0 && !("key" in rest)) {
4494
- vnodeData = { ...rest, key };
4495
- }
4496
- if (vnodeData && Object.keys(vnodeData).length === 0) {
4497
- vnodeData = null;
4498
- }
4499
- if (children !== void 0) {
4500
- if (Array.isArray(children)) {
4501
- return h(type, vnodeData, ...children);
4502
- }
4503
- if (typeof children === "object" && children !== null && "$flags$" in children) {
4504
- return h(type, vnodeData, children);
4505
- }
4506
- return h(type, vnodeData, children);
4507
- }
4508
- return h(type, vnodeData);
4509
- }
4510
- function jsxs(type, props, key) {
4511
- return jsx(type, props, key);
4512
- }
4513
-
4514
- // src/runtime/vdom/vdom-annotations.ts
4515
- var insertVdomAnnotations = (doc, staticComponents) => {
4516
- if (doc != null) {
4517
- const docData = STENCIL_DOC_DATA in doc ? doc[STENCIL_DOC_DATA] : { ...DEFAULT_DOC_DATA };
4518
- docData.staticComponents = new Set(staticComponents);
4519
- const orgLocationNodes = [];
4520
- parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
4521
- orgLocationNodes.forEach((orgLocationNode) => {
4522
- var _a;
4523
- if (orgLocationNode != null && orgLocationNode["s-nr"]) {
4524
- const nodeRef = orgLocationNode["s-nr"];
4525
- let hostId = nodeRef["s-host-id"];
4526
- let nodeId = nodeRef["s-node-id"];
4527
- let childId = `${hostId}.${nodeId}`;
4528
- if (hostId == null) {
4529
- hostId = 0;
4530
- docData.rootLevelIds++;
4531
- nodeId = docData.rootLevelIds;
4532
- childId = `${hostId}.${nodeId}`;
4533
- if (nodeRef.nodeType === 1 /* ElementNode */) {
4534
- nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
4535
- if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) {
4536
- nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
4537
- }
4538
- } else if (nodeRef.nodeType === 3 /* TextNode */) {
4539
- if (hostId === 0) {
4540
- const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
4541
- if (textContent === "") {
4542
- orgLocationNode.remove();
4543
- return;
4544
- }
4545
- }
4546
- const commentBeforeTextNode = doc.createComment(childId);
4547
- commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
4548
- insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
4549
- } else if (nodeRef.nodeType === 8 /* CommentNode */) {
4550
- const commentBeforeTextNode = doc.createComment(childId);
4551
- commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
4552
- nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
4553
- }
4554
- }
4555
- let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
4556
- const orgLocationParentNode = orgLocationNode.parentElement;
4557
- if (orgLocationParentNode) {
4558
- if (orgLocationParentNode["s-en"] === "") {
4559
- orgLocationNodeId += `.`;
4560
- } else if (orgLocationParentNode["s-en"] === "c") {
4561
- orgLocationNodeId += `.c`;
4562
- }
4563
- }
4564
- orgLocationNode.nodeValue = orgLocationNodeId;
4565
- }
4566
- });
4567
- }
4568
- };
4569
- var parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
4570
- var _a;
4571
- if (node == null) {
4572
- return;
4573
- }
4574
- if (node["s-nr"] != null) {
4575
- orgLocationNodes.push(node);
4576
- }
4577
- if (node.nodeType === 1 /* ElementNode */) {
4578
- const childNodes = [...Array.from(node.childNodes), ...Array.from(((_a = node.shadowRoot) == null ? void 0 : _a.childNodes) || [])];
4579
- childNodes.forEach((childNode) => {
4580
- const hostRef = getHostRef(childNode);
4581
- if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
4582
- const cmpData = {
4583
- nodeIds: 0
4584
- };
4585
- insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
4586
- }
4587
- parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
4588
- });
4589
- }
4590
- };
4591
- var insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
4592
- if (vnode != null) {
4593
- const hostId = ++docData.hostIds;
4594
- hostElm.setAttribute(HYDRATE_ID, hostId);
4595
- if (hostElm["s-cr"] != null) {
4596
- hostElm["s-cr"].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
4597
- }
4598
- if (vnode.$children$ != null) {
4599
- const depth = 0;
4600
- vnode.$children$.forEach((vnodeChild, index) => {
4601
- insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
4602
- });
4603
- }
4604
- if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute(HYDRATE_CHILD_ID)) {
4605
- const parent = hostElm.parentElement;
4606
- if (parent && parent.childNodes) {
4607
- const parentChildNodes = Array.from(parent.childNodes);
4608
- const comment = parentChildNodes.find(
4609
- (node) => node.nodeType === 8 /* CommentNode */ && node["s-sr"]
4610
- );
4611
- if (comment) {
4612
- const index = parentChildNodes.indexOf(hostElm) - 1;
4613
- vnode.$elm$.setAttribute(
4614
- HYDRATE_CHILD_ID,
4615
- `${comment["s-host-id"]}.${comment["s-node-id"]}.0.${index}`
4616
- );
4617
- }
4618
- }
4619
- }
4620
- }
4621
- };
4622
- var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
4623
- const childElm = vnodeChild.$elm$;
4624
- if (childElm == null) {
4625
- return;
4626
- }
4627
- const nodeId = cmpData.nodeIds++;
4628
- const childId = `${hostId}.${nodeId}.${depth}.${index}`;
4629
- childElm["s-host-id"] = hostId;
4630
- childElm["s-node-id"] = nodeId;
4631
- if (childElm.nodeType === 1 /* ElementNode */) {
4632
- childElm.setAttribute(HYDRATE_CHILD_ID, childId);
4633
- if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) {
4634
- childElm.setAttribute("s-sn", childElm["s-sn"]);
4635
- }
4636
- } else if (childElm.nodeType === 3 /* TextNode */) {
4637
- const parentNode = childElm.parentNode;
4638
- const nodeName = parentNode == null ? void 0 : parentNode.nodeName;
4639
- if (nodeName !== "STYLE" && nodeName !== "SCRIPT") {
4640
- const textNodeId = `${TEXT_NODE_ID}.${childId}`;
4641
- const commentBeforeTextNode = doc.createComment(textNodeId);
4642
- insertBefore(parentNode, commentBeforeTextNode, childElm);
4643
- }
4644
- } else if (childElm.nodeType === 8 /* CommentNode */) {
4645
- if (childElm["s-sr"]) {
4646
- const slotName = childElm["s-sn"] || "";
4647
- const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
4648
- childElm.nodeValue = slotNodeId;
4649
- }
4650
- }
4651
- if (vnodeChild.$children$ != null) {
4652
- const childDepth = depth + 1;
4653
- vnodeChild.$children$.forEach((vnode, index2) => {
4654
- insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index2);
4655
- });
4656
- }
4657
- };
4658
- export {
4659
- BUILD31 as BUILD,
4660
- Build,
4661
- Env,
4662
- Fragment,
4663
- H,
4664
- H as HTMLElement,
4665
- HYDRATED_STYLE_ID,
4666
- Host,
4667
- Mixin,
4668
- NAMESPACE2 as NAMESPACE,
4669
- STENCIL_DEV_MODE,
4670
- addHostEventListeners,
4671
- bootstrapLazy,
4672
- cmpModules,
4673
- connectedCallback,
4674
- consoleDevError,
4675
- consoleDevInfo,
4676
- consoleDevWarn,
4677
- consoleError,
4678
- createEvent,
4679
- defineCustomElement,
4680
- disconnectedCallback,
4681
- forceModeUpdate,
4682
- forceUpdate,
4683
- getAssetPath,
4684
- getElement,
4685
- getHostRef,
4686
- getMode,
4687
- getRenderingRef,
4688
- getValue,
4689
- h,
4690
- insertVdomAnnotations,
4691
- isMemberInElement,
4692
- jsx,
4693
- jsxDEV,
4694
- jsxs,
4695
- loadModule,
4696
- modeResolutionChain,
4697
- needsScopedSSR,
4698
- nextTick,
4699
- parsePropertyValue,
4700
- plt,
4701
- postUpdateComponent,
4702
- promiseResolve,
4703
- proxyComponent,
4704
- proxyCustomElement,
4705
- readTask,
4706
- registerHost,
4707
- registerInstance,
4708
- render,
4709
- renderVdom,
4710
- setAssetPath,
4711
- setErrorHandler,
4712
- setMode,
4713
- setNonce,
4714
- setPlatformHelpers,
4715
- setPlatformOptions,
4716
- setScopedSSR,
4717
- setTagTransformer,
4718
- setValue,
4719
- styles,
4720
- supportsConstructableStylesheets,
4721
- supportsListenerOptions,
4722
- supportsMutableAdoptedStyleSheets,
4723
- supportsShadow,
4724
- transformTag,
4725
- win,
4726
- writeTask
4727
- };