@solidjs/web 2.0.0-rc.2 → 2.0.0-rc.21

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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/server.dev.js +5165 -0
  3. package/dist/server.js +1876 -374
  4. package/dist/{server.cjs → server.observe.js} +2070 -577
  5. package/dist/{dev.cjs → web.dev.js} +955 -567
  6. package/dist/web.js +646 -350
  7. package/dist/{dev.js → web.observe.js} +699 -421
  8. package/frames/dist/assets.js +92 -0
  9. package/frames/dist/client.dev.js +1296 -1198
  10. package/frames/dist/client.js +1128 -1191
  11. package/frames/dist/client.observe.js +2041 -0
  12. package/frames/dist/regions.js +171 -0
  13. package/frames/dist/server.dev.js +2545 -0
  14. package/frames/dist/server.js +1683 -3004
  15. package/frames/dist/server.observe.js +2544 -0
  16. package/frames/dist/trace.js +45 -0
  17. package/frames/dist/wire.js +594 -0
  18. package/frames/package.json +2 -25
  19. package/package.json +244 -256
  20. package/performance-tracks/dist/performance-tracks.dev.js +679 -0
  21. package/performance-tracks/dist/performance-tracks.js +6 -0
  22. package/performance-tracks/dist/performance-tracks.observe.js +667 -0
  23. package/performance-tracks/package.json +7 -0
  24. package/performance-tracks/types/index.d.ts +69 -0
  25. package/serialization/decode/package.json +2 -15
  26. package/serialization/dist/decode.js +121 -25
  27. package/serialization/dist/serialization.js +282 -88
  28. package/serialization/package.json +2 -15
  29. package/serialization/types/index.d.ts +115 -153
  30. package/serialization/types/serializer-decode.d.ts +173 -114
  31. package/serialization/types/serializer.d.ts +144 -0
  32. package/server-functions/dist/client.dev.js +1462 -0
  33. package/server-functions/dist/client.js +667 -165
  34. package/server-functions/dist/client.observe.js +1441 -0
  35. package/server-functions/dist/rich-args.js +102 -1
  36. package/server-functions/dist/server.dev.js +2802 -299
  37. package/server-functions/dist/server.js +2724 -314
  38. package/server-functions/dist/server.observe.js +3680 -0
  39. package/server-functions/package.json +2 -35
  40. package/server-functions/rich-args/package.json +2 -15
  41. package/skills/server-components/SKILL.md +117 -0
  42. package/storage/package.json +2 -15
  43. package/types/client.d.ts +342 -288
  44. package/types/constants.d.ts +22 -0
  45. package/types/cookies.d.ts +32 -84
  46. package/types/diagnostics.d.ts +80 -0
  47. package/types/frames/assets-tier.d.ts +78 -0
  48. package/types/frames/client.d.ts +40 -1
  49. package/types/frames/frame-client.d.ts +443 -280
  50. package/types/frames/frame-container-plugin.d.ts +64 -0
  51. package/types/frames/frame-morph.d.ts +29 -0
  52. package/types/frames/frame-sink.d.ts +141 -161
  53. package/types/frames/frame-transport.d.ts +263 -184
  54. package/types/frames/regions-tier.d.ts +60 -0
  55. package/types/frames/serializer-decode.d.ts +241 -0
  56. package/types/frames/serializer.d.ts +115 -153
  57. package/types/frames/server.d.ts +2 -2
  58. package/types/frames/trace-tier.d.ts +2 -0
  59. package/types/frames/tree-rewrite.d.ts +39 -0
  60. package/types/frames/wire-tier.d.ts +169 -0
  61. package/types/head.d.ts +20 -0
  62. package/types/index.d.ts +98 -81
  63. package/types/index.server.d.ts +159 -0
  64. package/types/jsx.d.ts +49 -44
  65. package/types/observe.d.ts +535 -0
  66. package/types/reconcile.d.ts +1 -0
  67. package/types/render.d.ts +11 -0
  68. package/types/request-error-hook.d.ts +5 -0
  69. package/types/response.d.ts +95 -147
  70. package/types/serializer-decode.d.ts +173 -114
  71. package/types/serializer.d.ts +115 -153
  72. package/types/server-functions/argument-codec.d.ts +30 -0
  73. package/types/server-functions/client.d.ts +237 -223
  74. package/types/server-functions/flash.d.ts +28 -30
  75. package/types/server-functions/registry.d.ts +105 -0
  76. package/types/server-functions/rich-args.d.ts +1 -10
  77. package/types/server-functions/server.d.ts +538 -531
  78. package/types/server-functions/shared.d.ts +398 -425
  79. package/types/server-functions/uploads.d.ts +53 -0
  80. package/types/server-mock.d.ts +154 -20
  81. package/types/server-observe.d.ts +86 -0
  82. package/types/server.d.ts +601 -422
  83. package/types/trace.d.ts +127 -0
  84. package/LICENSE +0 -21
  85. package/dist/web.cjs +0 -2033
  86. package/frames/dist/client.cjs +0 -2002
  87. package/frames/dist/client.dev.cjs +0 -2022
  88. package/frames/dist/server.cjs +0 -3877
  89. package/serialization/dist/decode.cjs +0 -139
  90. package/serialization/dist/serialization.cjs +0 -261
  91. package/serialization/types-cjs/index.d.cts +0 -182
  92. package/serialization/types-cjs/package.json +0 -3
  93. package/serialization/types-cjs/serializer-decode.d.cts +0 -182
  94. package/server-functions/dist/client.cjs +0 -834
  95. package/server-functions/dist/rich-args.cjs +0 -11
  96. package/server-functions/dist/server.cjs +0 -1242
  97. package/server-functions/dist/server.dev.cjs +0 -1242
  98. package/storage/dist/storage.cjs +0 -12
  99. package/storage/types-cjs/index.d.cts +0 -28
  100. package/storage/types-cjs/package.json +0 -3
  101. package/types/core.d.ts +0 -9
  102. package/types-cjs/client.d.cts +0 -337
  103. package/types-cjs/cookies.d.cts +0 -93
  104. package/types-cjs/core.d.cts +0 -9
  105. package/types-cjs/frames/client.d.cts +0 -36
  106. package/types-cjs/frames/frame-client.d.cts +0 -356
  107. package/types-cjs/frames/frame-sink.d.cts +0 -194
  108. package/types-cjs/frames/frame-transport.d.cts +0 -222
  109. package/types-cjs/frames/serializer.d.cts +0 -182
  110. package/types-cjs/frames/server.d.cts +0 -52
  111. package/types-cjs/index.d.cts +0 -244
  112. package/types-cjs/jsx-properties.d.cts +0 -93
  113. package/types-cjs/jsx.d.cts +0 -4159
  114. package/types-cjs/package.json +0 -3
  115. package/types-cjs/response.d.cts +0 -174
  116. package/types-cjs/serializer-decode.d.cts +0 -182
  117. package/types-cjs/serializer.d.cts +0 -182
  118. package/types-cjs/server-functions/client.d.cts +0 -262
  119. package/types-cjs/server-functions/flash.d.cts +0 -38
  120. package/types-cjs/server-functions/rich-args.d.cts +0 -10
  121. package/types-cjs/server-functions/server.d.cts +0 -681
  122. package/types-cjs/server-functions/shared.d.cts +0 -523
  123. package/types-cjs/server-mock.d.cts +0 -286
  124. package/types-cjs/server.d.cts +0 -544
package/dist/web.cjs DELETED
@@ -1,2033 +0,0 @@
1
- 'use strict';
2
-
3
- var solidJs = require('solid-js');
4
-
5
- const DOMWithState = {
6
- INPUT: {
7
- value: 1,
8
- defaultValue: 2,
9
- checked: 1,
10
- defaultChecked: 2
11
- },
12
- SELECT: {
13
- value: 1
14
- },
15
- OPTION: {
16
- value: 1,
17
- selected: 1,
18
- defaultSelected: 2
19
- },
20
- TEXTAREA: {
21
- value: 1,
22
- defaultValue: 2
23
- },
24
- VIDEO: {
25
- muted: 1,
26
- defaultMuted: 2
27
- },
28
- AUDIO: {
29
- muted: 1,
30
- defaultMuted: 2
31
- }
32
- };
33
- const ChildProperties = /*#__PURE__*/new Set(["innerHTML", "textContent", "innerText", "children"]);
34
- const $$SLOT = /*#__PURE__*/Symbol("slot");
35
- const $$HOST = /*#__PURE__*/Symbol("host");
36
- 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"]);
37
- const SVGElements = /*#__PURE__*/new Set([
38
- "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",
39
- "set", "stop",
40
- "svg", "switch", "symbol", "text", "textPath",
41
- "tref", "tspan", "use", "view", "vkern"]);
42
- 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"]);
43
- const Namespaces = {
44
- svg: "http://www.w3.org/2000/svg",
45
- mathml: "http://www.w3.org/1998/Math/MathML",
46
- xlink: "http://www.w3.org/1999/xlink",
47
- xml: "http://www.w3.org/XML/1998/namespace"
48
- };
49
- const VoidElements = /*#__PURE__*/new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
50
- const RawTextElements = /*#__PURE__*/new Set(["style", "script", "noscript", "template", "textarea", "title"]);
51
- 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(","));
52
-
53
- const transparentOptions = {
54
- transparent: true,
55
- sync: true
56
- };
57
- const syncOptions = {
58
- sync: true
59
- };
60
- const effect = (fn, effectFn, options) => solidJs.createRenderEffect(fn, effectFn, options ? {
61
- sync: true,
62
- ...options,
63
- transparent: !options.scope
64
- } : transparentOptions);
65
- const memo = fn => solidJs.createMemo(() => fn(), syncOptions);
66
- const assetGates = new WeakMap();
67
- const waitAsset = promise => {
68
- let gate = assetGates.get(promise);
69
- if (!gate) {
70
- solidJs.runWithOwner(null, () => {
71
- gate = solidJs.createMemo(() => promise);
72
- });
73
- assetGates.set(promise, gate);
74
- }
75
- gate();
76
- };
77
-
78
- function reconcileArrays(parentNode, a, b, marker) {
79
- let bLength = b.length,
80
- aEnd = a.length,
81
- bEnd = bLength,
82
- aStart = 0,
83
- bStart = 0,
84
- tail = a[aEnd - 1],
85
- tailTag = tail[$$SLOT],
86
- after = tail.parentNode === parentNode && (!tailTag || tailTag === marker) ? tail.nextSibling : marker || null,
87
- map = null,
88
- anchor,
89
- anchorTag;
90
- const isLive = n => {
91
- if (!n) return false;
92
- const tag = n[$$SLOT];
93
- return n.parentNode === parentNode && (!tag || tag === marker);
94
- };
95
- while (aStart < aEnd || bStart < bEnd) {
96
- if (a[aStart] === b[bStart] && isLive(a[aStart])) {
97
- aStart++;
98
- bStart++;
99
- continue;
100
- }
101
- while (a[aEnd - 1] === b[bEnd - 1] && isLive(a[aEnd - 1])) {
102
- aEnd--;
103
- bEnd--;
104
- }
105
- if (aEnd === aStart) {
106
- let node;
107
- if (bEnd < bLength) {
108
- if (bStart) {
109
- const prev = b[bStart - 1];
110
- const prevTag = prev[$$SLOT];
111
- node = prev.parentNode === parentNode && (!prevTag || prevTag === marker) ? prev.nextSibling : after;
112
- } else node = b[bEnd - bStart];
113
- } else node = after;
114
- while (bStart < bEnd) {
115
- const n = b[bStart++];
116
- parentNode.insertBefore(n, node);
117
- if (marker) n[$$SLOT] = marker;
118
- }
119
- } else if (bEnd === bStart) {
120
- while (aStart < aEnd) {
121
- const n = a[aStart++];
122
- if (!map || !map.has(n)) {
123
- const tag = n[$$SLOT];
124
- if (n.parentNode === parentNode && (!tag || tag === marker)) n.remove();
125
- }
126
- }
127
- } else if ((anchor = a[aStart]) === b[bEnd - 1] && b[bStart] === a[aEnd - 1] && anchor.parentNode === parentNode && (!(anchorTag = anchor[$$SLOT]) || anchorTag === marker)) {
128
- if (marker) {
129
- do {
130
- const n = a[--aEnd];
131
- parentNode.insertBefore(n, anchor);
132
- n[$$SLOT] = marker;
133
- bStart++;
134
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
135
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
136
- } else {
137
- do {
138
- parentNode.insertBefore(a[--aEnd], anchor);
139
- bStart++;
140
- if (aStart >= aEnd - 1 || bStart >= bEnd) break;
141
- } while (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]);
142
- }
143
- } else {
144
- if (!map) {
145
- map = new Map();
146
- let i = bStart;
147
- while (i < bEnd) map.set(b[i], i++);
148
- }
149
- const index = map.get(a[aStart]);
150
- if (index != null) {
151
- if (bStart < index && index < bEnd) {
152
- let i = aStart,
153
- sequence = 1,
154
- t;
155
- while (++i < aEnd && i < bEnd) {
156
- if ((t = map.get(a[i])) == null || t !== index + sequence) break;
157
- sequence++;
158
- }
159
- if (sequence > index - bStart) {
160
- const head = a[aStart];
161
- const headTag = head[$$SLOT];
162
- const node = head.parentNode === parentNode && (!headTag || headTag === marker) ? head : after;
163
- while (bStart < index) {
164
- const n = b[bStart++];
165
- parentNode.insertBefore(n, node);
166
- if (marker) n[$$SLOT] = marker;
167
- }
168
- } else {
169
- const oldNode = a[aStart++];
170
- const newNode = b[bStart++];
171
- const oldTag = oldNode[$$SLOT];
172
- if (oldNode.parentNode === parentNode && (!oldTag || oldTag === marker)) {
173
- parentNode.replaceChild(newNode, oldNode);
174
- } else {
175
- parentNode.insertBefore(newNode, after);
176
- }
177
- if (marker) newNode[$$SLOT] = marker;
178
- }
179
- } else aStart++;
180
- } else {
181
- const n = a[aStart++];
182
- const nTag = n[$$SLOT];
183
- if (n.parentNode === parentNode && (!nTag || nTag === marker)) n.remove();
184
- }
185
- }
186
- }
187
- }
188
-
189
- const HEAD_ELIGIBLE_TAGS = new Set(["title", "meta", "link", "style", "script", "base"]);
190
- const HEAD_ATTR_NAME = /^[a-zA-Z_][a-zA-Z0-9_:.-]*$/;
191
- const RESOURCE_LINK_RELS = new Set(["preload", "modulepreload", "prefetch", "preconnect", "dns-prefetch", "stylesheet"]);
192
- const RESOURCE_QUALIFIERS = ["as", "crossorigin", "type", "media", "imagesrcset", "imagesizes"];
193
- const STYLESHEET_FETCH_META = new Set(["crossorigin", "integrity", "referrerpolicy", "fetchpriority"]);
194
- function evalHeadValue(v) {
195
- return typeof v === "function" ? v() : v;
196
- }
197
- function evalHeadProps(props, presets) {
198
- const out = {};
199
- for (const name in props) out[name] = presets && name in presets ? presets[name] : evalHeadValue(props[name]);
200
- return out;
201
- }
202
- function classifyHeadTag(desc) {
203
- const tag = desc.tag;
204
- if (tag === "link") {
205
- const rel = evalHeadValue(desc.props && desc.props.rel);
206
- return {
207
- resource: RESOURCE_LINK_RELS.has(rel),
208
- rel
209
- };
210
- }
211
- if (tag === "style") return {
212
- resource: !!(desc.props && "href" in desc.props)
213
- };
214
- if (tag === "script") return {
215
- resource: !!(desc.props && "src" in desc.props)
216
- };
217
- return {
218
- resource: false
219
- };
220
- }
221
- function resourceIdentity(tag, props) {
222
- let id = "res:" + tag + ":" + (props.rel || "") + ":" + (props.href || props.src || "");
223
- for (let i = 0; i < RESOURCE_QUALIFIERS.length; i++) {
224
- const q = RESOURCE_QUALIFIERS[i];
225
- if (props[q] != null) id += ":" + q + "=" + props[q];
226
- }
227
- return id;
228
- }
229
- function replaceableIdentity(tag, props, key, unique) {
230
- if (tag === "title") return "title";
231
- if (tag === "base") return "base";
232
- if (tag === "meta" && props.charset != null) return "charset";
233
- if (key != null) return tag + ":key:" + key;
234
- if (tag === "meta") {
235
- for (const ns of ["name", "property", "http-equiv"]) if (props[ns] != null) return "meta:" + ns + ":" + props[ns] + (props.media != null ? ":media=" + props.media : "");
236
- return unique;
237
- }
238
- if (tag === "link") {
239
- const rel = props.rel || "";
240
- if (rel === "icon" || rel === "apple-touch-icon") return "link:" + rel + (props.sizes != null ? ":sizes=" + props.sizes : "") + (props.type != null ? ":type=" + props.type : "");
241
- return "link:" + rel + ":" + (props.href || "");
242
- }
243
- return unique;
244
- }
245
- function resolveHead(groups) {
246
- const winners = new Map();
247
- const sorted = groups.slice().sort((a, b) => a.seq - b.seq);
248
- for (let i = 0; i < sorted.length; i++) {
249
- const group = sorted[i];
250
- const byIdentity = new Map();
251
- for (let j = 0; j < group.tags.length; j++) {
252
- const t = group.tags[j];
253
- let list = byIdentity.get(t.identity);
254
- if (!list) byIdentity.set(t.identity, list = []);
255
- list.push(t);
256
- }
257
- for (const [identity, tags] of byIdentity) {
258
- if (identity === "title") {
259
- winners.set(identity, {
260
- seq: group.seq,
261
- tags: [tags[tags.length - 1]]
262
- });
263
- } else {
264
- winners.set(identity, {
265
- seq: group.seq,
266
- tags
267
- });
268
- }
269
- }
270
- }
271
- return winners;
272
- }
273
-
274
- function parseCookieHeader(header) {
275
- const cookies = {};
276
- if (!header) return cookies;
277
- for (const part of header.split(";")) {
278
- const eq = part.indexOf("=");
279
- if (eq < 0) continue;
280
- const name = decodeSafe(part.slice(0, eq).trim());
281
- let value = part.slice(eq + 1).trim();
282
- if (value.length > 1 && value[0] === '"' && value[value.length - 1] === '"') {
283
- value = value.slice(1, -1);
284
- }
285
- cookies[name] = decodeSafe(value);
286
- }
287
- return cookies;
288
- }
289
- function decodeSafe(text) {
290
- try {
291
- return decodeURIComponent(text);
292
- } catch {
293
- return text;
294
- }
295
- }
296
- function serializeCookie(name, value, options = {}) {
297
- let cookie = `${encodeURIComponent(name)}=${encodeURIComponent(value)}`;
298
- cookie += `; Path=${options.path === undefined ? "/" : options.path}`;
299
- if (options.domain) cookie += `; Domain=${options.domain}`;
300
- if (options.maxAge !== undefined) cookie += `; Max-Age=${Math.trunc(options.maxAge)}`;
301
- if (options.expires) cookie += `; Expires=${options.expires.toUTCString()}`;
302
- if (options.httpOnly) cookie += "; HttpOnly";
303
- if (options.secure) cookie += "; Secure";
304
- if (options.sameSite) {
305
- const sameSite = options.sameSite.toLowerCase();
306
- cookie += `; SameSite=${sameSite === "none" ? "None" : sameSite === "strict" ? "Strict" : "Lax"}`;
307
- }
308
- return cookie;
309
- }
310
- const FLASH_COOKIE = "flash";
311
- const FLASH_MATCHER = new RegExp(`(?:^|;\\s*)${FLASH_COOKIE}=([^;]+)`);
312
- function hasFlashCookie(cookieHeader) {
313
- return !!cookieHeader && FLASH_MATCHER.test(cookieHeader);
314
- }
315
- function clearFlashCookie() {
316
- return `${FLASH_COOKIE}=; Max-Age=0; Path=/`;
317
- }
318
-
319
- const SERVER_FUNCTION_METADATA = Symbol.for("solid.ServerFunctionMetadata");
320
- function getServerFunctionMetadata(fn) {
321
- if (typeof fn !== "function") return undefined;
322
- return fn[SERVER_FUNCTION_METADATA] || undefined;
323
- }
324
- function isServerFunction(fn) {
325
- return typeof fn === "function" && !!fn[SERVER_FUNCTION_METADATA];
326
- }
327
- const SERVER_FUNCTION_RPC = Symbol.for("solid.ServerFunctionRPC");
328
- function getServerFunctionRPC() {
329
- return globalThis[SERVER_FUNCTION_RPC];
330
- }
331
-
332
- const $$EVENT_OWNER = "_$DX_EVENT_OWNER";
333
- const INNER_OWNED = {};
334
- const delegatedEvents = new Set();
335
- const delegatedContainers = new Map();
336
- function render$1(code, element, init, options = {}) {
337
- let disposer;
338
- registerDelegatedRoot(element);
339
- try {
340
- solidJs.createRoot(dispose => {
341
- disposer = dispose;
342
- if (element === document) {
343
- const tree = code();
344
- effect(() => solidJs.flatten(tree), () => {});
345
- } else {
346
- const tree = code();
347
- insert(element, () => tree, element.firstChild ? null : undefined, init, options.insertOptions);
348
- }
349
- }, {
350
- id: options.renderId
351
- });
352
- } catch (err) {
353
- if (disposer) disposer();
354
- unregisterDelegatedRoot(element);
355
- throw err;
356
- }
357
- return () => {
358
- disposer();
359
- unregisterDelegatedRoot(element);
360
- element.textContent = "";
361
- };
362
- }
363
- function create(html, bypassGuard, flag) {
364
- const t = document.createElement("template");
365
- t.innerHTML = html;
366
- return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
367
- }
368
- function template(html, flag) {
369
- let node;
370
- const fn = flag === 1 ? bypassGuard => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : bypassGuard => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
371
- return fn;
372
- }
373
- function delegateEvents(eventNames) {
374
- for (let i = 0, l = eventNames.length; i < l; i++) {
375
- const name = eventNames[i];
376
- if (!delegatedEvents.has(name)) {
377
- delegatedEvents.add(name);
378
- delegatedContainers.forEach((state, container) => attachDelegatedEvent(name, container, state));
379
- }
380
- }
381
- }
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;
433
- }
434
- }
435
- function setProperty(node, name, value) {
436
- if (isHydrating(node)) return;
437
- node[name] = value;
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
- }
469
- function setAttribute(node, name, value) {
470
- if (isHydrating(node)) return;
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);
473
- }
474
- function setAttributeNS(node, namespace, name, value) {
475
- if (isHydrating(node)) return;
476
- if (value == null || value === false) node.removeAttributeNS(namespace, name.indexOf(":") > -1 ? name.split(":").pop() : name);else node.setAttributeNS(namespace, name, value === true ? "" : value);
477
- }
478
- function className(node, value, prev) {
479
- if (isHydrating(node)) return;
480
- if (value == null || value === false) {
481
- prev && node.removeAttribute("class");
482
- return;
483
- }
484
- if (typeof value === "string") {
485
- value !== prev && node.setAttribute("class", value);
486
- return;
487
- }
488
- if (typeof prev === "string") {
489
- prev = {};
490
- node.removeAttribute("class");
491
- } else prev = classListToObject(prev || {});
492
- value = classListToObject(value);
493
- const classKeys = Object.keys(value || {});
494
- const prevKeys = Object.keys(prev);
495
- let i, len;
496
- for (i = 0, len = prevKeys.length; i < len; i++) {
497
- const key = prevKeys[i];
498
- if (!key || key === "undefined" || value[key]) continue;
499
- node.classList.remove(key);
500
- }
501
- for (i = 0, len = classKeys.length; i < len; i++) {
502
- const key = classKeys[i],
503
- classValue = !!value[key];
504
- if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
505
- node.classList.add(key);
506
- }
507
- }
508
- function addEvent(node, name, handler, delegate) {
509
- if (delegate) {
510
- if (Array.isArray(handler)) {
511
- node[`$$${name}`] = handler[0];
512
- node[`$$${name}Data`] = handler[1];
513
- } else node[`$$${name}`] = handler;
514
- } else if (Array.isArray(handler)) {
515
- const handlerFn = handler[0];
516
- node.addEventListener(name, handler[0] = e => handlerFn.call(node, handler[1], e));
517
- } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
518
- }
519
- function style(node, value, prev) {
520
- if (!value) {
521
- if (prev || node._$styles) {
522
- setAttribute(node, "style");
523
- node._$styles = undefined;
524
- }
525
- return;
526
- }
527
- const nodeStyle = node.style;
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
- }
542
- let v, s;
543
- for (s in applied) {
544
- if (value[s] == null) {
545
- nodeStyle.removeProperty(s);
546
- delete applied[s];
547
- }
548
- }
549
- for (s in value) {
550
- v = value[s];
551
- if (v != null && v !== applied[s]) {
552
- nodeStyle.setProperty(s, v);
553
- applied[s] = v;
554
- }
555
- }
556
- }
557
- function setStyleProperty(node, name, value) {
558
- value != null ? node.style.setProperty(name, value) : node.style.removeProperty(name);
559
- }
560
- function spread(node, props = {}, skipChildren) {
561
- const prevProps = {};
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(() => {
568
- const newProps = {};
569
- for (const prop in props) {
570
- if (prop === "children" || prop === "ref") continue;
571
- newProps[prop] = props[prop];
572
- }
573
- return newProps;
574
- }, props => assign(node, props, true, prevProps, true));
575
- return prevProps;
576
- }
577
- function dynamicProperty(props, key) {
578
- const src = props[key];
579
- Object.defineProperty(props, key, {
580
- get() {
581
- return src();
582
- },
583
- enumerable: true
584
- });
585
- return props;
586
- }
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 = solidJs.untrack(fn);
592
- solidJs.runWithOwner(null, () => applyRef(resolved, element));
593
- }
594
- const PURE_ROW = Symbol.for("solid.pure-row");
595
- function rowProof(fn) {
596
- fn[PURE_ROW] = true;
597
- return fn;
598
- }
599
- function scope(fn) {
600
- fn.$s = true;
601
- return fn;
602
- }
603
- const SCOPE_OPTIONS = {
604
- scope: true
605
- };
606
- let hydrationRt = null;
607
- function installHydrationRuntime() {
608
- hydrationRt = {
609
- claimInitial(parent, multi, initial) {
610
- if (isHydrating(parent)) {
611
- if (!multi && initial === undefined && parent) initial = [...parent.childNodes];
612
- if (Array.isArray(initial)) stripTextSeparators(initial);
613
- }
614
- return initial;
615
- },
616
- reclaimRegion(current, parent, marker) {
617
- if (!solidJs.sharedConfig.hydrating || !current || !parent.isConnected) return current;
618
- const first = Array.isArray(current) ? current[0] : current;
619
- if (!first || !first.nodeType || first.isConnected) return current;
620
- let nodes;
621
- if (marker) {
622
- nodes = [];
623
- let node = marker.previousSibling,
624
- depth = 0;
625
- while (node) {
626
- if (node.nodeType === 8) {
627
- const v = node.nodeValue;
628
- if (v === "/") depth++;else if (v === "$") {
629
- if (depth === 0) break;
630
- depth--;
631
- }
632
- }
633
- nodes.unshift(node);
634
- node = node.previousSibling;
635
- }
636
- } else nodes = [...parent.childNodes];
637
- return stripTextSeparators(nodes);
638
- },
639
- dedupEvent(e) {
640
- return !!(solidJs.sharedConfig.registry && solidJs.sharedConfig.events && solidJs.sharedConfig.events.find(([el, ev]) => ev === e));
641
- }
642
- };
643
- }
644
- function stripTextSeparators(nodes) {
645
- let j = 0;
646
- for (let i = 0; i < nodes.length; i++) {
647
- const node = nodes[i],
648
- t = node.nodeType;
649
- if (t === 8) {
650
- const v = node.nodeValue;
651
- if (v === "!$") {
652
- node.remove();
653
- continue;
654
- }
655
- if (v.startsWith("pl-")) continue;
656
- } else if (t === 1 && node.localName === "template" && node.id.startsWith("pl-")) continue;
657
- nodes[j++] = node;
658
- }
659
- nodes.length = j;
660
- return nodes;
661
- }
662
- function patchDriver(subject, body) {
663
- {
664
- effect(() => body(subject, subject, false), () => body(subject, undefined, true));
665
- }
666
- }
667
- function insert(parent, accessor, marker, initial, options) {
668
- const multi = marker !== undefined;
669
- const host = options && options.host;
670
- if (multi && !initial) initial = [];
671
- if (hydrationRt !== null) initial = hydrationRt.claimInitial(parent, multi, initial);
672
- if (typeof accessor !== "function") {
673
- accessor = normalize(accessor, initial, multi, true);
674
- if (typeof accessor !== "function") {
675
- insertExpression(parent, accessor, initial, marker);
676
- host && tagHost(accessor, host);
677
- return;
678
- }
679
- }
680
- if (multi && initial.length === 0) {
681
- const placeholder = document.createTextNode("");
682
- parent.insertBefore(placeholder, marker);
683
- initial = [placeholder];
684
- }
685
- let current = initial;
686
- effect(prev => {
687
- if (hydrationRt !== null) current = hydrationRt.reclaimRegion(current, parent, marker);
688
- const value = normalize(accessor(), current, multi, true);
689
- if (typeof value !== "function") return value;
690
- effect(() => (hydrationRt !== null && (current = hydrationRt.reclaimRegion(current, parent, marker)), normalize(value, current, multi)), inner => {
691
- current = insertExpression(parent, inner, current, marker);
692
- host && tagHost(current, host);
693
- }, prev !== undefined && !(options && options.schedule) ? {
694
- ...options,
695
- schedule: true
696
- } : options);
697
- return INNER_OWNED;
698
- }, value => {
699
- if (value === INNER_OWNED) return;
700
- current = insertExpression(parent, value, current, marker);
701
- host && tagHost(current, host);
702
- },
703
- accessor.$s ? options ? {
704
- ...options,
705
- scope: true
706
- } : SCOPE_OPTIONS : options);
707
- }
708
- function assign(node, props, skipChildren, prevProps = {}, skipRef = false) {
709
- const nodeName = node.nodeName;
710
- props || (props = {});
711
- for (const prop in prevProps) {
712
- if (!(prop in props)) {
713
- if (prop === "children") continue;
714
- prevProps[prop] = assignProp(node, prop, null, prevProps[prop], skipRef, nodeName);
715
- }
716
- }
717
- for (const prop in props) {
718
- if (prop === "children") {
719
- if (!skipChildren) insertExpression(node, normalize(props.children, undefined, false));
720
- continue;
721
- }
722
- prevProps[prop] = assignProp(node, prop, props[prop], prevProps[prop], skipRef, nodeName);
723
- }
724
- }
725
- const ASSET_REMOVAL_GRACE = 100;
726
- const assetRegistry = new Map();
727
- function assetEntryKey(descriptor) {
728
- if (descriptor.policy === "exclusive") return "x|" + descriptor.key;
729
- return descriptor.type === "inline-style" ? "i|" + descriptor.id : descriptor.type + "|" + descriptor.href;
730
- }
731
- function findAssetElement(selector, attr, value) {
732
- const nodes = document.querySelectorAll(selector);
733
- for (let i = 0; i < nodes.length; i++) {
734
- if (nodes[i].getAttribute(attr) === value) return nodes[i];
735
- }
736
- return null;
737
- }
738
- function setAssetAttrs(el, attrs) {
739
- for (const name in attrs) el.setAttribute(name, attrs[name]);
740
- }
741
- function mountAssetElement(descriptor) {
742
- let el;
743
- if (descriptor.type === "inline-style") {
744
- el = findAssetElement("style[data-asset]", "data-asset", descriptor.id);
745
- if (!el) {
746
- el = document.createElement("style");
747
- el.setAttribute("data-asset", descriptor.id);
748
- el.textContent = descriptor.content || "";
749
- }
750
- } else {
751
- const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
752
- el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
753
- if (!el) {
754
- el = document.createElement("link");
755
- el.rel = rel;
756
- el.href = descriptor.href;
757
- }
758
- }
759
- if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
760
- if (!el.isConnected) document.head.appendChild(el);
761
- return el;
762
- }
763
- const assetLoadSettled = /*#__PURE__*/Promise.resolve();
764
- function trackAssetLoad(entry, adopted) {
765
- if (entry.loadPromise) return;
766
- const el = entry.element;
767
- let settled = el.sheet != null;
768
- if (!settled && adopted && typeof performance !== "undefined" && performance.getEntriesByName) {
769
- settled = performance.getEntriesByName(el.href).length > 0;
770
- }
771
- if (settled) {
772
- entry.loadState = "loaded";
773
- entry.loadPromise = assetLoadSettled;
774
- return;
775
- }
776
- entry.loadState = "pending";
777
- entry.loadPromise = new Promise(resolve => {
778
- const settle = state => {
779
- entry.loadState = state;
780
- resolve();
781
- };
782
- el.addEventListener("load", () => settle("loaded"), {
783
- once: true
784
- });
785
- el.addEventListener("error", () => settle("errored"), {
786
- once: true
787
- });
788
- });
789
- }
790
- function warmAsset(descriptor) {
791
- if (descriptor.policy === "exclusive" || descriptor.type === "inline-style") return;
792
- const key = assetEntryKey(descriptor);
793
- let entry = assetRegistry.get(key);
794
- if (!entry) {
795
- entry = {
796
- count: 0,
797
- element: null,
798
- timer: null
799
- };
800
- assetRegistry.set(key, entry);
801
- }
802
- let adopted = true;
803
- if (!entry.element || !entry.element.isConnected) {
804
- const rel = descriptor.type === "module" ? "modulepreload" : "stylesheet";
805
- let el = findAssetElement(`link[rel="${rel}"]`, "href", descriptor.href);
806
- if (!el && descriptor.type === "style") {
807
- el = findAssetElement('link[rel="preload"][as="style"]', "href", descriptor.href);
808
- }
809
- if (!el) {
810
- adopted = false;
811
- el = document.createElement("link");
812
- if (descriptor.type === "style") {
813
- el.setAttribute("rel", "preload");
814
- el.setAttribute("as", "style");
815
- } else {
816
- el.setAttribute("rel", "modulepreload");
817
- }
818
- el.setAttribute("href", descriptor.href);
819
- if (!document.body) el.setAttribute("blocking", "render");
820
- }
821
- if (descriptor.attrs) setAssetAttrs(el, descriptor.attrs);
822
- if (!el.isConnected) document.head.appendChild(el);
823
- entry.element = el;
824
- entry.loadState = undefined;
825
- entry.loadPromise = undefined;
826
- }
827
- if (descriptor.type === "style") trackAssetLoad(entry, adopted);
828
- return entry;
829
- }
830
- function acquireAsset(descriptor) {
831
- const key = assetEntryKey(descriptor);
832
- let entry = assetRegistry.get(key);
833
- if (descriptor.policy === "exclusive") {
834
- if (!entry) {
835
- entry = {
836
- original: descriptor.get(),
837
- set: descriptor.set,
838
- writers: []
839
- };
840
- assetRegistry.set(key, entry);
841
- }
842
- const writer = {
843
- value: descriptor.value
844
- };
845
- entry.writers.push(writer);
846
- entry.set(writer.value);
847
- let released = false;
848
- return () => {
849
- if (released) return;
850
- released = true;
851
- const index = entry.writers.indexOf(writer);
852
- const wasTop = index === entry.writers.length - 1;
853
- entry.writers.splice(index, 1);
854
- if (!wasTop) return;
855
- if (entry.writers.length) {
856
- entry.set(entry.writers[entry.writers.length - 1].value);
857
- } else {
858
- entry.set(entry.original);
859
- assetRegistry.delete(key);
860
- }
861
- };
862
- }
863
- if (!entry) {
864
- entry = {
865
- count: 0,
866
- element: null,
867
- timer: null
868
- };
869
- assetRegistry.set(key, entry);
870
- }
871
- if (entry.timer) {
872
- clearTimeout(entry.timer);
873
- entry.timer = null;
874
- }
875
- entry.count++;
876
- if (!entry.element || !entry.element.isConnected) {
877
- entry.element = mountAssetElement(descriptor);
878
- } else if (descriptor.type === "style" && entry.element.getAttribute("rel") === "preload") {
879
- entry.element.removeAttribute("as");
880
- entry.element.setAttribute("rel", "stylesheet");
881
- }
882
- let released = false;
883
- return () => {
884
- if (released) return;
885
- released = true;
886
- if (--entry.count > 0) return;
887
- entry.timer = setTimeout(() => {
888
- assetRegistry.delete(key);
889
- entry.element && entry.element.remove();
890
- }, ASSET_REMOVAL_GRACE);
891
- };
892
- }
893
- let headRegistrations = null;
894
- let headSeq = 0;
895
- let headUid = 0;
896
- let headOwned = null;
897
- let headApplied = null;
898
- let headFallbackTitle = null;
899
- let headScheduled = false;
900
- const headMountedResources = new Set();
901
- function initHeadRegistry() {
902
- if (headRegistrations) return;
903
- headRegistrations = [];
904
- headOwned = new Map();
905
- headApplied = new Map();
906
- const t = document.querySelector("title");
907
- headFallbackTitle = t ? t.hasAttribute("data-dh") ? t.getAttribute("data-dhf") : t.textContent : null;
908
- if (globalThis._$HY) globalThis._$HY.h = applyServerHeadOps;
909
- }
910
- function applyServerHeadOps(ops) {
911
- for (let i = 0; i < ops.length; i++) {
912
- const op = ops[i];
913
- const identity = op[0] === "t" ? "title" : op[1];
914
- if (headOwned.has(identity)) continue;
915
- if (op[0] === "t") setHeadTitle(op[1]);else if (op[0] === "r") {
916
- const els = headMarkedElements(identity);
917
- for (let j = 0; j < els.length; j++) els[j].remove();
918
- } else {
919
- const el = document.createElement(op[2]);
920
- for (const name in op[3]) el.setAttribute(name, op[3][name]);
921
- if (op[4] != null) el.textContent = op[4];
922
- el.setAttribute("data-dh", identity);
923
- document.head.appendChild(el);
924
- }
925
- }
926
- }
927
- function headMarkedElements(identity) {
928
- const nodes = document.head.querySelectorAll("[data-dh]");
929
- const out = [];
930
- for (let i = 0; i < nodes.length; i++) {
931
- if (nodes[i].getAttribute("data-dh") === identity) out.push(nodes[i]);
932
- }
933
- return out;
934
- }
935
- function setHeadTitle(text) {
936
- let el = document.querySelector("title");
937
- if (!el) {
938
- el = document.createElement("title");
939
- document.head.appendChild(el);
940
- }
941
- el.textContent = text;
942
- el.setAttribute("data-dh", "title");
943
- return el;
944
- }
945
- function scheduleHeadApply() {
946
- if (headScheduled) return;
947
- headScheduled = true;
948
- queueMicrotask(flushHeadRegistry);
949
- }
950
- function flushHeadRegistry() {
951
- if (solidJs.sharedConfig.hydrating) {
952
- setTimeout(flushHeadRegistry, 0);
953
- return;
954
- }
955
- headScheduled = false;
956
- const winners = resolveHead(headRegistrations);
957
- for (const [identity, els] of headOwned) {
958
- if (winners.has(identity)) continue;
959
- headOwned.delete(identity);
960
- headApplied.delete(identity);
961
- if (identity === "title") {
962
- if (headFallbackTitle != null) {
963
- const el = setHeadTitle(headFallbackTitle);
964
- el.removeAttribute("data-dh");
965
- el.removeAttribute("data-dhf");
966
- }
967
- } else {
968
- for (let i = 0; i < els.length; i++) els[i].remove();
969
- }
970
- }
971
- for (const [identity, winner] of winners) {
972
- let sig = "";
973
- for (let i = 0; i < winner.tags.length; i++) sig += winner.tags[i].tag + JSON.stringify(winner.tags[i].props) + "|";
974
- if (headApplied.get(identity) === sig) continue;
975
- headApplied.set(identity, sig);
976
- if (identity === "base" || identity === "charset") {
977
- continue;
978
- }
979
- if (identity === "title") {
980
- const children = winner.tags[0].props.children;
981
- setHeadTitle(children == null ? "" : String(children));
982
- headOwned.set(identity, []);
983
- continue;
984
- }
985
- const existing = headMarkedElements(identity);
986
- const els = [];
987
- for (let i = 0; i < winner.tags.length; i++) {
988
- els.push(renderHeadElement(winner.tags[i], identity, existing));
989
- }
990
- for (let i = 0; i < existing.length; i++) {
991
- if (els.indexOf(existing[i]) === -1) existing[i].remove();
992
- }
993
- headOwned.set(identity, els);
994
- }
995
- }
996
- function createHeadElement(tag, props) {
997
- const el = document.createElement(tag);
998
- for (const name in props) {
999
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1000
- if (!HEAD_ATTR_NAME.test(name)) {
1001
- continue;
1002
- }
1003
- const v = props[name];
1004
- if (v == null || v === false) continue;
1005
- el.setAttribute(name, v === true ? "" : String(v));
1006
- }
1007
- if (props.children != null) el.textContent = String(props.children);
1008
- return el;
1009
- }
1010
- function renderHeadElement(t, identity, existing) {
1011
- for (let i = 0; i < existing.length; i++) {
1012
- if (headElementMatches(existing[i], t)) return existing.splice(i, 1)[0];
1013
- }
1014
- const el = createHeadElement(t.tag, t.props);
1015
- el.setAttribute("data-dh", identity);
1016
- document.head.appendChild(el);
1017
- return el;
1018
- }
1019
- function headElementMatches(el, t) {
1020
- if (el.tagName.toLowerCase() !== t.tag) return false;
1021
- for (const name in t.props) {
1022
- if (name === "children" || name === "ref" || name.slice(0, 2) === "on") continue;
1023
- if (!HEAD_ATTR_NAME.test(name)) continue;
1024
- const v = t.props[name];
1025
- if (v == null || v === false) {
1026
- if (el.hasAttribute(name)) return false;
1027
- } else if (el.getAttribute(name) !== (v === true ? "" : String(v))) return false;
1028
- }
1029
- const children = t.props.children;
1030
- return (children == null ? "" : String(children)) === el.textContent;
1031
- }
1032
- function mountHeadResource(tag, props) {
1033
- const identity = resourceIdentity(tag, props);
1034
- if (headMountedResources.has(identity)) return;
1035
- headMountedResources.add(identity);
1036
- const url = props.href || props.src;
1037
- let el = null;
1038
- if (url != null) {
1039
- 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);
1040
- }
1041
- if (!el) document.head.appendChild(createHeadElement(tag, props));
1042
- }
1043
- function gateHeadResource(props) {
1044
- const descriptor = {
1045
- type: props.rel === "stylesheet" ? "style" : "module",
1046
- href: props.href
1047
- };
1048
- let gateable = props.rel === "stylesheet" && props.href != null;
1049
- let attrs = null;
1050
- for (const name in props) {
1051
- if (name === "rel" || name === "href") continue;
1052
- if (!STYLESHEET_FETCH_META.has(name)) gateable = false;
1053
- if (!HEAD_ATTR_NAME.test(name)) continue;
1054
- const v = props[name];
1055
- if (v == null || v === false) continue;
1056
- (attrs || (attrs = {}))[name] = v === true ? "" : String(v);
1057
- }
1058
- if (attrs) descriptor.attrs = attrs;
1059
- effect(() => {
1060
- const entry = warmAsset(descriptor);
1061
- if (gateable && entry.loadState === "pending" && typeof waitAsset === "function") waitAsset(entry.loadPromise);
1062
- }, () => acquireAsset(descriptor));
1063
- }
1064
- function useHead(tags) {
1065
- initHeadRegistry();
1066
- const reg = {
1067
- seq: -1,
1068
- tags: null
1069
- };
1070
- const uid = ++headUid;
1071
- effect(() => {
1072
- let list = typeof tags === "function" ? tags() : tags;
1073
- if (!Array.isArray(list)) list = [list];
1074
- const replaceable = [];
1075
- const resources = [];
1076
- for (let i = 0; i < list.length; i++) {
1077
- const desc = list[i];
1078
- if (!desc || !HEAD_ELIGIBLE_TAGS.has(desc.tag)) {
1079
- continue;
1080
- }
1081
- const cls = classifyHeadTag(desc);
1082
- const props = evalHeadProps(desc.props || {}, cls.rel !== undefined ? {
1083
- rel: cls.rel
1084
- } : undefined);
1085
- if (cls.resource) {
1086
- if (desc.tag === "link" && (props.rel === "stylesheet" || props.rel === "modulepreload")) {
1087
- gateHeadResource(props);
1088
- } else if (desc.tag === "link") {
1089
- mountHeadResource(desc.tag, props);
1090
- } else {
1091
- resources.push({
1092
- tag: desc.tag,
1093
- props
1094
- });
1095
- }
1096
- } else {
1097
- const key = evalHeadValue(desc.key);
1098
- replaceable.push({
1099
- tag: desc.tag,
1100
- props,
1101
- identity: replaceableIdentity(desc.tag, props, key, "u:c" + uid + ":" + i)
1102
- });
1103
- }
1104
- }
1105
- return {
1106
- replaceable,
1107
- resources
1108
- };
1109
- }, evaluated => {
1110
- for (let i = 0; i < evaluated.resources.length; i++) {
1111
- mountHeadResource(evaluated.resources[i].tag, evaluated.resources[i].props);
1112
- }
1113
- reg.tags = evaluated.replaceable;
1114
- if (reg.seq < 0) reg.seq = ++headSeq;
1115
- if (headRegistrations.indexOf(reg) === -1) headRegistrations.push(reg);
1116
- scheduleHeadApply();
1117
- return () => {
1118
- const idx = headRegistrations.indexOf(reg);
1119
- if (idx > -1) headRegistrations.splice(idx, 1);
1120
- scheduleHeadApply();
1121
- };
1122
- });
1123
- }
1124
- function loadModuleAssets(mapping) {
1125
- const hy = globalThis._$HY;
1126
- if (!hy) return;
1127
- const pending = [];
1128
- for (const key in mapping) {
1129
- if (hy.modules[key]) continue;
1130
- const entryUrl = new URL(mapping[key], document.baseURI).href;
1131
- if (!hy.loading[key]) {
1132
- hy.loading[key] = import(entryUrl).then(mod => {
1133
- hy.modules[key] = mod;
1134
- }, err => {
1135
- delete hy.loading[key];
1136
- throw err;
1137
- });
1138
- }
1139
- pending.push(hy.loading[key]);
1140
- }
1141
- return pending.length ? Promise.all(pending).then(() => {}) : undefined;
1142
- }
1143
- function hydrate$1(code, element, options = {}) {
1144
- installHydrationRuntime();
1145
- if (globalThis._$HY.done) return render$1(code, element, [...element.childNodes], options);
1146
- options.renderId ||= "";
1147
- if (!globalThis._$HY.modules) globalThis._$HY.modules = {};
1148
- if (!globalThis._$HY.loading) globalThis._$HY.loading = {};
1149
- solidJs.sharedConfig.completed = globalThis._$HY.completed;
1150
- solidJs.sharedConfig.events = globalThis._$HY.events;
1151
- solidJs.sharedConfig.load = id => globalThis._$HY.r[id];
1152
- solidJs.sharedConfig.has = id => id in globalThis._$HY.r;
1153
- solidJs.sharedConfig.gather = root => gatherHydratable(element, root);
1154
- solidJs.sharedConfig.loadModuleAssets = loadModuleAssets;
1155
- solidJs.sharedConfig.cleanupFragment = id => {
1156
- const tpl = document.getElementById("pl-" + id);
1157
- if (tpl) {
1158
- let node = tpl.nextSibling;
1159
- while (node) {
1160
- const next = node.nextSibling;
1161
- if (node.nodeType === 8 && node.nodeValue === "pl-" + id) {
1162
- node.remove();
1163
- break;
1164
- }
1165
- node.remove();
1166
- node = next;
1167
- }
1168
- tpl.remove();
1169
- }
1170
- };
1171
- solidJs.sharedConfig.registry = new Map();
1172
- if (!solidJs.sharedConfig.boundaryScopes) solidJs.sharedConfig.boundaryScopes = new Map();
1173
- solidJs.sharedConfig.captureBoundaryScope = id => {
1174
- if (solidJs.sharedConfig.registry) solidJs.sharedConfig.boundaryScopes.set(id, {
1175
- registry: solidJs.sharedConfig.registry,
1176
- gather: solidJs.sharedConfig.gather
1177
- });
1178
- };
1179
- solidJs.sharedConfig.hydrating = true;
1180
- const hyr = globalThis._$HY.r;
1181
- const rootMapping = hyr && (hyr[options.renderId + "_assets"] || hyr["_assets"]);
1182
- if (rootMapping && typeof rootMapping === "object") {
1183
- const p = loadModuleAssets(rootMapping);
1184
- if (p) {
1185
- gatherHydratable(element, options.renderId);
1186
- const registry = solidJs.sharedConfig.registry;
1187
- const gather = solidJs.sharedConfig.gather;
1188
- let disposer;
1189
- p.then(() => {
1190
- solidJs.sharedConfig.registry = registry;
1191
- solidJs.sharedConfig.gather = gather;
1192
- solidJs.sharedConfig.hydrating = true;
1193
- try {
1194
- disposer = render$1(code, element, [...element.childNodes], options);
1195
- } finally {
1196
- solidJs.sharedConfig.hydrating = false;
1197
- }
1198
- }, err => {
1199
- console.error("Hydration module preload failed, falling back to client render:", err);
1200
- solidJs.sharedConfig.hydrating = false;
1201
- solidJs.sharedConfig.registry = undefined;
1202
- disposer = render$1(code, element, [...element.childNodes], options);
1203
- });
1204
- return () => disposer && disposer();
1205
- }
1206
- }
1207
- try {
1208
- gatherHydratable(element, options.renderId);
1209
- return render$1(code, element, [...element.childNodes], options);
1210
- } finally {
1211
- solidJs.sharedConfig.hydrating = false;
1212
- }
1213
- }
1214
- function getNextElement(template) {
1215
- let node,
1216
- key,
1217
- hydrating = isHydrating();
1218
- if (!hydrating || !(node = solidJs.sharedConfig.registry.get(key = getHydrationKey()))) {
1219
- if (!template) {
1220
- throw new Error(`Hydration Mismatch. Unable to find DOM nodes for hydration key: ${key}`);
1221
- }
1222
- return template(true);
1223
- }
1224
- if (solidJs.sharedConfig.completed) solidJs.sharedConfig.completed.add(node);
1225
- solidJs.sharedConfig.registry.delete(key);
1226
- return node;
1227
- }
1228
- function getNextMatch(el, nodeName) {
1229
- while (el && el.localName !== nodeName) el = el.nextSibling;
1230
- return el;
1231
- }
1232
- function getNextMarker(start) {
1233
- let end = start,
1234
- count = 0,
1235
- current = [];
1236
- if (isHydrating(start)) {
1237
- while (end) {
1238
- if (end.nodeType === 8) {
1239
- const v = end.nodeValue;
1240
- if (v === "$") count++;else if (v === "/") {
1241
- if (count === 0) return [end, current];
1242
- count--;
1243
- }
1244
- }
1245
- current.push(end);
1246
- end = end.nextSibling;
1247
- }
1248
- }
1249
- return [end, current];
1250
- }
1251
- function getFirstChild(node, expectedTag) {
1252
- const child = node.firstChild;
1253
- return child;
1254
- }
1255
- function getNextSibling(node, expectedTag) {
1256
- const sibling = node.nextSibling;
1257
- return sibling;
1258
- }
1259
- function runHydrationEvents() {
1260
- if (solidJs.sharedConfig.events && !solidJs.sharedConfig.events.queued) {
1261
- queueMicrotask(() => {
1262
- const {
1263
- completed,
1264
- events
1265
- } = solidJs.sharedConfig;
1266
- if (!events) return;
1267
- events.queued = false;
1268
- while (events.length) {
1269
- const [el, e] = events[0];
1270
- if (!completed.has(el)) return;
1271
- events.shift();
1272
- let matchContainer, matchState, matchDistance, matches;
1273
- for (const [container, state] of delegatedContainers) {
1274
- if (!state.handlers.has(e.type)) continue;
1275
- const entry = findOwner(e.target, state);
1276
- if (!entry) continue;
1277
- if (matchContainer) {
1278
- if (!matches) matches = [{
1279
- container: matchContainer,
1280
- state: matchState,
1281
- distance: matchDistance
1282
- }];
1283
- matches.push({
1284
- container,
1285
- state,
1286
- distance: entry.distance
1287
- });
1288
- } else {
1289
- matchContainer = container;
1290
- matchState = state;
1291
- matchDistance = entry.distance;
1292
- }
1293
- }
1294
- if (matches) {
1295
- matches.sort((a, b) => a.distance - b.distance);
1296
- for (let i = 0; i < matches.length; i++) eventHandler(e, matches[i].container, matches[i].state);
1297
- } else if (matchContainer) eventHandler(e, matchContainer, matchState);
1298
- }
1299
- if (solidJs.sharedConfig.done) {
1300
- solidJs.sharedConfig.events = _$HY.events = null;
1301
- solidJs.sharedConfig.completed = _$HY.completed = null;
1302
- }
1303
- });
1304
- solidJs.sharedConfig.events.queued = true;
1305
- }
1306
- }
1307
- function isHydrating(node) {
1308
- if (!solidJs.sharedConfig.hydrating) return false;
1309
- if (!node || node.isConnected) return true;
1310
- const roots = solidJs.sharedConfig.claimRoots;
1311
- if (roots) {
1312
- for (let i = 0; i < roots.length; i++) {
1313
- if (roots[i].contains(node)) return true;
1314
- }
1315
- }
1316
- return false;
1317
- }
1318
- function classListToObject(classList) {
1319
- if (Array.isArray(classList)) {
1320
- const result = {};
1321
- flattenClassList(classList, result);
1322
- classList = result;
1323
- }
1324
- if (classList && typeof classList === "object") {
1325
- const result = {},
1326
- keys = Object.keys(classList);
1327
- for (let i = 0, len = keys.length; i < len; i++) {
1328
- const key = keys[i];
1329
- if (!classList[key]) continue;
1330
- const classNames = key.trim().split(/\s+/);
1331
- for (let j = 0, nameLen = classNames.length; j < nameLen; j++) classNames[j] && (result[classNames[j]] = true);
1332
- }
1333
- return result;
1334
- }
1335
- return classList;
1336
- }
1337
- function flattenClassList(list, result) {
1338
- for (let i = 0, len = list.length; i < len; i++) {
1339
- const item = list[i];
1340
- 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;
1341
- }
1342
- }
1343
- function assignProp(node, prop, value, prev, skipRef, nodeName) {
1344
- if (prop === "style") return style(node, value, prev), value;
1345
- if (prop === "class") return className(node, value, prev), value;
1346
- if (value === prev && DOMWithState[nodeName]?.[prop] !== 1) return prev;
1347
- if (prop === "ref") {
1348
- if (!skipRef && value) ref(() => value, node);
1349
- return value;
1350
- }
1351
- const hasNamespace = prop.indexOf(":") > -1;
1352
- if (!hasNamespace && prop.slice(0, 2) === "on") {
1353
- const name = prop.slice(2).toLowerCase();
1354
- const delegate = DelegatedEvents.has(name);
1355
- if (!delegate && prev) {
1356
- const h = Array.isArray(prev) ? prev[0] : prev;
1357
- node.removeEventListener(name, h);
1358
- }
1359
- if (delegate || value) {
1360
- addEvent(node, name, value, delegate);
1361
- delegate && delegateEvents([name]);
1362
- }
1363
- } else if (hasNamespace && prop.slice(0, 5) === "prop:" || ChildProperties.has(prop) || DOMWithState[nodeName]?.[prop]) {
1364
- if (hasNamespace) prop = prop.slice(5);else if (isHydrating(node)) return value;
1365
- if (prop === "value" && nodeName === "SELECT") queueMicrotask(() => node.value = value) || (node.value = value);else if ((prop === "value" || prop === "defaultValue") && (nodeName === "INPUT" || nodeName === "TEXTAREA"))
1366
- node[prop] = value ?? "";else node[prop] = value;
1367
- } else {
1368
- const ns = hasNamespace && Namespaces[prop.split(":")[0]];
1369
- if (ns) setAttributeNS(node, ns, prop, value);else setAttribute(node, prop, value);
1370
- }
1371
- return value;
1372
- }
1373
- function eventHandler(e, container, state) {
1374
- if (hydrationRt !== null && hydrationRt.dedupEvent(e)) return;
1375
- const prev = e[$$EVENT_OWNER];
1376
- let resumeNode;
1377
- if (prev) {
1378
- if (prev === true || prev === container || !container.contains(prev)) return;
1379
- resumeNode = prev;
1380
- }
1381
- const owner = state && (state.owners.size === 1 && state.owners.has(container) ? container : findOwner(e.target, state)?.owner);
1382
- if (state && !owner) return;
1383
- if (owner && owner === resumeNode) return;
1384
- e[$$EVENT_OWNER] = owner || true;
1385
- let node = resumeNode || e.target;
1386
- const key = `$$${e.type}`;
1387
- const oriTarget = e.target;
1388
- const boundary = owner || container || e.currentTarget;
1389
- const retarget = value => Object.defineProperty(e, "target", {
1390
- configurable: true,
1391
- value
1392
- });
1393
- const handleNode = () => {
1394
- let handler = node[key];
1395
- if (handler === undefined && node.hasAttribute && node.hasAttribute("_bnd")) {
1396
- const seam = globalThis[Symbol.for("dx.bnd")];
1397
- if (seam) handler = seam.resolve(node, e.type);
1398
- }
1399
- if (handler && !node.disabled) {
1400
- const data = node[`${key}Data`];
1401
- data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
1402
- if (e.cancelBubble) return;
1403
- }
1404
- node.host && typeof node.host !== "string" && !node.host._$host && node.contains(e.target) && retarget(node.host);
1405
- return true;
1406
- };
1407
- const walkUpTree = () => {
1408
- while (node && handleNode()) {
1409
- if (node === boundary || node.parentNode === boundary) break;
1410
- node = node._$host || node.parentNode || node.host;
1411
- }
1412
- };
1413
- Object.defineProperty(e, "currentTarget", {
1414
- configurable: true,
1415
- get() {
1416
- return node || boundary || document;
1417
- }
1418
- });
1419
- if (resumeNode) {
1420
- if (resumeNode === e.target) node = resumeNode._$host || resumeNode.parentNode || resumeNode.host;
1421
- if (node && node !== boundary) walkUpTree();
1422
- } else if (e.composedPath) {
1423
- const path = e.composedPath();
1424
- if (path.length) {
1425
- retarget(path[0]);
1426
- for (let i = 0; i < path.length; i++) {
1427
- node = path[i];
1428
- if (!handleNode()) break;
1429
- if (node._$host) {
1430
- node = node._$host;
1431
- walkUpTree();
1432
- break;
1433
- }
1434
- if (node === boundary || node.parentNode === boundary) {
1435
- break;
1436
- }
1437
- }
1438
- } else walkUpTree();
1439
- }
1440
- else walkUpTree();
1441
- retarget(oriTarget);
1442
- }
1443
- function insertExpression(parent, value, current, marker) {
1444
- if (hydrationRt !== null && isHydrating(parent)) {
1445
- if (value && value !== current) for (const n of Array.isArray(value) ? value : [value]) if (n && n.nodeType && !isHydrating(n)) return current;
1446
- return value;
1447
- }
1448
- if (value === current) return value;
1449
- const t = typeof value,
1450
- multi = marker !== undefined;
1451
- if (t === "string" || t === "number") {
1452
- const tc = typeof current;
1453
- if (tc === "string" || tc === "number") {
1454
- parent.firstChild.data = value;
1455
- } else {
1456
- if (ownsAllChildren(parent, current)) parent.textContent = value;else {
1457
- removeOwnedChildren(parent, current);
1458
- parent.insertBefore(document.createTextNode(value), parent.firstChild);
1459
- }
1460
- }
1461
- } else if (value === undefined) {
1462
- cleanChildren(parent, current, marker);
1463
- } else if (value.nodeType) {
1464
- if (Array.isArray(current)) {
1465
- cleanChildren(parent, current, multi ? marker : null, value);
1466
- } else if (current && current.nodeType) {
1467
- current.parentNode === parent ? parent.replaceChild(value, current) : parent.appendChild(value);
1468
- } else if (current && parent.firstChild) {
1469
- parent.replaceChild(value, parent.firstChild);
1470
- } else {
1471
- parent.appendChild(value);
1472
- }
1473
- if (marker) value[$$SLOT] = marker;
1474
- } else if (Array.isArray(value)) {
1475
- const currentArray = current && Array.isArray(current);
1476
- if (value.length === 0) {
1477
- cleanChildren(parent, current, marker);
1478
- } else if (currentArray) {
1479
- if (current.length === 0) {
1480
- appendNodes(parent, value, marker);
1481
- } else reconcileArrays(parent, current, value, marker);
1482
- } else {
1483
- current && cleanChildren(parent, current);
1484
- appendNodes(parent, value);
1485
- }
1486
- } else ;
1487
- return value;
1488
- }
1489
- function normalize(value, current, multi, doNotUnwrap) {
1490
- value = solidJs.flatten(value, {
1491
- skipNonRendered: true,
1492
- doNotUnwrap
1493
- });
1494
- if (doNotUnwrap && typeof value === "function") return value;
1495
- if (multi && !Array.isArray(value)) value = [value != null ? value : ""];
1496
- if (Array.isArray(value)) {
1497
- for (let i = 0, len = value.length; i < len; i++) {
1498
- const item = value[i],
1499
- prev = current && current[i],
1500
- t = typeof item;
1501
- if (t === "string" || t === "number") value[i] = prev && prev.nodeType === 3 && (solidJs.sharedConfig.hydrating || prev.data === "" + item) ? prev : document.createTextNode(item);
1502
- }
1503
- }
1504
- return value;
1505
- }
1506
- function tagHost(value, host) {
1507
- if (Array.isArray(value)) {
1508
- for (let i = 0, len = value.length; i < len; i++) tagHost(value[i], host);
1509
- } else if (value && value.nodeType && value[$$HOST] !== host) {
1510
- value[$$HOST] = host;
1511
- Object.defineProperty(value, "_$host", {
1512
- get: host,
1513
- configurable: true
1514
- });
1515
- }
1516
- }
1517
- function appendNodes(parent, array, marker = null) {
1518
- for (let i = 0, len = array.length; i < len; i++) {
1519
- const n = array[i];
1520
- parent.insertBefore(n, marker);
1521
- if (marker) n[$$SLOT] = marker;
1522
- }
1523
- }
1524
- function ownsAllChildren(parent, current) {
1525
- if (current == null) return true;
1526
- if (Array.isArray(current)) {
1527
- return current.length ? parent.firstChild === current[0] && parent.lastChild === current[current.length - 1] : parent.firstChild === null;
1528
- }
1529
- if (current === "") return parent.firstChild === null;
1530
- if (current.nodeType) return parent.firstChild === current && parent.lastChild === current;
1531
- const first = parent.firstChild;
1532
- return first !== null && first.nodeType === 3 && parent.lastChild === first;
1533
- }
1534
- function removeOwnedChildren(parent, current) {
1535
- if (Array.isArray(current)) {
1536
- for (let i = 0; i < current.length; i++) {
1537
- const el = current[i];
1538
- if (el.parentNode === parent) el.remove();
1539
- }
1540
- } else if (current.nodeType) {
1541
- if (current.parentNode === parent) current.remove();
1542
- } else {
1543
- const first = parent.firstChild;
1544
- if (first && first.nodeType === 3) first.remove();
1545
- }
1546
- }
1547
- function cleanChildren(parent, current, marker, replacement) {
1548
- if (marker === undefined) {
1549
- if (ownsAllChildren(parent, current)) return parent.textContent = "";
1550
- return removeOwnedChildren(parent, current);
1551
- }
1552
- if (current.length) {
1553
- let inserted = false;
1554
- for (let i = current.length - 1; i >= 0; i--) {
1555
- const el = current[i];
1556
- if (replacement !== el) {
1557
- const tag = el[$$SLOT];
1558
- const owns = el.parentNode === parent && (!tag || tag === marker);
1559
- if (replacement && !inserted && !i) owns ? parent.replaceChild(replacement, el) : parent.insertBefore(replacement, marker);else if (owns) el.remove();
1560
- } else inserted = true;
1561
- }
1562
- } else if (replacement) parent.insertBefore(replacement, marker);
1563
- if (replacement && marker) replacement[$$SLOT] = marker;
1564
- }
1565
- function gatherHydratable(element, root) {
1566
- const templates = element.querySelectorAll(`*[_hk]`);
1567
- for (let i = 0; i < templates.length; i++) {
1568
- const node = templates[i];
1569
- const key = node.getAttribute("_hk");
1570
- if (root) {
1571
- if (!key.startsWith(root)) continue;
1572
- } else {
1573
- const frame = node.closest("[data-fid]");
1574
- if (frame && frame !== element && element.contains(frame)) continue;
1575
- }
1576
- if (!solidJs.sharedConfig.registry.has(key)) solidJs.sharedConfig.registry.set(key, node);
1577
- }
1578
- }
1579
- function getHydrationKey() {
1580
- return solidJs.sharedConfig.getNextContextId();
1581
- }
1582
- const voidFn = () => undefined;
1583
- const RequestContext = Symbol();
1584
-
1585
- function throwInBrowser(func) {
1586
- const err = new Error(`${func.name} is not supported in the browser, returning undefined`);
1587
- console.error(err);
1588
- }
1589
- function renderToString(fn, options) {
1590
- throwInBrowser(renderToString);
1591
- }
1592
- function renderToStream(fn, options) {
1593
- throwInBrowser(renderToStream);
1594
- }
1595
- function createResponseStub() {
1596
- throwInBrowser(createResponseStub);
1597
- }
1598
- function createRequestEvent(request, init) {
1599
- throwInBrowser(createRequestEvent);
1600
- }
1601
- function getExpectedRedirectStatus(response) {
1602
- throwInBrowser(getExpectedRedirectStatus);
1603
- }
1604
- function createSSRResponse() {
1605
- throwInBrowser(createSSRResponse);
1606
- }
1607
- function commitEventResponse(response, event) {
1608
- throwInBrowser(commitEventResponse);
1609
- }
1610
- function composeMiddleware(middlewares) {
1611
- throwInBrowser(composeMiddleware);
1612
- }
1613
- function ssr(template, ...nodes) {}
1614
- function ssrElement(name, props, children, needsId) {}
1615
- function ssrClassName(value) {}
1616
- function ssrStyle(value) {}
1617
- function ssrStyleProperty(name, value) {}
1618
- function ssrAttribute(key, value) {}
1619
- function ssrGroup(fn, n) {}
1620
- function ssrHydrationKey() {}
1621
- function resolveSSRNode(node, result, top) {}
1622
- function escape(s, attr) {}
1623
-
1624
- const ENVELOPE = Symbol.for("solid.ResponseEnvelope");
1625
- // PURE-annotated factory (same convention as solid's MockPromise): the brand
1626
- const ResponseEnvelope = /* @__PURE__ */(() => {
1627
- class ResponseEnvelope {
1628
- constructor(response, value) {
1629
- this.response = response;
1630
- this.value = value;
1631
- }
1632
- }
1633
- ResponseEnvelope.prototype[ENVELOPE] = true;
1634
- return ResponseEnvelope;
1635
- })();
1636
- function isResponseEnvelope(value) {
1637
- return !!(value && typeof value === "object" && value[ENVELOPE]);
1638
- }
1639
- const HREF = Symbol.for("solid.Href");
1640
- function isHref(value) {
1641
- return !!(value && (typeof value === "object" || typeof value === "function") && value[HREF]);
1642
- }
1643
- const SAFE_ERROR = Symbol.for("solid.SafeError");
1644
- function markSafeError(error) {
1645
- if (error && (typeof error === "object" || typeof error === "function")) {
1646
- Object.defineProperty(error, SAFE_ERROR, {
1647
- value: true,
1648
- enumerable: false,
1649
- configurable: true
1650
- });
1651
- }
1652
- return error;
1653
- }
1654
- function isSafeError(value) {
1655
- return !!(value && (typeof value === "object" || typeof value === "function") && value[SAFE_ERROR]);
1656
- }
1657
- const REVALIDATE_HEADER = "X-Revalidate";
1658
- function initWithRevalidate(init) {
1659
- const {
1660
- revalidate,
1661
- ...responseInit
1662
- } = init;
1663
- let headers;
1664
- if (responseInit.headers && responseInit.headers.getSetCookie) {
1665
- headers = new Headers();
1666
- responseInit.headers.forEach((value, key) => {
1667
- if (key !== "set-cookie") headers.append(key, value);
1668
- });
1669
- for (const cookie of responseInit.headers.getSetCookie()) {
1670
- headers.append("Set-Cookie", cookie);
1671
- }
1672
- } else {
1673
- headers = new Headers(responseInit.headers);
1674
- }
1675
- revalidate !== undefined && headers.set(REVALIDATE_HEADER, revalidate.toString());
1676
- return {
1677
- responseInit,
1678
- headers
1679
- };
1680
- }
1681
- function redirect(url, init = 302) {
1682
- if (typeof url !== "string" && !isHref(url)) {
1683
- throw new TypeError("redirect() expects a string URL or an Href-branded value (Symbol.for('solid.Href')).");
1684
- }
1685
- const {
1686
- responseInit,
1687
- headers
1688
- } = initWithRevalidate(typeof init === "number" ? {
1689
- status: init
1690
- } : init);
1691
- if (responseInit.status === undefined) {
1692
- responseInit.status = 302;
1693
- }
1694
- headers.set("Location", String(url));
1695
- return new Response(null, {
1696
- ...responseInit,
1697
- headers
1698
- });
1699
- }
1700
- function reload(init = {}) {
1701
- const {
1702
- responseInit,
1703
- headers
1704
- } = initWithRevalidate(init);
1705
- return new Response(null, {
1706
- ...responseInit,
1707
- headers
1708
- });
1709
- }
1710
- function respond(value, init = {}) {
1711
- const {
1712
- responseInit,
1713
- headers
1714
- } = initWithRevalidate(init);
1715
- headers.set("Content-Type", "application/json");
1716
- return new ResponseEnvelope(new Response(JSON.stringify(value), {
1717
- ...responseInit,
1718
- headers
1719
- }), value);
1720
- }
1721
-
1722
- const mergeProps = solidJs.merge;
1723
- const isServer = false;
1724
- const isDev = false;
1725
- function render(code, element, init, options = {}) {
1726
- try {
1727
- const dispose = render$1(code, element, init, {
1728
- ...options,
1729
- insertOptions: {
1730
- schedule: true
1731
- }
1732
- });
1733
- solidJs.flush();
1734
- return dispose;
1735
- } finally {
1736
- }
1737
- }
1738
- const hydrate = (...args) => {
1739
- solidJs.enableHydration();
1740
- return hydrate$1(...args);
1741
- };
1742
- function Portal(props) {
1743
- return solidJs.runWithOwner(solidJs.createOwner(), () => portalImpl(props));
1744
- }
1745
- function portalImpl(props) {
1746
- const treeMarker = document.createTextNode(""),
1747
- startMarker = document.createTextNode(""),
1748
- endMarker = document.createTextNode(""),
1749
- mount = () => props.mount || document.body,
1750
- content = solidJs.createMemo(() => [startMarker, props.children], {
1751
- ssrSource: "client",
1752
- loadingValue: undefined
1753
- });
1754
- solidJs.createRenderEffect(
1755
- () => [mount(), content(), solidJs.getOwner()], ([, c, owner]) => {
1756
- const m = solidJs.untrack(mount);
1757
- m.appendChild(endMarker);
1758
- const dispose = solidJs.runWithOwner(owner, () => solidJs.createRoot(d => {
1759
- insert(m, c, endMarker, undefined, {
1760
- host: () => treeMarker.parentNode
1761
- });
1762
- return d;
1763
- }));
1764
- return () => {
1765
- dispose();
1766
- let c = startMarker;
1767
- while (c) {
1768
- const n = c.nextSibling;
1769
- m.removeChild(c);
1770
- if (c === endMarker) break;
1771
- c = n;
1772
- }
1773
- };
1774
- },
1775
- {
1776
- schedule: true,
1777
- ssrSource: "client"
1778
- });
1779
- solidJs.createEffect(mount, () => {
1780
- const m = solidJs.untrack(mount);
1781
- const ownerRoot = getDelegatedRoot(treeMarker);
1782
- if (!ownerRoot || ownerRoot.contains(m)) return;
1783
- registerDelegatedContainer(m, ownerRoot);
1784
- return () => unregisterDelegatedContainer(m, ownerRoot);
1785
- }, {
1786
- ssrSource: "client"
1787
- });
1788
- if (solidJs.sharedConfig.hydrating) return solidJs.createMemo(() => treeMarker, {
1789
- ssrSource: "client",
1790
- loadingValue: undefined
1791
- });
1792
- return treeMarker;
1793
- }
1794
- const COMPONENT_BINDING = Symbol.for("dom-expressions.component-binding");
1795
- function bindingOf(value) {
1796
- return value !== null && (typeof value === "function" || typeof value === "object") && value[COMPONENT_BINDING] || undefined;
1797
- }
1798
- function dynamic(source) {
1799
- let latest = 0;
1800
- const sites = new Set();
1801
- let deliveredAddress;
1802
- const resolveBinding = (next, prev) => {
1803
- const binding = bindingOf(next);
1804
- if (!binding) return next;
1805
- deliveredAddress = binding.address;
1806
- const prevBinding = bindingOf(prev);
1807
- if (prevBinding && prevBinding.component === binding.component) {
1808
- for (const deliver of sites) deliver(binding.address);
1809
- return prev;
1810
- }
1811
- return next;
1812
- };
1813
- const cached = solidJs.createMemo(prev => {
1814
- const next = source();
1815
- if (!next || typeof next.then !== "function") return resolveBinding(next, prev);
1816
- const token = ++latest;
1817
- return {
1818
- then: (onFulfilled, onRejected) => next.then(resolved => onFulfilled(token === latest ? resolveBinding(resolved, prev) : resolved), onRejected)
1819
- };
1820
- }, {
1821
- lazy: true
1822
- });
1823
- return props => {
1824
- return solidJs.createMemo(() => {
1825
- const component = cached();
1826
- switch (typeof component) {
1827
- case "function":
1828
- {
1829
- const binding = bindingOf(component);
1830
- if (binding) {
1831
- const [address, setAddress] = solidJs.createSignal(deliveredAddress ?? binding.address);
1832
- sites.add(setAddress);
1833
- solidJs.onCleanup(() => sites.delete(setAddress));
1834
- return solidJs.untrack(() => binding.component(props, address));
1835
- }
1836
- return solidJs.untrack(() => component(props));
1837
- }
1838
- case "string":
1839
- const el = solidJs.sharedConfig.hydrating ? getNextElement() : createElement(component, solidJs.untrack(() => props.is));
1840
- spread(el, props);
1841
- return el;
1842
- }
1843
- });
1844
- };
1845
- }
1846
- function Dynamic(props) {
1847
- const Comp = dynamic(() => props.component);
1848
- return solidJs.createComponent(Comp, solidJs.omit(props, "component"));
1849
- }
1850
- function createElement(tagName, is = undefined) {
1851
- return SVGElements.has(tagName) ? document.createElementNS(Namespaces.svg, tagName) : MathMLElements.has(tagName) ? document.createElementNS(Namespaces.mathml, tagName) : document.createElement(tagName, {
1852
- is
1853
- });
1854
- }
1855
- function loadClientOnly(fn, setComp, exportName) {
1856
- fn().then(m => setComp(() => exportName ? m[exportName] : m.default));
1857
- }
1858
- function clientOnly(fn, options = {},
1859
- _moduleUrl) {
1860
- const [comp, setComp] = solidJs.createSignal();
1861
- let started = !options.lazy;
1862
- started && loadClientOnly(fn, setComp, options.export);
1863
- return props => {
1864
- let Comp;
1865
- let m;
1866
- const rest = solidJs.omit(props, "fallback");
1867
- if (!started) {
1868
- started = true;
1869
- loadClientOnly(fn, setComp, options.export);
1870
- }
1871
- if ((Comp = solidJs.untrack(comp)) && !solidJs.sharedConfig.hydrating) return Comp(rest);
1872
- const [mounted, setMounted] = solidJs.createSignal(!solidJs.sharedConfig.hydrating);
1873
- const gate = solidJs.createMemo(() => (Comp = comp(), m = mounted(), solidJs.untrack(() => Comp && m ? Comp(rest) : props.fallback)));
1874
- const onHydrationEnd = solidJs.sharedConfig.onHydrationEnd;
1875
- const release = () => setMounted(true);
1876
- onHydrationEnd ? onHydrationEnd(release) : queueMicrotask(release);
1877
- return gate;
1878
- };
1879
- }
1880
- function httpStatus(_code, _text) {}
1881
- function httpHeader(_name, _value, _options) {}
1882
-
1883
- Object.defineProperty(exports, "Errored", {
1884
- enumerable: true,
1885
- get: function () { return solidJs.Errored; }
1886
- });
1887
- Object.defineProperty(exports, "For", {
1888
- enumerable: true,
1889
- get: function () { return solidJs.For; }
1890
- });
1891
- Object.defineProperty(exports, "Hydration", {
1892
- enumerable: true,
1893
- get: function () { return solidJs.Hydration; }
1894
- });
1895
- Object.defineProperty(exports, "Loading", {
1896
- enumerable: true,
1897
- get: function () { return solidJs.Loading; }
1898
- });
1899
- Object.defineProperty(exports, "Match", {
1900
- enumerable: true,
1901
- get: function () { return solidJs.Match; }
1902
- });
1903
- Object.defineProperty(exports, "NoHydration", {
1904
- enumerable: true,
1905
- get: function () { return solidJs.NoHydration; }
1906
- });
1907
- Object.defineProperty(exports, "Repeat", {
1908
- enumerable: true,
1909
- get: function () { return solidJs.Repeat; }
1910
- });
1911
- Object.defineProperty(exports, "Reveal", {
1912
- enumerable: true,
1913
- get: function () { return solidJs.Reveal; }
1914
- });
1915
- Object.defineProperty(exports, "Show", {
1916
- enumerable: true,
1917
- get: function () { return solidJs.Show; }
1918
- });
1919
- Object.defineProperty(exports, "Switch", {
1920
- enumerable: true,
1921
- get: function () { return solidJs.Switch; }
1922
- });
1923
- Object.defineProperty(exports, "createComponent", {
1924
- enumerable: true,
1925
- get: function () { return solidJs.createComponent; }
1926
- });
1927
- Object.defineProperty(exports, "getOwner", {
1928
- enumerable: true,
1929
- get: function () { return solidJs.getOwner; }
1930
- });
1931
- Object.defineProperty(exports, "untrack", {
1932
- enumerable: true,
1933
- get: function () { return solidJs.untrack; }
1934
- });
1935
- exports.ChildProperties = ChildProperties;
1936
- exports.DOMElements = DOMElements;
1937
- exports.DOMWithState = DOMWithState;
1938
- exports.DelegatedEvents = DelegatedEvents;
1939
- exports.Dynamic = Dynamic;
1940
- exports.HREF = HREF;
1941
- exports.HydrationScript = voidFn;
1942
- exports.MathMLElements = MathMLElements;
1943
- exports.Namespaces = Namespaces;
1944
- exports.Portal = Portal;
1945
- exports.REVALIDATE_HEADER = REVALIDATE_HEADER;
1946
- exports.RawTextElements = RawTextElements;
1947
- exports.RequestContext = RequestContext;
1948
- exports.ResponseEnvelope = ResponseEnvelope;
1949
- exports.SAFE_ERROR = SAFE_ERROR;
1950
- exports.SVGElements = SVGElements;
1951
- exports.VoidElements = VoidElements;
1952
- exports.acquireAsset = acquireAsset;
1953
- exports.addEvent = addEvent;
1954
- exports.applyRef = applyRef;
1955
- exports.assign = assign;
1956
- exports.claimElement = claimElement;
1957
- exports.claimElementTree = claimElementTree;
1958
- exports.className = className;
1959
- exports.clearFlashCookie = clearFlashCookie;
1960
- exports.clientOnly = clientOnly;
1961
- exports.commitEventResponse = commitEventResponse;
1962
- exports.composeMiddleware = composeMiddleware;
1963
- exports.createRequestEvent = createRequestEvent;
1964
- exports.createResponseStub = createResponseStub;
1965
- exports.createSSRResponse = createSSRResponse;
1966
- exports.delegateEvents = delegateEvents;
1967
- exports.dynamic = dynamic;
1968
- exports.dynamicProperty = dynamicProperty;
1969
- exports.effect = effect;
1970
- exports.escape = escape;
1971
- exports.generateHydrationScript = voidFn;
1972
- exports.getDelegatedRoot = getDelegatedRoot;
1973
- exports.getExpectedRedirectStatus = getExpectedRedirectStatus;
1974
- exports.getFirstChild = getFirstChild;
1975
- exports.getHydrationKey = getHydrationKey;
1976
- exports.getNextElement = getNextElement;
1977
- exports.getNextMarker = getNextMarker;
1978
- exports.getNextMatch = getNextMatch;
1979
- exports.getNextSibling = getNextSibling;
1980
- exports.getRequestEvent = voidFn;
1981
- exports.getServerFunctionMetadata = getServerFunctionMetadata;
1982
- exports.getServerFunctionRPC = getServerFunctionRPC;
1983
- exports.hasFlashCookie = hasFlashCookie;
1984
- exports.httpHeader = httpHeader;
1985
- exports.httpStatus = httpStatus;
1986
- exports.hydrate = hydrate;
1987
- exports.insert = insert;
1988
- exports.installHydrationRuntime = installHydrationRuntime;
1989
- exports.isDev = isDev;
1990
- exports.isHref = isHref;
1991
- exports.isResponseEnvelope = isResponseEnvelope;
1992
- exports.isSafeError = isSafeError;
1993
- exports.isServer = isServer;
1994
- exports.isServerFunction = isServerFunction;
1995
- exports.markSafeError = markSafeError;
1996
- exports.memo = memo;
1997
- exports.mergeProps = mergeProps;
1998
- exports.parseCookieHeader = parseCookieHeader;
1999
- exports.patchDriver = patchDriver;
2000
- exports.redirect = redirect;
2001
- exports.ref = ref;
2002
- exports.registerDelegatedContainer = registerDelegatedContainer;
2003
- exports.registerDelegatedRoot = registerDelegatedRoot;
2004
- exports.registerElementClaim = registerElementClaim;
2005
- exports.reload = reload;
2006
- exports.render = render;
2007
- exports.renderToStream = renderToStream;
2008
- exports.renderToString = renderToString;
2009
- exports.resolveSSRNode = resolveSSRNode;
2010
- exports.respond = respond;
2011
- exports.rowProof = rowProof;
2012
- exports.runHydrationEvents = runHydrationEvents;
2013
- exports.scope = scope;
2014
- exports.serializeCookie = serializeCookie;
2015
- exports.setAttribute = setAttribute;
2016
- exports.setAttributeNS = setAttributeNS;
2017
- exports.setProperty = setProperty;
2018
- exports.setStyleProperty = setStyleProperty;
2019
- exports.spread = spread;
2020
- exports.ssr = ssr;
2021
- exports.ssrAttribute = ssrAttribute;
2022
- exports.ssrClassName = ssrClassName;
2023
- exports.ssrElement = ssrElement;
2024
- exports.ssrGroup = ssrGroup;
2025
- exports.ssrHydrationKey = ssrHydrationKey;
2026
- exports.ssrStyle = ssrStyle;
2027
- exports.ssrStyleProperty = ssrStyleProperty;
2028
- exports.style = style;
2029
- exports.template = template;
2030
- exports.unregisterDelegatedContainer = unregisterDelegatedContainer;
2031
- exports.unregisterDelegatedRoot = unregisterDelegatedRoot;
2032
- exports.useHead = useHead;
2033
- exports.warmAsset = warmAsset;