@qwik.dev/core 2.0.0-beta.3 → 2.0.0-beta.30

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 (138) hide show
  1. package/dist/backpatch/index.d.ts +2 -0
  2. package/dist/backpatch/index.mjs +5 -0
  3. package/dist/backpatch/package.json +8 -0
  4. package/dist/backpatch-executor.debug.js +39 -0
  5. package/dist/backpatch-executor.js +1 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.mjs +12916 -0
  8. package/dist/core-internal.d.ts +1077 -707
  9. package/dist/core.min.mjs +2 -1
  10. package/dist/core.mjs +11616 -8673
  11. package/dist/core.mjs.map +1 -1
  12. package/dist/core.prod.mjs +8266 -5225
  13. package/dist/insights/index.qwik.mjs +80 -57
  14. package/dist/loader/index.mjs +2 -2
  15. package/dist/loader/package.json +1 -1
  16. package/dist/optimizer.d.ts +47 -278
  17. package/dist/optimizer.mjs +2403 -3791
  18. package/dist/preloader.mjs +5 -8
  19. package/dist/qwikloader.debug.js +156 -131
  20. package/dist/qwikloader.js +1 -1
  21. package/dist/server.d.ts +51 -203
  22. package/dist/server.mjs +1418 -1088
  23. package/dist/server.prod.mjs +3264 -0
  24. package/dist/starters/adapters/aws-lambda/adapters/aws-lambda/{vite.config.mts → vite.config.ts} +2 -2
  25. package/dist/starters/adapters/aws-lambda/package.json +3 -2
  26. package/dist/starters/adapters/aws-lambda/src/entry_aws-lambda.tsx +2 -6
  27. package/dist/starters/adapters/azure-swa/adapters/azure-swa/{vite.config.mts → vite.config.ts} +2 -2
  28. package/dist/starters/adapters/azure-swa/package.json +3 -2
  29. package/dist/starters/adapters/azure-swa/src/entry.azure-swa.tsx +2 -3
  30. package/dist/starters/adapters/bun/adapters/bun/{vite.config.mts → vite.config.ts} +3 -3
  31. package/dist/starters/adapters/bun/package.json +3 -2
  32. package/dist/starters/adapters/bun/src/entry.bun.ts +0 -2
  33. package/dist/starters/adapters/cloud-run/adapters/cloud-run/{vite.config.mts → vite.config.ts} +2 -2
  34. package/dist/starters/adapters/cloud-run/package.json +3 -2
  35. package/dist/starters/adapters/cloud-run/src/entry.cloud-run.tsx +1 -3
  36. package/dist/starters/adapters/cloudflare-pages/adapters/cloudflare-pages/{vite.config.mts → vite.config.ts} +2 -2
  37. package/dist/starters/adapters/cloudflare-pages/package.json +3 -2
  38. package/dist/starters/adapters/cloudflare-pages/src/entry.cloudflare-pages.tsx +2 -3
  39. package/dist/starters/adapters/cloudflare-workers/README.md +52 -0
  40. package/dist/starters/adapters/cloudflare-workers/adapters/cloudflare-workers/vite.config.ts +15 -0
  41. package/dist/starters/adapters/cloudflare-workers/gitignore +3 -0
  42. package/dist/starters/adapters/cloudflare-workers/package.json +31 -0
  43. package/dist/starters/adapters/cloudflare-workers/public/.assetsignore +4 -0
  44. package/dist/starters/adapters/cloudflare-workers/public/_headers +11 -0
  45. package/dist/starters/adapters/cloudflare-workers/public/_redirects +1 -0
  46. package/dist/starters/adapters/cloudflare-workers/src/entry.cloudflare-pages.tsx +23 -0
  47. package/dist/starters/adapters/cloudflare-workers/worker-configuration.d.ts +5 -0
  48. package/dist/starters/adapters/cloudflare-workers/wrangler.jsonc +41 -0
  49. package/dist/starters/adapters/deno/adapters/deno/{vite.config.mts → vite.config.ts} +2 -2
  50. package/dist/starters/adapters/deno/package.json +3 -2
  51. package/dist/starters/adapters/deno/src/entry.deno.ts +0 -2
  52. package/dist/starters/adapters/express/adapters/express/{vite.config.mts → vite.config.ts} +2 -2
  53. package/dist/starters/adapters/express/package.json +4 -3
  54. package/dist/starters/adapters/express/src/entry.express.tsx +1 -3
  55. package/dist/starters/adapters/fastify/adapters/fastify/{vite.config.mts → vite.config.ts} +2 -2
  56. package/dist/starters/adapters/fastify/package.json +4 -3
  57. package/dist/starters/adapters/fastify/src/entry.fastify.tsx +1 -1
  58. package/dist/starters/adapters/fastify/src/plugins/fastify-qwik.ts +1 -2
  59. package/dist/starters/adapters/firebase/adapters/firebase/{vite.config.mts → vite.config.ts} +2 -2
  60. package/dist/starters/adapters/firebase/package.json +3 -2
  61. package/dist/starters/adapters/firebase/src/entry-firebase.tsx +2 -3
  62. package/dist/starters/adapters/netlify-edge/adapters/netlify-edge/{vite.config.mts → vite.config.ts} +2 -2
  63. package/dist/starters/adapters/netlify-edge/package.json +5 -4
  64. package/dist/starters/adapters/netlify-edge/src/entry.netlify-edge.tsx +2 -3
  65. package/dist/starters/adapters/node-server/adapters/node-server/{vite.config.mts → vite.config.ts} +2 -2
  66. package/dist/starters/adapters/node-server/package.json +3 -2
  67. package/dist/starters/adapters/node-server/src/entry.node-server.tsx +0 -2
  68. package/dist/starters/adapters/{static/adapters/static/vite.config.mts → ssg/adapters/ssg/vite.config.ts} +3 -3
  69. package/dist/starters/adapters/ssg/package.json +20 -0
  70. package/dist/starters/adapters/vercel-edge/README.md +2 -2
  71. package/dist/starters/adapters/vercel-edge/adapters/vercel-edge/{vite.config.mts → vite.config.ts} +2 -2
  72. package/dist/starters/adapters/vercel-edge/package.json +3 -2
  73. package/dist/starters/adapters/vercel-edge/src/entry.vercel-edge.tsx +2 -3
  74. package/dist/starters/adapters/vercel-edge/vercel.json +1 -1
  75. package/dist/starters/features/auth/package.json +1 -1
  76. package/dist/starters/features/compiled-i18n/package.json +37 -0
  77. package/dist/starters/features/compiled-i18n/src/components/locale-selector/locale-selector.tsx +30 -0
  78. package/dist/starters/features/compiled-i18n/src/entry.ssr.tsx +31 -0
  79. package/dist/starters/features/compiled-i18n/src/routes/plugin@compiled-i18n.ts +28 -0
  80. package/dist/starters/features/csr/index.html +27 -0
  81. package/dist/starters/features/csr/package.json +29 -0
  82. package/dist/starters/features/csr/src/root.tsx +15 -0
  83. package/dist/starters/features/csr/vite.config.ts +13 -0
  84. package/dist/starters/features/cypress/src/actions/example.action.ts +5 -0
  85. package/dist/starters/features/cypress/src/components/example/example.cy.tsx +50 -8
  86. package/dist/starters/features/cypress/src/components/example/example.tsx +13 -3
  87. package/dist/starters/features/cypress/src/loaders/example.loader.ts +5 -0
  88. package/dist/starters/features/pandacss/package.json +1 -1
  89. package/dist/starters/features/postcss/postcss.config.js +1 -1
  90. package/dist/starters/features/storybook/.storybook/tsconfig.json +0 -1
  91. package/dist/starters/features/styled-vanilla-extract/package.json +2 -1
  92. package/dist/starters/features/tailwind/package.json +2 -2
  93. package/dist/starters/features/tailwind/prettier.config.js +10 -0
  94. package/dist/starters/features/tailwind-v3/package.json +1 -1
  95. package/dist/starters/features/tailwind-v3/prettier.config.js +10 -0
  96. package/dist/testing/index.d.ts +925 -6
  97. package/dist/testing/index.mjs +15796 -11480
  98. package/dist/testing/package.json +1 -1
  99. package/handlers.mjs +1 -1
  100. package/package.json +34 -56
  101. package/public.d.ts +5 -1
  102. package/{qwik-cli.cjs → qwik-cli.mjs} +1 -1
  103. package/server.d.ts +2 -0
  104. package/bindings/qwik.darwin-arm64.node +0 -0
  105. package/bindings/qwik.darwin-x64.node +0 -0
  106. package/bindings/qwik.linux-x64-gnu.node +0 -0
  107. package/bindings/qwik.wasm.cjs +0 -471
  108. package/bindings/qwik.wasm.mjs +0 -464
  109. package/bindings/qwik.win32-x64-msvc.node +0 -0
  110. package/bindings/qwik_wasm_bg.wasm +0 -0
  111. package/dist/build/index.cjs +0 -35
  112. package/dist/build/index.cjs.map +0 -7
  113. package/dist/build/index.dev.cjs +0 -37
  114. package/dist/build/index.dev.cjs.map +0 -7
  115. package/dist/build/index.prod.cjs +0 -37
  116. package/dist/build/index.prod.cjs.map +0 -7
  117. package/dist/cli.cjs +0 -5545
  118. package/dist/core.cjs +0 -11800
  119. package/dist/core.cjs.map +0 -1
  120. package/dist/core.prod.cjs +0 -5661
  121. package/dist/insights/index.qwik.cjs +0 -1
  122. package/dist/insights/vite/index.cjs +0 -1
  123. package/dist/loader/index.cjs +0 -4
  124. package/dist/optimizer.cjs +0 -4020
  125. package/dist/preloader.cjs +0 -269
  126. package/dist/server.cjs +0 -3037
  127. package/dist/starters/adapters/static/package.json +0 -19
  128. package/dist/starters/features/localize/package.json +0 -37
  129. package/dist/starters/features/localize/src/entry.ssr.tsx +0 -30
  130. package/dist/starters/features/localize/src/locales/message.en.json +0 -8
  131. package/dist/starters/features/localize/src/locales/message.it.json +0 -8
  132. package/dist/starters/features/localize/src/routes/[locale]/i18n-utils.ts +0 -94
  133. package/dist/starters/features/localize/src/routes/[locale]/index.tsx +0 -52
  134. package/dist/starters/features/localize/src/routes/[locale]/layout.tsx +0 -12
  135. package/dist/starters/features/playwright/playwright-report/index.html +0 -22026
  136. package/dist/starters/features/tailwind/.prettierrc.js +0 -3
  137. package/dist/testing/index.cjs +0 -33331
  138. /package/dist/starters/adapters/{static → ssg}/README.md +0 -0
@@ -0,0 +1,3264 @@
1
+ /**
2
+ * @license
3
+ * @qwik.dev/core/server 2.0.0-beta.30-dev+5421ed4
4
+ * Copyright QwikDev. All Rights Reserved.
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
7
+ */
8
+ // packages/qwik/src/server/index.ts
9
+ import { setPlatform as setPlatform2 } from "@qwik.dev/core";
10
+
11
+ // packages/qwik/src/server/platform.ts
12
+ import { setPlatform as Dr } from "@qwik.dev/core";
13
+
14
+ import { isDev as isDev5 } from "@qwik.dev/core/build";
15
+
16
+ // packages/qwik/src/core/client/util-mapArray.ts
17
+ import { isDev as isDev2 } from "@qwik.dev/core/build";
18
+
19
+ // packages/qwik/src/core/shared/error/assert.ts
20
+ import { isDev as Kn } from "@qwik.dev/core/build";
21
+
22
+ // packages/qwik/src/core/shared/utils/qdev.ts
23
+ var Zn = globalThis;
24
+
25
+ var te = Zn.qDev !== false;
26
+
27
+ var qInspector = Zn.qInspector === true;
28
+
29
+ var ne = Zn.qDynamicPlatform !== false;
30
+
31
+ var ee = Zn.qTest === true;
32
+
33
+ var re = Zn.qRuntimeQrl === true;
34
+
35
+ // packages/qwik/src/core/shared/utils/log.ts
36
+ var se = te ? `background: #564CE0; color: white; padding: 2px 3px; border-radius: 2px; font-size: 0.8em;` : "";
37
+
38
+ var throwErrorAndStop = (e, ...t) => {
39
+ const r = ue(false, e, ...t);
40
+ debugger;
41
+ throw r;
42
+ };
43
+
44
+ var logErrorAndStop = (e, ...t) => {
45
+ const r = ue(te, e, ...t);
46
+ debugger;
47
+ return r;
48
+ };
49
+
50
+ var ue = (e, t, ...r) => {
51
+ const n = t instanceof Error ? t : new Error(t);
52
+ !ee && console.error("%cQWIK ERROR", se, n.message, ...r, n.stack);
53
+ e && !ee && setTimeout(() => {
54
+ throw n;
55
+ }, 0);
56
+ return n;
57
+ };
58
+
59
+ // packages/qwik/src/core/shared/error/assert.ts
60
+ var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
61
+
62
+ function assertTrue(e, t, ...r) {
63
+ if (Kn) {
64
+ if (e === true) {
65
+ return;
66
+ }
67
+ throwErrorAndStop(ASSERT_DISCLAIMER + t, ...r);
68
+ }
69
+ }
70
+
71
+ // packages/qwik/src/core/client/util-mapArray.ts
72
+ var fe = (e, t, r) => {
73
+ isDev2 && assertTrue(r % 2 === 0, "Expecting even number.");
74
+ let n = r >> 1;
75
+ let s = e.length - 2 >> 1;
76
+ while (n <= s) {
77
+ const r = n + (s - n >> 1);
78
+ const i = e[r << 1];
79
+ if (i === t) {
80
+ return r << 1;
81
+ }
82
+ if (i < t) {
83
+ n = r + 1;
84
+ } else {
85
+ s = r - 1;
86
+ }
87
+ }
88
+ return n << 1 ^ -1;
89
+ };
90
+
91
+ var ae = (e, t, r, n, s = false) => {
92
+ const i = fe(e, t, n);
93
+ if (i >= 0) {
94
+ if (r == null && !s) {
95
+ e.splice(i, 2);
96
+ } else {
97
+ e[i + 1] = r;
98
+ }
99
+ } else if (r != null || s) {
100
+ e.splice(i ^ -1, 0, t, r);
101
+ }
102
+ };
103
+
104
+ var mapApp_remove = (e, t, r) => {
105
+ const n = fe(e, t, r);
106
+ let s = null;
107
+ if (n >= 0) {
108
+ s = e[n + 1];
109
+ e.splice(n, 2);
110
+ return s;
111
+ }
112
+ return s;
113
+ };
114
+
115
+ var he = (e, t, r) => {
116
+ const n = fe(e, t, r);
117
+ if (n >= 0) {
118
+ return e[n + 1];
119
+ } else {
120
+ return null;
121
+ }
122
+ };
123
+
124
+ var de = (e, t, r) => fe(e, t, r) >= 0;
125
+
126
+ // packages/qwik/src/core/shared/utils/types.ts
127
+ var pe = e => typeof e === "object" && e !== null;
128
+
129
+ var ye = e => Array.isArray(e);
130
+
131
+ var me = e => typeof e === "string";
132
+
133
+ // packages/qwik/src/core/shared/error/error.ts
134
+ var codeToText = (e, ...t) => {
135
+ if (te) {
136
+ const r = [ "Error while serializing class or style attributes",
137
+ // 0
138
+ "Scheduler not found",
139
+ // 1
140
+ "track() received object, without prop to track",
141
+ // 2
142
+ "Only primitive and object literals can be serialized. {{0}}",
143
+ // 3
144
+ "You can render over a existing q:container. Skipping render().",
145
+ // 4
146
+ "QRL is not a function",
147
+ // 5
148
+ "Dynamic import {{0}} not found",
149
+ // 6
150
+ "Unknown type argument",
151
+ // 7
152
+ `Actual value for useContext({{0}}) can not be found, make sure some ancestor component has set a value using useContextProvider(). In the browser make sure that the context was used during SSR so its state was serialized.`,
153
+ // 8
154
+ "Invoking 'use*()' method outside of invocation context.",
155
+ // 9
156
+ `Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.\nSee https://qwik.dev/docs/core/tasks/#use-method-rules`,
157
+ // 10
158
+ 'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
159
+ // 11
160
+ "SsrError(tag): {{0}}",
161
+ // 12
162
+ "QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
163
+ // 13
164
+ "QRLs can not be dynamically resolved, because it does not have a chunk path",
165
+ // 14
166
+ "{{0}}\nThe JSX ref attribute must be a Signal",
167
+ // 15
168
+ "Serialization Error: Deserialization of data type {{0}} is not implemented",
169
+ // 16
170
+ "Serialization Error: Expected vnode for ref prop, but got {{0}}",
171
+ // 17
172
+ "Serialization Error: Cannot allocate data type {{0}}",
173
+ // 18
174
+ "Serialization Error: Missing root id for {{0}}",
175
+ // 19
176
+ "Serialization Error: Serialization of data type {{0}} is not implemented",
177
+ // 20
178
+ "Serialization Error: Unvisited {{0}}",
179
+ // 21
180
+ "Serialization Error: Missing QRL chunk for {{0}}",
181
+ // 22
182
+ "{{0}}\nThe value of the textarea must be a string found {{1}}",
183
+ // 23
184
+ "Unable to find q:container",
185
+ // 24
186
+ "Element must have 'q:container' attribute.",
187
+ // 25
188
+ "Unknown vnode type {{0}}.",
189
+ // 26
190
+ "Materialize error: missing element: {{0}} {{1}} {{2}}",
191
+ // 27
192
+ "Cannot coerce a Signal, use `.value` instead",
193
+ // 28
194
+ "useComputed$ QRL {{0}} {{1}} cannot return a Promise",
195
+ // 29
196
+ `===\nQwik version {{0}} already imported while importing {{1}}.\nThis can lead to issues due to duplicated shared structures.\nVerify that the Qwik libraries you're using are in "resolve.noExternal[]" and in "optimizeDeps.exclude".\n===\n`,
197
+ // 30
198
+ "WrappedSignal is read-only",
199
+ // 31
200
+ "Attribute value is unsafe for SSR {{0}}",
201
+ // 32
202
+ "SerializerSymbol function returned rejected promise",
203
+ // 33
204
+ "Serialization Error: Cannot serialize function: {{0}}" ];
205
+ let n = r[e] ?? "";
206
+ if (t.length) {
207
+ n = n.replaceAll(/{{(\d+)}}/g, (e, r) => {
208
+ let n = t[r];
209
+ if (n && pe(n) && n.constructor === Object) {
210
+ n = JSON.stringify(n).slice(0, 50);
211
+ }
212
+ return n;
213
+ });
214
+ }
215
+ return `Code(Q${e}): ${n}`;
216
+ } else {
217
+ return `Code(Q${e}) https://github.com/QwikDev/qwik/blob/build/v2/packages/qwik/src/core/shared/error/error.ts#${t.join()}L${9 + e}`;
218
+ }
219
+ };
220
+
221
+ var be = (e, t = []) => {
222
+ const r = codeToText(e, ...t);
223
+ return logErrorAndStop(r, ...t);
224
+ };
225
+
226
+ // packages/qwik/src/core/shared/qrl/qrl-utils.ts
227
+ import { isDev as isDev3 } from "@qwik.dev/core/build";
228
+
229
+ var ve = "<sync>";
230
+
231
+ // packages/qwik/src/core/shared/types.ts
232
+ var Se = "q:type";
233
+
234
+ // packages/qwik/src/core/shared/vnode-data-types.ts
235
+ var VNodeDataSeparator = {
236
+ REFERENCE_CH:
237
+ /* ***** */ `~`,
238
+ // `~` is a reference to the node. Save it.
239
+ REFERENCE:
240
+ /* ******** */ 126,
241
+ // `~` is a reference to the node. Save it.
242
+ ADVANCE_1_CH:
243
+ /* ***** */ `!`,
244
+ // `!` is vNodeData separator skipping 0. (ie next vNode)
245
+ ADVANCE_1:
246
+ /* ********* */ 33,
247
+ // `!` is vNodeData separator skipping 0. (ie next vNode)
248
+ ADVANCE_2_CH:
249
+ /* ***** */ `"`,
250
+ // `"` is vNodeData separator skipping 1.
251
+ ADVANCE_2:
252
+ /* ********* */ 34,
253
+ // `"` is vNodeData separator skipping 1.
254
+ ADVANCE_4_CH:
255
+ /* ***** */ `#`,
256
+ // `#` is vNodeData separator skipping 2.
257
+ ADVANCE_4:
258
+ /* ********* */ 35,
259
+ // `#` is vNodeData separator skipping 2.
260
+ ADVANCE_8_CH:
261
+ /* ***** */ `$`,
262
+ // `$` is vNodeData separator skipping 4.
263
+ ADVANCE_8:
264
+ /* ********* */ 36,
265
+ // `$` is vNodeData separator skipping 4.
266
+ ADVANCE_16_CH:
267
+ /* **** */ `%`,
268
+ // `%` is vNodeData separator skipping 8.
269
+ ADVANCE_16:
270
+ /* ******** */ 37,
271
+ // `%` is vNodeData separator skipping 8.
272
+ ADVANCE_32_CH:
273
+ /* **** */ `&`,
274
+ // `&` is vNodeData separator skipping 16.
275
+ ADVANCE_32:
276
+ /* ******** */ 38,
277
+ // `&` is vNodeData separator skipping 16.
278
+ ADVANCE_64_CH:
279
+ /* **** */ `'`,
280
+ // `'` is vNodeData separator skipping 32.
281
+ ADVANCE_64:
282
+ /* ******** */ 39,
283
+ // `'` is vNodeData separator skipping 32.
284
+ ADVANCE_128_CH:
285
+ /* *** */ `(`,
286
+ // `(` is vNodeData separator skipping 64.
287
+ ADVANCE_128:
288
+ /* ******* */ 40,
289
+ // `(` is vNodeData separator skipping 64.
290
+ ADVANCE_256_CH:
291
+ /* *** */ `)`,
292
+ // `)` is vNodeData separator skipping 128.
293
+ ADVANCE_256:
294
+ /* ******* */ 41,
295
+ // `)` is vNodeData separator skipping 128.
296
+ ADVANCE_512_CH:
297
+ /* *** */ `*`,
298
+ // `*` is vNodeData separator skipping 256.
299
+ ADVANCE_512:
300
+ /* ******* */ 42,
301
+ // `*` is vNodeData separator skipping 256.
302
+ ADVANCE_1024_CH:
303
+ /* ** */ `+`,
304
+ // `+` is vNodeData separator skipping 512.
305
+ ADVANCE_1024:
306
+ /* ****** */ 43,
307
+ // `+` is vNodeData separator skipping 512.
308
+ ADVANCE_2048_CH:
309
+ /* * */ ",",
310
+ // ',' is vNodeData separator skipping 1024.
311
+ ADVANCE_2048:
312
+ /* ****** */ 44,
313
+ // ',' is vNodeData separator skipping 1024.
314
+ ADVANCE_4096_CH:
315
+ /* * */ `-`,
316
+ // `-` is vNodeData separator skipping 2048.
317
+ ADVANCE_4096:
318
+ /* ****** */ 45,
319
+ // `-` is vNodeData separator skipping 2048.
320
+ ADVANCE_8192_CH:
321
+ /* * */ `.`,
322
+ // `.` is vNodeData separator skipping 4096.
323
+ ADVANCE_8192:
324
+ /* ****** */ 46
325
+ };
326
+
327
+ var VNodeDataChar = {
328
+ OPEN:
329
+ /* ************** */ 123,
330
+ // `{` is the start of the VNodeData for a virtual element.
331
+ OPEN_CHAR:
332
+ /* ****** */ "{",
333
+ CLOSE:
334
+ /* ************* */ 125,
335
+ // `}` is the end of the VNodeData for a virtual element.
336
+ CLOSE_CHAR:
337
+ /* ***** */ "}",
338
+ SCOPED_STYLE:
339
+ /* ******* */ 59,
340
+ // `;` - `q:sstyle` - Style attribute.
341
+ SCOPED_STYLE_CHAR:
342
+ ";",
343
+ RENDER_FN:
344
+ /* ********** */ 60,
345
+ // `<` - `q:renderFn' - Component QRL render function (body)
346
+ RENDER_FN_CHAR:
347
+ /* ** */ "<",
348
+ ID:
349
+ /* ***************** */ 61,
350
+ // `=` - `q:id` - ID of the element.
351
+ ID_CHAR:
352
+ /* ********* */ "=",
353
+ PROPS:
354
+ /* ************** */ 62,
355
+ // `>` - `q:props' - Component Props
356
+ PROPS_CHAR:
357
+ /* ****** */ ">",
358
+ SLOT_PARENT:
359
+ /* ******** */ 63,
360
+ // `?` - `q:sparent` - Slot parent.
361
+ SLOT_PARENT_CHAR:
362
+ "?",
363
+ KEY:
364
+ /* **************** */ 64,
365
+ // `@` - `q:key` - Element key.
366
+ KEY_CHAR:
367
+ /* ******** */ "@",
368
+ SEQ:
369
+ /* **************** */ 91,
370
+ // `[` - `q:seq' - Seq value from `useSequentialScope()`
371
+ SEQ_CHAR:
372
+ /* ******** */ "[",
373
+ DON_T_USE:
374
+ /* ********** */ 92,
375
+ // `\` - SKIP because `\` is used as escaping
376
+ DON_T_USE_CHAR: "\\",
377
+ CONTEXT:
378
+ /* ************ */ 93,
379
+ // `]` - `q:ctx' - Component context/props
380
+ CONTEXT_CHAR:
381
+ /* **** */ "]",
382
+ SEQ_IDX:
383
+ /* ************ */ 94,
384
+ // `^` - `q:seqIdx' - Sequential scope id
385
+ SEQ_IDX_CHAR:
386
+ /* **** */ "^",
387
+ BACK_REFS:
388
+ /* ********** */ 96,
389
+ // '`' - `q:brefs' - Effect dependencies/subscriptions
390
+ BACK_REFS_CHAR:
391
+ /* ** */ "`",
392
+ SEPARATOR:
393
+ /* ********* */ 124,
394
+ // `|` - Separator char to encode any key/value pairs.
395
+ SEPARATOR_CHAR:
396
+ /* ** */ "|",
397
+ SLOT:
398
+ /* ************** */ 126,
399
+ // `~` - `q:slot' - Slot name
400
+ SLOT_CHAR:
401
+ /* ******* */ "~"
402
+ };
403
+
404
+ // packages/qwik/src/core/shared/utils/character-escaping.ts
405
+ function escapeHTML(e) {
406
+ let t = "";
407
+ const r = e.length;
408
+ let n = 0;
409
+ let s = n;
410
+ for (;n < r; n++) {
411
+ const r = e.charCodeAt(n);
412
+ if (r === 60) {
413
+ t += e.substring(s, n) + "&lt;";
414
+ } else if (r === 62) {
415
+ t += e.substring(s, n) + "&gt;";
416
+ } else if (r === 38) {
417
+ t += e.substring(s, n) + "&amp;";
418
+ } else if (r === 34) {
419
+ t += e.substring(s, n) + "&quot;";
420
+ } else if (r === 39) {
421
+ t += e.substring(s, n) + "&#39;";
422
+ } else {
423
+ continue;
424
+ }
425
+ s = n + 1;
426
+ }
427
+ if (s === 0) {
428
+ return e;
429
+ } else {
430
+ return t + e.substring(s);
431
+ }
432
+ }
433
+
434
+ function encodeVNodeDataString(e) {
435
+ let t = "";
436
+ const r = e.length;
437
+ let n = 0;
438
+ let s = n;
439
+ for (;n < r; n++) {
440
+ const r = e.charCodeAt(n);
441
+ if (r >= VNodeDataSeparator.ADVANCE_1 && r <= VNodeDataSeparator.ADVANCE_8192) {
442
+ t += e.substring(s, n) + "\\" + e.charAt(n);
443
+ } else {
444
+ continue;
445
+ }
446
+ s = n + 1;
447
+ }
448
+ if (s === 0) {
449
+ return e;
450
+ } else {
451
+ return t + e.substring(s);
452
+ }
453
+ }
454
+
455
+ // packages/qwik/src/core/shared/utils/markers.ts
456
+ var qe = "q:renderFn";
457
+
458
+ var Ce = "q:slot";
459
+
460
+ var QSlotParent = "q:sparent";
461
+
462
+ var _e = "q:style";
463
+
464
+ var Oe = "style[q\\:style]";
465
+
466
+ var QStyleSSelector = "style[q\\:sstyle]";
467
+
468
+ var Ae = Oe + "," + QStyleSSelector;
469
+
470
+ var Pe = "q:sstyle";
471
+
472
+ var Ne = "q:ctx";
473
+
474
+ var Ie = "q:brefs";
475
+
476
+ var QRenderAttr = "q:render";
477
+
478
+ var QRuntimeAttr = "q:runtime";
479
+
480
+ var QVersionAttr = "q:version";
481
+
482
+ var Te = "q:base";
483
+
484
+ var QLocaleAttr = "q:locale";
485
+
486
+ var QManifestHashAttr = "q:manifest-hash";
487
+
488
+ var QInstanceAttr = "q:instance";
489
+
490
+ var Fe = "q:container-island";
491
+
492
+ var ze = "/" + Fe;
493
+
494
+ var Le = "q:ignore";
495
+
496
+ var De = "/" + Le;
497
+
498
+ var Ue = "q:container";
499
+
500
+ var We = "/" + Ue;
501
+
502
+ var Qe = "q:template";
503
+
504
+ var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
505
+
506
+ var Ye = "";
507
+
508
+ var ELEMENT_ID = "q:id";
509
+
510
+ var Xe = "q:key";
511
+
512
+ var Ge = "q:props";
513
+
514
+ var Ke = "q:seq";
515
+
516
+ var Ze = "q:seqIdx";
517
+
518
+ var ELEMENT_BACKPATCH_DATA = "qwik/backpatch";
519
+
520
+ var tr = "q:p";
521
+
522
+ var nr = "q:ps";
523
+
524
+ var er = ":";
525
+
526
+ var rr = er + "on";
527
+
528
+ var ir = er + "onIdx";
529
+
530
+ var sr = er + "onFlags";
531
+
532
+ var or = ":";
533
+
534
+ var lr = "dangerouslySetInnerHTML";
535
+
536
+ // packages/qwik/src/core/shared/utils/promises.ts
537
+ import { isDev as isDev4, isServer as Xn } from "@qwik.dev/core/build";
538
+
539
+ var ur = 100;
540
+
541
+ var fr = e => !!e && typeof e == "object" && typeof e.then === "function";
542
+
543
+ var hr = (e, t) => fr(e) ? e.then(t) : t(e);
544
+
545
+ var checkError = e => {
546
+ if (Xn && e instanceof ReferenceError && e.message.includes("window")) {
547
+ e.message = 'It seems like you forgot to add "if (isBrowser) {...}" here:' + e.message;
548
+ }
549
+ };
550
+
551
+ var dr = e => {
552
+ throw e;
553
+ };
554
+
555
+ function n(e, t = dr) {
556
+ let r = false;
557
+ let n;
558
+ try {
559
+ n = e();
560
+ r = true;
561
+ } catch (e) {
562
+ n = e;
563
+ }
564
+ if (!fr(n)) {
565
+ if (r) {
566
+ return n;
567
+ }
568
+ isDev4 && checkError(n);
569
+ return t(n);
570
+ }
571
+ let s = ur;
572
+ const i = async r => {
573
+ while (fr(r)) {
574
+ try {
575
+ await r;
576
+ return await e();
577
+ } catch (e) {
578
+ if (fr(e)) {
579
+ if (! --s) {
580
+ r = new Error("Exceeded max retry count in retryOnPromise");
581
+ break;
582
+ } else {
583
+ r = e;
584
+ }
585
+ } else {
586
+ r = e;
587
+ break;
588
+ }
589
+ }
590
+ }
591
+ isDev4 && checkError(r);
592
+ return t(r);
593
+ };
594
+ return r ? n.catch(i) : i(n);
595
+ }
596
+
597
+ // packages/qwik/src/core/shared/utils/scoped-styles.ts
598
+ function isClassAttr(e) {
599
+ return e === "class";
600
+ }
601
+
602
+ function convertStyleIdsToString(e) {
603
+ return Array.from(e).join(" ");
604
+ }
605
+
606
+ // packages/qwik/src/core/shared/utils/event-names.ts
607
+ var yr = e => e.charCodeAt(0) === 113 && e.charCodeAt(1) === 45 && e.charCodeAt(3) === 58;
608
+
609
+ function isPreventDefault(e) {
610
+ return e.startsWith("preventdefault:");
611
+ }
612
+
613
+ // packages/qwik/src/core/shared/utils/unitless_number.ts
614
+ var wr = /* @__PURE__ */ new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount",
615
+ // Known Prefixed Properties
616
+ "MozBoxFlex",
617
+ // TODO: Remove these since they shouldn't be used in modern code
618
+ "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
619
+
620
+ var isUnitlessNumber = e => wr.has(e);
621
+
622
+ // packages/qwik/src/core/shared/utils/styles.ts
623
+ var vr = e => {
624
+ if (!e) {
625
+ return "";
626
+ }
627
+ if (me(e)) {
628
+ return e.trim();
629
+ }
630
+ const t = [];
631
+ if (ye(e)) {
632
+ for (const r of e) {
633
+ const e = vr(r);
634
+ if (e) {
635
+ t.push(e);
636
+ }
637
+ }
638
+ } else {
639
+ for (const [r, n] of Object.entries(e)) {
640
+ if (n) {
641
+ t.push(r.trim());
642
+ }
643
+ }
644
+ }
645
+ return t.join(" ");
646
+ };
647
+
648
+ var gr = e => e.replace(/([A-Z])/g, "-$1").toLowerCase();
649
+
650
+ var stringifyStyle = e => {
651
+ if (e == null) {
652
+ return "";
653
+ }
654
+ if (typeof e == "object") {
655
+ if (ye(e)) {
656
+ throw be(0 /* stringifyClassOrStyle */ , [ e, "style" ]);
657
+ } else {
658
+ const t = [];
659
+ for (const r in e) {
660
+ if (Object.prototype.hasOwnProperty.call(e, r)) {
661
+ const n = e[r];
662
+ if (n != null && typeof n !== "function") {
663
+ if (r.startsWith("--")) {
664
+ t.push(r + ":" + n);
665
+ } else {
666
+ t.push(gr(r) + ":" + Sr(r, n));
667
+ }
668
+ }
669
+ }
670
+ }
671
+ return t.join(";");
672
+ }
673
+ }
674
+ return String(e);
675
+ };
676
+
677
+ var serializeBooleanOrNumberAttribute = e => e != null ? String(e) : null;
678
+
679
+ function r(e, t, r) {
680
+ if (isClassAttr(e)) {
681
+ const e = vr(t);
682
+ t = r ? r + (e.length ? " " + e : e) : e;
683
+ } else if (e === "style") {
684
+ t = stringifyStyle(t);
685
+ } else if (isEnumeratedBooleanAttribute(e) || typeof t === "number") {
686
+ t = serializeBooleanOrNumberAttribute(t);
687
+ } else if (t === false || t == null) {
688
+ t = null;
689
+ } else if (t === true && isPreventDefault(e)) {
690
+ t = "";
691
+ }
692
+ return t;
693
+ }
694
+
695
+ function isEnumeratedBooleanAttribute(e) {
696
+ return isAriaAttribute(e) || [ "spellcheck", "draggable", "contenteditable" ].includes(e);
697
+ }
698
+
699
+ var Sr = (e, t) => {
700
+ if (typeof t === "number" && t !== 0 && !isUnitlessNumber(e)) {
701
+ return t + "px";
702
+ }
703
+ return t;
704
+ };
705
+
706
+ function isAriaAttribute(e) {
707
+ return e.startsWith("aria-");
708
+ }
709
+
710
+ // packages/qwik/src/core/preloader/queue.ts
711
+ import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
712
+
713
+ // packages/qwik/src/core/preloader/bundle-graph.ts
714
+ import { isBrowser as isBrowser2 } from "@qwik.dev/core/build";
715
+
716
+ // packages/qwik/src/core/preloader/constants.ts
717
+ import { isBrowser as Gn } from "@qwik.dev/core/build";
718
+
719
+ var kr = Gn ? document : void 0;
720
+
721
+ var config = {
722
+ t: false,
723
+ i: 25,
724
+ v: .65
725
+ };
726
+
727
+ var xr = Gn && kr.createElement("link").relList.supports("modulepreload") ? "modulePreload" : "preload";
728
+
729
+ var loadStart = Date.now();
730
+
731
+ var qr = /\.[mc]?js$/;
732
+
733
+ // packages/qwik/src/core/preloader/types.ts
734
+ var BundleImportState_None = 0;
735
+
736
+ var BundleImportState_Queued = 1;
737
+
738
+ var BundleImportState_Preload = 2;
739
+
740
+ var BundleImportState_Alias = 3;
741
+
742
+ var BundleImportState_Loaded = 4;
743
+
744
+ // packages/qwik/src/core/preloader/bundle-graph.ts
745
+ var base;
746
+
747
+ var graph;
748
+
749
+ var makeBundle = (e, t) => ({
750
+ zt: e,
751
+ Tt: qr.test(e) ? BundleImportState_None : BundleImportState_Alias,
752
+ Lt: shouldResetFactor ? t?.map(e => ({
753
+ ...e,
754
+ Jt: 1
755
+ })) : t,
756
+ Dt: 1,
757
+ Ut: Date.now(),
758
+ Wt: 0,
759
+ Qt: 0
760
+ });
761
+
762
+ var parseBundleGraph = e => {
763
+ const t = /* @__PURE__ */ new Map;
764
+ let r = 0;
765
+ while (r < e.length) {
766
+ const n = e[r++];
767
+ const s = [];
768
+ let i;
769
+ let o = 1;
770
+ while (i = e[r], typeof i === "number") {
771
+ if (i < 0) {
772
+ o = -i / 10;
773
+ } else {
774
+ s.push({
775
+ zt: e[i],
776
+ Vt: o,
777
+ Jt: 1
778
+ });
779
+ }
780
+ r++;
781
+ }
782
+ t.set(n, s);
783
+ }
784
+ return t;
785
+ };
786
+
787
+ var Rr = e => {
788
+ let t = Er.get(e);
789
+ if (!t) {
790
+ let r;
791
+ if (graph) {
792
+ r = graph.get(e);
793
+ if (!r) {
794
+ return;
795
+ }
796
+ if (!r.length) {
797
+ r = void 0;
798
+ }
799
+ }
800
+ t = makeBundle(e, r);
801
+ Er.set(e, t);
802
+ }
803
+ return t;
804
+ };
805
+
806
+ var initPreloader = (e, t) => {
807
+ if (t) {
808
+ if ("debug" in t) {
809
+ config.t = !!t.debug;
810
+ }
811
+ if (typeof t.preloadProbability === "number") {
812
+ config.v = 1 - t.preloadProbability;
813
+ }
814
+ }
815
+ if (base != null || !e) {
816
+ return;
817
+ }
818
+ base = "";
819
+ graph = parseBundleGraph(e);
820
+ };
821
+
822
+ // packages/qwik/src/core/preloader/queue.ts
823
+ var Er = /* @__PURE__ */ new Map;
824
+
825
+ var shouldResetFactor;
826
+
827
+ var queueDirty;
828
+
829
+ var Cr = 0;
830
+
831
+ var jr = [];
832
+
833
+ var log = (...e) => {
834
+ console.log(`Preloader ${Date.now() - loadStart}ms ${Cr}/${jr.length} queued>`, ...e);
835
+ };
836
+
837
+ var resetQueue = () => {
838
+ Er.clear();
839
+ queueDirty = false;
840
+ shouldResetFactor = true;
841
+ Cr = 0;
842
+ jr.length = 0;
843
+ };
844
+
845
+ var sortQueue = () => {
846
+ if (queueDirty) {
847
+ jr.sort((e, t) => e.Dt - t.Dt);
848
+ queueDirty = false;
849
+ }
850
+ };
851
+
852
+ var getQueue = () => {
853
+ sortQueue();
854
+ let e = .4;
855
+ const t = [];
856
+ for (const r of jr) {
857
+ const n = Math.round((1 - r.Dt) * 10);
858
+ if (n !== e) {
859
+ e = n;
860
+ t.push(e);
861
+ }
862
+ t.push(r.zt);
863
+ }
864
+ return t;
865
+ };
866
+
867
+ var _r = () => {
868
+ if (!jr.length) {
869
+ return;
870
+ }
871
+ sortQueue();
872
+ while (jr.length) {
873
+ const e = jr[0];
874
+ const t = e.Dt;
875
+ const r = 1 - t;
876
+ const n = graph ? config.i :
877
+ // While the graph is not available, we limit to 5 preloads
878
+ 5;
879
+ if (r >= .99 || Cr < n) {
880
+ jr.shift();
881
+ Or(e);
882
+ } else {
883
+ break;
884
+ }
885
+ }
886
+ if (config.t && !jr.length) {
887
+ const e = [ ...Er.values() ].filter(e => e.Tt > BundleImportState_None);
888
+ const t = e.reduce((e, t) => e + t.Wt, 0);
889
+ const r = e.reduce((e, t) => e + t.Qt, 0);
890
+ log(`>>>> done ${e.length}/${Er.size} total: ${t}ms waited, ${r}ms loaded`);
891
+ }
892
+ };
893
+
894
+ var Or = e => {
895
+ if (e.Tt >= BundleImportState_Preload) {
896
+ return;
897
+ }
898
+ Cr++;
899
+ const t = Date.now();
900
+ e.Wt = t - e.Ut;
901
+ e.Tt = BundleImportState_Preload;
902
+ config.t && log(`<< load ${Math.round((1 - e.Dt) * 100)}% after ${`${e.Wt}ms`}`, e.zt);
903
+ const r = kr.createElement("link");
904
+ r.href = new URL(`${base}${e.zt}`, kr.baseURI).toString();
905
+ r.rel = xr;
906
+ r.as = "script";
907
+ r.onload = r.onerror = () => {
908
+ Cr--;
909
+ const n = Date.now();
910
+ e.Qt = n - t;
911
+ e.Tt = BundleImportState_Loaded;
912
+ config.t && log(`>> done after ${e.Qt}ms`, e.zt);
913
+ r.remove();
914
+ _r();
915
+ };
916
+ kr.head.appendChild(r);
917
+ };
918
+
919
+ var Ar = (e, t, r) => {
920
+ if (r?.has(e)) {
921
+ return;
922
+ }
923
+ const n = e.Dt;
924
+ e.Dt = t;
925
+ if (n - e.Dt < .01) {
926
+ return;
927
+ }
928
+ if (
929
+ // don't queue until we have initialized the preloader
930
+ base != null && e.Tt < BundleImportState_Preload) {
931
+ if (e.Tt === BundleImportState_None) {
932
+ e.Tt = BundleImportState_Queued;
933
+ jr.push(e);
934
+ config.t && log(`queued ${Math.round((1 - e.Dt) * 100)}%`, e.zt);
935
+ }
936
+ queueDirty = true;
937
+ }
938
+ if (e.Lt) {
939
+ r ||= /* @__PURE__ */ new Set;
940
+ r.add(e);
941
+ const t = 1 - e.Dt;
942
+ for (const n of e.Lt) {
943
+ const e = Rr(n.zt);
944
+ if (e.Dt === 0) {
945
+ continue;
946
+ }
947
+ let s;
948
+ if (t === 1 || t >= .99 && Nr < 100) {
949
+ Nr++;
950
+ s = Math.min(.01, 1 - n.Vt);
951
+ } else {
952
+ const r = 1 - n.Vt * t;
953
+ const i = n.Jt;
954
+ const o = r / i;
955
+ s = Math.max(.02, e.Dt * o);
956
+ n.Jt = o;
957
+ }
958
+ Ar(e, s, r);
959
+ }
960
+ }
961
+ };
962
+
963
+ var Pr = (e, t) => {
964
+ const r = Rr(e);
965
+ if (r && r.Dt > t) {
966
+ Ar(r, t);
967
+ }
968
+ };
969
+
970
+ var Nr;
971
+
972
+ var preload = (e, t) => {
973
+ if (!e?.length) {
974
+ return;
975
+ }
976
+ Nr = 0;
977
+ let r = t ? 1 - t : .4;
978
+ if (Array.isArray(e)) {
979
+ for (let t = e.length - 1; t >= 0; t--) {
980
+ const n = e[t];
981
+ if (typeof n === "number") {
982
+ r = 1 - n / 10;
983
+ } else {
984
+ Pr(n, r);
985
+ }
986
+ }
987
+ } else {
988
+ Pr(e, r);
989
+ }
990
+ if (isBrowser3) {
991
+ _r();
992
+ }
993
+ };
994
+
995
+ if (isBrowser3) {
996
+ document.addEventListener("qsymbol", e => {
997
+ const {symbol: t, href: r} = e.detail;
998
+ if (r) {
999
+ const e = t.slice(t.lastIndexOf("_") + 1);
1000
+ preload(e, 1);
1001
+ }
1002
+ });
1003
+ }
1004
+
1005
+ // packages/qwik/src/core/shared/utils/objects.ts
1006
+ var Ir = e => {
1007
+ for (const t in e) {
1008
+ if (Object.prototype.hasOwnProperty.call(e, t)) {
1009
+ return false;
1010
+ }
1011
+ }
1012
+ return true;
1013
+ };
1014
+
1015
+ // packages/qwik/src/core/shared/ssr-const.ts
1016
+ var LT = "<";
1017
+
1018
+ var GT = ">";
1019
+
1020
+ var CLOSE_TAG = "</";
1021
+
1022
+ var mf = " ";
1023
+
1024
+ var ATTR_EQUALS_QUOTE = '="';
1025
+
1026
+ var QUOTE = '"';
1027
+
1028
+ var EMPTY_ATTR = '=""';
1029
+
1030
+ var BRACKET_OPEN = "[";
1031
+
1032
+ var BRACKET_CLOSE = "]";
1033
+
1034
+ var PAREN_CLOSE = ")";
1035
+
1036
+ var Mr = ",";
1037
+
1038
+ // packages/qwik/src/server/platform.ts
1039
+ var getDevSegmentPath = (e, t, r, n) => {
1040
+ const s = e?.[t];
1041
+ if (s) {
1042
+ return s;
1043
+ }
1044
+ if (r === ve) {
1045
+ return [ r, "" ];
1046
+ }
1047
+ if (!n) {
1048
+ if (r.startsWith("_") && r.length < 6) {
1049
+ return [ r, `${import.meta.env.BASE_URL}@qwik-handlers` ];
1050
+ }
1051
+ console.error("qwik symbolMapper: unknown qrl requested without parent:", r);
1052
+ return [ r, `${import.meta.env.BASE_URL}${r}.js` ];
1053
+ }
1054
+ const i = `${import.meta.env.BASE_URL}${n.startsWith("/") ? n.slice(1) : n}_${r}.js`;
1055
+ return [ r, i ];
1056
+ };
1057
+
1058
+ function Fr(e, t) {
1059
+ const r = t?.mapper;
1060
+ const n = e.symbolMapper ? e.symbolMapper : (e, t, n) => {
1061
+ if (r || isDev5 && import.meta.env.MODE !== "test") {
1062
+ const t = da(e);
1063
+ const s = !isDev5 ? r[t] : getDevSegmentPath(r, t, e, n);
1064
+ if (!s) {
1065
+ if (t === ve) {
1066
+ return [ t, "" ];
1067
+ }
1068
+ const s = globalThis.__qwik_reg_symbols?.has(t);
1069
+ if (s) {
1070
+ return [ e, "_" ];
1071
+ }
1072
+ console.error("Cannot resolve symbol", e, "in", r, n);
1073
+ }
1074
+ return s;
1075
+ }
1076
+ };
1077
+ const s = {
1078
+ isServer: true,
1079
+ async importSymbol(e, t, r) {
1080
+ const n = da(r);
1081
+ const s = globalThis.__qwik_reg_symbols?.get(n);
1082
+ if (s) {
1083
+ return s;
1084
+ }
1085
+ throw be(6 /* dynamicImportFailed */ , [ r ]);
1086
+ },
1087
+ raf: () => {
1088
+ console.error("server can not rerender");
1089
+ return Promise.resolve();
1090
+ },
1091
+ chunkForSymbol(e, t, s) {
1092
+ return n(e, r, s);
1093
+ }
1094
+ };
1095
+ return s;
1096
+ }
1097
+
1098
+ async function setServerPlatform(e, t) {
1099
+ const r = Fr(e, t);
1100
+ Dr(r);
1101
+ }
1102
+
1103
+ var da = e => {
1104
+ const t = e.lastIndexOf("_");
1105
+ if (t > -1) {
1106
+ return e.slice(t + 1);
1107
+ }
1108
+ return e;
1109
+ };
1110
+
1111
+ // packages/qwik/src/server/utils.ts
1112
+ function createTimer() {
1113
+ if (typeof performance === "undefined") {
1114
+ return () => 0;
1115
+ }
1116
+ const e = performance.now();
1117
+ return () => {
1118
+ const t = performance.now();
1119
+ const r = t - e;
1120
+ return r / 1e6;
1121
+ };
1122
+ }
1123
+
1124
+ function getBuildBase(e) {
1125
+ let t = e.base;
1126
+ if (typeof e.base === "function") {
1127
+ t = e.base(e);
1128
+ }
1129
+ if (typeof t === "string") {
1130
+ if (!t.endsWith("/")) {
1131
+ t += "/";
1132
+ }
1133
+ return t;
1134
+ }
1135
+ return `${import.meta.env.BASE_URL || "/"}build/`;
1136
+ }
1137
+
1138
+ var versions = {
1139
+ qwik: "2.0.0-beta.30-dev+5421ed4",
1140
+ qwikDom: "2.1.19"
1141
+ };
1142
+
1143
+ // packages/qwik/src/server/ssr-container.ts
1144
+ import { isDev as isDev7 } from "@qwik.dev/core/build";
1145
+
1146
+ import { _SubscriptionData as Yi, _SharedContainer as rc, _jsxSorted as is, _jsxSplit as ss, _res as S, _setEvent, _walkJSX as kn, _createQRL as Eu, isSignal as Mc } from "@qwik.dev/core/internal";
1147
+
1148
+ // packages/qwik/src/server/preload-strategy.ts
1149
+ import { getPlatform as Ur } from "@qwik.dev/core";
1150
+
1151
+ // packages/qwik/src/server/preload-utils.ts
1152
+ function flattenPrefetchResources(e) {
1153
+ const t = [];
1154
+ const r = e => {
1155
+ if (e) {
1156
+ for (const n of e) {
1157
+ if (!t.includes(n.url)) {
1158
+ t.push(n.url);
1159
+ if (n.imports) {
1160
+ r(n.imports);
1161
+ }
1162
+ }
1163
+ }
1164
+ }
1165
+ };
1166
+ r(e);
1167
+ return t;
1168
+ }
1169
+
1170
+ // packages/qwik/src/server/preload-strategy.ts
1171
+ var getBundles = e => {
1172
+ const t = Ur();
1173
+ const r = e?.map(e => {
1174
+ const r = e.St;
1175
+ const n = e.kt;
1176
+ const s = t.chunkForSymbol(r, n, e.dev?.file);
1177
+ if (s) {
1178
+ return s[1];
1179
+ }
1180
+ return n;
1181
+ }).filter(Boolean);
1182
+ return [ ...new Set(r) ];
1183
+ };
1184
+
1185
+ function getPreloadPaths(e, t, r) {
1186
+ const n = t.prefetchStrategy;
1187
+ if (n === null) {
1188
+ return [];
1189
+ }
1190
+ if (!r?.manifest.bundleGraph) {
1191
+ return getBundles(e);
1192
+ }
1193
+ if (typeof n?.symbolsToPrefetch === "function") {
1194
+ try {
1195
+ const e = n.symbolsToPrefetch({
1196
+ manifest: r.manifest
1197
+ });
1198
+ return flattenPrefetchResources(e);
1199
+ } catch (e) {
1200
+ console.error("getPrefetchUrls, symbolsToPrefetch()", e);
1201
+ }
1202
+ }
1203
+ const s = /* @__PURE__ */ new Set;
1204
+ for (const t of e) {
1205
+ const e = da(t.St);
1206
+ if (e && e.length >= 10) {
1207
+ s.add(e);
1208
+ }
1209
+ }
1210
+ return [ ...s ];
1211
+ }
1212
+
1213
+ var expandBundles = (e, t) => {
1214
+ if (!t?.manifest.bundleGraph) {
1215
+ return [ ...new Set(e) ];
1216
+ }
1217
+ resetQueue();
1218
+ let r = .99;
1219
+ for (const t of e) {
1220
+ preload(t, r);
1221
+ r *= .95;
1222
+ }
1223
+ return getQueue();
1224
+ };
1225
+
1226
+ // packages/qwik/src/server/preload-impl.ts
1227
+ var simplifyPath = (e, t) => {
1228
+ if (t == null) {
1229
+ return null;
1230
+ }
1231
+ const r = `${e}${t}`.split("/");
1232
+ const n = [];
1233
+ for (const e of r) {
1234
+ if (e === ".." && n.length > 0) {
1235
+ n.pop();
1236
+ } else {
1237
+ n.push(e);
1238
+ }
1239
+ }
1240
+ return n.join("/");
1241
+ };
1242
+
1243
+ var getBase = e => {
1244
+ let t = e.Zn;
1245
+ if (import.meta.env.DEV && !import.meta.env.TEST) {
1246
+ t = import.meta.env.BASE_URL;
1247
+ }
1248
+ return t;
1249
+ };
1250
+
1251
+ var preloaderPre = (e, t, r) => {
1252
+ const {resolvedManifest: n} = e;
1253
+ const s = getBase(e);
1254
+ const i = simplifyPath(s, n?.manifest?.preloader);
1255
+ let o = n?.manifest.bundleGraphAsset;
1256
+ if (o) {
1257
+ o = (import.meta.env.BASE_URL || "/") + o;
1258
+ }
1259
+ if (i && o && t !== false) {
1260
+ const n = typeof t === "object" ? {
1261
+ debug: t.debug,
1262
+ preloadProbability: t.ssrPreloadProbability
1263
+ } : void 0;
1264
+ const a = e.resolvedManifest?.manifest.bundleGraph;
1265
+ initPreloader(a, n);
1266
+ const l = [];
1267
+ if (t) {
1268
+ if (t.debug) {
1269
+ l.push("d:1");
1270
+ }
1271
+ if (t.maxIdlePreloads) {
1272
+ l.push(`P:${t.maxIdlePreloads}`);
1273
+ }
1274
+ if (t.preloadProbability) {
1275
+ l.push(`Q:${t.preloadProbability}`);
1276
+ }
1277
+ }
1278
+ const c = l.length ? `,{${l.join(",")}}` : "";
1279
+ const u = {
1280
+ rel: "modulepreload",
1281
+ href: i
1282
+ };
1283
+ if (r) {
1284
+ u["nonce"] = r;
1285
+ }
1286
+ e.openElement("link", null, u, null, null, null);
1287
+ e.closeElement();
1288
+ e.openElement("link", null, {
1289
+ rel: "preload",
1290
+ href: o,
1291
+ as: "fetch",
1292
+ crossorigin: "anonymous"
1293
+ }, null, null, null);
1294
+ e.closeElement();
1295
+ const d = `let b=fetch("${o}");import("${i}").then(({l})=>l(${JSON.stringify(s)},b${c}));`;
1296
+ const h = {
1297
+ type: "module",
1298
+ async: true,
1299
+ crossorigin: "anonymous"
1300
+ };
1301
+ if (r) {
1302
+ h["nonce"] = r;
1303
+ }
1304
+ e.openElement("script", null, h, null, null, null);
1305
+ e.write(d);
1306
+ e.closeElement();
1307
+ }
1308
+ const a = simplifyPath(s, n?.manifest.core);
1309
+ if (a) {
1310
+ const t = {
1311
+ rel: "modulepreload",
1312
+ href: a
1313
+ };
1314
+ if (r) {
1315
+ t["nonce"] = r;
1316
+ }
1317
+ e.openElement("link", null, t, null, null, null);
1318
+ e.closeElement();
1319
+ }
1320
+ };
1321
+
1322
+ var includePreloader = (e, t, r, n) => {
1323
+ if (r.length === 0 || t === false) {
1324
+ return null;
1325
+ }
1326
+ const {ssrPreloads: s, ssrPreloadProbability: i} = normalizePreLoaderOptions(typeof t === "boolean" ? void 0 : t);
1327
+ let o = s;
1328
+ const a = getBase(e);
1329
+ const l = [];
1330
+ const {resolvedManifest: c} = e;
1331
+ if (o) {
1332
+ const e = c?.manifest.preloader;
1333
+ const t = c?.manifest.core;
1334
+ const n = expandBundles(r, c);
1335
+ let s = 4;
1336
+ const a = i * 10;
1337
+ for (const r of n) {
1338
+ if (typeof r === "string") {
1339
+ if (s < a) {
1340
+ break;
1341
+ }
1342
+ if (r === e || r === t) {
1343
+ continue;
1344
+ }
1345
+ l.push(r);
1346
+ if (--o === 0) {
1347
+ break;
1348
+ }
1349
+ } else {
1350
+ s = r;
1351
+ }
1352
+ }
1353
+ }
1354
+ const u = simplifyPath(a, c?.manifest.preloader);
1355
+ const d = l.length ?
1356
+ /**
1357
+ * We only use modulepreload links because they behave best. Older browsers can rely on the
1358
+ * preloader which does feature detection and which will be available soon after inserting these
1359
+ * links.
1360
+ */ `${JSON.stringify(l)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(a)}+l;document.head.appendChild(e)});` : "";
1361
+ let h = d;
1362
+ if (u) {
1363
+ h += `window.addEventListener('load',f=>{f=_=>import("${u}").then(({p})=>p(${JSON.stringify(r)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
1364
+ }
1365
+ if (h) {
1366
+ const t = {
1367
+ type: "module",
1368
+ async: "true",
1369
+ "q:type": "preload"
1370
+ };
1371
+ if (n) {
1372
+ t["nonce"] = n;
1373
+ }
1374
+ e.openElement("script", null, t, null, null, null);
1375
+ e.write(h);
1376
+ e.closeElement();
1377
+ }
1378
+ return null;
1379
+ };
1380
+
1381
+ var preloaderPost = (e, t, r) => {
1382
+ if (t.preloader !== false) {
1383
+ const n = Array.from(e.serializationCtx.At);
1384
+ const s = getPreloadPaths(n, t, e.resolvedManifest);
1385
+ if (s.length > 0) {
1386
+ includePreloader(e, t.preloader, s, r);
1387
+ }
1388
+ }
1389
+ };
1390
+
1391
+ function normalizePreLoaderOptions(e) {
1392
+ return {
1393
+ ...preLoaderOptionsDefault,
1394
+ ...e
1395
+ };
1396
+ }
1397
+
1398
+ var preLoaderOptionsDefault = {
1399
+ ssrPreloads: 7,
1400
+ ssrPreloadProbability: .5,
1401
+ debug: false,
1402
+ maxIdlePreloads: 25,
1403
+ preloadProbability: .35
1404
+ };
1405
+
1406
+ // packages/qwik/src/server/scripts.ts
1407
+ var QWIK_LOADER_DEFAULT_MINIFIED = 'const e=document,t=window,o="w",n="d",r=new Set,s=new Set([e]),i=new Map;let a,c;const l=(e,t)=>Array.from(e.querySelectorAll(t)),q=e=>{const t=[];return s.forEach(o=>t.push(...l(o,e))),t},d=(e,t,o,n=!1)=>e.addEventListener(t,o,{capture:n,passive:!1}),b=e=>{_(e),l(e,"[q\\\\:shadowroot]").forEach(e=>{const t=e.shadowRoot;t&&b(t)})},f=e=>e&&"function"==typeof e.then,p=t=>{if(void 0===t._qwikjson_){let o=(t===e.documentElement?e.body:t).lastElementChild;for(;o;){if("SCRIPT"===o.tagName&&"qwik/json"===o.getAttribute("type")){t._qwikjson_=JSON.parse(o.textContent.replace(/\\\\x3C(\\/?script)/gi,"<$1"));break}o=o.previousElementSibling}}},u=(e,t)=>new CustomEvent(e,{detail:t}),h=(t,o)=>{e.dispatchEvent(u(t,o))},m=e=>e.replace(/([A-Z-])/g,e=>"-"+e.toLowerCase()),v=e=>e.replace(/-./g,e=>e[1].toUpperCase()),w=e=>({scope:e.charAt(0),eventName:v(e.slice(2))}),y=async(t,o,n,r)=>{r&&(t.hasAttribute("preventdefault:"+r)&&o.preventDefault(),t.hasAttribute("stoppropagation:"+r)&&o.stopPropagation());const s=t._qDispatch?.[n];if(s){if("function"==typeof s){const e=s(o,t);f(e)&&await e}else if(s.length)for(let e=0;e<s.length;e++){const n=s[e],r=n?.(o,t);f(r)&&await r}return}const a=t.getAttribute("q-"+n);if(a){const n=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),r=n.getAttribute("q:base"),s=new URL(r,e.baseURI);for(const c of a.split("|")){const a=performance.now(),[l,q,d]=c.split("#"),b={qBase:r,symbol:q,element:t,reqTime:a};let u,m,v;if(""===l){const t=n.getAttribute("q:instance");u=(e["qFuncs_"+t]||[])[Number.parseInt(q)],u||(m="sync",v=Error("sym:"+q))}else{const e=`${q}|${r}|${l}`;if(u=i.get(e),!u){const t=new URL(l,s).href;try{const o=import(t);p(n),u=(await o)[q],u?(i.set(e,u),h("qsymbol",b)):(m="no-symbol",v=Error(`${q} not in ${t}`))}catch(e){m="async",v=e}}}if(u){if(t.isConnected)try{const e=u.call(d,o,t);f(e)&&await e}catch(e){h("qerror",{error:e,...b})}}else h("qerror",{importError:m,error:v,...b}),console.error(v)}}},g=async e=>{const t=m(e.type),o="e:"+t;let n=e.target;for(;n&&n.getAttribute;){const r=y(n,e,o,t),s=e.bubbles&&!e.cancelBubble;f(r)&&await r,n=s&&e.bubbles&&!e.cancelBubble?n.parentElement:null}},E=(e,t)=>{const o=m(t.type),n=e+":"+o;q("[q-"+e+"\\\\:"+o+"]").forEach(e=>y(e,t,n,o))},A=async e=>{E(n,e)},C=e=>{E(o,e)},k=()=>{const o=e.readyState;if("interactive"==o||"complete"==o){if(c=1,s.forEach(b),r.has("d:qinit")){r.delete("d:qinit");const e=u("qinit");q("[q-d\\\\:qinit]").forEach(t=>{y(t,e,"d:qinit"),t.removeAttribute("q-d:qinit")})}r.has("d:qidle")&&(r.delete("d:qidle"),(t.requestIdleCallback??t.setTimeout).bind(t)(()=>{const e=u("qidle");q("[q-d\\\\:qidle]").forEach(t=>{y(t,e,"d:qidle"),t.removeAttribute("q-d:qidle")})})),r.has("e:qvisible")&&(a||(a=new IntersectionObserver(e=>{for(const t of e)t.isIntersecting&&(a.unobserve(t.target),y(t.target,u("qvisible",t),"e:qvisible"))})),q("[q-e\\\\:qvisible]:not([q\\\\:observed])").forEach(e=>{a.observe(e),e.setAttribute("q:observed","true")}))}},_=(...e)=>{for(let i=0;i<e.length;i++){const a=e[i];if("string"==typeof a){if(!r.has(a)){r.add(a);const{scope:e,eventName:i}=w(a);e===o?d(t,i,C,!0):s.forEach(t=>d(t,i,e===n?A:g,!0)),1!==c||"e:qvisible"!==a&&"d:qinit"!==a&&"d:qidle"!==a||k()}}else s.has(a)||(r.forEach(e=>{const{scope:t,eventName:r}=w(e);t!==o&&d(a,r,t===n?A:g,!0)}),s.add(a))}},S=t._qwikEv;S?.roots||(Array.isArray(S)?_(...S):_("e:click","e:input"),t._qwikEv={events:r,roots:s,push:_},d(e,"readystatechange",k),k())';
1408
+
1409
+ var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst windowPrefix = "w";\nconst documentPrefix = "d";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\nlet hasInitialized;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst addEventListener = (el, eventName, handler, capture = false) => el.addEventListener(eventName, handler, { capture, passive: false });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent) => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n });\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => ({\n scope: event.charAt(0),\n eventName: kebabToCamel(event.slice(2))\n});\nconst dispatch = async (element, ev, scopedKebabName, kebabName) => {\n if (kebabName) {\n if (element.hasAttribute("preventdefault:" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (typeof handlers === "function") {\n const result = handlers(ev, element);\n if (isPromise(result)) {\n await result;\n }\n } else if (handlers.length) {\n for (let i = 0; i < handlers.length; i++) {\n const handler = handlers[i];\n const result = handler?.(ev, element);\n if (isPromise(result)) {\n await result;\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute("q-" + scopedKebabName);\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("|")) {\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split("#");\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n let handler;\n let importError;\n let error;\n if (chunk === "") {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sym:" + symbol);\n }\n } else {\n const key = `${symbol}|${qBase}|${chunk}`;\n handler = symbols.get(key);\n if (!handler) {\n const href = new URL(chunk, base).href;\n try {\n const module = import(\n href\n );\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${href}`);\n } else {\n symbols.set(key, handler);\n emitEvent("qsymbol", eventData);\n }\n } catch (err) {\n importError = "async";\n error = err;\n }\n }\n }\n if (!handler) {\n emitEvent("qerror", {\n importError,\n error,\n ...eventData\n });\n console.error(error);\n continue;\n }\n if (element.isConnected) {\n try {\n const result = handler.call(capturedIds, ev, element);\n if (isPromise(result)) {\n await result;\n }\n } catch (error2) {\n emitEvent("qerror", { error: error2, ...eventData });\n }\n }\n }\n }\n};\nconst processElementEvent = async (ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = "e:" + kebabName;\n let element = ev.target;\n while (element && element.getAttribute) {\n const results = dispatch(element, ev, scopedKebabName, kebabName);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (isPromise(results)) {\n await results;\n }\n element = doBubble && ev.bubbles && !ev.cancelBubble ? element.parentElement : null;\n }\n};\nconst broadcast = (infix, ev) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = infix + ":" + kebabName;\n querySelectorAll("[q-" + infix + "\\\\:" + kebabName + "]").forEach(\n (el) => dispatch(el, ev, scopedKebabName, kebabName)\n );\n};\nconst processDocumentEvent = async (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == "interactive" || readyState == "complete") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has("d:qinit")) {\n events.delete("d:qinit");\n const ev = createEvent("qinit");\n querySelectorAll("[q-d\\\\:qinit]").forEach((el) => {\n dispatch(el, ev, "d:qinit");\n el.removeAttribute("q-d:qinit");\n });\n }\n if (events.has("d:qidle")) {\n events.delete("d:qidle");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent("qidle");\n querySelectorAll("[q-d\\\\:qidle]").forEach((el) => {\n dispatch(el, ev, "d:qidle");\n el.removeAttribute("q-d:qidle");\n });\n });\n }\n if (events.has("e:qvisible")) {\n observer || (observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, createEvent("qvisible", entry), "e:qvisible");\n }\n }\n }));\n querySelectorAll("[q-e\\\\:qvisible]:not([q\\\\:observed])").forEach((el) => {\n observer.observe(el);\n el.setAttribute("q:observed", "true");\n });\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (let i = 0; i < eventNames.length; i++) {\n const eventNameOrRoot = eventNames[i];\n if (typeof eventNameOrRoot === "string") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n if (scope === windowPrefix) {\n addEventListener(win, eventName, processWindowEvent, true);\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === "e:qvisible" || eventNameOrRoot === "d:qinit" || eventNameOrRoot === "d:qidle")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n if (scope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n scope === documentPrefix ? processDocumentEvent : processElementEvent,\n true\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot("e:click", "e:input");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
1410
+
1411
+ var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `const t='script[type="qwik/backpatch"]',e=document.currentScript;if(e){const o=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const e=o.querySelector(t);if(e){const t=JSON.parse(e.textContent||"[]"),n=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let r=n.currentNode,c=r.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],i=t[e+1];let s=t[e+2];for(;c<o&&(r=n.nextNode(),r);)r.hasAttribute(":")&&c++;const l=r;null==s||!1===s?l.removeAttribute(i):("boolean"==typeof s&&(s=""),l.setAttribute(i,s))}}}}`;
1412
+
1413
+ var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';\nconst executorScript = document.currentScript;\nif (executorScript) {\n const container = executorScript.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n if (container) {\n const script = container.querySelector(BACKPATCH_DATA_SELECTOR);\n if (script) {\n const data = JSON.parse(script.textContent || "[]");\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n let currentNode = walker.currentNode;\n let currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;\n for (let i = 0; i < data.length; i += 3) {\n const elementIdx = data[i];\n const attrName = data[i + 1];\n let value = data[i + 2];\n while (currentNodeIdx < elementIdx) {\n currentNode = walker.nextNode();\n if (!currentNode) {\n break;\n }\n if (currentNode.hasAttribute(":")) {\n currentNodeIdx++;\n }\n }\n const element = currentNode;\n if (value == null || value === false) {\n element.removeAttribute(attrName);\n } else {\n if (typeof value === "boolean") {\n value = "";\n }\n element.setAttribute(attrName, value);\n }\n }\n }\n }\n}`;
1414
+
1415
+ function getQwikLoaderScript(e = {}) {
1416
+ return e.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
1417
+ }
1418
+
1419
+ var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
1420
+
1421
+ var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
1422
+
1423
+ function getQwikPrefetchWorkerScript(e = {}) {
1424
+ return e.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
1425
+ }
1426
+
1427
+ function getQwikBackpatchExecutorScript(e = {}) {
1428
+ return e.debug ? QWIK_BACKPATCH_EXECUTOR_DEBUG : QWIK_BACKPATCH_EXECUTOR_MINIFIED;
1429
+ }
1430
+
1431
+ // packages/qwik/src/server/ssr-node.ts
1432
+ import { _isJSXNode as ts, _EMPTY_OBJ, _EFFECT_BACK_REF as Yr } from "@qwik.dev/core/internal";
1433
+
1434
+ import { isDev as isDev6 } from "@qwik.dev/core/build";
1435
+
1436
+ var SsrNode = class {
1437
+ constructor(e, t, r, n, s, i) {
1438
+ this.parentComponent = e;
1439
+ this.attributesIndex = r;
1440
+ this.cleanupQueue = n;
1441
+ this.vnodeData = s;
1442
+ this.currentFile = i;
1443
+ this.id = t;
1444
+ this.flags = 1 /* Updatable */;
1445
+ this.attrs = this.attributesIndex >= 0 ? this.vnodeData[this.attributesIndex] : _EMPTY_OBJ;
1446
+ this.parentComponent?.addChild(this);
1447
+ if (isDev6 && t.indexOf("undefined") != -1) {
1448
+ throw new Error(`Invalid SSR node id: ${t}`);
1449
+ }
1450
+ }
1451
+ __brand__="SsrNode";
1452
+ /**
1453
+ * ID which the deserialize will use to retrieve the node.
1454
+ *
1455
+ * @param id - Unique id for the node.
1456
+ */
1457
+ id;
1458
+ flags;
1459
+ dirty=0 /* NONE */;
1460
+ children=null;
1461
+ attrs;
1462
+ /** Local props which don't serialize; */
1463
+ localProps=null;
1464
+ get [Yr]() {
1465
+ return this.getProp(Ie);
1466
+ }
1467
+ setProp(e, t) {
1468
+ if (this.attrs === _EMPTY_OBJ) {
1469
+ this.setEmptyArrayAsVNodeDataAttributes();
1470
+ }
1471
+ if (e.startsWith(er)) {
1472
+ (this.localProps ||= {})[e] = t;
1473
+ } else {
1474
+ this.attrs[e] = t;
1475
+ }
1476
+ if (e == Ke && t) {
1477
+ this.cleanupQueue.push(t);
1478
+ }
1479
+ }
1480
+ setEmptyArrayAsVNodeDataAttributes() {
1481
+ if (this.attributesIndex >= 0) {
1482
+ this.vnodeData[this.attributesIndex] = {};
1483
+ this.attrs = this.vnodeData[this.attributesIndex];
1484
+ } else {
1485
+ const e = this.vnodeData.length > 1 ? 1 : 0;
1486
+ this.vnodeData.splice(e, 0, {});
1487
+ this.attributesIndex = e;
1488
+ this.attrs = this.vnodeData[this.attributesIndex];
1489
+ }
1490
+ }
1491
+ getProp(e) {
1492
+ if (e.startsWith(er)) {
1493
+ return this.localProps ? this.localProps[e] ?? null : null;
1494
+ } else {
1495
+ return this.attrs[e] ?? null;
1496
+ }
1497
+ }
1498
+ removeProp(e) {
1499
+ if (e.startsWith(er)) {
1500
+ if (this.localProps) {
1501
+ delete this.localProps[e];
1502
+ }
1503
+ } else {
1504
+ delete this.attrs[e];
1505
+ }
1506
+ }
1507
+ addChild(e) {
1508
+ if (!this.children) {
1509
+ this.children = [];
1510
+ }
1511
+ this.children.push(e);
1512
+ }
1513
+ setTreeNonUpdatable() {
1514
+ if (this.flags & 1 /* Updatable */) {
1515
+ this.flags &= ~1 /* Updatable */;
1516
+ if (this.children) {
1517
+ for (const e of this.children) {
1518
+ e.setTreeNonUpdatable();
1519
+ }
1520
+ }
1521
+ }
1522
+ }
1523
+ toString() {
1524
+ if (isDev6) {
1525
+ let e = "";
1526
+ for (const t in this.attrs) {
1527
+ const r = this.attrs[t];
1528
+ e += `${t}=`;
1529
+ e += `${typeof r === "string" || typeof r === "number" ? JSON.stringify(r) : "*"}`;
1530
+ e += ", ";
1531
+ }
1532
+ return `<SSRNode id="${this.id}" ${e} />`;
1533
+ } else {
1534
+ return `<SSRNode id="${this.id}" />`;
1535
+ }
1536
+ }
1537
+ };
1538
+
1539
+ var DomRef = class {
1540
+ constructor(e) {
1541
+ this.Tn = e;
1542
+ }
1543
+ __brand__="DomRef";
1544
+ };
1545
+
1546
+ var SsrComponentFrame = class {
1547
+ constructor(e) {
1548
+ this.componentNode = e;
1549
+ }
1550
+ slots=[];
1551
+ projectionDepth=0;
1552
+ scopedStyleIds=/* @__PURE__ */ new Set;
1553
+ projectionScopedStyle=null;
1554
+ projectionComponentFrame=null;
1555
+ distributeChildrenIntoSlots(e, t, r) {
1556
+ this.projectionScopedStyle = t;
1557
+ this.projectionComponentFrame = r;
1558
+ if (ts(e)) {
1559
+ const t = this.getSlotName(e);
1560
+ ae(this.slots, t, e, 0);
1561
+ } else if (Array.isArray(e) && e.length > 0) {
1562
+ const t = [];
1563
+ for (let r = 0; r < e.length; r++) {
1564
+ const n = e[r];
1565
+ if (ts(n)) {
1566
+ const e = this.getSlotName(n);
1567
+ if (e === Ye) {
1568
+ t.push(n);
1569
+ } else {
1570
+ this.updateSlot(e, n);
1571
+ }
1572
+ } else {
1573
+ t.push(n);
1574
+ }
1575
+ }
1576
+ t.length > 0 && ae(this.slots, Ye, t, 0);
1577
+ } else {
1578
+ ae(this.slots, Ye, e, 0);
1579
+ }
1580
+ }
1581
+ updateSlot(e, t) {
1582
+ let r = he(this.slots, e, 0);
1583
+ if (r === null) {
1584
+ r = t;
1585
+ } else if (Array.isArray(r)) {
1586
+ r.push(t);
1587
+ } else {
1588
+ r = [ r, t ];
1589
+ }
1590
+ ae(this.slots, e, r, 0);
1591
+ }
1592
+ getSlotName(e) {
1593
+ if (e.props[Ce]) {
1594
+ return e.props[Ce];
1595
+ }
1596
+ return Ye;
1597
+ }
1598
+ hasSlot(e) {
1599
+ return de(this.slots, e, 0);
1600
+ }
1601
+ consumeChildrenForSlot(e, t) {
1602
+ const r = mapApp_remove(this.slots, t, 0);
1603
+ this.componentNode.setProp(t, e.id);
1604
+ e.setProp(QSlotParent, this.componentNode.id);
1605
+ return r;
1606
+ }
1607
+ };
1608
+
1609
+ // packages/qwik/src/server/tag-nesting.ts
1610
+ var allowedContent = e => {
1611
+ switch (e) {
1612
+ case 2 /* TEXT */ :
1613
+ return [ "text content", null ];
1614
+
1615
+ case 0 /* NOT_ALLOWED */ :
1616
+ return [ "no content", null ];
1617
+
1618
+ case 32 /* HTML */ :
1619
+ return [ "html content", "<head>, <body>" ];
1620
+
1621
+ case 64 /* HEAD */ :
1622
+ return [ "head content", "<title>, <script>, <noscript>, <style>, <meta>, <link>, <base>, <template>" ];
1623
+
1624
+ case 130 /* BODY */ :
1625
+ return [ "body content", "all tags allowed here" ];
1626
+
1627
+ case 4 /* EMPTY */ :
1628
+ return [ "no-content element", null ];
1629
+
1630
+ case 10 /* ANYTHING */ :
1631
+ return [ "any content", null ];
1632
+
1633
+ case 4096 /* TABLE */ :
1634
+ return [ "table", "<caption>, <colgroup>, <tbody>, <thead>, <tfoot>" ];
1635
+
1636
+ case 8192 /* TABLE_BODY */ :
1637
+ return [ "table body", "<tr>" ];
1638
+
1639
+ case 16384 /* TABLE_ROW */ :
1640
+ return [ "table row", "<td>, <th>" ];
1641
+
1642
+ case 32768 /* TABLE_COLGROUP */ :
1643
+ return [ "table column group", "<col>" ];
1644
+
1645
+ case 258 /* PHRASING_ANY */ :
1646
+ case 514 /* PHRASING_INSIDE_INPUT */ :
1647
+ case 1026 /* PHRASING_CONTAINER */ :
1648
+ return [ "phrasing content", "<a>, <b>, <img>, <input> ... (no <div>, <p> ...)" ];
1649
+
1650
+ case 2050 /* PICTURE */ :
1651
+ return [ "picture content", "<source>, <img>" ];
1652
+
1653
+ case 4098 /* BUTTON */ :
1654
+ return [ "button content", "phrasing content except interactive elements" ];
1655
+
1656
+ case 1 /* DOCUMENT */ :
1657
+ return [ "document", "<html>" ];
1658
+ }
1659
+ };
1660
+
1661
+ var initialTag = e => {
1662
+ switch (e) {
1663
+ case "html":
1664
+ return 32 /* HTML */;
1665
+
1666
+ case "head":
1667
+ return 64 /* HEAD */;
1668
+
1669
+ case "body":
1670
+ return 130 /* BODY */;
1671
+
1672
+ default:
1673
+ return isTagAllowed(10 /* ANYTHING */ , e);
1674
+ }
1675
+ };
1676
+
1677
+ function isTagAllowed(e, t) {
1678
+ switch (e) {
1679
+ case 2 /* TEXT */ :
1680
+ case 0 /* NOT_ALLOWED */ :
1681
+ return 0 /* NOT_ALLOWED */;
1682
+
1683
+ case 32 /* HTML */ :
1684
+ return isInHtml(t);
1685
+
1686
+ case 64 /* HEAD */ :
1687
+ return isInHead(t);
1688
+
1689
+ case 130 /* BODY */ :
1690
+ case 10 /* ANYTHING */ :
1691
+ case 1026 /* PHRASING_CONTAINER */ :
1692
+ return isInAnything(t);
1693
+
1694
+ case 4096 /* TABLE */ :
1695
+ return isInTable(t);
1696
+
1697
+ case 8192 /* TABLE_BODY */ :
1698
+ return isInTableBody(t);
1699
+
1700
+ case 16384 /* TABLE_ROW */ :
1701
+ return isInTableRow(t);
1702
+
1703
+ case 32768 /* TABLE_COLGROUP */ :
1704
+ return isInTableColGroup(t);
1705
+
1706
+ case 258 /* PHRASING_ANY */ :
1707
+ return isInPhrasing(t, true);
1708
+
1709
+ case 514 /* PHRASING_INSIDE_INPUT */ :
1710
+ return isInPhrasing(t, false);
1711
+
1712
+ case 2050 /* PICTURE */ :
1713
+ return isInPicture(t);
1714
+
1715
+ case 4098 /* BUTTON */ :
1716
+ return isInButton(t);
1717
+
1718
+ case 1 /* DOCUMENT */ :
1719
+ if (t === "html") {
1720
+ return 32 /* HTML */;
1721
+ }
1722
+ }
1723
+ return 0 /* NOT_ALLOWED */;
1724
+ }
1725
+
1726
+ function isInHtml(e) {
1727
+ switch (e) {
1728
+ case "head":
1729
+ return 64 /* HEAD */;
1730
+
1731
+ case "body":
1732
+ return 130 /* BODY */;
1733
+
1734
+ default:
1735
+ return 0 /* NOT_ALLOWED */;
1736
+ }
1737
+ }
1738
+
1739
+ function isInHead(e) {
1740
+ switch (e) {
1741
+ case "title":
1742
+ case "script":
1743
+ case "noscript":
1744
+ case "style":
1745
+ return 2 /* TEXT */;
1746
+
1747
+ case "meta":
1748
+ case "link":
1749
+ case "base":
1750
+ return 4 /* EMPTY */;
1751
+
1752
+ case "template":
1753
+ return 10 /* ANYTHING */;
1754
+
1755
+ default:
1756
+ return 0 /* NOT_ALLOWED */;
1757
+ }
1758
+ }
1759
+
1760
+ function isSelfClosingTag(e) {
1761
+ switch (e) {
1762
+ case "area":
1763
+ case "base":
1764
+ case "basefont":
1765
+ case "bgsound":
1766
+ case "br":
1767
+ case "col":
1768
+ case "embed":
1769
+ case "frame":
1770
+ case "hr":
1771
+ case "img":
1772
+ case "input":
1773
+ case "keygen":
1774
+ case "link":
1775
+ case "meta":
1776
+ case "param":
1777
+ case "source":
1778
+ case "track":
1779
+ case "wbr":
1780
+ return true;
1781
+
1782
+ default:
1783
+ return false;
1784
+ }
1785
+ }
1786
+
1787
+ function isInAnything(e) {
1788
+ if (isSelfClosingTag(e)) {
1789
+ return 4 /* EMPTY */;
1790
+ }
1791
+ switch (e) {
1792
+ case "script":
1793
+ case "style":
1794
+ case "noscript":
1795
+ case "noframes":
1796
+ return 2 /* TEXT */;
1797
+
1798
+ case "p":
1799
+ case "pre":
1800
+ return 258 /* PHRASING_ANY */;
1801
+
1802
+ case "table":
1803
+ return 4096 /* TABLE */;
1804
+
1805
+ case "html":
1806
+ case "head":
1807
+ case "body":
1808
+ return 0 /* NOT_ALLOWED */;
1809
+
1810
+ case "button":
1811
+ return 4098 /* BUTTON */;
1812
+
1813
+ case "input":
1814
+ case "textarea":
1815
+ return 514 /* PHRASING_INSIDE_INPUT */;
1816
+
1817
+ case "picture":
1818
+ return 2050 /* PICTURE */;
1819
+
1820
+ default:
1821
+ return 10 /* ANYTHING */;
1822
+ }
1823
+ }
1824
+
1825
+ function isInTable(e) {
1826
+ switch (e) {
1827
+ case "caption":
1828
+ return 10 /* ANYTHING */;
1829
+
1830
+ case "colgroup":
1831
+ return 32768 /* TABLE_COLGROUP */;
1832
+
1833
+ case "thead":
1834
+ case "tbody":
1835
+ case "tfoot":
1836
+ return 8192 /* TABLE_BODY */;
1837
+
1838
+ case "script":
1839
+ return 2 /* TEXT */;
1840
+
1841
+ default:
1842
+ return 0 /* NOT_ALLOWED */;
1843
+ }
1844
+ }
1845
+
1846
+ function isInTableBody(e) {
1847
+ switch (e) {
1848
+ case "tr":
1849
+ return 16384 /* TABLE_ROW */;
1850
+
1851
+ case "script":
1852
+ return 2 /* TEXT */;
1853
+
1854
+ default:
1855
+ return 0 /* NOT_ALLOWED */;
1856
+ }
1857
+ }
1858
+
1859
+ function isInTableRow(e) {
1860
+ switch (e) {
1861
+ case "td":
1862
+ case "th":
1863
+ return 10 /* ANYTHING */;
1864
+
1865
+ case "script":
1866
+ return 2 /* TEXT */;
1867
+
1868
+ default:
1869
+ return 0 /* NOT_ALLOWED */;
1870
+ }
1871
+ }
1872
+
1873
+ function isInTableColGroup(e) {
1874
+ switch (e) {
1875
+ case "col":
1876
+ return 4 /* EMPTY */;
1877
+
1878
+ case "script":
1879
+ return 2 /* TEXT */;
1880
+
1881
+ default:
1882
+ return 0 /* NOT_ALLOWED */;
1883
+ }
1884
+ }
1885
+
1886
+ function isInPicture(e) {
1887
+ switch (e) {
1888
+ case "source":
1889
+ return 4 /* EMPTY */;
1890
+
1891
+ case "img":
1892
+ return 4 /* EMPTY */;
1893
+
1894
+ case "script":
1895
+ return 2 /* TEXT */;
1896
+
1897
+ default:
1898
+ return 0 /* NOT_ALLOWED */;
1899
+ }
1900
+ }
1901
+
1902
+ function isInButton(e) {
1903
+ switch (e) {
1904
+ case "button":
1905
+ case "input":
1906
+ case "textarea":
1907
+ case "select":
1908
+ case "a":
1909
+ return 0 /* NOT_ALLOWED */;
1910
+
1911
+ case "picture":
1912
+ return 2050 /* PICTURE */;
1913
+
1914
+ default:
1915
+ return isInPhrasing(e, false);
1916
+ }
1917
+ }
1918
+
1919
+ function isInPhrasing(e, t) {
1920
+ switch (e) {
1921
+ case "svg":
1922
+ case "math":
1923
+ return 1026 /* PHRASING_CONTAINER */;
1924
+
1925
+ case "input":
1926
+ case "textarea":
1927
+ return t ? 514 /* PHRASING_INSIDE_INPUT */ : 0 /* NOT_ALLOWED */;
1928
+
1929
+ case "a":
1930
+ case "abbr":
1931
+ case "area":
1932
+ case "audio":
1933
+ case "b":
1934
+ case "bdi":
1935
+ case "bdo":
1936
+ case "br":
1937
+ case "button":
1938
+ case "canvas":
1939
+ case "cite":
1940
+ case "code":
1941
+ case "command":
1942
+ case "data":
1943
+ case "datalist":
1944
+ case "del":
1945
+ case "dfn":
1946
+ case "em":
1947
+ case "embed":
1948
+ case "i":
1949
+ case "iframe":
1950
+ case "img":
1951
+ case "ins":
1952
+ case "itemprop":
1953
+ case "kbd":
1954
+ case "keygen":
1955
+ case "label":
1956
+ case "link":
1957
+ case "map":
1958
+ case "mark":
1959
+ case "meta":
1960
+ case "meter":
1961
+ case "noscript":
1962
+ case "object":
1963
+ case "option":
1964
+ case "output":
1965
+ case "progress":
1966
+ case "q":
1967
+ case "ruby":
1968
+ case "s":
1969
+ case "samp":
1970
+ case "select":
1971
+ case "slot":
1972
+ case "small":
1973
+ case "span":
1974
+ case "strong":
1975
+ case "sub":
1976
+ case "sup":
1977
+ case "template":
1978
+ case "time":
1979
+ case "u":
1980
+ case "var":
1981
+ case "video":
1982
+ case "wbr":
1983
+ return t ? 258 /* PHRASING_ANY */ : 514 /* PHRASING_INSIDE_INPUT */;
1984
+
1985
+ case "script":
1986
+ case "style":
1987
+ return 2 /* TEXT */;
1988
+
1989
+ case "picture":
1990
+ return 2050 /* PICTURE */;
1991
+
1992
+ default:
1993
+ return 0 /* NOT_ALLOWED */;
1994
+ }
1995
+ }
1996
+
1997
+ // packages/qwik/src/server/vnode-data.ts
1998
+ var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
1999
+
2000
+ var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
2001
+
2002
+ var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
2003
+
2004
+ function vNodeData_incrementElementCount(e) {
2005
+ const t = e.length;
2006
+ const r = t > 1 ? e[t - 1] : 0;
2007
+ if (r >= 0) {
2008
+ e.push(-1);
2009
+ } else {
2010
+ e[t - 1] = r - 1;
2011
+ }
2012
+ }
2013
+
2014
+ function vNodeData_addTextSize(e, t) {
2015
+ const r = e.length;
2016
+ const n = r > 1 ? e[r - 1] : 0;
2017
+ if (r > 1 && n >= 0) {
2018
+ e[0] |= 1 /* TEXT_DATA */;
2019
+ }
2020
+ e.push(t);
2021
+ if (t == 0) {
2022
+ e[0] |= 1 /* TEXT_DATA */;
2023
+ }
2024
+ }
2025
+
2026
+ function vNodeData_openFragment(e, t) {
2027
+ e.push(t, OPEN_FRAGMENT);
2028
+ e[0] |= 2 /* VIRTUAL_NODE */;
2029
+ }
2030
+
2031
+ function vNodeData_closeFragment(e) {
2032
+ e.push(CLOSE_FRAGMENT);
2033
+ }
2034
+
2035
+ function vNodeData_openElement(e) {
2036
+ e.push({}, WRITE_ELEMENT_ATTRS);
2037
+ e[0] |= 4 /* ELEMENT_NODE */;
2038
+ }
2039
+
2040
+ function vNodeData_createSsrNodeReference(e, t, r, n, s) {
2041
+ t[0] |= 8 /* REFERENCE */;
2042
+ const i = [ -1 ];
2043
+ let o = -1;
2044
+ for (let e = 1; e < t.length; e++) {
2045
+ const r = t[e];
2046
+ if (typeof r === "object" && r !== null) {
2047
+ o = e;
2048
+ e++;
2049
+ if (t[e] !== WRITE_ELEMENT_ATTRS) {
2050
+ i[i.length - 1]++;
2051
+ i.push(-1);
2052
+ }
2053
+ } else if (r === CLOSE_FRAGMENT) {
2054
+ i.pop();
2055
+ } else if (r < 0) {
2056
+ const e = 0 - r;
2057
+ i[i.length - 1] += e;
2058
+ } else {
2059
+ i[i.length - 1]++;
2060
+ }
2061
+ }
2062
+ let a = r + "";
2063
+ if (t[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
2064
+ for (let e = 0; e < i.length; e++) {
2065
+ const t = i[e];
2066
+ if (t >= 0) {
2067
+ a += encodeAsAlphanumeric(t);
2068
+ }
2069
+ }
2070
+ }
2071
+ return new SsrNode(e, a, o, n, t, s);
2072
+ }
2073
+
2074
+ var ALPHANUMERIC = [];
2075
+
2076
+ function encodeAsAlphanumeric(e) {
2077
+ while (ALPHANUMERIC.length <= e) {
2078
+ let e = ALPHANUMERIC.length;
2079
+ let t = "";
2080
+ do {
2081
+ t = String.fromCharCode((t.length === 0 ? 65 : 97) + e % 26
2082
+ /* A-Z */) + t;
2083
+ e = Math.floor(e / 26
2084
+ /* A-Z */);
2085
+ } while (e !== 0);
2086
+ ALPHANUMERIC.push(t);
2087
+ }
2088
+ return ALPHANUMERIC[e];
2089
+ }
2090
+
2091
+ // packages/qwik/src/server/ssr-container.ts
2092
+ function ssrCreateContainer(e) {
2093
+ e.renderOptions ||= {};
2094
+ return new SSRContainer({
2095
+ tagName: e.tagName || "div",
2096
+ writer: e.writer || new StringBufferWriter,
2097
+ streamHandler: e.streamHandler,
2098
+ locale: e.locale || "",
2099
+ timing: e.timing || {
2100
+ firstFlush: 0,
2101
+ render: 0,
2102
+ snapshot: 0
2103
+ },
2104
+ buildBase: e.buildBase || "/build/",
2105
+ resolvedManifest: e.resolvedManifest || {
2106
+ mapper: {},
2107
+ manifest: {
2108
+ manifestHash: "dev",
2109
+ mapping: {}
2110
+ }
2111
+ },
2112
+ renderOptions: e.renderOptions
2113
+ });
2114
+ }
2115
+
2116
+ var StringBufferWriter = class {
2117
+ buffer=[];
2118
+ write(e) {
2119
+ this.buffer.push(e);
2120
+ }
2121
+ toString() {
2122
+ return this.buffer.join("");
2123
+ }
2124
+ };
2125
+
2126
+ var pi = {};
2127
+
2128
+ var QTemplateProps = {
2129
+ hidden: true,
2130
+ "aria-hidden": true
2131
+ };
2132
+
2133
+ var SSRContainer = class extends rc {
2134
+ tag;
2135
+ isHtml;
2136
+ writer;
2137
+ streamHandler;
2138
+ timing;
2139
+ size=0;
2140
+ resolvedManifest;
2141
+ symbolToChunkResolver;
2142
+ renderOptions;
2143
+ serializationCtx;
2144
+ /**
2145
+ * We use this to append additional nodes in the head node
2146
+ *
2147
+ * - From manifest injections
2148
+ * - From useStyles and useScopedStyles hooks
2149
+ */
2150
+ additionalHeadNodes=new Array;
2151
+ /**
2152
+ * We use this to append additional nodes in the body node
2153
+ *
2154
+ * - From manifest injections
2155
+ */
2156
+ additionalBodyNodes=new Array;
2157
+ lastNode=null;
2158
+ currentComponentNode=null;
2159
+ styleIds=/* @__PURE__ */ new Set;
2160
+ isBackpatchExecutorEmitted=false;
2161
+ backpatchMap=/* @__PURE__ */ new Map;
2162
+ currentElementFrame=null;
2163
+ renderTimer;
2164
+ /**
2165
+ * Current element index.
2166
+ *
2167
+ * This number must match the depth-first traversal of the DOM elements as returned by the
2168
+ * https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
2169
+ */
2170
+ depthFirstElementCount=-1;
2171
+ vNodeDatas=[];
2172
+ componentStack=[];
2173
+ cleanupQueue=[];
2174
+ emitContainerDataFrame=null;
2175
+ Kn=randomStr();
2176
+ // Temporary flag to find missing roots after the state was serialized
2177
+ S=false;
2178
+ qlInclude;
2179
+ promiseAttributes=null;
2180
+ constructor(e) {
2181
+ super(e.renderOptions.serverData ?? pi, e.locale);
2182
+ this.symbolToChunkResolver = e => {
2183
+ const t = e.lastIndexOf("_");
2184
+ const r = this.resolvedManifest.mapper[t == -1 ? e : e.substring(t + 1)];
2185
+ return r ? r[1] : "";
2186
+ };
2187
+ this.serializationCtx = this.serializationCtxFactory(SsrNode, DomRef, this.symbolToChunkResolver, e.writer);
2188
+ this.renderTimer = createTimer();
2189
+ this.tag = e.tagName;
2190
+ this.isHtml = e.tagName === "html";
2191
+ this.writer = e.writer;
2192
+ this.streamHandler = e.streamHandler;
2193
+ this.timing = e.timing;
2194
+ this.Zn = e.buildBase;
2195
+ this.resolvedManifest = e.resolvedManifest;
2196
+ this.renderOptions = e.renderOptions;
2197
+ this.Gn = 1e5;
2198
+ const t = this.renderOptions.qwikLoader;
2199
+ this.qlInclude = t ? typeof t === "object" ? t.include === "never" ? 2 /* Done */ : 0 /* Module */ : t === "inline" ? 1 /* Inline */ : t === "never" ? 2 /* Done */ : 0 /* Module */ : 0 /* Module */;
2200
+ if (this.qlInclude === 0 /* Module */) {
2201
+ const e = this.resolvedManifest?.manifest.qwikLoader;
2202
+ if (!e) {
2203
+ this.qlInclude = 1 /* Inline */;
2204
+ }
2205
+ }
2206
+ this.A();
2207
+ }
2208
+ ensureProjectionResolved(e) {}
2209
+ handleError(e, t) {
2210
+ throw e;
2211
+ }
2212
+ addBackpatchEntry(e, t, r) {
2213
+ const n = parseInt(e, 10);
2214
+ const s = {
2215
+ attrName: t,
2216
+ value: r
2217
+ };
2218
+ const i = this.backpatchMap.get(n) || [];
2219
+ i.push(s);
2220
+ this.backpatchMap.set(n, i);
2221
+ }
2222
+ async render(e) {
2223
+ this.openContainer();
2224
+ await this.renderJSX(e, {
2225
+ currentStyleScoped: null,
2226
+ parentComponentFrame: this.getComponentFrame()
2227
+ });
2228
+ await this.closeContainer();
2229
+ }
2230
+ async renderJSX(e, t) {
2231
+ await kn(this, e, t);
2232
+ }
2233
+ setContext(e, t, r) {
2234
+ const n = e;
2235
+ let s = n.getProp(Ne);
2236
+ if (s == null) {
2237
+ n.setProp(Ne, s = []);
2238
+ }
2239
+ ae(s, t.id, r, 0, true);
2240
+ this.addRoot(n);
2241
+ }
2242
+ resolveContext(e, t) {
2243
+ let r = e;
2244
+ while (r) {
2245
+ const e = r.getProp(Ne);
2246
+ if (e != null && de(e, t.id, 0)) {
2247
+ return he(e, t.id, 0);
2248
+ }
2249
+ r = r.parentComponent;
2250
+ }
2251
+ return void 0;
2252
+ }
2253
+ getParentHost(e) {
2254
+ const t = e;
2255
+ return t.parentComponent;
2256
+ }
2257
+ setHostProp(e, t, r) {
2258
+ const n = e;
2259
+ return n.setProp(t, r);
2260
+ }
2261
+ getHostProp(e, t) {
2262
+ const r = e;
2263
+ return r.getProp(t);
2264
+ }
2265
+ /**
2266
+ * Renders opening tag for container. It could be a html tag for regular apps or custom element
2267
+ * for micro-frontends
2268
+ */ openContainer() {
2269
+ if (this.tag == "html") {
2270
+ this.write("<!DOCTYPE html>");
2271
+ }
2272
+ const e = this.renderOptions.containerAttributes || {};
2273
+ const t = e[QRenderAttr];
2274
+ e[Ue] = "paused" /* PAUSED */;
2275
+ e[QRuntimeAttr] = "2";
2276
+ e[QVersionAttr] = this.Xn ?? "dev";
2277
+ e[QRenderAttr] = (t ? t + "-" : "") + (isDev7 ? "ssr-dev" : "ssr");
2278
+ e[Te] = this.Zn || "";
2279
+ e[QLocaleAttr] = this.wt;
2280
+ e[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
2281
+ e[QInstanceAttr] = this.Kn;
2282
+ this.Ft.containerAttributes = e;
2283
+ this.openElement(this.tag, null, e);
2284
+ if (!this.isHtml) {
2285
+ this.emitContainerDataFrame = this.currentElementFrame;
2286
+ }
2287
+ }
2288
+ /** Renders closing tag for current container */ closeContainer() {
2289
+ return this.closeElement();
2290
+ }
2291
+ C=0;
2292
+ /** Renders opening tag for DOM element */
2293
+ openElement(e, t, r, n = null, s = null, i = null, o = true) {
2294
+ const a = isQwikStyleElement(e, r) || isQwikStyleElement(e, n);
2295
+ if (
2296
+ // don't append qwik loader before qwik style elements
2297
+ // it will confuse the resuming, because styles are expected to be the first nodes in subtree
2298
+ !a && this.qlInclude === 1 /* Inline */) {
2299
+ if (this.C === 0 && this.size > 30 * 1024 && e !== "body") {
2300
+ this.emitQwikLoaderInline();
2301
+ } else if (e === "noscript" || e === "template") {
2302
+ this.C++;
2303
+ }
2304
+ }
2305
+ let l = void 0;
2306
+ this.lastNode = null;
2307
+ if (!a && this.currentElementFrame) {
2308
+ vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
2309
+ }
2310
+ this.createAndPushFrame(e, this.depthFirstElementCount++, i);
2311
+ if (this.isHtml && e === "body" && this.emitContainerDataFrame === null) {
2312
+ this.emitContainerDataFrame = this.currentElementFrame;
2313
+ }
2314
+ vNodeData_openElement(this.currentElementFrame.vNodeData);
2315
+ this.write(LT);
2316
+ this.write(e);
2317
+ const c = this.getOrCreateLastNode();
2318
+ if (r) {
2319
+ l = this.writeAttrs(e, r, false, s, i, o);
2320
+ }
2321
+ this.write(" " + or);
2322
+ if (t !== null) {
2323
+ this.write(`="${t}"`);
2324
+ } else if (import.meta.env.TEST) {
2325
+ this.write(EMPTY_ATTR);
2326
+ }
2327
+ if (n && !Ir(n)) {
2328
+ l = this.writeAttrs(e, n, true, s, i, o) || l;
2329
+ }
2330
+ this.write(GT);
2331
+ if (c) {
2332
+ c.setTreeNonUpdatable();
2333
+ }
2334
+ return l;
2335
+ }
2336
+ /** Renders closing tag for DOM element */ closeElement() {
2337
+ if (this.currentElementFrame === this.emitContainerDataFrame) {
2338
+ this.emitContainerDataFrame = null;
2339
+ this.onRenderDone();
2340
+ const e = createTimer();
2341
+ return hr(hr(this.emitContainerData(), () => this._closeElement()), () => {
2342
+ this.timing.snapshot = e();
2343
+ });
2344
+ }
2345
+ this._closeElement();
2346
+ }
2347
+ onRenderDone() {
2348
+ this.drainCleanupQueue();
2349
+ this.timing.render = this.renderTimer();
2350
+ }
2351
+ /** Drain cleanup queue and cleanup tasks etc. */ drainCleanupQueue() {
2352
+ let e = this.cleanupQueue.pop();
2353
+ while (e) {
2354
+ for (let t = 0; t < e.length; t++) {
2355
+ const r = e[t];
2356
+ if (hasDestroy(r)) {
2357
+ r.mn();
2358
+ }
2359
+ }
2360
+ e = this.cleanupQueue.pop();
2361
+ }
2362
+ }
2363
+ _closeElement() {
2364
+ const e = this.popFrame();
2365
+ const t = e.elementName;
2366
+ if (!isSelfClosingTag(t)) {
2367
+ this.write(CLOSE_TAG);
2368
+ this.write(t);
2369
+ this.write(GT);
2370
+ }
2371
+ this.lastNode = null;
2372
+ if (this.qlInclude === 1 /* Inline */) {
2373
+ if (t === "noscript" || t === "template") {
2374
+ this.C--;
2375
+ }
2376
+ }
2377
+ }
2378
+ /** Writes opening data to vNodeData for fragment boundaries */ openFragment(e) {
2379
+ this.lastNode = null;
2380
+ vNodeData_openFragment(this.currentElementFrame.vNodeData, e);
2381
+ this.getOrCreateLastNode();
2382
+ }
2383
+ /** Writes closing data to vNodeData for fragment boundaries */ closeFragment() {
2384
+ vNodeData_closeFragment(this.currentElementFrame.vNodeData);
2385
+ if (this.currentComponentNode) {
2386
+ this.currentComponentNode.setTreeNonUpdatable();
2387
+ }
2388
+ this.lastNode = null;
2389
+ }
2390
+ openProjection(e) {
2391
+ this.openFragment(e);
2392
+ const t = this.getComponentFrame();
2393
+ if (t) {
2394
+ this.serializationCtx.Rt(t.componentNode);
2395
+ t.projectionDepth++;
2396
+ }
2397
+ }
2398
+ closeProjection() {
2399
+ const e = this.getComponentFrame();
2400
+ if (e) {
2401
+ e.projectionDepth--;
2402
+ }
2403
+ this.closeFragment();
2404
+ }
2405
+ /** Writes opening data to vNodeData for component boundaries */ openComponent(e) {
2406
+ this.openFragment(e);
2407
+ this.currentComponentNode = this.getOrCreateLastNode();
2408
+ this.componentStack.push(new SsrComponentFrame(this.currentComponentNode));
2409
+ }
2410
+ /**
2411
+ * Returns the current component frame.
2412
+ *
2413
+ * @param projectionDepth - How many levels of projection to skip. This is needed when projections
2414
+ * are nested inside other projections we need to have a way to read from a frame above.
2415
+ * @returns
2416
+ */ getComponentFrame(e = 0) {
2417
+ const t = this.componentStack.length;
2418
+ const r = t - e - 1;
2419
+ return r >= 0 ? this.componentStack[r] : null;
2420
+ }
2421
+ getParentComponentFrame() {
2422
+ const e = this.getComponentFrame()?.projectionDepth || 0;
2423
+ return this.getComponentFrame(e);
2424
+ }
2425
+ /** Writes closing data to vNodeData for component boundaries and emit unclaimed projections inline */ async closeComponent() {
2426
+ const e = this.componentStack.pop();
2427
+ await this.emitUnclaimedProjectionForComponent(e);
2428
+ this.closeFragment();
2429
+ this.currentComponentNode = this.currentComponentNode?.parentComponent || null;
2430
+ }
2431
+ async emitUnclaimedProjectionForComponent(e) {
2432
+ if (e.slots.length === 0) {
2433
+ return;
2434
+ }
2435
+ this.openElement(Qe, null, QTemplateProps, null);
2436
+ const t = e.projectionScopedStyle;
2437
+ for (let r = 0; r < e.slots.length; r += 2) {
2438
+ const n = e.slots[r];
2439
+ const s = e.slots[r + 1];
2440
+ this.openFragment(isDev7 ? {
2441
+ [Se]: "P" /* Projection */ ,
2442
+ [QSlotParent]: e.componentNode.id
2443
+ } : {
2444
+ [QSlotParent]: e.componentNode.id
2445
+ });
2446
+ const i = this.getOrCreateLastNode();
2447
+ if (i.vnodeData) {
2448
+ i.vnodeData[0] |= 16 /* SERIALIZE */;
2449
+ }
2450
+ e.componentNode.setProp(n, i.id);
2451
+ await this.renderJSX(s, {
2452
+ currentStyleScoped: t,
2453
+ parentComponentFrame: e.projectionComponentFrame
2454
+ });
2455
+ this.closeFragment();
2456
+ }
2457
+ this.closeElement();
2458
+ }
2459
+ /** Write a text node with correct escaping. Save the length of the text node in the vNodeData. */ textNode(e) {
2460
+ this.write(escapeHTML(e));
2461
+ vNodeData_addTextSize(this.currentElementFrame.vNodeData, e.length);
2462
+ this.lastNode = null;
2463
+ }
2464
+ htmlNode(e) {
2465
+ this.write(e);
2466
+ }
2467
+ commentNode(e) {
2468
+ this.write("\x3c!--" + e + "--\x3e");
2469
+ }
2470
+ addRoot(e) {
2471
+ if (this.S) {
2472
+ return this.serializationCtx.Yn(e);
2473
+ }
2474
+ return this.serializationCtx.Rt(e);
2475
+ }
2476
+ getOrCreateLastNode() {
2477
+ if (!this.lastNode) {
2478
+ this.lastNode = vNodeData_createSsrNodeReference(this.currentComponentNode, this.currentElementFrame.vNodeData,
2479
+ // we start at -1, so we need to add +1
2480
+ this.currentElementFrame.depthFirstElementIdx + 1, this.cleanupQueue, this.currentElementFrame.currentFile);
2481
+ }
2482
+ return this.lastNode;
2483
+ }
2484
+ addUnclaimedProjection(e, t, r) {
2485
+ e.slots.push(t, r);
2486
+ }
2487
+ A() {
2488
+ const e = this.resolvedManifest.manifest.injections;
2489
+ if (!e) {
2490
+ return;
2491
+ }
2492
+ for (let t = 0; t < e.length; t++) {
2493
+ const r = e[t];
2494
+ const n = ss(r.tag, null, r.attributes || {}, null, 0, null);
2495
+ if (r.location === "head") {
2496
+ this.additionalHeadNodes.push(n);
2497
+ } else {
2498
+ this.additionalBodyNodes.push(n);
2499
+ }
2500
+ }
2501
+ }
2502
+ ue(e, t, r, n) {
2503
+ if (n) {
2504
+ const e = this.getComponentFrame(0);
2505
+ e.scopedStyleIds.add(t);
2506
+ const n = convertStyleIdsToString(e.scopedStyleIds);
2507
+ this.setHostProp(r, Pe, n);
2508
+ }
2509
+ if (!this.styleIds.has(t)) {
2510
+ this.styleIds.add(t);
2511
+ if (this.currentElementFrame?.elementName === "html") {
2512
+ this.additionalHeadNodes.push(is("style", null, {
2513
+ dangerouslySetInnerHTML: e,
2514
+ [_e]: t
2515
+ }, null, 0, t));
2516
+ } else {
2517
+ this._styleNode(t, e);
2518
+ }
2519
+ }
2520
+ }
2521
+ _styleNode(e, t) {
2522
+ this.openElement("style", null, {
2523
+ [_e]: e
2524
+ });
2525
+ this.write(t);
2526
+ this.closeElement();
2527
+ }
2528
+ ////////////////////////////////////
2529
+ emitContainerData() {
2530
+ return hr(this.resolvePromiseAttributes(), () => hr(this.emitStateData(), () => {
2531
+ this.S = true;
2532
+ this.emitVNodeData();
2533
+ preloaderPost(this, this.renderOptions, this.Ft?.nonce);
2534
+ this.emitSyncFnsData();
2535
+ this.emitPatchDataIfNeeded();
2536
+ this.emitExecutorIfNeeded();
2537
+ this.emitQwikLoaderAtBottomIfNeeded();
2538
+ }));
2539
+ }
2540
+ /**
2541
+ * Serialize the vNodeData into a string and emit it as a script tag.
2542
+ *
2543
+ * ## Encoding:
2544
+ *
2545
+ * - Alphabetical characters are text node lengths.
2546
+ * - Numbers are element counts.
2547
+ * - `{` is start of virtual node.
2548
+ * - `}` is end of virtual node.
2549
+ * - `~` Store as reference for data deserialization.
2550
+ * - `!"#$%&'()*+'-./` are separators (sequential characters in ASCII table)
2551
+ *
2552
+ * Attribute and separators encoding described here:
2553
+ * `packages/qwik/src/core/v2/shared/vnode-data-types.ts`
2554
+ *
2555
+ * NOTE: Not every element will need vNodeData. So we need to encode how many elements should be
2556
+ * skipped. By choosing different separators we can encode different numbers of elements to skip.
2557
+ */ emitVNodeData() {
2558
+ if (!this.serializationCtx.An.length) {
2559
+ return;
2560
+ }
2561
+ this.openElement("script", null, {
2562
+ type: "qwik/vnode"
2563
+ });
2564
+ const e = [];
2565
+ const t = this.vNodeDatas;
2566
+ let r = 0;
2567
+ for (let n = 0; n < t.length; n++) {
2568
+ const s = t[n];
2569
+ const i = s[0];
2570
+ if (i & 16 /* SERIALIZE */) {
2571
+ r = this.emitVNodeSeparators(r, n);
2572
+ if (i & 8 /* REFERENCE */) {
2573
+ this.write(VNodeDataSeparator.REFERENCE_CH);
2574
+ }
2575
+ if (i & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
2576
+ let t = null;
2577
+ let r = 0;
2578
+ for (let n = 1; n < s.length; n++) {
2579
+ const i = s[n];
2580
+ if (typeof i === "object" && i !== null) {
2581
+ e.push(t);
2582
+ t = i;
2583
+ } else if (i === OPEN_FRAGMENT) {
2584
+ r++;
2585
+ this.write(VNodeDataChar.OPEN_CHAR);
2586
+ } else if (i === CLOSE_FRAGMENT) {
2587
+ if (t) {
2588
+ this.writeFragmentAttrs(t);
2589
+ t = e.pop();
2590
+ }
2591
+ r--;
2592
+ this.write(VNodeDataChar.CLOSE_CHAR);
2593
+ } else if (i === WRITE_ELEMENT_ATTRS) {
2594
+ if (t && !Ir(t)) {
2595
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2596
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2597
+ this.writeFragmentAttrs(t);
2598
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2599
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2600
+ t = e.pop();
2601
+ }
2602
+ } else if (i >= 0) {
2603
+ this.write(encodeAsAlphanumeric(i));
2604
+ } else {
2605
+ this.write(String(0 - i));
2606
+ }
2607
+ }
2608
+ while (r-- > 0) {
2609
+ if (t) {
2610
+ this.writeFragmentAttrs(t);
2611
+ t = e.pop();
2612
+ }
2613
+ this.write(VNodeDataChar.CLOSE_CHAR);
2614
+ }
2615
+ }
2616
+ }
2617
+ }
2618
+ this.closeElement();
2619
+ }
2620
+ writeFragmentAttrs(e) {
2621
+ for (const t in e) {
2622
+ let r = e[t];
2623
+ let n = false;
2624
+ if (typeof r !== "string") {
2625
+ const e = this.addRoot(r);
2626
+ if (e === void 0) {
2627
+ continue;
2628
+ }
2629
+ r = String(e);
2630
+ }
2631
+ switch (t) {
2632
+ case Pe:
2633
+ this.write(VNodeDataChar.SCOPED_STYLE_CHAR);
2634
+ break;
2635
+
2636
+ case qe:
2637
+ this.write(VNodeDataChar.RENDER_FN_CHAR);
2638
+ break;
2639
+
2640
+ case ELEMENT_ID:
2641
+ this.write(VNodeDataChar.ID_CHAR);
2642
+ break;
2643
+
2644
+ case Ge:
2645
+ this.write(VNodeDataChar.PROPS_CHAR);
2646
+ break;
2647
+
2648
+ case Xe:
2649
+ n = true;
2650
+ this.write(VNodeDataChar.KEY_CHAR);
2651
+ break;
2652
+
2653
+ case Ke:
2654
+ this.write(VNodeDataChar.SEQ_CHAR);
2655
+ break;
2656
+
2657
+ case Ze:
2658
+ this.write(VNodeDataChar.SEQ_IDX_CHAR);
2659
+ break;
2660
+
2661
+ case Ie:
2662
+ this.write(VNodeDataChar.BACK_REFS_CHAR);
2663
+ break;
2664
+
2665
+ case QSlotParent:
2666
+ this.write(VNodeDataChar.SLOT_PARENT_CHAR);
2667
+ break;
2668
+
2669
+ // Skipping `\` character for now because it is used for escaping.
2670
+ case Ne:
2671
+ this.write(VNodeDataChar.CONTEXT_CHAR);
2672
+ break;
2673
+
2674
+ case Ce:
2675
+ this.write(VNodeDataChar.SLOT_CHAR);
2676
+ break;
2677
+
2678
+ default:
2679
+ {
2680
+ n = true;
2681
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2682
+ this.write(encodeVNodeDataString(t));
2683
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2684
+ }
2685
+ }
2686
+ const s = encodeVNodeDataString(n ? encodeURI(r) : r);
2687
+ const i = n ? s !== r : false;
2688
+ if (i) {
2689
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2690
+ this.write(s);
2691
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
2692
+ } else {
2693
+ this.write(r);
2694
+ }
2695
+ }
2696
+ }
2697
+ emitStateData() {
2698
+ if (!this.serializationCtx.An.length) {
2699
+ return;
2700
+ }
2701
+ const e = this.stateScriptAttrs();
2702
+ this.openElement("script", null, e);
2703
+ return hr(this.serializationCtx.It(), () => {
2704
+ this.closeElement();
2705
+ });
2706
+ }
2707
+ /** Add q-d:qidle attribute to eagerly resume some state if needed */ stateScriptAttrs() {
2708
+ const e = {
2709
+ type: "qwik/state"
2710
+ };
2711
+ const t = this.serializationCtx.jt;
2712
+ if (t.size > 0) {
2713
+ e["q-d:qidle"] = Eu(null, "_res", S, null, [ ...t ]);
2714
+ }
2715
+ return e;
2716
+ }
2717
+ emitSyncFnsData() {
2718
+ const e = this.serializationCtx.Jn;
2719
+ if (e.length) {
2720
+ const t = {
2721
+ "q:func": "qwik/json"
2722
+ };
2723
+ if (this.renderOptions.serverData?.nonce) {
2724
+ t["nonce"] = this.renderOptions.serverData.nonce;
2725
+ }
2726
+ this.openElement("script", null, t);
2727
+ this.write(Q_FUNCS_PREFIX.replace("HASH", this.Kn));
2728
+ this.write(BRACKET_OPEN);
2729
+ this.writeArray(e, Mr);
2730
+ this.write(BRACKET_CLOSE);
2731
+ this.closeElement();
2732
+ }
2733
+ }
2734
+ emitPatchDataIfNeeded() {
2735
+ const e = [];
2736
+ for (const [t, r] of this.backpatchMap) {
2737
+ for (const n of r) {
2738
+ e.push(t, n.attrName, Mc(n.value) ? n.value.untrackedValue : n.value);
2739
+ }
2740
+ }
2741
+ this.backpatchMap.clear();
2742
+ if (e.length > 0) {
2743
+ this.isBackpatchExecutorEmitted = true;
2744
+ const t = {
2745
+ type: ELEMENT_BACKPATCH_DATA
2746
+ };
2747
+ if (this.renderOptions.serverData?.nonce) {
2748
+ t["nonce"] = this.renderOptions.serverData.nonce;
2749
+ }
2750
+ this.openElement("script", null, t);
2751
+ this.write(JSON.stringify(e));
2752
+ this.closeElement();
2753
+ }
2754
+ }
2755
+ emitExecutorIfNeeded() {
2756
+ if (!this.isBackpatchExecutorEmitted) {
2757
+ return;
2758
+ }
2759
+ const e = {
2760
+ type: "text/javascript"
2761
+ };
2762
+ if (this.renderOptions.serverData?.nonce) {
2763
+ e["nonce"] = this.renderOptions.serverData.nonce;
2764
+ }
2765
+ this.openElement("script", null, e);
2766
+ const t = getQwikBackpatchExecutorScript({
2767
+ debug: isDev7
2768
+ });
2769
+ this.write(t);
2770
+ this.closeElement();
2771
+ }
2772
+ emitPreloaderPre() {
2773
+ preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
2774
+ }
2775
+ isStatic() {
2776
+ return this.serializationCtx.At.size === 0;
2777
+ }
2778
+ emitQwikLoaderAtTopIfNeeded() {
2779
+ if (this.qlInclude === 0 /* Module */) {
2780
+ this.qlInclude = 2 /* Done */;
2781
+ const e = this.Zn + this.resolvedManifest.manifest.qwikLoader;
2782
+ const t = {
2783
+ rel: "modulepreload",
2784
+ href: e
2785
+ };
2786
+ const r = this.renderOptions.serverData?.nonce;
2787
+ if (r) {
2788
+ t["nonce"] = r;
2789
+ }
2790
+ this.openElement("link", null, t);
2791
+ this.closeElement();
2792
+ const n = {
2793
+ async: true,
2794
+ type: "module",
2795
+ src: e
2796
+ };
2797
+ if (r) {
2798
+ n["nonce"] = r;
2799
+ }
2800
+ this.openElement("script", null, n);
2801
+ this.closeElement();
2802
+ }
2803
+ }
2804
+ emitQwikLoaderInline() {
2805
+ this.qlInclude = 2 /* Done */;
2806
+ const e = getQwikLoaderScript({
2807
+ debug: this.renderOptions.debug
2808
+ });
2809
+ const t = {
2810
+ id: "qwikloader",
2811
+ async: true,
2812
+ type: "module"
2813
+ };
2814
+ if (this.renderOptions.serverData?.nonce) {
2815
+ t["nonce"] = this.renderOptions.serverData.nonce;
2816
+ }
2817
+ this.openElement("script", null, t);
2818
+ this.write(e);
2819
+ this.closeElement();
2820
+ }
2821
+ emitQwikLoaderAtBottomIfNeeded() {
2822
+ if (!this.isStatic()) {
2823
+ if (this.qlInclude !== 2 /* Done */) {
2824
+ this.emitQwikLoaderInline();
2825
+ }
2826
+ this.emitQwikEvents(Array.from(this.serializationCtx.Ot, e => JSON.stringify(e)));
2827
+ }
2828
+ }
2829
+ emitQwikEvents(e) {
2830
+ if (e.length > 0) {
2831
+ const t = {};
2832
+ const r = this.renderOptions.serverData?.nonce;
2833
+ if (r) {
2834
+ t["nonce"] = r;
2835
+ }
2836
+ this.openElement("script", null, t);
2837
+ this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
2838
+ this.writeArray(e, Mr);
2839
+ this.write(PAREN_CLOSE);
2840
+ this.closeElement();
2841
+ }
2842
+ }
2843
+ // Keep in sync with process-vnode-data.unit.ts
2844
+ emitVNodeSeparators(e, t) {
2845
+ let r = t - e;
2846
+ while (r != 0) {
2847
+ if (r >= 8192) {
2848
+ this.write(VNodeDataSeparator.ADVANCE_8192_CH);
2849
+ r -= 8192;
2850
+ } else {
2851
+ r & 4096 && this.write(VNodeDataSeparator.ADVANCE_4096_CH);
2852
+ r & 2048 && this.write(VNodeDataSeparator.ADVANCE_2048_CH);
2853
+ r & 1024 && this.write(VNodeDataSeparator.ADVANCE_1024_CH);
2854
+ r & 512 && this.write(VNodeDataSeparator.ADVANCE_512_CH);
2855
+ r & 256 && this.write(VNodeDataSeparator.ADVANCE_256_CH);
2856
+ r & 128 && this.write(VNodeDataSeparator.ADVANCE_128_CH);
2857
+ r & 64 && this.write(VNodeDataSeparator.ADVANCE_64_CH);
2858
+ r & 32 && this.write(VNodeDataSeparator.ADVANCE_32_CH);
2859
+ r & 16 && this.write(VNodeDataSeparator.ADVANCE_16_CH);
2860
+ r & 8 && this.write(VNodeDataSeparator.ADVANCE_8_CH);
2861
+ r & 4 && this.write(VNodeDataSeparator.ADVANCE_4_CH);
2862
+ r & 2 && this.write(VNodeDataSeparator.ADVANCE_2_CH);
2863
+ r & 1 && this.write(VNodeDataSeparator.ADVANCE_1_CH);
2864
+ r = 0;
2865
+ }
2866
+ }
2867
+ return t;
2868
+ }
2869
+ createAndPushFrame(e, t, r) {
2870
+ let n = 10 /* ANYTHING */;
2871
+ if (isDev7) {
2872
+ if (!this.currentElementFrame) {
2873
+ n = initialTag(e);
2874
+ } else {
2875
+ let t = this.currentElementFrame;
2876
+ const s = t.tagNesting;
2877
+ n = isTagAllowed(s, e);
2878
+ if (n === 0 /* NOT_ALLOWED */) {
2879
+ const n = [];
2880
+ while (t) {
2881
+ n.unshift(t);
2882
+ t = t.parent;
2883
+ }
2884
+ const i = [];
2885
+ if (r) {
2886
+ i.push(`Error found in file: ${r}`);
2887
+ }
2888
+ i.push(`HTML rules do not allow '<${e}>' at this location.`, ` (The HTML parser will try to recover by auto-closing or inserting additional tags which will confuse Qwik when it resumes.)`, ` Offending tag: <${e}>`, ` Existing tag context:`);
2889
+ let o = " ";
2890
+ let a = "";
2891
+ for (const e of n) {
2892
+ const [t, r] = allowedContent(e.tagNesting);
2893
+ i.push(`${o}<${e.elementName}>${a !== t ? ` [${t}]${r ? ` -> ${r}` : ""}` : ""}`);
2894
+ a = t;
2895
+ o += " ";
2896
+ }
2897
+ i.push(`${o}<${e}> <= is not allowed as a child of ${allowedContent(s)[0]}.`);
2898
+ throw newTagError(i.join("\n"));
2899
+ }
2900
+ }
2901
+ }
2902
+ const s = {
2903
+ tagNesting: n,
2904
+ parent: this.currentElementFrame,
2905
+ elementName: e,
2906
+ depthFirstElementIdx: t,
2907
+ vNodeData: [ 0 /* NONE */ ],
2908
+ currentFile: isDev7 ? r || null : null
2909
+ };
2910
+ this.currentElementFrame = s;
2911
+ this.vNodeDatas.push(s.vNodeData);
2912
+ }
2913
+ popFrame() {
2914
+ const e = this.currentElementFrame;
2915
+ this.currentElementFrame = e.parent;
2916
+ return e;
2917
+ }
2918
+ ////////////////////////////////////
2919
+ write(e) {
2920
+ this.size += e.length;
2921
+ this.writer.write(e);
2922
+ }
2923
+ writeArray(e, t) {
2924
+ for (let r = 0; r < e.length; r++) {
2925
+ const n = e[r];
2926
+ if (r > 0) {
2927
+ this.write(t);
2928
+ }
2929
+ this.write(n);
2930
+ }
2931
+ }
2932
+ writeAttrs(e, t, s, i, o, a) {
2933
+ let l = void 0;
2934
+ for (let c in t) {
2935
+ let u = t[c];
2936
+ if (isSSRUnsafeAttr(c)) {
2937
+ if (isDev7) {
2938
+ throw be(32 /* unsafeAttr */ , [ c ]);
2939
+ }
2940
+ continue;
2941
+ }
2942
+ if (yr(c)) {
2943
+ u = _setEvent(this.serializationCtx, c, u, a);
2944
+ } else if (c === "ref") {
2945
+ const e = this.getOrCreateLastNode();
2946
+ if (Mc(u)) {
2947
+ u.Bt = new DomRef(e);
2948
+ continue;
2949
+ } else if (typeof u === "function") {
2950
+ u(new DomRef(e));
2951
+ continue;
2952
+ } else if (u == null) {
2953
+ continue;
2954
+ } else {
2955
+ throw be(15 /* invalidRefValue */ , [ o ]);
2956
+ }
2957
+ } else if (c === tr || c === nr) {
2958
+ u = this.serializationCtx.Rt(u);
2959
+ } else if (Mc(u)) {
2960
+ const e = this.getOrCreateLastNode();
2961
+ const t = new Yi({
2962
+ W: i,
2963
+ lt: s
2964
+ });
2965
+ const r = u;
2966
+ u = n(() => this.trackSignalValue(r, e, c, t));
2967
+ }
2968
+ if (fr(u)) {
2969
+ const e = this.getOrCreateLastNode();
2970
+ this.addPromiseAttribute(u);
2971
+ u.then(t => {
2972
+ this.addBackpatchEntry(e.id, c, t);
2973
+ });
2974
+ continue;
2975
+ }
2976
+ if (c === lr) {
2977
+ if (u) {
2978
+ l = String(u);
2979
+ c = Ue;
2980
+ u = "html" /* HTML */;
2981
+ }
2982
+ if (e === "style") {
2983
+ continue;
2984
+ }
2985
+ } else if (isPreventDefault(c)) {
2986
+ addPreventDefaultEventToSerializationContext(this.serializationCtx, c);
2987
+ }
2988
+ if (e === "textarea" && c === "value") {
2989
+ if (u && typeof u !== "string") {
2990
+ if (isDev7) {
2991
+ throw be(23 /* wrongTextareaValue */ , [ o, u ]);
2992
+ }
2993
+ continue;
2994
+ }
2995
+ l = escapeHTML(u || "");
2996
+ c = Ue;
2997
+ u = "text" /* TEXT */;
2998
+ }
2999
+ const d = r(c, u, i);
3000
+ if (d != null && d !== false) {
3001
+ this.write(mf);
3002
+ this.write(c);
3003
+ if (d !== true) {
3004
+ this.write(ATTR_EQUALS_QUOTE);
3005
+ const e = escapeHTML(String(d));
3006
+ this.write(e);
3007
+ this.write(QUOTE);
3008
+ }
3009
+ }
3010
+ }
3011
+ return l;
3012
+ }
3013
+ addPromiseAttribute(e) {
3014
+ this.promiseAttributes ||= [];
3015
+ this.promiseAttributes.push(e);
3016
+ }
3017
+ async resolvePromiseAttributes() {
3018
+ if (this.promiseAttributes) {
3019
+ await Promise.all(this.promiseAttributes);
3020
+ this.promiseAttributes = null;
3021
+ }
3022
+ }
3023
+ };
3024
+
3025
+ var isQwikStyleElement = (e, t) => {
3026
+ if (e === "style" && t != null) {
3027
+ return Object.prototype.hasOwnProperty.call(t, _e) || Object.prototype.hasOwnProperty.call(t, Pe);
3028
+ }
3029
+ return false;
3030
+ };
3031
+
3032
+ function newTagError(e) {
3033
+ return be(12 /* tagError */ , [ e ]);
3034
+ }
3035
+
3036
+ function hasDestroy(e) {
3037
+ return e && typeof e === "object" && typeof e.mn === "function";
3038
+ }
3039
+
3040
+ function isSSRUnsafeAttr(e) {
3041
+ for (let t = 0; t < e.length; t++) {
3042
+ const r = e.charCodeAt(t);
3043
+ if (r === 62 || r === 47 || r === 61 || r === 34 || r === 39 || r === 9 || r === 10 || r === 12 || r === 32) {
3044
+ return true;
3045
+ }
3046
+ }
3047
+ return false;
3048
+ }
3049
+
3050
+ function randomStr() {
3051
+ return (Math.random().toString(36) + "000000").slice(2, 8);
3052
+ }
3053
+
3054
+ function addPreventDefaultEventToSerializationContext(e, t) {
3055
+ const r = "e" + t.substring(14);
3056
+ if (r) {
3057
+ e.Ot.add(r);
3058
+ }
3059
+ }
3060
+
3061
+ // packages/qwik/src/server/ssr-render.ts
3062
+ import { manifest as builtManifest } from "@qwik-client-manifest";
3063
+
3064
+ // packages/qwik/src/server/ssr-stream-handler.ts
3065
+ var StreamHandler = class {
3066
+ constructor(e, t) {
3067
+ this.opts = e;
3068
+ this.timing = t;
3069
+ this.inOrderStreaming = e.streaming?.inOrder ?? {
3070
+ strategy: "auto",
3071
+ maximumInitialChunk: 2e4,
3072
+ maximumChunk: 1e4
3073
+ };
3074
+ this.nativeStream = e.stream;
3075
+ this.stream = this.setupStreamWriter();
3076
+ }
3077
+ bufferSize=0;
3078
+ buffer="";
3079
+ networkFlushes=0;
3080
+ inOrderStreaming;
3081
+ streamBlockDepth=0;
3082
+ streamBlockBuffer="";
3083
+ streamBlockBufferSize=0;
3084
+ nativeStream;
3085
+ firstFlushTimer=createTimer();
3086
+ stream;
3087
+ setupStreamWriter() {
3088
+ const e = this;
3089
+ let t;
3090
+ switch (this.inOrderStreaming.strategy) {
3091
+ case "disabled":
3092
+ t = {
3093
+ write(t) {
3094
+ if (t === void 0 || t === null) {
3095
+ return;
3096
+ }
3097
+ e.enqueue(t);
3098
+ }
3099
+ };
3100
+ break;
3101
+
3102
+ case "direct":
3103
+ {
3104
+ const e = this.nativeStream;
3105
+ t = {
3106
+ write(t) {
3107
+ if (t === void 0 || t === null) {
3108
+ return;
3109
+ }
3110
+ e.write(t);
3111
+ }
3112
+ };
3113
+ break;
3114
+ }
3115
+
3116
+ default:
3117
+ case "auto":
3118
+ {
3119
+ const r = this.inOrderStreaming.maximumChunk ?? 0;
3120
+ const n = this.inOrderStreaming.maximumInitialChunk ?? 0;
3121
+ t = {
3122
+ write(t) {
3123
+ if (t === void 0 || t === null) {
3124
+ return;
3125
+ }
3126
+ e.enqueue(t);
3127
+ if (e.streamBlockDepth === 0) {
3128
+ const t = e.networkFlushes === 0 ? n : r;
3129
+ if (e.bufferSize >= t) {
3130
+ e.flush();
3131
+ }
3132
+ }
3133
+ }
3134
+ };
3135
+ break;
3136
+ }
3137
+ }
3138
+ return t;
3139
+ }
3140
+ enqueue(e) {
3141
+ const t = e.length;
3142
+ if (this.streamBlockDepth > 0) {
3143
+ this.streamBlockBuffer += e;
3144
+ this.streamBlockBufferSize += t;
3145
+ } else {
3146
+ this.bufferSize += t;
3147
+ this.buffer += e;
3148
+ }
3149
+ }
3150
+ flush() {
3151
+ if (this.buffer) {
3152
+ this.nativeStream.write(this.buffer);
3153
+ this.buffer = "";
3154
+ this.bufferSize = 0;
3155
+ this.networkFlushes++;
3156
+ if (this.networkFlushes === 1) {
3157
+ this.timing.firstFlush = this.firstFlushTimer();
3158
+ }
3159
+ }
3160
+ }
3161
+ streamBlockStart() {
3162
+ this.streamBlockDepth++;
3163
+ }
3164
+ streamBlockEnd() {
3165
+ this.streamBlockDepth--;
3166
+ if (this.streamBlockDepth === 0 && this.streamBlockBuffer) {
3167
+ this.buffer += this.streamBlockBuffer;
3168
+ this.bufferSize += this.streamBlockBufferSize;
3169
+ this.streamBlockBuffer = "";
3170
+ this.streamBlockBufferSize = 0;
3171
+ this.flush();
3172
+ }
3173
+ }
3174
+ };
3175
+
3176
+ // packages/qwik/src/server/ssr-render.ts
3177
+ var renderToString = async (e, t = {}) => {
3178
+ const r = [];
3179
+ const n = {
3180
+ write(e) {
3181
+ r.push(e);
3182
+ }
3183
+ };
3184
+ const s = await renderToStream(e, {
3185
+ ...t,
3186
+ stream: n
3187
+ });
3188
+ return {
3189
+ isStatic: s.isStatic,
3190
+ timing: s.timing,
3191
+ manifest: s.manifest,
3192
+ snapshotResult: s.snapshotResult,
3193
+ html: r.join("")
3194
+ };
3195
+ };
3196
+
3197
+ var renderToStream = async (e, t) => {
3198
+ const r = {
3199
+ firstFlush: 0,
3200
+ render: 0,
3201
+ snapshot: 0
3202
+ };
3203
+ const n = t.containerTagName ?? "html";
3204
+ const s = getBuildBase(t);
3205
+ const i = resolveManifest(t.manifest);
3206
+ const o = typeof t.locale === "function" ? t.locale(t) : t.serverData?.locale || t.locale || t.containerAttributes?.locale || "";
3207
+ const a = new StreamHandler(t, r);
3208
+ const l = ssrCreateContainer({
3209
+ tagName: n,
3210
+ locale: o,
3211
+ writer: a.stream,
3212
+ streamHandler: a,
3213
+ timing: r,
3214
+ buildBase: s,
3215
+ resolvedManifest: i,
3216
+ renderOptions: t
3217
+ });
3218
+ await setServerPlatform(t, i);
3219
+ await l.render(e);
3220
+ await l.l;
3221
+ a.flush();
3222
+ const c = {
3223
+ flushes: a.networkFlushes,
3224
+ manifest: i?.manifest,
3225
+ size: l.size,
3226
+ isStatic: false,
3227
+ timing: r
3228
+ };
3229
+ return c;
3230
+ };
3231
+
3232
+ function resolveManifest(e) {
3233
+ const t = e ? {
3234
+ ...builtManifest,
3235
+ ...e
3236
+ } : builtManifest;
3237
+ if (!t || "mapper" in t) {
3238
+ return t;
3239
+ }
3240
+ if (t.mapping) {
3241
+ const e = {};
3242
+ Object.entries(t.mapping).forEach(([t, r]) => {
3243
+ e[da(t)] = [ t, r ];
3244
+ });
3245
+ return {
3246
+ mapper: e,
3247
+ manifest: t,
3248
+ injections: t.injections || []
3249
+ };
3250
+ }
3251
+ return void 0;
3252
+ }
3253
+
3254
+ var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
3255
+
3256
+ // packages/qwik/src/server/index.ts
3257
+ async function setServerPlatform2(e) {
3258
+ const t = Fr({
3259
+ manifest: e
3260
+ }, resolveManifest(e));
3261
+ setPlatform2(t);
3262
+ }
3263
+
3264
+ export { getQwikBackpatchExecutorScript, getQwikLoaderScript, getQwikPrefetchWorkerScript, renderToStream, renderToString, resolveManifest, setServerPlatform2 as setServerPlatform, versions };