@qwik.dev/core 2.0.0-alpha.2 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/server 2.0.0-alpha.2-dev+58b6f8d
3
+ * @qwik.dev/core/server 2.0.0-alpha.4-dev+374e0d6
4
4
  * Copyright QwikDev. All Rights Reserved.
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://github.com/QwikDev/qwik/blob/main/LICENSE
@@ -56,7 +56,7 @@ __export(server_exports, {
56
56
  versions: () => versions
57
57
  });
58
58
  module.exports = __toCommonJS(server_exports);
59
- var import_core4 = require("@qwik.dev/core");
59
+ var import_core5 = require("@qwik.dev/core");
60
60
 
61
61
  // packages/qwik/src/server/platform.ts
62
62
  var import_core = require("@qwik.dev/core");
@@ -167,7 +167,7 @@ var logWarn = (message, ...optionalParams) => {
167
167
  };
168
168
  var createAndLogError = (asyncThrow, message, ...optionalParams) => {
169
169
  const err = message instanceof Error ? message : new Error(message);
170
- console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
170
+ !qTest && console.error("%cQWIK ERROR", STYLE, err.message, ...optionalParams, err.stack);
171
171
  asyncThrow && !qTest && setTimeout(() => {
172
172
  throw err;
173
173
  }, 0);
@@ -180,24 +180,24 @@ var codeToText = (code, ...parts) => {
180
180
  const MAP = [
181
181
  "Error while serializing class or style attributes",
182
182
  // 0
183
- "Can not serialize a HTML Node that is not an Element",
184
- // 1
185
- "Runtime but no instance found on element.",
186
- // 2
187
- "Only primitive and object literals can be serialized",
183
+ "",
184
+ // 1 unused
185
+ "",
186
+ // 2 unused
187
+ "Only primitive and object literals can be serialized. {{0}}",
188
188
  // 3
189
- "Crash while rendering",
190
- // 4
189
+ "",
190
+ // 4 unused
191
191
  "You can render over a existing q:container. Skipping render().",
192
192
  // 5
193
- "Set property {{0}}",
194
- // 6
195
- "Only function's and 'string's are supported.",
196
- // 7
197
- "Only objects can be wrapped in 'QObject'",
198
- // 8
199
- `Only objects literals can be wrapped in 'QObject'`,
200
- // 9
193
+ "",
194
+ // 6 unused
195
+ "",
196
+ // 7 unused
197
+ "",
198
+ // 8 unused
199
+ "",
200
+ // 9 unused
201
201
  "QRL is not a function",
202
202
  // 10
203
203
  "Dynamic import not found",
@@ -208,43 +208,81 @@ var codeToText = (code, ...parts) => {
208
208
  // 13
209
209
  "Invoking 'use*()' method outside of invocation context.",
210
210
  // 14
211
- "Cant access renderCtx for existing context",
212
- // 15
213
- "Cant access document for existing context",
214
- // 16
215
- "props are immutable",
216
- // 17
217
- "<div> component can only be used at the root of a Qwik component$()",
218
- // 18
219
- "Props are immutable by default.",
220
- // 19
211
+ "",
212
+ // 15 unused
213
+ "",
214
+ // 16 unused
215
+ "",
216
+ // 17 unused
217
+ "",
218
+ // 18 unused
219
+ "",
220
+ // 19 unused
221
221
  `Calling a 'use*()' method outside 'component$(() => { HERE })' is not allowed. 'use*()' methods provide hooks to the 'component$' state and lifecycle, ie 'use' hooks can only be called synchronously within the 'component$' function or another 'use' method.
222
222
  See https://qwik.dev/docs/components/tasks/#use-method-rules`,
223
223
  // 20
224
- "Container is already paused. Skipping",
225
- // 21
226
224
  "",
227
- // 22 -- unused
228
- "When rendering directly on top of Document, the root node must be a <html>",
229
- // 23
230
- "A <html> node must have 2 children. The first one <head> and the second one a <body>",
231
- // 24
232
- 'Invalid JSXNode type "{{0}}". It must be either a function or a string. Found:',
233
- // 25
234
- "Tracking value changes can only be done to useStore() objects and component props",
235
- // 26
236
- "Missing Object ID for captured object",
237
- // 27
225
+ // 21 unused
226
+ "",
227
+ // 22 unused
228
+ "",
229
+ // 23 unused
230
+ "",
231
+ // 24 unused
232
+ "",
233
+ // 25 unused
234
+ "",
235
+ // 26 unused
236
+ "",
237
+ // 27 unused
238
238
  'The provided Context reference "{{0}}" is not a valid context created by createContextId()',
239
239
  // 28
240
- "<html> is the root container, it can not be rendered inside a component",
240
+ "SsrError(tag): {{0}}",
241
241
  // 29
242
242
  "QRLs can not be resolved because it does not have an attached container. This means that the QRL does not know where it belongs inside the DOM, so it cant dynamically import() from a relative path.",
243
243
  // 30
244
244
  "QRLs can not be dynamically resolved, because it does not have a chunk path",
245
245
  // 31
246
- "The JSX ref attribute must be a Signal"
246
+ "The JSX ref attribute must be a Signal",
247
247
  // 32
248
+ "Serialization Error: Deserialization of data type {{0}} is not implemented",
249
+ // 33
250
+ "Serialization Error: Expected vnode for ref prop, but got {{0}}",
251
+ // 34
252
+ "Serialization Error: Cannot allocate data type {{0}}",
253
+ // 35
254
+ "Serialization Error: Missing root id for {{0}}",
255
+ // 36
256
+ "Serialization Error: Serialization of data type {{0}} is not implemented",
257
+ // 37
258
+ "Serialization Error: Unvisited {{0}}",
259
+ // 38
260
+ "Serialization Error: Missing QRL chunk for {{0}}",
261
+ // 39
262
+ "The value of the textarea must be a string",
263
+ // 40
264
+ "Unable to find q:container",
265
+ // 41
266
+ "Element must have 'q:container' attribute.",
267
+ // 42
268
+ "Unknown vnode type {{0}}.",
269
+ // 43
270
+ "Materialize error: missing element: {{0}} {{1}} {{2}}",
271
+ // 44
272
+ "SsrError: {{0}}",
273
+ // 45
274
+ "Cannot coerce a Signal, use `.value` instead",
275
+ // 46
276
+ "useComputedSignal$ QRL {{0}} {{1}} returned a Promise",
277
+ // 47
278
+ "ComputedSignal is read-only",
279
+ // 48
280
+ "WrappedSignal is read-only",
281
+ // 49
282
+ "SsrError: Promises not expected here.",
283
+ // 50
284
+ "Attribute value is unsafe for SSR"
285
+ // 51
248
286
  ];
249
287
  let text = MAP[code] ?? "";
250
288
  if (parts.length) {
@@ -256,19 +294,14 @@ See https://qwik.dev/docs/components/tasks/#use-method-rules`,
256
294
  return v;
257
295
  });
258
296
  }
259
- return `Code(${code}): ${text}`;
297
+ return `Code(Q${code}): ${text}`;
260
298
  } else {
261
- return `Code(${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
299
+ return `Code(Q${code}) https://github.com/QwikDev/qwik/blob/main/packages/qwik/src/core/error/error.ts#L${8 + code}`;
262
300
  }
263
301
  };
264
- var QError_stringifyClassOrStyle = 0;
265
- var QError_verifySerializable = 3;
266
- var QError_qrlIsNotFunction = 10;
267
- var QError_qrlMissingContainer = 30;
268
- var QError_qrlMissingChunk = 31;
269
- var qError = (code, ...parts) => {
270
- const text = codeToText(code, ...parts);
271
- return logErrorAndStop(text, ...parts);
302
+ var qError = (code, errorMessageArgs = []) => {
303
+ const text = codeToText(code, ...errorMessageArgs);
304
+ return logErrorAndStop(text, ...errorMessageArgs);
272
305
  };
273
306
 
274
307
  // packages/qwik/src/core/shared/utils/event-names.ts
@@ -447,7 +480,7 @@ var isUnitlessNumber = (name) => {
447
480
  };
448
481
 
449
482
  // packages/qwik/src/core/shared/qrl/qrl-class.ts
450
- var import_build9 = require("@qwik.dev/core/build");
483
+ var import_build8 = require("@qwik.dev/core/build");
451
484
 
452
485
  // packages/qwik/src/core/shared/error/assert.ts
453
486
  var ASSERT_DISCLAIMER = "Internal assert, this is likely caused by a bug in Qwik: ";
@@ -507,10 +540,10 @@ var createPlatform2 = () => {
507
540
  }
508
541
  }
509
542
  if (!url) {
510
- throw qError(QError_qrlMissingChunk, symbolName);
543
+ throw qError(31 /* qrlMissingChunk */, [symbolName]);
511
544
  }
512
545
  if (!containerEl) {
513
- throw qError(QError_qrlMissingContainer, url, symbolName);
546
+ throw qError(30 /* qrlMissingContainer */, [url, symbolName]);
514
547
  }
515
548
  const urlDoc = toUrl(containerEl.ownerDocument, containerEl, url).toString();
516
549
  const urlCopy = new URL(urlDoc);
@@ -587,7 +620,7 @@ var maybeThenPassError = (valueOrPromise, thenFn) => {
587
620
  return isPromise(valueOrPromise) ? valueOrPromise.then(thenFn) : thenFn(valueOrPromise);
588
621
  };
589
622
  var shouldNotError = (reason) => {
590
- throwErrorAndStop("QWIK ERROR:", reason);
623
+ throwErrorAndStop(reason);
591
624
  };
592
625
  var delay = (timeout) => {
593
626
  return new Promise((resolve) => {
@@ -608,261 +641,6 @@ function retryOnPromise(fn, retryCount = 0) {
608
641
  // packages/qwik/src/build/index.dev.ts
609
642
  var isDev = true;
610
643
 
611
- // packages/qwik/src/server/ssr-node.ts
612
- var import_core2 = require("@qwik.dev/core");
613
- var import_build2 = require("@qwik.dev/core/build");
614
- var SsrNode = class {
615
- constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
616
- this.attrs = attrs;
617
- this.cleanupQueue = cleanupQueue;
618
- this.vnodeData = vnodeData;
619
- var _a;
620
- this.currentComponentNode = currentComponentNode;
621
- (_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
622
- this.nodeType = nodeType;
623
- this.id = id;
624
- if (import_build2.isDev && id.indexOf("undefined") != -1) {
625
- throw new Error(`Invalid SSR node id: ${id}`);
626
- }
627
- }
628
- __brand__;
629
- static ELEMENT_NODE = 1;
630
- static TEXT_NODE = 3;
631
- static DOCUMENT_NODE = 9;
632
- static DOCUMENT_FRAGMENT_NODE = 11;
633
- /** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
634
- nodeType;
635
- /**
636
- * ID which the deserialize will use to retrieve the node.
637
- *
638
- * @param refId - Unique id for the node.
639
- */
640
- id;
641
- /** Local props which don't serialize; */
642
- locals = null;
643
- currentComponentNode;
644
- childrenVNodeData = null;
645
- setProp(name, value) {
646
- if (this.attrs === import_core2._EMPTY_ARRAY) {
647
- this.attrs = [];
648
- }
649
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
650
- mapArray_set(this.locals || (this.locals = []), name, value, 0);
651
- } else {
652
- mapArray_set(this.attrs, name, value, 0);
653
- }
654
- if (name == ELEMENT_SEQ && value) {
655
- this.cleanupQueue.push(value);
656
- }
657
- }
658
- getProp(name) {
659
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
660
- return this.locals ? mapArray_get(this.locals, name, 0) : null;
661
- } else {
662
- return mapArray_get(this.attrs, name, 0);
663
- }
664
- }
665
- removeProp(name) {
666
- if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
667
- if (this.locals) {
668
- mapApp_remove(this.locals, name, 0);
669
- }
670
- } else {
671
- mapApp_remove(this.attrs, name, 0);
672
- }
673
- }
674
- addChildVNodeData(child) {
675
- if (!this.childrenVNodeData) {
676
- this.childrenVNodeData = [];
677
- }
678
- this.childrenVNodeData.push(child);
679
- }
680
- toString() {
681
- let stringifiedAttrs = "";
682
- for (let i = 0; i < this.attrs.length; i += 2) {
683
- const key = this.attrs[i];
684
- const value = this.attrs[i + 1];
685
- stringifiedAttrs += `${key}=`;
686
- stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
687
- if (i < this.attrs.length - 2) {
688
- stringifiedAttrs += ", ";
689
- }
690
- }
691
- return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
692
- }
693
- };
694
- var DomRef = class {
695
- /** @id is the same id as for SsrNode */
696
- constructor(id) {
697
- this.id = id;
698
- }
699
- };
700
- var SsrComponentFrame = class {
701
- constructor(componentNode) {
702
- this.componentNode = componentNode;
703
- }
704
- slots = [];
705
- projectionDepth = 0;
706
- scopedStyleIds = /* @__PURE__ */ new Set();
707
- projectionScopedStyle = null;
708
- projectionComponentFrame = null;
709
- distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
710
- this.projectionScopedStyle = projectionScopedStyle;
711
- this.projectionComponentFrame = projectionComponentFrame;
712
- if ((0, import_core2._isJSXNode)(children)) {
713
- const slotName = this.getSlotName(children);
714
- mapArray_set(this.slots, slotName, children, 0);
715
- } else if (Array.isArray(children)) {
716
- const defaultSlot = [];
717
- for (let i = 0; i < children.length; i++) {
718
- const child = children[i];
719
- if ((0, import_core2._isJSXNode)(child)) {
720
- const slotName = this.getSlotName(child);
721
- if (slotName === QDefaultSlot) {
722
- defaultSlot.push(child);
723
- } else {
724
- this.updateSlot(slotName, child);
725
- }
726
- } else {
727
- defaultSlot.push(child);
728
- }
729
- }
730
- defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
731
- } else {
732
- mapArray_set(this.slots, QDefaultSlot, children, 0);
733
- }
734
- }
735
- updateSlot(slotName, child) {
736
- let existingSlots = mapArray_get(this.slots, slotName, 0);
737
- if (existingSlots === null) {
738
- existingSlots = child;
739
- } else if (Array.isArray(existingSlots)) {
740
- existingSlots.push(child);
741
- } else {
742
- existingSlots = [existingSlots, child];
743
- }
744
- mapArray_set(this.slots, slotName, existingSlots, 0);
745
- }
746
- getSlotName(jsx2) {
747
- if (jsx2.props[QSlot]) {
748
- return jsx2.props[QSlot];
749
- }
750
- return QDefaultSlot;
751
- }
752
- hasSlot(slotName) {
753
- return mapArray_get(this.slots, slotName, 0) !== null;
754
- }
755
- consumeChildrenForSlot(projectionNode, slotName) {
756
- const children = mapApp_remove(this.slots, slotName, 0);
757
- if (children !== null) {
758
- this.componentNode.setProp(slotName, projectionNode.id);
759
- projectionNode.setProp(QSlotParent, this.componentNode.id);
760
- }
761
- return children;
762
- }
763
- releaseUnclaimedProjections(unclaimedProjections) {
764
- if (this.slots.length) {
765
- unclaimedProjections.push(this);
766
- unclaimedProjections.push(this.projectionScopedStyle);
767
- unclaimedProjections.push.apply(unclaimedProjections, this.slots);
768
- }
769
- }
770
- };
771
-
772
- // packages/qwik/src/server/vnode-data.ts
773
- var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
774
- var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
775
- var EMPTY_ARRAY = [];
776
- function vNodeData_incrementElementCount(vNodeData) {
777
- const length = vNodeData.length;
778
- const lastValue = length > 1 ? vNodeData[length - 1] : 0;
779
- if (lastValue >= 0) {
780
- vNodeData.push(-1);
781
- } else {
782
- vNodeData[length - 1] = lastValue - 1;
783
- }
784
- }
785
- function vNodeData_addTextSize(vNodeData, size) {
786
- const length = vNodeData.length;
787
- const lastValue = length > 1 ? vNodeData[length - 1] : 0;
788
- if (length > 1 && lastValue >= 0) {
789
- vNodeData[0] |= 1 /* TEXT_DATA */;
790
- }
791
- vNodeData.push(size);
792
- if (size == 0) {
793
- vNodeData[0] |= 1 /* TEXT_DATA */;
794
- }
795
- }
796
- function vNodeData_openFragment(vNodeData, attrs) {
797
- vNodeData.push(attrs, OPEN_FRAGMENT);
798
- vNodeData[0] |= 2 /* VIRTUAL_NODE */;
799
- }
800
- function vNodeData_closeFragment(vNodeData) {
801
- vNodeData.push(CLOSE_FRAGMENT);
802
- }
803
- function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
804
- vNodeData[0] |= 4 /* REFERENCE */;
805
- if (vNodeData.length == 1) {
806
- return new SsrNode(
807
- currentComponentNode,
808
- SsrNode.ELEMENT_NODE,
809
- String(depthFirstElementIdx),
810
- EMPTY_ARRAY,
811
- cleanupQueue,
812
- vNodeData
813
- );
814
- } else {
815
- let fragmentAttrs = EMPTY_ARRAY;
816
- const stack2 = [SsrNode.ELEMENT_NODE, -1];
817
- for (let i = 1; i < vNodeData.length; i++) {
818
- const value = vNodeData[i];
819
- if (Array.isArray(value)) {
820
- fragmentAttrs = value;
821
- i++;
822
- stack2[stack2.length - 1]++;
823
- stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
824
- } else if (value === CLOSE_FRAGMENT) {
825
- stack2.pop();
826
- stack2.pop();
827
- fragmentAttrs = EMPTY_ARRAY;
828
- } else if (value < 0) {
829
- const numberOfElements = 0 - value;
830
- stack2[stack2.length - 1] += numberOfElements;
831
- } else {
832
- stack2[stack2.length - 1]++;
833
- }
834
- }
835
- let refId = String(depthFirstElementIdx);
836
- for (let i = 1; i < stack2.length; i += 2) {
837
- const childCount = stack2[i];
838
- if (childCount >= 0) {
839
- refId += encodeAsAlphanumeric(childCount);
840
- }
841
- }
842
- const type = stack2[stack2.length - 2];
843
- return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
844
- }
845
- }
846
- var ALPHANUMERIC = [];
847
- function encodeAsAlphanumeric(value) {
848
- while (ALPHANUMERIC.length <= value) {
849
- let value2 = ALPHANUMERIC.length;
850
- let text = "";
851
- do {
852
- text = String.fromCharCode(
853
- (text.length === 0 ? 65 : 97) + value2 % 26
854
- /* A-Z */
855
- ) + text;
856
- value2 = Math.floor(
857
- value2 / 26
858
- /* A-Z */
859
- );
860
- } while (value2 !== 0);
861
- ALPHANUMERIC.push(text);
862
- }
863
- return ALPHANUMERIC[value];
864
- }
865
-
866
644
  // packages/qwik/src/core/shared/types.ts
867
645
  var DEBUG_TYPE = "q:type";
868
646
  var START = "\x1B[34m";
@@ -950,6 +728,7 @@ var ELEMENT_KEY = "q:key";
950
728
  var ELEMENT_PROPS = "q:props";
951
729
  var ELEMENT_SEQ = "q:seq";
952
730
  var ELEMENT_SEQ_IDX = "q:seqIdx";
731
+ var Q_PREFIX = "q:";
953
732
  var NON_SERIALIZABLE_MARKER_PREFIX = ":";
954
733
  var USE_ON_LOCAL = NON_SERIALIZABLE_MARKER_PREFIX + "on";
955
734
  var USE_ON_LOCAL_SEQ_IDX = NON_SERIALIZABLE_MARKER_PREFIX + "onIdx";
@@ -967,7 +746,7 @@ function setLocale(locale) {
967
746
  }
968
747
 
969
748
  // packages/qwik/src/core/client/vnode.ts
970
- var import_build7 = require("@qwik.dev/core/build");
749
+ var import_build6 = require("@qwik.dev/core/build");
971
750
 
972
751
  // packages/qwik/src/server/utils.ts
973
752
  var import_meta = {};
@@ -996,12 +775,12 @@ function getBuildBase(opts) {
996
775
  return `${import_meta.env.BASE_URL}build/`;
997
776
  }
998
777
  var versions = {
999
- qwik: "2.0.0-alpha.2-dev+58b6f8d",
778
+ qwik: "2.0.0-alpha.4-dev+374e0d6",
1000
779
  qwikDom: "2.1.19"
1001
780
  };
1002
781
 
1003
782
  // packages/qwik/src/server/prefetch-strategy.ts
1004
- var import_build3 = require("@qwik.dev/core/build");
783
+ var import_build2 = require("@qwik.dev/core/build");
1005
784
  function getPrefetchResources(qrls, opts, resolvedManifest) {
1006
785
  if (!resolvedManifest) {
1007
786
  return [];
@@ -1039,7 +818,7 @@ function getAutoPrefetch(qrls, resolvedManifest, buildBase) {
1039
818
  return prefetchResources;
1040
819
  }
1041
820
  function addBundle(manifest, urls, prefetchResources, buildBase, bundleFileName) {
1042
- const url = import_build3.isDev ? bundleFileName : buildBase + bundleFileName;
821
+ const url = import_build2.isDev ? bundleFileName : buildBase + bundleFileName;
1043
822
  let prefetchResource = urls.get(url);
1044
823
  if (!prefetchResource) {
1045
824
  prefetchResource = {
@@ -1063,13 +842,13 @@ var isQrl = (value) => {
1063
842
  };
1064
843
 
1065
844
  // packages/qwik/src/core/shared/utils/flyweight.ts
1066
- var EMPTY_ARRAY2 = [];
845
+ var EMPTY_ARRAY = [];
1067
846
  var EMPTY_OBJ = {};
1068
- Object.freeze(EMPTY_ARRAY2);
847
+ Object.freeze(EMPTY_ARRAY);
1069
848
  Object.freeze(EMPTY_OBJ);
1070
849
 
1071
850
  // packages/qwik/src/core/ssr/ssr-render-jsx.ts
1072
- var import_build6 = require("@qwik.dev/core/build");
851
+ var import_build5 = require("@qwik.dev/core/build");
1073
852
 
1074
853
  // packages/qwik/src/core/shared/jsx/slot.public.ts
1075
854
  var Slot = (props) => {
@@ -1257,8 +1036,11 @@ var Subscriber = class {
1257
1036
  function isSubscriber(value) {
1258
1037
  return value instanceof Subscriber || value instanceof WrappedSignal;
1259
1038
  }
1260
- function clearVNodeEffectDependencies(value) {
1261
- const effects = vnode_getProp(value, QSubscribers, null);
1039
+ function clearVNodeEffectDependencies(container, value) {
1040
+ if (vnode_isElementVNode(value)) {
1041
+ ensureMaterialized(value);
1042
+ }
1043
+ const effects = vnode_getProp(value, QSubscribers, container.$getObjectById$);
1262
1044
  if (!effects) {
1263
1045
  return;
1264
1046
  }
@@ -1286,15 +1068,24 @@ function clearEffects(subscriber, value) {
1286
1068
  return false;
1287
1069
  }
1288
1070
  const effectSubscriptions = subscriber.$effects$;
1289
- if (!effectSubscriptions) {
1290
- return false;
1071
+ const hostElement = subscriber.$hostElement$;
1072
+ if (hostElement && hostElement === value) {
1073
+ subscriber.$hostElement$ = null;
1291
1074
  }
1292
1075
  let subscriptionRemoved = false;
1293
- for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
1294
- const effect = effectSubscriptions[i];
1295
- if (effect[0 /* EFFECT */] === value) {
1296
- effectSubscriptions.splice(i, 1);
1297
- subscriptionRemoved = true;
1076
+ if (effectSubscriptions) {
1077
+ for (let i = effectSubscriptions.length - 1; i >= 0; i--) {
1078
+ const effect = effectSubscriptions[i];
1079
+ if (effect[0 /* EFFECT */] === value) {
1080
+ effectSubscriptions.splice(i, 1);
1081
+ subscriptionRemoved = true;
1082
+ }
1083
+ }
1084
+ }
1085
+ const args = subscriber.$args$;
1086
+ if (args) {
1087
+ for (let i = args.length - 1; i >= 0; i--) {
1088
+ clearEffects(args[i], subscriber);
1298
1089
  }
1299
1090
  }
1300
1091
  return subscriptionRemoved;
@@ -1448,7 +1239,7 @@ var ignoreErrorToPreventNodeFromCrashing = (err) => {
1448
1239
  };
1449
1240
 
1450
1241
  // packages/qwik/src/core/client/vnode-diff.ts
1451
- var import_build5 = require("@qwik.dev/core/build");
1242
+ var import_build4 = require("@qwik.dev/core/build");
1452
1243
 
1453
1244
  // packages/qwik/src/core/client/vnode-namespace.ts
1454
1245
  var isForeignObjectElement = (elementName) => elementName.toLowerCase() === "foreignobject";
@@ -1620,7 +1411,7 @@ function getNewElementNamespaceData(domParentVNode, tagOrVNode) {
1620
1411
  }
1621
1412
 
1622
1413
  // packages/qwik/src/core/shared/component-execution.ts
1623
- var import_build4 = require("@qwik.dev/core/build");
1414
+ var import_build3 = require("@qwik.dev/core/build");
1624
1415
  var executeComponent = (container, renderHost, subscriptionHost, componentQRL, props) => {
1625
1416
  const iCtx = newInvokeContext(container.$locale$, subscriptionHost, void 0, RenderEvent);
1626
1417
  iCtx.$effectSubscriber$ = [subscriptionHost, ":" /* COMPONENT */];
@@ -1656,7 +1447,7 @@ var executeComponent = (container, renderHost, subscriptionHost, componentQRL, p
1656
1447
  }
1657
1448
  }
1658
1449
  if (vnode_isVNode(renderHost)) {
1659
- clearVNodeEffectDependencies(renderHost);
1450
+ clearVNodeEffectDependencies(container, renderHost);
1660
1451
  }
1661
1452
  return componentFn(props);
1662
1453
  },
@@ -1699,7 +1490,7 @@ function addUseOnEvents(jsx2, useOnEvents) {
1699
1490
  if (jsxElement2) {
1700
1491
  addUseOnEvent(jsxElement2, key, useOnEvents[key]);
1701
1492
  }
1702
- } else if (import_build4.isDev) {
1493
+ } else if (import_build3.isDev) {
1703
1494
  logWarn(
1704
1495
  'You are trying to add an event "' + key + '" using `useOn` hook, but a node to which you can add an event is not found. Please make sure that the component has a valid element node. '
1705
1496
  );
@@ -1730,7 +1521,7 @@ function findFirstStringJSX(jsx2) {
1730
1521
  const queue = [jsx2];
1731
1522
  while (queue.length) {
1732
1523
  const jsx3 = queue.shift();
1733
- if (isJSXNode2(jsx3)) {
1524
+ if (isJSXNode(jsx3)) {
1734
1525
  if (typeof jsx3.type === "string") {
1735
1526
  return jsx3;
1736
1527
  }
@@ -1749,7 +1540,7 @@ function findFirstStringJSX(jsx2) {
1749
1540
  return null;
1750
1541
  }
1751
1542
  function addScriptNodeForInvisibleComponents(jsx2) {
1752
- if (isJSXNode2(jsx2)) {
1543
+ if (isJSXNode(jsx2)) {
1753
1544
  const jsxElement = new JSXNodeImpl(
1754
1545
  "script",
1755
1546
  {},
@@ -1848,12 +1639,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1848
1639
  descend(jsxValue, false);
1849
1640
  } else if (isSignal(jsxValue)) {
1850
1641
  if (vCurrent) {
1851
- clearVNodeEffectDependencies(vCurrent);
1642
+ clearVNodeEffectDependencies(container, vCurrent);
1852
1643
  }
1853
1644
  expectVirtual("S" /* WrappedSignal */, null);
1854
1645
  descend(
1855
- trackSignal(
1856
- () => jsxValue.value,
1646
+ trackSignalAndAssignHost(
1647
+ jsxValue,
1857
1648
  vNewNode || vCurrent,
1858
1649
  "." /* VNODE */,
1859
1650
  container
@@ -1863,7 +1654,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1863
1654
  } else if (isPromise(jsxValue)) {
1864
1655
  expectVirtual("A" /* Awaited */, null);
1865
1656
  asyncQueue.push(jsxValue, vNewNode || vCurrent);
1866
- } else if (isJSXNode2(jsxValue)) {
1657
+ } else if (isJSXNode(jsxValue)) {
1867
1658
  const type = jsxValue.type;
1868
1659
  if (typeof type === "string") {
1869
1660
  expectNoMoreTextNodes();
@@ -1999,46 +1790,45 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
1999
1790
  }
2000
1791
  }
2001
1792
  function descendContentToProject(children, host) {
2002
- if (!Array.isArray(children)) {
2003
- children = [children];
2004
- }
2005
- if (children.length) {
2006
- const createProjectionJSXNode = (slotName) => {
2007
- return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
2008
- };
2009
- const projections = [];
2010
- if (host) {
2011
- for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
2012
- const prop = host[i];
2013
- if (isSlotProp(prop)) {
2014
- const slotName = prop;
2015
- projections.push(slotName);
2016
- projections.push(createProjectionJSXNode(slotName));
2017
- }
1793
+ const projectionChildren = Array.isArray(children) ? children : [children];
1794
+ const createProjectionJSXNode = (slotName) => {
1795
+ return new JSXNodeImpl(Projection, EMPTY_OBJ, null, [], 0, slotName);
1796
+ };
1797
+ const projections = [];
1798
+ if (host) {
1799
+ for (let i = vnode_getPropStartIndex(host); i < host.length; i = i + 2) {
1800
+ const prop = host[i];
1801
+ if (isSlotProp(prop)) {
1802
+ const slotName = prop;
1803
+ projections.push(slotName);
1804
+ projections.push(createProjectionJSXNode(slotName));
2018
1805
  }
2019
1806
  }
2020
- for (let i = 0; i < children.length; i++) {
2021
- const child = children[i];
2022
- const slotName = String(
2023
- isJSXNode2(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
2024
- );
2025
- const idx = mapApp_findIndx(projections, slotName, 0);
2026
- let jsxBucket;
2027
- if (idx >= 0) {
2028
- jsxBucket = projections[idx + 1];
2029
- } else {
2030
- projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
2031
- }
2032
- const removeProjection = child === false;
2033
- if (!removeProjection) {
2034
- jsxBucket.children.push(child);
2035
- }
1807
+ }
1808
+ if (projections.length === 0 && children == null) {
1809
+ return;
1810
+ }
1811
+ for (let i = 0; i < projectionChildren.length; i++) {
1812
+ const child = projectionChildren[i];
1813
+ const slotName = String(
1814
+ isJSXNode(child) && directGetPropsProxyProp(child, QSlot) || QDefaultSlot
1815
+ );
1816
+ const idx = mapApp_findIndx(projections, slotName, 0);
1817
+ let jsxBucket;
1818
+ if (idx >= 0) {
1819
+ jsxBucket = projections[idx + 1];
1820
+ } else {
1821
+ projections.splice(~idx, 0, slotName, jsxBucket = createProjectionJSXNode(slotName));
2036
1822
  }
2037
- for (let i = projections.length - 2; i >= 0; i = i - 2) {
2038
- projections.splice(i, 1);
1823
+ const removeProjection = child === false;
1824
+ if (!removeProjection) {
1825
+ jsxBucket.children.push(child);
2039
1826
  }
2040
- descend(projections, true);
2041
1827
  }
1828
+ for (let i = projections.length - 2; i >= 0; i = i - 2) {
1829
+ projections.splice(i, 1);
1830
+ }
1831
+ descend(projections, true);
2042
1832
  }
2043
1833
  function expectProjection() {
2044
1834
  const jsxNode2 = jsxValue;
@@ -2051,8 +1841,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2051
1841
  );
2052
1842
  if (vCurrent == null) {
2053
1843
  vNewNode = vnode_newVirtual();
2054
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2055
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
1844
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1845
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectProjection");
2056
1846
  vnode_setProp(vNewNode, QSlot, slotName);
2057
1847
  vnode_setProp(vNewNode, QSlotParent, vParent);
2058
1848
  vnode_setProp(vParent, slotName, vNewNode);
@@ -2078,8 +1868,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2078
1868
  );
2079
1869
  vnode_setProp(vNewNode, QSlot, slotNameKey);
2080
1870
  vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
2081
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2082
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
1871
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1872
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
2083
1873
  return false;
2084
1874
  } else if (vProjectedNode === vCurrent) {
2085
1875
  } else {
@@ -2091,8 +1881,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2091
1881
  );
2092
1882
  vnode_setProp(vNewNode, QSlot, slotNameKey);
2093
1883
  vHost && vnode_setProp(vHost, slotNameKey, vNewNode);
2094
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
2095
- import_build5.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
1884
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "P" /* Projection */);
1885
+ import_build4.isDev && vnode_setProp(vNewNode, "q:code", "expectSlot" + count++);
2096
1886
  }
2097
1887
  return true;
2098
1888
  }
@@ -2102,7 +1892,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2102
1892
  if (constProps && typeof constProps == "object" && "name" in constProps) {
2103
1893
  const constValue = constProps.name;
2104
1894
  if (vHost && constValue instanceof WrappedSignal) {
2105
- return trackSignal(() => constValue.value, vHost, ":" /* COMPONENT */, container);
1895
+ return trackSignalAndAssignHost(constValue, vHost, ":" /* COMPONENT */, container);
2106
1896
  }
2107
1897
  }
2108
1898
  return directGetPropsProxyProp(jsxNode2, "name") || QDefaultSlot;
@@ -2184,12 +1974,12 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2184
1974
  }
2185
1975
  }
2186
1976
  if (isSignal(value)) {
2187
- const signalData = new EffectData({
1977
+ const signalData = new EffectPropData({
2188
1978
  $scopedStyleIdPrefix$: scopedStyleIdPrefix,
2189
1979
  $isConst$: true
2190
1980
  });
2191
- value = trackSignal(
2192
- () => value.value,
1981
+ value = trackSignalAndAssignHost(
1982
+ value,
2193
1983
  vNewNode,
2194
1984
  key2,
2195
1985
  container,
@@ -2203,8 +1993,8 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2203
1993
  }
2204
1994
  if (elementName === "textarea" && key2 === "value") {
2205
1995
  if (typeof value !== "string") {
2206
- if (import_build5.isDev) {
2207
- throwErrorAndStop("The value of the textarea must be a string");
1996
+ if (import_build4.isDev) {
1997
+ throw qError(40 /* wrongTextareaValue */);
2208
1998
  }
2209
1999
  continue;
2210
2000
  }
@@ -2336,7 +2126,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2336
2126
  }
2337
2127
  };
2338
2128
  while (srcKey !== null || dstKey !== null) {
2339
- if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || dstKey == ELEMENT_KEY) {
2129
+ if ((dstKey == null ? void 0 : dstKey.startsWith(HANDLER_PREFIX)) || (dstKey == null ? void 0 : dstKey.startsWith(Q_PREFIX))) {
2340
2130
  dstIdx++;
2341
2131
  dstKey = dstIdx < dstLength ? dstAttrs[dstIdx++] : null;
2342
2132
  } else if (srcKey == null) {
@@ -2447,7 +2237,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2447
2237
  vCurrent && getInsertBefore()
2448
2238
  );
2449
2239
  vnode_setProp(vNewNode, ELEMENT_KEY, jsxKey);
2450
- import_build5.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
2240
+ import_build4.isDev && vnode_setProp(vNewNode || vCurrent, DEBUG_TYPE, type);
2451
2241
  }
2452
2242
  function expectComponent(component) {
2453
2243
  const componentMeta = component[SERIALIZABLE_STATE];
@@ -2490,7 +2280,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2490
2280
  container.$scheduler$(7 /* COMPONENT */, host, componentQRL, jsxProps);
2491
2281
  }
2492
2282
  }
2493
- jsxNode2.children != null && descendContentToProject(jsxNode2.children, host);
2283
+ descendContentToProject(jsxNode2.children, host);
2494
2284
  } else {
2495
2285
  const lookupKey = jsxNode2.key;
2496
2286
  const vNodeLookupKey = getKey(host);
@@ -2522,7 +2312,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2522
2312
  }
2523
2313
  function insertNewComponent(host, componentQRL, jsxProps) {
2524
2314
  if (host) {
2525
- clearVNodeEffectDependencies(host);
2315
+ clearVNodeEffectDependencies(container, host);
2526
2316
  }
2527
2317
  vnode_insertBefore(
2528
2318
  journal,
@@ -2531,7 +2321,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2531
2321
  vCurrent && getInsertBefore()
2532
2322
  );
2533
2323
  const jsxNode2 = jsxValue;
2534
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
2324
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "C" /* Component */);
2535
2325
  container.setHostProp(vNewNode, OnRenderProp, componentQRL);
2536
2326
  container.setHostProp(vNewNode, ELEMENT_PROPS, jsxProps);
2537
2327
  container.setHostProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
@@ -2544,7 +2334,7 @@ var vnode_diff = (container, jsxNode, vStartNode, scopedStyleIdPrefix) => {
2544
2334
  vCurrent && getInsertBefore()
2545
2335
  );
2546
2336
  const jsxNode2 = jsxValue;
2547
- import_build5.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
2337
+ import_build4.isDev && vnode_setProp(vNewNode, DEBUG_TYPE, "I" /* InlineComponent */);
2548
2338
  vnode_setProp(vNewNode, ELEMENT_PROPS, jsxNode2.props);
2549
2339
  if (jsxNode2.key) {
2550
2340
  vnode_setProp(vNewNode, ELEMENT_KEY, jsxNode2.key);
@@ -2588,8 +2378,8 @@ function propsDiffer(src, dst) {
2588
2378
  if (!src || !dst) {
2589
2379
  return true;
2590
2380
  }
2591
- let srcKeys = removeChildrenKey(Object.keys(src));
2592
- let dstKeys = removeChildrenKey(Object.keys(dst));
2381
+ let srcKeys = removePropsKeys(Object.keys(src), ["children", QSubscribers]);
2382
+ let dstKeys = removePropsKeys(Object.keys(dst), ["children", QSubscribers]);
2593
2383
  if (srcKeys.length !== dstKeys.length) {
2594
2384
  return true;
2595
2385
  }
@@ -2604,10 +2394,13 @@ function propsDiffer(src, dst) {
2604
2394
  }
2605
2395
  return false;
2606
2396
  }
2607
- function removeChildrenKey(keys) {
2608
- const childrenIdx = keys.indexOf("children");
2609
- if (childrenIdx !== -1) {
2610
- keys.splice(childrenIdx, 1);
2397
+ function removePropsKeys(keys, propKeys) {
2398
+ for (let i = propKeys.length - 1; i >= 0; i--) {
2399
+ const propKey = propKeys[i];
2400
+ const propIdx = keys.indexOf(propKey);
2401
+ if (propIdx !== -1) {
2402
+ keys.splice(propIdx, 1);
2403
+ }
2611
2404
  }
2612
2405
  return keys;
2613
2406
  }
@@ -2620,9 +2413,9 @@ function cleanup(container, vNode) {
2620
2413
  do {
2621
2414
  const type = vCursor[0 /* flags */];
2622
2415
  if (type & 3 /* ELEMENT_OR_VIRTUAL_MASK */) {
2416
+ clearVNodeEffectDependencies(container, vCursor);
2417
+ markVNodeAsDeleted(vCursor);
2623
2418
  if (type & 2 /* Virtual */) {
2624
- clearVNodeEffectDependencies(vCursor);
2625
- markVNodeAsDeleted(vCursor);
2626
2419
  const seq = container.getHostProp(vCursor, ELEMENT_SEQ);
2627
2420
  if (seq) {
2628
2421
  for (let i = 0; i < seq.length; i++) {
@@ -2631,7 +2424,7 @@ function cleanup(container, vNode) {
2631
2424
  const task = obj;
2632
2425
  clearSubscriberEffectDependencies(task);
2633
2426
  if (task.$flags$ & 1 /* VISIBLE_TASK */) {
2634
- container.$scheduler$(80 /* CLEANUP_VISIBLE */, task);
2427
+ container.$scheduler$(48 /* CLEANUP_VISIBLE */, task);
2635
2428
  } else {
2636
2429
  cleanupTask(task);
2637
2430
  }
@@ -2722,8 +2515,8 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2722
2515
  let journalFlushScheduled = false;
2723
2516
  return schedule;
2724
2517
  function schedule(type, hostOrTask = null, targetOrQrl = null, payload = null) {
2725
- const runLater = type !== 127 /* WAIT_FOR_ALL */ && type !== 16 /* WAIT_FOR_COMPONENTS */ && type !== 6 /* COMPONENT_SSR */;
2726
- const isTask2 = type === 3 /* TASK */ || type === 64 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 80 /* CLEANUP_VISIBLE */;
2518
+ const runLater = type !== 255 /* WAIT_FOR_ALL */ && type !== 6 /* COMPONENT_SSR */;
2519
+ const isTask2 = type === 3 /* TASK */ || type === 32 /* VISIBLE */ || type === 2 /* RESOURCE */ || type === 48 /* CLEANUP_VISIBLE */;
2727
2520
  if (isTask2) {
2728
2521
  hostOrTask.$flags$ |= 8 /* DIRTY */;
2729
2522
  }
@@ -2743,7 +2536,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2743
2536
  chore = sortedInsert(choreQueue, chore);
2744
2537
  if (!journalFlushScheduled && runLater) {
2745
2538
  journalFlushScheduled = true;
2746
- schedule(48 /* JOURNAL_FLUSH */);
2539
+ schedule(16 /* JOURNAL_FLUSH */);
2747
2540
  scheduleDrain();
2748
2541
  }
2749
2542
  if (runLater) {
@@ -2770,7 +2563,7 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2770
2563
  }
2771
2564
  const isDeletedVNode = vNodeAlreadyDeleted(nextChore);
2772
2565
  if (isDeletedVNode && // we need to process cleanup tasks for deleted nodes
2773
- nextChore.$type$ !== 80 /* CLEANUP_VISIBLE */) {
2566
+ nextChore.$type$ !== 48 /* CLEANUP_VISIBLE */) {
2774
2567
  DEBUG2 && debugTrace("skip chore", nextChore, currentChore, choreQueue);
2775
2568
  continue;
2776
2569
  }
@@ -2783,13 +2576,14 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2783
2576
  return runUptoChore.$returnValue$;
2784
2577
  }
2785
2578
  function executeChore(chore) {
2579
+ var _a;
2786
2580
  const host = chore.$host$;
2787
2581
  DEBUG2 && debugTrace("execute", chore, currentChore, choreQueue);
2788
2582
  assertEqual(currentChore, null, "Chore already running.");
2789
2583
  currentChore = chore;
2790
2584
  let returnValue = null;
2791
2585
  switch (chore.$type$) {
2792
- case 48 /* JOURNAL_FLUSH */:
2586
+ case 16 /* JOURNAL_FLUSH */:
2793
2587
  returnValue = journalFlush();
2794
2588
  journalFlushScheduled = false;
2795
2589
  break;
@@ -2804,7 +2598,17 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2804
2598
  chore.$payload$
2805
2599
  ),
2806
2600
  (jsx3) => {
2807
- return chore.$type$ === 7 /* COMPONENT */ ? maybeThen(container.processJsx(host, jsx3), () => jsx3) : jsx3;
2601
+ if (chore.$type$ === 7 /* COMPONENT */) {
2602
+ const styleScopedId = container.getHostProp(host, QScopedStyle);
2603
+ return vnode_diff(
2604
+ container,
2605
+ jsx3,
2606
+ host,
2607
+ addComponentStylePrefix(styleScopedId)
2608
+ );
2609
+ } else {
2610
+ return jsx3;
2611
+ }
2808
2612
  },
2809
2613
  (err) => container.handleError(err, host)
2810
2614
  );
@@ -2816,10 +2620,10 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2816
2620
  case 3 /* TASK */:
2817
2621
  returnValue = runTask(chore.$payload$, container, host);
2818
2622
  break;
2819
- case 64 /* VISIBLE */:
2623
+ case 32 /* VISIBLE */:
2820
2624
  returnValue = runTask(chore.$payload$, container, host);
2821
2625
  break;
2822
- case 80 /* CLEANUP_VISIBLE */:
2626
+ case 48 /* CLEANUP_VISIBLE */:
2823
2627
  const task = chore.$payload$;
2824
2628
  cleanupTask(task);
2825
2629
  break;
@@ -2854,13 +2658,27 @@ var createScheduler = (container, scheduleDrain, journalFlush) => {
2854
2658
  returnValue = !target.resolved ? target.resolve() : null;
2855
2659
  break;
2856
2660
  }
2661
+ case 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */: {
2662
+ const target = chore.$target$;
2663
+ const forceRunEffects = target.$forceRunEffects$;
2664
+ target.$forceRunEffects$ = false;
2665
+ if (!((_a = target.$effects$) == null ? void 0 : _a.length)) {
2666
+ break;
2667
+ }
2668
+ returnValue = retryOnPromise(() => {
2669
+ if (target.$computeIfNeeded$() || forceRunEffects) {
2670
+ triggerEffects(container, target, target.$effects$);
2671
+ }
2672
+ });
2673
+ break;
2674
+ }
2857
2675
  }
2858
2676
  return maybeThenPassError(returnValue, (value) => {
2859
- var _a;
2677
+ var _a2;
2860
2678
  DEBUG2 && debugTrace("execute.DONE", null, currentChore, choreQueue);
2861
2679
  if (currentChore) {
2862
2680
  currentChore.$executed$ = true;
2863
- (_a = currentChore.$resolve$) == null ? void 0 : _a.call(currentChore, value);
2681
+ (_a2 = currentChore.$resolve$) == null ? void 0 : _a2.call(currentChore, value);
2864
2682
  }
2865
2683
  currentChore = null;
2866
2684
  return chore.$returnValue$ = value;
@@ -2879,11 +2697,11 @@ function vNodeAlreadyDeleted(chore) {
2879
2697
  return !!(chore.$host$ && vnode_isVNode(chore.$host$) && chore.$host$[0 /* flags */] & 32 /* Deleted */);
2880
2698
  }
2881
2699
  function choreComparator(a, b, shouldThrowOnHostMismatch) {
2882
- const macroTypeDiff = (a.$type$ & 112 /* MACRO */) - (b.$type$ & 112 /* MACRO */);
2700
+ const macroTypeDiff = (a.$type$ & 240 /* MACRO */) - (b.$type$ & 240 /* MACRO */);
2883
2701
  if (macroTypeDiff !== 0) {
2884
2702
  return macroTypeDiff;
2885
2703
  }
2886
- if (a.$type$ !== 48 /* JOURNAL_FLUSH */) {
2704
+ if (a.$type$ !== 16 /* JOURNAL_FLUSH */) {
2887
2705
  const aHost = a.$host$;
2888
2706
  const bHost = b.$host$;
2889
2707
  if (aHost !== bHost && aHost !== null && bHost !== null) {
@@ -2898,7 +2716,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2898
2716
  This can lead to inconsistencies between Server-Side Rendering (SSR) and Client-Side Rendering (CSR).
2899
2717
  Problematic Node: ${aHost.toString()}`;
2900
2718
  if (shouldThrowOnHostMismatch) {
2901
- throwErrorAndStop(errorMessage);
2719
+ throw qError(45 /* serverHostMismatch */, [errorMessage]);
2902
2720
  }
2903
2721
  logWarn(errorMessage);
2904
2722
  return null;
@@ -2912,7 +2730,7 @@ function choreComparator(a, b, shouldThrowOnHostMismatch) {
2912
2730
  if (idxDiff !== 0) {
2913
2731
  return idxDiff;
2914
2732
  }
2915
- if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */)) {
2733
+ if (a.$target$ !== b.$target$ && (a.$type$ === 1 /* QRL_RESOLVE */ && b.$type$ === 1 /* QRL_RESOLVE */ || a.$type$ === 5 /* NODE_PROP */ && b.$type$ === 5 /* NODE_PROP */ || a.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */ && b.$type$ === 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */)) {
2916
2734
  return 1;
2917
2735
  }
2918
2736
  }
@@ -2955,11 +2773,11 @@ function debugChoreToString(chore) {
2955
2773
  [5 /* NODE_PROP */]: "NODE_PROP",
2956
2774
  [7 /* COMPONENT */]: "COMPONENT",
2957
2775
  [6 /* COMPONENT_SSR */]: "COMPONENT_SSR",
2958
- [48 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
2959
- [64 /* VISIBLE */]: "VISIBLE",
2960
- [80 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
2961
- [127 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL",
2962
- [16 /* WAIT_FOR_COMPONENTS */]: "WAIT_FOR_COMPONENTS"
2776
+ [8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */]: "RECOMPUTE_SIGNAL",
2777
+ [16 /* JOURNAL_FLUSH */]: "JOURNAL_FLUSH",
2778
+ [32 /* VISIBLE */]: "VISIBLE",
2779
+ [48 /* CLEANUP_VISIBLE */]: "CLEANUP_VISIBLE",
2780
+ [255 /* WAIT_FOR_ALL */]: "WAIT_FOR_ALL"
2963
2781
  }[chore.$type$] || "UNKNOWN: " + chore.$type$;
2964
2782
  const host = String(chore.$host$).replaceAll(/\n.*/gim, "");
2965
2783
  const qrlTarget = (_a = chore.$target$) == null ? void 0 : _a.$symbol$;
@@ -3082,7 +2900,7 @@ var throwIfQRLNotResolved = (qrl) => {
3082
2900
  var isSignal = (value) => {
3083
2901
  return value instanceof Signal;
3084
2902
  };
3085
- var EffectData = class {
2903
+ var EffectPropData = class {
3086
2904
  data;
3087
2905
  constructor(data) {
3088
2906
  this.data = data;
@@ -3146,7 +2964,7 @@ var Signal = class {
3146
2964
  // prevent accidental use as value
3147
2965
  valueOf() {
3148
2966
  if (qDev) {
3149
- return throwErrorAndStop("Cannot coerce a Signal, use `.value` instead");
2967
+ throw qError(46 /* cannotCoerceSignal */);
3150
2968
  }
3151
2969
  }
3152
2970
  toString() {
@@ -3179,7 +2997,7 @@ var ensureEffectContainsSubscriber = (effect, subscriber, container) => {
3179
2997
  return;
3180
2998
  }
3181
2999
  effect.$effectDependencies$.push(subscriber);
3182
- } else if (vnode_isVNode(effect) && vnode_isVirtualVNode(effect)) {
3000
+ } else if (vnode_isVNode(effect) && !vnode_isTextVNode(effect)) {
3183
3001
  let subscribers = vnode_getProp(
3184
3002
  effect,
3185
3003
  QSubscribers,
@@ -3223,7 +3041,7 @@ var triggerEffects = (container, signal, effects) => {
3223
3041
  DEBUG3 && log2("schedule.effect.task", pad("\n" + String(effect), " "));
3224
3042
  let choreType = 3 /* TASK */;
3225
3043
  if (effect.$flags$ & 1 /* VISIBLE_TASK */) {
3226
- choreType = 64 /* VISIBLE */;
3044
+ choreType = 32 /* VISIBLE */;
3227
3045
  } else if (effect.$flags$ & 4 /* RESOURCE */) {
3228
3046
  choreType = 2 /* RESOURCE */;
3229
3047
  }
@@ -3234,13 +3052,7 @@ var triggerEffects = (container, signal, effects) => {
3234
3052
  container.$scheduler$(1 /* QRL_RESOLVE */, null, effect.$computeQrl$);
3235
3053
  }
3236
3054
  }
3237
- try {
3238
- retryOnPromise(
3239
- () => effect.$invalidate$()
3240
- );
3241
- } catch (e) {
3242
- logError(e);
3243
- }
3055
+ effect.$invalidate$();
3244
3056
  } else if (property === ":" /* COMPONENT */) {
3245
3057
  const host = effect;
3246
3058
  const qrl = container.getHostProp(host, OnRenderProp);
@@ -3253,9 +3065,8 @@ var triggerEffects = (container, signal, effects) => {
3253
3065
  container.$scheduler$(4 /* NODE_DIFF */, host, target, signal);
3254
3066
  } else {
3255
3067
  const host = effect;
3256
- let effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
3257
- if (effectData instanceof EffectData) {
3258
- effectData = effectData;
3068
+ const effectData = effectSubscriptions[2 /* FIRST_BACK_REF_OR_DATA */];
3069
+ if (effectData instanceof EffectPropData) {
3259
3070
  const data = effectData.data;
3260
3071
  const payload = {
3261
3072
  ...data,
@@ -3280,6 +3091,7 @@ var ComputedSignal = class extends Signal {
3280
3091
  // We need a separate flag to know when the computation needs running because
3281
3092
  // we need the old value to know if effects need running after computation
3282
3093
  $invalid$ = true;
3094
+ $forceRunEffects$ = false;
3283
3095
  constructor(container, fn) {
3284
3096
  super(container, NEEDS_COMPUTATION);
3285
3097
  this.$computeQrl$ = fn;
@@ -3287,12 +3099,8 @@ var ComputedSignal = class extends Signal {
3287
3099
  $invalidate$() {
3288
3100
  var _a;
3289
3101
  this.$invalid$ = true;
3290
- if (!((_a = this.$effects$) == null ? void 0 : _a.length)) {
3291
- return;
3292
- }
3293
- if (this.$computeIfNeeded$()) {
3294
- triggerEffects(this.$container$, this, this.$effects$);
3295
- }
3102
+ this.$forceRunEffects$ = false;
3103
+ (_a = this.$container$) == null ? void 0 : _a.$scheduler$(8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */, null, this);
3296
3104
  }
3297
3105
  /**
3298
3106
  * Use this to force running subscribers, for example when the calculated value has mutated but
@@ -3300,10 +3108,14 @@ var ComputedSignal = class extends Signal {
3300
3108
  */
3301
3109
  force() {
3302
3110
  this.$invalid$ = true;
3111
+ this.$forceRunEffects$ = false;
3303
3112
  triggerEffects(this.$container$, this, this.$effects$);
3304
3113
  }
3305
3114
  get untrackedValue() {
3306
- this.$computeIfNeeded$();
3115
+ const didChange = this.$computeIfNeeded$();
3116
+ if (didChange) {
3117
+ this.$forceRunEffects$ = didChange;
3118
+ }
3307
3119
  assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
3308
3120
  return this.$untrackedValue$;
3309
3121
  }
@@ -3319,9 +3131,10 @@ var ComputedSignal = class extends Signal {
3319
3131
  try {
3320
3132
  const untrackedValue = computeQrl.getFn(ctx)();
3321
3133
  if (isPromise(untrackedValue)) {
3322
- throwErrorAndStop(
3323
- `useComputedSignal$ QRL ${computeQrl.dev ? `${computeQrl.dev.file} ` : ""}${computeQrl.$hash$} returned a Promise`
3324
- );
3134
+ throw qError(47 /* computedNotSync */, [
3135
+ computeQrl.dev ? computeQrl.dev.file : "",
3136
+ computeQrl.$hash$
3137
+ ]);
3325
3138
  }
3326
3139
  DEBUG3 && log2("Signal.$compute$", untrackedValue);
3327
3140
  this.$invalid$ = false;
@@ -3341,7 +3154,7 @@ var ComputedSignal = class extends Signal {
3341
3154
  return super.value;
3342
3155
  }
3343
3156
  set value(_) {
3344
- throwErrorAndStop("ComputedSignal is read-only");
3157
+ throw qError(48 /* computedReadOnly */);
3345
3158
  }
3346
3159
  };
3347
3160
  var WrappedSignal = class extends Signal {
@@ -3352,6 +3165,8 @@ var WrappedSignal = class extends Signal {
3352
3165
  // we need the old value to know if effects need running after computation
3353
3166
  $invalid$ = true;
3354
3167
  $effectDependencies$ = null;
3168
+ $hostElement$ = null;
3169
+ $forceRunEffects$ = false;
3355
3170
  constructor(container, fn, args, fnStr) {
3356
3171
  super(container, NEEDS_COMPUTATION);
3357
3172
  this.$args$ = args;
@@ -3361,12 +3176,12 @@ var WrappedSignal = class extends Signal {
3361
3176
  $invalidate$() {
3362
3177
  var _a;
3363
3178
  this.$invalid$ = true;
3364
- if (!((_a = this.$effects$) == null ? void 0 : _a.length)) {
3365
- return;
3366
- }
3367
- if (this.$computeIfNeeded$()) {
3368
- triggerEffects(this.$container$, this, this.$effects$);
3369
- }
3179
+ this.$forceRunEffects$ = false;
3180
+ (_a = this.$container$) == null ? void 0 : _a.$scheduler$(
3181
+ 8 /* RECOMPUTE_AND_SCHEDULE_EFFECTS */,
3182
+ this.$hostElement$,
3183
+ this
3184
+ );
3370
3185
  }
3371
3186
  /**
3372
3187
  * Use this to force running subscribers, for example when the calculated value has mutated but
@@ -3374,10 +3189,14 @@ var WrappedSignal = class extends Signal {
3374
3189
  */
3375
3190
  force() {
3376
3191
  this.$invalid$ = true;
3192
+ this.$forceRunEffects$ = false;
3377
3193
  triggerEffects(this.$container$, this, this.$effects$);
3378
3194
  }
3379
3195
  get untrackedValue() {
3380
- this.$computeIfNeeded$();
3196
+ const didChange = this.$computeIfNeeded$();
3197
+ if (didChange) {
3198
+ this.$forceRunEffects$ = didChange;
3199
+ }
3381
3200
  assertFalse(this.$untrackedValue$ === NEEDS_COMPUTATION, "Invalid state");
3382
3201
  return this.$untrackedValue$;
3383
3202
  }
@@ -3402,12 +3221,12 @@ var WrappedSignal = class extends Signal {
3402
3221
  return super.value;
3403
3222
  }
3404
3223
  set value(_) {
3405
- throwErrorAndStop("WrappedSignal is read-only");
3224
+ throw qError(49 /* wrappedReadOnly */);
3406
3225
  }
3407
3226
  };
3408
3227
 
3409
3228
  // packages/qwik/src/core/version.ts
3410
- var version = "2.0.0-alpha.2-dev+58b6f8d";
3229
+ var version = "2.0.0-alpha.4-dev+374e0d6";
3411
3230
 
3412
3231
  // packages/qwik/src/core/shared/shared-container.ts
3413
3232
  var _SharedContainer = class {
@@ -3432,7 +3251,7 @@ var _SharedContainer = class {
3432
3251
  this.$scheduler$ = createScheduler(this, scheduleDrain, journalFlush);
3433
3252
  }
3434
3253
  trackSignalValue(signal, subscriber, property, data) {
3435
- return trackSignal(() => signal.value, subscriber, property, this, data);
3254
+ return trackSignalAndAssignHost(signal, subscriber, property, this, data);
3436
3255
  }
3437
3256
  serializationCtxFactory(NodeConstructor, DomRefConstructor, symbolToChunkResolver, writer, prepVNodeData) {
3438
3257
  return createSerializationContext(
@@ -3554,7 +3373,7 @@ var JSXNodeImpl = class {
3554
3373
  }
3555
3374
  };
3556
3375
  var Virtual = (props) => props.children;
3557
- var isJSXNode2 = (n) => {
3376
+ var isJSXNode = (n) => {
3558
3377
  if (qDev) {
3559
3378
  if (n instanceof JSXNodeImpl) {
3560
3379
  return true;
@@ -3690,7 +3509,7 @@ function qwikDebugToString(value) {
3690
3509
  }
3691
3510
  } else if (isStore(value)) {
3692
3511
  return "Store";
3693
- } else if (isJSXNode2(value)) {
3512
+ } else if (isJSXNode(value)) {
3694
3513
  return jsxToString(value);
3695
3514
  }
3696
3515
  } finally {
@@ -3703,7 +3522,7 @@ var pad = (text, prefix) => {
3703
3522
  return String(text).split("\n").map((line, idx) => (idx ? prefix : "") + line).join("\n");
3704
3523
  };
3705
3524
  var jsxToString = (value) => {
3706
- if (isJSXNode2(value)) {
3525
+ if (isJSXNode(value)) {
3707
3526
  let type = value.type;
3708
3527
  if (typeof type === "function") {
3709
3528
  type = type.name || "Component";
@@ -3892,7 +3711,7 @@ var VNodeDataChar = {
3892
3711
  /* ************** */
3893
3712
  123
3894
3713
  ),
3895
- // `{` is the start of the VNodeData.
3714
+ // `{` is the start of the VNodeData for a virtual element.
3896
3715
  OPEN_CHAR: (
3897
3716
  /* ****** */
3898
3717
  "{"
@@ -3901,7 +3720,7 @@ var VNodeDataChar = {
3901
3720
  /* ************* */
3902
3721
  125
3903
3722
  ),
3904
- // `}` is the end of the VNodeData.
3723
+ // `}` is the end of the VNodeData for a virtual element.
3905
3724
  CLOSE_CHAR: (
3906
3725
  /* ***** */
3907
3726
  "}"
@@ -3971,7 +3790,7 @@ var VNodeDataChar = {
3971
3790
  ),
3972
3791
  DON_T_USE: (
3973
3792
  /* ********** */
3974
- 93
3793
+ 92
3975
3794
  ),
3976
3795
  // `\` - SKIP because `\` is used as escaping
3977
3796
  DON_T_USE_CHAR: "\\",
@@ -3993,6 +3812,15 @@ var VNodeDataChar = {
3993
3812
  /* **** */
3994
3813
  "^"
3995
3814
  ),
3815
+ SUBS: (
3816
+ /* *************** */
3817
+ 96
3818
+ ),
3819
+ // '`' - `q:subs' - Effect dependencies/subscriptions
3820
+ SUBS_CHAR: (
3821
+ /* ******* */
3822
+ "`"
3823
+ ),
3996
3824
  SEPARATOR: (
3997
3825
  /* ********* */
3998
3826
  124
@@ -4714,9 +4542,32 @@ var vnode_materialize = (vNode) => {
4714
4542
  const element = vNode[6 /* element */];
4715
4543
  const firstChild = fastFirstChild(element);
4716
4544
  const vNodeData = (_b = (_a = element.ownerDocument) == null ? void 0 : _a.qVNodeData) == null ? void 0 : _b.get(element);
4717
- const vFirstChild = vNodeData ? materializeFromVNodeData(vNode, vNodeData, element, firstChild) : materializeFromDOM(vNode, firstChild);
4545
+ const vFirstChild = materialize(vNode, element, firstChild, vNodeData);
4718
4546
  return vFirstChild;
4719
4547
  };
4548
+ var materialize = (vNode, element, firstChild, vNodeData) => {
4549
+ if (vNodeData) {
4550
+ if (vNodeData.charCodeAt(0) === VNodeDataChar.SEPARATOR) {
4551
+ const elementVNodeDataStartIdx = 1;
4552
+ let elementVNodeDataEndIdx = 1;
4553
+ while (vNodeData.charCodeAt(elementVNodeDataEndIdx) !== VNodeDataChar.SEPARATOR) {
4554
+ elementVNodeDataEndIdx++;
4555
+ }
4556
+ const elementVNodeData = vNodeData.substring(
4557
+ elementVNodeDataStartIdx,
4558
+ elementVNodeDataEndIdx
4559
+ );
4560
+ vNodeData = vNodeData.substring(elementVNodeDataEndIdx + 1);
4561
+ const vFirstChild = materializeFromDOM(vNode, firstChild, elementVNodeData);
4562
+ if (!vNodeData) {
4563
+ return vFirstChild;
4564
+ }
4565
+ }
4566
+ return materializeFromVNodeData(vNode, vNodeData, element, firstChild);
4567
+ } else {
4568
+ return materializeFromDOM(vNode, firstChild);
4569
+ }
4570
+ };
4720
4571
  var ensureMaterialized = (vnode) => {
4721
4572
  const vParent = ensureElementVNode(vnode);
4722
4573
  let vFirstChild = vParent[4 /* firstChild */];
@@ -4841,7 +4692,7 @@ var fastGetter = (prototype, name) => {
4841
4692
  var isQStyleElement = (node) => {
4842
4693
  return isElement(node) && node.nodeName === "STYLE" && (node.hasAttribute(QScopedStyle) || node.hasAttribute(QStyle));
4843
4694
  };
4844
- var materializeFromDOM = (vParent, firstChild) => {
4695
+ var materializeFromDOM = (vParent, firstChild, vData) => {
4845
4696
  let vFirstChild = null;
4846
4697
  const skipStyleElements = () => {
4847
4698
  while (isQStyleElement(child)) {
@@ -4875,8 +4726,54 @@ var materializeFromDOM = (vParent, firstChild) => {
4875
4726
  }
4876
4727
  vParent[5 /* lastChild */] = vChild || null;
4877
4728
  vParent[4 /* firstChild */] = vFirstChild;
4729
+ if (vData) {
4730
+ let container = null;
4731
+ processVNodeData(vData, (peek, consumeValue) => {
4732
+ if (peek() === VNodeDataChar.ID) {
4733
+ if (!container) {
4734
+ container = getDomContainer(vParent[6 /* element */]);
4735
+ }
4736
+ const id = consumeValue();
4737
+ container.$setRawState$(parseInt(id), vParent);
4738
+ import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
4739
+ } else if (peek() === VNodeDataChar.SUBS) {
4740
+ vnode_setProp(vParent, QSubscribers, consumeValue());
4741
+ } else {
4742
+ consumeValue();
4743
+ }
4744
+ });
4745
+ }
4878
4746
  return vFirstChild;
4879
4747
  };
4748
+ var processVNodeData = (vData, callback) => {
4749
+ let nextToConsumeIdx = 0;
4750
+ let ch = 0;
4751
+ let peekCh = 0;
4752
+ const peek = () => {
4753
+ if (peekCh !== 0) {
4754
+ return peekCh;
4755
+ } else {
4756
+ return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
4757
+ }
4758
+ };
4759
+ const consume = () => {
4760
+ ch = peek();
4761
+ peekCh = 0;
4762
+ nextToConsumeIdx++;
4763
+ return ch;
4764
+ };
4765
+ const consumeValue = () => {
4766
+ consume();
4767
+ const start = nextToConsumeIdx;
4768
+ while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
4769
+ consume();
4770
+ }
4771
+ return vData.substring(start, nextToConsumeIdx);
4772
+ };
4773
+ while (peek() !== 0) {
4774
+ callback(peek, consumeValue, consume, nextToConsumeIdx);
4775
+ }
4776
+ };
4880
4777
  var vnode_getNextSibling = (vnode) => {
4881
4778
  return vnode[3 /* nextSibling */];
4882
4779
  };
@@ -4961,7 +4858,7 @@ var vnode_getPropStartIndex = (vnode) => {
4961
4858
  } else if (type === 2 /* Virtual */) {
4962
4859
  return 6 /* PROPS_OFFSET */;
4963
4860
  }
4964
- throw throwErrorAndStop("Invalid vnode type.");
4861
+ throw qError(43 /* invalidVNodeType */, [type]);
4965
4862
  };
4966
4863
  var vnode_getParent = (vnode) => {
4967
4864
  return vnode[1 /* parent */] || null;
@@ -4976,7 +4873,7 @@ var vnode_getNode = (vnode) => {
4976
4873
  assertTrue(vnode_isTextVNode(vnode), "Expecting Text Node.");
4977
4874
  return vnode[4 /* node */];
4978
4875
  };
4979
- function vnode_toString(depth = 10, offset = "", materialize = false, siblings = false) {
4876
+ function vnode_toString(depth = 10, offset = "", materialize2 = false, siblings = false) {
4980
4877
  var _a;
4981
4878
  let vnode = this;
4982
4879
  if (depth === 0) {
@@ -5029,7 +4926,7 @@ function vnode_toString(depth = 10, offset = "", materialize = false, siblings =
5029
4926
  }
5030
4927
  }
5031
4928
  strings.push("<" + tag + attrs.join("") + ">");
5032
- if (vnode_isMaterialized(vnode) || materialize) {
4929
+ if (vnode_isMaterialized(vnode) || materialize2) {
5033
4930
  const child = vnode_getFirstChild(vnode);
5034
4931
  child && strings.push(" " + vnode_toString.call(child, depth - 1, offset + " ", true, true));
5035
4932
  } else {
@@ -5052,25 +4949,9 @@ var isLowercase = (ch) => (
5052
4949
  var stack = [];
5053
4950
  function materializeFromVNodeData(vParent, vData, element, child) {
5054
4951
  let idx = 0;
5055
- let nextToConsumeIdx = 0;
5056
4952
  let vFirst = null;
5057
4953
  let vLast = null;
5058
4954
  let previousTextNode = null;
5059
- let ch = 0;
5060
- let peekCh = 0;
5061
- const peek = () => {
5062
- if (peekCh !== 0) {
5063
- return peekCh;
5064
- } else {
5065
- return peekCh = nextToConsumeIdx < vData.length ? vData.charCodeAt(nextToConsumeIdx) : 0;
5066
- }
5067
- };
5068
- const consume = () => {
5069
- ch = peek();
5070
- peekCh = 0;
5071
- nextToConsumeIdx++;
5072
- return ch;
5073
- };
5074
4955
  const addVNode = (node) => {
5075
4956
  node[0 /* flags */] = node[0 /* flags */] & 255 /* negated_mask */ | idx << 8 /* shift */;
5076
4957
  idx++;
@@ -5082,25 +4963,15 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5082
4963
  }
5083
4964
  vLast = node;
5084
4965
  };
5085
- const consumeValue = () => {
5086
- consume();
5087
- const start = nextToConsumeIdx;
5088
- while (peek() <= 58 && peekCh !== 0 || peekCh === 95 || peekCh >= 65 && peekCh <= 90 || peekCh >= 97 && peekCh <= 122) {
5089
- consume();
5090
- }
5091
- return vData.substring(start, nextToConsumeIdx);
5092
- };
5093
4966
  let textIdx = 0;
5094
4967
  let combinedText = null;
5095
4968
  let container = null;
5096
- while (peek() !== 0) {
4969
+ processVNodeData(vData, (peek, consumeValue, consume, nextToConsumeIdx) => {
5097
4970
  if (isNumber(peek())) {
5098
4971
  while (!isElement(child)) {
5099
4972
  child = fastNextSibling(child);
5100
4973
  if (!child) {
5101
- throwErrorAndStop(
5102
- "Materialize error: missing element: " + vData + " " + peek() + " " + nextToConsumeIdx
5103
- );
4974
+ throw qError(44 /* materializeVNodeDataError */, [vData, peek(), nextToConsumeIdx]);
5104
4975
  }
5105
4976
  }
5106
4977
  while (isQStyleElement(child)) {
@@ -5127,7 +4998,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5127
4998
  }
5128
4999
  const id = consumeValue();
5129
5000
  container.$setRawState$(parseInt(id), vParent);
5130
- import_build7.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
5001
+ import_build6.isDev && vnode_setAttr(null, vParent, ELEMENT_ID, id);
5131
5002
  } else if (peek() === VNodeDataChar.PROPS) {
5132
5003
  vnode_setAttr(null, vParent, ELEMENT_PROPS, consumeValue());
5133
5004
  } else if (peek() === VNodeDataChar.SLOT_REF) {
@@ -5138,6 +5009,8 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5138
5009
  vnode_setAttr(null, vParent, ELEMENT_SEQ, consumeValue());
5139
5010
  } else if (peek() === VNodeDataChar.SEQ_IDX) {
5140
5011
  vnode_setAttr(null, vParent, ELEMENT_SEQ_IDX, consumeValue());
5012
+ } else if (peek() === VNodeDataChar.SUBS) {
5013
+ vnode_setProp(vParent, QSubscribers, consumeValue());
5141
5014
  } else if (peek() === VNodeDataChar.CONTEXT) {
5142
5015
  vnode_setAttr(null, vParent, QCtxAttr, consumeValue());
5143
5016
  } else if (peek() === VNodeDataChar.OPEN) {
@@ -5180,7 +5053,7 @@ function materializeFromVNodeData(vParent, vData, element, child) {
5180
5053
  );
5181
5054
  textIdx += length;
5182
5055
  }
5183
- }
5056
+ });
5184
5057
  vParent[5 /* lastChild */] = vLast;
5185
5058
  return vFirst;
5186
5059
  }
@@ -5193,7 +5066,7 @@ var vnode_getType = (vnode) => {
5193
5066
  } else if (type & 4 /* Text */) {
5194
5067
  return 3;
5195
5068
  }
5196
- throw throwErrorAndStop("Unknown vnode type: " + type);
5069
+ throw qError(43 /* invalidVNodeType */, [type]);
5197
5070
  };
5198
5071
  var isElement = (node) => node && typeof node == "object" && fastNodeType(node) === /** Node.ELEMENT_NODE* */
5199
5072
  1;
@@ -5274,7 +5147,7 @@ var VNodeArray = class VNode extends Array {
5274
5147
  constructor(flags, parent, previousSibling, nextSibling) {
5275
5148
  super();
5276
5149
  this.push(flags, parent, previousSibling, nextSibling);
5277
- if (import_build7.isDev) {
5150
+ if (import_build6.isDev) {
5278
5151
  this.toString = vnode_toString;
5279
5152
  }
5280
5153
  }
@@ -5355,6 +5228,12 @@ var trackSignal = (fn, subscriber, property, container, data) => {
5355
5228
  trackInvocation.$container$ = previousContainer;
5356
5229
  }
5357
5230
  };
5231
+ var trackSignalAndAssignHost = (value, host, property, container, data) => {
5232
+ if (value instanceof WrappedSignal && value.$hostElement$ !== host && host) {
5233
+ value.$hostElement$ = host;
5234
+ }
5235
+ return trackSignal(() => value.value, host, property, container, data);
5236
+ };
5358
5237
 
5359
5238
  // packages/qwik/src/core/use/use-context.ts
5360
5239
  var createContextId = (name) => {
@@ -5376,7 +5255,7 @@ var isRecoverable = (err) => {
5376
5255
  };
5377
5256
 
5378
5257
  // packages/qwik/src/core/client/process-vnode-data.ts
5379
- function processVNodeData(document2) {
5258
+ function processVNodeData2(document2) {
5380
5259
  const Q_CONTAINER = "q:container";
5381
5260
  const Q_CONTAINER_END = "/" + Q_CONTAINER;
5382
5261
  const Q_PROPS_SEPARATOR2 = ":";
@@ -5629,7 +5508,7 @@ function processVNodeData(document2) {
5629
5508
  function getDomContainer(element) {
5630
5509
  const qContainerElement = _getQContainerElement(element);
5631
5510
  if (!qContainerElement) {
5632
- throwErrorAndStop("Unable to find q:container.");
5511
+ throw qError(41 /* containerNotFound */);
5633
5512
  }
5634
5513
  return getDomContainerFromQContainerElement(qContainerElement);
5635
5514
  }
@@ -5690,7 +5569,7 @@ var DomContainer = class extends _SharedContainer {
5690
5569
  );
5691
5570
  this.qContainer = element.getAttribute(QContainerAttr);
5692
5571
  if (!this.qContainer) {
5693
- throwErrorAndStop("Element must have 'q:container' attribute.");
5572
+ throw qError(42 /* elementWithoutContainer */);
5694
5573
  }
5695
5574
  this.$journal$ = [
5696
5575
  // The first time we render we need to hoist the styles.
@@ -5711,7 +5590,7 @@ var DomContainer = class extends _SharedContainer {
5711
5590
  this.stateData = null;
5712
5591
  const document2 = this.element.ownerDocument;
5713
5592
  if (!document2.qVNodeData) {
5714
- processVNodeData(document2);
5593
+ processVNodeData2(document2);
5715
5594
  }
5716
5595
  this.$rawStateData$ = [];
5717
5596
  this.stateData = [];
@@ -5721,7 +5600,7 @@ var DomContainer = class extends _SharedContainer {
5721
5600
  this.$rawStateData$ = JSON.parse(lastState.textContent);
5722
5601
  this.stateData = wrapDeserializerProxy(this, this.$rawStateData$);
5723
5602
  }
5724
- this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY2;
5603
+ this.$qFuncs$ = getQFuncs(document2, this.$instanceHash$) || EMPTY_ARRAY;
5725
5604
  }
5726
5605
  $setRawState$(id, vParent) {
5727
5606
  this.stateData[id] = vParent;
@@ -5729,10 +5608,6 @@ var DomContainer = class extends _SharedContainer {
5729
5608
  parseQRL(qrl) {
5730
5609
  return inflateQRL(this, parseQRL(qrl));
5731
5610
  }
5732
- processJsx(host, jsx2) {
5733
- const styleScopedId = this.getHostProp(host, QScopedStyle);
5734
- return vnode_diff(this, jsx2, host, addComponentStylePrefix(styleScopedId));
5735
- }
5736
5611
  handleError(err, host) {
5737
5612
  if (qDev) {
5738
5613
  if (typeof document !== "undefined") {
@@ -5829,12 +5704,12 @@ var DomContainer = class extends _SharedContainer {
5829
5704
  }
5830
5705
  processChores() {
5831
5706
  let renderCount = this.$renderCount$;
5832
- const result = this.$scheduler$(127 /* WAIT_FOR_ALL */);
5707
+ const result = this.$scheduler$(255 /* WAIT_FOR_ALL */);
5833
5708
  if (isPromise(result)) {
5834
5709
  return result.then(async () => {
5835
5710
  while (renderCount !== this.$renderCount$) {
5836
5711
  renderCount = this.$renderCount$;
5837
- await this.$scheduler$(127 /* WAIT_FOR_ALL */);
5712
+ await this.$scheduler$(255 /* WAIT_FOR_ALL */);
5838
5713
  }
5839
5714
  this.renderDone = null;
5840
5715
  });
@@ -6003,7 +5878,9 @@ var inflate = (container, target, typeId, data) => {
6003
5878
  if (valType === 0 /* RootRef */ || valType >= 12 /* Error */) {
6004
5879
  Object.defineProperty(target, key, {
6005
5880
  get() {
6006
- return deserializeData(container, valType, valData);
5881
+ const value = deserializeData(container, valType, valData);
5882
+ target[key] = value;
5883
+ return value;
6007
5884
  },
6008
5885
  set(value) {
6009
5886
  Object.defineProperty(target, key, {
@@ -6078,7 +5955,8 @@ var inflate = (container, target, typeId, data) => {
6078
5955
  signal.$args$ = d[1];
6079
5956
  signal.$effectDependencies$ = d[2];
6080
5957
  signal.$untrackedValue$ = d[3];
6081
- signal.$effects$ = d.slice(4);
5958
+ signal.$hostElement$ = d[4];
5959
+ signal.$effects$ = d.slice(5);
6082
5960
  break;
6083
5961
  }
6084
5962
  case 24 /* ComputedSignal */: {
@@ -6175,11 +6053,12 @@ var inflate = (container, target, typeId, data) => {
6175
6053
  break;
6176
6054
  case 30 /* EffectData */: {
6177
6055
  const effectData = target;
6178
- effectData.data = data[0];
6056
+ effectData.data.$scopedStyleIdPrefix$ = data[0];
6057
+ effectData.data.$isConst$ = data[1];
6179
6058
  break;
6180
6059
  }
6181
6060
  default:
6182
- return throwErrorAndStop("Not implemented");
6061
+ throw qError(33 /* serializeErrorNotImplemented */, [typeId]);
6183
6062
  }
6184
6063
  };
6185
6064
  var _constants = [
@@ -6188,7 +6067,7 @@ var _constants = [
6188
6067
  true,
6189
6068
  false,
6190
6069
  "",
6191
- EMPTY_ARRAY2,
6070
+ EMPTY_ARRAY,
6192
6071
  EMPTY_OBJ,
6193
6072
  NEEDS_COMPUTATION,
6194
6073
  Slot,
@@ -6292,12 +6171,12 @@ var allocate = (container, typeId, value) => {
6292
6171
  if (vnode_isVNode(vNode)) {
6293
6172
  return vnode_getNode(vNode);
6294
6173
  } else {
6295
- return throwErrorAndStop("expected vnode for ref prop, but got " + typeof vNode);
6174
+ throw qError(34 /* serializeErrorExpectedVNode */, [typeof vNode]);
6296
6175
  }
6297
6176
  case 30 /* EffectData */:
6298
- return new EffectData(null);
6177
+ return new EffectPropData({});
6299
6178
  default:
6300
- return throwErrorAndStop("unknown allocate type: " + typeId);
6179
+ throw qError(35 /* serializeErrorCannotAllocate */, [typeId]);
6301
6180
  }
6302
6181
  };
6303
6182
  function retrieveVNodeOrDocument(container, value) {
@@ -6327,6 +6206,7 @@ function inflateQRL(container, qrl) {
6327
6206
  }
6328
6207
  return qrl;
6329
6208
  }
6209
+ var isDomRef = (obj) => false;
6330
6210
  var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToChunkResolver, getProp, setProp, storeProxyMap, writer, prepVNodeData) => {
6331
6211
  if (!writer) {
6332
6212
  const buffer = [];
@@ -6351,7 +6231,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6351
6231
  return id;
6352
6232
  };
6353
6233
  const isSsrNode = NodeConstructor ? (obj) => obj instanceof NodeConstructor : () => false;
6354
- const isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
6234
+ isDomRef = DomRefConstructor ? (obj) => obj instanceof DomRefConstructor : () => false;
6355
6235
  return {
6356
6236
  $serialize$() {
6357
6237
  serialize(this);
@@ -6370,7 +6250,7 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6370
6250
  $getRootId$: (obj) => {
6371
6251
  const id = map.get(obj);
6372
6252
  if (!id || id === -1) {
6373
- return throwErrorAndStop("Missing root id for: ", obj);
6253
+ throw qError(36 /* serializeErrorMissingRootId */, [obj]);
6374
6254
  }
6375
6255
  return id;
6376
6256
  },
@@ -6459,16 +6339,24 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6459
6339
  if (obj.$args$) {
6460
6340
  discoveredValues.push(...obj.$args$);
6461
6341
  }
6342
+ if (obj.$hostElement$) {
6343
+ discoveredValues.push(obj.$hostElement$);
6344
+ }
6462
6345
  } else if (obj instanceof ComputedSignal) {
6463
6346
  discoveredValues.push(obj.$computeQrl$);
6464
6347
  }
6465
6348
  } else if (obj instanceof Task) {
6466
6349
  discoveredValues.push(obj.$el$, obj.$qrl$, obj.$state$, obj.$effectDependencies$);
6467
6350
  } else if (isSsrNode(obj)) {
6468
- discoveredValues.push(obj.vnodeData);
6351
+ discoverValuesForVNodeData(obj.vnodeData, discoveredValues);
6352
+ if (obj.childrenVNodeData && obj.childrenVNodeData.length) {
6353
+ for (const data of obj.childrenVNodeData) {
6354
+ discoverValuesForVNodeData(data, discoveredValues);
6355
+ }
6356
+ }
6469
6357
  } else if (isDomRef(obj)) {
6470
- discoveredValues.push(obj.id);
6471
- } else if (isJSXNode2(obj)) {
6358
+ discoveredValues.push(obj.$ssrNode$.id);
6359
+ } else if (isJSXNode(obj)) {
6472
6360
  discoveredValues.push(obj.type, obj.props, obj.constProps, obj.children);
6473
6361
  } else if (Array.isArray(obj)) {
6474
6362
  discoveredValues.push(...obj);
@@ -6488,14 +6376,14 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6488
6376
  }
6489
6377
  );
6490
6378
  promises.push(obj);
6491
- } else if (obj instanceof EffectData) {
6379
+ } else if (obj instanceof EffectPropData) {
6492
6380
  discoveredValues.push(obj.data);
6493
6381
  } else if (isObjectLiteral(obj)) {
6494
6382
  Object.entries(obj).forEach(([key, value]) => {
6495
6383
  discoveredValues.push(key, value);
6496
6384
  });
6497
6385
  } else {
6498
- return throwErrorAndStop("Unknown type: " + obj);
6386
+ throw qError(37 /* serializeErrorUnknownType */, [obj]);
6499
6387
  }
6500
6388
  };
6501
6389
  for (const root of roots) {
@@ -6520,6 +6408,20 @@ var createSerializationContext = (NodeConstructor, DomRefConstructor, symbolToCh
6520
6408
  } while (discoveredValues.length);
6521
6409
  }
6522
6410
  };
6411
+ var isSsrAttrs = (value) => Array.isArray(value) && value.length > 0;
6412
+ var discoverValuesForVNodeData = (vnodeData, discoveredValues) => {
6413
+ for (const value of vnodeData) {
6414
+ if (isSsrAttrs(value)) {
6415
+ for (let i = 1; i < value.length; i += 2) {
6416
+ if (value[i - 1] === ELEMENT_KEY) {
6417
+ continue;
6418
+ }
6419
+ const attrValue = value[i];
6420
+ discoveredValues.push(attrValue);
6421
+ }
6422
+ }
6423
+ }
6424
+ };
6523
6425
  var promiseResults = /* @__PURE__ */ new WeakMap();
6524
6426
  function serialize(serializationContext) {
6525
6427
  const { $writer$, $isSsrNode$, $isDomRef$, $setProp$, $storeProxyMap$ } = serializationContext;
@@ -6601,7 +6503,7 @@ function serialize(serializationContext) {
6601
6503
  output(2 /* Number */, value);
6602
6504
  }
6603
6505
  } else if (typeof value === "object") {
6604
- if (value === EMPTY_ARRAY2) {
6506
+ if (value === EMPTY_ARRAY) {
6605
6507
  output(1 /* Constant */, 5 /* EMPTY_ARRAY */);
6606
6508
  } else if (value === EMPTY_OBJ) {
6607
6509
  output(1 /* Constant */, 6 /* EMPTY_OBJ */);
@@ -6630,7 +6532,7 @@ function serialize(serializationContext) {
6630
6532
  } else if (value === NEEDS_COMPUTATION) {
6631
6533
  output(1 /* Constant */, 7 /* NEEDS_COMPUTATION */);
6632
6534
  } else {
6633
- throwErrorAndStop("Unknown type: " + typeof value);
6535
+ throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
6634
6536
  }
6635
6537
  };
6636
6538
  const writeObjectValue = (value, idx) => {
@@ -6648,14 +6550,14 @@ function serialize(serializationContext) {
6648
6550
  const constProps = value[_CONST_PROPS];
6649
6551
  const out = constProps ? [varProps, constProps] : Object.keys(varProps).length ? [varProps] : 0;
6650
6552
  output(29 /* PropsProxy */, out);
6651
- } else if (value instanceof EffectData) {
6652
- output(30 /* EffectData */, [value.data]);
6553
+ } else if (value instanceof EffectPropData) {
6554
+ output(30 /* EffectData */, [value.data.$scopedStyleIdPrefix$, value.data.$isConst$]);
6653
6555
  } else if (isStore(value)) {
6654
6556
  if (isResource(value)) {
6655
6557
  serializationContext.$resources$.add(value);
6656
6558
  const res = promiseResults.get(value.value);
6657
6559
  if (!res) {
6658
- return throwErrorAndStop("Unvisited Resource");
6560
+ throw qError(38 /* serializeErrorUnvisited */, ["resource"]);
6659
6561
  }
6660
6562
  output(20 /* Resource */, [...res, getStoreHandler(value).$effects$]);
6661
6563
  } else {
@@ -6692,7 +6594,8 @@ function serialize(serializationContext) {
6692
6594
  output(13 /* Object */, out);
6693
6595
  }
6694
6596
  } else if ($isDomRef$(value)) {
6695
- output(9 /* RefVNode */, value.id);
6597
+ value.$ssrNode$.vnodeData[0] |= 16 /* SERIALIZE */;
6598
+ output(9 /* RefVNode */, value.$ssrNode$.id);
6696
6599
  } else if (value instanceof Signal) {
6697
6600
  const v = value instanceof ComputedSignal && (value.$invalid$ || fastSkipSerialize(value.$untrackedValue$)) ? NEEDS_COMPUTATION : value.$untrackedValue$;
6698
6601
  if (value instanceof WrappedSignal) {
@@ -6700,6 +6603,7 @@ function serialize(serializationContext) {
6700
6603
  ...serializeWrappingFn(serializationContext, value),
6701
6604
  value.$effectDependencies$,
6702
6605
  v,
6606
+ value.$hostElement$,
6703
6607
  ...value.$effects$ || []
6704
6608
  ]);
6705
6609
  } else if (value instanceof ComputedSignal) {
@@ -6738,11 +6642,11 @@ function serialize(serializationContext) {
6738
6642
  const vNodeData = value.vnodeData;
6739
6643
  if (vNodeData) {
6740
6644
  (_a = serializationContext.$prepVNodeData$) == null ? void 0 : _a.call(serializationContext, vNodeData);
6741
- vNodeData[0] |= 8 /* SERIALIZE */;
6645
+ vNodeData[0] |= 16 /* SERIALIZE */;
6742
6646
  }
6743
6647
  if (value.childrenVNodeData) {
6744
6648
  for (const vNodeData2 of value.childrenVNodeData) {
6745
- vNodeData2[0] |= 8 /* SERIALIZE */;
6649
+ vNodeData2[0] |= 16 /* SERIALIZE */;
6746
6650
  }
6747
6651
  }
6748
6652
  } else {
@@ -6769,7 +6673,7 @@ function serialize(serializationContext) {
6769
6673
  combined.push(k, v);
6770
6674
  }
6771
6675
  output(16 /* Map */, combined);
6772
- } else if (isJSXNode2(value)) {
6676
+ } else if (isJSXNode(value)) {
6773
6677
  output(28 /* JSXNode */, [
6774
6678
  value.type,
6775
6679
  value.varProps,
@@ -6794,7 +6698,7 @@ function serialize(serializationContext) {
6794
6698
  } else if (isPromise(value)) {
6795
6699
  const res = promiseResults.get(value);
6796
6700
  if (!res) {
6797
- return throwErrorAndStop("Unvisited Promise");
6701
+ throw qError(38 /* serializeErrorUnvisited */, ["promise"]);
6798
6702
  }
6799
6703
  output(14 /* Promise */, res);
6800
6704
  } else if (value instanceof Uint8Array) {
@@ -6805,7 +6709,7 @@ function serialize(serializationContext) {
6805
6709
  const out = btoa(buf).replace(/=+$/, "");
6806
6710
  output(17 /* Uint8Array */, out);
6807
6711
  } else {
6808
- return throwErrorAndStop("implement");
6712
+ throw qError(37 /* serializeErrorUnknownType */, [typeof value]);
6809
6713
  }
6810
6714
  };
6811
6715
  writeValue(serializationContext.$roots$, -1);
@@ -6852,7 +6756,7 @@ function qrlToString(serializationContext, value) {
6852
6756
  }
6853
6757
  }
6854
6758
  if (!chunk) {
6855
- throwErrorAndStop("Missing chunk for: " + value.$symbol$);
6759
+ throw qError(31 /* qrlMissingChunk */, [value.$symbol$]);
6856
6760
  }
6857
6761
  if (chunk.startsWith("./")) {
6858
6762
  chunk = chunk.slice(2);
@@ -6907,7 +6811,7 @@ function isResource(value) {
6907
6811
  return "__brand" in value && value.__brand === "resource";
6908
6812
  }
6909
6813
  var frameworkType = (obj) => {
6910
- return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode2(obj)) || isQrl2(obj);
6814
+ return typeof obj === "object" && obj !== null && (obj instanceof Signal || obj instanceof Task || isJSXNode(obj)) || isQrl2(obj);
6911
6815
  };
6912
6816
  var canSerialize = (value) => {
6913
6817
  if (value == null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
@@ -6937,7 +6841,7 @@ var canSerialize = (value) => {
6937
6841
  return true;
6938
6842
  } else if (isPromise(value)) {
6939
6843
  return true;
6940
- } else if (isJSXNode2(value)) {
6844
+ } else if (isJSXNode(value)) {
6941
6845
  return true;
6942
6846
  } else if (value instanceof Error) {
6943
6847
  return true;
@@ -6957,6 +6861,8 @@ var canSerialize = (value) => {
6957
6861
  return true;
6958
6862
  } else if (value instanceof Uint8Array) {
6959
6863
  return true;
6864
+ } else if (isDomRef == null ? void 0 : isDomRef(value)) {
6865
+ return true;
6960
6866
  }
6961
6867
  } else if (typeof value === "function") {
6962
6868
  if (isQrl2(value) || isQwikComponent(value)) {
@@ -7001,7 +6907,7 @@ var _verifySerializable = (value, seen, ctx, preMessage) => {
7001
6907
  let expectIndex = 0;
7002
6908
  unwrapped.forEach((v, i) => {
7003
6909
  if (i !== expectIndex) {
7004
- throw qError(QError_verifySerializable, unwrapped);
6910
+ throw qError(3 /* verifySerializable */, [unwrapped]);
7005
6911
  }
7006
6912
  _verifySerializable(v, seen, ctx + "[" + i + "]");
7007
6913
  expectIndex = i + 1;
@@ -7041,8 +6947,7 @@ const ${fnName} = $(${String(
7041
6947
 
7042
6948
  Please check out https://qwik.dev/docs/advanced/qrl/ for more information.`;
7043
6949
  }
7044
- console.error("Trying to serialize", value);
7045
- throwErrorAndStop(message);
6950
+ throw qError(3 /* verifySerializable */, [message]);
7046
6951
  }
7047
6952
  return value;
7048
6953
  };
@@ -7094,7 +6999,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7094
6999
  function bindFnToContext(currentCtx, beforeFn) {
7095
7000
  return (...args) => maybeThen(resolveLazy(), (fn) => {
7096
7001
  if (!isFunction(fn)) {
7097
- throw qError(QError_qrlIsNotFunction);
7002
+ throw qError(10 /* qrlIsNotFunction */);
7098
7003
  }
7099
7004
  if (beforeFn && beforeFn() === false) {
7100
7005
  return;
@@ -7195,7 +7100,7 @@ var createQRL = (chunk, symbol, symbolRef, symbolFn, capture, captureRef, refSym
7195
7100
  if (symbolRef) {
7196
7101
  symbolRef = maybeThen(symbolRef, (resolved) => qrl.resolved = symbolRef = wrapFn(resolved));
7197
7102
  }
7198
- if (import_build9.isDev) {
7103
+ if (import_build8.isDev) {
7199
7104
  Object.defineProperty(qrl, "_devOnlySymbolRef", {
7200
7105
  get() {
7201
7106
  return symbolRef;
@@ -7286,7 +7191,7 @@ var stringifyStyle = (obj) => {
7286
7191
  }
7287
7192
  if (typeof obj == "object") {
7288
7193
  if (isArray(obj)) {
7289
- throw qError(QError_stringifyClassOrStyle, obj, "style");
7194
+ throw qError(0 /* stringifyClassOrStyle */, [obj, "style"]);
7290
7195
  } else {
7291
7196
  const chunks = [];
7292
7197
  for (const key in obj) {
@@ -7349,7 +7254,7 @@ function getValidManifest(manifest) {
7349
7254
  }
7350
7255
 
7351
7256
  // packages/qwik/src/server/ssr-container.ts
7352
- var import_core3 = require("@qwik.dev/core");
7257
+ var import_core4 = require("@qwik.dev/core");
7353
7258
  var import_build10 = require("@qwik.dev/core/build");
7354
7259
 
7355
7260
  // packages/qwik/src/server/prefetch-utils.ts
@@ -7525,6 +7430,166 @@ var PrefetchImplementationDefault = {
7525
7430
  prefetchEvent: "always"
7526
7431
  };
7527
7432
 
7433
+ // packages/qwik/src/server/ssr-node.ts
7434
+ var import_core2 = require("@qwik.dev/core");
7435
+ var import_build9 = require("@qwik.dev/core/build");
7436
+ var SsrNode = class {
7437
+ constructor(currentComponentNode, nodeType, id, attrs, cleanupQueue, vnodeData) {
7438
+ this.attrs = attrs;
7439
+ this.cleanupQueue = cleanupQueue;
7440
+ this.vnodeData = vnodeData;
7441
+ var _a;
7442
+ this.currentComponentNode = currentComponentNode;
7443
+ (_a = this.currentComponentNode) == null ? void 0 : _a.addChildVNodeData(this.vnodeData);
7444
+ this.nodeType = nodeType;
7445
+ this.id = id;
7446
+ if (import_build9.isDev && id.indexOf("undefined") != -1) {
7447
+ throw new Error(`Invalid SSR node id: ${id}`);
7448
+ }
7449
+ }
7450
+ __brand__;
7451
+ static ELEMENT_NODE = 1;
7452
+ static TEXT_NODE = 3;
7453
+ static DOCUMENT_NODE = 9;
7454
+ static DOCUMENT_FRAGMENT_NODE = 11;
7455
+ /** @param nodeType - Node type: ELEMENT_NODE, TEXT_NODE, DOCUMENT_NODE */
7456
+ nodeType;
7457
+ /**
7458
+ * ID which the deserialize will use to retrieve the node.
7459
+ *
7460
+ * @param refId - Unique id for the node.
7461
+ */
7462
+ id;
7463
+ /** Local props which don't serialize; */
7464
+ locals = null;
7465
+ currentComponentNode;
7466
+ childrenVNodeData = null;
7467
+ setProp(name, value) {
7468
+ if (this.attrs === import_core2._EMPTY_ARRAY) {
7469
+ this.attrs = [];
7470
+ }
7471
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7472
+ mapArray_set(this.locals || (this.locals = []), name, value, 0);
7473
+ } else {
7474
+ mapArray_set(this.attrs, name, value, 0);
7475
+ }
7476
+ if (name == ELEMENT_SEQ && value) {
7477
+ this.cleanupQueue.push(value);
7478
+ }
7479
+ }
7480
+ getProp(name) {
7481
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7482
+ return this.locals ? mapArray_get(this.locals, name, 0) : null;
7483
+ } else {
7484
+ return mapArray_get(this.attrs, name, 0);
7485
+ }
7486
+ }
7487
+ removeProp(name) {
7488
+ if (name.startsWith(NON_SERIALIZABLE_MARKER_PREFIX)) {
7489
+ if (this.locals) {
7490
+ mapApp_remove(this.locals, name, 0);
7491
+ }
7492
+ } else {
7493
+ mapApp_remove(this.attrs, name, 0);
7494
+ }
7495
+ }
7496
+ addChildVNodeData(child) {
7497
+ if (!this.childrenVNodeData) {
7498
+ this.childrenVNodeData = [];
7499
+ }
7500
+ this.childrenVNodeData.push(child);
7501
+ }
7502
+ toString() {
7503
+ let stringifiedAttrs = "";
7504
+ for (let i = 0; i < this.attrs.length; i += 2) {
7505
+ const key = this.attrs[i];
7506
+ const value = this.attrs[i + 1];
7507
+ stringifiedAttrs += `${key}=`;
7508
+ stringifiedAttrs += `${typeof value === "string" || typeof value === "number" ? JSON.stringify(value) : "*"}`;
7509
+ if (i < this.attrs.length - 2) {
7510
+ stringifiedAttrs += ", ";
7511
+ }
7512
+ }
7513
+ return `SSRNode [<${this.id}> ${stringifiedAttrs}]`;
7514
+ }
7515
+ };
7516
+ var DomRef = class {
7517
+ constructor($ssrNode$) {
7518
+ this.$ssrNode$ = $ssrNode$;
7519
+ }
7520
+ };
7521
+ var SsrComponentFrame = class {
7522
+ constructor(componentNode) {
7523
+ this.componentNode = componentNode;
7524
+ }
7525
+ slots = [];
7526
+ projectionDepth = 0;
7527
+ scopedStyleIds = /* @__PURE__ */ new Set();
7528
+ projectionScopedStyle = null;
7529
+ projectionComponentFrame = null;
7530
+ distributeChildrenIntoSlots(children, projectionScopedStyle, projectionComponentFrame) {
7531
+ this.projectionScopedStyle = projectionScopedStyle;
7532
+ this.projectionComponentFrame = projectionComponentFrame;
7533
+ if ((0, import_core2._isJSXNode)(children)) {
7534
+ const slotName = this.getSlotName(children);
7535
+ mapArray_set(this.slots, slotName, children, 0);
7536
+ } else if (Array.isArray(children)) {
7537
+ const defaultSlot = [];
7538
+ for (let i = 0; i < children.length; i++) {
7539
+ const child = children[i];
7540
+ if ((0, import_core2._isJSXNode)(child)) {
7541
+ const slotName = this.getSlotName(child);
7542
+ if (slotName === QDefaultSlot) {
7543
+ defaultSlot.push(child);
7544
+ } else {
7545
+ this.updateSlot(slotName, child);
7546
+ }
7547
+ } else {
7548
+ defaultSlot.push(child);
7549
+ }
7550
+ }
7551
+ defaultSlot.length && mapArray_set(this.slots, QDefaultSlot, defaultSlot, 0);
7552
+ } else {
7553
+ mapArray_set(this.slots, QDefaultSlot, children, 0);
7554
+ }
7555
+ }
7556
+ updateSlot(slotName, child) {
7557
+ let existingSlots = mapArray_get(this.slots, slotName, 0);
7558
+ if (existingSlots === null) {
7559
+ existingSlots = child;
7560
+ } else if (Array.isArray(existingSlots)) {
7561
+ existingSlots.push(child);
7562
+ } else {
7563
+ existingSlots = [existingSlots, child];
7564
+ }
7565
+ mapArray_set(this.slots, slotName, existingSlots, 0);
7566
+ }
7567
+ getSlotName(jsx2) {
7568
+ if (jsx2.props[QSlot]) {
7569
+ return jsx2.props[QSlot];
7570
+ }
7571
+ return QDefaultSlot;
7572
+ }
7573
+ hasSlot(slotName) {
7574
+ return mapArray_get(this.slots, slotName, 0) !== null;
7575
+ }
7576
+ consumeChildrenForSlot(projectionNode, slotName) {
7577
+ const children = mapApp_remove(this.slots, slotName, 0);
7578
+ if (children !== null) {
7579
+ this.componentNode.setProp(slotName, projectionNode.id);
7580
+ projectionNode.setProp(QSlotParent, this.componentNode.id);
7581
+ }
7582
+ return children;
7583
+ }
7584
+ releaseUnclaimedProjections(unclaimedProjections) {
7585
+ if (this.slots.length) {
7586
+ unclaimedProjections.push(this);
7587
+ unclaimedProjections.push(this.projectionScopedStyle);
7588
+ unclaimedProjections.push.apply(unclaimedProjections, this.slots);
7589
+ }
7590
+ }
7591
+ };
7592
+
7528
7593
  // packages/qwik/src/server/tag-nesting.ts
7529
7594
  var allowedContent = (state) => {
7530
7595
  switch (state) {
@@ -7795,6 +7860,110 @@ function isInPhrasing(text, allowInput) {
7795
7860
  }
7796
7861
  }
7797
7862
 
7863
+ // packages/qwik/src/server/vnode-data.ts
7864
+ var import_core3 = require("@qwik.dev/core");
7865
+ var OPEN_FRAGMENT = Number.MAX_SAFE_INTEGER;
7866
+ var CLOSE_FRAGMENT = Number.MAX_SAFE_INTEGER - 1;
7867
+ var WRITE_ELEMENT_ATTRS = Number.MAX_SAFE_INTEGER - 2;
7868
+ function vNodeData_incrementElementCount(vNodeData) {
7869
+ const length = vNodeData.length;
7870
+ const lastValue = length > 1 ? vNodeData[length - 1] : 0;
7871
+ if (lastValue >= 0) {
7872
+ vNodeData.push(-1);
7873
+ } else {
7874
+ vNodeData[length - 1] = lastValue - 1;
7875
+ }
7876
+ }
7877
+ function vNodeData_addTextSize(vNodeData, size) {
7878
+ const length = vNodeData.length;
7879
+ const lastValue = length > 1 ? vNodeData[length - 1] : 0;
7880
+ if (length > 1 && lastValue >= 0) {
7881
+ vNodeData[0] |= 1 /* TEXT_DATA */;
7882
+ }
7883
+ vNodeData.push(size);
7884
+ if (size == 0) {
7885
+ vNodeData[0] |= 1 /* TEXT_DATA */;
7886
+ }
7887
+ }
7888
+ function vNodeData_openFragment(vNodeData, attrs) {
7889
+ vNodeData.push(attrs, OPEN_FRAGMENT);
7890
+ vNodeData[0] |= 2 /* VIRTUAL_NODE */;
7891
+ }
7892
+ function vNodeData_closeFragment(vNodeData) {
7893
+ vNodeData.push(CLOSE_FRAGMENT);
7894
+ }
7895
+ function vNodeData_openElement(vNodeData) {
7896
+ vNodeData.push([], WRITE_ELEMENT_ATTRS);
7897
+ vNodeData[0] |= 4 /* ELEMENT_NODE */;
7898
+ }
7899
+ function vNodeData_createSsrNodeReference(currentComponentNode, vNodeData, depthFirstElementIdx, cleanupQueue) {
7900
+ vNodeData[0] |= 8 /* REFERENCE */;
7901
+ let fragmentAttrs = import_core3._EMPTY_ARRAY;
7902
+ const stack2 = [SsrNode.ELEMENT_NODE, -1];
7903
+ for (let i = 1; i < vNodeData.length; i++) {
7904
+ const value = vNodeData[i];
7905
+ if (Array.isArray(value)) {
7906
+ fragmentAttrs = value;
7907
+ i++;
7908
+ if (vNodeData[i] !== WRITE_ELEMENT_ATTRS) {
7909
+ stack2[stack2.length - 1]++;
7910
+ stack2.push(SsrNode.DOCUMENT_FRAGMENT_NODE, -1);
7911
+ }
7912
+ } else if (value === CLOSE_FRAGMENT) {
7913
+ stack2.pop();
7914
+ stack2.pop();
7915
+ fragmentAttrs = import_core3._EMPTY_ARRAY;
7916
+ } else if (value < 0) {
7917
+ const numberOfElements = 0 - value;
7918
+ stack2[stack2.length - 1] += numberOfElements;
7919
+ } else {
7920
+ stack2[stack2.length - 1]++;
7921
+ }
7922
+ }
7923
+ let refId = String(depthFirstElementIdx);
7924
+ if (vNodeData[0] & (2 /* VIRTUAL_NODE */ | 1 /* TEXT_DATA */)) {
7925
+ for (let i = 1; i < stack2.length; i += 2) {
7926
+ const childCount = stack2[i];
7927
+ if (childCount >= 0) {
7928
+ refId += encodeAsAlphanumeric(childCount);
7929
+ }
7930
+ }
7931
+ }
7932
+ const type = stack2[stack2.length - 2];
7933
+ return new SsrNode(currentComponentNode, type, refId, fragmentAttrs, cleanupQueue, vNodeData);
7934
+ }
7935
+ var ALPHANUMERIC = [];
7936
+ function encodeAsAlphanumeric(value) {
7937
+ while (ALPHANUMERIC.length <= value) {
7938
+ let value2 = ALPHANUMERIC.length;
7939
+ let text = "";
7940
+ do {
7941
+ text = String.fromCharCode(
7942
+ (text.length === 0 ? 65 : 97) + value2 % 26
7943
+ /* A-Z */
7944
+ ) + text;
7945
+ value2 = Math.floor(
7946
+ value2 / 26
7947
+ /* A-Z */
7948
+ );
7949
+ } while (value2 !== 0);
7950
+ ALPHANUMERIC.push(text);
7951
+ }
7952
+ return ALPHANUMERIC[value];
7953
+ }
7954
+
7955
+ // packages/qwik/src/server/scripts.ts
7956
+ var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
7957
+ var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
7958
+ function getQwikLoaderScript(opts = {}) {
7959
+ return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
7960
+ }
7961
+ var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
7962
+ var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
7963
+ function getQwikPrefetchWorkerScript(opts = {}) {
7964
+ return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
7965
+ }
7966
+
7798
7967
  // packages/qwik/src/server/ssr-container.ts
7799
7968
  function ssrCreateContainer(opts) {
7800
7969
  opts.renderOptions ||= {};
@@ -7831,7 +8000,7 @@ var StringBufferWriter = class {
7831
8000
  }
7832
8001
  };
7833
8002
  var EMPTY_OBJ2 = {};
7834
- var SSRContainer = class extends import_core3._SharedContainer {
8003
+ var SSRContainer = class extends import_core4._SharedContainer {
7835
8004
  tag;
7836
8005
  writer;
7837
8006
  timing;
@@ -7904,15 +8073,12 @@ var SSRContainer = class extends import_core3._SharedContainer {
7904
8073
  }
7905
8074
  ensureProjectionResolved(host) {
7906
8075
  }
7907
- processJsx(host, jsx2) {
7908
- throw new Error("Should not get here.");
7909
- }
7910
8076
  handleError(err, $host$) {
7911
8077
  throw err;
7912
8078
  }
7913
8079
  async render(jsx2) {
7914
8080
  this.openContainer();
7915
- await (0, import_core3._walkJSX)(this, jsx2, {
8081
+ await (0, import_core4._walkJSX)(this, jsx2, {
7916
8082
  allowPromises: true,
7917
8083
  currentStyleScoped: null,
7918
8084
  parentComponentFrame: this.getComponentFrame()
@@ -7995,6 +8161,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
7995
8161
  vNodeData_incrementElementCount(this.currentElementFrame.vNodeData);
7996
8162
  }
7997
8163
  this.createAndPushFrame(elementName, this.depthFirstElementCount++, currentFile);
8164
+ vNodeData_openElement(this.currentElementFrame.vNodeData);
7998
8165
  this.write("<");
7999
8166
  this.write(elementName);
8000
8167
  if (varAttrs) {
@@ -8082,7 +8249,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8082
8249
  this.openFragment(attrs);
8083
8250
  const vNode = (_a = this.currentElementFrame) == null ? void 0 : _a.vNodeData;
8084
8251
  if (vNode) {
8085
- vNode[0] |= 8 /* SERIALIZE */;
8252
+ vNode[0] |= 16 /* SERIALIZE */;
8086
8253
  }
8087
8254
  const componentFrame = this.getComponentFrame();
8088
8255
  if (componentFrame) {
@@ -8167,7 +8334,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8167
8334
  }
8168
8335
  for (let i = 0; i < injections.length; i++) {
8169
8336
  const injection = injections[i];
8170
- const jsxNode = (0, import_core3._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
8337
+ const jsxNode = (0, import_core4._jsxSplit)(injection.tag, null, injection.attributes || {}, null, 0, null);
8171
8338
  if (injection.location === "head") {
8172
8339
  this.additionalHeadNodes.push(jsxNode);
8173
8340
  } else {
@@ -8187,7 +8354,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8187
8354
  this.styleIds.add(styleId);
8188
8355
  if (((_a = this.currentElementFrame) == null ? void 0 : _a.elementName) === "html") {
8189
8356
  this.additionalHeadNodes.push(
8190
- (0, import_core3._jsxSorted)(
8357
+ (0, import_core4._jsxSorted)(
8191
8358
  "style",
8192
8359
  null,
8193
8360
  { dangerouslySetInnerHTML: content, [QStyle]: styleId },
@@ -8248,12 +8415,12 @@ var SSRContainer = class extends import_core3._SharedContainer {
8248
8415
  for (let elementIdx = 0; elementIdx < vNodeData.length; elementIdx++) {
8249
8416
  const vNode = vNodeData[elementIdx];
8250
8417
  const flag = vNode[0];
8251
- if (flag & 8 /* SERIALIZE */) {
8418
+ if (flag & 16 /* SERIALIZE */) {
8252
8419
  lastSerializedIdx = this.emitVNodeSeparators(lastSerializedIdx, elementIdx);
8253
- if (flag & 4 /* REFERENCE */) {
8420
+ if (flag & 8 /* REFERENCE */) {
8254
8421
  this.write(VNodeDataSeparator.REFERENCE_CH);
8255
8422
  }
8256
- if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */)) {
8423
+ if (flag & (1 /* TEXT_DATA */ | 2 /* VIRTUAL_NODE */ | 4 /* ELEMENT_NODE */)) {
8257
8424
  let fragmentAttrs = null;
8258
8425
  let depth = 0;
8259
8426
  for (let i = 1; i < vNode.length; i++) {
@@ -8271,6 +8438,13 @@ var SSRContainer = class extends import_core3._SharedContainer {
8271
8438
  }
8272
8439
  depth--;
8273
8440
  this.write(VNodeDataChar.CLOSE_CHAR);
8441
+ } else if (value === WRITE_ELEMENT_ATTRS) {
8442
+ if (fragmentAttrs && fragmentAttrs.length) {
8443
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
8444
+ writeFragmentAttrs(this.write.bind(this), this.addRoot.bind(this), fragmentAttrs);
8445
+ this.write(VNodeDataChar.SEPARATOR_CHAR);
8446
+ fragmentAttrs = vNodeAttrsStack.pop();
8447
+ }
8274
8448
  } else if (value >= 0) {
8275
8449
  this.write(encodeAsAlphanumeric(value));
8276
8450
  } else {
@@ -8323,6 +8497,9 @@ var SSRContainer = class extends import_core3._SharedContainer {
8323
8497
  case ELEMENT_SEQ_IDX:
8324
8498
  write(VNodeDataChar.SEQ_IDX_CHAR);
8325
8499
  break;
8500
+ case QSubscribers:
8501
+ write(VNodeDataChar.SUBS_CHAR);
8502
+ break;
8326
8503
  // Skipping `\` character for now because it is used for escaping.
8327
8504
  case QCtxAttr:
8328
8505
  write(VNodeDataChar.CONTEXT_CHAR);
@@ -8527,10 +8704,10 @@ var SSRContainer = class extends import_core3._SharedContainer {
8527
8704
  );
8528
8705
  const lastNode = this.getLastNode();
8529
8706
  if (lastNode.vnodeData) {
8530
- lastNode.vnodeData[0] |= 8 /* SERIALIZE */;
8707
+ lastNode.vnodeData[0] |= 16 /* SERIALIZE */;
8531
8708
  }
8532
8709
  ssrComponentNode == null ? void 0 : ssrComponentNode.setProp(value, lastNode.id);
8533
- await (0, import_core3._walkJSX)(this, children, {
8710
+ await (0, import_core4._walkJSX)(this, children, {
8534
8711
  allowPromises: true,
8535
8712
  currentStyleScoped: scopedStyleId,
8536
8713
  parentComponentFrame: null
@@ -8650,7 +8827,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8650
8827
  let styleScopedId = null;
8651
8828
  if (isSSRUnsafeAttr(key)) {
8652
8829
  if (import_build10.isDev) {
8653
- throw new Error("Attribute value is unsafe for SSR");
8830
+ throw qError(51 /* unsafeAttr */);
8654
8831
  }
8655
8832
  continue;
8656
8833
  }
@@ -8661,17 +8838,19 @@ var SSRContainer = class extends import_core3._SharedContainer {
8661
8838
  }
8662
8839
  if (key === "ref") {
8663
8840
  const lastNode = this.getLastNode();
8664
- if ((0, import_core3.isSignal)(value)) {
8665
- value.value = new DomRef(lastNode.id);
8841
+ if ((0, import_core4.isSignal)(value)) {
8842
+ value.value = new DomRef(lastNode);
8666
8843
  continue;
8667
8844
  } else if (typeof value === "function") {
8668
- value(new DomRef(lastNode.id));
8845
+ value(new DomRef(lastNode));
8669
8846
  continue;
8847
+ } else {
8848
+ throw qError(32 /* invalidRefValue */);
8670
8849
  }
8671
8850
  }
8672
- if ((0, import_core3.isSignal)(value)) {
8851
+ if ((0, import_core4.isSignal)(value)) {
8673
8852
  const lastNode = this.getLastNode();
8674
- const signalData = new import_core3._EffectData({
8853
+ const signalData = new import_core4._EffectData({
8675
8854
  $scopedStyleIdPrefix$: styleScopedId,
8676
8855
  $isConst$: isConst
8677
8856
  });
@@ -8688,7 +8867,7 @@ var SSRContainer = class extends import_core3._SharedContainer {
8688
8867
  if (tag === "textarea" && key === "value") {
8689
8868
  if (typeof value !== "string") {
8690
8869
  if (import_build10.isDev) {
8691
- throw new Error("The value of the textarea must be a string");
8870
+ throw qError(40 /* wrongTextareaValue */);
8692
8871
  }
8693
8872
  continue;
8694
8873
  }
@@ -8724,7 +8903,7 @@ var isQwikStyleElement = (tag, attrs) => {
8724
8903
  return false;
8725
8904
  };
8726
8905
  function newTagError(text) {
8727
- return new Error("SsrError(tag): " + text);
8906
+ return qError(29 /* tagError */, [text]);
8728
8907
  }
8729
8908
  function hasDestroy(obj) {
8730
8909
  return obj && typeof obj === "object" && typeof obj.$destroy$ === "function";
@@ -8940,22 +9119,10 @@ function resolveManifest(manifest) {
8940
9119
  }
8941
9120
  var Q_FUNCS_PREFIX = 'document["qFuncs_HASH"]=';
8942
9121
 
8943
- // packages/qwik/src/server/scripts.ts
8944
- var QWIK_LOADER_DEFAULT_MINIFIED = '(()=>{var e=Object.defineProperty,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o,s=(e,s)=>{for(var a in s||(s={}))n.call(s,a)&&r(e,a,s[a]);if(t)for(var a of t(s))o.call(s,a)&&r(e,a,s[a]);return e};((e,t)=>{const n="__q_context__",o=window,r=new Set,a=new Set([e]),i="replace",c="forEach",l="target",f="getAttribute",p="isConnected",b="qvisible",u="_qwikjson_",h=(e,t)=>Array.from(e.querySelectorAll(t)),y=e=>{const t=[];return a.forEach((n=>t.push(...h(n,e)))),t},d=e=>{S(e),h(e,"[q\\\\:shadowroot]").forEach((e=>{const t=e.shadowRoot;t&&d(t)}))},q=e=>e&&"function"==typeof e.then,m=(e,t,n=t.type)=>{y("[on"+e+"\\\\:"+n+"]")[c]((o=>g(o,e,t,n)))},w=t=>{if(void 0===t[u]){let n=(t===e.documentElement?e.body:t).lastElementChild;for(;n;){if("SCRIPT"===n.tagName&&"qwik/json"===n[f]("type")){t[u]=JSON.parse(n.textContent[i](/\\\\x3C(\\/?script)/gi,"<$1"));break}n=n.previousElementSibling}}},v=(e,t)=>new CustomEvent(e,{detail:t}),g=async(t,o,r,a=r.type)=>{const c="on"+o+":"+a;t.hasAttribute("preventdefault:"+a)&&r.preventDefault(),t.hasAttribute("stoppropagation:"+a)&&r.stopPropagation();const l=t._qc_,b=l&&l.li.filter((e=>e[0]===c));if(b&&b.length>0){for(const e of b){const n=e[1].getFn([t,r],(()=>t[p]))(r,t),o=r.cancelBubble;q(n)&&await n,o&&r.stopPropagation()}return}const u=t.qDispatchEvent;if(u)return u(r,o);const h=t[f](c);if(h){const o=t.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"),a=o[f]("q:base"),c=o[f]("q:version")||"unknown",l=o[f]("q:manifest-hash")||"dev",b=new URL(a,e.baseURI);for(const f of h.split("\\n")){const u=new URL(f,b),h=u.href,y=u.hash[i](/^#?([^?[|]*).*$/,"$1")||"default",d=performance.now();let m,v,g;const A=f.startsWith("#"),_={qBase:a,qManifest:l,qVersion:c,href:h,symbol:y,element:t,reqTime:d};if(A){const t=o.getAttribute("q:instance");m=(e["qFuncs_"+t]||[])[Number.parseInt(y)],m||(v="sync",g=Error("sync handler error for symbol: "+y))}else{const e=u.href.split("#")[0];try{const t=import(e);w(o),m=(await t)[y],m||(v="no-symbol",g=Error(`${y} not in ${e}`))}catch(e){v||(v="async"),g=e}}if(!m){E("qerror",s({importError:v,error:g},_)),console.error(g);break}const k=e[n];if(t[p]){const o=async(a=0)=>{try{e[n]=[t,r,u],A||E("qsymbol",s({},_));const o=m(r,t);q(o)&&await o}catch(e){q(e)&&a<100?e.then((()=>o(a++))):E("qerror",s({error:e},_))}finally{e[n]=k}};o()}}}},E=(t,n)=>{e.dispatchEvent(v(t,n))},A=e=>e[i](/([A-Z])/g,(e=>"-"+e.toLowerCase())),_=async e=>{let t=A(e.type),n=e[l];for(m("-document",e,t);n&&n[f];){const o=g(n,"",e,t);let r=e.cancelBubble;q(o)&&await o,r=r||e.cancelBubble||n.hasAttribute("stoppropagation:"+e.type),n=e.bubbles&&!0!==r?n.parentElement:null}},k=e=>{m("-window",e,A(e.type))},C=()=>{var n;const s=e.readyState;if(!t&&("interactive"==s||"complete"==s)&&(a.forEach(d),t=1,E("qinit"),(null!=(n=o.requestIdleCallback)?n:o.setTimeout).bind(o)((()=>E("qidle"))),r.has(b))){const e=y("[on\\\\:"+b+"]"),t=new IntersectionObserver((e=>{for(const n of e)n.isIntersecting&&(t.unobserve(n[l]),g(n[l],"",v(b,n)))}));e[c]((e=>t.observe(e)))}},O=(e,t,n,o=!1)=>e.addEventListener(t,n,{capture:o,passive:!1}),S=(...e)=>{for(const t of e)"string"==typeof t?r.has(t)||(a.forEach((e=>O(e,t,_,!0))),O(o,t,k,!0),r.add(t)):a.has(t)||(r.forEach((e=>O(t,e,_,!0))),a.add(t))};if(!(n in e)){e[n]=0;const t=o.qwikevents;Array.isArray(t)&&S(...t),o.qwikevents={events:r,roots:a,push:S},O(e,"readystatechange",C),C()}})(document)})()';
8945
- var QWIK_LOADER_DEFAULT_DEBUG = '(() => {\n var __defProp = Object.defineProperty;\n var __getOwnPropSymbols = Object.getOwnPropertySymbols;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __propIsEnum = Object.prototype.propertyIsEnumerable;\n var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: value\n }) : obj[key] = value;\n var __spreadValues = (a, b) => {\n for (var prop in b || (b = {})) {\n __hasOwnProp.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n if (__getOwnPropSymbols) {\n for (var prop of __getOwnPropSymbols(b)) {\n __propIsEnum.call(b, prop) && __defNormalProp(a, prop, b[prop]);\n }\n }\n return a;\n };\n ((doc, hasInitialized) => {\n const Q_CONTEXT = "__q_context__";\n const win = window;\n const events = new Set;\n const roots = new Set([ doc ]);\n const nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\n const querySelectorAll = query => {\n const elements = [];\n roots.forEach((root => elements.push(...nativeQuerySelectorAll(root, query))));\n return elements;\n };\n const findShadowRoots = fragment => {\n processEventOrNode(fragment);\n nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]").forEach((parent => {\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }));\n };\n const isPromise = promise => promise && "function" == typeof promise.then;\n const broadcast = (infix, ev, type = ev.type) => {\n querySelectorAll("[on" + infix + "\\\\:" + type + "]").forEach((el => dispatch(el, infix, ev, type)));\n };\n const resolveContainer = containerEl => {\n if (void 0 === containerEl._qwikjson_) {\n let script = (containerEl === doc.documentElement ? doc.body : containerEl).lastElementChild;\n while (script) {\n if ("SCRIPT" === script.tagName && "qwik/json" === script.getAttribute("type")) {\n containerEl._qwikjson_ = JSON.parse(script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1"));\n break;\n }\n script = script.previousElementSibling;\n }\n }\n };\n const createEvent = (eventName, detail) => new CustomEvent(eventName, {\n detail: detail\n });\n const dispatch = async (element, scope, ev, eventName = ev.type) => {\n const attrName = "on" + scope + ":" + eventName;\n element.hasAttribute("preventdefault:" + eventName) && ev.preventDefault();\n element.hasAttribute("stoppropagation:" + eventName) && ev.stopPropagation();\n const ctx = element._qc_;\n const relevantListeners = ctx && ctx.li.filter((li => li[0] === attrName));\n if (relevantListeners && relevantListeners.length > 0) {\n for (const listener of relevantListeners) {\n const results = listener[1].getFn([ element, ev ], (() => element.isConnected))(ev, element);\n const cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble && ev.stopPropagation();\n }\n return;\n }\n const qDispatchEvent = element.qDispatchEvent;\n if (qDispatchEvent) {\n return qDispatchEvent(ev, scope);\n }\n const attrValue = element.getAttribute(attrName);\n if (attrValue) {\n const container = element.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n const qBase = container.getAttribute("q:base");\n const qVersion = container.getAttribute("q:version") || "unknown";\n const qManifest = container.getAttribute("q:manifest-hash") || "dev";\n const base = new URL(qBase, doc.baseURI);\n for (const qrl of attrValue.split("\\n")) {\n const url = new URL(qrl, base);\n const href = url.href;\n const symbol = url.hash.replace(/^#?([^?[|]*).*$/, "$1") || "default";\n const reqTime = performance.now();\n let handler;\n let importError;\n let error;\n const isSync = qrl.startsWith("#");\n const eventData = {\n qBase: qBase,\n qManifest: qManifest,\n qVersion: qVersion,\n href: href,\n symbol: symbol,\n element: element,\n reqTime: reqTime\n };\n if (isSync) {\n const hash = container.getAttribute("q:instance");\n handler = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler) {\n importError = "sync";\n error = new Error("sync handler error for symbol: " + symbol);\n }\n } else {\n const uri = url.href.split("#")[0];\n try {\n const module = import(\n uri);\n resolveContainer(container);\n handler = (await module)[symbol];\n if (!handler) {\n importError = "no-symbol";\n error = new Error(`${symbol} not in ${uri}`);\n }\n } catch (err) {\n importError || (importError = "async");\n error = err;\n }\n }\n if (!handler) {\n emitEvent("qerror", __spreadValues({\n importError: importError,\n error: error\n }, eventData));\n console.error(error);\n break;\n }\n const previousCtx = doc[Q_CONTEXT];\n if (element.isConnected) {\n const handleEvent = async (retryCount = 0) => {\n try {\n doc[Q_CONTEXT] = [ element, ev, url ];\n isSync || emitEvent("qsymbol", __spreadValues({}, eventData));\n const results = handler(ev, element);\n isPromise(results) && await results;\n } catch (error2) {\n isPromise(error2) && retryCount < 100 ? error2.then((() => handleEvent(retryCount++))) : emitEvent("qerror", __spreadValues({\n error: error2\n }, eventData));\n } finally {\n doc[Q_CONTEXT] = previousCtx;\n }\n };\n handleEvent();\n }\n }\n }\n };\n const emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n };\n const camelToKebab = str => str.replace(/([A-Z])/g, (a => "-" + a.toLowerCase()));\n const processDocumentEvent = async ev => {\n let type = camelToKebab(ev.type);\n let element = ev.target;\n broadcast("-document", ev, type);\n while (element && element.getAttribute) {\n const results = dispatch(element, "", ev, type);\n let cancelBubble = ev.cancelBubble;\n isPromise(results) && await results;\n cancelBubble = cancelBubble || ev.cancelBubble || element.hasAttribute("stoppropagation:" + ev.type);\n element = ev.bubbles && !0 !== cancelBubble ? element.parentElement : null;\n }\n };\n const processWindowEvent = ev => {\n broadcast("-window", ev, camelToKebab(ev.type));\n };\n const processReadyStateChange = () => {\n var _a;\n const readyState = doc.readyState;\n if (!hasInitialized && ("interactive" == readyState || "complete" == readyState)) {\n roots.forEach(findShadowRoots);\n hasInitialized = 1;\n emitEvent("qinit");\n (null != (_a = win.requestIdleCallback) ? _a : win.setTimeout).bind(win)((() => emitEvent("qidle")));\n if (events.has("qvisible")) {\n const results = querySelectorAll("[on\\\\:qvisible]");\n const observer = new IntersectionObserver((entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(entry.target, "", createEvent("qvisible", entry));\n }\n }\n }));\n results.forEach((el => observer.observe(el)));\n }\n }\n };\n const addEventListener = (el, eventName, handler, capture = !1) => el.addEventListener(eventName, handler, {\n capture: capture,\n passive: !1\n });\n const processEventOrNode = (...eventNames) => {\n for (const eventNameOrNode of eventNames) {\n if ("string" == typeof eventNameOrNode) {\n if (!events.has(eventNameOrNode)) {\n roots.forEach((root => addEventListener(root, eventNameOrNode, processDocumentEvent, !0)));\n addEventListener(win, eventNameOrNode, processWindowEvent, !0);\n events.add(eventNameOrNode);\n }\n } else if (!roots.has(eventNameOrNode)) {\n events.forEach((eventName => addEventListener(eventNameOrNode, eventName, processDocumentEvent, !0)));\n roots.add(eventNameOrNode);\n }\n }\n };\n if (!(Q_CONTEXT in doc)) {\n doc[Q_CONTEXT] = 0;\n const qwikevents = win.qwikevents;\n Array.isArray(qwikevents) && processEventOrNode(...qwikevents);\n win.qwikevents = {\n events: events,\n roots: roots,\n push: processEventOrNode\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n }\n })(document);\n})()';
8946
- function getQwikLoaderScript(opts = {}) {
8947
- return opts.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
8948
- }
8949
- var QWIK_PREFETCH_MINIFIED = globalThis.QWIK_PREFETCH_MINIFIED;
8950
- var QWIK_PREFETCH_DEBUG = globalThis.QWIK_PREFETCH_DEBUG;
8951
- function getQwikPrefetchWorkerScript(opts = {}) {
8952
- return opts.debug ? QWIK_PREFETCH_DEBUG : QWIK_PREFETCH_MINIFIED;
8953
- }
8954
-
8955
9122
  // packages/qwik/src/server/index.ts
8956
9123
  async function setServerPlatform2(manifest) {
8957
9124
  const platform = createPlatform({ manifest }, resolveManifest(manifest));
8958
- (0, import_core4.setPlatform)(platform);
9125
+ (0, import_core5.setPlatform)(platform);
8959
9126
  }
8960
9127
  // Annotate the CommonJS export names for ESM import in node:
8961
9128
  0 && (module.exports = {