@solidjs/web 2.0.0-experimental.9 → 2.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +22 -4
  2. package/dist/dev.cjs +1588 -224
  3. package/dist/dev.js +1513 -200
  4. package/dist/server.cjs +2722 -254
  5. package/dist/server.js +2659 -245
  6. package/dist/web.cjs +1524 -218
  7. package/dist/web.js +1449 -194
  8. package/frames/dist/client.cjs +1916 -0
  9. package/frames/dist/client.dev.cjs +1933 -0
  10. package/frames/dist/client.dev.js +1921 -0
  11. package/frames/dist/client.js +1904 -0
  12. package/frames/dist/server.cjs +3756 -0
  13. package/frames/dist/server.js +3743 -0
  14. package/frames/package.json +30 -0
  15. package/package.json +350 -37
  16. package/serialization/decode/package.json +20 -0
  17. package/serialization/dist/decode.cjs +122 -0
  18. package/serialization/dist/decode.js +116 -0
  19. package/serialization/dist/serialization.cjs +244 -0
  20. package/serialization/dist/serialization.js +227 -0
  21. package/serialization/package.json +20 -0
  22. package/serialization/types/index.d.ts +182 -0
  23. package/serialization/types/serializer-decode.d.ts +182 -0
  24. package/serialization/types-cjs/index.d.cts +182 -0
  25. package/serialization/types-cjs/package.json +3 -0
  26. package/serialization/types-cjs/serializer-decode.d.cts +182 -0
  27. package/server-functions/dist/client.cjs +793 -0
  28. package/server-functions/dist/client.js +763 -0
  29. package/server-functions/dist/rich-args.cjs +11 -0
  30. package/server-functions/dist/rich-args.js +9 -0
  31. package/server-functions/dist/server.cjs +1171 -0
  32. package/server-functions/dist/server.dev.cjs +1171 -0
  33. package/server-functions/dist/server.dev.js +1137 -0
  34. package/server-functions/dist/server.js +1137 -0
  35. package/server-functions/package.json +40 -0
  36. package/server-functions/rich-args/package.json +20 -0
  37. package/storage/package.json +8 -3
  38. package/storage/types/index.d.ts +26 -0
  39. package/storage/types-cjs/index.d.cts +28 -0
  40. package/storage/types-cjs/package.json +3 -0
  41. package/types/client.d.ts +290 -27
  42. package/types/cookies.d.ts +93 -0
  43. package/types/core.d.ts +6 -2
  44. package/types/frames/client.d.ts +36 -0
  45. package/types/frames/frame-client.d.ts +338 -0
  46. package/types/frames/frame-sink.d.ts +194 -0
  47. package/types/frames/frame-transport.d.ts +222 -0
  48. package/types/frames/serializer.d.ts +182 -0
  49. package/types/frames/server.d.ts +52 -0
  50. package/types/index.d.ts +223 -24
  51. package/types/jsx-properties.d.ts +93 -0
  52. package/types/jsx.d.ts +4159 -1
  53. package/types/response.d.ts +174 -0
  54. package/types/serializer-decode.d.ts +182 -0
  55. package/types/serializer.d.ts +182 -0
  56. package/types/server-functions/client.d.ts +231 -0
  57. package/types/server-functions/flash.d.ts +38 -0
  58. package/types/server-functions/rich-args.d.ts +10 -0
  59. package/types/server-functions/server.d.ts +616 -0
  60. package/types/server-functions/shared.d.ts +523 -0
  61. package/types/server-mock.d.ts +249 -12
  62. package/types/server.d.ts +424 -51
  63. package/types-cjs/client.d.cts +337 -0
  64. package/types-cjs/cookies.d.cts +93 -0
  65. package/types-cjs/core.d.cts +6 -0
  66. package/types-cjs/frames/client.d.cts +36 -0
  67. package/types-cjs/frames/frame-client.d.cts +338 -0
  68. package/types-cjs/frames/frame-sink.d.cts +194 -0
  69. package/types-cjs/frames/frame-transport.d.cts +222 -0
  70. package/types-cjs/frames/serializer.d.cts +182 -0
  71. package/types-cjs/frames/server.d.cts +52 -0
  72. package/types-cjs/index.d.cts +244 -0
  73. package/types-cjs/jsx-properties.d.cts +93 -0
  74. package/types-cjs/jsx.d.cts +4159 -0
  75. package/types-cjs/package.json +3 -0
  76. package/types-cjs/response.d.cts +174 -0
  77. package/types-cjs/serializer-decode.d.cts +182 -0
  78. package/types-cjs/serializer.d.cts +182 -0
  79. package/types-cjs/server-functions/client.d.cts +231 -0
  80. package/types-cjs/server-functions/flash.d.cts +38 -0
  81. package/types-cjs/server-functions/rich-args.d.cts +10 -0
  82. package/types-cjs/server-functions/server.d.cts +616 -0
  83. package/types-cjs/server-functions/shared.d.cts +523 -0
  84. package/types-cjs/server-mock.d.cts +277 -0
  85. package/types-cjs/server.d.cts +523 -0
package/dist/dev.js CHANGED
@@ -1,33 +1,91 @@
1
- import { createMemo, createRoot, flatten, untrack, createRenderEffect, sharedConfig, enableHydration, $DEVCOMP, omit } from 'solid-js';
2
- export { ErrorBoundary, For, Match, Show, Suspense, Switch, createComponent, createRenderEffect as effect, getOwner, merge as mergeProps, untrack } from 'solid-js';
1
+ import { createRenderEffect, createMemo, runWithOwner, sharedConfig, untrack, flatten, createRoot, merge, createComponent, omit, createOwner, createSignal, $DEVCOMP, onCleanup, enableHydration, enforceLoadingBoundary, flush, getOwner, createEffect } from 'solid-js';
2
+ export { Errored, For, Hydration, Loading, Match, NoHydration, Repeat, Reveal, Show, Switch, createComponent, getOwner, untrack } from 'solid-js';
3
3
 
4
- const Properties = /*#__PURE__*/new Set([
5
- "value", "checked", "selected", "muted"]);
4
+ const DOMWithState = {
5
+ INPUT: {
6
+ value: 1,
7
+ defaultValue: 2,
8
+ checked: 1,
9
+ defaultChecked: 2
10
+ },
11
+ SELECT: {
12
+ value: 1
13
+ },
14
+ OPTION: {
15
+ value: 1,
16
+ selected: 1,
17
+ defaultSelected: 2
18
+ },
19
+ TEXTAREA: {
20
+ value: 1,
21
+ defaultValue: 2
22
+ },
23
+ VIDEO: {
24
+ muted: 1,
25
+ defaultMuted: 2
26
+ },
27
+ AUDIO: {
28
+ muted: 1,
29
+ defaultMuted: 2
30
+ }
31
+ };
6
32
  const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
33
+ const $$SLOT = /*#__PURE__*/Symbol("slot");
34
+ const $$HOST = /*#__PURE__*/Symbol("host");
7
35
  const DelegatedEvents = /*#__PURE__*/new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
8
36
  const SVGElements = /*#__PURE__*/new Set([
9
37
  "altGlyph", "altGlyphDef", "altGlyphItem", "animate", "animateColor", "animateMotion", "animateTransform", "circle", "clipPath", "color-profile", "cursor", "defs", "desc", "ellipse", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "filter", "font", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignObject", "g", "glyph", "glyphRef", "hkern", "image", "line", "linearGradient", "marker", "mask", "metadata", "missing-glyph", "mpath", "path", "pattern", "polygon", "polyline", "radialGradient", "rect",
10
38
  "set", "stop",
11
39
  "svg", "switch", "symbol", "text", "textPath",
12
40
  "tref", "tspan", "use", "view", "vkern"]);
13
- const SVGNamespace = {
41
+ const MathMLElements = /*#__PURE__*/new Set(["annotation", "annotation-xml", "maction", "math", "menclose", "merror", "mfenced", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics"]);
42
+ const Namespaces = {
43
+ svg: "http://www.w3.org/2000/svg",
44
+ mathml: "http://www.w3.org/1998/Math/MathML",
14
45
  xlink: "http://www.w3.org/1999/xlink",
15
46
  xml: "http://www.w3.org/XML/1998/namespace"
16
47
  };
17
- const DOMElements = /*#__PURE__*/new Set(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "main", "nav", "section", "body", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "param", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "menu", "summary", "details", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "bgsound", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "head", "header", "hgroup", "hr", "html", "i", "iframe", "image", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "marquee", "menu", "menuitem", "meta", "meter", "nav", "nobr", "noembed", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "plaintext", "portal", "pre", "progress", "q", "rb", "rp", "rt", "rtc", "ruby", "s", "samp", "script", "section", "select", "shadow", "slot", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr", "xmp", "input", "h1", "h2", "h3", "h4", "h5", "h6",
18
- "webview",
19
- "isindex", "listing", "multicol", "nextid", "noindex", "search"]);
48
+ const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
49
+ const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
50
+ const DOMElements = /*#__PURE__*/new Set(/*#__PURE__*/"a,abbr,acronym,address,applet,area,article,aside,audio,b,base,basefont,bdi,bdo,bgsound,big,blink,blockquote,body,br,button,canvas,caption,center,cite,code,col,colgroup,content,data,datalist,dd,del,details,dfn,dialog,dir,div,dl,dt,em,embed,fieldset,figcaption,figure,font,footer,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,i,iframe,image,img,input,ins,isindex,kbd,keygen,label,legend,li,link,listing,main,map,mark,marquee,math,menu,menuitem,meta,meter,multicol,nav,nextid,nobr,noembed,noframes,noindex,noscript,object,ol,optgroup,option,output,p,param,picture,plaintext,portal,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,script,search,section,select,shadow,slot,small,source,spacer,span,strike,strong,style,sub,summary,sup,svg,table,tbody,td,template,textarea,tfoot,th,thead,time,title,tr,track,tt,u,ul,var,video,wbr,webview,xmp".split(","));
20
51
 
21
- const memo = fn => createMemo(() => fn());
52
+ const transparentOptions = {
53
+ transparent: true,
54
+ sync: true
55
+ };
56
+ const syncOptions = {
57
+ sync: true
58
+ };
59
+ const effect = (fn, effectFn, options) => createRenderEffect(fn, effectFn, options ? {
60
+ sync: true,
61
+ ...options,
62
+ transparent: !options.scope
63
+ } : transparentOptions);
64
+ const memo = fn => createMemo(() => fn(), syncOptions);
65
+ const assetGates = new WeakMap();
66
+ const waitAsset = promise => {
67
+ let gate = assetGates.get(promise);
68
+ if (!gate) {
69
+ runWithOwner(null, () => {
70
+ gate = createMemo(() => promise);
71
+ });
72
+ assetGates.set(promise, gate);
73
+ }
74
+ gate();
75
+ };
22
76
 
23
- function reconcileArrays(parentNode, a, b) {
77
+ function reconcileArrays(parentNode, a, b, marker) {
24
78
  let bLength = b.length,
25
79
  aEnd = a.length,
26
80
  bEnd = bLength,
27
81
  aStart = 0,
28
82
  bStart = 0,
29
- after = a[aEnd - 1].nextSibling,
30
- map = null;
83
+ tail = a[aEnd - 1],
84
+ tailTag = tail[$$SLOT],
85
+ after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
86
+ map = null,
87
+ anchor,
88
+ anchorTag;
31
89
  while (aStart < aEnd || bStart < bEnd) {
32
90
  if (a[aStart] === b[bStart]) {
33
91
  aStart++;
@@ -39,18 +97,43 @@ function reconcileArrays(parentNode, a, b) {
39
97
  bEnd--;
40
98
  }
41
99
  if (aEnd === aStart) {
42
- const node = bEnd < bLength ? bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart] : after;
43
- while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
100
+ let node;
101
+ if (bEnd < bLength) {
102
+ if (bStart) {
103
+ const prev = b[bStart - 1];
104
+ const prevTag = prev[$$SLOT];
105
+ node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
106
+ } else node = b[bEnd - bStart];
107
+ } else node = after;
108
+ while (bStart < bEnd) {
109
+ const n = b[bStart++];
110
+ parentNode.insertBefore(n, node);
111
+ if (marker) n[$$SLOT] = marker;
112
+ }
44
113
  } else if (bEnd === bStart) {
45
114
  while (aStart < aEnd) {
46
- if (!map || !map.has(a[aStart])) a[aStart].remove();
47
- aStart++;
115
+ const n = a[aStart++];
116
+ if (!map || !map.has(n)) {
117
+ const tag = n[$$SLOT];
118
+ if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
119
+ }
120
+ }
121
+ } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
122
+ if (marker) {
123
+ do {
124
+ const n = a[--aEnd];
125
+ parentNode.insertBefore(n, anchor);
126
+ n[$$SLOT] = marker;
127
+ bStart++;
128
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
129
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
130
+ } else {
131
+ do {
132
+ parentNode.insertBefore(a[--aEnd], anchor);
133
+ bStart++;
134
+ if (aStart >= aEnd - 1 || bStart >= bEnd) break;
135
+ } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
48
136
  }
49
- } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
50
- const node = a[--aEnd].nextSibling;
51
- parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
52
- parentNode.insertBefore(b[--bEnd], node);
53
- a[aEnd] = b[bEnd];
54
137
  } else {
55
138
  if (!map) {
56
139
  map = new Map();
@@ -68,78 +151,338 @@ function reconcileArrays(parentNode, a, b) {
68
151
  sequence++;
69
152
  }
70
153
  if (sequence > index - bStart) {
71
- const node = a[aStart];
72
- while (bStart < index) parentNode.insertBefore(b[bStart++], node);
73
- } else parentNode.replaceChild(b[bStart++], a[aStart++]);
154
+ const head = a[aStart];
155
+ const headTag = head[$$SLOT];
156
+ const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
157
+ while (bStart < index) {
158
+ const n = b[bStart++];
159
+ parentNode.insertBefore(n, node);
160
+ if (marker) n[$$SLOT] = marker;
161
+ }
162
+ } else {
163
+ const oldNode = a[aStart++];
164
+ const newNode = b[bStart++];
165
+ const oldTag = oldNode[$$SLOT];
166
+ if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
167
+ parentNode.replaceChild(newNode, oldNode);
168
+ } else {
169
+ parentNode.insertBefore(newNode, after);
170
+ }
171
+ if (marker) newNode[$$SLOT] = marker;
172
+ }
74
173
  } else aStart++;
75
- } else a[aStart++].remove();
174
+ } else {
175
+ const n = a[aStart++];
176
+ const nTag = n[$$SLOT];
177
+ if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
178
+ }
76
179
  }
77
180
  }
78
181
  }
79
182
 
80
- const $$EVENTS = "_$DX_DELEGATE";
81
- function render(code, element, init, options = {}) {
183
+ const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
184
+ const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
185
+ const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
186
+ const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
187
+ const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
188
+ function evalHeadValue(v) {
189
+ return typeof v === "function" ? v() : v;
190
+ }
191
+ function evalHeadProps(props, presets) {
192
+ const out = {};
193
+ for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
194
+ return out;
195
+ }
196
+ function classifyHeadTag(desc) {
197
+ const tag = desc.tag;
198
+ if (tag === "link") {
199
+ const rel = evalHeadValue(desc.props && desc.props.rel);
200
+ return {
201
+ resource: RESOURCE_LINK_RELS.has(rel),
202
+ rel
203
+ };
204
+ }
205
+ if (tag === "style") return {
206
+ resource: !!(desc.props && "href" in desc.props)
207
+ };
208
+ if (tag === "script") return {
209
+ resource: !!(desc.props && "src" in desc.props)
210
+ };
211
+ return {
212
+ resource: false
213
+ };
214
+ }
215
+ function resourceIdentity(tag, props) {
216
+ let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
217
+ for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
218
+ const q = RESOURCE_QUALIFIERS[i];
219
+ if (props[q] != null) id += ":" + q + "=" + props[q];
220
+ }
221
+ return id;
222
+ }
223
+ function replaceableIdentity(tag, props, key, unique) {
224
+ if (tag === "title") return "title";
225
+ if (tag === "base") return "base";
226
+ if (tag === "meta" && props.charset != null) return "charset";
227
+ if (key != null) return tag + ":key:" + key;
228
+ if (tag === "meta") {
229
+ for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
230
+ return unique;
231
+ }
232
+ if (tag === "link") {
233
+ const rel = props.rel || "";
234
+ if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
235
+ return "link:" + rel + ":" + (props.href || "");
236
+ }
237
+ return unique;
238
+ }
239
+ function resolveHead(groups) {
240
+ const winners = new Map();
241
+ const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
242
+ for (let i = 0; i < sorted.length; i++) {
243
+ const group = sorted[i];
244
+ const byIdentity = new Map();
245
+ for (let j = 0; j < group.tags.length; j++) {
246
+ const t = group.tags[j];
247
+ let list = byIdentity.get(t.identity);
248
+ if (!list) byIdentity.set(t.identity, list = []);
249
+ list.push(t);
250
+ }
251
+ for (const [identity, tags] of byIdentity) {
252
+ if (identity === "title") {
253
+ if (tags.length > 1) console.warn("Multiple <title> tags in one head group; the last one wins.");
254
+ winners.set(identity, {
255
+ seq: group.seq,
256
+ tags: [tags[tags.length - 1]]
257
+ });
258
+ } else {
259
+ winners.set(identity, {
260
+ seq: group.seq,
261
+ tags
262
+ });
263
+ }
264
+ }
265
+ }
266
+ return winners;
267
+ }
268
+
269
+ function parseCookieHeader(header) {
270
+ const cookies = {};
271
+ if (!header) return cookies;
272
+ for (const part of header.split(";")) {
273
+ const eq = part.indexOf("=");
274
+ if (eq < 0) continue;
275
+ const name = decodeSafe(part.slice(0, eq).trim());
276
+ let value = part.slice(eq + 1).trim();
277
+ if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
278
+ value = value.slice(1, -1);
279
+ }
280
+ cookies[name] = decodeSafe(value);
281
+ }
282
+ return cookies;
283
+ }
284
+ function decodeSafe(text) {
285
+ try {
286
+ return decodeURIComponent(text);
287
+ } catch {
288
+ return text;
289
+ }
290
+ }
291
+ function serializeCookie(name, value, options = {}) {
292
+ let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
293
+ cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
294
+ if (options.domain) cookie += `; Domain=${options.domain}`;
295
+ if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
296
+ if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
297
+ if (options.httpOnly) cookie += "; HttpOnly";
298
+ if (options.secure) cookie += "; Secure";
299
+ if (options.sameSite) {
300
+ const sameSite = options.sameSite.toLowerCase();
301
+ cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
302
+ }
303
+ return cookie;
304
+ }
305
+ const FLASH_COOKIE = "flash";
306
+ const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
307
+ function hasFlashCookie(cookieHeader) {
308
+ return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
309
+ }
310
+ function clearFlashCookie() {
311
+ return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
312
+ }
313
+
314
+ const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
315
+ function getServerFunctionMetadata(fn) {
316
+ if (typeof fn !== "function") return undefined;
317
+ return fn[SERVER_FUNCTION_METADATA] || undefined;
318
+ }
319
+ function isServerFunction(fn) {
320
+ return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
321
+ }
322
+ const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
323
+ function getServerFunctionRPC() {
324
+ return globalThis[SERVER_FUNCTION_RPC];
325
+ }
326
+
327
+ const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
328
+ const INNER_OWNED = {};
329
+ const delegatedEvents = new Set();
330
+ const delegatedContainers = new Map();
331
+ function render$1(code, element, init, options = {}) {
82
332
  if (!element) {
83
333
  throw new Error("The `element` passed to `render(..., element)` doesn't exist. Make sure `element` exists in the document.");
84
334
  }
85
335
  let disposer;
86
- createRoot(dispose => {
87
- disposer = dispose;
88
- element === document ? flatten(code) : insert(element, code(), element.firstChild ? null : undefined, init);
89
- }, {
90
- id: options.renderId
91
- });
336
+ registerDelegatedRoot(element);
337
+ try {
338
+ createRoot(dispose => {
339
+ disposer = dispose;
340
+ if (element === document) {
341
+ const tree = code();
342
+ effect(() => flatten(tree), () => {});
343
+ } else {
344
+ const tree = code();
345
+ insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
346
+ }
347
+ }, {
348
+ id: options.renderId
349
+ });
350
+ } catch (err) {
351
+ if (disposer) disposer();
352
+ unregisterDelegatedRoot(element);
353
+ throw err;
354
+ }
92
355
  return () => {
93
356
  disposer();
357
+ unregisterDelegatedRoot(element);
94
358
  element.textContent = "";
95
359
  };
96
360
  }
97
- function template(html, isImportNode, isSVG, isMathML) {
361
+ function create(html, bypassGuard, flag) {
362
+ if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
363
+ const t = document.createElement("template");
364
+ t.innerHTML = html;
365
+ return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
366
+ }
367
+ function template(html, flag) {
98
368
  let node;
99
- const create = () => {
100
- if (isHydrating()) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
101
- const t = isMathML ? document.createElementNS("http://www.w3.org/1998/Math/MathML", "template") : document.createElement("template");
102
- t.innerHTML = html;
103
- return isSVG ? t.content.firstChild.firstChild : isMathML ? t.firstChild : t.content.firstChild;
104
- };
105
- return isImportNode ? () => untrack(() => document.importNode(node || (node = create()), true)) : () => (node || (node = create())).cloneNode(true);
369
+ const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
370
+ fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
371
+ return fn;
106
372
  }
107
- function delegateEvents(eventNames, document = window.document) {
108
- const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
373
+ function delegateEvents(eventNames) {
109
374
  for (let i = 0, l = eventNames.length; i < l; i++) {
110
375
  const name = eventNames[i];
111
- if (!e.has(name)) {
112
- e.add(name);
113
- document.addEventListener(name, eventHandler);
376
+ if (!delegatedEvents.has(name)) {
377
+ delegatedEvents.add(name);
378
+ delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
114
379
  }
115
380
  }
116
381
  }
117
- function clearDelegatedEvents(document = window.document) {
118
- if (document[$$EVENTS]) {
119
- for (let name of document[$$EVENTS].keys()) document.removeEventListener(name, eventHandler);
120
- delete document[$$EVENTS];
382
+ function registerDelegatedRoot(root) {
383
+ const state = registerDelegatedContainer(root, root);
384
+ if (state) state.roots = (state.roots || 0) + 1;
385
+ }
386
+ function unregisterDelegatedRoot(root) {
387
+ const state = delegatedContainers.get(root);
388
+ if (state) state.roots > 1 ? state.roots-- : delete state.roots;
389
+ unregisterDelegatedContainer(root, root);
390
+ }
391
+ function registerDelegatedContainer(container, owner = container) {
392
+ if (!container || !owner) return;
393
+ let state = delegatedContainers.get(container);
394
+ if (!state) delegatedContainers.set(container, state = {
395
+ owners: new Map(),
396
+ handlers: new Map()
397
+ });
398
+ state.owners.set(owner, (state.owners.get(owner) || 0) + 1);
399
+ delegatedEvents.forEach(name => attachDelegatedEvent(name, container, state));
400
+ return state;
401
+ }
402
+ function unregisterDelegatedContainer(container, owner = container) {
403
+ const state = delegatedContainers.get(container);
404
+ if (!state) return;
405
+ const count = state.owners.get(owner);
406
+ if (count > 1) state.owners.set(owner, count - 1);else state.owners.delete(owner);
407
+ if (state.owners.size) return;
408
+ state.handlers.forEach((handler, name) => container.removeEventListener(name, handler));
409
+ delegatedContainers.delete(container);
410
+ }
411
+ function attachDelegatedEvent(name, container, state) {
412
+ if (state.handlers.has(name)) return;
413
+ const handler = e => eventHandler(e, container, state);
414
+ state.handlers.set(name, handler);
415
+ container.addEventListener(name, handler);
416
+ }
417
+ function getDelegatedRoot(node) {
418
+ while (node) {
419
+ if (delegatedContainers.get(node)?.roots) return node;
420
+ node = node._$host || node.parentNode || node.host;
421
+ }
422
+ }
423
+ function findOwner(target, state) {
424
+ let node = target;
425
+ let distance = 0;
426
+ while (node) {
427
+ if (state.owners.has(node)) return {
428
+ owner: node,
429
+ distance
430
+ };
431
+ distance++;
432
+ node = node._$host || node.parentNode || node.host;
121
433
  }
122
434
  }
123
435
  function setProperty(node, name, value) {
124
436
  if (isHydrating(node)) return;
125
437
  node[name] = value;
126
438
  }
439
+ let claimHandlers = null;
440
+ const CLAIM_SEAM = Symbol.for("dom-expressions.element-claims");
441
+ function registerElementClaim(handler) {
442
+ (claimHandlers || (claimHandlers = globalThis[CLAIM_SEAM] = [])).push(handler);
443
+ return () => {
444
+ const index = claimHandlers.indexOf(handler);
445
+ index > -1 && claimHandlers.splice(index, 1);
446
+ };
447
+ }
448
+ const CLAIMED_ELEMENTS = "a[href], form[action]";
449
+ function claimElementTree(root) {
450
+ const handlers = globalThis[CLAIM_SEAM];
451
+ if (handlers === undefined || handlers.length === 0) return root;
452
+ const isElement = root.nodeType === 1;
453
+ if (!isElement && root.nodeType !== 11) return root;
454
+ if (isElement && root.matches(CLAIMED_ELEMENTS)) {
455
+ for (let i = 0; i < handlers.length; i++) handlers[i](root);
456
+ }
457
+ const found = root.querySelectorAll(CLAIMED_ELEMENTS);
458
+ for (let i = 0; i < found.length; i++) {
459
+ for (let j = 0; j < handlers.length; j++) handlers[j](found[i]);
460
+ }
461
+ return root;
462
+ }
463
+ function claimElement(node) {
464
+ if (claimHandlers !== null) {
465
+ for (let i = 0; i < claimHandlers.length; i++) claimHandlers[i](node);
466
+ }
467
+ return node;
468
+ }
127
469
  function setAttribute(node, name, value) {
128
470
  if (isHydrating(node)) return;
129
471
  if (value == null || value === false) node.removeAttribute(name);else node.setAttribute(name, value === true ? "" : value);
472
+ if (claimHandlers !== null && (name === "href" || name === "action")) claimElement(node);
130
473
  }
131
474
  function setAttributeNS(node, namespace, name, value) {
132
475
  if (isHydrating(node)) return;
133
- if (value == null) node.removeAttributeNS(namespace, name);else node.setAttributeNS(namespace, name, value);
476
+ if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
134
477
  }
135
- function className(node, value, isSVG, prev) {
478
+ function className(node, value, prev) {
136
479
  if (isHydrating(node)) return;
137
480
  if (value == null || value === false) {
138
481
  prev && node.removeAttribute("class");
139
482
  return;
140
483
  }
141
484
  if (typeof value === "string") {
142
- value !== prev && (isSVG ? node.setAttribute("class", value) : node.className = value);
485
+ value !== prev && node.setAttribute("class", value);
143
486
  return;
144
487
  }
145
488
  if (typeof prev === "string") {
@@ -153,16 +496,16 @@ function className(node, value, isSVG, prev) {
153
496
  for (i = 0, len = prevKeys.length; i < len; i++) {
154
497
  const key = prevKeys[i];
155
498
  if (!key || key === "undefined" || value[key]) continue;
156
- toggleClassKey(node, key, false);
499
+ node.classList.remove(key);
157
500
  }
158
501
  for (i = 0, len = classKeys.length; i < len; i++) {
159
502
  const key = classKeys[i],
160
503
  classValue = !!value[key];
161
504
  if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
162
- toggleClassKey(node, key, true);
505
+ node.classList.add(key);
163
506
  }
164
507
  }
165
- function addEventListener(node, name, handler, delegate) {
508
+ function addEvent(node, name, handler, delegate) {
166
509
  if (delegate) {
167
510
  if (Array.isArray(handler)) {
168
511
  node[`$$${name}`] = handler[0];
@@ -175,42 +518,60 @@ function addEventListener(node, name, handler, delegate) {
175
518
  }
176
519
  function style(node, value, prev) {
177
520
  if (!value) {
178
- prev ? setAttribute(node, "style") : value;
521
+ if (prev || node._$styles) {
522
+ setAttribute(node, "style");
523
+ node._$styles = undefined;
524
+ }
179
525
  return;
180
526
  }
181
527
  const nodeStyle = node.style;
182
- if (typeof value === "string") return nodeStyle.cssText = value;
183
- typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
184
- prev || (prev = {});
185
- value || (value = {});
528
+ if (typeof value === "string") {
529
+ node._$styles = undefined;
530
+ return nodeStyle.cssText = value;
531
+ }
532
+ if (typeof prev === "string") {
533
+ nodeStyle.cssText = "";
534
+ prev = undefined;
535
+ }
536
+ let applied = node._$styles;
537
+ if (!applied) {
538
+ applied = node._$styles = prev ? {
539
+ ...prev
540
+ } : {};
541
+ }
186
542
  let v, s;
543
+ for (s in applied) {
544
+ if (value[s] == null) {
545
+ nodeStyle.removeProperty(s);
546
+ delete applied[s];
547
+ }
548
+ }
187
549
  for (s in value) {
188
550
  v = value[s];
189
- if (v !== prev[s]) nodeStyle.setProperty(s, v);
190
- delete prev[s];
551
+ if (v != null && v !== applied[s]) {
552
+ nodeStyle.setProperty(s, v);
553
+ applied[s] = v;
554
+ }
191
555
  }
192
- for (s in prev) value[s] == null && nodeStyle.removeProperty(s);
193
556
  }
194
557
  function setStyleProperty(node, name, value) {
195
558
  value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
196
559
  }
197
- function spread(node, props = {}, isSVG, skipChildren) {
560
+ function spread(node, props = {}, skipChildren) {
198
561
  const prevProps = {};
199
- if (!skipChildren) {
200
- createRenderEffect(() => normalize(props.children, prevProps.children), value => {
201
- insertExpression(node, value, prevProps.children);
202
- prevProps.children = value;
203
- });
204
- }
205
- createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node), () => {});
206
- createRenderEffect(() => {
562
+ if (!skipChildren) insert(node, () => props.children);
563
+ effect(() => {
564
+ const r = props.ref;
565
+ (typeof r === "function" || Array.isArray(r)) && ref(() => r, node);
566
+ }, () => {});
567
+ effect(() => {
207
568
  const newProps = {};
208
569
  for (const prop in props) {
209
570
  if (prop === "children" || prop === "ref") continue;
210
571
  newProps[prop] = props[prop];
211
572
  }
212
573
  return newProps;
213
- }, props => assign(node, props, isSVG, true, prevProps, true));
574
+ }, props => assign(node, props, true, prevProps, true));
214
575
  return prevProps;
215
576
  }
216
577
  function dynamicProperty(props, key) {
@@ -223,48 +584,628 @@ function dynamicProperty(props, key) {
223
584
  });
224
585
  return props;
225
586
  }
226
- function use(fn, element, arg) {
227
- untrack(() => fn(element, arg));
587
+ function applyRef(r, element) {
588
+ Array.isArray(r) ? r.flat(Infinity).forEach(f => f && f(element)) : r(element);
589
+ }
590
+ function ref(fn, element) {
591
+ const resolved = untrack(fn);
592
+ runWithOwner(null, () => applyRef(resolved, element));
593
+ }
594
+ function scope(fn) {
595
+ fn.$s = true;
596
+ return fn;
597
+ }
598
+ const SCOPE_OPTIONS = {
599
+ scope: true
600
+ };
601
+ let hydrationRt = null;
602
+ function installHydrationRuntime() {
603
+ hydrationRt = {
604
+ claimInitial(parent, multi, initial) {
605
+ if (isHydrating(parent)) {
606
+ if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
607
+ if (Array.isArray(initial)) stripTextSeparators(initial);
608
+ }
609
+ return initial;
610
+ },
611
+ reclaimRegion(current, parent, marker) {
612
+ if (!sharedConfig.hydrating || !current || !parent.isConnected) return current;
613
+ const first = Array.isArray(current) ? current[0] : current;
614
+ if (!first || !first.nodeType || first.isConnected) return current;
615
+ let nodes;
616
+ if (marker) {
617
+ nodes = [];
618
+ let node = marker.previousSibling,
619
+ depth = 0;
620
+ while (node) {
621
+ if (node.nodeType === 8) {
622
+ const v = node.nodeValue;
623
+ if (v === "/") depth++;else if (v === "$") {
624
+ if (depth === 0) break;
625
+ depth--;
626
+ }
627
+ }
628
+ nodes.unshift(node);
629
+ node = node.previousSibling;
630
+ }
631
+ } else nodes = [...parent.childNodes];
632
+ return stripTextSeparators(nodes);
633
+ },
634
+ dedupEvent(e) {
635
+ return !!(sharedConfig.registry && sharedConfig.events && sharedConfig.events.find(([el, ev]) => ev === e));
636
+ }
637
+ };
638
+ }
639
+ function stripTextSeparators(nodes) {
640
+ let j = 0;
641
+ for (let i = 0; i < nodes.length; i++) {
642
+ const node = nodes[i],
643
+ t = node.nodeType;
644
+ if (t === 8) {
645
+ const v = node.nodeValue;
646
+ if (v === "!$") {
647
+ node.remove();
648
+ continue;
649
+ }
650
+ if (v.startsWith("pl-")) continue;
651
+ } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
652
+ nodes[j++] = node;
653
+ }
654
+ nodes.length = j;
655
+ return nodes;
228
656
  }
229
- function insert(parent, accessor, marker, initial) {
657
+ function insert(parent, accessor, marker, initial, options) {
230
658
  const multi = marker !== undefined;
659
+ const host = options && options.host;
231
660
  if (multi && !initial) initial = [];
661
+ if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
232
662
  if (typeof accessor !== "function") {
233
663
  accessor = normalize(accessor, initial, multi, true);
234
- if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
664
+ if (typeof accessor !== "function") {
665
+ insertExpression(parent, accessor, initial, marker);
666
+ host && tagHost(accessor, host);
667
+ return;
668
+ }
669
+ }
670
+ if (multi && initial.length === 0) {
671
+ const placeholder = document.createTextNode("");
672
+ parent.insertBefore(placeholder, marker);
673
+ initial = [placeholder];
235
674
  }
236
- createRenderEffect(prev => normalize(accessor, prev, multi), (value, current) => insertExpression(parent, value, current, marker), initial);
675
+ let current = initial;
676
+ effect(prev => {
677
+ if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
678
+ const value = normalize(accessor(), current, multi, true);
679
+ if (typeof value !== "function") return value;
680
+ effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
681
+ current = insertExpression(parent, inner, current, marker);
682
+ host && tagHost(current, host);
683
+ }, prev !== undefined && !(options && options.schedule) ? {
684
+ ...options,
685
+ schedule: true
686
+ } : options);
687
+ return INNER_OWNED;
688
+ }, value => {
689
+ if (value === INNER_OWNED) return;
690
+ current = insertExpression(parent, value, current, marker);
691
+ host && tagHost(current, host);
692
+ },
693
+ accessor.$s ? options ? {
694
+ ...options,
695
+ scope: true
696
+ } : SCOPE_OPTIONS : options);
237
697
  }
238
- function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
698
+ function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
699
+ const nodeName = node.nodeName;
239
700
  props || (props = {});
240
701
  for (const prop in prevProps) {
241
702
  if (!(prop in props)) {
242
703
  if (prop === "children") continue;
243
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef);
704
+ prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
244
705
  }
245
706
  }
246
707
  for (const prop in props) {
247
708
  if (prop === "children") {
248
- if (!skipChildren) insertExpression(node, props.children);
709
+ if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
710
+ continue;
711
+ }
712
+ prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
713
+ }
714
+ }
715
+ const ASSET_REMOVAL_GRACE = 100;
716
+ const assetRegistry = new Map();
717
+ function assetEntryKey(descriptor) {
718
+ if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
719
+ return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
720
+ }
721
+ function findAssetElement(selector, attr, value) {
722
+ const nodes = document.querySelectorAll(selector);
723
+ for (let i = 0; i < nodes.length; i++) {
724
+ if (nodes[i].getAttribute(attr) === value) return nodes[i];
725
+ }
726
+ return null;
727
+ }
728
+ function setAssetAttrs(el, attrs) {
729
+ for (const name in attrs) el.setAttribute(name, attrs[name]);
730
+ }
731
+ function mountAssetElement(descriptor) {
732
+ let el;
733
+ if (descriptor.type === "inline-style") {
734
+ el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
735
+ if (!el) {
736
+ el = document.createElement("style");
737
+ el.setAttribute("data-asset", descriptor.id);
738
+ el.textContent = descriptor.content || "";
739
+ }
740
+ } else {
741
+ const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
742
+ el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
743
+ if (!el) {
744
+ el = document.createElement("link");
745
+ el.rel = rel;
746
+ el.href = descriptor.href;
747
+ }
748
+ }
749
+ if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
750
+ if (!el.isConnected) document.head.appendChild(el);
751
+ return el;
752
+ }
753
+ const assetLoadSettled = /*#__PURE__*/Promise.resolve();
754
+ function trackAssetLoad(entry, adopted) {
755
+ if (entry.loadPromise) return;
756
+ const el = entry.element;
757
+ let settled = el.sheet != null;
758
+ if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
759
+ settled = performance.getEntriesByName(el.href).length > 0;
760
+ }
761
+ if (settled) {
762
+ entry.loadState = "loaded";
763
+ entry.loadPromise = assetLoadSettled;
764
+ return;
765
+ }
766
+ entry.loadState = "pending";
767
+ entry.loadPromise = new Promise(resolve => {
768
+ const settle = state => {
769
+ entry.loadState = state;
770
+ resolve();
771
+ };
772
+ el.addEventListener("load", () => settle("loaded"), {
773
+ once: true
774
+ });
775
+ el.addEventListener("error", () => settle("errored"), {
776
+ once: true
777
+ });
778
+ });
779
+ }
780
+ function warmAsset(descriptor) {
781
+ if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
782
+ const key = assetEntryKey(descriptor);
783
+ let entry = assetRegistry.get(key);
784
+ if (!entry) {
785
+ entry = {
786
+ count: 0,
787
+ element: null,
788
+ timer: null
789
+ };
790
+ assetRegistry.set(key, entry);
791
+ }
792
+ let adopted = true;
793
+ if (!entry.element || !entry.element.isConnected) {
794
+ const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
795
+ let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
796
+ if (!el && descriptor.type === "style") {
797
+ el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
798
+ }
799
+ if (!el) {
800
+ adopted = false;
801
+ el = document.createElement("link");
802
+ if (descriptor.type === "style") {
803
+ el.setAttribute("rel", "preload");
804
+ el.setAttribute("as", "style");
805
+ } else {
806
+ el.setAttribute("rel", "modulepreload");
807
+ }
808
+ el.setAttribute("href", descriptor.href);
809
+ if (!document.body) el.setAttribute("blocking", "render");
810
+ }
811
+ if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
812
+ if (!el.isConnected) document.head.appendChild(el);
813
+ entry.element = el;
814
+ entry.loadState = undefined;
815
+ entry.loadPromise = undefined;
816
+ }
817
+ if (descriptor.type === "style") trackAssetLoad(entry, adopted);
818
+ return entry;
819
+ }
820
+ function acquireAsset(descriptor) {
821
+ const key = assetEntryKey(descriptor);
822
+ let entry = assetRegistry.get(key);
823
+ if (descriptor.policy === "exclusive") {
824
+ if (!entry) {
825
+ entry = {
826
+ original: descriptor.get(),
827
+ set: descriptor.set,
828
+ writers: []
829
+ };
830
+ assetRegistry.set(key, entry);
831
+ }
832
+ const writer = {
833
+ value: descriptor.value
834
+ };
835
+ entry.writers.push(writer);
836
+ entry.set(writer.value);
837
+ let released = false;
838
+ return () => {
839
+ if (released) return;
840
+ released = true;
841
+ const index = entry.writers.indexOf(writer);
842
+ const wasTop = index === entry.writers.length - 1;
843
+ entry.writers.splice(index, 1);
844
+ if (!wasTop) return;
845
+ if (entry.writers.length) {
846
+ entry.set(entry.writers[entry.writers.length - 1].value);
847
+ } else {
848
+ entry.set(entry.original);
849
+ assetRegistry.delete(key);
850
+ }
851
+ };
852
+ }
853
+ if (!entry) {
854
+ entry = {
855
+ count: 0,
856
+ element: null,
857
+ timer: null
858
+ };
859
+ assetRegistry.set(key, entry);
860
+ }
861
+ if (entry.timer) {
862
+ clearTimeout(entry.timer);
863
+ entry.timer = null;
864
+ }
865
+ entry.count++;
866
+ if (!entry.element || !entry.element.isConnected) {
867
+ entry.element = mountAssetElement(descriptor);
868
+ } else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
869
+ entry.element.removeAttribute("as");
870
+ entry.element.setAttribute("rel", "stylesheet");
871
+ }
872
+ let released = false;
873
+ return () => {
874
+ if (released) return;
875
+ released = true;
876
+ if (--entry.count > 0) return;
877
+ entry.timer = setTimeout(() => {
878
+ assetRegistry.delete(key);
879
+ entry.element && entry.element.remove();
880
+ }, ASSET_REMOVAL_GRACE);
881
+ };
882
+ }
883
+ let headRegistrations = null;
884
+ let headSeq = 0;
885
+ let headUid = 0;
886
+ let headOwned = null;
887
+ let headApplied = null;
888
+ let headFallbackTitle = null;
889
+ let headScheduled = false;
890
+ const headMountedResources = new Set();
891
+ function initHeadRegistry() {
892
+ if (headRegistrations) return;
893
+ headRegistrations = [];
894
+ headOwned = new Map();
895
+ headApplied = new Map();
896
+ const t = document.querySelector("title");
897
+ headFallbackTitle = t && !t.hasAttribute("data-dh") ? t.textContent : null;
898
+ if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
899
+ }
900
+ function applyServerHeadOps(ops) {
901
+ for (let i = 0; i < ops.length; i++) {
902
+ const op = ops[i];
903
+ const identity = op[0] === "t" ? "title" : op[1];
904
+ if (headOwned.has(identity)) continue;
905
+ if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
906
+ const els = headMarkedElements(identity);
907
+ for (let j = 0; j < els.length; j++) els[j].remove();
908
+ } else {
909
+ const el = document.createElement(op[2]);
910
+ for (const name in op[3]) el.setAttribute(name, op[3][name]);
911
+ if (op[4] != null) el.textContent = op[4];
912
+ el.setAttribute("data-dh", identity);
913
+ document.head.appendChild(el);
914
+ }
915
+ }
916
+ }
917
+ function headMarkedElements(identity) {
918
+ const nodes = document.head.querySelectorAll("[data-dh]");
919
+ const out = [];
920
+ for (let i = 0; i < nodes.length; i++) {
921
+ if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
922
+ }
923
+ return out;
924
+ }
925
+ function setHeadTitle(text) {
926
+ let el = document.querySelector("title");
927
+ if (!el) {
928
+ el = document.createElement("title");
929
+ document.head.appendChild(el);
930
+ }
931
+ el.textContent = text;
932
+ el.setAttribute("data-dh", "title");
933
+ return el;
934
+ }
935
+ function scheduleHeadApply() {
936
+ if (headScheduled) return;
937
+ headScheduled = true;
938
+ queueMicrotask(flushHeadRegistry);
939
+ }
940
+ function flushHeadRegistry() {
941
+ if (sharedConfig.hydrating) {
942
+ setTimeout(flushHeadRegistry, 0);
943
+ return;
944
+ }
945
+ headScheduled = false;
946
+ const winners = resolveHead(headRegistrations);
947
+ for (const [identity, els] of headOwned) {
948
+ if (winners.has(identity)) continue;
949
+ headOwned.delete(identity);
950
+ headApplied.delete(identity);
951
+ if (identity === "title") {
952
+ if (headFallbackTitle != null) setHeadTitle(headFallbackTitle).removeAttribute("data-dh");
953
+ } else {
954
+ for (let i = 0; i < els.length; i++) els[i].remove();
955
+ }
956
+ }
957
+ for (const [identity, winner] of winners) {
958
+ let sig = "";
959
+ for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
960
+ if (headApplied.get(identity) === sig) continue;
961
+ headApplied.set(identity, sig);
962
+ if (identity === "base" || identity === "charset") {
963
+ console.warn(`useHead: <${winner.tags[0].tag}> (${identity}) is shell-only and ignored on the client`);
964
+ continue;
965
+ }
966
+ if (identity === "title") {
967
+ const children = winner.tags[0].props.children;
968
+ setHeadTitle(children == null ? "" : String(children));
969
+ headOwned.set(identity, []);
970
+ continue;
971
+ }
972
+ const existing = headMarkedElements(identity);
973
+ const els = [];
974
+ for (let i = 0; i < winner.tags.length; i++) {
975
+ els.push(renderHeadElement(winner.tags[i], identity, existing));
976
+ }
977
+ for (let i = 0; i < existing.length; i++) {
978
+ if (els.indexOf(existing[i]) === -1) existing[i].remove();
979
+ }
980
+ headOwned.set(identity, els);
981
+ }
982
+ }
983
+ function createHeadElement(tag, props) {
984
+ const el = document.createElement(tag);
985
+ for (const name in props) {
986
+ if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
987
+ if (!HEAD_ATTR_NAME.test(name)) {
988
+ console.warn(`useHead: ignoring invalid attribute name "${name}"`);
249
989
  continue;
250
990
  }
251
- const value = props[prop];
252
- prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef);
991
+ const v = props[name];
992
+ if (v == null || v === false) continue;
993
+ el.setAttribute(name, v === true ? "" : String(v));
994
+ }
995
+ if (props.children != null) el.textContent = String(props.children);
996
+ return el;
997
+ }
998
+ function renderHeadElement(t, identity, existing) {
999
+ for (let i = 0; i < existing.length; i++) {
1000
+ if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
1001
+ }
1002
+ const el = createHeadElement(t.tag, t.props);
1003
+ el.setAttribute("data-dh", identity);
1004
+ document.head.appendChild(el);
1005
+ return el;
1006
+ }
1007
+ function headElementMatches(el, t) {
1008
+ if (el.tagName.toLowerCase() !== t.tag) return false;
1009
+ for (const name in t.props) {
1010
+ if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1011
+ if (!HEAD_ATTR_NAME.test(name)) continue;
1012
+ const v = t.props[name];
1013
+ if (v == null || v === false) {
1014
+ if (el.hasAttribute(name)) return false;
1015
+ } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
1016
+ }
1017
+ const children = t.props.children;
1018
+ return (children == null ? "" : String(children)) === el.textContent;
1019
+ }
1020
+ function mountHeadResource(tag, props) {
1021
+ const identity = resourceIdentity(tag, props);
1022
+ if (headMountedResources.has(identity)) return;
1023
+ headMountedResources.add(identity);
1024
+ const url = props.href || props.src;
1025
+ let el = null;
1026
+ if (url != null) {
1027
+ if (tag === "link") el = findAssetElement(`link[rel="${props.rel}"]`, "href", url);else if (tag === "script") el = findAssetElement("script[src]", "src", url);else el = findAssetElement("style[href]", "href", url);
1028
+ }
1029
+ if (!el) document.head.appendChild(createHeadElement(tag, props));
1030
+ }
1031
+ function gateHeadResource(props) {
1032
+ const descriptor = {
1033
+ type: props.rel === "stylesheet" ? "style" : "module",
1034
+ href: props.href
1035
+ };
1036
+ let gateable = props.rel === "stylesheet" && props.href != null;
1037
+ let attrs = null;
1038
+ for (const name in props) {
1039
+ if (name === "rel" || name === "href") continue;
1040
+ if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
1041
+ if (!HEAD_ATTR_NAME.test(name)) continue;
1042
+ const v = props[name];
1043
+ if (v == null || v === false) continue;
1044
+ (attrs || (attrs = {}))[name] = v === true ? "" : String(v);
1045
+ }
1046
+ if (attrs) descriptor.attrs = attrs;
1047
+ effect(() => {
1048
+ const entry = warmAsset(descriptor);
1049
+ if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1050
+ }, () => acquireAsset(descriptor));
1051
+ }
1052
+ function useHead(tags) {
1053
+ initHeadRegistry();
1054
+ const reg = {
1055
+ seq: -1,
1056
+ tags: null
1057
+ };
1058
+ const uid = ++headUid;
1059
+ effect(() => {
1060
+ let list = typeof tags === "function" ? tags() : tags;
1061
+ if (!Array.isArray(list)) list = [list];
1062
+ const replaceable = [];
1063
+ const resources = [];
1064
+ for (let i = 0; i < list.length; i++) {
1065
+ const desc = list[i];
1066
+ if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
1067
+ console.warn(`useHead: ignoring non-head tag`, desc);
1068
+ continue;
1069
+ }
1070
+ const cls = classifyHeadTag(desc);
1071
+ const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
1072
+ rel: cls.rel
1073
+ } : undefined);
1074
+ if (cls.resource) {
1075
+ if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
1076
+ gateHeadResource(props);
1077
+ } else if (desc.tag === "link") {
1078
+ mountHeadResource(desc.tag, props);
1079
+ } else {
1080
+ resources.push({
1081
+ tag: desc.tag,
1082
+ props
1083
+ });
1084
+ }
1085
+ } else {
1086
+ const key = evalHeadValue(desc.key);
1087
+ replaceable.push({
1088
+ tag: desc.tag,
1089
+ props,
1090
+ identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
1091
+ });
1092
+ }
1093
+ }
1094
+ return {
1095
+ replaceable,
1096
+ resources
1097
+ };
1098
+ }, evaluated => {
1099
+ for (let i = 0; i < evaluated.resources.length; i++) {
1100
+ mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
1101
+ }
1102
+ reg.tags = evaluated.replaceable;
1103
+ if (reg.seq < 0) reg.seq = ++headSeq;
1104
+ if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
1105
+ scheduleHeadApply();
1106
+ return () => {
1107
+ const idx = headRegistrations.indexOf(reg);
1108
+ if (idx > -1) headRegistrations.splice(idx, 1);
1109
+ scheduleHeadApply();
1110
+ };
1111
+ });
1112
+ }
1113
+ function loadModuleAssets(mapping) {
1114
+ const hy = globalThis._$HY;
1115
+ if (!hy) return;
1116
+ const pending = [];
1117
+ for (const key in mapping) {
1118
+ if (hy.modules[key]) continue;
1119
+ const entryUrl = mapping[key];
1120
+ if (!hy.loading[key]) {
1121
+ hy.loading[key] = import(entryUrl).then(mod => {
1122
+ hy.modules[key] = mod;
1123
+ }, err => {
1124
+ delete hy.loading[key];
1125
+ throw err;
1126
+ });
1127
+ }
1128
+ pending.push(hy.loading[key]);
253
1129
  }
1130
+ return pending.length ? Promise.all(pending).then(() => {}) : undefined;
254
1131
  }
255
1132
  function hydrate$1(code, element, options = {}) {
256
- if (globalThis._$HY.done) return render(code, element, [...element.childNodes], options);
1133
+ installHydrationRuntime();
1134
+ if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
257
1135
  options.renderId ||= "";
1136
+ if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1137
+ if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
258
1138
  sharedConfig.completed = globalThis._$HY.completed;
259
1139
  sharedConfig.events = globalThis._$HY.events;
260
1140
  sharedConfig.load = id => globalThis._$HY.r[id];
261
1141
  sharedConfig.has = id => id in globalThis._$HY.r;
262
1142
  sharedConfig.gather = root => gatherHydratable(element, root);
1143
+ sharedConfig.loadModuleAssets = loadModuleAssets;
1144
+ sharedConfig.cleanupFragment = id => {
1145
+ const tpl = document.getElementById("pl-" + id);
1146
+ if (tpl) {
1147
+ let node = tpl.nextSibling;
1148
+ while (node) {
1149
+ const next = node.nextSibling;
1150
+ if (node.nodeType === 8 && node.nodeValue === "pl-" + id) {
1151
+ node.remove();
1152
+ break;
1153
+ }
1154
+ node.remove();
1155
+ node = next;
1156
+ }
1157
+ tpl.remove();
1158
+ }
1159
+ };
263
1160
  sharedConfig.registry = new Map();
1161
+ if (!sharedConfig.boundaryScopes) sharedConfig.boundaryScopes = new Map();
1162
+ sharedConfig.captureBoundaryScope = id => {
1163
+ if (sharedConfig.registry) sharedConfig.boundaryScopes.set(id, {
1164
+ registry: sharedConfig.registry,
1165
+ gather: sharedConfig.gather
1166
+ });
1167
+ };
264
1168
  sharedConfig.hydrating = true;
1169
+ {
1170
+ sharedConfig.verifyHydration = () => {
1171
+ if (sharedConfig.registry && sharedConfig.registry.size) {
1172
+ const orphaned = [...sharedConfig.registry.values()].filter(node => node.isConnected);
1173
+ sharedConfig.registry.clear();
1174
+ if (!orphaned.length) return;
1175
+ console.warn(`Hydration completed with ${orphaned.length} unclaimed server-rendered node(s):\n` + orphaned.map(node => ` ${node.outerHTML.slice(0, 100)}`).join("\n"));
1176
+ }
1177
+ };
1178
+ }
1179
+ const hyr = globalThis._$HY.r;
1180
+ const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
1181
+ if (rootMapping && typeof rootMapping === "object") {
1182
+ const p = loadModuleAssets(rootMapping);
1183
+ if (p) {
1184
+ gatherHydratable(element, options.renderId);
1185
+ const registry = sharedConfig.registry;
1186
+ const gather = sharedConfig.gather;
1187
+ let disposer;
1188
+ p.then(() => {
1189
+ sharedConfig.registry = registry;
1190
+ sharedConfig.gather = gather;
1191
+ sharedConfig.hydrating = true;
1192
+ try {
1193
+ disposer = render$1(code, element, [...element.childNodes], options);
1194
+ } finally {
1195
+ sharedConfig.hydrating = false;
1196
+ }
1197
+ }, err => {
1198
+ console.error("Hydration module preload failed, falling back to client render:", err);
1199
+ sharedConfig.hydrating = false;
1200
+ sharedConfig.registry = undefined;
1201
+ disposer = render$1(code, element, [...element.childNodes], options);
1202
+ });
1203
+ return () => disposer && disposer();
1204
+ }
1205
+ }
265
1206
  try {
266
1207
  gatherHydratable(element, options.renderId);
267
- return render(code, element, [...element.childNodes], options);
1208
+ return render$1(code, element, [...element.childNodes], options);
268
1209
  } finally {
269
1210
  sharedConfig.hydrating = false;
270
1211
  }
@@ -274,11 +1215,19 @@ function getNextElement(template) {
274
1215
  key,
275
1216
  hydrating = isHydrating();
276
1217
  if (!hydrating || !(node = sharedConfig.registry.get(key = getHydrationKey()))) {
1218
+ if (!template) {
1219
+ throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
1220
+ }
277
1221
  if (hydrating) {
278
- sharedConfig.done = true;
279
- throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}\n${template ? template().outerHTML : ""}`);
1222
+ console.warn(`Hydration key miss for "${key}": no server-rendered element carries this key` + (template._html ? ` (template: ${template._html.slice(0, 60)})` : "") + `. A detached element was created instead; its subtree will not appear in the ` + `document or become interactive. This usually means the server and client ` + `hydration id namespaces are misaligned — when hydrating a subtree of a larger ` + `server render, wrap the document shell in <NoHydration> and re-enter with ` + `<Hydration> around the hydrated subtree (or pass hydrate() a renderId matching ` + `the server's <Hydration id>).`);
1223
+ }
1224
+ return template(true);
1225
+ }
1226
+ if (template && template._html) {
1227
+ const expected = template._html.match(/^<(\w+)/)?.[1];
1228
+ if (expected && node.localName !== expected) {
1229
+ console.warn(`Hydration tag mismatch for key "${key}": expected <${expected}> but found`, node);
280
1230
  }
281
- return template();
282
1231
  }
283
1232
  if (sharedConfig.completed) sharedConfig.completed.add(node);
284
1233
  sharedConfig.registry.delete(key);
@@ -307,6 +1256,50 @@ function getNextMarker(start) {
307
1256
  }
308
1257
  return [end, current];
309
1258
  }
1259
+ function getFirstChild(node, expectedTag) {
1260
+ const child = node.firstChild;
1261
+ if (isHydrating() && expectedTag && child?.localName !== expectedTag) {
1262
+ const isMissing = !child || child.nodeType !== 1;
1263
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> as first child of", node, "\n " + describeSiblings(node, child, expectedTag, isMissing));
1264
+ }
1265
+ return child;
1266
+ }
1267
+ function getNextSibling(node, expectedTag) {
1268
+ const sibling = node.nextSibling;
1269
+ if (isHydrating() && expectedTag && sibling?.localName !== expectedTag) {
1270
+ const parent = node.parentNode;
1271
+ const isMissing = !sibling || sibling.nodeType !== 1;
1272
+ console.warn("Hydration structure mismatch: expected <" + expectedTag + "> after", node, "in", parent, "\n " + describeSiblings(parent, sibling, expectedTag, isMissing));
1273
+ }
1274
+ return sibling;
1275
+ }
1276
+ function describeSiblings(parent, mismatchChild, expectedTag, isMissing) {
1277
+ if (!parent) return `<${expectedTag} \u2190 parent unavailable>`;
1278
+ const children = [];
1279
+ let child = parent.firstChild;
1280
+ while (child) {
1281
+ if (child.nodeType === 1) children.push(child);
1282
+ child = child.nextSibling;
1283
+ }
1284
+ const pTag = parent.localName || "#fragment";
1285
+ if (isMissing) {
1286
+ const tags = children.map(c => `<${c.localName}>`).join("");
1287
+ return `<${pTag}>${tags}<${expectedTag} \u2190 missing></${pTag}>`;
1288
+ }
1289
+ const idx = children.indexOf(mismatchChild);
1290
+ let start = 0,
1291
+ end = children.length;
1292
+ let prefix = "",
1293
+ suffix = "";
1294
+ if (children.length > 6) {
1295
+ start = Math.max(0, idx - 2);
1296
+ end = Math.min(children.length, idx + 3);
1297
+ if (start > 0) prefix = "...";
1298
+ if (end < children.length) suffix = "...";
1299
+ }
1300
+ const tags = children.slice(start, end).map(c => c === mismatchChild ? `<${c.localName} \u2190 expected ${expectedTag}>` : `<${c.localName}>`).join("");
1301
+ return `<${pTag}>${prefix}${tags}${suffix}</${pTag}>`;
1302
+ }
310
1303
  function runHydrationEvents() {
311
1304
  if (sharedConfig.events && !sharedConfig.events.queued) {
312
1305
  queueMicrotask(() => {
@@ -320,7 +1313,32 @@ function runHydrationEvents() {
320
1313
  const [el, e] = events[0];
321
1314
  if (!completed.has(el)) return;
322
1315
  events.shift();
323
- eventHandler(e);
1316
+ let matchContainer, matchState, matchDistance, matches;
1317
+ for (const [container, state] of delegatedContainers) {
1318
+ if (!state.handlers.has(e.type)) continue;
1319
+ const entry = findOwner(e.target, state);
1320
+ if (!entry) continue;
1321
+ if (matchContainer) {
1322
+ if (!matches) matches = [{
1323
+ container: matchContainer,
1324
+ state: matchState,
1325
+ distance: matchDistance
1326
+ }];
1327
+ matches.push({
1328
+ container,
1329
+ state,
1330
+ distance: entry.distance
1331
+ });
1332
+ } else {
1333
+ matchContainer = container;
1334
+ matchState = state;
1335
+ matchDistance = entry.distance;
1336
+ }
1337
+ }
1338
+ if (matches) {
1339
+ matches.sort((a, b) => a.distance - b.distance);
1340
+ for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1341
+ } else if (matchContainer) eventHandler(e, matchContainer, matchState);
324
1342
  }
325
1343
  if (sharedConfig.done) {
326
1344
  sharedConfig.events = _$HY.events = null;
@@ -331,16 +1349,31 @@ function runHydrationEvents() {
331
1349
  }
332
1350
  }
333
1351
  function isHydrating(node) {
334
- return sharedConfig.hydrating && !sharedConfig.done && (!node || node.isConnected);
335
- }
336
- function toggleClassKey(node, key, value) {
337
- const classNames = key.trim().split(/\s+/);
338
- for (let i = 0, nameLen = classNames.length; i < nameLen; i++) node.classList.toggle(classNames[i], value);
1352
+ if (!sharedConfig.hydrating) return false;
1353
+ if (!node || node.isConnected) return true;
1354
+ const roots = sharedConfig.claimRoots;
1355
+ if (roots) {
1356
+ for (let i = 0; i < roots.length; i++) {
1357
+ if (roots[i].contains(node)) return true;
1358
+ }
1359
+ }
1360
+ return false;
339
1361
  }
340
1362
  function classListToObject(classList) {
341
1363
  if (Array.isArray(classList)) {
342
1364
  const result = {};
343
1365
  flattenClassList(classList, result);
1366
+ classList = result;
1367
+ }
1368
+ if (classList && typeof classList === "object") {
1369
+ const result = {},
1370
+ keys = Object.keys(classList);
1371
+ for (let i = 0, len = keys.length; i < len; i++) {
1372
+ const key = keys[i];
1373
+ if (!classList[key]) continue;
1374
+ const classNames = key.trim().split(/\s+/);
1375
+ for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
1376
+ }
344
1377
  return result;
345
1378
  }
346
1379
  return classList;
@@ -351,18 +1384,16 @@ function flattenClassList(list, result) {
351
1384
  if (Array.isArray(item)) flattenClassList(item, result);else if (typeof item === "object" && item != null) Object.assign(result, item);else if (item || item === 0) result[item] = true;
352
1385
  }
353
1386
  }
354
- function assignProp(node, prop, value, prev, isSVG, skipRef) {
355
- let forceProp;
1387
+ function assignProp(node, prop, value, prev, skipRef, nodeName) {
356
1388
  if (prop === "style") return style(node, value, prev), value;
357
- if (prop === "class") return className(node, value, isSVG, prev), value;
358
- if (value === prev) return prev;
1389
+ if (prop === "class") return className(node, value, prev), value;
1390
+ if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
359
1391
  if (prop === "ref") {
360
- if (!skipRef) value(node);
361
- } else if (prop.slice(0, 3) === "on:") {
362
- const e = prop.slice(3);
363
- prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
364
- value && node.addEventListener(e, value, typeof value !== "function" && value);
365
- } else if (prop.slice(0, 2) === "on") {
1392
+ if (!skipRef && value) ref(() => value, node);
1393
+ return value;
1394
+ }
1395
+ const hasNamespace = prop.indexOf(":") > -1;
1396
+ if (!hasNamespace && prop.slice(0, 2) === "on") {
366
1397
  const name = prop.slice(2).toLowerCase();
367
1398
  const delegate = DelegatedEvents.has(name);
368
1399
  if (!delegate && prev) {
@@ -370,26 +1401,35 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
370
1401
  node.removeEventListener(name, h);
371
1402
  }
372
1403
  if (delegate || value) {
373
- addEventListener(node, name, value, delegate);
1404
+ addEvent(node, name, value, delegate);
374
1405
  delegate && delegateEvents([name]);
375
1406
  }
376
- } else if ((forceProp = prop.slice(0, 5) === "prop:") || ChildProperties.has(prop) || !isSVG && Properties.has(prop)) {
377
- if (forceProp) prop = prop.slice(5);else if (isHydrating(node)) return value;
378
- if (prop === "value" && node.nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else node[prop] = value;
1407
+ } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1408
+ if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1409
+ if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1410
+ node[prop] = value ?? "";else node[prop] = value;
379
1411
  } else {
380
- const ns = isSVG && prop.indexOf(":") > -1 && SVGNamespace[prop.split(":")[0]];
1412
+ const ns = hasNamespace && Namespaces[prop.split(":")[0]];
381
1413
  if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
382
1414
  }
383
1415
  return value;
384
1416
  }
385
- function eventHandler(e) {
386
- if (sharedConfig.registry && sharedConfig.events) {
387
- if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
1417
+ function eventHandler(e, container, state) {
1418
+ if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
1419
+ const prev = e[$$EVENT_OWNER];
1420
+ let resumeNode;
1421
+ if (prev) {
1422
+ if (prev === true || prev === container || !container.contains(prev)) return;
1423
+ resumeNode = prev;
388
1424
  }
389
- let node = e.target;
1425
+ const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1426
+ if (state && !owner) return;
1427
+ if (owner && owner === resumeNode) return;
1428
+ e[$$EVENT_OWNER] = owner || true;
1429
+ let node = resumeNode || e.target;
390
1430
  const key = `$$${e.type}`;
391
1431
  const oriTarget = e.target;
392
- const oriCurrentTarget = e.currentTarget;
1432
+ const boundary = owner || container || e.currentTarget;
393
1433
  const retarget = value => Object.defineProperty(e, "target", {
394
1434
  configurable: true,
395
1435
  value
@@ -405,52 +1445,72 @@ function eventHandler(e) {
405
1445
  return true;
406
1446
  };
407
1447
  const walkUpTree = () => {
408
- while (handleNode() && (node = node._$host || node.parentNode || node.host));
1448
+ while (node && handleNode()) {
1449
+ if (node === boundary || node.parentNode === boundary) break;
1450
+ node = node._$host || node.parentNode || node.host;
1451
+ }
409
1452
  };
410
1453
  Object.defineProperty(e, "currentTarget", {
411
1454
  configurable: true,
412
1455
  get() {
413
- return node || document;
1456
+ return node || boundary || document;
414
1457
  }
415
1458
  });
416
- if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
417
- if (e.composedPath) {
1459
+ if (resumeNode) {
1460
+ if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1461
+ if (node && node !== boundary) walkUpTree();
1462
+ } else if (e.composedPath) {
418
1463
  const path = e.composedPath();
419
- retarget(path[0]);
420
- for (let i = 0; i < path.length - 2; i++) {
421
- node = path[i];
422
- if (!handleNode()) break;
423
- if (node._$host) {
424
- node = node._$host;
425
- walkUpTree();
426
- break;
427
- }
428
- if (node.parentNode === oriCurrentTarget) {
429
- break;
1464
+ if (path.length) {
1465
+ retarget(path[0]);
1466
+ for (let i = 0; i < path.length; i++) {
1467
+ node = path[i];
1468
+ if (!handleNode()) break;
1469
+ if (node._$host) {
1470
+ node = node._$host;
1471
+ walkUpTree();
1472
+ break;
1473
+ }
1474
+ if (node === boundary || node.parentNode === boundary) {
1475
+ break;
1476
+ }
430
1477
  }
431
- }
1478
+ } else walkUpTree();
432
1479
  }
433
1480
  else walkUpTree();
434
1481
  retarget(oriTarget);
435
1482
  }
436
1483
  function insertExpression(parent, value, current, marker) {
437
- if (isHydrating(parent)) return;
438
- if (value === current) return;
1484
+ if (hydrationRt !== null && isHydrating(parent)) {
1485
+ if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1486
+ return value;
1487
+ }
1488
+ if (value === current) return value;
439
1489
  const t = typeof value,
440
1490
  multi = marker !== undefined;
441
1491
  if (t === "string" || t === "number") {
442
1492
  const tc = typeof current;
443
1493
  if (tc === "string" || tc === "number") {
444
1494
  parent.firstChild.data = value;
445
- } else parent.textContent = value;
1495
+ } else {
1496
+ if (ownsAllChildren(parent, current)) parent.textContent = value;else {
1497
+ removeOwnedChildren(parent, current);
1498
+ parent.insertBefore(document.createTextNode(value), parent.firstChild);
1499
+ }
1500
+ }
446
1501
  } else if (value === undefined) {
447
1502
  cleanChildren(parent, current, marker);
448
1503
  } else if (value.nodeType) {
449
1504
  if (Array.isArray(current)) {
450
1505
  cleanChildren(parent, current, multi ? marker : null, value);
451
- } else if (current === undefined || !parent.firstChild) {
1506
+ } else if (current && current.nodeType) {
1507
+ current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1508
+ } else if (current && parent.firstChild) {
1509
+ parent.replaceChild(value, parent.firstChild);
1510
+ } else {
452
1511
  parent.appendChild(value);
453
- } else parent.replaceChild(value, parent.firstChild);
1512
+ }
1513
+ if (marker) value[$$SLOT] = marker;
454
1514
  } else if (Array.isArray(value)) {
455
1515
  const currentArray = current && Array.isArray(current);
456
1516
  if (value.length === 0) {
@@ -458,12 +1518,13 @@ function insertExpression(parent, value, current, marker) {
458
1518
  } else if (currentArray) {
459
1519
  if (current.length === 0) {
460
1520
  appendNodes(parent, value, marker);
461
- } else reconcileArrays(parent, current, value);
1521
+ } else reconcileArrays(parent, current, value, marker);
462
1522
  } else {
463
- current && cleanChildren(parent);
1523
+ current && cleanChildren(parent, current);
464
1524
  appendNodes(parent, value);
465
1525
  }
466
1526
  } else console.warn(`Unrecognized value. Skipped inserting`, value);
1527
+ return value;
467
1528
  }
468
1529
  function normalize(value, current, multi, doNotUnwrap) {
469
1530
  value = flatten(value, {
@@ -477,44 +1538,87 @@ function normalize(value, current, multi, doNotUnwrap) {
477
1538
  const item = value[i],
478
1539
  prev = current && current[i],
479
1540
  t = typeof item;
480
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && prev.data === item ? prev : document.createTextNode(item);
1541
+ if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
481
1542
  }
482
1543
  }
483
1544
  return value;
484
1545
  }
1546
+ function tagHost(value, host) {
1547
+ if (Array.isArray(value)) {
1548
+ for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
1549
+ } else if (value && value.nodeType && value[$$HOST] !== host) {
1550
+ value[$$HOST] = host;
1551
+ Object.defineProperty(value, "_$host", {
1552
+ get: host,
1553
+ configurable: true
1554
+ });
1555
+ }
1556
+ }
485
1557
  function appendNodes(parent, array, marker = null) {
486
- for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
1558
+ for (let i = 0, len = array.length; i < len; i++) {
1559
+ const n = array[i];
1560
+ parent.insertBefore(n, marker);
1561
+ if (marker) n[$$SLOT] = marker;
1562
+ }
1563
+ }
1564
+ function ownsAllChildren(parent, current) {
1565
+ if (current == null) return true;
1566
+ if (Array.isArray(current)) {
1567
+ return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1568
+ }
1569
+ if (current === "") return parent.firstChild === null;
1570
+ if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1571
+ const first = parent.firstChild;
1572
+ return first !== null && first.nodeType === 3 && parent.lastChild === first;
1573
+ }
1574
+ function removeOwnedChildren(parent, current) {
1575
+ if (Array.isArray(current)) {
1576
+ for (let i = 0; i < current.length; i++) {
1577
+ const el = current[i];
1578
+ if (el.parentNode === parent) el.remove();
1579
+ }
1580
+ } else if (current.nodeType) {
1581
+ if (current.parentNode === parent) current.remove();
1582
+ } else {
1583
+ const first = parent.firstChild;
1584
+ if (first && first.nodeType === 3) first.remove();
1585
+ }
487
1586
  }
488
1587
  function cleanChildren(parent, current, marker, replacement) {
489
- if (marker === undefined) return parent.textContent = "";
1588
+ if (marker === undefined) {
1589
+ if (ownsAllChildren(parent, current)) return parent.textContent = "";
1590
+ return removeOwnedChildren(parent, current);
1591
+ }
490
1592
  if (current.length) {
491
1593
  let inserted = false;
492
1594
  for (let i = current.length - 1; i >= 0; i--) {
493
1595
  const el = current[i];
494
1596
  if (replacement !== el) {
495
- const isParent = el.parentNode === parent;
496
- if (replacement && !inserted && !i) isParent ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else isParent && el.remove();
1597
+ const tag = el[$$SLOT];
1598
+ const owns = el.parentNode === parent && (!tag || tag === marker);
1599
+ if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
497
1600
  } else inserted = true;
498
1601
  }
499
1602
  } else if (replacement) parent.insertBefore(replacement, marker);
1603
+ if (replacement && marker) replacement[$$SLOT] = marker;
500
1604
  }
501
1605
  function gatherHydratable(element, root) {
502
1606
  const templates = element.querySelectorAll(`*[_hk]`);
503
1607
  for (let i = 0; i < templates.length; i++) {
504
1608
  const node = templates[i];
505
1609
  const key = node.getAttribute("_hk");
506
- if ((!root || key.startsWith(root)) && !sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
1610
+ if (root) {
1611
+ if (!key.startsWith(root)) continue;
1612
+ } else {
1613
+ const frame = node.closest("[data-fid]");
1614
+ if (frame && frame !== element && element.contains(frame)) continue;
1615
+ }
1616
+ if (!sharedConfig.registry.has(key)) sharedConfig.registry.set(key, node);
507
1617
  }
508
1618
  }
509
1619
  function getHydrationKey() {
510
1620
  return sharedConfig.getNextContextId();
511
1621
  }
512
- function NoHydration(props) {
513
- return sharedConfig.hydrating ? undefined : props.children;
514
- }
515
- function Hydration(props) {
516
- return props.children;
517
- }
518
1622
  const voidFn = () => undefined;
519
1623
  const RequestContext = Symbol();
520
1624
 
@@ -525,91 +1629,300 @@ function throwInBrowser(func) {
525
1629
  function renderToString(fn, options) {
526
1630
  throwInBrowser(renderToString);
527
1631
  }
528
- function renderToStringAsync(fn, options) {
529
- throwInBrowser(renderToStringAsync);
530
- }
531
1632
  function renderToStream(fn, options) {
532
1633
  throwInBrowser(renderToStream);
533
1634
  }
1635
+ function createResponseStub() {
1636
+ throwInBrowser(createResponseStub);
1637
+ }
1638
+ function createRequestEvent(request, init) {
1639
+ throwInBrowser(createRequestEvent);
1640
+ }
1641
+ function getExpectedRedirectStatus(response) {
1642
+ throwInBrowser(getExpectedRedirectStatus);
1643
+ }
1644
+ function createSSRResponse() {
1645
+ throwInBrowser(createSSRResponse);
1646
+ }
1647
+ function commitEventResponse(response, event) {
1648
+ throwInBrowser(commitEventResponse);
1649
+ }
1650
+ function composeMiddleware(middlewares) {
1651
+ throwInBrowser(composeMiddleware);
1652
+ }
534
1653
  function ssr(template, ...nodes) {}
535
1654
  function ssrElement(name, props, children, needsId) {}
536
- function ssrClassList(value) {}
1655
+ function ssrClassName(value) {}
537
1656
  function ssrStyle(value) {}
1657
+ function ssrStyleProperty(name, value) {}
538
1658
  function ssrAttribute(key, value) {}
1659
+ function ssrGroup(fn, n) {}
539
1660
  function ssrHydrationKey() {}
540
- function resolveSSRNode(node) {}
541
- function escape(html) {}
1661
+ function resolveSSRNode(node, result, top) {}
1662
+ function escape(s, attr) {}
542
1663
 
1664
+ const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1665
+ // PURE-annotated factory (same convention as solid's MockPromise): the brand
1666
+ const ResponseEnvelope = /* @__PURE__ */(() => {
1667
+ class ResponseEnvelope {
1668
+ constructor(response, value) {
1669
+ this.response = response;
1670
+ this.value = value;
1671
+ }
1672
+ }
1673
+ ResponseEnvelope.prototype[ENVELOPE] = true;
1674
+ return ResponseEnvelope;
1675
+ })();
1676
+ function isResponseEnvelope(value) {
1677
+ return !!(value && typeof value === "object" && value[ENVELOPE]);
1678
+ }
1679
+ const HREF = Symbol.for("solid.Href");
1680
+ function isHref(value) {
1681
+ return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
1682
+ }
1683
+ const SAFE_ERROR = Symbol.for("solid.SafeError");
1684
+ function markSafeError(error) {
1685
+ if (error && (typeof error === "object" || typeof error === "function")) {
1686
+ Object.defineProperty(error, SAFE_ERROR, {
1687
+ value: true,
1688
+ enumerable: false,
1689
+ configurable: true
1690
+ });
1691
+ }
1692
+ return error;
1693
+ }
1694
+ function isSafeError(value) {
1695
+ return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1696
+ }
1697
+ const REVALIDATE_HEADER = "X-Revalidate";
1698
+ function initWithRevalidate(init) {
1699
+ const {
1700
+ revalidate,
1701
+ ...responseInit
1702
+ } = init;
1703
+ let headers;
1704
+ if (responseInit.headers && responseInit.headers.getSetCookie) {
1705
+ headers = new Headers();
1706
+ responseInit.headers.forEach((value, key) => {
1707
+ if (key !== "set-cookie") headers.append(key, value);
1708
+ });
1709
+ for (const cookie of responseInit.headers.getSetCookie()) {
1710
+ headers.append("Set-Cookie", cookie);
1711
+ }
1712
+ } else {
1713
+ headers = new Headers(responseInit.headers);
1714
+ }
1715
+ revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1716
+ return {
1717
+ responseInit,
1718
+ headers
1719
+ };
1720
+ }
1721
+ function redirect(url, init = 302) {
1722
+ if (typeof url !== "string" && !isHref(url)) {
1723
+ throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
1724
+ }
1725
+ const {
1726
+ responseInit,
1727
+ headers
1728
+ } = initWithRevalidate(typeof init === "number" ? {
1729
+ status: init
1730
+ } : init);
1731
+ if (responseInit.status === undefined) {
1732
+ responseInit.status = 302;
1733
+ }
1734
+ headers.set("Location", String(url));
1735
+ return new Response(null, {
1736
+ ...responseInit,
1737
+ headers
1738
+ });
1739
+ }
1740
+ function reload(init = {}) {
1741
+ const {
1742
+ responseInit,
1743
+ headers
1744
+ } = initWithRevalidate(init);
1745
+ return new Response(null, {
1746
+ ...responseInit,
1747
+ headers
1748
+ });
1749
+ }
1750
+ function respond(value, init = {}) {
1751
+ const {
1752
+ responseInit,
1753
+ headers
1754
+ } = initWithRevalidate(init);
1755
+ headers.set("Content-Type", "application/json");
1756
+ return new ResponseEnvelope(new Response(JSON.stringify(value), {
1757
+ ...responseInit,
1758
+ headers
1759
+ }), value);
1760
+ }
1761
+
1762
+ const mergeProps = merge;
543
1763
  const isServer = false;
544
1764
  const isDev = true;
545
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
546
- function createElement(tagName, isSVG = false, is = undefined) {
547
- return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName, {
548
- is
549
- });
1765
+ function render(code, element, init, options = {}) {
1766
+ enforceLoadingBoundary(true);
1767
+ try {
1768
+ const dispose = render$1(code, element, init, {
1769
+ ...options,
1770
+ insertOptions: {
1771
+ schedule: true
1772
+ }
1773
+ });
1774
+ flush();
1775
+ return dispose;
1776
+ } finally {
1777
+ enforceLoadingBoundary(false);
1778
+ }
550
1779
  }
551
1780
  const hydrate = (...args) => {
552
1781
  enableHydration();
553
1782
  return hydrate$1(...args);
554
1783
  };
555
1784
  function Portal(props) {
1785
+ return runWithOwner(createOwner(), () => portalImpl(props));
1786
+ }
1787
+ function portalImpl(props) {
556
1788
  const treeMarker = document.createTextNode(""),
557
1789
  startMarker = document.createTextNode(""),
558
1790
  endMarker = document.createTextNode(""),
559
- mount = () => createElementProxy(props.mount || document.body, treeMarker);
560
- let content = createMemo(() => [startMarker, props.children]);
561
- createRenderEffect(() => [mount(), content()], ([m, c]) => {
1791
+ mount = () => props.mount || document.body,
1792
+ content = createMemo(() => [startMarker, props.children], {
1793
+ ssrSource: "client",
1794
+ loadingValue: undefined
1795
+ });
1796
+ createRenderEffect(
1797
+ () => [mount(), content(), getOwner()], ([, c, owner]) => {
1798
+ const m = untrack(mount);
562
1799
  m.appendChild(endMarker);
563
- insert(m, c, endMarker);
1800
+ const dispose = runWithOwner(owner, () => createRoot(d => {
1801
+ insert(m, c, endMarker, undefined, {
1802
+ host: () => treeMarker.parentNode
1803
+ });
1804
+ return d;
1805
+ }));
564
1806
  return () => {
1807
+ dispose();
565
1808
  let c = startMarker;
566
- while (c && c !== endMarker) {
1809
+ while (c) {
567
1810
  const n = c.nextSibling;
568
1811
  m.removeChild(c);
1812
+ if (c === endMarker) break;
569
1813
  c = n;
570
1814
  }
571
1815
  };
1816
+ },
1817
+ {
1818
+ schedule: true,
1819
+ ssrSource: "client"
1820
+ });
1821
+ createEffect(mount, () => {
1822
+ const m = untrack(mount);
1823
+ const ownerRoot = getDelegatedRoot(treeMarker);
1824
+ if (!ownerRoot || ownerRoot.contains(m)) return;
1825
+ registerDelegatedContainer(m, ownerRoot);
1826
+ return () => unregisterDelegatedContainer(m, ownerRoot);
1827
+ }, {
1828
+ ssrSource: "client"
1829
+ });
1830
+ if (sharedConfig.hydrating) return createMemo(() => treeMarker, {
1831
+ ssrSource: "client",
1832
+ loadingValue: undefined
572
1833
  });
573
1834
  return treeMarker;
574
1835
  }
575
- function createElementProxy(el, marker) {
576
- return new Proxy(el, {
577
- get(target, prop) {
578
- if (prop === "appendChild" || prop === "insertBefore") {
579
- return (...args) => {
580
- Object.defineProperty(args[0], "_$host", {
581
- get: () => marker.parentNode,
582
- configurable: true
583
- });
584
- target[prop](...args);
585
- };
586
- }
587
- const value = Reflect.get(target, prop);
588
- return typeof value === "function" ? value.bind(target) : value;
589
- }
590
- });
1836
+ const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1837
+ function bindingOf(value) {
1838
+ return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
591
1839
  }
592
- function createDynamic(component, props) {
593
- const cached = createMemo(component);
594
- return createMemo(() => {
595
- const component = cached();
596
- switch (typeof component) {
597
- case "function":
598
- Object.assign(component, {
599
- [$DEVCOMP]: true
600
- });
601
- return untrack(() => component(props));
602
- case "string":
603
- const isSvg = SVGElements.has(component);
604
- const el = sharedConfig.hydrating ? getNextElement() : createElement(component, isSvg, untrack(() => props.is));
605
- spread(el, props, isSvg);
606
- return el;
1840
+ function dynamic(source) {
1841
+ let latest = 0;
1842
+ const sites = new Set();
1843
+ let deliveredAddress;
1844
+ const resolveBinding = (next, prev) => {
1845
+ const binding = bindingOf(next);
1846
+ if (!binding) return next;
1847
+ deliveredAddress = binding.address;
1848
+ const prevBinding = bindingOf(prev);
1849
+ if (prevBinding && prevBinding.component === binding.component) {
1850
+ for (const deliver of sites) deliver(binding.address);
1851
+ return prev;
607
1852
  }
1853
+ return next;
1854
+ };
1855
+ const cached = createMemo(prev => {
1856
+ const next = source();
1857
+ if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1858
+ const token = ++latest;
1859
+ return {
1860
+ then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
1861
+ };
1862
+ }, {
1863
+ lazy: true
608
1864
  });
1865
+ return props => {
1866
+ return createMemo(() => {
1867
+ const component = cached();
1868
+ switch (typeof component) {
1869
+ case "function":
1870
+ {
1871
+ Object.assign(component, {
1872
+ [$DEVCOMP]: true
1873
+ });
1874
+ const binding = bindingOf(component);
1875
+ if (binding) {
1876
+ const [address, setAddress] = createSignal(deliveredAddress ?? binding.address);
1877
+ sites.add(setAddress);
1878
+ onCleanup(() => sites.delete(setAddress));
1879
+ return untrack(() => binding.component(props, address));
1880
+ }
1881
+ return untrack(() => component(props));
1882
+ }
1883
+ case "string":
1884
+ const el = sharedConfig.hydrating ? getNextElement() : createElement(component, untrack(() => props.is));
1885
+ spread(el, props);
1886
+ return el;
1887
+ }
1888
+ });
1889
+ };
609
1890
  }
610
1891
  function Dynamic(props) {
611
- const others = omit(props, "component");
612
- return createDynamic(() => props.component, others);
1892
+ const Comp = dynamic(() => props.component);
1893
+ return createComponent(Comp, omit(props, "component"));
1894
+ }
1895
+ function createElement(tagName, is = undefined) {
1896
+ return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1897
+ is
1898
+ });
1899
+ }
1900
+ function loadClientOnly(fn, setComp, exportName) {
1901
+ fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
1902
+ }
1903
+ function clientOnly(fn, options = {},
1904
+ _moduleUrl) {
1905
+ const [comp, setComp] = createSignal();
1906
+ let started = !options.lazy;
1907
+ started && loadClientOnly(fn, setComp, options.export);
1908
+ return props => {
1909
+ let Comp;
1910
+ let m;
1911
+ const rest = omit(props, "fallback");
1912
+ if (!started) {
1913
+ started = true;
1914
+ loadClientOnly(fn, setComp, options.export);
1915
+ }
1916
+ if ((Comp = untrack(comp)) && !sharedConfig.hydrating) return Comp(rest);
1917
+ const [mounted, setMounted] = createSignal(!sharedConfig.hydrating);
1918
+ const gate = createMemo(() => (Comp = comp(), m = mounted(), untrack(() => Comp && m ? Comp(rest) : props.fallback)));
1919
+ const onHydrationEnd = sharedConfig.onHydrationEnd;
1920
+ const release = () => setMounted(true);
1921
+ onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
1922
+ return gate;
1923
+ };
613
1924
  }
1925
+ function httpStatus(_code, _text) {}
1926
+ function httpHeader(_name, _value, _options) {}
614
1927
 
615
- export { voidFn as Assets, ChildProperties, DOMElements, DelegatedEvents, Dynamic, Hydration, voidFn as HydrationScript, NoHydration, Portal, Properties, RequestContext, SVGElements, SVGNamespace, addEventListener, assign, className, clearDelegatedEvents, createDynamic, delegateEvents, dynamicProperty, escape, voidFn as generateHydrationScript, voidFn as getAssets, getHydrationKey, getNextElement, getNextMarker, getNextMatch, voidFn as getRequestEvent, hydrate, insert, isDev, isServer, memo, render, renderToStream, renderToString, renderToStringAsync, resolveSSRNode, runHydrationEvents, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassList, ssrElement, ssrHydrationKey, ssrStyle, style, template, use, voidFn as useAssets };
1928
+ export { ChildProperties, DOMElements, DOMWithState, DelegatedEvents, Dynamic, HREF, voidFn as HydrationScript, MathMLElements, Namespaces, Portal, REVALIDATE_HEADER, RawTextElements, RequestContext, ResponseEnvelope, SAFE_ERROR, SVGElements, VoidElements, acquireAsset, addEvent, applyRef, assign, claimElement, claimElementTree, className, clearFlashCookie, clientOnly, commitEventResponse, composeMiddleware, createRequestEvent, createResponseStub, createSSRResponse, delegateEvents, dynamic, dynamicProperty, effect, escape, voidFn as generateHydrationScript, getDelegatedRoot, getExpectedRedirectStatus, getFirstChild, getHydrationKey, getNextElement, getNextMarker, getNextMatch, getNextSibling, voidFn as getRequestEvent, getServerFunctionMetadata, getServerFunctionRPC, hasFlashCookie, httpHeader, httpStatus, hydrate, insert, installHydrationRuntime, isDev, isHref, isResponseEnvelope, isSafeError, isServer, isServerFunction, markSafeError, memo, mergeProps, parseCookieHeader, redirect, ref, registerDelegatedContainer, registerDelegatedRoot, registerElementClaim, reload, render, renderToStream, renderToString, resolveSSRNode, respond, runHydrationEvents, scope, serializeCookie, setAttribute, setAttributeNS, setProperty, setStyleProperty, spread, ssr, ssrAttribute, ssrClassName, ssrElement, ssrGroup, ssrHydrationKey, ssrStyle, ssrStyleProperty, style, template, unregisterDelegatedContainer, unregisterDelegatedRoot, useHead, warmAsset };