@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
@@ -10,7 +10,7 @@ var isServer = !isBrowser;
10
10
  var isDev = false;
11
11
  /**
12
12
  * @license
13
- * @qwik.dev/core 2.0.0-alpha.8-dev+66037b5
13
+ * @qwik.dev/core 2.0.0-alpha.9-dev+56ed5bd
14
14
  * Copyright QwikDev. All Rights Reserved.
15
15
  * Use of this source code is governed by an MIT-style license that can be
16
16
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -35,10 +35,6 @@ function assertTrue() {
35
35
  function assertFalse() {
36
36
  }
37
37
  const codeToText = (code) => `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
38
- var QError;
39
- !function(QError2) {
40
- QError2[QError2.stringifyClassOrStyle = 0] = "stringifyClassOrStyle", QError2[QError2.schedulerNotFound = 1] = "schedulerNotFound", QError2[QError2.trackObjectWithoutProp = 2] = "trackObjectWithoutProp", QError2[QError2.verifySerializable = 3] = "verifySerializable", QError2[QError2.UNUSED_4 = 4] = "UNUSED_4", QError2[QError2.cannotRenderOverExistingContainer = 5] = "cannotRenderOverExistingContainer", QError2[QError2.UNUSED_6 = 6] = "UNUSED_6", QError2[QError2.UNUSED_7 = 7] = "UNUSED_7", QError2[QError2.UNUSED_8 = 8] = "UNUSED_8", QError2[QError2.UNUSED_9 = 9] = "UNUSED_9", QError2[QError2.qrlIsNotFunction = 10] = "qrlIsNotFunction", QError2[QError2.dynamicImportFailed = 11] = "dynamicImportFailed", QError2[QError2.unknownTypeArgument = 12] = "unknownTypeArgument", QError2[QError2.notFoundContext = 13] = "notFoundContext", QError2[QError2.useMethodOutsideContext = 14] = "useMethodOutsideContext", QError2[QError2.UNUSED_15 = 15] = "UNUSED_15", QError2[QError2.UNUSED_16 = 16] = "UNUSED_16", QError2[QError2.UNUSED_17 = 17] = "UNUSED_17", QError2[QError2.UNUSED_18 = 18] = "UNUSED_18", QError2[QError2.UNUSED_19 = 19] = "UNUSED_19", QError2[QError2.useInvokeContext = 20] = "useInvokeContext", QError2[QError2.UNUSED_21 = 21] = "UNUSED_21", QError2[QError2.UNUSED_22 = 22] = "UNUSED_22", QError2[QError2.UNUSED_23 = 23] = "UNUSED_23", QError2[QError2.UNUSED_24 = 24] = "UNUSED_24", QError2[QError2.UNUSED_25 = 25] = "UNUSED_25", QError2[QError2.UNUSED_26 = 26] = "UNUSED_26", QError2[QError2.UNUSED_27 = 27] = "UNUSED_27", QError2[QError2.invalidContext = 28] = "invalidContext", QError2[QError2.tagError = 29] = "tagError", QError2[QError2.qrlMissingContainer = 30] = "qrlMissingContainer", QError2[QError2.qrlMissingChunk = 31] = "qrlMissingChunk", QError2[QError2.invalidRefValue = 32] = "invalidRefValue", QError2[QError2.serializeErrorNotImplemented = 33] = "serializeErrorNotImplemented", QError2[QError2.serializeErrorExpectedVNode = 34] = "serializeErrorExpectedVNode", QError2[QError2.serializeErrorCannotAllocate = 35] = "serializeErrorCannotAllocate", QError2[QError2.serializeErrorMissingRootId = 36] = "serializeErrorMissingRootId", QError2[QError2.serializeErrorUnknownType = 37] = "serializeErrorUnknownType", QError2[QError2.serializeErrorUnvisited = 38] = "serializeErrorUnvisited", QError2[QError2.serializeErrorMissingChunk = 39] = "serializeErrorMissingChunk", QError2[QError2.wrongTextareaValue = 40] = "wrongTextareaValue", QError2[QError2.containerNotFound = 41] = "containerNotFound", QError2[QError2.elementWithoutContainer = 42] = "elementWithoutContainer", QError2[QError2.invalidVNodeType = 43] = "invalidVNodeType", QError2[QError2.materializeVNodeDataError = 44] = "materializeVNodeDataError", QError2[QError2.cannotCoerceSignal = 45] = "cannotCoerceSignal", QError2[QError2.computedNotSync = 46] = "computedNotSync", QError2[QError2.computedReadOnly = 47] = "computedReadOnly", QError2[QError2.wrappedReadOnly = 48] = "wrappedReadOnly", QError2[QError2.unsafeAttr = 49] = "unsafeAttr";
41
- }(QError || (QError = {}));
42
38
  const qError = (code, errorMessageArgs = []) => {
43
39
  const text = codeToText(code, ...errorMessageArgs);
44
40
  return logErrorAndStop(text, ...errorMessageArgs);
@@ -49,23 +45,6 @@ const getSymbolHash = (symbolName) => {
49
45
  const index = symbolName.lastIndexOf("_");
50
46
  return index > -1 ? symbolName.slice(index + 1) : symbolName;
51
47
  };
52
- var VirtualType;
53
- !function(VirtualType2) {
54
- VirtualType2.Virtual = "V", VirtualType2.Fragment = "F", VirtualType2.WrappedSignal = "S", VirtualType2.Awaited = "A", VirtualType2.Component = "C", VirtualType2.InlineComponent = "I", VirtualType2.Projection = "P";
55
- }(VirtualType || (VirtualType = {}));
56
- ({
57
- [VirtualType.Virtual]: "\x1B[34mVirtual\x1B[0m",
58
- [VirtualType.Fragment]: "\x1B[34mFragment\x1B[0m",
59
- [VirtualType.WrappedSignal]: "\x1B[34mSignal\x1B[0m",
60
- [VirtualType.Awaited]: "\x1B[34mAwaited\x1B[0m",
61
- [VirtualType.Component]: "\x1B[34mComponent\x1B[0m",
62
- [VirtualType.InlineComponent]: "\x1B[34mInlineComponent\x1B[0m",
63
- [VirtualType.Projection]: "\x1B[34mProjection\x1B[0m"
64
- });
65
- var QContainerValue;
66
- !function(QContainerValue2) {
67
- QContainerValue2.PAUSED = "paused", QContainerValue2.RESUMED = "resumed", QContainerValue2.HTML = "html", QContainerValue2.TEXT = "text";
68
- }(QContainerValue || (QContainerValue = {}));
69
48
  const QSlot = "q:slot";
70
49
  const QSlotS = "q:s";
71
50
  const QStyle = "q:style";
@@ -77,7 +56,7 @@ const QContainerIslandEnd = "/" + QContainerIsland;
77
56
  const QIgnore = "q:ignore";
78
57
  const QIgnoreEnd = "/q:ignore";
79
58
  const QTemplate = "q:template";
80
- const QContainerSelector = "[q\\:container]:not([q\\:container=" + QContainerValue.HTML + "]):not([q\\:container=" + QContainerValue.TEXT + "])";
59
+ const QContainerSelector = "[q\\:container]:not([q\\:container=html]):not([q\\:container=text])";
81
60
  const HTML_NS = "http://www.w3.org/1999/xhtml";
82
61
  const SVG_NS = "http://www.w3.org/2000/svg";
83
62
  const MATH_NS = "http://www.w3.org/1998/Math/MathML";
@@ -93,10 +72,10 @@ const createPlatform = () => ({
93
72
  }
94
73
  }
95
74
  if (!url) {
96
- throw qError(QError.qrlMissingChunk, [symbolName]);
75
+ throw qError(31, [symbolName]);
97
76
  }
98
77
  if (!containerEl) {
99
- throw qError(QError.qrlMissingContainer, [url, symbolName]);
78
+ throw qError(30, [url, symbolName]);
100
79
  }
101
80
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
102
81
  const urlCopy = new URL(urlDoc);
@@ -160,276 +139,400 @@ const isSerializableObject = (v) => {
160
139
  const isArray = (v) => Array.isArray(v);
161
140
  const isString = (v) => "string" == typeof v;
162
141
  const isFunction = (v) => "function" == typeof v;
163
- var VNodeDataFlag;
164
- !function(VNodeDataFlag2) {
165
- VNodeDataFlag2[VNodeDataFlag2.NONE = 0] = "NONE", VNodeDataFlag2[VNodeDataFlag2.TEXT_DATA = 1] = "TEXT_DATA", VNodeDataFlag2[VNodeDataFlag2.VIRTUAL_NODE = 2] = "VIRTUAL_NODE", VNodeDataFlag2[VNodeDataFlag2.ELEMENT_NODE = 4] = "ELEMENT_NODE", VNodeDataFlag2[VNodeDataFlag2.REFERENCE = 8] = "REFERENCE", VNodeDataFlag2[VNodeDataFlag2.SERIALIZE = 16] = "SERIALIZE";
166
- }(VNodeDataFlag || (VNodeDataFlag = {}));
167
- const isQrl = (value) => "function" == typeof value && "function" == typeof value.getSymbol;
168
142
  const EMPTY_ARRAY = [];
169
143
  const EMPTY_OBJ = {};
170
144
  Object.freeze(EMPTY_ARRAY), Object.freeze(EMPTY_OBJ);
171
- var ChoreType;
172
- !function(ChoreType2) {
173
- ChoreType2[ChoreType2.MACRO = 240] = "MACRO", ChoreType2[ChoreType2.MICRO = 15] = "MICRO", ChoreType2[ChoreType2.QRL_RESOLVE = 1] = "QRL_RESOLVE", ChoreType2[ChoreType2.RUN_QRL = 2] = "RUN_QRL", ChoreType2[ChoreType2.TASK = 3] = "TASK", ChoreType2[ChoreType2.NODE_DIFF = 4] = "NODE_DIFF", ChoreType2[ChoreType2.NODE_PROP = 5] = "NODE_PROP", ChoreType2[ChoreType2.COMPONENT = 6] = "COMPONENT", ChoreType2[ChoreType2.RECOMPUTE_AND_SCHEDULE_EFFECTS = 7] = "RECOMPUTE_AND_SCHEDULE_EFFECTS", ChoreType2[ChoreType2.JOURNAL_FLUSH = 16] = "JOURNAL_FLUSH", ChoreType2[ChoreType2.VISIBLE = 32] = "VISIBLE", ChoreType2[ChoreType2.CLEANUP_VISIBLE = 48] = "CLEANUP_VISIBLE", ChoreType2[ChoreType2.WAIT_FOR_ALL = 255] = "WAIT_FOR_ALL";
174
- }(ChoreType || (ChoreType = {}));
175
- const Slot = (props) => _jsxSorted(Virtual, null, {
176
- [QSlotS]: ""
177
- }, props.children, 0, props.name ?? "");
178
- const SkipRender = Symbol("skip render");
179
- const SSRRaw = () => null;
180
- const SSRComment = () => null;
181
145
  const isJsxPropertyAnEventName = (name) => (name.startsWith("on") || name.startsWith("window:on") || name.startsWith("document:on")) && name.endsWith("$");
182
146
  const isHtmlAttributeAnEventName = (name) => name.startsWith("on:") || name.startsWith("on-window:") || name.startsWith("on-document:");
183
- const getEventNameFromJsxProp = (name) => {
184
- if (name.endsWith("$")) {
185
- let idx = -1;
186
- if (name.startsWith("on") ? idx = 2 : name.startsWith("window:on") ? idx = 9 : name.startsWith("document:on") && (idx = 11), -1 != idx) {
187
- const isCaseSensitive = isDashAt(name, idx) && !isDashAt(name, idx + 1);
188
- isCaseSensitive && idx++;
189
- let lastIdx = idx;
190
- let eventName = "";
191
- for (; ; ) {
192
- idx = name.indexOf("-", lastIdx);
193
- const chunk = name.substring(lastIdx, -1 === idx ? name.length - 1 : idx);
194
- if (eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), -1 == idx) {
195
- return eventName;
196
- }
197
- isDashAt(name, idx + 1) ? (eventName += "-", idx++) : (eventName += name.charAt(idx + 1).toUpperCase(), idx++), lastIdx = idx + 1;
198
- }
199
- }
200
- }
201
- return null;
202
- };
203
- const getEventNameScopeFromJsxProp = (name) => {
204
- const index = name.indexOf(":");
205
- return -1 !== index ? name.substring(0, index) : "";
206
- };
207
- const isDashAt = (name, idx) => 45 === name.charCodeAt(idx);
208
- const convertEventNameFromJsxPropToHtmlAttr = (name) => {
209
- if (name.endsWith("$")) {
210
- let prefix = null;
211
- if (name.startsWith("on") ? prefix = "on:" : name.startsWith("window:on") ? prefix = "on-window:" : name.startsWith("document:on") && (prefix = "on-document:"), null !== prefix) {
212
- const eventName = getEventNameFromJsxProp(name);
147
+ function jsxEventToHtmlAttribute(jsxEvent) {
148
+ if (jsxEvent.endsWith("$")) {
149
+ const [prefix, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
150
+ if (-1 !== idx) {
151
+ const eventName = getEventNameFromJsxEvent(jsxEvent);
213
152
  return prefix + fromCamelToKebabCase(eventName);
214
153
  }
215
154
  }
216
155
  return null;
217
- };
218
- const fromCamelToKebabCase = (text) => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
219
- function isPreventDefault(key) {
220
- return key.startsWith("preventdefault:");
221
- }
222
- function getFileLocationFromJsx(jsxDev) {
223
- if (!jsxDev) {
224
- return null;
225
- }
226
- const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
227
- return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
228
156
  }
229
- const styleContent = (styleId) => "⚡️" + styleId;
230
- function hasClassAttr(props) {
231
- for (const key in props) {
232
- if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
233
- return true;
157
+ function getEventNameFromJsxEvent(jsxEvent) {
158
+ if (jsxEvent.endsWith("$")) {
159
+ const [, idx] = getEventScopeDataFromJsxEvent(jsxEvent);
160
+ if (-1 != idx) {
161
+ return jsxEventToEventName(jsxEvent, idx);
234
162
  }
235
163
  }
236
- return false;
237
- }
238
- function isClassAttr(key) {
239
- return "class" === key || "className" === key;
164
+ return null;
240
165
  }
241
- function convertScopedStyleIdsToArray(scopedStyleIds) {
242
- return scopedStyleIds?.split(" ") ?? null;
166
+ function jsxEventToEventName(jsxEvent, startIdx = 0) {
167
+ let lastIdx = startIdx;
168
+ const isCaseSensitive = isDash(jsxEvent.charCodeAt(startIdx));
169
+ isCaseSensitive && lastIdx++;
170
+ let eventName = "";
171
+ const chunk = jsxEvent.substring(lastIdx, jsxEvent.length - 1);
172
+ return "DOMContentLoaded" === chunk ? "DOMContentLoaded" : (eventName += isCaseSensitive ? chunk : chunk.toLowerCase(), eventName);
243
173
  }
244
- function convertStyleIdsToString(scopedStyleIds) {
245
- return Array.from(scopedStyleIds).join(" ");
174
+ function getEventScopeDataFromJsxEvent(eventName) {
175
+ let prefix = null;
176
+ let idx = -1;
177
+ return eventName.startsWith("on") ? (prefix = "on:", idx = 2) : eventName.startsWith("window:on") ? (prefix = "on-window:", idx = 9) : eventName.startsWith("document:on") && (prefix = "on-document:", idx = 11), [prefix, idx];
246
178
  }
247
- const addComponentStylePrefix = (styleId) => {
248
- if (styleId) {
249
- let idx = 0;
250
- do {
251
- styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
252
- } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
253
- }
254
- return styleId || null;
255
- };
256
- const unitlessNumbers = /* @__PURE__ */ new Set(["animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp"]);
257
- const isUnitlessNumber = (name) => unitlessNumbers.has(name);
258
- const serializeClass = (obj) => {
259
- if (!obj) {
260
- return "";
261
- }
262
- if (isString(obj)) {
263
- return obj.trim();
264
- }
265
- const classes = [];
266
- if (isArray(obj)) {
267
- for (const o of obj) {
268
- const classList = serializeClass(o);
269
- classList && classes.push(classList);
270
- }
271
- } else {
272
- for (const [key, value] of Object.entries(obj)) {
273
- value && classes.push(key.trim());
274
- }
275
- }
276
- return classes.join(" ");
277
- };
278
- const fromCamelToKebabCaseWithDash = (text) => text.replace(/([A-Z])/g, "-$1").toLowerCase();
279
- const stringifyStyle = (obj) => {
280
- if (null == obj) {
281
- return "";
282
- }
283
- if ("object" == typeof obj) {
284
- if (isArray(obj)) {
285
- throw qError(QError.stringifyClassOrStyle, [obj, "style"]);
286
- }
287
- {
288
- const chunks = [];
289
- for (const key in obj) {
290
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
291
- const value = obj[key];
292
- null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
293
- }
294
- }
295
- return chunks.join(";");
296
- }
297
- }
298
- return String(obj);
179
+ const isDash = (charCode) => 45 === charCode;
180
+ const getEventNameScopeFromJsxEvent = (name) => {
181
+ const index = name.indexOf(":");
182
+ return -1 !== index ? name.substring(0, index) : "";
299
183
  };
300
- const serializeBooleanOrNumberAttribute = (value) => null != value ? String(value) : null;
301
- function serializeAttribute(key, value, styleScopedId) {
302
- if (isClassAttr(key)) {
303
- const serializedClass = serializeClass(value);
304
- value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
305
- } else {
306
- "style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" == typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
307
- }
308
- return value;
309
- }
310
- function isEnumeratedBooleanAttribute(key) {
311
- return isAriaAttribute(key) || ["spellcheck", "draggable", "contenteditable"].includes(key);
184
+ function isPreventDefault(key) {
185
+ return key.startsWith("preventdefault:");
312
186
  }
313
- const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || isUnitlessNumber(styleName) ? value : value + "px";
314
- function isAriaAttribute(prop) {
315
- return prop.startsWith("aria-");
187
+ const fromCamelToKebabCase = (text) => text.replace(/([A-Z-])/g, "-$1").toLowerCase();
188
+ const createContextId = (name) => /* @__PURE__ */ Object.freeze({
189
+ id: fromCamelToKebabCase(name)
190
+ });
191
+ const ERROR_CONTEXT = /* @__PURE__ */ createContextId("qk-error");
192
+ const version = "2.0.0-alpha.9-dev+56ed5bd";
193
+ const Slot = (props) => _jsxSorted(Virtual, null, {
194
+ [QSlotS]: ""
195
+ }, props.children, 0, props.name ?? "");
196
+ const SkipRender = Symbol("skip render");
197
+ const SSRRaw = () => null;
198
+ const SSRComment = () => null;
199
+ const NEEDS_COMPUTATION = Symbol("invalid");
200
+ const _EFFECT_BACK_REF = Symbol("backRef");
201
+ function getSubscriber(effect, prop, data) {
202
+ effect[_EFFECT_BACK_REF] || (isServer && isSsrNode(effect) ? effect.setProp("q:brefs", /* @__PURE__ */ new Map()) : effect[_EFFECT_BACK_REF] = /* @__PURE__ */ new Map());
203
+ const subMap = effect[_EFFECT_BACK_REF];
204
+ let sub = subMap.get(prop);
205
+ return sub || (sub = [effect, prop], subMap.set(prop, sub)), data && (sub[3] = data), sub;
316
206
  }
317
- const STORE_TARGET = Symbol("store.target");
318
- const STORE_HANDLER = Symbol("store.handler");
319
- const STORE_ALL_PROPS = Symbol("store.all");
320
- var StoreFlags;
321
- !function(StoreFlags2) {
322
- StoreFlags2[StoreFlags2.NONE = 0] = "NONE", StoreFlags2[StoreFlags2.RECURSIVE = 1] = "RECURSIVE", StoreFlags2[StoreFlags2.IMMUTABLE = 2] = "IMMUTABLE";
323
- }(StoreFlags || (StoreFlags = {}));
324
- const getStoreHandler = (value) => value[STORE_HANDLER];
325
- const getStoreTarget = (value) => value?.[STORE_TARGET] || null;
326
- const unwrapStore = (value) => getStoreTarget(value) || value;
327
- const isStore = (value) => STORE_TARGET in value;
328
- function createStore(container, obj, flags) {
329
- return new Proxy(obj, new StoreHandler(flags, container || null));
207
+ function isSsrNode(value) {
208
+ return "__brand__" in value && "currentComponentNode" in value;
330
209
  }
331
- const getOrCreateStore = (obj, flags, container) => {
332
- if (isSerializableObject(obj) && container) {
333
- let store = container.$storeProxyMap$.get(obj);
334
- return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)), store;
210
+ const throwIfQRLNotResolved = (qrl2) => {
211
+ if (!qrl2.resolved) {
212
+ throw qrl2.resolve();
335
213
  }
336
- return obj;
337
214
  };
338
- class StoreHandler {
339
- constructor($flags$, $container$) {
340
- __publicField(this, "$flags$");
341
- __publicField(this, "$container$");
215
+ const isSignal = (value) => value instanceof SignalImpl;
216
+ class SubscriptionData {
217
+ constructor(data) {
218
+ __publicField(this, "data");
219
+ this.data = data;
220
+ }
221
+ }
222
+ class SignalImpl {
223
+ constructor(container, value) {
224
+ __publicField(this, "$untrackedValue$");
342
225
  __publicField(this, "$effects$", null);
343
- this.$flags$ = $flags$, this.$container$ = $container$;
226
+ __publicField(this, "$container$", null);
227
+ this.$container$ = container, this.$untrackedValue$ = value;
344
228
  }
345
- toString() {
346
- return "[Store]";
229
+ get untrackedValue() {
230
+ return this.$untrackedValue$;
347
231
  }
348
- get(target, prop) {
349
- if ("symbol" == typeof prop) {
350
- return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
351
- }
232
+ set untrackedValue(value) {
233
+ this.$untrackedValue$ = value;
234
+ }
235
+ get value() {
352
236
  const ctx = tryGetInvokeContext();
353
- const value = target[prop];
354
237
  if (ctx) {
355
238
  if (null === this.$container$) {
356
239
  if (!ctx.$container$) {
357
- return value;
240
+ return this.untrackedValue;
358
241
  }
359
242
  this.$container$ = ctx.$container$;
360
243
  } else {
361
244
  assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
362
245
  }
363
246
  const effectSubscriber = ctx.$effectSubscriber$;
364
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
365
- }
366
- if ("toString" === prop && value === Object.prototype.toString) {
367
- return this.toString;
368
- }
369
- 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;
370
- }
371
- set(target, prop, value) {
372
- if ("symbol" == typeof prop) {
373
- return target[prop] = value, true;
374
- }
375
- const newValue = this.$flags$ & StoreFlags.RECURSIVE ? unwrapStore(value) : value;
376
- if (prop in target) {
377
- newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
378
- } else {
379
- setNewValueAndTriggerEffects(prop, newValue, target, this);
247
+ if (effectSubscriber) {
248
+ const effects = this.$effects$ || (this.$effects$ = /* @__PURE__ */ new Set());
249
+ ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this), addQrlToSerializationCtx(effectSubscriber, this.$container$);
250
+ }
380
251
  }
381
- return true;
252
+ return this.untrackedValue;
382
253
  }
383
- deleteProperty(target, prop) {
384
- return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)), true);
254
+ set value(value) {
255
+ value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
385
256
  }
386
- has(target, prop) {
387
- if (prop === STORE_TARGET) {
388
- return true;
389
- }
390
- if ("string" == typeof prop) {
391
- const ctx = tryGetInvokeContext();
392
- if (ctx) {
393
- const effectSubscriber = ctx.$effectSubscriber$;
394
- effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
395
- }
396
- }
397
- return Object.prototype.hasOwnProperty.call(target, prop);
257
+ valueOf() {
398
258
  }
399
- ownKeys(target) {
400
- const ctx = tryGetInvokeContext();
401
- const effectSubscriber = ctx?.$effectSubscriber$;
402
- return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
259
+ toString() {
260
+ return this.constructor.name;
403
261
  }
404
- getOwnPropertyDescriptor(target, prop) {
405
- const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
406
- return Array.isArray(target) || "symbol" == typeof prop || descriptor && !descriptor.configurable ? descriptor : {
407
- enumerable: true,
408
- configurable: true
262
+ toJSON() {
263
+ return {
264
+ value: this.$untrackedValue$
409
265
  };
410
266
  }
411
267
  }
412
- function addStoreEffect(target, prop, store, effectSubscription) {
413
- const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
414
- let effects = effectsMap.get(prop);
415
- effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
416
- }
417
- function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
418
- target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
419
- }
420
- function getEffects(target, prop, storeEffects) {
421
- let effectsToTrigger;
422
- if (storeEffects) {
423
- if (Array.isArray(target)) {
424
- for (const effects of storeEffects.values()) {
425
- effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
426
- for (const effect of effects) {
427
- effectsToTrigger.add(effect);
428
- }
429
- }
430
- } else {
431
- effectsToTrigger = storeEffects.get(prop);
432
- }
268
+ const ensureContainsSubscription = (array, effectSubscription) => {
269
+ array.add(effectSubscription);
270
+ };
271
+ const ensureContainsBackRef = (array, value) => {
272
+ array[2] || (array[2] = /* @__PURE__ */ new Set()), array[2].add(value);
273
+ };
274
+ const addQrlToSerializationCtx = (effectSubscriber, container) => {
275
+ if (container && !isDomContainer(container)) {
276
+ const effect = effectSubscriber[0];
277
+ const property = effectSubscriber[1];
278
+ let qrl2 = null;
279
+ isTask(effect) ? qrl2 = effect.$qrl$ : effect instanceof ComputedSignalImpl ? qrl2 = effect.$computeQrl$ : ":" === property && (qrl2 = container.getHostProp(effect, "q:renderFn")), qrl2 && container.serializationCtx.$eventQrls$.add(qrl2);
280
+ }
281
+ };
282
+ const triggerEffects = (container, signal, effects) => {
283
+ const isBrowser2 = isDomContainer(container);
284
+ if (effects) {
285
+ const scheduleEffect = (effectSubscription) => {
286
+ const consumer = effectSubscription[0];
287
+ const property = effectSubscription[1];
288
+ if (isTask(consumer)) {
289
+ consumer.$flags$ |= 8;
290
+ let choreType = 3;
291
+ 1 & consumer.$flags$ && (choreType = 32), container.$scheduler$(choreType, consumer);
292
+ } else if (consumer instanceof SignalImpl) {
293
+ consumer instanceof ComputedSignalImpl && (consumer.$computeQrl$.resolved || container.$scheduler$(1, null, consumer.$computeQrl$)), consumer.$invalidate$();
294
+ } else if (":" === property) {
295
+ const host = consumer;
296
+ const qrl2 = container.getHostProp(host, "q:renderFn");
297
+ const props = container.getHostProp(host, "q:props");
298
+ container.$scheduler$(6, host, qrl2, props);
299
+ } else if (isBrowser2) {
300
+ if ("." === property) {
301
+ container.$scheduler$(4, consumer, consumer, signal);
302
+ } else {
303
+ const effectData = effectSubscription[3];
304
+ if (effectData instanceof SubscriptionData) {
305
+ const payload = {
306
+ ...effectData.data,
307
+ $value$: signal
308
+ };
309
+ container.$scheduler$(5, consumer, property, payload);
310
+ }
311
+ }
312
+ }
313
+ };
314
+ for (const effect of effects) {
315
+ scheduleEffect(effect);
316
+ }
317
+ }
318
+ };
319
+ class ComputedSignalImpl extends (_b = SignalImpl, _a = _EFFECT_BACK_REF, _b) {
320
+ constructor(container, fn, flags = 1) {
321
+ super(container, NEEDS_COMPUTATION);
322
+ __publicField(this, "$computeQrl$");
323
+ __publicField(this, "$flags$");
324
+ __publicField(this, "$forceRunEffects$", false);
325
+ __publicField(this, _a, null);
326
+ this.$computeQrl$ = fn, this.$flags$ = flags;
327
+ }
328
+ $invalidate$() {
329
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(7, null, this);
330
+ }
331
+ force() {
332
+ this.$forceRunEffects$ = true, this.$container$?.$scheduler$(7, null, this);
333
+ }
334
+ get untrackedValue() {
335
+ const didChange = this.$computeIfNeeded$();
336
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
337
+ }
338
+ $computeIfNeeded$() {
339
+ if (!(1 & this.$flags$)) {
340
+ return false;
341
+ }
342
+ const computeQrl = this.$computeQrl$;
343
+ throwIfQRLNotResolved(computeQrl);
344
+ const ctx = tryGetInvokeContext();
345
+ const previousEffectSubscription = ctx?.$effectSubscriber$;
346
+ ctx && (ctx.$effectSubscriber$ = getSubscriber(this, "."));
347
+ try {
348
+ const untrackedValue = computeQrl.getFn(ctx)();
349
+ if (isPromise(untrackedValue)) {
350
+ throw qError(46, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
351
+ }
352
+ this.$flags$ &= -2;
353
+ const didChange = untrackedValue !== this.$untrackedValue$;
354
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
355
+ } finally {
356
+ ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
357
+ }
358
+ }
359
+ set value(_) {
360
+ throw qError(47);
361
+ }
362
+ get value() {
363
+ return super.value;
364
+ }
365
+ }
366
+ class WrappedSignal extends (_d = SignalImpl, _c = _EFFECT_BACK_REF, _d) {
367
+ constructor(container, fn, args, fnStr, flags = 3) {
368
+ super(container, NEEDS_COMPUTATION);
369
+ __publicField(this, "$args$");
370
+ __publicField(this, "$func$");
371
+ __publicField(this, "$funcStr$");
372
+ __publicField(this, "$flags$");
373
+ __publicField(this, "$hostElement$", null);
374
+ __publicField(this, "$forceRunEffects$", false);
375
+ __publicField(this, _c, null);
376
+ this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
377
+ }
378
+ $invalidate$() {
379
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(7, this.$hostElement$, this);
380
+ }
381
+ force() {
382
+ this.$flags$ |= 1, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
383
+ }
384
+ get untrackedValue() {
385
+ const didChange = this.$computeIfNeeded$();
386
+ return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
387
+ }
388
+ $computeIfNeeded$() {
389
+ if (!(1 & this.$flags$)) {
390
+ return false;
391
+ }
392
+ const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, ".", this.$container$);
393
+ const didChange = untrackedValue !== this.$untrackedValue$;
394
+ return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
395
+ }
396
+ set value(_) {
397
+ throw qError(48);
398
+ }
399
+ get value() {
400
+ return super.value;
401
+ }
402
+ }
403
+ class SerializerSignalImpl extends ComputedSignalImpl {
404
+ constructor(container, argQrl) {
405
+ super(container, argQrl);
406
+ __publicField(this, "$didInitialize$", false);
407
+ }
408
+ $computeIfNeeded$() {
409
+ if (!(1 & this.$flags$)) {
410
+ return false;
411
+ }
412
+ throwIfQRLNotResolved(this.$computeQrl$);
413
+ let arg = this.$computeQrl$.resolved;
414
+ "function" == typeof arg && (arg = arg());
415
+ const { deserialize, initial } = arg;
416
+ const update = arg.update;
417
+ const currentValue = this.$untrackedValue$ === NEEDS_COMPUTATION ? initial : this.$untrackedValue$;
418
+ const untrackedValue = trackSignal(() => this.$didInitialize$ ? update?.(currentValue) : deserialize(currentValue), this, ".", this.$container$);
419
+ const didChange = this.$didInitialize$ && "undefined" !== untrackedValue || untrackedValue !== this.$untrackedValue$;
420
+ return this.$flags$ &= -2, this.$didInitialize$ = true, didChange && (this.$untrackedValue$ = untrackedValue), didChange;
421
+ }
422
+ }
423
+ const isSerializerObj = (obj) => "object" == typeof obj && null !== obj && "function" == typeof obj[SerializerSymbol];
424
+ const STORE_TARGET = Symbol("store.target");
425
+ const STORE_HANDLER = Symbol("store.handler");
426
+ const STORE_ALL_PROPS = Symbol("store.all");
427
+ const getStoreHandler = (value) => value[STORE_HANDLER];
428
+ const getStoreTarget = (value) => value?.[STORE_TARGET] || null;
429
+ const unwrapStore = (value) => getStoreTarget(value) || value;
430
+ const isStore = (value) => STORE_TARGET in value;
431
+ function createStore(container, obj, flags) {
432
+ return new Proxy(obj, new StoreHandler(flags, container || null));
433
+ }
434
+ const getOrCreateStore = (obj, flags, container) => {
435
+ if (isSerializableObject(obj) && container) {
436
+ let store = container.$storeProxyMap$.get(obj);
437
+ return store || (store = createStore(container, obj, flags), container.$storeProxyMap$.set(obj, store)), store;
438
+ }
439
+ return obj;
440
+ };
441
+ class StoreHandler {
442
+ constructor($flags$, $container$) {
443
+ __publicField(this, "$flags$");
444
+ __publicField(this, "$container$");
445
+ __publicField(this, "$effects$", null);
446
+ this.$flags$ = $flags$, this.$container$ = $container$;
447
+ }
448
+ toString() {
449
+ return "[Store]";
450
+ }
451
+ get(target, prop) {
452
+ if ("symbol" == typeof prop) {
453
+ return prop === STORE_TARGET ? target : prop === STORE_HANDLER ? this : target[prop];
454
+ }
455
+ const ctx = tryGetInvokeContext();
456
+ const value = target[prop];
457
+ if (ctx) {
458
+ if (null === this.$container$) {
459
+ if (!ctx.$container$) {
460
+ return value;
461
+ }
462
+ this.$container$ = ctx.$container$;
463
+ } else {
464
+ assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
465
+ }
466
+ const effectSubscriber = ctx.$effectSubscriber$;
467
+ effectSubscriber && addStoreEffect(target, Array.isArray(target) ? STORE_ALL_PROPS : prop, this, effectSubscriber);
468
+ }
469
+ if ("toString" === prop && value === Object.prototype.toString) {
470
+ return this.toString;
471
+ }
472
+ return 1 & this.$flags$ && "object" == typeof value && null !== value && !Object.isFrozen(value) && !isStore(value) && !Object.isFrozen(target) ? getOrCreateStore(value, this.$flags$, this.$container$) : value;
473
+ }
474
+ set(target, prop, value) {
475
+ if ("symbol" == typeof prop) {
476
+ return target[prop] = value, true;
477
+ }
478
+ const newValue = 1 & this.$flags$ ? unwrapStore(value) : value;
479
+ if (prop in target) {
480
+ newValue !== target[prop] && setNewValueAndTriggerEffects(prop, newValue, target, this);
481
+ } else {
482
+ setNewValueAndTriggerEffects(prop, newValue, target, this);
483
+ }
484
+ return true;
485
+ }
486
+ deleteProperty(target, prop) {
487
+ return "string" == typeof prop && delete target[prop] && (triggerEffects(this.$container$, this, getEffects(target, prop, this.$effects$)), true);
488
+ }
489
+ has(target, prop) {
490
+ if (prop === STORE_TARGET) {
491
+ return true;
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
+ }
499
+ }
500
+ return Object.prototype.hasOwnProperty.call(target, prop);
501
+ }
502
+ ownKeys(target) {
503
+ const ctx = tryGetInvokeContext();
504
+ const effectSubscriber = ctx?.$effectSubscriber$;
505
+ return effectSubscriber && addStoreEffect(target, STORE_ALL_PROPS, this, effectSubscriber), Reflect.ownKeys(target);
506
+ }
507
+ getOwnPropertyDescriptor(target, prop) {
508
+ const descriptor = Reflect.getOwnPropertyDescriptor(target, prop);
509
+ return Array.isArray(target) || "symbol" == typeof prop || descriptor && !descriptor.configurable ? descriptor : {
510
+ enumerable: true,
511
+ configurable: true
512
+ };
513
+ }
514
+ }
515
+ function addStoreEffect(target, prop, store, effectSubscription) {
516
+ const effectsMap = store.$effects$ || (store.$effects$ = /* @__PURE__ */ new Map());
517
+ let effects = effectsMap.get(prop);
518
+ effects || (effects = /* @__PURE__ */ new Set(), effectsMap.set(prop, effects)), ensureContainsSubscription(effects, effectSubscription), ensureContainsBackRef(effectSubscription, target), addQrlToSerializationCtx(effectSubscription, store.$container$);
519
+ }
520
+ function setNewValueAndTriggerEffects(prop, value, target, currentStore) {
521
+ target[prop] = value, triggerEffects(currentStore.$container$, currentStore, getEffects(target, prop, currentStore.$effects$));
522
+ }
523
+ function getEffects(target, prop, storeEffects) {
524
+ let effectsToTrigger;
525
+ if (storeEffects) {
526
+ if (Array.isArray(target)) {
527
+ for (const effects of storeEffects.values()) {
528
+ effectsToTrigger || (effectsToTrigger = /* @__PURE__ */ new Set());
529
+ for (const effect of effects) {
530
+ effectsToTrigger.add(effect);
531
+ }
532
+ }
533
+ } else {
534
+ effectsToTrigger = storeEffects.get(prop);
535
+ }
433
536
  }
434
537
  const storeArrayValue = storeEffects?.get(STORE_ALL_PROPS);
435
538
  if (storeArrayValue) {
@@ -440,12 +543,10 @@ function getEffects(target, prop, storeEffects) {
440
543
  }
441
544
  return effectsToTrigger || null;
442
545
  }
443
- const NEEDS_COMPUTATION = Symbol("invalid");
444
- const _EFFECT_BACK_REF = Symbol("backRef");
445
- _a = _EFFECT_BACK_REF;
546
+ _e = _EFFECT_BACK_REF;
446
547
  class BackRef {
447
548
  constructor() {
448
- __publicField(this, _a, null);
549
+ __publicField(this, _e, null);
449
550
  }
450
551
  }
451
552
  function clearAllEffects(container, consumer) {
@@ -453,12 +554,12 @@ function clearAllEffects(container, consumer) {
453
554
  const effects = consumer[_EFFECT_BACK_REF];
454
555
  if (effects) {
455
556
  for (const [, effect] of effects) {
456
- const backRefs = effect[EffectSubscriptionProp.BACK_REF];
557
+ const backRefs = effect[2];
457
558
  if (!backRefs) {
458
559
  return;
459
560
  }
460
561
  for (const producer of backRefs) {
461
- if (producer instanceof Signal) {
562
+ if (producer instanceof SignalImpl) {
462
563
  clearSignal(container, producer, effect);
463
564
  } else if (container.$storeProxyMap$.has(producer)) {
464
565
  const target = container.$storeProxyMap$.get(producer);
@@ -480,21 +581,8 @@ function clearStore(producer, effect) {
480
581
  }
481
582
  }
482
583
  }
483
- function getSubscriber(effect, prop, data) {
484
- effect[_EFFECT_BACK_REF] || (isServer && isSsrNode(effect) ? effect.setProp("q:brefs", /* @__PURE__ */ new Map()) : effect[_EFFECT_BACK_REF] = /* @__PURE__ */ new Map());
485
- const subMap = effect[_EFFECT_BACK_REF];
486
- let sub = subMap.get(prop);
487
- return sub || (sub = [effect, prop], subMap.set(prop, sub)), data && (sub[EffectSubscriptionProp.DATA] = data), sub;
488
- }
489
- function isSsrNode(value) {
490
- return "__brand__" in value && "currentComponentNode" in value;
491
- }
492
- var TaskFlags;
493
- !function(TaskFlags2) {
494
- TaskFlags2[TaskFlags2.VISIBLE_TASK = 1] = "VISIBLE_TASK", TaskFlags2[TaskFlags2.TASK = 2] = "TASK", TaskFlags2[TaskFlags2.RESOURCE = 4] = "RESOURCE", TaskFlags2[TaskFlags2.DIRTY = 8] = "DIRTY";
495
- }(TaskFlags || (TaskFlags = {}));
496
584
  const runTask = (task, container, host) => {
497
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
585
+ task.$flags$ &= -9, cleanupTask(task);
498
586
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qTask");
499
587
  iCtx.$container$ = container;
500
588
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -513,7 +601,7 @@ const runTask = (task, container, host) => {
513
601
  const taskApi = {
514
602
  track: (obj, prop) => {
515
603
  const ctx = newInvokeContext();
516
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container, invoke(ctx, () => {
604
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container, invoke(ctx, () => {
517
605
  if (isFunction(obj)) {
518
606
  return obj();
519
607
  }
@@ -526,7 +614,7 @@ const runTask = (task, container, host) => {
526
614
  if (isStore(obj)) {
527
615
  return addStoreEffect(getStoreTarget(obj), STORE_ALL_PROPS, getStoreHandler(obj), ctx.$effectSubscriber$), obj;
528
616
  }
529
- throw qError(QError.trackObjectWithoutProp);
617
+ throw qError(2);
530
618
  });
531
619
  },
532
620
  cleanup: cleanup2
@@ -562,25 +650,33 @@ class Task extends BackRef {
562
650
  }
563
651
  }
564
652
  const isTask = (value) => value instanceof Task;
565
- var VNodeFlags;
566
- var VNodeFlagsIndex;
567
- var VNodeProps;
568
- var ElementVNodeProps;
569
- var TextVNodeProps;
570
- var VirtualVNodeProps;
571
- !function(VNodeFlags2) {
572
- VNodeFlags2[VNodeFlags2.Element = 1] = "Element", VNodeFlags2[VNodeFlags2.Virtual = 2] = "Virtual", VNodeFlags2[VNodeFlags2.ELEMENT_OR_VIRTUAL_MASK = 3] = "ELEMENT_OR_VIRTUAL_MASK", VNodeFlags2[VNodeFlags2.ELEMENT_OR_TEXT_MASK = 5] = "ELEMENT_OR_TEXT_MASK", VNodeFlags2[VNodeFlags2.TYPE_MASK = 7] = "TYPE_MASK", VNodeFlags2[VNodeFlags2.INFLATED_TYPE_MASK = 15] = "INFLATED_TYPE_MASK", VNodeFlags2[VNodeFlags2.Text = 4] = "Text", VNodeFlags2[VNodeFlags2.Inflated = 8] = "Inflated", VNodeFlags2[VNodeFlags2.Resolved = 16] = "Resolved", VNodeFlags2[VNodeFlags2.Deleted = 32] = "Deleted", VNodeFlags2[VNodeFlags2.NAMESPACE_MASK = 192] = "NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NEGATED_NAMESPACE_MASK = -193] = "NEGATED_NAMESPACE_MASK", VNodeFlags2[VNodeFlags2.NS_html = 0] = "NS_html", VNodeFlags2[VNodeFlags2.NS_svg = 64] = "NS_svg", VNodeFlags2[VNodeFlags2.NS_math = 128] = "NS_math";
573
- }(VNodeFlags || (VNodeFlags = {})), function(VNodeFlagsIndex2) {
574
- VNodeFlagsIndex2[VNodeFlagsIndex2.mask = -256] = "mask", VNodeFlagsIndex2[VNodeFlagsIndex2.negated_mask = 255] = "negated_mask", VNodeFlagsIndex2[VNodeFlagsIndex2.shift = 8] = "shift";
575
- }(VNodeFlagsIndex || (VNodeFlagsIndex = {})), function(VNodeProps2) {
576
- VNodeProps2[VNodeProps2.flags = 0] = "flags", VNodeProps2[VNodeProps2.parent = 1] = "parent", VNodeProps2[VNodeProps2.previousSibling = 2] = "previousSibling", VNodeProps2[VNodeProps2.nextSibling = 3] = "nextSibling";
577
- }(VNodeProps || (VNodeProps = {})), function(ElementVNodeProps2) {
578
- ElementVNodeProps2[ElementVNodeProps2.firstChild = 4] = "firstChild", ElementVNodeProps2[ElementVNodeProps2.lastChild = 5] = "lastChild", ElementVNodeProps2[ElementVNodeProps2.element = 6] = "element", ElementVNodeProps2[ElementVNodeProps2.elementName = 7] = "elementName", ElementVNodeProps2[ElementVNodeProps2.PROPS_OFFSET = 8] = "PROPS_OFFSET";
579
- }(ElementVNodeProps || (ElementVNodeProps = {})), function(TextVNodeProps2) {
580
- TextVNodeProps2[TextVNodeProps2.node = 4] = "node", TextVNodeProps2[TextVNodeProps2.text = 5] = "text";
581
- }(TextVNodeProps || (TextVNodeProps = {})), function(VirtualVNodeProps2) {
582
- VirtualVNodeProps2[VirtualVNodeProps2.firstChild = 4] = "firstChild", VirtualVNodeProps2[VirtualVNodeProps2.lastChild = 5] = "lastChild", VirtualVNodeProps2[VirtualVNodeProps2.PROPS_OFFSET = 6] = "PROPS_OFFSET";
583
- }(VirtualVNodeProps || (VirtualVNodeProps = {}));
653
+ const styleContent = (styleId) => "⚡️" + styleId;
654
+ function hasClassAttr(props) {
655
+ for (const key in props) {
656
+ if (Object.prototype.hasOwnProperty.call(props, key) && isClassAttr(key)) {
657
+ return true;
658
+ }
659
+ }
660
+ return false;
661
+ }
662
+ function isClassAttr(key) {
663
+ return "class" === key || "className" === key;
664
+ }
665
+ function convertScopedStyleIdsToArray(scopedStyleIds) {
666
+ return scopedStyleIds?.split(" ") ?? null;
667
+ }
668
+ function convertStyleIdsToString(scopedStyleIds) {
669
+ return Array.from(scopedStyleIds).join(" ");
670
+ }
671
+ const addComponentStylePrefix = (styleId) => {
672
+ if (styleId) {
673
+ let idx = 0;
674
+ do {
675
+ styleId = styleId.substring(0, idx) + styleContent(styleId.substring(idx));
676
+ } while (0 !== (idx = styleId.indexOf(" ", idx) + 1));
677
+ }
678
+ return styleId || null;
679
+ };
584
680
  const mapApp_findIndx = (array, key, start) => {
585
681
  let bottom = start >> 1;
586
682
  let top = array.length - 2 >> 1;
@@ -605,15 +701,15 @@ const mapArray_get = (array, key, start) => {
605
701
  const isForeignObjectElement = (elementName) => "foreignObject" === elementName;
606
702
  const isSvgElement = (elementName) => "svg" === elementName || isForeignObjectElement(elementName);
607
703
  const isMathElement = (elementName) => "math" === elementName;
608
- const vnode_isDefaultNamespace = (vnode) => !(vnode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK);
704
+ const vnode_isDefaultNamespace = (vnode) => !(192 & vnode[0]);
609
705
  const vnode_getElementNamespaceFlags = (element) => {
610
706
  switch (fastNamespaceURI(element)) {
611
707
  case SVG_NS:
612
- return VNodeFlags.NS_svg;
708
+ return 64;
613
709
  case MATH_NS:
614
- return VNodeFlags.NS_math;
710
+ return 128;
615
711
  default:
616
- return VNodeFlags.NS_html;
712
+ return 0;
617
713
  }
618
714
  };
619
715
  function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild) {
@@ -626,11 +722,11 @@ function vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNo
626
722
  for (let i = 0; i < children.length; i++) {
627
723
  const childVNode = children[i];
628
724
  if (vnode_isTextVNode(childVNode)) {
629
- domChildren.push(childVNode[TextVNodeProps.node]);
725
+ domChildren.push(childVNode[4]);
630
726
  continue;
631
727
  }
632
- if ((childVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK) == (domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK)) {
633
- domChildren.push(childVNode[ElementVNodeProps.element]);
728
+ if ((192 & childVNode[0]) == (192 & domParentVNode[0])) {
729
+ domChildren.push(childVNode[6]);
634
730
  continue;
635
731
  }
636
732
  const newChildElement = vnode_cloneElementWithNamespace(childVNode, domParentVNode, elementNamespace, elementNamespaceFlag);
@@ -658,7 +754,7 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
658
754
  let childElement = null;
659
755
  let newChildElement = null;
660
756
  if (vnode_isElementVNode(vCursor)) {
661
- childElement = vCursor[ElementVNodeProps.element];
757
+ childElement = vCursor[6];
662
758
  const childElementTag = vnode_getElementName(vCursor);
663
759
  const vCursorParent = vnode_getParent(vCursor);
664
760
  const vCursorDomParent = null == rootElement ? parentVNode : vCursorParent && vnode_getDomParentVNode(vCursorParent);
@@ -668,7 +764,7 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
668
764
  }
669
765
  newChildElement = cloneElementWithNamespace(childElement, childElementTag, namespace), childElement.remove(), null == rootElement && (rootElement = newChildElement), parentElement && parentElement.appendChild(newChildElement);
670
766
  const vFirstChild = vnode_getFirstChild(vCursor);
671
- if (vCursor[ElementVNodeProps.element] = newChildElement, vCursor[VNodeProps.flags] &= VNodeFlags.NEGATED_NAMESPACE_MASK, vCursor[VNodeProps.flags] |= namespaceFlag, vFirstChild) {
767
+ if (vCursor[6] = newChildElement, vCursor[0] &= -193, vCursor[0] |= namespaceFlag, vFirstChild) {
672
768
  vCursor = vFirstChild, parentElement = newChildElement;
673
769
  continue;
674
770
  }
@@ -708,23 +804,23 @@ function vnode_cloneElementWithNamespace(elementVNode, parentVNode, namespace, n
708
804
  return rootElement;
709
805
  }
710
806
  function isSvg(tagOrVNode) {
711
- return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_svg);
807
+ return "string" == typeof tagOrVNode ? isSvgElement(tagOrVNode) : !!(64 & tagOrVNode[0]);
712
808
  }
713
809
  function isMath(tagOrVNode) {
714
- return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!(tagOrVNode[VNodeProps.flags] & VNodeFlags.NS_math);
810
+ return "string" == typeof tagOrVNode ? isMathElement(tagOrVNode) : !!(128 & tagOrVNode[0]);
715
811
  }
716
812
  function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
717
813
  const parentIsDefaultNamespace = !domParentVNode || !!vnode_getElementName(domParentVNode) && vnode_isDefaultNamespace(domParentVNode);
718
814
  const parentIsForeignObject = !parentIsDefaultNamespace && isForeignObjectElement(vnode_getElementName(domParentVNode));
719
815
  let elementNamespace = HTML_NS;
720
- let elementNamespaceFlag = VNodeFlags.NS_html;
816
+ let elementNamespaceFlag = 0;
721
817
  const isElementVNodeOrString = "string" == typeof tagOrVNode || vnode_isElementVNode(tagOrVNode);
722
818
  if (isElementVNodeOrString && isSvg(tagOrVNode)) {
723
- elementNamespace = SVG_NS, elementNamespaceFlag = VNodeFlags.NS_svg;
819
+ elementNamespace = SVG_NS, elementNamespaceFlag = 64;
724
820
  } else if (isElementVNodeOrString && isMath(tagOrVNode)) {
725
- elementNamespace = MATH_NS, elementNamespaceFlag = VNodeFlags.NS_math;
821
+ elementNamespace = MATH_NS, elementNamespaceFlag = 128;
726
822
  } else if (domParentVNode && !parentIsForeignObject && !parentIsDefaultNamespace) {
727
- elementNamespace = !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_svg) ? SVG_NS : !!(domParentVNode[VNodeProps.flags] & VNodeFlags.NS_math) ? MATH_NS : HTML_NS, elementNamespaceFlag = domParentVNode[VNodeProps.flags] & VNodeFlags.NAMESPACE_MASK;
823
+ elementNamespace = !!(64 & domParentVNode[0]) ? SVG_NS : !!(128 & domParentVNode[0]) ? MATH_NS : HTML_NS, elementNamespaceFlag = 192 & domParentVNode[0];
728
824
  }
729
825
  return {
730
826
  elementNamespace,
@@ -734,7 +830,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
734
830
  const executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
735
831
  const iCtx = newInvokeContext(container.$locale$, subscriptionHost || void 0, void 0, "qRender");
736
832
  let componentFn;
737
- subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, EffectProperty.COMPONENT), iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
833
+ subscriptionHost && (iCtx.$effectSubscriber$ = getSubscriber(subscriptionHost, ":"), iCtx.$container$ = container), container.ensureProjectionResolved(renderHost);
738
834
  let isInlineComponent = false;
739
835
  if (null === componentQRL && assertDefined(componentQRL = container.getHostProp(renderHost, "q:renderFn")), isQrl$1(componentQRL)) {
740
836
  (props = props || container.getHostProp(renderHost, "q:props") || EMPTY_OBJ).children && delete props.children, componentFn = componentQRL.getFn(iCtx);
@@ -853,16 +949,84 @@ function escapeHTML(html) {
853
949
  }
854
950
  return 0 === lastIdx ? html : escapedHTML + html.substring(lastIdx);
855
951
  }
856
- const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
857
- let journal = container.$journal$;
858
- const stack2 = [];
859
- const asyncQueue = [];
860
- let vParent = null;
861
- let vCurrent = null;
862
- let vNewNode = null;
863
- let vSiblings = null;
864
- let vSiblingsIdx = -1;
865
- let jsxChildren = null;
952
+ const unitlessNumbers = /* @__PURE__ */ new Set(["animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexShrink", "gridArea", "gridRow", "gridRowEnd", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "MozAnimationIterationCount", "MozBoxFlex", "msFlex", "msFlexPositive", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexShrink", "WebkitLineClamp"]);
953
+ const isUnitlessNumber = (name) => unitlessNumbers.has(name);
954
+ const serializeClass = (obj) => {
955
+ if (!obj) {
956
+ return "";
957
+ }
958
+ if (isString(obj)) {
959
+ return obj.trim();
960
+ }
961
+ const classes = [];
962
+ if (isArray(obj)) {
963
+ for (const o of obj) {
964
+ const classList = serializeClass(o);
965
+ classList && classes.push(classList);
966
+ }
967
+ } else {
968
+ for (const [key, value] of Object.entries(obj)) {
969
+ value && classes.push(key.trim());
970
+ }
971
+ }
972
+ return classes.join(" ");
973
+ };
974
+ const fromCamelToKebabCaseWithDash = (text) => text.replace(/([A-Z])/g, "-$1").toLowerCase();
975
+ const stringifyStyle = (obj) => {
976
+ if (null == obj) {
977
+ return "";
978
+ }
979
+ if ("object" == typeof obj) {
980
+ if (isArray(obj)) {
981
+ throw qError(0, [obj, "style"]);
982
+ }
983
+ {
984
+ const chunks = [];
985
+ for (const key in obj) {
986
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
987
+ const value = obj[key];
988
+ null != value && "function" != typeof value && (key.startsWith("--") ? chunks.push(key + ":" + value) : chunks.push(fromCamelToKebabCaseWithDash(key) + ":" + setValueForStyle(key, value)));
989
+ }
990
+ }
991
+ return chunks.join(";");
992
+ }
993
+ }
994
+ return String(obj);
995
+ };
996
+ const serializeBooleanOrNumberAttribute = (value) => null != value ? String(value) : null;
997
+ function serializeAttribute(key, value, styleScopedId) {
998
+ if (isClassAttr(key)) {
999
+ const serializedClass = serializeClass(value);
1000
+ value = styleScopedId ? styleScopedId + (serializedClass.length ? " " + serializedClass : serializedClass) : serializedClass;
1001
+ } else {
1002
+ "style" === key ? value = stringifyStyle(value) : isEnumeratedBooleanAttribute(key) || "number" == typeof value ? value = serializeBooleanOrNumberAttribute(value) : false === value || null == value ? value = null : true === value && isPreventDefault(key) && (value = "");
1003
+ }
1004
+ return value;
1005
+ }
1006
+ function isEnumeratedBooleanAttribute(key) {
1007
+ return isAriaAttribute(key) || ["spellcheck", "draggable", "contenteditable"].includes(key);
1008
+ }
1009
+ const setValueForStyle = (styleName, value) => "number" != typeof value || 0 === value || isUnitlessNumber(styleName) ? value : value + "px";
1010
+ function isAriaAttribute(prop) {
1011
+ return prop.startsWith("aria-");
1012
+ }
1013
+ function getFileLocationFromJsx(jsxDev) {
1014
+ if (!jsxDev) {
1015
+ return null;
1016
+ }
1017
+ const sanitizedFileName = jsxDev.fileName?.replace(/\\/g, "/");
1018
+ return sanitizedFileName ? `${sanitizedFileName}:${jsxDev.lineNumber}:${jsxDev.columnNumber}` : null;
1019
+ }
1020
+ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1021
+ let journal = container.$journal$;
1022
+ const stack2 = [];
1023
+ const asyncQueue = [];
1024
+ let vParent = null;
1025
+ let vCurrent = null;
1026
+ let vNewNode = null;
1027
+ let vSiblings = null;
1028
+ let vSiblingsArray = null;
1029
+ let jsxChildren = null;
866
1030
  let jsxValue = null;
867
1031
  let jsxIdx = 0;
868
1032
  let jsxCount = 0;
@@ -888,12 +1052,12 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
888
1052
  if (Array.isArray(jsxValue)) {
889
1053
  descend(jsxValue, false);
890
1054
  } else if (isSignal(jsxValue)) {
891
- vCurrent && clearAllEffects(container, vCurrent), expectVirtual(VirtualType.WrappedSignal, null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, EffectProperty.VNODE, container), true);
1055
+ vCurrent && clearAllEffects(container, vCurrent), expectVirtual("S", null), descend(trackSignalAndAssignHost(jsxValue, vNewNode || vCurrent, ".", container), true);
892
1056
  } else if (isPromise(jsxValue)) {
893
- expectVirtual(VirtualType.Awaited, null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
1057
+ expectVirtual("A", null), asyncQueue.push(jsxValue, vNewNode || vCurrent);
894
1058
  } else if (isJSXNode(jsxValue)) {
895
1059
  const type = jsxValue.type;
896
- "string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type), descend(jsxValue.children, true)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(), expectVirtual(VirtualType.Fragment, jsxValue.key), descend(jsxValue.children, true)) : type === Slot ? (expectNoMoreTextNodes(), expectSlot() || descend(jsxValue.children, true)) : type === Projection ? (expectProjection(), descend(jsxValue.children, true)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(), expectComponent(type)));
1060
+ "string" == typeof type ? (expectNoMoreTextNodes(), expectElement(jsxValue, type), descend(jsxValue.children, true)) : "function" == typeof type && (type === Fragment ? (expectNoMoreTextNodes(), expectVirtual("F", jsxValue.key), descend(jsxValue.children, true)) : type === Slot ? (expectNoMoreTextNodes(), expectSlot() || descend(jsxValue.children, true)) : type === Projection ? (expectProjection(), descend(jsxValue.children, true)) : type === SSRComment || type === SSRRaw ? expectNoMore() : (expectNoMoreTextNodes(), expectComponent(type)));
897
1061
  }
898
1062
  } else {
899
1063
  jsxValue === SkipRender ? journal = [] : expectText("");
@@ -916,17 +1080,13 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
916
1080
  }
917
1081
  }
918
1082
  function peekNextSibling() {
919
- if (null !== vSiblings) {
920
- const idx = vSiblingsIdx + SiblingsArray.NextVNode;
921
- return idx < vSiblings.length ? vSiblings[idx] : null;
922
- }
923
1083
  return vCurrent ? vnode_getNextSibling(vCurrent) : null;
924
1084
  }
925
1085
  function advanceToNextSibling() {
926
- vCurrent = peekNextSibling(), null !== vSiblings && (vSiblingsIdx += SiblingsArray.Size);
1086
+ vCurrent = peekNextSibling();
927
1087
  }
928
1088
  function descend(children, descendVNode) {
929
- null != children ? (stackPush(children, descendVNode), descendVNode && (vSiblings = null, vSiblingsIdx = -1, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent), vNewNode = null), shouldAdvance = false) : function() {
1089
+ null != children ? (stackPush(children, descendVNode), descendVNode && (vSiblings = null, vSiblingsArray = null, vParent = vNewNode || vCurrent, vCurrent = vnode_getFirstChild(vParent), vNewNode = null), shouldAdvance = false) : function() {
930
1090
  const vFirstChild = vCurrent && vnode_getFirstChild(vCurrent);
931
1091
  if (null !== vFirstChild) {
932
1092
  let vChild = vFirstChild;
@@ -938,24 +1098,17 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
938
1098
  }();
939
1099
  }
940
1100
  function ascend() {
941
- stack2.pop() && (vSiblingsIdx = stack2.pop(), vSiblings = stack2.pop(), vNewNode = stack2.pop(), vCurrent = stack2.pop(), vParent = stack2.pop()), jsxValue = stack2.pop(), jsxCount = stack2.pop(), jsxIdx = stack2.pop(), jsxChildren = stack2.pop(), advance();
1101
+ stack2.pop() && (vSiblings = stack2.pop(), vSiblingsArray = stack2.pop(), vNewNode = stack2.pop(), vCurrent = stack2.pop(), vParent = stack2.pop()), jsxValue = stack2.pop(), jsxCount = stack2.pop(), jsxIdx = stack2.pop(), jsxChildren = stack2.pop(), advance();
942
1102
  }
943
1103
  function stackPush(children, descendVNode) {
944
- stack2.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack2.push(vParent, vCurrent, vNewNode, vSiblings, vSiblingsIdx), stack2.push(descendVNode), Array.isArray(children) ? (jsxIdx = 0, jsxCount = children.length, jsxChildren = children, jsxValue = jsxCount > 0 ? children[0] : null) : void 0 === children ? (jsxIdx = 0, jsxValue = null, jsxChildren = null, jsxCount = 0) : (jsxIdx = 0, jsxValue = children, jsxChildren = null, jsxCount = 1);
1104
+ stack2.push(jsxChildren, jsxIdx, jsxCount, jsxValue), descendVNode && stack2.push(vParent, vCurrent, vNewNode, vSiblingsArray, vSiblings), stack2.push(descendVNode), Array.isArray(children) ? (jsxIdx = 0, jsxCount = children.length, jsxChildren = children, jsxValue = jsxCount > 0 ? children[0] : null) : void 0 === children ? (jsxIdx = 0, jsxValue = null, jsxChildren = null, jsxCount = 0) : (jsxIdx = 0, jsxValue = children, jsxChildren = null, jsxCount = 1);
945
1105
  }
946
1106
  function getInsertBefore() {
947
- if (vNewNode) {
948
- return vCurrent;
949
- }
950
- if (null !== vSiblings) {
951
- const nextIdx = vSiblingsIdx + SiblingsArray.NextVNode;
952
- return nextIdx < vSiblings.length ? vSiblings[nextIdx] : null;
953
- }
954
- return peekNextSibling();
1107
+ return vNewNode ? vCurrent : peekNextSibling();
955
1108
  }
956
1109
  function expectProjection() {
957
1110
  const slotName = jsxValue.key;
958
- vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && vCurrent[VNodeProps.flags] & VNodeFlags.Deleted ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
1111
+ vCurrent = vnode_getProp(vParent, slotName, (id) => vnode_locate(container.rootVNode, id)), vCurrent = vCurrent && 32 & vCurrent[0] ? null : vCurrent, null == vCurrent && (vNewNode = vnode_newVirtual(), vnode_setProp(vNewNode, QSlot, slotName), vnode_setProp(vNewNode, "q:sparent", vParent), vnode_setProp(vParent, slotName, vNewNode));
959
1112
  }
960
1113
  function expectSlot() {
961
1114
  const vHost = vnode_getProjectionParentComponent(vParent, container.rootVNode);
@@ -965,21 +1118,13 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
965
1118
  if (constProps && "object" == typeof constProps && "name" in constProps) {
966
1119
  const constValue = constProps.name;
967
1120
  if (vHost2 && constValue instanceof WrappedSignal) {
968
- return trackSignalAndAssignHost(constValue, vHost2, EffectProperty.COMPONENT, container);
1121
+ return trackSignalAndAssignHost(constValue, vHost2, ":", container);
969
1122
  }
970
1123
  }
971
1124
  return directGetPropsProxyProp(jsxNode2, "name") || "";
972
1125
  }(vHost);
973
1126
  const vProjectedNode = vHost ? vnode_getProp(vHost, slotNameKey, null) : null;
974
- if (null == vProjectedNode) {
975
- return vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false;
976
- }
977
- if (vProjectedNode === vCurrent) ;
978
- else {
979
- const parent = vnode_getParent(vProjectedNode);
980
- !(!parent || vnode_isElementVNode(parent) && vnode_getElementName(parent) === QTemplate) && vParent !== parent && vnode_remove(journal, parent, vProjectedNode, false), vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
981
- }
982
- return true;
1127
+ return null == vProjectedNode ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), false) : (vProjectedNode === vCurrent || (vnode_insertBefore(journal, vParent, vNewNode = vProjectedNode, vCurrent && getInsertBefore()), vnode_setProp(vNewNode, QSlot, slotNameKey), vHost && vnode_setProp(vHost, slotNameKey, vNewNode), isDev), true);
983
1128
  }
984
1129
  function expectNoMore() {
985
1130
  if (null !== vCurrent) {
@@ -1001,7 +1146,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1001
1146
  const domParentVNode = vnode_getDomParentVNode(vParent);
1002
1147
  const { elementNamespace, elementNamespaceFlag } = getNewElementNamespaceData(domParentVNode, elementName2);
1003
1148
  const element2 = container.document.createElementNS(elementNamespace, elementName2);
1004
- return vNewNode = vnode_newElement(element2, elementName2), vNewNode[VNodeProps.flags] |= elementNamespaceFlag, element2;
1149
+ return vNewNode = vnode_newElement(element2, elementName2), vNewNode[0] |= elementNamespaceFlag, element2;
1005
1150
  }(elementName);
1006
1151
  const { constProps } = jsx2;
1007
1152
  let needsQDispatchEventPatch = false;
@@ -1009,10 +1154,10 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1009
1154
  for (const key2 in constProps) {
1010
1155
  let value = constProps[key2];
1011
1156
  if (isJsxPropertyAnEventName(key2)) {
1012
- const eventName = getEventNameFromJsxProp(key2);
1013
- const scope = getEventNameScopeFromJsxProp(key2);
1157
+ const eventName = getEventNameFromJsxEvent(key2);
1158
+ const scope = getEventNameScopeFromJsxEvent(key2);
1014
1159
  if (eventName && (vnode_setProp(vNewNode, HANDLER_PREFIX + ":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)), scope) {
1015
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key2);
1160
+ const htmlEvent = jsxEventToHtmlAttribute(key2);
1016
1161
  htmlEvent && vnode_setAttr(journal, vNewNode, htmlEvent, "");
1017
1162
  }
1018
1163
  needsQDispatchEventPatch = true;
@@ -1029,7 +1174,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1029
1174
  if (null == value) {
1030
1175
  continue;
1031
1176
  }
1032
- throw qError(QError.invalidRefValue, [currentFile]);
1177
+ throw qError(32, [currentFile]);
1033
1178
  }
1034
1179
  if (isSignal(value)) {
1035
1180
  const signalData = new SubscriptionData({
@@ -1048,7 +1193,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1048
1193
  element.value = escapeHTML(value || "");
1049
1194
  }
1050
1195
  } else {
1051
- element.innerHTML = value, element.setAttribute("q:container", QContainerValue.HTML);
1196
+ element.innerHTML = value, element.setAttribute("q:container", "html");
1052
1197
  }
1053
1198
  }
1054
1199
  }
@@ -1062,7 +1207,7 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1062
1207
  const jsxKey = jsx2.key;
1063
1208
  let needsQDispatchEventPatch = false;
1064
1209
  const currentFile = getFileLocationFromJsx(jsx2.dev);
1065
- isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey), null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx2, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent), vCurrent = vNewNode, vNewNode = null, null !== vSiblings && (vSiblingsIdx -= SiblingsArray.Size)));
1210
+ isSameElementName && jsxKey === getKey(vCurrent) || (vNewNode = retrieveChildWithKey(elementName, jsxKey), null === vNewNode ? needsQDispatchEventPatch = createNewElement(jsx2, elementName) : (vnode_insertBefore(journal, vParent, vNewNode, vCurrent), vCurrent = vNewNode, vNewNode = null));
1066
1211
  const jsxAttrs = [];
1067
1212
  const props = jsx2.varProps;
1068
1213
  for (const key in props) {
@@ -1071,7 +1216,8 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1071
1216
  }
1072
1217
  null !== jsxKey && mapArray_set(jsxAttrs, "q:key", jsxKey, 0);
1073
1218
  const vNode = vNewNode || vCurrent;
1074
- if (needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile2) {
1219
+ const element = vNode[6];
1220
+ element.vNode = new WeakRef(vNode), needsQDispatchEventPatch = function(vnode, srcAttrs, currentFile2) {
1075
1221
  vnode_ensureElementInflated(vnode);
1076
1222
  const dstAttrs = vnode_getProps(vnode);
1077
1223
  let srcIdx = 0;
@@ -1086,17 +1232,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1086
1232
  vnode_setProp(vnode, key, value);
1087
1233
  } else {
1088
1234
  if ("ref" === key) {
1089
- const element = vnode_getNode(vnode);
1235
+ const element2 = vnode_getNode(vnode);
1090
1236
  if (isSignal(value)) {
1091
- return void (value.value = element);
1237
+ return void (value.value = element2);
1092
1238
  }
1093
1239
  if ("function" == typeof value) {
1094
- return void value(element);
1095
- }
1096
- if (null == value) {
1097
- return;
1240
+ return void value(element2);
1098
1241
  }
1099
- throw qError(QError.invalidRefValue, [currentFile2]);
1242
+ throw qError(32, [currentFile2]);
1100
1243
  }
1101
1244
  if (isSignal(value)) {
1102
1245
  const signalData = new SubscriptionData({
@@ -1105,14 +1248,14 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1105
1248
  });
1106
1249
  value = trackSignalAndAssignHost(value, vnode, key, container, signalData);
1107
1250
  }
1108
- vnode_setAttr(journal, vnode, key, serializeAttribute(key, value, scopedStyleIdPrefix)), null === value && (dstLength = dstAttrs.length);
1251
+ vnode_setAttr(journal, vnode, key, null !== value ? serializeAttribute(key, value, scopedStyleIdPrefix) : null), null === value && (dstLength = dstAttrs.length);
1109
1252
  }
1110
1253
  };
1111
1254
  const recordJsxEvent = (key, value) => {
1112
- const eventName = getEventNameFromJsxProp(key);
1113
- const scope = getEventNameScopeFromJsxProp(key);
1255
+ const eventName = getEventNameFromJsxEvent(key);
1256
+ const scope = getEventNameScopeFromJsxEvent(key);
1114
1257
  if (eventName && (record(":" + scope + ":" + eventName, value), registerQwikLoaderEvent(eventName)), scope) {
1115
- const htmlEvent = convertEventNameFromJsxPropToHtmlAttr(key);
1258
+ const htmlEvent = jsxEventToHtmlAttribute(key);
1116
1259
  htmlEvent && record(htmlEvent, "");
1117
1260
  }
1118
1261
  };
@@ -1120,32 +1263,29 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1120
1263
  if (dstKey?.startsWith(HANDLER_PREFIX) || dstKey?.startsWith("q:")) {
1121
1264
  dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1122
1265
  } else if (null == srcKey) {
1123
- dstKey && isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1266
+ dstKey && isHtmlAttributeAnEventName(dstKey) ? dstIdx++ : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1124
1267
  } else if (null == dstKey) {
1125
1268
  isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1126
1269
  } else if (srcKey == dstKey) {
1127
1270
  const srcValue = srcAttrs[srcIdx++];
1128
1271
  srcValue !== dstAttrs[dstIdx++] && record(dstKey, srcValue), srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
1129
1272
  } else {
1130
- srcKey < dstKey ? (isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null);
1273
+ srcKey < dstKey ? (isJsxPropertyAnEventName(srcKey) ? (patchEventDispatch = true, recordJsxEvent(srcKey, srcAttrs[srcIdx])) : record(srcKey, srcAttrs[srcIdx]), srcIdx++, srcKey = srcIdx < srcLength ? srcAttrs[srcIdx++] : null, dstIdx++, dstLength = dstAttrs.length, dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null) : (isHtmlAttributeAnEventName(dstKey) ? (patchEventDispatch = true, dstIdx++) : (record(dstKey, null), dstIdx--), dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null);
1131
1274
  }
1132
1275
  }
1133
1276
  return patchEventDispatch;
1134
- }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch) {
1135
- const element = vnode_getNode(vNode);
1136
- element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1137
- const eventName = event.type;
1138
- const eventProp = ":" + scope.substring(1) + ":" + eventName;
1139
- const qrls = [vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null)];
1140
- let returnValue = false;
1141
- return qrls.flat(2).forEach((qrl2) => {
1142
- if (qrl2) {
1143
- const value = container.$scheduler$(ChoreType.RUN_QRL, vNode, qrl2, [event, element]);
1144
- returnValue = returnValue || true === value;
1145
- }
1146
- }), returnValue;
1147
- });
1148
- }
1277
+ }(vNode, jsxAttrs, currentFile) || needsQDispatchEventPatch, needsQDispatchEventPatch && (element.qDispatchEvent || (element.qDispatchEvent = (event, scope) => {
1278
+ const eventName = event.type;
1279
+ const eventProp = ":" + scope.substring(1) + ":" + eventName;
1280
+ const qrls = [vnode_getProp(vNode, eventProp, null), vnode_getProp(vNode, HANDLER_PREFIX + eventProp, null)];
1281
+ let returnValue = false;
1282
+ return qrls.flat(2).forEach((qrl2) => {
1283
+ if (qrl2) {
1284
+ const value = container.$scheduler$(2, vNode, qrl2, [event, element]);
1285
+ returnValue = returnValue || true === value;
1286
+ }
1287
+ }), returnValue;
1288
+ }));
1149
1289
  }
1150
1290
  function registerQwikLoaderEvent(eventName) {
1151
1291
  const window2 = container.document.defaultView;
@@ -1153,26 +1293,29 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1153
1293
  }
1154
1294
  function retrieveChildWithKey(nodeName, key) {
1155
1295
  let vNodeWithKey = null;
1156
- if (-1 === vSiblingsIdx) {
1157
- vSiblings = [], vSiblingsIdx = 0;
1296
+ if (null === vSiblings) {
1297
+ vSiblings = /* @__PURE__ */ new Map(), vSiblingsArray = [];
1158
1298
  let vNode = vCurrent;
1159
1299
  for (; vNode; ) {
1160
1300
  const name = vnode_isElementVNode(vNode) ? vnode_getElementName(vNode) : null;
1161
1301
  const vKey = getKey(vNode) || getComponentHash(vNode, container.$getObjectById$);
1162
- null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : vSiblings.push(name, vKey, vNode), vNode = vnode_getNextSibling(vNode);
1302
+ null === vNodeWithKey && vKey == key && name == nodeName ? vNodeWithKey = vNode : null === vKey ? vSiblingsArray.push(name, vNode) : vSiblings.set(name + ":" + vKey, vNode), vNode = vnode_getNextSibling(vNode);
1163
1303
  }
1164
- } else {
1165
- for (let idx = vSiblingsIdx; idx < vSiblings.length; idx += SiblingsArray.Size) {
1166
- if (vSiblings[idx + SiblingsArray.Key] === key && vSiblings[idx + SiblingsArray.Name] === nodeName) {
1167
- vNodeWithKey = vSiblings[idx + SiblingsArray.VNode], vSiblings?.splice(idx, SiblingsArray.Size);
1304
+ } else if (null === key) {
1305
+ for (let i = 0; i < vSiblingsArray.length; i += 2) {
1306
+ if (vSiblingsArray[i] === nodeName) {
1307
+ vNodeWithKey = vSiblingsArray[i + 1], vSiblingsArray.splice(i, 2);
1168
1308
  break;
1169
1309
  }
1170
1310
  }
1311
+ } else {
1312
+ const vSibling = vSiblings.get(nodeName + ":" + key);
1313
+ vSibling && (vNodeWithKey = vSibling, vSiblings.delete(nodeName + ":" + key));
1171
1314
  }
1172
1315
  return vNodeWithKey;
1173
1316
  }
1174
1317
  function expectVirtual(type, jsxKey) {
1175
- vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey), null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, "q:key", jsxKey), isDev) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1318
+ vCurrent && vnode_isVirtualVNode(vCurrent) && getKey(vCurrent) === jsxKey && jsxKey || (null === jsxKey || (vNewNode = retrieveChildWithKey(null, jsxKey), null == vNewNode) ? (vnode_insertBefore(journal, vParent, vNewNode = vnode_newVirtual(), vCurrent && getInsertBefore()), vnode_setProp(vNewNode, "q:key", jsxKey), isDev) : vnode_insertBefore(journal, vParent, vNewNode, vCurrent && getInsertBefore()));
1176
1319
  }
1177
1320
  function expectComponent(component) {
1178
1321
  const componentMeta = component[SERIALIZABLE_STATE];
@@ -1185,9 +1328,9 @@ const vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1185
1328
  const componentHash = componentQRL.$hash$;
1186
1329
  const vNodeComponentHash = getComponentHash(host, container.$getObjectById$);
1187
1330
  const lookupKey = jsxNode2.key || componentHash;
1188
- if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1331
+ if (lookupKey === (getKey(host) || vNodeComponentHash) ? componentHash === vNodeComponentHash && jsxNode2.key || (insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true) : (vNewNode = retrieveChildWithKey(null, lookupKey), vNewNode ? vnode_insertBefore(journal, vParent, vNewNode, vCurrent) : insertNewComponent(host, componentQRL, jsxProps), host = vNewNode, shouldRender = true), host) {
1189
1332
  const vNodeProps = vnode_getProp(host, "q:props", container.$getObjectById$);
1190
- shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[VNodeProps.flags] &= ~VNodeFlags.Deleted, container.$scheduler$(ChoreType.COMPONENT, host, componentQRL, jsxProps));
1333
+ shouldRender = shouldRender || propsDiffer(jsxProps, vNodeProps), shouldRender && (host[0] &= -33, container.$scheduler$(6, host, componentQRL, jsxProps));
1191
1334
  }
1192
1335
  !function(children, host2) {
1193
1336
  const projectionChildren = Array.isArray(children) ? children : [children];
@@ -1295,21 +1438,21 @@ function cleanup(container, vNode) {
1295
1438
  }
1296
1439
  let vParent = null;
1297
1440
  for (; ; ) {
1298
- const type = vCursor[VNodeProps.flags];
1299
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
1300
- if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), type & VNodeFlags.Virtual) {
1441
+ const type = vCursor[0];
1442
+ if (3 & type) {
1443
+ if (clearAllEffects(container, vCursor), markVNodeAsDeleted(vCursor), 2 & type) {
1301
1444
  const seq = container.getHostProp(vCursor, "q:seq");
1302
1445
  if (seq) {
1303
1446
  for (let i = 0; i < seq.length; i++) {
1304
1447
  const obj = seq[i];
1305
1448
  if (isTask(obj)) {
1306
1449
  const task = obj;
1307
- clearAllEffects(container, task), task.$flags$ & TaskFlags.VISIBLE_TASK ? container.$scheduler$(ChoreType.CLEANUP_VISIBLE, task) : cleanupTask(task);
1450
+ clearAllEffects(container, task), 1 & task.$flags$ ? container.$scheduler$(48, task) : cleanupTask(task);
1308
1451
  }
1309
1452
  }
1310
1453
  }
1311
1454
  }
1312
- if (type & VNodeFlags.Virtual && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1455
+ if (2 & type && null !== vnode_getProp(vCursor, "q:renderFn", null)) {
1313
1456
  const attrs = vnode_getProps(vCursor);
1314
1457
  for (let i = 0; i < attrs.length; i += 2) {
1315
1458
  if (isSlotProp(attrs[i])) {
@@ -1341,7 +1484,7 @@ function cleanup(container, vNode) {
1341
1484
  }
1342
1485
  }
1343
1486
  } else {
1344
- type & VNodeFlags.Text && markVNodeAsDeleted(vCursor);
1487
+ 4 & type && markVNodeAsDeleted(vCursor);
1345
1488
  }
1346
1489
  if (vCursor === vNode) {
1347
1490
  return;
@@ -1370,17 +1513,13 @@ function cleanup(container, vNode) {
1370
1513
  function cleanupStaleUnclaimedProjection(journal, projection) {
1371
1514
  const projectionParent = vnode_getParent(projection);
1372
1515
  if (projectionParent) {
1373
- projectionParent[VNodeProps.flags] & VNodeFlags.Element && vnode_getElementName(projectionParent) === QTemplate && vnode_remove(journal, projectionParent, projection, true);
1516
+ 1 & projectionParent[0] && vnode_getElementName(projectionParent) === QTemplate && vnode_remove(journal, projectionParent, projection, true);
1374
1517
  }
1375
1518
  }
1376
1519
  function markVNodeAsDeleted(vCursor) {
1377
- vCursor[VNodeProps.flags] |= VNodeFlags.Deleted;
1520
+ vCursor[0] |= 32;
1378
1521
  }
1379
1522
  const HANDLER_PREFIX = ":";
1380
- var SiblingsArray;
1381
- !function(SiblingsArray2) {
1382
- SiblingsArray2[SiblingsArray2.Name = 0] = "Name", SiblingsArray2[SiblingsArray2.Key = 1] = "Key", SiblingsArray2[SiblingsArray2.VNode = 2] = "VNode", SiblingsArray2[SiblingsArray2.Size = 3] = "Size", SiblingsArray2[SiblingsArray2.NextVNode = 5] = "NextVNode";
1383
- }(SiblingsArray || (SiblingsArray = {}));
1384
1523
  const _createResourceReturn = (opts) => ({
1385
1524
  __brand: "resource",
1386
1525
  value: void 0,
@@ -1393,10 +1532,10 @@ const _createResourceReturn = (opts) => ({
1393
1532
  });
1394
1533
  const createResourceReturn = (container, opts, initialPromise) => {
1395
1534
  const result = _createResourceReturn();
1396
- return result.value = initialPromise, createStore(container, result, StoreFlags.RECURSIVE);
1535
+ return result.value = initialPromise, createStore(container, result, 1);
1397
1536
  };
1398
1537
  const runResource = (task, container, host) => {
1399
- task.$flags$ &= ~TaskFlags.DIRTY, cleanupTask(task);
1538
+ task.$flags$ &= -9, cleanupTask(task);
1400
1539
  const iCtx = newInvokeContext(container.$locale$, host, void 0, "qResource");
1401
1540
  iCtx.$container$ = container;
1402
1541
  const taskFn = task.$qrl$.getFn(iCtx, () => clearAllEffects(container, task));
@@ -1415,7 +1554,7 @@ const runResource = (task, container, host) => {
1415
1554
  const opts = {
1416
1555
  track: (obj, prop) => {
1417
1556
  const ctx = newInvokeContext();
1418
- return ctx.$effectSubscriber$ = getSubscriber(task, EffectProperty.COMPONENT), ctx.$container$ = container, invoke(ctx, () => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj);
1557
+ return ctx.$effectSubscriber$ = getSubscriber(task, ":"), ctx.$container$ = container, invoke(ctx, () => isFunction(obj) ? obj() : prop ? obj[prop] : isSignal(obj) ? obj.value : obj);
1419
1558
  },
1420
1559
  cleanup(fn) {
1421
1560
  "function" == typeof fn && cleanups.push(fn);
@@ -1465,10 +1604,10 @@ const vnode_documentPosition = (a2, b, rootVNode) => {
1465
1604
  let aDepth = -1;
1466
1605
  let bDepth = -1;
1467
1606
  for (; a2; ) {
1468
- a2 = (aVNodePath[++aDepth] = a2)[VNodeProps.parent] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1607
+ a2 = (aVNodePath[++aDepth] = a2)[1] || rootVNode && vnode_getProp(a2, "q:sparent", (id) => vnode_locate(rootVNode, id));
1469
1608
  }
1470
1609
  for (; b; ) {
1471
- b = (bVNodePath[++bDepth] = b)[VNodeProps.parent] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1610
+ b = (bVNodePath[++bDepth] = b)[1] || rootVNode && vnode_getProp(b, "q:sparent", (id) => vnode_locate(rootVNode, id));
1472
1611
  }
1473
1612
  for (; aDepth >= 0 && bDepth >= 0; ) {
1474
1613
  if ((a2 = aVNodePath[aDepth]) !== (b = bVNodePath[bDepth])) {
@@ -1522,14 +1661,14 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1522
1661
  let drainScheduled = false;
1523
1662
  return function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
1524
1663
  const isServer3 = !isDomContainer(container);
1525
- const isComponentSsr = isServer3 && type === ChoreType.COMPONENT;
1526
- const runLater = type !== ChoreType.WAIT_FOR_ALL && !isComponentSsr && type !== ChoreType.RUN_QRL;
1527
- const isTask2 = type === ChoreType.TASK || type === ChoreType.VISIBLE || type === ChoreType.CLEANUP_VISIBLE;
1528
- const isClientOnly = type === ChoreType.JOURNAL_FLUSH || type === ChoreType.NODE_DIFF || type === ChoreType.NODE_PROP;
1664
+ const isComponentSsr = isServer3 && 6 === type;
1665
+ const runLater = 255 !== type && !isComponentSsr && 2 !== type;
1666
+ const isTask2 = 3 === type || 32 === type || 48 === type;
1667
+ const isClientOnly = 16 === type || 4 === type || 5 === type;
1529
1668
  if (isServer3 && isClientOnly) {
1530
1669
  return;
1531
1670
  }
1532
- isTask2 && (hostOrTask.$flags$ |= TaskFlags.DIRTY);
1671
+ isTask2 && (hostOrTask.$flags$ |= 8);
1533
1672
  let chore = {
1534
1673
  $type$: type,
1535
1674
  $idx$: isTask2 ? hostOrTask.$index$ : "string" == typeof targetOrQrl ? targetOrQrl : 0,
@@ -1563,10 +1702,10 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1563
1702
  return sortedArray.splice(~idx, 0, value), value;
1564
1703
  }
1565
1704
  const existing = sortedArray[idx];
1566
- existing.$type$ === ChoreType.NODE_DIFF && (existing.$payload$ = value.$payload$);
1705
+ 4 === existing.$type$ && (existing.$payload$ = value.$payload$);
1567
1706
  existing.$executed$ && (existing.$executed$ = false);
1568
1707
  return existing;
1569
- }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = true, schedule(ChoreType.JOURNAL_FLUSH), scheduleDrain()?.catch?.(() => {
1708
+ }(choreQueue, chore, container.rootVNode || null), !drainScheduled && runLater && (drainScheduled = true, schedule(16), scheduleDrain()?.catch?.(() => {
1570
1709
  }));
1571
1710
  return runLater ? getPromise(chore) : drainUpTo(chore, isServer3);
1572
1711
  };
@@ -1587,7 +1726,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1587
1726
  break;
1588
1727
  }
1589
1728
  } else {
1590
- vNodeAlreadyDeleted(nextChore) && nextChore.$type$ !== ChoreType.CLEANUP_VISIBLE ? choreQueue.shift() : executeChore(nextChore, isServer3);
1729
+ vNodeAlreadyDeleted(nextChore) && 48 !== nextChore.$type$ ? choreQueue.shift() : executeChore(nextChore, isServer3);
1591
1730
  }
1592
1731
  }
1593
1732
  return runUptoChore.$returnValue$;
@@ -1598,13 +1737,13 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1598
1737
  let returnValue = null;
1599
1738
  try {
1600
1739
  switch (chore.$type$) {
1601
- case ChoreType.WAIT_FOR_ALL:
1740
+ case 255:
1602
1741
  isServer3 && (drainScheduled = false);
1603
1742
  break;
1604
- case ChoreType.JOURNAL_FLUSH:
1743
+ case 16:
1605
1744
  returnValue = journalFlush(), drainScheduled = false;
1606
1745
  break;
1607
- case ChoreType.COMPONENT:
1746
+ case 6:
1608
1747
  returnValue = safeCall(() => executeComponent(container, host, host, chore.$target$, chore.$payload$), (jsx2) => {
1609
1748
  if (isServer3) {
1610
1749
  return jsx2;
@@ -1615,7 +1754,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1615
1754
  }
1616
1755
  }, (err) => container.handleError(err, host));
1617
1756
  break;
1618
- case ChoreType.RUN_QRL:
1757
+ case 2:
1619
1758
  {
1620
1759
  const fn = chore.$target$.getFn();
1621
1760
  const result = retryOnPromise(() => fn(...chore.$payload$));
@@ -1630,11 +1769,11 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1630
1769
  returnValue = null;
1631
1770
  }
1632
1771
  break;
1633
- case ChoreType.TASK:
1634
- case ChoreType.VISIBLE:
1772
+ case 3:
1773
+ case 32:
1635
1774
  {
1636
1775
  const payload = chore.$payload$;
1637
- if (payload.$flags$ & TaskFlags.RESOURCE) {
1776
+ if (4 & payload.$flags$) {
1638
1777
  const result = runResource(payload, container, host);
1639
1778
  returnValue = isServer3 ? result : null;
1640
1779
  } else {
@@ -1642,17 +1781,17 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1642
1781
  }
1643
1782
  }
1644
1783
  break;
1645
- case ChoreType.CLEANUP_VISIBLE:
1784
+ case 48:
1646
1785
  cleanupTask(chore.$payload$);
1647
1786
  break;
1648
- case ChoreType.NODE_DIFF:
1787
+ case 4:
1649
1788
  {
1650
1789
  const parentVirtualNode = chore.$target$;
1651
1790
  let jsx2 = chore.$payload$;
1652
1791
  isSignal(jsx2) && (jsx2 = jsx2.value), returnValue = retryOnPromise(() => vnode_diff(container, jsx2, parentVirtualNode, null));
1653
1792
  }
1654
1793
  break;
1655
- case ChoreType.NODE_PROP:
1794
+ case 5:
1656
1795
  {
1657
1796
  const virtualNode = chore.$host$;
1658
1797
  const payload = chore.$payload$;
@@ -1663,19 +1802,19 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1663
1802
  const property = chore.$idx$;
1664
1803
  const serializedValue = serializeAttribute(property, value, payload.$scopedStyleIdPrefix$);
1665
1804
  if (isConst) {
1666
- journal.push(VNodeJournalOpCode.SetAttribute, virtualNode[ElementVNodeProps.element], property, serializedValue);
1805
+ journal.push(2, virtualNode[6], property, serializedValue);
1667
1806
  } else {
1668
1807
  vnode_setAttr(journal, virtualNode, property, serializedValue);
1669
1808
  }
1670
1809
  }
1671
1810
  break;
1672
- case ChoreType.QRL_RESOLVE:
1811
+ case 1:
1673
1812
  {
1674
1813
  const target = chore.$target$;
1675
1814
  returnValue = target.resolved ? null : target.resolve();
1676
1815
  }
1677
1816
  break;
1678
- case ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS: {
1817
+ case 7: {
1679
1818
  const target = chore.$target$;
1680
1819
  const forceRunEffects = target.$forceRunEffects$;
1681
1820
  if (target.$forceRunEffects$ = false, !target.$effects$?.size) {
@@ -1695,7 +1834,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1695
1834
  isPromise(returnValue) ? (chore.$promise$ = returnValue.then(after, (error) => after(void 0, error)), chore.$resolve$?.(chore.$promise$), chore.$resolve$ = void 0) : after(returnValue);
1696
1835
  }
1697
1836
  function choreComparator(a2, b, rootVNode) {
1698
- const macroTypeDiff = (a2.$type$ & ChoreType.MACRO) - (b.$type$ & ChoreType.MACRO);
1837
+ const macroTypeDiff = (240 & a2.$type$) - (240 & b.$type$);
1699
1838
  if (0 !== macroTypeDiff) {
1700
1839
  return macroTypeDiff;
1701
1840
  }
@@ -1718,7 +1857,7 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1718
1857
  }
1719
1858
  }
1720
1859
  }
1721
- const microTypeDiff = (a2.$type$ & ChoreType.MICRO) - (b.$type$ & ChoreType.MICRO);
1860
+ const microTypeDiff = (15 & a2.$type$) - (15 & b.$type$);
1722
1861
  if (0 !== microTypeDiff) {
1723
1862
  return microTypeDiff;
1724
1863
  }
@@ -1728,217 +1867,8 @@ const createScheduler = (container, scheduleDrain, journalFlush) => {
1728
1867
  };
1729
1868
  const toNumber = (value) => "number" == typeof value ? value : -1;
1730
1869
  function vNodeAlreadyDeleted(chore) {
1731
- return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[VNodeProps.flags] & VNodeFlags.Deleted);
1732
- }
1733
- var SignalFlags;
1734
- var WrappedSignalFlags;
1735
- !function(SignalFlags2) {
1736
- SignalFlags2[SignalFlags2.INVALID = 1] = "INVALID";
1737
- }(SignalFlags || (SignalFlags = {})), function(WrappedSignalFlags2) {
1738
- WrappedSignalFlags2[WrappedSignalFlags2.UNWRAP = 2] = "UNWRAP";
1739
- }(WrappedSignalFlags || (WrappedSignalFlags = {}));
1740
- const throwIfQRLNotResolved = (qrl2) => {
1741
- if (!qrl2.resolved) {
1742
- throw qrl2.resolve();
1743
- }
1744
- };
1745
- const isSignal = (value) => value instanceof Signal;
1746
- class SubscriptionData {
1747
- constructor(data) {
1748
- __publicField(this, "data");
1749
- this.data = data;
1750
- }
1751
- }
1752
- var EffectSubscriptionProp;
1753
- var EffectProperty;
1754
- !function(EffectSubscriptionProp2) {
1755
- EffectSubscriptionProp2[EffectSubscriptionProp2.CONSUMER = 0] = "CONSUMER", EffectSubscriptionProp2[EffectSubscriptionProp2.PROPERTY = 1] = "PROPERTY", EffectSubscriptionProp2[EffectSubscriptionProp2.BACK_REF = 2] = "BACK_REF", EffectSubscriptionProp2[EffectSubscriptionProp2.DATA = 3] = "DATA";
1756
- }(EffectSubscriptionProp || (EffectSubscriptionProp = {})), function(EffectProperty2) {
1757
- EffectProperty2.COMPONENT = ":", EffectProperty2.VNODE = ".";
1758
- }(EffectProperty || (EffectProperty = {}));
1759
- class Signal {
1760
- constructor(container, value) {
1761
- __publicField(this, "$untrackedValue$");
1762
- __publicField(this, "$effects$", null);
1763
- __publicField(this, "$container$", null);
1764
- this.$container$ = container, this.$untrackedValue$ = value;
1765
- }
1766
- get untrackedValue() {
1767
- return this.$untrackedValue$;
1768
- }
1769
- set untrackedValue(value) {
1770
- this.$untrackedValue$ = value;
1771
- }
1772
- get value() {
1773
- const ctx = tryGetInvokeContext();
1774
- if (ctx) {
1775
- if (null === this.$container$) {
1776
- if (!ctx.$container$) {
1777
- return this.untrackedValue;
1778
- }
1779
- this.$container$ = ctx.$container$;
1780
- } else {
1781
- assertTrue(!ctx.$container$ || ctx.$container$ === this.$container$);
1782
- }
1783
- const effectSubscriber = ctx.$effectSubscriber$;
1784
- if (effectSubscriber) {
1785
- const effects = this.$effects$ || (this.$effects$ = /* @__PURE__ */ new Set());
1786
- ensureContainsSubscription(effects, effectSubscriber), ensureContainsBackRef(effectSubscriber, this), addQrlToSerializationCtx(effectSubscriber, this.$container$);
1787
- }
1788
- }
1789
- return this.untrackedValue;
1790
- }
1791
- set value(value) {
1792
- value !== this.$untrackedValue$ && (this.$untrackedValue$ = value, triggerEffects(this.$container$, this, this.$effects$));
1793
- }
1794
- valueOf() {
1795
- }
1796
- toString() {
1797
- 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") || "");
1798
- }
1799
- toJSON() {
1800
- return {
1801
- value: this.$untrackedValue$
1802
- };
1803
- }
1804
- }
1805
- const ensureContainsSubscription = (array, effectSubscription) => {
1806
- array.add(effectSubscription);
1807
- };
1808
- const ensureContainsBackRef = (array, value) => {
1809
- var _a2;
1810
- array[_a2 = EffectSubscriptionProp.BACK_REF] || (array[_a2] = /* @__PURE__ */ new Set()), array[EffectSubscriptionProp.BACK_REF].add(value);
1811
- };
1812
- const addQrlToSerializationCtx = (effectSubscriber, container) => {
1813
- if (container && !isDomContainer(container)) {
1814
- const effect = effectSubscriber[EffectSubscriptionProp.CONSUMER];
1815
- const property = effectSubscriber[EffectSubscriptionProp.PROPERTY];
1816
- let qrl2 = null;
1817
- isTask(effect) ? qrl2 = effect.$qrl$ : effect instanceof ComputedSignal ? qrl2 = effect.$computeQrl$ : property === EffectProperty.COMPONENT && (qrl2 = container.getHostProp(effect, "q:renderFn")), qrl2 && container.serializationCtx.$eventQrls$.add(qrl2);
1818
- }
1819
- };
1820
- const triggerEffects = (container, signal, effects) => {
1821
- const isBrowser2 = isDomContainer(container);
1822
- if (effects) {
1823
- const scheduleEffect = (effectSubscription) => {
1824
- const consumer = effectSubscription[EffectSubscriptionProp.CONSUMER];
1825
- const property = effectSubscription[EffectSubscriptionProp.PROPERTY];
1826
- if (isTask(consumer)) {
1827
- consumer.$flags$ |= TaskFlags.DIRTY;
1828
- let choreType = ChoreType.TASK;
1829
- consumer.$flags$ & TaskFlags.VISIBLE_TASK && (choreType = ChoreType.VISIBLE), container.$scheduler$(choreType, consumer);
1830
- } else if (consumer instanceof Signal) {
1831
- consumer instanceof ComputedSignal && (consumer.$computeQrl$.resolved || container.$scheduler$(ChoreType.QRL_RESOLVE, null, consumer.$computeQrl$)), consumer.$invalidate$();
1832
- } else if (property === EffectProperty.COMPONENT) {
1833
- const host = consumer;
1834
- const qrl2 = container.getHostProp(host, "q:renderFn");
1835
- const props = container.getHostProp(host, "q:props");
1836
- container.$scheduler$(ChoreType.COMPONENT, host, qrl2, props);
1837
- } else if (isBrowser2) {
1838
- if (property === EffectProperty.VNODE) {
1839
- container.$scheduler$(ChoreType.NODE_DIFF, consumer, consumer, signal);
1840
- } else {
1841
- const effectData = effectSubscription[EffectSubscriptionProp.DATA];
1842
- if (effectData instanceof SubscriptionData) {
1843
- const payload = {
1844
- ...effectData.data,
1845
- $value$: signal
1846
- };
1847
- container.$scheduler$(ChoreType.NODE_PROP, consumer, property, payload);
1848
- }
1849
- }
1850
- }
1851
- };
1852
- for (const effect of effects) {
1853
- scheduleEffect(effect);
1854
- }
1855
- }
1856
- };
1857
- class ComputedSignal extends (_c = Signal, _b = _EFFECT_BACK_REF, _c) {
1858
- constructor(container, fn, flags = SignalFlags.INVALID) {
1859
- super(container, NEEDS_COMPUTATION);
1860
- __publicField(this, "$computeQrl$");
1861
- __publicField(this, "$flags$");
1862
- __publicField(this, "$forceRunEffects$", false);
1863
- __publicField(this, _b, null);
1864
- this.$computeQrl$ = fn, this.$flags$ = flags;
1865
- }
1866
- $invalidate$() {
1867
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, null, this);
1868
- }
1869
- force() {
1870
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1871
- }
1872
- get untrackedValue() {
1873
- const didChange = this.$computeIfNeeded$();
1874
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1875
- }
1876
- $computeIfNeeded$() {
1877
- if (!(this.$flags$ & SignalFlags.INVALID)) {
1878
- return false;
1879
- }
1880
- const computeQrl = this.$computeQrl$;
1881
- throwIfQRLNotResolved(computeQrl);
1882
- const ctx = tryGetInvokeContext();
1883
- const previousEffectSubscription = ctx?.$effectSubscriber$;
1884
- ctx && (ctx.$effectSubscriber$ = getSubscriber(this, EffectProperty.VNODE));
1885
- try {
1886
- const untrackedValue = computeQrl.getFn(ctx)();
1887
- if (isPromise(untrackedValue)) {
1888
- throw qError(QError.computedNotSync, [computeQrl.dev ? computeQrl.dev.file : "", computeQrl.$hash$]);
1889
- }
1890
- this.$flags$ &= ~SignalFlags.INVALID;
1891
- const didChange = untrackedValue !== this.$untrackedValue$;
1892
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1893
- } finally {
1894
- ctx && (ctx.$effectSubscriber$ = previousEffectSubscription);
1895
- }
1896
- }
1897
- get value() {
1898
- return super.value;
1899
- }
1900
- set value(_) {
1901
- throw qError(QError.computedReadOnly);
1902
- }
1903
- }
1904
- class WrappedSignal extends (_e = Signal, _d = _EFFECT_BACK_REF, _e) {
1905
- constructor(container, fn, args, fnStr, flags = SignalFlags.INVALID | WrappedSignalFlags.UNWRAP) {
1906
- super(container, NEEDS_COMPUTATION);
1907
- __publicField(this, "$args$");
1908
- __publicField(this, "$func$");
1909
- __publicField(this, "$funcStr$");
1910
- __publicField(this, "$flags$");
1911
- __publicField(this, "$hostElement$", null);
1912
- __publicField(this, "$forceRunEffects$", false);
1913
- __publicField(this, _d, null);
1914
- this.$args$ = args, this.$func$ = fn, this.$funcStr$ = fnStr, this.$flags$ = flags;
1915
- }
1916
- $invalidate$() {
1917
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, this.$container$?.$scheduler$(ChoreType.RECOMPUTE_AND_SCHEDULE_EFFECTS, this.$hostElement$, this);
1918
- }
1919
- force() {
1920
- this.$flags$ |= SignalFlags.INVALID, this.$forceRunEffects$ = false, triggerEffects(this.$container$, this, this.$effects$);
1921
- }
1922
- get untrackedValue() {
1923
- const didChange = this.$computeIfNeeded$();
1924
- return didChange && (this.$forceRunEffects$ = didChange), assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION), this.$untrackedValue$;
1925
- }
1926
- $computeIfNeeded$() {
1927
- if (!(this.$flags$ & SignalFlags.INVALID)) {
1928
- return false;
1929
- }
1930
- const untrackedValue = trackSignal(() => this.$func$(...this.$args$), this, EffectProperty.VNODE, this.$container$);
1931
- const didChange = untrackedValue !== this.$untrackedValue$;
1932
- return didChange && (this.$untrackedValue$ = untrackedValue), didChange;
1933
- }
1934
- get value() {
1935
- return super.value;
1936
- }
1937
- set value(_) {
1938
- throw qError(QError.wrappedReadOnly);
1939
- }
1870
+ return !!(chore.$host$ && vnode_isVNode(chore.$host$) && 32 & chore.$host$[0]);
1940
1871
  }
1941
- const version = "2.0.0-alpha.8-dev+66037b5";
1942
1872
  class _SharedContainer {
1943
1873
  constructor(scheduleDrain, journalFlush, serverData, locale) {
1944
1874
  __publicField(this, "$version$");
@@ -1949,6 +1879,7 @@ class _SharedContainer {
1949
1879
  __publicField(this, "$serverData$");
1950
1880
  __publicField(this, "$currentUniqueId$", 0);
1951
1881
  __publicField(this, "$instanceHash$", null);
1882
+ __publicField(this, "$buildBase$", null);
1952
1883
  this.$serverData$ = serverData, this.$locale$ = locale, this.$version$ = version, this.$storeProxyMap$ = /* @__PURE__ */ new WeakMap(), this.$getObjectById$ = () => {
1953
1884
  throw Error("Not implemented");
1954
1885
  }, this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
@@ -1960,155 +1891,6 @@ class _SharedContainer {
1960
1891
  return createSerializationContext(NodeConstructor, DomRefConstructor, symbolToChunkResolver, this.getHostProp.bind(this), this.setHostProp.bind(this), this.$storeProxyMap$, writer, prepVNodeData);
1961
1892
  }
1962
1893
  }
1963
- const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
1964
- const processed = null == key ? null : String(key);
1965
- const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
1966
- return node;
1967
- };
1968
- const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
1969
- let sortedProps;
1970
- return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter((entry) => {
1971
- const attr = entry[0];
1972
- return "children" === attr ? (children ?? (children = entry[1]), false) : "key" === attr ? (key = entry[1], false) : !constProps;
1973
- }).sort(([a2], [b]) => a2 < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {}, _jsxSorted(type, sortedProps, constProps, children, flags, key);
1974
- };
1975
- const jsx = (type, props, key) => _jsxSplit(type, props, null, null, 0, null);
1976
- const isPropsProxy = (obj) => obj && void 0 !== obj[_VAR_PROPS];
1977
- class JSXNodeImpl {
1978
- constructor(type, varProps, constProps, children, flags, key = null) {
1979
- __publicField(this, "type");
1980
- __publicField(this, "varProps");
1981
- __publicField(this, "constProps");
1982
- __publicField(this, "children");
1983
- __publicField(this, "flags");
1984
- __publicField(this, "key");
1985
- __publicField(this, "dev");
1986
- __publicField(this, "_proxy", null);
1987
- this.type = type, this.varProps = varProps, this.constProps = constProps, this.children = children, this.flags = flags, this.key = key;
1988
- }
1989
- get props() {
1990
- return this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children)), this._proxy;
1991
- }
1992
- }
1993
- const Virtual = (props) => props.children;
1994
- const isJSXNode = (n) => n instanceof JSXNodeImpl;
1995
- const Fragment = (props) => props.children;
1996
- function createPropsProxy(varProps, constProps, children) {
1997
- return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
1998
- }
1999
- class PropsProxyHandler {
2000
- constructor($varProps$, $constProps$, $children$) {
2001
- __publicField(this, "$varProps$");
2002
- __publicField(this, "$constProps$");
2003
- __publicField(this, "$children$");
2004
- this.$varProps$ = $varProps$, this.$constProps$ = $constProps$, this.$children$ = $children$;
2005
- }
2006
- get(_, prop) {
2007
- if (prop === _CONST_PROPS) {
2008
- return this.$constProps$;
2009
- }
2010
- if (prop === _VAR_PROPS) {
2011
- return this.$varProps$;
2012
- }
2013
- if (null != this.$children$ && "children" === prop) {
2014
- return this.$children$;
2015
- }
2016
- const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
2017
- return value instanceof WrappedSignal && value.$flags$ & WrappedSignalFlags.UNWRAP ? value.value : value;
2018
- }
2019
- set(_, prop, value) {
2020
- return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
2021
- }
2022
- deleteProperty(_, prop) {
2023
- if ("string" != typeof prop) {
2024
- return false;
2025
- }
2026
- let didDelete = delete this.$varProps$[prop];
2027
- return this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete), null != this.$children$ && "children" === prop && (this.$children$ = null), didDelete;
2028
- }
2029
- has(_, prop) {
2030
- return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
2031
- }
2032
- getOwnPropertyDescriptor(target, p) {
2033
- return {
2034
- configurable: true,
2035
- enumerable: true,
2036
- value: "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p]
2037
- };
2038
- }
2039
- ownKeys() {
2040
- const out = Object.keys(this.$varProps$);
2041
- if (null != this.$children$ && -1 === out.indexOf("children") && out.push("children"), this.$constProps$) {
2042
- for (const key in this.$constProps$) {
2043
- -1 === out.indexOf(key) && out.push(key);
2044
- }
2045
- }
2046
- return out;
2047
- }
2048
- }
2049
- const directGetPropsProxyProp = (jsx2, prop) => jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
2050
- const stringifyPath = [];
2051
- function qwikDebugToString(value) {
2052
- if (null === value) {
2053
- return "null";
2054
- }
2055
- if (void 0 === value) {
2056
- return "undefined";
2057
- }
2058
- if ("string" == typeof value) {
2059
- return '"' + value + '"';
2060
- }
2061
- if ("number" == typeof value || "boolean" == typeof value) {
2062
- return String(value);
2063
- }
2064
- if (isTask(value)) {
2065
- return `Task(${qwikDebugToString(value.$qrl$)})`;
2066
- }
2067
- if (isQrl(value)) {
2068
- return `Qrl(${value.$symbol$})`;
2069
- }
2070
- if ("object" == typeof value || "function" == typeof value) {
2071
- if (stringifyPath.includes(value)) {
2072
- return "*";
2073
- }
2074
- try {
2075
- if (stringifyPath.push(value), Array.isArray(value)) {
2076
- return vnode_isVNode(value) ? "(" + vnode_getProp(value, "q:type", null) + ")" : value.map(qwikDebugToString);
2077
- }
2078
- if (isSignal(value)) {
2079
- return value instanceof WrappedSignal ? "WrappedSignal" : value instanceof ComputedSignal ? "ComputedSignal" : "Signal";
2080
- }
2081
- if (isStore(value)) {
2082
- return "Store";
2083
- }
2084
- if (isJSXNode(value)) {
2085
- return jsxToString(value);
2086
- }
2087
- } finally {
2088
- stringifyPath.pop();
2089
- }
2090
- }
2091
- return value;
2092
- }
2093
- const pad = (text, prefix) => String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
2094
- const jsxToString = (value) => {
2095
- if (isJSXNode(value)) {
2096
- let type = value.type;
2097
- "function" == typeof type && (type = type.name || "Component");
2098
- let str = "<" + value.type;
2099
- if (value.props) {
2100
- for (const [key, val] of Object.entries(value.props)) {
2101
- str += " " + key + "=" + qwikDebugToString(val);
2102
- }
2103
- const children = value.children;
2104
- null != children ? (str += ">", Array.isArray(children) ? children.forEach((child) => {
2105
- str += jsxToString(child);
2106
- }) : str += jsxToString(children), str += "</" + value.type + ">") : str += "/>";
2107
- }
2108
- return str;
2109
- }
2110
- return String(value);
2111
- };
2112
1894
  const VNodeDataSeparator = {
2113
1895
  REFERENCE_CH: "~",
2114
1896
  REFERENCE: 126,
@@ -2173,1132 +1955,1216 @@ const VNodeDataChar = {
2173
1955
  SLOT: 126,
2174
1956
  SLOT_CHAR: "~"
2175
1957
  };
2176
- const mergeMaps = (map1, map2) => {
2177
- for (const [k, v] of map2) {
2178
- map1.set(k, v);
2179
- }
2180
- return map1;
2181
- };
2182
- var VNodeJournalOpCode;
2183
- !function(VNodeJournalOpCode2) {
2184
- VNodeJournalOpCode2[VNodeJournalOpCode2.SetText = 1] = "SetText", VNodeJournalOpCode2[VNodeJournalOpCode2.SetAttribute = 2] = "SetAttribute", VNodeJournalOpCode2[VNodeJournalOpCode2.HoistStyles = 3] = "HoistStyles", VNodeJournalOpCode2[VNodeJournalOpCode2.Remove = 4] = "Remove", VNodeJournalOpCode2[VNodeJournalOpCode2.Insert = 5] = "Insert";
2185
- }(VNodeJournalOpCode || (VNodeJournalOpCode = {}));
2186
- const vnode_newElement = (element, elementName) => {
2187
- assertEqual(fastNodeType(element));
2188
- const vnode = VNodeArray.createElement(VNodeFlags.Element | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, null, null, element, elementName);
2189
- return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2190
- };
2191
- const vnode_newUnMaterializedElement = (element) => {
2192
- assertEqual(fastNodeType(element));
2193
- const vnode = VNodeArray.createElement(VNodeFlags.Element | -1 << VNodeFlagsIndex.shift, null, null, null, void 0, void 0, element, void 0);
2194
- return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2195
- };
2196
- const vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
2197
- sharedTextNode && assertEqual(fastNodeType(sharedTextNode));
2198
- const vnode = VNodeArray.createText(VNodeFlags.Text | -1 << VNodeFlagsIndex.shift, null, previousTextNode, null, sharedTextNode, textContent);
2199
- return assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2200
- };
2201
- const vnode_newText = (textNode, textContent) => {
2202
- const vnode = VNodeArray.createText(VNodeFlags.Text | VNodeFlags.Inflated | -1 << VNodeFlagsIndex.shift, null, null, null, textNode, textContent);
2203
- return assertEqual(fastNodeType(textNode)), assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2204
- };
2205
- const vnode_newVirtual = () => {
2206
- const vnode = VNodeArray.createVirtual(VNodeFlags.Virtual | -1 << VNodeFlagsIndex.shift, null, null, null, null, null);
2207
- return assertFalse(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertTrue(vnode_isVirtualVNode(vnode)), vnode;
2208
- };
2209
- const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
2210
- const vnode_isElementVNode = (vNode) => {
2211
- return (vNode[VNodeProps.flags] & VNodeFlags.Element) === VNodeFlags.Element;
2212
- };
2213
- const vnode_isElementOrTextVNode = (vNode) => {
2214
- return !!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK);
2215
- };
2216
- const vnode_isTextVNode = (vNode) => {
2217
- return (vNode[VNodeProps.flags] & VNodeFlags.Text) === VNodeFlags.Text;
2218
- };
2219
- const vnode_isVirtualVNode = (vNode) => {
2220
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual;
2221
- };
2222
- const vnode_isProjection = (vNode) => {
2223
- return (vNode[VNodeProps.flags] & VNodeFlags.Virtual) === VNodeFlags.Virtual && null !== vnode_getProp(vNode, QSlot, null);
2224
- };
2225
- const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2226
- const ensureElementOrVirtualVNode = (vNode) => {
2227
- assertTrue(!!(vNode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
2228
- };
2229
- const ensureElementVNode = (vNode) => (assertTrue(vnode_isElementVNode(vNode), "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2230
- const vnode_getNodeTypeName = (vNode) => {
2231
- if (vNode) {
2232
- switch (vNode[VNodeProps.flags] & VNodeFlags.TYPE_MASK) {
2233
- case VNodeFlags.Element:
2234
- return "Element";
2235
- case VNodeFlags.Virtual:
2236
- return "Virtual";
2237
- case VNodeFlags.Text:
2238
- return "Text";
1958
+ function processVNodeData$1(document2) {
1959
+ const vNodeDataMap = document2.qVNodeData || (document2.qVNodeData = /* @__PURE__ */ new WeakMap());
1960
+ const prototype = document2.body;
1961
+ const getAttribute = prototype.getAttribute;
1962
+ const hasAttribute = prototype.hasAttribute;
1963
+ const getNodeType = ((prototype2, name) => {
1964
+ let getter;
1965
+ for (; prototype2 && !(getter = Object.getOwnPropertyDescriptor(prototype2, name)?.get); ) {
1966
+ prototype2 = Object.getPrototypeOf(prototype2);
2239
1967
  }
2240
- }
2241
- return "<unknown>";
2242
- };
2243
- const vnode_ensureElementInflated = (vnode) => {
2244
- if ((vnode[VNodeProps.flags] & VNodeFlags.INFLATED_TYPE_MASK) === VNodeFlags.Element) {
2245
- const elementVNode = vnode;
2246
- elementVNode[VNodeProps.flags] ^= VNodeFlags.Inflated;
2247
- const element = elementVNode[ElementVNodeProps.element];
2248
- const attributes = element.attributes;
2249
- const props = vnode_getProps(elementVNode);
2250
- for (let idx = 0; idx < attributes.length; idx++) {
2251
- const attr = attributes[idx];
2252
- const key = attr.name;
2253
- if (":" === key || !key) {
2254
- break;
2255
- }
2256
- if (key.startsWith("q:container")) {
2257
- 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);
2258
- } else if (!key.startsWith("on:")) {
2259
- mapArray_set(props, key, attr.value, 0);
1968
+ return getter || function() {
1969
+ return this[name];
1970
+ };
1971
+ })(prototype, "nodeType");
1972
+ const attachVnodeDataAndRefs = (element) => {
1973
+ Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script) => {
1974
+ script.setAttribute("type", "x-qwik/vnode");
1975
+ const qContainerElement = script.closest("[q\\:container]");
1976
+ qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
1977
+ }), element.querySelectorAll("[q\\:shadowroot]").forEach((parent) => {
1978
+ const shadowRoot = parent.shadowRoot;
1979
+ shadowRoot && attachVnodeDataAndRefs(shadowRoot);
1980
+ });
1981
+ };
1982
+ attachVnodeDataAndRefs(document2);
1983
+ const getFastNodeType = (node) => {
1984
+ const nodeType = getNodeType.call(node);
1985
+ if (1 === nodeType) {
1986
+ if (null === getAttribute.call(node, "q:container")) {
1987
+ if (hasAttribute.call(node, "q:shadowroot")) {
1988
+ return 6;
1989
+ }
1990
+ return hasAttribute.call(node, ":") ? 2 : 0;
2260
1991
  }
1992
+ return 3;
2261
1993
  }
2262
- }
2263
- };
2264
- function vnode_walkVNode(vNode) {
2265
- let vCursor = vNode;
2266
- if (vnode_isTextVNode(vNode)) {
2267
- return;
2268
- }
2269
- let vParent = null;
2270
- for (; ; ) {
2271
- const vFirstChild = vnode_getFirstChild(vCursor);
2272
- if (vFirstChild) {
2273
- vCursor = vFirstChild;
2274
- continue;
2275
- }
2276
- if (vCursor === vNode) {
2277
- return;
2278
- }
2279
- const vNextSibling = vnode_getNextSibling(vCursor);
2280
- if (vNextSibling) {
2281
- vCursor = vNextSibling;
2282
- } else {
2283
- for (vParent = vnode_getParent(vCursor); vParent; ) {
2284
- if (vParent === vNode) {
2285
- return;
2286
- }
2287
- const vNextParentSibling = vnode_getNextSibling(vParent);
2288
- if (vNextParentSibling) {
2289
- vCursor = vNextParentSibling;
2290
- break;
2291
- }
2292
- vParent = vnode_getParent(vParent);
1994
+ if (8 === nodeType) {
1995
+ const nodeValue = node.nodeValue || "";
1996
+ if (nodeValue.startsWith("q:container-island")) {
1997
+ return 65;
2293
1998
  }
2294
- if (null == vParent) {
2295
- return;
1999
+ if (nodeValue.startsWith("q:ignore")) {
2000
+ return 16;
2296
2001
  }
2297
- }
2298
- }
2299
- }
2300
- function vnode_getDOMChildNodes(journal, root, isVNode = false, childNodes = []) {
2301
- if (vnode_isElementOrTextVNode(root)) {
2302
- return vnode_isTextVNode(root) && vnode_ensureTextInflated(journal, root), childNodes.push(isVNode ? root : vnode_getNode(root)), childNodes;
2303
- }
2304
- let vNode = vnode_getFirstChild(root);
2305
- for (; vNode; ) {
2306
- vnode_isElementVNode(vNode) ? childNodes.push(isVNode ? vNode : vnode_getNode(vNode)) : vnode_isTextVNode(vNode) ? (vnode_ensureTextInflated(journal, vNode), childNodes.push(isVNode ? vNode : vnode_getNode(vNode))) : vnode_getDOMChildNodes(journal, vNode, !!isVNode, childNodes), vNode = vnode_getNextSibling(vNode);
2307
- }
2308
- return childNodes;
2309
- }
2310
- const vnode_getDomSibling = (vNode, nextDirection, descend) => {
2311
- const childProp = nextDirection ? VirtualVNodeProps.firstChild : VirtualVNodeProps.lastChild;
2312
- const siblingProp = nextDirection ? VNodeProps.nextSibling : VNodeProps.previousSibling;
2313
- let cursor = vNode;
2314
- for (; descend && cursor && vnode_isVirtualVNode(cursor); ) {
2315
- const child = cursor[childProp];
2316
- if (!child) {
2317
- break;
2318
- }
2319
- if (child[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
2320
- return child;
2321
- }
2322
- cursor = child;
2323
- }
2324
- for (; cursor; ) {
2325
- let sibling = cursor[siblingProp];
2326
- if (sibling && sibling[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK) {
2327
- return sibling;
2328
- }
2329
- if (!sibling) {
2330
- let virtual = cursor[VNodeProps.parent];
2331
- if (virtual && !vnode_isVirtualVNode(virtual)) {
2332
- return null;
2002
+ if (nodeValue.startsWith("q:container")) {
2003
+ return 5;
2333
2004
  }
2334
- for (; virtual && !(sibling = virtual[siblingProp]); ) {
2335
- if (virtual = virtual[VNodeProps.parent], virtual && !vnode_isVirtualVNode(virtual)) {
2336
- return null;
2337
- }
2005
+ if (nodeValue.startsWith("/q:container-island")) {
2006
+ return 128;
2338
2007
  }
2339
- if (!sibling) {
2340
- return null;
2008
+ if (nodeValue.startsWith("/q:ignore")) {
2009
+ return 32;
2341
2010
  }
2342
- if (vnode_isTextVNode(sibling) && virtual && vnode_isElementVNode(virtual)) {
2343
- return null;
2011
+ if (nodeValue.startsWith("/q:container")) {
2012
+ return 8;
2344
2013
  }
2345
2014
  }
2346
- for (; sibling; ) {
2347
- if (cursor = sibling, cursor[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_TEXT_MASK && vnode_getNode(cursor)) {
2348
- return cursor;
2015
+ return 0;
2016
+ };
2017
+ const isSeparator = (ch) => VNodeDataSeparator.ADVANCE_1 <= ch && ch <= VNodeDataSeparator.ADVANCE_8192;
2018
+ const findVDataSectionEnd = (vData, start, end) => {
2019
+ let depth = 0;
2020
+ for (; start < end; ) {
2021
+ const ch = vData.charCodeAt(start);
2022
+ if (0 === depth && isSeparator(ch)) {
2023
+ break;
2349
2024
  }
2350
- sibling = cursor[childProp];
2025
+ ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--, start++;
2351
2026
  }
2352
- }
2353
- return null;
2354
- };
2355
- const vnode_ensureInflatedIfText = (journal, vNode) => {
2356
- vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
2357
- };
2358
- const vnode_ensureTextInflated = (journal, vnode) => {
2359
- const textVNode = ensureTextVNode(vnode);
2360
- if (!(textVNode[VNodeProps.flags] & VNodeFlags.Inflated)) {
2361
- const parentNode = vnode_getDomParent(vnode);
2362
- const sharedTextNode = textVNode[TextVNodeProps.node];
2363
- const doc = parentNode.ownerDocument;
2364
- let cursor = vnode_getDomSibling(vnode, false, true);
2365
- const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, true, true)?.[ElementVNodeProps.element] || null;
2366
- let lastPreviousTextNode = insertBeforeNode;
2367
- for (; cursor && vnode_isTextVNode(cursor); ) {
2368
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
2369
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2370
- journal.push(VNodeJournalOpCode.Insert, parentNode, lastPreviousTextNode, textNode), lastPreviousTextNode = textNode, cursor[TextVNodeProps.node] = textNode, cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
2371
- }
2372
- cursor = vnode_getDomSibling(cursor, false, true);
2027
+ return start;
2028
+ };
2029
+ const nextSibling = (node) => {
2030
+ for (; node && (node = node.nextSibling) && 0 === getFastNodeType(node); ) {
2373
2031
  }
2374
- for (cursor = vnode; cursor && vnode_isTextVNode(cursor); ) {
2375
- const next = vnode_getDomSibling(cursor, true, true);
2376
- const isLastNode = !next || !vnode_isTextVNode(next);
2377
- if (!(cursor[VNodeProps.flags] & VNodeFlags.Inflated)) {
2378
- if (isLastNode && sharedTextNode) {
2379
- journal.push(VNodeJournalOpCode.SetText, sharedTextNode, cursor[TextVNodeProps.text]);
2380
- } else {
2381
- const textNode = doc.createTextNode(cursor[TextVNodeProps.text]);
2382
- journal.push(VNodeJournalOpCode.Insert, parentNode, insertBeforeNode, textNode), cursor[TextVNodeProps.node] = textNode;
2032
+ return node;
2033
+ };
2034
+ const firstChild = (node) => {
2035
+ for (; node && (node = node.firstChild) && 0 === getFastNodeType(node); ) {
2036
+ }
2037
+ return node;
2038
+ };
2039
+ const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs) => {
2040
+ const vData_length = vData.length;
2041
+ let elementIdx = 0;
2042
+ let vNodeElementIndex = -1;
2043
+ let vData_start = 0;
2044
+ let vData_end = 0;
2045
+ let ch = 0;
2046
+ let needsToStoreRef = -1;
2047
+ let nextNode = null;
2048
+ const howManyElementsToSkip = () => {
2049
+ let elementsToSkip = 0;
2050
+ for (; isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1, vData_start++, !(vData_start >= vData_length)); ) {
2051
+ }
2052
+ return elementsToSkip;
2053
+ };
2054
+ do {
2055
+ if (node === exitNode) {
2056
+ return;
2057
+ }
2058
+ nextNode = null;
2059
+ const nodeType = node == containerNode ? 2 : getFastNodeType(node);
2060
+ if (3 === nodeType) {
2061
+ const container = node;
2062
+ let cursor = node;
2063
+ for (; cursor && !(nextNode = nextSibling(cursor)); ) {
2064
+ cursor = cursor.parentNode;
2383
2065
  }
2384
- cursor[VNodeProps.flags] |= VNodeFlags.Inflated;
2066
+ walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
2067
+ } else if (16 === nodeType) {
2068
+ let islandNode = node;
2069
+ do {
2070
+ if (islandNode = walker2.nextNode(), !islandNode) {
2071
+ throw new Error(`Island inside <!--${node?.nodeValue}--> not found!`);
2072
+ }
2073
+ } while (65 !== getFastNodeType(islandNode));
2074
+ nextNode = null;
2075
+ } else if (128 === nodeType) {
2076
+ nextNode = node;
2077
+ do {
2078
+ if (nextNode = walker2.nextNode(), !nextNode) {
2079
+ throw new Error("Ignore block not closed!");
2080
+ }
2081
+ } while (32 !== getFastNodeType(nextNode));
2082
+ nextNode = null;
2083
+ } else if (5 === nodeType) {
2084
+ nextNode = node;
2085
+ do {
2086
+ if (nextNode = nextSibling(nextNode), !nextNode) {
2087
+ throw new Error(`<!--${node?.nodeValue}--> not closed!`);
2088
+ }
2089
+ } while (8 !== getFastNodeType(nextNode));
2090
+ walkContainer(walker2, node, node, nextNode, "", null);
2091
+ } else if (6 === nodeType) {
2092
+ nextNode = nextSibling(node);
2093
+ const shadowRootContainer = node;
2094
+ const shadowRoot = shadowRootContainer?.shadowRoot;
2095
+ shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
2385
2096
  }
2386
- cursor = next;
2387
- }
2097
+ if (!(2 & ~nodeType)) {
2098
+ if (vNodeElementIndex < elementIdx) {
2099
+ if (-1 === vNodeElementIndex && (vNodeElementIndex = 0), vData_start = vData_end, vData_start < vData_length) {
2100
+ vNodeElementIndex += howManyElementsToSkip();
2101
+ ch === VNodeDataSeparator.REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++, ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1), vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
2102
+ } else {
2103
+ vNodeElementIndex = Number.MAX_SAFE_INTEGER;
2104
+ }
2105
+ }
2106
+ if (elementIdx === vNodeElementIndex) {
2107
+ needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
2108
+ const instructions = vData.substring(vData_start, vData_end);
2109
+ vNodeDataMap.set(node, instructions);
2110
+ }
2111
+ elementIdx++;
2112
+ }
2113
+ } while (node = nextNode || walker2.nextNode());
2114
+ };
2115
+ const walker = document2.createTreeWalker(document2, 129);
2116
+ walkContainer(walker, null, walker.firstChild(), null, "", null);
2117
+ }
2118
+ function getDomContainer(element) {
2119
+ const qContainerElement = _getQContainerElement(element);
2120
+ if (!qContainerElement) {
2121
+ throw qError(41);
2388
2122
  }
2389
- };
2390
- const vnode_locate = (rootVNode, id) => {
2391
- ensureElementVNode(rootVNode);
2392
- let vNode = rootVNode;
2393
- const containerElement = rootVNode[ElementVNodeProps.element];
2394
- const { qVNodeRefs } = containerElement;
2395
- let elementOffset = -1;
2396
- let refElement;
2397
- if ("string" == typeof id ? (elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset)) : refElement = id, vnode_isVNode(refElement)) {
2398
- vNode = refElement;
2399
- } else {
2400
- assertTrue(containerElement.contains(refElement));
2401
- let parent = refElement;
2402
- const elementPath = [refElement];
2403
- for (; parent && parent !== containerElement; ) {
2404
- parent = parent.parentElement, elementPath.push(parent);
2123
+ return getDomContainerFromQContainerElement(qContainerElement);
2124
+ }
2125
+ function getDomContainerFromQContainerElement(qContainerElement) {
2126
+ let container = qContainerElement.qContainer;
2127
+ return container || (container = new DomContainer(qContainerElement)), container;
2128
+ }
2129
+ function _getQContainerElement(element) {
2130
+ return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
2131
+ }
2132
+ const isDomContainer = (container) => container instanceof DomContainer;
2133
+ class DomContainer extends _SharedContainer {
2134
+ constructor(element) {
2135
+ super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale"));
2136
+ __publicField(this, "element");
2137
+ __publicField(this, "qContainer");
2138
+ __publicField(this, "qManifestHash");
2139
+ __publicField(this, "rootVNode");
2140
+ __publicField(this, "document");
2141
+ __publicField(this, "$journal$");
2142
+ __publicField(this, "renderDone", null);
2143
+ __publicField(this, "$rawStateData$");
2144
+ __publicField(this, "$storeProxyMap$", /* @__PURE__ */ new WeakMap());
2145
+ __publicField(this, "$qFuncs$");
2146
+ __publicField(this, "$instanceHash$");
2147
+ __publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
2148
+ __publicField(this, "$stateData$");
2149
+ __publicField(this, "$styleIds$", null);
2150
+ __publicField(this, "$renderCount$", 0);
2151
+ __publicField(this, "$getObjectById$", (id) => ("string" == typeof id && (id = parseFloat(id)), assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`), this.$stateData$[id]));
2152
+ if (this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
2153
+ throw qError(42);
2405
2154
  }
2406
- for (let i = elementPath.length - 2; i >= 0; i--) {
2407
- vNode = vnode_getVNodeForChildNode(vNode, elementPath[i]);
2155
+ this.$journal$ = [3, element.ownerDocument], this.document = element.ownerDocument, this.element = element, this.$buildBase$ = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"), this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element), this.$rawStateData$ = [], this.$stateData$ = [];
2156
+ const document2 = this.element.ownerDocument;
2157
+ document2.qVNodeData || processVNodeData$1(document2), this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY, this.$setServerData$(), element.setAttribute("q:container", "resumed"), element.qContainer = this;
2158
+ const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
2159
+ if (0 !== qwikStates.length) {
2160
+ this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent), this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
2408
2161
  }
2409
- -1 != elementOffset && qVNodeRefs.set(elementOffset, vNode);
2410
2162
  }
2411
- if ("string" == typeof id) {
2412
- const idLength = id.length;
2413
- let idx = indexOfAlphanumeric(id, idLength);
2414
- let childIdx = 0;
2415
- for (; idx < idLength; ) {
2416
- const ch = id.charCodeAt(idx);
2417
- childIdx *= 26, ch >= 97 ? childIdx += ch - 97 : (childIdx += ch - 65, vNode = vnode_getChildWithIdx(vNode, childIdx), childIdx = 0), idx++;
2418
- }
2163
+ $setRawState$(id, vParent) {
2164
+ this.$stateData$[id] = vParent;
2419
2165
  }
2420
- return vNode;
2421
- };
2422
- const vnode_getChildWithIdx = (vNode, childIdx) => {
2423
- let child = vnode_getFirstChild(vNode);
2424
- for (assertDefined(); child[VNodeProps.flags] >>> VNodeFlagsIndex.shift !== childIdx; ) {
2425
- child = vnode_getNextSibling(child);
2166
+ parseQRL(qrl2) {
2167
+ return inflateQRL(this, parseQRL(qrl2));
2426
2168
  }
2427
- return child;
2428
- };
2429
- const vNodeStack = [];
2430
- const vnode_getVNodeForChildNode = (vNode, childElement) => {
2431
- ensureElementVNode(vNode);
2432
- let child = vnode_getFirstChild(vNode);
2433
- for (assertDefined(); child && child[ElementVNodeProps.element] !== childElement; ) {
2434
- if (vnode_isVirtualVNode(child)) {
2435
- const next = vnode_getNextSibling(child);
2436
- const firstChild = vnode_getFirstChild(child);
2437
- firstChild ? (next && vNodeStack.push(next), child = firstChild) : child = next || (vNodeStack.length ? vNodeStack.pop() : null);
2438
- } else {
2439
- const next = vnode_getNextSibling(child);
2440
- child = next || (next || vNodeStack.pop());
2169
+ handleError(err, host) {
2170
+ const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
2171
+ if (!errorStore) {
2172
+ throw err;
2441
2173
  }
2174
+ errorStore.error = err;
2442
2175
  }
2443
- for (; vNodeStack.length; ) {
2444
- vNodeStack.pop();
2176
+ setContext(host, context, value) {
2177
+ let ctx = this.getHostProp(host, "q:ctx");
2178
+ ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
2445
2179
  }
2446
- return ensureElementVNode(child), assertEqual(child[ElementVNodeProps.element]), child;
2447
- };
2448
- const indexOfAlphanumeric = (id, length) => {
2449
- let idx = 0;
2450
- for (; idx < length; ) {
2451
- if (!(id.charCodeAt(idx) <= 57)) {
2452
- return idx;
2180
+ resolveContext(host, contextId) {
2181
+ for (; host; ) {
2182
+ const ctx = this.getHostProp(host, "q:ctx");
2183
+ if (ctx) {
2184
+ const value = mapArray_get(ctx, contextId.id, 0);
2185
+ if (value) {
2186
+ return value;
2187
+ }
2188
+ }
2189
+ host = this.getParentHost(host);
2453
2190
  }
2454
- idx++;
2455
2191
  }
2456
- return length;
2457
- };
2458
- const parseBoolean = (value) => "false" !== value && Boolean(value);
2459
- const isBooleanAttr = (element, key) => ("allowfullscreen" == key || "async" == key || "autofocus" == key || "autoplay" == key || "checked" == key || "controls" == key || "default" == key || "defer" == key || "disabled" == key || "formnovalidate" == key || "inert" == key || "ismap" == key || "itemscope" == key || "loop" == key || "multiple" == key || "muted" == key || "nomodule" == key || "novalidate" == key || "open" == key || "playsinline" == key || "readonly" == key || "required" == key || "reversed" == key || "selected" == key) && key in element;
2460
- const vnode_applyJournal = (journal) => {
2461
- let idx = 0;
2462
- const length = journal.length;
2463
- for (; idx < length; ) {
2464
- switch (journal[idx++]) {
2465
- case VNodeJournalOpCode.SetText:
2466
- journal[idx++].nodeValue = journal[idx++];
2467
- break;
2468
- case VNodeJournalOpCode.SetAttribute:
2469
- const element = journal[idx++];
2470
- let key = journal[idx++];
2471
- "className" === key && (key = "class");
2472
- const value = journal[idx++];
2473
- isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? element.innerHTML = value : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2474
- break;
2475
- case VNodeJournalOpCode.HoistStyles:
2476
- const document2 = journal[idx++];
2477
- const head = document2.head;
2478
- const styles = document2.querySelectorAll(QStylesAllSelector);
2479
- for (let i = 0; i < styles.length; i++) {
2480
- head.appendChild(styles[i]);
2481
- }
2482
- break;
2483
- case VNodeJournalOpCode.Remove:
2484
- const removeParent = journal[idx++];
2485
- let nodeToRemove;
2486
- for (; idx < length && "number" != typeof (nodeToRemove = journal[idx]); ) {
2487
- removeParent.removeChild(nodeToRemove), idx++;
2488
- }
2489
- break;
2490
- case VNodeJournalOpCode.Insert:
2491
- const insertParent = journal[idx++];
2492
- const insertBefore = journal[idx++];
2493
- let newChild;
2494
- for (; idx < length && "number" != typeof (newChild = journal[idx]); ) {
2495
- insertParent.insertBefore(newChild, insertBefore), idx++;
2192
+ getParentHost(host) {
2193
+ let vNode = vnode_getParent(host);
2194
+ for (; vNode; ) {
2195
+ if (vnode_isVirtualVNode(vNode)) {
2196
+ if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
2197
+ return vNode;
2496
2198
  }
2199
+ vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
2200
+ } else {
2201
+ vNode = vnode_getParent(vNode);
2202
+ }
2497
2203
  }
2204
+ return null;
2498
2205
  }
2499
- journal.length = 0;
2500
- };
2501
- const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
2502
- ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent), newChild === insertBefore && (insertBefore = null);
2503
- let adjustedInsertBefore = null;
2504
- null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, true, false)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, true, true) : insertBefore, adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
2505
- const domParentVNode = vnode_getDomParentVNode(parent);
2506
- const parentNode = domParentVNode && domParentVNode[ElementVNodeProps.element];
2507
- if (parentNode) {
2508
- const domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild);
2509
- domChildren.length && journal.push(VNodeJournalOpCode.Insert, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
2510
- }
2511
- const newChildCurrentParent = newChild[VNodeProps.parent];
2512
- newChildCurrentParent && (newChild[VNodeProps.previousSibling] || newChild[VNodeProps.nextSibling] || vnode_isElementVNode(newChildCurrentParent) && newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, false);
2513
- const vNext = insertBefore;
2514
- const vPrevious = vNext ? vNext[VNodeProps.previousSibling] : parent[ElementVNodeProps.lastChild];
2515
- vNext ? vNext[VNodeProps.previousSibling] = newChild : parent[ElementVNodeProps.lastChild] = newChild, vPrevious ? vPrevious[VNodeProps.nextSibling] = newChild : parent[ElementVNodeProps.firstChild] = newChild, newChild[VNodeProps.previousSibling] = vPrevious, newChild[VNodeProps.nextSibling] = vNext, newChild[VNodeProps.parent] = parent;
2516
- };
2517
- const vnode_getDomParent = (vnode) => (vnode = vnode_getDomParentVNode(vnode)) && vnode[ElementVNodeProps.element];
2518
- const vnode_getDomParentVNode = (vnode) => {
2519
- for (; vnode && !vnode_isElementVNode(vnode); ) {
2520
- vnode = vnode[VNodeProps.parent];
2206
+ setHostProp(host, name, value) {
2207
+ vnode_setProp(host, name, value);
2521
2208
  }
2522
- return vnode;
2523
- };
2524
- const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
2525
- assertEqual(vParent, vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove);
2526
- const vPrevious = vToRemove[VNodeProps.previousSibling];
2527
- const vNext = vToRemove[VNodeProps.nextSibling];
2528
- if (vPrevious ? vPrevious[VNodeProps.nextSibling] = vNext : vParent[ElementVNodeProps.firstChild] = vNext, vNext ? vNext[VNodeProps.previousSibling] = vPrevious : vParent[ElementVNodeProps.lastChild] = vPrevious, vToRemove[VNodeProps.previousSibling] = null, vToRemove[VNodeProps.nextSibling] = null, removeDOM) {
2529
- const domParent = vnode_getDomParent(vParent);
2530
- if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
2531
- return;
2209
+ getHostProp(host, name) {
2210
+ const vNode = host;
2211
+ let getObjectById2 = null;
2212
+ switch (name) {
2213
+ case "q:seq":
2214
+ case "q:props":
2215
+ case "q:renderFn":
2216
+ case "q:ctx":
2217
+ case "q:brefs":
2218
+ getObjectById2 = this.$getObjectById$;
2219
+ break;
2220
+ case "q:seqIdx":
2221
+ case ":onIdx":
2222
+ getObjectById2 = parseInt;
2532
2223
  }
2533
- const children = vnode_getDOMChildNodes(journal, vToRemove);
2534
- domParent && children.length && journal.push(VNodeJournalOpCode.Remove, domParent, ...children);
2224
+ return vnode_getProp(vNode, name, getObjectById2);
2535
2225
  }
2536
- };
2537
- const vnode_truncate = (journal, vParent, vDelete) => {
2538
- const parent = vnode_getDomParent(vParent);
2539
- const children = vnode_getDOMChildNodes(journal, vDelete);
2540
- parent && children.length && journal.push(VNodeJournalOpCode.Remove, parent, ...children);
2541
- const vPrevious = vDelete[VNodeProps.previousSibling];
2542
- vPrevious ? vPrevious[VNodeProps.nextSibling] = null : vParent[ElementVNodeProps.firstChild] = null, vParent[ElementVNodeProps.lastChild] = vPrevious;
2543
- };
2544
- const vnode_getElementName = (vnode) => {
2545
- const elementVNode = ensureElementVNode(vnode);
2546
- let elementName = elementVNode[ElementVNodeProps.elementName];
2547
- if (void 0 === elementName) {
2548
- const element = elementVNode[ElementVNodeProps.element];
2549
- const nodeName = fastNodeName(element);
2550
- elementName = elementVNode[ElementVNodeProps.elementName] = nodeName, elementVNode[VNodeProps.flags] |= vnode_getElementNamespaceFlags(element);
2226
+ scheduleRender() {
2227
+ return this.$renderCount$++, this.renderDone || (this.renderDone = getPlatform().nextTick(() => this.processChores())), this.renderDone.finally(() => emitEvent("qrender", {
2228
+ instanceHash: this.$instanceHash$,
2229
+ renderCount: this.$renderCount$
2230
+ }));
2551
2231
  }
2552
- return elementName;
2553
- };
2554
- const vnode_getText = (vnode) => {
2555
- const textVNode = ensureTextVNode(vnode);
2556
- let text = textVNode[TextVNodeProps.text];
2557
- return void 0 === text && (text = textVNode[TextVNodeProps.text] = textVNode[TextVNodeProps.node].nodeValue), text;
2558
- };
2559
- const vnode_setText = (journal, textVNode, text) => {
2560
- vnode_ensureTextInflated(journal, textVNode);
2561
- journal.push(VNodeJournalOpCode.SetText, textVNode[TextVNodeProps.node], textVNode[TextVNodeProps.text] = text);
2562
- };
2563
- const vnode_getFirstChild = (vnode) => {
2564
- if (vnode_isTextVNode(vnode)) {
2565
- return null;
2232
+ processChores() {
2233
+ let renderCount = this.$renderCount$;
2234
+ const result = this.$scheduler$(255);
2235
+ if (isPromise(result)) {
2236
+ return result.then(async () => {
2237
+ for (; renderCount !== this.$renderCount$; ) {
2238
+ renderCount = this.$renderCount$, await this.$scheduler$(255);
2239
+ }
2240
+ this.renderDone = null;
2241
+ });
2242
+ }
2243
+ renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
2566
2244
  }
2567
- let vFirstChild = vnode[ElementVNodeProps.firstChild];
2568
- return void 0 === vFirstChild && (vFirstChild = ensureMaterialized(vnode)), vFirstChild;
2569
- };
2570
- const vnode_materialize = (vNode) => {
2571
- const element = vNode[ElementVNodeProps.element];
2572
- const firstChild = fastFirstChild(element);
2573
- const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
2574
- return materialize(vNode, element, firstChild, vNodeData);
2575
- };
2576
- const materialize = (vNode, element, firstChild, vNodeData) => {
2577
- if (vNodeData) {
2578
- if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
2579
- const elementVNodeDataStartIdx = 1;
2580
- let elementVNodeDataEndIdx = 1;
2581
- for (; vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR; ) {
2582
- elementVNodeDataEndIdx++;
2583
- }
2584
- const elementVNodeData = vNodeData.substring(elementVNodeDataStartIdx, elementVNodeDataEndIdx);
2585
- vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
2586
- const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
2587
- if (!vNodeData) {
2588
- return vFirstChild;
2245
+ ensureProjectionResolved(vNode) {
2246
+ if (!(16 & vNode[0])) {
2247
+ vNode[0] |= 16;
2248
+ const props = vnode_getProps(vNode);
2249
+ for (let i = 0; i < props.length; i += 2) {
2250
+ if (isSlotProp(props[i])) {
2251
+ const value = props[i + 1];
2252
+ "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
2253
+ }
2589
2254
  }
2590
2255
  }
2591
- return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
2592
2256
  }
2593
- return materializeFromDOM(vNode, firstChild);
2594
- };
2595
- const ensureMaterialized = (vnode) => {
2596
- const vParent = ensureElementVNode(vnode);
2597
- let vFirstChild = vParent[ElementVNodeProps.firstChild];
2598
- if (void 0 === vFirstChild) {
2599
- vFirstChild = vParent[VNodeProps.parent] && shouldIgnoreChildren(vParent[ElementVNodeProps.element]) ? vParent[ElementVNodeProps.firstChild] = vParent[ElementVNodeProps.lastChild] = null : vnode_materialize(vParent);
2257
+ getSyncFn(id) {
2258
+ const fn = this.$qFuncs$[id];
2259
+ return fn;
2600
2260
  }
2601
- return assertTrue(void 0 !== vParent[ElementVNodeProps.firstChild]), assertTrue(void 0 !== vParent[ElementVNodeProps.lastChild]), vFirstChild;
2602
- };
2603
- let _fastHasAttribute = null;
2604
- const shouldIgnoreChildren = (node) => (_fastHasAttribute || (_fastHasAttribute = node.hasAttribute), _fastHasAttribute.call(node, "q:container"));
2605
- let _fastNodeType = null;
2606
- const fastNodeType = (node) => (_fastNodeType || (_fastNodeType = fastGetter(node, "nodeType")), _fastNodeType.call(node));
2607
- const fastIsTextOrElement = (node) => {
2608
- const type = fastNodeType(node);
2609
- return 3 === type || 1 === type;
2610
- };
2611
- let _fastNextSibling = null;
2612
- const fastNextSibling = (node) => {
2613
- for (_fastNextSibling || (_fastNextSibling = fastGetter(node, "nextSibling")), _fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")); node; ) {
2614
- if (null !== (node = _fastNextSibling.call(node))) {
2615
- const type = fastNodeType(node);
2616
- if (3 === type || 1 === type) {
2617
- break;
2618
- }
2619
- if (8 === type) {
2620
- const nodeValue = node.nodeValue;
2621
- if (nodeValue?.startsWith(QIgnore)) {
2622
- return getNodeAfterCommentNode(node, QContainerIsland, _fastNextSibling, _fastFirstChild);
2623
- }
2624
- if (node.nodeValue?.startsWith(QContainerIslandEnd)) {
2625
- return getNodeAfterCommentNode(node, QIgnoreEnd, _fastNextSibling, _fastFirstChild);
2626
- }
2627
- if (nodeValue?.startsWith("q:container")) {
2628
- for (; node && (node = _fastNextSibling.call(node)) && (8 !== fastNodeType(node) || !node.nodeValue?.startsWith("/q:container")); ) {
2629
- }
2630
- }
2631
- }
2261
+ $appendStyle$(content, styleId, host, scoped) {
2262
+ if (scoped) {
2263
+ const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
2264
+ const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
2265
+ scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", convertStyleIdsToString(scopedStyleIds));
2266
+ }
2267
+ if (null == this.$styleIds$ && (this.$styleIds$ = /* @__PURE__ */ new Set(), this.element.querySelectorAll(QStyleSelector).forEach((style) => {
2268
+ this.$styleIds$.add(style.getAttribute(QStyle));
2269
+ })), !this.$styleIds$.has(styleId)) {
2270
+ this.$styleIds$.add(styleId);
2271
+ const styleElement = this.document.createElement("style");
2272
+ styleElement.setAttribute(QStyle, styleId), styleElement.textContent = content, this.$journal$.push(5, this.document.head, null, styleElement);
2632
2273
  }
2633
2274
  }
2634
- return node;
2635
- };
2636
- function getNodeAfterCommentNode(node, commentValue, nextSibling, firstChild) {
2637
- for (; node; ) {
2638
- if (node.nodeValue?.startsWith(commentValue)) {
2639
- return node = nextSibling.call(node) || null;
2275
+ $setServerData$() {
2276
+ const containerAttributes = {};
2277
+ const attrs = this.element.attributes;
2278
+ if (attrs) {
2279
+ for (let index = 0; index < attrs.length; index++) {
2280
+ const attr = attrs[index];
2281
+ ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
2282
+ }
2640
2283
  }
2641
- let nextNode = firstChild.call(node);
2642
- nextNode || (nextNode = nextSibling.call(node)), nextNode || (nextNode = fastParentNode(node), nextNode && (nextNode = nextSibling.call(nextNode))), node = nextNode;
2284
+ this.$serverData$ = {
2285
+ containerAttributes
2286
+ };
2643
2287
  }
2644
- return null;
2645
2288
  }
2646
- let _fastParentNode = null;
2647
- const fastParentNode = (node) => (_fastParentNode || (_fastParentNode = fastGetter(node, "parentNode")), _fastParentNode.call(node));
2648
- let _fastFirstChild = null;
2649
- const fastFirstChild = (node) => {
2650
- for (_fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")), node = node && _fastFirstChild.call(node); node && !fastIsTextOrElement(node); ) {
2651
- node = fastNextSibling(node);
2289
+ let _context;
2290
+ const tryGetInvokeContext = () => {
2291
+ if (!_context) {
2292
+ const context = "undefined" != typeof document && document && document.__q_context__;
2293
+ if (!context) {
2294
+ return;
2295
+ }
2296
+ return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
2652
2297
  }
2653
- return node;
2298
+ return _context;
2654
2299
  };
2655
- let _fastNamespaceURI = null;
2656
- const fastNamespaceURI = (element) => (_fastNamespaceURI || (_fastNamespaceURI = fastGetter(element, "namespaceURI")), _fastNamespaceURI.call(element));
2657
- let _fastNodeName = null;
2658
- const fastNodeName = (element) => (_fastNodeName || (_fastNodeName = fastGetter(element, "nodeName")), _fastNodeName.call(element));
2659
- const fastGetter = (prototype, name) => {
2660
- let getter;
2661
- for (; prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
2662
- prototype = Object.getPrototypeOf(prototype);
2300
+ function invoke(context, fn, ...args) {
2301
+ return invokeApply.call(this, context, fn, args);
2302
+ }
2303
+ function invokeApply(context, fn, args) {
2304
+ const previousContext = _context;
2305
+ let returnValue;
2306
+ try {
2307
+ _context = context, returnValue = fn.apply(this, args);
2308
+ } finally {
2309
+ _context = previousContext;
2663
2310
  }
2664
- return getter || function() {
2665
- return this[name];
2666
- };
2311
+ return returnValue;
2312
+ }
2313
+ const newInvokeContextFromTuple = ([element, event, url]) => {
2314
+ const domContainer = getDomContainer(element);
2315
+ const hostElement = vnode_locate(domContainer.rootVNode, element);
2316
+ const locale = domContainer.$locale$;
2317
+ return newInvokeContext(locale, hostElement, element, event, url);
2667
2318
  };
2668
- const isQStyleElement = (node) => isElement(node) && "STYLE" === node.nodeName && (node.hasAttribute("q:sstyle") || node.hasAttribute(QStyle));
2669
- const materializeFromDOM = (vParent, firstChild, vData) => {
2670
- let vFirstChild = null;
2671
- const skipStyleElements = () => {
2672
- for (; isQStyleElement(child); ) {
2673
- child = fastNextSibling(child);
2674
- }
2319
+ const newInvokeContext = (locale, hostElement, element, event, url) => {
2320
+ const ctx = {
2321
+ $url$: url,
2322
+ $i$: 0,
2323
+ $hostElement$: hostElement,
2324
+ $element$: element,
2325
+ $event$: event,
2326
+ $qrl$: void 0,
2327
+ $effectSubscriber$: void 0,
2328
+ $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
2329
+ $container$: void 0
2675
2330
  };
2676
- let child = firstChild;
2677
- skipStyleElements();
2678
- let vChild = null;
2679
- for (; child; ) {
2680
- const nodeType = fastNodeType(child);
2681
- let vNextChild = null;
2682
- 3 === nodeType ? vNextChild = vnode_newText(child, child.textContent ?? void 0) : 1 === nodeType && (vNextChild = vnode_newUnMaterializedElement(child)), vNextChild && (vNextChild[VNodeProps.parent] = vParent, vChild && (vChild[VNodeProps.nextSibling] = vNextChild), vNextChild[VNodeProps.previousSibling] = vChild, vChild = vNextChild), vFirstChild || (vParent[ElementVNodeProps.firstChild] = vFirstChild = vChild), child = fastNextSibling(child), skipStyleElements();
2683
- }
2684
- if (vParent[ElementVNodeProps.lastChild] = vChild || null, vParent[ElementVNodeProps.firstChild] = vFirstChild, vData) {
2685
- let container = null;
2686
- processVNodeData$1(vData, (peek, consumeValue) => {
2687
- if (peek() === VNodeDataChar.ID) {
2688
- container || (container = getDomContainer(vParent[ElementVNodeProps.element]));
2689
- const id = consumeValue();
2690
- container.$setRawState$(parseInt(id), vParent);
2691
- } else {
2692
- peek() === VNodeDataChar.BACK_REFS ? (container || (container = getDomContainer(vParent[ElementVNodeProps.element])), setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
2693
- }
2694
- });
2695
- }
2696
- return vFirstChild;
2331
+ return ctx;
2697
2332
  };
2698
- function setEffectBackRefFromVNodeData(vParent, value, container) {
2699
- const deserializedSubMap = container.$getObjectById$(value);
2700
- if (vParent[_EFFECT_BACK_REF]) {
2701
- mergeMaps(vParent[_EFFECT_BACK_REF], deserializedSubMap);
2702
- } else {
2703
- Object.defineProperty(vParent, _EFFECT_BACK_REF, {
2704
- value: deserializedSubMap
2705
- });
2706
- }
2707
- }
2708
- const processVNodeData$1 = (vData, callback) => {
2709
- let nextToConsumeIdx = 0;
2710
- let ch = 0;
2711
- let peekCh = 0;
2712
- const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
2713
- const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
2714
- const consumeValue = () => {
2715
- consume();
2716
- const start = nextToConsumeIdx;
2717
- for (; peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122; ) {
2718
- consume();
2719
- }
2720
- return vData.substring(start, nextToConsumeIdx);
2721
- };
2722
- for (; 0 !== peek(); ) {
2723
- callback(peek, consumeValue, consume, nextToConsumeIdx);
2724
- }
2725
- };
2726
- const vnode_getNextSibling = (vnode) => vnode[VNodeProps.nextSibling];
2727
- const vnode_getPreviousSibling = (vnode) => vnode[VNodeProps.previousSibling];
2728
- const vnode_setAttr = (journal, vnode, key, value) => {
2729
- const type = vnode[VNodeProps.flags];
2730
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2731
- vnode_ensureElementInflated(vnode);
2732
- const props = vnode_getProps(vnode);
2733
- const idx = mapApp_findIndx(props, key, 0);
2734
- if (idx >= 0) {
2735
- if (props[idx + 1] != value && type & VNodeFlags.Element) {
2736
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
2737
- }
2738
- null == value ? props.splice(idx, 2) : props[idx + 1] = value;
2739
- } else if (null != value && (props.splice(~idx, 0, key, value), type & VNodeFlags.Element)) {
2740
- journal && journal.push(VNodeJournalOpCode.SetAttribute, vnode[ElementVNodeProps.element], key, value);
2741
- }
2742
- }
2743
- };
2744
- const vnode_getAttr = (vnode, key) => {
2745
- if (vnode[VNodeProps.flags] & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2746
- vnode_ensureElementInflated(vnode);
2747
- const props = vnode_getProps(vnode);
2748
- return mapArray_get(props, key, 0);
2333
+ const untrack = (fn) => invoke(void 0, fn);
2334
+ const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
2335
+ const trackSignal = (fn, subscriber, property, container, data) => {
2336
+ const previousSubscriber = trackInvocation.$effectSubscriber$;
2337
+ const previousContainer = trackInvocation.$container$;
2338
+ try {
2339
+ return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
2340
+ } finally {
2341
+ trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
2749
2342
  }
2750
- return null;
2751
2343
  };
2752
- const vnode_getProp = (vnode, key, getObject) => {
2753
- const type = vnode[VNodeProps.flags];
2754
- if (type & VNodeFlags.ELEMENT_OR_VIRTUAL_MASK) {
2755
- type & VNodeFlags.Element && vnode_ensureElementInflated(vnode);
2756
- const props = vnode_getProps(vnode);
2757
- const idx = mapApp_findIndx(props, key, 0);
2758
- if (idx >= 0) {
2759
- let value = props[idx + 1];
2760
- return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)), value;
2761
- }
2762
- }
2763
- return null;
2344
+ const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host), trackSignal(() => value.value, host, property, container, data));
2345
+ const _jsxSorted = (type, varProps, constProps, children, flags, key) => {
2346
+ const processed = null == key ? null : String(key);
2347
+ const node = new JSXNodeImpl(type, varProps || {}, constProps || null, children, flags, processed);
2348
+ return node;
2764
2349
  };
2765
- const vnode_setProp = (vnode, key, value) => {
2766
- ensureElementOrVirtualVNode(vnode);
2767
- const props = vnode_getProps(vnode);
2768
- const idx = mapApp_findIndx(props, key, 0);
2769
- idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
2350
+ const _jsxSplit = (type, varProps, constProps, children, flags, key, dev) => {
2351
+ let sortedProps;
2352
+ return sortedProps = varProps ? Object.fromEntries(untrack(() => Object.entries(varProps)).filter((entry) => {
2353
+ const attr = entry[0];
2354
+ return "children" === attr ? (children ?? (children = entry[1]), false) : "key" === attr ? (key = entry[1], false) : !constProps;
2355
+ }).sort(([a2], [b]) => a2 < b ? -1 : 1)) : "string" == typeof type ? EMPTY_OBJ : {}, _jsxSorted(type, sortedProps, constProps, children, flags, key);
2770
2356
  };
2771
- const vnode_getPropStartIndex = (vnode) => {
2772
- const type = vnode[VNodeProps.flags] & VNodeFlags.TYPE_MASK;
2773
- if (type === VNodeFlags.Element) {
2774
- return ElementVNodeProps.PROPS_OFFSET;
2357
+ const jsx = (type, props, key) => _jsxSplit(type, props, null, null, 0, null);
2358
+ const isPropsProxy = (obj) => obj && void 0 !== obj[_VAR_PROPS];
2359
+ class JSXNodeImpl {
2360
+ constructor(type, varProps, constProps, children, flags, key = null) {
2361
+ __publicField(this, "type");
2362
+ __publicField(this, "varProps");
2363
+ __publicField(this, "constProps");
2364
+ __publicField(this, "children");
2365
+ __publicField(this, "flags");
2366
+ __publicField(this, "key");
2367
+ __publicField(this, "dev");
2368
+ __publicField(this, "_proxy", null);
2369
+ this.type = type, this.varProps = varProps, this.constProps = constProps, this.children = children, this.flags = flags, this.key = key;
2775
2370
  }
2776
- if (type === VNodeFlags.Virtual) {
2777
- return VirtualVNodeProps.PROPS_OFFSET;
2371
+ get props() {
2372
+ return this._proxy || (this._proxy = createPropsProxy(this.varProps, this.constProps, this.children)), this._proxy;
2778
2373
  }
2779
- throw qError(QError.invalidVNodeType, [type]);
2780
- };
2781
- const vnode_getProps = (vnode) => vnode[vnode_getPropStartIndex(vnode)];
2782
- const vnode_getParent = (vnode) => vnode[VNodeProps.parent] || null;
2783
- const vnode_getNode = (vnode) => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[ElementVNodeProps.element] : (assertTrue(vnode_isTextVNode(vnode)), vnode[TextVNodeProps.node]);
2784
- const isNumber = (ch) => 48 <= ch && ch <= 57;
2785
- const isLowercase = (ch) => 97 <= ch && ch <= 122;
2786
- const stack = [];
2787
- function materializeFromVNodeData(vParent, vData, element, child) {
2788
- let idx = 0;
2789
- let vFirst = null;
2790
- let vLast = null;
2791
- let previousTextNode = null;
2792
- const addVNode = (node) => {
2793
- node[VNodeProps.flags] = node[VNodeProps.flags] & VNodeFlagsIndex.negated_mask | idx << VNodeFlagsIndex.shift, idx++, vLast && (vLast[VNodeProps.nextSibling] = node), node[VNodeProps.previousSibling] = vLast, node[VNodeProps.parent] = vParent, vFirst || (vParent[ElementVNodeProps.firstChild] = vFirst = node), vLast = node;
2794
- };
2795
- let textIdx = 0;
2796
- let combinedText = null;
2797
- let container = null;
2798
- return processVNodeData$1(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
2799
- if (isNumber(peek())) {
2800
- for (; !isElement(child); ) {
2801
- if (!(child = fastNextSibling(child))) {
2802
- throw qError(QError.materializeVNodeDataError, [vData, peek(), nextToConsumeIdx]);
2803
- }
2804
- }
2805
- for (; isQStyleElement(child); ) {
2806
- child = fastNextSibling(child);
2807
- }
2808
- combinedText = null, previousTextNode = null;
2809
- let value = 0;
2810
- for (; isNumber(peek()); ) {
2811
- value *= 10, value += consume() - 48;
2812
- }
2813
- for (; value--; ) {
2814
- addVNode(vnode_newUnMaterializedElement(child)), child = fastNextSibling(child);
2815
- }
2816
- } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
2817
- vnode_setAttr(null, vParent, "q:sstyle", consumeValue());
2818
- } else if (peek() === VNodeDataChar.RENDER_FN) {
2819
- vnode_setAttr(null, vParent, "q:renderFn", consumeValue());
2820
- } else if (peek() === VNodeDataChar.ID) {
2821
- container || (container = getDomContainer(element));
2822
- const id = consumeValue();
2823
- container.$setRawState$(parseInt(id), vParent);
2824
- } else if (peek() === VNodeDataChar.PROPS) {
2825
- vnode_setAttr(null, vParent, "q:props", consumeValue());
2826
- } else if (peek() === VNodeDataChar.KEY) {
2827
- vnode_setAttr(null, vParent, "q:key", consumeValue());
2828
- } else if (peek() === VNodeDataChar.SEQ) {
2829
- vnode_setAttr(null, vParent, "q:seq", consumeValue());
2830
- } else if (peek() === VNodeDataChar.SEQ_IDX) {
2831
- vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
2832
- } else if (peek() === VNodeDataChar.BACK_REFS) {
2833
- container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
2834
- } else if (peek() === VNodeDataChar.SLOT_PARENT) {
2835
- vnode_setProp(vParent, "q:sparent", consumeValue());
2836
- } else if (peek() === VNodeDataChar.CONTEXT) {
2837
- vnode_setAttr(null, vParent, "q:ctx", consumeValue());
2838
- } else if (peek() === VNodeDataChar.OPEN) {
2839
- consume(), addVNode(vnode_newVirtual()), stack.push(vParent, vFirst, vLast, previousTextNode, idx), idx = 0, vParent = vLast, vFirst = vLast = null;
2840
- } else if (peek() === VNodeDataChar.SEPARATOR) {
2841
- const key = consumeValue();
2842
- const value = consumeValue();
2843
- vnode_setAttr(null, vParent, key, value);
2844
- } else if (peek() === VNodeDataChar.CLOSE) {
2845
- consume(), vParent[ElementVNodeProps.lastChild] = vLast, idx = stack.pop(), previousTextNode = stack.pop(), vLast = stack.pop(), vFirst = stack.pop(), vParent = stack.pop();
2846
- } else if (peek() === VNodeDataChar.SLOT) {
2847
- vnode_setAttr(null, vParent, QSlot, consumeValue());
2848
- } else {
2849
- const textNode = child && 3 === fastNodeType(child) ? child : null;
2850
- null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
2851
- let length = 0;
2852
- for (; isLowercase(peek()); ) {
2853
- length += consume() - 97, length *= 26;
2854
- }
2855
- length += consume() - 65;
2856
- const text = null === combinedText ? "" : combinedText.substring(textIdx, textIdx + length);
2857
- addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)), textIdx += length;
2858
- }
2859
- }), vParent[ElementVNodeProps.lastChild] = vLast, vFirst;
2860
2374
  }
2861
- const vnode_getType = (vnode) => {
2862
- const type = vnode[VNodeProps.flags];
2863
- if (type & VNodeFlags.Element) {
2864
- return 1;
2865
- }
2866
- if (type & VNodeFlags.Virtual) {
2867
- return 11;
2868
- }
2869
- if (type & VNodeFlags.Text) {
2870
- return 3;
2375
+ const Virtual = (props) => props.children;
2376
+ const isJSXNode = (n) => n instanceof JSXNodeImpl;
2377
+ const Fragment = (props) => props.children;
2378
+ function createPropsProxy(varProps, constProps, children) {
2379
+ return new Proxy({}, new PropsProxyHandler(varProps, constProps, children));
2380
+ }
2381
+ class PropsProxyHandler {
2382
+ constructor($varProps$, $constProps$, $children$) {
2383
+ __publicField(this, "$varProps$");
2384
+ __publicField(this, "$constProps$");
2385
+ __publicField(this, "$children$");
2386
+ this.$varProps$ = $varProps$, this.$constProps$ = $constProps$, this.$children$ = $children$;
2871
2387
  }
2872
- throw qError(QError.invalidVNodeType, [type]);
2873
- };
2874
- const isElement = (node) => node && "object" == typeof node && 1 === fastNodeType(node);
2875
- const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
2876
- let projectionDepth = 1;
2877
- for (; projectionDepth--; ) {
2878
- for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
2879
- const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
2880
- const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
2881
- vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
2388
+ get(_, prop) {
2389
+ if (prop === _CONST_PROPS) {
2390
+ return this.$constProps$;
2882
2391
  }
2883
- projectionDepth > 0 && (vHost = vnode_getParent(vHost));
2392
+ if (prop === _VAR_PROPS) {
2393
+ return this.$varProps$;
2394
+ }
2395
+ if (null != this.$children$ && "children" === prop) {
2396
+ return this.$children$;
2397
+ }
2398
+ const value = this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] : this.$varProps$[prop];
2399
+ return value instanceof WrappedSignal && 2 & value.$flags$ ? value.value : value;
2884
2400
  }
2885
- return vHost;
2886
- };
2887
- const VNodeArray = class VNode extends Array {
2888
- static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
2889
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
2401
+ set(_, prop, value) {
2402
+ return prop === _CONST_PROPS ? (this.$constProps$ = value, true) : prop === _VAR_PROPS ? (this.$varProps$ = value, true) : (this.$constProps$ && prop in this.$constProps$ ? this.$constProps$[prop] = value : this.$varProps$[prop] = value, true);
2890
2403
  }
2891
- static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
2892
- return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
2404
+ deleteProperty(_, prop) {
2405
+ if ("string" != typeof prop) {
2406
+ return false;
2407
+ }
2408
+ let didDelete = delete this.$varProps$[prop];
2409
+ return this.$constProps$ && (didDelete = delete this.$constProps$[prop] || didDelete), null != this.$children$ && "children" === prop && (this.$children$ = null), didDelete;
2893
2410
  }
2894
- static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
2895
- return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
2411
+ has(_, prop) {
2412
+ return "children" === prop && null != this.$children$ || prop === _CONST_PROPS || prop === _VAR_PROPS || prop in this.$varProps$ || !!this.$constProps$ && prop in this.$constProps$;
2896
2413
  }
2897
- constructor(flags, parent, previousSibling, nextSibling, ...rest) {
2898
- super(flags, parent, previousSibling, nextSibling, ...rest);
2414
+ getOwnPropertyDescriptor(_, p) {
2415
+ return {
2416
+ configurable: true,
2417
+ enumerable: true,
2418
+ value: "children" === p && null != this.$children$ ? this.$children$ : this.$constProps$ && p in this.$constProps$ ? this.$constProps$[p] : this.$varProps$[p]
2419
+ };
2899
2420
  }
2900
- };
2901
- let _context;
2902
- const tryGetInvokeContext = () => {
2903
- if (!_context) {
2904
- const context = "undefined" != typeof document && document && document.__q_context__;
2905
- if (!context) {
2906
- return;
2421
+ ownKeys() {
2422
+ const out = Object.keys(this.$varProps$);
2423
+ if (null != this.$children$ && -1 === out.indexOf("children") && out.push("children"), this.$constProps$) {
2424
+ for (const key in this.$constProps$) {
2425
+ -1 === out.indexOf(key) && out.push(key);
2426
+ }
2907
2427
  }
2908
- return isArray(context) ? document.__q_context__ = newInvokeContextFromTuple(context) : context;
2428
+ return out;
2909
2429
  }
2910
- return _context;
2911
- };
2912
- function invoke(context, fn, ...args) {
2913
- return invokeApply.call(this, context, fn, args);
2914
2430
  }
2915
- function invokeApply(context, fn, args) {
2916
- const previousContext = _context;
2917
- let returnValue;
2918
- try {
2919
- _context = context, returnValue = fn.apply(this, args);
2920
- } finally {
2921
- _context = previousContext;
2431
+ const directGetPropsProxyProp = (jsx2, prop) => jsx2.constProps && prop in jsx2.constProps ? jsx2.constProps[prop] : jsx2.varProps[prop];
2432
+ const mergeMaps = (map1, map2) => {
2433
+ for (const [k, v] of map2) {
2434
+ map1.set(k, v);
2922
2435
  }
2923
- return returnValue;
2924
- }
2925
- const newInvokeContextFromTuple = ([element, event, url]) => {
2926
- const domContainer = getDomContainer(element);
2927
- const container = domContainer.element;
2928
- const vNode = container ? vnode_locate(domContainer.rootVNode, element) : void 0;
2929
- const locale = container?.getAttribute("q:locale") || void 0;
2930
- return newInvokeContext(locale, vNode, element, event, url);
2436
+ return map1;
2931
2437
  };
2932
- const newInvokeContext = (locale, hostElement, element, event, url) => {
2933
- const ctx = {
2934
- $url$: url,
2935
- $i$: 0,
2936
- $hostElement$: hostElement,
2937
- $element$: element,
2938
- $event$: event,
2939
- $qrl$: void 0,
2940
- $effectSubscriber$: void 0,
2941
- $locale$: locale || ("object" == typeof event && event && "locale" in event ? event.locale : void 0),
2942
- $container$: void 0
2943
- };
2944
- return ctx;
2438
+ const vnode_newElement = (element, elementName) => {
2439
+ assertEqual(fastNodeType(element));
2440
+ const vnode = VNodeArray.createElement(-247, null, null, null, null, null, element, elementName);
2441
+ return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2945
2442
  };
2946
- const untrack = (fn) => invoke(void 0, fn);
2947
- const trackInvocation = /* @__PURE__ */ newInvokeContext(void 0, void 0, void 0, "qRender");
2948
- const trackSignal = (fn, subscriber, property, container, data) => {
2949
- const previousSubscriber = trackInvocation.$effectSubscriber$;
2950
- const previousContainer = trackInvocation.$container$;
2951
- try {
2952
- return trackInvocation.$effectSubscriber$ = getSubscriber(subscriber, property, data), trackInvocation.$container$ = container, invoke(trackInvocation, fn);
2953
- } finally {
2954
- trackInvocation.$effectSubscriber$ = previousSubscriber, trackInvocation.$container$ = previousContainer;
2443
+ const vnode_newUnMaterializedElement = (element) => {
2444
+ assertEqual(fastNodeType(element));
2445
+ const vnode = VNodeArray.createElement(-255, null, null, null, void 0, void 0, element, void 0);
2446
+ return assertTrue(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), element.vNode = new WeakRef(vnode), vnode;
2447
+ };
2448
+ const vnode_newSharedText = (previousTextNode, sharedTextNode, textContent) => {
2449
+ sharedTextNode && assertEqual(fastNodeType(sharedTextNode));
2450
+ const vnode = VNodeArray.createText(-252, null, previousTextNode, null, sharedTextNode, textContent);
2451
+ return assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2452
+ };
2453
+ const vnode_newText = (textNode, textContent) => {
2454
+ const vnode = VNodeArray.createText(-244, null, null, null, textNode, textContent);
2455
+ return assertEqual(fastNodeType(textNode)), assertFalse(vnode_isElementVNode(vnode)), assertTrue(vnode_isTextVNode(vnode)), assertFalse(vnode_isVirtualVNode(vnode)), vnode;
2456
+ };
2457
+ const vnode_newVirtual = () => {
2458
+ const vnode = VNodeArray.createVirtual(-254, null, null, null, null, null);
2459
+ return assertFalse(vnode_isElementVNode(vnode)), assertFalse(vnode_isTextVNode(vnode)), assertTrue(vnode_isVirtualVNode(vnode)), vnode;
2460
+ };
2461
+ const vnode_isVNode = (vNode) => vNode instanceof VNodeArray;
2462
+ const vnode_isElementVNode = (vNode) => {
2463
+ return !(1 & ~vNode[0]);
2464
+ };
2465
+ const vnode_isElementOrTextVNode = (vNode) => {
2466
+ return !!(5 & vNode[0]);
2467
+ };
2468
+ const vnode_isTextVNode = (vNode) => {
2469
+ return !(4 & ~vNode[0]);
2470
+ };
2471
+ const vnode_isVirtualVNode = (vNode) => {
2472
+ return !(2 & ~vNode[0]);
2473
+ };
2474
+ const vnode_isProjection = (vNode) => {
2475
+ return !(2 & ~vNode[0]) && null !== vnode_getProp(vNode, QSlot, null);
2476
+ };
2477
+ const ensureTextVNode = (vNode) => (assertTrue(vnode_isTextVNode(vNode), "Expecting TextVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2478
+ const ensureElementOrVirtualVNode = (vNode) => {
2479
+ assertTrue(!!(3 & vNode[0]), "Expecting ElementVNode or VirtualVNode was: " + vnode_getNodeTypeName(vNode));
2480
+ };
2481
+ const ensureElementVNode = (vNode) => (assertTrue(vnode_isElementVNode(vNode), "Expecting ElementVNode was: " + vnode_getNodeTypeName(vNode)), vNode);
2482
+ const vnode_getNodeTypeName = (vNode) => {
2483
+ if (vNode) {
2484
+ switch (7 & vNode[0]) {
2485
+ case 1:
2486
+ return "Element";
2487
+ case 2:
2488
+ return "Virtual";
2489
+ case 4:
2490
+ return "Text";
2491
+ }
2955
2492
  }
2493
+ return "<unknown>";
2956
2494
  };
2957
- const trackSignalAndAssignHost = (value, host, property, container, data) => (value instanceof WrappedSignal && value.$hostElement$ !== host && host && (value.$hostElement$ = host), trackSignal(() => value.value, host, property, container, data));
2958
- const createContextId = (name) => /* @__PURE__ */ Object.freeze({
2959
- id: fromCamelToKebabCase(name)
2960
- });
2961
- const ERROR_CONTEXT = /* @__PURE__ */ createContextId("qk-error");
2962
- function processVNodeData(document2) {
2963
- const vNodeDataMap = document2.qVNodeData || (document2.qVNodeData = /* @__PURE__ */ new WeakMap());
2964
- const prototype = document2.body;
2965
- const getAttribute = prototype.getAttribute;
2966
- const hasAttribute = prototype.hasAttribute;
2967
- const getNodeType = ((prototype2, name) => {
2968
- let getter;
2969
- for (; prototype2 && !(getter = Object.getOwnPropertyDescriptor(prototype2, name)?.get); ) {
2970
- prototype2 = Object.getPrototypeOf(prototype2);
2495
+ const vnode_ensureElementInflated = (vnode) => {
2496
+ if (1 == (15 & vnode[0])) {
2497
+ const elementVNode = vnode;
2498
+ elementVNode[0] ^= 8;
2499
+ const element = elementVNode[6];
2500
+ const attributes = element.attributes;
2501
+ const props = vnode_getProps(elementVNode);
2502
+ for (let idx = 0; idx < attributes.length; idx++) {
2503
+ const attr = attributes[idx];
2504
+ const key = attr.name;
2505
+ if (":" === key || !key) {
2506
+ break;
2507
+ }
2508
+ if (key.startsWith("q:container")) {
2509
+ "html" === attr.value ? mapArray_set(props, dangerouslySetInnerHTML, element.innerHTML, 0) : "text" === attr.value && "value" in element && mapArray_set(props, "value", element.value, 0);
2510
+ } else if (!key.startsWith("on:")) {
2511
+ mapArray_set(props, key, attr.value, 0);
2512
+ }
2971
2513
  }
2972
- return getter || function() {
2973
- return this[name];
2974
- };
2975
- })(prototype, "nodeType");
2976
- const attachVnodeDataAndRefs = (element) => {
2977
- Array.from(element.querySelectorAll('script[type="qwik/vnode"]')).forEach((script) => {
2978
- script.setAttribute("type", "x-qwik/vnode");
2979
- const qContainerElement = script.closest("[q\\:container]");
2980
- qContainerElement.qVnodeData = script.textContent, qContainerElement.qVNodeRefs = /* @__PURE__ */ new Map();
2981
- }), element.querySelectorAll("[q\\:shadowroot]").forEach((parent) => {
2982
- const shadowRoot = parent.shadowRoot;
2983
- shadowRoot && attachVnodeDataAndRefs(shadowRoot);
2984
- });
2985
- };
2986
- let NodeType;
2987
- attachVnodeDataAndRefs(document2), function(NodeType2) {
2988
- NodeType2[NodeType2.CONTAINER_MASK = 1] = "CONTAINER_MASK", NodeType2[NodeType2.ELEMENT = 2] = "ELEMENT", NodeType2[NodeType2.ELEMENT_CONTAINER = 3] = "ELEMENT_CONTAINER", NodeType2[NodeType2.ELEMENT_SHADOW_ROOT = 6] = "ELEMENT_SHADOW_ROOT", NodeType2[NodeType2.COMMENT_SKIP_START = 5] = "COMMENT_SKIP_START", NodeType2[NodeType2.COMMENT_SKIP_END = 8] = "COMMENT_SKIP_END", NodeType2[NodeType2.COMMENT_IGNORE_START = 16] = "COMMENT_IGNORE_START", NodeType2[NodeType2.COMMENT_IGNORE_END = 32] = "COMMENT_IGNORE_END", NodeType2[NodeType2.COMMENT_ISLAND_START = 65] = "COMMENT_ISLAND_START", NodeType2[NodeType2.COMMENT_ISLAND_END = 128] = "COMMENT_ISLAND_END", NodeType2[NodeType2.OTHER = 0] = "OTHER";
2989
- }(NodeType || (NodeType = {}));
2990
- const getFastNodeType = (node) => {
2991
- const nodeType = getNodeType.call(node);
2992
- if (1 === nodeType) {
2993
- if (null === getAttribute.call(node, "q:container")) {
2994
- if (hasAttribute.call(node, "q:shadowroot")) {
2995
- return NodeType.ELEMENT_SHADOW_ROOT;
2514
+ }
2515
+ };
2516
+ function vnode_walkVNode(vNode) {
2517
+ let vCursor = vNode;
2518
+ if (vnode_isTextVNode(vNode)) {
2519
+ return;
2520
+ }
2521
+ let vParent = null;
2522
+ for (; ; ) {
2523
+ const vFirstChild = vnode_getFirstChild(vCursor);
2524
+ if (vFirstChild) {
2525
+ vCursor = vFirstChild;
2526
+ continue;
2527
+ }
2528
+ if (vCursor === vNode) {
2529
+ return;
2530
+ }
2531
+ const vNextSibling = vnode_getNextSibling(vCursor);
2532
+ if (vNextSibling) {
2533
+ vCursor = vNextSibling;
2534
+ } else {
2535
+ for (vParent = vnode_getParent(vCursor); vParent; ) {
2536
+ if (vParent === vNode) {
2537
+ return;
2538
+ }
2539
+ const vNextParentSibling = vnode_getNextSibling(vParent);
2540
+ if (vNextParentSibling) {
2541
+ vCursor = vNextParentSibling;
2542
+ break;
2996
2543
  }
2997
- return hasAttribute.call(node, ":") ? NodeType.ELEMENT : NodeType.OTHER;
2544
+ vParent = vnode_getParent(vParent);
2545
+ }
2546
+ if (null == vParent) {
2547
+ return;
2998
2548
  }
2999
- return NodeType.ELEMENT_CONTAINER;
3000
2549
  }
3001
- if (8 === nodeType) {
3002
- const nodeValue = node.nodeValue || "";
3003
- if (nodeValue.startsWith("q:container-island")) {
3004
- return NodeType.COMMENT_ISLAND_START;
2550
+ }
2551
+ }
2552
+ function vnode_getDOMChildNodes(journal, root, isVNode = false, childNodes = []) {
2553
+ if (vnode_isElementOrTextVNode(root)) {
2554
+ return vnode_isTextVNode(root) && vnode_ensureTextInflated(journal, root), childNodes.push(isVNode ? root : vnode_getNode(root)), childNodes;
2555
+ }
2556
+ let vNode = vnode_getFirstChild(root);
2557
+ for (; vNode; ) {
2558
+ vnode_isElementVNode(vNode) ? childNodes.push(isVNode ? vNode : vnode_getNode(vNode)) : vnode_isTextVNode(vNode) ? (vnode_ensureTextInflated(journal, vNode), childNodes.push(isVNode ? vNode : vnode_getNode(vNode))) : vnode_getDOMChildNodes(journal, vNode, !!isVNode, childNodes), vNode = vnode_getNextSibling(vNode);
2559
+ }
2560
+ return childNodes;
2561
+ }
2562
+ const vnode_getDomSibling = (vNode, nextDirection, descend) => {
2563
+ const childProp = nextDirection ? 4 : 5;
2564
+ const siblingProp = nextDirection ? 3 : 2;
2565
+ let cursor = vNode;
2566
+ for (; descend && cursor && vnode_isVirtualVNode(cursor); ) {
2567
+ const child = cursor[childProp];
2568
+ if (!child) {
2569
+ break;
2570
+ }
2571
+ if (5 & child[0]) {
2572
+ return child;
2573
+ }
2574
+ cursor = child;
2575
+ }
2576
+ for (; cursor; ) {
2577
+ let sibling = cursor[siblingProp];
2578
+ if (sibling && 5 & sibling[0]) {
2579
+ return sibling;
2580
+ }
2581
+ if (!sibling) {
2582
+ let virtual = cursor[1];
2583
+ if (virtual && !vnode_isVirtualVNode(virtual)) {
2584
+ return null;
3005
2585
  }
3006
- if (nodeValue.startsWith("q:ignore")) {
3007
- return NodeType.COMMENT_IGNORE_START;
2586
+ for (; virtual && !(sibling = virtual[siblingProp]); ) {
2587
+ if (virtual = virtual[1], virtual && !vnode_isVirtualVNode(virtual)) {
2588
+ return null;
2589
+ }
3008
2590
  }
3009
- if (nodeValue.startsWith("q:container")) {
3010
- return NodeType.COMMENT_SKIP_START;
2591
+ if (!sibling) {
2592
+ return null;
3011
2593
  }
3012
- if (nodeValue.startsWith("/q:container-island")) {
3013
- return NodeType.COMMENT_ISLAND_END;
2594
+ if (vnode_isTextVNode(sibling) && virtual && vnode_isElementVNode(virtual)) {
2595
+ return null;
3014
2596
  }
3015
- if (nodeValue.startsWith("/q:ignore")) {
3016
- return NodeType.COMMENT_IGNORE_END;
2597
+ }
2598
+ for (; sibling; ) {
2599
+ if (cursor = sibling, 5 & cursor[0] && vnode_getNode(cursor)) {
2600
+ return cursor;
3017
2601
  }
3018
- if (nodeValue.startsWith("/q:container")) {
3019
- return NodeType.COMMENT_SKIP_END;
2602
+ sibling = cursor[childProp];
2603
+ }
2604
+ }
2605
+ return null;
2606
+ };
2607
+ const vnode_ensureInflatedIfText = (journal, vNode) => {
2608
+ vnode_isTextVNode(vNode) && vnode_ensureTextInflated(journal, vNode);
2609
+ };
2610
+ const vnode_ensureTextInflated = (journal, vnode) => {
2611
+ const textVNode = ensureTextVNode(vnode);
2612
+ if (!(8 & textVNode[0])) {
2613
+ const parentNode = vnode_getDomParent(vnode);
2614
+ const sharedTextNode = textVNode[4];
2615
+ const doc = parentNode.ownerDocument;
2616
+ let cursor = vnode_getDomSibling(vnode, false, true);
2617
+ const insertBeforeNode = sharedTextNode || vnode_getDomSibling(vnode, true, true)?.[6] || null;
2618
+ let lastPreviousTextNode = insertBeforeNode;
2619
+ for (; cursor && vnode_isTextVNode(cursor); ) {
2620
+ if (!(8 & cursor[0])) {
2621
+ const textNode = doc.createTextNode(cursor[5]);
2622
+ journal.push(5, parentNode, lastPreviousTextNode, textNode), lastPreviousTextNode = textNode, cursor[4] = textNode, cursor[0] |= 8;
3020
2623
  }
2624
+ cursor = vnode_getDomSibling(cursor, false, true);
3021
2625
  }
3022
- return NodeType.OTHER;
3023
- };
3024
- const isSeparator = (ch) => VNodeDataSeparator.ADVANCE_1 <= ch && ch <= VNodeDataSeparator.ADVANCE_8192;
3025
- const findVDataSectionEnd = (vData, start, end) => {
3026
- let depth = 0;
3027
- for (; start < end; ) {
3028
- const ch = vData.charCodeAt(start);
3029
- if (0 === depth && isSeparator(ch)) {
3030
- break;
2626
+ for (cursor = vnode; cursor && vnode_isTextVNode(cursor); ) {
2627
+ const next = vnode_getDomSibling(cursor, true, true);
2628
+ const isLastNode = !next || !vnode_isTextVNode(next);
2629
+ if (!(8 & cursor[0])) {
2630
+ if (isLastNode && sharedTextNode) {
2631
+ journal.push(1, sharedTextNode, cursor[5]);
2632
+ } else {
2633
+ const textNode = doc.createTextNode(cursor[5]);
2634
+ journal.push(5, parentNode, insertBeforeNode, textNode), cursor[4] = textNode;
2635
+ }
2636
+ cursor[0] |= 8;
3031
2637
  }
3032
- ch === VNodeDataChar.OPEN ? depth++ : ch === VNodeDataChar.CLOSE && depth--, start++;
2638
+ cursor = next;
3033
2639
  }
3034
- return start;
3035
- };
3036
- const nextSibling = (node) => {
3037
- for (; node && (node = node.nextSibling) && getFastNodeType(node) === NodeType.OTHER; ) {
2640
+ }
2641
+ };
2642
+ const vnode_locate = (rootVNode, id) => {
2643
+ ensureElementVNode(rootVNode);
2644
+ let vNode = rootVNode;
2645
+ const containerElement = rootVNode[6];
2646
+ const { qVNodeRefs } = containerElement;
2647
+ let elementOffset = -1;
2648
+ let refElement;
2649
+ if ("string" == typeof id) {
2650
+ elementOffset = parseInt(id), refElement = qVNodeRefs.get(elementOffset);
2651
+ } else {
2652
+ refElement = id;
2653
+ const vNode2 = refElement.vNode?.deref();
2654
+ if (vNode2) {
2655
+ return vNode2;
3038
2656
  }
3039
- return node;
3040
- };
3041
- const firstChild = (node) => {
3042
- for (; node && (node = node.firstChild) && getFastNodeType(node) === NodeType.OTHER; ) {
2657
+ }
2658
+ if (vnode_isVNode(refElement)) {
2659
+ vNode = refElement;
2660
+ } else {
2661
+ assertTrue(containerElement.contains(refElement));
2662
+ let parent = refElement;
2663
+ const elementPath = [refElement];
2664
+ for (; parent && parent !== containerElement; ) {
2665
+ parent = parent.parentElement, elementPath.push(parent);
3043
2666
  }
3044
- return node;
3045
- };
3046
- const walkContainer = (walker2, containerNode, node, exitNode, vData, qVNodeRefs) => {
3047
- const vData_length = vData.length;
3048
- let elementIdx = 0;
3049
- let vNodeElementIndex = -1;
3050
- let vData_start = 0;
3051
- let vData_end = 0;
3052
- let ch = 0;
3053
- let needsToStoreRef = -1;
3054
- let nextNode = null;
3055
- const howManyElementsToSkip = () => {
3056
- let elementsToSkip = 0;
3057
- for (; isSeparator(ch = vData.charCodeAt(vData_start)) && (elementsToSkip += 1 << ch - VNodeDataSeparator.ADVANCE_1, vData_start++, !(vData_start >= vData_length)); ) {
3058
- }
3059
- return elementsToSkip;
3060
- };
3061
- do {
3062
- if (node === exitNode) {
3063
- return;
3064
- }
3065
- nextNode = null;
3066
- const nodeType = node == containerNode ? NodeType.ELEMENT : getFastNodeType(node);
3067
- if (nodeType === NodeType.ELEMENT_CONTAINER) {
3068
- const container = node;
3069
- let cursor = node;
3070
- for (; cursor && !(nextNode = nextSibling(cursor)); ) {
3071
- cursor = cursor.parentNode;
2667
+ for (let i = elementPath.length - 2; i >= 0; i--) {
2668
+ vNode = vnode_getVNodeForChildNode(vNode, elementPath[i]);
2669
+ }
2670
+ -1 != elementOffset && qVNodeRefs.set(elementOffset, vNode);
2671
+ }
2672
+ if ("string" == typeof id) {
2673
+ const idLength = id.length;
2674
+ let idx = indexOfAlphanumeric(id, idLength);
2675
+ let childIdx = 0;
2676
+ for (; idx < idLength; ) {
2677
+ const ch = id.charCodeAt(idx);
2678
+ childIdx *= 26, ch >= 97 ? childIdx += ch - 97 : (childIdx += ch - 65, vNode = vnode_getChildWithIdx(vNode, childIdx), childIdx = 0), idx++;
2679
+ }
2680
+ }
2681
+ return vNode;
2682
+ };
2683
+ const vnode_getChildWithIdx = (vNode, childIdx) => {
2684
+ let child = vnode_getFirstChild(vNode);
2685
+ for (assertDefined(); child[0] >>> 8 !== childIdx; ) {
2686
+ child = vnode_getNextSibling(child);
2687
+ }
2688
+ return child;
2689
+ };
2690
+ const vNodeStack = [];
2691
+ const vnode_getVNodeForChildNode = (vNode, childElement) => {
2692
+ ensureElementVNode(vNode);
2693
+ let child = vnode_getFirstChild(vNode);
2694
+ for (assertDefined(); child && child[6] !== childElement; ) {
2695
+ if (vnode_isVirtualVNode(child)) {
2696
+ const next = vnode_getNextSibling(child);
2697
+ const firstChild = vnode_getFirstChild(child);
2698
+ firstChild ? (next && vNodeStack.push(next), child = firstChild) : child = next || (vNodeStack.length ? vNodeStack.pop() : null);
2699
+ } else {
2700
+ const next = vnode_getNextSibling(child);
2701
+ child = next || (next || vNodeStack.pop());
2702
+ }
2703
+ }
2704
+ for (; vNodeStack.length; ) {
2705
+ vNodeStack.pop();
2706
+ }
2707
+ return ensureElementVNode(child), assertEqual(child[6]), child;
2708
+ };
2709
+ const indexOfAlphanumeric = (id, length) => {
2710
+ let idx = 0;
2711
+ for (; idx < length; ) {
2712
+ if (!(id.charCodeAt(idx) <= 57)) {
2713
+ return idx;
2714
+ }
2715
+ idx++;
2716
+ }
2717
+ return length;
2718
+ };
2719
+ const parseBoolean = (value) => "false" !== value && Boolean(value);
2720
+ const isBooleanAttr = (element, key) => ("allowfullscreen" == key || "async" == key || "autofocus" == key || "autoplay" == key || "checked" == key || "controls" == key || "default" == key || "defer" == key || "disabled" == key || "formnovalidate" == key || "inert" == key || "ismap" == key || "itemscope" == key || "loop" == key || "multiple" == key || "muted" == key || "nomodule" == key || "novalidate" == key || "open" == key || "playsinline" == key || "readonly" == key || "required" == key || "reversed" == key || "selected" == key) && key in element;
2721
+ const vnode_applyJournal = (journal) => {
2722
+ let idx = 0;
2723
+ const length = journal.length;
2724
+ for (; idx < length; ) {
2725
+ switch (journal[idx++]) {
2726
+ case 1:
2727
+ journal[idx++].nodeValue = journal[idx++];
2728
+ break;
2729
+ case 2:
2730
+ const element = journal[idx++];
2731
+ let key = journal[idx++];
2732
+ "className" === key && (key = "class");
2733
+ const value = journal[idx++];
2734
+ isBooleanAttr(element, key) ? element[key] = parseBoolean(value) : "value" === key && key in element ? element.value = String(value) : key === dangerouslySetInnerHTML ? (element.innerHTML = value, element.setAttribute("q:container", "html")) : null == value || false === value ? element.removeAttribute(key) : element.setAttribute(key, String(value));
2735
+ break;
2736
+ case 3:
2737
+ const document2 = journal[idx++];
2738
+ const head = document2.head;
2739
+ const styles = document2.querySelectorAll(QStylesAllSelector);
2740
+ for (let i = 0; i < styles.length; i++) {
2741
+ head.appendChild(styles[i]);
3072
2742
  }
3073
- walkContainer(walker2, container, node, nextNode, container.qVnodeData || "", container.qVNodeRefs);
3074
- } else if (nodeType === NodeType.COMMENT_IGNORE_START) {
3075
- let islandNode = node;
3076
- do {
3077
- if (islandNode = walker2.nextNode(), !islandNode) {
3078
- throw new Error(`Island inside <!--${node?.nodeValue}--> not found!`);
3079
- }
3080
- } while (getFastNodeType(islandNode) !== NodeType.COMMENT_ISLAND_START);
3081
- nextNode = null;
3082
- } else if (nodeType === NodeType.COMMENT_ISLAND_END) {
3083
- nextNode = node;
3084
- do {
3085
- if (nextNode = walker2.nextNode(), !nextNode) {
3086
- throw new Error("Ignore block not closed!");
3087
- }
3088
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_IGNORE_END);
3089
- nextNode = null;
3090
- } else if (nodeType === NodeType.COMMENT_SKIP_START) {
3091
- nextNode = node;
3092
- do {
3093
- if (nextNode = nextSibling(nextNode), !nextNode) {
3094
- throw new Error(`<!--${node?.nodeValue}--> not closed!`);
3095
- }
3096
- } while (getFastNodeType(nextNode) !== NodeType.COMMENT_SKIP_END);
3097
- walkContainer(walker2, node, node, nextNode, "", null);
3098
- } else if (nodeType === NodeType.ELEMENT_SHADOW_ROOT) {
3099
- nextNode = nextSibling(node);
3100
- const shadowRootContainer = node;
3101
- const shadowRoot = shadowRootContainer?.shadowRoot;
3102
- shadowRoot && walkContainer(document2.createTreeWalker(shadowRoot, 129), null, firstChild(shadowRoot), null, "", null);
3103
- }
3104
- if ((nodeType & NodeType.ELEMENT) === NodeType.ELEMENT) {
3105
- if (vNodeElementIndex < elementIdx) {
3106
- if (-1 === vNodeElementIndex && (vNodeElementIndex = 0), vData_start = vData_end, vData_start < vData_length) {
3107
- vNodeElementIndex += howManyElementsToSkip();
3108
- ch === VNodeDataSeparator.REFERENCE && (needsToStoreRef = vNodeElementIndex, vData_start++, ch = vData_start < vData_length ? vData.charCodeAt(vData_end) : VNodeDataSeparator.ADVANCE_1), vData_end = findVDataSectionEnd(vData, vData_start, vData_length);
3109
- } else {
3110
- vNodeElementIndex = Number.MAX_SAFE_INTEGER;
3111
- }
2743
+ break;
2744
+ case 4:
2745
+ const removeParent = journal[idx++];
2746
+ let nodeToRemove;
2747
+ for (; idx < length && "number" != typeof (nodeToRemove = journal[idx]); ) {
2748
+ removeParent.removeChild(nodeToRemove), idx++;
3112
2749
  }
3113
- if (elementIdx === vNodeElementIndex) {
3114
- needsToStoreRef === elementIdx && qVNodeRefs.set(elementIdx, node);
3115
- const instructions = vData.substring(vData_start, vData_end);
3116
- vNodeDataMap.set(node, instructions);
2750
+ break;
2751
+ case 5:
2752
+ const insertParent = journal[idx++];
2753
+ const insertBefore = journal[idx++];
2754
+ let newChild;
2755
+ for (; idx < length && "number" != typeof (newChild = journal[idx]); ) {
2756
+ insertParent.insertBefore(newChild, insertBefore), idx++;
3117
2757
  }
3118
- elementIdx++;
2758
+ }
2759
+ }
2760
+ journal.length = 0;
2761
+ };
2762
+ const vnode_insertBefore = (journal, parent, newChild, insertBefore) => {
2763
+ ensureElementOrVirtualVNode(parent), vnode_isElementVNode(parent) && ensureMaterialized(parent);
2764
+ const newChildCurrentParent = newChild[1];
2765
+ if (newChild === insertBefore) {
2766
+ if (newChildCurrentParent) {
2767
+ return;
2768
+ }
2769
+ insertBefore = null;
2770
+ }
2771
+ newChildCurrentParent && (newChild[2] || newChild[3] || newChildCurrentParent !== parent) && vnode_remove(journal, newChildCurrentParent, newChild, false);
2772
+ let adjustedInsertBefore = null;
2773
+ null == insertBefore ? vnode_isVirtualVNode(parent) && (adjustedInsertBefore = vnode_getDomSibling(parent, true, false)) : adjustedInsertBefore = vnode_isVirtualVNode(insertBefore) ? vnode_getDomSibling(insertBefore, true, true) : insertBefore, adjustedInsertBefore && vnode_ensureInflatedIfText(journal, adjustedInsertBefore);
2774
+ const domParentVNode = vnode_getDomParentVNode(parent);
2775
+ const parentNode = domParentVNode && domParentVNode[6];
2776
+ if (parentNode) {
2777
+ const domChildren = vnode_getDomChildrenWithCorrectNamespacesToInsert(journal, domParentVNode, newChild);
2778
+ domChildren.length && journal.push(5, parentNode, vnode_getNode(adjustedInsertBefore), ...domChildren);
2779
+ }
2780
+ const vNext = insertBefore;
2781
+ const vPrevious = vNext ? vNext[2] : parent[5];
2782
+ vNext ? vNext[2] = newChild : parent[5] = newChild, vPrevious ? vPrevious[3] = newChild : parent[4] = newChild, newChild[2] = vPrevious, newChild[3] = vNext, newChild[1] = parent;
2783
+ };
2784
+ const vnode_getDomParent = (vnode) => (vnode = vnode_getDomParentVNode(vnode)) && vnode[6];
2785
+ const vnode_getDomParentVNode = (vnode) => {
2786
+ for (; vnode && !vnode_isElementVNode(vnode); ) {
2787
+ vnode = vnode[1];
2788
+ }
2789
+ return vnode;
2790
+ };
2791
+ const vnode_remove = (journal, vParent, vToRemove, removeDOM) => {
2792
+ if (assertEqual(vParent, vnode_getParent(vToRemove)), vnode_isTextVNode(vToRemove) && vnode_ensureTextInflated(journal, vToRemove), removeDOM) {
2793
+ const domParent = vnode_getDomParent(vParent);
2794
+ if (vnode_getAttr(vParent, dangerouslySetInnerHTML)) {
2795
+ return;
2796
+ }
2797
+ const children = vnode_getDOMChildNodes(journal, vToRemove);
2798
+ domParent && children.length && journal.push(4, domParent, ...children);
2799
+ }
2800
+ const vPrevious = vToRemove[2];
2801
+ const vNext = vToRemove[3];
2802
+ vPrevious ? vPrevious[3] = vNext : vParent[4] = vNext, vNext ? vNext[2] = vPrevious : vParent[5] = vPrevious, vToRemove[2] = null, vToRemove[3] = null;
2803
+ };
2804
+ const vnode_truncate = (journal, vParent, vDelete) => {
2805
+ const parent = vnode_getDomParent(vParent);
2806
+ const children = vnode_getDOMChildNodes(journal, vDelete);
2807
+ parent && children.length && journal.push(4, parent, ...children);
2808
+ const vPrevious = vDelete[2];
2809
+ vPrevious ? vPrevious[3] = null : vParent[4] = null, vParent[5] = vPrevious;
2810
+ };
2811
+ const vnode_getElementName = (vnode) => {
2812
+ const elementVNode = ensureElementVNode(vnode);
2813
+ let elementName = elementVNode[7];
2814
+ if (void 0 === elementName) {
2815
+ const element = elementVNode[6];
2816
+ const nodeName = fastNodeName(element).toLowerCase();
2817
+ elementName = elementVNode[7] = nodeName, elementVNode[0] |= vnode_getElementNamespaceFlags(element);
2818
+ }
2819
+ return elementName;
2820
+ };
2821
+ const vnode_getText = (vnode) => {
2822
+ const textVNode = ensureTextVNode(vnode);
2823
+ let text = textVNode[5];
2824
+ return void 0 === text && (text = textVNode[5] = textVNode[4].nodeValue), text;
2825
+ };
2826
+ const vnode_setText = (journal, textVNode, text) => {
2827
+ vnode_ensureTextInflated(journal, textVNode);
2828
+ journal.push(1, textVNode[4], textVNode[5] = text);
2829
+ };
2830
+ const vnode_getFirstChild = (vnode) => {
2831
+ if (vnode_isTextVNode(vnode)) {
2832
+ return null;
2833
+ }
2834
+ let vFirstChild = vnode[4];
2835
+ return void 0 === vFirstChild && (vFirstChild = ensureMaterialized(vnode)), vFirstChild;
2836
+ };
2837
+ const vnode_materialize = (vNode) => {
2838
+ const element = vNode[6];
2839
+ const firstChild = fastFirstChild(element);
2840
+ const vNodeData = element.ownerDocument?.qVNodeData?.get(element);
2841
+ return materialize(vNode, element, firstChild, vNodeData);
2842
+ };
2843
+ const materialize = (vNode, element, firstChild, vNodeData) => {
2844
+ if (vNodeData) {
2845
+ if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
2846
+ const elementVNodeDataStartIdx = 1;
2847
+ let elementVNodeDataEndIdx = 1;
2848
+ for (; vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR; ) {
2849
+ elementVNodeDataEndIdx++;
3119
2850
  }
3120
- } while (node = nextNode || walker2.nextNode());
3121
- };
3122
- const walker = document2.createTreeWalker(document2, 129);
3123
- walkContainer(walker, null, walker.firstChild(), null, "", null);
3124
- }
3125
- function getDomContainer(element) {
3126
- const qContainerElement = _getQContainerElement(element);
3127
- if (!qContainerElement) {
3128
- throw qError(QError.containerNotFound);
2851
+ const elementVNodeData = vNodeData.substring(elementVNodeDataStartIdx, elementVNodeDataEndIdx);
2852
+ vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
2853
+ const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
2854
+ if (!vNodeData) {
2855
+ return vFirstChild;
2856
+ }
2857
+ }
2858
+ return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
3129
2859
  }
3130
- return getDomContainerFromQContainerElement(qContainerElement);
3131
- }
3132
- function getDomContainerFromQContainerElement(qContainerElement) {
3133
- const qElement = qContainerElement;
3134
- let container = qElement.qContainer;
3135
- if (!container) {
3136
- container = new DomContainer(qElement);
3137
- const containerAttributes = {};
3138
- if (qElement) {
3139
- const attrs = qElement.attributes;
3140
- if (attrs) {
3141
- for (let index = 0; index < attrs.length; index++) {
3142
- const attr = attrs[index];
3143
- ":" !== attr.name && (containerAttributes[attr.name] = attr.value);
2860
+ return materializeFromDOM(vNode, firstChild);
2861
+ };
2862
+ const ensureMaterialized = (vnode) => {
2863
+ const vParent = ensureElementVNode(vnode);
2864
+ let vFirstChild = vParent[4];
2865
+ if (void 0 === vFirstChild) {
2866
+ vFirstChild = vParent[1] && shouldIgnoreChildren(vParent[6]) ? vParent[4] = vParent[5] = null : vnode_materialize(vParent);
2867
+ }
2868
+ return assertTrue(void 0 !== vParent[4]), assertTrue(void 0 !== vParent[5]), vFirstChild;
2869
+ };
2870
+ let _fastHasAttribute = null;
2871
+ const shouldIgnoreChildren = (node) => (_fastHasAttribute || (_fastHasAttribute = node.hasAttribute), _fastHasAttribute.call(node, "q:container"));
2872
+ let _fastNodeType = null;
2873
+ const fastNodeType = (node) => (_fastNodeType || (_fastNodeType = fastGetter(node, "nodeType")), _fastNodeType.call(node));
2874
+ const fastIsTextOrElement = (node) => {
2875
+ const type = fastNodeType(node);
2876
+ return 3 === type || 1 === type;
2877
+ };
2878
+ let _fastNextSibling = null;
2879
+ const fastNextSibling = (node) => {
2880
+ for (_fastNextSibling || (_fastNextSibling = fastGetter(node, "nextSibling")), _fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")); node; ) {
2881
+ if (null !== (node = _fastNextSibling.call(node))) {
2882
+ const type = fastNodeType(node);
2883
+ if (3 === type || 1 === type) {
2884
+ break;
2885
+ }
2886
+ if (8 === type) {
2887
+ const nodeValue = node.nodeValue;
2888
+ if (nodeValue?.startsWith(QIgnore)) {
2889
+ return getNodeAfterCommentNode(node, QContainerIsland, _fastNextSibling, _fastFirstChild);
2890
+ }
2891
+ if (node.nodeValue?.startsWith(QContainerIslandEnd)) {
2892
+ return getNodeAfterCommentNode(node, QIgnoreEnd, _fastNextSibling, _fastFirstChild);
2893
+ }
2894
+ if (nodeValue?.startsWith("q:container")) {
2895
+ for (; node && (node = _fastNextSibling.call(node)) && (8 !== fastNodeType(node) || !node.nodeValue?.startsWith("/q:container")); ) {
2896
+ }
3144
2897
  }
3145
2898
  }
3146
2899
  }
3147
- container.$serverData$ = {
3148
- containerAttributes
3149
- }, qElement.setAttribute("q:container", QContainerValue.RESUMED), qElement.qContainer = container;
3150
2900
  }
3151
- return container;
3152
- }
3153
- function _getQContainerElement(element) {
3154
- return (Array.isArray(element) ? vnode_getDomParent(element) : element).closest(QContainerSelector);
3155
- }
3156
- const isDomContainer = (container) => container instanceof DomContainer;
3157
- class DomContainer extends _SharedContainer {
3158
- constructor(element) {
3159
- super(() => this.scheduleRender(), () => vnode_applyJournal(this.$journal$), {}, element.getAttribute("q:locale"));
3160
- __publicField(this, "element");
3161
- __publicField(this, "qContainer");
3162
- __publicField(this, "qBase");
3163
- __publicField(this, "qManifestHash");
3164
- __publicField(this, "rootVNode");
3165
- __publicField(this, "document");
3166
- __publicField(this, "$journal$");
3167
- __publicField(this, "renderDone", null);
3168
- __publicField(this, "$rawStateData$");
3169
- __publicField(this, "$storeProxyMap$", /* @__PURE__ */ new WeakMap());
3170
- __publicField(this, "$qFuncs$");
3171
- __publicField(this, "$instanceHash$");
3172
- __publicField(this, "vNodeLocate", (id) => vnode_locate(this.rootVNode, id));
3173
- __publicField(this, "$stateData$");
3174
- __publicField(this, "$styleIds$", null);
3175
- __publicField(this, "$renderCount$", 0);
3176
- __publicField(this, "$getObjectById$", (id) => ("string" == typeof id && (id = parseFloat(id)), assertTrue(id < this.$rawStateData$.length / 2, `Invalid reference: ${id} >= ${this.$rawStateData$.length / 2}`), this.$stateData$[id]));
3177
- if (this.qContainer = element.getAttribute("q:container"), !this.qContainer) {
3178
- throw qError(QError.elementWithoutContainer);
3179
- }
3180
- this.$journal$ = [VNodeJournalOpCode.HoistStyles, element.ownerDocument], this.document = element.ownerDocument, this.element = element, this.qBase = element.getAttribute("q:base"), this.$instanceHash$ = element.getAttribute("q:instance"), this.qManifestHash = element.getAttribute("q:manifest-hash"), this.rootVNode = vnode_newUnMaterializedElement(this.element), this.$rawStateData$ = null, this.$stateData$ = null;
3181
- const document2 = this.element.ownerDocument;
3182
- document2.qVNodeData || processVNodeData(document2), this.$rawStateData$ = [], this.$stateData$ = [];
3183
- const qwikStates = element.querySelectorAll('script[type="qwik/state"]');
3184
- if (0 !== qwikStates.length) {
3185
- this.$rawStateData$ = JSON.parse(qwikStates[qwikStates.length - 1].textContent), this.$stateData$ = wrapDeserializerProxy(this, this.$rawStateData$);
2901
+ return node;
2902
+ };
2903
+ function getNodeAfterCommentNode(node, commentValue, nextSibling, firstChild) {
2904
+ for (; node; ) {
2905
+ if (node.nodeValue?.startsWith(commentValue)) {
2906
+ return node = nextSibling.call(node) || null;
3186
2907
  }
3187
- this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
2908
+ let nextNode = firstChild.call(node);
2909
+ nextNode || (nextNode = nextSibling.call(node)), nextNode || (nextNode = fastParentNode(node), nextNode && (nextNode = nextSibling.call(nextNode))), node = nextNode;
3188
2910
  }
3189
- $setRawState$(id, vParent) {
3190
- this.$stateData$[id] = vParent;
2911
+ return null;
2912
+ }
2913
+ let _fastParentNode = null;
2914
+ const fastParentNode = (node) => (_fastParentNode || (_fastParentNode = fastGetter(node, "parentNode")), _fastParentNode.call(node));
2915
+ let _fastFirstChild = null;
2916
+ const fastFirstChild = (node) => {
2917
+ for (_fastFirstChild || (_fastFirstChild = fastGetter(node, "firstChild")), node = node && _fastFirstChild.call(node); node && !fastIsTextOrElement(node); ) {
2918
+ node = fastNextSibling(node);
3191
2919
  }
3192
- parseQRL(qrl2) {
3193
- return inflateQRL(this, parseQRL(qrl2));
2920
+ return node;
2921
+ };
2922
+ let _fastNamespaceURI = null;
2923
+ const fastNamespaceURI = (element) => (_fastNamespaceURI || (_fastNamespaceURI = fastGetter(element, "namespaceURI")), _fastNamespaceURI.call(element));
2924
+ let _fastNodeName = null;
2925
+ const fastNodeName = (element) => (_fastNodeName || (_fastNodeName = fastGetter(element, "nodeName")), _fastNodeName.call(element));
2926
+ const fastGetter = (prototype, name) => {
2927
+ let getter;
2928
+ for (; prototype && !(getter = Object.getOwnPropertyDescriptor(prototype, name)?.get); ) {
2929
+ prototype = Object.getPrototypeOf(prototype);
3194
2930
  }
3195
- handleError(err, host) {
3196
- const errorStore = host && this.resolveContext(host, ERROR_CONTEXT);
3197
- if (!errorStore) {
3198
- throw err;
2931
+ return getter || function() {
2932
+ return this[name];
2933
+ };
2934
+ };
2935
+ const isQStyleElement = (node) => isElement(node) && "STYLE" === node.nodeName && (node.hasAttribute("q:sstyle") || node.hasAttribute(QStyle));
2936
+ const materializeFromDOM = (vParent, firstChild, vData) => {
2937
+ let vFirstChild = null;
2938
+ const skipStyleElements = () => {
2939
+ for (; isQStyleElement(child); ) {
2940
+ child = fastNextSibling(child);
3199
2941
  }
3200
- errorStore.error = err;
3201
- }
3202
- setContext(host, context, value) {
3203
- let ctx = this.getHostProp(host, "q:ctx");
3204
- ctx || this.setHostProp(host, "q:ctx", ctx = []), mapArray_set(ctx, context.id, value, 0);
2942
+ };
2943
+ let child = firstChild;
2944
+ skipStyleElements();
2945
+ let vChild = null;
2946
+ for (; child; ) {
2947
+ const nodeType = fastNodeType(child);
2948
+ let vNextChild = null;
2949
+ 3 === nodeType ? vNextChild = vnode_newText(child, child.textContent ?? void 0) : 1 === nodeType && (vNextChild = vnode_newUnMaterializedElement(child)), vNextChild && (vNextChild[1] = vParent, vChild && (vChild[3] = vNextChild), vNextChild[2] = vChild, vChild = vNextChild), vFirstChild || (vParent[4] = vFirstChild = vChild), child = fastNextSibling(child), skipStyleElements();
3205
2950
  }
3206
- resolveContext(host, contextId) {
3207
- for (; host; ) {
3208
- const ctx = this.getHostProp(host, "q:ctx");
3209
- if (ctx) {
3210
- const value = mapArray_get(ctx, contextId.id, 0);
3211
- if (value) {
3212
- return value;
3213
- }
2951
+ if (vParent[5] = vChild || null, vParent[4] = vFirstChild, vData) {
2952
+ let container = null;
2953
+ processVNodeData(vData, (peek, consumeValue) => {
2954
+ if (peek() === VNodeDataChar.ID) {
2955
+ container || (container = getDomContainer(vParent[6]));
2956
+ const id = consumeValue();
2957
+ container.$setRawState$(parseInt(id), vParent);
2958
+ } else {
2959
+ peek() === VNodeDataChar.BACK_REFS ? (container || (container = getDomContainer(vParent[6])), setEffectBackRefFromVNodeData(vParent, consumeValue(), container)) : consumeValue();
3214
2960
  }
3215
- host = this.getParentHost(host);
2961
+ });
2962
+ }
2963
+ return vFirstChild;
2964
+ };
2965
+ function setEffectBackRefFromVNodeData(vParent, value, container) {
2966
+ const deserializedSubMap = container.$getObjectById$(value);
2967
+ if (vParent[_EFFECT_BACK_REF]) {
2968
+ mergeMaps(vParent[_EFFECT_BACK_REF], deserializedSubMap);
2969
+ } else {
2970
+ Object.defineProperty(vParent, _EFFECT_BACK_REF, {
2971
+ value: deserializedSubMap
2972
+ });
2973
+ }
2974
+ }
2975
+ const processVNodeData = (vData, callback) => {
2976
+ let nextToConsumeIdx = 0;
2977
+ let ch = 0;
2978
+ let peekCh = 0;
2979
+ const peek = () => 0 !== peekCh ? peekCh : peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
2980
+ const consume = () => (ch = peek(), peekCh = 0, nextToConsumeIdx++, ch);
2981
+ const consumeValue = () => {
2982
+ consume();
2983
+ const start = nextToConsumeIdx;
2984
+ for (; peek() <= 58 && 0 !== peekCh || 95 === peekCh || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122; ) {
2985
+ consume();
3216
2986
  }
2987
+ return vData.substring(start, nextToConsumeIdx);
2988
+ };
2989
+ for (; 0 !== peek(); ) {
2990
+ callback(peek, consumeValue, consume, nextToConsumeIdx);
3217
2991
  }
3218
- getParentHost(host) {
3219
- let vNode = vnode_getParent(host);
3220
- for (; vNode; ) {
3221
- if (vnode_isVirtualVNode(vNode)) {
3222
- if (null !== vnode_getProp(vNode, "q:renderFn", null)) {
3223
- return vNode;
3224
- }
3225
- vNode = vnode_getParent(vNode) || vnode_getProp(vNode, "q:sparent", this.vNodeLocate);
3226
- } else {
3227
- vNode = vnode_getParent(vNode);
2992
+ };
2993
+ const vnode_getNextSibling = (vnode) => vnode[3];
2994
+ const vnode_getPreviousSibling = (vnode) => vnode[2];
2995
+ const vnode_setAttr = (journal, vnode, key, value) => {
2996
+ const type = vnode[0];
2997
+ if (3 & type) {
2998
+ vnode_ensureElementInflated(vnode);
2999
+ const props = vnode_getProps(vnode);
3000
+ const idx = mapApp_findIndx(props, key, 0);
3001
+ if (idx >= 0) {
3002
+ if (props[idx + 1] != value && 1 & type) {
3003
+ journal && journal.push(2, vnode[6], key, value);
3228
3004
  }
3005
+ null == value ? props.splice(idx, 2) : props[idx + 1] = value;
3006
+ } else if (null != value && (props.splice(~idx, 0, key, value), 1 & type)) {
3007
+ journal && journal.push(2, vnode[6], key, value);
3229
3008
  }
3230
- return null;
3231
3009
  }
3232
- setHostProp(host, name, value) {
3233
- vnode_setProp(host, name, value);
3010
+ };
3011
+ const vnode_getAttr = (vnode, key) => {
3012
+ if (3 & vnode[0]) {
3013
+ vnode_ensureElementInflated(vnode);
3014
+ const props = vnode_getProps(vnode);
3015
+ return mapArray_get(props, key, 0);
3234
3016
  }
3235
- getHostProp(host, name) {
3236
- const vNode = host;
3237
- let getObjectById2 = null;
3238
- switch (name) {
3239
- case "q:seq":
3240
- case "q:props":
3241
- case "q:renderFn":
3242
- case "q:ctx":
3243
- case "q:brefs":
3244
- getObjectById2 = this.$getObjectById$;
3245
- break;
3246
- case "q:seqIdx":
3247
- case ":onIdx":
3248
- getObjectById2 = parseInt;
3017
+ return null;
3018
+ };
3019
+ const vnode_getProp = (vnode, key, getObject) => {
3020
+ const type = vnode[0];
3021
+ if (3 & type) {
3022
+ 1 & type && vnode_ensureElementInflated(vnode);
3023
+ const props = vnode_getProps(vnode);
3024
+ const idx = mapApp_findIndx(props, key, 0);
3025
+ if (idx >= 0) {
3026
+ let value = props[idx + 1];
3027
+ return "string" == typeof value && getObject && (props[idx + 1] = value = getObject(value)), value;
3249
3028
  }
3250
- return vnode_getProp(vNode, name, getObjectById2);
3251
3029
  }
3252
- scheduleRender() {
3253
- return this.$renderCount$++, this.renderDone || (this.renderDone = getPlatform().nextTick(() => this.processChores())), this.renderDone.finally(() => emitEvent("qrender", {
3254
- instanceHash: this.$instanceHash$,
3255
- renderCount: this.$renderCount$
3256
- }));
3030
+ return null;
3031
+ };
3032
+ const vnode_setProp = (vnode, key, value) => {
3033
+ ensureElementOrVirtualVNode(vnode);
3034
+ const props = vnode_getProps(vnode);
3035
+ const idx = mapApp_findIndx(props, key, 0);
3036
+ idx >= 0 ? props[idx + 1] = value : null != value && props.splice(~idx, 0, key, value);
3037
+ };
3038
+ const vnode_getPropStartIndex = (vnode) => {
3039
+ const type = 7 & vnode[0];
3040
+ if (1 === type) {
3041
+ return 8;
3257
3042
  }
3258
- processChores() {
3259
- let renderCount = this.$renderCount$;
3260
- const result = this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3261
- if (isPromise(result)) {
3262
- return result.then(async () => {
3263
- for (; renderCount !== this.$renderCount$; ) {
3264
- renderCount = this.$renderCount$, await this.$scheduler$(ChoreType.WAIT_FOR_ALL);
3265
- }
3266
- this.renderDone = null;
3267
- });
3268
- }
3269
- renderCount === this.$renderCount$ ? this.renderDone = null : this.processChores();
3043
+ if (2 === type) {
3044
+ return 6;
3270
3045
  }
3271
- ensureProjectionResolved(vNode) {
3272
- if (!(vNode[VNodeProps.flags] & VNodeFlags.Resolved)) {
3273
- vNode[VNodeProps.flags] |= VNodeFlags.Resolved;
3274
- const props = vnode_getProps(vNode);
3275
- for (let i = 0; i < props.length; i += 2) {
3276
- if (isSlotProp(props[i])) {
3277
- const value = props[i + 1];
3278
- "string" == typeof value && (props[i + 1] = this.vNodeLocate(value));
3046
+ throw qError(43, [type]);
3047
+ };
3048
+ const vnode_getProps = (vnode) => vnode[vnode_getPropStartIndex(vnode)];
3049
+ const vnode_getParent = (vnode) => vnode[1] || null;
3050
+ const vnode_getNode = (vnode) => null === vnode || vnode_isVirtualVNode(vnode) ? null : vnode_isElementVNode(vnode) ? vnode[6] : (assertTrue(vnode_isTextVNode(vnode)), vnode[4]);
3051
+ const isNumber = (ch) => 48 <= ch && ch <= 57;
3052
+ const isLowercase = (ch) => 97 <= ch && ch <= 122;
3053
+ const stack = [];
3054
+ function materializeFromVNodeData(vParent, vData, element, child) {
3055
+ let idx = 0;
3056
+ let vFirst = null;
3057
+ let vLast = null;
3058
+ let previousTextNode = null;
3059
+ const addVNode = (node) => {
3060
+ node[0] = 255 & node[0] | idx << 8, idx++, vLast && (vLast[3] = node), node[2] = vLast, node[1] = vParent, vFirst || (vParent[4] = vFirst = node), vLast = node;
3061
+ };
3062
+ let textIdx = 0;
3063
+ let combinedText = null;
3064
+ let container = null;
3065
+ return processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
3066
+ if (isNumber(peek())) {
3067
+ for (; !isElement(child); ) {
3068
+ if (!(child = fastNextSibling(child))) {
3069
+ throw qError(44, [vData, peek(), nextToConsumeIdx]);
3279
3070
  }
3280
3071
  }
3072
+ for (; isQStyleElement(child); ) {
3073
+ child = fastNextSibling(child);
3074
+ }
3075
+ combinedText = null, previousTextNode = null;
3076
+ let value = 0;
3077
+ for (; isNumber(peek()); ) {
3078
+ value *= 10, value += consume() - 48;
3079
+ }
3080
+ for (; value--; ) {
3081
+ addVNode(vnode_newUnMaterializedElement(child)), child = fastNextSibling(child);
3082
+ }
3083
+ } else if (peek() === VNodeDataChar.SCOPED_STYLE) {
3084
+ vnode_setAttr(null, vParent, "q:sstyle", consumeValue());
3085
+ } else if (peek() === VNodeDataChar.RENDER_FN) {
3086
+ vnode_setAttr(null, vParent, "q:renderFn", consumeValue());
3087
+ } else if (peek() === VNodeDataChar.ID) {
3088
+ container || (container = getDomContainer(element));
3089
+ const id = consumeValue();
3090
+ container.$setRawState$(parseInt(id), vParent);
3091
+ } else if (peek() === VNodeDataChar.PROPS) {
3092
+ vnode_setAttr(null, vParent, "q:props", consumeValue());
3093
+ } else if (peek() === VNodeDataChar.KEY) {
3094
+ vnode_setAttr(null, vParent, "q:key", consumeValue());
3095
+ } else if (peek() === VNodeDataChar.SEQ) {
3096
+ vnode_setAttr(null, vParent, "q:seq", consumeValue());
3097
+ } else if (peek() === VNodeDataChar.SEQ_IDX) {
3098
+ vnode_setAttr(null, vParent, "q:seqIdx", consumeValue());
3099
+ } else if (peek() === VNodeDataChar.BACK_REFS) {
3100
+ container || (container = getDomContainer(element)), setEffectBackRefFromVNodeData(vParent, consumeValue(), container);
3101
+ } else if (peek() === VNodeDataChar.SLOT_PARENT) {
3102
+ vnode_setProp(vParent, "q:sparent", consumeValue());
3103
+ } else if (peek() === VNodeDataChar.CONTEXT) {
3104
+ vnode_setAttr(null, vParent, "q:ctx", consumeValue());
3105
+ } else if (peek() === VNodeDataChar.OPEN) {
3106
+ consume(), addVNode(vnode_newVirtual()), stack.push(vParent, vFirst, vLast, previousTextNode, idx), idx = 0, vParent = vLast, vFirst = vLast = null;
3107
+ } else if (peek() === VNodeDataChar.SEPARATOR) {
3108
+ const key = consumeValue();
3109
+ const value = consumeValue();
3110
+ vnode_setAttr(null, vParent, key, value);
3111
+ } else if (peek() === VNodeDataChar.CLOSE) {
3112
+ consume(), vParent[5] = vLast, idx = stack.pop(), previousTextNode = stack.pop(), vLast = stack.pop(), vFirst = stack.pop(), vParent = stack.pop();
3113
+ } else if (peek() === VNodeDataChar.SLOT) {
3114
+ vnode_setAttr(null, vParent, QSlot, consumeValue());
3115
+ } else {
3116
+ const textNode = child && 3 === fastNodeType(child) ? child : null;
3117
+ null === combinedText && (combinedText = textNode ? textNode.nodeValue : null, textIdx = 0);
3118
+ let length = 0;
3119
+ for (; isLowercase(peek()); ) {
3120
+ length += consume() - 97, length *= 26;
3121
+ }
3122
+ length += consume() - 65;
3123
+ const text = null === combinedText ? "" : combinedText.substring(textIdx, textIdx + length);
3124
+ addVNode(previousTextNode = vnode_newSharedText(previousTextNode, textNode, text)), textIdx += length;
3281
3125
  }
3126
+ }), vParent[5] = vLast, vFirst;
3127
+ }
3128
+ const vnode_getType = (vnode) => {
3129
+ const type = vnode[0];
3130
+ if (1 & type) {
3131
+ return 1;
3282
3132
  }
3283
- getSyncFn(id) {
3284
- const fn = this.$qFuncs$[id];
3285
- return fn;
3133
+ if (2 & type) {
3134
+ return 11;
3286
3135
  }
3287
- $appendStyle$(content, styleId, host, scoped) {
3288
- if (scoped) {
3289
- const scopedStyleIdsString = this.getHostProp(host, "q:sstyle");
3290
- const scopedStyleIds = new Set(convertScopedStyleIdsToArray(scopedStyleIdsString));
3291
- scopedStyleIds.add(styleId), this.setHostProp(host, "q:sstyle", convertStyleIdsToString(scopedStyleIds));
3292
- }
3293
- if (null == this.$styleIds$ && (this.$styleIds$ = /* @__PURE__ */ new Set(), this.element.querySelectorAll(QStyleSelector).forEach((style) => {
3294
- this.$styleIds$.add(style.getAttribute(QStyle));
3295
- })), !this.$styleIds$.has(styleId)) {
3296
- this.$styleIds$.add(styleId);
3297
- const styleElement = this.document.createElement("style");
3298
- styleElement.setAttribute(QStyle, styleId), styleElement.textContent = content, this.$journal$.push(VNodeJournalOpCode.Insert, this.document.head, null, styleElement);
3136
+ if (4 & type) {
3137
+ return 3;
3138
+ }
3139
+ throw qError(43, [type]);
3140
+ };
3141
+ const isElement = (node) => node && "object" == typeof node && 1 === fastNodeType(node);
3142
+ const vnode_getProjectionParentComponent = (vHost, rootVNode) => {
3143
+ let projectionDepth = 1;
3144
+ for (; projectionDepth--; ) {
3145
+ for (; vHost && (!vnode_isVirtualVNode(vHost) || null === vnode_getProp(vHost, "q:renderFn", null)); ) {
3146
+ const qSlotParent = vnode_getProp(vHost, "q:sparent", (id) => vnode_locate(rootVNode, id));
3147
+ const vProjectionParent = vnode_isVirtualVNode(vHost) && qSlotParent;
3148
+ vProjectionParent && projectionDepth++, vHost = vProjectionParent || vnode_getParent(vHost);
3299
3149
  }
3150
+ projectionDepth > 0 && (vHost = vnode_getParent(vHost));
3300
3151
  }
3301
- }
3152
+ return vHost;
3153
+ };
3154
+ const VNodeArray = class VNode extends Array {
3155
+ static createElement(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName) {
3156
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, element, elementName, []);
3157
+ }
3158
+ static createText(flags, parent, previousSibling, nextSibling, textNode, text) {
3159
+ return new VNode(flags, parent, previousSibling, nextSibling, textNode, text);
3160
+ }
3161
+ static createVirtual(flags, parent, previousSibling, nextSibling, firstChild, lastChild) {
3162
+ return new VNode(flags, parent, previousSibling, nextSibling, firstChild, lastChild, []);
3163
+ }
3164
+ constructor(flags, parent, previousSibling, nextSibling, ...rest) {
3165
+ super(flags, parent, previousSibling, nextSibling, ...rest);
3166
+ }
3167
+ };
3302
3168
  const deserializedProxyMap = /* @__PURE__ */ new WeakMap();
3303
3169
  const isDeserializerProxy = (value) => "object" == typeof value && null !== value && SERIALIZER_PROXY_UNWRAP in value;
3304
3170
  const SERIALIZER_PROXY_UNWRAP = Symbol("UNWRAP");
@@ -3336,7 +3202,7 @@ class DeserializationHandler {
3336
3202
  }
3337
3203
  const container = this.$container$;
3338
3204
  let propValue = allocate(container, typeId, value);
3339
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)), Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue, propValue;
3205
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)), Reflect.set(target, property, propValue), this.$data$[idx] = void 0, this.$data$[idx + 1] = propValue, propValue;
3340
3206
  }
3341
3207
  has(target, property) {
3342
3208
  return property === SERIALIZER_PROXY_UNWRAP || Object.prototype.hasOwnProperty.call(target, property);
@@ -3366,13 +3232,13 @@ const inflate = (container, target, typeId, data) => {
3366
3232
  if (void 0 === typeId) {
3367
3233
  return target;
3368
3234
  }
3369
- switch (typeId !== TypeIds.Object && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)), typeId) {
3370
- case TypeIds.Object:
3235
+ switch (13 !== typeId && Array.isArray(data) && (data = _eagerDeserializeArray(container, data)), typeId) {
3236
+ case 13:
3371
3237
  for (let i2 = 0; i2 < data.length; i2 += 4) {
3372
3238
  const key = deserializeData(container, data[i2], data[i2 + 1]);
3373
3239
  const valType = data[i2 + 2];
3374
3240
  const valData = data[i2 + 3];
3375
- valType === TypeIds.RootRef || valType >= TypeIds.Error ? Object.defineProperty(target, key, {
3241
+ 0 === valType || valType >= 12 ? Object.defineProperty(target, key, {
3376
3242
  get() {
3377
3243
  const value = deserializeData(container, valType, valData);
3378
3244
  return target[key] = value, value;
@@ -3390,54 +3256,56 @@ const inflate = (container, target, typeId, data) => {
3390
3256
  }) : target[key] = deserializeData(container, valType, valData);
3391
3257
  }
3392
3258
  break;
3393
- case TypeIds.QRL:
3259
+ case 18:
3394
3260
  inflateQRL(container, target);
3395
3261
  break;
3396
- case TypeIds.Task:
3262
+ case 19:
3397
3263
  const task = target;
3398
3264
  const v = data;
3399
3265
  task.$qrl$ = inflateQRL(container, v[0]), task.$flags$ = v[1], task.$index$ = v[2], task.$el$ = v[3], task[_EFFECT_BACK_REF] = v[4], task.$state$ = v[5];
3400
3266
  break;
3401
- case TypeIds.Resource:
3267
+ case 20:
3402
3268
  const [resolved, result, effects] = data;
3403
3269
  const resource = target;
3404
3270
  resolved ? (resource.value = Promise.resolve(result), resource._resolved = result, resource._state = "resolved") : (resource.value = Promise.reject(result), resource._error = result, resource._state = "rejected"), getStoreHandler(target).$effects$ = effects;
3405
3271
  break;
3406
- case TypeIds.Component:
3272
+ case 21:
3407
3273
  target[SERIALIZABLE_STATE][0] = data[0];
3408
3274
  break;
3409
- case TypeIds.Store:
3410
- case TypeIds.StoreArray: {
3275
+ case 26:
3276
+ case 27: {
3411
3277
  const [value, flags, effects2] = data;
3412
3278
  const store = getOrCreateStore(value, flags, container);
3413
3279
  getStoreHandler(store).$effects$ = effects2, target = store;
3414
3280
  break;
3415
3281
  }
3416
- case TypeIds.Signal: {
3282
+ case 22: {
3417
3283
  const signal = target;
3418
3284
  const d = data;
3419
3285
  signal.$untrackedValue$ = d[0], signal.$effects$ = new Set(d.slice(1));
3420
3286
  break;
3421
3287
  }
3422
- case TypeIds.WrappedSignal: {
3288
+ case 23: {
3423
3289
  const signal = target;
3424
3290
  const d = data;
3425
3291
  signal.$func$ = container.getSyncFn(d[0]), signal.$args$ = d[1], signal[_EFFECT_BACK_REF] = d[2], signal.$untrackedValue$ = d[3], signal.$flags$ = d[4], signal.$hostElement$ = d[5], signal.$effects$ = new Set(d.slice(6));
3426
3292
  break;
3427
3293
  }
3428
- case TypeIds.ComputedSignal: {
3294
+ case 25:
3295
+ case 24: {
3429
3296
  const computed = target;
3430
3297
  const d = data;
3431
- computed.$computeQrl$ = d[0], computed.$effects$ = d[1], 3 === d.length ? computed.$untrackedValue$ = d[2] : (computed.$flags$ |= SignalFlags.INVALID, computed.$computeQrl$.resolve(), container.$scheduler$?.(ChoreType.QRL_RESOLVE, null, computed.$computeQrl$));
3298
+ computed.$computeQrl$ = d[0], computed.$effects$ = new Set(d[1]);
3299
+ d.length > 2 ? (computed.$untrackedValue$ = d[2], 25 === typeId && (computed.$flags$ |= 1)) : (computed.$flags$ |= 1, computed.$computeQrl$.resolve(), container.$scheduler$?.(1, null, computed.$computeQrl$));
3432
3300
  break;
3433
3301
  }
3434
- case TypeIds.Error: {
3302
+ case 12: {
3435
3303
  const d = data;
3436
3304
  target.message = d[0];
3437
3305
  const second = d[1];
3438
3306
  if (second && Array.isArray(second)) {
3439
3307
  for (let i2 = 0; i2 < second.length; i2++) {
3440
- target[second[i2++]] = d[i2];
3308
+ target[second[i2++]] = second[i2];
3441
3309
  }
3442
3310
  target.stack = d[2];
3443
3311
  } else {
@@ -3445,7 +3313,7 @@ const inflate = (container, target, typeId, data) => {
3445
3313
  }
3446
3314
  break;
3447
3315
  }
3448
- case TypeIds.FormData: {
3316
+ case 28: {
3449
3317
  const formData = target;
3450
3318
  const d = data;
3451
3319
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3453,13 +3321,13 @@ const inflate = (container, target, typeId, data) => {
3453
3321
  }
3454
3322
  break;
3455
3323
  }
3456
- case TypeIds.JSXNode: {
3324
+ case 29: {
3457
3325
  const jsx2 = target;
3458
3326
  const [type, varProps, constProps, children, flags, key] = data;
3459
3327
  jsx2.type = type, jsx2.varProps = varProps, jsx2.constProps = constProps, jsx2.children = children, jsx2.flags = flags, jsx2.key = key;
3460
3328
  break;
3461
3329
  }
3462
- case TypeIds.Set: {
3330
+ case 15: {
3463
3331
  const set = target;
3464
3332
  const d = data;
3465
3333
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3467,7 +3335,7 @@ const inflate = (container, target, typeId, data) => {
3467
3335
  }
3468
3336
  break;
3469
3337
  }
3470
- case TypeIds.Map: {
3338
+ case 16: {
3471
3339
  const map = target;
3472
3340
  const d = data;
3473
3341
  for (let i2 = 0; i2 < d.length; i2++) {
@@ -3475,14 +3343,14 @@ const inflate = (container, target, typeId, data) => {
3475
3343
  }
3476
3344
  break;
3477
3345
  }
3478
- case TypeIds.Promise: {
3346
+ case 14: {
3479
3347
  const promise = target;
3480
3348
  const [resolved2, result2] = data;
3481
3349
  const [resolve, reject] = resolvers.get(promise);
3482
3350
  resolved2 ? resolve(result2) : reject(result2);
3483
3351
  break;
3484
3352
  }
3485
- case TypeIds.Uint8Array:
3353
+ case 17:
3486
3354
  const bytes = target;
3487
3355
  const buf = atob(data);
3488
3356
  let i = 0;
@@ -3490,17 +3358,17 @@ const inflate = (container, target, typeId, data) => {
3490
3358
  bytes[i++] = s.charCodeAt(0);
3491
3359
  }
3492
3360
  break;
3493
- case TypeIds.PropsProxy:
3361
+ case 30:
3494
3362
  const propsProxy = target;
3495
3363
  propsProxy[_VAR_PROPS] = 0 === data ? {} : data[0], propsProxy[_CONST_PROPS] = data[1];
3496
3364
  break;
3497
- case TypeIds.EffectData: {
3365
+ case 31: {
3498
3366
  const effectData = target;
3499
3367
  effectData.data.$scopedStyleIdPrefix$ = data[0], effectData.data.$isConst$ = data[1];
3500
3368
  break;
3501
3369
  }
3502
3370
  default:
3503
- throw qError(QError.serializeErrorNotImplemented, [typeId]);
3371
+ throw qError(33, [typeId]);
3504
3372
  }
3505
3373
  return target;
3506
3374
  };
@@ -3510,59 +3378,60 @@ const allocate = (container, typeId, value) => {
3510
3378
  return typeId;
3511
3379
  }
3512
3380
  switch (typeId) {
3513
- case TypeIds.RootRef:
3381
+ case 0:
3514
3382
  return container.$getObjectById$(value);
3515
- case TypeIds.Constant:
3383
+ case 1:
3516
3384
  return _constants[value];
3517
- case TypeIds.Number:
3385
+ case 2:
3386
+ case 3:
3518
3387
  return value;
3519
- case TypeIds.Array:
3388
+ case 4:
3520
3389
  return wrapDeserializerProxy(container, value);
3521
- case TypeIds.Object:
3390
+ case 13:
3522
3391
  return {};
3523
- case TypeIds.QRL:
3392
+ case 18:
3524
3393
  return parseQRL(container.$getObjectById$(value));
3525
- case TypeIds.Task:
3394
+ case 19:
3526
3395
  return new Task(-1, -1, null, null, null, null);
3527
- case TypeIds.Resource: {
3396
+ case 20: {
3528
3397
  const res = createResourceReturn(container, void 0, void 0);
3529
3398
  return res.loading = false, res;
3530
3399
  }
3531
- case TypeIds.URL:
3400
+ case 5:
3532
3401
  return new URL(value);
3533
- case TypeIds.Date:
3402
+ case 6:
3534
3403
  return new Date(value);
3535
- case TypeIds.Regex:
3404
+ case 7:
3536
3405
  const idx = value.lastIndexOf("/");
3537
3406
  return new RegExp(value.slice(1, idx), value.slice(idx + 1));
3538
- case TypeIds.Error:
3407
+ case 12:
3539
3408
  return new Error();
3540
- case TypeIds.Component:
3409
+ case 21:
3541
3410
  return componentQrl(null);
3542
- case TypeIds.Signal:
3543
- return new Signal(container, 0);
3544
- case TypeIds.WrappedSignal:
3411
+ case 22:
3412
+ return new SignalImpl(container, 0);
3413
+ case 23:
3545
3414
  return new WrappedSignal(container, null, null, null);
3546
- case TypeIds.ComputedSignal:
3547
- return new ComputedSignal(container, null);
3548
- case TypeIds.Store:
3549
- case TypeIds.StoreArray:
3415
+ case 24:
3416
+ return new ComputedSignalImpl(container, null);
3417
+ case 25:
3418
+ return new SerializerSignalImpl(container, null);
3419
+ case 26:
3420
+ case 27:
3550
3421
  return null;
3551
- case TypeIds.URLSearchParams:
3422
+ case 11:
3552
3423
  return new URLSearchParams(value);
3553
- case TypeIds.FormData:
3424
+ case 28:
3554
3425
  return new FormData();
3555
- case TypeIds.JSXNode:
3426
+ case 29:
3556
3427
  return new JSXNodeImpl(null, null, null, null, -1, null);
3557
- case TypeIds.BigInt:
3428
+ case 10:
3558
3429
  return BigInt(value);
3559
- case TypeIds.Set:
3430
+ case 15:
3560
3431
  return /* @__PURE__ */ new Set();
3561
- case TypeIds.Map:
3432
+ case 16:
3562
3433
  return /* @__PURE__ */ new Map();
3563
- case TypeIds.String:
3564
- return value;
3565
- case TypeIds.Promise:
3434
+ case 14:
3566
3435
  let resolve;
3567
3436
  let reject;
3568
3437
  const promise = new Promise((res, rej) => {
@@ -3570,24 +3439,24 @@ const allocate = (container, typeId, value) => {
3570
3439
  });
3571
3440
  return resolvers.set(promise, [resolve, reject]), promise.catch(() => {
3572
3441
  }), promise;
3573
- case TypeIds.Uint8Array:
3442
+ case 17:
3574
3443
  const encodedLength = value.length;
3575
3444
  const rest = 3 & encodedLength;
3576
3445
  return new Uint8Array(3 * (encodedLength >>> 2) + (rest ? rest - 1 : 0));
3577
- case TypeIds.PropsProxy:
3446
+ case 30:
3578
3447
  return createPropsProxy(null, null);
3579
- case TypeIds.VNode:
3448
+ case 8:
3580
3449
  return retrieveVNodeOrDocument(container, value);
3581
- case TypeIds.RefVNode:
3450
+ case 9:
3582
3451
  const vNode = retrieveVNodeOrDocument(container, value);
3583
3452
  if (vnode_isVNode(vNode)) {
3584
3453
  return vnode_getNode(vNode);
3585
3454
  }
3586
- throw qError(QError.serializeErrorExpectedVNode, [typeof vNode]);
3587
- case TypeIds.EffectData:
3455
+ throw qError(34, [typeof vNode]);
3456
+ case 31:
3588
3457
  return new SubscriptionData({});
3589
3458
  default:
3590
- throw qError(QError.serializeErrorCannotAllocate, [typeId]);
3459
+ throw qError(35, [typeId]);
3591
3460
  }
3592
3461
  };
3593
3462
  function retrieveVNodeOrDocument(container, value) {
@@ -3649,7 +3518,7 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3649
3518
  $getRootId$: (obj) => {
3650
3519
  const id = map.get(obj);
3651
3520
  if (!id || -1 === id) {
3652
- throw qError(QError.serializeErrorMissingRootId, [obj]);
3521
+ throw qError(36, [obj]);
3653
3522
  }
3654
3523
  return id;
3655
3524
  },
@@ -3700,9 +3569,12 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3700
3569
  obj.forEach((v, k) => {
3701
3570
  discoveredValues.push(k, v);
3702
3571
  });
3703
- } else if (obj instanceof Signal) {
3704
- const v = obj instanceof WrappedSignal ? obj.untrackedValue : obj instanceof ComputedSignal && (obj.$flags$ & SignalFlags.INVALID || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3705
- v !== NEEDS_COMPUTATION && discoveredValues.push(v), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignal && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3572
+ } else if (obj instanceof SignalImpl) {
3573
+ const toSerialize = obj instanceof ComputedSignalImpl && !(obj instanceof SerializerSignalImpl) && (1 & obj.$flags$ || fastSkipSerialize(obj)) ? NEEDS_COMPUTATION : obj.$untrackedValue$;
3574
+ toSerialize !== NEEDS_COMPUTATION && (obj instanceof SerializerSignalImpl ? promises.push(obj.$computeQrl$.resolve().then((arg) => {
3575
+ let data;
3576
+ arg.serialize ? data = arg.serialize(toSerialize) : SerializerSymbol in toSerialize && (data = toSerialize[SerializerSymbol](toSerialize)), void 0 === data && (data = NEEDS_COMPUTATION), serializationResults.set(obj, data), discoveredValues.push(data);
3577
+ })) : discoveredValues.push(toSerialize)), obj.$effects$ && discoveredValues.push(obj.$effects$), obj instanceof WrappedSignal ? (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), obj.$args$ && discoveredValues.push(...obj.$args$), obj.$hostElement$ && discoveredValues.push(obj.$hostElement$)) : obj instanceof ComputedSignalImpl && (discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues), discoveredValues.push(obj.$computeQrl$));
3706
3578
  } else if (obj instanceof Task) {
3707
3579
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$), discoverEffectBackRefs(obj[_EFFECT_BACK_REF], discoveredValues);
3708
3580
  } else if (isSsrNode2(obj)) {
@@ -3715,8 +3587,6 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3715
3587
  discoveredValues.push(obj.$ssrNode$.id);
3716
3588
  } else if (isJSXNode(obj)) {
3717
3589
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
3718
- } else if (Array.isArray(obj)) {
3719
- discoveredValues.push(...obj);
3720
3590
  } else if (isQrl$1(obj)) {
3721
3591
  obj.$captureRef$ && obj.$captureRef$.length && discoveredValues.push(...obj.$captureRef$);
3722
3592
  } else if (isPropsProxy(obj)) {
@@ -3729,9 +3599,14 @@ const createSerializationContext = (NodeConstructor, DomRefConstructor, symbolTo
3729
3599
  }), promises.push(obj);
3730
3600
  } else if (obj instanceof SubscriptionData) {
3731
3601
  discoveredValues.push(obj.data);
3602
+ } else if (Array.isArray(obj)) {
3603
+ discoveredValues.push(...obj);
3604
+ } else if (isSerializerObj(obj)) {
3605
+ const result = obj[SerializerSymbol](obj);
3606
+ serializationResults.set(obj, result), discoveredValues.push(result);
3732
3607
  } else {
3733
3608
  if (!isObjectLiteral(obj)) {
3734
- throw qError(QError.serializeErrorUnknownType, [obj]);
3609
+ throw qError(37, [obj]);
3735
3610
  }
3736
3611
  Object.entries(obj).forEach(([key, value]) => {
3737
3612
  discoveredValues.push(key, value);
@@ -3778,6 +3653,7 @@ const discoverEffectBackRefs = (effectsBackRefs, discoveredValues) => {
3778
3653
  effectsBackRefs && discoveredValues.push(effectsBackRefs);
3779
3654
  };
3780
3655
  const promiseResults = /* @__PURE__ */ new WeakMap();
3656
+ const serializationResults = /* @__PURE__ */ new WeakMap();
3781
3657
  function serialize(serializationContext) {
3782
3658
  const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
3783
3659
  let depth = -1;
@@ -3804,46 +3680,46 @@ function serialize(serializationContext) {
3804
3680
  };
3805
3681
  const writeValue = (value, idx) => {
3806
3682
  if (fastSkipSerialize(value)) {
3807
- output(TypeIds.Constant, Constants.Undefined);
3683
+ output(1, 0);
3808
3684
  } else if ("bigint" == typeof value) {
3809
- output(TypeIds.BigInt, value.toString());
3685
+ output(10, value.toString());
3810
3686
  } else if ("boolean" == typeof value) {
3811
- output(TypeIds.Constant, value ? Constants.True : Constants.False);
3687
+ output(1, value ? 2 : 3);
3812
3688
  } else if ("function" == typeof value) {
3813
3689
  if (value === Slot) {
3814
- output(TypeIds.Constant, Constants.Slot);
3690
+ output(1, 9);
3815
3691
  } else if (value === Fragment) {
3816
- output(TypeIds.Constant, Constants.Fragment);
3692
+ output(1, 10);
3817
3693
  } else if (isQrl$1(value)) {
3818
3694
  const qrl2 = qrlToString(serializationContext, value);
3819
3695
  const id = serializationContext.$addRoot$(qrl2);
3820
- output(TypeIds.QRL, id);
3696
+ output(18, id);
3821
3697
  } else if (isQwikComponent(value)) {
3822
3698
  const [qrl2] = value[SERIALIZABLE_STATE];
3823
- serializationContext.$renderSymbols$.add(qrl2.$symbol$), output(TypeIds.Component, [qrl2]);
3699
+ serializationContext.$renderSymbols$.add(qrl2.$symbol$), output(21, [qrl2]);
3824
3700
  } else {
3825
- console.error("Cannot serialize function (ignoring for now): " + value.toString()), output(TypeIds.Constant, Constants.Undefined);
3701
+ console.error("Cannot serialize function (ignoring for now): " + value.toString()), output(1, 0);
3826
3702
  }
3827
3703
  } else if ("number" == typeof value) {
3828
- 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);
3704
+ 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);
3829
3705
  } else if ("object" == typeof value) {
3830
- value === EMPTY_ARRAY ? output(TypeIds.Constant, Constants.EMPTY_ARRAY) : value === EMPTY_OBJ ? output(TypeIds.Constant, Constants.EMPTY_OBJ) : (depth++, null === value ? output(TypeIds.Constant, Constants.Null) : writeObjectValue(value, idx), depth--);
3706
+ value === EMPTY_ARRAY ? output(1, 5) : value === EMPTY_OBJ ? output(1, 6) : null === value ? output(1, 1) : (depth++, writeObjectValue(value, idx), depth--);
3831
3707
  } else if ("string" == typeof value) {
3832
3708
  if (0 === value.length) {
3833
- output(TypeIds.Constant, Constants.EmptyString);
3709
+ output(1, 4);
3834
3710
  } else {
3835
3711
  const seen = depth > 1 && serializationContext.$wasSeen$(value);
3836
- "number" == typeof seen && seen >= 0 ? output(TypeIds.RootRef, seen) : output(TypeIds.String, value);
3712
+ "number" == typeof seen && seen >= 0 ? output(0, seen) : output(3, value);
3837
3713
  }
3838
3714
  } else if (void 0 === value) {
3839
- output(TypeIds.Constant, Constants.Undefined);
3715
+ output(1, 0);
3840
3716
  } else if (value === NEEDS_COMPUTATION) {
3841
- output(TypeIds.Constant, Constants.NEEDS_COMPUTATION);
3717
+ output(1, 7);
3842
3718
  } else {
3843
3719
  if (value !== STORE_ALL_PROPS) {
3844
- throw qError(QError.serializeErrorUnknownType, [typeof value]);
3720
+ throw qError(37, [typeof value]);
3845
3721
  }
3846
- output(TypeIds.Constant, Constants.STORE_ALL_PROPS);
3722
+ output(1, 8);
3847
3723
  }
3848
3724
  };
3849
3725
  const writeObjectValue = (value, idx) => {
@@ -3851,24 +3727,24 @@ function serialize(serializationContext) {
3851
3727
  if (depth > 2) {
3852
3728
  const seen = serializationContext.$wasSeen$(value);
3853
3729
  if ("number" == typeof seen && seen >= 0) {
3854
- return void output(TypeIds.RootRef, seen);
3730
+ return void output(0, seen);
3855
3731
  }
3856
3732
  }
3857
3733
  if (isPropsProxy(value)) {
3858
3734
  const varProps = value[_VAR_PROPS];
3859
3735
  const constProps = value[_CONST_PROPS];
3860
3736
  const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
3861
- output(TypeIds.PropsProxy, out);
3737
+ output(30, out);
3862
3738
  } else if (value instanceof SubscriptionData) {
3863
- output(TypeIds.EffectData, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
3739
+ output(31, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
3864
3740
  } else if (isStore(value)) {
3865
3741
  if (isResource(value)) {
3866
3742
  serializationContext.$resources$.add(value);
3867
3743
  const res = promiseResults.get(value.value);
3868
3744
  if (!res) {
3869
- throw qError(QError.serializeErrorUnvisited, ["resource"]);
3745
+ throw qError(38, ["resource"]);
3870
3746
  }
3871
- output(TypeIds.Resource, [...res, getStoreHandler(value).$effects$]);
3747
+ output(20, [...res, getStoreHandler(value).$effects$]);
3872
3748
  } else {
3873
3749
  const storeHandler = getStoreHandler(value);
3874
3750
  const storeTarget = getStoreTarget(value);
@@ -3886,93 +3762,104 @@ function serialize(serializationContext) {
3886
3762
  for (; null == out[out.length - 1]; ) {
3887
3763
  out.pop();
3888
3764
  }
3889
- output(Array.isArray(storeTarget) ? TypeIds.StoreArray : TypeIds.Store, out);
3765
+ output(Array.isArray(storeTarget) ? 27 : 26, out);
3766
+ }
3767
+ } else if (isSerializerObj(value)) {
3768
+ let result = serializationResults.get(value);
3769
+ if (isPromise(result)) {
3770
+ const promiseResult = promiseResults.get(result);
3771
+ if (!promiseResult[0]) {
3772
+ throw console.error(promiseResult[1]), qError(50);
3773
+ }
3774
+ result = promiseResult[1];
3890
3775
  }
3776
+ depth--, writeValue(result, idx), depth++;
3891
3777
  } else if (isObjectLiteral(value)) {
3892
3778
  if (Array.isArray(value)) {
3893
- output(TypeIds.Array, value);
3779
+ output(4, value);
3894
3780
  } else {
3895
3781
  const out = [];
3896
3782
  for (const key in value) {
3897
3783
  Object.prototype.hasOwnProperty.call(value, key) && !fastSkipSerialize(value[key]) && out.push(key, value[key]);
3898
3784
  }
3899
- output(TypeIds.Object, out);
3785
+ output(13, out);
3900
3786
  }
3901
3787
  } else if ($isDomRef$(value)) {
3902
- value.$ssrNode$.vnodeData[0] |= VNodeDataFlag.SERIALIZE, output(TypeIds.RefVNode, value.$ssrNode$.id);
3903
- } else if (value instanceof Signal) {
3904
- const v = value instanceof ComputedSignal && (value.$flags$ & SignalFlags.INVALID || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3788
+ value.$ssrNode$.vnodeData[0] |= 16, output(9, value.$ssrNode$.id);
3789
+ } else if (value instanceof SignalImpl) {
3790
+ const isSerialized = value instanceof SerializerSignalImpl;
3791
+ const v = !isSerialized && value instanceof ComputedSignalImpl && (1 & value.$flags$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
3905
3792
  if (value instanceof WrappedSignal) {
3906
- output(TypeIds.WrappedSignal, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3907
- } else if (value instanceof ComputedSignal) {
3793
+ output(23, [...serializeWrappingFn(serializationContext, value), filterEffectBackRefs(value[_EFFECT_BACK_REF]), v, value.$flags$, value.$hostElement$, ...value.$effects$ || []]);
3794
+ } else if (value instanceof ComputedSignalImpl) {
3908
3795
  const out = [value.$computeQrl$, value.$effects$];
3909
- v !== NEEDS_COMPUTATION && out.push(v), output(TypeIds.ComputedSignal, out);
3796
+ v !== NEEDS_COMPUTATION && out.push(isSerialized ? serializationResults.get(value) : v), output(isSerialized ? 25 : 24, out);
3910
3797
  } else {
3911
- output(TypeIds.Signal, [v, ...value.$effects$ || []]);
3798
+ output(22, [v, ...value.$effects$ || []]);
3912
3799
  }
3913
3800
  } else if (value instanceof URL) {
3914
- output(TypeIds.URL, value.href);
3801
+ output(5, value.href);
3915
3802
  } else if (value instanceof Date) {
3916
- output(TypeIds.Date, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
3803
+ output(6, Number.isNaN(value.valueOf()) ? "" : value.valueOf());
3917
3804
  } else if (value instanceof RegExp) {
3918
- output(TypeIds.Regex, value.toString());
3805
+ output(7, value.toString());
3919
3806
  } else if (value instanceof Error) {
3920
3807
  const out = [value.message];
3921
3808
  const extraProps = Object.entries(value).flat();
3922
- extraProps.length && out.push(extraProps), out.push(value.stack), output(TypeIds.Error, out);
3809
+ extraProps.length && out.push(extraProps), out.push(value.stack), output(12, out);
3923
3810
  } else if ($isSsrNode$(value)) {
3924
3811
  if (isRootObject) {
3925
- $setProp$(value, "q:id", String(idx)), output(TypeIds.VNode, value.id);
3812
+ $setProp$(value, "q:id", String(idx)), output(8, value.id);
3926
3813
  const vNodeData = value.vnodeData;
3927
- if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= VNodeDataFlag.SERIALIZE), value.childrenVNodeData) {
3814
+ if (vNodeData && (serializationContext.$prepVNodeData$?.(vNodeData), vNodeData[0] |= 16), value.childrenVNodeData) {
3928
3815
  for (const vNodeData2 of value.childrenVNodeData) {
3929
- vNodeData2[0] |= VNodeDataFlag.SERIALIZE;
3816
+ vNodeData2[0] |= 16;
3930
3817
  }
3931
3818
  }
3932
3819
  } else {
3933
- serializationContext.$addRoot$(value), output(TypeIds.RootRef, serializationContext.$roots$.length - 1);
3820
+ serializationContext.$addRoot$(value), output(0, serializationContext.$roots$.length - 1);
3934
3821
  }
3935
3822
  } else if ("undefined" != typeof FormData && value instanceof FormData) {
3936
3823
  const array = [];
3937
3824
  value.forEach((value2, key) => {
3938
3825
  array.push(key, "string" == typeof value2 ? value2 : value2.name);
3939
- }), output(TypeIds.FormData, array);
3826
+ }), output(28, array);
3940
3827
  } else if (value instanceof URLSearchParams) {
3941
- output(TypeIds.URLSearchParams, value.toString());
3828
+ output(11, value.toString());
3942
3829
  } else if (value instanceof Set) {
3943
- output(TypeIds.Set, [...value.values()]);
3830
+ output(15, [...value.values()]);
3944
3831
  } else if (value instanceof Map) {
3945
3832
  const combined = [];
3946
3833
  for (const [k, v] of value.entries()) {
3947
3834
  combined.push(k, v);
3948
3835
  }
3949
- output(TypeIds.Map, combined);
3836
+ output(16, combined);
3950
3837
  } else if (isJSXNode(value)) {
3951
- output(TypeIds.JSXNode, [value.type, value.varProps, value.constProps, value.children, value.flags, value.key]);
3838
+ output(29, [value.type, value.varProps, value.constProps, value.children, value.flags, value.key]);
3952
3839
  } else if (value instanceof Task) {
3953
3840
  const out = [value.$qrl$, value.$flags$, value.$index$, value.$el$, value[_EFFECT_BACK_REF], value.$state$];
3954
3841
  for (; null == out[out.length - 1]; ) {
3955
3842
  out.pop();
3956
3843
  }
3957
- output(TypeIds.Task, out);
3844
+ output(19, out);
3958
3845
  } else if (isPromise(value)) {
3959
3846
  const res = promiseResults.get(value);
3960
3847
  if (!res) {
3961
- throw qError(QError.serializeErrorUnvisited, ["promise"]);
3848
+ throw qError(38, ["promise"]);
3962
3849
  }
3963
- output(TypeIds.Promise, res);
3850
+ output(14, res);
3964
3851
  } else if (value instanceof Uint8Array) {
3965
3852
  let buf = "";
3966
3853
  for (const c of value) {
3967
3854
  buf += String.fromCharCode(c);
3968
3855
  }
3969
3856
  const out = btoa(buf).replace(/=+$/, "");
3970
- output(TypeIds.Uint8Array, out);
3857
+ output(17, out);
3971
3858
  } else {
3972
3859
  if (!vnode_isVNode(value)) {
3973
- throw qError(QError.serializeErrorUnknownType, [typeof value]);
3860
+ throw qError(37, [typeof value]);
3974
3861
  }
3975
- output(TypeIds.Constant, Constants.Undefined);
3862
+ output(1, 0);
3976
3863
  }
3977
3864
  };
3978
3865
  writeValue(serializationContext.$roots$, -1);
@@ -3981,7 +3868,7 @@ function filterEffectBackRefs(effectBackRef) {
3981
3868
  let effectBackRefToSerialize = null;
3982
3869
  if (effectBackRef) {
3983
3870
  for (const [effectProp, effect] of effectBackRef) {
3984
- effect[EffectSubscriptionProp.BACK_REF] && (effectBackRefToSerialize || (effectBackRefToSerialize = /* @__PURE__ */ new Map()), effectBackRefToSerialize.set(effectProp, effect));
3871
+ effect[2] && (effectBackRefToSerialize || (effectBackRefToSerialize = /* @__PURE__ */ new Map()), effectBackRefToSerialize.set(effectProp, effect));
3985
3872
  }
3986
3873
  }
3987
3874
  return effectBackRefToSerialize;
@@ -4007,7 +3894,7 @@ function qrlToString(serializationContext, value) {
4007
3894
  backChannel || (backChannel = globalThis[QRL_RUNTIME_CHUNK] = /* @__PURE__ */ new Map()), backChannel.set(value.$symbol$, value._devOnlySymbolRef), chunk || (chunk = QRL_RUNTIME_CHUNK);
4008
3895
  }
4009
3896
  if (!chunk) {
4010
- throw qError(QError.qrlMissingChunk, [value.$symbol$]);
3897
+ throw qError(31, [value.$symbol$]);
4011
3898
  }
4012
3899
  chunk.startsWith("./") && (chunk = chunk.slice(2));
4013
3900
  }
@@ -4028,7 +3915,7 @@ function deserializeData(container, typeId, value) {
4028
3915
  return value;
4029
3916
  }
4030
3917
  let propValue = allocate(container, typeId, value);
4031
- return typeId >= TypeIds.Error && (propValue = inflate(container, propValue, typeId, value)), propValue;
3918
+ return typeId >= 12 && (propValue = inflate(container, propValue, typeId, value)), propValue;
4032
3919
  }
4033
3920
  function shouldTrackObj(obj) {
4034
3921
  return "object" == typeof obj && null !== obj || "string" == typeof obj && obj.length > 1;
@@ -4040,18 +3927,13 @@ function isObjectLiteral(obj) {
4040
3927
  function isResource(value) {
4041
3928
  return "__brand" in value && "resource" === value.__brand;
4042
3929
  }
4043
- const frameworkType = (obj) => "object" == typeof obj && null !== obj && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
3930
+ const frameworkType = (obj) => "object" == typeof obj && null !== obj && (obj instanceof SignalImpl || obj instanceof Task || isJSXNode(obj)) || isQrl$1(obj);
4044
3931
  const QRL_RUNTIME_CHUNK = "mock-chunk";
4045
- var TypeIds;
4046
- var Constants;
4047
- !function(TypeIds2) {
4048
- TypeIds2[TypeIds2.RootRef = 0] = "RootRef", TypeIds2[TypeIds2.Constant = 1] = "Constant", TypeIds2[TypeIds2.Number = 2] = "Number", TypeIds2[TypeIds2.String = 3] = "String", TypeIds2[TypeIds2.Array = 4] = "Array", TypeIds2[TypeIds2.URL = 5] = "URL", TypeIds2[TypeIds2.Date = 6] = "Date", TypeIds2[TypeIds2.Regex = 7] = "Regex", TypeIds2[TypeIds2.VNode = 8] = "VNode", TypeIds2[TypeIds2.RefVNode = 9] = "RefVNode", TypeIds2[TypeIds2.BigInt = 10] = "BigInt", TypeIds2[TypeIds2.URLSearchParams = 11] = "URLSearchParams", TypeIds2[TypeIds2.Error = 12] = "Error", TypeIds2[TypeIds2.Object = 13] = "Object", TypeIds2[TypeIds2.Promise = 14] = "Promise", TypeIds2[TypeIds2.Set = 15] = "Set", TypeIds2[TypeIds2.Map = 16] = "Map", TypeIds2[TypeIds2.Uint8Array = 17] = "Uint8Array", TypeIds2[TypeIds2.QRL = 18] = "QRL", TypeIds2[TypeIds2.Task = 19] = "Task", TypeIds2[TypeIds2.Resource = 20] = "Resource", TypeIds2[TypeIds2.Component = 21] = "Component", TypeIds2[TypeIds2.Signal = 22] = "Signal", TypeIds2[TypeIds2.WrappedSignal = 23] = "WrappedSignal", TypeIds2[TypeIds2.ComputedSignal = 24] = "ComputedSignal", TypeIds2[TypeIds2.Store = 25] = "Store", TypeIds2[TypeIds2.StoreArray = 26] = "StoreArray", TypeIds2[TypeIds2.FormData = 27] = "FormData", TypeIds2[TypeIds2.JSXNode = 28] = "JSXNode", TypeIds2[TypeIds2.PropsProxy = 29] = "PropsProxy", TypeIds2[TypeIds2.EffectData = 30] = "EffectData";
4049
- }(TypeIds || (TypeIds = {})), function(Constants2) {
4050
- Constants2[Constants2.Undefined = 0] = "Undefined", Constants2[Constants2.Null = 1] = "Null", Constants2[Constants2.True = 2] = "True", Constants2[Constants2.False = 3] = "False", Constants2[Constants2.EmptyString = 4] = "EmptyString", Constants2[Constants2.EMPTY_ARRAY = 5] = "EMPTY_ARRAY", Constants2[Constants2.EMPTY_OBJ = 6] = "EMPTY_OBJ", Constants2[Constants2.NEEDS_COMPUTATION = 7] = "NEEDS_COMPUTATION", Constants2[Constants2.STORE_ALL_PROPS = 8] = "STORE_ALL_PROPS", Constants2[Constants2.Slot = 9] = "Slot", Constants2[Constants2.Fragment = 10] = "Fragment", Constants2[Constants2.NaN = 11] = "NaN", Constants2[Constants2.PositiveInfinity = 12] = "PositiveInfinity", Constants2[Constants2.NegativeInfinity = 13] = "NegativeInfinity", Constants2[Constants2.MaxSafeInt = 14] = "MaxSafeInt", Constants2[Constants2.AlmostMaxSafeInt = 15] = "AlmostMaxSafeInt", Constants2[Constants2.MinSafeInt = 16] = "MinSafeInt";
4051
- }(Constants || (Constants = {}));
4052
3932
  const noSerializeSet = /* @__PURE__ */ new WeakSet();
4053
- const fastSkipSerialize = (obj) => noSerializeSet.has(obj);
3933
+ const fastSkipSerialize = (obj) => "object" == typeof obj && obj && (NoSerializeSymbol in obj || noSerializeSet.has(obj));
4054
3934
  const noSerialize = (input) => (null != input && noSerializeSet.add(input), input);
3935
+ const NoSerializeSymbol = Symbol("noSerialize");
3936
+ const SerializerSymbol = Symbol("serialize");
4055
3937
  const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
4056
3938
  let _containerEl;
4057
3939
  const qrl2 = async function(...args) {
@@ -4064,7 +3946,7 @@ const createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef) => {
4064
3946
  if (!qrl2.resolved) {
4065
3947
  return qrl2.resolve().then((fn) => {
4066
3948
  if (!isFunction(fn)) {
4067
- throw qError(QError.qrlIsNotFunction);
3949
+ throw qError(10);
4068
3950
  }
4069
3951
  return bound(...args);
4070
3952
  });