@noya-app/noya-multiplayer-react 0.1.49 → 0.1.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,3 +1,913 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+
31
+ // ../../node_modules/tree-visit/lib/access.js
32
+ var require_access = __commonJS({
33
+ "../../node_modules/tree-visit/lib/access.js"(exports) {
34
+ "use strict";
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.accessPath = exports.access = void 0;
37
+ function access(node, indexPath, options) {
38
+ if (options.includeTraversalContext) {
39
+ const accessed = accessPath(node, indexPath, options);
40
+ return accessed[accessed.length - 1];
41
+ }
42
+ let path = indexPath.slice();
43
+ while (path.length > 0) {
44
+ let index = path.shift();
45
+ node = options.getChildren(node, path)[index];
46
+ }
47
+ return node;
48
+ }
49
+ exports.access = access;
50
+ function accessPath(node, indexPath, options) {
51
+ let path = indexPath.slice();
52
+ let result = [node];
53
+ while (path.length > 0) {
54
+ let index = path.shift();
55
+ const context = options.includeTraversalContext ? {
56
+ getRoot: () => result[0],
57
+ getParent: () => result[result.length - 2],
58
+ getAncestors: () => result.slice(0, -1)
59
+ } : void 0;
60
+ node = options.getChildren(node, path, context)[index];
61
+ result.push(node);
62
+ }
63
+ return result;
64
+ }
65
+ exports.accessPath = accessPath;
66
+ }
67
+ });
68
+
69
+ // ../../node_modules/tree-visit/lib/sort.js
70
+ var require_sort = __commonJS({
71
+ "../../node_modules/tree-visit/lib/sort.js"(exports) {
72
+ "use strict";
73
+ Object.defineProperty(exports, "__esModule", { value: true });
74
+ exports.sortIndexPaths = exports.compareIndexPaths = void 0;
75
+ function compareIndexPaths(a, b) {
76
+ for (let i = 0; i < Math.min(a.length, b.length); i++) {
77
+ if (a[i] < b[i])
78
+ return -1;
79
+ if (a[i] > b[i])
80
+ return 1;
81
+ }
82
+ return a.length - b.length;
83
+ }
84
+ exports.compareIndexPaths = compareIndexPaths;
85
+ function sortIndexPaths(indexPaths) {
86
+ return indexPaths.sort(compareIndexPaths);
87
+ }
88
+ exports.sortIndexPaths = sortIndexPaths;
89
+ }
90
+ });
91
+
92
+ // ../../node_modules/tree-visit/lib/ancestors.js
93
+ var require_ancestors = __commonJS({
94
+ "../../node_modules/tree-visit/lib/ancestors.js"(exports) {
95
+ "use strict";
96
+ Object.defineProperty(exports, "__esModule", { value: true });
97
+ exports.ancestorIndexPaths = void 0;
98
+ var sort_1 = require_sort();
99
+ function ancestorIndexPaths(indexPaths) {
100
+ const paths = /* @__PURE__ */ new Map();
101
+ const sortedIndexPaths = (0, sort_1.sortIndexPaths)(indexPaths);
102
+ for (const indexPath of sortedIndexPaths) {
103
+ const foundParent = indexPath.some((_, index) => {
104
+ const parentKey = indexPath.slice(0, index).join();
105
+ return paths.has(parentKey);
106
+ });
107
+ if (foundParent)
108
+ continue;
109
+ paths.set(indexPath.join(), indexPath);
110
+ }
111
+ return Array.from(paths.values());
112
+ }
113
+ exports.ancestorIndexPaths = ancestorIndexPaths;
114
+ }
115
+ });
116
+
117
+ // ../../node_modules/tree-visit/lib/diagram/boxDiagram.js
118
+ var require_boxDiagram = __commonJS({
119
+ "../../node_modules/tree-visit/lib/diagram/boxDiagram.js"(exports) {
120
+ "use strict";
121
+ Object.defineProperty(exports, "__esModule", { value: true });
122
+ exports.boxDiagram = void 0;
123
+ var BoxDrawing;
124
+ (function(BoxDrawing2) {
125
+ BoxDrawing2["TopLeft"] = "\u250C";
126
+ BoxDrawing2["TopRight"] = "\u2510";
127
+ BoxDrawing2["BottomLeft"] = "\u2514";
128
+ BoxDrawing2["BottomRight"] = "\u2518";
129
+ BoxDrawing2["Horizontal"] = "\u2500";
130
+ BoxDrawing2["Vertical"] = "\u2502";
131
+ BoxDrawing2["BottomConnectorDown"] = "\u252C";
132
+ BoxDrawing2["BottomConnectorUp"] = "\u2534";
133
+ BoxDrawing2["TopConnectorUp"] = "\u2534";
134
+ })(BoxDrawing || (BoxDrawing = {}));
135
+ function wrapLabelInBox(label) {
136
+ const lines = label.split("\n");
137
+ const length = Math.max(...lines.map((line) => line.length));
138
+ const horizontalMargin = 1;
139
+ const width = length + horizontalMargin * 2 + 2;
140
+ const height = 2 + lines.length;
141
+ const diagram = [
142
+ [
143
+ BoxDrawing.TopLeft,
144
+ BoxDrawing.Horizontal.repeat(length + horizontalMargin * 2),
145
+ BoxDrawing.TopRight
146
+ ],
147
+ ...lines.map((line) => [
148
+ BoxDrawing.Vertical,
149
+ " ".repeat(horizontalMargin),
150
+ line + (line.length < length ? " ".repeat(length - line.length) : ""),
151
+ " ".repeat(horizontalMargin),
152
+ BoxDrawing.Vertical
153
+ ]),
154
+ [
155
+ BoxDrawing.BottomLeft,
156
+ BoxDrawing.Horizontal.repeat(length + horizontalMargin * 2),
157
+ BoxDrawing.BottomRight
158
+ ]
159
+ ];
160
+ return {
161
+ width,
162
+ height,
163
+ contents: diagram.map((parts) => parts.join(""))
164
+ };
165
+ }
166
+ function mergeBoxesHorizontal(boxes) {
167
+ const horizontalMargin = 1;
168
+ if (boxes.length === 0) {
169
+ throw new Error("Can't merge empty array of boxes");
170
+ }
171
+ return boxes.slice(1).reduce((result, box) => {
172
+ const height = Math.max(result.height, box.height);
173
+ const width = result.width + horizontalMargin + box.width;
174
+ const contents = [];
175
+ for (let i = 0; i < height; i++) {
176
+ contents.push((result.contents[i] || " ".repeat(result.width)) + " ".repeat(horizontalMargin) + (box.contents[i] || " ".repeat(box.width)));
177
+ }
178
+ return { height, width, contents: centerBlock(contents, width) };
179
+ }, boxes[0]);
180
+ }
181
+ function mergeBoxesVertical(boxes) {
182
+ const verticalMargin = 1;
183
+ if (boxes.length === 0) {
184
+ throw new Error("Can't merge empty array of boxes");
185
+ }
186
+ const width = Math.max(...boxes.map((box) => box.width));
187
+ return boxes.slice(1).reduce((result, box) => {
188
+ const height = result.height + verticalMargin + box.height;
189
+ const contents = [];
190
+ for (let i = 0; i < height; i++) {
191
+ if (i < result.height) {
192
+ contents.push(result.contents[i]);
193
+ } else if (i === result.height) {
194
+ contents.push(" ".repeat(width));
195
+ } else {
196
+ contents.push(box.contents[i - result.height - 1]);
197
+ }
198
+ }
199
+ return { height, width, contents: centerBlock(contents, width) };
200
+ }, boxes[0]);
201
+ }
202
+ function nodeDiagram(node, indexPath, options) {
203
+ const label = options.getLabel(node, indexPath);
204
+ const box = wrapLabelInBox(label);
205
+ const children = options.getChildren(node, indexPath);
206
+ if (children.length === 0)
207
+ return box;
208
+ const childBoxes = children.map((child, index) => {
209
+ const childBox = nodeDiagram(child, [...indexPath, index], options);
210
+ childBox.contents[0] = insertSubstring(childBox.contents[0], centerIndex(childBox.contents[0].length), BoxDrawing.TopConnectorUp);
211
+ return childBox;
212
+ });
213
+ const result = mergeBoxesVertical([box, mergeBoxesHorizontal(childBoxes)]);
214
+ const contents = result.contents;
215
+ const mid = centerIndex(result.width);
216
+ contents[box.height - 1] = insertSubstring(contents[box.height - 1], mid, BoxDrawing.BottomConnectorDown);
217
+ let min = contents[box.height + 1].indexOf(BoxDrawing.TopConnectorUp);
218
+ let max = contents[box.height + 1].lastIndexOf(BoxDrawing.TopConnectorUp);
219
+ for (let i = min; i <= max; i++) {
220
+ let character;
221
+ if (i === mid) {
222
+ character = childBoxes.length > 1 ? BoxDrawing.BottomConnectorUp : BoxDrawing.Vertical;
223
+ } else if (i === min) {
224
+ character = BoxDrawing.TopLeft;
225
+ } else if (i === max) {
226
+ character = BoxDrawing.TopRight;
227
+ } else {
228
+ character = BoxDrawing.Horizontal;
229
+ }
230
+ result.contents[box.height] = insertSubstring(result.contents[box.height], i, character);
231
+ }
232
+ return result;
233
+ }
234
+ function boxDiagram(node, options) {
235
+ return nodeDiagram(node, [], options).contents.join("\n");
236
+ }
237
+ exports.boxDiagram = boxDiagram;
238
+ function centerIndex(width) {
239
+ return Math.floor(width / 2);
240
+ }
241
+ function centerLine(line, width) {
242
+ const remainder = width - line.length;
243
+ if (remainder <= 0)
244
+ return line;
245
+ const prefixLength = centerIndex(remainder);
246
+ const suffixLength = centerIndex(remainder);
247
+ const result = " ".repeat(prefixLength) + line + " ".repeat(suffixLength);
248
+ return prefixLength + suffixLength + result.length < width ? result + " " : result;
249
+ }
250
+ function centerBlock(lines, width) {
251
+ return lines.map((line) => centerLine(line, width));
252
+ }
253
+ function insertSubstring(string, index, substring) {
254
+ if (index > string.length - 1)
255
+ return string;
256
+ return string.substring(0, index) + substring + string.substring(index + 1);
257
+ }
258
+ }
259
+ });
260
+
261
+ // ../../node_modules/tree-visit/lib/diagram/directoryDiagram.js
262
+ var require_directoryDiagram = __commonJS({
263
+ "../../node_modules/tree-visit/lib/diagram/directoryDiagram.js"(exports) {
264
+ "use strict";
265
+ Object.defineProperty(exports, "__esModule", { value: true });
266
+ exports.prefixBlock = exports.isMultiline = exports.directoryDiagram = void 0;
267
+ var LinePrefix;
268
+ (function(LinePrefix2) {
269
+ LinePrefix2["Child"] = "\u251C\u2500\u2500 ";
270
+ LinePrefix2["LastChild"] = "\u2514\u2500\u2500 ";
271
+ LinePrefix2["NestedChild"] = "\u2502 ";
272
+ LinePrefix2["LastNestedChild"] = " ";
273
+ })(LinePrefix || (LinePrefix = {}));
274
+ function nodeDiagram(node, indexPath, options) {
275
+ const label = options.getLabel(node, indexPath);
276
+ const depth = indexPath.length;
277
+ let rootLine = { label, depth, prefix: "", multilinePrefix: "" };
278
+ const children = options.getChildren(node, indexPath);
279
+ if (children.length === 0)
280
+ return [rootLine];
281
+ if (options.flattenSingleChildNodes && children.length === 1 && !isMultiline(label)) {
282
+ const [line] = nodeDiagram(children[0], [...indexPath, 0], options);
283
+ const hideRoot = indexPath.length === 0 && label === "";
284
+ rootLine.label = hideRoot ? `/ ${line.label}` : `${rootLine.label} / ${line.label}`;
285
+ return [rootLine];
286
+ }
287
+ const nestedLines = children.flatMap((file, index, array) => {
288
+ const childIsLast = index === array.length - 1;
289
+ const childLines = nodeDiagram(file, [...indexPath, index], options);
290
+ const childPrefix = childIsLast ? LinePrefix.LastChild : LinePrefix.Child;
291
+ const childMultilinePrefix = childIsLast ? LinePrefix.LastNestedChild : LinePrefix.NestedChild;
292
+ childLines.forEach((line) => {
293
+ if (line.depth === depth + 1) {
294
+ line.prefix = childPrefix + line.prefix;
295
+ line.multilinePrefix = childMultilinePrefix + line.multilinePrefix;
296
+ } else if (childIsLast) {
297
+ line.prefix = LinePrefix.LastNestedChild + line.prefix;
298
+ line.multilinePrefix = LinePrefix.LastNestedChild + line.multilinePrefix;
299
+ } else {
300
+ line.prefix = LinePrefix.NestedChild + line.prefix;
301
+ line.multilinePrefix = LinePrefix.NestedChild + line.multilinePrefix;
302
+ }
303
+ });
304
+ return childLines;
305
+ });
306
+ return [rootLine, ...nestedLines];
307
+ }
308
+ function directoryDiagram(node, options) {
309
+ const lines = nodeDiagram(node, [], options);
310
+ const strings = lines.map((line) => prefixBlock(line.label, line.prefix, line.multilinePrefix));
311
+ return strings.join("\n");
312
+ }
313
+ exports.directoryDiagram = directoryDiagram;
314
+ function isMultiline(line) {
315
+ return line.includes("\n");
316
+ }
317
+ exports.isMultiline = isMultiline;
318
+ function prefixBlock(block, prefix, multilinePrefix) {
319
+ if (!isMultiline(block))
320
+ return prefix + block;
321
+ return block.split("\n").map((line, index) => (index === 0 ? prefix : multilinePrefix) + line).join("\n");
322
+ }
323
+ exports.prefixBlock = prefixBlock;
324
+ }
325
+ });
326
+
327
+ // ../../node_modules/tree-visit/lib/diagram.js
328
+ var require_diagram = __commonJS({
329
+ "../../node_modules/tree-visit/lib/diagram.js"(exports) {
330
+ "use strict";
331
+ Object.defineProperty(exports, "__esModule", { value: true });
332
+ exports.diagram = void 0;
333
+ var boxDiagram_1 = require_boxDiagram();
334
+ var directoryDiagram_1 = require_directoryDiagram();
335
+ function diagram(node, options) {
336
+ if (options.type === "box") {
337
+ return (0, boxDiagram_1.boxDiagram)(node, options);
338
+ }
339
+ return (0, directoryDiagram_1.directoryDiagram)(node, options);
340
+ }
341
+ exports.diagram = diagram;
342
+ }
343
+ });
344
+
345
+ // ../../node_modules/tree-visit/lib/visit.js
346
+ var require_visit = __commonJS({
347
+ "../../node_modules/tree-visit/lib/visit.js"(exports) {
348
+ "use strict";
349
+ Object.defineProperty(exports, "__esModule", { value: true });
350
+ exports.visit = exports.STOP = exports.SKIP = void 0;
351
+ exports.SKIP = "skip";
352
+ exports.STOP = "stop";
353
+ function visit(node, options) {
354
+ const { onEnter, onLeave, getChildren, onDetectCycle, getIdentifier } = options;
355
+ let indexPath = [];
356
+ let stack = [{ node }];
357
+ const visited = onDetectCycle ? /* @__PURE__ */ new Set() : void 0;
358
+ const context = options.includeTraversalContext ? {
359
+ getRoot() {
360
+ return node;
361
+ },
362
+ getParent() {
363
+ var _a;
364
+ return (_a = stack[stack.length - 2]) === null || _a === void 0 ? void 0 : _a.node;
365
+ },
366
+ getAncestors() {
367
+ return stack.slice(0, -1).map((wrapper) => wrapper.node);
368
+ }
369
+ } : void 0;
370
+ const getIndexPath = options.reuseIndexPath ? () => indexPath : () => indexPath.slice();
371
+ while (stack.length > 0) {
372
+ let wrapper = stack[stack.length - 1];
373
+ if (wrapper.state === void 0) {
374
+ if (visited) {
375
+ const id = getIdentifier ? getIdentifier(wrapper.node) : wrapper.node;
376
+ if (visited.has(id)) {
377
+ const action = typeof onDetectCycle === "function" ? onDetectCycle(wrapper.node, getIndexPath(), context) : onDetectCycle;
378
+ if (action === "error") {
379
+ throw new Error("Cycle detected in tree");
380
+ } else {
381
+ wrapper.state = -1;
382
+ continue;
383
+ }
384
+ }
385
+ visited.add(id);
386
+ }
387
+ const enterResult = onEnter === null || onEnter === void 0 ? void 0 : onEnter(wrapper.node, getIndexPath());
388
+ if (enterResult === exports.STOP)
389
+ return;
390
+ wrapper.state = enterResult === exports.SKIP ? -1 : 0;
391
+ }
392
+ const children = wrapper.children || getChildren(wrapper.node, getIndexPath(), context);
393
+ if (!wrapper.children) {
394
+ wrapper.children = children;
395
+ }
396
+ if (wrapper.state !== -1) {
397
+ if (wrapper.state < children.length) {
398
+ let currentIndex = wrapper.state;
399
+ indexPath.push(currentIndex);
400
+ stack.push({ node: children[currentIndex] });
401
+ wrapper.state = currentIndex + 1;
402
+ continue;
403
+ }
404
+ const leaveResult = onLeave === null || onLeave === void 0 ? void 0 : onLeave(wrapper.node, getIndexPath());
405
+ if (leaveResult === exports.STOP)
406
+ return;
407
+ }
408
+ if (visited) {
409
+ const id = getIdentifier ? getIdentifier(wrapper.node) : wrapper.node;
410
+ visited.delete(id);
411
+ }
412
+ indexPath.pop();
413
+ stack.pop();
414
+ }
415
+ }
416
+ exports.visit = visit;
417
+ }
418
+ });
419
+
420
+ // ../../node_modules/tree-visit/lib/find.js
421
+ var require_find = __commonJS({
422
+ "../../node_modules/tree-visit/lib/find.js"(exports) {
423
+ "use strict";
424
+ Object.defineProperty(exports, "__esModule", { value: true });
425
+ exports.findAllIndexPaths = exports.findIndexPath = exports.findAll = exports.find = void 0;
426
+ var visit_1 = require_visit();
427
+ function find(node, options) {
428
+ let found;
429
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onEnter: (child, indexPath) => {
430
+ if (options.predicate(child, indexPath)) {
431
+ found = child;
432
+ return visit_1.STOP;
433
+ }
434
+ } }));
435
+ return found;
436
+ }
437
+ exports.find = find;
438
+ function findAll(node, options) {
439
+ let found = [];
440
+ (0, visit_1.visit)(node, {
441
+ onEnter: (child, indexPath) => {
442
+ if (options.predicate(child, indexPath)) {
443
+ found.push(child);
444
+ }
445
+ },
446
+ getChildren: options.getChildren
447
+ });
448
+ return found;
449
+ }
450
+ exports.findAll = findAll;
451
+ function findIndexPath(node, options) {
452
+ let found;
453
+ (0, visit_1.visit)(node, {
454
+ onEnter: (child, indexPath) => {
455
+ if (options.predicate(child, indexPath)) {
456
+ found = [...indexPath];
457
+ return visit_1.STOP;
458
+ }
459
+ },
460
+ getChildren: options.getChildren
461
+ });
462
+ return found;
463
+ }
464
+ exports.findIndexPath = findIndexPath;
465
+ function findAllIndexPaths(node, options) {
466
+ let found = [];
467
+ (0, visit_1.visit)(node, {
468
+ onEnter: (child, indexPath) => {
469
+ if (options.predicate(child, indexPath)) {
470
+ found.push([...indexPath]);
471
+ }
472
+ },
473
+ getChildren: options.getChildren
474
+ });
475
+ return found;
476
+ }
477
+ exports.findAllIndexPaths = findAllIndexPaths;
478
+ }
479
+ });
480
+
481
+ // ../../node_modules/tree-visit/lib/reduce.js
482
+ var require_reduce = __commonJS({
483
+ "../../node_modules/tree-visit/lib/reduce.js"(exports) {
484
+ "use strict";
485
+ Object.defineProperty(exports, "__esModule", { value: true });
486
+ exports.reduce = void 0;
487
+ var visit_1 = require_visit();
488
+ function reduce(node, options) {
489
+ let result = options.initialResult;
490
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onEnter: (child, indexPath) => {
491
+ result = options.nextResult(result, child, indexPath);
492
+ } }));
493
+ return result;
494
+ }
495
+ exports.reduce = reduce;
496
+ }
497
+ });
498
+
499
+ // ../../node_modules/tree-visit/lib/flat.js
500
+ var require_flat = __commonJS({
501
+ "../../node_modules/tree-visit/lib/flat.js"(exports) {
502
+ "use strict";
503
+ Object.defineProperty(exports, "__esModule", { value: true });
504
+ exports.flat = void 0;
505
+ var reduce_1 = require_reduce();
506
+ function flat(node, options) {
507
+ return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child) => {
508
+ result.push(child);
509
+ return result;
510
+ } }));
511
+ }
512
+ exports.flat = flat;
513
+ }
514
+ });
515
+
516
+ // ../../node_modules/tree-visit/lib/flatMap.js
517
+ var require_flatMap = __commonJS({
518
+ "../../node_modules/tree-visit/lib/flatMap.js"(exports) {
519
+ "use strict";
520
+ Object.defineProperty(exports, "__esModule", { value: true });
521
+ exports.flatMap = void 0;
522
+ var reduce_1 = require_reduce();
523
+ function flatMap(node, options) {
524
+ return (0, reduce_1.reduce)(node, Object.assign(Object.assign({}, options), { initialResult: [], nextResult: (result, child, indexPath) => {
525
+ result.push(...options.transform(child, indexPath));
526
+ return result;
527
+ } }));
528
+ }
529
+ exports.flatMap = flatMap;
530
+ }
531
+ });
532
+
533
+ // ../../node_modules/tree-visit/lib/map.js
534
+ var require_map = __commonJS({
535
+ "../../node_modules/tree-visit/lib/map.js"(exports) {
536
+ "use strict";
537
+ Object.defineProperty(exports, "__esModule", { value: true });
538
+ exports.map = void 0;
539
+ var visit_1 = require_visit();
540
+ function map3(node, options) {
541
+ const childrenMap = {};
542
+ (0, visit_1.visit)(node, Object.assign(Object.assign({}, options), { onLeave: (child, indexPath) => {
543
+ var _a, _b;
544
+ const keyIndexPath = [0, ...indexPath];
545
+ const key = keyIndexPath.join();
546
+ const transformed = options.transform(child, (_a = childrenMap[key]) !== null && _a !== void 0 ? _a : [], indexPath);
547
+ const parentKey = keyIndexPath.slice(0, -1).join();
548
+ const parentChildren = (_b = childrenMap[parentKey]) !== null && _b !== void 0 ? _b : [];
549
+ parentChildren.push(transformed);
550
+ childrenMap[parentKey] = parentChildren;
551
+ } }));
552
+ return childrenMap[""][0];
553
+ }
554
+ exports.map = map3;
555
+ }
556
+ });
557
+
558
+ // ../../node_modules/tree-visit/lib/operation.js
559
+ var require_operation = __commonJS({
560
+ "../../node_modules/tree-visit/lib/operation.js"(exports) {
561
+ "use strict";
562
+ Object.defineProperty(exports, "__esModule", { value: true });
563
+ exports.splice = exports.applyOperations = exports.getReplaceOperations = exports.getRemovalOperations = exports.getInsertionOperations = exports.replaceOperation = exports.removeOperation = exports.insertOperation = void 0;
564
+ var ancestors_1 = require_ancestors();
565
+ var map_1 = require_map();
566
+ function insertOperation(index, nodes) {
567
+ return {
568
+ type: "insert",
569
+ index,
570
+ nodes
571
+ };
572
+ }
573
+ exports.insertOperation = insertOperation;
574
+ function removeOperation(indexes) {
575
+ return {
576
+ type: "remove",
577
+ indexes
578
+ };
579
+ }
580
+ exports.removeOperation = removeOperation;
581
+ function replaceOperation() {
582
+ return {
583
+ type: "replace"
584
+ };
585
+ }
586
+ exports.replaceOperation = replaceOperation;
587
+ function splitIndexPath(indexPath) {
588
+ return [indexPath.slice(0, -1), indexPath[indexPath.length - 1]];
589
+ }
590
+ function getInsertionOperations(indexPath, nodes, operations = /* @__PURE__ */ new Map()) {
591
+ var _a;
592
+ const [parentIndexPath, index] = splitIndexPath(indexPath);
593
+ for (let i = parentIndexPath.length - 1; i >= 0; i--) {
594
+ const parentKey = parentIndexPath.slice(0, i).join();
595
+ switch ((_a = operations.get(parentKey)) === null || _a === void 0 ? void 0 : _a.type) {
596
+ case "remove":
597
+ continue;
598
+ }
599
+ operations.set(parentKey, replaceOperation());
600
+ }
601
+ const operation = operations.get(parentIndexPath.join());
602
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
603
+ case "remove":
604
+ operations.set(parentIndexPath.join(), {
605
+ type: "removeThenInsert",
606
+ removeIndexes: operation.indexes,
607
+ insertIndex: index,
608
+ insertNodes: nodes
609
+ });
610
+ break;
611
+ default:
612
+ operations.set(parentIndexPath.join(), insertOperation(index, nodes));
613
+ }
614
+ return operations;
615
+ }
616
+ exports.getInsertionOperations = getInsertionOperations;
617
+ function getRemovalOperations(indexPaths) {
618
+ var _a, _b;
619
+ const _ancestorIndexPaths = (0, ancestors_1.ancestorIndexPaths)(indexPaths);
620
+ const indexesToRemove = /* @__PURE__ */ new Map();
621
+ for (const indexPath of _ancestorIndexPaths) {
622
+ const parentKey = indexPath.slice(0, -1).join();
623
+ const value = (_a = indexesToRemove.get(parentKey)) !== null && _a !== void 0 ? _a : [];
624
+ value.push(indexPath[indexPath.length - 1]);
625
+ indexesToRemove.set(parentKey, value);
626
+ }
627
+ const operations = /* @__PURE__ */ new Map();
628
+ for (const indexPath of _ancestorIndexPaths) {
629
+ for (let i = indexPath.length - 1; i >= 0; i--) {
630
+ const parentKey = indexPath.slice(0, i).join();
631
+ operations.set(parentKey, replaceOperation());
632
+ }
633
+ }
634
+ for (const indexPath of _ancestorIndexPaths) {
635
+ const parentKey = indexPath.slice(0, -1).join();
636
+ operations.set(parentKey, removeOperation((_b = indexesToRemove.get(parentKey)) !== null && _b !== void 0 ? _b : []));
637
+ }
638
+ return operations;
639
+ }
640
+ exports.getRemovalOperations = getRemovalOperations;
641
+ function getReplaceOperations(indexPath, node) {
642
+ const operations = /* @__PURE__ */ new Map();
643
+ const [parentIndexPath, index] = splitIndexPath(indexPath);
644
+ for (let i = parentIndexPath.length - 1; i >= 0; i--) {
645
+ const parentKey = parentIndexPath.slice(0, i).join();
646
+ operations.set(parentKey, replaceOperation());
647
+ }
648
+ operations.set(parentIndexPath.join(), {
649
+ type: "removeThenInsert",
650
+ removeIndexes: [index],
651
+ insertIndex: index,
652
+ insertNodes: [node]
653
+ });
654
+ return operations;
655
+ }
656
+ exports.getReplaceOperations = getReplaceOperations;
657
+ function applyOperations(node, operations, options) {
658
+ return (0, map_1.map)(node, Object.assign(Object.assign({}, options), {
659
+ // Avoid calling `getChildren` for every node in the tree.
660
+ // Return [] if we're just going to return the original node anyway.
661
+ getChildren: (node2, indexPath) => {
662
+ const key = indexPath.join();
663
+ const operation = operations.get(key);
664
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
665
+ case "replace":
666
+ case "remove":
667
+ case "removeThenInsert":
668
+ case "insert":
669
+ return options.getChildren(node2, indexPath);
670
+ default:
671
+ return [];
672
+ }
673
+ },
674
+ transform: (node2, children, indexPath) => {
675
+ const key = indexPath.join();
676
+ const operation = operations.get(key);
677
+ switch (operation === null || operation === void 0 ? void 0 : operation.type) {
678
+ case "remove":
679
+ return options.create(node2, children.filter((_, index) => !operation.indexes.includes(index)), indexPath);
680
+ case "removeThenInsert":
681
+ const updatedChildren = children.filter((_, index) => !operation.removeIndexes.includes(index));
682
+ const adjustedIndex = operation.removeIndexes.reduce((index, removedIndex) => removedIndex < index ? index - 1 : index, operation.insertIndex);
683
+ return options.create(node2, splice(updatedChildren, adjustedIndex, 0, ...operation.insertNodes), indexPath);
684
+ case "insert":
685
+ return options.create(node2, splice(children, operation.index, 0, ...operation.nodes), indexPath);
686
+ case "replace":
687
+ return options.create(node2, children, indexPath);
688
+ default:
689
+ return node2;
690
+ }
691
+ }
692
+ }));
693
+ }
694
+ exports.applyOperations = applyOperations;
695
+ function splice(array, start, deleteCount, ...items) {
696
+ return [
697
+ ...array.slice(0, start),
698
+ ...items,
699
+ ...array.slice(start + deleteCount)
700
+ ];
701
+ }
702
+ exports.splice = splice;
703
+ }
704
+ });
705
+
706
+ // ../../node_modules/tree-visit/lib/insert.js
707
+ var require_insert = __commonJS({
708
+ "../../node_modules/tree-visit/lib/insert.js"(exports) {
709
+ "use strict";
710
+ Object.defineProperty(exports, "__esModule", { value: true });
711
+ exports.insert = void 0;
712
+ var operation_1 = require_operation();
713
+ function insert(node, options) {
714
+ const { nodes, at } = options;
715
+ if (at.length === 0) {
716
+ throw new Error(`Can't insert nodes at the root`);
717
+ }
718
+ const state = (0, operation_1.getInsertionOperations)(at, nodes);
719
+ return (0, operation_1.applyOperations)(node, state, options);
720
+ }
721
+ exports.insert = insert;
722
+ }
723
+ });
724
+
725
+ // ../../node_modules/tree-visit/lib/move.js
726
+ var require_move = __commonJS({
727
+ "../../node_modules/tree-visit/lib/move.js"(exports) {
728
+ "use strict";
729
+ Object.defineProperty(exports, "__esModule", { value: true });
730
+ exports.move = void 0;
731
+ var access_1 = require_access();
732
+ var ancestors_1 = require_ancestors();
733
+ var operation_1 = require_operation();
734
+ function move(node, options) {
735
+ if (options.indexPaths.length === 0)
736
+ return node;
737
+ for (const indexPath of options.indexPaths) {
738
+ if (indexPath.length === 0) {
739
+ throw new Error(`Can't move the root node`);
740
+ }
741
+ }
742
+ if (options.to.length === 0) {
743
+ throw new Error(`Can't move nodes to the root`);
744
+ }
745
+ const _ancestorIndexPaths = (0, ancestors_1.ancestorIndexPaths)(options.indexPaths);
746
+ const nodesToInsert = _ancestorIndexPaths.map((indexPath) => (0, access_1.access)(node, indexPath, options));
747
+ const operations = (0, operation_1.getInsertionOperations)(options.to, nodesToInsert, (0, operation_1.getRemovalOperations)(_ancestorIndexPaths));
748
+ return (0, operation_1.applyOperations)(node, operations, options);
749
+ }
750
+ exports.move = move;
751
+ }
752
+ });
753
+
754
+ // ../../node_modules/tree-visit/lib/remove.js
755
+ var require_remove = __commonJS({
756
+ "../../node_modules/tree-visit/lib/remove.js"(exports) {
757
+ "use strict";
758
+ Object.defineProperty(exports, "__esModule", { value: true });
759
+ exports.remove = void 0;
760
+ var operation_1 = require_operation();
761
+ function remove(node, options) {
762
+ if (options.indexPaths.length === 0)
763
+ return node;
764
+ for (const indexPath of options.indexPaths) {
765
+ if (indexPath.length === 0) {
766
+ throw new Error(`Can't remove the root node`);
767
+ }
768
+ }
769
+ const operations = (0, operation_1.getRemovalOperations)(options.indexPaths);
770
+ return (0, operation_1.applyOperations)(node, operations, options);
771
+ }
772
+ exports.remove = remove;
773
+ }
774
+ });
775
+
776
+ // ../../node_modules/tree-visit/lib/replace.js
777
+ var require_replace = __commonJS({
778
+ "../../node_modules/tree-visit/lib/replace.js"(exports) {
779
+ "use strict";
780
+ Object.defineProperty(exports, "__esModule", { value: true });
781
+ exports.replace = void 0;
782
+ var operation_1 = require_operation();
783
+ function replace(node, options) {
784
+ if (options.at.length === 0)
785
+ return options.node;
786
+ const operations = (0, operation_1.getReplaceOperations)(options.at, options.node);
787
+ return (0, operation_1.applyOperations)(node, operations, options);
788
+ }
789
+ exports.replace = replace;
790
+ }
791
+ });
792
+
793
+ // ../../node_modules/tree-visit/lib/defineTree.js
794
+ var require_defineTree = __commonJS({
795
+ "../../node_modules/tree-visit/lib/defineTree.js"(exports) {
796
+ "use strict";
797
+ Object.defineProperty(exports, "__esModule", { value: true });
798
+ exports.defineTree = void 0;
799
+ var access_1 = require_access();
800
+ var diagram_1 = require_diagram();
801
+ var find_1 = require_find();
802
+ var flat_1 = require_flat();
803
+ var flatMap_1 = require_flatMap();
804
+ var insert_1 = require_insert();
805
+ var map_1 = require_map();
806
+ var move_1 = require_move();
807
+ var reduce_1 = require_reduce();
808
+ var remove_1 = require_remove();
809
+ var replace_1 = require_replace();
810
+ var visit_1 = require_visit();
811
+ var Tree = class _Tree {
812
+ constructor(getChildrenOrBaseOptions, appliedOptions) {
813
+ this.appliedOptions = appliedOptions;
814
+ this.getChildren = (node, indexPath, context) => {
815
+ return this._getChildren(node, indexPath, context);
816
+ };
817
+ this.mergeOptions = (options) => Object.assign(Object.assign(Object.assign({}, this.baseOptions), this.appliedOptions), options);
818
+ this.withOptions = (newOptions) => new _Tree(this.baseOptions, Object.assign(Object.assign({}, this.appliedOptions), newOptions));
819
+ this.access = (node, indexPath) => (0, access_1.access)(node, indexPath, this.mergeOptions({}));
820
+ this.accessPath = (node, indexPath) => (0, access_1.accessPath)(node, indexPath, this.mergeOptions({}));
821
+ this.diagram = (node, options) => typeof options === "function" ? (0, diagram_1.diagram)(node, this.mergeOptions({ getLabel: options })) : (0, diagram_1.diagram)(node, this.mergeOptions(options));
822
+ this.find = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.find)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.find)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
823
+ this.findAll = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAll)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAll)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
824
+ this.findIndexPath = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findIndexPath)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findIndexPath)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
825
+ this.findAllIndexPaths = (node, predicateOrOptions) => typeof predicateOrOptions === "function" ? (0, find_1.findAllIndexPaths)(node, this.mergeOptions({ predicate: predicateOrOptions })) : (0, find_1.findAllIndexPaths)(node, this.mergeOptions(Object.assign({}, predicateOrOptions)));
826
+ this.flat = (node) => (0, flat_1.flat)(node, this.mergeOptions({}));
827
+ this.flatMap = (node, transform) => (0, flatMap_1.flatMap)(node, this.mergeOptions({ transform }));
828
+ this.reduce = (node, nextResult, initialResult) => (0, reduce_1.reduce)(node, this.mergeOptions({ nextResult, initialResult }));
829
+ this.map = (node, transform) => (0, map_1.map)(node, this.mergeOptions({ transform }));
830
+ this.visit = (node, onEnterOrOptions) => typeof onEnterOrOptions === "function" ? (0, visit_1.visit)(node, this.mergeOptions({ onEnter: onEnterOrOptions })) : (0, visit_1.visit)(node, this.mergeOptions(Object.assign({}, onEnterOrOptions)));
831
+ this.insert = (node, options) => (0, insert_1.insert)(node, this.mergeOptions(options));
832
+ this.remove = (node, options) => (0, remove_1.remove)(node, this.mergeOptions(options));
833
+ this.move = (node, options) => (0, move_1.move)(node, this.mergeOptions(options));
834
+ this.replace = (node, options) => (0, replace_1.replace)(node, this.mergeOptions(options));
835
+ this.baseOptions = typeof getChildrenOrBaseOptions === "function" ? { getChildren: getChildrenOrBaseOptions } : getChildrenOrBaseOptions;
836
+ this._getChildren = this.baseOptions.getChildren;
837
+ }
838
+ };
839
+ function defineTree2(getChildren) {
840
+ return new Tree(getChildren, {});
841
+ }
842
+ exports.defineTree = defineTree2;
843
+ }
844
+ });
845
+
846
+ // ../../node_modules/tree-visit/lib/indexPath.js
847
+ var require_indexPath = __commonJS({
848
+ "../../node_modules/tree-visit/lib/indexPath.js"(exports) {
849
+ "use strict";
850
+ Object.defineProperty(exports, "__esModule", { value: true });
851
+ }
852
+ });
853
+
854
+ // ../../node_modules/tree-visit/lib/options.js
855
+ var require_options = __commonJS({
856
+ "../../node_modules/tree-visit/lib/options.js"(exports) {
857
+ "use strict";
858
+ Object.defineProperty(exports, "__esModule", { value: true });
859
+ }
860
+ });
861
+
862
+ // ../../node_modules/tree-visit/lib/withOptions.js
863
+ var require_withOptions = __commonJS({
864
+ "../../node_modules/tree-visit/lib/withOptions.js"(exports) {
865
+ "use strict";
866
+ Object.defineProperty(exports, "__esModule", { value: true });
867
+ exports.withOptions = void 0;
868
+ var defineTree_1 = require_defineTree();
869
+ exports.withOptions = defineTree_1.defineTree;
870
+ }
871
+ });
872
+
873
+ // ../../node_modules/tree-visit/lib/index.js
874
+ var require_lib = __commonJS({
875
+ "../../node_modules/tree-visit/lib/index.js"(exports) {
876
+ "use strict";
877
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
878
+ if (k2 === void 0) k2 = k;
879
+ Object.defineProperty(o, k2, { enumerable: true, get: function() {
880
+ return m[k];
881
+ } });
882
+ } : function(o, m, k, k2) {
883
+ if (k2 === void 0) k2 = k;
884
+ o[k2] = m[k];
885
+ });
886
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
887
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
888
+ };
889
+ Object.defineProperty(exports, "__esModule", { value: true });
890
+ __exportStar(require_access(), exports);
891
+ __exportStar(require_ancestors(), exports);
892
+ __exportStar(require_defineTree(), exports);
893
+ __exportStar(require_diagram(), exports);
894
+ __exportStar(require_find(), exports);
895
+ __exportStar(require_flat(), exports);
896
+ __exportStar(require_flatMap(), exports);
897
+ __exportStar(require_indexPath(), exports);
898
+ __exportStar(require_insert(), exports);
899
+ __exportStar(require_map(), exports);
900
+ __exportStar(require_move(), exports);
901
+ __exportStar(require_options(), exports);
902
+ __exportStar(require_reduce(), exports);
903
+ __exportStar(require_remove(), exports);
904
+ __exportStar(require_replace(), exports);
905
+ __exportStar(require_sort(), exports);
906
+ __exportStar(require_visit(), exports);
907
+ __exportStar(require_withOptions(), exports);
908
+ }
909
+ });
910
+
1
911
  // src/index.ts
2
912
  export * from "@noya-app/state-manager";
3
913
 
@@ -414,10 +1324,13 @@ var StateInspector = memoGeneric2(function StateInspector2({
414
1324
  secretManager,
415
1325
  ephemeralUserDataManager,
416
1326
  connectionEventManager,
417
- taskManager
1327
+ taskManager,
1328
+ ioManager
418
1329
  } = noyaManager;
419
1330
  const [didMount, setDidMount] = React4.useState(false);
420
1331
  const tasks = useObservable(taskManager.tasks$);
1332
+ const inputs = useObservable(ioManager.inputs$);
1333
+ const outputTransforms = useObservable(ioManager.outputTransforms$);
421
1334
  useLayoutEffect(() => {
422
1335
  setDidMount(true);
423
1336
  }, []);
@@ -459,6 +1372,14 @@ var StateInspector = memoGeneric2(function StateInspector2({
459
1372
  "noya-multiplayer-react-show-secrets",
460
1373
  false
461
1374
  );
1375
+ const [showInputs, setShowInputs] = useLocalStorageState(
1376
+ "noya-multiplayer-react-show-inputs",
1377
+ false
1378
+ );
1379
+ const [showOutputTransforms, setShowOutputTransforms] = useLocalStorageState(
1380
+ "noya-multiplayer-react-show-output-transforms",
1381
+ false
1382
+ );
462
1383
  const connectionEvents = useObservable(connectionEventManager.events$);
463
1384
  useEffect2(() => {
464
1385
  if (eventsContainerRef.current) {
@@ -477,6 +1398,10 @@ var StateInspector = memoGeneric2(function StateInspector2({
477
1398
  const connectedUsers = useObservable(connectedUsersManager.connectedUsers$);
478
1399
  const userId = useObservable(connectedUsersManager.currentUserId$);
479
1400
  const state = useObservable(multiplayerStateManager.optimisticState$);
1401
+ const inputsInitialized = useObservable(ioManager.inputsInitialized$);
1402
+ const outputTransformsInitialized = useObservable(
1403
+ ioManager.outputTransformsInitialized$
1404
+ );
480
1405
  useEffect2(() => {
481
1406
  if (historyContainerRef.current) {
482
1407
  historyContainerRef.current.scrollTop = historyContainerRef.current.scrollHeight;
@@ -850,33 +1775,6 @@ var StateInspector = memoGeneric2(function StateInspector2({
850
1775
  "Delete"
851
1776
  ))))
852
1777
  ),
853
- /* @__PURE__ */ React4.createElement(
854
- DisclosureSection,
855
- {
856
- title: "Tasks",
857
- colorScheme,
858
- open: showTasks,
859
- setOpen: setShowTasks
860
- },
861
- /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, tasks?.map((task) => /* @__PURE__ */ React4.createElement(
862
- InspectorRow,
863
- {
864
- key: task.id,
865
- colorScheme,
866
- style: {
867
- backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
868
- }
869
- },
870
- /* @__PURE__ */ React4.createElement(
871
- ObjectInspector,
872
- {
873
- name: task.name,
874
- data: task.payload,
875
- theme
876
- }
877
- )
878
- )))
879
- ),
880
1778
  /* @__PURE__ */ React4.createElement(
881
1779
  DisclosureSection,
882
1780
  {
@@ -908,41 +1806,118 @@ var StateInspector = memoGeneric2(function StateInspector2({
908
1806
  "Delete"
909
1807
  ))))
910
1808
  ),
1809
+ " ",
911
1810
  /* @__PURE__ */ React4.createElement(
912
1811
  DisclosureSection,
913
1812
  {
914
- open: showEphemeral,
915
- setOpen: setShowEphemeral,
916
- title: "Ephemeral User Data",
1813
+ open: showInputs,
1814
+ setOpen: setShowInputs,
1815
+ title: /* @__PURE__ */ React4.createElement(TitleLabel, null, "Inputs", /* @__PURE__ */ React4.createElement(ColoredDot, { type: inputsInitialized ? "success" : "error" })),
917
1816
  colorScheme
918
1817
  },
919
- /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React4.createElement(InspectorRow, { key, colorScheme }, /* @__PURE__ */ React4.createElement(
920
- ObjectInspector,
1818
+ /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, inputs?.map((input) => /* @__PURE__ */ React4.createElement(InspectorRow, { key: input.id, colorScheme }, /* @__PURE__ */ React4.createElement(ObjectInspector, { data: input, theme }))), !inputs?.length && /* @__PURE__ */ React4.createElement(
1819
+ "div",
921
1820
  {
922
- name: key,
923
- data: value,
924
- theme,
925
- expandLevel: 10
926
- }
927
- ))))
1821
+ style: {
1822
+ padding: "12px",
1823
+ fontSize: "12px",
1824
+ display: "flex",
1825
+ flexDirection: "column",
1826
+ gap: "4px"
1827
+ }
1828
+ },
1829
+ /* @__PURE__ */ React4.createElement("span", null, "No inputs")
1830
+ ))
928
1831
  ),
929
1832
  /* @__PURE__ */ React4.createElement(
930
1833
  DisclosureSection,
931
1834
  {
932
- open: showEvents,
933
- setOpen: setShowEvents,
934
- title: "Events",
1835
+ open: showOutputTransforms,
1836
+ setOpen: setShowOutputTransforms,
1837
+ title: /* @__PURE__ */ React4.createElement(TitleLabel, null, "Output Transforms", /* @__PURE__ */ React4.createElement(
1838
+ ColoredDot,
1839
+ {
1840
+ type: outputTransformsInitialized ? "success" : "error"
1841
+ }
1842
+ )),
935
1843
  colorScheme
936
1844
  },
937
- /* @__PURE__ */ React4.createElement("div", { ref: eventsContainerRef, style: styles.sectionInner }, connectionEvents?.map(
938
- (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React4.createElement(InspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React4.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React4.createElement(
939
- InspectorRow,
940
- {
941
- key: index,
942
- colorScheme,
943
- variant: event.type === "send" ? "up" : "down",
944
- style: {
945
- padding: "0px 12px 1px"
1845
+ /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, outputTransforms?.map((transform) => /* @__PURE__ */ React4.createElement(InspectorRow, { key: transform.id, colorScheme }, /* @__PURE__ */ React4.createElement(ObjectInspector, { data: transform, theme }))), !outputTransforms?.length && /* @__PURE__ */ React4.createElement(
1846
+ "div",
1847
+ {
1848
+ style: {
1849
+ padding: "12px",
1850
+ fontSize: "12px",
1851
+ display: "flex",
1852
+ flexDirection: "column",
1853
+ gap: "4px"
1854
+ }
1855
+ },
1856
+ /* @__PURE__ */ React4.createElement("span", null, "No output transforms")
1857
+ ))
1858
+ ),
1859
+ /* @__PURE__ */ React4.createElement(
1860
+ DisclosureSection,
1861
+ {
1862
+ title: "Tasks",
1863
+ colorScheme,
1864
+ open: showTasks,
1865
+ setOpen: setShowTasks
1866
+ },
1867
+ /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, tasks?.map((task) => /* @__PURE__ */ React4.createElement(
1868
+ InspectorRow,
1869
+ {
1870
+ key: task.id,
1871
+ colorScheme,
1872
+ style: {
1873
+ backgroundColor: task.status === "done" ? "rgba(0,255,0,0.2)" : task.status === "error" ? "rgba(255,0,0,0.2)" : void 0
1874
+ }
1875
+ },
1876
+ /* @__PURE__ */ React4.createElement(
1877
+ ObjectInspector,
1878
+ {
1879
+ name: task.name,
1880
+ data: task.payload,
1881
+ theme
1882
+ }
1883
+ )
1884
+ )))
1885
+ ),
1886
+ /* @__PURE__ */ React4.createElement(
1887
+ DisclosureSection,
1888
+ {
1889
+ open: showEphemeral,
1890
+ setOpen: setShowEphemeral,
1891
+ title: "Ephemeral User Data",
1892
+ colorScheme
1893
+ },
1894
+ /* @__PURE__ */ React4.createElement("div", { style: styles.sectionInner }, Object.entries(ephemeral).map(([key, value]) => /* @__PURE__ */ React4.createElement(InspectorRow, { key, colorScheme }, /* @__PURE__ */ React4.createElement(
1895
+ ObjectInspector,
1896
+ {
1897
+ name: key,
1898
+ data: value,
1899
+ theme,
1900
+ expandLevel: 10
1901
+ }
1902
+ ))))
1903
+ ),
1904
+ /* @__PURE__ */ React4.createElement(
1905
+ DisclosureSection,
1906
+ {
1907
+ open: showEvents,
1908
+ setOpen: setShowEvents,
1909
+ title: "Events",
1910
+ colorScheme
1911
+ },
1912
+ /* @__PURE__ */ React4.createElement("div", { ref: eventsContainerRef, style: styles.sectionInner }, connectionEvents?.map(
1913
+ (event, index) => event.type === "stateChange" ? /* @__PURE__ */ React4.createElement(InspectorRow, { key: index, colorScheme }, "connection:", " ", /* @__PURE__ */ React4.createElement("span", { style: { fontStyle: "italic" } }, event.state.toLowerCase())) : /* @__PURE__ */ React4.createElement(
1914
+ InspectorRow,
1915
+ {
1916
+ key: index,
1917
+ colorScheme,
1918
+ variant: event.type === "send" ? "up" : "down",
1919
+ style: {
1920
+ padding: "0px 12px 1px"
946
1921
  }
947
1922
  },
948
1923
  /* @__PURE__ */ React4.createElement(
@@ -1272,166 +2247,2908 @@ function useErrorOverlay(noyaManager) {
1272
2247
  });
1273
2248
  }
1274
2249
 
1275
- // src/noyaApp.ts
1276
- import {
1277
- createOrCastValue,
1278
- findAllDefs,
1279
- isEmbeddedApp,
1280
- localStorageSync,
1281
- parentFrameSync,
1282
- stubSync as stubSync2,
1283
- TypeGuard,
1284
- webSocketSync
1285
- } from "@noya-app/state-manager";
1286
- import { useMemo as useMemo3, useState as useState3 } from "react";
1287
- function createDefaultAppData(initialState) {
1288
- return {
1289
- theme: "light",
1290
- viewType: "editable",
1291
- initialState,
1292
- inspector: false
1293
- };
2250
+ // ../../node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
2251
+ var TransformKind = Symbol.for("TypeBox.Transform");
2252
+ var ReadonlyKind = Symbol.for("TypeBox.Readonly");
2253
+ var OptionalKind = Symbol.for("TypeBox.Optional");
2254
+ var Hint = Symbol.for("TypeBox.Hint");
2255
+ var Kind = Symbol.for("TypeBox.Kind");
2256
+
2257
+ // ../../node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
2258
+ function Any(options = {}) {
2259
+ return { ...options, [Kind]: "Any" };
1294
2260
  }
1295
- function enforceSchema(initialState, schema) {
1296
- return schema ? createOrCastValue({
1297
- schema,
1298
- value: initialState,
1299
- defs: findAllDefs(schema)
1300
- }) : initialState;
2261
+
2262
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2263
+ var value_exports = {};
2264
+ __export(value_exports, {
2265
+ IsArray: () => IsArray,
2266
+ IsAsyncIterator: () => IsAsyncIterator,
2267
+ IsBigInt: () => IsBigInt,
2268
+ IsBoolean: () => IsBoolean,
2269
+ IsDate: () => IsDate,
2270
+ IsFunction: () => IsFunction,
2271
+ IsIterator: () => IsIterator,
2272
+ IsNull: () => IsNull,
2273
+ IsNumber: () => IsNumber,
2274
+ IsObject: () => IsObject,
2275
+ IsRegExp: () => IsRegExp,
2276
+ IsString: () => IsString,
2277
+ IsSymbol: () => IsSymbol,
2278
+ IsUint8Array: () => IsUint8Array,
2279
+ IsUndefined: () => IsUndefined
2280
+ });
2281
+ function IsAsyncIterator(value) {
2282
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
1301
2283
  }
1302
- function parseAppDataParameter(options) {
1303
- const window2 = options?.window ?? globalThis;
1304
- const location = window2.location;
1305
- if (!location) return null;
1306
- const urlHash = (location.hash || "").replace(/^#/, "");
1307
- const params = new URLSearchParams(urlHash);
1308
- const data = params.get("data");
1309
- if (!data) return null;
1310
- try {
1311
- return JSON.parse(data);
1312
- } catch (e) {
1313
- return null;
1314
- }
2284
+ function IsArray(value) {
2285
+ return Array.isArray(value);
1315
2286
  }
1316
- function getAppData(initialState, schema, options) {
1317
- const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
1318
- let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
1319
- if (options?.overrideExistingState) {
1320
- appData.initialState = resolvedInitialState;
1321
- }
1322
- appData.initialState = enforceSchema(appData.initialState, schema);
1323
- return appData;
2287
+ function IsBigInt(value) {
2288
+ return typeof value === "bigint";
1324
2289
  }
1325
- function useNoyaState(...args) {
1326
- const [initialState, options] = typeof args[0] === "object" && args[0] !== null && "schema" in args[0] && TypeGuard.IsSchema(args[0].schema) ? [null, args[0]] : [args[0], args[1]];
1327
- const [
1328
- {
1329
- multiplayerUrl,
1330
- inspector,
1331
- initialState: noyaAppInitialState,
1332
- theme,
1333
- viewType
1334
- }
1335
- ] = useState3(() => {
1336
- return getAppData(initialState, options?.schema, {
1337
- overrideExistingState: options?.overrideExistingState
1338
- });
1339
- });
1340
- const sync = useMemo3(() => {
1341
- return isEmbeddedApp() ? parentFrameSync({ debug: options?.debug }) : multiplayerUrl ? webSocketSync({
1342
- url: multiplayerUrl,
1343
- debug: options?.debug
1344
- }) : options?.offlineStorageKey ? localStorageSync({ key: options.offlineStorageKey }) : stubSync2();
1345
- }, [multiplayerUrl, options?.offlineStorageKey, options?.debug]);
1346
- const result = useMultiplayerState(noyaAppInitialState, {
1347
- ...options,
1348
- inspector: options?.inspector ?? inspector,
1349
- sync: options?.sync ?? sync
1350
- });
1351
- const [, , extras] = result;
1352
- const mergedExtras = useMemo3(() => {
1353
- return { ...extras, theme, viewType };
1354
- }, [extras, theme, viewType]);
1355
- return [result[0], result[1], mergedExtras];
2290
+ function IsBoolean(value) {
2291
+ return typeof value === "boolean";
2292
+ }
2293
+ function IsDate(value) {
2294
+ return value instanceof globalThis.Date;
2295
+ }
2296
+ function IsFunction(value) {
2297
+ return typeof value === "function";
2298
+ }
2299
+ function IsIterator(value) {
2300
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
2301
+ }
2302
+ function IsNull(value) {
2303
+ return value === null;
2304
+ }
2305
+ function IsNumber(value) {
2306
+ return typeof value === "number";
2307
+ }
2308
+ function IsObject(value) {
2309
+ return typeof value === "object" && value !== null;
2310
+ }
2311
+ function IsRegExp(value) {
2312
+ return value instanceof globalThis.RegExp;
2313
+ }
2314
+ function IsString(value) {
2315
+ return typeof value === "string";
2316
+ }
2317
+ function IsSymbol(value) {
2318
+ return typeof value === "symbol";
2319
+ }
2320
+ function IsUint8Array(value) {
2321
+ return value instanceof globalThis.Uint8Array;
2322
+ }
2323
+ function IsUndefined(value) {
2324
+ return value === void 0;
1356
2325
  }
1357
2326
 
1358
- // src/NoyaStateContext.tsx
1359
- import {
1360
- Observable
1361
- } from "@noya-app/observable";
1362
- import React6, {
1363
- createContext,
1364
- useCallback as useCallback2,
1365
- useContext,
1366
- useEffect as useEffect4,
1367
- useMemo as useMemo4
1368
- } from "react";
1369
- var AnyNoyaStateContext = createContext(void 0);
1370
- function useAnyNoyaStateContext() {
1371
- const value = useContext(AnyNoyaStateContext);
1372
- if (!value) {
1373
- throw new Error(
1374
- "useNoyaStateContext must be used within a NoyaStateProvider"
1375
- );
2327
+ // ../../node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
2328
+ function ArrayType(value) {
2329
+ return value.map((value2) => Visit(value2));
2330
+ }
2331
+ function DateType(value) {
2332
+ return new Date(value.getTime());
2333
+ }
2334
+ function Uint8ArrayType(value) {
2335
+ return new Uint8Array(value);
2336
+ }
2337
+ function RegExpType(value) {
2338
+ return new RegExp(value.source, value.flags);
2339
+ }
2340
+ function ObjectType(value) {
2341
+ const result = {};
2342
+ for (const key of Object.getOwnPropertyNames(value)) {
2343
+ result[key] = Visit(value[key]);
1376
2344
  }
1377
- return value;
2345
+ for (const key of Object.getOwnPropertySymbols(value)) {
2346
+ result[key] = Visit(value[key]);
2347
+ }
2348
+ return result;
1378
2349
  }
1379
- function useAnyNoyaManager() {
1380
- const { noyaManager } = useAnyNoyaStateContext();
1381
- return noyaManager;
2350
+ function Visit(value) {
2351
+ return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
1382
2352
  }
1383
- function useColorScheme() {
1384
- const { theme } = useAnyNoyaStateContext();
1385
- return theme;
2353
+ function Clone(value) {
2354
+ return Visit(value);
1386
2355
  }
1387
- function useViewType() {
1388
- const { viewType } = useAnyNoyaStateContext();
1389
- return viewType;
2356
+
2357
+ // ../../node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
2358
+ function CloneRest(schemas) {
2359
+ return schemas.map((schema) => CloneType(schema));
1390
2360
  }
1391
- function useAssets() {
1392
- const { noyaManager } = useAnyNoyaStateContext();
1393
- return useObservable(noyaManager.assetManager.assets$);
2361
+ function CloneType(schema, options = {}) {
2362
+ return { ...Clone(schema), ...options };
1394
2363
  }
1395
- function useAsset(id) {
1396
- const { noyaManager } = useAnyNoyaStateContext();
1397
- const observable = useMemo4(
1398
- () => noyaManager.assetManager.assets$.map(
1399
- (assets) => assets.find((a) => a.id === id)
1400
- ),
1401
- [noyaManager, id]
1402
- );
1403
- return useObservable(observable);
2364
+
2365
+ // ../../node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
2366
+ function Array2(schema, options = {}) {
2367
+ return {
2368
+ ...options,
2369
+ [Kind]: "Array",
2370
+ type: "array",
2371
+ items: CloneType(schema)
2372
+ };
1404
2373
  }
1405
- function useAssetManager() {
1406
- const { noyaManager } = useAnyNoyaStateContext();
1407
- const isInitialized = useObservable(noyaManager.assetManager.isInitialized$);
1408
- return useMemo4(
1409
- () => ({
1410
- create: noyaManager.assetManager.create,
1411
- delete: noyaManager.assetManager.delete,
1412
- isInitialized
1413
- }),
1414
- [noyaManager, isInitialized]
1415
- );
2374
+
2375
+ // ../../node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
2376
+ function AsyncIterator(items, options = {}) {
2377
+ return {
2378
+ ...options,
2379
+ [Kind]: "AsyncIterator",
2380
+ type: "AsyncIterator",
2381
+ items: CloneType(items)
2382
+ };
1416
2383
  }
1417
- function useAIManager() {
1418
- const { noyaManager } = useAnyNoyaStateContext();
1419
- return noyaManager.aiManager;
2384
+
2385
+ // ../../node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
2386
+ function DiscardKey(value, key) {
2387
+ const { [key]: _, ...rest } = value;
2388
+ return rest;
1420
2389
  }
1421
- function useSecretManager() {
1422
- const { noyaManager } = useAnyNoyaStateContext();
1423
- return noyaManager.secretManager;
2390
+ function Discard(value, keys) {
2391
+ return keys.reduce((acc, key) => DiscardKey(acc, key), value);
1424
2392
  }
1425
- function useSecrets() {
1426
- const { noyaManager } = useAnyNoyaStateContext();
1427
- return useObservable(noyaManager.secretManager.secrets$);
2393
+
2394
+ // ../../node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
2395
+ function Never(options = {}) {
2396
+ return {
2397
+ ...options,
2398
+ [Kind]: "Never",
2399
+ not: {}
2400
+ };
1428
2401
  }
1429
- function useSecret(name) {
1430
- const { noyaManager } = useAnyNoyaStateContext();
1431
- return useObservable(
1432
- noyaManager.secretManager.secrets$,
1433
- useCallback2((secrets) => secrets.find((s) => s.name === name), [name])
1434
- );
2402
+
2403
+ // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
2404
+ function MappedResult(properties) {
2405
+ return {
2406
+ [Kind]: "MappedResult",
2407
+ properties
2408
+ };
2409
+ }
2410
+
2411
+ // ../../node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
2412
+ function Constructor(parameters, returns, options) {
2413
+ return {
2414
+ ...options,
2415
+ [Kind]: "Constructor",
2416
+ type: "Constructor",
2417
+ parameters: CloneRest(parameters),
2418
+ returns: CloneType(returns)
2419
+ };
2420
+ }
2421
+
2422
+ // ../../node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
2423
+ function Function2(parameters, returns, options) {
2424
+ return {
2425
+ ...options,
2426
+ [Kind]: "Function",
2427
+ type: "Function",
2428
+ parameters: CloneRest(parameters),
2429
+ returns: CloneType(returns)
2430
+ };
2431
+ }
2432
+
2433
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
2434
+ function UnionCreate(T, options) {
2435
+ return { ...options, [Kind]: "Union", anyOf: CloneRest(T) };
2436
+ }
2437
+
2438
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
2439
+ function IsReadonly(value) {
2440
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
2441
+ }
2442
+ function IsOptional(value) {
2443
+ return IsObject(value) && value[OptionalKind] === "Optional";
2444
+ }
2445
+ function IsAny(value) {
2446
+ return IsKindOf(value, "Any");
2447
+ }
2448
+ function IsArray2(value) {
2449
+ return IsKindOf(value, "Array");
2450
+ }
2451
+ function IsAsyncIterator2(value) {
2452
+ return IsKindOf(value, "AsyncIterator");
2453
+ }
2454
+ function IsBigInt2(value) {
2455
+ return IsKindOf(value, "BigInt");
2456
+ }
2457
+ function IsBoolean2(value) {
2458
+ return IsKindOf(value, "Boolean");
2459
+ }
2460
+ function IsConstructor(value) {
2461
+ return IsKindOf(value, "Constructor");
2462
+ }
2463
+ function IsDate2(value) {
2464
+ return IsKindOf(value, "Date");
2465
+ }
2466
+ function IsFunction2(value) {
2467
+ return IsKindOf(value, "Function");
2468
+ }
2469
+ function IsInteger(value) {
2470
+ return IsKindOf(value, "Integer");
2471
+ }
2472
+ function IsIntersect(value) {
2473
+ return IsKindOf(value, "Intersect");
2474
+ }
2475
+ function IsIterator2(value) {
2476
+ return IsKindOf(value, "Iterator");
2477
+ }
2478
+ function IsKindOf(value, kind) {
2479
+ return IsObject(value) && Kind in value && value[Kind] === kind;
2480
+ }
2481
+ function IsLiteral(value) {
2482
+ return IsKindOf(value, "Literal");
2483
+ }
2484
+ function IsMappedKey(value) {
2485
+ return IsKindOf(value, "MappedKey");
2486
+ }
2487
+ function IsMappedResult(value) {
2488
+ return IsKindOf(value, "MappedResult");
2489
+ }
2490
+ function IsNever(value) {
2491
+ return IsKindOf(value, "Never");
2492
+ }
2493
+ function IsNot(value) {
2494
+ return IsKindOf(value, "Not");
2495
+ }
2496
+ function IsNull2(value) {
2497
+ return IsKindOf(value, "Null");
2498
+ }
2499
+ function IsNumber2(value) {
2500
+ return IsKindOf(value, "Number");
2501
+ }
2502
+ function IsObject2(value) {
2503
+ return IsKindOf(value, "Object");
2504
+ }
2505
+ function IsPromise(value) {
2506
+ return IsKindOf(value, "Promise");
2507
+ }
2508
+ function IsRecord(value) {
2509
+ return IsKindOf(value, "Record");
2510
+ }
2511
+ function IsRef(value) {
2512
+ return IsKindOf(value, "Ref");
2513
+ }
2514
+ function IsRegExp2(value) {
2515
+ return IsKindOf(value, "RegExp");
2516
+ }
2517
+ function IsString2(value) {
2518
+ return IsKindOf(value, "String");
2519
+ }
2520
+ function IsSymbol2(value) {
2521
+ return IsKindOf(value, "Symbol");
2522
+ }
2523
+ function IsTemplateLiteral(value) {
2524
+ return IsKindOf(value, "TemplateLiteral");
2525
+ }
2526
+ function IsThis(value) {
2527
+ return IsKindOf(value, "This");
2528
+ }
2529
+ function IsTransform(value) {
2530
+ return IsObject(value) && TransformKind in value;
2531
+ }
2532
+ function IsTuple(value) {
2533
+ return IsKindOf(value, "Tuple");
2534
+ }
2535
+ function IsUndefined2(value) {
2536
+ return IsKindOf(value, "Undefined");
2537
+ }
2538
+ function IsUnion(value) {
2539
+ return IsKindOf(value, "Union");
2540
+ }
2541
+ function IsUint8Array2(value) {
2542
+ return IsKindOf(value, "Uint8Array");
2543
+ }
2544
+ function IsUnknown(value) {
2545
+ return IsKindOf(value, "Unknown");
2546
+ }
2547
+ function IsUnsafe(value) {
2548
+ return IsKindOf(value, "Unsafe");
2549
+ }
2550
+ function IsVoid(value) {
2551
+ return IsKindOf(value, "Void");
2552
+ }
2553
+ function IsKind(value) {
2554
+ return IsObject(value) && Kind in value && IsString(value[Kind]);
2555
+ }
2556
+ function IsSchema(value) {
2557
+ return IsAny(value) || IsArray2(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber2(value) || IsObject2(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined2(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
2558
+ }
2559
+
2560
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
2561
+ function IsUnionOptional(T) {
2562
+ return T.some((L) => IsOptional(L));
2563
+ }
2564
+ function RemoveOptionalFromRest(T) {
2565
+ return T.map((L) => IsOptional(L) ? RemoveOptionalFromType(L) : L);
2566
+ }
2567
+ function RemoveOptionalFromType(T) {
2568
+ return Discard(T, [OptionalKind]);
2569
+ }
2570
+ function ResolveUnion(T, options) {
2571
+ return IsUnionOptional(T) ? Optional(UnionCreate(RemoveOptionalFromRest(T), options)) : UnionCreate(RemoveOptionalFromRest(T), options);
2572
+ }
2573
+ function UnionEvaluated(T, options = {}) {
2574
+ return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : ResolveUnion(T, options);
2575
+ }
2576
+
2577
+ // ../../node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
2578
+ function Union(T, options = {}) {
2579
+ return T.length === 0 ? Never(options) : T.length === 1 ? CloneType(T[0], options) : UnionCreate(T, options);
2580
+ }
2581
+
2582
+ // ../../node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
2583
+ var TypeBoxError = class extends Error {
2584
+ constructor(message) {
2585
+ super(message);
2586
+ }
2587
+ };
2588
+
2589
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
2590
+ var TemplateLiteralParserError = class extends TypeBoxError {
2591
+ };
2592
+ function Unescape(pattern) {
2593
+ return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
2594
+ }
2595
+ function IsNonEscaped(pattern, index, char) {
2596
+ return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
2597
+ }
2598
+ function IsOpenParen(pattern, index) {
2599
+ return IsNonEscaped(pattern, index, "(");
2600
+ }
2601
+ function IsCloseParen(pattern, index) {
2602
+ return IsNonEscaped(pattern, index, ")");
2603
+ }
2604
+ function IsSeparator(pattern, index) {
2605
+ return IsNonEscaped(pattern, index, "|");
2606
+ }
2607
+ function IsGroup(pattern) {
2608
+ if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
2609
+ return false;
2610
+ let count = 0;
2611
+ for (let index = 0; index < pattern.length; index++) {
2612
+ if (IsOpenParen(pattern, index))
2613
+ count += 1;
2614
+ if (IsCloseParen(pattern, index))
2615
+ count -= 1;
2616
+ if (count === 0 && index !== pattern.length - 1)
2617
+ return false;
2618
+ }
2619
+ return true;
2620
+ }
2621
+ function InGroup(pattern) {
2622
+ return pattern.slice(1, pattern.length - 1);
2623
+ }
2624
+ function IsPrecedenceOr(pattern) {
2625
+ let count = 0;
2626
+ for (let index = 0; index < pattern.length; index++) {
2627
+ if (IsOpenParen(pattern, index))
2628
+ count += 1;
2629
+ if (IsCloseParen(pattern, index))
2630
+ count -= 1;
2631
+ if (IsSeparator(pattern, index) && count === 0)
2632
+ return true;
2633
+ }
2634
+ return false;
2635
+ }
2636
+ function IsPrecedenceAnd(pattern) {
2637
+ for (let index = 0; index < pattern.length; index++) {
2638
+ if (IsOpenParen(pattern, index))
2639
+ return true;
2640
+ }
2641
+ return false;
2642
+ }
2643
+ function Or(pattern) {
2644
+ let [count, start] = [0, 0];
2645
+ const expressions = [];
2646
+ for (let index = 0; index < pattern.length; index++) {
2647
+ if (IsOpenParen(pattern, index))
2648
+ count += 1;
2649
+ if (IsCloseParen(pattern, index))
2650
+ count -= 1;
2651
+ if (IsSeparator(pattern, index) && count === 0) {
2652
+ const range2 = pattern.slice(start, index);
2653
+ if (range2.length > 0)
2654
+ expressions.push(TemplateLiteralParse(range2));
2655
+ start = index + 1;
2656
+ }
2657
+ }
2658
+ const range = pattern.slice(start);
2659
+ if (range.length > 0)
2660
+ expressions.push(TemplateLiteralParse(range));
2661
+ if (expressions.length === 0)
2662
+ return { type: "const", const: "" };
2663
+ if (expressions.length === 1)
2664
+ return expressions[0];
2665
+ return { type: "or", expr: expressions };
2666
+ }
2667
+ function And(pattern) {
2668
+ function Group(value, index) {
2669
+ if (!IsOpenParen(value, index))
2670
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
2671
+ let count = 0;
2672
+ for (let scan = index; scan < value.length; scan++) {
2673
+ if (IsOpenParen(value, scan))
2674
+ count += 1;
2675
+ if (IsCloseParen(value, scan))
2676
+ count -= 1;
2677
+ if (count === 0)
2678
+ return [index, scan];
2679
+ }
2680
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
2681
+ }
2682
+ function Range(pattern2, index) {
2683
+ for (let scan = index; scan < pattern2.length; scan++) {
2684
+ if (IsOpenParen(pattern2, scan))
2685
+ return [index, scan];
2686
+ }
2687
+ return [index, pattern2.length];
2688
+ }
2689
+ const expressions = [];
2690
+ for (let index = 0; index < pattern.length; index++) {
2691
+ if (IsOpenParen(pattern, index)) {
2692
+ const [start, end] = Group(pattern, index);
2693
+ const range = pattern.slice(start, end + 1);
2694
+ expressions.push(TemplateLiteralParse(range));
2695
+ index = end;
2696
+ } else {
2697
+ const [start, end] = Range(pattern, index);
2698
+ const range = pattern.slice(start, end);
2699
+ if (range.length > 0)
2700
+ expressions.push(TemplateLiteralParse(range));
2701
+ index = end - 1;
2702
+ }
2703
+ }
2704
+ return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
2705
+ }
2706
+ function TemplateLiteralParse(pattern) {
2707
+ return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
2708
+ }
2709
+ function TemplateLiteralParseExact(pattern) {
2710
+ return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
2711
+ }
2712
+
2713
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
2714
+ var TemplateLiteralFiniteError = class extends TypeBoxError {
2715
+ };
2716
+ function IsNumberExpression(expression) {
2717
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
2718
+ }
2719
+ function IsBooleanExpression(expression) {
2720
+ return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
2721
+ }
2722
+ function IsStringExpression(expression) {
2723
+ return expression.type === "const" && expression.const === ".*";
2724
+ }
2725
+ function IsTemplateLiteralExpressionFinite(expression) {
2726
+ return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
2727
+ throw new TemplateLiteralFiniteError(`Unknown expression type`);
2728
+ })();
2729
+ }
2730
+ function IsTemplateLiteralFinite(schema) {
2731
+ const expression = TemplateLiteralParseExact(schema.pattern);
2732
+ return IsTemplateLiteralExpressionFinite(expression);
2733
+ }
2734
+
2735
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
2736
+ var TemplateLiteralGenerateError = class extends TypeBoxError {
2737
+ };
2738
+ function* GenerateReduce(buffer) {
2739
+ if (buffer.length === 1)
2740
+ return yield* buffer[0];
2741
+ for (const left of buffer[0]) {
2742
+ for (const right of GenerateReduce(buffer.slice(1))) {
2743
+ yield `${left}${right}`;
2744
+ }
2745
+ }
2746
+ }
2747
+ function* GenerateAnd(expression) {
2748
+ return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
2749
+ }
2750
+ function* GenerateOr(expression) {
2751
+ for (const expr of expression.expr)
2752
+ yield* TemplateLiteralExpressionGenerate(expr);
2753
+ }
2754
+ function* GenerateConst(expression) {
2755
+ return yield expression.const;
2756
+ }
2757
+ function* TemplateLiteralExpressionGenerate(expression) {
2758
+ return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
2759
+ throw new TemplateLiteralGenerateError("Unknown expression");
2760
+ })();
2761
+ }
2762
+ function TemplateLiteralGenerate(schema) {
2763
+ const expression = TemplateLiteralParseExact(schema.pattern);
2764
+ return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
2765
+ }
2766
+
2767
+ // ../../node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
2768
+ function Literal(value, options = {}) {
2769
+ return {
2770
+ ...options,
2771
+ [Kind]: "Literal",
2772
+ const: value,
2773
+ type: typeof value
2774
+ };
2775
+ }
2776
+
2777
+ // ../../node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
2778
+ function Boolean(options = {}) {
2779
+ return {
2780
+ ...options,
2781
+ [Kind]: "Boolean",
2782
+ type: "boolean"
2783
+ };
2784
+ }
2785
+
2786
+ // ../../node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
2787
+ function BigInt2(options = {}) {
2788
+ return {
2789
+ ...options,
2790
+ [Kind]: "BigInt",
2791
+ type: "bigint"
2792
+ };
2793
+ }
2794
+
2795
+ // ../../node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
2796
+ function Number2(options = {}) {
2797
+ return {
2798
+ ...options,
2799
+ [Kind]: "Number",
2800
+ type: "number"
2801
+ };
2802
+ }
2803
+
2804
+ // ../../node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
2805
+ function String(options = {}) {
2806
+ return { ...options, [Kind]: "String", type: "string" };
2807
+ }
2808
+
2809
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
2810
+ function* FromUnion(syntax) {
2811
+ const trim = syntax.trim().replace(/"|'/g, "");
2812
+ return trim === "boolean" ? yield Boolean() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String() : yield (() => {
2813
+ const literals = trim.split("|").map((literal) => Literal(literal.trim()));
2814
+ return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
2815
+ })();
2816
+ }
2817
+ function* FromTerminal(syntax) {
2818
+ if (syntax[1] !== "{") {
2819
+ const L = Literal("$");
2820
+ const R = FromSyntax(syntax.slice(1));
2821
+ return yield* [L, ...R];
2822
+ }
2823
+ for (let i = 2; i < syntax.length; i++) {
2824
+ if (syntax[i] === "}") {
2825
+ const L = FromUnion(syntax.slice(2, i));
2826
+ const R = FromSyntax(syntax.slice(i + 1));
2827
+ return yield* [...L, ...R];
2828
+ }
2829
+ }
2830
+ yield Literal(syntax);
2831
+ }
2832
+ function* FromSyntax(syntax) {
2833
+ for (let i = 0; i < syntax.length; i++) {
2834
+ if (syntax[i] === "$") {
2835
+ const L = Literal(syntax.slice(0, i));
2836
+ const R = FromTerminal(syntax.slice(i));
2837
+ return yield* [L, ...R];
2838
+ }
2839
+ }
2840
+ yield Literal(syntax);
2841
+ }
2842
+ function TemplateLiteralSyntax(syntax) {
2843
+ return [...FromSyntax(syntax)];
2844
+ }
2845
+
2846
+ // ../../node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
2847
+ var PatternBoolean = "(true|false)";
2848
+ var PatternNumber = "(0|[1-9][0-9]*)";
2849
+ var PatternString = "(.*)";
2850
+ var PatternBooleanExact = `^${PatternBoolean}$`;
2851
+ var PatternNumberExact = `^${PatternNumber}$`;
2852
+ var PatternStringExact = `^${PatternString}$`;
2853
+
2854
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
2855
+ var TemplateLiteralPatternError = class extends TypeBoxError {
2856
+ };
2857
+ function Escape(value) {
2858
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2859
+ }
2860
+ function Visit2(schema, acc) {
2861
+ return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber2(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
2862
+ throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
2863
+ })();
2864
+ }
2865
+ function TemplateLiteralPattern(kinds) {
2866
+ return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
2867
+ }
2868
+
2869
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
2870
+ function TemplateLiteralToUnion(schema) {
2871
+ const R = TemplateLiteralGenerate(schema);
2872
+ const L = R.map((S) => Literal(S));
2873
+ return UnionEvaluated(L);
2874
+ }
2875
+
2876
+ // ../../node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
2877
+ function TemplateLiteral(unresolved, options = {}) {
2878
+ const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
2879
+ return { ...options, [Kind]: "TemplateLiteral", type: "string", pattern };
2880
+ }
2881
+
2882
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
2883
+ function FromTemplateLiteral(T) {
2884
+ const R = TemplateLiteralGenerate(T);
2885
+ return R.map((S) => S.toString());
2886
+ }
2887
+ function FromUnion2(T) {
2888
+ const Acc = [];
2889
+ for (const L of T)
2890
+ Acc.push(...IndexPropertyKeys(L));
2891
+ return Acc;
2892
+ }
2893
+ function FromLiteral(T) {
2894
+ return [T.toString()];
2895
+ }
2896
+ function IndexPropertyKeys(T) {
2897
+ return [...new Set(IsTemplateLiteral(T) ? FromTemplateLiteral(T) : IsUnion(T) ? FromUnion2(T.anyOf) : IsLiteral(T) ? FromLiteral(T.const) : IsNumber2(T) ? ["[number]"] : IsInteger(T) ? ["[number]"] : [])];
2898
+ }
2899
+
2900
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
2901
+ function FromProperties(T, P, options) {
2902
+ const Acc = {};
2903
+ for (const K2 of Object.getOwnPropertyNames(P)) {
2904
+ Acc[K2] = Index(T, IndexPropertyKeys(P[K2]), options);
2905
+ }
2906
+ return Acc;
2907
+ }
2908
+ function FromMappedResult(T, R, options) {
2909
+ return FromProperties(T, R.properties, options);
2910
+ }
2911
+ function IndexFromMappedResult(T, R, options) {
2912
+ const P = FromMappedResult(T, R, options);
2913
+ return MappedResult(P);
2914
+ }
2915
+
2916
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
2917
+ function FromRest(T, K) {
2918
+ return T.map((L) => IndexFromPropertyKey(L, K));
2919
+ }
2920
+ function FromIntersectRest(T) {
2921
+ return T.filter((L) => !IsNever(L));
2922
+ }
2923
+ function FromIntersect(T, K) {
2924
+ return IntersectEvaluated(FromIntersectRest(FromRest(T, K)));
2925
+ }
2926
+ function FromUnionRest(T) {
2927
+ return T.some((L) => IsNever(L)) ? [] : T;
2928
+ }
2929
+ function FromUnion3(T, K) {
2930
+ return UnionEvaluated(FromUnionRest(FromRest(T, K)));
2931
+ }
2932
+ function FromTuple(T, K) {
2933
+ return K in T ? T[K] : K === "[number]" ? UnionEvaluated(T) : Never();
2934
+ }
2935
+ function FromArray(T, K) {
2936
+ return K === "[number]" ? T : Never();
2937
+ }
2938
+ function FromProperty(T, K) {
2939
+ return K in T ? T[K] : Never();
2940
+ }
2941
+ function IndexFromPropertyKey(T, K) {
2942
+ return IsIntersect(T) ? FromIntersect(T.allOf, K) : IsUnion(T) ? FromUnion3(T.anyOf, K) : IsTuple(T) ? FromTuple(T.items ?? [], K) : IsArray2(T) ? FromArray(T.items, K) : IsObject2(T) ? FromProperty(T.properties, K) : Never();
2943
+ }
2944
+ function IndexFromPropertyKeys(T, K) {
2945
+ return K.map((L) => IndexFromPropertyKey(T, L));
2946
+ }
2947
+ function FromSchema(T, K) {
2948
+ return UnionEvaluated(IndexFromPropertyKeys(T, K));
2949
+ }
2950
+ function Index(T, K, options = {}) {
2951
+ return IsMappedResult(K) ? CloneType(IndexFromMappedResult(T, K, options)) : IsMappedKey(K) ? CloneType(IndexFromMappedKey(T, K, options)) : IsSchema(K) ? CloneType(FromSchema(T, IndexPropertyKeys(K)), options) : CloneType(FromSchema(T, K), options);
2952
+ }
2953
+
2954
+ // ../../node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
2955
+ function MappedIndexPropertyKey(T, K, options) {
2956
+ return { [K]: Index(T, [K], options) };
2957
+ }
2958
+ function MappedIndexPropertyKeys(T, K, options) {
2959
+ return K.reduce((Acc, L) => {
2960
+ return { ...Acc, ...MappedIndexPropertyKey(T, L, options) };
2961
+ }, {});
2962
+ }
2963
+ function MappedIndexProperties(T, K, options) {
2964
+ return MappedIndexPropertyKeys(T, K.keys, options);
2965
+ }
2966
+ function IndexFromMappedKey(T, K, options) {
2967
+ const P = MappedIndexProperties(T, K, options);
2968
+ return MappedResult(P);
2969
+ }
2970
+
2971
+ // ../../node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
2972
+ function Iterator(items, options = {}) {
2973
+ return {
2974
+ ...options,
2975
+ [Kind]: "Iterator",
2976
+ type: "Iterator",
2977
+ items: CloneType(items)
2978
+ };
2979
+ }
2980
+
2981
+ // ../../node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
2982
+ function _Object(properties, options = {}) {
2983
+ const propertyKeys = globalThis.Object.getOwnPropertyNames(properties);
2984
+ const optionalKeys = propertyKeys.filter((key) => IsOptional(properties[key]));
2985
+ const requiredKeys = propertyKeys.filter((name) => !optionalKeys.includes(name));
2986
+ const clonedAdditionalProperties = IsSchema(options.additionalProperties) ? { additionalProperties: CloneType(options.additionalProperties) } : {};
2987
+ const clonedProperties = {};
2988
+ for (const key of propertyKeys)
2989
+ clonedProperties[key] = CloneType(properties[key]);
2990
+ return requiredKeys.length > 0 ? { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties, required: requiredKeys } : { ...options, ...clonedAdditionalProperties, [Kind]: "Object", type: "object", properties: clonedProperties };
2991
+ }
2992
+ var Object2 = _Object;
2993
+
2994
+ // ../../node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
2995
+ function Promise2(item, options = {}) {
2996
+ return {
2997
+ ...options,
2998
+ [Kind]: "Promise",
2999
+ type: "Promise",
3000
+ item: CloneType(item)
3001
+ };
3002
+ }
3003
+
3004
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
3005
+ function RemoveReadonly(schema) {
3006
+ return Discard(CloneType(schema), [ReadonlyKind]);
3007
+ }
3008
+ function AddReadonly(schema) {
3009
+ return { ...CloneType(schema), [ReadonlyKind]: "Readonly" };
3010
+ }
3011
+ function ReadonlyWithFlag(schema, F) {
3012
+ return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
3013
+ }
3014
+ function Readonly(schema, enable) {
3015
+ const F = enable ?? true;
3016
+ return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
3017
+ }
3018
+
3019
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
3020
+ function FromProperties2(K, F) {
3021
+ const Acc = {};
3022
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3023
+ Acc[K2] = Readonly(K[K2], F);
3024
+ return Acc;
3025
+ }
3026
+ function FromMappedResult2(R, F) {
3027
+ return FromProperties2(R.properties, F);
3028
+ }
3029
+ function ReadonlyFromMappedResult(R, F) {
3030
+ const P = FromMappedResult2(R, F);
3031
+ return MappedResult(P);
3032
+ }
3033
+
3034
+ // ../../node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
3035
+ function Tuple(items, options = {}) {
3036
+ const [additionalItems, minItems, maxItems] = [false, items.length, items.length];
3037
+ return items.length > 0 ? { ...options, [Kind]: "Tuple", type: "array", items: CloneRest(items), additionalItems, minItems, maxItems } : { ...options, [Kind]: "Tuple", type: "array", minItems, maxItems };
3038
+ }
3039
+
3040
+ // ../../node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
3041
+ function SetIncludes(T, S) {
3042
+ return T.includes(S);
3043
+ }
3044
+ function SetDistinct(T) {
3045
+ return [...new Set(T)];
3046
+ }
3047
+ function SetIntersect(T, S) {
3048
+ return T.filter((L) => S.includes(L));
3049
+ }
3050
+ function SetIntersectManyResolve(T, Init) {
3051
+ return T.reduce((Acc, L) => {
3052
+ return SetIntersect(Acc, L);
3053
+ }, Init);
3054
+ }
3055
+ function SetIntersectMany(T) {
3056
+ return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
3057
+ }
3058
+ function SetUnionMany(T) {
3059
+ const Acc = [];
3060
+ for (const L of T)
3061
+ Acc.push(...L);
3062
+ return Acc;
3063
+ }
3064
+
3065
+ // ../../node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
3066
+ function FromMappedResult3(K, P) {
3067
+ return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
3068
+ }
3069
+ function MappedKeyToKnownMappedResultProperties(K) {
3070
+ return { [K]: Literal(K) };
3071
+ }
3072
+ function MappedKeyToUnknownMappedResultProperties(P) {
3073
+ const Acc = {};
3074
+ for (const L of P)
3075
+ Acc[L] = Literal(L);
3076
+ return Acc;
3077
+ }
3078
+ function MappedKeyToMappedResultProperties(K, P) {
3079
+ return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
3080
+ }
3081
+ function FromMappedKey(K, P) {
3082
+ const R = MappedKeyToMappedResultProperties(K, P);
3083
+ return FromMappedResult3(K, R);
3084
+ }
3085
+ function FromRest2(K, T) {
3086
+ return T.map((L) => FromSchemaType(K, L));
3087
+ }
3088
+ function FromProperties3(K, T) {
3089
+ const Acc = {};
3090
+ for (const K2 of globalThis.Object.getOwnPropertyNames(T))
3091
+ Acc[K2] = FromSchemaType(K, T[K2]);
3092
+ return Acc;
3093
+ }
3094
+ function FromSchemaType(K, T) {
3095
+ return (
3096
+ // unevaluated modifier types
3097
+ IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
3098
+ // unevaluated mapped types
3099
+ IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
3100
+ // unevaluated types
3101
+ IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsFunction2(T) ? Function2(FromRest2(K, T.parameters), FromSchemaType(K, T.returns)) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items)) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items)) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf)) : IsUnion(T) ? Union(FromRest2(K, T.anyOf)) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? [])) : IsObject2(T) ? Object2(FromProperties3(K, T.properties)) : IsArray2(T) ? Array2(FromSchemaType(K, T.items)) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item)) : T
3102
+ )
3103
+ )
3104
+ );
3105
+ }
3106
+ function MappedFunctionReturnType(K, T) {
3107
+ const Acc = {};
3108
+ for (const L of K)
3109
+ Acc[L] = FromSchemaType(L, T);
3110
+ return Acc;
3111
+ }
3112
+ function Mapped(key, map3, options = {}) {
3113
+ const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
3114
+ const RT = map3({ [Kind]: "MappedKey", keys: K });
3115
+ const R = MappedFunctionReturnType(K, RT);
3116
+ return CloneType(Object2(R), options);
3117
+ }
3118
+
3119
+ // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
3120
+ function RemoveOptional(schema) {
3121
+ return Discard(CloneType(schema), [OptionalKind]);
3122
+ }
3123
+ function AddOptional(schema) {
3124
+ return { ...CloneType(schema), [OptionalKind]: "Optional" };
3125
+ }
3126
+ function OptionalWithFlag(schema, F) {
3127
+ return F === false ? RemoveOptional(schema) : AddOptional(schema);
3128
+ }
3129
+ function Optional(schema, enable) {
3130
+ const F = enable ?? true;
3131
+ return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
3132
+ }
3133
+
3134
+ // ../../node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
3135
+ function FromProperties4(P, F) {
3136
+ const Acc = {};
3137
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3138
+ Acc[K2] = Optional(P[K2], F);
3139
+ return Acc;
3140
+ }
3141
+ function FromMappedResult4(R, F) {
3142
+ return FromProperties4(R.properties, F);
3143
+ }
3144
+ function OptionalFromMappedResult(R, F) {
3145
+ const P = FromMappedResult4(R, F);
3146
+ return MappedResult(P);
3147
+ }
3148
+
3149
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
3150
+ function IntersectCreate(T, options) {
3151
+ const allObjects = T.every((schema) => IsObject2(schema));
3152
+ const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: CloneType(options.unevaluatedProperties) } : {};
3153
+ return options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: CloneRest(T) } : { ...options, ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: CloneRest(T) };
3154
+ }
3155
+
3156
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
3157
+ function IsIntersectOptional(T) {
3158
+ return T.every((L) => IsOptional(L));
3159
+ }
3160
+ function RemoveOptionalFromType2(T) {
3161
+ return Discard(T, [OptionalKind]);
3162
+ }
3163
+ function RemoveOptionalFromRest2(T) {
3164
+ return T.map((L) => IsOptional(L) ? RemoveOptionalFromType2(L) : L);
3165
+ }
3166
+ function ResolveIntersect(T, options) {
3167
+ return IsIntersectOptional(T) ? Optional(IntersectCreate(RemoveOptionalFromRest2(T), options)) : IntersectCreate(RemoveOptionalFromRest2(T), options);
3168
+ }
3169
+ function IntersectEvaluated(T, options = {}) {
3170
+ if (T.length === 0)
3171
+ return Never(options);
3172
+ if (T.length === 1)
3173
+ return CloneType(T[0], options);
3174
+ if (T.some((schema) => IsTransform(schema)))
3175
+ throw new Error("Cannot intersect transform types");
3176
+ return ResolveIntersect(T, options);
3177
+ }
3178
+
3179
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
3180
+ function Intersect(T, options = {}) {
3181
+ if (T.length === 0)
3182
+ return Never(options);
3183
+ if (T.length === 1)
3184
+ return CloneType(T[0], options);
3185
+ if (T.some((schema) => IsTransform(schema)))
3186
+ throw new Error("Cannot intersect transform types");
3187
+ return IntersectCreate(T, options);
3188
+ }
3189
+
3190
+ // ../../node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
3191
+ function FromRest3(T) {
3192
+ return T.map((L) => AwaitedResolve(L));
3193
+ }
3194
+ function FromIntersect2(T) {
3195
+ return Intersect(FromRest3(T));
3196
+ }
3197
+ function FromUnion4(T) {
3198
+ return Union(FromRest3(T));
3199
+ }
3200
+ function FromPromise(T) {
3201
+ return AwaitedResolve(T);
3202
+ }
3203
+ function AwaitedResolve(T) {
3204
+ return IsIntersect(T) ? FromIntersect2(T.allOf) : IsUnion(T) ? FromUnion4(T.anyOf) : IsPromise(T) ? FromPromise(T.item) : T;
3205
+ }
3206
+ function Awaited(T, options = {}) {
3207
+ return CloneType(AwaitedResolve(T), options);
3208
+ }
3209
+
3210
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
3211
+ function FromRest4(T) {
3212
+ const Acc = [];
3213
+ for (const L of T)
3214
+ Acc.push(KeyOfPropertyKeys(L));
3215
+ return Acc;
3216
+ }
3217
+ function FromIntersect3(T) {
3218
+ const C = FromRest4(T);
3219
+ const R = SetUnionMany(C);
3220
+ return R;
3221
+ }
3222
+ function FromUnion5(T) {
3223
+ const C = FromRest4(T);
3224
+ const R = SetIntersectMany(C);
3225
+ return R;
3226
+ }
3227
+ function FromTuple2(T) {
3228
+ return T.map((_, I) => I.toString());
3229
+ }
3230
+ function FromArray2(_) {
3231
+ return ["[number]"];
3232
+ }
3233
+ function FromProperties5(T) {
3234
+ return globalThis.Object.getOwnPropertyNames(T);
3235
+ }
3236
+ function FromPatternProperties(patternProperties) {
3237
+ if (!includePatternProperties)
3238
+ return [];
3239
+ const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
3240
+ return patternPropertyKeys.map((key) => {
3241
+ return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
3242
+ });
3243
+ }
3244
+ function KeyOfPropertyKeys(T) {
3245
+ return IsIntersect(T) ? FromIntersect3(T.allOf) : IsUnion(T) ? FromUnion5(T.anyOf) : IsTuple(T) ? FromTuple2(T.items ?? []) : IsArray2(T) ? FromArray2(T.items) : IsObject2(T) ? FromProperties5(T.properties) : IsRecord(T) ? FromPatternProperties(T.patternProperties) : [];
3246
+ }
3247
+ var includePatternProperties = false;
3248
+
3249
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
3250
+ function KeyOfPropertyKeysToRest(T) {
3251
+ return T.map((L) => L === "[number]" ? Number2() : Literal(L));
3252
+ }
3253
+ function KeyOf(T, options = {}) {
3254
+ if (IsMappedResult(T)) {
3255
+ return KeyOfFromMappedResult(T, options);
3256
+ } else {
3257
+ const K = KeyOfPropertyKeys(T);
3258
+ const S = KeyOfPropertyKeysToRest(K);
3259
+ const U = UnionEvaluated(S);
3260
+ return CloneType(U, options);
3261
+ }
3262
+ }
3263
+
3264
+ // ../../node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
3265
+ function FromProperties6(K, options) {
3266
+ const Acc = {};
3267
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3268
+ Acc[K2] = KeyOf(K[K2], options);
3269
+ return Acc;
3270
+ }
3271
+ function FromMappedResult5(R, options) {
3272
+ return FromProperties6(R.properties, options);
3273
+ }
3274
+ function KeyOfFromMappedResult(R, options) {
3275
+ const P = FromMappedResult5(R, options);
3276
+ return MappedResult(P);
3277
+ }
3278
+
3279
+ // ../../node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
3280
+ function CompositeKeys(T) {
3281
+ const Acc = [];
3282
+ for (const L of T)
3283
+ Acc.push(...KeyOfPropertyKeys(L));
3284
+ return SetDistinct(Acc);
3285
+ }
3286
+ function FilterNever(T) {
3287
+ return T.filter((L) => !IsNever(L));
3288
+ }
3289
+ function CompositeProperty(T, K) {
3290
+ const Acc = [];
3291
+ for (const L of T)
3292
+ Acc.push(...IndexFromPropertyKeys(L, [K]));
3293
+ return FilterNever(Acc);
3294
+ }
3295
+ function CompositeProperties(T, K) {
3296
+ const Acc = {};
3297
+ for (const L of K) {
3298
+ Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
3299
+ }
3300
+ return Acc;
3301
+ }
3302
+ function Composite(T, options = {}) {
3303
+ const K = CompositeKeys(T);
3304
+ const P = CompositeProperties(T, K);
3305
+ const R = Object2(P, options);
3306
+ return R;
3307
+ }
3308
+
3309
+ // ../../node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
3310
+ function Date2(options = {}) {
3311
+ return {
3312
+ ...options,
3313
+ [Kind]: "Date",
3314
+ type: "Date"
3315
+ };
3316
+ }
3317
+
3318
+ // ../../node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
3319
+ function Null(options = {}) {
3320
+ return {
3321
+ ...options,
3322
+ [Kind]: "Null",
3323
+ type: "null"
3324
+ };
3325
+ }
3326
+
3327
+ // ../../node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
3328
+ function Symbol2(options) {
3329
+ return { ...options, [Kind]: "Symbol", type: "symbol" };
3330
+ }
3331
+
3332
+ // ../../node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
3333
+ function Undefined(options = {}) {
3334
+ return { ...options, [Kind]: "Undefined", type: "undefined" };
3335
+ }
3336
+
3337
+ // ../../node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
3338
+ function Uint8Array2(options = {}) {
3339
+ return { ...options, [Kind]: "Uint8Array", type: "Uint8Array" };
3340
+ }
3341
+
3342
+ // ../../node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
3343
+ function Unknown(options = {}) {
3344
+ return {
3345
+ ...options,
3346
+ [Kind]: "Unknown"
3347
+ };
3348
+ }
3349
+
3350
+ // ../../node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
3351
+ function FromArray3(T) {
3352
+ return T.map((L) => FromValue(L, false));
3353
+ }
3354
+ function FromProperties7(value) {
3355
+ const Acc = {};
3356
+ for (const K of globalThis.Object.getOwnPropertyNames(value))
3357
+ Acc[K] = Readonly(FromValue(value[K], false));
3358
+ return Acc;
3359
+ }
3360
+ function ConditionalReadonly(T, root) {
3361
+ return root === true ? T : Readonly(T);
3362
+ }
3363
+ function FromValue(value, root) {
3364
+ return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function2([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt2() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
3365
+ }
3366
+ function Const(T, options = {}) {
3367
+ return CloneType(FromValue(T, true), options);
3368
+ }
3369
+
3370
+ // ../../node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
3371
+ function ConstructorParameters(schema, options = {}) {
3372
+ return Tuple(CloneRest(schema.parameters), { ...options });
3373
+ }
3374
+
3375
+ // ../../node_modules/@sinclair/typebox/build/esm/type/deref/deref.mjs
3376
+ function FromRest5(schema, references) {
3377
+ return schema.map((schema2) => Deref(schema2, references));
3378
+ }
3379
+ function FromProperties8(properties, references) {
3380
+ const Acc = {};
3381
+ for (const K of globalThis.Object.getOwnPropertyNames(properties)) {
3382
+ Acc[K] = Deref(properties[K], references);
3383
+ }
3384
+ return Acc;
3385
+ }
3386
+ function FromConstructor(schema, references) {
3387
+ schema.parameters = FromRest5(schema.parameters, references);
3388
+ schema.returns = Deref(schema.returns, references);
3389
+ return schema;
3390
+ }
3391
+ function FromFunction(schema, references) {
3392
+ schema.parameters = FromRest5(schema.parameters, references);
3393
+ schema.returns = Deref(schema.returns, references);
3394
+ return schema;
3395
+ }
3396
+ function FromIntersect4(schema, references) {
3397
+ schema.allOf = FromRest5(schema.allOf, references);
3398
+ return schema;
3399
+ }
3400
+ function FromUnion6(schema, references) {
3401
+ schema.anyOf = FromRest5(schema.anyOf, references);
3402
+ return schema;
3403
+ }
3404
+ function FromTuple3(schema, references) {
3405
+ if (IsUndefined(schema.items))
3406
+ return schema;
3407
+ schema.items = FromRest5(schema.items, references);
3408
+ return schema;
3409
+ }
3410
+ function FromArray4(schema, references) {
3411
+ schema.items = Deref(schema.items, references);
3412
+ return schema;
3413
+ }
3414
+ function FromObject(schema, references) {
3415
+ schema.properties = FromProperties8(schema.properties, references);
3416
+ return schema;
3417
+ }
3418
+ function FromPromise2(schema, references) {
3419
+ schema.item = Deref(schema.item, references);
3420
+ return schema;
3421
+ }
3422
+ function FromAsyncIterator(schema, references) {
3423
+ schema.items = Deref(schema.items, references);
3424
+ return schema;
3425
+ }
3426
+ function FromIterator(schema, references) {
3427
+ schema.items = Deref(schema.items, references);
3428
+ return schema;
3429
+ }
3430
+ function FromRef(schema, references) {
3431
+ const target = references.find((remote) => remote.$id === schema.$ref);
3432
+ if (target === void 0)
3433
+ throw Error(`Unable to dereference schema with $id ${schema.$ref}`);
3434
+ const discard = Discard(target, ["$id"]);
3435
+ return Deref(discard, references);
3436
+ }
3437
+ function DerefResolve(schema, references) {
3438
+ return IsConstructor(schema) ? FromConstructor(schema, references) : IsFunction2(schema) ? FromFunction(schema, references) : IsIntersect(schema) ? FromIntersect4(schema, references) : IsUnion(schema) ? FromUnion6(schema, references) : IsTuple(schema) ? FromTuple3(schema, references) : IsArray2(schema) ? FromArray4(schema, references) : IsObject2(schema) ? FromObject(schema, references) : IsPromise(schema) ? FromPromise2(schema, references) : IsAsyncIterator2(schema) ? FromAsyncIterator(schema, references) : IsIterator2(schema) ? FromIterator(schema, references) : IsRef(schema) ? FromRef(schema, references) : schema;
3439
+ }
3440
+ function Deref(schema, references) {
3441
+ return DerefResolve(CloneType(schema), CloneRest(references));
3442
+ }
3443
+
3444
+ // ../../node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
3445
+ function Enum(item, options = {}) {
3446
+ if (IsUndefined(item))
3447
+ throw new Error("Enum undefined or empty");
3448
+ const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
3449
+ const values2 = [...new Set(values1)];
3450
+ const anyOf = values2.map((value) => Literal(value));
3451
+ return Union(anyOf, { ...options, [Hint]: "Enum" });
3452
+ }
3453
+
3454
+ // ../../node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
3455
+ var type_exports = {};
3456
+ __export(type_exports, {
3457
+ IsAny: () => IsAny2,
3458
+ IsArray: () => IsArray3,
3459
+ IsAsyncIterator: () => IsAsyncIterator3,
3460
+ IsBigInt: () => IsBigInt3,
3461
+ IsBoolean: () => IsBoolean3,
3462
+ IsConstructor: () => IsConstructor2,
3463
+ IsDate: () => IsDate3,
3464
+ IsFunction: () => IsFunction3,
3465
+ IsInteger: () => IsInteger2,
3466
+ IsIntersect: () => IsIntersect2,
3467
+ IsIterator: () => IsIterator3,
3468
+ IsKind: () => IsKind2,
3469
+ IsKindOf: () => IsKindOf2,
3470
+ IsLiteral: () => IsLiteral2,
3471
+ IsLiteralBoolean: () => IsLiteralBoolean,
3472
+ IsLiteralNumber: () => IsLiteralNumber,
3473
+ IsLiteralString: () => IsLiteralString,
3474
+ IsLiteralValue: () => IsLiteralValue,
3475
+ IsMappedKey: () => IsMappedKey2,
3476
+ IsMappedResult: () => IsMappedResult2,
3477
+ IsNever: () => IsNever2,
3478
+ IsNot: () => IsNot2,
3479
+ IsNull: () => IsNull3,
3480
+ IsNumber: () => IsNumber3,
3481
+ IsObject: () => IsObject3,
3482
+ IsOptional: () => IsOptional2,
3483
+ IsPromise: () => IsPromise2,
3484
+ IsProperties: () => IsProperties,
3485
+ IsReadonly: () => IsReadonly2,
3486
+ IsRecord: () => IsRecord2,
3487
+ IsRecursive: () => IsRecursive,
3488
+ IsRef: () => IsRef2,
3489
+ IsRegExp: () => IsRegExp3,
3490
+ IsSchema: () => IsSchema2,
3491
+ IsString: () => IsString3,
3492
+ IsSymbol: () => IsSymbol3,
3493
+ IsTemplateLiteral: () => IsTemplateLiteral2,
3494
+ IsThis: () => IsThis2,
3495
+ IsTransform: () => IsTransform2,
3496
+ IsTuple: () => IsTuple2,
3497
+ IsUint8Array: () => IsUint8Array3,
3498
+ IsUndefined: () => IsUndefined3,
3499
+ IsUnion: () => IsUnion2,
3500
+ IsUnionLiteral: () => IsUnionLiteral,
3501
+ IsUnknown: () => IsUnknown2,
3502
+ IsUnsafe: () => IsUnsafe2,
3503
+ IsVoid: () => IsVoid2,
3504
+ TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
3505
+ });
3506
+ var TypeGuardUnknownTypeError = class extends TypeBoxError {
3507
+ };
3508
+ var KnownTypes = [
3509
+ "Any",
3510
+ "Array",
3511
+ "AsyncIterator",
3512
+ "BigInt",
3513
+ "Boolean",
3514
+ "Constructor",
3515
+ "Date",
3516
+ "Enum",
3517
+ "Function",
3518
+ "Integer",
3519
+ "Intersect",
3520
+ "Iterator",
3521
+ "Literal",
3522
+ "MappedKey",
3523
+ "MappedResult",
3524
+ "Not",
3525
+ "Null",
3526
+ "Number",
3527
+ "Object",
3528
+ "Promise",
3529
+ "Record",
3530
+ "Ref",
3531
+ "RegExp",
3532
+ "String",
3533
+ "Symbol",
3534
+ "TemplateLiteral",
3535
+ "This",
3536
+ "Tuple",
3537
+ "Undefined",
3538
+ "Union",
3539
+ "Uint8Array",
3540
+ "Unknown",
3541
+ "Void"
3542
+ ];
3543
+ function IsPattern(value) {
3544
+ try {
3545
+ new RegExp(value);
3546
+ return true;
3547
+ } catch {
3548
+ return false;
3549
+ }
3550
+ }
3551
+ function IsControlCharacterFree(value) {
3552
+ if (!IsString(value))
3553
+ return false;
3554
+ for (let i = 0; i < value.length; i++) {
3555
+ const code = value.charCodeAt(i);
3556
+ if (code >= 7 && code <= 13 || code === 27 || code === 127) {
3557
+ return false;
3558
+ }
3559
+ }
3560
+ return true;
3561
+ }
3562
+ function IsAdditionalProperties(value) {
3563
+ return IsOptionalBoolean(value) || IsSchema2(value);
3564
+ }
3565
+ function IsOptionalBigInt(value) {
3566
+ return IsUndefined(value) || IsBigInt(value);
3567
+ }
3568
+ function IsOptionalNumber(value) {
3569
+ return IsUndefined(value) || IsNumber(value);
3570
+ }
3571
+ function IsOptionalBoolean(value) {
3572
+ return IsUndefined(value) || IsBoolean(value);
3573
+ }
3574
+ function IsOptionalString(value) {
3575
+ return IsUndefined(value) || IsString(value);
3576
+ }
3577
+ function IsOptionalPattern(value) {
3578
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
3579
+ }
3580
+ function IsOptionalFormat(value) {
3581
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
3582
+ }
3583
+ function IsOptionalSchema(value) {
3584
+ return IsUndefined(value) || IsSchema2(value);
3585
+ }
3586
+ function IsReadonly2(value) {
3587
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
3588
+ }
3589
+ function IsOptional2(value) {
3590
+ return IsObject(value) && value[OptionalKind] === "Optional";
3591
+ }
3592
+ function IsAny2(value) {
3593
+ return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
3594
+ }
3595
+ function IsArray3(value) {
3596
+ return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
3597
+ }
3598
+ function IsAsyncIterator3(value) {
3599
+ return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3600
+ }
3601
+ function IsBigInt3(value) {
3602
+ return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
3603
+ }
3604
+ function IsBoolean3(value) {
3605
+ return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
3606
+ }
3607
+ function IsConstructor2(value) {
3608
+ return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3609
+ }
3610
+ function IsDate3(value) {
3611
+ return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
3612
+ }
3613
+ function IsFunction3(value) {
3614
+ return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3615
+ }
3616
+ function IsInteger2(value) {
3617
+ return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
3618
+ }
3619
+ function IsProperties(value) {
3620
+ return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
3621
+ }
3622
+ function IsIntersect2(value) {
3623
+ return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
3624
+ }
3625
+ function IsIterator3(value) {
3626
+ return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3627
+ }
3628
+ function IsKindOf2(value, kind) {
3629
+ return IsObject(value) && Kind in value && value[Kind] === kind;
3630
+ }
3631
+ function IsLiteralString(value) {
3632
+ return IsLiteral2(value) && IsString(value.const);
3633
+ }
3634
+ function IsLiteralNumber(value) {
3635
+ return IsLiteral2(value) && IsNumber(value.const);
3636
+ }
3637
+ function IsLiteralBoolean(value) {
3638
+ return IsLiteral2(value) && IsBoolean(value.const);
3639
+ }
3640
+ function IsLiteral2(value) {
3641
+ return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue(value.const);
3642
+ }
3643
+ function IsLiteralValue(value) {
3644
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
3645
+ }
3646
+ function IsMappedKey2(value) {
3647
+ return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
3648
+ }
3649
+ function IsMappedResult2(value) {
3650
+ return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
3651
+ }
3652
+ function IsNever2(value) {
3653
+ return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
3654
+ }
3655
+ function IsNot2(value) {
3656
+ return IsKindOf2(value, "Not") && IsSchema2(value.not);
3657
+ }
3658
+ function IsNull3(value) {
3659
+ return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
3660
+ }
3661
+ function IsNumber3(value) {
3662
+ return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
3663
+ }
3664
+ function IsObject3(value) {
3665
+ return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
3666
+ }
3667
+ function IsPromise2(value) {
3668
+ return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
3669
+ }
3670
+ function IsRecord2(value) {
3671
+ return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
3672
+ const keys = Object.getOwnPropertyNames(schema.patternProperties);
3673
+ return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
3674
+ })(value);
3675
+ }
3676
+ function IsRecursive(value) {
3677
+ return IsObject(value) && Hint in value && value[Hint] === "Recursive";
3678
+ }
3679
+ function IsRef2(value) {
3680
+ return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
3681
+ }
3682
+ function IsRegExp3(value) {
3683
+ return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
3684
+ }
3685
+ function IsString3(value) {
3686
+ return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
3687
+ }
3688
+ function IsSymbol3(value) {
3689
+ return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
3690
+ }
3691
+ function IsTemplateLiteral2(value) {
3692
+ return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
3693
+ }
3694
+ function IsThis2(value) {
3695
+ return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
3696
+ }
3697
+ function IsTransform2(value) {
3698
+ return IsObject(value) && TransformKind in value;
3699
+ }
3700
+ function IsTuple2(value) {
3701
+ return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
3702
+ (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
3703
+ }
3704
+ function IsUndefined3(value) {
3705
+ return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
3706
+ }
3707
+ function IsUnionLiteral(value) {
3708
+ return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
3709
+ }
3710
+ function IsUnion2(value) {
3711
+ return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
3712
+ }
3713
+ function IsUint8Array3(value) {
3714
+ return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
3715
+ }
3716
+ function IsUnknown2(value) {
3717
+ return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
3718
+ }
3719
+ function IsUnsafe2(value) {
3720
+ return IsKindOf2(value, "Unsafe");
3721
+ }
3722
+ function IsVoid2(value) {
3723
+ return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
3724
+ }
3725
+ function IsKind2(value) {
3726
+ return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
3727
+ }
3728
+ function IsSchema2(value) {
3729
+ return IsObject(value) && (IsAny2(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined3(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
3730
+ }
3731
+
3732
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
3733
+ var ExtendsResolverError = class extends TypeBoxError {
3734
+ };
3735
+ var ExtendsResult;
3736
+ (function(ExtendsResult2) {
3737
+ ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
3738
+ ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
3739
+ ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
3740
+ })(ExtendsResult || (ExtendsResult = {}));
3741
+ function IntoBooleanResult(result) {
3742
+ return result === ExtendsResult.False ? result : ExtendsResult.True;
3743
+ }
3744
+ function Throw(message) {
3745
+ throw new ExtendsResolverError(message);
3746
+ }
3747
+ function IsStructuralRight(right) {
3748
+ return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
3749
+ }
3750
+ function StructuralRight(left, right) {
3751
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
3752
+ }
3753
+ function FromAnyRight(left, right) {
3754
+ return ExtendsResult.True;
3755
+ }
3756
+ function FromAny(left, right) {
3757
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
3758
+ }
3759
+ function FromArrayRight(left, right) {
3760
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
3761
+ }
3762
+ function FromArray5(left, right) {
3763
+ return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3764
+ }
3765
+ function FromAsyncIterator2(left, right) {
3766
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3767
+ }
3768
+ function FromBigInt(left, right) {
3769
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
3770
+ }
3771
+ function FromBooleanRight(left, right) {
3772
+ return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
3773
+ }
3774
+ function FromBoolean(left, right) {
3775
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
3776
+ }
3777
+ function FromConstructor2(left, right) {
3778
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3779
+ }
3780
+ function FromDate(left, right) {
3781
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
3782
+ }
3783
+ function FromFunction2(left, right) {
3784
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
3785
+ }
3786
+ function FromIntegerRight(left, right) {
3787
+ return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3788
+ }
3789
+ function FromInteger(left, right) {
3790
+ return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
3791
+ }
3792
+ function FromIntersectRight(left, right) {
3793
+ return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3794
+ }
3795
+ function FromIntersect5(left, right) {
3796
+ return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3797
+ }
3798
+ function FromIterator2(left, right) {
3799
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
3800
+ }
3801
+ function FromLiteral2(left, right) {
3802
+ return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
3803
+ }
3804
+ function FromNeverRight(left, right) {
3805
+ return ExtendsResult.False;
3806
+ }
3807
+ function FromNever(left, right) {
3808
+ return ExtendsResult.True;
3809
+ }
3810
+ function UnwrapTNot(schema) {
3811
+ let [current, depth] = [schema, 0];
3812
+ while (true) {
3813
+ if (!type_exports.IsNot(current))
3814
+ break;
3815
+ current = current.not;
3816
+ depth += 1;
3817
+ }
3818
+ return depth % 2 === 0 ? current : Unknown();
3819
+ }
3820
+ function FromNot(left, right) {
3821
+ return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
3822
+ }
3823
+ function FromNull(left, right) {
3824
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
3825
+ }
3826
+ function FromNumberRight(left, right) {
3827
+ return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
3828
+ }
3829
+ function FromNumber(left, right) {
3830
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
3831
+ }
3832
+ function IsObjectPropertyCount(schema, count) {
3833
+ return Object.getOwnPropertyNames(schema.properties).length === count;
3834
+ }
3835
+ function IsObjectStringLike(schema) {
3836
+ return IsObjectArrayLike(schema);
3837
+ }
3838
+ function IsObjectSymbolLike(schema) {
3839
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
3840
+ }
3841
+ function IsObjectNumberLike(schema) {
3842
+ return IsObjectPropertyCount(schema, 0);
3843
+ }
3844
+ function IsObjectBooleanLike(schema) {
3845
+ return IsObjectPropertyCount(schema, 0);
3846
+ }
3847
+ function IsObjectBigIntLike(schema) {
3848
+ return IsObjectPropertyCount(schema, 0);
3849
+ }
3850
+ function IsObjectDateLike(schema) {
3851
+ return IsObjectPropertyCount(schema, 0);
3852
+ }
3853
+ function IsObjectUint8ArrayLike(schema) {
3854
+ return IsObjectArrayLike(schema);
3855
+ }
3856
+ function IsObjectFunctionLike(schema) {
3857
+ const length = Number2();
3858
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3859
+ }
3860
+ function IsObjectConstructorLike(schema) {
3861
+ return IsObjectPropertyCount(schema, 0);
3862
+ }
3863
+ function IsObjectArrayLike(schema) {
3864
+ const length = Number2();
3865
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
3866
+ }
3867
+ function IsObjectPromiseLike(schema) {
3868
+ const then = Function2([Any()], Any());
3869
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
3870
+ }
3871
+ function Property(left, right) {
3872
+ return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
3873
+ }
3874
+ function FromObjectRight(left, right) {
3875
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
3876
+ return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
3877
+ })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
3878
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
3879
+ })() : ExtendsResult.False;
3880
+ }
3881
+ function FromObject2(left, right) {
3882
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
3883
+ for (const key of Object.getOwnPropertyNames(right.properties)) {
3884
+ if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
3885
+ return ExtendsResult.False;
3886
+ }
3887
+ if (type_exports.IsOptional(right.properties[key])) {
3888
+ return ExtendsResult.True;
3889
+ }
3890
+ if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
3891
+ return ExtendsResult.False;
3892
+ }
3893
+ }
3894
+ return ExtendsResult.True;
3895
+ })();
3896
+ }
3897
+ function FromPromise3(left, right) {
3898
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
3899
+ }
3900
+ function RecordKey(schema) {
3901
+ return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String() : Throw("Unknown record key pattern");
3902
+ }
3903
+ function RecordValue(schema) {
3904
+ return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
3905
+ }
3906
+ function FromRecordRight(left, right) {
3907
+ const [Key, Value] = [RecordKey(right), RecordValue(right)];
3908
+ return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
3909
+ for (const key of Object.getOwnPropertyNames(left.properties)) {
3910
+ if (Property(Value, left.properties[key]) === ExtendsResult.False) {
3911
+ return ExtendsResult.False;
3912
+ }
3913
+ }
3914
+ return ExtendsResult.True;
3915
+ })() : ExtendsResult.False;
3916
+ }
3917
+ function FromRecord(left, right) {
3918
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
3919
+ }
3920
+ function FromRegExp(left, right) {
3921
+ const L = type_exports.IsRegExp(left) ? String() : left;
3922
+ const R = type_exports.IsRegExp(right) ? String() : right;
3923
+ return Visit3(L, R);
3924
+ }
3925
+ function FromStringRight(left, right) {
3926
+ return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
3927
+ }
3928
+ function FromString(left, right) {
3929
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
3930
+ }
3931
+ function FromSymbol(left, right) {
3932
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
3933
+ }
3934
+ function FromTemplateLiteral2(left, right) {
3935
+ return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
3936
+ }
3937
+ function IsArrayOfTuple(left, right) {
3938
+ return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
3939
+ }
3940
+ function FromTupleRight(left, right) {
3941
+ return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
3942
+ }
3943
+ function FromTuple4(left, right) {
3944
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3945
+ }
3946
+ function FromUint8Array(left, right) {
3947
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
3948
+ }
3949
+ function FromUndefined(left, right) {
3950
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
3951
+ }
3952
+ function FromUnionRight(left, right) {
3953
+ return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3954
+ }
3955
+ function FromUnion7(left, right) {
3956
+ return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
3957
+ }
3958
+ function FromUnknownRight(left, right) {
3959
+ return ExtendsResult.True;
3960
+ }
3961
+ function FromUnknown(left, right) {
3962
+ return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
3963
+ }
3964
+ function FromVoidRight(left, right) {
3965
+ return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
3966
+ }
3967
+ function FromVoid(left, right) {
3968
+ return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
3969
+ }
3970
+ function Visit3(left, right) {
3971
+ return (
3972
+ // resolvable
3973
+ type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
3974
+ // standard
3975
+ type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray5(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator2(left, right) : type_exports.IsConstructor(left) ? FromConstructor2(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction2(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect5(left, right) : type_exports.IsIterator(left) ? FromIterator2(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject2(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple4(left, right) : type_exports.IsPromise(left) ? FromPromise3(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion7(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
3976
+ )
3977
+ );
3978
+ }
3979
+ function ExtendsCheck(left, right) {
3980
+ return Visit3(left, right);
3981
+ }
3982
+
3983
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
3984
+ function FromProperties9(P, Right, True, False, options) {
3985
+ const Acc = {};
3986
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3987
+ Acc[K2] = Extends(P[K2], Right, True, False, options);
3988
+ return Acc;
3989
+ }
3990
+ function FromMappedResult6(Left, Right, True, False, options) {
3991
+ return FromProperties9(Left.properties, Right, True, False, options);
3992
+ }
3993
+ function ExtendsFromMappedResult(Left, Right, True, False, options) {
3994
+ const P = FromMappedResult6(Left, Right, True, False, options);
3995
+ return MappedResult(P);
3996
+ }
3997
+
3998
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
3999
+ function ExtendsResolve(left, right, trueType, falseType) {
4000
+ const R = ExtendsCheck(left, right);
4001
+ return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
4002
+ }
4003
+ function Extends(L, R, T, F, options = {}) {
4004
+ return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CloneType(ExtendsFromMappedKey(L, R, T, F, options)) : CloneType(ExtendsResolve(L, R, T, F), options);
4005
+ }
4006
+
4007
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
4008
+ function FromPropertyKey(K, U, L, R, options) {
4009
+ return {
4010
+ [K]: Extends(Literal(K), U, L, R, options)
4011
+ };
4012
+ }
4013
+ function FromPropertyKeys(K, U, L, R, options) {
4014
+ return K.reduce((Acc, LK) => {
4015
+ return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
4016
+ }, {});
4017
+ }
4018
+ function FromMappedKey2(K, U, L, R, options) {
4019
+ return FromPropertyKeys(K.keys, U, L, R, options);
4020
+ }
4021
+ function ExtendsFromMappedKey(T, U, L, R, options) {
4022
+ const P = FromMappedKey2(T, U, L, R, options);
4023
+ return MappedResult(P);
4024
+ }
4025
+
4026
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
4027
+ function ExcludeFromTemplateLiteral(L, R) {
4028
+ return Exclude(TemplateLiteralToUnion(L), R);
4029
+ }
4030
+
4031
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
4032
+ function ExcludeRest(L, R) {
4033
+ const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
4034
+ return excluded.length === 1 ? excluded[0] : Union(excluded);
4035
+ }
4036
+ function Exclude(L, R, options = {}) {
4037
+ if (IsTemplateLiteral(L))
4038
+ return CloneType(ExcludeFromTemplateLiteral(L, R), options);
4039
+ if (IsMappedResult(L))
4040
+ return CloneType(ExcludeFromMappedResult(L, R), options);
4041
+ return CloneType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
4042
+ }
4043
+
4044
+ // ../../node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
4045
+ function FromProperties10(P, U) {
4046
+ const Acc = {};
4047
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4048
+ Acc[K2] = Exclude(P[K2], U);
4049
+ return Acc;
4050
+ }
4051
+ function FromMappedResult7(R, T) {
4052
+ return FromProperties10(R.properties, T);
4053
+ }
4054
+ function ExcludeFromMappedResult(R, T) {
4055
+ const P = FromMappedResult7(R, T);
4056
+ return MappedResult(P);
4057
+ }
4058
+
4059
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
4060
+ function ExtractFromTemplateLiteral(L, R) {
4061
+ return Extract(TemplateLiteralToUnion(L), R);
4062
+ }
4063
+
4064
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
4065
+ function ExtractRest(L, R) {
4066
+ const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
4067
+ return extracted.length === 1 ? extracted[0] : Union(extracted);
4068
+ }
4069
+ function Extract(L, R, options = {}) {
4070
+ if (IsTemplateLiteral(L))
4071
+ return CloneType(ExtractFromTemplateLiteral(L, R), options);
4072
+ if (IsMappedResult(L))
4073
+ return CloneType(ExtractFromMappedResult(L, R), options);
4074
+ return CloneType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
4075
+ }
4076
+
4077
+ // ../../node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
4078
+ function FromProperties11(P, T) {
4079
+ const Acc = {};
4080
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4081
+ Acc[K2] = Extract(P[K2], T);
4082
+ return Acc;
4083
+ }
4084
+ function FromMappedResult8(R, T) {
4085
+ return FromProperties11(R.properties, T);
4086
+ }
4087
+ function ExtractFromMappedResult(R, T) {
4088
+ const P = FromMappedResult8(R, T);
4089
+ return MappedResult(P);
4090
+ }
4091
+
4092
+ // ../../node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
4093
+ function InstanceType(schema, options = {}) {
4094
+ return CloneType(schema.returns, options);
4095
+ }
4096
+
4097
+ // ../../node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
4098
+ function Integer(options = {}) {
4099
+ return {
4100
+ ...options,
4101
+ [Kind]: "Integer",
4102
+ type: "integer"
4103
+ };
4104
+ }
4105
+
4106
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
4107
+ function MappedIntrinsicPropertyKey(K, M, options) {
4108
+ return {
4109
+ [K]: Intrinsic(Literal(K), M, options)
4110
+ };
4111
+ }
4112
+ function MappedIntrinsicPropertyKeys(K, M, options) {
4113
+ return K.reduce((Acc, L) => {
4114
+ return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
4115
+ }, {});
4116
+ }
4117
+ function MappedIntrinsicProperties(T, M, options) {
4118
+ return MappedIntrinsicPropertyKeys(T["keys"], M, options);
4119
+ }
4120
+ function IntrinsicFromMappedKey(T, M, options) {
4121
+ const P = MappedIntrinsicProperties(T, M, options);
4122
+ return MappedResult(P);
4123
+ }
4124
+
4125
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
4126
+ function ApplyUncapitalize(value) {
4127
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4128
+ return [first.toLowerCase(), rest].join("");
4129
+ }
4130
+ function ApplyCapitalize(value) {
4131
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4132
+ return [first.toUpperCase(), rest].join("");
4133
+ }
4134
+ function ApplyUppercase(value) {
4135
+ return value.toUpperCase();
4136
+ }
4137
+ function ApplyLowercase(value) {
4138
+ return value.toLowerCase();
4139
+ }
4140
+ function FromTemplateLiteral3(schema, mode, options) {
4141
+ const expression = TemplateLiteralParseExact(schema.pattern);
4142
+ const finite = IsTemplateLiteralExpressionFinite(expression);
4143
+ if (!finite)
4144
+ return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
4145
+ const strings = [...TemplateLiteralExpressionGenerate(expression)];
4146
+ const literals = strings.map((value) => Literal(value));
4147
+ const mapped = FromRest6(literals, mode);
4148
+ const union = Union(mapped);
4149
+ return TemplateLiteral([union], options);
4150
+ }
4151
+ function FromLiteralValue(value, mode) {
4152
+ return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
4153
+ }
4154
+ function FromRest6(T, M) {
4155
+ return T.map((L) => Intrinsic(L, M));
4156
+ }
4157
+ function Intrinsic(schema, mode, options = {}) {
4158
+ return (
4159
+ // Intrinsic-Mapped-Inference
4160
+ IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
4161
+ // Standard-Inference
4162
+ IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, schema) : IsUnion(schema) ? Union(FromRest6(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : schema
4163
+ )
4164
+ );
4165
+ }
4166
+
4167
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
4168
+ function Capitalize(T, options = {}) {
4169
+ return Intrinsic(T, "Capitalize", options);
4170
+ }
4171
+
4172
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
4173
+ function Lowercase(T, options = {}) {
4174
+ return Intrinsic(T, "Lowercase", options);
4175
+ }
4176
+
4177
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
4178
+ function Uncapitalize(T, options = {}) {
4179
+ return Intrinsic(T, "Uncapitalize", options);
4180
+ }
4181
+
4182
+ // ../../node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
4183
+ function Uppercase(T, options = {}) {
4184
+ return Intrinsic(T, "Uppercase", options);
4185
+ }
4186
+
4187
+ // ../../node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
4188
+ function Not(schema, options) {
4189
+ return {
4190
+ ...options,
4191
+ [Kind]: "Not",
4192
+ not: CloneType(schema)
4193
+ };
4194
+ }
4195
+
4196
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
4197
+ function FromProperties12(P, K, options) {
4198
+ const Acc = {};
4199
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4200
+ Acc[K2] = Omit(P[K2], K, options);
4201
+ return Acc;
4202
+ }
4203
+ function FromMappedResult9(R, K, options) {
4204
+ return FromProperties12(R.properties, K, options);
4205
+ }
4206
+ function OmitFromMappedResult(R, K, options) {
4207
+ const P = FromMappedResult9(R, K, options);
4208
+ return MappedResult(P);
4209
+ }
4210
+
4211
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
4212
+ function FromIntersect6(T, K) {
4213
+ return T.map((T2) => OmitResolve(T2, K));
4214
+ }
4215
+ function FromUnion8(T, K) {
4216
+ return T.map((T2) => OmitResolve(T2, K));
4217
+ }
4218
+ function FromProperty2(T, K) {
4219
+ const { [K]: _, ...R } = T;
4220
+ return R;
4221
+ }
4222
+ function FromProperties13(T, K) {
4223
+ return K.reduce((T2, K2) => FromProperty2(T2, K2), T);
4224
+ }
4225
+ function OmitResolve(T, K) {
4226
+ return IsIntersect(T) ? Intersect(FromIntersect6(T.allOf, K)) : IsUnion(T) ? Union(FromUnion8(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties13(T.properties, K)) : Object2({});
4227
+ }
4228
+ function Omit(T, K, options = {}) {
4229
+ if (IsMappedKey(K))
4230
+ return OmitFromMappedKey(T, K, options);
4231
+ if (IsMappedResult(T))
4232
+ return OmitFromMappedResult(T, K, options);
4233
+ const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
4234
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4235
+ const R = CloneType(OmitResolve(T, I), options);
4236
+ return { ...D, ...R };
4237
+ }
4238
+
4239
+ // ../../node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
4240
+ function FromPropertyKey2(T, K, options) {
4241
+ return {
4242
+ [K]: Omit(T, [K], options)
4243
+ };
4244
+ }
4245
+ function FromPropertyKeys2(T, K, options) {
4246
+ return K.reduce((Acc, LK) => {
4247
+ return { ...Acc, ...FromPropertyKey2(T, LK, options) };
4248
+ }, {});
4249
+ }
4250
+ function FromMappedKey3(T, K, options) {
4251
+ return FromPropertyKeys2(T, K.keys, options);
4252
+ }
4253
+ function OmitFromMappedKey(T, K, options) {
4254
+ const P = FromMappedKey3(T, K, options);
4255
+ return MappedResult(P);
4256
+ }
4257
+
4258
+ // ../../node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
4259
+ function Parameters(schema, options = {}) {
4260
+ return Tuple(CloneRest(schema.parameters), { ...options });
4261
+ }
4262
+
4263
+ // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
4264
+ function FromRest7(T) {
4265
+ return T.map((L) => PartialResolve(L));
4266
+ }
4267
+ function FromProperties14(T) {
4268
+ const Acc = {};
4269
+ for (const K of globalThis.Object.getOwnPropertyNames(T))
4270
+ Acc[K] = Optional(T[K]);
4271
+ return Acc;
4272
+ }
4273
+ function PartialResolve(T) {
4274
+ return IsIntersect(T) ? Intersect(FromRest7(T.allOf)) : IsUnion(T) ? Union(FromRest7(T.anyOf)) : IsObject2(T) ? Object2(FromProperties14(T.properties)) : Object2({});
4275
+ }
4276
+ function Partial(T, options = {}) {
4277
+ if (IsMappedResult(T))
4278
+ return PartialFromMappedResult(T, options);
4279
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4280
+ const R = CloneType(PartialResolve(T), options);
4281
+ return { ...D, ...R };
4282
+ }
4283
+
4284
+ // ../../node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
4285
+ function FromProperties15(K, options) {
4286
+ const Acc = {};
4287
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
4288
+ Acc[K2] = Partial(K[K2], options);
4289
+ return Acc;
4290
+ }
4291
+ function FromMappedResult10(R, options) {
4292
+ return FromProperties15(R.properties, options);
4293
+ }
4294
+ function PartialFromMappedResult(R, options) {
4295
+ const P = FromMappedResult10(R, options);
4296
+ return MappedResult(P);
4297
+ }
4298
+
4299
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
4300
+ function FromProperties16(P, K, options) {
4301
+ const Acc = {};
4302
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4303
+ Acc[K2] = Pick(P[K2], K, options);
4304
+ return Acc;
4305
+ }
4306
+ function FromMappedResult11(R, K, options) {
4307
+ return FromProperties16(R.properties, K, options);
4308
+ }
4309
+ function PickFromMappedResult(R, K, options) {
4310
+ const P = FromMappedResult11(R, K, options);
4311
+ return MappedResult(P);
4312
+ }
4313
+
4314
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
4315
+ function FromIntersect7(T, K) {
4316
+ return T.map((T2) => PickResolve(T2, K));
4317
+ }
4318
+ function FromUnion9(T, K) {
4319
+ return T.map((T2) => PickResolve(T2, K));
4320
+ }
4321
+ function FromProperties17(T, K) {
4322
+ const Acc = {};
4323
+ for (const K2 of K)
4324
+ if (K2 in T)
4325
+ Acc[K2] = T[K2];
4326
+ return Acc;
4327
+ }
4328
+ function PickResolve(T, K) {
4329
+ return IsIntersect(T) ? Intersect(FromIntersect7(T.allOf, K)) : IsUnion(T) ? Union(FromUnion9(T.anyOf, K)) : IsObject2(T) ? Object2(FromProperties17(T.properties, K)) : Object2({});
4330
+ }
4331
+ function Pick(T, K, options = {}) {
4332
+ if (IsMappedKey(K))
4333
+ return PickFromMappedKey(T, K, options);
4334
+ if (IsMappedResult(T))
4335
+ return PickFromMappedResult(T, K, options);
4336
+ const I = IsSchema(K) ? IndexPropertyKeys(K) : K;
4337
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4338
+ const R = CloneType(PickResolve(T, I), options);
4339
+ return { ...D, ...R };
4340
+ }
4341
+
4342
+ // ../../node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
4343
+ function FromPropertyKey3(T, K, options) {
4344
+ return {
4345
+ [K]: Pick(T, [K], options)
4346
+ };
4347
+ }
4348
+ function FromPropertyKeys3(T, K, options) {
4349
+ return K.reduce((Acc, LK) => {
4350
+ return { ...Acc, ...FromPropertyKey3(T, LK, options) };
4351
+ }, {});
4352
+ }
4353
+ function FromMappedKey4(T, K, options) {
4354
+ return FromPropertyKeys3(T, K.keys, options);
4355
+ }
4356
+ function PickFromMappedKey(T, K, options) {
4357
+ const P = FromMappedKey4(T, K, options);
4358
+ return MappedResult(P);
4359
+ }
4360
+
4361
+ // ../../node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
4362
+ function ReadonlyOptional(schema) {
4363
+ return Readonly(Optional(schema));
4364
+ }
4365
+
4366
+ // ../../node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
4367
+ function RecordCreateFromPattern(pattern, T, options) {
4368
+ return {
4369
+ ...options,
4370
+ [Kind]: "Record",
4371
+ type: "object",
4372
+ patternProperties: { [pattern]: CloneType(T) }
4373
+ };
4374
+ }
4375
+ function RecordCreateFromKeys(K, T, options) {
4376
+ const Acc = {};
4377
+ for (const K2 of K)
4378
+ Acc[K2] = CloneType(T);
4379
+ return Object2(Acc, { ...options, [Hint]: "Record" });
4380
+ }
4381
+ function FromTemplateLiteralKey(K, T, options) {
4382
+ return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
4383
+ }
4384
+ function FromUnionKey(K, T, options) {
4385
+ return RecordCreateFromKeys(IndexPropertyKeys(Union(K)), T, options);
4386
+ }
4387
+ function FromLiteralKey(K, T, options) {
4388
+ return RecordCreateFromKeys([K.toString()], T, options);
4389
+ }
4390
+ function FromRegExpKey(K, T, options) {
4391
+ return RecordCreateFromPattern(K.source, T, options);
4392
+ }
4393
+ function FromStringKey(K, T, options) {
4394
+ const pattern = IsUndefined(K.pattern) ? PatternStringExact : K.pattern;
4395
+ return RecordCreateFromPattern(pattern, T, options);
4396
+ }
4397
+ function FromIntegerKey(_, T, options) {
4398
+ return RecordCreateFromPattern(PatternNumberExact, T, options);
4399
+ }
4400
+ function FromNumberKey(_, T, options) {
4401
+ return RecordCreateFromPattern(PatternNumberExact, T, options);
4402
+ }
4403
+ function Record(K, T, options = {}) {
4404
+ return IsUnion(K) ? FromUnionKey(K.anyOf, T, options) : IsTemplateLiteral(K) ? FromTemplateLiteralKey(K, T, options) : IsLiteral(K) ? FromLiteralKey(K.const, T, options) : IsInteger(K) ? FromIntegerKey(K, T, options) : IsNumber2(K) ? FromNumberKey(K, T, options) : IsRegExp2(K) ? FromRegExpKey(K, T, options) : IsString2(K) ? FromStringKey(K, T, options) : Never(options);
4405
+ }
4406
+
4407
+ // ../../node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
4408
+ var Ordinal = 0;
4409
+ function Recursive(callback, options = {}) {
4410
+ if (IsUndefined(options.$id))
4411
+ options.$id = `T${Ordinal++}`;
4412
+ const thisType = callback({ [Kind]: "This", $ref: `${options.$id}` });
4413
+ thisType.$id = options.$id;
4414
+ return CloneType({ ...options, [Hint]: "Recursive", ...thisType });
4415
+ }
4416
+
4417
+ // ../../node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
4418
+ function Ref(unresolved, options = {}) {
4419
+ if (IsString(unresolved))
4420
+ return { ...options, [Kind]: "Ref", $ref: unresolved };
4421
+ if (IsUndefined(unresolved.$id))
4422
+ throw new Error("Reference target type must specify an $id");
4423
+ return {
4424
+ ...options,
4425
+ [Kind]: "Ref",
4426
+ $ref: unresolved.$id
4427
+ };
4428
+ }
4429
+
4430
+ // ../../node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
4431
+ function RegExp2(unresolved, options = {}) {
4432
+ const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
4433
+ return { ...options, [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags };
4434
+ }
4435
+
4436
+ // ../../node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs
4437
+ var format_exports = {};
4438
+ __export(format_exports, {
4439
+ Clear: () => Clear,
4440
+ Delete: () => Delete,
4441
+ Entries: () => Entries,
4442
+ Get: () => Get,
4443
+ Has: () => Has,
4444
+ Set: () => Set2
4445
+ });
4446
+ var map = /* @__PURE__ */ new Map();
4447
+ function Entries() {
4448
+ return new Map(map);
4449
+ }
4450
+ function Clear() {
4451
+ return map.clear();
4452
+ }
4453
+ function Delete(format) {
4454
+ return map.delete(format);
4455
+ }
4456
+ function Has(format) {
4457
+ return map.has(format);
4458
+ }
4459
+ function Set2(format, func) {
4460
+ map.set(format, func);
4461
+ }
4462
+ function Get(format) {
4463
+ return map.get(format);
4464
+ }
4465
+
4466
+ // ../../node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs
4467
+ var type_exports2 = {};
4468
+ __export(type_exports2, {
4469
+ Clear: () => Clear2,
4470
+ Delete: () => Delete2,
4471
+ Entries: () => Entries2,
4472
+ Get: () => Get2,
4473
+ Has: () => Has2,
4474
+ Set: () => Set3
4475
+ });
4476
+ var map2 = /* @__PURE__ */ new Map();
4477
+ function Entries2() {
4478
+ return new Map(map2);
4479
+ }
4480
+ function Clear2() {
4481
+ return map2.clear();
4482
+ }
4483
+ function Delete2(kind) {
4484
+ return map2.delete(kind);
4485
+ }
4486
+ function Has2(kind) {
4487
+ return map2.has(kind);
4488
+ }
4489
+ function Set3(kind, func) {
4490
+ map2.set(kind, func);
4491
+ }
4492
+ function Get2(kind) {
4493
+ return map2.get(kind);
4494
+ }
4495
+
4496
+ // ../../node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
4497
+ function FromRest8(T) {
4498
+ return T.map((L) => RequiredResolve(L));
4499
+ }
4500
+ function FromProperties18(T) {
4501
+ const Acc = {};
4502
+ for (const K of globalThis.Object.getOwnPropertyNames(T))
4503
+ Acc[K] = Discard(T[K], [OptionalKind]);
4504
+ return Acc;
4505
+ }
4506
+ function RequiredResolve(T) {
4507
+ return IsIntersect(T) ? Intersect(FromRest8(T.allOf)) : IsUnion(T) ? Union(FromRest8(T.anyOf)) : IsObject2(T) ? Object2(FromProperties18(T.properties)) : Object2({});
4508
+ }
4509
+ function Required(T, options = {}) {
4510
+ if (IsMappedResult(T)) {
4511
+ return RequiredFromMappedResult(T, options);
4512
+ } else {
4513
+ const D = Discard(T, [TransformKind, "$id", "required"]);
4514
+ const R = CloneType(RequiredResolve(T), options);
4515
+ return { ...D, ...R };
4516
+ }
4517
+ }
4518
+
4519
+ // ../../node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
4520
+ function FromProperties19(P, options) {
4521
+ const Acc = {};
4522
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4523
+ Acc[K2] = Required(P[K2], options);
4524
+ return Acc;
4525
+ }
4526
+ function FromMappedResult12(R, options) {
4527
+ return FromProperties19(R.properties, options);
4528
+ }
4529
+ function RequiredFromMappedResult(R, options) {
4530
+ const P = FromMappedResult12(R, options);
4531
+ return MappedResult(P);
4532
+ }
4533
+
4534
+ // ../../node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
4535
+ function RestResolve(T) {
4536
+ return IsIntersect(T) ? CloneRest(T.allOf) : IsUnion(T) ? CloneRest(T.anyOf) : IsTuple(T) ? CloneRest(T.items ?? []) : [];
4537
+ }
4538
+ function Rest(T) {
4539
+ return CloneRest(RestResolve(T));
4540
+ }
4541
+
4542
+ // ../../node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
4543
+ function ReturnType(schema, options = {}) {
4544
+ return CloneType(schema.returns, options);
4545
+ }
4546
+
4547
+ // ../../node_modules/@sinclair/typebox/build/esm/type/strict/strict.mjs
4548
+ function Strict(schema) {
4549
+ return JSON.parse(JSON.stringify(schema));
4550
+ }
4551
+
4552
+ // ../../node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
4553
+ var TransformDecodeBuilder = class {
4554
+ schema;
4555
+ constructor(schema) {
4556
+ this.schema = schema;
4557
+ }
4558
+ Decode(decode) {
4559
+ return new TransformEncodeBuilder(this.schema, decode);
4560
+ }
4561
+ };
4562
+ var TransformEncodeBuilder = class {
4563
+ schema;
4564
+ decode;
4565
+ constructor(schema, decode) {
4566
+ this.schema = schema;
4567
+ this.decode = decode;
4568
+ }
4569
+ EncodeTransform(encode, schema) {
4570
+ const Encode = (value) => schema[TransformKind].Encode(encode(value));
4571
+ const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
4572
+ const Codec = { Encode, Decode };
4573
+ return { ...schema, [TransformKind]: Codec };
4574
+ }
4575
+ EncodeSchema(encode, schema) {
4576
+ const Codec = { Decode: this.decode, Encode: encode };
4577
+ return { ...schema, [TransformKind]: Codec };
4578
+ }
4579
+ Encode(encode) {
4580
+ const schema = CloneType(this.schema);
4581
+ return IsTransform(schema) ? this.EncodeTransform(encode, schema) : this.EncodeSchema(encode, schema);
4582
+ }
4583
+ };
4584
+ function Transform(schema) {
4585
+ return new TransformDecodeBuilder(schema);
4586
+ }
4587
+
4588
+ // ../../node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
4589
+ function Unsafe(options = {}) {
4590
+ return {
4591
+ ...options,
4592
+ [Kind]: options[Kind] ?? "Unsafe"
4593
+ };
4594
+ }
4595
+
4596
+ // ../../node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
4597
+ var type_exports3 = {};
4598
+ __export(type_exports3, {
4599
+ Any: () => Any,
4600
+ Array: () => Array2,
4601
+ AsyncIterator: () => AsyncIterator,
4602
+ Awaited: () => Awaited,
4603
+ BigInt: () => BigInt2,
4604
+ Boolean: () => Boolean,
4605
+ Capitalize: () => Capitalize,
4606
+ Composite: () => Composite,
4607
+ Const: () => Const,
4608
+ Constructor: () => Constructor,
4609
+ ConstructorParameters: () => ConstructorParameters,
4610
+ Date: () => Date2,
4611
+ Deref: () => Deref,
4612
+ Enum: () => Enum,
4613
+ Exclude: () => Exclude,
4614
+ Extends: () => Extends,
4615
+ Extract: () => Extract,
4616
+ Function: () => Function2,
4617
+ Index: () => Index,
4618
+ InstanceType: () => InstanceType,
4619
+ Integer: () => Integer,
4620
+ Intersect: () => Intersect,
4621
+ Iterator: () => Iterator,
4622
+ KeyOf: () => KeyOf,
4623
+ Literal: () => Literal,
4624
+ Lowercase: () => Lowercase,
4625
+ Mapped: () => Mapped,
4626
+ Never: () => Never,
4627
+ Not: () => Not,
4628
+ Null: () => Null,
4629
+ Number: () => Number2,
4630
+ Object: () => Object2,
4631
+ Omit: () => Omit,
4632
+ Optional: () => Optional,
4633
+ Parameters: () => Parameters,
4634
+ Partial: () => Partial,
4635
+ Pick: () => Pick,
4636
+ Promise: () => Promise2,
4637
+ Readonly: () => Readonly,
4638
+ ReadonlyOptional: () => ReadonlyOptional,
4639
+ Record: () => Record,
4640
+ Recursive: () => Recursive,
4641
+ Ref: () => Ref,
4642
+ RegExp: () => RegExp2,
4643
+ Required: () => Required,
4644
+ Rest: () => Rest,
4645
+ ReturnType: () => ReturnType,
4646
+ Strict: () => Strict,
4647
+ String: () => String,
4648
+ Symbol: () => Symbol2,
4649
+ TemplateLiteral: () => TemplateLiteral,
4650
+ Transform: () => Transform,
4651
+ Tuple: () => Tuple,
4652
+ Uint8Array: () => Uint8Array2,
4653
+ Uncapitalize: () => Uncapitalize,
4654
+ Undefined: () => Undefined,
4655
+ Union: () => Union,
4656
+ Unknown: () => Unknown,
4657
+ Unsafe: () => Unsafe,
4658
+ Uppercase: () => Uppercase,
4659
+ Void: () => Void
4660
+ });
4661
+
4662
+ // ../../node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
4663
+ function Void(options = {}) {
4664
+ return {
4665
+ ...options,
4666
+ [Kind]: "Void",
4667
+ type: "void"
4668
+ };
4669
+ }
4670
+
4671
+ // ../../node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
4672
+ var Type = type_exports3;
4673
+
4674
+ // ../noya-schemas/src/jsonSchema.ts
4675
+ var jsonSchema = Type.Recursive(
4676
+ (This) => Type.Union(
4677
+ [
4678
+ Type.Object({
4679
+ type: Type.Literal("string"),
4680
+ default: Type.Optional(Type.String()),
4681
+ _kind: Type.Literal("String")
4682
+ }),
4683
+ Type.Object({
4684
+ type: Type.Literal("number"),
4685
+ default: Type.Optional(Type.Number()),
4686
+ minimum: Type.Optional(Type.Number()),
4687
+ maximum: Type.Optional(Type.Number()),
4688
+ _kind: Type.Literal("Number")
4689
+ }),
4690
+ Type.Object({
4691
+ type: Type.Literal("boolean"),
4692
+ default: Type.Optional(Type.Boolean()),
4693
+ _kind: Type.Literal("Boolean")
4694
+ }),
4695
+ Type.Object({
4696
+ type: Type.Literal("null"),
4697
+ _kind: Type.Literal("Null")
4698
+ }),
4699
+ Type.Object({
4700
+ type: Type.Literal("array"),
4701
+ items: This,
4702
+ // default: Type.Optional(Type.Array(Type.Any())),
4703
+ // minItems: Type.Optional(Type.Number()),
4704
+ // maxItems: Type.Optional(Type.Number()),
4705
+ _kind: Type.Literal("Array")
4706
+ }),
4707
+ Type.Object({
4708
+ type: Type.Literal("object"),
4709
+ properties: Type.Record(Type.String(), This),
4710
+ required: Type.Optional(Type.Array(Type.String())),
4711
+ // default: Type.Optional(Type.Record(Type.String(), Type.Any())),
4712
+ _kind: Type.Literal("Object")
4713
+ })
4714
+ ],
4715
+ {
4716
+ discriminator: "type"
4717
+ }
4718
+ ),
4719
+ {
4720
+ $id: "jsonSchema"
4721
+ }
4722
+ );
4723
+
4724
+ // ../noya-schemas/src/input.ts
4725
+ function Nullable(type) {
4726
+ return Type.Union([type, Type.Null()]);
4727
+ }
4728
+ var inputSchemaBase = {
4729
+ id: Type.String({ format: "uuid", default: "" }),
4730
+ name: Type.String(),
4731
+ description: Nullable(Type.String()),
4732
+ required: Type.Boolean({ default: false })
4733
+ };
4734
+ var fileInputSchema = Type.Object({
4735
+ ...inputSchemaBase,
4736
+ kind: Type.Literal("file"),
4737
+ toolId: Nullable(Type.String())
4738
+ });
4739
+ var dataInputSchema = Type.Object({
4740
+ ...inputSchemaBase,
4741
+ kind: Type.Literal("data"),
4742
+ schema: Nullable(jsonSchema)
4743
+ });
4744
+ var inputSchema = Type.Union([fileInputSchema, dataInputSchema], {
4745
+ discriminator: "kind"
4746
+ });
4747
+ var outputTransformSchemaBase = {
4748
+ id: Type.String({ format: "uuid", default: "" }),
4749
+ order: Type.Number()
4750
+ };
4751
+ var scriptOutputTransformSchema = Type.Object({
4752
+ ...outputTransformSchemaBase,
4753
+ kind: Type.Literal("script"),
4754
+ location: Type.Union([Type.Literal("state"), Type.Literal("url")]),
4755
+ value: Type.String()
4756
+ });
4757
+ var jsonPointerOutputTransformSchema = Type.Object({
4758
+ ...outputTransformSchemaBase,
4759
+ kind: Type.Literal("jsonPointer"),
4760
+ value: Type.String()
4761
+ });
4762
+ var outputTransformSchema = Type.Union(
4763
+ [scriptOutputTransformSchema, jsonPointerOutputTransformSchema],
4764
+ { discriminator: "kind" }
4765
+ );
4766
+
4767
+ // ../../node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
4768
+ function IsObject4(value) {
4769
+ return value !== null && typeof value === "object";
4770
+ }
4771
+ function IsArray4(value) {
4772
+ return Array.isArray(value) && !ArrayBuffer.isView(value);
4773
+ }
4774
+ function IsUndefined4(value) {
4775
+ return value === void 0;
4776
+ }
4777
+ function IsNumber4(value) {
4778
+ return typeof value === "number";
4779
+ }
4780
+
4781
+ // ../../node_modules/@sinclair/typebox/build/esm/system/policy.mjs
4782
+ var TypeSystemPolicy;
4783
+ (function(TypeSystemPolicy2) {
4784
+ TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
4785
+ TypeSystemPolicy2.AllowArrayObject = false;
4786
+ TypeSystemPolicy2.AllowNaN = false;
4787
+ TypeSystemPolicy2.AllowNullVoid = false;
4788
+ function IsExactOptionalProperty(value, key) {
4789
+ return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
4790
+ }
4791
+ TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
4792
+ function IsObjectLike(value) {
4793
+ const isObject = IsObject4(value);
4794
+ return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray4(value);
4795
+ }
4796
+ TypeSystemPolicy2.IsObjectLike = IsObjectLike;
4797
+ function IsRecordLike(value) {
4798
+ return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
4799
+ }
4800
+ TypeSystemPolicy2.IsRecordLike = IsRecordLike;
4801
+ function IsNumberLike(value) {
4802
+ return TypeSystemPolicy2.AllowNaN ? IsNumber4(value) : Number.isFinite(value);
4803
+ }
4804
+ TypeSystemPolicy2.IsNumberLike = IsNumberLike;
4805
+ function IsVoidLike(value) {
4806
+ const isUndefined = IsUndefined4(value);
4807
+ return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
4808
+ }
4809
+ TypeSystemPolicy2.IsVoidLike = IsVoidLike;
4810
+ })(TypeSystemPolicy || (TypeSystemPolicy = {}));
4811
+
4812
+ // ../../node_modules/@sinclair/typebox/build/esm/system/system.mjs
4813
+ var TypeSystemDuplicateTypeKind = class extends TypeBoxError {
4814
+ constructor(kind) {
4815
+ super(`Duplicate type kind '${kind}' detected`);
4816
+ }
4817
+ };
4818
+ var TypeSystemDuplicateFormat = class extends TypeBoxError {
4819
+ constructor(kind) {
4820
+ super(`Duplicate string format '${kind}' detected`);
4821
+ }
4822
+ };
4823
+ var TypeSystem;
4824
+ (function(TypeSystem2) {
4825
+ function Type2(kind, check) {
4826
+ if (type_exports2.Has(kind))
4827
+ throw new TypeSystemDuplicateTypeKind(kind);
4828
+ type_exports2.Set(kind, check);
4829
+ return (options = {}) => Unsafe({ ...options, [Kind]: kind });
4830
+ }
4831
+ TypeSystem2.Type = Type2;
4832
+ function Format(format, check) {
4833
+ if (format_exports.Has(format))
4834
+ throw new TypeSystemDuplicateFormat(format);
4835
+ format_exports.Set(format, check);
4836
+ return format;
4837
+ }
4838
+ TypeSystem2.Format = Format;
4839
+ })(TypeSystem || (TypeSystem = {}));
4840
+
4841
+ // ../../node_modules/@sinclair/typebox/build/esm/value/hash/hash.mjs
4842
+ var ByteMarker;
4843
+ (function(ByteMarker2) {
4844
+ ByteMarker2[ByteMarker2["Undefined"] = 0] = "Undefined";
4845
+ ByteMarker2[ByteMarker2["Null"] = 1] = "Null";
4846
+ ByteMarker2[ByteMarker2["Boolean"] = 2] = "Boolean";
4847
+ ByteMarker2[ByteMarker2["Number"] = 3] = "Number";
4848
+ ByteMarker2[ByteMarker2["String"] = 4] = "String";
4849
+ ByteMarker2[ByteMarker2["Object"] = 5] = "Object";
4850
+ ByteMarker2[ByteMarker2["Array"] = 6] = "Array";
4851
+ ByteMarker2[ByteMarker2["Date"] = 7] = "Date";
4852
+ ByteMarker2[ByteMarker2["Uint8Array"] = 8] = "Uint8Array";
4853
+ ByteMarker2[ByteMarker2["Symbol"] = 9] = "Symbol";
4854
+ ByteMarker2[ByteMarker2["BigInt"] = 10] = "BigInt";
4855
+ })(ByteMarker || (ByteMarker = {}));
4856
+ var Accumulator = BigInt("14695981039346656037");
4857
+ var [Prime, Size] = [BigInt("1099511628211"), BigInt("2") ** BigInt("64")];
4858
+ var Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
4859
+ var F64 = new Float64Array(1);
4860
+ var F64In = new DataView(F64.buffer);
4861
+ var F64Out = new Uint8Array(F64.buffer);
4862
+
4863
+ // ../../node_modules/@sinclair/typebox/build/esm/errors/errors.mjs
4864
+ var ValueErrorType;
4865
+ (function(ValueErrorType2) {
4866
+ ValueErrorType2[ValueErrorType2["ArrayContains"] = 0] = "ArrayContains";
4867
+ ValueErrorType2[ValueErrorType2["ArrayMaxContains"] = 1] = "ArrayMaxContains";
4868
+ ValueErrorType2[ValueErrorType2["ArrayMaxItems"] = 2] = "ArrayMaxItems";
4869
+ ValueErrorType2[ValueErrorType2["ArrayMinContains"] = 3] = "ArrayMinContains";
4870
+ ValueErrorType2[ValueErrorType2["ArrayMinItems"] = 4] = "ArrayMinItems";
4871
+ ValueErrorType2[ValueErrorType2["ArrayUniqueItems"] = 5] = "ArrayUniqueItems";
4872
+ ValueErrorType2[ValueErrorType2["Array"] = 6] = "Array";
4873
+ ValueErrorType2[ValueErrorType2["AsyncIterator"] = 7] = "AsyncIterator";
4874
+ ValueErrorType2[ValueErrorType2["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum";
4875
+ ValueErrorType2[ValueErrorType2["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum";
4876
+ ValueErrorType2[ValueErrorType2["BigIntMaximum"] = 10] = "BigIntMaximum";
4877
+ ValueErrorType2[ValueErrorType2["BigIntMinimum"] = 11] = "BigIntMinimum";
4878
+ ValueErrorType2[ValueErrorType2["BigIntMultipleOf"] = 12] = "BigIntMultipleOf";
4879
+ ValueErrorType2[ValueErrorType2["BigInt"] = 13] = "BigInt";
4880
+ ValueErrorType2[ValueErrorType2["Boolean"] = 14] = "Boolean";
4881
+ ValueErrorType2[ValueErrorType2["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp";
4882
+ ValueErrorType2[ValueErrorType2["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp";
4883
+ ValueErrorType2[ValueErrorType2["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp";
4884
+ ValueErrorType2[ValueErrorType2["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp";
4885
+ ValueErrorType2[ValueErrorType2["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp";
4886
+ ValueErrorType2[ValueErrorType2["Date"] = 20] = "Date";
4887
+ ValueErrorType2[ValueErrorType2["Function"] = 21] = "Function";
4888
+ ValueErrorType2[ValueErrorType2["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum";
4889
+ ValueErrorType2[ValueErrorType2["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum";
4890
+ ValueErrorType2[ValueErrorType2["IntegerMaximum"] = 24] = "IntegerMaximum";
4891
+ ValueErrorType2[ValueErrorType2["IntegerMinimum"] = 25] = "IntegerMinimum";
4892
+ ValueErrorType2[ValueErrorType2["IntegerMultipleOf"] = 26] = "IntegerMultipleOf";
4893
+ ValueErrorType2[ValueErrorType2["Integer"] = 27] = "Integer";
4894
+ ValueErrorType2[ValueErrorType2["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties";
4895
+ ValueErrorType2[ValueErrorType2["Intersect"] = 29] = "Intersect";
4896
+ ValueErrorType2[ValueErrorType2["Iterator"] = 30] = "Iterator";
4897
+ ValueErrorType2[ValueErrorType2["Kind"] = 31] = "Kind";
4898
+ ValueErrorType2[ValueErrorType2["Literal"] = 32] = "Literal";
4899
+ ValueErrorType2[ValueErrorType2["Never"] = 33] = "Never";
4900
+ ValueErrorType2[ValueErrorType2["Not"] = 34] = "Not";
4901
+ ValueErrorType2[ValueErrorType2["Null"] = 35] = "Null";
4902
+ ValueErrorType2[ValueErrorType2["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum";
4903
+ ValueErrorType2[ValueErrorType2["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum";
4904
+ ValueErrorType2[ValueErrorType2["NumberMaximum"] = 38] = "NumberMaximum";
4905
+ ValueErrorType2[ValueErrorType2["NumberMinimum"] = 39] = "NumberMinimum";
4906
+ ValueErrorType2[ValueErrorType2["NumberMultipleOf"] = 40] = "NumberMultipleOf";
4907
+ ValueErrorType2[ValueErrorType2["Number"] = 41] = "Number";
4908
+ ValueErrorType2[ValueErrorType2["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties";
4909
+ ValueErrorType2[ValueErrorType2["ObjectMaxProperties"] = 43] = "ObjectMaxProperties";
4910
+ ValueErrorType2[ValueErrorType2["ObjectMinProperties"] = 44] = "ObjectMinProperties";
4911
+ ValueErrorType2[ValueErrorType2["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty";
4912
+ ValueErrorType2[ValueErrorType2["Object"] = 46] = "Object";
4913
+ ValueErrorType2[ValueErrorType2["Promise"] = 47] = "Promise";
4914
+ ValueErrorType2[ValueErrorType2["RegExp"] = 48] = "RegExp";
4915
+ ValueErrorType2[ValueErrorType2["StringFormatUnknown"] = 49] = "StringFormatUnknown";
4916
+ ValueErrorType2[ValueErrorType2["StringFormat"] = 50] = "StringFormat";
4917
+ ValueErrorType2[ValueErrorType2["StringMaxLength"] = 51] = "StringMaxLength";
4918
+ ValueErrorType2[ValueErrorType2["StringMinLength"] = 52] = "StringMinLength";
4919
+ ValueErrorType2[ValueErrorType2["StringPattern"] = 53] = "StringPattern";
4920
+ ValueErrorType2[ValueErrorType2["String"] = 54] = "String";
4921
+ ValueErrorType2[ValueErrorType2["Symbol"] = 55] = "Symbol";
4922
+ ValueErrorType2[ValueErrorType2["TupleLength"] = 56] = "TupleLength";
4923
+ ValueErrorType2[ValueErrorType2["Tuple"] = 57] = "Tuple";
4924
+ ValueErrorType2[ValueErrorType2["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength";
4925
+ ValueErrorType2[ValueErrorType2["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength";
4926
+ ValueErrorType2[ValueErrorType2["Uint8Array"] = 60] = "Uint8Array";
4927
+ ValueErrorType2[ValueErrorType2["Undefined"] = 61] = "Undefined";
4928
+ ValueErrorType2[ValueErrorType2["Union"] = 62] = "Union";
4929
+ ValueErrorType2[ValueErrorType2["Void"] = 63] = "Void";
4930
+ })(ValueErrorType || (ValueErrorType = {}));
4931
+
4932
+ // ../../node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
4933
+ var Insert = Object2({
4934
+ type: Literal("insert"),
4935
+ path: String(),
4936
+ value: Unknown()
4937
+ });
4938
+ var Update = Object2({
4939
+ type: Literal("update"),
4940
+ path: String(),
4941
+ value: Unknown()
4942
+ });
4943
+ var Delete3 = Object2({
4944
+ type: Literal("delete"),
4945
+ path: String()
4946
+ });
4947
+ var Edit = Union([Insert, Update, Delete3]);
4948
+
4949
+ // ../noya-schemas/src/SchemaTree.ts
4950
+ var import_tree_visit = __toESM(require_lib());
4951
+ var SchemaTree = (0, import_tree_visit.defineTree)((schema) => {
4952
+ if (type_exports.IsUnion(schema)) {
4953
+ return schema.anyOf;
4954
+ } else if (type_exports.IsObject(schema)) {
4955
+ return Object.values(schema.properties);
4956
+ } else if (type_exports.IsArray(schema)) {
4957
+ return [schema.items];
4958
+ }
4959
+ return [];
4960
+ }).withOptions({
4961
+ getLabel(node) {
4962
+ return node[Kind] ?? "<UnknownKind>";
4963
+ }
4964
+ });
4965
+ function findAllDefs(schema) {
4966
+ if (!schema) return [];
4967
+ return SchemaTree.flatMap(schema, (node) => {
4968
+ return node.$id ? [node] : [];
4969
+ });
4970
+ }
4971
+
4972
+ // ../noya-schemas/src/index.ts
4973
+ function validateUUID(value) {
4974
+ return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(
4975
+ value
4976
+ );
4977
+ }
4978
+ format_exports.Set("color", () => true);
4979
+ format_exports.Set("uuid", validateUUID);
4980
+
4981
+ // src/noyaApp.ts
4982
+ import {
4983
+ createOrCastValue,
4984
+ isEmbeddedApp,
4985
+ localStorageSync,
4986
+ parentFrameSync,
4987
+ stubSync as stubSync2,
4988
+ TypeGuard,
4989
+ webSocketSync
4990
+ } from "@noya-app/state-manager";
4991
+ import { useMemo as useMemo3, useState as useState3 } from "react";
4992
+ function createDefaultAppData(initialState) {
4993
+ return {
4994
+ theme: "light",
4995
+ viewType: "editable",
4996
+ initialState,
4997
+ inspector: false
4998
+ };
4999
+ }
5000
+ function enforceSchema(initialState, schema) {
5001
+ return schema ? createOrCastValue({
5002
+ schema,
5003
+ value: initialState,
5004
+ defs: findAllDefs(schema)
5005
+ }) : initialState;
5006
+ }
5007
+ function parseAppDataParameter(options) {
5008
+ const window2 = options?.window ?? globalThis;
5009
+ const location = window2.location;
5010
+ if (!location) return null;
5011
+ const urlHash = (location.hash || "").replace(/^#/, "");
5012
+ const params = new URLSearchParams(urlHash);
5013
+ const data = params.get("data");
5014
+ if (!data) return null;
5015
+ try {
5016
+ return JSON.parse(data);
5017
+ } catch (e) {
5018
+ return null;
5019
+ }
5020
+ }
5021
+ function getAppData(initialState, schema, options) {
5022
+ const resolvedInitialState = initialState instanceof Function ? initialState() : initialState;
5023
+ let appData = parseAppDataParameter(options) ?? createDefaultAppData(resolvedInitialState);
5024
+ if (options?.overrideExistingState) {
5025
+ appData.initialState = resolvedInitialState;
5026
+ }
5027
+ appData.initialState = enforceSchema(appData.initialState, schema);
5028
+ return appData;
5029
+ }
5030
+ function useNoyaState(...args) {
5031
+ const [initialState, options] = typeof args[0] === "object" && args[0] !== null && "schema" in args[0] && TypeGuard.IsSchema(args[0].schema) ? [null, args[0]] : [args[0], args[1]];
5032
+ const [
5033
+ {
5034
+ multiplayerUrl,
5035
+ inspector,
5036
+ initialState: noyaAppInitialState,
5037
+ theme,
5038
+ viewType
5039
+ }
5040
+ ] = useState3(() => {
5041
+ return getAppData(initialState, options?.schema, {
5042
+ overrideExistingState: options?.overrideExistingState
5043
+ });
5044
+ });
5045
+ const sync = useMemo3(() => {
5046
+ return isEmbeddedApp() ? parentFrameSync({ debug: options?.debug }) : multiplayerUrl ? webSocketSync({
5047
+ url: multiplayerUrl,
5048
+ debug: options?.debug
5049
+ }) : options?.offlineStorageKey ? localStorageSync({ key: options.offlineStorageKey }) : stubSync2();
5050
+ }, [multiplayerUrl, options?.offlineStorageKey, options?.debug]);
5051
+ const result = useMultiplayerState(noyaAppInitialState, {
5052
+ ...options,
5053
+ inspector: options?.inspector ?? inspector,
5054
+ sync: options?.sync ?? sync
5055
+ });
5056
+ const [, , extras] = result;
5057
+ const mergedExtras = useMemo3(() => {
5058
+ return { ...extras, theme, viewType };
5059
+ }, [extras, theme, viewType]);
5060
+ return [result[0], result[1], mergedExtras];
5061
+ }
5062
+
5063
+ // src/NoyaStateContext.tsx
5064
+ import {
5065
+ Observable
5066
+ } from "@noya-app/observable";
5067
+ import React6, {
5068
+ createContext,
5069
+ useCallback as useCallback2,
5070
+ useContext,
5071
+ useEffect as useEffect4,
5072
+ useMemo as useMemo4
5073
+ } from "react";
5074
+ var AnyNoyaStateContext = createContext(void 0);
5075
+ function useAnyNoyaStateContext() {
5076
+ const value = useContext(AnyNoyaStateContext);
5077
+ if (!value) {
5078
+ throw new Error(
5079
+ "useNoyaStateContext must be used within a NoyaStateProvider"
5080
+ );
5081
+ }
5082
+ return value;
5083
+ }
5084
+ function useAnyNoyaManager() {
5085
+ const { noyaManager } = useAnyNoyaStateContext();
5086
+ return noyaManager;
5087
+ }
5088
+ function useColorScheme() {
5089
+ const { theme } = useAnyNoyaStateContext();
5090
+ return theme;
5091
+ }
5092
+ function useViewType() {
5093
+ const { viewType } = useAnyNoyaStateContext();
5094
+ return viewType;
5095
+ }
5096
+ function useAssets() {
5097
+ const { noyaManager } = useAnyNoyaStateContext();
5098
+ return useObservable(noyaManager.assetManager.assets$);
5099
+ }
5100
+ function useAsset(id) {
5101
+ const { noyaManager } = useAnyNoyaStateContext();
5102
+ const observable = useMemo4(
5103
+ () => noyaManager.assetManager.assets$.map(
5104
+ (assets) => assets.find((a) => a.id === id)
5105
+ ),
5106
+ [noyaManager, id]
5107
+ );
5108
+ return useObservable(observable);
5109
+ }
5110
+ function useAssetManager() {
5111
+ const { noyaManager } = useAnyNoyaStateContext();
5112
+ const isInitialized = useObservable(noyaManager.assetManager.isInitialized$);
5113
+ return useMemo4(
5114
+ () => ({
5115
+ create: noyaManager.assetManager.create,
5116
+ delete: noyaManager.assetManager.delete,
5117
+ isInitialized
5118
+ }),
5119
+ [noyaManager, isInitialized]
5120
+ );
5121
+ }
5122
+ function useAIManager() {
5123
+ const { noyaManager } = useAnyNoyaStateContext();
5124
+ return noyaManager.aiManager;
5125
+ }
5126
+ function useSecretManager() {
5127
+ const { noyaManager } = useAnyNoyaStateContext();
5128
+ return noyaManager.secretManager;
5129
+ }
5130
+ function useSecrets() {
5131
+ const { noyaManager } = useAnyNoyaStateContext();
5132
+ return useObservable(noyaManager.secretManager.secrets$);
5133
+ }
5134
+ function useSecret(name) {
5135
+ const { noyaManager } = useAnyNoyaStateContext();
5136
+ return useObservable(
5137
+ noyaManager.secretManager.secrets$,
5138
+ useCallback2((secrets) => secrets.find((s) => s.name === name), [name])
5139
+ );
5140
+ }
5141
+ function useInputs() {
5142
+ const { noyaManager } = useAnyNoyaStateContext();
5143
+ return useObservable(noyaManager.ioManager.inputs$);
5144
+ }
5145
+ function useOutputTransforms() {
5146
+ const { noyaManager } = useAnyNoyaStateContext();
5147
+ return useObservable(noyaManager.ioManager.outputTransforms$);
5148
+ }
5149
+ function useIOManager() {
5150
+ const { noyaManager } = useAnyNoyaStateContext();
5151
+ return noyaManager.ioManager;
1435
5152
  }
1436
5153
  function useIsInitialized() {
1437
5154
  const { noyaManager, viewType } = useAnyNoyaStateContext();
@@ -1473,7 +5190,9 @@ var FallbackUntilInitialized = ({
1473
5190
  };
1474
5191
  function createNoyaContext({
1475
5192
  schema,
1476
- mergeHistoryEntries
5193
+ mergeHistoryEntries,
5194
+ outputTransforms,
5195
+ inputs
1477
5196
  }) {
1478
5197
  const NoyaStateContext = AnyNoyaStateContext;
1479
5198
  const EphemeralUserDataManagerContext = AnyEphemeralUserDataManagerContext;
@@ -1485,9 +5204,11 @@ function createNoyaContext({
1485
5204
  const [, , { noyaManager, theme, viewType }] = useNoyaState(
1486
5205
  initialState,
1487
5206
  {
1488
- ...options,
1489
5207
  schema,
1490
- mergeHistoryEntries
5208
+ mergeHistoryEntries,
5209
+ outputTransforms,
5210
+ inputs,
5211
+ ...options
1491
5212
  }
1492
5213
  );
1493
5214
  const contextValue = useMemo4(
@@ -1744,12 +5465,15 @@ export {
1744
5465
  useColorScheme,
1745
5466
  useConnectedUsersManager,
1746
5467
  useCurrentUserId,
5468
+ useIOManager,
5469
+ useInputs,
1747
5470
  useIsInitialized,
1748
5471
  useManagedHistory,
1749
5472
  useManagedState,
1750
5473
  useMultiplayerState,
1751
5474
  useNoyaState,
1752
5475
  useObservable,
5476
+ useOutputTransforms,
1753
5477
  useSecret,
1754
5478
  useSecretManager,
1755
5479
  useSecrets,