@qwik.dev/core 2.0.0-alpha.8 → 2.0.0-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/bindings/qwik.darwin-arm64.node +0 -0
  2. package/bindings/qwik.darwin-x64.node +0 -0
  3. package/bindings/qwik.linux-x64-gnu.node +0 -0
  4. package/bindings/qwik.win32-x64-msvc.node +0 -0
  5. package/bindings/qwik_wasm_bg.wasm +0 -0
  6. package/dist/build/package.json +1 -1
  7. package/dist/cli.cjs +2 -2
  8. package/dist/core-internal.d.ts +234 -22
  9. package/dist/core.cjs +7305 -7418
  10. package/dist/core.cjs.map +1 -1
  11. package/dist/core.min.mjs +1 -1
  12. package/dist/core.mjs +7299 -7418
  13. package/dist/core.mjs.map +1 -1
  14. package/dist/core.prod.cjs +1546 -1662
  15. package/dist/core.prod.mjs +2713 -2852
  16. package/dist/insights/index.qwik.cjs +1815 -1933
  17. package/dist/insights/index.qwik.mjs +1815 -1933
  18. package/dist/insights/insights.d.ts +1 -1
  19. package/dist/loader/package.json +1 -1
  20. package/dist/optimizer.cjs +47 -17
  21. package/dist/optimizer.d.ts +1 -1
  22. package/dist/optimizer.mjs +45 -17
  23. package/dist/prefetch/package.json +1 -1
  24. package/dist/server.cjs +12 -11
  25. package/dist/server.mjs +12 -11
  26. package/dist/starters/features/auth/package.json +1 -1
  27. package/dist/starters/features/tailwind/package.json +2 -2
  28. package/dist/starters/features/tailwind-v3/.vscode/settings.json +3 -0
  29. package/dist/starters/features/tailwind-v3/package.json +21 -0
  30. package/dist/starters/features/tailwind-v3/postcss.config.cjs +6 -0
  31. package/dist/starters/features/tailwind-v3/src/global.css +7 -0
  32. package/dist/starters/features/tailwind-v3/tailwind.config.js +8 -0
  33. package/dist/testing/index.cjs +5461 -5373
  34. package/dist/testing/index.d.ts +2 -1
  35. package/dist/testing/index.mjs +5475 -5389
  36. package/dist/testing/package.json +1 -1
  37. package/package.json +3 -3
  38. package/public.d.ts +6 -0
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core 2.0.0-alpha.8-dev+66037b5
3
+ * @qwik.dev/core 2.0.0-alpha.9-dev+56ed5bd
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -38,36 +38,6 @@
38
38
  function assertFalse() {
39
39
  qDev;
40
40
  }
41
- var QError;
42
- !function(QError) {
43
- QError[QError.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError[QError.schedulerNotFound = 1] = "schedulerNotFound",
44
- QError[QError.trackObjectWithoutProp = 2] = "trackObjectWithoutProp", QError[QError.verifySerializable = 3] = "verifySerializable",
45
- QError[QError.UNUSED_4 = 4] = "UNUSED_4", QError[QError.cannotRenderOverExistingContainer = 5] = "cannotRenderOverExistingContainer",
46
- QError[QError.UNUSED_6 = 6] = "UNUSED_6", QError[QError.UNUSED_7 = 7] = "UNUSED_7",
47
- QError[QError.UNUSED_8 = 8] = "UNUSED_8", QError[QError.UNUSED_9 = 9] = "UNUSED_9",
48
- QError[QError.qrlIsNotFunction = 10] = "qrlIsNotFunction", QError[QError.dynamicImportFailed = 11] = "dynamicImportFailed",
49
- QError[QError.unknownTypeArgument = 12] = "unknownTypeArgument", QError[QError.notFoundContext = 13] = "notFoundContext",
50
- QError[QError.useMethodOutsideContext = 14] = "useMethodOutsideContext", QError[QError.UNUSED_15 = 15] = "UNUSED_15",
51
- QError[QError.UNUSED_16 = 16] = "UNUSED_16", QError[QError.UNUSED_17 = 17] = "UNUSED_17",
52
- QError[QError.UNUSED_18 = 18] = "UNUSED_18", QError[QError.UNUSED_19 = 19] = "UNUSED_19",
53
- QError[QError.useInvokeContext = 20] = "useInvokeContext", QError[QError.UNUSED_21 = 21] = "UNUSED_21",
54
- QError[QError.UNUSED_22 = 22] = "UNUSED_22", QError[QError.UNUSED_23 = 23] = "UNUSED_23",
55
- QError[QError.UNUSED_24 = 24] = "UNUSED_24", QError[QError.UNUSED_25 = 25] = "UNUSED_25",
56
- QError[QError.UNUSED_26 = 26] = "UNUSED_26", QError[QError.UNUSED_27 = 27] = "UNUSED_27",
57
- QError[QError.invalidContext = 28] = "invalidContext", QError[QError.tagError = 29] = "tagError",
58
- QError[QError.qrlMissingContainer = 30] = "qrlMissingContainer", QError[QError.qrlMissingChunk = 31] = "qrlMissingChunk",
59
- QError[QError.invalidRefValue = 32] = "invalidRefValue", QError[QError.serializeErrorNotImplemented = 33] = "serializeErrorNotImplemented",
60
- QError[QError.serializeErrorExpectedVNode = 34] = "serializeErrorExpectedVNode",
61
- QError[QError.serializeErrorCannotAllocate = 35] = "serializeErrorCannotAllocate",
62
- QError[QError.serializeErrorMissingRootId = 36] = "serializeErrorMissingRootId",
63
- QError[QError.serializeErrorUnknownType = 37] = "serializeErrorUnknownType", QError[QError.serializeErrorUnvisited = 38] = "serializeErrorUnvisited",
64
- QError[QError.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError[QError.wrongTextareaValue = 40] = "wrongTextareaValue",
65
- QError[QError.containerNotFound = 41] = "containerNotFound", QError[QError.elementWithoutContainer = 42] = "elementWithoutContainer",
66
- QError[QError.invalidVNodeType = 43] = "invalidVNodeType", QError[QError.materializeVNodeDataError = 44] = "materializeVNodeDataError",
67
- QError[QError.cannotCoerceSignal = 45] = "cannotCoerceSignal", QError[QError.computedNotSync = 46] = "computedNotSync",
68
- QError[QError.computedReadOnly = 47] = "computedReadOnly", QError[QError.wrappedReadOnly = 48] = "wrappedReadOnly",
69
- QError[QError.unsafeAttr = 49] = "unsafeAttr";
70
- }(QError || (QError = {}));
71
41
  const qError = (code, errorMessageArgs = []) => {
72
42
  const text = (code => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`)(code, ...errorMessageArgs);
73
43
  return ((message, ...optionalParams) => createAndLogError(!0, message, ...optionalParams))(text, ...errorMessageArgs);
@@ -82,30 +52,9 @@
82
52
  const index = symbolName.lastIndexOf("_");
83
53
  return index > -1 ? symbolName.slice(index + 1) : symbolName;
84
54
  };
85
- var VirtualType;
86
- !function(VirtualType) {
87
- VirtualType.Virtual = "V", VirtualType.Fragment = "F", VirtualType.WrappedSignal = "S",
88
- VirtualType.Awaited = "A", VirtualType.Component = "C", VirtualType.InlineComponent = "I",
89
- VirtualType.Projection = "P";
90
- }(VirtualType || (VirtualType = {}));
91
- const VirtualTypeName = {
92
- [VirtualType.Virtual]: "Virtual",
93
- [VirtualType.Fragment]: "Fragment",
94
- [VirtualType.WrappedSignal]: "Signal",
95
- [VirtualType.Awaited]: "Awaited",
96
- [VirtualType.Component]: "Component",
97
- [VirtualType.InlineComponent]: "InlineComponent",
98
- [VirtualType.Projection]: "Projection"
99
- };
100
- var QContainerValue;
101
- !function(QContainerValue) {
102
- QContainerValue.PAUSED = "paused", QContainerValue.RESUMED = "resumed", QContainerValue.HTML = "html",
103
- QContainerValue.TEXT = "text";
104
- }(QContainerValue || (QContainerValue = {}));
105
55
  const QSlot = "q:slot";
106
56
  const QSlotS = "q:s";
107
57
  const getQFuncs = (document, hash) => document["qFuncs_" + hash] || [];
108
- const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
109
58
  const HTML_NS = "http://www.w3.org/1999/xhtml";
110
59
  const SVG_NS = "http://www.w3.org/2000/svg";
111
60
  const MATH_NS = "http://www.w3.org/1998/Math/MathML";
@@ -120,10 +69,10 @@
120
69
  }
121
70
  }
122
71
  if (!url) {
123
- throw qError(QError.qrlMissingChunk, [ symbolName ]);
72
+ throw qError(31, [ symbolName ]);
124
73
  }
125
74
  if (!containerEl) {
126
- throw qError(QError.qrlMissingContainer, [ url, symbolName ]);
75
+ throw qError(30, [ url, symbolName ]);
127
76
  }
128
77
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
129
78
  const urlCopy = new URL(urlDoc);
@@ -190,13 +139,6 @@
190
139
  const isArray = v => Array.isArray(v);
191
140
  const isString = v => "string" == typeof v;
192
141
  const isFunction = v => "function" == typeof v;
193
- var VNodeDataFlag;
194
- let _locale;
195
- !function(VNodeDataFlag) {
196
- VNodeDataFlag[VNodeDataFlag.NONE = 0] = "NONE", VNodeDataFlag[VNodeDataFlag.TEXT_DATA = 1] = "TEXT_DATA",
197
- VNodeDataFlag[VNodeDataFlag.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag[VNodeDataFlag.ELEMENT_NODE = 4] = "ELEMENT_NODE",
198
- VNodeDataFlag[VNodeDataFlag.REFERENCE = 8] = "REFERENCE", VNodeDataFlag[VNodeDataFlag.SERIALIZE = 16] = "SERIALIZE";
199
- }(VNodeDataFlag || (VNodeDataFlag = {}));
200
142
  const EMPTY_ARRAY = [];
201
143
  const EMPTY_OBJ = {};
202
144
  Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
@@ -216,7 +158,7 @@
216
158
  chunk = match[2];
217
159
  } else {
218
160
  if (!(match = srcCode.match(EXTRACT_SELF_IMPORT))) {
219
- throw qError(QError.dynamicImportFailed, [ srcCode ]);
161
+ throw qError(11, [ srcCode ]);
220
162
  }
221
163
  {
222
164
  const ref = "QWIK-SELF";
@@ -228,7 +170,7 @@
228
170
  }
229
171
  } else {
230
172
  if (!isString(chunkOrFn)) {
231
- throw qError(QError.unknownTypeArgument, [ chunkOrFn ]);
173
+ throw qError(12, [ chunkOrFn ]);
232
174
  }
233
175
  chunk = chunkOrFn;
234
176
  }
@@ -239,263 +181,397 @@
239
181
  };
240
182
  const inlinedQrl = (symbol, symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, symbol, null, null, lexicalScopeCapture);
241
183
  const _noopQrl = (symbolName, lexicalScopeCapture = EMPTY_ARRAY) => createQRL(null, symbolName, null, null, null, lexicalScopeCapture);
242
- var ChoreType;
243
- !function(ChoreType) {
244
- ChoreType[ChoreType.MACRO = 240] = "MACRO", ChoreType[ChoreType.MICRO = 15] = "MICRO",
245
- ChoreType[ChoreType.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType[ChoreType.RUN_QRL = 2] = "RUN_QRL",
246
- ChoreType[ChoreType.TASK = 3] = "TASK", ChoreType[ChoreType.NODE_DIFF = 4] = "NODE_DIFF",
247
- ChoreType[ChoreType.NODE_PROP = 5] = "NODE_PROP", ChoreType[ChoreType.COMPONENT = 6] = "COMPONENT",
248
- ChoreType[ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS = 7] = "RECOMPUTE_AND_SCHEDULE_EFFECTS",
249
- ChoreType[ChoreType.JOURNAL_FLUSH = 16] = "JOURNAL_FLUSH", ChoreType[ChoreType.VISIBLE = 32] = "VISIBLE",
250
- ChoreType[ChoreType.CLEANUP_VISIBLE = 48] = "CLEANUP_VISIBLE", ChoreType[ChoreType.WAIT_FOR_ALL = 255] = "WAIT_FOR_ALL";
251
- }(ChoreType || (ChoreType = {}));
252
- const useLexicalScope = () => {
253
- const context = getInvokeContext();
254
- let qrl = context.$qrl$;
255
- if (qrl) {
256
- assertQrl(qrl), assertDefined();
257
- } else {
258
- const el = context.$element$;
259
- assertDefined();
260
- const containerElement = _getQContainerElement(el);
261
- assertDefined();
262
- qrl = getDomContainer(containerElement).parseQRL(decodeURIComponent(String(context.$url$)));
263
- }
264
- return qrl.$captureRef$;
265
- };
266
- const queueQRL = (...args) => {
267
- const [runQrl] = useLexicalScope();
268
- const hostElement = getInvokeContext().$hostElement$;
269
- const scheduler = getDomContainer(hostElement).$scheduler$;
270
- if (!scheduler) {
271
- throw qError(QError.schedulerNotFound);
184
+ let _locale;
185
+ const useSequentialScope = () => {
186
+ const iCtx = useInvokeContext();
187
+ const host = iCtx.$hostElement$;
188
+ let seq = iCtx.$container$.getHostProp(host, "q:seq");
189
+ null === seq && (seq = [], iCtx.$container$.setHostProp(host, "q:seq", seq));
190
+ let seqIdx = iCtx.$container$.getHostProp(host, "q:seqIdx");
191
+ for (null === seqIdx && (seqIdx = 0), iCtx.$container$.setHostProp(host, "q:seqIdx", seqIdx + 1); seq.length <= seqIdx; ) {
192
+ seq.push(void 0);
272
193
  }
273
- return scheduler(ChoreType.RUN_QRL, hostElement, runQrl, args);
194
+ return {
195
+ val: seq[seqIdx],
196
+ set: value => seq[seqIdx] = value,
197
+ i: seqIdx,
198
+ iCtx
199
+ };
274
200
  };
275
- const Slot = props => _jsxSorted(Virtual, null, {
276
- [QSlotS]: ""
277
- }, props.children, 0, props.name ?? "");
278
- const SkipRender = Symbol("skip render");
279
- const SSRRaw = () => null;
280
- const SSRComment = () => null;
281
- const SSRStream = (props, key) => jsx(RenderOnce, {
282
- children: jsx(InternalSSRStream, props)
283
- }, key);
284
- const InternalSSRStream = () => null;
285
201
  const isJsxPropertyAnEventName = name => (name.startsWith("on") || name.startsWith("window:on") || name.startsWith("document:on")) && name.endsWith("$");
286
202
  const isHtmlAttributeAnEventName = name => name.startsWith("on:") || name.startsWith("on-window:") || name.startsWith("on-document:");
287
- const getEventNameFromJsxProp = name => {
288
- if (name.endsWith("$")) {
289
- let idx = -1;
290
- if (name.startsWith("on") ? idx = 2 : name.startsWith("window:on") ? idx = 9 : name.startsWith("document:on") && (idx = 11),
291
- -1 != idx) {
292
- const isCaseSensitive = isDashAt(name, idx) && !isDashAt(name, idx + 1);
293
- isCaseSensitive && idx++;
294
- let lastIdx = idx;
295
- let eventName = "";
296
- for (;;) {
297
- idx = name.indexOf("-", lastIdx);
298
- const chunk = name.substring(lastIdx, -1 === idx ? name.length - 1 : idx);
299
- if (eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), -1 == idx) {
300
- return eventName;
301
- }
302
- isDashAt(name, idx + 1) ? (eventName += "-", idx++) : (eventName += name.charAt(idx + 1).toUpperCase(),
303
- idx++), lastIdx = idx + 1;
304
- }
305
- }
306
- }
307
- return null;
308
- };
309
- const getEventNameScopeFromJsxProp = name => {
310
- const index = name.indexOf(":");
311
- return -1 !== index ? name.substring(0, index) : "";
312
- };
313
- const isDashAt = (name, idx) => 45 === name.charCodeAt(idx);
314
- const convertEventNameFromJsxPropToHtmlAttr = name => {
315
- if (name.endsWith("$")) {
316
- let prefix = null;
317
- if (name.startsWith("on") ? prefix = "on:" : name.startsWith("window:on") ? prefix = "on-window:" : name.startsWith("document:on") && (prefix = "on-document:"),
318
- null !== prefix) {
319
- const eventName = getEventNameFromJsxProp(name);
203
+ function jsxEventToHtmlAttribute(jsxEvent) {
204
+ if (jsxEvent.endsWith("$")) {
205
+ const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
206
+ if (-1 !== idx) {
207
+ const eventName = getEventNameFromJsxEvent(jsxEvent);
320
208
  return prefix + fromCamelToKebabCase(eventName);
321
209
  }
322
210
  }
323
211
  return null;
324
- };
325
- const fromCamelToKebabCase = text => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
326
- function isPreventDefault(key) {
327
- return key.startsWith("preventdefault:");
328
- }
329
- function getFileLocationFromJsx(jsxDev) {
330
- if (!jsxDev) {
331
- return null;
332
- }
333
- const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
334
- return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
335
212
  }
336
- const styleContent = styleId => "⚡️" + styleId;
337
- function hasClassAttr(props) {
338
- for (const key in props) {
339
- if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
340
- return !0;
213
+ function getEventNameFromJsxEvent(jsxEvent) {
214
+ if (jsxEvent.endsWith("$")) {
215
+ const [, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
216
+ if (-1 != idx) {
217
+ return function(jsxEvent, startIdx = 0) {
218
+ const idx = startIdx;
219
+ let lastIdx = idx;
220
+ const isCaseSensitive = isDash(jsxEvent.charCodeAt(idx));
221
+ isCaseSensitive && lastIdx++;
222
+ let eventName = "";
223
+ const chunk = jsxEvent.substring(lastIdx, jsxEvent.length - 1);
224
+ if ("DOMContentLoaded" === chunk) {
225
+ return "DOMContentLoaded";
226
+ }
227
+ return eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), eventName;
228
+ }(jsxEvent, idx);
341
229
  }
342
230
  }
343
- return !1;
231
+ return null;
344
232
  }
345
- function isClassAttr(key) {
346
- return "class" === key || "className" === key;
233
+ function getEventScopeDataFromJsxEvent(eventName) {
234
+ let prefix = null;
235
+ let idx = -1;
236
+ return eventName.startsWith("on") ? (prefix = "on:", idx = 2) : eventName.startsWith("window:on") ? (prefix = "on-window:",
237
+ idx = 9) : eventName.startsWith("document:on") && (prefix = "on-document:", idx = 11),
238
+ [ prefix, idx ];
347
239
  }
348
- const addComponentStylePrefix = styleId => {
349
- if (styleId) {
350
- let idx = 0;
351
- do {
352
- styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
353
- } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
354
- }
355
- return styleId || null;
240
+ const isDash = charCode => 45 === charCode;
241
+ const getEventNameScopeFromJsxEvent = name => {
242
+ const index = name.indexOf(":");
243
+ return -1 !== index ? name.substring(0, index) : "";
356
244
  };
357
- const unitlessNumbers = 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", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
358
- const hashCode = (text, hash = 0) => {
359
- for (let i = 0; i < text.length; i++) {
360
- hash = (hash << 5) - hash + text.charCodeAt(i), hash |= 0;
361
- }
362
- return Number(Math.abs(hash)).toString(36);
245
+ function isPreventDefault(key) {
246
+ return key.startsWith("preventdefault:");
247
+ }
248
+ const fromCamelToKebabCase = text => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
249
+ const createContextId = name => (assertTrue(/^[\w/.-]+$/.test(name)), /*#__PURE__*/ Object.freeze({
250
+ id: fromCamelToKebabCase(name)
251
+ }));
252
+ const useContextProvider = (context, newValue) => {
253
+ const {val, set, iCtx} = useSequentialScope();
254
+ void 0 === val && (iCtx.$container$.setContext(iCtx.$hostElement$, context, newValue),
255
+ set(1));
363
256
  };
364
- const serializeClass = obj => {
365
- if (!obj) {
366
- return "";
367
- }
368
- if (isString(obj)) {
369
- return obj.trim();
370
- }
371
- const classes = [];
372
- if (isArray(obj)) {
373
- for (const o of obj) {
374
- const classList = serializeClass(o);
375
- classList && classes.push(classList);
376
- }
377
- } else {
378
- for (const [key, value] of Object.entries(obj)) {
379
- value && classes.push(key.trim());
380
- }
257
+ const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
258
+ const version = "2.0.0-alpha.9-dev+56ed5bd";
259
+ const Slot = props => _jsxSorted(Virtual, null, {
260
+ [QSlotS]: ""
261
+ }, props.children, 0, props.name ?? "");
262
+ const SkipRender = Symbol("skip render");
263
+ const SSRRaw = () => null;
264
+ const SSRComment = () => null;
265
+ const SSRStream = (props, key) => jsx(RenderOnce, {
266
+ children: jsx(InternalSSRStream, props)
267
+ }, key);
268
+ const InternalSSRStream = () => null;
269
+ const NEEDS_COMPUTATION = Symbol("invalid");
270
+ const _EFFECT_BACK_REF = Symbol("backRef");
271
+ function getSubscriber(effect, prop, data) {
272
+ var value;
273
+ effect[_EFFECT_BACK_REF] || (build.isServer && ("__brand__" in (value = effect) && "currentComponentNode" in value) ? effect.setProp("q:brefs", new Map) : effect[_EFFECT_BACK_REF] = new Map);
274
+ const subMap = effect[_EFFECT_BACK_REF];
275
+ let sub = subMap.get(prop);
276
+ return sub || (sub = [ effect, prop ], subMap.set(prop, sub)), data && (sub[3] = data),
277
+ sub;
278
+ }
279
+ const throwIfQRLNotResolved = qrl => {
280
+ if (!qrl.resolved) {
281
+ throw qrl.resolve();
381
282
  }
382
- return classes.join(" ");
383
283
  };
384
- function serializeAttribute(key, value, styleScopedId) {
385
- if (isClassAttr(key)) {
386
- const serializedClass = serializeClass(value);
387
- value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
388
- } else {
389
- "style" === key ? value = (obj => {
390
- if (null == obj) {
391
- return "";
392
- }
393
- if ("object" == typeof obj) {
394
- if (isArray(obj)) {
395
- throw qError(QError.stringifyClassOrStyle, [ obj, "style" ]);
396
- }
397
- {
398
- const chunks = [];
399
- for (const key in obj) {
400
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
401
- const value = obj[key];
402
- null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(key.replace(/([A-Z])/g, "-$1").toLowerCase() + ":" + setValueForStyle(key, value)));
403
- }
404
- }
405
- return chunks.join(";");
406
- }
407
- }
408
- return String(obj);
409
- })(value) : !function(key) {
410
- return prop = key, prop.startsWith("aria-") || [ "spellcheck", "draggable", "contenteditable" ].includes(key);
411
- var prop;
412
- }(key) && "number" != typeof value ? !1 === value || null == value ? value = null : !0 === value && isPreventDefault(key) && (value = "") : value = (value => null != value ? String(value) : null)(value);
284
+ const isSignal = value => value instanceof SignalImpl;
285
+ class SubscriptionData {
286
+ data;
287
+ constructor(data) {
288
+ this.data = data;
413
289
  }
414
- return value;
415
290
  }
416
- const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || unitlessNumbers.has(styleName) ? value : value + "px";
417
- const STORE_TARGET = Symbol("store.target");
418
- const STORE_HANDLER = Symbol("store.handler");
419
- const STORE_ALL_PROPS = Symbol("store.all");
420
- var StoreFlags;
421
- !function(StoreFlags) {
422
- StoreFlags[StoreFlags.NONE = 0] = "NONE", StoreFlags[StoreFlags.RECURSIVE = 1] = "RECURSIVE",
423
- StoreFlags[StoreFlags.IMMUTABLE = 2] = "IMMUTABLE";
424
- }(StoreFlags || (StoreFlags = {}));
425
- const getStoreHandler = value => value[STORE_HANDLER];
426
- const getStoreTarget = value => value?.[STORE_TARGET] || null;
427
- const unwrapStore = value => getStoreTarget(value) || value;
428
- const isStore = value => STORE_TARGET in value;
429
- function createStore(container, obj, flags) {
430
- return new Proxy(obj, new StoreHandler(flags, container || null));
431
- }
432
- const getOrCreateStore = (obj, flags, container) => {
433
- if (isSerializableObject(obj) && container) {
434
- let store = container.$storeProxyMap$.get(obj);
435
- return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)),
436
- store;
437
- }
438
- return obj;
439
- };
440
- class StoreHandler {
441
- $flags$;
442
- $container$;
291
+ class SignalImpl {
292
+ $untrackedValue$;
443
293
  $effects$=null;
444
- constructor($flags$, $container$) {
445
- this.$flags$ = $flags$, this.$container$ = $container$;
294
+ $container$=null;
295
+ constructor(container, value) {
296
+ this.$container$ = container, this.$untrackedValue$ = value;
446
297
  }
447
- toString() {
448
- return "[Store]";
298
+ get untrackedValue() {
299
+ return this.$untrackedValue$;
449
300
  }
450
- get(target, prop) {
451
- if ("symbol" == typeof prop) {
452
- return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
453
- }
301
+ set untrackedValue(value) {
302
+ this.$untrackedValue$ = value;
303
+ }
304
+ get value() {
454
305
  const ctx = tryGetInvokeContext();
455
- const value = target[prop];
456
306
  if (ctx) {
457
307
  if (null === this.$container$) {
458
308
  if (!ctx.$container$) {
459
- return value;
309
+ return this.untrackedValue;
460
310
  }
461
311
  this.$container$ = ctx.$container$;
462
312
  } else {
463
313
  assertTrue();
464
314
  }
465
315
  const effectSubscriber = ctx.$effectSubscriber$;
466
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
467
- }
468
- if ("toString" === prop && value === Object.prototype.toString) {
469
- return this.toString;
316
+ if (effectSubscriber) {
317
+ const effects = this.$effects$ ||= new Set;
318
+ ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this),
319
+ addQrlToSerializationCtx(effectSubscriber, this.$container$);
320
+ }
470
321
  }
471
- return this.$flags$ & StoreFlags.RECURSIVE && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
322
+ return this.untrackedValue;
472
323
  }
473
- set(target, prop, value) {
474
- if ("symbol" == typeof prop) {
475
- return target[prop] = value, !0;
476
- }
477
- const newValue = this.$flags$ & StoreFlags.RECURSIVE ? unwrapStore(value) : value;
478
- if (prop in target) {
479
- newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
480
- } else {
481
- setNewValueAndTriggerEffects(prop, newValue, target, this);
482
- }
483
- return !0;
324
+ set value(value) {
325
+ value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
484
326
  }
485
- deleteProperty(target, prop) {
486
- return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)),
487
- !0);
327
+ valueOf() {
328
+ qDev;
488
329
  }
489
- has(target, prop) {
490
- if (prop === STORE_TARGET) {
491
- return !0;
492
- }
493
- if ("string" == typeof prop) {
494
- const ctx = tryGetInvokeContext();
495
- if (ctx) {
496
- const effectSubscriber = ctx.$effectSubscriber$;
497
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
498
- }
330
+ toString() {
331
+ return build.isDev ? `[${this.constructor.name}${1 & this.$flags$ ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "") : this.constructor.name;
332
+ }
333
+ toJSON() {
334
+ return {
335
+ value: this.$untrackedValue$
336
+ };
337
+ }
338
+ }
339
+ const ensureContainsSubscription = (array, effectSubscription) => {
340
+ array.add(effectSubscription);
341
+ };
342
+ const ensureContainsBackRef = (array, value) => {
343
+ array[2] ||= new Set, array[2].add(value);
344
+ };
345
+ const addQrlToSerializationCtx = (effectSubscriber, container) => {
346
+ if (container && !isDomContainer(container)) {
347
+ const effect = effectSubscriber[0];
348
+ const property = effectSubscriber[1];
349
+ let qrl = null;
350
+ isTask(effect) ? qrl = effect.$qrl$ : effect instanceof ComputedSignalImpl ? qrl = effect.$computeQrl$ : ":" === property && (qrl = container.getHostProp(effect, "q:renderFn")),
351
+ qrl && container.serializationCtx.$eventQrls$.add(qrl);
352
+ }
353
+ };
354
+ const triggerEffects = (container, signal, effects) => {
355
+ const isBrowser = isDomContainer(container);
356
+ if (effects) {
357
+ const scheduleEffect = effectSubscription => {
358
+ const consumer = effectSubscription[0];
359
+ const property = effectSubscription[1];
360
+ if (assertDefined(), isTask(consumer)) {
361
+ consumer.$flags$ |= 8;
362
+ let choreType = 3;
363
+ 1 & consumer.$flags$ && (choreType = 32), container.$scheduler$(choreType, consumer);
364
+ } else if (consumer instanceof SignalImpl) {
365
+ consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)),
366
+ consumer.$invalidate$();
367
+ } else if (":" === property) {
368
+ const host = consumer;
369
+ const qrl = container.getHostProp(host, "q:renderFn");
370
+ assertDefined();
371
+ const props = container.getHostProp(host, "q:props");
372
+ container.$scheduler$(6, host, qrl, props);
373
+ } else if (isBrowser) {
374
+ if ("." === property) {
375
+ container.$scheduler$(4, consumer, consumer, signal);
376
+ } else {
377
+ const effectData = effectSubscription[3];
378
+ if (effectData instanceof SubscriptionData) {
379
+ const payload = {
380
+ ...effectData.data,
381
+ $value$: signal
382
+ };
383
+ container.$scheduler$(5, consumer, property, payload);
384
+ }
385
+ }
386
+ }
387
+ };
388
+ for (const effect of effects) {
389
+ scheduleEffect(effect);
390
+ }
391
+ }
392
+ };
393
+ class ComputedSignalImpl extends SignalImpl {
394
+ $computeQrl$;
395
+ $flags$;
396
+ $forceRunEffects$=!1;
397
+ [_EFFECT_BACK_REF]=null;
398
+ constructor(container, fn, flags = 1) {
399
+ super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
400
+ }
401
+ $invalidate$() {
402
+ this.$flags$ |= 1, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(7, null, this);
403
+ }
404
+ force() {
405
+ this.$forceRunEffects$ = !0, this.$container$?.$scheduler$(7, null, this);
406
+ }
407
+ get untrackedValue() {
408
+ const didChange = this.$computeIfNeeded$();
409
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
410
+ }
411
+ $computeIfNeeded$() {
412
+ if (!(1 & this.$flags$)) {
413
+ return !1;
414
+ }
415
+ const computeQrl = this.$computeQrl$;
416
+ throwIfQRLNotResolved(computeQrl);
417
+ const ctx = tryGetInvokeContext();
418
+ const previousEffectSubscription = ctx?.$effectSubscriber$;
419
+ ctx && (ctx.$effectSubscriber$ = getSubscriber(this, "."));
420
+ try {
421
+ const untrackedValue = computeQrl.getFn(ctx)();
422
+ if (isPromise(untrackedValue)) {
423
+ throw qError(46, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
424
+ }
425
+ this.$flags$ &= -2;
426
+ const didChange = untrackedValue !== this.$untrackedValue$;
427
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
428
+ } finally {
429
+ ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
430
+ }
431
+ }
432
+ set value(_) {
433
+ throw qError(47);
434
+ }
435
+ get value() {
436
+ return super.value;
437
+ }
438
+ }
439
+ class WrappedSignal extends SignalImpl {
440
+ $args$;
441
+ $func$;
442
+ $funcStr$;
443
+ $flags$;
444
+ $hostElement$=null;
445
+ $forceRunEffects$=!1;
446
+ [_EFFECT_BACK_REF]=null;
447
+ constructor(container, fn, args, fnStr, flags = 3) {
448
+ super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
449
+ this.$flags$ = flags;
450
+ }
451
+ $invalidate$() {
452
+ this.$flags$ |= 1, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(7, this.$hostElement$, this);
453
+ }
454
+ force() {
455
+ this.$flags$ |= 1, this.$forceRunEffects$ = !1, triggerEffects(this.$container$, this, this.$effects$);
456
+ }
457
+ get untrackedValue() {
458
+ const didChange = this.$computeIfNeeded$();
459
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
460
+ }
461
+ $computeIfNeeded$() {
462
+ if (!(1 & this.$flags$)) {
463
+ return !1;
464
+ }
465
+ const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, ".", this.$container$);
466
+ const didChange = untrackedValue !== this.$untrackedValue$;
467
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
468
+ }
469
+ set value(_) {
470
+ throw qError(48);
471
+ }
472
+ get value() {
473
+ return super.value;
474
+ }
475
+ }
476
+ class SerializerSignalImpl extends ComputedSignalImpl {
477
+ constructor(container, argQrl) {
478
+ super(container, argQrl);
479
+ }
480
+ $didInitialize$=!1;
481
+ $computeIfNeeded$() {
482
+ if (!(1 & this.$flags$)) {
483
+ return !1;
484
+ }
485
+ throwIfQRLNotResolved(this.$computeQrl$);
486
+ let arg = this.$computeQrl$.resolved;
487
+ "function" == typeof arg && (arg = arg());
488
+ const {deserialize, initial} = arg;
489
+ const update = arg.update;
490
+ const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
491
+ const untrackedValue = trackSignal((() => this.$didInitialize$ ? update?.(currentValue) : deserialize(currentValue)), this, ".", this.$container$);
492
+ const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
493
+ return this.$flags$ &= -2, this.$didInitialize$ = !0, didChange && (this.$untrackedValue$ = untrackedValue),
494
+ didChange;
495
+ }
496
+ }
497
+ const isSerializerObj = obj => "object" == typeof obj && null !== obj && "function" == typeof obj[SerializerSymbol];
498
+ const STORE_TARGET = Symbol("store.target");
499
+ const STORE_HANDLER = Symbol("store.handler");
500
+ const STORE_ALL_PROPS = Symbol("store.all");
501
+ const getStoreHandler = value => value[STORE_HANDLER];
502
+ const getStoreTarget = value => value?.[STORE_TARGET] || null;
503
+ const unwrapStore = value => getStoreTarget(value) || value;
504
+ const isStore = value => STORE_TARGET in value;
505
+ function createStore(container, obj, flags) {
506
+ return new Proxy(obj, new StoreHandler(flags, container || null));
507
+ }
508
+ const getOrCreateStore = (obj, flags, container) => {
509
+ if (isSerializableObject(obj) && container) {
510
+ let store = container.$storeProxyMap$.get(obj);
511
+ return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)),
512
+ store;
513
+ }
514
+ return obj;
515
+ };
516
+ class StoreHandler {
517
+ $flags$;
518
+ $container$;
519
+ $effects$=null;
520
+ constructor($flags$, $container$) {
521
+ this.$flags$ = $flags$, this.$container$ = $container$;
522
+ }
523
+ toString() {
524
+ return "[Store]";
525
+ }
526
+ get(target, prop) {
527
+ if ("symbol" == typeof prop) {
528
+ return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
529
+ }
530
+ const ctx = tryGetInvokeContext();
531
+ const value = target[prop];
532
+ if (ctx) {
533
+ if (null === this.$container$) {
534
+ if (!ctx.$container$) {
535
+ return value;
536
+ }
537
+ this.$container$ = ctx.$container$;
538
+ } else {
539
+ assertTrue();
540
+ }
541
+ const effectSubscriber = ctx.$effectSubscriber$;
542
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
543
+ }
544
+ if ("toString" === prop && value === Object.prototype.toString) {
545
+ return this.toString;
546
+ }
547
+ return 1 & this.$flags$ && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
548
+ }
549
+ set(target, prop, value) {
550
+ if ("symbol" == typeof prop) {
551
+ return target[prop] = value, !0;
552
+ }
553
+ const newValue = 1 & this.$flags$ ? unwrapStore(value) : value;
554
+ if (prop in target) {
555
+ newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
556
+ } else {
557
+ setNewValueAndTriggerEffects(prop, newValue, target, this);
558
+ }
559
+ return !0;
560
+ }
561
+ deleteProperty(target, prop) {
562
+ return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)),
563
+ !0);
564
+ }
565
+ has(target, prop) {
566
+ if (prop === STORE_TARGET) {
567
+ return !0;
568
+ }
569
+ if ("string" == typeof prop) {
570
+ const ctx = tryGetInvokeContext();
571
+ if (ctx) {
572
+ const effectSubscriber = ctx.$effectSubscriber$;
573
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
574
+ }
499
575
  }
500
576
  return Object.prototype.hasOwnProperty.call(target, prop);
501
577
  }
@@ -545,8 +621,6 @@
545
621
  }
546
622
  return effectsToTrigger || null;
547
623
  }
548
- const NEEDS_COMPUTATION = Symbol("invalid");
549
- const _EFFECT_BACK_REF = Symbol("backRef");
550
624
  class BackRef {
551
625
  [_EFFECT_BACK_REF]=null;
552
626
  }
@@ -555,12 +629,12 @@
555
629
  const effects = consumer[_EFFECT_BACK_REF];
556
630
  if (effects) {
557
631
  for (const [, effect] of effects) {
558
- const backRefs = effect[EffectSubscriptionProp.BACK_REF];
632
+ const backRefs = effect[2];
559
633
  if (!backRefs) {
560
634
  return;
561
635
  }
562
636
  for (const producer of backRefs) {
563
- if (producer instanceof Signal) {
637
+ if (producer instanceof SignalImpl) {
564
638
  clearSignal(container, producer, effect);
565
639
  } else if (container.$storeProxyMap$.has(producer)) {
566
640
  const target = container.$storeProxyMap$.get(producer);
@@ -583,54 +657,33 @@
583
657
  }
584
658
  }
585
659
  }
586
- const implicit$FirstArg = fn => function(first, ...rest) {
587
- return fn.call(null, dollar(first), ...rest);
588
- };
589
- const createSignal = value => new Signal(null, value);
590
- const createComputedQrl = qrl => (throwIfQRLNotResolved(qrl), new ComputedSignal(null, qrl));
591
- const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedQrl);
592
- const useSequentialScope = () => {
593
- const iCtx = useInvokeContext();
594
- const host = iCtx.$hostElement$;
595
- let seq = iCtx.$container$.getHostProp(host, "q:seq");
596
- null === seq && (seq = [], iCtx.$container$.setHostProp(host, "q:seq", seq));
597
- let seqIdx = iCtx.$container$.getHostProp(host, "q:seqIdx");
598
- for (null === seqIdx && (seqIdx = 0), iCtx.$container$.setHostProp(host, "q:seqIdx", seqIdx + 1); seq.length <= seqIdx; ) {
599
- seq.push(void 0);
660
+ const useLexicalScope = () => {
661
+ const context = getInvokeContext();
662
+ let qrl = context.$qrl$;
663
+ if (qrl) {
664
+ assertQrl(qrl), assertDefined();
665
+ } else {
666
+ const el = context.$element$;
667
+ assertDefined();
668
+ const containerElement = _getQContainerElement(el);
669
+ assertDefined();
670
+ qrl = getDomContainer(containerElement).parseQRL(decodeURIComponent(String(context.$url$)));
600
671
  }
601
- return {
602
- val: seq[seqIdx],
603
- set: value => seq[seqIdx] = value,
604
- i: seqIdx,
605
- iCtx
606
- };
672
+ return qrl.$captureRef$;
607
673
  };
608
- function getSubscriber(effect, prop, data) {
609
- var value;
610
- effect[_EFFECT_BACK_REF] || (build.isServer && ("__brand__" in (value = effect) && "currentComponentNode" in value) ? effect.setProp("q:brefs", new Map) : effect[_EFFECT_BACK_REF] = new Map);
611
- const subMap = effect[_EFFECT_BACK_REF];
612
- let sub = subMap.get(prop);
613
- return sub || (sub = [ effect, prop ], subMap.set(prop, sub)), data && (sub[EffectSubscriptionProp.DATA] = data),
614
- sub;
615
- }
616
- var TaskFlags;
617
- !function(TaskFlags) {
618
- TaskFlags[TaskFlags.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags[TaskFlags.TASK = 2] = "TASK",
619
- TaskFlags[TaskFlags.RESOURCE = 4] = "RESOURCE", TaskFlags[TaskFlags.DIRTY = 8] = "DIRTY";
620
- }(TaskFlags || (TaskFlags = {}));
621
674
  const useTaskQrl = qrl => {
622
675
  const {val, set, iCtx, i} = useSequentialScope();
623
676
  if (val) {
624
677
  return;
625
678
  }
626
679
  assertQrl(qrl), set(1);
627
- const task = new Task(TaskFlags.DIRTY | TaskFlags.TASK, i, iCtx.$hostElement$, qrl, void 0, null);
680
+ const task = new Task(10, i, iCtx.$hostElement$, qrl, void 0, null);
628
681
  set(task);
629
- const promise = iCtx.$container$.$scheduler$(ChoreType.TASK, task);
682
+ const promise = iCtx.$container$.$scheduler$(3, task);
630
683
  isPromise(promise) && promise.catch((() => {}));
631
684
  };
632
685
  const runTask = (task, container, host) => {
633
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
686
+ task.$flags$ &= -9, cleanupTask(task);
634
687
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
635
688
  iCtx.$container$ = container;
636
689
  const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
@@ -649,7 +702,7 @@
649
702
  const taskApi = {
650
703
  track: (obj, prop) => {
651
704
  const ctx = newInvokeContext();
652
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container,
705
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container,
653
706
  invoke(ctx, (() => {
654
707
  if (isFunction(obj)) {
655
708
  return obj();
@@ -664,7 +717,7 @@
664
717
  return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$),
665
718
  obj;
666
719
  }
667
- throw qError(QError.trackObjectWithoutProp);
720
+ throw qError(2);
668
721
  }));
669
722
  },
670
723
  cleanup
@@ -704,41 +757,40 @@
704
757
  const isTask = value => value instanceof Task;
705
758
  const scheduleTask = (_event, element) => {
706
759
  const [task] = useLexicalScope();
707
- const type = task.$flags$ & TaskFlags.VISIBLE_TASK ? ChoreType.VISIBLE : ChoreType.TASK;
760
+ const type = 1 & task.$flags$ ? 32 : 3;
708
761
  getDomContainer(element).$scheduler$(type, task);
709
762
  };
710
- var VNodeFlags;
711
- var VNodeFlagsIndex;
712
- var VNodeProps;
713
- var ElementVNodeProps;
714
- var TextVNodeProps;
715
- var VirtualVNodeProps;
716
- !function(VNodeFlags) {
717
- VNodeFlags[VNodeFlags.Element = 1] = "Element", VNodeFlags[VNodeFlags.Virtual = 2] = "Virtual",
718
- VNodeFlags[VNodeFlags.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK",
719
- VNodeFlags[VNodeFlags.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags[VNodeFlags.TYPE_MASK = 7] = "TYPE_MASK",
720
- VNodeFlags[VNodeFlags.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags[VNodeFlags.Text = 4] = "Text",
721
- VNodeFlags[VNodeFlags.Inflated = 8] = "Inflated", VNodeFlags[VNodeFlags.Resolved = 16] = "Resolved",
722
- VNodeFlags[VNodeFlags.Deleted = 32] = "Deleted", VNodeFlags[VNodeFlags.NAMESPACE_MASK = 192] = "NAMESPACE_MASK",
723
- VNodeFlags[VNodeFlags.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK",
724
- VNodeFlags[VNodeFlags.NS_html = 0] = "NS_html", VNodeFlags[VNodeFlags.NS_svg = 64] = "NS_svg",
725
- VNodeFlags[VNodeFlags.NS_math = 128] = "NS_math";
726
- }(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex) {
727
- VNodeFlagsIndex[VNodeFlagsIndex.mask = -256] = "mask", VNodeFlagsIndex[VNodeFlagsIndex.negated_mask = 255] = "negated_mask",
728
- VNodeFlagsIndex[VNodeFlagsIndex.shift = 8] = "shift";
729
- }(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps) {
730
- VNodeProps[VNodeProps.flags = 0] = "flags", VNodeProps[VNodeProps.parent = 1] = "parent",
731
- VNodeProps[VNodeProps.previousSibling = 2] = "previousSibling", VNodeProps[VNodeProps.nextSibling = 3] = "nextSibling";
732
- }(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps) {
733
- ElementVNodeProps[ElementVNodeProps.firstChild = 4] = "firstChild", ElementVNodeProps[ElementVNodeProps.lastChild = 5] = "lastChild",
734
- ElementVNodeProps[ElementVNodeProps.element = 6] = "element", ElementVNodeProps[ElementVNodeProps.elementName = 7] = "elementName",
735
- ElementVNodeProps[ElementVNodeProps.PROPS_OFFSET = 8] = "PROPS_OFFSET";
736
- }(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps) {
737
- TextVNodeProps[TextVNodeProps.node = 4] = "node", TextVNodeProps[TextVNodeProps.text = 5] = "text";
738
- }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps) {
739
- VirtualVNodeProps[VirtualVNodeProps.firstChild = 4] = "firstChild", VirtualVNodeProps[VirtualVNodeProps.lastChild = 5] = "lastChild",
740
- VirtualVNodeProps[VirtualVNodeProps.PROPS_OFFSET = 6] = "PROPS_OFFSET";
741
- }(VirtualVNodeProps || (VirtualVNodeProps = {}));
763
+ const styleContent = styleId => "⚡️" + styleId;
764
+ function hasClassAttr(props) {
765
+ for (const key in props) {
766
+ if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
767
+ return !0;
768
+ }
769
+ }
770
+ return !1;
771
+ }
772
+ function isClassAttr(key) {
773
+ return "class" === key || "className" === key;
774
+ }
775
+ const addComponentStylePrefix = styleId => {
776
+ if (styleId) {
777
+ let idx = 0;
778
+ do {
779
+ styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
780
+ } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
781
+ }
782
+ return styleId || null;
783
+ };
784
+ const DEBUG_TYPE = "q:type";
785
+ const VirtualTypeName = {
786
+ V: "Virtual",
787
+ F: "Fragment",
788
+ S: "Signal",
789
+ A: "Awaited",
790
+ C: "Component",
791
+ I: "InlineComponent",
792
+ P: "Projection"
793
+ };
742
794
  const mapApp_findIndx = (array, key, start) => {
743
795
  assertTrue();
744
796
  let bottom = start >> 1;
@@ -781,7 +833,7 @@
781
833
  let childElement = null;
782
834
  let newChildElement = null;
783
835
  if (vnode_isElementVNode(vCursor)) {
784
- childElement = vCursor[ElementVNodeProps.element];
836
+ childElement = vCursor[6];
785
837
  const childElementTag = vnode_getElementName(vCursor);
786
838
  const vCursorParent = vnode_getParent(vCursor);
787
839
  const vCursorDomParent = null == rootElement ? parentVNode : vCursorParent && vnode_getDomParentVNode(vCursorParent);
@@ -792,8 +844,8 @@
792
844
  newChildElement = cloneElementWithNamespace(childElement, childElementTag, namespace),
793
845
  childElement.remove(), null == rootElement && (rootElement = newChildElement), parentElement && parentElement.appendChild(newChildElement);
794
846
  const vFirstChild = vnode_getFirstChild(vCursor);
795
- if (vCursor[ElementVNodeProps.element] = newChildElement, vCursor[VNodeProps.flags] &= VNodeFlags.NEGATED_NAMESPACE_MASK,
796
- vCursor[VNodeProps.flags] |= namespaceFlag, vFirstChild) {
847
+ if (vCursor[6] = newChildElement, vCursor[0] &= -193, vCursor[0] |= namespaceFlag,
848
+ vFirstChild) {
797
849
  vCursor = vFirstChild, parentElement = newChildElement;
798
850
  continue;
799
851
  }
@@ -833,71 +885,36 @@
833
885
  return rootElement;
834
886
  }
835
887
  function isSvg(tagOrVNode) {
836
- return "string" == typeof tagOrVNode ? "svg" === (elementName = tagOrVNode) || isForeignObjectElement(elementName) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_svg);
888
+ return "string" == typeof tagOrVNode ? "svg" === (elementName = tagOrVNode) || isForeignObjectElement(elementName) : !!(64 & tagOrVNode[0]);
837
889
  var elementName;
838
890
  }
839
891
  function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
840
892
  const parentIsDefaultNamespace = !domParentVNode || !(!vnode_getElementName(domParentVNode) || (vnode = domParentVNode,
841
- vnode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK));
893
+ 192 & vnode[0]));
842
894
  var vnode;
843
895
  const parentIsForeignObject = !parentIsDefaultNamespace && isForeignObjectElement(vnode_getElementName(domParentVNode));
844
896
  let elementNamespace = HTML_NS;
845
- let elementNamespaceFlag = VNodeFlags.NS_html;
897
+ let elementNamespaceFlag = 0;
846
898
  const isElementVNodeOrString = "string" == typeof tagOrVNode || vnode_isElementVNode(tagOrVNode);
847
899
  if (isElementVNodeOrString && isSvg(tagOrVNode)) {
848
- elementNamespace = SVG_NS, elementNamespaceFlag = VNodeFlags.NS_svg;
900
+ elementNamespace = SVG_NS, elementNamespaceFlag = 64;
849
901
  } else if (isElementVNodeOrString && function(tagOrVNode) {
850
- return "string" == typeof tagOrVNode ? "math" === tagOrVNode : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_math);
902
+ return "string" == typeof tagOrVNode ? "math" === tagOrVNode : !!(128 & tagOrVNode[0]);
851
903
  }(tagOrVNode)) {
852
- elementNamespace = MATH_NS, elementNamespaceFlag = VNodeFlags.NS_math;
904
+ elementNamespace = MATH_NS, elementNamespaceFlag = 128;
853
905
  } else if (domParentVNode && !parentIsForeignObject && !parentIsDefaultNamespace) {
854
- elementNamespace = !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_svg) ? SVG_NS : !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_math) ? MATH_NS : HTML_NS,
855
- elementNamespaceFlag = domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK;
906
+ elementNamespace = !!(64 & domParentVNode[0]) ? SVG_NS : !!(128 & domParentVNode[0]) ? MATH_NS : HTML_NS,
907
+ elementNamespaceFlag = 192 & domParentVNode[0];
856
908
  }
857
909
  return {
858
910
  elementNamespace,
859
911
  elementNamespaceFlag
860
912
  };
861
913
  }
862
- const useOn = (event, eventQrl) => {
863
- _useOn(createEventName(event, void 0), eventQrl);
864
- };
865
- const useOnDocument = (event, eventQrl) => {
866
- _useOn(createEventName(event, "document"), eventQrl);
867
- };
868
- const createEventName = (event, eventType) => {
869
- const prefix = void 0 !== eventType ? eventType + ":" : "";
870
- const map = name => prefix + "on" + name.charAt(0).toUpperCase() + name.substring(1) + "$";
871
- return Array.isArray(event) ? event.map(map) : map(event);
872
- };
873
- const _useOn = (eventName, eventQrl) => {
874
- const {isAdded, addEvent} = useOnEventsSequentialScope();
875
- isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach((event => addEvent(event, eventQrl))) : addEvent(eventName, eventQrl));
876
- };
877
- const useOnEventsSequentialScope = () => {
878
- const iCtx = useInvokeContext();
879
- const host = iCtx.$hostElement$;
880
- let onMap = iCtx.$container$.getHostProp(host, ":on");
881
- null === onMap && (onMap = {}, iCtx.$container$.setHostProp(host, ":on", onMap));
882
- let seqIdx = iCtx.$container$.getHostProp(host, ":onIdx");
883
- null === seqIdx && (seqIdx = 0), iCtx.$container$.setHostProp(host, ":onIdx", seqIdx + 1);
884
- let addedFlags = iCtx.$container$.getHostProp(host, ":onFlags");
885
- for (null === addedFlags && (addedFlags = [], iCtx.$container$.setHostProp(host, ":onFlags", addedFlags)); addedFlags.length <= seqIdx; ) {
886
- addedFlags.push(!1);
887
- }
888
- return {
889
- isAdded: addedFlags[seqIdx],
890
- addEvent: (eventName, eventQrl) => {
891
- addedFlags[seqIdx] = !0;
892
- let events = onMap[eventName];
893
- events || (onMap[eventName] = events = []), events.push(eventQrl);
894
- }
895
- };
896
- };
897
914
  const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
898
915
  const iCtx = newInvokeContext(container.$locale$, subscriptionHost || void 0, void 0, "qRender");
899
916
  let componentFn;
900
- subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, EffectProperty.COMPONENT),
917
+ subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, ":"),
901
918
  iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
902
919
  let isInlineComponent = !1;
903
920
  if (null === componentQRL && (componentQRL = container.getHostProp(renderHost, "q:renderFn"),
@@ -1025,6 +1042,73 @@
1025
1042
  }
1026
1043
  return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
1027
1044
  }
1045
+ const unitlessNumbers = 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", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp" ]);
1046
+ const hashCode = (text, hash = 0) => {
1047
+ for (let i = 0; i < text.length; i++) {
1048
+ hash = (hash << 5) - hash + text.charCodeAt(i), hash |= 0;
1049
+ }
1050
+ return Number(Math.abs(hash)).toString(36);
1051
+ };
1052
+ const serializeClass = obj => {
1053
+ if (!obj) {
1054
+ return "";
1055
+ }
1056
+ if (isString(obj)) {
1057
+ return obj.trim();
1058
+ }
1059
+ const classes = [];
1060
+ if (isArray(obj)) {
1061
+ for (const o of obj) {
1062
+ const classList = serializeClass(o);
1063
+ classList && classes.push(classList);
1064
+ }
1065
+ } else {
1066
+ for (const [key, value] of Object.entries(obj)) {
1067
+ value && classes.push(key.trim());
1068
+ }
1069
+ }
1070
+ return classes.join(" ");
1071
+ };
1072
+ function serializeAttribute(key, value, styleScopedId) {
1073
+ if (isClassAttr(key)) {
1074
+ const serializedClass = serializeClass(value);
1075
+ value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
1076
+ } else {
1077
+ "style" === key ? value = (obj => {
1078
+ if (null == obj) {
1079
+ return "";
1080
+ }
1081
+ if ("object" == typeof obj) {
1082
+ if (isArray(obj)) {
1083
+ throw qError(0, [ obj, "style" ]);
1084
+ }
1085
+ {
1086
+ const chunks = [];
1087
+ for (const key in obj) {
1088
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
1089
+ const value = obj[key];
1090
+ null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(key.replace(/([A-Z])/g, "-$1").toLowerCase() + ":" + setValueForStyle(key, value)));
1091
+ }
1092
+ }
1093
+ return chunks.join(";");
1094
+ }
1095
+ }
1096
+ return String(obj);
1097
+ })(value) : !function(key) {
1098
+ return prop = key, prop.startsWith("aria-") || [ "spellcheck", "draggable", "contenteditable" ].includes(key);
1099
+ var prop;
1100
+ }(key) && "number" != typeof value ? !1 === value || null == value ? value = null : !0 === value && isPreventDefault(key) && (value = "") : value = (value => null != value ? String(value) : null)(value);
1101
+ }
1102
+ return value;
1103
+ }
1104
+ const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || unitlessNumbers.has(styleName) ? value : value + "px";
1105
+ function getFileLocationFromJsx(jsxDev) {
1106
+ if (!jsxDev) {
1107
+ return null;
1108
+ }
1109
+ const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
1110
+ return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
1111
+ }
1028
1112
  const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1029
1113
  let journal = container.$journal$;
1030
1114
  const stack = [];
@@ -1033,7 +1117,7 @@
1033
1117
  let vCurrent = null;
1034
1118
  let vNewNode = null;
1035
1119
  let vSiblings = null;
1036
- let vSiblingsIdx = -1;
1120
+ let vSiblingsArray = null;
1037
1121
  let jsxChildren = null;
1038
1122
  let jsxValue = null;
1039
1123
  let jsxIdx = 0;
@@ -1062,15 +1146,14 @@
1062
1146
  if (Array.isArray(jsxValue)) {
1063
1147
  descend(jsxValue, !1);
1064
1148
  } else if (isSignal(jsxValue)) {
1065
- vCurrent && clearAllEffects(container, vCurrent), expectVirtual(VirtualType.WrappedSignal, null),
1066
- descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, EffectProperty.VNODE, container), !0);
1149
+ vCurrent && clearAllEffects(container, vCurrent), expectVirtual("S", null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), !0);
1067
1150
  } else if (isPromise(jsxValue)) {
1068
- expectVirtual(VirtualType.Awaited, null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
1151
+ expectVirtual("A", null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
1069
1152
  } else if (isJSXNode(jsxValue)) {
1070
1153
  const type = jsxValue.type;
1071
1154
  "string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type),
1072
1155
  descend(jsxValue.children, !0)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(),
1073
- expectVirtual(VirtualType.Fragment, jsxValue.key), descend(jsxValue.children, !0)) : type === Slot ? (expectNoMoreTextNodes(),
1156
+ expectVirtual("F", jsxValue.key), descend(jsxValue.children, !0)) : type === Slot ? (expectNoMoreTextNodes(),
1074
1157
  expectSlot() || descend(jsxValue.children, !0)) : type === Projection ? (expectProjection(),
1075
1158
  descend(jsxValue.children, !0)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(),
1076
1159
  expectComponent(type)));
@@ -1096,18 +1179,14 @@
1096
1179
  }
1097
1180
  }
1098
1181
  function peekNextSibling() {
1099
- if (null !== vSiblings) {
1100
- const idx = vSiblingsIdx + SiblingsArray.NextVNode;
1101
- return idx < vSiblings.length ? vSiblings[idx] : null;
1102
- }
1103
1182
  return vCurrent ? vnode_getNextSibling(vCurrent) : null;
1104
1183
  }
1105
1184
  function advanceToNextSibling() {
1106
- vCurrent = peekNextSibling(), null !== vSiblings && (vSiblingsIdx += SiblingsArray.Size);
1185
+ vCurrent = peekNextSibling();
1107
1186
  }
1108
1187
  function descend(children, descendVNode) {
1109
1188
  null != children ? (stackPush(children, descendVNode), descendVNode && (assertDefined(),
1110
- vSiblings = null, vSiblingsIdx = -1, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent),
1189
+ vSiblings = null, vSiblingsArray = null, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent),
1111
1190
  vNewNode = null), shouldAdvance = !1) : function() {
1112
1191
  const vFirstChild = vCurrent && vnode_getFirstChild(vCurrent);
1113
1192
  if (null !== vFirstChild) {
@@ -1120,34 +1199,27 @@
1120
1199
  }();
1121
1200
  }
1122
1201
  function ascend() {
1123
- stack.pop() && (vSiblingsIdx = stack.pop(), vSiblings = stack.pop(), vNewNode = stack.pop(),
1202
+ stack.pop() && (vSiblings = stack.pop(), vSiblingsArray = stack.pop(), vNewNode = stack.pop(),
1124
1203
  vCurrent = stack.pop(), vParent = stack.pop()), jsxValue = stack.pop(), jsxCount = stack.pop(),
1125
1204
  jsxIdx = stack.pop(), jsxChildren = stack.pop(), advance();
1126
1205
  }
1127
1206
  function stackPush(children, descendVNode) {
1128
- stack.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack.push(vParent, vCurrent, vNewNode, vSiblings, vSiblingsIdx),
1207
+ stack.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack.push(vParent, vCurrent, vNewNode, vSiblingsArray, vSiblings),
1129
1208
  stack.push(descendVNode), Array.isArray(children) ? (jsxIdx = 0, jsxCount = children.length,
1130
1209
  jsxChildren = children, jsxValue = jsxCount > 0 ? children[0] : null) : void 0 === children ? (jsxIdx = 0,
1131
1210
  jsxValue = null, jsxChildren = null, jsxCount = 0) : (jsxIdx = 0, jsxValue = children,
1132
1211
  jsxChildren = null, jsxCount = 1);
1133
1212
  }
1134
1213
  function getInsertBefore() {
1135
- if (vNewNode) {
1136
- return vCurrent;
1137
- }
1138
- if (null !== vSiblings) {
1139
- const nextIdx = vSiblingsIdx + SiblingsArray.NextVNode;
1140
- return nextIdx < vSiblings.length ? vSiblings[nextIdx] : null;
1141
- }
1142
- return peekNextSibling();
1214
+ return vNewNode ? vCurrent : peekNextSibling();
1143
1215
  }
1144
1216
  function expectProjection() {
1145
1217
  const slotName = jsxValue.key;
1146
1218
  vCurrent = vnode_getProp(vParent, slotName, (id => vnode_locate(container.rootVNode, id))),
1147
- vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent,
1148
- null == vCurrent && (vNewNode = vnode_newVirtual(), build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection),
1149
- build.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection"), vnode_setProp(vNewNode, QSlot, slotName),
1150
- vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
1219
+ vCurrent = vCurrent && 32 & vCurrent[0] ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(),
1220
+ build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P"), build.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection"),
1221
+ vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent),
1222
+ vnode_setProp(vParent, slotName, vNewNode));
1151
1223
  }
1152
1224
  function expectSlot() {
1153
1225
  const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
@@ -1157,26 +1229,19 @@
1157
1229
  if (constProps && "object" == typeof constProps && "name" in constProps) {
1158
1230
  const constValue = constProps.name;
1159
1231
  if (vHost && constValue instanceof WrappedSignal) {
1160
- return trackSignalAndAssignHost(constValue, vHost, EffectProperty.COMPONENT, container);
1232
+ return trackSignalAndAssignHost(constValue, vHost, ":", container);
1161
1233
  }
1162
1234
  }
1163
1235
  return directGetPropsProxyProp(jsxNode, "name") || "";
1164
1236
  }(vHost);
1165
1237
  const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
1166
- if (null == vProjectedNode) {
1167
- return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
1168
- vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
1169
- build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++),
1170
- !1;
1171
- }
1172
- if (vProjectedNode === vCurrent) {} else {
1173
- const parent = vnode_getParent(vProjectedNode);
1174
- !(!parent || vnode_isElementVNode(parent) && "q:template" === vnode_getElementName(parent)) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, !1),
1175
- vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()),
1176
- vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
1177
- build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Projection), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
1178
- }
1179
- return !0;
1238
+ return null == vProjectedNode ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
1239
+ vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
1240
+ build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P"), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++),
1241
+ !1) : (vProjectedNode === vCurrent || (vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()),
1242
+ vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode),
1243
+ build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P"), build.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++)),
1244
+ !0);
1180
1245
  }
1181
1246
  function expectNoMore() {
1182
1247
  if (assertFalse(), null !== vCurrent) {
@@ -1199,7 +1264,7 @@
1199
1264
  const domParentVNode = vnode_getDomParentVNode(vParent);
1200
1265
  const {elementNamespace, elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, elementName);
1201
1266
  const element = container.document.createElementNS(elementNamespace, elementName);
1202
- return vNewNode = vnode_newElement(element, elementName), vNewNode[VNodeProps.flags] |= elementNamespaceFlag,
1267
+ return vNewNode = vnode_newElement(element, elementName), vNewNode[0] |= elementNamespaceFlag,
1203
1268
  element;
1204
1269
  }(elementName);
1205
1270
  const {constProps} = jsx;
@@ -1208,11 +1273,11 @@
1208
1273
  for (const key in constProps) {
1209
1274
  let value = constProps[key];
1210
1275
  if (isJsxPropertyAnEventName(key)) {
1211
- const eventName = getEventNameFromJsxProp(key);
1212
- const scope = getEventNameScopeFromJsxProp(key);
1276
+ const eventName = getEventNameFromJsxEvent(key);
1277
+ const scope = getEventNameScopeFromJsxEvent(key);
1213
1278
  if (eventName && (vnode_setProp(vNewNode, HANDLER_PREFIX + ":" + scope + ":" + eventName, value),
1214
1279
  registerQwikLoaderEvent(eventName)), scope) {
1215
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
1280
+ const htmlEvent = jsxEventToHtmlAttribute(key);
1216
1281
  htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
1217
1282
  }
1218
1283
  needsQDispatchEventPatch = !0;
@@ -1229,7 +1294,7 @@
1229
1294
  if (null == value) {
1230
1295
  continue;
1231
1296
  }
1232
- throw qError(QError.invalidRefValue, [ currentFile ]);
1297
+ throw qError(32, [ currentFile ]);
1233
1298
  }
1234
1299
  if (isSignal(value)) {
1235
1300
  const signalData = new SubscriptionData({
@@ -1244,14 +1309,14 @@
1244
1309
  } else {
1245
1310
  if (value && "string" != typeof value) {
1246
1311
  if (build.isDev) {
1247
- throw qError(QError.wrongTextareaValue, [ currentFile, value ]);
1312
+ throw qError(40, [ currentFile, value ]);
1248
1313
  }
1249
1314
  continue;
1250
1315
  }
1251
1316
  element.value = escapeHTML(value || "");
1252
1317
  }
1253
1318
  } else {
1254
- element.innerHTML = value, element.setAttribute("q:container", QContainerValue.HTML);
1319
+ element.innerHTML = value, element.setAttribute("q:container", "html");
1255
1320
  }
1256
1321
  }
1257
1322
  }
@@ -1268,7 +1333,7 @@
1268
1333
  const currentFile = getFileLocationFromJsx(jsx.dev);
1269
1334
  isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey),
1270
1335
  null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent),
1271
- vCurrent = vNewNode, vNewNode = null, null !== vSiblings && (vSiblingsIdx -= SiblingsArray.Size)));
1336
+ vCurrent = vNewNode, vNewNode = null));
1272
1337
  const jsxAttrs = [];
1273
1338
  const props = jsx.varProps;
1274
1339
  for (const key in props) {
@@ -1277,7 +1342,8 @@
1277
1342
  }
1278
1343
  null !== jsxKey && mapArray_set(jsxAttrs, "q:key", jsxKey, 0);
1279
1344
  const vNode = vNewNode || vCurrent;
1280
- if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile) {
1345
+ const element = vNode[6];
1346
+ element.vNode = new WeakRef(vNode), needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile) {
1281
1347
  vnode_ensureElementInflated(vnode);
1282
1348
  const dstAttrs = vnode_getProps(vnode);
1283
1349
  let srcIdx = 0;
@@ -1299,10 +1365,7 @@
1299
1365
  if ("function" == typeof value) {
1300
1366
  return void value(element);
1301
1367
  }
1302
- if (null == value) {
1303
- return;
1304
- }
1305
- throw qError(QError.invalidRefValue, [ currentFile ]);
1368
+ throw qError(32, [ currentFile ]);
1306
1369
  }
1307
1370
  if (isSignal(value)) {
1308
1371
  const signalData = new SubscriptionData({
@@ -1311,16 +1374,16 @@
1311
1374
  });
1312
1375
  value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
1313
1376
  }
1314
- vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix)),
1377
+ vnode_setAttr(journal, vnode, key, null !== value ? serializeAttribute(key, value, scopedStyleIdPrefix) : null),
1315
1378
  null === value && (dstLength = dstAttrs.length);
1316
1379
  }
1317
1380
  };
1318
1381
  const recordJsxEvent = (key, value) => {
1319
- const eventName = getEventNameFromJsxProp(key);
1320
- const scope = getEventNameScopeFromJsxProp(key);
1382
+ const eventName = getEventNameFromJsxEvent(key);
1383
+ const scope = getEventNameScopeFromJsxEvent(key);
1321
1384
  if (eventName && (record(":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)),
1322
1385
  scope) {
1323
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
1386
+ const htmlEvent = jsxEventToHtmlAttribute(key);
1324
1387
  htmlEvent && record(htmlEvent, "");
1325
1388
  }
1326
1389
  };
@@ -1328,7 +1391,7 @@
1328
1391
  if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith("q:")) {
1329
1392
  dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1330
1393
  } else if (null == srcKey) {
1331
- dstKey && isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = !0, dstIdx++) : (record(dstKey, null),
1394
+ dstKey && isHtmlAttributeAnEventName(dstKey) ? dstIdx++ : (record(dstKey, null),
1332
1395
  dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1333
1396
  } else if (null == dstKey) {
1334
1397
  isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = !0, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]),
@@ -1340,26 +1403,24 @@
1340
1403
  } else {
1341
1404
  srcKey < dstKey ? (isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = !0,
1342
1405
  recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++,
1343
- srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = !0,
1406
+ srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstLength = dstAttrs.length,
1407
+ dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = !0,
1344
1408
  dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null);
1345
1409
  }
1346
1410
  }
1347
1411
  return patchEventDispatch;
1348
- }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
1349
- const element = vnode_getNode(vNode);
1350
- element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1351
- const eventName = event.type;
1352
- const eventProp = ":" + scope.substring(1) + ":" + eventName;
1353
- const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
1354
- let returnValue = !1;
1355
- return qrls.flat(2).forEach((qrl => {
1356
- if (qrl) {
1357
- const value = container.$scheduler$(ChoreType.RUN_QRL, vNode, qrl, [ event, element ]);
1358
- returnValue = returnValue || !0 === value;
1359
- }
1360
- })), returnValue;
1361
- });
1362
- }
1412
+ }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch && (element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1413
+ const eventName = event.type;
1414
+ const eventProp = ":" + scope.substring(1) + ":" + eventName;
1415
+ const qrls = [ vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null) ];
1416
+ let returnValue = !1;
1417
+ return qrls.flat(2).forEach((qrl => {
1418
+ if (qrl) {
1419
+ const value = container.$scheduler$(2, vNode, qrl, [ event, element ]);
1420
+ returnValue = returnValue || !0 === value;
1421
+ }
1422
+ })), returnValue;
1423
+ }));
1363
1424
  }
1364
1425
  function registerQwikLoaderEvent(eventName) {
1365
1426
  const window = container.document.defaultView;
@@ -1367,29 +1428,32 @@
1367
1428
  }
1368
1429
  function retrieveChildWithKey(nodeName, key) {
1369
1430
  let vNodeWithKey = null;
1370
- if (-1 === vSiblingsIdx) {
1371
- vSiblings = [], vSiblingsIdx = 0;
1431
+ if (null === vSiblings) {
1432
+ vSiblings = new Map, vSiblingsArray = [];
1372
1433
  let vNode = vCurrent;
1373
1434
  for (;vNode; ) {
1374
1435
  const name = vnode_isElementVNode(vNode) ? vnode_getElementName(vNode) : null;
1375
1436
  const vKey = getKey(vNode) || getComponentHash(vNode, container.$getObjectById$);
1376
- null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : vSiblings.push(name, vKey, vNode),
1437
+ null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : null === vKey ? vSiblingsArray.push(name, vNode) : vSiblings.set(name + ":" + vKey, vNode),
1377
1438
  vNode = vnode_getNextSibling(vNode);
1378
1439
  }
1379
- } else {
1380
- for (let idx = vSiblingsIdx; idx < vSiblings.length; idx += SiblingsArray.Size) {
1381
- if (vSiblings[idx + SiblingsArray.Key] === key && vSiblings[idx + SiblingsArray.Name] === nodeName) {
1382
- vNodeWithKey = vSiblings[idx + SiblingsArray.VNode], vSiblings?.splice(idx, SiblingsArray.Size);
1440
+ } else if (null === key) {
1441
+ for (let i = 0; i < vSiblingsArray.length; i += 2) {
1442
+ if (vSiblingsArray[i] === nodeName) {
1443
+ vNodeWithKey = vSiblingsArray[i + 1], vSiblingsArray.splice(i, 2);
1383
1444
  break;
1384
1445
  }
1385
1446
  }
1447
+ } else {
1448
+ const vSibling = vSiblings.get(nodeName + ":" + key);
1449
+ vSibling && (vNodeWithKey = vSibling, vSiblings.delete(nodeName + ":" + key));
1386
1450
  }
1387
1451
  return vNodeWithKey;
1388
1452
  }
1389
1453
  function expectVirtual(type, jsxKey) {
1390
- vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey),
1454
+ vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey && jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey),
1391
1455
  null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()),
1392
- vnode_setProp(vNewNode, "q:key", jsxKey), build.isDev && vnode_setProp(vNewNode || vCurrent, "q:type", type)) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1456
+ vnode_setProp(vNewNode, "q:key", jsxKey), build.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type)) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1393
1457
  }
1394
1458
  function expectComponent(component) {
1395
1459
  const componentMeta = component[SERIALIZABLE_STATE];
@@ -1402,7 +1466,7 @@
1402
1466
  const componentHash = componentQRL.$hash$;
1403
1467
  const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1404
1468
  const lookupKey = jsxNode.key || componentHash;
1405
- if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps),
1469
+ if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash && jsxNode.key || (insertNewComponent(host, componentQRL, jsxProps),
1406
1470
  host = vNewNode, shouldRender = !0) : (vNewNode = retrieveChildWithKey(null, lookupKey),
1407
1471
  vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps),
1408
1472
  host = vNewNode, shouldRender = !0), host) {
@@ -1425,8 +1489,7 @@
1425
1489
  }
1426
1490
  }
1427
1491
  return !1;
1428
- }(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted,
1429
- container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1492
+ }(jsxProps, vNodeProps), shouldRender && (host[0] &= -33, container.$scheduler$(6, host, componentQRL, jsxProps));
1430
1493
  }
1431
1494
  !function(children, host) {
1432
1495
  const projectionChildren = Array.isArray(children) ? children : [ children ];
@@ -1476,13 +1539,13 @@
1476
1539
  function insertNewComponent(host, componentQRL, jsxProps) {
1477
1540
  host && clearAllEffects(container, host), vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1478
1541
  const jsxNode = jsxValue;
1479
- build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.Component), container.setHostProp(vNewNode, "q:renderFn", componentQRL),
1542
+ build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C"), container.setHostProp(vNewNode, "q:renderFn", componentQRL),
1480
1543
  container.setHostProp(vNewNode, "q:props", jsxProps), container.setHostProp(vNewNode, "q:key", jsxNode.key);
1481
1544
  }
1482
1545
  function insertNewInlineComponent() {
1483
1546
  vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore());
1484
1547
  const jsxNode = jsxValue;
1485
- build.isDev && vnode_setProp(vNewNode, "q:type", VirtualType.InlineComponent), vnode_setProp(vNewNode, "q:props", jsxNode.props),
1548
+ build.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I"), vnode_setProp(vNewNode, "q:props", jsxNode.props),
1486
1549
  jsxNode.key && vnode_setProp(vNewNode, "q:key", jsxNode.key);
1487
1550
  }
1488
1551
  function expectText(text) {
@@ -1519,21 +1582,21 @@
1519
1582
  }
1520
1583
  let vParent = null;
1521
1584
  for (;;) {
1522
- const type = vCursor[VNodeProps.flags];
1523
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
1524
- if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), type & VNodeFlags.Virtual) {
1585
+ const type = vCursor[0];
1586
+ if (3 & type) {
1587
+ if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), 2 & type) {
1525
1588
  const seq = container.getHostProp(vCursor, "q:seq");
1526
1589
  if (seq) {
1527
1590
  for (let i = 0; i < seq.length; i++) {
1528
1591
  const obj = seq[i];
1529
1592
  if (isTask(obj)) {
1530
1593
  const task = obj;
1531
- clearAllEffects(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
1594
+ clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(48, task) : cleanupTask(task);
1532
1595
  }
1533
1596
  }
1534
1597
  }
1535
1598
  }
1536
- if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1599
+ if (2 & type && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1537
1600
  const attrs = vnode_getProps(vCursor);
1538
1601
  for (let i = 0; i < attrs.length; i += 2) {
1539
1602
  if (isSlotProp(attrs[i])) {
@@ -1565,7 +1628,7 @@
1565
1628
  }
1566
1629
  }
1567
1630
  } else {
1568
- type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
1631
+ 4 & type && markVNodeAsDeleted(vCursor);
1569
1632
  }
1570
1633
  if (vCursor === vNode) {
1571
1634
  return;
@@ -1594,20 +1657,22 @@
1594
1657
  function cleanupStaleUnclaimedProjection(journal, projection) {
1595
1658
  const projectionParent = vnode_getParent(projection);
1596
1659
  if (projectionParent) {
1597
- projectionParent[VNodeProps.flags] & VNodeFlags.Element && "q:template" === vnode_getElementName(projectionParent) && vnode_remove(journal, projectionParent, projection, !0);
1660
+ 1 & projectionParent[0] && "q:template" === vnode_getElementName(projectionParent) && vnode_remove(journal, projectionParent, projection, !0);
1598
1661
  }
1599
1662
  }
1600
1663
  function markVNodeAsDeleted(vCursor) {
1601
- vCursor[VNodeProps.flags] |= VNodeFlags.Deleted;
1664
+ vCursor[0] |= 32;
1602
1665
  }
1603
1666
  const HANDLER_PREFIX = ":";
1604
1667
  let count = 0;
1605
- var SiblingsArray;
1606
- !function(SiblingsArray) {
1607
- SiblingsArray[SiblingsArray.Name = 0] = "Name", SiblingsArray[SiblingsArray.Key = 1] = "Key",
1608
- SiblingsArray[SiblingsArray.VNode = 2] = "VNode", SiblingsArray[SiblingsArray.Size = 3] = "Size",
1609
- SiblingsArray[SiblingsArray.NextVNode = 5] = "NextVNode";
1610
- }(SiblingsArray || (SiblingsArray = {}));
1668
+ const implicit$FirstArg = fn => function(first, ...rest) {
1669
+ return fn.call(null, dollar(first), ...rest);
1670
+ };
1671
+ const createComputedSignal = qrl => (throwIfQRLNotResolved(qrl), new ComputedSignalImpl(null, qrl));
1672
+ const createSerializerSignal = arg => (throwIfQRLNotResolved(arg), new SerializerSignalImpl(null, arg));
1673
+ const createSignal = value => new SignalImpl(null, value);
1674
+ const createComputed$ = /*#__PURE__*/ implicit$FirstArg(createComputedSignal);
1675
+ const createSerializer$ = implicit$FirstArg(createSerializerSignal);
1611
1676
  const useResourceQrl = (qrl, opts) => {
1612
1677
  const {val, set, i, iCtx} = useSequentialScope();
1613
1678
  if (null != val) {
@@ -1616,8 +1681,8 @@
1616
1681
  assertQrl(qrl);
1617
1682
  const container = iCtx.$container$;
1618
1683
  const resource = createResourceReturn(container, opts);
1619
- const task = new Task(TaskFlags.DIRTY | TaskFlags.RESOURCE, i, iCtx.$hostElement$, qrl, resource, null);
1620
- return container.$scheduler$(ChoreType.TASK, task), set(resource), resource;
1684
+ const task = new Task(12, i, iCtx.$hostElement$, qrl, resource, null);
1685
+ return container.$scheduler$(3, task), set(resource), resource;
1621
1686
  };
1622
1687
  const createResourceReturn = (container, opts, initialPromise) => {
1623
1688
  const result = (opts => ({
@@ -1630,11 +1695,11 @@
1630
1695
  _timeout: opts?.timeout ?? -1,
1631
1696
  _cache: 0
1632
1697
  }))(opts);
1633
- return result.value = initialPromise, createStore(container, result, StoreFlags.RECURSIVE);
1698
+ return result.value = initialPromise, createStore(container, result, 1);
1634
1699
  };
1635
1700
  const isResourceReturn = obj => isObject(obj) && "resource" === (getStoreTarget(obj) || obj).__brand;
1636
1701
  const runResource = (task, container, host) => {
1637
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
1702
+ task.$flags$ &= -9, cleanupTask(task);
1638
1703
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
1639
1704
  iCtx.$container$ = container;
1640
1705
  const taskFn = task.$qrl$.getFn(iCtx, (() => clearAllEffects(container, task)));
@@ -1654,7 +1719,7 @@
1654
1719
  const opts = {
1655
1720
  track: (obj, prop) => {
1656
1721
  const ctx = newInvokeContext();
1657
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container,
1722
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container,
1658
1723
  invoke(ctx, (() => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj));
1659
1724
  },
1660
1725
  cleanup(fn) {
@@ -1712,14 +1777,14 @@
1712
1777
  let drainScheduled = !1;
1713
1778
  return function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
1714
1779
  const isServer = !isDomContainer(container);
1715
- const isComponentSsr = isServer && type === ChoreType.COMPONENT;
1716
- const runLater = type !== ChoreType.WAIT_FOR_ALL && !isComponentSsr && type !== ChoreType.RUN_QRL;
1717
- const isTask = type === ChoreType.TASK || type === ChoreType.VISIBLE || type === ChoreType.CLEANUP_VISIBLE;
1718
- const isClientOnly = type === ChoreType.JOURNAL_FLUSH || type === ChoreType.NODE_DIFF || type === ChoreType.NODE_PROP;
1780
+ const isComponentSsr = isServer && 6 === type;
1781
+ const runLater = 255 !== type && !isComponentSsr && 2 !== type;
1782
+ const isTask = 3 === type || 32 === type || 48 === type;
1783
+ const isClientOnly = 16 === type || 4 === type || 5 === type;
1719
1784
  if (isServer && isClientOnly) {
1720
1785
  return;
1721
1786
  }
1722
- isTask && (hostOrTask.$flags$ |= TaskFlags.DIRTY);
1787
+ isTask && (hostOrTask.$flags$ |= 8);
1723
1788
  let chore = {
1724
1789
  $type$: type,
1725
1790
  $idx$: isTask ? hostOrTask.$index$ : "string" == typeof targetOrQrl ? targetOrQrl : 0,
@@ -1753,11 +1818,11 @@
1753
1818
  return sortedArray.splice(~idx, 0, value), value;
1754
1819
  }
1755
1820
  const existing = sortedArray[idx];
1756
- existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = value.$payload$);
1821
+ 4 === existing.$type$ && (existing.$payload$ = value.$payload$);
1757
1822
  existing.$executed$ && (existing.$executed$ = !1);
1758
1823
  return existing;
1759
1824
  }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = !0,
1760
- schedule(ChoreType.JOURNAL_FLUSH), scheduleDrain()?.catch?.((() => {})));
1825
+ schedule(16), scheduleDrain()?.catch?.((() => {})));
1761
1826
  return runLater ? getPromise(chore) : drainUpTo(chore, isServer);
1762
1827
  };
1763
1828
  function drainUpTo(runUptoChore, isServer) {
@@ -1777,7 +1842,7 @@
1777
1842
  break;
1778
1843
  }
1779
1844
  } else {
1780
- (chore = nextChore).$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted && nextChore.$type$ !== ChoreType.CLEANUP_VISIBLE ? choreQueue.shift() : executeChore(nextChore, isServer);
1845
+ (chore = nextChore).$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0] && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer);
1781
1846
  }
1782
1847
  }
1783
1848
  var chore;
@@ -1789,15 +1854,15 @@
1789
1854
  let returnValue = null;
1790
1855
  try {
1791
1856
  switch (chore.$type$) {
1792
- case ChoreType.WAIT_FOR_ALL:
1857
+ case 255:
1793
1858
  isServer && (drainScheduled = !1);
1794
1859
  break;
1795
1860
 
1796
- case ChoreType.JOURNAL_FLUSH:
1861
+ case 16:
1797
1862
  returnValue = journalFlush(), drainScheduled = !1;
1798
1863
  break;
1799
1864
 
1800
- case ChoreType.COMPONENT:
1865
+ case 6:
1801
1866
  returnValue = safeCall((() => executeComponent(container, host, host, chore.$target$, chore.$payload$)), (jsx => {
1802
1867
  if (isServer) {
1803
1868
  return jsx;
@@ -1809,7 +1874,7 @@
1809
1874
  }), (err => container.handleError(err, host)));
1810
1875
  break;
1811
1876
 
1812
- case ChoreType.RUN_QRL:
1877
+ case 2:
1813
1878
  {
1814
1879
  const fn = chore.$target$.getFn();
1815
1880
  const result = retryOnPromise((() => fn(...chore.$payload$)));
@@ -1826,11 +1891,11 @@
1826
1891
  }
1827
1892
  break;
1828
1893
 
1829
- case ChoreType.TASK:
1830
- case ChoreType.VISIBLE:
1894
+ case 3:
1895
+ case 32:
1831
1896
  {
1832
1897
  const payload = chore.$payload$;
1833
- if (payload.$flags$ & TaskFlags.RESOURCE) {
1898
+ if (4 & payload.$flags$) {
1834
1899
  const result = runResource(payload, container, host);
1835
1900
  returnValue = isServer ? result : null;
1836
1901
  } else {
@@ -1839,11 +1904,11 @@
1839
1904
  }
1840
1905
  break;
1841
1906
 
1842
- case ChoreType.CLEANUP_VISIBLE:
1907
+ case 48:
1843
1908
  cleanupTask(chore.$payload$);
1844
1909
  break;
1845
1910
 
1846
- case ChoreType.NODE_DIFF:
1911
+ case 4:
1847
1912
  {
1848
1913
  const parentVirtualNode = chore.$target$;
1849
1914
  let jsx = chore.$payload$;
@@ -1851,7 +1916,7 @@
1851
1916
  }
1852
1917
  break;
1853
1918
 
1854
- case ChoreType.NODE_PROP:
1919
+ case 5:
1855
1920
  {
1856
1921
  const virtualNode = chore.$host$;
1857
1922
  const payload = chore.$payload$;
@@ -1862,21 +1927,21 @@
1862
1927
  const property = chore.$idx$;
1863
1928
  const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
1864
1929
  if (isConst) {
1865
- journal.push(VNodeJournalOpCode.SetAttribute, virtualNode[ElementVNodeProps.element], property, serializedValue);
1930
+ journal.push(2, virtualNode[6], property, serializedValue);
1866
1931
  } else {
1867
1932
  vnode_setAttr(journal, virtualNode, property, serializedValue);
1868
1933
  }
1869
1934
  }
1870
1935
  break;
1871
1936
 
1872
- case ChoreType.QRL_RESOLVE:
1937
+ case 1:
1873
1938
  {
1874
1939
  const target = chore.$target$;
1875
1940
  returnValue = target.resolved ? null : target.resolve();
1876
1941
  }
1877
1942
  break;
1878
1943
 
1879
- case ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS:
1944
+ case 7:
1880
1945
  {
1881
1946
  const target = chore.$target$;
1882
1947
  const forceRunEffects = target.$forceRunEffects$;
@@ -1899,7 +1964,7 @@
1899
1964
  chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
1900
1965
  }
1901
1966
  function choreComparator(a, b, rootVNode) {
1902
- const macroTypeDiff = (a.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
1967
+ const macroTypeDiff = (240 & a.$type$) - (240 & b.$type$);
1903
1968
  if (0 !== macroTypeDiff) {
1904
1969
  return macroTypeDiff;
1905
1970
  }
@@ -1914,10 +1979,10 @@
1914
1979
  let aDepth = -1;
1915
1980
  let bDepth = -1;
1916
1981
  for (;a; ) {
1917
- a = (aVNodePath[++aDepth] = a)[VNodeProps.parent] || rootVNode && vnode_getProp(a, "q:sparent", (id => vnode_locate(rootVNode, id)));
1982
+ a = (aVNodePath[++aDepth] = a)[1] || rootVNode && vnode_getProp(a, "q:sparent", (id => vnode_locate(rootVNode, id)));
1918
1983
  }
1919
1984
  for (;b; ) {
1920
- b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id)));
1985
+ b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", (id => vnode_locate(rootVNode, id)));
1921
1986
  }
1922
1987
  for (;aDepth >= 0 && bDepth >= 0; ) {
1923
1988
  if ((a = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -1971,7 +2036,7 @@
1971
2036
  }
1972
2037
  }
1973
2038
  }
1974
- const microTypeDiff = (a.$type$ & ChoreType.MICRO) - (b.$type$ & ChoreType.MICRO);
2039
+ const microTypeDiff = (15 & a.$type$) - (15 & b.$type$);
1975
2040
  if (0 !== microTypeDiff) {
1976
2041
  return microTypeDiff;
1977
2042
  }
@@ -1980,218 +2045,459 @@
1980
2045
  }
1981
2046
  };
1982
2047
  const toNumber = value => "number" == typeof value ? value : -1;
1983
- var SignalFlags;
1984
- var WrappedSignalFlags;
1985
- !function(SignalFlags) {
1986
- SignalFlags[SignalFlags.INVALID = 1] = "INVALID";
1987
- }(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags) {
1988
- WrappedSignalFlags[WrappedSignalFlags.UNWRAP = 2] = "UNWRAP";
1989
- }(WrappedSignalFlags || (WrappedSignalFlags = {}));
1990
- const throwIfQRLNotResolved = qrl => {
1991
- if (!qrl.resolved) {
1992
- throw qrl.resolve();
1993
- }
1994
- };
1995
- const isSignal = value => value instanceof Signal;
1996
- class SubscriptionData {
1997
- data;
1998
- constructor(data) {
1999
- this.data = data;
2000
- }
2001
- }
2002
- var EffectSubscriptionProp;
2003
- var EffectProperty;
2004
- !function(EffectSubscriptionProp) {
2005
- EffectSubscriptionProp[EffectSubscriptionProp.CONSUMER = 0] = "CONSUMER", EffectSubscriptionProp[EffectSubscriptionProp.PROPERTY = 1] = "PROPERTY",
2006
- EffectSubscriptionProp[EffectSubscriptionProp.BACK_REF = 2] = "BACK_REF", EffectSubscriptionProp[EffectSubscriptionProp.DATA = 3] = "DATA";
2007
- }(EffectSubscriptionProp || (EffectSubscriptionProp = {})), function(EffectProperty) {
2008
- EffectProperty.COMPONENT = ":", EffectProperty.VNODE = ".";
2009
- }(EffectProperty || (EffectProperty = {}));
2010
- class Signal {
2011
- $untrackedValue$;
2012
- $effects$=null;
2013
- $container$=null;
2014
- constructor(container, value) {
2015
- this.$container$ = container, this.$untrackedValue$ = value;
2016
- }
2017
- get untrackedValue() {
2018
- return this.$untrackedValue$;
2019
- }
2020
- set untrackedValue(value) {
2021
- this.$untrackedValue$ = value;
2022
- }
2023
- get value() {
2024
- const ctx = tryGetInvokeContext();
2025
- if (ctx) {
2026
- if (null === this.$container$) {
2027
- if (!ctx.$container$) {
2028
- return this.untrackedValue;
2029
- }
2030
- this.$container$ = ctx.$container$;
2031
- } else {
2032
- assertTrue();
2033
- }
2034
- const effectSubscriber = ctx.$effectSubscriber$;
2035
- if (effectSubscriber) {
2036
- const effects = this.$effects$ ||= new Set;
2037
- ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this),
2038
- addQrlToSerializationCtx(effectSubscriber, this.$container$);
2039
- }
2040
- }
2041
- return this.untrackedValue;
2042
- }
2043
- set value(value) {
2044
- value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
2045
- }
2046
- valueOf() {
2047
- qDev;
2048
+ class _SharedContainer {
2049
+ $version$;
2050
+ $scheduler$;
2051
+ $storeProxyMap$;
2052
+ $locale$;
2053
+ $getObjectById$;
2054
+ $serverData$;
2055
+ $currentUniqueId$=0;
2056
+ $instanceHash$=null;
2057
+ $buildBase$=null;
2058
+ constructor(scheduleDrain, journalFlush, serverData, locale) {
2059
+ this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version,
2060
+ this.$storeProxyMap$ = new WeakMap, this.$getObjectById$ = () => {
2061
+ throw Error("Not implemented");
2062
+ }, this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
2048
2063
  }
2049
- toString() {
2050
- return `[${this.constructor.name}${this.$flags$ & SignalFlags.INVALID ? " INVALID" : ""} ${String(this.$untrackedValue$)}]` + (Array.from(this.$effects$ || []).map((e => "\n -> " + pad(qwikDebugToString(e[0]), " "))).join("\n") || "");
2064
+ trackSignalValue(signal, subscriber, property, data) {
2065
+ return trackSignalAndAssignHost(signal, subscriber, property, this, data);
2051
2066
  }
2052
- toJSON() {
2053
- return {
2054
- value: this.$untrackedValue$
2055
- };
2067
+ serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
2068
+ return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
2056
2069
  }
2057
2070
  }
2058
- const ensureContainsSubscription = (array, effectSubscription) => {
2059
- array.add(effectSubscription);
2060
- };
2061
- const ensureContainsBackRef = (array, value) => {
2062
- array[EffectSubscriptionProp.BACK_REF] ||= new Set, array[EffectSubscriptionProp.BACK_REF].add(value);
2063
- };
2064
- const addQrlToSerializationCtx = (effectSubscriber, container) => {
2065
- if (container && !isDomContainer(container)) {
2066
- const effect = effectSubscriber[EffectSubscriptionProp.CONSUMER];
2067
- const property = effectSubscriber[EffectSubscriptionProp.PROPERTY];
2068
- let qrl = null;
2069
- isTask(effect) ? qrl = effect.$qrl$ : effect instanceof ComputedSignal ? qrl = effect.$computeQrl$ : property === EffectProperty.COMPONENT && (qrl = container.getHostProp(effect, "q:renderFn")),
2070
- qrl && container.serializationCtx.$eventQrls$.add(qrl);
2071
+ const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
2072
+ const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62, VNodeDataChar_SLOT_PARENT = 63, VNodeDataChar_KEY = 64, VNodeDataChar_SEQ = 91, VNodeDataChar_CONTEXT = 93, VNodeDataChar_SEQ_IDX = 94, VNodeDataChar_BACK_REFS = 96, VNodeDataChar_SEPARATOR = 124, VNodeDataChar_SLOT = 126;
2073
+ function getDomContainer(element) {
2074
+ const qContainerElement = _getQContainerElement(element);
2075
+ if (!qContainerElement) {
2076
+ throw qError(41);
2071
2077
  }
2072
- };
2073
- const triggerEffects = (container, signal, effects) => {
2074
- const isBrowser = isDomContainer(container);
2075
- if (effects) {
2076
- const scheduleEffect = effectSubscription => {
2077
- const consumer = effectSubscription[EffectSubscriptionProp.CONSUMER];
2078
- const property = effectSubscription[EffectSubscriptionProp.PROPERTY];
2079
- if (assertDefined(), isTask(consumer)) {
2080
- consumer.$flags$ |= TaskFlags.DIRTY;
2081
- let choreType = ChoreType.TASK;
2082
- consumer.$flags$ & TaskFlags.VISIBLE_TASK && (choreType = ChoreType.VISIBLE), container.$scheduler$(choreType, consumer);
2083
- } else if (consumer instanceof Signal) {
2084
- consumer instanceof ComputedSignal && (consumer.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, consumer.$computeQrl$)),
2085
- consumer.$invalidate$();
2086
- } else if (property === EffectProperty.COMPONENT) {
2087
- const host = consumer;
2088
- const qrl = container.getHostProp(host, "q:renderFn");
2089
- assertDefined();
2090
- const props = container.getHostProp(host, "q:props");
2091
- container.$scheduler$(ChoreType.COMPONENT, host, qrl, props);
2092
- } else if (isBrowser) {
2093
- if (property === EffectProperty.VNODE) {
2094
- container.$scheduler$(ChoreType.NODE_DIFF, consumer, consumer, signal);
2095
- } else {
2096
- const effectData = effectSubscription[EffectSubscriptionProp.DATA];
2097
- if (effectData instanceof SubscriptionData) {
2098
- const payload = {
2099
- ...effectData.data,
2100
- $value$: signal
2101
- };
2102
- container.$scheduler$(ChoreType.NODE_PROP, consumer, property, payload);
2103
- }
2104
- }
2105
- }
2106
- };
2107
- for (const effect of effects) {
2108
- scheduleEffect(effect);
2078
+ return getDomContainerFromQContainerElement(qContainerElement);
2079
+ }
2080
+ function getDomContainerFromQContainerElement(qContainerElement) {
2081
+ let container = qContainerElement.qContainer;
2082
+ return container || (container = new DomContainer(qContainerElement)), container;
2083
+ }
2084
+ function _getQContainerElement(element) {
2085
+ return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest("[q\\:container]:not([q\\:container=html]):not([q\\:container=text])");
2086
+ }
2087
+ const isDomContainer = container => container instanceof DomContainer;
2088
+ class DomContainer extends _SharedContainer {
2089
+ element;
2090
+ qContainer;
2091
+ qManifestHash;
2092
+ rootVNode;
2093
+ document;
2094
+ $journal$;
2095
+ renderDone=null;
2096
+ $rawStateData$;
2097
+ $storeProxyMap$=new WeakMap;
2098
+ $qFuncs$;
2099
+ $instanceHash$;
2100
+ vNodeLocate=id => vnode_locate(this.rootVNode, id);
2101
+ $stateData$;
2102
+ $styleIds$=null;
2103
+ $renderCount$=0;
2104
+ constructor(element) {
2105
+ if (super((() => this.scheduleRender()), (() => vnode_applyJournal(this.$journal$)), {}, element.getAttribute("q:locale")),
2106
+ this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
2107
+ throw qError(42);
2108
+ }
2109
+ this.$journal$ = [ 3, element.ownerDocument ], this.document = element.ownerDocument,
2110
+ this.element = element, this.$buildBase$ = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"),
2111
+ this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element),
2112
+ this.$rawStateData$ = [], this.$stateData$ = [];
2113
+ const document = this.element.ownerDocument;
2114
+ document.qVNodeData || function(document) {
2115
+ const vNodeDataMap = document.qVNodeData || (document.qVNodeData = new WeakMap);
2116
+ const prototype = document.body;
2117
+ const getAttribute = prototype.getAttribute;
2118
+ const hasAttribute = prototype.hasAttribute;
2119
+ const getNodeType = ((prototype, name) => {
2120
+ let getter;
2121
+ for (;prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
2122
+ prototype = Object.getPrototypeOf(prototype);
2123
+ }
2124
+ return getter || function() {
2125
+ return this[name];
2126
+ };
2127
+ })(prototype, "nodeType");
2128
+ const attachVnodeDataAndRefs = element => {
2129
+ Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script => {
2130
+ script.setAttribute("type", "x-qwik/vnode");
2131
+ const qContainerElement = script.closest("[q\\:container]");
2132
+ qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = new Map;
2133
+ })), element.querySelectorAll("[q\\:shadowroot]").forEach((parent => {
2134
+ const shadowRoot = parent.shadowRoot;
2135
+ shadowRoot && attachVnodeDataAndRefs(shadowRoot);
2136
+ }));
2137
+ };
2138
+ attachVnodeDataAndRefs(document);
2139
+ const getFastNodeType = node => {
2140
+ const nodeType = getNodeType.call(node);
2141
+ if (1 === nodeType) {
2142
+ return null === getAttribute.call(node, "q:container") ? hasAttribute.call(node, "q:shadowroot") ? 6 : hasAttribute.call(node, ":") ? 2 : 0 : 3;
2143
+ }
2144
+ if (8 === nodeType) {
2145
+ const nodeValue = node.nodeValue || "";
2146
+ if (nodeValue.startsWith("q:container-island")) {
2147
+ return 65;
2148
+ }
2149
+ if (nodeValue.startsWith("q:ignore")) {
2150
+ return 16;
2151
+ }
2152
+ if (nodeValue.startsWith("q:container")) {
2153
+ return 5;
2154
+ }
2155
+ if (nodeValue.startsWith("/q:container-island")) {
2156
+ return 128;
2157
+ }
2158
+ if (nodeValue.startsWith("/q:ignore")) {
2159
+ return 32;
2160
+ }
2161
+ if (nodeValue.startsWith("/q:container")) {
2162
+ return 8;
2163
+ }
2164
+ }
2165
+ return 0;
2166
+ };
2167
+ const isSeparator = ch => VNodeDataSeparator_ADVANCE_1 <= ch && ch <= VNodeDataSeparator_ADVANCE_8192;
2168
+ const findVDataSectionEnd = (vData, start, end) => {
2169
+ let depth = 0;
2170
+ for (;start < end; ) {
2171
+ const ch = vData.charCodeAt(start);
2172
+ if (0 === depth && isSeparator(ch)) {
2173
+ break;
2174
+ }
2175
+ ch === VNodeDataChar_OPEN ? depth++ : ch === VNodeDataChar_CLOSE && depth--, start++;
2176
+ }
2177
+ return start;
2178
+ };
2179
+ const nextSibling = node => {
2180
+ for (;node && (node = node.nextSibling) && 0 === getFastNodeType(node); ) {}
2181
+ return node;
2182
+ };
2183
+ const firstChild = node => {
2184
+ for (;node && (node = node.firstChild) && 0 === getFastNodeType(node); ) {}
2185
+ return node;
2186
+ };
2187
+ const walkContainer = (walker, containerNode, node, exitNode, vData, qVNodeRefs) => {
2188
+ const vData_length = vData.length;
2189
+ let elementIdx = 0;
2190
+ let vNodeElementIndex = -1;
2191
+ let vData_start = 0;
2192
+ let vData_end = 0;
2193
+ let ch = 0;
2194
+ let needsToStoreRef = -1;
2195
+ let nextNode = null;
2196
+ const howManyElementsToSkip = () => {
2197
+ let elementsToSkip = 0;
2198
+ for (;isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator_ADVANCE_1,
2199
+ vData_start++, !(vData_start >= vData_length)); ) {}
2200
+ return elementsToSkip;
2201
+ };
2202
+ do {
2203
+ if (node === exitNode) {
2204
+ return;
2205
+ }
2206
+ nextNode = null;
2207
+ const nodeType = node == containerNode ? 2 : getFastNodeType(node);
2208
+ if (3 === nodeType) {
2209
+ const container = node;
2210
+ let cursor = node;
2211
+ for (;cursor && !(nextNode = nextSibling(cursor)); ) {
2212
+ cursor = cursor.parentNode;
2213
+ }
2214
+ walkContainer(walker, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
2215
+ } else if (16 === nodeType) {
2216
+ let islandNode = node;
2217
+ do {
2218
+ if (islandNode = walker.nextNode(), !islandNode) {
2219
+ throw new Error(`Island inside \x3c!--${node?.nodeValue}--\x3e not found!`);
2220
+ }
2221
+ } while (65 !== getFastNodeType(islandNode));
2222
+ nextNode = null;
2223
+ } else if (128 === nodeType) {
2224
+ nextNode = node;
2225
+ do {
2226
+ if (nextNode = walker.nextNode(), !nextNode) {
2227
+ throw new Error("Ignore block not closed!");
2228
+ }
2229
+ } while (32 !== getFastNodeType(nextNode));
2230
+ nextNode = null;
2231
+ } else if (5 === nodeType) {
2232
+ nextNode = node;
2233
+ do {
2234
+ if (nextNode = nextSibling(nextNode), !nextNode) {
2235
+ throw new Error(`\x3c!--${node?.nodeValue}--\x3e not closed!`);
2236
+ }
2237
+ } while (8 !== getFastNodeType(nextNode));
2238
+ walkContainer(walker, node, node, nextNode, "", null);
2239
+ } else if (6 === nodeType) {
2240
+ nextNode = nextSibling(node);
2241
+ const shadowRootContainer = node;
2242
+ const shadowRoot = shadowRootContainer?.shadowRoot;
2243
+ shadowRoot && walkContainer(document.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
2244
+ }
2245
+ if (!(2 & ~nodeType)) {
2246
+ if (vNodeElementIndex < elementIdx && (-1 === vNodeElementIndex && (vNodeElementIndex = 0),
2247
+ vData_start = vData_end, vData_start < vData_length ? (vNodeElementIndex += howManyElementsToSkip(),
2248
+ ch === VNodeDataSeparator_REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++,
2249
+ ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator_ADVANCE_1),
2250
+ vData_end = findVDataSectionEnd(vData, vData_start, vData_length)) : vNodeElementIndex = Number.MAX_SAFE_INTEGER),
2251
+ elementIdx === vNodeElementIndex) {
2252
+ needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
2253
+ const instructions = vData.substring(vData_start, vData_end);
2254
+ vNodeDataMap.set(node, instructions);
2255
+ }
2256
+ elementIdx++;
2257
+ }
2258
+ } while (node = nextNode || walker.nextNode());
2259
+ };
2260
+ const walker = document.createTreeWalker(document, 129);
2261
+ walkContainer(walker, null, walker.firstChild(), null, "", null);
2262
+ }(document), this.$qFuncs$ = getQFuncs(document, this.$instanceHash$) || EMPTY_ARRAY,
2263
+ this.$setServerData$(), element.setAttribute("q:container", "resumed"), element.qContainer = this;
2264
+ const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
2265
+ if (0 !== qwikStates.length) {
2266
+ this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent),
2267
+ this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
2109
2268
  }
2110
2269
  }
2111
- };
2112
- class ComputedSignal extends Signal {
2113
- $computeQrl$;
2114
- $flags$;
2115
- $forceRunEffects$=!1;
2116
- [_EFFECT_BACK_REF]=null;
2117
- constructor(container, fn, flags = SignalFlags.INVALID) {
2118
- super(container, NEEDS_COMPUTATION), this.$computeQrl$ = fn, this.$flags$ = flags;
2119
- }
2120
- $invalidate$() {
2121
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
2122
- }
2123
- force() {
2124
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, triggerEffects(this.$container$, this, this.$effects$);
2125
- }
2126
- get untrackedValue() {
2127
- const didChange = this.$computeIfNeeded$();
2128
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
2270
+ $setRawState$(id, vParent) {
2271
+ this.$stateData$[id] = vParent;
2129
2272
  }
2130
- $computeIfNeeded$() {
2131
- if (!(this.$flags$ & SignalFlags.INVALID)) {
2132
- return !1;
2273
+ parseQRL(qrl) {
2274
+ return inflateQRL(this, parseQRL(qrl));
2275
+ }
2276
+ handleError(err, host) {
2277
+ const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
2278
+ if (!errorStore) {
2279
+ throw err;
2133
2280
  }
2134
- const computeQrl = this.$computeQrl$;
2135
- throwIfQRLNotResolved(computeQrl);
2136
- const ctx = tryGetInvokeContext();
2137
- const previousEffectSubscription = ctx?.$effectSubscriber$;
2138
- ctx && (ctx.$effectSubscriber$ = getSubscriber(this, EffectProperty.VNODE));
2139
- try {
2140
- const untrackedValue = computeQrl.getFn(ctx)();
2141
- if (isPromise(untrackedValue)) {
2142
- throw qError(QError.computedNotSync, [ computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$ ]);
2281
+ errorStore.error = err;
2282
+ }
2283
+ setContext(host, context, value) {
2284
+ let ctx = this.getHostProp(host, "q:ctx");
2285
+ ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
2286
+ }
2287
+ resolveContext(host, contextId) {
2288
+ for (;host; ) {
2289
+ const ctx = this.getHostProp(host, "q:ctx");
2290
+ if (ctx) {
2291
+ const value = mapArray_get(ctx, contextId.id, 0);
2292
+ if (value) {
2293
+ return value;
2294
+ }
2143
2295
  }
2144
- this.$flags$ &= ~SignalFlags.INVALID;
2145
- const didChange = untrackedValue !== this.$untrackedValue$;
2146
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
2147
- } finally {
2148
- ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
2296
+ host = this.getParentHost(host);
2149
2297
  }
2150
2298
  }
2151
- get value() {
2152
- return super.value;
2153
- }
2154
- set value(_) {
2155
- throw qError(QError.computedReadOnly);
2299
+ getParentHost(host) {
2300
+ let vNode = vnode_getParent(host);
2301
+ for (;vNode; ) {
2302
+ if (vnode_isVirtualVNode(vNode)) {
2303
+ if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
2304
+ return vNode;
2305
+ }
2306
+ vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
2307
+ } else {
2308
+ vNode = vnode_getParent(vNode);
2309
+ }
2310
+ }
2311
+ return null;
2156
2312
  }
2157
- }
2158
- class WrappedSignal extends Signal {
2159
- $args$;
2160
- $func$;
2161
- $funcStr$;
2162
- $flags$;
2163
- $hostElement$=null;
2164
- $forceRunEffects$=!1;
2165
- [_EFFECT_BACK_REF]=null;
2166
- constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
2167
- super(container, NEEDS_COMPUTATION), this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr,
2168
- this.$flags$ = flags;
2313
+ setHostProp(host, name, value) {
2314
+ vnode_setProp(host, name, value);
2169
2315
  }
2170
- $invalidate$() {
2171
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
2316
+ getHostProp(host, name) {
2317
+ const vNode = host;
2318
+ let getObjectById = null;
2319
+ switch (name) {
2320
+ case "q:seq":
2321
+ case "q:props":
2322
+ case "q:renderFn":
2323
+ case "q:ctx":
2324
+ case "q:brefs":
2325
+ getObjectById = this.$getObjectById$;
2326
+ break;
2327
+
2328
+ case "q:seqIdx":
2329
+ case ":onIdx":
2330
+ getObjectById = parseInt;
2331
+ }
2332
+ return vnode_getProp(vNode, name, getObjectById);
2172
2333
  }
2173
- force() {
2174
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = !1, triggerEffects(this.$container$, this, this.$effects$);
2334
+ scheduleRender() {
2335
+ return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick((() => this.processChores())),
2336
+ this.renderDone.finally((() => emitEvent("qrender", {
2337
+ instanceHash: this.$instanceHash$,
2338
+ renderCount: this.$renderCount$
2339
+ })));
2175
2340
  }
2176
- get untrackedValue() {
2177
- const didChange = this.$computeIfNeeded$();
2178
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(), this.$untrackedValue$;
2341
+ processChores() {
2342
+ let renderCount = this.$renderCount$;
2343
+ const result = this.$scheduler$(255);
2344
+ if (isPromise(result)) {
2345
+ return result.then((async () => {
2346
+ for (;renderCount !== this.$renderCount$; ) {
2347
+ renderCount = this.$renderCount$, await this.$scheduler$(255);
2348
+ }
2349
+ this.renderDone = null;
2350
+ }));
2351
+ }
2352
+ renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
2179
2353
  }
2180
- $computeIfNeeded$() {
2181
- if (!(this.$flags$ & SignalFlags.INVALID)) {
2182
- return !1;
2354
+ ensureProjectionResolved(vNode) {
2355
+ if (!(16 & vNode[0])) {
2356
+ vNode[0] |= 16;
2357
+ const props = vnode_getProps(vNode);
2358
+ for (let i = 0; i < props.length; i += 2) {
2359
+ if (isSlotProp(props[i])) {
2360
+ const value = props[i + 1];
2361
+ "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
2362
+ }
2363
+ }
2183
2364
  }
2184
- const untrackedValue = trackSignal((() => this.$func$(...this.$args$)), this, EffectProperty.VNODE, this.$container$);
2185
- const didChange = untrackedValue !== this.$untrackedValue$;
2186
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
2187
2365
  }
2188
- get value() {
2189
- return super.value;
2366
+ $getObjectById$=id => ("string" == typeof id && (id = parseFloat(id)), assertTrue(),
2367
+ this.$stateData$[id]);
2368
+ getSyncFn(id) {
2369
+ const fn = this.$qFuncs$[id];
2370
+ return assertTrue(), fn;
2190
2371
  }
2191
- set value(_) {
2192
- throw qError(QError.wrappedReadOnly);
2372
+ $appendStyle$(content, styleId, host, scoped) {
2373
+ if (scoped) {
2374
+ const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
2375
+ const scopedStyleIds = new Set(function(scopedStyleIds) {
2376
+ return scopedStyleIds?.split(" ") ?? null;
2377
+ }(scopedStyleIdsString));
2378
+ scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", function(scopedStyleIds) {
2379
+ return Array.from(scopedStyleIds).join(" ");
2380
+ }(scopedStyleIds));
2381
+ }
2382
+ if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll("style[q\\:style]").forEach((style => {
2383
+ this.$styleIds$.add(style.getAttribute("q:style"));
2384
+ }))), !this.$styleIds$.has(styleId)) {
2385
+ this.$styleIds$.add(styleId);
2386
+ const styleElement = this.document.createElement("style");
2387
+ styleElement.setAttribute("q:style", styleId), styleElement.textContent = content,
2388
+ this.$journal$.push(5, this.document.head, null, styleElement);
2389
+ }
2390
+ }
2391
+ $setServerData$() {
2392
+ const containerAttributes = {};
2393
+ const attrs = this.element.attributes;
2394
+ if (attrs) {
2395
+ for (let index = 0; index < attrs.length; index++) {
2396
+ const attr = attrs[index];
2397
+ ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
2398
+ }
2399
+ }
2400
+ this.$serverData$ = {
2401
+ containerAttributes
2402
+ };
2403
+ }
2404
+ }
2405
+ let _context;
2406
+ const tryGetInvokeContext = () => {
2407
+ if (!_context) {
2408
+ const context = "undefined" != typeof document && document && document.__q_context__;
2409
+ if (!context) {
2410
+ return;
2411
+ }
2412
+ return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
2413
+ }
2414
+ return _context;
2415
+ };
2416
+ const getInvokeContext = () => {
2417
+ const ctx = tryGetInvokeContext();
2418
+ if (!ctx) {
2419
+ throw qError(14);
2420
+ }
2421
+ return ctx;
2422
+ };
2423
+ const useInvokeContext = () => {
2424
+ const ctx = tryGetInvokeContext();
2425
+ if (!ctx || "qRender" !== ctx.$event$) {
2426
+ throw qError(20);
2427
+ }
2428
+ return assertDefined(), assertDefined(), ctx;
2429
+ };
2430
+ function useBindInvokeContext(fn) {
2431
+ if (null == fn) {
2432
+ return fn;
2433
+ }
2434
+ const ctx = getInvokeContext();
2435
+ return function(...args) {
2436
+ return invokeApply.call(this, ctx, fn, args);
2437
+ };
2438
+ }
2439
+ function invoke(context, fn, ...args) {
2440
+ return invokeApply.call(this, context, fn, args);
2441
+ }
2442
+ function invokeApply(context, fn, args) {
2443
+ const previousContext = _context;
2444
+ let returnValue;
2445
+ try {
2446
+ _context = context, returnValue = fn.apply(this, args);
2447
+ } finally {
2448
+ _context = previousContext;
2193
2449
  }
2450
+ return returnValue;
2194
2451
  }
2452
+ const newInvokeContextFromTuple = ([element, event, url]) => {
2453
+ const domContainer = getDomContainer(element);
2454
+ const hostElement = vnode_locate(domContainer.rootVNode, element);
2455
+ const locale = domContainer.$locale$;
2456
+ return locale && function(locale) {
2457
+ _locale = locale;
2458
+ }(locale), newInvokeContext(locale, hostElement, element, event, url);
2459
+ };
2460
+ const newInvokeContext = (locale, hostElement, element, event, url) => {
2461
+ const ctx = {
2462
+ $url$: url,
2463
+ $i$: 0,
2464
+ $hostElement$: hostElement,
2465
+ $element$: element,
2466
+ $event$: event,
2467
+ $qrl$: void 0,
2468
+ $effectSubscriber$: void 0,
2469
+ $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
2470
+ $container$: void 0
2471
+ };
2472
+ return seal(), ctx;
2473
+ };
2474
+ const untrack = fn => invoke(void 0, fn);
2475
+ const trackInvocation = /*#__PURE__*/ newInvokeContext(void 0, void 0, void 0, "qRender");
2476
+ const trackSignal = (fn, subscriber, property, container, data) => {
2477
+ const previousSubscriber = trackInvocation.$effectSubscriber$;
2478
+ const previousContainer = trackInvocation.$container$;
2479
+ try {
2480
+ return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data),
2481
+ trackInvocation.$container$ = container, invoke(trackInvocation, fn);
2482
+ } finally {
2483
+ trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
2484
+ }
2485
+ };
2486
+ const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host),
2487
+ trackSignal((() => value.value), host, property, container, data));
2488
+ const queueQRL = (...args) => {
2489
+ const [runQrl] = useLexicalScope();
2490
+ const context = getInvokeContext();
2491
+ const hostElement = context.$hostElement$;
2492
+ if (!hostElement) {
2493
+ return;
2494
+ }
2495
+ const scheduler = getDomContainer(context.$element$).$scheduler$;
2496
+ if (!scheduler) {
2497
+ throw qError(1);
2498
+ }
2499
+ return scheduler(2, hostElement, runQrl, args);
2500
+ };
2195
2501
  class ParentComponentData {
2196
2502
  $scopedStyle$;
2197
2503
  $componentFrame$;
@@ -2237,12 +2543,12 @@
2237
2543
  enqueue(value[i]);
2238
2544
  }
2239
2545
  } else if (isSignal(value)) {
2240
- ssr.openFragment(build.isDev ? [ "q:type", VirtualType.WrappedSignal ] : EMPTY_ARRAY);
2546
+ ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "S" ] : EMPTY_ARRAY);
2241
2547
  const signalNode = ssr.getLastNode();
2242
- enqueue(ssr.closeFragment), enqueue(trackSignalAndAssignHost(value, signalNode, EffectProperty.VNODE, ssr));
2548
+ enqueue(ssr.closeFragment), enqueue(trackSignalAndAssignHost(value, signalNode, ".", ssr));
2243
2549
  } else if (isPromise(value)) {
2244
- ssr.openFragment(build.isDev ? [ "q:type", VirtualType.Awaited ] : EMPTY_ARRAY),
2245
- enqueue(ssr.closeFragment), enqueue(value), enqueue(Promise), enqueue((() => ssr.commentNode("qkssr-f")));
2550
+ ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "A" ] : EMPTY_ARRAY), enqueue(ssr.closeFragment),
2551
+ enqueue(value), enqueue(Promise), enqueue((() => ssr.commentNode("qkssr-f")));
2246
2552
  } else if (function(value) {
2247
2553
  return !!value[Symbol.asyncIterator];
2248
2554
  }(value)) {
@@ -2275,14 +2581,14 @@
2275
2581
  } else if (isFunction(type)) {
2276
2582
  if (type === Fragment) {
2277
2583
  let attrs = null != jsx.key ? [ "q:key", jsx.key ] : EMPTY_ARRAY;
2278
- build.isDev && (attrs = [ "q:type", VirtualType.Fragment, ...attrs ]), ssr.openFragment(attrs),
2584
+ build.isDev && (attrs = [ DEBUG_TYPE, "F", ...attrs ]), ssr.openFragment(attrs),
2279
2585
  ssr.addCurrentElementFrameAsComponentChild(), enqueue(ssr.closeFragment);
2280
2586
  const children = jsx.children;
2281
2587
  null != children && enqueue(children);
2282
2588
  } else if (type === Slot) {
2283
2589
  const componentFrame = options.parentComponentFrame || ssr.unclaimedProjectionComponentFrameQueue.shift();
2284
2590
  if (componentFrame) {
2285
- const projectionAttrs = build.isDev ? [ "q:type", VirtualType.Projection ] : [];
2591
+ const projectionAttrs = build.isDev ? [ DEBUG_TYPE, "P" ] : [];
2286
2592
  projectionAttrs.push("q:sparent", componentFrame.componentNode.id || ""), ssr.openProjection(projectionAttrs);
2287
2593
  const host = componentFrame.componentNode;
2288
2594
  const node = ssr.getLastNode();
@@ -2291,7 +2597,7 @@
2291
2597
  if (constProps && "object" == typeof constProps && "name" in constProps) {
2292
2598
  const constValue = constProps.name;
2293
2599
  if (constValue instanceof WrappedSignal) {
2294
- return trackSignalAndAssignHost(constValue, host, EffectProperty.COMPONENT, ssr);
2600
+ return trackSignalAndAssignHost(constValue, host, ":", ssr);
2295
2601
  }
2296
2602
  }
2297
2603
  return directGetPropsProxyProp(jsx, "name") || "";
@@ -2303,8 +2609,7 @@
2303
2609
  slotDefaultChildren && slotChildren !== slotDefaultChildren && ssr.addUnclaimedProjection(componentFrame, "", slotDefaultChildren),
2304
2610
  enqueue(slotChildren), enqueue(new ParentComponentData(componentFrame.projectionScopedStyle, componentFrame.projectionComponentFrame));
2305
2611
  } else {
2306
- ssr.openFragment(build.isDev ? [ "q:type", VirtualType.Projection ] : EMPTY_ARRAY),
2307
- ssr.closeFragment();
2612
+ ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "P" ] : EMPTY_ARRAY), ssr.closeFragment();
2308
2613
  }
2309
2614
  } else if (type === SSRComment) {
2310
2615
  ssr.commentNode(directGetPropsProxyProp(jsx, "data") || "");
@@ -2323,7 +2628,7 @@
2323
2628
  } else if (type === SSRRaw) {
2324
2629
  ssr.htmlNode(directGetPropsProxyProp(jsx, "data"));
2325
2630
  } else if (isQwikComponent(type)) {
2326
- ssr.openComponent(build.isDev ? [ "q:type", VirtualType.Component ] : []);
2631
+ ssr.openComponent(build.isDev ? [ DEBUG_TYPE, "C" ] : []);
2327
2632
  const host = ssr.getLastNode();
2328
2633
  const componentFrame = ssr.getParentComponentFrame();
2329
2634
  componentFrame.distributeChildrenIntoSlots(jsx.children, options.styleScoped, options.parentComponentFrame);
@@ -2334,7 +2639,7 @@
2334
2639
  srcProps && srcProps.children && delete srcProps.children;
2335
2640
  const scheduler = ssr.$scheduler$;
2336
2641
  return host.setProp("q:renderFn", componentQrl), host.setProp("q:props", srcProps),
2337
- null !== jsx.key && host.setProp("q:key", jsx.key), scheduler(ChoreType.COMPONENT, host, componentQrl, srcProps);
2642
+ null !== jsx.key && host.setProp("q:key", jsx.key), scheduler(6, host, componentQrl, srcProps);
2338
2643
  })(ssr, jsx, type);
2339
2644
  const compStyleComponentId = addComponentStylePrefix(host.getProp("q:sstyle"));
2340
2645
  enqueue(new ParentComponentData(options.styleScoped, options.parentComponentFrame)),
@@ -2342,7 +2647,7 @@
2342
2647
  enqueue(new ParentComponentData(compStyleComponentId, componentFrame));
2343
2648
  } else {
2344
2649
  const inlineComponentProps = [ "q:key", jsx.key ];
2345
- ssr.openFragment(build.isDev ? [ "q:type", VirtualType.InlineComponent, ...inlineComponentProps ] : inlineComponentProps),
2650
+ ssr.openFragment(build.isDev ? [ DEBUG_TYPE, "I", ...inlineComponentProps ] : inlineComponentProps),
2346
2651
  enqueue(ssr.closeFragment);
2347
2652
  const component = ssr.getComponentFrame(0);
2348
2653
  const jsxOutput = ((ssr, componentHost, inlineComponentFunction, jsx) => {
@@ -2373,7 +2678,7 @@
2373
2678
  }
2374
2679
  }
2375
2680
  const eventValue = setEvent(serializationCtx, key, value);
2376
- eventValue && ssrAttrs.push(convertEventNameFromJsxPropToHtmlAttr(key), eventValue);
2681
+ eventValue && ssrAttrs.push(jsxEventToHtmlAttribute(key), eventValue);
2377
2682
  } else {
2378
2683
  isSignal(value) ? isClassAttr(key) ? ssrAttrs.push(key, [ value, styleScopedId ]) : ssrAttrs.push(key, value) : (isPreventDefault(key) && addPreventDefaultEventToSerializationContext(serializationCtx, key),
2379
2684
  value = serializeAttribute(key, value, styleScopedId), ssrAttrs.push(key, value));
@@ -2419,36 +2724,13 @@
2419
2724
  return value;
2420
2725
  }
2421
2726
  function addQwikEventToSerializationContext(serializationCtx, key, qrl) {
2422
- const eventName = getEventNameFromJsxProp(key);
2727
+ const eventName = getEventNameFromJsxEvent(key);
2423
2728
  eventName && (serializationCtx.$eventNames$.add(eventName), serializationCtx.$eventQrls$.add(qrl));
2424
2729
  }
2425
2730
  function addPreventDefaultEventToSerializationContext(serializationCtx, key) {
2426
2731
  const eventName = key.substring(15);
2427
2732
  eventName && serializationCtx.$eventNames$.add(eventName);
2428
2733
  }
2429
- const version = "2.0.0-alpha.8-dev+66037b5";
2430
- class _SharedContainer {
2431
- $version$;
2432
- $scheduler$;
2433
- $storeProxyMap$;
2434
- $locale$;
2435
- $getObjectById$;
2436
- $serverData$;
2437
- $currentUniqueId$=0;
2438
- $instanceHash$=null;
2439
- constructor(scheduleDrain, journalFlush, serverData, locale) {
2440
- this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version,
2441
- this.$storeProxyMap$ = new WeakMap, this.$getObjectById$ = () => {
2442
- throw Error("Not implemented");
2443
- }, this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
2444
- }
2445
- trackSignalValue(signal, subscriber, property, data) {
2446
- return trackSignalAndAssignHost(signal, subscriber, property, this, data);
2447
- }
2448
- serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
2449
- return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
2450
- }
2451
- }
2452
2734
  const getValueProp = p0 => p0.value;
2453
2735
  const getProp = (p0, p1) => p0[p1];
2454
2736
  const getWrapped = args => new WrappedSignal(null, 1 === args.length ? getValueProp : getProp, args, null);
@@ -2459,7 +2741,7 @@
2459
2741
  return obj[prop];
2460
2742
  }
2461
2743
  if (isSignal(obj)) {
2462
- return assertEqual(), obj instanceof WrappedSignal && obj.flags & WrappedSignalFlags.UNWRAP ? obj : getWrapped(args);
2744
+ return assertEqual(), obj instanceof WrappedSignal && 2 & obj.flags ? obj : getWrapped(args);
2463
2745
  }
2464
2746
  if (isPropsProxy(obj)) {
2465
2747
  const constProps = obj[_CONST_PROPS];
@@ -2553,7 +2835,7 @@
2553
2835
  return this.$children$;
2554
2836
  }
2555
2837
  const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
2556
- return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
2838
+ return value instanceof WrappedSignal && 2 & value.$flags$ ? value.value : value;
2557
2839
  }
2558
2840
  set(_, prop, value) {
2559
2841
  return prop === _CONST_PROPS ? (this.$constProps$ = value, !0) : prop === _VAR_PROPS ? (this.$varProps$ = value,
@@ -2571,7 +2853,7 @@
2571
2853
  has(_, prop) {
2572
2854
  return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
2573
2855
  }
2574
- getOwnPropertyDescriptor(target, p) {
2856
+ getOwnPropertyDescriptor(_, p) {
2575
2857
  return {
2576
2858
  configurable: !0,
2577
2859
  enumerable: !0,
@@ -2616,10 +2898,10 @@
2616
2898
  }
2617
2899
  try {
2618
2900
  if (stringifyPath.push(value), Array.isArray(value)) {
2619
- return vnode_isVNode(value) ? "(" + vnode_getProp(value, "q:type", null) + ")" : value.map(qwikDebugToString);
2901
+ return vnode_isVNode(value) ? "(" + vnode_getProp(value, DEBUG_TYPE, null) + ")" : value.map(qwikDebugToString);
2620
2902
  }
2621
2903
  if (isSignal(value)) {
2622
- return value instanceof WrappedSignal ? "WrappedSignal" : value instanceof ComputedSignal ? "ComputedSignal" : "Signal";
2904
+ return value instanceof WrappedSignal ? "WrappedSignal" : value instanceof ComputedSignalImpl ? "ComputedSignal" : "Signal";
2623
2905
  }
2624
2906
  if (isStore(value)) {
2625
2907
  return "Store";
@@ -2636,8 +2918,6 @@
2636
2918
  const pad = (text, prefix) => String(text).split("\n").map(((line, idx) => (idx ? prefix : "") + line)).join("\n");
2637
2919
  const jsxToString = value => {
2638
2920
  if (isJSXNode(value)) {
2639
- let type = value.type;
2640
- "function" == typeof type && (type = type.name || "Component");
2641
2921
  let str = "<" + value.type;
2642
2922
  if (value.props) {
2643
2923
  for (const [key, val] of Object.entries(value.props)) {
@@ -2652,61 +2932,53 @@
2652
2932
  }
2653
2933
  return String(value);
2654
2934
  };
2655
- const VNodeDataSeparator_REFERENCE = 126, VNodeDataSeparator_ADVANCE_1 = 33, VNodeDataSeparator_ADVANCE_8192 = 46;
2656
- const VNodeDataChar_OPEN = 123, VNodeDataChar_CLOSE = 125, VNodeDataChar_SCOPED_STYLE = 59, VNodeDataChar_RENDER_FN = 60, VNodeDataChar_ID = 61, VNodeDataChar_PROPS = 62, VNodeDataChar_SLOT_PARENT = 63, VNodeDataChar_KEY = 64, VNodeDataChar_SEQ = 91, VNodeDataChar_CONTEXT = 93, VNodeDataChar_SEQ_IDX = 94, VNodeDataChar_BACK_REFS = 96, VNodeDataChar_SEPARATOR = 124, VNodeDataChar_SLOT = 126;
2657
- var VNodeJournalOpCode;
2658
- !function(VNodeJournalOpCode) {
2659
- VNodeJournalOpCode[VNodeJournalOpCode.SetText = 1] = "SetText", VNodeJournalOpCode[VNodeJournalOpCode.SetAttribute = 2] = "SetAttribute",
2660
- VNodeJournalOpCode[VNodeJournalOpCode.HoistStyles = 3] = "HoistStyles", VNodeJournalOpCode[VNodeJournalOpCode.Remove = 4] = "Remove",
2661
- VNodeJournalOpCode[VNodeJournalOpCode.Insert = 5] = "Insert";
2662
- }(VNodeJournalOpCode || (VNodeJournalOpCode = {}));
2663
2935
  const vnode_newElement = (element, elementName) => {
2664
2936
  assertEqual(fastNodeType(element));
2665
- const vnode = VNodeArray.createElement(VNodeFlags.Element | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, null, null, element, elementName);
2937
+ const vnode = VNodeArray.createElement(-247, null, null, null, null, null, element, elementName);
2666
2938
  return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)),
2667
- assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2939
+ assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2668
2940
  };
2669
2941
  const vnode_newUnMaterializedElement = element => {
2670
2942
  assertEqual(fastNodeType(element));
2671
- const vnode = VNodeArray.createElement(VNodeFlags.Element | -1 << VNodeFlagsIndex.shift, null, null, null, void 0, void 0, element, void 0);
2943
+ const vnode = VNodeArray.createElement(-255, null, null, null, void 0, void 0, element, void 0);
2672
2944
  return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)),
2673
- assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2945
+ assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2674
2946
  };
2675
2947
  const vnode_newText = (textNode, textContent) => {
2676
- const vnode = VNodeArray.createText(VNodeFlags.Text | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, textNode, textContent);
2948
+ const vnode = VNodeArray.createText(-244, null, null, null, textNode, textContent);
2677
2949
  return assertEqual(fastNodeType(textNode)), assertFalse(vnode_isElementVNode(vnode)),
2678
2950
  assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)),
2679
2951
  vnode;
2680
2952
  };
2681
2953
  const vnode_newVirtual = () => {
2682
- const vnode = VNodeArray.createVirtual(VNodeFlags.Virtual | -1 << VNodeFlagsIndex.shift, null, null, null, null, null);
2954
+ const vnode = VNodeArray.createVirtual(-254, null, null, null, null, null);
2683
2955
  return assertFalse(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)),
2684
2956
  assertTrue(vnode_isVirtualVNode(vnode)), vnode;
2685
2957
  };
2686
2958
  const vnode_isVNode = vNode => vNode instanceof VNodeArray;
2687
2959
  const vnode_isElementVNode = vNode => {
2688
2960
  assertDefined();
2689
- return (vNode[VNodeProps.flags] & VNodeFlags.Element) === VNodeFlags.Element;
2961
+ return !(1 & ~vNode[0]);
2690
2962
  };
2691
2963
  const vnode_isElementOrTextVNode = vNode => {
2692
2964
  assertDefined();
2693
- return !!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK);
2965
+ return !!(5 & vNode[0]);
2694
2966
  };
2695
2967
  const vnode_isMaterialized = vNode => {
2696
2968
  assertDefined();
2697
- return (vNode[VNodeProps.flags] & VNodeFlags.Element) === VNodeFlags.Element && void 0 !== vNode[ElementVNodeProps.firstChild] && void 0 !== vNode[ElementVNodeProps.lastChild];
2969
+ return !(1 & ~vNode[0]) && void 0 !== vNode[4] && void 0 !== vNode[5];
2698
2970
  };
2699
2971
  const vnode_isTextVNode = vNode => {
2700
2972
  assertDefined();
2701
- return (vNode[VNodeProps.flags] & VNodeFlags.Text) === VNodeFlags.Text;
2973
+ return !(4 & ~vNode[0]);
2702
2974
  };
2703
2975
  const vnode_isVirtualVNode = vNode => {
2704
2976
  assertDefined();
2705
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
2977
+ return !(2 & ~vNode[0]);
2706
2978
  };
2707
2979
  const vnode_isProjection = vNode => {
2708
2980
  assertDefined();
2709
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
2981
+ return !(2 & ~vNode[0]) && null !== vnode_getProp(vNode, QSlot, null);
2710
2982
  };
2711
2983
  const ensureTextVNode = vNode => (assertTrue(vnode_isTextVNode(vNode), vnode_getNodeTypeName(vNode)),
2712
2984
  vNode);
@@ -2717,24 +2989,24 @@
2717
2989
  vNode);
2718
2990
  const vnode_getNodeTypeName = vNode => {
2719
2991
  if (vNode) {
2720
- switch (vNode[VNodeProps.flags] & VNodeFlags.TYPE_MASK) {
2721
- case VNodeFlags.Element:
2992
+ switch (7 & vNode[0]) {
2993
+ case 1:
2722
2994
  return "Element";
2723
2995
 
2724
- case VNodeFlags.Virtual:
2996
+ case 2:
2725
2997
  return "Virtual";
2726
2998
 
2727
- case VNodeFlags.Text:
2999
+ case 4:
2728
3000
  return "Text";
2729
3001
  }
2730
3002
  }
2731
3003
  return "<unknown>";
2732
3004
  };
2733
3005
  const vnode_ensureElementInflated = vnode => {
2734
- if ((vnode[VNodeProps.flags] & VNodeFlags.INFLATED_TYPE_MASK) === VNodeFlags.Element) {
3006
+ if (1 == (15 & vnode[0])) {
2735
3007
  const elementVNode = vnode;
2736
- elementVNode[VNodeProps.flags] ^= VNodeFlags.Inflated;
2737
- const element = elementVNode[ElementVNodeProps.element];
3008
+ elementVNode[0] ^= 8;
3009
+ const element = elementVNode[6];
2738
3010
  const attributes = element.attributes;
2739
3011
  const props = vnode_getProps(elementVNode);
2740
3012
  for (let idx = 0; idx < attributes.length; idx++) {
@@ -2744,7 +3016,7 @@
2744
3016
  break;
2745
3017
  }
2746
3018
  if (key.startsWith("q:container")) {
2747
- attr.value === QContainerValue.HTML ? mapArray_set(props, "dangerouslySetInnerHTML", element.innerHTML, 0) : attr.value === QContainerValue.TEXT && "value" in element && mapArray_set(props, "value", element.value, 0);
3019
+ "html" === attr.value ? mapArray_set(props, "dangerouslySetInnerHTML", element.innerHTML, 0) : "text" === attr.value && "value" in element && mapArray_set(props, "value", element.value, 0);
2748
3020
  } else if (!key.startsWith("on:")) {
2749
3021
  mapArray_set(props, key, attr.value, 0);
2750
3022
  }
@@ -2801,31 +3073,31 @@
2801
3073
  return childNodes;
2802
3074
  }
2803
3075
  const vnode_getDomSibling = (vNode, nextDirection, descend) => {
2804
- const childProp = nextDirection ? VirtualVNodeProps.firstChild : VirtualVNodeProps.lastChild;
2805
- const siblingProp = nextDirection ? VNodeProps.nextSibling : VNodeProps.previousSibling;
3076
+ const childProp = nextDirection ? 4 : 5;
3077
+ const siblingProp = nextDirection ? 3 : 2;
2806
3078
  let cursor = vNode;
2807
3079
  for (;descend && cursor && vnode_isVirtualVNode(cursor); ) {
2808
3080
  const child = cursor[childProp];
2809
3081
  if (!child) {
2810
3082
  break;
2811
3083
  }
2812
- if (child[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
3084
+ if (5 & child[0]) {
2813
3085
  return child;
2814
3086
  }
2815
3087
  cursor = child;
2816
3088
  }
2817
3089
  for (;cursor; ) {
2818
3090
  let sibling = cursor[siblingProp];
2819
- if (sibling && sibling[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
3091
+ if (sibling && 5 & sibling[0]) {
2820
3092
  return sibling;
2821
3093
  }
2822
3094
  if (!sibling) {
2823
- let virtual = cursor[VNodeProps.parent];
3095
+ let virtual = cursor[1];
2824
3096
  if (virtual && !vnode_isVirtualVNode(virtual)) {
2825
3097
  return null;
2826
3098
  }
2827
3099
  for (;virtual && !(sibling = virtual[siblingProp]); ) {
2828
- if (virtual = virtual[VNodeProps.parent], virtual && !vnode_isVirtualVNode(virtual)) {
3100
+ if (virtual = virtual[1], virtual && !vnode_isVirtualVNode(virtual)) {
2829
3101
  return null;
2830
3102
  }
2831
3103
  }
@@ -2837,7 +3109,7 @@
2837
3109
  }
2838
3110
  }
2839
3111
  for (;sibling; ) {
2840
- if (cursor = sibling, cursor[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK && vnode_getNode(cursor)) {
3112
+ if (cursor = sibling, 5 & cursor[0] && vnode_getNode(cursor)) {
2841
3113
  return cursor;
2842
3114
  }
2843
3115
  sibling = cursor[childProp];
@@ -2847,33 +3119,32 @@
2847
3119
  };
2848
3120
  const vnode_ensureTextInflated = (journal, vnode) => {
2849
3121
  const textVNode = ensureTextVNode(vnode);
2850
- if (!(textVNode[VNodeProps.flags] & VNodeFlags.Inflated)) {
3122
+ if (!(8 & textVNode[0])) {
2851
3123
  const parentNode = vnode_getDomParent(vnode);
2852
- const sharedTextNode = textVNode[TextVNodeProps.node];
3124
+ const sharedTextNode = textVNode[4];
2853
3125
  const doc = parentNode.ownerDocument;
2854
3126
  let cursor = vnode_getDomSibling(vnode, !1, !0);
2855
- const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, !0, !0)?.[ElementVNodeProps.element] || null;
3127
+ const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, !0, !0)?.[6] || null;
2856
3128
  let lastPreviousTextNode = insertBeforeNode;
2857
3129
  for (;cursor && vnode_isTextVNode(cursor); ) {
2858
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
2859
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2860
- journal.push(VNodeJournalOpCode.Insert, parentNode, lastPreviousTextNode, textNode),
2861
- lastPreviousTextNode = textNode, cursor[TextVNodeProps.node] = textNode, cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
3130
+ if (!(8 & cursor[0])) {
3131
+ const textNode = doc.createTextNode(cursor[5]);
3132
+ journal.push(5, parentNode, lastPreviousTextNode, textNode), lastPreviousTextNode = textNode,
3133
+ cursor[4] = textNode, cursor[0] |= 8;
2862
3134
  }
2863
3135
  cursor = vnode_getDomSibling(cursor, !1, !0);
2864
3136
  }
2865
3137
  for (cursor = vnode; cursor && vnode_isTextVNode(cursor); ) {
2866
3138
  const next = vnode_getDomSibling(cursor, !0, !0);
2867
3139
  const isLastNode = !next || !vnode_isTextVNode(next);
2868
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
3140
+ if (!(8 & cursor[0])) {
2869
3141
  if (isLastNode && sharedTextNode) {
2870
- journal.push(VNodeJournalOpCode.SetText, sharedTextNode, cursor[TextVNodeProps.text]);
3142
+ journal.push(1, sharedTextNode, cursor[5]);
2871
3143
  } else {
2872
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2873
- journal.push(VNodeJournalOpCode.Insert, parentNode, insertBeforeNode, textNode),
2874
- cursor[TextVNodeProps.node] = textNode;
3144
+ const textNode = doc.createTextNode(cursor[5]);
3145
+ journal.push(5, parentNode, insertBeforeNode, textNode), cursor[4] = textNode;
2875
3146
  }
2876
- cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
3147
+ cursor[0] |= 8;
2877
3148
  }
2878
3149
  cursor = next;
2879
3150
  }
@@ -2882,12 +3153,20 @@
2882
3153
  const vnode_locate = (rootVNode, id) => {
2883
3154
  ensureElementVNode(rootVNode);
2884
3155
  let vNode = rootVNode;
2885
- const containerElement = rootVNode[ElementVNodeProps.element];
3156
+ const containerElement = rootVNode[6];
2886
3157
  const {qVNodeRefs} = containerElement;
2887
3158
  let elementOffset = -1;
2888
3159
  let refElement;
2889
- if ("string" == typeof id ? (assertDefined(), elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset)) : refElement = id,
2890
- assertDefined(), vnode_isVNode(refElement)) {
3160
+ if ("string" == typeof id) {
3161
+ assertDefined(), elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset);
3162
+ } else {
3163
+ refElement = id;
3164
+ const vNode = refElement.vNode?.deref();
3165
+ if (vNode) {
3166
+ return vNode;
3167
+ }
3168
+ }
3169
+ if (assertDefined(), vnode_isVNode(refElement)) {
2891
3170
  vNode = refElement;
2892
3171
  } else {
2893
3172
  assertTrue(containerElement.contains(refElement));
@@ -2915,7 +3194,7 @@
2915
3194
  };
2916
3195
  const vnode_getChildWithIdx = (vNode, childIdx) => {
2917
3196
  let child = vnode_getFirstChild(vNode);
2918
- for (assertDefined(); child[VNodeProps.flags] >>> VNodeFlagsIndex.shift !== childIdx; ) {
3197
+ for (assertDefined(); child[0] >>> 8 !== childIdx; ) {
2919
3198
  child = vnode_getNextSibling(child), assertDefined();
2920
3199
  }
2921
3200
  return child;
@@ -2924,7 +3203,7 @@
2924
3203
  const vnode_getVNodeForChildNode = (vNode, childElement) => {
2925
3204
  ensureElementVNode(vNode);
2926
3205
  let child = vnode_getFirstChild(vNode);
2927
- for (assertDefined(); child && child[ElementVNodeProps.element] !== childElement; ) {
3206
+ for (assertDefined(); child && child[6] !== childElement; ) {
2928
3207
  if (vnode_isVirtualVNode(child)) {
2929
3208
  const next = vnode_getNextSibling(child);
2930
3209
  const firstChild = vnode_getFirstChild(child);
@@ -2957,19 +3236,20 @@
2957
3236
  const length = journal.length;
2958
3237
  for (;idx < length; ) {
2959
3238
  switch (journal[idx++]) {
2960
- case VNodeJournalOpCode.SetText:
3239
+ case 1:
2961
3240
  journal[idx++].nodeValue = journal[idx++];
2962
3241
  break;
2963
3242
 
2964
- case VNodeJournalOpCode.SetAttribute:
3243
+ case 2:
2965
3244
  const element = journal[idx++];
2966
3245
  let key = journal[idx++];
2967
3246
  "className" === key && (key = "class");
2968
3247
  const value = journal[idx++];
2969
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : "dangerouslySetInnerHTML" === key ? element.innerHTML = value : null == value || !1 === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
3248
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : "dangerouslySetInnerHTML" === key ? (element.innerHTML = value,
3249
+ element.setAttribute("q:container", "html")) : null == value || !1 === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2970
3250
  break;
2971
3251
 
2972
- case VNodeJournalOpCode.HoistStyles:
3252
+ case 3:
2973
3253
  const document = journal[idx++];
2974
3254
  const head = document.head;
2975
3255
  const styles = document.querySelectorAll("style[q\\:style],style[q\\:sstyle]");
@@ -2978,7 +3258,7 @@
2978
3258
  }
2979
3259
  break;
2980
3260
 
2981
- case VNodeJournalOpCode.Remove:
3261
+ case 4:
2982
3262
  const removeParent = journal[idx++];
2983
3263
  let nodeToRemove;
2984
3264
  for (;idx < length && "number" != typeof (nodeToRemove = journal[idx]); ) {
@@ -2986,7 +3266,7 @@
2986
3266
  }
2987
3267
  break;
2988
3268
 
2989
- case VNodeJournalOpCode.Insert:
3269
+ case 5:
2990
3270
  const insertParent = journal[idx++];
2991
3271
  const insertBefore = journal[idx++];
2992
3272
  let newChild;
@@ -2998,15 +3278,22 @@
2998
3278
  journal.length = 0;
2999
3279
  };
3000
3280
  const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
3001
- ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent),
3002
- newChild === insertBefore && (insertBefore = null);
3281
+ ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent);
3282
+ const newChildCurrentParent = newChild[1];
3283
+ if (newChild === insertBefore) {
3284
+ if (newChildCurrentParent) {
3285
+ return;
3286
+ }
3287
+ insertBefore = null;
3288
+ }
3289
+ newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, !1);
3003
3290
  let adjustedInsertBefore = null;
3004
3291
  null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, !0, !1)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, !0, !0) : insertBefore,
3005
3292
  adjustedInsertBefore && ((journal, vNode) => {
3006
3293
  vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
3007
3294
  })(journal, adjustedInsertBefore);
3008
3295
  const domParentVNode = vnode_getDomParentVNode(parent);
3009
- const parentNode = domParentVNode && domParentVNode[ElementVNodeProps.element];
3296
+ const parentNode = domParentVNode && domParentVNode[6];
3010
3297
  if (parentNode) {
3011
3298
  const domChildren = function(journal, domParentVNode, newChild) {
3012
3299
  const {elementNamespace, elementNamespaceFlag} = getNewElementNamespaceData(domParentVNode, newChild);
@@ -3018,11 +3305,11 @@
3018
3305
  for (let i = 0; i < children.length; i++) {
3019
3306
  const childVNode = children[i];
3020
3307
  if (vnode_isTextVNode(childVNode)) {
3021
- domChildren.push(childVNode[TextVNodeProps.node]);
3308
+ domChildren.push(childVNode[4]);
3022
3309
  continue;
3023
3310
  }
3024
- if ((childVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK) == (domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK)) {
3025
- domChildren.push(childVNode[ElementVNodeProps.element]);
3311
+ if ((192 & childVNode[0]) == (192 & domParentVNode[0])) {
3312
+ domChildren.push(childVNode[6]);
3026
3313
  continue;
3027
3314
  }
3028
3315
  const newChildElement = vnode_cloneElementWithNamespace(childVNode, domParentVNode, elementNamespace, elementNamespaceFlag);
@@ -3031,65 +3318,59 @@
3031
3318
  }
3032
3319
  return domChildren;
3033
3320
  }(journal, domParentVNode, newChild);
3034
- domChildren.length && journal.push(VNodeJournalOpCode.Insert, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
3321
+ domChildren.length && journal.push(5, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
3035
3322
  }
3036
- const newChildCurrentParent = newChild[VNodeProps.parent];
3037
- newChildCurrentParent && (newChild[VNodeProps.previousSibling] || newChild[VNodeProps.nextSibling] || vnode_isElementVNode(newChildCurrentParent) && newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, !1);
3038
3323
  const vNext = insertBefore;
3039
- const vPrevious = vNext ? vNext[VNodeProps.previousSibling] : parent[ElementVNodeProps.lastChild];
3040
- vNext ? vNext[VNodeProps.previousSibling] = newChild : parent[ElementVNodeProps.lastChild] = newChild,
3041
- vPrevious ? vPrevious[VNodeProps.nextSibling] = newChild : parent[ElementVNodeProps.firstChild] = newChild,
3042
- newChild[VNodeProps.previousSibling] = vPrevious, newChild[VNodeProps.nextSibling] = vNext,
3043
- newChild[VNodeProps.parent] = parent;
3324
+ const vPrevious = vNext ? vNext[2] : parent[5];
3325
+ vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild,
3326
+ newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
3044
3327
  };
3045
- const vnode_getDomParent = vnode => (vnode = vnode_getDomParentVNode(vnode)) && vnode[ElementVNodeProps.element];
3328
+ const vnode_getDomParent = vnode => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
3046
3329
  const vnode_getDomParentVNode = vnode => {
3047
3330
  for (;vnode && !vnode_isElementVNode(vnode); ) {
3048
- vnode = vnode[VNodeProps.parent];
3331
+ vnode = vnode[1];
3049
3332
  }
3050
3333
  return vnode;
3051
3334
  };
3052
3335
  const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
3053
- assertEqual(vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove);
3054
- const vPrevious = vToRemove[VNodeProps.previousSibling];
3055
- const vNext = vToRemove[VNodeProps.nextSibling];
3056
- if (vPrevious ? vPrevious[VNodeProps.nextSibling] = vNext : vParent[ElementVNodeProps.firstChild] = vNext,
3057
- vNext ? vNext[VNodeProps.previousSibling] = vPrevious : vParent[ElementVNodeProps.lastChild] = vPrevious,
3058
- vToRemove[VNodeProps.previousSibling] = null, vToRemove[VNodeProps.nextSibling] = null,
3336
+ if (assertEqual(vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove),
3059
3337
  removeDOM) {
3060
3338
  const domParent = vnode_getDomParent(vParent);
3061
3339
  if (vnode_getAttr(vParent, "dangerouslySetInnerHTML")) {
3062
3340
  return;
3063
3341
  }
3064
3342
  const children = vnode_getDOMChildNodes(journal, vToRemove);
3065
- domParent && children.length && journal.push(VNodeJournalOpCode.Remove, domParent, ...children);
3343
+ domParent && children.length && journal.push(4, domParent, ...children);
3066
3344
  }
3345
+ const vPrevious = vToRemove[2];
3346
+ const vNext = vToRemove[3];
3347
+ vPrevious ? vPrevious[3] = vNext : vParent[4] = vNext, vNext ? vNext[2] = vPrevious : vParent[5] = vPrevious,
3348
+ vToRemove[2] = null, vToRemove[3] = null;
3067
3349
  };
3068
3350
  const vnode_truncate = (journal, vParent, vDelete) => {
3069
3351
  assertDefined();
3070
3352
  const parent = vnode_getDomParent(vParent);
3071
3353
  const children = vnode_getDOMChildNodes(journal, vDelete);
3072
- parent && children.length && journal.push(VNodeJournalOpCode.Remove, parent, ...children);
3073
- const vPrevious = vDelete[VNodeProps.previousSibling];
3074
- vPrevious ? vPrevious[VNodeProps.nextSibling] = null : vParent[ElementVNodeProps.firstChild] = null,
3075
- vParent[ElementVNodeProps.lastChild] = vPrevious;
3354
+ parent && children.length && journal.push(4, parent, ...children);
3355
+ const vPrevious = vDelete[2];
3356
+ vPrevious ? vPrevious[3] = null : vParent[4] = null, vParent[5] = vPrevious;
3076
3357
  };
3077
3358
  const vnode_getElementName = vnode => {
3078
3359
  const elementVNode = ensureElementVNode(vnode);
3079
- let elementName = elementVNode[ElementVNodeProps.elementName];
3360
+ let elementName = elementVNode[7];
3080
3361
  if (void 0 === elementName) {
3081
- const element = elementVNode[ElementVNodeProps.element];
3082
- const nodeName = build.isDev ? fastNodeName(element).toLowerCase() : fastNodeName(element);
3083
- elementName = elementVNode[ElementVNodeProps.elementName] = nodeName, elementVNode[VNodeProps.flags] |= (element => {
3362
+ const element = elementVNode[6];
3363
+ const nodeName = fastNodeName(element).toLowerCase();
3364
+ elementName = elementVNode[7] = nodeName, elementVNode[0] |= (element => {
3084
3365
  switch (fastNamespaceURI(element)) {
3085
3366
  case SVG_NS:
3086
- return VNodeFlags.NS_svg;
3367
+ return 64;
3087
3368
 
3088
3369
  case MATH_NS:
3089
- return VNodeFlags.NS_math;
3370
+ return 128;
3090
3371
 
3091
3372
  default:
3092
- return VNodeFlags.NS_html;
3373
+ return 0;
3093
3374
  }
3094
3375
  })(element);
3095
3376
  }
@@ -3097,19 +3378,18 @@
3097
3378
  };
3098
3379
  const vnode_getText = vnode => {
3099
3380
  const textVNode = ensureTextVNode(vnode);
3100
- let text = textVNode[TextVNodeProps.text];
3101
- return void 0 === text && (text = textVNode[TextVNodeProps.text] = textVNode[TextVNodeProps.node].nodeValue),
3102
- text;
3381
+ let text = textVNode[5];
3382
+ return void 0 === text && (text = textVNode[5] = textVNode[4].nodeValue), text;
3103
3383
  };
3104
3384
  const vnode_setText = (journal, textVNode, text) => {
3105
3385
  vnode_ensureTextInflated(journal, textVNode);
3106
- journal.push(VNodeJournalOpCode.SetText, textVNode[TextVNodeProps.node], textVNode[TextVNodeProps.text] = text);
3386
+ journal.push(1, textVNode[4], textVNode[5] = text);
3107
3387
  };
3108
3388
  const vnode_getFirstChild = vnode => {
3109
3389
  if (vnode_isTextVNode(vnode)) {
3110
3390
  return null;
3111
3391
  }
3112
- let vFirstChild = vnode[ElementVNodeProps.firstChild];
3392
+ let vFirstChild = vnode[4];
3113
3393
  return void 0 === vFirstChild && (vFirstChild = ensureMaterialized(vnode)), vFirstChild;
3114
3394
  };
3115
3395
  const materialize = (vNode, element, firstChild, vNodeData) => {
@@ -3133,19 +3413,17 @@
3133
3413
  let vLast = null;
3134
3414
  let previousTextNode = null;
3135
3415
  const addVNode = node => {
3136
- node[VNodeProps.flags] = node[VNodeProps.flags] & VNodeFlagsIndex.negated_mask | idx << VNodeFlagsIndex.shift,
3137
- idx++, vLast && (vLast[VNodeProps.nextSibling] = node), node[VNodeProps.previousSibling] = vLast,
3138
- node[VNodeProps.parent] = vParent, vFirst || (vParent[ElementVNodeProps.firstChild] = vFirst = node),
3139
- vLast = node;
3416
+ node[0] = 255 & node[0] | idx << 8, idx++, vLast && (vLast[3] = node), node[2] = vLast,
3417
+ node[1] = vParent, vFirst || (vParent[4] = vFirst = node), vLast = node;
3140
3418
  };
3141
3419
  let textIdx = 0;
3142
3420
  let combinedText = null;
3143
3421
  let container = null;
3144
- return processVNodeData$1(vData, ((peek, consumeValue, consume, nextToConsumeIdx) => {
3422
+ return processVNodeData(vData, ((peek, consumeValue, consume, nextToConsumeIdx) => {
3145
3423
  if (isNumber(peek())) {
3146
3424
  for (;!isElement(child); ) {
3147
3425
  if (!(child = fastNextSibling(child))) {
3148
- throw qError(QError.materializeVNodeDataError, [ vData, peek(), nextToConsumeIdx ]);
3426
+ throw qError(44, [ vData, peek(), nextToConsumeIdx ]);
3149
3427
  }
3150
3428
  }
3151
3429
  for (;isQStyleElement(child); ) {
@@ -3189,7 +3467,7 @@
3189
3467
  const value = consumeValue();
3190
3468
  vnode_setAttr(null, vParent, key, value);
3191
3469
  } else if (peek() === VNodeDataChar_CLOSE) {
3192
- consume(), vParent[ElementVNodeProps.lastChild] = vLast, idx = stack.pop(), previousTextNode = stack.pop(),
3470
+ consume(), vParent[5] = vLast, idx = stack.pop(), previousTextNode = stack.pop(),
3193
3471
  vLast = stack.pop(), vFirst = stack.pop(), vParent = stack.pop();
3194
3472
  } else if (peek() === VNodeDataChar_SLOT) {
3195
3473
  vnode_setAttr(null, vParent, QSlot, consumeValue());
@@ -3204,22 +3482,22 @@
3204
3482
  const text = null === combinedText ? "" : combinedText.substring(textIdx, textIdx + length);
3205
3483
  addVNode(previousTextNode = ((previousTextNode, sharedTextNode, textContent) => {
3206
3484
  sharedTextNode && assertEqual(fastNodeType(sharedTextNode));
3207
- const vnode = VNodeArray.createText(VNodeFlags.Text | -1 << VNodeFlagsIndex.shift, null, previousTextNode, null, sharedTextNode, textContent);
3485
+ const vnode = VNodeArray.createText(-252, null, previousTextNode, null, sharedTextNode, textContent);
3208
3486
  return assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)),
3209
3487
  assertFalse(vnode_isVirtualVNode(vnode)), vnode;
3210
3488
  })(previousTextNode, textNode, text)), textIdx += length;
3211
3489
  }
3212
- })), vParent[ElementVNodeProps.lastChild] = vLast, vFirst;
3490
+ })), vParent[5] = vLast, vFirst;
3213
3491
  }(vNode, vNodeData, element, firstChild);
3214
3492
  }
3215
3493
  return materializeFromDOM(vNode, firstChild);
3216
3494
  };
3217
3495
  const ensureMaterialized = vnode => {
3218
3496
  const vParent = ensureElementVNode(vnode);
3219
- let vFirstChild = vParent[ElementVNodeProps.firstChild];
3497
+ let vFirstChild = vParent[4];
3220
3498
  if (void 0 === vFirstChild) {
3221
- vFirstChild = vParent[VNodeProps.parent] && shouldIgnoreChildren(vParent[ElementVNodeProps.element]) ? vParent[ElementVNodeProps.firstChild] = vParent[ElementVNodeProps.lastChild] = null : (vNode => {
3222
- const element = vNode[ElementVNodeProps.element];
3499
+ vFirstChild = vParent[1] && shouldIgnoreChildren(vParent[6]) ? vParent[4] = vParent[5] = null : (vNode => {
3500
+ const element = vNode[6];
3223
3501
  const firstChild = fastFirstChild(element);
3224
3502
  const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
3225
3503
  return materialize(vNode, element, firstChild, vNodeData);
@@ -3312,20 +3590,19 @@
3312
3590
  const nodeType = fastNodeType(child);
3313
3591
  let vNextChild = null;
3314
3592
  3 === nodeType ? vNextChild = vnode_newText(child, child.textContent ?? void 0) : 1 === nodeType && (vNextChild = vnode_newUnMaterializedElement(child)),
3315
- vNextChild && (vNextChild[VNodeProps.parent] = vParent, vChild && (vChild[VNodeProps.nextSibling] = vNextChild),
3316
- vNextChild[VNodeProps.previousSibling] = vChild, vChild = vNextChild), vFirstChild || (vParent[ElementVNodeProps.firstChild] = vFirstChild = vChild),
3317
- child = fastNextSibling(child), skipStyleElements();
3593
+ vNextChild && (vNextChild[1] = vParent, vChild && (vChild[3] = vNextChild), vNextChild[2] = vChild,
3594
+ vChild = vNextChild), vFirstChild || (vParent[4] = vFirstChild = vChild), child = fastNextSibling(child),
3595
+ skipStyleElements();
3318
3596
  }
3319
- if (vParent[ElementVNodeProps.lastChild] = vChild || null, vParent[ElementVNodeProps.firstChild] = vFirstChild,
3320
- vData) {
3597
+ if (vParent[5] = vChild || null, vParent[4] = vFirstChild, vData) {
3321
3598
  let container = null;
3322
- processVNodeData$1(vData, ((peek, consumeValue) => {
3599
+ processVNodeData(vData, ((peek, consumeValue) => {
3323
3600
  if (peek() === VNodeDataChar_ID) {
3324
- container || (container = getDomContainer(vParent[ElementVNodeProps.element]));
3601
+ container || (container = getDomContainer(vParent[6]));
3325
3602
  const id = consumeValue();
3326
3603
  container.$setRawState$(parseInt(id), vParent), build.isDev && vnode_setAttr(null, vParent, "q:id", id);
3327
3604
  } else {
3328
- peek() === VNodeDataChar_BACK_REFS ? (container || (container = getDomContainer(vParent[ElementVNodeProps.element])),
3605
+ peek() === VNodeDataChar_BACK_REFS ? (container || (container = getDomContainer(vParent[6])),
3329
3606
  setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
3330
3607
  }
3331
3608
  }));
@@ -3346,7 +3623,7 @@
3346
3623
  });
3347
3624
  }
3348
3625
  }
3349
- const processVNodeData$1 = (vData, callback) => {
3626
+ const processVNodeData = (vData, callback) => {
3350
3627
  let nextToConsumeIdx = 0;
3351
3628
  let ch = 0;
3352
3629
  let peekCh = 0;
@@ -3364,10 +3641,10 @@
3364
3641
  callback(peek, consumeValue, consume, nextToConsumeIdx);
3365
3642
  }
3366
3643
  };
3367
- const vnode_getNextSibling = vnode => vnode[VNodeProps.nextSibling];
3368
- const vnode_getPreviousSibling = vnode => vnode[VNodeProps.previousSibling];
3644
+ const vnode_getNextSibling = vnode => vnode[3];
3645
+ const vnode_getPreviousSibling = vnode => vnode[2];
3369
3646
  const vnode_getAttrKeys = vnode => {
3370
- if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
3647
+ if (3 & vnode[0]) {
3371
3648
  vnode_ensureElementInflated(vnode);
3372
3649
  const keys = [];
3373
3650
  const props = vnode_getProps(vnode);
@@ -3377,604 +3654,166 @@
3377
3654
  }
3378
3655
  return keys;
3379
3656
  }
3380
- return [];
3381
- };
3382
- const vnode_setAttr = (journal, vnode, key, value) => {
3383
- const type = vnode[VNodeProps.flags];
3384
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
3385
- vnode_ensureElementInflated(vnode);
3386
- const props = vnode_getProps(vnode);
3387
- const idx = mapApp_findIndx(props, key, 0);
3388
- if (idx >= 0) {
3389
- if (props[idx + 1] != value && type & VNodeFlags.Element) {
3390
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
3391
- }
3392
- null == value ? props.splice(idx, 2) : props[idx + 1] = value;
3393
- } else if (null != value && (props.splice(~idx, 0, key, value), type & VNodeFlags.Element)) {
3394
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
3395
- }
3396
- }
3397
- };
3398
- const vnode_getAttr = (vnode, key) => {
3399
- if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
3400
- vnode_ensureElementInflated(vnode);
3401
- const props = vnode_getProps(vnode);
3402
- return mapArray_get(props, key, 0);
3403
- }
3404
- return null;
3405
- };
3406
- const vnode_getProp = (vnode, key, getObject) => {
3407
- const type = vnode[VNodeProps.flags];
3408
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
3409
- type & VNodeFlags.Element && vnode_ensureElementInflated(vnode);
3410
- const props = vnode_getProps(vnode);
3411
- const idx = mapApp_findIndx(props, key, 0);
3412
- if (idx >= 0) {
3413
- let value = props[idx + 1];
3414
- return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)),
3415
- value;
3416
- }
3417
- }
3418
- return null;
3419
- };
3420
- const vnode_setProp = (vnode, key, value) => {
3421
- ensureElementOrVirtualVNode(vnode);
3422
- const props = vnode_getProps(vnode);
3423
- const idx = mapApp_findIndx(props, key, 0);
3424
- idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
3425
- };
3426
- const vnode_getProps = vnode => vnode[(vnode => {
3427
- const type = vnode[VNodeProps.flags] & VNodeFlags.TYPE_MASK;
3428
- if (type === VNodeFlags.Element) {
3429
- return ElementVNodeProps.PROPS_OFFSET;
3430
- }
3431
- if (type === VNodeFlags.Virtual) {
3432
- return VirtualVNodeProps.PROPS_OFFSET;
3433
- }
3434
- throw qError(QError.invalidVNodeType, [ type ]);
3435
- })(vnode)];
3436
- const vnode_getParent = vnode => vnode[VNodeProps.parent] || null;
3437
- const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode)),
3438
- vnode[TextVNodeProps.node]);
3439
- function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1) {
3440
- let vnode = this;
3441
- if (0 === depth) {
3442
- return "...";
3443
- }
3444
- if (null === vnode) {
3445
- return "null";
3446
- }
3447
- if (void 0 === vnode) {
3448
- return "undefined";
3449
- }
3450
- const strings = [];
3451
- do {
3452
- if (vnode_isTextVNode(vnode)) {
3453
- strings.push(qwikDebugToString(vnode_getText(vnode)));
3454
- } else if (vnode_isVirtualVNode(vnode)) {
3455
- const attrs = [ "[" + String(vnode[VNodeProps.flags] >>> VNodeFlagsIndex.shift) + "]" ];
3456
- vnode_getAttrKeys(vnode).forEach((key => {
3457
- if ("q:type" !== key) {
3458
- const value = vnode_getAttr(vnode, key);
3459
- attrs.push(" " + key + "=" + qwikDebugToString(value));
3460
- }
3461
- }));
3462
- const name = VirtualTypeName[vnode_getAttr(vnode, "q:type") || VirtualType.Virtual] || VirtualTypeName[VirtualType.Virtual];
3463
- strings.push("<" + name + attrs.join("") + ">");
3464
- const child = vnode_getFirstChild(vnode);
3465
- child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", !0, !0)),
3466
- strings.push("</" + name + ">");
3467
- } else if (vnode_isElementVNode(vnode)) {
3468
- const tag = vnode_getElementName(vnode);
3469
- const attrs = [];
3470
- const keys = vnode_getAttrKeys(vnode);
3471
- keys.forEach((key => {
3472
- const value = vnode_getAttr(vnode, key);
3473
- attrs.push(" " + key + "=" + qwikDebugToString(value));
3474
- }));
3475
- const node = vnode_getNode(vnode);
3476
- if (node) {
3477
- const vnodeData = node.ownerDocument.qVNodeData?.get(node);
3478
- vnodeData && attrs.push(" q:vnodeData=" + qwikDebugToString(vnodeData));
3479
- }
3480
- const domAttrs = node.attributes;
3481
- for (let i = 0; i < domAttrs.length; i++) {
3482
- const attr = domAttrs[i];
3483
- -1 === keys.indexOf(attr.name) && attrs.push(" " + attr.name + (attr.value ? "=" + qwikDebugToString(attr.value) : ""));
3484
- }
3485
- if (strings.push("<" + tag + attrs.join("") + ">"), vnode_isMaterialized(vnode) || materialize) {
3486
- const child = vnode_getFirstChild(vnode);
3487
- child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", !0, !0));
3488
- } else {
3489
- strings.push(" \x3c!-- not materialized --!>");
3490
- }
3491
- strings.push("</" + tag + ">");
3492
- }
3493
- vnode = siblings && vnode_getNextSibling(vnode) || null;
3494
- } while (vnode);
3495
- return strings.join("\n" + offset);
3496
- }
3497
- const isNumber = ch => 48 <= ch && ch <= 57;
3498
- const isLowercase = ch => 97 <= ch && ch <= 122;
3499
- const stack = [];
3500
- const vnode_getType = vnode => {
3501
- const type = vnode[VNodeProps.flags];
3502
- if (type & VNodeFlags.Element) {
3503
- return 1;
3504
- }
3505
- if (type & VNodeFlags.Virtual) {
3506
- return 11;
3507
- }
3508
- if (type & VNodeFlags.Text) {
3509
- return 3;
3510
- }
3511
- throw qError(QError.invalidVNodeType, [ type ]);
3512
- };
3513
- const isElement = node => node && "object" == typeof node && 1 === fastNodeType(node);
3514
- const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
3515
- let projectionDepth = 1;
3516
- for (;projectionDepth--; ) {
3517
- for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
3518
- const qSlotParent = vnode_getProp(vHost, "q:sparent", (id => vnode_locate(rootVNode, id)));
3519
- const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
3520
- vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
3521
- }
3522
- projectionDepth > 0 && (vHost = vnode_getParent(vHost));
3523
- }
3524
- return vHost;
3525
- };
3526
- const VNodeArray = class VNode extends Array {
3527
- static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
3528
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
3529
- }
3530
- static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
3531
- return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
3532
- }
3533
- static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
3534
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
3535
- }
3536
- constructor(flags, parent, previousSibling, nextSibling, ...rest) {
3537
- super(flags, parent, previousSibling, nextSibling, ...rest), build.isDev && (this.toString = vnode_toString);
3538
- }
3539
- };
3540
- let _context;
3541
- const tryGetInvokeContext = () => {
3542
- if (!_context) {
3543
- const context = "undefined" != typeof document && document && document.__q_context__;
3544
- if (!context) {
3545
- return;
3546
- }
3547
- return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
3548
- }
3549
- return _context;
3550
- };
3551
- const getInvokeContext = () => {
3552
- const ctx = tryGetInvokeContext();
3553
- if (!ctx) {
3554
- throw qError(QError.useMethodOutsideContext);
3555
- }
3556
- return ctx;
3557
- };
3558
- const useInvokeContext = () => {
3559
- const ctx = tryGetInvokeContext();
3560
- if (!ctx || "qRender" !== ctx.$event$) {
3561
- throw qError(QError.useInvokeContext);
3562
- }
3563
- return assertDefined(), assertDefined(), ctx;
3564
- };
3565
- function useBindInvokeContext(fn) {
3566
- if (null == fn) {
3567
- return fn;
3568
- }
3569
- const ctx = getInvokeContext();
3570
- return function(...args) {
3571
- return invokeApply.call(this, ctx, fn, args);
3572
- };
3573
- }
3574
- function invoke(context, fn, ...args) {
3575
- return invokeApply.call(this, context, fn, args);
3576
- }
3577
- function invokeApply(context, fn, args) {
3578
- const previousContext = _context;
3579
- let returnValue;
3580
- try {
3581
- _context = context, returnValue = fn.apply(this, args);
3582
- } finally {
3583
- _context = previousContext;
3584
- }
3585
- return returnValue;
3586
- }
3587
- const newInvokeContextFromTuple = ([element, event, url]) => {
3588
- const domContainer = getDomContainer(element);
3589
- const container = domContainer.element;
3590
- const vNode = container ? vnode_locate(domContainer.rootVNode, element) : void 0;
3591
- const locale = container?.getAttribute("q:locale") || void 0;
3592
- return locale && function(locale) {
3593
- _locale = locale;
3594
- }(locale), newInvokeContext(locale, vNode, element, event, url);
3595
- };
3596
- const newInvokeContext = (locale, hostElement, element, event, url) => {
3597
- const ctx = {
3598
- $url$: url,
3599
- $i$: 0,
3600
- $hostElement$: hostElement,
3601
- $element$: element,
3602
- $event$: event,
3603
- $qrl$: void 0,
3604
- $effectSubscriber$: void 0,
3605
- $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
3606
- $container$: void 0
3607
- };
3608
- return seal(), ctx;
3609
- };
3610
- const untrack = fn => invoke(void 0, fn);
3611
- const trackInvocation = /*#__PURE__*/ newInvokeContext(void 0, void 0, void 0, "qRender");
3612
- const trackSignal = (fn, subscriber, property, container, data) => {
3613
- const previousSubscriber = trackInvocation.$effectSubscriber$;
3614
- const previousContainer = trackInvocation.$container$;
3615
- try {
3616
- return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data),
3617
- trackInvocation.$container$ = container, invoke(trackInvocation, fn);
3618
- } finally {
3619
- trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
3620
- }
3621
- };
3622
- const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host),
3623
- trackSignal((() => value.value), host, property, container, data));
3624
- const createContextId = name => (assertTrue(/^[\w/.-]+$/.test(name)), /*#__PURE__*/ Object.freeze({
3625
- id: fromCamelToKebabCase(name)
3626
- }));
3627
- const useContextProvider = (context, newValue) => {
3628
- const {val, set, iCtx} = useSequentialScope();
3629
- void 0 === val && (iCtx.$container$.setContext(iCtx.$hostElement$, context, newValue),
3630
- set(1));
3631
- };
3632
- const ERROR_CONTEXT = /*#__PURE__*/ createContextId("qk-error");
3633
- function getDomContainer(element) {
3634
- const qContainerElement = _getQContainerElement(element);
3635
- if (!qContainerElement) {
3636
- throw qError(QError.containerNotFound);
3637
- }
3638
- return getDomContainerFromQContainerElement(qContainerElement);
3639
- }
3640
- function getDomContainerFromQContainerElement(qContainerElement) {
3641
- const qElement = qContainerElement;
3642
- let container = qElement.qContainer;
3643
- if (!container) {
3644
- container = new DomContainer(qElement);
3645
- const containerAttributes = {};
3646
- if (qElement) {
3647
- const attrs = qElement.attributes;
3648
- if (attrs) {
3649
- for (let index = 0; index < attrs.length; index++) {
3650
- const attr = attrs[index];
3651
- ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
3652
- }
3653
- }
3654
- }
3655
- container.$serverData$ = {
3656
- containerAttributes
3657
- }, qElement.setAttribute("q:container", QContainerValue.RESUMED), qElement.qContainer = container;
3658
- }
3659
- return container;
3660
- }
3661
- function _getQContainerElement(element) {
3662
- return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
3663
- }
3664
- const isDomContainer = container => container instanceof DomContainer;
3665
- class DomContainer extends _SharedContainer {
3666
- element;
3667
- qContainer;
3668
- qBase;
3669
- qManifestHash;
3670
- rootVNode;
3671
- document;
3672
- $journal$;
3673
- renderDone=null;
3674
- $rawStateData$;
3675
- $storeProxyMap$=new WeakMap;
3676
- $qFuncs$;
3677
- $instanceHash$;
3678
- vNodeLocate=id => vnode_locate(this.rootVNode, id);
3679
- $stateData$;
3680
- $styleIds$=null;
3681
- $renderCount$=0;
3682
- constructor(element) {
3683
- if (super((() => this.scheduleRender()), (() => vnode_applyJournal(this.$journal$)), {}, element.getAttribute("q:locale")),
3684
- this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
3685
- throw qError(QError.elementWithoutContainer);
3686
- }
3687
- this.$journal$ = [ VNodeJournalOpCode.HoistStyles, element.ownerDocument ], this.document = element.ownerDocument,
3688
- this.element = element, this.qBase = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"),
3689
- this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element),
3690
- this.$rawStateData$ = null, this.$stateData$ = null;
3691
- const document = this.element.ownerDocument;
3692
- document.qVNodeData || function(document) {
3693
- const vNodeDataMap = document.qVNodeData || (document.qVNodeData = new WeakMap);
3694
- const prototype = document.body;
3695
- const getAttribute = prototype.getAttribute;
3696
- const hasAttribute = prototype.hasAttribute;
3697
- const getNodeType = ((prototype, name) => {
3698
- let getter;
3699
- for (;prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
3700
- prototype = Object.getPrototypeOf(prototype);
3701
- }
3702
- return getter || function() {
3703
- return this[name];
3704
- };
3705
- })(prototype, "nodeType");
3706
- const attachVnodeDataAndRefs = element => {
3707
- Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script => {
3708
- script.setAttribute("type", "x-qwik/vnode");
3709
- const qContainerElement = script.closest("[q\\:container]");
3710
- qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = new Map;
3711
- })), element.querySelectorAll("[q\\:shadowroot]").forEach((parent => {
3712
- const shadowRoot = parent.shadowRoot;
3713
- shadowRoot && attachVnodeDataAndRefs(shadowRoot);
3714
- }));
3715
- };
3716
- let NodeType;
3717
- attachVnodeDataAndRefs(document), function(NodeType) {
3718
- NodeType[NodeType.CONTAINER_MASK = 1] = "CONTAINER_MASK", NodeType[NodeType.ELEMENT = 2] = "ELEMENT",
3719
- NodeType[NodeType.ELEMENT_CONTAINER = 3] = "ELEMENT_CONTAINER", NodeType[NodeType.ELEMENT_SHADOW_ROOT = 6] = "ELEMENT_SHADOW_ROOT",
3720
- NodeType[NodeType.COMMENT_SKIP_START = 5] = "COMMENT_SKIP_START", NodeType[NodeType.COMMENT_SKIP_END = 8] = "COMMENT_SKIP_END",
3721
- NodeType[NodeType.COMMENT_IGNORE_START = 16] = "COMMENT_IGNORE_START", NodeType[NodeType.COMMENT_IGNORE_END = 32] = "COMMENT_IGNORE_END",
3722
- NodeType[NodeType.COMMENT_ISLAND_START = 65] = "COMMENT_ISLAND_START", NodeType[NodeType.COMMENT_ISLAND_END = 128] = "COMMENT_ISLAND_END",
3723
- NodeType[NodeType.OTHER = 0] = "OTHER";
3724
- }(NodeType || (NodeType = {}));
3725
- const getFastNodeType = node => {
3726
- const nodeType = getNodeType.call(node);
3727
- if (1 === nodeType) {
3728
- return null === getAttribute.call(node, "q:container") ? hasAttribute.call(node, "q:shadowroot") ? NodeType.ELEMENT_SHADOW_ROOT : hasAttribute.call(node, ":") ? NodeType.ELEMENT : NodeType.OTHER : NodeType.ELEMENT_CONTAINER;
3729
- }
3730
- if (8 === nodeType) {
3731
- const nodeValue = node.nodeValue || "";
3732
- if (nodeValue.startsWith("q:container-island")) {
3733
- return NodeType.COMMENT_ISLAND_START;
3734
- }
3735
- if (nodeValue.startsWith("q:ignore")) {
3736
- return NodeType.COMMENT_IGNORE_START;
3737
- }
3738
- if (nodeValue.startsWith("q:container")) {
3739
- return NodeType.COMMENT_SKIP_START;
3740
- }
3741
- if (nodeValue.startsWith("/q:container-island")) {
3742
- return NodeType.COMMENT_ISLAND_END;
3743
- }
3744
- if (nodeValue.startsWith("/q:ignore")) {
3745
- return NodeType.COMMENT_IGNORE_END;
3746
- }
3747
- if (nodeValue.startsWith("/q:container")) {
3748
- return NodeType.COMMENT_SKIP_END;
3749
- }
3750
- }
3751
- return NodeType.OTHER;
3752
- };
3753
- const isSeparator = ch => VNodeDataSeparator_ADVANCE_1 <= ch && ch <= VNodeDataSeparator_ADVANCE_8192;
3754
- const findVDataSectionEnd = (vData, start, end) => {
3755
- let depth = 0;
3756
- for (;start < end; ) {
3757
- const ch = vData.charCodeAt(start);
3758
- if (0 === depth && isSeparator(ch)) {
3759
- break;
3760
- }
3761
- ch === VNodeDataChar_OPEN ? depth++ : ch === VNodeDataChar_CLOSE && depth--, start++;
3762
- }
3763
- return start;
3764
- };
3765
- const nextSibling = node => {
3766
- for (;node && (node = node.nextSibling) && getFastNodeType(node) === NodeType.OTHER; ) {}
3767
- return node;
3768
- };
3769
- const firstChild = node => {
3770
- for (;node && (node = node.firstChild) && getFastNodeType(node) === NodeType.OTHER; ) {}
3771
- return node;
3772
- };
3773
- const walkContainer = (walker, containerNode, node, exitNode, vData, qVNodeRefs) => {
3774
- const vData_length = vData.length;
3775
- let elementIdx = 0;
3776
- let vNodeElementIndex = -1;
3777
- let vData_start = 0;
3778
- let vData_end = 0;
3779
- let ch = 0;
3780
- let needsToStoreRef = -1;
3781
- let nextNode = null;
3782
- const howManyElementsToSkip = () => {
3783
- let elementsToSkip = 0;
3784
- for (;isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator_ADVANCE_1,
3785
- vData_start++, !(vData_start >= vData_length)); ) {}
3786
- return elementsToSkip;
3787
- };
3788
- do {
3789
- if (node === exitNode) {
3790
- return;
3791
- }
3792
- nextNode = null;
3793
- const nodeType = node == containerNode ? NodeType.ELEMENT : getFastNodeType(node);
3794
- if (nodeType === NodeType.ELEMENT_CONTAINER) {
3795
- const container = node;
3796
- let cursor = node;
3797
- for (;cursor && !(nextNode = nextSibling(cursor)); ) {
3798
- cursor = cursor.parentNode;
3799
- }
3800
- walkContainer(walker, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
3801
- } else if (nodeType === NodeType.COMMENT_IGNORE_START) {
3802
- let islandNode = node;
3803
- do {
3804
- if (islandNode = walker.nextNode(), !islandNode) {
3805
- throw new Error(`Island inside \x3c!--${node?.nodeValue}--\x3e not found!`);
3806
- }
3807
- } while (getFastNodeType(islandNode) !== NodeType.COMMENT_ISLAND_START);
3808
- nextNode = null;
3809
- } else if (nodeType === NodeType.COMMENT_ISLAND_END) {
3810
- nextNode = node;
3811
- do {
3812
- if (nextNode = walker.nextNode(), !nextNode) {
3813
- throw new Error("Ignore block not closed!");
3814
- }
3815
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_IGNORE_END);
3816
- nextNode = null;
3817
- } else if (nodeType === NodeType.COMMENT_SKIP_START) {
3818
- nextNode = node;
3819
- do {
3820
- if (nextNode = nextSibling(nextNode), !nextNode) {
3821
- throw new Error(`\x3c!--${node?.nodeValue}--\x3e not closed!`);
3822
- }
3823
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_SKIP_END);
3824
- walkContainer(walker, node, node, nextNode, "", null);
3825
- } else if (nodeType === NodeType.ELEMENT_SHADOW_ROOT) {
3826
- nextNode = nextSibling(node);
3827
- const shadowRootContainer = node;
3828
- const shadowRoot = shadowRootContainer?.shadowRoot;
3829
- shadowRoot && walkContainer(document.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
3830
- }
3831
- if ((nodeType & NodeType.ELEMENT) === NodeType.ELEMENT) {
3832
- if (vNodeElementIndex < elementIdx && (-1 === vNodeElementIndex && (vNodeElementIndex = 0),
3833
- vData_start = vData_end, vData_start < vData_length ? (vNodeElementIndex += howManyElementsToSkip(),
3834
- ch === VNodeDataSeparator_REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++,
3835
- ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator_ADVANCE_1),
3836
- vData_end = findVDataSectionEnd(vData, vData_start, vData_length)) : vNodeElementIndex = Number.MAX_SAFE_INTEGER),
3837
- elementIdx === vNodeElementIndex) {
3838
- needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
3839
- const instructions = vData.substring(vData_start, vData_end);
3840
- vNodeDataMap.set(node, instructions);
3841
- }
3842
- elementIdx++;
3843
- }
3844
- } while (node = nextNode || walker.nextNode());
3845
- };
3846
- const walker = document.createTreeWalker(document, 129);
3847
- walkContainer(walker, null, walker.firstChild(), null, "", null);
3848
- }(document), this.$rawStateData$ = [], this.$stateData$ = [];
3849
- const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
3850
- if (0 !== qwikStates.length) {
3851
- this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent),
3852
- this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
3853
- }
3854
- this.$qFuncs$ = getQFuncs(document, this.$instanceHash$) || EMPTY_ARRAY;
3855
- }
3856
- $setRawState$(id, vParent) {
3857
- this.$stateData$[id] = vParent;
3657
+ return [];
3658
+ };
3659
+ const vnode_setAttr = (journal, vnode, key, value) => {
3660
+ const type = vnode[0];
3661
+ if (3 & type) {
3662
+ vnode_ensureElementInflated(vnode);
3663
+ const props = vnode_getProps(vnode);
3664
+ const idx = mapApp_findIndx(props, key, 0);
3665
+ if (idx >= 0) {
3666
+ if (props[idx + 1] != value && 1 & type) {
3667
+ journal && journal.push(2, vnode[6], key, value);
3668
+ }
3669
+ null == value ? props.splice(idx, 2) : props[idx + 1] = value;
3670
+ } else if (null != value && (props.splice(~idx, 0, key, value), 1 & type)) {
3671
+ journal && journal.push(2, vnode[6], key, value);
3672
+ }
3858
3673
  }
3859
- parseQRL(qrl) {
3860
- return inflateQRL(this, parseQRL(qrl));
3674
+ };
3675
+ const vnode_getAttr = (vnode, key) => {
3676
+ if (3 & vnode[0]) {
3677
+ vnode_ensureElementInflated(vnode);
3678
+ const props = vnode_getProps(vnode);
3679
+ return mapArray_get(props, key, 0);
3861
3680
  }
3862
- handleError(err, host) {
3863
- const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
3864
- if (!errorStore) {
3865
- throw err;
3681
+ return null;
3682
+ };
3683
+ const vnode_getProp = (vnode, key, getObject) => {
3684
+ const type = vnode[0];
3685
+ if (3 & type) {
3686
+ 1 & type && vnode_ensureElementInflated(vnode);
3687
+ const props = vnode_getProps(vnode);
3688
+ const idx = mapApp_findIndx(props, key, 0);
3689
+ if (idx >= 0) {
3690
+ let value = props[idx + 1];
3691
+ return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)),
3692
+ value;
3866
3693
  }
3867
- errorStore.error = err;
3868
3694
  }
3869
- setContext(host, context, value) {
3870
- let ctx = this.getHostProp(host, "q:ctx");
3871
- ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
3695
+ return null;
3696
+ };
3697
+ const vnode_setProp = (vnode, key, value) => {
3698
+ ensureElementOrVirtualVNode(vnode);
3699
+ const props = vnode_getProps(vnode);
3700
+ const idx = mapApp_findIndx(props, key, 0);
3701
+ idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
3702
+ };
3703
+ const vnode_getProps = vnode => vnode[(vnode => {
3704
+ const type = 7 & vnode[0];
3705
+ if (1 === type) {
3706
+ return 8;
3872
3707
  }
3873
- resolveContext(host, contextId) {
3874
- for (;host; ) {
3875
- const ctx = this.getHostProp(host, "q:ctx");
3876
- if (ctx) {
3877
- const value = mapArray_get(ctx, contextId.id, 0);
3878
- if (value) {
3879
- return value;
3880
- }
3881
- }
3882
- host = this.getParentHost(host);
3883
- }
3708
+ if (2 === type) {
3709
+ return 6;
3884
3710
  }
3885
- getParentHost(host) {
3886
- let vNode = vnode_getParent(host);
3887
- for (;vNode; ) {
3888
- if (vnode_isVirtualVNode(vNode)) {
3889
- if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
3890
- return vNode;
3711
+ throw qError(43, [ type ]);
3712
+ })(vnode)];
3713
+ const vnode_getParent = vnode => vnode[1] || null;
3714
+ const vnode_getNode = vnode => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode)),
3715
+ vnode[4]);
3716
+ function vnode_toString(depth = 20, offset = "", materialize = !1, siblings = !1) {
3717
+ let vnode = this;
3718
+ if (0 === depth) {
3719
+ return "...";
3720
+ }
3721
+ if (null === vnode) {
3722
+ return "null";
3723
+ }
3724
+ if (void 0 === vnode) {
3725
+ return "undefined";
3726
+ }
3727
+ const strings = [];
3728
+ do {
3729
+ if (vnode_isTextVNode(vnode)) {
3730
+ strings.push(qwikDebugToString(vnode_getText(vnode)));
3731
+ } else if (vnode_isVirtualVNode(vnode)) {
3732
+ const attrs = [ "[" + String(vnode[0] >>> 8) + "]" ];
3733
+ vnode_getAttrKeys(vnode).forEach((key => {
3734
+ if (key !== DEBUG_TYPE) {
3735
+ const value = vnode_getAttr(vnode, key);
3736
+ attrs.push(" " + key + "=" + qwikDebugToString(value));
3891
3737
  }
3892
- vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
3738
+ }));
3739
+ const name = VirtualTypeName[vnode_getAttr(vnode, DEBUG_TYPE) || "V"] || VirtualTypeName.V;
3740
+ strings.push("<" + name + attrs.join("") + ">");
3741
+ const child = vnode_getFirstChild(vnode);
3742
+ child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", !0, !0)),
3743
+ strings.push("</" + name + ">");
3744
+ } else if (vnode_isElementVNode(vnode)) {
3745
+ const tag = vnode_getElementName(vnode);
3746
+ const attrs = [];
3747
+ const keys = vnode_getAttrKeys(vnode);
3748
+ keys.forEach((key => {
3749
+ const value = vnode_getAttr(vnode, key);
3750
+ attrs.push(" " + key + "=" + qwikDebugToString(value));
3751
+ }));
3752
+ const node = vnode_getNode(vnode);
3753
+ if (node) {
3754
+ const vnodeData = node.ownerDocument.qVNodeData?.get(node);
3755
+ vnodeData && attrs.push(" q:vnodeData=" + qwikDebugToString(vnodeData));
3756
+ }
3757
+ const domAttrs = node.attributes;
3758
+ for (let i = 0; i < domAttrs.length; i++) {
3759
+ const attr = domAttrs[i];
3760
+ -1 === keys.indexOf(attr.name) && attrs.push(" " + attr.name + (attr.value ? "=" + qwikDebugToString(attr.value) : ""));
3761
+ }
3762
+ if (strings.push("<" + tag + attrs.join("") + ">"), vnode_isMaterialized(vnode) || materialize) {
3763
+ const child = vnode_getFirstChild(vnode);
3764
+ child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", !0, !0));
3893
3765
  } else {
3894
- vNode = vnode_getParent(vNode);
3766
+ strings.push(" \x3c!-- not materialized --!>");
3895
3767
  }
3768
+ strings.push("</" + tag + ">");
3896
3769
  }
3897
- return null;
3898
- }
3899
- setHostProp(host, name, value) {
3900
- vnode_setProp(host, name, value);
3770
+ vnode = siblings && vnode_getNextSibling(vnode) || null;
3771
+ } while (vnode);
3772
+ return strings.join("\n" + offset);
3773
+ }
3774
+ const isNumber = ch => 48 <= ch && ch <= 57;
3775
+ const isLowercase = ch => 97 <= ch && ch <= 122;
3776
+ const stack = [];
3777
+ const vnode_getType = vnode => {
3778
+ const type = vnode[0];
3779
+ if (1 & type) {
3780
+ return 1;
3901
3781
  }
3902
- getHostProp(host, name) {
3903
- const vNode = host;
3904
- let getObjectById = null;
3905
- switch (name) {
3906
- case "q:seq":
3907
- case "q:props":
3908
- case "q:renderFn":
3909
- case "q:ctx":
3910
- case "q:brefs":
3911
- getObjectById = this.$getObjectById$;
3912
- break;
3913
-
3914
- case "q:seqIdx":
3915
- case ":onIdx":
3916
- getObjectById = parseInt;
3917
- }
3918
- return vnode_getProp(vNode, name, getObjectById);
3782
+ if (2 & type) {
3783
+ return 11;
3919
3784
  }
3920
- scheduleRender() {
3921
- return this.$renderCount$++, this.renderDone ||= getPlatform().nextTick((() => this.processChores())),
3922
- this.renderDone.finally((() => emitEvent("qrender", {
3923
- instanceHash: this.$instanceHash$,
3924
- renderCount: this.$renderCount$
3925
- })));
3785
+ if (4 & type) {
3786
+ return 3;
3926
3787
  }
3927
- processChores() {
3928
- let renderCount = this.$renderCount$;
3929
- const result = this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3930
- if (isPromise(result)) {
3931
- return result.then((async () => {
3932
- for (;renderCount !== this.$renderCount$; ) {
3933
- renderCount = this.$renderCount$, await this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3934
- }
3935
- this.renderDone = null;
3936
- }));
3788
+ throw qError(43, [ type ]);
3789
+ };
3790
+ const isElement = node => node && "object" == typeof node && 1 === fastNodeType(node);
3791
+ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
3792
+ let projectionDepth = 1;
3793
+ for (;projectionDepth--; ) {
3794
+ for (;vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
3795
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", (id => vnode_locate(rootVNode, id)));
3796
+ const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
3797
+ vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
3937
3798
  }
3938
- renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
3799
+ projectionDepth > 0 && (vHost = vnode_getParent(vHost));
3939
3800
  }
3940
- ensureProjectionResolved(vNode) {
3941
- if (!(vNode[VNodeProps.flags] & VNodeFlags.Resolved)) {
3942
- vNode[VNodeProps.flags] |= VNodeFlags.Resolved;
3943
- const props = vnode_getProps(vNode);
3944
- for (let i = 0; i < props.length; i += 2) {
3945
- if (isSlotProp(props[i])) {
3946
- const value = props[i + 1];
3947
- "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
3948
- }
3949
- }
3950
- }
3801
+ return vHost;
3802
+ };
3803
+ const VNodeArray = class VNode extends Array {
3804
+ static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
3805
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
3951
3806
  }
3952
- $getObjectById$=id => ("string" == typeof id && (id = parseFloat(id)), assertTrue(),
3953
- this.$stateData$[id]);
3954
- getSyncFn(id) {
3955
- const fn = this.$qFuncs$[id];
3956
- return assertTrue(), fn;
3807
+ static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
3808
+ return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
3957
3809
  }
3958
- $appendStyle$(content, styleId, host, scoped) {
3959
- if (scoped) {
3960
- const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
3961
- const scopedStyleIds = new Set(function(scopedStyleIds) {
3962
- return scopedStyleIds?.split(" ") ?? null;
3963
- }(scopedStyleIdsString));
3964
- scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", function(scopedStyleIds) {
3965
- return Array.from(scopedStyleIds).join(" ");
3966
- }(scopedStyleIds));
3967
- }
3968
- if (null == this.$styleIds$ && (this.$styleIds$ = new Set, this.element.querySelectorAll("style[q\\:style]").forEach((style => {
3969
- this.$styleIds$.add(style.getAttribute("q:style"));
3970
- }))), !this.$styleIds$.has(styleId)) {
3971
- this.$styleIds$.add(styleId);
3972
- const styleElement = this.document.createElement("style");
3973
- styleElement.setAttribute("q:style", styleId), styleElement.textContent = content,
3974
- this.$journal$.push(VNodeJournalOpCode.Insert, this.document.head, null, styleElement);
3975
- }
3810
+ static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
3811
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
3976
3812
  }
3977
- }
3813
+ constructor(flags, parent, previousSibling, nextSibling, ...rest) {
3814
+ super(flags, parent, previousSibling, nextSibling, ...rest), build.isDev && (this.toString = vnode_toString);
3815
+ }
3816
+ };
3978
3817
  const deserializedProxyMap = new WeakMap;
3979
3818
  const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
3980
3819
  const wrapDeserializerProxy = (container, data) => {
@@ -4012,7 +3851,7 @@
4012
3851
  }
4013
3852
  const container = this.$container$;
4014
3853
  let propValue = allocate(container, typeId, value);
4015
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
3854
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)),
4016
3855
  Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue,
4017
3856
  propValue;
4018
3857
  }
@@ -4037,19 +3876,19 @@
4037
3876
  if (void 0 === typeId) {
4038
3877
  return target;
4039
3878
  }
4040
- switch (typeId !== TypeIds.Object && Array.isArray(data) && (data = ((container, data) => {
3879
+ switch (13 !== typeId && Array.isArray(data) && (data = ((container, data) => {
4041
3880
  const out = Array(data.length / 2);
4042
3881
  for (let i = 0; i < data.length; i += 2) {
4043
3882
  out[i / 2] = deserializeData(container, data[i], data[i + 1]);
4044
3883
  }
4045
3884
  return out;
4046
3885
  })(container, data)), typeId) {
4047
- case TypeIds.Object:
3886
+ case 13:
4048
3887
  for (let i = 0; i < data.length; i += 4) {
4049
3888
  const key = deserializeData(container, data[i], data[i + 1]);
4050
3889
  const valType = data[i + 2];
4051
3890
  const valData = data[i + 3];
4052
- valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
3891
+ 0 === valType || valType >= 12 ? Object.defineProperty(target, key, {
4053
3892
  get() {
4054
3893
  const value = deserializeData(container, valType, valData);
4055
3894
  return target[key] = value, value;
@@ -4068,18 +3907,18 @@
4068
3907
  }
4069
3908
  break;
4070
3909
 
4071
- case TypeIds.QRL:
3910
+ case 18:
4072
3911
  inflateQRL(container, target);
4073
3912
  break;
4074
3913
 
4075
- case TypeIds.Task:
3914
+ case 19:
4076
3915
  const task = target;
4077
3916
  const v = data;
4078
3917
  task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2],
4079
3918
  task.$el$ = v[3], task[_EFFECT_BACK_REF] = v[4], task.$state$ = v[5];
4080
3919
  break;
4081
3920
 
4082
- case TypeIds.Resource:
3921
+ case 20:
4083
3922
  const [resolved, result, effects] = data;
4084
3923
  const resource = target;
4085
3924
  resolved ? (resource.value = Promise.resolve(result), resource._resolved = result,
@@ -4087,12 +3926,12 @@
4087
3926
  resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
4088
3927
  break;
4089
3928
 
4090
- case TypeIds.Component:
3929
+ case 21:
4091
3930
  target[SERIALIZABLE_STATE][0] = data[0];
4092
3931
  break;
4093
3932
 
4094
- case TypeIds.Store:
4095
- case TypeIds.StoreArray:
3933
+ case 26:
3934
+ case 27:
4096
3935
  {
4097
3936
  const [value, flags, effects] = data;
4098
3937
  const store = getOrCreateStore(value, flags, container);
@@ -4100,7 +3939,7 @@
4100
3939
  break;
4101
3940
  }
4102
3941
 
4103
- case TypeIds.Signal:
3942
+ case 22:
4104
3943
  {
4105
3944
  const signal = target;
4106
3945
  const d = data;
@@ -4108,7 +3947,7 @@
4108
3947
  break;
4109
3948
  }
4110
3949
 
4111
- case TypeIds.WrappedSignal:
3950
+ case 23:
4112
3951
  {
4113
3952
  const signal = target;
4114
3953
  const d = data;
@@ -4118,23 +3957,25 @@
4118
3957
  break;
4119
3958
  }
4120
3959
 
4121
- case TypeIds.ComputedSignal:
3960
+ case 25:
3961
+ case 24:
4122
3962
  {
4123
3963
  const computed = target;
4124
3964
  const d = data;
4125
- computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID,
4126
- computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3965
+ computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
3966
+ d.length > 2 ? (computed.$untrackedValue$ = d[2], 25 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1,
3967
+ computed.$computeQrl$.resolve(), container.$scheduler$?.(1, null, computed.$computeQrl$));
4127
3968
  break;
4128
3969
  }
4129
3970
 
4130
- case TypeIds.Error:
3971
+ case 12:
4131
3972
  {
4132
3973
  const d = data;
4133
3974
  target.message = d[0];
4134
3975
  const second = d[1];
4135
3976
  if (second && Array.isArray(second)) {
4136
3977
  for (let i = 0; i < second.length; i++) {
4137
- target[second[i++]] = d[i];
3978
+ target[second[i++]] = second[i];
4138
3979
  }
4139
3980
  target.stack = d[2];
4140
3981
  } else {
@@ -4143,7 +3984,7 @@
4143
3984
  break;
4144
3985
  }
4145
3986
 
4146
- case TypeIds.FormData:
3987
+ case 28:
4147
3988
  {
4148
3989
  const formData = target;
4149
3990
  const d = data;
@@ -4153,7 +3994,7 @@
4153
3994
  break;
4154
3995
  }
4155
3996
 
4156
- case TypeIds.JSXNode:
3997
+ case 29:
4157
3998
  {
4158
3999
  const jsx = target;
4159
4000
  const [type, varProps, constProps, children, flags, key] = data;
@@ -4162,7 +4003,7 @@
4162
4003
  break;
4163
4004
  }
4164
4005
 
4165
- case TypeIds.Set:
4006
+ case 15:
4166
4007
  {
4167
4008
  const set = target;
4168
4009
  const d = data;
@@ -4172,7 +4013,7 @@
4172
4013
  break;
4173
4014
  }
4174
4015
 
4175
- case TypeIds.Map:
4016
+ case 16:
4176
4017
  {
4177
4018
  const map = target;
4178
4019
  const d = data;
@@ -4182,7 +4023,7 @@
4182
4023
  break;
4183
4024
  }
4184
4025
 
4185
- case TypeIds.Promise:
4026
+ case 14:
4186
4027
  {
4187
4028
  const promise = target;
4188
4029
  const [resolved, result] = data;
@@ -4191,7 +4032,7 @@
4191
4032
  break;
4192
4033
  }
4193
4034
 
4194
- case TypeIds.Uint8Array:
4035
+ case 17:
4195
4036
  const bytes = target;
4196
4037
  const buf = atob(data);
4197
4038
  let i = 0;
@@ -4200,12 +4041,12 @@
4200
4041
  }
4201
4042
  break;
4202
4043
 
4203
- case TypeIds.PropsProxy:
4044
+ case 30:
4204
4045
  const propsProxy = target;
4205
4046
  propsProxy[_VAR_PROPS] = 0 === data ? {} : data[0], propsProxy[_CONST_PROPS] = data[1];
4206
4047
  break;
4207
4048
 
4208
- case TypeIds.EffectData:
4049
+ case 31:
4209
4050
  {
4210
4051
  const effectData = target;
4211
4052
  effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
@@ -4213,7 +4054,7 @@
4213
4054
  }
4214
4055
 
4215
4056
  default:
4216
- throw qError(QError.serializeErrorNotImplemented, [ typeId ]);
4057
+ throw qError(33, [ typeId ]);
4217
4058
  }
4218
4059
  return target;
4219
4060
  };
@@ -4223,84 +4064,85 @@
4223
4064
  return typeId;
4224
4065
  }
4225
4066
  switch (typeId) {
4226
- case TypeIds.RootRef:
4067
+ case 0:
4227
4068
  return container.$getObjectById$(value);
4228
4069
 
4229
- case TypeIds.Constant:
4070
+ case 1:
4230
4071
  return _constants[value];
4231
4072
 
4232
- case TypeIds.Number:
4073
+ case 2:
4074
+ case 3:
4233
4075
  return value;
4234
4076
 
4235
- case TypeIds.Array:
4077
+ case 4:
4236
4078
  return wrapDeserializerProxy(container, value);
4237
4079
 
4238
- case TypeIds.Object:
4080
+ case 13:
4239
4081
  return {};
4240
4082
 
4241
- case TypeIds.QRL:
4083
+ case 18:
4242
4084
  return parseQRL(container.$getObjectById$(value));
4243
4085
 
4244
- case TypeIds.Task:
4086
+ case 19:
4245
4087
  return new Task(-1, -1, null, null, null, null);
4246
4088
 
4247
- case TypeIds.Resource:
4089
+ case 20:
4248
4090
  {
4249
4091
  const res = createResourceReturn(container, void 0, void 0);
4250
4092
  return res.loading = !1, res;
4251
4093
  }
4252
4094
 
4253
- case TypeIds.URL:
4095
+ case 5:
4254
4096
  return new URL(value);
4255
4097
 
4256
- case TypeIds.Date:
4098
+ case 6:
4257
4099
  return new Date(value);
4258
4100
 
4259
- case TypeIds.Regex:
4101
+ case 7:
4260
4102
  const idx = value.lastIndexOf("/");
4261
4103
  return new RegExp(value.slice(1, idx), value.slice(idx + 1));
4262
4104
 
4263
- case TypeIds.Error:
4105
+ case 12:
4264
4106
  return new Error;
4265
4107
 
4266
- case TypeIds.Component:
4108
+ case 21:
4267
4109
  return componentQrl(null);
4268
4110
 
4269
- case TypeIds.Signal:
4270
- return new Signal(container, 0);
4111
+ case 22:
4112
+ return new SignalImpl(container, 0);
4271
4113
 
4272
- case TypeIds.WrappedSignal:
4114
+ case 23:
4273
4115
  return new WrappedSignal(container, null, null, null);
4274
4116
 
4275
- case TypeIds.ComputedSignal:
4276
- return new ComputedSignal(container, null);
4117
+ case 24:
4118
+ return new ComputedSignalImpl(container, null);
4277
4119
 
4278
- case TypeIds.Store:
4279
- case TypeIds.StoreArray:
4120
+ case 25:
4121
+ return new SerializerSignalImpl(container, null);
4122
+
4123
+ case 26:
4124
+ case 27:
4280
4125
  return null;
4281
4126
 
4282
- case TypeIds.URLSearchParams:
4127
+ case 11:
4283
4128
  return new URLSearchParams(value);
4284
4129
 
4285
- case TypeIds.FormData:
4130
+ case 28:
4286
4131
  return new FormData;
4287
4132
 
4288
- case TypeIds.JSXNode:
4133
+ case 29:
4289
4134
  return new JSXNodeImpl(null, null, null, null, -1, null);
4290
4135
 
4291
- case TypeIds.BigInt:
4136
+ case 10:
4292
4137
  return BigInt(value);
4293
4138
 
4294
- case TypeIds.Set:
4139
+ case 15:
4295
4140
  return new Set;
4296
4141
 
4297
- case TypeIds.Map:
4142
+ case 16:
4298
4143
  return new Map;
4299
4144
 
4300
- case TypeIds.String:
4301
- return value;
4302
-
4303
- case TypeIds.Promise:
4145
+ case 14:
4304
4146
  let resolve;
4305
4147
  let reject;
4306
4148
  const promise = new Promise(((res, rej) => {
@@ -4308,29 +4150,29 @@
4308
4150
  }));
4309
4151
  return resolvers.set(promise, [ resolve, reject ]), promise.catch((() => {})), promise;
4310
4152
 
4311
- case TypeIds.Uint8Array:
4153
+ case 17:
4312
4154
  const encodedLength = value.length;
4313
4155
  const rest = 3 & encodedLength;
4314
4156
  return new Uint8Array(3 * (encodedLength >>> 2) + (rest ? rest - 1 : 0));
4315
4157
 
4316
- case TypeIds.PropsProxy:
4158
+ case 30:
4317
4159
  return createPropsProxy(null, null);
4318
4160
 
4319
- case TypeIds.VNode:
4161
+ case 8:
4320
4162
  return retrieveVNodeOrDocument(container, value);
4321
4163
 
4322
- case TypeIds.RefVNode:
4164
+ case 9:
4323
4165
  const vNode = retrieveVNodeOrDocument(container, value);
4324
4166
  if (vnode_isVNode(vNode)) {
4325
4167
  return vnode_getNode(vNode);
4326
4168
  }
4327
- throw qError(QError.serializeErrorExpectedVNode, [ typeof vNode ]);
4169
+ throw qError(34, [ typeof vNode ]);
4328
4170
 
4329
- case TypeIds.EffectData:
4171
+ case 31:
4330
4172
  return new SubscriptionData({});
4331
4173
 
4332
4174
  default:
4333
- throw qError(QError.serializeErrorCannotAllocate, [ typeId ]);
4175
+ throw qError(35, [ typeId ]);
4334
4176
  }
4335
4177
  };
4336
4178
  function retrieveVNodeOrDocument(container, value) {
@@ -4405,49 +4247,48 @@
4405
4247
  };
4406
4248
  const writeValue = (value, idx) => {
4407
4249
  if (fastSkipSerialize(value)) {
4408
- output(TypeIds.Constant, Constants.Undefined);
4250
+ output(1, 0);
4409
4251
  } else if ("bigint" == typeof value) {
4410
- output(TypeIds.BigInt, value.toString());
4252
+ output(10, value.toString());
4411
4253
  } else if ("boolean" == typeof value) {
4412
- output(TypeIds.Constant, value ? Constants.True : Constants.False);
4254
+ output(1, value ? 2 : 3);
4413
4255
  } else if ("function" == typeof value) {
4414
4256
  if (value === Slot) {
4415
- output(TypeIds.Constant, Constants.Slot);
4257
+ output(1, 9);
4416
4258
  } else if (value === Fragment) {
4417
- output(TypeIds.Constant, Constants.Fragment);
4259
+ output(1, 10);
4418
4260
  } else if (isQrl$1(value)) {
4419
4261
  const qrl = qrlToString(serializationContext, value);
4420
4262
  const id = serializationContext.$addRoot$(qrl);
4421
- output(TypeIds.QRL, id);
4263
+ output(18, id);
4422
4264
  } else if (isQwikComponent(value)) {
4423
4265
  const [qrl] = value[SERIALIZABLE_STATE];
4424
- serializationContext.$renderSymbols$.add(qrl.$symbol$), output(TypeIds.Component, [ qrl ]);
4266
+ serializationContext.$renderSymbols$.add(qrl.$symbol$), output(21, [ qrl ]);
4425
4267
  } else {
4426
4268
  console.error("Cannot serialize function (ignoring for now): " + value.toString()),
4427
- output(TypeIds.Constant, Constants.Undefined);
4269
+ output(1, 0);
4428
4270
  }
4429
4271
  } else if ("number" == typeof value) {
4430
- Number.isNaN(value) ? output(TypeIds.Constant, Constants.NaN) : Number.isFinite(value) ? value === Number.MAX_SAFE_INTEGER ? output(TypeIds.Constant, Constants.MaxSafeInt) : value === Number.MAX_SAFE_INTEGER - 1 ? output(TypeIds.Constant, Constants.AlmostMaxSafeInt) : value === Number.MIN_SAFE_INTEGER ? output(TypeIds.Constant, Constants.MinSafeInt) : output(TypeIds.Number, value) : output(TypeIds.Constant, value < 0 ? Constants.NegativeInfinity : Constants.PositiveInfinity);
4272
+ Number.isNaN(value) ? output(1, 11) : Number.isFinite(value) ? value === Number.MAX_SAFE_INTEGER ? output(1, 14) : value === Number.MAX_SAFE_INTEGER - 1 ? output(1, 15) : value === Number.MIN_SAFE_INTEGER ? output(1, 16) : output(2, value) : output(1, value < 0 ? 13 : 12);
4431
4273
  } else if ("object" == typeof value) {
4432
- value === EMPTY_ARRAY ? output(TypeIds.Constant, Constants.EMPTY_ARRAY) : value === EMPTY_OBJ ? output(TypeIds.Constant, Constants.EMPTY_OBJ) : (depth++,
4433
- null === value ? output(TypeIds.Constant, Constants.Null) : writeObjectValue(value, idx),
4434
- depth--);
4274
+ value === EMPTY_ARRAY ? output(1, 5) : value === EMPTY_OBJ ? output(1, 6) : null === value ? output(1, 1) : (depth++,
4275
+ writeObjectValue(value, idx), depth--);
4435
4276
  } else if ("string" == typeof value) {
4436
4277
  if (0 === value.length) {
4437
- output(TypeIds.Constant, Constants.EmptyString);
4278
+ output(1, 4);
4438
4279
  } else {
4439
4280
  const seen = depth > 1 && serializationContext.$wasSeen$(value);
4440
- "number" == typeof seen && seen >= 0 ? output(TypeIds.RootRef, seen) : output(TypeIds.String, value);
4281
+ "number" == typeof seen && seen >= 0 ? output(0, seen) : output(3, value);
4441
4282
  }
4442
4283
  } else if (void 0 === value) {
4443
- output(TypeIds.Constant, Constants.Undefined);
4284
+ output(1, 0);
4444
4285
  } else if (value === NEEDS_COMPUTATION) {
4445
- output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
4286
+ output(1, 7);
4446
4287
  } else {
4447
4288
  if (value !== STORE_ALL_PROPS) {
4448
- throw qError(QError.serializeErrorUnknownType, [ typeof value ]);
4289
+ throw qError(37, [ typeof value ]);
4449
4290
  }
4450
- output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
4291
+ output(1, 8);
4451
4292
  }
4452
4293
  };
4453
4294
  const writeObjectValue = (value, idx) => {
@@ -4455,16 +4296,16 @@
4455
4296
  if (depth > 2) {
4456
4297
  const seen = serializationContext.$wasSeen$(value);
4457
4298
  if ("number" == typeof seen && seen >= 0) {
4458
- return void output(TypeIds.RootRef, seen);
4299
+ return void output(0, seen);
4459
4300
  }
4460
4301
  }
4461
4302
  if (isPropsProxy(value)) {
4462
4303
  const varProps = value[_VAR_PROPS];
4463
4304
  const constProps = value[_CONST_PROPS];
4464
4305
  const out = constProps ? [ varProps, constProps ] : Object.keys(varProps).length ? [ varProps ] : 0;
4465
- output(TypeIds.PropsProxy, out);
4306
+ output(30, out);
4466
4307
  } else if (value instanceof SubscriptionData) {
4467
- output(TypeIds.EffectData, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
4308
+ output(31, [ value.data.$scopedStyleIdPrefix$, value.data.$isConst$ ]);
4468
4309
  } else if (isStore(value)) {
4469
4310
  if (function(value) {
4470
4311
  return "__brand" in value && "resource" === value.__brand;
@@ -4472,9 +4313,9 @@
4472
4313
  serializationContext.$resources$.add(value);
4473
4314
  const res = promiseResults.get(value.value);
4474
4315
  if (!res) {
4475
- throw qError(QError.serializeErrorUnvisited, [ "resource" ]);
4316
+ throw qError(38, [ "resource" ]);
4476
4317
  }
4477
- output(TypeIds.Resource, [ ...res, getStoreHandler(value).$effects$ ]);
4318
+ output(20, [ ...res, getStoreHandler(value).$effects$ ]);
4478
4319
  } else {
4479
4320
  const storeHandler = getStoreHandler(value);
4480
4321
  const storeTarget = getStoreTarget(value);
@@ -4492,94 +4333,106 @@
4492
4333
  for (;null == out[out.length - 1]; ) {
4493
4334
  out.pop();
4494
4335
  }
4495
- output(Array.isArray(storeTarget) ? TypeIds.StoreArray : TypeIds.Store, out);
4336
+ output(Array.isArray(storeTarget) ? 27 : 26, out);
4337
+ }
4338
+ } else if (isSerializerObj(value)) {
4339
+ let result = serializationResults.get(value);
4340
+ if (isPromise(result)) {
4341
+ const promiseResult = promiseResults.get(result);
4342
+ if (!promiseResult[0]) {
4343
+ throw console.error(promiseResult[1]), qError(50);
4344
+ }
4345
+ result = promiseResult[1];
4496
4346
  }
4347
+ depth--, writeValue(result, idx), depth++;
4497
4348
  } else if (isObjectLiteral(value)) {
4498
4349
  if (Array.isArray(value)) {
4499
- output(TypeIds.Array, value);
4350
+ output(4, value);
4500
4351
  } else {
4501
4352
  const out = [];
4502
4353
  for (const key in value) {
4503
4354
  Object.prototype.hasOwnProperty.call(value, key) && !fastSkipSerialize(value[key]) && out.push(key, value[key]);
4504
4355
  }
4505
- output(TypeIds.Object, out);
4356
+ output(13, out);
4506
4357
  }
4507
4358
  } else if ($isDomRef$(value)) {
4508
- value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
4509
- } else if (value instanceof Signal) {
4510
- const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
4359
+ value.$ssrNode$.vnodeData[0] |= 16, output(9, value.$ssrNode$.id);
4360
+ } else if (value instanceof SignalImpl) {
4361
+ const isSerialized = value instanceof SerializerSignalImpl;
4362
+ const v = !isSerialized && value instanceof ComputedSignalImpl && (1 & value.$flags$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
4511
4363
  if (value instanceof WrappedSignal) {
4512
- output(TypeIds.WrappedSignal, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
4513
- } else if (value instanceof ComputedSignal) {
4364
+ output(23, [ ...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || [] ]);
4365
+ } else if (value instanceof ComputedSignalImpl) {
4514
4366
  const out = [ value.$computeQrl$, value.$effects$ ];
4515
- v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
4367
+ v !== NEEDS_COMPUTATION && out.push(isSerialized ? serializationResults.get(value) : v),
4368
+ output(isSerialized ? 25 : 24, out);
4516
4369
  } else {
4517
- output(TypeIds.Signal, [ v, ...value.$effects$ || [] ]);
4370
+ output(22, [ v, ...value.$effects$ || [] ]);
4518
4371
  }
4519
4372
  } else if (value instanceof URL) {
4520
- output(TypeIds.URL, value.href);
4373
+ output(5, value.href);
4521
4374
  } else if (value instanceof Date) {
4522
- output(TypeIds.Date, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
4375
+ output(6, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
4523
4376
  } else if (value instanceof RegExp) {
4524
- output(TypeIds.Regex, value.toString());
4377
+ output(7, value.toString());
4525
4378
  } else if (value instanceof Error) {
4526
4379
  const out = [ value.message ];
4527
4380
  const extraProps = Object.entries(value).flat();
4528
- extraProps.length && out.push(extraProps), out.push(value.stack), output(TypeIds.Error, out);
4381
+ extraProps.length && out.push(extraProps), out.push(value.stack), output(12, out);
4529
4382
  } else if ($isSsrNode$(value)) {
4530
4383
  if (isRootObject) {
4531
- $setProp$(value, "q:id", String(idx)), output(TypeIds.VNode, value.id);
4384
+ $setProp$(value, "q:id", String(idx)), output(8, value.id);
4532
4385
  const vNodeData = value.vnodeData;
4533
- if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= VNodeDataFlag.SERIALIZE),
4386
+ if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= 16),
4534
4387
  value.childrenVNodeData) {
4535
4388
  for (const vNodeData of value.childrenVNodeData) {
4536
- vNodeData[0] |= VNodeDataFlag.SERIALIZE;
4389
+ vNodeData[0] |= 16;
4537
4390
  }
4538
4391
  }
4539
4392
  } else {
4540
- serializationContext.$addRoot$(value), output(TypeIds.RootRef, serializationContext.$roots$.length - 1);
4393
+ serializationContext.$addRoot$(value), output(0, serializationContext.$roots$.length - 1);
4541
4394
  }
4542
4395
  } else if ("undefined" != typeof FormData && value instanceof FormData) {
4543
4396
  const array = [];
4544
4397
  value.forEach(((value, key) => {
4545
4398
  array.push(key, "string" == typeof value ? value : value.name);
4546
- })), output(TypeIds.FormData, array);
4399
+ })), output(28, array);
4547
4400
  } else if (value instanceof URLSearchParams) {
4548
- output(TypeIds.URLSearchParams, value.toString());
4401
+ output(11, value.toString());
4549
4402
  } else if (value instanceof Set) {
4550
- output(TypeIds.Set, [ ...value.values() ]);
4403
+ output(15, [ ...value.values() ]);
4551
4404
  } else if (value instanceof Map) {
4552
4405
  const combined = [];
4553
4406
  for (const [k, v] of value.entries()) {
4554
4407
  combined.push(k, v);
4555
4408
  }
4556
- output(TypeIds.Map, combined);
4409
+ output(16, combined);
4557
4410
  } else if (isJSXNode(value)) {
4558
- output(TypeIds.JSXNode, [ value.type, value.varProps, value.constProps, value.children, value.flags, value.key ]);
4411
+ output(29, [ value.type, value.varProps, value.constProps, value.children, value.flags, value.key ]);
4559
4412
  } else if (value instanceof Task) {
4560
4413
  const out = [ value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$ ];
4561
4414
  for (;null == out[out.length - 1]; ) {
4562
4415
  out.pop();
4563
4416
  }
4564
- output(TypeIds.Task, out);
4417
+ output(19, out);
4565
4418
  } else if (isPromise(value)) {
4566
4419
  const res = promiseResults.get(value);
4567
4420
  if (!res) {
4568
- throw qError(QError.serializeErrorUnvisited, [ "promise" ]);
4421
+ throw qError(38, [ "promise" ]);
4569
4422
  }
4570
- output(TypeIds.Promise, res);
4423
+ output(14, res);
4571
4424
  } else if (value instanceof Uint8Array) {
4572
4425
  let buf = "";
4573
4426
  for (const c of value) {
4574
4427
  buf += String.fromCharCode(c);
4575
4428
  }
4576
4429
  const out = btoa(buf).replace(/=+$/, "");
4577
- output(TypeIds.Uint8Array, out);
4430
+ output(17, out);
4578
4431
  } else {
4579
4432
  if (!vnode_isVNode(value)) {
4580
- throw qError(QError.serializeErrorUnknownType, [ typeof value ]);
4433
+ throw qError(37, [ typeof value ]);
4581
4434
  }
4582
- output(TypeIds.Constant, Constants.Undefined);
4435
+ output(1, 0);
4583
4436
  }
4584
4437
  };
4585
4438
  writeValue(serializationContext.$roots$, -1);
@@ -4599,7 +4452,7 @@
4599
4452
  $getRootId$: obj => {
4600
4453
  const id = map.get(obj);
4601
4454
  if (!id || -1 === id) {
4602
- throw qError(QError.serializeErrorMissingRootId, [ obj ]);
4455
+ throw qError(36, [ obj ]);
4603
4456
  }
4604
4457
  return id;
4605
4458
  },
@@ -4649,11 +4502,16 @@
4649
4502
  obj.forEach(((v, k) => {
4650
4503
  discoveredValues.push(k, v);
4651
4504
  }));
4652
- } else if (obj instanceof Signal) {
4653
- const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
4654
- v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$),
4505
+ } else if (obj instanceof SignalImpl) {
4506
+ const toSerialize = obj instanceof ComputedSignalImpl && !(obj instanceof SerializerSignalImpl) && (1 & obj.$flags$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
4507
+ toSerialize !== NEEDS_COMPUTATION && (obj instanceof SerializerSignalImpl ? promises.push(obj.$computeQrl$.resolve().then((arg => {
4508
+ let data;
4509
+ arg.serialize ? data = arg.serialize(toSerialize) : SerializerSymbol in toSerialize && (data = toSerialize[SerializerSymbol](toSerialize)),
4510
+ void 0 === data && (data = NEEDS_COMPUTATION), serializationResults.set(obj, data),
4511
+ discoveredValues.push(data);
4512
+ }))) : discoveredValues.push(toSerialize)), obj.$effects$ && discoveredValues.push(obj.$effects$),
4655
4513
  obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
4656
- obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
4514
+ obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignalImpl && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues),
4657
4515
  discoveredValues.push(obj.$computeQrl$));
4658
4516
  } else if (obj instanceof Task) {
4659
4517
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
@@ -4667,8 +4525,6 @@
4667
4525
  discoveredValues.push(obj.$ssrNode$.id);
4668
4526
  } else if (isJSXNode(obj)) {
4669
4527
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
4670
- } else if (Array.isArray(obj)) {
4671
- discoveredValues.push(...obj);
4672
4528
  } else if (isQrl$1(obj)) {
4673
4529
  obj.$captureRef$ && obj.$captureRef$.length && discoveredValues.push(...obj.$captureRef$);
4674
4530
  } else if (isPropsProxy(obj)) {
@@ -4681,9 +4537,14 @@
4681
4537
  })), promises.push(obj);
4682
4538
  } else if (obj instanceof SubscriptionData) {
4683
4539
  discoveredValues.push(obj.data);
4540
+ } else if (Array.isArray(obj)) {
4541
+ discoveredValues.push(...obj);
4542
+ } else if (isSerializerObj(obj)) {
4543
+ const result = obj[SerializerSymbol](obj);
4544
+ serializationResults.set(obj, result), discoveredValues.push(result);
4684
4545
  } else {
4685
4546
  if (!isObjectLiteral(obj)) {
4686
- throw qError(QError.serializeErrorUnknownType, [ obj ]);
4547
+ throw qError(37, [ obj ]);
4687
4548
  }
4688
4549
  Object.entries(obj).forEach((([key, value]) => {
4689
4550
  discoveredValues.push(key, value);
@@ -4730,12 +4591,12 @@
4730
4591
  effectsBackRefs && discoveredValues.push(effectsBackRefs);
4731
4592
  };
4732
4593
  const promiseResults = new WeakMap;
4594
+ const serializationResults = new WeakMap;
4733
4595
  function filterEffectBackRefs(effectBackRef) {
4734
4596
  let effectBackRefToSerialize = null;
4735
4597
  if (effectBackRef) {
4736
4598
  for (const [effectProp, effect] of effectBackRef) {
4737
- effect[EffectSubscriptionProp.BACK_REF] && (effectBackRefToSerialize ||= new Map,
4738
- effectBackRefToSerialize.set(effectProp, effect));
4599
+ effect[2] && (effectBackRefToSerialize ||= new Map, effectBackRefToSerialize.set(effectProp, effect));
4739
4600
  }
4740
4601
  }
4741
4602
  return effectBackRefToSerialize;
@@ -4763,7 +4624,7 @@
4763
4624
  chunk || (chunk = QRL_RUNTIME_CHUNK);
4764
4625
  }
4765
4626
  if (!chunk) {
4766
- throw qError(QError.qrlMissingChunk, [ value.$symbol$ ]);
4627
+ throw qError(31, [ value.$symbol$ ]);
4767
4628
  }
4768
4629
  chunk.startsWith("./") && (chunk = chunk.slice(2));
4769
4630
  }
@@ -4784,7 +4645,7 @@
4784
4645
  return value;
4785
4646
  }
4786
4647
  let propValue = allocate(container, typeId, value);
4787
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)),
4648
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)),
4788
4649
  propValue;
4789
4650
  }
4790
4651
  function _createDeserializeContainer(stateData, element) {
@@ -4807,7 +4668,7 @@
4807
4668
  const prototype = Object.getPrototypeOf(obj);
4808
4669
  return null == prototype || prototype === Object.prototype || prototype === Array.prototype;
4809
4670
  }
4810
- const frameworkType = obj => "object" == typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
4671
+ const frameworkType = obj => "object" == typeof obj && null !== obj && (obj instanceof SignalImpl || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
4811
4672
  const canSerialize = (value, seen = new WeakSet) => {
4812
4673
  if (null == value || "string" == typeof value || "number" == typeof value || "boolean" == typeof value || "bigint" == typeof value) {
4813
4674
  return !0;
@@ -4882,34 +4743,6 @@
4882
4743
  return !1;
4883
4744
  };
4884
4745
  const QRL_RUNTIME_CHUNK = "mock-chunk";
4885
- var TypeIds;
4886
- var Constants;
4887
- !function(TypeIds) {
4888
- TypeIds[TypeIds.RootRef = 0] = "RootRef", TypeIds[TypeIds.Constant = 1] = "Constant",
4889
- TypeIds[TypeIds.Number = 2] = "Number", TypeIds[TypeIds.String = 3] = "String",
4890
- TypeIds[TypeIds.Array = 4] = "Array", TypeIds[TypeIds.URL = 5] = "URL", TypeIds[TypeIds.Date = 6] = "Date",
4891
- TypeIds[TypeIds.Regex = 7] = "Regex", TypeIds[TypeIds.VNode = 8] = "VNode", TypeIds[TypeIds.RefVNode = 9] = "RefVNode",
4892
- TypeIds[TypeIds.BigInt = 10] = "BigInt", TypeIds[TypeIds.URLSearchParams = 11] = "URLSearchParams",
4893
- TypeIds[TypeIds.Error = 12] = "Error", TypeIds[TypeIds.Object = 13] = "Object",
4894
- TypeIds[TypeIds.Promise = 14] = "Promise", TypeIds[TypeIds.Set = 15] = "Set", TypeIds[TypeIds.Map = 16] = "Map",
4895
- TypeIds[TypeIds.Uint8Array = 17] = "Uint8Array", TypeIds[TypeIds.QRL = 18] = "QRL",
4896
- TypeIds[TypeIds.Task = 19] = "Task", TypeIds[TypeIds.Resource = 20] = "Resource",
4897
- TypeIds[TypeIds.Component = 21] = "Component", TypeIds[TypeIds.Signal = 22] = "Signal",
4898
- TypeIds[TypeIds.WrappedSignal = 23] = "WrappedSignal", TypeIds[TypeIds.ComputedSignal = 24] = "ComputedSignal",
4899
- TypeIds[TypeIds.Store = 25] = "Store", TypeIds[TypeIds.StoreArray = 26] = "StoreArray",
4900
- TypeIds[TypeIds.FormData = 27] = "FormData", TypeIds[TypeIds.JSXNode = 28] = "JSXNode",
4901
- TypeIds[TypeIds.PropsProxy = 29] = "PropsProxy", TypeIds[TypeIds.EffectData = 30] = "EffectData";
4902
- }(TypeIds || (TypeIds = {})), function(Constants) {
4903
- Constants[Constants.Undefined = 0] = "Undefined", Constants[Constants.Null = 1] = "Null",
4904
- Constants[Constants.True = 2] = "True", Constants[Constants.False = 3] = "False",
4905
- Constants[Constants.EmptyString = 4] = "EmptyString", Constants[Constants.EMPTY_ARRAY = 5] = "EMPTY_ARRAY",
4906
- Constants[Constants.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants[Constants.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION",
4907
- Constants[Constants.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants[Constants.Slot = 9] = "Slot",
4908
- Constants[Constants.Fragment = 10] = "Fragment", Constants[Constants.NaN = 11] = "NaN",
4909
- Constants[Constants.PositiveInfinity = 12] = "PositiveInfinity", Constants[Constants.NegativeInfinity = 13] = "NegativeInfinity",
4910
- Constants[Constants.MaxSafeInt = 14] = "MaxSafeInt", Constants[Constants.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt",
4911
- Constants[Constants.MinSafeInt = 16] = "MinSafeInt";
4912
- }(Constants || (Constants = {}));
4913
4746
  const verifySerializable = (value, preMessage) => {
4914
4747
  const seen = new WeakSet;
4915
4748
  return _verifySerializable(value, seen, "_", preMessage);
@@ -4945,7 +4778,7 @@
4945
4778
  let expectIndex = 0;
4946
4779
  return unwrapped.forEach(((v, i) => {
4947
4780
  if (i !== expectIndex) {
4948
- throw qError(QError.verifySerializable, [ unwrapped ]);
4781
+ throw qError(3, [ unwrapped ]);
4949
4782
  }
4950
4783
  _verifySerializable(v, seen, ctx + "[" + i + "]"), expectIndex = i + 1;
4951
4784
  })), value;
@@ -4963,7 +4796,7 @@
4963
4796
  case "number":
4964
4797
  return value;
4965
4798
  }
4966
- let message = "";
4799
+ let message;
4967
4800
  if (message = preMessage || "Value cannot be serialized", "_" !== ctx && (message += ` in ${ctx},`),
4968
4801
  "object" === typeObj) {
4969
4802
  message += ` because it's an instance of "${value?.constructor.name}". You might need to use 'noSerialize()' or use an object literal instead. Check out https://qwik.dev/docs/advanced/dollar/`;
@@ -4971,15 +4804,17 @@
4971
4804
  const fnName = value.name;
4972
4805
  message += ` because it's a function named "${fnName}". You might need to convert it to a QRL using $(fn):\n\nconst ${fnName} = $(${String(value)});\n\nPlease check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
4973
4806
  }
4974
- throw qError(QError.verifySerializable, [ message ]);
4807
+ throw qError(3, [ message ]);
4975
4808
  }
4976
4809
  return value;
4977
4810
  };
4978
4811
  const noSerializeSet = /*#__PURE__*/ new WeakSet;
4979
4812
  const weakSerializeSet = /*#__PURE__*/ new WeakSet;
4980
4813
  const shouldSerialize = obj => !isObject(obj) && !isFunction(obj) || !noSerializeSet.has(obj);
4981
- const fastSkipSerialize = obj => noSerializeSet.has(obj);
4814
+ const fastSkipSerialize = obj => "object" == typeof obj && obj && (NoSerializeSymbol in obj || noSerializeSet.has(obj));
4982
4815
  const noSerialize = input => (null != input && noSerializeSet.add(input), input);
4816
+ const NoSerializeSymbol = Symbol("noSerialize");
4817
+ const SerializerSymbol = Symbol("serialize");
4983
4818
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
4984
4819
  let _containerEl;
4985
4820
  const qrl = async function(...args) {
@@ -4992,7 +4827,7 @@
4992
4827
  if (!qrl.resolved) {
4993
4828
  return qrl.resolve().then((fn => {
4994
4829
  if (!isFunction(fn)) {
4995
- throw qError(QError.qrlIsNotFunction);
4830
+ throw qError(10);
4996
4831
  }
4997
4832
  return bound(...args);
4998
4833
  }));
@@ -5115,7 +4950,7 @@
5115
4950
  }
5116
4951
  {
5117
4952
  const containerState = iCtx.$container$;
5118
- const newStore = getOrCreateStore(value, opts?.deep ?? !0 ? StoreFlags.RECURSIVE : StoreFlags.NONE, containerState);
4953
+ const newStore = getOrCreateStore(value, opts?.deep ?? !0 ? 1 : 0, containerState);
5119
4954
  return set(newStore), newStore;
5120
4955
  }
5121
4956
  };
@@ -5265,19 +5100,62 @@
5265
5100
  return iCtx.$container$.$appendStyle$(transform(value, styleId), styleId, host, scoped),
5266
5101
  styleId;
5267
5102
  };
5103
+ const useOn = (event, eventQrl) => {
5104
+ _useOn(createEventName(event, "on"), eventQrl);
5105
+ };
5106
+ const useOnDocument = (event, eventQrl) => {
5107
+ _useOn(createEventName(event, "document:on"), eventQrl);
5108
+ };
5109
+ const createEventName = (event, eventScope) => {
5110
+ const map = name => {
5111
+ let prefix = eventScope;
5112
+ return "DOMContentLoaded" === name && (prefix += "-"), function(eventName, prefix) {
5113
+ return prefix + (eventName = eventName.charAt(0).toUpperCase() + eventName.substring(1)) + "$";
5114
+ }(name, prefix);
5115
+ };
5116
+ return Array.isArray(event) ? event.map(map) : map(event);
5117
+ };
5118
+ const _useOn = (eventName, eventQrl) => {
5119
+ const {isAdded, addEvent} = useOnEventsSequentialScope();
5120
+ isAdded || eventQrl && (Array.isArray(eventName) ? eventName.forEach((event => addEvent(event, eventQrl))) : addEvent(eventName, eventQrl));
5121
+ };
5122
+ const useOnEventsSequentialScope = () => {
5123
+ const iCtx = useInvokeContext();
5124
+ const host = iCtx.$hostElement$;
5125
+ let onMap = iCtx.$container$.getHostProp(host, ":on");
5126
+ null === onMap && (onMap = {}, iCtx.$container$.setHostProp(host, ":on", onMap));
5127
+ let seqIdx = iCtx.$container$.getHostProp(host, ":onIdx");
5128
+ null === seqIdx && (seqIdx = 0), iCtx.$container$.setHostProp(host, ":onIdx", seqIdx + 1);
5129
+ let addedFlags = iCtx.$container$.getHostProp(host, ":onFlags");
5130
+ for (null === addedFlags && (addedFlags = [], iCtx.$container$.setHostProp(host, ":onFlags", addedFlags)); addedFlags.length <= seqIdx; ) {
5131
+ addedFlags.push(!1);
5132
+ }
5133
+ return {
5134
+ isAdded: addedFlags[seqIdx],
5135
+ addEvent: (eventName, eventQrl) => {
5136
+ addedFlags[seqIdx] = !0;
5137
+ let events = onMap[eventName];
5138
+ events || (onMap[eventName] = events = []), events.push(eventQrl);
5139
+ }
5140
+ };
5141
+ };
5268
5142
  const useConstant = value => {
5269
5143
  const {val, set} = useSequentialScope();
5270
5144
  return null != val ? val : set(value = isFunction(value) && !isQwikComponent(value) ? value() : value);
5271
5145
  };
5272
- const useComputedQrl = qrl => {
5146
+ const useComputedCommon = (qrl, Class) => {
5273
5147
  const {val, set} = useSequentialScope();
5274
5148
  if (val) {
5275
5149
  return val;
5276
5150
  }
5277
5151
  assertQrl(qrl);
5278
- const signal = new ComputedSignal(null, qrl);
5152
+ const signal = new Class(null, qrl);
5279
5153
  return set(signal), throwIfQRLNotResolved(qrl), signal;
5280
5154
  };
5155
+ const useComputedQrl = qrl => useComputedCommon(qrl, ComputedSignalImpl);
5156
+ const useComputed$ = implicit$FirstArg(useComputedQrl);
5157
+ const useSerializerQrl = qrl => useComputedCommon(qrl, SerializerSignalImpl);
5158
+ const useSerializer$ = implicit$FirstArg(useSerializerQrl);
5281
5159
  const useVisibleTaskQrl = (qrl, opts) => {
5282
5160
  const {val, set, i, iCtx} = useSequentialScope();
5283
5161
  const eagerness = opts?.strategy ?? "intersection-observer";
@@ -5285,9 +5163,9 @@
5285
5163
  return void (isServerPlatform() && useRunTask(val, eagerness));
5286
5164
  }
5287
5165
  assertQrl(qrl);
5288
- const task = new Task(TaskFlags.VISIBLE_TASK, i, iCtx.$hostElement$, qrl, void 0, null);
5166
+ const task = new Task(1, i, iCtx.$hostElement$, qrl, void 0, null);
5289
5167
  set(task), useRunTask(task, eagerness), isServerPlatform() || (qrl.$resolveLazy$(iCtx.$element$),
5290
- iCtx.$container$.$scheduler$(ChoreType.VISIBLE, task));
5168
+ iCtx.$container$.$scheduler$(32, task));
5291
5169
  };
5292
5170
  const useRunTask = (task, eagerness) => {
5293
5171
  "intersection-observer" === eagerness ? useOn("qvisible", getTaskHandlerQrl(task)) : "document-ready" === eagerness ? useOnDocument("qinit", getTaskHandlerQrl(task)) : "document-idle" === eagerness && useOnDocument("qidle", getTaskHandlerQrl(task));
@@ -5295,7 +5173,6 @@
5295
5173
  const getTaskHandlerQrl = task => createQRL(null, "_task", scheduleTask, null, null, [ task ]);
5296
5174
  const useTask$ = /*#__PURE__*/ implicit$FirstArg(useTaskQrl);
5297
5175
  const useVisibleTask$ = /*#__PURE__*/ implicit$FirstArg(useVisibleTaskQrl);
5298
- const useComputed$ = implicit$FirstArg(useComputedQrl);
5299
5176
  const PREFETCH_CODE = /*#__PURE__*/ ((b, h, c, q, v) => {
5300
5177
  c.register("URL", {
5301
5178
  scope: "SCOPE"
@@ -5318,7 +5195,8 @@
5318
5195
  get: function() {
5319
5196
  return build.isServer;
5320
5197
  }
5321
- }), exports.$ = $, exports.Fragment = Fragment, exports.PrefetchGraph = (opts = {}) => {
5198
+ }), exports.$ = $, exports.Fragment = Fragment, exports.NoSerializeSymbol = NoSerializeSymbol,
5199
+ exports.PrefetchGraph = (opts = {}) => {
5322
5200
  const isTest = (void 0).TEST;
5323
5201
  if (build.isDev && !isTest) {
5324
5202
  return _jsxSorted("script", null, {
@@ -5366,7 +5244,7 @@
5366
5244
  return _jsxSorted("script", null, props, null, 0, "prefetch-service-worker");
5367
5245
  }, exports.RenderOnce = RenderOnce, exports.Resource = props => _jsxSorted(Fragment, null, null, function(props) {
5368
5246
  const resource = props.value;
5369
- if (isResourceReturn(resource) && resource.value) {
5247
+ if (isResourceReturn(resource)) {
5370
5248
  if (!isServerPlatform()) {
5371
5249
  const state = resource._state;
5372
5250
  if ("pending" === state && props.onPending) {
@@ -5382,7 +5260,8 @@
5382
5260
  }
5383
5261
  }
5384
5262
  }
5385
- return resource.value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
5263
+ const value = resource.value;
5264
+ return value ? value.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : Promise.resolve(void 0);
5386
5265
  }
5387
5266
  return isPromise(resource) ? resource.then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : isSignal(resource) ? Promise.resolve(resource.value).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected)) : Promise.resolve(resource).then(useBindInvokeContext(props.onResolved), useBindInvokeContext(props.onRejected));
5388
5267
  }(props), 0, null), exports.SSRComment = SSRComment, exports.SSRRaw = SSRRaw, exports.SSRStream = SSRStream,
@@ -5390,10 +5269,11 @@
5390
5269
  data: "qkssr-pu"
5391
5270
  }), props.children, jsx(SSRComment, {
5392
5271
  data: "qkssr-po"
5393
- }) ], exports.SkipRender = SkipRender, exports.Slot = Slot, exports._CONST_PROPS = _CONST_PROPS,
5394
- exports._DomContainer = DomContainer, exports._EFFECT_BACK_REF = _EFFECT_BACK_REF,
5395
- exports._EMPTY_ARRAY = EMPTY_ARRAY, exports._EffectData = SubscriptionData, exports._IMMUTABLE = _IMMUTABLE,
5396
- exports._SharedContainer = _SharedContainer, exports._VAR_PROPS = _VAR_PROPS, exports._deserialize = function(rawStateData, element) {
5272
+ }) ], exports.SerializerSymbol = SerializerSymbol, exports.SkipRender = SkipRender,
5273
+ exports.Slot = Slot, exports._CONST_PROPS = _CONST_PROPS, exports._DomContainer = DomContainer,
5274
+ exports._EFFECT_BACK_REF = _EFFECT_BACK_REF, exports._EMPTY_ARRAY = EMPTY_ARRAY,
5275
+ exports._EffectData = SubscriptionData, exports._IMMUTABLE = _IMMUTABLE, exports._SharedContainer = _SharedContainer,
5276
+ exports._VAR_PROPS = _VAR_PROPS, exports._deserialize = function(rawStateData, element) {
5397
5277
  if (null == rawStateData) {
5398
5278
  return [];
5399
5279
  }
@@ -5476,10 +5356,11 @@
5476
5356
  return r === _IMMUTABLE ? obj[prop] : r;
5477
5357
  }, exports._wrapStore = (obj, prop) => {
5478
5358
  const value = getStoreTarget(obj)[prop];
5479
- return isSignal(value) ? value : new WrappedSignal(null, getProp, [ obj, prop ], null, SignalFlags.INVALID);
5359
+ return isSignal(value) ? value : new WrappedSignal(null, getProp, [ obj, prop ], null, 1);
5480
5360
  }, exports.component$ = onMount => componentQrl(dollar(onMount)), exports.componentQrl = componentQrl,
5481
- exports.createComputed$ = createComputed$, exports.createComputedQrl = createComputedQrl,
5482
- exports.createContextId = createContextId, exports.createElement = h, exports.createSignal = createSignal,
5361
+ exports.createComputed$ = createComputed$, exports.createComputedQrl = createComputedSignal,
5362
+ exports.createContextId = createContextId, exports.createElement = h, exports.createSerializer$ = createSerializer$,
5363
+ exports.createSerializerQrl = createSerializerSignal, exports.createSignal = createSignal,
5483
5364
  exports.event$ = event$, exports.eventQrl = eventQrl, exports.getDomContainer = getDomContainer,
5484
5365
  exports.getLocale = function(defaultLocale) {
5485
5366
  if (void 0 === _locale) {
@@ -5520,11 +5401,11 @@
5520
5401
  }
5521
5402
  parent = child;
5522
5403
  }
5523
- parent.setAttribute("q:container", QContainerValue.RESUMED);
5404
+ parent.setAttribute("q:container", "resumed");
5524
5405
  const container = getDomContainer(parent);
5525
5406
  container.$serverData$ = opts.serverData || {};
5526
5407
  const host = container.rootVNode;
5527
- return container.$scheduler$(ChoreType.NODE_DIFF, host, host, jsxNode), await container.$scheduler$(ChoreType.WAIT_FOR_ALL),
5408
+ return container.$scheduler$(4, host, host, jsxNode), await container.$scheduler$(255),
5528
5409
  {
5529
5410
  cleanup: () => {
5530
5411
  cleanup(container, container.rootVNode);
@@ -5547,27 +5428,30 @@
5547
5428
  if (void 0 !== defaultValue) {
5548
5429
  return set(defaultValue);
5549
5430
  }
5550
- throw qError(QError.notFoundContext, [ context.id ]);
5431
+ throw qError(13, [ context.id ]);
5551
5432
  }, exports.useContextProvider = useContextProvider, exports.useErrorBoundary = () => {
5552
- const store = useStore({
5433
+ const error = useStore({
5553
5434
  error: void 0
5554
5435
  });
5555
- return useOn("error-boundary", qrl("/runtime", "error", [ store ])), useContextProvider(ERROR_CONTEXT, store),
5556
- store;
5436
+ return useContextProvider(ERROR_CONTEXT, error), error;
5557
5437
  }, exports.useId = () => {
5558
5438
  const {val, set, iCtx} = useSequentialScope();
5559
5439
  if (null != val) {
5560
5440
  return val;
5561
5441
  }
5562
- const containerBase = isDomContainer(iCtx.$container$) ? "" : iCtx.$container$.buildBase || "";
5563
- const base = containerBase ? hashCode(containerBase) : "";
5442
+ const containerBase = iCtx.$container$.$buildBase$ || "";
5443
+ const base = containerBase ? hashCode(containerBase).substring(0, 3) : "";
5564
5444
  const componentQrl = iCtx.$container$.getHostProp(iCtx.$hostElement$, "q:renderFn");
5565
- return set(`${base}-${componentQrl?.getHash() || ""}-${(iCtx.$container$.$currentUniqueId$++).toString(36) || ""}`);
5445
+ let id = `${base}${componentQrl?.getHash().substring(0, 3) || ""}${(iCtx.$container$.$currentUniqueId$++).toString(36) || ""}`;
5446
+ let firstChar = id.charCodeAt(0);
5447
+ return firstChar >= 48 && firstChar <= 57 && (firstChar += 17, id = String.fromCharCode(firstChar) + id.substring(1)),
5448
+ set(id);
5566
5449
  }, exports.useLexicalScope = useLexicalScope, exports.useOn = useOn, exports.useOnDocument = useOnDocument,
5567
5450
  exports.useOnWindow = (event, eventQrl) => {
5568
- _useOn(createEventName(event, "window"), eventQrl);
5451
+ _useOn(createEventName(event, "window:on"), eventQrl);
5569
5452
  }, exports.useResource$ = (generatorFn, opts) => useResourceQrl(dollar(generatorFn), opts),
5570
- exports.useResourceQrl = useResourceQrl, exports.useServerData = useServerData,
5453
+ exports.useResourceQrl = useResourceQrl, exports.useSerializer$ = useSerializer$,
5454
+ exports.useSerializerQrl = useSerializerQrl, exports.useServerData = useServerData,
5571
5455
  exports.useSignal = initialState => useConstant((() => {
5572
5456
  const value = isFunction(initialState) && !isQwikComponent(initialState) ? invoke(void 0, initialState) : initialState;
5573
5457
  return createSignal(value);