@qwik.dev/core 2.0.0-beta.32 → 2.0.0-beta.34

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * @qwik.dev/core/server 2.0.0-beta.32-dev+0e29f8a
3
+ * @qwik.dev/core/server 2.0.0-beta.34-dev+8b055bb
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
@@ -9,7 +9,7 @@
9
9
  import { setPlatform as setPlatform2 } from "@qwik.dev/core";
10
10
 
11
11
  // packages/qwik/src/server/platform.ts
12
- import { setPlatform as jr } from "@qwik.dev/core";
12
+ import { setPlatform as Pr } from "@qwik.dev/core";
13
13
 
14
14
  import { isDev as isDev5 } from "@qwik.dev/core/build";
15
15
 
@@ -131,7 +131,7 @@ var be = e => Array.isArray(e);
131
131
  var ve = e => typeof e === "string";
132
132
 
133
133
  // packages/qwik/src/core/shared/error/error.ts
134
- var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#Q";
134
+ var baseUrl = "https://qwikdev-build-v2.qwik-8nx.pages.dev/docs/errors/#q";
135
135
 
136
136
  var codeToText = (e, ...t) => {
137
137
  if (re) {
@@ -232,7 +232,7 @@ import { isDev as isDev3 } from "@qwik.dev/core/build";
232
232
 
233
233
  var ke = "<sync>";
234
234
 
235
- var Ia = e => {
235
+ var Na = e => {
236
236
  const t = e.lastIndexOf("_") + 1;
237
237
  return e.slice(t);
238
238
  };
@@ -464,7 +464,7 @@ function encodeVNodeDataString(e) {
464
464
  // packages/qwik/src/core/shared/utils/markers.ts
465
465
  var Ee = "q:renderFn";
466
466
 
467
- var je = "q:slot";
467
+ var Pe = "q:slot";
468
468
 
469
469
  var QSlotParent = "q:sparent";
470
470
 
@@ -502,13 +502,13 @@ var Ue = "/" + Le;
502
502
 
503
503
  var We = "q:ignore";
504
504
 
505
- var Qe = "/" + We;
505
+ var Ve = "/" + We;
506
506
 
507
- var Ve = "q:container";
507
+ var Qe = "q:container";
508
508
 
509
- var Je = "/" + Ve;
509
+ var Je = "/" + Qe;
510
510
 
511
- var Be = "q:template";
511
+ var He = "q:template";
512
512
 
513
513
  var QContainerSelector = "[q\\:container]:not([q\\:container=" + "html" /* HTML */ + "]):not([q\\:container=" + "text" /* TEXT */ + "])";
514
514
 
@@ -655,7 +655,7 @@ var qr = e => {
655
655
  return t.join(" ");
656
656
  };
657
657
 
658
- var Rr = e => e.replace(/([A-Z])/g, "-$1").toLowerCase();
658
+ var _r = e => e.replace(/([A-Z])/g, "-$1").toLowerCase();
659
659
 
660
660
  var stringifyStyle = e => {
661
661
  if (e == null) {
@@ -673,7 +673,7 @@ var stringifyStyle = e => {
673
673
  if (n.startsWith("--")) {
674
674
  t.push(n + ":" + r);
675
675
  } else {
676
- t.push(Rr(n) + ":" + Cr(n, r));
676
+ t.push(_r(n) + ":" + Rr(n, r));
677
677
  }
678
678
  }
679
679
  }
@@ -706,7 +706,7 @@ function isEnumeratedBooleanAttribute(e) {
706
706
  return isAriaAttribute(e) || [ "spellcheck", "draggable", "contenteditable" ].includes(e);
707
707
  }
708
708
 
709
- var Cr = (e, t) => {
709
+ var Rr = (e, t) => {
710
710
  if (typeof t === "number" && t !== 0 && !isUnitlessNumber(e)) {
711
711
  return t + "px";
712
712
  }
@@ -717,11 +717,8 @@ function isAriaAttribute(e) {
717
717
  return e.startsWith("aria-");
718
718
  }
719
719
 
720
- // packages/qwik/src/core/preloader/queue.ts
721
- import { isBrowser as isBrowser3 } from "@qwik.dev/core/build";
722
-
723
720
  // packages/qwik/src/core/preloader/bundle-graph.ts
724
- import { isServer as isServer4 } from "@qwik.dev/core/build";
721
+ import { isServer as isServer3 } from "@qwik.dev/core/build";
725
722
 
726
723
  // packages/qwik/src/core/shared/platform/platform.ts
727
724
  import { isServer as isServer2 } from "@qwik.dev/core/build";
@@ -730,7 +727,7 @@ var Er = () => ({
730
727
  isServer: isServer2,
731
728
  importSymbol(e, t, n) {
732
729
  if (isServer2) {
733
- const e = Ia(n);
730
+ const e = Na(n);
734
731
  const t = globalThis.__qwik_reg_symbols?.get(e);
735
732
  if (t) {
736
733
  return t;
@@ -743,7 +740,7 @@ var Er = () => ({
743
740
  if (!e) {
744
741
  throw Se(13 /* qrlMissingContainer */ , [ t, n ]);
745
742
  }
746
- const r = Tr(e.ownerDocument, e, t).toString();
743
+ const r = Cr(e.ownerDocument, e, t).toString();
747
744
  const s = new URL(r);
748
745
  s.hash = "";
749
746
  const i = s.href;
@@ -761,85 +758,27 @@ var Er = () => ({
761
758
  }
762
759
  });
763
760
 
764
- var Tr = (e, t, n) => {
761
+ var Cr = (e, t, n) => {
765
762
  const r = e.baseURI;
766
763
  const s = new URL(t.getAttribute(ze) ?? r, r);
767
764
  return new URL(n, s);
768
765
  };
769
766
 
770
- var Pr = /* @__PURE__ */ Er();
767
+ var Tr = /* @__PURE__ */ Er();
771
768
 
772
769
  var Or = () => {
773
770
  if (ie) {
774
- return Pr.isServer;
771
+ return Tr.isServer;
775
772
  }
776
773
  return false;
777
774
  };
778
775
 
779
- // packages/qwik/src/core/shared/platform/next-tick.ts
780
- var Ar = e => {
781
- let t;
782
- if (typeof MessageChannel !== "undefined") {
783
- const n = new MessageChannel;
784
- n.port1.onmessage = () => e();
785
- t = () => n.port2.postMessage(null);
786
- } else {
787
- t = () => setTimeout(e);
788
- }
789
- return t;
790
- };
791
-
792
- // packages/qwik/src/core/preloader/constants.ts
793
- import { isServer as isServer3 } from "@qwik.dev/core/build";
794
-
795
- var Mr = import.meta.env.TEST ? !Or() : !isServer3;
796
-
797
- var Nr = Mr ? document : void 0;
798
-
799
- var config = {
800
- t: false,
801
- i: 25,
802
- v: .65
803
- };
804
-
805
- var Ir = Mr && Nr.createElement("link").relList?.supports?.("modulepreload") ? "modulePreload" : "preload";
806
-
807
- var loadStart = performance.now();
808
-
809
- var Fr = /\.[mc]?js$/;
810
-
811
- var Dr = 1e3 / 60;
812
-
813
- // packages/qwik/src/core/preloader/types.ts
814
- var BundleImportState_None = 0;
815
-
816
- var BundleImportState_Queued = 1;
817
-
818
- var BundleImportState_Preload = 2;
819
-
820
- var BundleImportState_Alias = 3;
821
-
822
- var BundleImportState_Loaded = 4;
823
-
824
776
  // packages/qwik/src/core/preloader/bundle-graph.ts
825
777
  var base;
826
778
 
827
779
  var graph;
828
780
 
829
- var isBrowser2 = import.meta.env.TEST ? !Or() : !isServer4;
830
-
831
- var makeBundle = (e, t) => ({
832
- zt: e,
833
- At: Fr.test(e) ? BundleImportState_None : BundleImportState_Alias,
834
- Lt: shouldResetFactor ? t?.map(e => ({
835
- ...e,
836
- Kt: 1
837
- })) : t,
838
- Ut: 1,
839
- Wt: performance.now(),
840
- Qt: 0,
841
- Vt: 0
842
- });
781
+ var Mr = import.meta.env.TEST ? !Or() : !isServer3;
843
782
 
844
783
  var parseBundleGraph = e => {
845
784
  const t = /* @__PURE__ */ new Map;
@@ -855,8 +794,8 @@ var parseBundleGraph = e => {
855
794
  } else {
856
795
  s.push({
857
796
  zt: e[i],
858
- Gt: o,
859
- Kt: 1
797
+ Bt: o,
798
+ Yt: 1
860
799
  });
861
800
  }
862
801
  n++;
@@ -866,34 +805,7 @@ var parseBundleGraph = e => {
866
805
  return t;
867
806
  };
868
807
 
869
- var zr = e => {
870
- let t = Lr.get(e);
871
- if (!t) {
872
- let n;
873
- if (graph) {
874
- n = graph.get(e);
875
- if (!n) {
876
- return;
877
- }
878
- if (!n.length) {
879
- n = void 0;
880
- }
881
- }
882
- t = makeBundle(e, n);
883
- Lr.set(e, t);
884
- }
885
- return t;
886
- };
887
-
888
- var initPreloader = (e, t) => {
889
- if (t) {
890
- if ("debug" in t) {
891
- config.t = !!t.debug;
892
- }
893
- if (typeof t.preloadProbability === "number") {
894
- config.v = 1 - t.preloadProbability;
895
- }
896
- }
808
+ var initPreloader = e => {
897
809
  if (base != null || !e) {
898
810
  return;
899
811
  }
@@ -901,295 +813,8 @@ var initPreloader = (e, t) => {
901
813
  graph = parseBundleGraph(e);
902
814
  };
903
815
 
904
- // packages/qwik/src/core/preloader/queue.ts
905
- var Lr = /* @__PURE__ */ new Map;
906
-
907
- var shouldResetFactor;
908
-
909
- var queueDirty;
910
-
911
- var Ur = 0;
912
-
913
- var Wr = [];
914
-
915
- var Qr = Ar(Fa);
916
-
917
- var Vr = Ar(i);
918
-
919
- var Jr = false;
920
-
921
- var Br = false;
922
-
923
- var Hr = false;
924
-
925
- var Yr = import.meta.env.TEST ? !Or() : isBrowser3;
926
-
927
- var Xr = [];
928
-
929
- var log = (...e) => {
930
- console.log(`Preloader ${performance.now() - loadStart}ms ${Ur}/${Wr.length} queued>`, ...e);
931
- };
932
-
933
- var resetQueue = () => {
934
- Lr.clear();
935
- queueDirty = false;
936
- shouldResetFactor = true;
937
- Ur = 0;
938
- Wr.length = 0;
939
- Xr.length = 0;
940
- Jr = false;
941
- Br = false;
942
- Hr = false;
943
- };
944
-
945
- var sortQueue = () => {
946
- if (queueDirty) {
947
- Wr.sort((e, t) => e.Ut - t.Ut);
948
- queueDirty = false;
949
- }
950
- };
951
-
952
- var getQueue = () => {
953
- sortQueue();
954
- let e = .4;
955
- const t = [];
956
- for (let n = 0; n < Wr.length; n++) {
957
- const r = Wr[n];
958
- const s = Math.round((1 - r.Ut) * 10);
959
- if (s !== e) {
960
- e = s;
961
- t.push(e);
962
- }
963
- t.push(r.zt);
964
- }
965
- return t;
966
- };
967
-
968
- function Fa() {
969
- Jr = false;
970
- if (!Wr.length) {
971
- return;
972
- }
973
- sortQueue();
974
- const e = performance.now() + Dr;
975
- let t = false;
976
- while (Wr.length) {
977
- const n = Wr[0];
978
- const r = n.Ut;
979
- const s = 1 - r;
980
- const i = graph ? config.i :
981
- // While the graph is not available, we limit to 5 preloads
982
- 5;
983
- if (s >= .99 || Ur < i) {
984
- Wr.shift();
985
- Zr(n);
986
- if (performance.now() >= e) {
987
- t = true;
988
- break;
989
- }
990
- } else {
991
- break;
992
- }
993
- }
994
- if (t && Wr.length && !Jr) {
995
- Jr = true;
996
- Qr();
997
- }
998
- if (config.t && !Wr.length) {
999
- const e = [ ...Lr.values() ].filter(e => e.At > BundleImportState_None);
1000
- const t = e.reduce((e, t) => e + t.Qt, 0);
1001
- const n = e.reduce((e, t) => e + t.Vt, 0);
1002
- log(`>>>> done ${e.length}/${Lr.size} total: ${t}ms waited, ${n}ms loaded`);
1003
- }
1004
- }
1005
-
1006
- var Gr = (e, t, n, r) => {
1007
- Xr.unshift({
1008
- Jt: e,
1009
- Ut: t,
1010
- Bt: r,
1011
- Ht: n
1012
- });
1013
- };
1014
-
1015
- var Kr = () => {
1016
- const e = Xr[Xr.length - 1];
1017
- const t = e.Jt;
1018
- if (e.Lt) {
1019
- const n = e.Yt;
1020
- if (n >= e.Lt.length) {
1021
- Xr.pop();
1022
- return false;
1023
- }
1024
- const r = e.Lt[n];
1025
- e.Yt = n + 1;
1026
- const s = zr(r.zt);
1027
- if (s.Ut === 0) {
1028
- return true;
1029
- }
1030
- const i = 1 - t.Ut;
1031
- let o;
1032
- if (i === 1 || i >= .99 && e.Ht.Xt < 100) {
1033
- e.Ht.Xt++;
1034
- o = Math.min(.01, 1 - r.Gt);
1035
- } else {
1036
- const e = 1 - r.Gt * i;
1037
- const t = r.Kt;
1038
- const n = e / t;
1039
- o = Math.max(.02, s.Ut * n);
1040
- r.Kt = n;
1041
- }
1042
- Xr.push({
1043
- Jt: s,
1044
- Ut: o,
1045
- Bt: e.Bt,
1046
- Ht: e.Ht
1047
- });
1048
- return true;
1049
- }
1050
- if (e.Bt?.has(t)) {
1051
- Xr.pop();
1052
- return false;
1053
- }
1054
- const n = t.Ut;
1055
- t.Ut = e.Ut;
1056
- if (n - t.Ut < .01) {
1057
- Xr.pop();
1058
- return false;
1059
- }
1060
- if (
1061
- // don't queue until we have initialized the preloader
1062
- base != null && t.At < BundleImportState_Preload) {
1063
- if (t.At === BundleImportState_None) {
1064
- t.At = BundleImportState_Queued;
1065
- Wr.push(t);
1066
- config.t && log(`queued ${Math.round((1 - t.Ut) * 100)}%`, t.zt);
1067
- }
1068
- queueDirty = true;
1069
- }
1070
- if (t.Lt?.length) {
1071
- const n = e.Bt || /* @__PURE__ */ new Set;
1072
- n.add(t);
1073
- e.Bt = n;
1074
- e.Lt = t.Lt;
1075
- e.Yt = 0;
1076
- return false;
1077
- }
1078
- Xr.pop();
1079
- return false;
1080
- };
1081
-
1082
- function i() {
1083
- if (Hr || !Xr.length) {
1084
- return;
1085
- }
1086
- Br = false;
1087
- Hr = true;
1088
- const e = Yr ? performance.now() + Dr : 0;
1089
- let t = false;
1090
- while (Xr.length) {
1091
- t = true;
1092
- const n = Kr();
1093
- if (Yr && n && performance.now() >= e) {
1094
- if (!Br) {
1095
- Br = true;
1096
- Vr();
1097
- }
1098
- break;
1099
- }
1100
- }
1101
- Hr = false;
1102
- if (t && Yr) {
1103
- Qr();
1104
- }
1105
- }
1106
-
1107
- var Zr = e => {
1108
- if (e.At >= BundleImportState_Preload) {
1109
- return;
1110
- }
1111
- Ur++;
1112
- const t = performance.now();
1113
- e.Qt = t - e.Wt;
1114
- e.At = BundleImportState_Preload;
1115
- config.t && log(`<< load ${Math.round((1 - e.Ut) * 100)}% after ${`${e.Qt}ms`}`, e.zt);
1116
- const n = Nr.createElement("link");
1117
- n.href = new URL(`${base}${e.zt}`, Nr.baseURI).toString();
1118
- n.rel = Ir;
1119
- n.as = "script";
1120
- n.onload = n.onerror = () => {
1121
- Ur--;
1122
- const r = performance.now();
1123
- e.Vt = r - t;
1124
- e.At = BundleImportState_Loaded;
1125
- config.t && log(`>> done after ${e.Vt}ms`, e.zt);
1126
- n.remove();
1127
- Qr();
1128
- };
1129
- Nr.head.appendChild(n);
1130
- };
1131
-
1132
- var adjustProbabilities = (e, t, n) => {
1133
- Gr(e, t, {
1134
- Xt: 0
1135
- }, n);
1136
- if (Yr) {
1137
- Vr();
1138
- } else {
1139
- i();
1140
- }
1141
- };
1142
-
1143
- var ti = (e, t, n) => {
1144
- const r = zr(e);
1145
- if (r && r.Ut > t) {
1146
- if (n) {
1147
- Gr(r, t, n);
1148
- } else {
1149
- adjustProbabilities(r, t);
1150
- }
1151
- }
1152
- };
1153
-
1154
- var preload = (e, t) => {
1155
- if (!e?.length) {
1156
- return;
1157
- }
1158
- let n = t ? 1 - t : .4;
1159
- const r = {
1160
- Xt: 0
1161
- };
1162
- if (Array.isArray(e)) {
1163
- for (let t = e.length - 1; t >= 0; t--) {
1164
- const s = e[t];
1165
- if (typeof s === "number") {
1166
- n = 1 - s / 10;
1167
- } else {
1168
- ti(s, n, r);
1169
- }
1170
- }
1171
- } else {
1172
- ti(e, n, r);
1173
- }
1174
- if (Yr) {
1175
- Vr();
1176
- } else {
1177
- i();
1178
- }
1179
- };
1180
-
1181
- if (import.meta.env.TEST ? !Or() : isBrowser3) {
1182
- document.addEventListener("qsymbol", e => {
1183
- const {symbol: t, href: n} = e.detail;
1184
- if (n) {
1185
- const e = t.slice(t.lastIndexOf("_") + 1);
1186
- preload(e, 1);
1187
- }
1188
- });
1189
- }
1190
-
1191
816
  // packages/qwik/src/core/shared/utils/objects.ts
1192
- var ni = e => {
817
+ var ti = e => {
1193
818
  for (const t in e) {
1194
819
  if (Object.prototype.hasOwnProperty.call(e, t)) {
1195
820
  return false;
@@ -1205,7 +830,7 @@ var GT = ">";
1205
830
 
1206
831
  var CLOSE_TAG = "</";
1207
832
 
1208
- var Lf = " ";
833
+ var zf = " ";
1209
834
 
1210
835
  var ATTR_EQUALS_QUOTE = '="';
1211
836
 
@@ -1219,7 +844,7 @@ var BRACKET_CLOSE = "]";
1219
844
 
1220
845
  var PAREN_CLOSE = ")";
1221
846
 
1222
- var ei = ",";
847
+ var ni = ",";
1223
848
 
1224
849
  // packages/qwik/src/server/platform.ts
1225
850
  var getDevSegmentPath = (e, t, n, r) => {
@@ -1283,7 +908,7 @@ function createPlatform2(e, t) {
1283
908
 
1284
909
  async function setServerPlatform(e, t) {
1285
910
  const n = createPlatform2(e, t);
1286
- jr(n);
911
+ Pr(n);
1287
912
  }
1288
913
 
1289
914
  var getSymbolHash2 = e => {
@@ -1322,95 +947,18 @@ function getBuildBase(e) {
1322
947
  }
1323
948
 
1324
949
  var versions = {
1325
- qwik: "2.0.0-beta.32-dev+0e29f8a",
950
+ qwik: "2.0.0-beta.34-dev+8b055bb",
1326
951
  qwikDom: "2.1.19"
1327
952
  };
1328
953
 
1329
954
  // packages/qwik/src/server/ssr-container.ts
1330
955
  import { isDev as isDev7 } from "@qwik.dev/core/build";
1331
956
 
1332
- import { _SubscriptionData as fs, _SharedContainer as Au, _jsxSorted as xs, _jsxSplit as qs, _res as w, _setEvent, _walkJSX as Cn, _createQRL as Gc, isSignal as Dl } from "@qwik.dev/core/internal";
1333
-
1334
- // packages/qwik/src/server/preload-strategy.ts
1335
- import { getPlatform as _r } from "@qwik.dev/core";
1336
-
1337
- // packages/qwik/src/server/preload-utils.ts
1338
- function flattenPrefetchResources(e) {
1339
- const t = [];
1340
- const n = e => {
1341
- if (e) {
1342
- for (let r = 0; r < e.length; r++) {
1343
- const s = e[r];
1344
- if (!t.includes(s.url)) {
1345
- t.push(s.url);
1346
- if (s.imports) {
1347
- n(s.imports);
1348
- }
1349
- }
1350
- }
1351
- }
1352
- };
1353
- n(e);
1354
- return t;
1355
- }
1356
-
1357
- // packages/qwik/src/server/preload-strategy.ts
1358
- var getBundles = e => {
1359
- const t = _r();
1360
- const n = e?.map(e => {
1361
- const n = e.bt;
1362
- const r = e.vt;
1363
- const s = t.chunkForSymbol(n, r, e.dev?.file);
1364
- if (s) {
1365
- return s[1];
1366
- }
1367
- return r;
1368
- }).filter(Boolean);
1369
- return [ ...new Set(n) ];
1370
- };
1371
-
1372
- function getPreloadPaths(e, t, n) {
1373
- const r = t.prefetchStrategy;
1374
- if (r === null) {
1375
- return [];
1376
- }
1377
- if (!n?.manifest.bundleGraph) {
1378
- return getBundles(e);
1379
- }
1380
- if (typeof r?.symbolsToPrefetch === "function") {
1381
- try {
1382
- const e = r.symbolsToPrefetch({
1383
- manifest: n.manifest
1384
- });
1385
- return flattenPrefetchResources(e);
1386
- } catch (e) {
1387
- console.error("getPrefetchUrls, symbolsToPrefetch()", e);
1388
- }
1389
- }
1390
- const s = /* @__PURE__ */ new Set;
1391
- for (let t = 0; t < e.length; t++) {
1392
- const n = getSymbolHash2(e[t].bt);
1393
- if (n && n.length >= 10) {
1394
- s.add(n);
1395
- }
1396
- }
1397
- return [ ...s ];
1398
- }
1399
-
1400
- var expandBundles = (e, t) => {
1401
- if (!t?.manifest.bundleGraph) {
1402
- return [ ...new Set(e) ];
1403
- }
1404
- resetQueue();
1405
- let n = .99;
1406
- for (let t = 0; t < e.length; t++) {
1407
- preload(e[t], n);
1408
- n *= .95;
1409
- }
1410
- return getQueue();
1411
- };
957
+ import { _SubscriptionData as cs, _SharedContainer as Ou, _jsxSorted as ks, _jsxSplit as xs, _res as w, _setEvent, _walkJSX as Rn, _createQRL as Xc, isSignal as Fl } from "@qwik.dev/core/internal";
1412
958
 
1413
959
  // packages/qwik/src/server/preload-impl.ts
960
+ import { getPlatform as jr } from "@qwik.dev/core";
961
+
1414
962
  var simplifyPath = (e, t) => {
1415
963
  if (t == null) {
1416
964
  return null;
@@ -1429,7 +977,7 @@ var simplifyPath = (e, t) => {
1429
977
  };
1430
978
 
1431
979
  var getBase = e => {
1432
- let t = e.ae;
980
+ let t = e.ce;
1433
981
  if (import.meta.env.DEV && !import.meta.env.TEST) {
1434
982
  t = import.meta.env.BASE_URL;
1435
983
  }
@@ -1445,33 +993,23 @@ var preloaderPre = (e, t, n) => {
1445
993
  o = (import.meta.env.BASE_URL || "/") + o;
1446
994
  }
1447
995
  if (i && o && t !== false) {
1448
- const r = typeof t === "object" ? {
1449
- debug: t.debug,
1450
- preloadProbability: t.ssrPreloadProbability
1451
- } : void 0;
1452
- const a = e.resolvedManifest?.manifest.bundleGraph;
1453
- initPreloader(a, r);
1454
- const l = [];
996
+ const r = e.resolvedManifest?.manifest.bundleGraph;
997
+ initPreloader(r);
998
+ const a = [];
1455
999
  if (t) {
1456
- if (t.debug) {
1457
- l.push("d:1");
1458
- }
1459
1000
  if (t.maxIdlePreloads) {
1460
- l.push(`P:${t.maxIdlePreloads}`);
1461
- }
1462
- if (t.preloadProbability) {
1463
- l.push(`Q:${t.preloadProbability}`);
1001
+ a.push(`P:${t.maxIdlePreloads}`);
1464
1002
  }
1465
1003
  }
1466
- const c = l.length ? `,{${l.join(",")}}` : "";
1467
- const u = {
1004
+ const l = a.length ? `,{${a.join(",")}}` : "";
1005
+ const c = {
1468
1006
  rel: "modulepreload",
1469
1007
  href: i
1470
1008
  };
1471
1009
  if (n) {
1472
- u["nonce"] = n;
1010
+ c["nonce"] = n;
1473
1011
  }
1474
- e.openElement("link", null, u, null, null, null);
1012
+ e.openElement("link", null, c, null, null, null);
1475
1013
  e.closeElement();
1476
1014
  e.openElement("link", null, {
1477
1015
  rel: "preload",
@@ -1480,7 +1018,7 @@ var preloaderPre = (e, t, n) => {
1480
1018
  crossorigin: "anonymous"
1481
1019
  }, null, null, null);
1482
1020
  e.closeElement();
1483
- const d = `let b=fetch("${o}");import("${i}").then(({l})=>l(${JSON.stringify(s)},b${c}));`;
1021
+ const u = `let b=fetch("${o}");import("${i}").then(({l})=>l(${JSON.stringify(s)},b${l}));`;
1484
1022
  const h = {
1485
1023
  type: "module",
1486
1024
  async: true,
@@ -1490,7 +1028,7 @@ var preloaderPre = (e, t, n) => {
1490
1028
  h["nonce"] = n;
1491
1029
  }
1492
1030
  e.openElement("script", null, h, null, null, null);
1493
- e.write(d);
1031
+ e.write(u);
1494
1032
  e.closeElement();
1495
1033
  }
1496
1034
  const a = simplifyPath(s, r?.manifest.core);
@@ -1511,45 +1049,35 @@ var includePreloader = (e, t, n, r) => {
1511
1049
  if (n.length === 0 || t === false) {
1512
1050
  return null;
1513
1051
  }
1514
- const {ssrPreloads: s, ssrPreloadProbability: i} = normalizePreLoaderOptions(typeof t === "boolean" ? void 0 : t);
1515
- let o = s;
1516
- const a = getBase(e);
1517
- const l = [];
1518
- const {resolvedManifest: c} = e;
1519
- if (o) {
1520
- const e = c?.manifest.preloader;
1521
- const t = c?.manifest.core;
1522
- const r = expandBundles(n, c);
1523
- let s = 4;
1524
- const a = i * 10;
1525
- for (let n = 0; n < r.length; n++) {
1526
- const i = r[n];
1527
- if (typeof i === "string") {
1528
- if (s < a) {
1529
- break;
1530
- }
1531
- if (i === e || i === t) {
1532
- continue;
1533
- }
1534
- l.push(i);
1535
- if (--o === 0) {
1536
- break;
1537
- }
1538
- } else {
1539
- s = i;
1052
+ const {ssrPreloads: s} = normalizePreLoaderOptions(typeof t === "boolean" ? void 0 : t);
1053
+ let i = s;
1054
+ const o = getBase(e);
1055
+ const a = [];
1056
+ const {resolvedManifest: l} = e;
1057
+ if (i) {
1058
+ const e = l?.manifest.preloader;
1059
+ const t = l?.manifest.core;
1060
+ for (let r = 0; r < n.length; r++) {
1061
+ const s = n[r];
1062
+ if (s === e || s === t) {
1063
+ continue;
1064
+ }
1065
+ a.push(s);
1066
+ if (--i === 0) {
1067
+ break;
1540
1068
  }
1541
1069
  }
1542
1070
  }
1543
- const u = simplifyPath(a, c?.manifest.preloader);
1544
- const d = l.length ?
1071
+ const c = simplifyPath(o, l?.manifest.preloader);
1072
+ const u = a.length ?
1545
1073
  /**
1546
1074
  * We only use modulepreload links because they behave best. Older browsers can rely on the
1547
1075
  * preloader which does feature detection and which will be available soon after inserting these
1548
1076
  * links.
1549
- */ `${JSON.stringify(l)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(a)}+l;document.head.appendChild(e)});` : "";
1550
- let h = d;
1551
- if (u) {
1552
- h += `window.addEventListener('load',f=>{f=_=>import("${u}").then(({p})=>p(${JSON.stringify(n)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
1077
+ */ `${JSON.stringify(a)}.map((l,e)=>{e=document.createElement('link');e.rel='modulepreload';e.href=${JSON.stringify(o)}+l;document.head.appendChild(e)});` : "";
1078
+ let h = u;
1079
+ if (c) {
1080
+ h += `window.addEventListener('load',f=>{f=_=>import("${c}").then(({p})=>p(${JSON.stringify(n)}));try{requestIdleCallback(f,{timeout:2000})}catch(e){setTimeout(f,200)}})`;
1553
1081
  }
1554
1082
  if (h) {
1555
1083
  const t = {
@@ -1569,11 +1097,9 @@ var includePreloader = (e, t, n, r) => {
1569
1097
 
1570
1098
  var preloaderPost = (e, t, n) => {
1571
1099
  if (t.preloader !== false) {
1572
- const r = Array.from(e.serializationCtx.jt);
1573
- const s = getPreloadPaths(r, t, e.resolvedManifest);
1574
- if (s.length > 0) {
1575
- includePreloader(e, t.preloader, s, n);
1576
- }
1100
+ const r = Array.from(e.serializationCtx.Pt);
1101
+ const s = getBundles(r);
1102
+ includePreloader(e, t.preloader, s, n);
1577
1103
  }
1578
1104
  };
1579
1105
 
@@ -1584,12 +1110,23 @@ function normalizePreLoaderOptions(e) {
1584
1110
  };
1585
1111
  }
1586
1112
 
1113
+ var getBundles = e => {
1114
+ const t = jr();
1115
+ const n = e?.map(e => {
1116
+ const n = e.bt;
1117
+ const r = e.vt;
1118
+ const s = t.chunkForSymbol(n, r, e.dev?.file);
1119
+ if (s) {
1120
+ return s[1];
1121
+ }
1122
+ return r;
1123
+ }).filter(Boolean);
1124
+ return [ ...new Set(n) ];
1125
+ };
1126
+
1587
1127
  var preLoaderOptionsDefault = {
1588
1128
  ssrPreloads: 7,
1589
- ssrPreloadProbability: .5,
1590
- debug: false,
1591
- maxIdlePreloads: 25,
1592
- preloadProbability: .35
1129
+ maxIdlePreloads: 25
1593
1130
  };
1594
1131
 
1595
1132
  // packages/qwik/src/server/scripts.ts
@@ -1597,9 +1134,9 @@ var QWIK_LOADER_DEFAULT_MINIFIED = 'const e=document,t=window,r="w",n="wp",o="d"
1597
1134
 
1598
1135
  var QWIK_LOADER_DEFAULT_DEBUG = 'const doc = document;\nconst win = window;\nconst windowPrefix = "w";\nconst passiveWindowPrefix = "wp";\nconst documentPrefix = "d";\nconst passiveDocumentPrefix = "dp";\nconst elementPrefix = "e";\nconst passiveElementPrefix = "ep";\nconst capturePrefix = "capture:";\nconst events = /* @__PURE__ */ new Set();\nconst roots = /* @__PURE__ */ new Set([doc]);\nconst symbols = /* @__PURE__ */ new Map();\nlet observer;\nlet hasInitialized;\nlet queuedTasks;\nconst nativeQuerySelectorAll = (root, selector) => Array.from(root.querySelectorAll(selector));\nconst querySelectorAll = (query) => {\n const elements = [];\n roots.forEach((root) => elements.push(...nativeQuerySelectorAll(root, query)));\n return elements;\n};\nconst addEventListener = (el, eventName, handler, capture = false, passive = false) => el.addEventListener(eventName, handler, { capture, passive });\nconst findShadowRoots = (fragment) => {\n addEventOrRoot(fragment);\n const shadowRoots = nativeQuerySelectorAll(fragment, "[q\\\\:shadowroot]");\n for (let i = 0; i < shadowRoots.length; i++) {\n const parent = shadowRoots[i];\n const shadowRoot = parent.shadowRoot;\n shadowRoot && findShadowRoots(shadowRoot);\n }\n};\nconst isPromise = (promise) => promise && typeof promise.then === "function";\nconst runTasks = async (tasks) => {\n for (let i = 0; i < tasks.length; i++) {\n await tasks[i]();\n }\n};\nconst queueTasks = (tasks) => {\n if (tasks.length) {\n const run = () => runTasks(tasks);\n queuedTasks = queuedTasks ? queuedTasks.then(run, run) : run();\n }\n};\nconst resolveContainer = (containerEl) => {\n if (containerEl._qwikjson_ === void 0) {\n const parentJSON = containerEl === doc.documentElement ? doc.body : containerEl;\n let script = parentJSON.lastElementChild;\n while (script) {\n if (script.tagName === "SCRIPT" && script.getAttribute("type") === "qwik/json") {\n containerEl._qwikjson_ = JSON.parse(\n script.textContent.replace(/\\\\x3C(\\/?script)/gi, "<$1")\n );\n break;\n }\n script = script.previousElementSibling;\n }\n }\n};\nconst createEvent = (eventName, detail) => new CustomEvent(eventName, { detail });\nconst emitEvent = (eventName, detail) => {\n doc.dispatchEvent(createEvent(eventName, detail));\n};\nconst camelToKebab = (str) => str.replace(/([A-Z-])/g, (a) => "-" + a.toLowerCase());\nconst kebabToCamel = (eventName) => eventName.replace(/-./g, (a) => a[1].toUpperCase());\nconst parseKebabEvent = (event) => {\n const separatorIndex = event.indexOf(":");\n const scope = event.slice(0, separatorIndex);\n return {\n scope,\n eventName: kebabToCamel(event.slice(separatorIndex + 1))\n };\n};\nconst isPassiveScope = (scope) => scope.length === 2;\nconst getRootScope = (scope) => scope.charAt(0);\nconst isElementNode = (node) => !!node && node.nodeType === 1;\nconst isCaptureHandlerElement = (element, scopedKebabName, captureAttribute) => element.hasAttribute(captureAttribute) && (!!element._qDispatch?.[scopedKebabName] || element.hasAttribute("q-" + scopedKebabName));\nconst resolveHandler = (container, element, qBase, base, chunk, symbol, reqTime) => {\n const eventData = {\n qBase,\n symbol,\n element,\n reqTime\n };\n if (chunk === "") {\n const hash = container.getAttribute("q:instance");\n const handler2 = (doc["qFuncs_" + hash] || [])[Number.parseInt(symbol)];\n if (!handler2) {\n const error = new Error("sym:" + symbol);\n emitEvent("qerror", {\n importError: "sync",\n error,\n ...eventData\n });\n console.error(error);\n }\n return handler2;\n }\n const key = `${symbol}|${qBase}|${chunk}`;\n const handler = symbols.get(key);\n if (handler) {\n return handler;\n }\n const href = new URL(chunk, base).href;\n const module = import(\n href\n );\n resolveContainer(container);\n return module.then(\n (module2) => {\n const handler2 = module2[symbol];\n if (!handler2) {\n const error = new Error(`${symbol} not in ${href}`);\n emitEvent("qerror", {\n importError: "no-symbol",\n error,\n ...eventData\n });\n console.error(error);\n } else {\n symbols.set(key, handler2);\n emitEvent("qsymbol", eventData);\n }\n return handler2;\n },\n (error) => {\n emitEvent("qerror", {\n importError: "async",\n error,\n ...eventData\n });\n console.error(error);\n return void 0;\n }\n );\n};\nconst dispatch = (element, ev, scopedKebabName, tasks, kebabName, allowPreventDefault = true) => {\n let defer = false;\n if (kebabName) {\n if (allowPreventDefault && element.hasAttribute("preventdefault:" + kebabName)) {\n ev.preventDefault();\n }\n if (element.hasAttribute("stoppropagation:" + kebabName)) {\n ev.stopPropagation();\n }\n }\n const handlers = element._qDispatch?.[scopedKebabName];\n if (handlers) {\n if (typeof handlers === "function") {\n const run = () => handlers(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n } else if (handlers.length) {\n for (let i = 0; i < handlers.length; i++) {\n const handler = handlers[i];\n if (handler) {\n const run = () => handler(ev, element);\n if (defer) {\n tasks.push(async () => {\n const result = run();\n if (isPromise(result)) {\n await result;\n }\n });\n } else {\n const result = run();\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n }\n return;\n }\n const attrValue = element.getAttribute("q-" + scopedKebabName);\n if (attrValue) {\n const container = element.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n const qBase = container.getAttribute("q:base");\n const base = new URL(qBase, doc.baseURI);\n const qrls = attrValue.split("|");\n for (let i = 0; i < qrls.length; i++) {\n const qrl = qrls[i];\n const reqTime = performance.now();\n const [chunk, symbol, capturedIds] = qrl.split("#");\n const run = (handler2) => {\n if (handler2 && element.isConnected) {\n try {\n const result = handler2.call(capturedIds, ev, element);\n if (isPromise(result)) {\n return result.catch((error) => {\n emitEvent("qerror", {\n error,\n qBase,\n symbol,\n element,\n reqTime\n });\n });\n }\n } catch (error) {\n emitEvent("qerror", {\n error,\n qBase,\n symbol,\n element,\n reqTime\n });\n }\n }\n };\n const handler = resolveHandler(container, element, qBase, base, chunk, symbol, reqTime);\n if (defer || isPromise(handler)) {\n defer = true;\n tasks.push(async () => {\n await run(isPromise(handler) ? await handler : handler);\n });\n } else {\n const result = run(handler);\n if (isPromise(result)) {\n defer = true;\n tasks.push(() => result);\n }\n }\n }\n }\n};\nconst processElementEvent = (ev, scope = elementPrefix, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const captureAttribute = capturePrefix + kebabName;\n const elements = [];\n const captureHandlers = [];\n const tasks = [];\n let current = ev.target;\n while (current) {\n if (isElementNode(current)) {\n elements.push(current);\n captureHandlers.push(isCaptureHandlerElement(current, scopedKebabName, captureAttribute));\n current = current.parentElement;\n } else {\n current = current.parentElement;\n }\n }\n for (let i = elements.length - 1; i >= 0; i--) {\n if (captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n const continuePropagation = !ev.cancelBubble;\n if (!continuePropagation || ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n for (let i = 0; i < elements.length; i++) {\n if (!captureHandlers[i]) {\n dispatch(elements[i], ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n const doBubble = ev.bubbles && !ev.cancelBubble;\n if (!doBubble || ev.cancelBubble) {\n queueTasks(tasks);\n return;\n }\n }\n }\n queueTasks(tasks);\n};\nconst processPassiveElementEvent = (ev) => processElementEvent(ev, passiveElementPrefix, false);\nconst broadcast = (scope, ev, allowPreventDefault = true) => {\n const kebabName = camelToKebab(ev.type);\n const scopedKebabName = scope + ":" + kebabName;\n const elements = querySelectorAll("[q-" + scope + "\\\\:" + kebabName + "]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, scopedKebabName, tasks, kebabName, allowPreventDefault);\n }\n queueTasks(tasks);\n};\nconst processDocumentEvent = (ev) => {\n broadcast(documentPrefix, ev);\n};\nconst processPassiveDocumentEvent = (ev) => {\n broadcast(passiveDocumentPrefix, ev, false);\n};\nconst processWindowEvent = (ev) => {\n broadcast(windowPrefix, ev);\n};\nconst processPassiveWindowEvent = (ev) => {\n broadcast(passiveWindowPrefix, ev, false);\n};\nconst processReadyStateChange = () => {\n const readyState = doc.readyState;\n if (readyState == "interactive" || readyState == "complete") {\n hasInitialized = 1;\n roots.forEach(findShadowRoots);\n if (events.has("d:qinit")) {\n events.delete("d:qinit");\n const ev = createEvent("qinit");\n const elements = querySelectorAll("[q-d\\\\:qinit]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qinit", tasks);\n el.removeAttribute("q-d:qinit");\n }\n queueTasks(tasks);\n }\n if (events.has("d:qidle")) {\n events.delete("d:qidle");\n const riC = win.requestIdleCallback ?? win.setTimeout;\n riC.bind(win)(() => {\n const ev = createEvent("qidle");\n const elements = querySelectorAll("[q-d\\\\:qidle]");\n const tasks = [];\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n dispatch(el, ev, "d:qidle", tasks);\n el.removeAttribute("q-d:qidle");\n }\n queueTasks(tasks);\n });\n }\n if (events.has("e:qvisible")) {\n observer || (observer = new IntersectionObserver((entries) => {\n const tasks = [];\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n if (entry.isIntersecting) {\n observer.unobserve(entry.target);\n dispatch(\n entry.target,\n createEvent("qvisible", entry),\n "e:qvisible",\n tasks\n );\n }\n }\n queueTasks(tasks);\n }));\n const elements = querySelectorAll("[q-e\\\\:qvisible]:not([q\\\\:observed])");\n for (let i = 0; i < elements.length; i++) {\n const el = elements[i];\n observer.observe(el);\n el.setAttribute("q:observed", "true");\n }\n }\n }\n};\nconst addEventOrRoot = (...eventNames) => {\n for (let i = 0; i < eventNames.length; i++) {\n const eventNameOrRoot = eventNames[i];\n if (typeof eventNameOrRoot === "string") {\n if (!events.has(eventNameOrRoot)) {\n events.add(eventNameOrRoot);\n const { scope, eventName } = parseKebabEvent(eventNameOrRoot);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope === windowPrefix) {\n addEventListener(\n win,\n eventName,\n passive ? processPassiveWindowEvent : processWindowEvent,\n true,\n passive\n );\n } else {\n roots.forEach(\n (root) => addEventListener(\n root,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n )\n );\n }\n if (hasInitialized === 1 && (eventNameOrRoot === "e:qvisible" || eventNameOrRoot === "d:qinit" || eventNameOrRoot === "d:qidle")) {\n processReadyStateChange();\n }\n }\n } else {\n if (!roots.has(eventNameOrRoot)) {\n events.forEach((kebabEventName) => {\n const { scope, eventName } = parseKebabEvent(kebabEventName);\n const passive = isPassiveScope(scope);\n const rootScope = getRootScope(scope);\n if (rootScope !== windowPrefix) {\n addEventListener(\n eventNameOrRoot,\n eventName,\n rootScope === documentPrefix ? passive ? processPassiveDocumentEvent : processDocumentEvent : passive ? processPassiveElementEvent : processElementEvent,\n true,\n passive\n );\n }\n });\n roots.add(eventNameOrRoot);\n }\n }\n }\n};\nconst _qwikEv = win._qwikEv;\nif (!_qwikEv?.roots) {\n if (Array.isArray(_qwikEv)) {\n addEventOrRoot(..._qwikEv);\n } else {\n addEventOrRoot("e:click", "e:input");\n }\n win._qwikEv = {\n events,\n roots,\n push: addEventOrRoot\n };\n addEventListener(doc, "readystatechange", processReadyStateChange);\n processReadyStateChange();\n}';
1599
1136
 
1600
- var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `const t='script[type="qwik/backpatch"]',e=document.currentScript;if(e){const o=e.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const e=o.querySelector(t);if(e){const t=JSON.parse(e.textContent||"[]"),n=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let r=n.currentNode,c=r.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const o=t[e],i=t[e+1];let s=t[e+2];for(;c<o&&(r=n.nextNode(),r);)r.hasAttribute(":")&&c++;const l=r;null==s||!1===s?l.removeAttribute(i):("boolean"==typeof s&&(s=""),l.setAttribute(i,s))}}}}`;
1137
+ var QWIK_BACKPATCH_EXECUTOR_MINIFIED = `const t='script[type="qwik/backpatch"]';function e(e,n){const o=n||e.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");if(o){const n=o.querySelector(t);if(n){const t=JSON.parse(n.textContent||"[]"),r=e.createTreeWalker(o,NodeFilter.SHOW_ELEMENT);let c=r.currentNode,i=c.hasAttribute(":")?0:-1;for(let e=0;e<t.length;e+=3){const n=t[e],o=t[e+1];let s=t[e+2];for(;i<n&&(c=r.nextNode(),c);)c.hasAttribute(":")&&i++;const a=c;null==s||!1===s?a.removeAttribute(o):("boolean"==typeof s&&(s=""),a.setAttribute(o,s))}}}}const n=document.currentScript;if(n){const t=n.closest("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");t&&e(document,t)}`;
1601
1138
 
1602
- var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';\nconst executorScript = document.currentScript;\nif (executorScript) {\n const container = executorScript.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n if (container) {\n const script = container.querySelector(BACKPATCH_DATA_SELECTOR);\n if (script) {\n const data = JSON.parse(script.textContent || "[]");\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n let currentNode = walker.currentNode;\n let currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;\n for (let i = 0; i < data.length; i += 3) {\n const elementIdx = data[i];\n const attrName = data[i + 1];\n let value = data[i + 2];\n while (currentNodeIdx < elementIdx) {\n currentNode = walker.nextNode();\n if (!currentNode) {\n break;\n }\n if (currentNode.hasAttribute(":")) {\n currentNodeIdx++;\n }\n }\n const element = currentNode;\n if (value == null || value === false) {\n element.removeAttribute(attrName);\n } else {\n if (typeof value === "boolean") {\n value = "";\n }\n element.setAttribute(attrName, value);\n }\n }\n }\n }\n}`;
1139
+ var QWIK_BACKPATCH_EXECUTOR_DEBUG = `const BACKPATCH_DATA_SELECTOR = 'script[type="qwik/backpatch"]';\nfunction executeBackpatch(doc, containerElement) {\n const container = containerElement || doc.querySelector("[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])");\n if (container) {\n const script = container.querySelector(BACKPATCH_DATA_SELECTOR);\n if (script) {\n const data = JSON.parse(script.textContent || "[]");\n const walker = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);\n let currentNode = walker.currentNode;\n let currentNodeIdx = currentNode.hasAttribute(":") ? 0 : -1;\n for (let i = 0; i < data.length; i += 3) {\n const elementIdx = data[i];\n const attrName = data[i + 1];\n let value = data[i + 2];\n while (currentNodeIdx < elementIdx) {\n currentNode = walker.nextNode();\n if (!currentNode) {\n break;\n }\n if (currentNode.hasAttribute(":")) {\n currentNodeIdx++;\n }\n }\n const element = currentNode;\n if (value == null || value === false) {\n element.removeAttribute(attrName);\n } else {\n if (typeof value === "boolean") {\n value = "";\n }\n element.setAttribute(attrName, value);\n }\n }\n }\n }\n}\nconst executorScript = document.currentScript;\nif (executorScript) {\n const container = executorScript.closest(\n "[q\\\\:container]:not([q\\\\:container=html]):not([q\\\\:container=text])"\n );\n if (container) {\n executeBackpatch(document, container);\n }\n}`;
1603
1140
 
1604
1141
  function getQwikLoaderScript(e = {}) {
1605
1142
  return e.debug ? QWIK_LOADER_DEFAULT_DEBUG : QWIK_LOADER_DEFAULT_MINIFIED;
@@ -1618,7 +1155,7 @@ function getQwikBackpatchExecutorScript(e = {}) {
1618
1155
  }
1619
1156
 
1620
1157
  // packages/qwik/src/server/ssr-node.ts
1621
- import { _isJSXNode as $s, _EMPTY_OBJ, _EFFECT_BACK_REF as si } from "@qwik.dev/core/internal";
1158
+ import { _isJSXNode as ps, _EMPTY_OBJ, _EFFECT_BACK_REF as ii } from "@qwik.dev/core/internal";
1622
1159
 
1623
1160
  import { isDev as isDev6 } from "@qwik.dev/core/build";
1624
1161
 
@@ -1650,7 +1187,7 @@ var SsrNode = class {
1650
1187
  attrs;
1651
1188
  /** Local props which don't serialize; */
1652
1189
  localProps=null;
1653
- get [si]() {
1190
+ get [ii]() {
1654
1191
  return this.getProp(Fe);
1655
1192
  }
1656
1193
  setProp(e, t) {
@@ -1728,7 +1265,7 @@ var SsrNode = class {
1728
1265
 
1729
1266
  var DomRef = class {
1730
1267
  constructor(e) {
1731
- this.Hn = e;
1268
+ this.Jn = e;
1732
1269
  }
1733
1270
  __brand__="DomRef";
1734
1271
  };
@@ -1745,14 +1282,14 @@ var SsrComponentFrame = class {
1745
1282
  distributeChildrenIntoSlots(e, t, n) {
1746
1283
  this.projectionScopedStyle = t;
1747
1284
  this.projectionComponentFrame = n;
1748
- if ($s(e)) {
1285
+ if (ps(e)) {
1749
1286
  const t = this.getSlotName(e);
1750
1287
  pe(this.slots, t, e, 0);
1751
1288
  } else if (Array.isArray(e) && e.length > 0) {
1752
1289
  const t = [];
1753
1290
  for (let n = 0; n < e.length; n++) {
1754
1291
  const r = e[n];
1755
- if ($s(r)) {
1292
+ if (ps(r)) {
1756
1293
  const e = this.getSlotName(r);
1757
1294
  if (e === Ke) {
1758
1295
  t.push(r);
@@ -1780,8 +1317,8 @@ var SsrComponentFrame = class {
1780
1317
  pe(this.slots, e, n, 0);
1781
1318
  }
1782
1319
  getSlotName(e) {
1783
- if (e.props[je]) {
1784
- return e.props[je];
1320
+ if (e.props[Pe]) {
1321
+ return e.props[Pe];
1785
1322
  }
1786
1323
  return Ke;
1787
1324
  }
@@ -2313,14 +1850,14 @@ var StringBufferWriter = class {
2313
1850
  }
2314
1851
  };
2315
1852
 
2316
- var Di = {};
1853
+ var Fi = {};
2317
1854
 
2318
1855
  var QTemplateProps = {
2319
1856
  hidden: true,
2320
1857
  "aria-hidden": true
2321
1858
  };
2322
1859
 
2323
- var SSRContainer = class extends Au {
1860
+ var SSRContainer = class extends Ou {
2324
1861
  tag;
2325
1862
  isHtml;
2326
1863
  writer;
@@ -2362,13 +1899,13 @@ var SSRContainer = class extends Au {
2362
1899
  componentStack=[];
2363
1900
  cleanupQueue=[];
2364
1901
  emitContainerDataFrame=null;
2365
- fe=randomStr();
1902
+ ue=randomStr();
2366
1903
  // Temporary flag to find missing roots after the state was serialized
2367
- S=false;
1904
+ t=false;
2368
1905
  qlInclude;
2369
1906
  promiseAttributes=null;
2370
1907
  constructor(e) {
2371
- super(e.renderOptions.serverData ?? Di, e.locale);
1908
+ super(e.renderOptions.serverData ?? Fi, e.locale);
2372
1909
  this.symbolToChunkResolver = e => {
2373
1910
  const t = e.lastIndexOf("_");
2374
1911
  const n = this.resolvedManifest.mapper[t == -1 ? e : e.substring(t + 1)];
@@ -2381,10 +1918,10 @@ var SSRContainer = class extends Au {
2381
1918
  this.writer = e.writer;
2382
1919
  this.streamHandler = e.streamHandler;
2383
1920
  this.timing = e.timing;
2384
- this.ae = e.buildBase;
1921
+ this.ce = e.buildBase;
2385
1922
  this.resolvedManifest = e.resolvedManifest;
2386
1923
  this.renderOptions = e.renderOptions;
2387
- this.ce = 1e5;
1924
+ this.le = 1e5;
2388
1925
  const t = this.renderOptions.qwikLoader;
2389
1926
  this.qlInclude = t ? typeof t === "object" ? t.include === "never" ? 2 /* Done */ : 0 /* Module */ : t === "inline" ? 1 /* Inline */ : t === "never" ? 2 /* Done */ : 0 /* Module */ : 0 /* Module */;
2390
1927
  if (this.qlInclude === 0 /* Module */) {
@@ -2393,7 +1930,7 @@ var SSRContainer = class extends Au {
2393
1930
  this.qlInclude = 1 /* Inline */;
2394
1931
  }
2395
1932
  }
2396
- this.A();
1933
+ this.i();
2397
1934
  }
2398
1935
  ensureProjectionResolved(e) {}
2399
1936
  handleError(e, t) {
@@ -2418,7 +1955,7 @@ var SSRContainer = class extends Au {
2418
1955
  await this.closeContainer();
2419
1956
  }
2420
1957
  async renderJSX(e, t) {
2421
- await Cn(this, e, t);
1958
+ await Rn(this, e, t);
2422
1959
  }
2423
1960
  setContext(e, t, n) {
2424
1961
  const r = e;
@@ -2461,14 +1998,14 @@ var SSRContainer = class extends Au {
2461
1998
  }
2462
1999
  const e = this.renderOptions.containerAttributes || {};
2463
2000
  const t = e[QRenderAttr];
2464
- e[Ve] = "paused" /* PAUSED */;
2001
+ e[Qe] = "paused" /* PAUSED */;
2465
2002
  e[QRuntimeAttr] = "2";
2466
- e[QVersionAttr] = this.ue ?? "dev";
2003
+ e[QVersionAttr] = this.oe ?? "dev";
2467
2004
  e[QRenderAttr] = (t ? t + "-" : "") + (isDev7 ? "ssr-dev" : "ssr");
2468
- e[ze] = this.ae || "";
2005
+ e[ze] = this.ce || "";
2469
2006
  e[QLocaleAttr] = this.Mt;
2470
2007
  e[QManifestHashAttr] = this.resolvedManifest.manifest.manifestHash;
2471
- e[QInstanceAttr] = this.fe;
2008
+ e[QInstanceAttr] = this.ue;
2472
2009
  this.Dt.containerAttributes = e;
2473
2010
  this.openElement(this.tag, null, e);
2474
2011
  if (!this.isHtml) {
@@ -2515,7 +2052,7 @@ var SSRContainer = class extends Au {
2515
2052
  } else if (import.meta.env.TEST) {
2516
2053
  this.write(EMPTY_ATTR);
2517
2054
  }
2518
- if (r && !ni(r)) {
2055
+ if (r && !ti(r)) {
2519
2056
  l = this.writeAttrs(e, r, true, s, i, o) || l;
2520
2057
  }
2521
2058
  this.write(GT);
@@ -2545,7 +2082,7 @@ var SSRContainer = class extends Au {
2545
2082
  for (let t = 0; t < e.length; t++) {
2546
2083
  const n = e[t];
2547
2084
  if (hasDestroy(n)) {
2548
- n.Cn();
2085
+ n.qn();
2549
2086
  }
2550
2087
  }
2551
2088
  e = this.cleanupQueue.pop();
@@ -2621,7 +2158,7 @@ var SSRContainer = class extends Au {
2621
2158
  if (e.slots.length === 0) {
2622
2159
  return;
2623
2160
  }
2624
- this.openElement(Be, null, QTemplateProps, null);
2161
+ this.openElement(He, null, QTemplateProps, null);
2625
2162
  const t = e.projectionScopedStyle;
2626
2163
  for (let n = 0; n < e.slots.length; n += 2) {
2627
2164
  const r = e.slots[n];
@@ -2657,8 +2194,8 @@ var SSRContainer = class extends Au {
2657
2194
  this.write("\x3c!--" + e + "--\x3e");
2658
2195
  }
2659
2196
  addRoot(e) {
2660
- if (this.S) {
2661
- return this.serializationCtx.oe(e);
2197
+ if (this.t) {
2198
+ return this.serializationCtx.ie(e);
2662
2199
  }
2663
2200
  return this.serializationCtx.kt(e);
2664
2201
  }
@@ -2673,14 +2210,14 @@ var SSRContainer = class extends Au {
2673
2210
  addUnclaimedProjection(e, t, n) {
2674
2211
  e.slots.push(t, n);
2675
2212
  }
2676
- A() {
2213
+ i() {
2677
2214
  const e = this.resolvedManifest.manifest.injections;
2678
2215
  if (!e) {
2679
2216
  return;
2680
2217
  }
2681
2218
  for (let t = 0; t < e.length; t++) {
2682
2219
  const n = e[t];
2683
- const r = qs(n.tag, null, n.attributes || {}, null, 0, null);
2220
+ const r = xs(n.tag, null, n.attributes || {}, null, 0, null);
2684
2221
  if (n.location === "head") {
2685
2222
  this.additionalHeadNodes.push(r);
2686
2223
  } else {
@@ -2688,7 +2225,7 @@ var SSRContainer = class extends Au {
2688
2225
  }
2689
2226
  }
2690
2227
  }
2691
- ve(e, t, n, r) {
2228
+ we(e, t, n, r) {
2692
2229
  if (r) {
2693
2230
  const e = this.getComponentFrame(0);
2694
2231
  e.scopedStyleIds.add(t);
@@ -2698,7 +2235,7 @@ var SSRContainer = class extends Au {
2698
2235
  if (!this.styleIds.has(t)) {
2699
2236
  this.styleIds.add(t);
2700
2237
  if (this.currentElementFrame?.elementName === "html") {
2701
- this.additionalHeadNodes.push(xs("style", null, {
2238
+ this.additionalHeadNodes.push(ks("style", null, {
2702
2239
  dangerouslySetInnerHTML: e,
2703
2240
  [Oe]: t
2704
2241
  }, null, 0, t));
@@ -2717,7 +2254,7 @@ var SSRContainer = class extends Au {
2717
2254
  ////////////////////////////////////
2718
2255
  emitContainerData() {
2719
2256
  return $r(this.resolvePromiseAttributes(), () => $r(this.emitStateData(), () => {
2720
- this.S = true;
2257
+ this.t = true;
2721
2258
  this.emitVNodeData();
2722
2259
  preloaderPost(this, this.renderOptions, this.Dt?.nonce);
2723
2260
  this.emitSyncFnsData();
@@ -2744,7 +2281,7 @@ var SSRContainer = class extends Au {
2744
2281
  * NOTE: Not every element will need vNodeData. So we need to encode how many elements should be
2745
2282
  * skipped. By choosing different separators we can encode different numbers of elements to skip.
2746
2283
  */ emitVNodeData() {
2747
- if (!this.serializationCtx.Qn.length) {
2284
+ if (!this.serializationCtx.Un.length) {
2748
2285
  return;
2749
2286
  }
2750
2287
  this.openElement("script", null, {
@@ -2780,7 +2317,7 @@ var SSRContainer = class extends Au {
2780
2317
  n--;
2781
2318
  this.write(VNodeDataChar.CLOSE_CHAR);
2782
2319
  } else if (i === WRITE_ELEMENT_ATTRS) {
2783
- if (t && !ni(t)) {
2320
+ if (t && !ti(t)) {
2784
2321
  this.write(VNodeDataChar.SEPARATOR_CHAR);
2785
2322
  this.write(VNodeDataChar.SEPARATOR_CHAR);
2786
2323
  this.writeFragmentAttrs(t);
@@ -2860,7 +2397,7 @@ var SSRContainer = class extends Au {
2860
2397
  this.write(VNodeDataChar.CONTEXT_CHAR);
2861
2398
  break;
2862
2399
 
2863
- case je:
2400
+ case Pe:
2864
2401
  this.write(VNodeDataChar.SLOT_CHAR);
2865
2402
  break;
2866
2403
 
@@ -2884,12 +2421,12 @@ var SSRContainer = class extends Au {
2884
2421
  }
2885
2422
  }
2886
2423
  emitStateData() {
2887
- if (!this.serializationCtx.Qn.length) {
2424
+ if (!this.serializationCtx.Un.length) {
2888
2425
  return;
2889
2426
  }
2890
2427
  const e = this.stateScriptAttrs();
2891
2428
  this.openElement("script", null, e);
2892
- return $r(this.serializationCtx._t(), () => {
2429
+ return $r(this.serializationCtx.jt(), () => {
2893
2430
  this.closeElement();
2894
2431
  });
2895
2432
  }
@@ -2897,14 +2434,14 @@ var SSRContainer = class extends Au {
2897
2434
  const e = {
2898
2435
  type: "qwik/state"
2899
2436
  };
2900
- const t = this.serializationCtx.Ct;
2437
+ const t = this.serializationCtx.Rt;
2901
2438
  if (t.size > 0) {
2902
- e["q-d:qidle"] = Gc(null, "_res", w, null, [ ...t ]);
2439
+ e["q-d:qidle"] = Xc(null, "_res", w, null, [ ...t ]);
2903
2440
  }
2904
2441
  return e;
2905
2442
  }
2906
2443
  emitSyncFnsData() {
2907
- const e = this.serializationCtx.re;
2444
+ const e = this.serializationCtx.ne;
2908
2445
  if (e.length) {
2909
2446
  const t = {
2910
2447
  "q:func": "qwik/json"
@@ -2913,9 +2450,9 @@ var SSRContainer = class extends Au {
2913
2450
  t["nonce"] = this.renderOptions.serverData.nonce;
2914
2451
  }
2915
2452
  this.openElement("script", null, t);
2916
- this.write(Q_FUNCS_PREFIX.replace("HASH", this.fe));
2453
+ this.write(Q_FUNCS_PREFIX.replace("HASH", this.ue));
2917
2454
  this.write(BRACKET_OPEN);
2918
- this.writeArray(e, ei);
2455
+ this.writeArray(e, ni);
2919
2456
  this.write(BRACKET_CLOSE);
2920
2457
  this.closeElement();
2921
2458
  }
@@ -2925,7 +2462,7 @@ var SSRContainer = class extends Au {
2925
2462
  for (const [t, n] of this.backpatchMap) {
2926
2463
  for (let r = 0; r < n.length; r++) {
2927
2464
  const s = n[r];
2928
- e.push(t, s.attrName, Dl(s.value) ? s.value.untrackedValue : s.value);
2465
+ e.push(t, s.attrName, Fl(s.value) ? s.value.untrackedValue : s.value);
2929
2466
  }
2930
2467
  }
2931
2468
  this.backpatchMap.clear();
@@ -2963,12 +2500,12 @@ var SSRContainer = class extends Au {
2963
2500
  preloaderPre(this, this.renderOptions.preloader, this.renderOptions.serverData?.nonce);
2964
2501
  }
2965
2502
  isStatic() {
2966
- return this.serializationCtx.jt.size === 0;
2503
+ return this.serializationCtx.Pt.size === 0;
2967
2504
  }
2968
2505
  emitQwikLoaderAtTopIfNeeded() {
2969
2506
  if (this.qlInclude === 0 /* Module */) {
2970
2507
  this.qlInclude = 2 /* Done */;
2971
- const e = this.ae + this.resolvedManifest.manifest.qwikLoader;
2508
+ const e = this.ce + this.resolvedManifest.manifest.qwikLoader;
2972
2509
  const t = {
2973
2510
  rel: "modulepreload",
2974
2511
  href: e
@@ -3013,7 +2550,7 @@ var SSRContainer = class extends Au {
3013
2550
  if (this.qlInclude !== 2 /* Done */) {
3014
2551
  this.emitQwikLoaderInline();
3015
2552
  }
3016
- this.emitQwikEvents(Array.from(this.serializationCtx.Pt, e => JSON.stringify(e)));
2553
+ this.emitQwikEvents(Array.from(this.serializationCtx.Tt, e => JSON.stringify(e)));
3017
2554
  }
3018
2555
  }
3019
2556
  emitQwikEvents(e) {
@@ -3025,7 +2562,7 @@ var SSRContainer = class extends Au {
3025
2562
  }
3026
2563
  this.openElement("script", null, t);
3027
2564
  this.write(`(window._qwikEv||(window._qwikEv=[])).push(`);
3028
- this.writeArray(e, ei);
2565
+ this.writeArray(e, ni);
3029
2566
  this.write(PAREN_CLOSE);
3030
2567
  this.closeElement();
3031
2568
  }
@@ -3134,8 +2671,8 @@ var SSRContainer = class extends Au {
3134
2671
  u = _setEvent(this.serializationCtx, c, u, a);
3135
2672
  } else if (c === "ref") {
3136
2673
  const e = this.getOrCreateLastNode();
3137
- if (Dl(u)) {
3138
- u.Zt = new DomRef(e);
2674
+ if (Fl(u)) {
2675
+ u.Gt = new DomRef(e);
3139
2676
  continue;
3140
2677
  } else if (typeof u === "function") {
3141
2678
  u(new DomRef(e));
@@ -3147,9 +2684,9 @@ var SSRContainer = class extends Au {
3147
2684
  }
3148
2685
  } else if (c === rr || c === ir) {
3149
2686
  u = this.serializationCtx.kt(u);
3150
- } else if (Dl(u)) {
2687
+ } else if (Fl(u)) {
3151
2688
  const e = this.getOrCreateLastNode();
3152
- const t = new fs({
2689
+ const t = new cs({
3153
2690
  M: i,
3154
2691
  et: s
3155
2692
  });
@@ -3167,7 +2704,7 @@ var SSRContainer = class extends Au {
3167
2704
  if (c === fr) {
3168
2705
  if (u) {
3169
2706
  l = String(u);
3170
- c = Ve;
2707
+ c = Qe;
3171
2708
  u = "html" /* HTML */;
3172
2709
  }
3173
2710
  if (e === "style") {
@@ -3184,16 +2721,16 @@ var SSRContainer = class extends Au {
3184
2721
  continue;
3185
2722
  }
3186
2723
  l = escapeHTML(u || "");
3187
- c = Ve;
2724
+ c = Qe;
3188
2725
  u = "text" /* TEXT */;
3189
2726
  }
3190
- const d = r(c, u, i);
3191
- if (d != null && d !== false) {
3192
- this.write(Lf);
2727
+ const h = r(c, u, i);
2728
+ if (h != null && h !== false) {
2729
+ this.write(zf);
3193
2730
  this.write(c);
3194
- if (d !== true) {
2731
+ if (h !== true) {
3195
2732
  this.write(ATTR_EQUALS_QUOTE);
3196
- const e = escapeHTML(String(d));
2733
+ const e = escapeHTML(String(h));
3197
2734
  this.write(e);
3198
2735
  this.write(QUOTE);
3199
2736
  }
@@ -3225,7 +2762,7 @@ function newTagError(e) {
3225
2762
  }
3226
2763
 
3227
2764
  function hasDestroy(e) {
3228
- return e && typeof e === "object" && typeof e.Cn === "function";
2765
+ return e && typeof e === "object" && typeof e.qn === "function";
3229
2766
  }
3230
2767
 
3231
2768
  function isSSRUnsafeAttr(e) {
@@ -3245,7 +2782,7 @@ function randomStr() {
3245
2782
  function addPreventDefaultEventToSerializationContext(e, t) {
3246
2783
  const n = "e" + t.substring(14);
3247
2784
  if (n) {
3248
- e.Pt.add(n);
2785
+ e.Tt.add(n);
3249
2786
  }
3250
2787
  }
3251
2788
 
@@ -3274,6 +2811,8 @@ var StreamHandler = class {
3274
2811
  streamBlockBufferSize=0;
3275
2812
  nativeStream;
3276
2813
  firstFlushTimer=createTimer();
2814
+ pendingFlush;
2815
+ flushQueued=false;
3277
2816
  stream;
3278
2817
  setupStreamWriter() {
3279
2818
  const e = this;
@@ -3286,19 +2825,29 @@ var StreamHandler = class {
3286
2825
  return;
3287
2826
  }
3288
2827
  e.enqueue(t);
2828
+ },
2829
+ waitForDrain() {
2830
+ return e.waitForPendingFlush();
3289
2831
  }
3290
2832
  };
3291
2833
  break;
3292
2834
 
3293
2835
  case "direct":
3294
2836
  {
3295
- const e = this.nativeStream;
2837
+ const n = this.nativeStream;
3296
2838
  t = {
3297
2839
  write(t) {
3298
2840
  if (t === void 0 || t === null) {
3299
2841
  return;
3300
2842
  }
3301
- e.write(t);
2843
+ if (e.pendingFlush) {
2844
+ const r = e.pendingFlush.then(() => n.write(t));
2845
+ return e.trackPendingFlush(r);
2846
+ }
2847
+ return e.trackPendingFlush(n.write(t));
2848
+ },
2849
+ waitForDrain() {
2850
+ return e.waitForPendingFlush();
3302
2851
  }
3303
2852
  };
3304
2853
  break;
@@ -3318,9 +2867,12 @@ var StreamHandler = class {
3318
2867
  if (e.streamBlockDepth === 0) {
3319
2868
  const t = e.networkFlushes === 0 ? r : n;
3320
2869
  if (e.bufferSize >= t) {
3321
- e.flush();
2870
+ return e.flush();
3322
2871
  }
3323
2872
  }
2873
+ },
2874
+ waitForDrain() {
2875
+ return e.waitForPendingFlush();
3324
2876
  }
3325
2877
  };
3326
2878
  break;
@@ -3338,16 +2890,52 @@ var StreamHandler = class {
3338
2890
  this.buffer += e;
3339
2891
  }
3340
2892
  }
2893
+ trackPendingFlush(e) {
2894
+ if (!dr(e)) {
2895
+ return;
2896
+ }
2897
+ const t = Promise.resolve(e).finally(() => {
2898
+ if (this.pendingFlush === t) {
2899
+ this.pendingFlush = void 0;
2900
+ }
2901
+ });
2902
+ this.pendingFlush = t;
2903
+ return t;
2904
+ }
2905
+ flushBuffer() {
2906
+ const e = this.buffer;
2907
+ this.buffer = "";
2908
+ this.bufferSize = 0;
2909
+ this.networkFlushes++;
2910
+ if (this.networkFlushes === 1) {
2911
+ this.timing.firstFlush = this.firstFlushTimer();
2912
+ }
2913
+ return this.trackPendingFlush(this.nativeStream.write(e));
2914
+ }
3341
2915
  flush() {
3342
- if (this.buffer) {
3343
- this.nativeStream.write(this.buffer);
3344
- this.buffer = "";
3345
- this.bufferSize = 0;
3346
- this.networkFlushes++;
3347
- if (this.networkFlushes === 1) {
3348
- this.timing.firstFlush = this.firstFlushTimer();
2916
+ if (!this.buffer) {
2917
+ return this.waitForPendingFlush();
2918
+ }
2919
+ if (this.pendingFlush) {
2920
+ if (!this.flushQueued) {
2921
+ this.flushQueued = true;
2922
+ const e = this.pendingFlush.then(() => {
2923
+ this.flushQueued = false;
2924
+ this.pendingFlush = void 0;
2925
+ return this.flush();
2926
+ });
2927
+ this.pendingFlush = e.finally(() => {
2928
+ if (this.pendingFlush === e) {
2929
+ this.pendingFlush = void 0;
2930
+ }
2931
+ });
3349
2932
  }
2933
+ return this.pendingFlush;
3350
2934
  }
2935
+ return this.flushBuffer();
2936
+ }
2937
+ waitForPendingFlush() {
2938
+ return this.pendingFlush;
3351
2939
  }
3352
2940
  streamBlockStart() {
3353
2941
  this.streamBlockDepth++;
@@ -3359,7 +2947,7 @@ var StreamHandler = class {
3359
2947
  this.bufferSize += this.streamBlockBufferSize;
3360
2948
  this.streamBlockBuffer = "";
3361
2949
  this.streamBlockBufferSize = 0;
3362
- this.flush();
2950
+ return this.flush();
3363
2951
  }
3364
2952
  }
3365
2953
  };
@@ -3409,7 +2997,7 @@ var renderToStream = async (e, t) => {
3409
2997
  await setServerPlatform(t, i);
3410
2998
  await l.render(e);
3411
2999
  await l.l;
3412
- a.flush();
3000
+ await a.flush();
3413
3001
  const c = {
3414
3002
  flushes: a.networkFlushes,
3415
3003
  manifest: i?.manifest,