vinojs 0.1.0 → 0.1.2

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 (115) hide show
  1. package/dist/client.mjs +1 -1
  2. package/dist/{compile-Lxl_tdxL.mjs → compile-glNMkyyx.mjs} +3 -47
  3. package/dist/compile-glNMkyyx.mjs.map +1 -0
  4. package/dist/{definePage-Ba4r-TFh.mjs → definePage--9Pz7rHs.mjs} +29 -7
  5. package/dist/definePage--9Pz7rHs.mjs.map +1 -0
  6. package/dist/defineServerFn-H-bz7xBX.mjs +47 -0
  7. package/dist/defineServerFn-H-bz7xBX.mjs.map +1 -0
  8. package/dist/factory-CVT0-OZw.d.mts +187 -0
  9. package/dist/factory-CVT0-OZw.d.mts.map +1 -0
  10. package/dist/factory.d.mts +2 -0
  11. package/dist/factory.mjs +153 -0
  12. package/dist/factory.mjs.map +1 -0
  13. package/dist/vino.d.mts +4 -103
  14. package/dist/vino.d.mts.map +1 -1
  15. package/dist/vino.mjs +8 -3
  16. package/dist/vino.mjs.map +1 -1
  17. package/dist/vite.mjs +3 -2
  18. package/dist/vite.mjs.map +1 -1
  19. package/package.json +5 -1
  20. package/dist/compile-Lxl_tdxL.mjs.map +0 -1
  21. package/dist/definePage-Ba4r-TFh.mjs.map +0 -1
  22. package/examples/basic/dist/client/.assetsignore +0 -2
  23. package/examples/basic/dist/client/about.html +0 -1
  24. package/examples/basic/dist/client/admin.html +0 -1
  25. package/examples/basic/dist/client/assets/Counter-BvqMZKON.js +0 -1
  26. package/examples/basic/dist/client/assets/_slug_-CYpOSbrn.js +0 -1
  27. package/examples/basic/dist/client/assets/about-BZXRzUyv.js +0 -1
  28. package/examples/basic/dist/client/assets/admin-DRE7uh2s.js +0 -1
  29. package/examples/basic/dist/client/assets/client-B6nFkut5.js +0 -1
  30. package/examples/basic/dist/client/assets/client-pages-Bc6cNZAm.js +0 -2
  31. package/examples/basic/dist/client/assets/components-DX9r6vHn.js +0 -1
  32. package/examples/basic/dist/client/assets/components-DsWJ6F73.js +0 -2
  33. package/examples/basic/dist/client/assets/counter-DBpvln_F.js +0 -1
  34. package/examples/basic/dist/client/assets/dom-B5sHIJ1E.js +0 -1
  35. package/examples/basic/dist/client/assets/honoto-9UtdLp4J.js +0 -33
  36. package/examples/basic/dist/client/assets/honoto-client-DEh86_WZ.css +0 -1
  37. package/examples/basic/dist/client/assets/honoto-client.js +0 -2
  38. package/examples/basic/dist/client/assets/hooks-Cz6AT21d.js +0 -1
  39. package/examples/basic/dist/client/assets/jsx-dev-runtime-92VDsVyo.js +0 -1
  40. package/examples/basic/dist/client/counter.html +0 -1
  41. package/examples/basic/dist/client/index.html +0 -1
  42. package/examples/basic/dist/client/jobs.html +0 -1
  43. package/examples/basic/dist/ssr/.vite/manifest.json +0 -140
  44. package/examples/basic/dist/ssr/assets/_slug_-CY3-kffX.js +0 -46
  45. package/examples/basic/dist/ssr/assets/about-CTDjNhkO.js +0 -15
  46. package/examples/basic/dist/ssr/assets/admin-DvS-UGJx.js +0 -26
  47. package/examples/basic/dist/ssr/assets/constants-UoriGYcX-CUecBFMT.js +0 -6
  48. package/examples/basic/dist/ssr/assets/counter-DfIbc9Sp.js +0 -30
  49. package/examples/basic/dist/ssr/assets/honoto-CA313cVy.js +0 -2129
  50. package/examples/basic/dist/ssr/assets/jobs-D9hh-UO9.js +0 -42
  51. package/examples/basic/dist/ssr/assets/jsx-CgYLQazd.js +0 -1080
  52. package/examples/basic/dist/ssr/assets/jsx-dev-runtime-BlUda7H8.js +0 -742
  53. package/examples/basic/dist/ssr/assets/jsx-renderer-CzZcZPnS.js +0 -65
  54. package/examples/basic/dist/ssr/assets/layout-DYvLwr2u.js +0 -53
  55. package/examples/basic/dist/ssr/assets/pages-DB6jeyrt.js +0 -53
  56. package/examples/basic/dist/ssr/assets/rolldown-runtime-D7D4PA-g.js +0 -13
  57. package/examples/basic/dist/ssr/assets/ssr-hooks-CBQr0cdH.js +0 -7
  58. package/examples/basic/dist/ssr/index.js +0 -22
  59. package/examples/basic/dist/ssr/wrangler.json +0 -1
  60. package/examples/full/dist/client/.assetsignore +0 -2
  61. package/examples/full/dist/client/assets/BookmarkButton-py0xGxgl.js +0 -1
  62. package/examples/full/dist/client/assets/_slug_-DZUFsE9O.js +0 -1
  63. package/examples/full/dist/client/assets/auth-client-D2Wtuobe.js +0 -1
  64. package/examples/full/dist/client/assets/bun-sqlite-dialect-C7ftEUSI-CsHdUKBY.js +0 -1
  65. package/examples/full/dist/client/assets/client-B6nFkut5.js +0 -1
  66. package/examples/full/dist/client/assets/client-pages-fshKs747.js +0 -2
  67. package/examples/full/dist/client/assets/components-DX9r6vHn.js +0 -1
  68. package/examples/full/dist/client/assets/components-S_-rWrKi.js +0 -2
  69. package/examples/full/dist/client/assets/d1-sqlite-dialect-BZmaVTp8-FPCaMZqX.js +0 -1
  70. package/examples/full/dist/client/assets/default-query-compiler-CUdqIu1h.js +0 -1
  71. package/examples/full/dist/client/assets/dist-BoGTNvkC.js +0 -1
  72. package/examples/full/dist/client/assets/dom-DCd3wYW7.js +0 -1
  73. package/examples/full/dist/client/assets/factory-Bgf4EtLx.js +0 -8
  74. package/examples/full/dist/client/assets/honoto-client-BSvNAnxN.css +0 -1
  75. package/examples/full/dist/client/assets/honoto-client.js +0 -2
  76. package/examples/full/dist/client/assets/hooks-Cz6AT21d.js +0 -1
  77. package/examples/full/dist/client/assets/jsx-dev-runtime-92VDsVyo.js +0 -1
  78. package/examples/full/dist/client/assets/kysely-adapter-BHhasAnc.js +0 -1
  79. package/examples/full/dist/client/assets/kysely-migration-tables-DFfmKhq--U5ujlMwE.js +0 -1
  80. package/examples/full/dist/client/assets/node-sqlite-dialect-DJDXH5Ot.js +0 -1
  81. package/examples/full/dist/client/assets/pages-CUQx6Eus.js +0 -1
  82. package/examples/full/dist/client/assets/saved-jIi74ncJ.js +0 -1
  83. package/examples/full/dist/client/assets/session-B-accyM3.js +0 -611
  84. package/examples/full/dist/client/assets/sign-in-BelI3gSs.js +0 -1
  85. package/examples/full/dist/client/assets/sign-up-pR94lfdu.js +0 -1
  86. package/examples/full/dist/client/index.html +0 -1
  87. package/examples/full/dist/client/saved.html +0 -1
  88. package/examples/full/dist/client/sign-in.html +0 -1
  89. package/examples/full/dist/client/sign-up.html +0 -1
  90. package/examples/full/dist/ssr/.dev.vars +0 -1
  91. package/examples/full/dist/ssr/.vite/manifest.json +0 -219
  92. package/examples/full/dist/ssr/assets/BookmarkButton-KS7z5_vi.js +0 -298
  93. package/examples/full/dist/ssr/assets/_slug_-rRStRaAN.js +0 -89
  94. package/examples/full/dist/ssr/assets/auth-DSFZ4iak.js +0 -31434
  95. package/examples/full/dist/ssr/assets/auth-client-BFSBVoML.js +0 -894
  96. package/examples/full/dist/ssr/assets/bun-sqlite-dialect-C7ftEUSI-BeXpIqKl.js +0 -162
  97. package/examples/full/dist/ssr/assets/compiled-query-DmoyCh28.js +0 -8410
  98. package/examples/full/dist/ssr/assets/d1-sqlite-dialect-BZmaVTp8-CjJdvL94.js +0 -114
  99. package/examples/full/dist/ssr/assets/default-query-compiler-D7xOzCCJ.js +0 -1727
  100. package/examples/full/dist/ssr/assets/dist-LmmDoNdk.js +0 -6832
  101. package/examples/full/dist/ssr/assets/dist-kFDN1l4Z.js +0 -342
  102. package/examples/full/dist/ssr/assets/factory-AD6s9SIW.js +0 -2079
  103. package/examples/full/dist/ssr/assets/jsx-renderer-mMLf5XLN.js +0 -1926
  104. package/examples/full/dist/ssr/assets/kysely-adapter-BCLenpM8.js +0 -2
  105. package/examples/full/dist/ssr/assets/kysely-migration-tables-DFfmKhq--BtVr6hRe.js +0 -17
  106. package/examples/full/dist/ssr/assets/layout-mVA7qP4j.js +0 -44
  107. package/examples/full/dist/ssr/assets/node-sqlite-dialect-D-wtYAD7.js +0 -162
  108. package/examples/full/dist/ssr/assets/pages-Do5kR_Ia.js +0 -147
  109. package/examples/full/dist/ssr/assets/saved-Dr4pP6B5.js +0 -111
  110. package/examples/full/dist/ssr/assets/session-BvIpX7tr.js +0 -13
  111. package/examples/full/dist/ssr/assets/sign-in-22pzTnJE.js +0 -115
  112. package/examples/full/dist/ssr/assets/sign-up-CN4j8Qg1.js +0 -117
  113. package/examples/full/dist/ssr/assets/sqlite-adapter-DVlms5wO.js +0 -79
  114. package/examples/full/dist/ssr/index.js +0 -97
  115. package/examples/full/dist/ssr/wrangler.json +0 -1
@@ -1,1926 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/utils/html.js
14
- var HtmlEscapedCallbackPhase = {
15
- Stringify: 1,
16
- BeforeStream: 2,
17
- Stream: 3
18
- };
19
- var raw = (value, callbacks) => {
20
- const escapedString = new String(value);
21
- escapedString.isEscaped = true;
22
- escapedString.callbacks = callbacks;
23
- return escapedString;
24
- };
25
- var escapeRe = /[&<>'"]/;
26
- var stringBufferToString = async (buffer, callbacks) => {
27
- let str = "";
28
- callbacks ||= [];
29
- const resolvedBuffer = await Promise.all(buffer);
30
- for (let i = resolvedBuffer.length - 1;; i--) {
31
- str += resolvedBuffer[i];
32
- i--;
33
- if (i < 0) break;
34
- let r = resolvedBuffer[i];
35
- if (typeof r === "object") callbacks.push(...r.callbacks || []);
36
- const isEscaped = r.isEscaped;
37
- r = await (typeof r === "object" ? r.toString() : r);
38
- if (typeof r === "object") callbacks.push(...r.callbacks || []);
39
- if (r.isEscaped ?? isEscaped) str += r;
40
- else {
41
- const buf = [str];
42
- escapeToBuffer(r, buf);
43
- str = buf[0];
44
- }
45
- }
46
- return raw(str, callbacks);
47
- };
48
- var escapeToBuffer = (str, buffer) => {
49
- const match = str.search(escapeRe);
50
- if (match === -1) {
51
- buffer[0] += str;
52
- return;
53
- }
54
- let escape;
55
- let index;
56
- let lastIndex = 0;
57
- for (index = match; index < str.length; index++) {
58
- switch (str.charCodeAt(index)) {
59
- case 34:
60
- escape = "&quot;";
61
- break;
62
- case 39:
63
- escape = "&#39;";
64
- break;
65
- case 38:
66
- escape = "&amp;";
67
- break;
68
- case 60:
69
- escape = "&lt;";
70
- break;
71
- case 62:
72
- escape = "&gt;";
73
- break;
74
- default: continue;
75
- }
76
- buffer[0] += str.substring(lastIndex, index) + escape;
77
- lastIndex = index + 1;
78
- }
79
- buffer[0] += str.substring(lastIndex, index);
80
- };
81
- var resolveCallbackSync = (str) => {
82
- const callbacks = str.callbacks;
83
- if (!callbacks?.length) return str;
84
- const buffer = [str];
85
- const context = {};
86
- callbacks.forEach((c) => c({
87
- phase: HtmlEscapedCallbackPhase.Stringify,
88
- buffer,
89
- context
90
- }));
91
- return buffer[0];
92
- };
93
- var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) => {
94
- if (typeof str === "object" && !(str instanceof String)) {
95
- if (!(str instanceof Promise)) str = str.toString();
96
- if (str instanceof Promise) str = await str;
97
- }
98
- const callbacks = str.callbacks;
99
- if (!callbacks?.length) return Promise.resolve(str);
100
- if (buffer) buffer[0] += str;
101
- else buffer = [str];
102
- const resStr = Promise.all(callbacks.map((c) => c({
103
- phase,
104
- buffer,
105
- context
106
- }))).then((res) => Promise.all(res.filter(Boolean).map((str2) => resolveCallback(str2, phase, false, context, buffer))).then(() => buffer[0]));
107
- if (preserveCallbacks) return raw(await resStr, callbacks);
108
- else return resStr;
109
- };
110
- //#endregion
111
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/helper/html/index.js
112
- var html = (strings, ...values) => {
113
- const buffer = [""];
114
- for (let i = 0, len = strings.length - 1; i < len; i++) {
115
- buffer[0] += strings[i];
116
- const children = Array.isArray(values[i]) ? values[i].flat(Infinity) : [values[i]];
117
- for (let i2 = 0, len2 = children.length; i2 < len2; i2++) {
118
- const child = children[i2];
119
- if (typeof child === "string") escapeToBuffer(child, buffer);
120
- else if (typeof child === "number") buffer[0] += child;
121
- else if (typeof child === "boolean" || child === null || child === void 0) continue;
122
- else if (typeof child === "object" && child.isEscaped) {
123
- if (child.callbacks) buffer.unshift("", child);
124
- else {
125
- const tmp = child.toString();
126
- if (tmp instanceof Promise) buffer.unshift("", tmp);
127
- else buffer[0] += tmp;
128
- }
129
- } else if (child instanceof Promise) buffer.unshift("", child);
130
- else escapeToBuffer(child.toString(), buffer);
131
- }
132
- }
133
- buffer[0] += strings.at(-1);
134
- return buffer.length === 1 ? "callbacks" in buffer ? raw(resolveCallbackSync(raw(buffer[0], buffer.callbacks))) : raw(buffer[0]) : stringBufferToString(buffer, buffer.callbacks);
135
- };
136
- //#endregion
137
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/constants.js
138
- var DOM_RENDERER = /* @__PURE__ */ Symbol("RENDERER");
139
- var DOM_ERROR_HANDLER = /* @__PURE__ */ Symbol("ERROR_HANDLER");
140
- var DOM_STASH = /* @__PURE__ */ Symbol("STASH");
141
- var DOM_INTERNAL_TAG = /* @__PURE__ */ Symbol("INTERNAL");
142
- var DOM_MEMO = /* @__PURE__ */ Symbol("MEMO");
143
- var PERMALINK = /* @__PURE__ */ Symbol("PERMALINK");
144
- //#endregion
145
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/utils.js
146
- var setInternalTagFlag = (fn) => {
147
- fn[DOM_INTERNAL_TAG] = true;
148
- return fn;
149
- };
150
- //#endregion
151
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/context.js
152
- var createContextProviderFunction = (values) => ({ value, children }) => {
153
- if (!children) return;
154
- const props = { children: [{
155
- tag: setInternalTagFlag(() => {
156
- values.push(value);
157
- }),
158
- props: {}
159
- }] };
160
- if (Array.isArray(children)) props.children.push(...children.flat());
161
- else props.children.push(children);
162
- props.children.push({
163
- tag: setInternalTagFlag(() => {
164
- values.pop();
165
- }),
166
- props: {}
167
- });
168
- const res = {
169
- tag: "",
170
- props,
171
- type: ""
172
- };
173
- res[DOM_ERROR_HANDLER] = (err) => {
174
- values.pop();
175
- throw err;
176
- };
177
- return res;
178
- };
179
- var createContext$1 = (defaultValue) => {
180
- const values = [defaultValue];
181
- const context = createContextProviderFunction(values);
182
- context.values = values;
183
- context.Provider = context;
184
- globalContexts.push(context);
185
- return context;
186
- };
187
- //#endregion
188
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/context.js
189
- var globalContexts = [];
190
- var alsProbed = false;
191
- var asyncLocalStorage;
192
- var fallbackStore;
193
- var fallbackRendersInFlight = 0;
194
- var warnedFallbackDefault = false;
195
- var loadAsyncLocalStorage = () => {
196
- if (alsProbed) return asyncLocalStorage;
197
- alsProbed = true;
198
- const global = globalThis;
199
- let AsyncLocalStorage;
200
- for (const probe of [() => global.process?.getBuiltinModule?.("node:async_hooks")?.AsyncLocalStorage, () => global.process?.mainModule?.require?.("node:async_hooks")?.AsyncLocalStorage]) {
201
- try {
202
- AsyncLocalStorage = probe();
203
- } catch {}
204
- if (AsyncLocalStorage) break;
205
- }
206
- if (AsyncLocalStorage) asyncLocalStorage = new AsyncLocalStorage();
207
- return asyncLocalStorage;
208
- };
209
- var getCurrentStore = () => {
210
- return loadAsyncLocalStorage()?.getStore() || fallbackStore;
211
- };
212
- var warnIfStorelessAccess = () => {
213
- if (fallbackRendersInFlight > 0 && !warnedFallbackDefault) {
214
- warnedFallbackDefault = true;
215
- console.warn("hono/jsx: AsyncLocalStorage is unavailable in this runtime, so useContext() after an await in an async component falls back to the context default value during server-side rendering. To get provided values across await boundaries, use a runtime with AsyncLocalStorage (Node.js >= 20.16, Deno, Bun, or Cloudflare Workers with the nodejs_compat flag).");
216
- }
217
- };
218
- var getContextValuesIn = (store, context) => {
219
- if (!store) {
220
- warnIfStorelessAccess();
221
- return context.values;
222
- }
223
- let values = store.get(context);
224
- if (!values) {
225
- values = [context.values[0]];
226
- store.set(context, values);
227
- }
228
- return values;
229
- };
230
- var readContextValueIn = (store, context) => {
231
- if (!store) {
232
- warnIfStorelessAccess();
233
- return context.values.at(-1);
234
- }
235
- const values = store.get(context);
236
- return values?.length ? values.at(-1) : context.values[0];
237
- };
238
- var captureContextValues = (store) => (store ? globalContexts.filter((c) => store.has(c)) : globalContexts).map((c) => [c, readContextValueIn(store, c)]);
239
- var resumeWithContextValues = (callback, store, contexts) => runWithRenderContext(() => {
240
- const currentStore = getCurrentStore();
241
- const valuesPerContext = contexts.map(([context, value]) => {
242
- const values = getContextValuesIn(currentStore, context);
243
- values.push(value);
244
- return values;
245
- });
246
- const popContextValues = () => {
247
- valuesPerContext.forEach((values) => {
248
- values.pop();
249
- });
250
- };
251
- try {
252
- const result = callback();
253
- if (result instanceof Promise) return result.finally(popContextValues);
254
- popContextValues();
255
- return result;
256
- } catch (e) {
257
- popContextValues();
258
- throw e;
259
- }
260
- }, store);
261
- var runWithRenderContext = (callback, resumeStore) => {
262
- if (getCurrentStore()) return callback();
263
- const store = resumeStore ?? /* @__PURE__ */ new WeakMap();
264
- const storage = loadAsyncLocalStorage();
265
- if (storage) return storage.run(store, callback);
266
- fallbackStore = store;
267
- let result;
268
- try {
269
- result = callback();
270
- } finally {
271
- fallbackStore = void 0;
272
- }
273
- if (!warnedFallbackDefault && result instanceof Promise) {
274
- fallbackRendersInFlight++;
275
- result = result.finally(() => {
276
- fallbackRendersInFlight--;
277
- });
278
- }
279
- return result;
280
- };
281
- var captureRenderContext = () => {
282
- const store = getCurrentStore();
283
- const contexts = captureContextValues(store);
284
- return (callback) => resumeWithContextValues(callback, store, contexts);
285
- };
286
- var createContext = (defaultValue) => {
287
- const values = [defaultValue];
288
- const context = ((props) => {
289
- const contextValues = getContextValuesIn(getCurrentStore(), context);
290
- contextValues.push(props.value);
291
- let string;
292
- try {
293
- string = props.children ? (Array.isArray(props.children) ? new JSXFragmentNode("", {}, props.children) : props.children).toString() : "";
294
- } catch (e) {
295
- contextValues.pop();
296
- throw e;
297
- }
298
- if (string instanceof Promise) return string.finally(() => contextValues.pop()).then((resString) => raw(resString, resString.callbacks));
299
- else {
300
- contextValues.pop();
301
- return raw(string);
302
- }
303
- });
304
- context.values = values;
305
- context.Provider = context;
306
- context[DOM_RENDERER] = createContextProviderFunction(values);
307
- globalContexts.push(context);
308
- return context;
309
- };
310
- var useContext = (context) => {
311
- return readContextValueIn(getCurrentStore(), context);
312
- };
313
- //#endregion
314
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/intrinsic-element/common.js
315
- var deDupeKeyMap = {
316
- title: [],
317
- script: ["src"],
318
- style: ["data-href"],
319
- link: ["href"],
320
- meta: [
321
- "name",
322
- "httpEquiv",
323
- "charset",
324
- "itemProp"
325
- ]
326
- };
327
- var domRenderers = {};
328
- var dataPrecedenceAttr = "data-precedence";
329
- var isStylesheetLinkWithPrecedence = (props) => props.rel === "stylesheet" && "precedence" in props;
330
- var shouldDeDupeByKey = (tagName, supportSort) => {
331
- if (tagName === "link") return supportSort;
332
- return deDupeKeyMap[tagName].length > 0;
333
- };
334
- //#endregion
335
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/children.js
336
- var toArray = (children) => Array.isArray(children) ? children : [children];
337
- //#endregion
338
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/intrinsic-element/components.js
339
- var components_exports$1 = /* @__PURE__ */ __exportAll({
340
- button: () => button$1,
341
- form: () => form$1,
342
- input: () => input$1,
343
- link: () => link$1,
344
- meta: () => meta$1,
345
- script: () => script$1,
346
- style: () => style$1,
347
- title: () => title$1
348
- });
349
- var metaTagMap = /* @__PURE__ */ new WeakMap();
350
- var insertIntoHead = (tagName, tag, props, precedence) => ({ buffer, context }) => {
351
- if (!buffer) return;
352
- const map = metaTagMap.get(context) || {};
353
- metaTagMap.set(context, map);
354
- const tags = map[tagName] ||= [];
355
- let duped = false;
356
- const deDupeKeys = deDupeKeyMap[tagName];
357
- const deDupeByKey = shouldDeDupeByKey(tagName, precedence !== void 0);
358
- if (deDupeByKey) LOOP: for (const [, tagProps] of tags) {
359
- if (tagName === "link" && !(tagProps.rel === "stylesheet" && tagProps["data-precedence"] !== void 0)) continue;
360
- for (const key of deDupeKeys) if ((tagProps?.[key] ?? null) === props?.[key]) {
361
- duped = true;
362
- break LOOP;
363
- }
364
- }
365
- if (duped) buffer[0] = buffer[0].replaceAll(tag, "");
366
- else if (deDupeByKey || tagName === "link") tags.push([
367
- tag,
368
- props,
369
- precedence
370
- ]);
371
- else tags.unshift([
372
- tag,
373
- props,
374
- precedence
375
- ]);
376
- if (buffer[0].indexOf("</head>") !== -1) {
377
- let insertTags;
378
- if (tagName === "link" || precedence !== void 0) {
379
- const precedences = [];
380
- insertTags = tags.map(([tag2, , tagPrecedence], index) => {
381
- if (tagPrecedence === void 0) return [
382
- tag2,
383
- Number.MAX_SAFE_INTEGER,
384
- index
385
- ];
386
- let order = precedences.indexOf(tagPrecedence);
387
- if (order === -1) {
388
- precedences.push(tagPrecedence);
389
- order = precedences.length - 1;
390
- }
391
- return [
392
- tag2,
393
- order,
394
- index
395
- ];
396
- }).sort((a, b) => a[1] - b[1] || a[2] - b[2]).map(([tag2]) => tag2);
397
- } else insertTags = tags.map(([tag2]) => tag2);
398
- insertTags.forEach((tag2) => {
399
- buffer[0] = buffer[0].replaceAll(tag2, "");
400
- });
401
- buffer[0] = buffer[0].replace(/(?=<\/head>)/, insertTags.join(""));
402
- }
403
- };
404
- var returnWithoutSpecialBehavior = (tag, children, props) => raw(new JSXNode(tag, props, toArray(children ?? [])).toString());
405
- var documentMetadataTag$1 = (tag, children, props, sort) => {
406
- if ("itemProp" in props) return returnWithoutSpecialBehavior(tag, children, props);
407
- let { precedence, blocking, ...restProps } = props;
408
- precedence = sort ? precedence ?? "" : void 0;
409
- if (sort) restProps[dataPrecedenceAttr] = precedence;
410
- const string = new JSXNode(tag, restProps, toArray(children || [])).toString();
411
- if (string instanceof Promise) return string.then((resString) => raw(resString, [...resString.callbacks || [], insertIntoHead(tag, resString, restProps, precedence)]));
412
- else return raw(string, [insertIntoHead(tag, string, restProps, precedence)]);
413
- };
414
- var title$1 = ({ children, ...props }) => {
415
- const nameSpaceContext = getNameSpaceContext$1();
416
- if (nameSpaceContext) {
417
- const context = useContext(nameSpaceContext);
418
- if (context === "svg" || context === "head") return new JSXNode("title", props, toArray(children ?? []));
419
- }
420
- return documentMetadataTag$1("title", children, props, false);
421
- };
422
- var script$1 = ({ children, ...props }) => {
423
- const nameSpaceContext = getNameSpaceContext$1();
424
- if (["src", "async"].some((k) => !props[k]) || nameSpaceContext && useContext(nameSpaceContext) === "head") return returnWithoutSpecialBehavior("script", children, props);
425
- return documentMetadataTag$1("script", children, props, false);
426
- };
427
- var style$1 = ({ children, ...props }) => {
428
- if (!["href", "precedence"].every((k) => k in props)) return returnWithoutSpecialBehavior("style", children, props);
429
- props["data-href"] = props.href;
430
- delete props.href;
431
- return documentMetadataTag$1("style", children, props, true);
432
- };
433
- var link$1 = ({ children, ...props }) => {
434
- if (["onLoad", "onError"].some((k) => k in props) || props.rel === "stylesheet" && (!("precedence" in props) || "disabled" in props)) return returnWithoutSpecialBehavior("link", children, props);
435
- return documentMetadataTag$1("link", children, props, isStylesheetLinkWithPrecedence(props));
436
- };
437
- var meta$1 = ({ children, ...props }) => {
438
- const nameSpaceContext = getNameSpaceContext$1();
439
- if (nameSpaceContext && useContext(nameSpaceContext) === "head") return returnWithoutSpecialBehavior("meta", children, props);
440
- return documentMetadataTag$1("meta", children, props, false);
441
- };
442
- var newJSXNode = (tag, { children, ...props }) => new JSXNode(tag, props, toArray(children ?? []));
443
- var form$1 = (props) => {
444
- if (typeof props.action === "function") props.action = PERMALINK in props.action ? props.action[PERMALINK] : void 0;
445
- return newJSXNode("form", props);
446
- };
447
- var formActionableElement$1 = (tag, props) => {
448
- if (typeof props.formAction === "function") props.formAction = PERMALINK in props.formAction ? props.formAction[PERMALINK] : void 0;
449
- return newJSXNode(tag, props);
450
- };
451
- var input$1 = (props) => formActionableElement$1("input", props);
452
- var button$1 = (props) => formActionableElement$1("button", props);
453
- //#endregion
454
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/utils.js
455
- var normalizeElementKeyMap = /* @__PURE__ */ new Map([
456
- ["className", "class"],
457
- ["htmlFor", "for"],
458
- ["crossOrigin", "crossorigin"],
459
- ["httpEquiv", "http-equiv"],
460
- ["itemProp", "itemprop"],
461
- ["fetchPriority", "fetchpriority"],
462
- ["noModule", "nomodule"],
463
- ["formAction", "formaction"]
464
- ]);
465
- var normalizeIntrinsicElementKey = (key) => normalizeElementKeyMap.get(key) || key;
466
- var invalidAttributeNameCharRe = /[\s"'<>/=`\\\x00-\x1f\x7f-\x9f]/;
467
- var validAttributeNameCache = /* @__PURE__ */ new Set();
468
- var validAttributeNameCacheMax = 1024;
469
- var invalidTagNameCharRe = /^[!?]|[\s"'<>/=`\\\x00-\x1f\x7f-\x9f]/;
470
- var validTagNameCache = /* @__PURE__ */ new Set();
471
- var validTagNameCacheMax = 256;
472
- var cacheValidName = (cache, max, name) => {
473
- if (cache.size >= max) cache.clear();
474
- cache.add(name);
475
- };
476
- var isValidTagName = (name) => {
477
- if (validTagNameCache.has(name)) return true;
478
- if (typeof name !== "string") return false;
479
- if (name.length === 0) return true;
480
- if (invalidTagNameCharRe.test(name)) return false;
481
- cacheValidName(validTagNameCache, validTagNameCacheMax, name);
482
- return true;
483
- };
484
- var isValidAttributeName = (name) => {
485
- if (validAttributeNameCache.has(name)) return true;
486
- const len = name.length;
487
- if (len === 0) return false;
488
- for (let i = 0; i < len; i++) {
489
- const c = name.charCodeAt(i);
490
- if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 45 || c === 95 || c === 46 || c === 58)) {
491
- if (!invalidAttributeNameCharRe.test(name)) {
492
- cacheValidName(validAttributeNameCache, validAttributeNameCacheMax, name);
493
- return true;
494
- } else return false;
495
- }
496
- }
497
- cacheValidName(validAttributeNameCache, validAttributeNameCacheMax, name);
498
- return true;
499
- };
500
- var invalidStylePropertyNameCharRe = /[\s"'():;\\/\[\]{}\x00-\x1f\x7f-\x9f]/;
501
- var validStylePropertyNameCache = /* @__PURE__ */ new Set();
502
- var validStylePropertyNameCacheMax = 1024;
503
- var isValidStylePropertyName = (name) => {
504
- if (validStylePropertyNameCache.has(name)) return true;
505
- const len = name.length;
506
- if (len === 0) return false;
507
- for (let i = 0; i < len; i++) {
508
- const c = name.charCodeAt(i);
509
- if (!(c >= 97 && c <= 122 || c >= 65 && c <= 90 || c >= 48 && c <= 57 || c === 45 || c === 95)) {
510
- if (!invalidStylePropertyNameCharRe.test(name)) {
511
- cacheValidName(validStylePropertyNameCache, validStylePropertyNameCacheMax, name);
512
- return true;
513
- } else return false;
514
- }
515
- }
516
- cacheValidName(validStylePropertyNameCache, validStylePropertyNameCacheMax, name);
517
- return true;
518
- };
519
- var unsafeStyleValueCharRe = /[;"'\\/\[\](){}]/;
520
- var hasUnsafeStyleValue = (value) => {
521
- if (!unsafeStyleValueCharRe.test(value)) return false;
522
- let quote = 0;
523
- const blockStack = [];
524
- for (let i = 0, len = value.length; i < len; i++) {
525
- const c = value.charCodeAt(i);
526
- if (c === 92) {
527
- if (i === len - 1) return true;
528
- i++;
529
- } else if (quote !== 0) {
530
- if (c === 10 || c === 12 || c === 13) return true;
531
- if (c === quote) quote = 0;
532
- } else if (c === 47 && value.charCodeAt(i + 1) === 42) {
533
- const end = value.indexOf("*/", i + 2);
534
- if (end === -1) return true;
535
- i = end + 1;
536
- } else if (c === 34 || c === 39) quote = c;
537
- else if (c === 40) blockStack.push(41);
538
- else if (c === 91) blockStack.push(93);
539
- else if (c === 123 || c === 125) return true;
540
- else if (c === 41 || c === 93) {
541
- if (blockStack[blockStack.length - 1] !== c) return true;
542
- blockStack.pop();
543
- } else if (c === 59 && blockStack.length === 0) return true;
544
- }
545
- return quote !== 0 || blockStack.length !== 0;
546
- };
547
- var styleObjectForEach = (style, fn) => {
548
- for (const [k, v] of Object.entries(style)) {
549
- const key = k[0] === "-" || !/[A-Z]/.test(k) ? k : k.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
550
- if (!isValidStylePropertyName(key)) continue;
551
- if (v == null) {
552
- fn(key, null);
553
- continue;
554
- }
555
- let value;
556
- if (typeof v === "number") value = !key.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/) ? `${v}px` : `${v}`;
557
- else if (typeof v === "string") {
558
- if (hasUnsafeStyleValue(v)) continue;
559
- value = v;
560
- } else continue;
561
- fn(key, value);
562
- }
563
- };
564
- //#endregion
565
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/base.js
566
- var nameSpaceContext$1 = void 0;
567
- var getNameSpaceContext$1 = () => nameSpaceContext$1;
568
- var toSVGAttributeName = (key) => /[A-Z]/.test(key) && key.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
569
- var emptyTags = [
570
- "area",
571
- "base",
572
- "br",
573
- "col",
574
- "embed",
575
- "hr",
576
- "img",
577
- "input",
578
- "keygen",
579
- "link",
580
- "meta",
581
- "param",
582
- "source",
583
- "track",
584
- "wbr"
585
- ];
586
- var booleanAttributes = [
587
- "allowfullscreen",
588
- "async",
589
- "autofocus",
590
- "autoplay",
591
- "checked",
592
- "controls",
593
- "default",
594
- "defer",
595
- "disabled",
596
- "download",
597
- "formnovalidate",
598
- "hidden",
599
- "inert",
600
- "ismap",
601
- "itemscope",
602
- "loop",
603
- "multiple",
604
- "muted",
605
- "nomodule",
606
- "novalidate",
607
- "open",
608
- "playsinline",
609
- "readonly",
610
- "required",
611
- "reversed",
612
- "selected"
613
- ];
614
- var resolveFunctionComponentResult = (result, suspendedContext) => result.then((resolved) => {
615
- if (!Array.isArray(resolved) && !(resolved instanceof JSXNode)) return resolved;
616
- const children = Array.isArray(resolved) ? resolved : [resolved];
617
- const render = () => {
618
- const buffer = [""];
619
- childrenToStringToBuffer(children, buffer);
620
- return buffer.length === 1 ? raw(buffer[0], buffer.callbacks) : stringBufferToString(buffer, buffer.callbacks);
621
- };
622
- return suspendedContext ? suspendedContext(render) : runWithRenderContext(render);
623
- });
624
- var childrenToStringToBuffer = (children, buffer) => {
625
- for (let i = 0, len = children.length; i < len; i++) {
626
- const child = children[i];
627
- if (typeof child === "string") escapeToBuffer(child, buffer);
628
- else if (typeof child === "boolean" || child === null || child === void 0) continue;
629
- else if (child instanceof JSXNode) child.toStringToBuffer(buffer);
630
- else if (typeof child === "number") buffer[0] += child;
631
- else if (child.isEscaped) {
632
- buffer[0] += child;
633
- const callbacks = child.callbacks;
634
- if (callbacks) {
635
- buffer.callbacks ||= [];
636
- buffer.callbacks.push(...callbacks);
637
- }
638
- } else if (child instanceof Promise) buffer.unshift("", child);
639
- else childrenToStringToBuffer(child, buffer);
640
- }
641
- };
642
- var JSXNode = class {
643
- tag;
644
- props;
645
- key;
646
- children;
647
- isEscaped = true;
648
- constructor(tag, props, children) {
649
- if (typeof tag !== "function" && !isValidTagName(tag)) throw new Error(`Invalid JSX tag name: ${tag}`);
650
- this.tag = tag;
651
- this.props = props;
652
- this.children = children;
653
- }
654
- get type() {
655
- return this.tag;
656
- }
657
- get ref() {
658
- return this.props.ref || null;
659
- }
660
- toString() {
661
- const render = () => {
662
- const buffer = [""];
663
- this.toStringToBuffer(buffer);
664
- return buffer.length === 1 ? "callbacks" in buffer ? resolveCallbackSync(raw(buffer[0], buffer.callbacks)).toString() : buffer[0] : stringBufferToString(buffer, buffer.callbacks);
665
- };
666
- return runWithRenderContext(render);
667
- }
668
- toStringToBuffer(buffer) {
669
- const tag = this.tag;
670
- const props = this.props;
671
- let { children } = this;
672
- buffer[0] += `<${tag}`;
673
- const normalizeKey = tag === "svg" || nameSpaceContext$1 && useContext(nameSpaceContext$1) === "svg" ? (key) => toSVGAttributeName(normalizeIntrinsicElementKey(key)) : (key) => normalizeIntrinsicElementKey(key);
674
- for (let [key, v] of Object.entries(props)) {
675
- key = normalizeKey(key);
676
- if (!isValidAttributeName(key)) continue;
677
- if (key === "children") {} else if (key === "style" && typeof v === "object") {
678
- let styleStr = "";
679
- styleObjectForEach(v, (property, value) => {
680
- if (value != null) styleStr += `${styleStr ? ";" : ""}${property}:${value}`;
681
- });
682
- buffer[0] += " style=\"";
683
- escapeToBuffer(styleStr, buffer);
684
- buffer[0] += "\"";
685
- } else if (typeof v === "string") {
686
- buffer[0] += ` ${key}="`;
687
- escapeToBuffer(v, buffer);
688
- buffer[0] += "\"";
689
- } else if (v === null || v === void 0) {} else if (typeof v === "number" || v.isEscaped) buffer[0] += ` ${key}="${v}"`;
690
- else if (typeof v === "boolean" && booleanAttributes.includes(key)) {
691
- if (v) buffer[0] += ` ${key}=""`;
692
- } else if (key === "dangerouslySetInnerHTML") {
693
- if (children.length > 0) throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
694
- children = [raw(v.__html)];
695
- } else if (v instanceof Promise) {
696
- buffer[0] += ` ${key}="`;
697
- buffer.unshift("\"", v);
698
- } else if (typeof v === "function") {
699
- if (!key.startsWith("on") && key !== "ref") throw new Error(`Invalid prop '${key}' of type 'function' supplied to '${tag}'.`);
700
- } else {
701
- buffer[0] += ` ${key}="`;
702
- escapeToBuffer(v.toString(), buffer);
703
- buffer[0] += "\"";
704
- }
705
- }
706
- if (emptyTags.includes(tag) && children.length === 0) {
707
- buffer[0] += "/>";
708
- return;
709
- }
710
- buffer[0] += ">";
711
- childrenToStringToBuffer(children, buffer);
712
- buffer[0] += `</${tag}>`;
713
- }
714
- };
715
- var JSXFunctionNode = class extends JSXNode {
716
- toStringToBuffer(buffer) {
717
- const { children } = this;
718
- const props = { ...this.props };
719
- if (children.length) props.children = children.length === 1 ? children[0] : children;
720
- const res = this.tag.call(null, props);
721
- if (typeof res === "boolean" || res == null) return;
722
- else if (res instanceof Promise) {
723
- if (globalContexts.length === 0) buffer.unshift("", resolveFunctionComponentResult(res));
724
- else buffer.unshift("", resolveFunctionComponentResult(res, captureRenderContext()));
725
- } else if (res instanceof JSXNode) res.toStringToBuffer(buffer);
726
- else if (Array.isArray(res)) childrenToStringToBuffer(res, buffer);
727
- else if (typeof res === "number" || res.isEscaped) {
728
- buffer[0] += res;
729
- if (res.callbacks) {
730
- buffer.callbacks ||= [];
731
- buffer.callbacks.push(...res.callbacks);
732
- }
733
- } else escapeToBuffer(res, buffer);
734
- }
735
- };
736
- var JSXFragmentNode = class extends JSXNode {
737
- toStringToBuffer(buffer) {
738
- childrenToStringToBuffer(this.children, buffer);
739
- }
740
- };
741
- var jsx = (tag, props, ...children) => {
742
- props ??= {};
743
- if (children.length) props.children = children.length === 1 ? children[0] : children;
744
- const key = props.key;
745
- delete props["key"];
746
- const node = jsxFn(tag, props, children);
747
- node.key = key;
748
- return node;
749
- };
750
- var initDomRenderer = false;
751
- var jsxFn = (tag, props, children) => {
752
- if (!initDomRenderer) {
753
- for (const k in domRenderers) components_exports$1[k][DOM_RENDERER] = domRenderers[k];
754
- initDomRenderer = true;
755
- }
756
- if (typeof tag === "function") return new JSXFunctionNode(tag, props, children);
757
- else if (components_exports$1[tag]) return new JSXFunctionNode(components_exports$1[tag], props, children);
758
- else if (tag === "svg" || tag === "head") {
759
- nameSpaceContext$1 ||= createContext("");
760
- return new JSXNode(tag, props, [new JSXFunctionNode(nameSpaceContext$1, { value: tag }, children)]);
761
- } else return new JSXNode(tag, props, children);
762
- };
763
- var Fragment$1 = ({ children }) => {
764
- return new JSXFragmentNode("", { children }, Array.isArray(children) ? children : children ? [children] : []);
765
- };
766
- //#endregion
767
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/jsx-dev-runtime.js
768
- function jsxDEV$1(tag, props, key) {
769
- let node;
770
- if (!props || !("children" in props)) node = jsxFn(tag, props, []);
771
- else {
772
- const children = props.children;
773
- node = Array.isArray(children) ? jsxFn(tag, props, children) : jsxFn(tag, props, [children]);
774
- }
775
- node.key = key;
776
- return node;
777
- }
778
- //#endregion
779
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/render.js
780
- var HONO_PORTAL_ELEMENT = "_hp";
781
- var eventAliasMap = {
782
- Change: "Input",
783
- DoubleClick: "DblClick"
784
- };
785
- var nameSpaceMap = {
786
- svg: "2000/svg",
787
- math: "1998/Math/MathML"
788
- };
789
- var buildDataStack = [];
790
- var refCleanupMap = /* @__PURE__ */ new WeakMap();
791
- var nameSpaceContext = void 0;
792
- var getNameSpaceContext = () => nameSpaceContext;
793
- var isNodeString = (node) => "t" in node;
794
- var eventCache = { onClick: ["click", false] };
795
- var getEventSpec = (key) => {
796
- if (!key.startsWith("on")) return;
797
- if (eventCache[key]) return eventCache[key];
798
- const match = key.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);
799
- if (match) {
800
- const [, eventName, capture] = match;
801
- return eventCache[key] = [(eventAliasMap[eventName] || eventName).toLowerCase(), !!capture];
802
- }
803
- };
804
- var toAttributeName = (element, key) => nameSpaceContext && element instanceof SVGElement && /[A-Z]/.test(key) && (key in element.style || key.match(/^(?:o|pai|str|u|ve)/)) ? key.replace(/([A-Z])/g, "-$1").toLowerCase() : key;
805
- var normalizeFormValue = (value) => value === null || value === void 0 || value === false ? null : value;
806
- var applySelectValue = (select, props) => {
807
- if (!("value" in props)) return;
808
- select.value = normalizeFormValue(props["value"]);
809
- if (!select.multiple && select.selectedIndex === -1) select.selectedIndex = 0;
810
- };
811
- var isIgnorableAttributeError = (error) => error instanceof DOMException && error.name === "InvalidCharacterError";
812
- var applyProps = (container, attributes, oldAttributes) => {
813
- attributes ||= {};
814
- for (let key in attributes) {
815
- const value = attributes[key];
816
- if (key !== "children" && (!oldAttributes || oldAttributes[key] !== value)) {
817
- key = normalizeIntrinsicElementKey(key);
818
- const eventSpec = getEventSpec(key);
819
- if (eventSpec) {
820
- if (oldAttributes?.[key] !== value) {
821
- if (oldAttributes) container.removeEventListener(eventSpec[0], oldAttributes[key], eventSpec[1]);
822
- if (value != null) {
823
- if (typeof value !== "function") throw new Error(`Event handler for "${key}" is not a function`);
824
- container.addEventListener(eventSpec[0], value, eventSpec[1]);
825
- }
826
- }
827
- } else if (key === "dangerouslySetInnerHTML" && value) container.innerHTML = value.__html;
828
- else if (key === "ref") {
829
- let cleanup;
830
- if (typeof value === "function") cleanup = value(container) || (() => value(null));
831
- else if (value && "current" in value) {
832
- value.current = container;
833
- cleanup = () => value.current = null;
834
- }
835
- refCleanupMap.set(container, cleanup);
836
- } else if (key === "style") {
837
- const style = container.style;
838
- if (typeof value === "string") style.cssText = value;
839
- else {
840
- style.cssText = "";
841
- if (value != null) styleObjectForEach(value, style.setProperty.bind(style));
842
- }
843
- } else {
844
- if (key === "value") {
845
- const nodeName = container.nodeName;
846
- if (nodeName === "SELECT") continue;
847
- else if (nodeName === "INPUT" || nodeName === "TEXTAREA") {
848
- container.value = normalizeFormValue(value);
849
- if (nodeName === "TEXTAREA") {
850
- container.textContent = value;
851
- continue;
852
- }
853
- }
854
- } else if (key === "checked" && container.nodeName === "INPUT" || key === "selected" && container.nodeName === "OPTION") container[key] = value;
855
- const k = toAttributeName(container, key);
856
- try {
857
- if (value === null || value === void 0 || value === false) container.removeAttribute(k);
858
- else if (value === true) container.setAttribute(k, "");
859
- else if (typeof value === "string" || typeof value === "number") container.setAttribute(k, value);
860
- else container.setAttribute(k, value.toString());
861
- } catch (e) {
862
- if (!isIgnorableAttributeError(e)) throw e;
863
- }
864
- }
865
- }
866
- }
867
- if (oldAttributes) for (let key in oldAttributes) {
868
- const value = oldAttributes[key];
869
- if (key !== "children" && !(key in attributes)) {
870
- key = normalizeIntrinsicElementKey(key);
871
- const eventSpec = getEventSpec(key);
872
- if (eventSpec) container.removeEventListener(eventSpec[0], value, eventSpec[1]);
873
- else if (key === "ref") refCleanupMap.get(container)?.();
874
- else try {
875
- container.removeAttribute(toAttributeName(container, key));
876
- } catch (e) {
877
- if (!isIgnorableAttributeError(e)) throw e;
878
- }
879
- }
880
- }
881
- };
882
- var invokeTag = (context, node) => {
883
- node[DOM_STASH][0] = 0;
884
- buildDataStack.push([context, node]);
885
- const func = node.tag[DOM_RENDERER] || node.tag;
886
- const props = func.defaultProps ? {
887
- ...func.defaultProps,
888
- ...node.props
889
- } : node.props;
890
- try {
891
- return [func.call(null, props)];
892
- } finally {
893
- buildDataStack.pop();
894
- }
895
- };
896
- var getNextChildren = (node, container, nextChildren, childrenToRemove, callbacks) => {
897
- if (node.vR?.length) {
898
- childrenToRemove.push(...node.vR);
899
- delete node.vR;
900
- }
901
- if (typeof node.tag === "function") node[DOM_STASH][1][1]?.forEach((data) => callbacks.push(data));
902
- node.vC.forEach((child) => {
903
- if (isNodeString(child)) nextChildren.push(child);
904
- else if (typeof child.tag === "function" || child.tag === "") {
905
- child.c = container;
906
- const currentNextChildrenIndex = nextChildren.length;
907
- getNextChildren(child, container, nextChildren, childrenToRemove, callbacks);
908
- if (child.s) {
909
- for (let i = currentNextChildrenIndex; i < nextChildren.length; i++) nextChildren[i].s = true;
910
- child.s = false;
911
- }
912
- } else {
913
- nextChildren.push(child);
914
- if (child.vR?.length) {
915
- childrenToRemove.push(...child.vR);
916
- delete child.vR;
917
- }
918
- }
919
- });
920
- };
921
- var findInsertBefore = (node) => {
922
- while (node && (node.tag === HONO_PORTAL_ELEMENT || !node.e)) node = node.tag === HONO_PORTAL_ELEMENT || !node.vC?.[0] ? node.nN : node.vC[0];
923
- return node?.e;
924
- };
925
- var removeNode = (node) => {
926
- if (!isNodeString(node)) {
927
- node[DOM_STASH]?.[1][1]?.forEach((data) => data[2]?.());
928
- refCleanupMap.get(node.e)?.();
929
- if (node.p === 2) node.vC?.forEach((n) => n.p = 2);
930
- node.vC?.forEach(removeNode);
931
- }
932
- if (!node.p) {
933
- node.e?.remove();
934
- delete node.e;
935
- }
936
- if (typeof node.tag === "function") {
937
- updateMap.delete(node);
938
- fallbackUpdateFnArrayMap.delete(node);
939
- delete node[DOM_STASH][3];
940
- node.a = true;
941
- }
942
- };
943
- var apply = (node, container, isNew) => {
944
- node.c = container;
945
- applyNodeObject(node, container, isNew);
946
- };
947
- var findChildNodeIndex = (childNodes, child) => {
948
- if (!child) return;
949
- for (let i = 0, len = childNodes.length; i < len; i++) if (childNodes[i] === child) return i;
950
- };
951
- var cancelBuild = /* @__PURE__ */ Symbol();
952
- var applyNodeObject = (node, container, isNew) => {
953
- const next = [];
954
- const remove = [];
955
- const callbacks = [];
956
- getNextChildren(node, container, next, remove, callbacks);
957
- remove.forEach(removeNode);
958
- const childNodes = isNew ? void 0 : container.childNodes;
959
- let offset;
960
- let insertBeforeNode = null;
961
- if (isNew) offset = -1;
962
- else if (!childNodes.length) offset = 0;
963
- else {
964
- const offsetByNextNode = findChildNodeIndex(childNodes, findInsertBefore(node.nN));
965
- if (offsetByNextNode !== void 0) {
966
- insertBeforeNode = childNodes[offsetByNextNode];
967
- offset = offsetByNextNode;
968
- } else offset = findChildNodeIndex(childNodes, next.find((n) => n.tag !== HONO_PORTAL_ELEMENT && n.e)?.e) ?? -1;
969
- if (offset === -1) isNew = true;
970
- }
971
- for (let i = 0, len = next.length; i < len; i++, offset++) {
972
- const child = next[i];
973
- let el;
974
- if (child.s && child.e) {
975
- el = child.e;
976
- child.s = false;
977
- } else {
978
- const isNewLocal = isNew || !child.e;
979
- if (isNodeString(child)) {
980
- if (child.e && child.d) child.e.textContent = child.t;
981
- child.d = false;
982
- el = child.e ||= document.createTextNode(child.t);
983
- } else {
984
- el = child.e ||= child.n ? document.createElementNS(child.n, child.tag) : document.createElement(child.tag);
985
- applyProps(el, child.props, child.pP);
986
- applyNodeObject(child, el, isNewLocal);
987
- if (child.tag === "select") applySelectValue(el, child.props);
988
- }
989
- }
990
- if (child.tag === HONO_PORTAL_ELEMENT) offset--;
991
- else if (isNew) {
992
- if (!el.parentNode) container.appendChild(el);
993
- } else if (childNodes[offset] !== el && childNodes[offset - 1] !== el) {
994
- if (childNodes[offset + 1] === el) container.appendChild(childNodes[offset]);
995
- else container.insertBefore(el, insertBeforeNode || childNodes[offset] || null);
996
- }
997
- }
998
- if (node.pP) node.pP = void 0;
999
- if (callbacks.length) {
1000
- const useLayoutEffectCbs = [];
1001
- const useEffectCbs = [];
1002
- callbacks.forEach(([, useLayoutEffectCb, , useEffectCb, useInsertionEffectCb]) => {
1003
- if (useLayoutEffectCb) useLayoutEffectCbs.push(useLayoutEffectCb);
1004
- if (useEffectCb) useEffectCbs.push(useEffectCb);
1005
- useInsertionEffectCb?.();
1006
- });
1007
- useLayoutEffectCbs.forEach((cb) => cb());
1008
- if (useEffectCbs.length) requestAnimationFrame(() => {
1009
- useEffectCbs.forEach((cb) => cb());
1010
- });
1011
- }
1012
- };
1013
- var isSameContext = (oldContexts, newContexts) => !!(oldContexts && oldContexts.length === newContexts.length && oldContexts.every((ctx, i) => ctx[1] === newContexts[i][1]));
1014
- var fallbackUpdateFnArrayMap = /* @__PURE__ */ new WeakMap();
1015
- var build = (context, node, children) => {
1016
- const buildWithPreviousChildren = !children && node.pC;
1017
- if (children) node.pC ||= node.vC;
1018
- let foundErrorHandler;
1019
- try {
1020
- children ||= typeof node.tag == "function" ? invokeTag(context, node) : toArray(node.props.children);
1021
- if (children[0]?.tag === "" && children[0][DOM_ERROR_HANDLER]) {
1022
- foundErrorHandler = children[0][DOM_ERROR_HANDLER];
1023
- context[5].push([
1024
- context,
1025
- foundErrorHandler,
1026
- node
1027
- ]);
1028
- }
1029
- const oldVChildren = buildWithPreviousChildren ? [...node.pC] : node.vC ? [...node.vC] : void 0;
1030
- const vChildren = [];
1031
- let prevNode;
1032
- for (let i = 0; i < children.length; i++) {
1033
- if (Array.isArray(children[i])) {
1034
- children.splice(i, 1, ...children[i].flat(Infinity));
1035
- i--;
1036
- continue;
1037
- }
1038
- let child = buildNode(children[i]);
1039
- if (child) {
1040
- if (typeof child.tag === "function" && !child.tag[DOM_INTERNAL_TAG]) {
1041
- if (globalContexts.length > 0) child[DOM_STASH][2] = globalContexts.map((c) => [c, c.values.at(-1)]);
1042
- if (context[5]?.length) child[DOM_STASH][3] = context[5].at(-1);
1043
- }
1044
- let oldChild;
1045
- if (oldVChildren && oldVChildren.length) {
1046
- const i2 = oldVChildren.findIndex(isNodeString(child) ? (c) => isNodeString(c) : child.key !== void 0 ? (c) => c.key === child.key && c.tag === child.tag : (c) => c.tag === child.tag);
1047
- if (i2 !== -1) {
1048
- oldChild = oldVChildren[i2];
1049
- oldVChildren.splice(i2, 1);
1050
- }
1051
- }
1052
- if (oldChild) {
1053
- if (isNodeString(child)) {
1054
- if (oldChild.t !== child.t) {
1055
- oldChild.t = child.t;
1056
- oldChild.d = true;
1057
- }
1058
- child = oldChild;
1059
- } else {
1060
- const pP = oldChild.pP = oldChild.props;
1061
- oldChild.props = child.props;
1062
- oldChild.f ||= child.f || node.f;
1063
- if (typeof child.tag === "function") {
1064
- const oldContexts = oldChild[DOM_STASH][2];
1065
- oldChild[DOM_STASH][2] = child[DOM_STASH][2] || [];
1066
- oldChild[DOM_STASH][3] = child[DOM_STASH][3];
1067
- if (!oldChild.f && ((oldChild.o || oldChild) === child.o || oldChild.tag[DOM_MEMO]?.(pP, oldChild.props)) && isSameContext(oldContexts, oldChild[DOM_STASH][2])) oldChild.s = true;
1068
- }
1069
- child = oldChild;
1070
- }
1071
- } else if (!isNodeString(child) && nameSpaceContext) {
1072
- const ns = useContext(nameSpaceContext);
1073
- if (ns) child.n = ns;
1074
- }
1075
- if (!isNodeString(child) && !child.s) {
1076
- build(context, child);
1077
- delete child.f;
1078
- }
1079
- vChildren.push(child);
1080
- if (prevNode && !prevNode.s && !child.s) for (let p = prevNode; p && !isNodeString(p); p = p.vC?.at(-1)) p.nN = child;
1081
- prevNode = child;
1082
- }
1083
- }
1084
- node.vR = buildWithPreviousChildren ? [...node.vC, ...oldVChildren || []] : oldVChildren || [];
1085
- node.vC = vChildren;
1086
- if (buildWithPreviousChildren) delete node.pC;
1087
- } catch (e) {
1088
- node.f = true;
1089
- if (e === cancelBuild) {
1090
- if (foundErrorHandler) return;
1091
- else throw e;
1092
- }
1093
- const [errorHandlerContext, errorHandler, errorHandlerNode] = node[DOM_STASH]?.[3] || [];
1094
- if (errorHandler) {
1095
- const fallbackUpdateFn = () => update([
1096
- 0,
1097
- false,
1098
- context[2]
1099
- ], errorHandlerNode);
1100
- const fallbackUpdateFnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode) || [];
1101
- fallbackUpdateFnArray.push(fallbackUpdateFn);
1102
- fallbackUpdateFnArrayMap.set(errorHandlerNode, fallbackUpdateFnArray);
1103
- const fallback = errorHandler(e, () => {
1104
- const fnArray = fallbackUpdateFnArrayMap.get(errorHandlerNode);
1105
- if (fnArray) {
1106
- const i = fnArray.indexOf(fallbackUpdateFn);
1107
- if (i !== -1) {
1108
- fnArray.splice(i, 1);
1109
- return fallbackUpdateFn();
1110
- }
1111
- }
1112
- });
1113
- if (fallback) {
1114
- if (context[0] === 1) context[1] = true;
1115
- else {
1116
- build(context, errorHandlerNode, [fallback]);
1117
- if ((errorHandler.length === 1 || context !== errorHandlerContext) && errorHandlerNode.c) {
1118
- apply(errorHandlerNode, errorHandlerNode.c, false);
1119
- return;
1120
- }
1121
- }
1122
- throw cancelBuild;
1123
- }
1124
- }
1125
- throw e;
1126
- } finally {
1127
- if (foundErrorHandler) context[5].pop();
1128
- }
1129
- };
1130
- var buildNode = (node) => {
1131
- if (node === void 0 || node === null || typeof node === "boolean") return;
1132
- else if (typeof node === "string" || typeof node === "number") return {
1133
- t: node.toString(),
1134
- d: true
1135
- };
1136
- else {
1137
- if ("vR" in node) node = {
1138
- tag: node.tag,
1139
- props: node.props,
1140
- key: node.key,
1141
- f: node.f,
1142
- type: node.tag,
1143
- ref: node.props.ref,
1144
- o: node.o || node
1145
- };
1146
- if (typeof node.tag === "function") node[DOM_STASH] = [0, []];
1147
- else {
1148
- const ns = nameSpaceMap[node.tag];
1149
- if (ns) {
1150
- nameSpaceContext ||= createContext$1("");
1151
- node.props.children = [{
1152
- tag: nameSpaceContext,
1153
- props: {
1154
- value: node.n = `http://www.w3.org/${ns}`,
1155
- children: node.props.children
1156
- }
1157
- }];
1158
- }
1159
- }
1160
- return node;
1161
- }
1162
- };
1163
- var updateSync = (context, node) => {
1164
- node[DOM_STASH][2]?.forEach(([c, v]) => {
1165
- c.values.push(v);
1166
- });
1167
- try {
1168
- build(context, node, void 0);
1169
- } catch {
1170
- return;
1171
- }
1172
- if (node.a) {
1173
- delete node.a;
1174
- return;
1175
- }
1176
- node[DOM_STASH][2]?.forEach(([c]) => {
1177
- c.values.pop();
1178
- });
1179
- if (context[0] !== 1 || !context[1]) apply(node, node.c, false);
1180
- };
1181
- var updateMap = /* @__PURE__ */ new WeakMap();
1182
- var currentUpdateSets = [];
1183
- var update = async (context, node) => {
1184
- context[5] ||= [];
1185
- const existing = updateMap.get(node);
1186
- if (existing) existing[0](void 0);
1187
- let resolve;
1188
- const promise = new Promise((r) => resolve = r);
1189
- updateMap.set(node, [resolve, () => {
1190
- if (context[2]) context[2](context, node, (context2) => {
1191
- updateSync(context2, node);
1192
- }).then(() => resolve(node));
1193
- else {
1194
- updateSync(context, node);
1195
- resolve(node);
1196
- }
1197
- }]);
1198
- if (currentUpdateSets.length) currentUpdateSets.at(-1).add(node);
1199
- else {
1200
- await Promise.resolve();
1201
- const latest = updateMap.get(node);
1202
- if (latest) {
1203
- updateMap.delete(node);
1204
- latest[1]();
1205
- }
1206
- }
1207
- return promise;
1208
- };
1209
- var createPortal = (children, container, key) => ({
1210
- tag: HONO_PORTAL_ELEMENT,
1211
- props: { children },
1212
- key,
1213
- e: container,
1214
- p: 1
1215
- });
1216
- //#endregion
1217
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/hooks/index.js
1218
- var STASH_SATE = 0;
1219
- var STASH_CALLBACK = 2;
1220
- var STASH_MEMO = 3;
1221
- var STASH_REF = 4;
1222
- var resolvedPromiseValueMap = /* @__PURE__ */ new WeakMap();
1223
- var isDepsChanged = (prevDeps, deps) => !prevDeps || !deps || prevDeps.length !== deps.length || deps.some((dep, i) => dep !== prevDeps[i]);
1224
- var updateHook = void 0;
1225
- var pendingStack = [];
1226
- var useState = (initialState) => {
1227
- const resolveInitialState = () => typeof initialState === "function" ? initialState() : initialState;
1228
- const buildData = buildDataStack.at(-1);
1229
- if (!buildData) return [resolveInitialState(), () => {}];
1230
- const [, node] = buildData;
1231
- const stateArray = node[DOM_STASH][1][STASH_SATE] ||= [];
1232
- const hookIndex = node[DOM_STASH][0]++;
1233
- return stateArray[hookIndex] ||= [resolveInitialState(), (newState) => {
1234
- const localUpdateHook = updateHook;
1235
- const stateData = stateArray[hookIndex];
1236
- if (typeof newState === "function") newState = newState(stateData[0]);
1237
- if (!Object.is(newState, stateData[0])) {
1238
- stateData[0] = newState;
1239
- if (pendingStack.length) {
1240
- const [pendingType, pendingPromise] = pendingStack.at(-1);
1241
- Promise.all([pendingType === 3 ? node : update([
1242
- pendingType,
1243
- false,
1244
- localUpdateHook
1245
- ], node), pendingPromise]).then(([node2]) => {
1246
- if (!node2 || !(pendingType === 2 || pendingType === 3)) return;
1247
- const lastVC = node2.vC;
1248
- const addUpdateTask = () => {
1249
- setTimeout(() => {
1250
- if (lastVC !== node2.vC) return;
1251
- update([
1252
- pendingType === 3 ? 1 : 0,
1253
- false,
1254
- localUpdateHook
1255
- ], node2);
1256
- });
1257
- };
1258
- requestAnimationFrame(addUpdateTask);
1259
- });
1260
- } else update([
1261
- 0,
1262
- false,
1263
- localUpdateHook
1264
- ], node);
1265
- }
1266
- }];
1267
- };
1268
- var useEffectCommon = (index, effect, deps) => {
1269
- const buildData = buildDataStack.at(-1);
1270
- if (!buildData) return;
1271
- const [, node] = buildData;
1272
- const effectDepsArray = node[DOM_STASH][1][1] ||= [];
1273
- const hookIndex = node[DOM_STASH][0]++;
1274
- const [prevDeps, , prevCleanup] = effectDepsArray[hookIndex] ||= [];
1275
- if (isDepsChanged(prevDeps, deps)) {
1276
- if (prevCleanup) prevCleanup();
1277
- const runner = () => {
1278
- data[index] = void 0;
1279
- data[2] = effect();
1280
- };
1281
- const data = [
1282
- deps,
1283
- void 0,
1284
- void 0,
1285
- void 0,
1286
- void 0
1287
- ];
1288
- data[index] = runner;
1289
- effectDepsArray[hookIndex] = data;
1290
- }
1291
- };
1292
- var useEffect = (effect, deps) => useEffectCommon(3, effect, deps);
1293
- var useCallback = (callback, deps) => {
1294
- const buildData = buildDataStack.at(-1);
1295
- if (!buildData) return callback;
1296
- const [, node] = buildData;
1297
- const callbackArray = node[DOM_STASH][1][STASH_CALLBACK] ||= [];
1298
- const hookIndex = node[DOM_STASH][0]++;
1299
- const prevDeps = callbackArray[hookIndex];
1300
- if (isDepsChanged(prevDeps?.[1], deps)) callbackArray[hookIndex] = [callback, deps];
1301
- else callback = callbackArray[hookIndex][0];
1302
- return callback;
1303
- };
1304
- function useRef(initialValue) {
1305
- const buildData = buildDataStack.at(-1);
1306
- if (!buildData) return { current: initialValue };
1307
- const [, node] = buildData;
1308
- const refArray = node[DOM_STASH][1][STASH_REF] ||= [];
1309
- const hookIndex = node[DOM_STASH][0]++;
1310
- return refArray[hookIndex] ||= { current: initialValue };
1311
- }
1312
- var use = (promise) => {
1313
- const cachedRes = resolvedPromiseValueMap.get(promise);
1314
- if (cachedRes) {
1315
- if (cachedRes.length === 2) throw cachedRes[1];
1316
- return cachedRes[0];
1317
- }
1318
- promise.then((res) => resolvedPromiseValueMap.set(promise, [res]), (e) => resolvedPromiseValueMap.set(promise, [void 0, e]));
1319
- throw promise;
1320
- };
1321
- var useMemo = (factory, deps) => {
1322
- const buildData = buildDataStack.at(-1);
1323
- if (!buildData) return factory();
1324
- const [, node] = buildData;
1325
- const memoArray = node[DOM_STASH][1][STASH_MEMO] ||= [];
1326
- const hookIndex = node[DOM_STASH][0]++;
1327
- const prevDeps = memoArray[hookIndex];
1328
- if (isDepsChanged(prevDeps?.[1], deps)) memoArray[hookIndex] = [factory(), deps];
1329
- return memoArray[hookIndex][0];
1330
- };
1331
- //#endregion
1332
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/hooks/index.js
1333
- var FormContext = createContext$1({
1334
- pending: false,
1335
- data: null,
1336
- method: null,
1337
- action: null
1338
- });
1339
- var actions = /* @__PURE__ */ new Set();
1340
- var registerAction = (action) => {
1341
- actions.add(action);
1342
- action.finally(() => actions.delete(action));
1343
- };
1344
- //#endregion
1345
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js
1346
- var components_exports = /* @__PURE__ */ __exportAll({
1347
- button: () => button,
1348
- clearCache: () => clearCache,
1349
- composeRef: () => composeRef,
1350
- form: () => form,
1351
- input: () => input,
1352
- link: () => link,
1353
- meta: () => meta,
1354
- script: () => script,
1355
- style: () => style,
1356
- title: () => title
1357
- });
1358
- var clearCache = () => {
1359
- blockingPromiseMap = /* @__PURE__ */ Object.create(null);
1360
- createdElements = /* @__PURE__ */ Object.create(null);
1361
- };
1362
- var composeRef = (ref, cb) => {
1363
- return useMemo(() => (e) => {
1364
- let refCleanup;
1365
- if (ref) {
1366
- if (typeof ref === "function") refCleanup = ref(e) || (() => {
1367
- ref(null);
1368
- });
1369
- else if (ref && "current" in ref) {
1370
- ref.current = e;
1371
- refCleanup = () => {
1372
- ref.current = null;
1373
- };
1374
- }
1375
- }
1376
- const cbCleanup = cb(e);
1377
- return () => {
1378
- cbCleanup?.();
1379
- refCleanup?.();
1380
- };
1381
- }, [ref]);
1382
- };
1383
- var blockingPromiseMap = /* @__PURE__ */ Object.create(null);
1384
- var createdElements = /* @__PURE__ */ Object.create(null);
1385
- var documentMetadataTag = (tag, props, preserveNodeType, supportSort, supportBlocking) => {
1386
- if (props?.itemProp) return {
1387
- tag,
1388
- props,
1389
- type: tag,
1390
- ref: props.ref
1391
- };
1392
- const head = document.head;
1393
- let { onLoad, onError, precedence, blocking, ...restProps } = props;
1394
- let element = null;
1395
- let created = false;
1396
- const deDupeKeys = deDupeKeyMap[tag];
1397
- const deDupeByKey = shouldDeDupeByKey(tag, supportSort);
1398
- const isDeDupeCandidateLink = (e) => e.getAttribute("rel") === "stylesheet" && e.getAttribute("data-precedence") !== null;
1399
- let existingElements = void 0;
1400
- if (deDupeByKey) {
1401
- const tags = head.querySelectorAll(tag);
1402
- LOOP: for (const e of tags) {
1403
- if (tag === "link" && !isDeDupeCandidateLink(e)) continue;
1404
- for (const key of deDupeKeys) if (e.getAttribute(key) === props[key]) {
1405
- element = e;
1406
- break LOOP;
1407
- }
1408
- }
1409
- if (!element) {
1410
- const cacheKey = deDupeKeys.reduce((acc, key) => props[key] === void 0 ? acc : `${acc}-${key}-${props[key]}`, tag);
1411
- created = !createdElements[cacheKey];
1412
- element = createdElements[cacheKey] ||= (() => {
1413
- const e = document.createElement(tag);
1414
- for (const key of deDupeKeys) if (props[key] !== void 0) e.setAttribute(key, props[key]);
1415
- if (props.rel) e.setAttribute("rel", props.rel);
1416
- return e;
1417
- })();
1418
- }
1419
- } else existingElements = head.querySelectorAll(tag);
1420
- precedence = supportSort ? precedence ?? "" : void 0;
1421
- if (supportSort) restProps[dataPrecedenceAttr] = precedence;
1422
- const insert = useCallback((e) => {
1423
- if (deDupeByKey) {
1424
- if (tag === "link" && precedence !== void 0) {
1425
- let found2 = false;
1426
- for (const existingElement of head.querySelectorAll(tag)) {
1427
- const existingPrecedence = existingElement.getAttribute(dataPrecedenceAttr);
1428
- if (existingPrecedence === null) {
1429
- head.insertBefore(e, existingElement);
1430
- return;
1431
- }
1432
- if (found2 && existingPrecedence !== precedence) {
1433
- head.insertBefore(e, existingElement);
1434
- return;
1435
- }
1436
- if (existingPrecedence === precedence) found2 = true;
1437
- }
1438
- head.appendChild(e);
1439
- return;
1440
- }
1441
- let found = false;
1442
- for (const existingElement of head.querySelectorAll(tag)) {
1443
- if (found && existingElement.getAttribute("data-precedence") !== precedence) {
1444
- head.insertBefore(e, existingElement);
1445
- return;
1446
- }
1447
- if (existingElement.getAttribute("data-precedence") === precedence) found = true;
1448
- }
1449
- head.appendChild(e);
1450
- } else if (tag === "link") {
1451
- if (!head.contains(e)) head.appendChild(e);
1452
- } else if (existingElements) {
1453
- let found = false;
1454
- for (const existingElement of existingElements) if (existingElement === e) {
1455
- found = true;
1456
- break;
1457
- }
1458
- if (!found) head.insertBefore(e, head.contains(existingElements[0]) ? existingElements[0] : head.querySelector(tag));
1459
- existingElements = void 0;
1460
- }
1461
- }, [
1462
- deDupeByKey,
1463
- precedence,
1464
- tag
1465
- ]);
1466
- const ref = composeRef(props.ref, (e) => {
1467
- const key = deDupeKeys[0];
1468
- if (preserveNodeType === 2) e.innerHTML = "";
1469
- if (created || existingElements) insert(e);
1470
- if (!onError && !onLoad) return;
1471
- if (!key) return;
1472
- let promise = blockingPromiseMap[e.getAttribute(key)] ||= new Promise((resolve, reject) => {
1473
- e.addEventListener("load", resolve);
1474
- e.addEventListener("error", reject);
1475
- });
1476
- if (onLoad) promise = promise.then(onLoad);
1477
- if (onError) promise = promise.catch(onError);
1478
- promise.catch(() => {});
1479
- });
1480
- if (supportBlocking && blocking === "render") {
1481
- const key = deDupeKeyMap[tag][0];
1482
- if (key && props[key]) {
1483
- const value = props[key];
1484
- use(blockingPromiseMap[value] ||= new Promise((resolve, reject) => {
1485
- insert(element);
1486
- element.addEventListener("load", resolve);
1487
- element.addEventListener("error", reject);
1488
- }));
1489
- }
1490
- }
1491
- const jsxNode = {
1492
- tag,
1493
- type: tag,
1494
- props: {
1495
- ...restProps,
1496
- ref
1497
- },
1498
- ref
1499
- };
1500
- jsxNode.p = preserveNodeType;
1501
- if (element) jsxNode.e = element;
1502
- return createPortal(jsxNode, head);
1503
- };
1504
- var title = (props) => {
1505
- const nameSpaceContext = getNameSpaceContext();
1506
- if ((nameSpaceContext && useContext(nameSpaceContext))?.endsWith("svg")) return {
1507
- tag: "title",
1508
- props,
1509
- type: "title",
1510
- ref: props.ref
1511
- };
1512
- return documentMetadataTag("title", props, void 0, false, false);
1513
- };
1514
- var script = (props) => {
1515
- if (!props || ["src", "async"].some((k) => !props[k])) return {
1516
- tag: "script",
1517
- props,
1518
- type: "script",
1519
- ref: props.ref
1520
- };
1521
- return documentMetadataTag("script", props, 1, false, true);
1522
- };
1523
- var style = (props) => {
1524
- if (!props || !["href", "precedence"].every((k) => k in props)) return {
1525
- tag: "style",
1526
- props,
1527
- type: "style",
1528
- ref: props.ref
1529
- };
1530
- props["data-href"] = props.href;
1531
- delete props.href;
1532
- return documentMetadataTag("style", props, 2, true, true);
1533
- };
1534
- var link = (props) => {
1535
- if (!props || ["onLoad", "onError"].some((k) => k in props) || props.rel === "stylesheet" && (!("precedence" in props) || "disabled" in props)) return {
1536
- tag: "link",
1537
- props,
1538
- type: "link",
1539
- ref: props.ref
1540
- };
1541
- return documentMetadataTag("link", props, 1, isStylesheetLinkWithPrecedence(props), true);
1542
- };
1543
- var meta = (props) => {
1544
- return documentMetadataTag("meta", props, void 0, false, false);
1545
- };
1546
- var customEventFormAction = /* @__PURE__ */ Symbol();
1547
- var form = (props) => {
1548
- const { action, ...restProps } = props;
1549
- if (typeof action !== "function") restProps.action = action;
1550
- const [state, setState] = useState([null, false]);
1551
- const onSubmit = useCallback(async (ev) => {
1552
- const currentAction = ev.isTrusted ? action : ev.detail[customEventFormAction];
1553
- if (typeof currentAction !== "function") return;
1554
- ev.preventDefault();
1555
- const formData = new FormData(ev.target);
1556
- setState([formData, true]);
1557
- const actionRes = currentAction(formData);
1558
- if (actionRes instanceof Promise) {
1559
- registerAction(actionRes);
1560
- await actionRes;
1561
- }
1562
- setState([null, true]);
1563
- }, []);
1564
- const ref = composeRef(props.ref, (el) => {
1565
- el.addEventListener("submit", onSubmit);
1566
- return () => {
1567
- el.removeEventListener("submit", onSubmit);
1568
- };
1569
- });
1570
- const [data, isDirty] = state;
1571
- state[1] = false;
1572
- return {
1573
- tag: FormContext,
1574
- props: {
1575
- value: {
1576
- pending: data !== null,
1577
- data,
1578
- method: data ? "post" : null,
1579
- action: data ? action : null
1580
- },
1581
- children: {
1582
- tag: "form",
1583
- props: {
1584
- ...restProps,
1585
- ref
1586
- },
1587
- type: "form",
1588
- ref
1589
- }
1590
- },
1591
- f: isDirty
1592
- };
1593
- };
1594
- var formActionableElement = (tag, { formAction, ...props }) => {
1595
- if (typeof formAction === "function") {
1596
- const onClick = useCallback((ev) => {
1597
- ev.preventDefault();
1598
- ev.currentTarget.form.dispatchEvent(new CustomEvent("submit", { detail: { [customEventFormAction]: formAction } }));
1599
- }, []);
1600
- props.ref = composeRef(props.ref, (el) => {
1601
- el.addEventListener("click", onClick);
1602
- return () => {
1603
- el.removeEventListener("click", onClick);
1604
- };
1605
- });
1606
- }
1607
- return {
1608
- tag,
1609
- props,
1610
- type: tag,
1611
- ref: props.ref
1612
- };
1613
- };
1614
- var input = (props) => formActionableElement("input", props);
1615
- var button = (props) => formActionableElement("button", props);
1616
- Object.assign(domRenderers, {
1617
- title,
1618
- script,
1619
- style,
1620
- link,
1621
- meta,
1622
- form,
1623
- input,
1624
- button
1625
- });
1626
- //#endregion
1627
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js
1628
- var jsxDEV = (tag, props, key) => {
1629
- if (typeof tag === "string" && components_exports[tag]) tag = components_exports[tag];
1630
- return {
1631
- tag,
1632
- type: tag,
1633
- props,
1634
- key,
1635
- ref: props.ref
1636
- };
1637
- };
1638
- var Fragment = (props) => jsxDEV("", props, void 0);
1639
- //#endregion
1640
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/dom/components.js
1641
- var ErrorBoundary$1 = (({ children, fallback, fallbackRender, onError }) => {
1642
- const res = Fragment({ children });
1643
- res[DOM_ERROR_HANDLER] = (err) => {
1644
- if (err instanceof Promise) throw err;
1645
- onError?.(err);
1646
- return fallbackRender?.(err) || fallback;
1647
- };
1648
- return res;
1649
- });
1650
- var Suspense$1 = (({ children, fallback }) => {
1651
- const res = Fragment({ children });
1652
- res[DOM_ERROR_HANDLER] = (err, retry) => {
1653
- if (!(err instanceof Promise)) throw err;
1654
- err.finally(retry);
1655
- return fallback;
1656
- };
1657
- return res;
1658
- });
1659
- //#endregion
1660
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/streaming.js
1661
- var StreamingContext = createContext(null);
1662
- var suspenseCounter = 0;
1663
- var Suspense = async ({ children, fallback }) => {
1664
- if (!Array.isArray(children)) children = [children];
1665
- const nonce = useContext(StreamingContext)?.scriptNonce;
1666
- let resArray = [];
1667
- const stackNode = { [DOM_STASH]: [0, []] };
1668
- const popNodeStack = () => {
1669
- buildDataStack.pop();
1670
- };
1671
- try {
1672
- stackNode[DOM_STASH][0] = 0;
1673
- buildDataStack.push([[], stackNode]);
1674
- resArray = children.map((c) => c == null || typeof c === "boolean" ? "" : c.toString());
1675
- } catch (e) {
1676
- if (e instanceof Promise) {
1677
- const resume = captureRenderContext();
1678
- resArray = [e.then(() => resume(() => {
1679
- stackNode[DOM_STASH][0] = 0;
1680
- buildDataStack.push([[], stackNode]);
1681
- return childrenToString(children).finally(popNodeStack);
1682
- }))];
1683
- } else throw e;
1684
- } finally {
1685
- popNodeStack();
1686
- }
1687
- if (resArray.some((res) => res instanceof Promise)) {
1688
- const index = suspenseCounter++;
1689
- const fallbackStr = await fallback.toString();
1690
- return raw(`<template id="H:${index}"></template>${fallbackStr}<!--/$-->`, [...fallbackStr.callbacks || [], ({ phase, buffer, context }) => {
1691
- if (phase === HtmlEscapedCallbackPhase.BeforeStream) return;
1692
- return Promise.all(resArray).then(async (htmlArray) => {
1693
- htmlArray = htmlArray.flat();
1694
- const content = htmlArray.join("");
1695
- if (buffer) buffer[0] = buffer[0].replace(new RegExp(`<template id="H:${index}"></template>.*?<!--/\\$-->`), content);
1696
- let html = buffer ? "" : `<template data-hono-target="H:${index}">${content}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
1697
- ((d,c,n) => {
1698
- c=d.currentScript.previousSibling
1699
- d=d.getElementById('H:${index}')
1700
- if(!d)return
1701
- do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='/$')
1702
- d.replaceWith(c.content)
1703
- })(document)
1704
- <\/script>`;
1705
- const callbacks = htmlArray.map((html2) => html2.callbacks || []).flat();
1706
- if (!callbacks.length) return html;
1707
- if (phase === HtmlEscapedCallbackPhase.Stream) html = await resolveCallback(html, HtmlEscapedCallbackPhase.BeforeStream, true, context);
1708
- return raw(html, callbacks);
1709
- });
1710
- }]);
1711
- } else return raw(resArray.join(""));
1712
- };
1713
- Suspense[DOM_RENDERER] = Suspense$1;
1714
- var textEncoder = new TextEncoder();
1715
- var renderToReadableStream = (content, onError = console.trace) => {
1716
- let cancelled = false;
1717
- return new ReadableStream({
1718
- async start(controller) {
1719
- try {
1720
- if (content instanceof JSXNode) content = content.toString();
1721
- const context = typeof content === "object" ? content : {};
1722
- const resolved = await resolveCallback(content, HtmlEscapedCallbackPhase.BeforeStream, true, context);
1723
- if (!cancelled) controller.enqueue(textEncoder.encode(resolved));
1724
- let resolvedCount = 0;
1725
- const callbacks = [];
1726
- const then = (promise) => {
1727
- callbacks.push(promise.catch((err) => {
1728
- console.log(err);
1729
- onError(err);
1730
- return "";
1731
- }).then(async (res) => {
1732
- res = await resolveCallback(res, HtmlEscapedCallbackPhase.BeforeStream, true, context);
1733
- res.callbacks?.map((c) => c({
1734
- phase: HtmlEscapedCallbackPhase.Stream,
1735
- context
1736
- })).filter(Boolean).forEach(then);
1737
- resolvedCount++;
1738
- if (!cancelled) controller.enqueue(textEncoder.encode(res));
1739
- }));
1740
- };
1741
- resolved.callbacks?.map((c) => c({
1742
- phase: HtmlEscapedCallbackPhase.Stream,
1743
- context
1744
- })).filter(Boolean).forEach(then);
1745
- while (resolvedCount !== callbacks.length) await Promise.all(callbacks);
1746
- } catch (e) {
1747
- onError(e);
1748
- }
1749
- if (!cancelled) controller.close();
1750
- },
1751
- cancel() {
1752
- cancelled = true;
1753
- }
1754
- });
1755
- };
1756
- //#endregion
1757
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/jsx/components.js
1758
- var errorBoundaryCounter = 0;
1759
- var childrenToString = async (children) => {
1760
- try {
1761
- return children.flat().map((c) => c == null || typeof c === "boolean" ? "" : c.toString());
1762
- } catch (e) {
1763
- if (e instanceof Promise) {
1764
- const resume = captureRenderContext();
1765
- await e;
1766
- return resume(() => childrenToString(children));
1767
- } else throw e;
1768
- }
1769
- };
1770
- var resolveChildEarly = (c) => {
1771
- if (c == null || typeof c === "boolean") return "";
1772
- else if (typeof c === "string") return c;
1773
- else {
1774
- const str = c.toString();
1775
- if (!(str instanceof Promise)) return raw(str);
1776
- else return str;
1777
- }
1778
- };
1779
- var ErrorBoundary = async ({ children, fallback, fallbackRender, onError }) => {
1780
- if (!children) return raw("");
1781
- if (!Array.isArray(children)) children = [children];
1782
- const nonce = useContext(StreamingContext)?.scriptNonce;
1783
- let resume;
1784
- const getResume = () => resume ||= captureRenderContext();
1785
- let fallbackStrPromise;
1786
- const resolveFallbackStr = () => fallbackStrPromise ||= (async () => {
1787
- const awaitedFallback = await fallback;
1788
- if (typeof awaitedFallback === "string") return awaitedFallback;
1789
- else {
1790
- const fallbackResult = await getResume()(() => awaitedFallback?.toString());
1791
- if (typeof fallbackResult === "string") return raw(fallbackResult, fallbackResult.callbacks || awaitedFallback?.callbacks);
1792
- }
1793
- })();
1794
- const renderFallback = async (error) => {
1795
- const fallbackStr = await resolveFallbackStr();
1796
- return getResume()(async () => {
1797
- onError?.(error);
1798
- const fallbackRes = fallbackStr !== void 0 ? fallbackStr : fallbackRender && jsx(Fragment$1, {}, fallbackRender(error)) || "";
1799
- const fallbackResString = await Fragment$1({ children: fallbackRes }).toString();
1800
- return raw(fallbackResString, fallbackResString.callbacks || fallbackRes.callbacks);
1801
- });
1802
- };
1803
- let resArray = [];
1804
- try {
1805
- resArray = children.map(resolveChildEarly);
1806
- } catch (e) {
1807
- const resume2 = getResume();
1808
- if (e instanceof Promise) resArray = [e.then(() => resume2(() => childrenToString(children))).catch((e2) => renderFallback(e2))];
1809
- else resArray = [await renderFallback(e)];
1810
- }
1811
- if (resArray.some((res) => res instanceof Promise)) {
1812
- getResume();
1813
- const index = errorBoundaryCounter++;
1814
- const replaceRe = RegExp(`(<template id="E:${index}"></template>.*?)(.*?)(<!--E:${index}-->)`);
1815
- let caught = false;
1816
- const catchCallback = async ({ error: error2, buffer }) => {
1817
- if (caught) return "";
1818
- caught = true;
1819
- const fallbackResString = await renderFallback(error2);
1820
- const fallbackCallbacks = fallbackResString.callbacks;
1821
- if (buffer) {
1822
- buffer[0] = buffer[0].replace(replaceRe, fallbackResString);
1823
- return fallbackCallbacks?.length ? raw("", fallbackCallbacks) : "";
1824
- }
1825
- return raw(`<template data-hono-target="E:${index}">${fallbackResString}</template><script>
1826
- ((d,c,n) => {
1827
- c=d.currentScript.previousSibling
1828
- d=d.getElementById('E:${index}')
1829
- if(!d)return
1830
- do{n=d.nextSibling;n.remove()}while(n.nodeType!=8||n.nodeValue!='E:${index}')
1831
- d.replaceWith(c.content)
1832
- })(document)
1833
- <\/script>`, fallbackCallbacks);
1834
- };
1835
- let error;
1836
- const promiseAll = Promise.all(resArray).catch((e) => error = e);
1837
- return raw(`<template id="E:${index}"></template><!--E:${index}-->`, [({ phase, buffer, context }) => {
1838
- if (phase === HtmlEscapedCallbackPhase.BeforeStream) return;
1839
- return promiseAll.then(async (htmlArray) => {
1840
- if (error) throw error;
1841
- htmlArray = htmlArray.flat();
1842
- const content = htmlArray.join("");
1843
- let html = buffer ? "" : `<template data-hono-target="E:${index}">${content}</template><script${nonce ? ` nonce="${nonce}"` : ""}>
1844
- ((d,c) => {
1845
- c=d.currentScript.previousSibling
1846
- d=d.getElementById('E:${index}')
1847
- if(!d)return
1848
- d.parentElement.insertBefore(c.content,d.nextSibling)
1849
- })(document)
1850
- <\/script>`;
1851
- if (htmlArray.every((html2) => !html2.callbacks?.length)) {
1852
- if (buffer) buffer[0] = buffer[0].replace(replaceRe, content);
1853
- return html;
1854
- }
1855
- if (buffer) buffer[0] = buffer[0].replace(replaceRe, (_all, pre, _, post) => `${pre}${content}${post}`);
1856
- const callbacks = htmlArray.map((html2) => html2.callbacks || []).flat();
1857
- if (phase === HtmlEscapedCallbackPhase.Stream) html = await resolveCallback(html, HtmlEscapedCallbackPhase.BeforeStream, true, context);
1858
- let resolvedCount = 0;
1859
- const promises = callbacks.map((c) => (...args) => c(...args)?.then((content2) => {
1860
- resolvedCount++;
1861
- if (buffer) {
1862
- if (resolvedCount === callbacks.length) buffer[0] = buffer[0].replace(replaceRe, (_all, _pre, content3) => content3);
1863
- buffer[0] += content2;
1864
- return raw("", content2.callbacks);
1865
- }
1866
- return raw(content2 + (resolvedCount !== callbacks.length ? "" : `<script>
1867
- ((d,c,n) => {
1868
- d=d.getElementById('E:${index}')
1869
- if(!d)return
1870
- n=d.nextSibling
1871
- while(n.nodeType!=8||n.nodeValue!='E:${index}'){n=n.nextSibling}
1872
- n.remove()
1873
- d.remove()
1874
- })(document)
1875
- <\/script>`), content2.callbacks);
1876
- }).catch((error2) => catchCallback({
1877
- error: error2,
1878
- buffer
1879
- })));
1880
- return raw(html, promises);
1881
- }).catch((error2) => catchCallback({
1882
- error: error2,
1883
- buffer
1884
- }));
1885
- }]);
1886
- } else return Fragment$1({ children: resArray });
1887
- };
1888
- ErrorBoundary[DOM_RENDERER] = ErrorBoundary$1;
1889
- //#endregion
1890
- //#region ../../node_modules/.pnpm/hono@4.13.3/node_modules/hono/dist/middleware/jsx-renderer/index.js
1891
- var RequestContext = createContext(null);
1892
- var createRenderer = (c, Layout, component, options) => (children, props) => {
1893
- options = typeof options === "function" ? options(c) : options;
1894
- const docType = typeof options?.docType === "string" ? options.docType : options?.docType === false ? "" : "<!DOCTYPE html>";
1895
- const currentLayout = component ? jsx((props2) => component(props2, c), {
1896
- Layout,
1897
- ...props
1898
- }, children) : children;
1899
- const body = html`${raw(docType)}${jsx(RequestContext.Provider, { value: c }, currentLayout)}`;
1900
- if (options?.stream) {
1901
- if (options.stream === true) {
1902
- c.header("Transfer-Encoding", "chunked");
1903
- c.header("Content-Type", "text/html; charset=UTF-8");
1904
- c.header("Content-Encoding", "Identity");
1905
- } else for (const [key, value] of Object.entries(options.stream)) c.header(key, value);
1906
- return c.body(renderToReadableStream(body));
1907
- } else return c.html(body);
1908
- };
1909
- var jsxRenderer = (component, options) => function jsxRenderer2(c, next) {
1910
- const Layout = c.getLayout() ?? Fragment$1;
1911
- if (component) c.setLayout((props) => {
1912
- return component({
1913
- ...props,
1914
- Layout
1915
- }, c);
1916
- });
1917
- c.setRenderer(createRenderer(c, Layout, component, options));
1918
- return next();
1919
- };
1920
- var useRequestContext = () => {
1921
- const c = useContext(RequestContext);
1922
- if (!c) throw new Error("RequestContext is not provided.");
1923
- return c;
1924
- };
1925
- //#endregion
1926
- export { useState as a, HtmlEscapedCallbackPhase as c, useRef as i, resolveCallback as l, useRequestContext as n, jsxDEV$1 as o, useEffect as r, Fragment$1 as s, jsxRenderer as t, __exportAll as u };