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