@bunny-agent/runner-cli 0.9.31 → 0.9.33

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/bundle.mjs CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env node
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (target, all) => {
4
+ for (var name in all)
5
+ __defProp(target, name, { get: all[name], enumerable: true });
6
+ };
2
7
 
3
8
  // src/cli.ts
4
9
  import { resolve as resolve3 } from "node:path";
@@ -1383,20 +1388,37 @@ var generateImageSchema = {
1383
1388
  size: {
1384
1389
  type: "string",
1385
1390
  enum: [
1391
+ "auto",
1392
+ "1024x1024",
1393
+ "1536x1024",
1394
+ "1024x1536",
1386
1395
  "256x256",
1387
1396
  "512x512",
1388
- "1024x1024",
1389
1397
  "1792x1024",
1390
- "1024x1792",
1391
- "1280x1280",
1392
- "1568x1056",
1393
- "1056x1568",
1394
- "1472x1088",
1395
- "1088x1472",
1396
- "1728x960",
1397
- "960x1728"
1398
+ "1024x1792"
1399
+ ],
1400
+ description: "Image dimensions. Supported values: auto, 1024x1024, 1536x1024, 1024x1536, 256x256, 512x512, 1792x1024, 1024x1792."
1401
+ },
1402
+ aspectRatio: {
1403
+ type: "string",
1404
+ enum: [
1405
+ "1:1",
1406
+ "3:2",
1407
+ "2:3",
1408
+ "3:4",
1409
+ "4:3",
1410
+ "4:5",
1411
+ "5:4",
1412
+ "9:16",
1413
+ "16:9",
1414
+ "21:9"
1398
1415
  ],
1399
- description: "Image dimensions. Common: 1024x1024 (square), 1280x1280, 1568x1056 (landscape), 1056x1568 (portrait), 1728x960 (wide), 960x1728 (tall)."
1416
+ description: "Image aspect ratio. Use this instead of size for models that support it when exact proportions matter. Supported values: 1:1, 3:2, 2:3, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9."
1417
+ },
1418
+ imageSize: {
1419
+ type: "string",
1420
+ enum: ["1K", "2K", "4K"],
1421
+ description: "Image resolution for models that support K-resolution output. Use this for requests like 2K or 4K."
1400
1422
  },
1401
1423
  quality: {
1402
1424
  type: "string",
@@ -1551,19 +1573,23 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
1551
1573
  name: "generate_image",
1552
1574
  label: "generate image",
1553
1575
  description: "Generate an image from a text prompt. Saves the image to disk and returns the file path.",
1554
- promptSnippet: "generate_image(prompt, filename?, size?, quality?) - generate an image from text",
1576
+ promptSnippet: "generate_image(prompt, filename?, size?, aspectRatio?, imageSize?, quality?) - generate an image from text",
1555
1577
  promptGuidelines: [
1556
1578
  "Use generate_image when the user asks to create, draw, or visualize something.",
1557
1579
  "Be descriptive in the prompt \u2014 more detail produces better results.",
1558
- "Provide a filename with extension, e.g. 'cat.png'."
1580
+ "Provide a filename with extension, e.g. 'cat.png'.",
1581
+ "Use aspectRatio (e.g. '3:4') when the requested output needs specific proportions.",
1582
+ "Use imageSize (e.g. '2K') when the user requests 1K, 2K, or 4K resolution."
1559
1583
  ],
1560
1584
  // biome-ignore lint/suspicious/noExplicitAny: plain JSON Schema compatible with TypeBox TSchema
1561
1585
  parameters: generateImageSchema,
1562
1586
  async execute(_toolCallId, params, signal, _onUpdate) {
1563
1587
  const p = params;
1564
1588
  const prompt = p.prompt;
1565
- const size = p.size ?? "1024x1024";
1589
+ const size = p.size;
1566
1590
  const quality = p.quality ?? "auto";
1591
+ const aspectRatio = p.aspectRatio;
1592
+ const imageSize = p.imageSize;
1567
1593
  const rawFilename = p.filename;
1568
1594
  const filename = rawFilename ? extname(rawFilename) ? rawFilename : `${rawFilename}.png` : `image_${Date.now()}.png`;
1569
1595
  const filePath = join6(cwd, filename.replace(/[^a-zA-Z0-9_\-./]/g, "_"));
@@ -1579,10 +1605,12 @@ function buildImageGenerateTool(cwd, imageModelId, baseUrl, apiKey) {
1579
1605
  model: imageModelId,
1580
1606
  prompt,
1581
1607
  n: 1,
1582
- size,
1583
1608
  quality,
1584
1609
  response_format: "b64_json",
1585
- output_format: "png"
1610
+ output_format: "png",
1611
+ ...aspectRatio ? { aspect_ratio: aspectRatio } : {},
1612
+ ...imageSize ? { image_size: imageSize } : {},
1613
+ ...size ? { size } : !aspectRatio && !imageSize ? { size: "1024x1024" } : {}
1586
1614
  }),
1587
1615
  signal
1588
1616
  });
@@ -2508,172 +2536,2879 @@ function buildSecretAwareTools(cwd, secrets) {
2508
2536
  return tools;
2509
2537
  }
2510
2538
 
2511
- // ../../packages/runner-pi/dist/pi-runner.js
2512
- var LOG_PREFIX2 = "[bunny-agent:pi]";
2513
- function parseModelSpec(model) {
2514
- const trimmed = model.trim();
2515
- const separator = trimmed.indexOf(":");
2516
- if (separator <= 0 || separator === trimmed.length - 1) {
2517
- throw new Error(`Invalid pi model "${model}". Expected format "<provider>:<model>", for example "google:gemini-2.5-pro".`);
2539
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
2540
+ var value_exports = {};
2541
+ __export(value_exports, {
2542
+ HasPropertyKey: () => HasPropertyKey,
2543
+ IsArray: () => IsArray,
2544
+ IsAsyncIterator: () => IsAsyncIterator,
2545
+ IsBigInt: () => IsBigInt,
2546
+ IsBoolean: () => IsBoolean,
2547
+ IsDate: () => IsDate,
2548
+ IsFunction: () => IsFunction,
2549
+ IsIterator: () => IsIterator,
2550
+ IsNull: () => IsNull,
2551
+ IsNumber: () => IsNumber,
2552
+ IsObject: () => IsObject,
2553
+ IsRegExp: () => IsRegExp,
2554
+ IsString: () => IsString,
2555
+ IsSymbol: () => IsSymbol,
2556
+ IsUint8Array: () => IsUint8Array,
2557
+ IsUndefined: () => IsUndefined
2558
+ });
2559
+ function HasPropertyKey(value, key) {
2560
+ return key in value;
2561
+ }
2562
+ function IsAsyncIterator(value) {
2563
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
2564
+ }
2565
+ function IsArray(value) {
2566
+ return Array.isArray(value);
2567
+ }
2568
+ function IsBigInt(value) {
2569
+ return typeof value === "bigint";
2570
+ }
2571
+ function IsBoolean(value) {
2572
+ return typeof value === "boolean";
2573
+ }
2574
+ function IsDate(value) {
2575
+ return value instanceof globalThis.Date;
2576
+ }
2577
+ function IsFunction(value) {
2578
+ return typeof value === "function";
2579
+ }
2580
+ function IsIterator(value) {
2581
+ return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
2582
+ }
2583
+ function IsNull(value) {
2584
+ return value === null;
2585
+ }
2586
+ function IsNumber(value) {
2587
+ return typeof value === "number";
2588
+ }
2589
+ function IsObject(value) {
2590
+ return typeof value === "object" && value !== null;
2591
+ }
2592
+ function IsRegExp(value) {
2593
+ return value instanceof globalThis.RegExp;
2594
+ }
2595
+ function IsString(value) {
2596
+ return typeof value === "string";
2597
+ }
2598
+ function IsSymbol(value) {
2599
+ return typeof value === "symbol";
2600
+ }
2601
+ function IsUint8Array(value) {
2602
+ return value instanceof globalThis.Uint8Array;
2603
+ }
2604
+ function IsUndefined(value) {
2605
+ return value === void 0;
2606
+ }
2607
+
2608
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
2609
+ function ArrayType(value) {
2610
+ return value.map((value2) => Visit(value2));
2611
+ }
2612
+ function DateType(value) {
2613
+ return new Date(value.getTime());
2614
+ }
2615
+ function Uint8ArrayType(value) {
2616
+ return new Uint8Array(value);
2617
+ }
2618
+ function RegExpType(value) {
2619
+ return new RegExp(value.source, value.flags);
2620
+ }
2621
+ function ObjectType(value) {
2622
+ const result = {};
2623
+ for (const key of Object.getOwnPropertyNames(value)) {
2624
+ result[key] = Visit(value[key]);
2518
2625
  }
2519
- return {
2520
- provider: trimmed.slice(0, separator),
2521
- modelName: trimmed.slice(separator + 1)
2522
- };
2626
+ for (const key of Object.getOwnPropertySymbols(value)) {
2627
+ result[key] = Visit(value[key]);
2628
+ }
2629
+ return result;
2523
2630
  }
2524
- function resolveImageModelName(chatProvider, env) {
2525
- const spec = env?.IMAGE_GENERATION_MODEL;
2526
- if (!spec)
2527
- return void 0;
2528
- try {
2529
- const { provider, modelName } = parseModelSpec(spec);
2530
- return provider === chatProvider ? modelName : void 0;
2531
- } catch {
2532
- return void 0;
2631
+ function Visit(value) {
2632
+ return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
2633
+ }
2634
+ function Clone(value) {
2635
+ return Visit(value);
2636
+ }
2637
+
2638
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
2639
+ function CloneType(schema, options) {
2640
+ return options === void 0 ? Clone(schema) : Clone({ ...options, ...schema });
2641
+ }
2642
+
2643
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
2644
+ function IsObject2(value) {
2645
+ return value !== null && typeof value === "object";
2646
+ }
2647
+ function IsArray2(value) {
2648
+ return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value);
2649
+ }
2650
+ function IsUndefined2(value) {
2651
+ return value === void 0;
2652
+ }
2653
+ function IsNumber2(value) {
2654
+ return typeof value === "number";
2655
+ }
2656
+
2657
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/system/policy.mjs
2658
+ var TypeSystemPolicy;
2659
+ (function(TypeSystemPolicy2) {
2660
+ TypeSystemPolicy2.InstanceMode = "default";
2661
+ TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
2662
+ TypeSystemPolicy2.AllowArrayObject = false;
2663
+ TypeSystemPolicy2.AllowNaN = false;
2664
+ TypeSystemPolicy2.AllowNullVoid = false;
2665
+ function IsExactOptionalProperty(value, key) {
2666
+ return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
2667
+ }
2668
+ TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
2669
+ function IsObjectLike(value) {
2670
+ const isObject = IsObject2(value);
2671
+ return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray2(value);
2672
+ }
2673
+ TypeSystemPolicy2.IsObjectLike = IsObjectLike;
2674
+ function IsRecordLike(value) {
2675
+ return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
2533
2676
  }
2677
+ TypeSystemPolicy2.IsRecordLike = IsRecordLike;
2678
+ function IsNumberLike(value) {
2679
+ return TypeSystemPolicy2.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
2680
+ }
2681
+ TypeSystemPolicy2.IsNumberLike = IsNumberLike;
2682
+ function IsVoidLike(value) {
2683
+ const isUndefined = IsUndefined2(value);
2684
+ return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
2685
+ }
2686
+ TypeSystemPolicy2.IsVoidLike = IsVoidLike;
2687
+ })(TypeSystemPolicy || (TypeSystemPolicy = {}));
2688
+
2689
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
2690
+ function ImmutableArray(value) {
2691
+ return globalThis.Object.freeze(value).map((value2) => Immutable(value2));
2534
2692
  }
2535
- function getEnvValue(optionsEnv, name) {
2536
- return optionsEnv?.[name] ?? process.env[name];
2693
+ function ImmutableDate(value) {
2694
+ return value;
2537
2695
  }
2538
- function applyModelOverrides(model, provider, optionsEnv) {
2539
- if (model == null)
2540
- return;
2541
- const openAiBaseUrl = getEnvValue(optionsEnv, "OPENAI_BASE_URL");
2542
- const geminiBaseUrl = getEnvValue(optionsEnv, "GEMINI_BASE_URL");
2543
- const anthropicBaseUrl = getEnvValue(optionsEnv, "ANTHROPIC_BASE_URL");
2544
- if (provider === "openai" && openAiBaseUrl) {
2545
- model.baseUrl = openAiBaseUrl;
2546
- } else if (provider === "google" && geminiBaseUrl) {
2547
- model.baseUrl = geminiBaseUrl;
2548
- } else if (provider === "anthropic" && anthropicBaseUrl) {
2549
- model.baseUrl = anthropicBaseUrl;
2696
+ function ImmutableUint8Array(value) {
2697
+ return value;
2698
+ }
2699
+ function ImmutableRegExp(value) {
2700
+ return value;
2701
+ }
2702
+ function ImmutableObject(value) {
2703
+ const result = {};
2704
+ for (const key of Object.getOwnPropertyNames(value)) {
2705
+ result[key] = Immutable(value[key]);
2706
+ }
2707
+ for (const key of Object.getOwnPropertySymbols(value)) {
2708
+ result[key] = Immutable(value[key]);
2550
2709
  }
2710
+ return globalThis.Object.freeze(result);
2551
2711
  }
2552
- function getErrorFromAgentEndMessages(messages) {
2553
- for (let i = messages.length - 1; i >= 0; i--) {
2554
- const m = messages[i];
2555
- if (m.role === "assistant" && m.errorMessage) {
2556
- return m.errorMessage;
2557
- }
2712
+ function Immutable(value) {
2713
+ return IsArray(value) ? ImmutableArray(value) : IsDate(value) ? ImmutableDate(value) : IsUint8Array(value) ? ImmutableUint8Array(value) : IsRegExp(value) ? ImmutableRegExp(value) : IsObject(value) ? ImmutableObject(value) : value;
2714
+ }
2715
+
2716
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/create/type.mjs
2717
+ function CreateType(schema, options) {
2718
+ const result = options !== void 0 ? { ...options, ...schema } : schema;
2719
+ switch (TypeSystemPolicy.InstanceMode) {
2720
+ case "freeze":
2721
+ return Immutable(result);
2722
+ case "clone":
2723
+ return Clone(result);
2724
+ default:
2725
+ return result;
2558
2726
  }
2559
- return void 0;
2560
2727
  }
2561
- function traceRawMessage(debugCwd, data, reset = false, optionsEnv) {
2562
- const debugVal = getEnvValue(optionsEnv, "DEBUG");
2563
- const enabled = debugVal === "true" || debugVal === "1";
2564
- if (!enabled)
2565
- return;
2728
+
2729
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
2730
+ var TypeBoxError = class extends Error {
2731
+ constructor(message) {
2732
+ super(message);
2733
+ }
2734
+ };
2735
+
2736
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
2737
+ var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
2738
+ var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
2739
+ var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
2740
+ var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
2741
+ var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
2742
+
2743
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
2744
+ function IsReadonly(value) {
2745
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
2746
+ }
2747
+ function IsOptional(value) {
2748
+ return IsObject(value) && value[OptionalKind] === "Optional";
2749
+ }
2750
+ function IsAny(value) {
2751
+ return IsKindOf(value, "Any");
2752
+ }
2753
+ function IsArgument(value) {
2754
+ return IsKindOf(value, "Argument");
2755
+ }
2756
+ function IsArray3(value) {
2757
+ return IsKindOf(value, "Array");
2758
+ }
2759
+ function IsAsyncIterator2(value) {
2760
+ return IsKindOf(value, "AsyncIterator");
2761
+ }
2762
+ function IsBigInt2(value) {
2763
+ return IsKindOf(value, "BigInt");
2764
+ }
2765
+ function IsBoolean2(value) {
2766
+ return IsKindOf(value, "Boolean");
2767
+ }
2768
+ function IsComputed(value) {
2769
+ return IsKindOf(value, "Computed");
2770
+ }
2771
+ function IsConstructor(value) {
2772
+ return IsKindOf(value, "Constructor");
2773
+ }
2774
+ function IsDate2(value) {
2775
+ return IsKindOf(value, "Date");
2776
+ }
2777
+ function IsFunction2(value) {
2778
+ return IsKindOf(value, "Function");
2779
+ }
2780
+ function IsInteger(value) {
2781
+ return IsKindOf(value, "Integer");
2782
+ }
2783
+ function IsIntersect(value) {
2784
+ return IsKindOf(value, "Intersect");
2785
+ }
2786
+ function IsIterator2(value) {
2787
+ return IsKindOf(value, "Iterator");
2788
+ }
2789
+ function IsKindOf(value, kind) {
2790
+ return IsObject(value) && Kind in value && value[Kind] === kind;
2791
+ }
2792
+ function IsLiteralValue(value) {
2793
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
2794
+ }
2795
+ function IsLiteral(value) {
2796
+ return IsKindOf(value, "Literal");
2797
+ }
2798
+ function IsMappedKey(value) {
2799
+ return IsKindOf(value, "MappedKey");
2800
+ }
2801
+ function IsMappedResult(value) {
2802
+ return IsKindOf(value, "MappedResult");
2803
+ }
2804
+ function IsNever(value) {
2805
+ return IsKindOf(value, "Never");
2806
+ }
2807
+ function IsNot(value) {
2808
+ return IsKindOf(value, "Not");
2809
+ }
2810
+ function IsNull2(value) {
2811
+ return IsKindOf(value, "Null");
2812
+ }
2813
+ function IsNumber3(value) {
2814
+ return IsKindOf(value, "Number");
2815
+ }
2816
+ function IsObject3(value) {
2817
+ return IsKindOf(value, "Object");
2818
+ }
2819
+ function IsPromise(value) {
2820
+ return IsKindOf(value, "Promise");
2821
+ }
2822
+ function IsRecord(value) {
2823
+ return IsKindOf(value, "Record");
2824
+ }
2825
+ function IsRef(value) {
2826
+ return IsKindOf(value, "Ref");
2827
+ }
2828
+ function IsRegExp2(value) {
2829
+ return IsKindOf(value, "RegExp");
2830
+ }
2831
+ function IsString2(value) {
2832
+ return IsKindOf(value, "String");
2833
+ }
2834
+ function IsSymbol2(value) {
2835
+ return IsKindOf(value, "Symbol");
2836
+ }
2837
+ function IsTemplateLiteral(value) {
2838
+ return IsKindOf(value, "TemplateLiteral");
2839
+ }
2840
+ function IsThis(value) {
2841
+ return IsKindOf(value, "This");
2842
+ }
2843
+ function IsTransform(value) {
2844
+ return IsObject(value) && TransformKind in value;
2845
+ }
2846
+ function IsTuple(value) {
2847
+ return IsKindOf(value, "Tuple");
2848
+ }
2849
+ function IsUndefined3(value) {
2850
+ return IsKindOf(value, "Undefined");
2851
+ }
2852
+ function IsUnion(value) {
2853
+ return IsKindOf(value, "Union");
2854
+ }
2855
+ function IsUint8Array2(value) {
2856
+ return IsKindOf(value, "Uint8Array");
2857
+ }
2858
+ function IsUnknown(value) {
2859
+ return IsKindOf(value, "Unknown");
2860
+ }
2861
+ function IsUnsafe(value) {
2862
+ return IsKindOf(value, "Unsafe");
2863
+ }
2864
+ function IsVoid(value) {
2865
+ return IsKindOf(value, "Void");
2866
+ }
2867
+ function IsKind(value) {
2868
+ return IsObject(value) && Kind in value && IsString(value[Kind]);
2869
+ }
2870
+ function IsSchema(value) {
2871
+ return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsComputed(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) || IsNumber3(value) || IsObject3(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
2872
+ }
2873
+
2874
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
2875
+ var type_exports = {};
2876
+ __export(type_exports, {
2877
+ IsAny: () => IsAny2,
2878
+ IsArgument: () => IsArgument2,
2879
+ IsArray: () => IsArray4,
2880
+ IsAsyncIterator: () => IsAsyncIterator3,
2881
+ IsBigInt: () => IsBigInt3,
2882
+ IsBoolean: () => IsBoolean3,
2883
+ IsComputed: () => IsComputed2,
2884
+ IsConstructor: () => IsConstructor2,
2885
+ IsDate: () => IsDate3,
2886
+ IsFunction: () => IsFunction3,
2887
+ IsImport: () => IsImport,
2888
+ IsInteger: () => IsInteger2,
2889
+ IsIntersect: () => IsIntersect2,
2890
+ IsIterator: () => IsIterator3,
2891
+ IsKind: () => IsKind2,
2892
+ IsKindOf: () => IsKindOf2,
2893
+ IsLiteral: () => IsLiteral2,
2894
+ IsLiteralBoolean: () => IsLiteralBoolean,
2895
+ IsLiteralNumber: () => IsLiteralNumber,
2896
+ IsLiteralString: () => IsLiteralString,
2897
+ IsLiteralValue: () => IsLiteralValue2,
2898
+ IsMappedKey: () => IsMappedKey2,
2899
+ IsMappedResult: () => IsMappedResult2,
2900
+ IsNever: () => IsNever2,
2901
+ IsNot: () => IsNot2,
2902
+ IsNull: () => IsNull3,
2903
+ IsNumber: () => IsNumber4,
2904
+ IsObject: () => IsObject4,
2905
+ IsOptional: () => IsOptional2,
2906
+ IsPromise: () => IsPromise2,
2907
+ IsProperties: () => IsProperties,
2908
+ IsReadonly: () => IsReadonly2,
2909
+ IsRecord: () => IsRecord2,
2910
+ IsRecursive: () => IsRecursive,
2911
+ IsRef: () => IsRef2,
2912
+ IsRegExp: () => IsRegExp3,
2913
+ IsSchema: () => IsSchema2,
2914
+ IsString: () => IsString3,
2915
+ IsSymbol: () => IsSymbol3,
2916
+ IsTemplateLiteral: () => IsTemplateLiteral2,
2917
+ IsThis: () => IsThis2,
2918
+ IsTransform: () => IsTransform2,
2919
+ IsTuple: () => IsTuple2,
2920
+ IsUint8Array: () => IsUint8Array3,
2921
+ IsUndefined: () => IsUndefined4,
2922
+ IsUnion: () => IsUnion2,
2923
+ IsUnionLiteral: () => IsUnionLiteral,
2924
+ IsUnknown: () => IsUnknown2,
2925
+ IsUnsafe: () => IsUnsafe2,
2926
+ IsVoid: () => IsVoid2,
2927
+ TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
2928
+ });
2929
+ var TypeGuardUnknownTypeError = class extends TypeBoxError {
2930
+ };
2931
+ var KnownTypes = [
2932
+ "Argument",
2933
+ "Any",
2934
+ "Array",
2935
+ "AsyncIterator",
2936
+ "BigInt",
2937
+ "Boolean",
2938
+ "Computed",
2939
+ "Constructor",
2940
+ "Date",
2941
+ "Enum",
2942
+ "Function",
2943
+ "Integer",
2944
+ "Intersect",
2945
+ "Iterator",
2946
+ "Literal",
2947
+ "MappedKey",
2948
+ "MappedResult",
2949
+ "Not",
2950
+ "Null",
2951
+ "Number",
2952
+ "Object",
2953
+ "Promise",
2954
+ "Record",
2955
+ "Ref",
2956
+ "RegExp",
2957
+ "String",
2958
+ "Symbol",
2959
+ "TemplateLiteral",
2960
+ "This",
2961
+ "Tuple",
2962
+ "Undefined",
2963
+ "Union",
2964
+ "Uint8Array",
2965
+ "Unknown",
2966
+ "Void"
2967
+ ];
2968
+ function IsPattern(value) {
2566
2969
  try {
2567
- const file = join8(debugCwd, "pi-message-stream-debug.json");
2568
- if (reset && existsSync5(file))
2569
- unlinkSync3(file);
2570
- const type = data !== null && typeof data === "object" ? data.type : void 0;
2571
- let payload = data;
2572
- try {
2573
- payload = data !== void 0 ? JSON.parse(JSON.stringify(data)) : void 0;
2574
- } catch {
2575
- payload = "[non-serializable]";
2576
- }
2577
- const entry = { _t: (/* @__PURE__ */ new Date()).toISOString(), type, payload };
2578
- appendFileSync2(file, JSON.stringify(entry, null, 2) + ",\n");
2970
+ new RegExp(value);
2971
+ return true;
2579
2972
  } catch {
2973
+ return false;
2580
2974
  }
2581
2975
  }
2582
- function createPiRunner(options = {}) {
2583
- const modelSpec = options.model;
2584
- if (modelSpec == null || modelSpec.trim() === "") {
2585
- throw new Error("Pi runner: model is required. Pass a model in the form <provider>:<model>, e.g. openai:gpt-4o or google:gemini-2.5-flash.");
2586
- }
2587
- const { provider, modelName } = parseModelSpec(modelSpec.trim());
2588
- const cwd = options.cwd || process.cwd();
2589
- const apiKeyEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
2590
- const inlineApiKey = typeof options.env?.[apiKeyEnvKey] === "string" && options.env[apiKeyEnvKey].length > 0 ? options.env[apiKeyEnvKey] : void 0;
2591
- const modelRegistry = ModelRegistry.inMemory(AuthStorage.create());
2592
- const defaultModel = getModel(provider, modelName);
2593
- let model = defaultModel ?? modelRegistry.find(provider, modelName);
2594
- if (model == null) {
2595
- const baseUrlEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_BASE_URL`;
2596
- const baseUrl = getEnvValue(options.env, baseUrlEnvKey) ?? getEnvValue(options.env, "OPENAI_BASE_URL");
2597
- if (!baseUrl) {
2598
- throw new Error(`Pi runner: model "${modelSpec}" not found in built-in catalog. Set ${baseUrlEnvKey} (or OPENAI_BASE_URL) to auto-register it.`);
2599
- }
2600
- modelRegistry.registerProvider(provider, {
2601
- baseUrl,
2602
- apiKey: inlineApiKey ?? apiKeyEnvKey,
2603
- api: "openai-completions",
2604
- models: [
2605
- {
2606
- id: modelName,
2607
- name: modelName,
2608
- reasoning: false,
2609
- input: ["text", "image"],
2610
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
2611
- contextWindow: 128e3,
2612
- maxTokens: 8192
2613
- }
2614
- ]
2615
- });
2616
- const registered = modelRegistry.find(provider, modelName);
2617
- if (!registered) {
2618
- throw new Error(`Pi runner: failed to resolve model "${modelSpec}" after registration.`);
2976
+ function IsControlCharacterFree(value) {
2977
+ if (!IsString(value))
2978
+ return false;
2979
+ for (let i = 0; i < value.length; i++) {
2980
+ const code = value.charCodeAt(i);
2981
+ if (code >= 7 && code <= 13 || code === 27 || code === 127) {
2982
+ return false;
2619
2983
  }
2620
- model = registered;
2621
2984
  }
2622
- applyModelOverrides(model, provider, options.env);
2623
- const imageModelName = resolveImageModelName(provider, options.env);
2624
- return {
2625
- async *run(userInput) {
2626
- if (inlineApiKey !== void 0) {
2627
- modelRegistry.authStorage.setRuntimeApiKey(provider, inlineApiKey);
2628
- }
2629
- try {
2630
- const resume = options.sessionId?.trim();
2631
- const sessionManager = await (async () => {
2632
- if (resume !== void 0 && resume !== "") {
2633
- if (resume.includes("/")) {
2634
- return SessionManager2.open(resume);
2635
- }
2636
- const sessionPath2 = resolveSessionPathById(cwd, resume);
2637
- console.error(`${LOG_PREFIX2} resume: id=${resume} path=${sessionPath2 ?? "(not found)"}`);
2638
- if (sessionPath2) {
2639
- if (isSessionFileTooLarge(sessionPath2)) {
2640
- const context = extractSessionContext(sessionPath2);
2641
- console.error(`${LOG_PREFIX2} session file too large, starting fresh${context ? " (with context)" : ""}`);
2642
- const newMgr = SessionManager2.create(cwd);
2643
- if (context) {
2644
- const firstId = newMgr.getEntries()[0]?.id ?? "";
2645
- newMgr.appendCompaction(context, firstId, 0);
2646
- }
2647
- return newMgr;
2648
- }
2649
- return SessionManager2.open(sessionPath2);
2650
- }
2651
- return SessionManager2.create(cwd);
2652
- }
2653
- return SessionManager2.create(cwd);
2654
- })();
2655
- const resourceLoader = options.skillPaths ? new BunnyAgentResourceLoader({
2656
- cwd,
2657
- skillPaths: options.skillPaths,
2658
- appendSystemPrompt: options.systemPrompt
2659
- }) : void 0;
2660
- if (options.skillPaths && options.skillPaths.length > 0) {
2661
- console.error(`${LOG_PREFIX2} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
2662
- }
2663
- if (resourceLoader) {
2664
- await resourceLoader.reload();
2665
- }
2666
- const customTools = options.env && Object.keys(options.env).length > 0 ? buildSecretAwareTools(cwd, options.env) : [];
2667
- if (imageModelName) {
2668
- const apiKey = await modelRegistry.authStorage.getApiKey(provider) ?? "";
2669
- customTools.push(buildImageGenerateTool(cwd, imageModelName, model.baseUrl, apiKey), buildImageEditTool(cwd, imageModelName, model.baseUrl, apiKey));
2670
- }
2671
- const { session } = await createAgentSession({
2672
- cwd,
2673
- model,
2674
- sessionManager,
2675
- modelRegistry,
2676
- resourceLoader,
2985
+ return true;
2986
+ }
2987
+ function IsAdditionalProperties(value) {
2988
+ return IsOptionalBoolean(value) || IsSchema2(value);
2989
+ }
2990
+ function IsOptionalBigInt(value) {
2991
+ return IsUndefined(value) || IsBigInt(value);
2992
+ }
2993
+ function IsOptionalNumber(value) {
2994
+ return IsUndefined(value) || IsNumber(value);
2995
+ }
2996
+ function IsOptionalBoolean(value) {
2997
+ return IsUndefined(value) || IsBoolean(value);
2998
+ }
2999
+ function IsOptionalString(value) {
3000
+ return IsUndefined(value) || IsString(value);
3001
+ }
3002
+ function IsOptionalPattern(value) {
3003
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
3004
+ }
3005
+ function IsOptionalFormat(value) {
3006
+ return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
3007
+ }
3008
+ function IsOptionalSchema(value) {
3009
+ return IsUndefined(value) || IsSchema2(value);
3010
+ }
3011
+ function IsReadonly2(value) {
3012
+ return IsObject(value) && value[ReadonlyKind] === "Readonly";
3013
+ }
3014
+ function IsOptional2(value) {
3015
+ return IsObject(value) && value[OptionalKind] === "Optional";
3016
+ }
3017
+ function IsAny2(value) {
3018
+ return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
3019
+ }
3020
+ function IsArgument2(value) {
3021
+ return IsKindOf2(value, "Argument") && IsNumber(value.index);
3022
+ }
3023
+ function IsArray4(value) {
3024
+ 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);
3025
+ }
3026
+ function IsAsyncIterator3(value) {
3027
+ return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3028
+ }
3029
+ function IsBigInt3(value) {
3030
+ 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);
3031
+ }
3032
+ function IsBoolean3(value) {
3033
+ return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
3034
+ }
3035
+ function IsComputed2(value) {
3036
+ return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
3037
+ }
3038
+ function IsConstructor2(value) {
3039
+ return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3040
+ }
3041
+ function IsDate3(value) {
3042
+ 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);
3043
+ }
3044
+ function IsFunction3(value) {
3045
+ return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
3046
+ }
3047
+ function IsImport(value) {
3048
+ return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
3049
+ }
3050
+ function IsInteger2(value) {
3051
+ 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);
3052
+ }
3053
+ function IsProperties(value) {
3054
+ return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
3055
+ }
3056
+ function IsIntersect2(value) {
3057
+ 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);
3058
+ }
3059
+ function IsIterator3(value) {
3060
+ return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
3061
+ }
3062
+ function IsKindOf2(value, kind) {
3063
+ return IsObject(value) && Kind in value && value[Kind] === kind;
3064
+ }
3065
+ function IsLiteralString(value) {
3066
+ return IsLiteral2(value) && IsString(value.const);
3067
+ }
3068
+ function IsLiteralNumber(value) {
3069
+ return IsLiteral2(value) && IsNumber(value.const);
3070
+ }
3071
+ function IsLiteralBoolean(value) {
3072
+ return IsLiteral2(value) && IsBoolean(value.const);
3073
+ }
3074
+ function IsLiteral2(value) {
3075
+ return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
3076
+ }
3077
+ function IsLiteralValue2(value) {
3078
+ return IsBoolean(value) || IsNumber(value) || IsString(value);
3079
+ }
3080
+ function IsMappedKey2(value) {
3081
+ return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
3082
+ }
3083
+ function IsMappedResult2(value) {
3084
+ return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
3085
+ }
3086
+ function IsNever2(value) {
3087
+ return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
3088
+ }
3089
+ function IsNot2(value) {
3090
+ return IsKindOf2(value, "Not") && IsSchema2(value.not);
3091
+ }
3092
+ function IsNull3(value) {
3093
+ return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
3094
+ }
3095
+ function IsNumber4(value) {
3096
+ 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);
3097
+ }
3098
+ function IsObject4(value) {
3099
+ return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
3100
+ }
3101
+ function IsPromise2(value) {
3102
+ return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
3103
+ }
3104
+ function IsRecord2(value) {
3105
+ return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
3106
+ const keys = Object.getOwnPropertyNames(schema.patternProperties);
3107
+ return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
3108
+ })(value);
3109
+ }
3110
+ function IsRecursive(value) {
3111
+ return IsObject(value) && Hint in value && value[Hint] === "Recursive";
3112
+ }
3113
+ function IsRef2(value) {
3114
+ return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
3115
+ }
3116
+ function IsRegExp3(value) {
3117
+ return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
3118
+ }
3119
+ function IsString3(value) {
3120
+ return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
3121
+ }
3122
+ function IsSymbol3(value) {
3123
+ return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
3124
+ }
3125
+ function IsTemplateLiteral2(value) {
3126
+ return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
3127
+ }
3128
+ function IsThis2(value) {
3129
+ return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
3130
+ }
3131
+ function IsTransform2(value) {
3132
+ return IsObject(value) && TransformKind in value;
3133
+ }
3134
+ function IsTuple2(value) {
3135
+ return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
3136
+ (IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
3137
+ }
3138
+ function IsUndefined4(value) {
3139
+ return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
3140
+ }
3141
+ function IsUnionLiteral(value) {
3142
+ return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
3143
+ }
3144
+ function IsUnion2(value) {
3145
+ return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
3146
+ }
3147
+ function IsUint8Array3(value) {
3148
+ return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
3149
+ }
3150
+ function IsUnknown2(value) {
3151
+ return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
3152
+ }
3153
+ function IsUnsafe2(value) {
3154
+ return IsKindOf2(value, "Unsafe");
3155
+ }
3156
+ function IsVoid2(value) {
3157
+ return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
3158
+ }
3159
+ function IsKind2(value) {
3160
+ return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
3161
+ }
3162
+ function IsSchema2(value) {
3163
+ return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed2(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) || IsNumber4(value) || IsObject4(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
3164
+ }
3165
+
3166
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
3167
+ var PatternBoolean = "(true|false)";
3168
+ var PatternNumber = "(0|[1-9][0-9]*)";
3169
+ var PatternString = "(.*)";
3170
+ var PatternNever = "(?!.*)";
3171
+ var PatternBooleanExact = `^${PatternBoolean}$`;
3172
+ var PatternNumberExact = `^${PatternNumber}$`;
3173
+ var PatternStringExact = `^${PatternString}$`;
3174
+ var PatternNeverExact = `^${PatternNever}$`;
3175
+
3176
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
3177
+ function SetIncludes(T, S) {
3178
+ return T.includes(S);
3179
+ }
3180
+ function SetDistinct(T) {
3181
+ return [...new Set(T)];
3182
+ }
3183
+ function SetIntersect(T, S) {
3184
+ return T.filter((L) => S.includes(L));
3185
+ }
3186
+ function SetIntersectManyResolve(T, Init) {
3187
+ return T.reduce((Acc, L) => {
3188
+ return SetIntersect(Acc, L);
3189
+ }, Init);
3190
+ }
3191
+ function SetIntersectMany(T) {
3192
+ return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
3193
+ }
3194
+ function SetUnionMany(T) {
3195
+ const Acc = [];
3196
+ for (const L of T)
3197
+ Acc.push(...L);
3198
+ return Acc;
3199
+ }
3200
+
3201
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
3202
+ function Any(options) {
3203
+ return CreateType({ [Kind]: "Any" }, options);
3204
+ }
3205
+
3206
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
3207
+ function Array2(items, options) {
3208
+ return CreateType({ [Kind]: "Array", type: "array", items }, options);
3209
+ }
3210
+
3211
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs
3212
+ function Argument(index) {
3213
+ return CreateType({ [Kind]: "Argument", index });
3214
+ }
3215
+
3216
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
3217
+ function AsyncIterator(items, options) {
3218
+ return CreateType({ [Kind]: "AsyncIterator", type: "AsyncIterator", items }, options);
3219
+ }
3220
+
3221
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs
3222
+ function Computed(target, parameters, options) {
3223
+ return CreateType({ [Kind]: "Computed", target, parameters }, options);
3224
+ }
3225
+
3226
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
3227
+ function DiscardKey(value, key) {
3228
+ const { [key]: _, ...rest } = value;
3229
+ return rest;
3230
+ }
3231
+ function Discard(value, keys) {
3232
+ return keys.reduce((acc, key) => DiscardKey(acc, key), value);
3233
+ }
3234
+
3235
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
3236
+ function Never(options) {
3237
+ return CreateType({ [Kind]: "Never", not: {} }, options);
3238
+ }
3239
+
3240
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
3241
+ function MappedResult(properties) {
3242
+ return CreateType({
3243
+ [Kind]: "MappedResult",
3244
+ properties
3245
+ });
3246
+ }
3247
+
3248
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
3249
+ function Constructor(parameters, returns, options) {
3250
+ return CreateType({ [Kind]: "Constructor", type: "Constructor", parameters, returns }, options);
3251
+ }
3252
+
3253
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
3254
+ function Function(parameters, returns, options) {
3255
+ return CreateType({ [Kind]: "Function", type: "Function", parameters, returns }, options);
3256
+ }
3257
+
3258
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
3259
+ function UnionCreate(T, options) {
3260
+ return CreateType({ [Kind]: "Union", anyOf: T }, options);
3261
+ }
3262
+
3263
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
3264
+ function IsUnionOptional(types) {
3265
+ return types.some((type) => IsOptional(type));
3266
+ }
3267
+ function RemoveOptionalFromRest(types) {
3268
+ return types.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
3269
+ }
3270
+ function RemoveOptionalFromType(T) {
3271
+ return Discard(T, [OptionalKind]);
3272
+ }
3273
+ function ResolveUnion(types, options) {
3274
+ const isOptional = IsUnionOptional(types);
3275
+ return isOptional ? Optional(UnionCreate(RemoveOptionalFromRest(types), options)) : UnionCreate(RemoveOptionalFromRest(types), options);
3276
+ }
3277
+ function UnionEvaluated(T, options) {
3278
+ return T.length === 1 ? CreateType(T[0], options) : T.length === 0 ? Never(options) : ResolveUnion(T, options);
3279
+ }
3280
+
3281
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
3282
+ function Union(types, options) {
3283
+ return types.length === 0 ? Never(options) : types.length === 1 ? CreateType(types[0], options) : UnionCreate(types, options);
3284
+ }
3285
+
3286
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
3287
+ var TemplateLiteralParserError = class extends TypeBoxError {
3288
+ };
3289
+ function Unescape(pattern) {
3290
+ return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
3291
+ }
3292
+ function IsNonEscaped(pattern, index, char) {
3293
+ return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
3294
+ }
3295
+ function IsOpenParen(pattern, index) {
3296
+ return IsNonEscaped(pattern, index, "(");
3297
+ }
3298
+ function IsCloseParen(pattern, index) {
3299
+ return IsNonEscaped(pattern, index, ")");
3300
+ }
3301
+ function IsSeparator(pattern, index) {
3302
+ return IsNonEscaped(pattern, index, "|");
3303
+ }
3304
+ function IsGroup(pattern) {
3305
+ if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
3306
+ return false;
3307
+ let count = 0;
3308
+ for (let index = 0; index < pattern.length; index++) {
3309
+ if (IsOpenParen(pattern, index))
3310
+ count += 1;
3311
+ if (IsCloseParen(pattern, index))
3312
+ count -= 1;
3313
+ if (count === 0 && index !== pattern.length - 1)
3314
+ return false;
3315
+ }
3316
+ return true;
3317
+ }
3318
+ function InGroup(pattern) {
3319
+ return pattern.slice(1, pattern.length - 1);
3320
+ }
3321
+ function IsPrecedenceOr(pattern) {
3322
+ let count = 0;
3323
+ for (let index = 0; index < pattern.length; index++) {
3324
+ if (IsOpenParen(pattern, index))
3325
+ count += 1;
3326
+ if (IsCloseParen(pattern, index))
3327
+ count -= 1;
3328
+ if (IsSeparator(pattern, index) && count === 0)
3329
+ return true;
3330
+ }
3331
+ return false;
3332
+ }
3333
+ function IsPrecedenceAnd(pattern) {
3334
+ for (let index = 0; index < pattern.length; index++) {
3335
+ if (IsOpenParen(pattern, index))
3336
+ return true;
3337
+ }
3338
+ return false;
3339
+ }
3340
+ function Or(pattern) {
3341
+ let [count, start] = [0, 0];
3342
+ const expressions = [];
3343
+ for (let index = 0; index < pattern.length; index++) {
3344
+ if (IsOpenParen(pattern, index))
3345
+ count += 1;
3346
+ if (IsCloseParen(pattern, index))
3347
+ count -= 1;
3348
+ if (IsSeparator(pattern, index) && count === 0) {
3349
+ const range2 = pattern.slice(start, index);
3350
+ if (range2.length > 0)
3351
+ expressions.push(TemplateLiteralParse(range2));
3352
+ start = index + 1;
3353
+ }
3354
+ }
3355
+ const range = pattern.slice(start);
3356
+ if (range.length > 0)
3357
+ expressions.push(TemplateLiteralParse(range));
3358
+ if (expressions.length === 0)
3359
+ return { type: "const", const: "" };
3360
+ if (expressions.length === 1)
3361
+ return expressions[0];
3362
+ return { type: "or", expr: expressions };
3363
+ }
3364
+ function And(pattern) {
3365
+ function Group(value, index) {
3366
+ if (!IsOpenParen(value, index))
3367
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
3368
+ let count = 0;
3369
+ for (let scan = index; scan < value.length; scan++) {
3370
+ if (IsOpenParen(value, scan))
3371
+ count += 1;
3372
+ if (IsCloseParen(value, scan))
3373
+ count -= 1;
3374
+ if (count === 0)
3375
+ return [index, scan];
3376
+ }
3377
+ throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
3378
+ }
3379
+ function Range(pattern2, index) {
3380
+ for (let scan = index; scan < pattern2.length; scan++) {
3381
+ if (IsOpenParen(pattern2, scan))
3382
+ return [index, scan];
3383
+ }
3384
+ return [index, pattern2.length];
3385
+ }
3386
+ const expressions = [];
3387
+ for (let index = 0; index < pattern.length; index++) {
3388
+ if (IsOpenParen(pattern, index)) {
3389
+ const [start, end] = Group(pattern, index);
3390
+ const range = pattern.slice(start, end + 1);
3391
+ expressions.push(TemplateLiteralParse(range));
3392
+ index = end;
3393
+ } else {
3394
+ const [start, end] = Range(pattern, index);
3395
+ const range = pattern.slice(start, end);
3396
+ if (range.length > 0)
3397
+ expressions.push(TemplateLiteralParse(range));
3398
+ index = end - 1;
3399
+ }
3400
+ }
3401
+ return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
3402
+ }
3403
+ function TemplateLiteralParse(pattern) {
3404
+ return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
3405
+ }
3406
+ function TemplateLiteralParseExact(pattern) {
3407
+ return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
3408
+ }
3409
+
3410
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
3411
+ var TemplateLiteralFiniteError = class extends TypeBoxError {
3412
+ };
3413
+ function IsNumberExpression(expression) {
3414
+ 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]*";
3415
+ }
3416
+ function IsBooleanExpression(expression) {
3417
+ 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";
3418
+ }
3419
+ function IsStringExpression(expression) {
3420
+ return expression.type === "const" && expression.const === ".*";
3421
+ }
3422
+ function IsTemplateLiteralExpressionFinite(expression) {
3423
+ 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 : (() => {
3424
+ throw new TemplateLiteralFiniteError(`Unknown expression type`);
3425
+ })();
3426
+ }
3427
+ function IsTemplateLiteralFinite(schema) {
3428
+ const expression = TemplateLiteralParseExact(schema.pattern);
3429
+ return IsTemplateLiteralExpressionFinite(expression);
3430
+ }
3431
+
3432
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
3433
+ var TemplateLiteralGenerateError = class extends TypeBoxError {
3434
+ };
3435
+ function* GenerateReduce(buffer) {
3436
+ if (buffer.length === 1)
3437
+ return yield* buffer[0];
3438
+ for (const left of buffer[0]) {
3439
+ for (const right of GenerateReduce(buffer.slice(1))) {
3440
+ yield `${left}${right}`;
3441
+ }
3442
+ }
3443
+ }
3444
+ function* GenerateAnd(expression) {
3445
+ return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
3446
+ }
3447
+ function* GenerateOr(expression) {
3448
+ for (const expr of expression.expr)
3449
+ yield* TemplateLiteralExpressionGenerate(expr);
3450
+ }
3451
+ function* GenerateConst(expression) {
3452
+ return yield expression.const;
3453
+ }
3454
+ function* TemplateLiteralExpressionGenerate(expression) {
3455
+ return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
3456
+ throw new TemplateLiteralGenerateError("Unknown expression");
3457
+ })();
3458
+ }
3459
+ function TemplateLiteralGenerate(schema) {
3460
+ const expression = TemplateLiteralParseExact(schema.pattern);
3461
+ return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
3462
+ }
3463
+
3464
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
3465
+ function Literal(value, options) {
3466
+ return CreateType({
3467
+ [Kind]: "Literal",
3468
+ const: value,
3469
+ type: typeof value
3470
+ }, options);
3471
+ }
3472
+
3473
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
3474
+ function Boolean2(options) {
3475
+ return CreateType({ [Kind]: "Boolean", type: "boolean" }, options);
3476
+ }
3477
+
3478
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
3479
+ function BigInt(options) {
3480
+ return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
3481
+ }
3482
+
3483
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
3484
+ function Number2(options) {
3485
+ return CreateType({ [Kind]: "Number", type: "number" }, options);
3486
+ }
3487
+
3488
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
3489
+ function String2(options) {
3490
+ return CreateType({ [Kind]: "String", type: "string" }, options);
3491
+ }
3492
+
3493
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
3494
+ function* FromUnion(syntax) {
3495
+ const trim = syntax.trim().replace(/"|'/g, "");
3496
+ return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt() : trim === "string" ? yield String2() : yield (() => {
3497
+ const literals = trim.split("|").map((literal) => Literal(literal.trim()));
3498
+ return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
3499
+ })();
3500
+ }
3501
+ function* FromTerminal(syntax) {
3502
+ if (syntax[1] !== "{") {
3503
+ const L = Literal("$");
3504
+ const R = FromSyntax(syntax.slice(1));
3505
+ return yield* [L, ...R];
3506
+ }
3507
+ for (let i = 2; i < syntax.length; i++) {
3508
+ if (syntax[i] === "}") {
3509
+ const L = FromUnion(syntax.slice(2, i));
3510
+ const R = FromSyntax(syntax.slice(i + 1));
3511
+ return yield* [...L, ...R];
3512
+ }
3513
+ }
3514
+ yield Literal(syntax);
3515
+ }
3516
+ function* FromSyntax(syntax) {
3517
+ for (let i = 0; i < syntax.length; i++) {
3518
+ if (syntax[i] === "$") {
3519
+ const L = Literal(syntax.slice(0, i));
3520
+ const R = FromTerminal(syntax.slice(i));
3521
+ return yield* [L, ...R];
3522
+ }
3523
+ }
3524
+ yield Literal(syntax);
3525
+ }
3526
+ function TemplateLiteralSyntax(syntax) {
3527
+ return [...FromSyntax(syntax)];
3528
+ }
3529
+
3530
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
3531
+ var TemplateLiteralPatternError = class extends TypeBoxError {
3532
+ };
3533
+ function Escape(value) {
3534
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3535
+ }
3536
+ function Visit2(schema, acc) {
3537
+ return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(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}` : (() => {
3538
+ throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
3539
+ })();
3540
+ }
3541
+ function TemplateLiteralPattern(kinds) {
3542
+ return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
3543
+ }
3544
+
3545
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
3546
+ function TemplateLiteralToUnion(schema) {
3547
+ const R = TemplateLiteralGenerate(schema);
3548
+ const L = R.map((S) => Literal(S));
3549
+ return UnionEvaluated(L);
3550
+ }
3551
+
3552
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
3553
+ function TemplateLiteral(unresolved, options) {
3554
+ const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
3555
+ return CreateType({ [Kind]: "TemplateLiteral", type: "string", pattern }, options);
3556
+ }
3557
+
3558
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
3559
+ function FromTemplateLiteral(templateLiteral) {
3560
+ const keys = TemplateLiteralGenerate(templateLiteral);
3561
+ return keys.map((key) => key.toString());
3562
+ }
3563
+ function FromUnion2(types) {
3564
+ const result = [];
3565
+ for (const type of types)
3566
+ result.push(...IndexPropertyKeys(type));
3567
+ return result;
3568
+ }
3569
+ function FromLiteral(literalValue) {
3570
+ return [literalValue.toString()];
3571
+ }
3572
+ function IndexPropertyKeys(type) {
3573
+ return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger(type) ? ["[number]"] : [])];
3574
+ }
3575
+
3576
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
3577
+ function FromProperties(type, properties, options) {
3578
+ const result = {};
3579
+ for (const K2 of Object.getOwnPropertyNames(properties)) {
3580
+ result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options);
3581
+ }
3582
+ return result;
3583
+ }
3584
+ function FromMappedResult(type, mappedResult, options) {
3585
+ return FromProperties(type, mappedResult.properties, options);
3586
+ }
3587
+ function IndexFromMappedResult(type, mappedResult, options) {
3588
+ const properties = FromMappedResult(type, mappedResult, options);
3589
+ return MappedResult(properties);
3590
+ }
3591
+
3592
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
3593
+ function FromRest(types, key) {
3594
+ return types.map((type) => IndexFromPropertyKey(type, key));
3595
+ }
3596
+ function FromIntersectRest(types) {
3597
+ return types.filter((type) => !IsNever(type));
3598
+ }
3599
+ function FromIntersect(types, key) {
3600
+ return IntersectEvaluated(FromIntersectRest(FromRest(types, key)));
3601
+ }
3602
+ function FromUnionRest(types) {
3603
+ return types.some((L) => IsNever(L)) ? [] : types;
3604
+ }
3605
+ function FromUnion3(types, key) {
3606
+ return UnionEvaluated(FromUnionRest(FromRest(types, key)));
3607
+ }
3608
+ function FromTuple(types, key) {
3609
+ return key in types ? types[key] : key === "[number]" ? UnionEvaluated(types) : Never();
3610
+ }
3611
+ function FromArray(type, key) {
3612
+ return key === "[number]" ? type : Never();
3613
+ }
3614
+ function FromProperty(properties, propertyKey) {
3615
+ return propertyKey in properties ? properties[propertyKey] : Never();
3616
+ }
3617
+ function IndexFromPropertyKey(type, propertyKey) {
3618
+ return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
3619
+ }
3620
+ function IndexFromPropertyKeys(type, propertyKeys) {
3621
+ return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
3622
+ }
3623
+ function FromSchema(type, propertyKeys) {
3624
+ return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
3625
+ }
3626
+ function Index(type, key, options) {
3627
+ if (IsRef(type) || IsRef(key)) {
3628
+ const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
3629
+ if (!IsSchema(type) || !IsSchema(key))
3630
+ throw new TypeBoxError(error);
3631
+ return Computed("Index", [type, key]);
3632
+ }
3633
+ if (IsMappedResult(key))
3634
+ return IndexFromMappedResult(type, key, options);
3635
+ if (IsMappedKey(key))
3636
+ return IndexFromMappedKey(type, key, options);
3637
+ return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
3638
+ }
3639
+
3640
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
3641
+ function MappedIndexPropertyKey(type, key, options) {
3642
+ return { [key]: Index(type, [key], Clone(options)) };
3643
+ }
3644
+ function MappedIndexPropertyKeys(type, propertyKeys, options) {
3645
+ return propertyKeys.reduce((result, left) => {
3646
+ return { ...result, ...MappedIndexPropertyKey(type, left, options) };
3647
+ }, {});
3648
+ }
3649
+ function MappedIndexProperties(type, mappedKey, options) {
3650
+ return MappedIndexPropertyKeys(type, mappedKey.keys, options);
3651
+ }
3652
+ function IndexFromMappedKey(type, mappedKey, options) {
3653
+ const properties = MappedIndexProperties(type, mappedKey, options);
3654
+ return MappedResult(properties);
3655
+ }
3656
+
3657
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
3658
+ function Iterator(items, options) {
3659
+ return CreateType({ [Kind]: "Iterator", type: "Iterator", items }, options);
3660
+ }
3661
+
3662
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
3663
+ function RequiredArray(properties) {
3664
+ return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
3665
+ }
3666
+ function _Object(properties, options) {
3667
+ const required = RequiredArray(properties);
3668
+ const schema = required.length > 0 ? { [Kind]: "Object", type: "object", required, properties } : { [Kind]: "Object", type: "object", properties };
3669
+ return CreateType(schema, options);
3670
+ }
3671
+ var Object2 = _Object;
3672
+
3673
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
3674
+ function Promise2(item, options) {
3675
+ return CreateType({ [Kind]: "Promise", type: "Promise", item }, options);
3676
+ }
3677
+
3678
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
3679
+ function RemoveReadonly(schema) {
3680
+ return CreateType(Discard(schema, [ReadonlyKind]));
3681
+ }
3682
+ function AddReadonly(schema) {
3683
+ return CreateType({ ...schema, [ReadonlyKind]: "Readonly" });
3684
+ }
3685
+ function ReadonlyWithFlag(schema, F) {
3686
+ return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
3687
+ }
3688
+ function Readonly(schema, enable) {
3689
+ const F = enable ?? true;
3690
+ return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
3691
+ }
3692
+
3693
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
3694
+ function FromProperties2(K, F) {
3695
+ const Acc = {};
3696
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
3697
+ Acc[K2] = Readonly(K[K2], F);
3698
+ return Acc;
3699
+ }
3700
+ function FromMappedResult2(R, F) {
3701
+ return FromProperties2(R.properties, F);
3702
+ }
3703
+ function ReadonlyFromMappedResult(R, F) {
3704
+ const P = FromMappedResult2(R, F);
3705
+ return MappedResult(P);
3706
+ }
3707
+
3708
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
3709
+ function Tuple(types, options) {
3710
+ return CreateType(types.length > 0 ? { [Kind]: "Tuple", type: "array", items: types, additionalItems: false, minItems: types.length, maxItems: types.length } : { [Kind]: "Tuple", type: "array", minItems: types.length, maxItems: types.length }, options);
3711
+ }
3712
+
3713
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
3714
+ function FromMappedResult3(K, P) {
3715
+ return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
3716
+ }
3717
+ function MappedKeyToKnownMappedResultProperties(K) {
3718
+ return { [K]: Literal(K) };
3719
+ }
3720
+ function MappedKeyToUnknownMappedResultProperties(P) {
3721
+ const Acc = {};
3722
+ for (const L of P)
3723
+ Acc[L] = Literal(L);
3724
+ return Acc;
3725
+ }
3726
+ function MappedKeyToMappedResultProperties(K, P) {
3727
+ return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
3728
+ }
3729
+ function FromMappedKey(K, P) {
3730
+ const R = MappedKeyToMappedResultProperties(K, P);
3731
+ return FromMappedResult3(K, R);
3732
+ }
3733
+ function FromRest2(K, T) {
3734
+ return T.map((L) => FromSchemaType(K, L));
3735
+ }
3736
+ function FromProperties3(K, T) {
3737
+ const Acc = {};
3738
+ for (const K2 of globalThis.Object.getOwnPropertyNames(T))
3739
+ Acc[K2] = FromSchemaType(K, T[K2]);
3740
+ return Acc;
3741
+ }
3742
+ function FromSchemaType(K, T) {
3743
+ const options = { ...T };
3744
+ return (
3745
+ // unevaluated modifier types
3746
+ IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
3747
+ // unevaluated mapped types
3748
+ IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
3749
+ // unevaluated types
3750
+ IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction2(T) ? Function(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item), options) : T
3751
+ )
3752
+ )
3753
+ );
3754
+ }
3755
+ function MappedFunctionReturnType(K, T) {
3756
+ const Acc = {};
3757
+ for (const L of K)
3758
+ Acc[L] = FromSchemaType(L, T);
3759
+ return Acc;
3760
+ }
3761
+ function Mapped(key, map, options) {
3762
+ const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
3763
+ const RT = map({ [Kind]: "MappedKey", keys: K });
3764
+ const R = MappedFunctionReturnType(K, RT);
3765
+ return Object2(R, options);
3766
+ }
3767
+
3768
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
3769
+ function RemoveOptional(schema) {
3770
+ return CreateType(Discard(schema, [OptionalKind]));
3771
+ }
3772
+ function AddOptional(schema) {
3773
+ return CreateType({ ...schema, [OptionalKind]: "Optional" });
3774
+ }
3775
+ function OptionalWithFlag(schema, F) {
3776
+ return F === false ? RemoveOptional(schema) : AddOptional(schema);
3777
+ }
3778
+ function Optional(schema, enable) {
3779
+ const F = enable ?? true;
3780
+ return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
3781
+ }
3782
+
3783
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
3784
+ function FromProperties4(P, F) {
3785
+ const Acc = {};
3786
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
3787
+ Acc[K2] = Optional(P[K2], F);
3788
+ return Acc;
3789
+ }
3790
+ function FromMappedResult4(R, F) {
3791
+ return FromProperties4(R.properties, F);
3792
+ }
3793
+ function OptionalFromMappedResult(R, F) {
3794
+ const P = FromMappedResult4(R, F);
3795
+ return MappedResult(P);
3796
+ }
3797
+
3798
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
3799
+ function IntersectCreate(T, options = {}) {
3800
+ const allObjects = T.every((schema) => IsObject3(schema));
3801
+ const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
3802
+ return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T }, options);
3803
+ }
3804
+
3805
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
3806
+ function IsIntersectOptional(types) {
3807
+ return types.every((left) => IsOptional(left));
3808
+ }
3809
+ function RemoveOptionalFromType2(type) {
3810
+ return Discard(type, [OptionalKind]);
3811
+ }
3812
+ function RemoveOptionalFromRest2(types) {
3813
+ return types.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
3814
+ }
3815
+ function ResolveIntersect(types, options) {
3816
+ return IsIntersectOptional(types) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types), options)) : IntersectCreate(RemoveOptionalFromRest2(types), options);
3817
+ }
3818
+ function IntersectEvaluated(types, options = {}) {
3819
+ if (types.length === 1)
3820
+ return CreateType(types[0], options);
3821
+ if (types.length === 0)
3822
+ return Never(options);
3823
+ if (types.some((schema) => IsTransform(schema)))
3824
+ throw new Error("Cannot intersect transform types");
3825
+ return ResolveIntersect(types, options);
3826
+ }
3827
+
3828
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
3829
+ function Intersect(types, options) {
3830
+ if (types.length === 1)
3831
+ return CreateType(types[0], options);
3832
+ if (types.length === 0)
3833
+ return Never(options);
3834
+ if (types.some((schema) => IsTransform(schema)))
3835
+ throw new Error("Cannot intersect transform types");
3836
+ return IntersectCreate(types, options);
3837
+ }
3838
+
3839
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
3840
+ function Ref(...args) {
3841
+ const [$ref, options] = typeof args[0] === "string" ? [args[0], args[1]] : [args[0].$id, args[1]];
3842
+ if (typeof $ref !== "string")
3843
+ throw new TypeBoxError("Ref: $ref must be a string");
3844
+ return CreateType({ [Kind]: "Ref", $ref }, options);
3845
+ }
3846
+
3847
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
3848
+ function FromComputed(target, parameters) {
3849
+ return Computed("Awaited", [Computed(target, parameters)]);
3850
+ }
3851
+ function FromRef($ref) {
3852
+ return Computed("Awaited", [Ref($ref)]);
3853
+ }
3854
+ function FromIntersect2(types) {
3855
+ return Intersect(FromRest3(types));
3856
+ }
3857
+ function FromUnion4(types) {
3858
+ return Union(FromRest3(types));
3859
+ }
3860
+ function FromPromise(type) {
3861
+ return Awaited(type);
3862
+ }
3863
+ function FromRest3(types) {
3864
+ return types.map((type) => Awaited(type));
3865
+ }
3866
+ function Awaited(type, options) {
3867
+ return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
3868
+ }
3869
+
3870
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
3871
+ function FromRest4(types) {
3872
+ const result = [];
3873
+ for (const L of types)
3874
+ result.push(KeyOfPropertyKeys(L));
3875
+ return result;
3876
+ }
3877
+ function FromIntersect3(types) {
3878
+ const propertyKeysArray = FromRest4(types);
3879
+ const propertyKeys = SetUnionMany(propertyKeysArray);
3880
+ return propertyKeys;
3881
+ }
3882
+ function FromUnion5(types) {
3883
+ const propertyKeysArray = FromRest4(types);
3884
+ const propertyKeys = SetIntersectMany(propertyKeysArray);
3885
+ return propertyKeys;
3886
+ }
3887
+ function FromTuple2(types) {
3888
+ return types.map((_, indexer) => indexer.toString());
3889
+ }
3890
+ function FromArray2(_) {
3891
+ return ["[number]"];
3892
+ }
3893
+ function FromProperties5(T) {
3894
+ return globalThis.Object.getOwnPropertyNames(T);
3895
+ }
3896
+ function FromPatternProperties(patternProperties) {
3897
+ if (!includePatternProperties)
3898
+ return [];
3899
+ const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
3900
+ return patternPropertyKeys.map((key) => {
3901
+ return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
3902
+ });
3903
+ }
3904
+ function KeyOfPropertyKeys(type) {
3905
+ return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
3906
+ }
3907
+ var includePatternProperties = false;
3908
+
3909
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
3910
+ function FromComputed2(target, parameters) {
3911
+ return Computed("KeyOf", [Computed(target, parameters)]);
3912
+ }
3913
+ function FromRef2($ref) {
3914
+ return Computed("KeyOf", [Ref($ref)]);
3915
+ }
3916
+ function KeyOfFromType(type, options) {
3917
+ const propertyKeys = KeyOfPropertyKeys(type);
3918
+ const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
3919
+ const result = UnionEvaluated(propertyKeyTypes);
3920
+ return CreateType(result, options);
3921
+ }
3922
+ function KeyOfPropertyKeysToRest(propertyKeys) {
3923
+ return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
3924
+ }
3925
+ function KeyOf(type, options) {
3926
+ return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
3927
+ }
3928
+
3929
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
3930
+ function FromProperties6(properties, options) {
3931
+ const result = {};
3932
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
3933
+ result[K2] = KeyOf(properties[K2], Clone(options));
3934
+ return result;
3935
+ }
3936
+ function FromMappedResult5(mappedResult, options) {
3937
+ return FromProperties6(mappedResult.properties, options);
3938
+ }
3939
+ function KeyOfFromMappedResult(mappedResult, options) {
3940
+ const properties = FromMappedResult5(mappedResult, options);
3941
+ return MappedResult(properties);
3942
+ }
3943
+
3944
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
3945
+ function CompositeKeys(T) {
3946
+ const Acc = [];
3947
+ for (const L of T)
3948
+ Acc.push(...KeyOfPropertyKeys(L));
3949
+ return SetDistinct(Acc);
3950
+ }
3951
+ function FilterNever(T) {
3952
+ return T.filter((L) => !IsNever(L));
3953
+ }
3954
+ function CompositeProperty(T, K) {
3955
+ const Acc = [];
3956
+ for (const L of T)
3957
+ Acc.push(...IndexFromPropertyKeys(L, [K]));
3958
+ return FilterNever(Acc);
3959
+ }
3960
+ function CompositeProperties(T, K) {
3961
+ const Acc = {};
3962
+ for (const L of K) {
3963
+ Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
3964
+ }
3965
+ return Acc;
3966
+ }
3967
+ function Composite(T, options) {
3968
+ const K = CompositeKeys(T);
3969
+ const P = CompositeProperties(T, K);
3970
+ const R = Object2(P, options);
3971
+ return R;
3972
+ }
3973
+
3974
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
3975
+ function Date2(options) {
3976
+ return CreateType({ [Kind]: "Date", type: "Date" }, options);
3977
+ }
3978
+
3979
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
3980
+ function Null(options) {
3981
+ return CreateType({ [Kind]: "Null", type: "null" }, options);
3982
+ }
3983
+
3984
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
3985
+ function Symbol2(options) {
3986
+ return CreateType({ [Kind]: "Symbol", type: "symbol" }, options);
3987
+ }
3988
+
3989
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
3990
+ function Undefined(options) {
3991
+ return CreateType({ [Kind]: "Undefined", type: "undefined" }, options);
3992
+ }
3993
+
3994
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
3995
+ function Uint8Array2(options) {
3996
+ return CreateType({ [Kind]: "Uint8Array", type: "Uint8Array" }, options);
3997
+ }
3998
+
3999
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
4000
+ function Unknown(options) {
4001
+ return CreateType({ [Kind]: "Unknown" }, options);
4002
+ }
4003
+
4004
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
4005
+ function FromArray3(T) {
4006
+ return T.map((L) => FromValue(L, false));
4007
+ }
4008
+ function FromProperties7(value) {
4009
+ const Acc = {};
4010
+ for (const K of globalThis.Object.getOwnPropertyNames(value))
4011
+ Acc[K] = Readonly(FromValue(value[K], false));
4012
+ return Acc;
4013
+ }
4014
+ function ConditionalReadonly(T, root) {
4015
+ return root === true ? T : Readonly(T);
4016
+ }
4017
+ function FromValue(value, root) {
4018
+ 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(Function([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
4019
+ }
4020
+ function Const(T, options) {
4021
+ return CreateType(FromValue(T, true), options);
4022
+ }
4023
+
4024
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
4025
+ function ConstructorParameters(schema, options) {
4026
+ return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
4027
+ }
4028
+
4029
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
4030
+ function Enum(item, options) {
4031
+ if (IsUndefined(item))
4032
+ throw new Error("Enum undefined or empty");
4033
+ const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
4034
+ const values2 = [...new Set(values1)];
4035
+ const anyOf = values2.map((value) => Literal(value));
4036
+ return Union(anyOf, { ...options, [Hint]: "Enum" });
4037
+ }
4038
+
4039
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
4040
+ var ExtendsResolverError = class extends TypeBoxError {
4041
+ };
4042
+ var ExtendsResult;
4043
+ (function(ExtendsResult2) {
4044
+ ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
4045
+ ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
4046
+ ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
4047
+ })(ExtendsResult || (ExtendsResult = {}));
4048
+ function IntoBooleanResult(result) {
4049
+ return result === ExtendsResult.False ? result : ExtendsResult.True;
4050
+ }
4051
+ function Throw(message) {
4052
+ throw new ExtendsResolverError(message);
4053
+ }
4054
+ function IsStructuralRight(right) {
4055
+ return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
4056
+ }
4057
+ function StructuralRight(left, right) {
4058
+ 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");
4059
+ }
4060
+ function FromAnyRight(left, right) {
4061
+ return ExtendsResult.True;
4062
+ }
4063
+ function FromAny(left, right) {
4064
+ 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;
4065
+ }
4066
+ function FromArrayRight(left, right) {
4067
+ return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
4068
+ }
4069
+ function FromArray4(left, right) {
4070
+ 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));
4071
+ }
4072
+ function FromAsyncIterator(left, right) {
4073
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
4074
+ }
4075
+ function FromBigInt(left, right) {
4076
+ 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;
4077
+ }
4078
+ function FromBooleanRight(left, right) {
4079
+ return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
4080
+ }
4081
+ function FromBoolean(left, right) {
4082
+ 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;
4083
+ }
4084
+ function FromConstructor(left, right) {
4085
+ 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));
4086
+ }
4087
+ function FromDate(left, right) {
4088
+ 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;
4089
+ }
4090
+ function FromFunction(left, right) {
4091
+ 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));
4092
+ }
4093
+ function FromIntegerRight(left, right) {
4094
+ return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
4095
+ }
4096
+ function FromInteger(left, right) {
4097
+ 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;
4098
+ }
4099
+ function FromIntersectRight(left, right) {
4100
+ return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
4101
+ }
4102
+ function FromIntersect4(left, right) {
4103
+ return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
4104
+ }
4105
+ function FromIterator(left, right) {
4106
+ return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
4107
+ }
4108
+ function FromLiteral2(left, right) {
4109
+ 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;
4110
+ }
4111
+ function FromNeverRight(left, right) {
4112
+ return ExtendsResult.False;
4113
+ }
4114
+ function FromNever(left, right) {
4115
+ return ExtendsResult.True;
4116
+ }
4117
+ function UnwrapTNot(schema) {
4118
+ let [current, depth] = [schema, 0];
4119
+ while (true) {
4120
+ if (!type_exports.IsNot(current))
4121
+ break;
4122
+ current = current.not;
4123
+ depth += 1;
4124
+ }
4125
+ return depth % 2 === 0 ? current : Unknown();
4126
+ }
4127
+ function FromNot(left, right) {
4128
+ return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
4129
+ }
4130
+ function FromNull(left, right) {
4131
+ 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;
4132
+ }
4133
+ function FromNumberRight(left, right) {
4134
+ return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
4135
+ }
4136
+ function FromNumber(left, right) {
4137
+ 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;
4138
+ }
4139
+ function IsObjectPropertyCount(schema, count) {
4140
+ return Object.getOwnPropertyNames(schema.properties).length === count;
4141
+ }
4142
+ function IsObjectStringLike(schema) {
4143
+ return IsObjectArrayLike(schema);
4144
+ }
4145
+ function IsObjectSymbolLike(schema) {
4146
+ 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]));
4147
+ }
4148
+ function IsObjectNumberLike(schema) {
4149
+ return IsObjectPropertyCount(schema, 0);
4150
+ }
4151
+ function IsObjectBooleanLike(schema) {
4152
+ return IsObjectPropertyCount(schema, 0);
4153
+ }
4154
+ function IsObjectBigIntLike(schema) {
4155
+ return IsObjectPropertyCount(schema, 0);
4156
+ }
4157
+ function IsObjectDateLike(schema) {
4158
+ return IsObjectPropertyCount(schema, 0);
4159
+ }
4160
+ function IsObjectUint8ArrayLike(schema) {
4161
+ return IsObjectArrayLike(schema);
4162
+ }
4163
+ function IsObjectFunctionLike(schema) {
4164
+ const length = Number2();
4165
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
4166
+ }
4167
+ function IsObjectConstructorLike(schema) {
4168
+ return IsObjectPropertyCount(schema, 0);
4169
+ }
4170
+ function IsObjectArrayLike(schema) {
4171
+ const length = Number2();
4172
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
4173
+ }
4174
+ function IsObjectPromiseLike(schema) {
4175
+ const then = Function([Any()], Any());
4176
+ return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
4177
+ }
4178
+ function Property(left, right) {
4179
+ return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
4180
+ }
4181
+ function FromObjectRight(left, right) {
4182
+ 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)) ? (() => {
4183
+ return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
4184
+ })() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
4185
+ return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
4186
+ })() : ExtendsResult.False;
4187
+ }
4188
+ function FromObject(left, right) {
4189
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
4190
+ for (const key of Object.getOwnPropertyNames(right.properties)) {
4191
+ if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
4192
+ return ExtendsResult.False;
4193
+ }
4194
+ if (type_exports.IsOptional(right.properties[key])) {
4195
+ return ExtendsResult.True;
4196
+ }
4197
+ if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
4198
+ return ExtendsResult.False;
4199
+ }
4200
+ }
4201
+ return ExtendsResult.True;
4202
+ })();
4203
+ }
4204
+ function FromPromise2(left, right) {
4205
+ 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));
4206
+ }
4207
+ function RecordKey(schema) {
4208
+ return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String2() : Throw("Unknown record key pattern");
4209
+ }
4210
+ function RecordValue(schema) {
4211
+ return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
4212
+ }
4213
+ function FromRecordRight(left, right) {
4214
+ const [Key, Value] = [RecordKey(right), RecordValue(right)];
4215
+ 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) ? (() => {
4216
+ for (const key of Object.getOwnPropertyNames(left.properties)) {
4217
+ if (Property(Value, left.properties[key]) === ExtendsResult.False) {
4218
+ return ExtendsResult.False;
4219
+ }
4220
+ }
4221
+ return ExtendsResult.True;
4222
+ })() : ExtendsResult.False;
4223
+ }
4224
+ function FromRecord(left, right) {
4225
+ return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
4226
+ }
4227
+ function FromRegExp(left, right) {
4228
+ const L = type_exports.IsRegExp(left) ? String2() : left;
4229
+ const R = type_exports.IsRegExp(right) ? String2() : right;
4230
+ return Visit3(L, R);
4231
+ }
4232
+ function FromStringRight(left, right) {
4233
+ return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
4234
+ }
4235
+ function FromString(left, right) {
4236
+ 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;
4237
+ }
4238
+ function FromSymbol(left, right) {
4239
+ 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;
4240
+ }
4241
+ function FromTemplateLiteral2(left, right) {
4242
+ return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
4243
+ }
4244
+ function IsArrayOfTuple(left, right) {
4245
+ return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
4246
+ }
4247
+ function FromTupleRight(left, right) {
4248
+ return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
4249
+ }
4250
+ function FromTuple3(left, right) {
4251
+ 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;
4252
+ }
4253
+ function FromUint8Array(left, right) {
4254
+ 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;
4255
+ }
4256
+ function FromUndefined(left, right) {
4257
+ 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;
4258
+ }
4259
+ function FromUnionRight(left, right) {
4260
+ return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
4261
+ }
4262
+ function FromUnion6(left, right) {
4263
+ return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
4264
+ }
4265
+ function FromUnknownRight(left, right) {
4266
+ return ExtendsResult.True;
4267
+ }
4268
+ function FromUnknown(left, right) {
4269
+ 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;
4270
+ }
4271
+ function FromVoidRight(left, right) {
4272
+ return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
4273
+ }
4274
+ function FromVoid(left, right) {
4275
+ 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;
4276
+ }
4277
+ function Visit3(left, right) {
4278
+ return (
4279
+ // resolvable
4280
+ 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) : (
4281
+ // standard
4282
+ type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray4(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : type_exports.IsConstructor(left) ? FromConstructor(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect4(left, right) : type_exports.IsIterator(left) ? FromIterator(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) ? FromObject(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) ? FromTuple3(left, right) : type_exports.IsPromise(left) ? FromPromise2(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion6(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
4283
+ )
4284
+ );
4285
+ }
4286
+ function ExtendsCheck(left, right) {
4287
+ return Visit3(left, right);
4288
+ }
4289
+
4290
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
4291
+ function FromProperties8(P, Right, True, False, options) {
4292
+ const Acc = {};
4293
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4294
+ Acc[K2] = Extends(P[K2], Right, True, False, Clone(options));
4295
+ return Acc;
4296
+ }
4297
+ function FromMappedResult6(Left, Right, True, False, options) {
4298
+ return FromProperties8(Left.properties, Right, True, False, options);
4299
+ }
4300
+ function ExtendsFromMappedResult(Left, Right, True, False, options) {
4301
+ const P = FromMappedResult6(Left, Right, True, False, options);
4302
+ return MappedResult(P);
4303
+ }
4304
+
4305
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
4306
+ function ExtendsResolve(left, right, trueType, falseType) {
4307
+ const R = ExtendsCheck(left, right);
4308
+ return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
4309
+ }
4310
+ function Extends(L, R, T, F, options) {
4311
+ return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : CreateType(ExtendsResolve(L, R, T, F), options);
4312
+ }
4313
+
4314
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
4315
+ function FromPropertyKey(K, U, L, R, options) {
4316
+ return {
4317
+ [K]: Extends(Literal(K), U, L, R, Clone(options))
4318
+ };
4319
+ }
4320
+ function FromPropertyKeys(K, U, L, R, options) {
4321
+ return K.reduce((Acc, LK) => {
4322
+ return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
4323
+ }, {});
4324
+ }
4325
+ function FromMappedKey2(K, U, L, R, options) {
4326
+ return FromPropertyKeys(K.keys, U, L, R, options);
4327
+ }
4328
+ function ExtendsFromMappedKey(T, U, L, R, options) {
4329
+ const P = FromMappedKey2(T, U, L, R, options);
4330
+ return MappedResult(P);
4331
+ }
4332
+
4333
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
4334
+ function ExcludeFromTemplateLiteral(L, R) {
4335
+ return Exclude(TemplateLiteralToUnion(L), R);
4336
+ }
4337
+
4338
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
4339
+ function ExcludeRest(L, R) {
4340
+ const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
4341
+ return excluded.length === 1 ? excluded[0] : Union(excluded);
4342
+ }
4343
+ function Exclude(L, R, options = {}) {
4344
+ if (IsTemplateLiteral(L))
4345
+ return CreateType(ExcludeFromTemplateLiteral(L, R), options);
4346
+ if (IsMappedResult(L))
4347
+ return CreateType(ExcludeFromMappedResult(L, R), options);
4348
+ return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
4349
+ }
4350
+
4351
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
4352
+ function FromProperties9(P, U) {
4353
+ const Acc = {};
4354
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4355
+ Acc[K2] = Exclude(P[K2], U);
4356
+ return Acc;
4357
+ }
4358
+ function FromMappedResult7(R, T) {
4359
+ return FromProperties9(R.properties, T);
4360
+ }
4361
+ function ExcludeFromMappedResult(R, T) {
4362
+ const P = FromMappedResult7(R, T);
4363
+ return MappedResult(P);
4364
+ }
4365
+
4366
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
4367
+ function ExtractFromTemplateLiteral(L, R) {
4368
+ return Extract(TemplateLiteralToUnion(L), R);
4369
+ }
4370
+
4371
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
4372
+ function ExtractRest(L, R) {
4373
+ const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
4374
+ return extracted.length === 1 ? extracted[0] : Union(extracted);
4375
+ }
4376
+ function Extract(L, R, options) {
4377
+ if (IsTemplateLiteral(L))
4378
+ return CreateType(ExtractFromTemplateLiteral(L, R), options);
4379
+ if (IsMappedResult(L))
4380
+ return CreateType(ExtractFromMappedResult(L, R), options);
4381
+ return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
4382
+ }
4383
+
4384
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
4385
+ function FromProperties10(P, T) {
4386
+ const Acc = {};
4387
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4388
+ Acc[K2] = Extract(P[K2], T);
4389
+ return Acc;
4390
+ }
4391
+ function FromMappedResult8(R, T) {
4392
+ return FromProperties10(R.properties, T);
4393
+ }
4394
+ function ExtractFromMappedResult(R, T) {
4395
+ const P = FromMappedResult8(R, T);
4396
+ return MappedResult(P);
4397
+ }
4398
+
4399
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
4400
+ function InstanceType(schema, options) {
4401
+ return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
4402
+ }
4403
+
4404
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
4405
+ function ReadonlyOptional(schema) {
4406
+ return Readonly(Optional(schema));
4407
+ }
4408
+
4409
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
4410
+ function RecordCreateFromPattern(pattern, T, options) {
4411
+ return CreateType({ [Kind]: "Record", type: "object", patternProperties: { [pattern]: T } }, options);
4412
+ }
4413
+ function RecordCreateFromKeys(K, T, options) {
4414
+ const result = {};
4415
+ for (const K2 of K)
4416
+ result[K2] = T;
4417
+ return Object2(result, { ...options, [Hint]: "Record" });
4418
+ }
4419
+ function FromTemplateLiteralKey(K, T, options) {
4420
+ return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
4421
+ }
4422
+ function FromUnionKey(key, type, options) {
4423
+ return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
4424
+ }
4425
+ function FromLiteralKey(key, type, options) {
4426
+ return RecordCreateFromKeys([key.toString()], type, options);
4427
+ }
4428
+ function FromRegExpKey(key, type, options) {
4429
+ return RecordCreateFromPattern(key.source, type, options);
4430
+ }
4431
+ function FromStringKey(key, type, options) {
4432
+ const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
4433
+ return RecordCreateFromPattern(pattern, type, options);
4434
+ }
4435
+ function FromAnyKey(_, type, options) {
4436
+ return RecordCreateFromPattern(PatternStringExact, type, options);
4437
+ }
4438
+ function FromNeverKey(_key, type, options) {
4439
+ return RecordCreateFromPattern(PatternNeverExact, type, options);
4440
+ }
4441
+ function FromBooleanKey(_key, type, options) {
4442
+ return Object2({ true: type, false: type }, options);
4443
+ }
4444
+ function FromIntegerKey(_key, type, options) {
4445
+ return RecordCreateFromPattern(PatternNumberExact, type, options);
4446
+ }
4447
+ function FromNumberKey(_, type, options) {
4448
+ return RecordCreateFromPattern(PatternNumberExact, type, options);
4449
+ }
4450
+ function Record(key, type, options = {}) {
4451
+ return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean2(key) ? FromBooleanKey(key, type, options) : IsInteger(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString2(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
4452
+ }
4453
+ function RecordPattern(record) {
4454
+ return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
4455
+ }
4456
+ function RecordKey2(type) {
4457
+ const pattern = RecordPattern(type);
4458
+ return pattern === PatternStringExact ? String2() : pattern === PatternNumberExact ? Number2() : String2({ pattern });
4459
+ }
4460
+ function RecordValue2(type) {
4461
+ return type.patternProperties[RecordPattern(type)];
4462
+ }
4463
+
4464
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs
4465
+ function FromConstructor2(args, type) {
4466
+ type.parameters = FromTypes(args, type.parameters);
4467
+ type.returns = FromType(args, type.returns);
4468
+ return type;
4469
+ }
4470
+ function FromFunction2(args, type) {
4471
+ type.parameters = FromTypes(args, type.parameters);
4472
+ type.returns = FromType(args, type.returns);
4473
+ return type;
4474
+ }
4475
+ function FromIntersect5(args, type) {
4476
+ type.allOf = FromTypes(args, type.allOf);
4477
+ return type;
4478
+ }
4479
+ function FromUnion7(args, type) {
4480
+ type.anyOf = FromTypes(args, type.anyOf);
4481
+ return type;
4482
+ }
4483
+ function FromTuple4(args, type) {
4484
+ if (IsUndefined(type.items))
4485
+ return type;
4486
+ type.items = FromTypes(args, type.items);
4487
+ return type;
4488
+ }
4489
+ function FromArray5(args, type) {
4490
+ type.items = FromType(args, type.items);
4491
+ return type;
4492
+ }
4493
+ function FromAsyncIterator2(args, type) {
4494
+ type.items = FromType(args, type.items);
4495
+ return type;
4496
+ }
4497
+ function FromIterator2(args, type) {
4498
+ type.items = FromType(args, type.items);
4499
+ return type;
4500
+ }
4501
+ function FromPromise3(args, type) {
4502
+ type.item = FromType(args, type.item);
4503
+ return type;
4504
+ }
4505
+ function FromObject2(args, type) {
4506
+ const mappedProperties = FromProperties11(args, type.properties);
4507
+ return { ...type, ...Object2(mappedProperties) };
4508
+ }
4509
+ function FromRecord2(args, type) {
4510
+ const mappedKey = FromType(args, RecordKey2(type));
4511
+ const mappedValue = FromType(args, RecordValue2(type));
4512
+ const result = Record(mappedKey, mappedValue);
4513
+ return { ...type, ...result };
4514
+ }
4515
+ function FromArgument(args, argument) {
4516
+ return argument.index in args ? args[argument.index] : Unknown();
4517
+ }
4518
+ function FromProperty2(args, type) {
4519
+ const isReadonly = IsReadonly(type);
4520
+ const isOptional = IsOptional(type);
4521
+ const mapped = FromType(args, type);
4522
+ return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
4523
+ }
4524
+ function FromProperties11(args, properties) {
4525
+ return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
4526
+ return { ...result, [key]: FromProperty2(args, properties[key]) };
4527
+ }, {});
4528
+ }
4529
+ function FromTypes(args, types) {
4530
+ return types.map((type) => FromType(args, type));
4531
+ }
4532
+ function FromType(args, type) {
4533
+ return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction2(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator2(type) ? FromAsyncIterator2(args, type) : IsIterator2(type) ? FromIterator2(args, type) : IsPromise(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
4534
+ }
4535
+ function Instantiate(type, args) {
4536
+ return FromType(args, CloneType(type));
4537
+ }
4538
+
4539
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
4540
+ function Integer(options) {
4541
+ return CreateType({ [Kind]: "Integer", type: "integer" }, options);
4542
+ }
4543
+
4544
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
4545
+ function MappedIntrinsicPropertyKey(K, M, options) {
4546
+ return {
4547
+ [K]: Intrinsic(Literal(K), M, Clone(options))
4548
+ };
4549
+ }
4550
+ function MappedIntrinsicPropertyKeys(K, M, options) {
4551
+ const result = K.reduce((Acc, L) => {
4552
+ return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
4553
+ }, {});
4554
+ return result;
4555
+ }
4556
+ function MappedIntrinsicProperties(T, M, options) {
4557
+ return MappedIntrinsicPropertyKeys(T["keys"], M, options);
4558
+ }
4559
+ function IntrinsicFromMappedKey(T, M, options) {
4560
+ const P = MappedIntrinsicProperties(T, M, options);
4561
+ return MappedResult(P);
4562
+ }
4563
+
4564
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
4565
+ function ApplyUncapitalize(value) {
4566
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4567
+ return [first.toLowerCase(), rest].join("");
4568
+ }
4569
+ function ApplyCapitalize(value) {
4570
+ const [first, rest] = [value.slice(0, 1), value.slice(1)];
4571
+ return [first.toUpperCase(), rest].join("");
4572
+ }
4573
+ function ApplyUppercase(value) {
4574
+ return value.toUpperCase();
4575
+ }
4576
+ function ApplyLowercase(value) {
4577
+ return value.toLowerCase();
4578
+ }
4579
+ function FromTemplateLiteral3(schema, mode, options) {
4580
+ const expression = TemplateLiteralParseExact(schema.pattern);
4581
+ const finite = IsTemplateLiteralExpressionFinite(expression);
4582
+ if (!finite)
4583
+ return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
4584
+ const strings = [...TemplateLiteralExpressionGenerate(expression)];
4585
+ const literals = strings.map((value) => Literal(value));
4586
+ const mapped = FromRest5(literals, mode);
4587
+ const union = Union(mapped);
4588
+ return TemplateLiteral([union], options);
4589
+ }
4590
+ function FromLiteralValue(value, mode) {
4591
+ return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
4592
+ }
4593
+ function FromRest5(T, M) {
4594
+ return T.map((L) => Intrinsic(L, M));
4595
+ }
4596
+ function Intrinsic(schema, mode, options = {}) {
4597
+ return (
4598
+ // Intrinsic-Mapped-Inference
4599
+ IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
4600
+ // Standard-Inference
4601
+ IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : (
4602
+ // Default Type
4603
+ CreateType(schema, options)
4604
+ )
4605
+ )
4606
+ );
4607
+ }
4608
+
4609
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
4610
+ function Capitalize(T, options = {}) {
4611
+ return Intrinsic(T, "Capitalize", options);
4612
+ }
4613
+
4614
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
4615
+ function Lowercase(T, options = {}) {
4616
+ return Intrinsic(T, "Lowercase", options);
4617
+ }
4618
+
4619
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
4620
+ function Uncapitalize(T, options = {}) {
4621
+ return Intrinsic(T, "Uncapitalize", options);
4622
+ }
4623
+
4624
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
4625
+ function Uppercase(T, options = {}) {
4626
+ return Intrinsic(T, "Uppercase", options);
4627
+ }
4628
+
4629
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
4630
+ function FromProperties12(properties, propertyKeys, options) {
4631
+ const result = {};
4632
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
4633
+ result[K2] = Omit(properties[K2], propertyKeys, Clone(options));
4634
+ return result;
4635
+ }
4636
+ function FromMappedResult9(mappedResult, propertyKeys, options) {
4637
+ return FromProperties12(mappedResult.properties, propertyKeys, options);
4638
+ }
4639
+ function OmitFromMappedResult(mappedResult, propertyKeys, options) {
4640
+ const properties = FromMappedResult9(mappedResult, propertyKeys, options);
4641
+ return MappedResult(properties);
4642
+ }
4643
+
4644
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
4645
+ function FromIntersect6(types, propertyKeys) {
4646
+ return types.map((type) => OmitResolve(type, propertyKeys));
4647
+ }
4648
+ function FromUnion8(types, propertyKeys) {
4649
+ return types.map((type) => OmitResolve(type, propertyKeys));
4650
+ }
4651
+ function FromProperty3(properties, key) {
4652
+ const { [key]: _, ...R } = properties;
4653
+ return R;
4654
+ }
4655
+ function FromProperties13(properties, propertyKeys) {
4656
+ return propertyKeys.reduce((T, K2) => FromProperty3(T, K2), properties);
4657
+ }
4658
+ function FromObject3(type, propertyKeys, properties) {
4659
+ const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4660
+ const mappedProperties = FromProperties13(properties, propertyKeys);
4661
+ return Object2(mappedProperties, options);
4662
+ }
4663
+ function UnionFromPropertyKeys(propertyKeys) {
4664
+ const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
4665
+ return Union(result);
4666
+ }
4667
+ function OmitResolve(type, propertyKeys) {
4668
+ return IsIntersect(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
4669
+ }
4670
+ function Omit(type, key, options) {
4671
+ const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
4672
+ const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
4673
+ const isTypeRef = IsRef(type);
4674
+ const isKeyRef = IsRef(key);
4675
+ return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
4676
+ }
4677
+
4678
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
4679
+ function FromPropertyKey2(type, key, options) {
4680
+ return { [key]: Omit(type, [key], Clone(options)) };
4681
+ }
4682
+ function FromPropertyKeys2(type, propertyKeys, options) {
4683
+ return propertyKeys.reduce((Acc, LK) => {
4684
+ return { ...Acc, ...FromPropertyKey2(type, LK, options) };
4685
+ }, {});
4686
+ }
4687
+ function FromMappedKey3(type, mappedKey, options) {
4688
+ return FromPropertyKeys2(type, mappedKey.keys, options);
4689
+ }
4690
+ function OmitFromMappedKey(type, mappedKey, options) {
4691
+ const properties = FromMappedKey3(type, mappedKey, options);
4692
+ return MappedResult(properties);
4693
+ }
4694
+
4695
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
4696
+ function FromProperties14(properties, propertyKeys, options) {
4697
+ const result = {};
4698
+ for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
4699
+ result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
4700
+ return result;
4701
+ }
4702
+ function FromMappedResult10(mappedResult, propertyKeys, options) {
4703
+ return FromProperties14(mappedResult.properties, propertyKeys, options);
4704
+ }
4705
+ function PickFromMappedResult(mappedResult, propertyKeys, options) {
4706
+ const properties = FromMappedResult10(mappedResult, propertyKeys, options);
4707
+ return MappedResult(properties);
4708
+ }
4709
+
4710
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
4711
+ function FromIntersect7(types, propertyKeys) {
4712
+ return types.map((type) => PickResolve(type, propertyKeys));
4713
+ }
4714
+ function FromUnion9(types, propertyKeys) {
4715
+ return types.map((type) => PickResolve(type, propertyKeys));
4716
+ }
4717
+ function FromProperties15(properties, propertyKeys) {
4718
+ const result = {};
4719
+ for (const K2 of propertyKeys)
4720
+ if (K2 in properties)
4721
+ result[K2] = properties[K2];
4722
+ return result;
4723
+ }
4724
+ function FromObject4(Type2, keys, properties) {
4725
+ const options = Discard(Type2, [TransformKind, "$id", "required", "properties"]);
4726
+ const mappedProperties = FromProperties15(properties, keys);
4727
+ return Object2(mappedProperties, options);
4728
+ }
4729
+ function UnionFromPropertyKeys2(propertyKeys) {
4730
+ const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
4731
+ return Union(result);
4732
+ }
4733
+ function PickResolve(type, propertyKeys) {
4734
+ return IsIntersect(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
4735
+ }
4736
+ function Pick(type, key, options) {
4737
+ const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
4738
+ const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
4739
+ const isTypeRef = IsRef(type);
4740
+ const isKeyRef = IsRef(key);
4741
+ return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
4742
+ }
4743
+
4744
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
4745
+ function FromPropertyKey3(type, key, options) {
4746
+ return {
4747
+ [key]: Pick(type, [key], Clone(options))
4748
+ };
4749
+ }
4750
+ function FromPropertyKeys3(type, propertyKeys, options) {
4751
+ return propertyKeys.reduce((result, leftKey) => {
4752
+ return { ...result, ...FromPropertyKey3(type, leftKey, options) };
4753
+ }, {});
4754
+ }
4755
+ function FromMappedKey4(type, mappedKey, options) {
4756
+ return FromPropertyKeys3(type, mappedKey.keys, options);
4757
+ }
4758
+ function PickFromMappedKey(type, mappedKey, options) {
4759
+ const properties = FromMappedKey4(type, mappedKey, options);
4760
+ return MappedResult(properties);
4761
+ }
4762
+
4763
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
4764
+ function FromComputed3(target, parameters) {
4765
+ return Computed("Partial", [Computed(target, parameters)]);
4766
+ }
4767
+ function FromRef3($ref) {
4768
+ return Computed("Partial", [Ref($ref)]);
4769
+ }
4770
+ function FromProperties16(properties) {
4771
+ const partialProperties = {};
4772
+ for (const K of globalThis.Object.getOwnPropertyNames(properties))
4773
+ partialProperties[K] = Optional(properties[K]);
4774
+ return partialProperties;
4775
+ }
4776
+ function FromObject5(type, properties) {
4777
+ const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4778
+ const mappedProperties = FromProperties16(properties);
4779
+ return Object2(mappedProperties, options);
4780
+ }
4781
+ function FromRest6(types) {
4782
+ return types.map((type) => PartialResolve(type));
4783
+ }
4784
+ function PartialResolve(type) {
4785
+ return (
4786
+ // Mappable
4787
+ IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : (
4788
+ // Intrinsic
4789
+ IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
4790
+ // Passthrough
4791
+ Object2({})
4792
+ )
4793
+ )
4794
+ );
4795
+ }
4796
+ function Partial(type, options) {
4797
+ if (IsMappedResult(type)) {
4798
+ return PartialFromMappedResult(type, options);
4799
+ } else {
4800
+ return CreateType({ ...PartialResolve(type), ...options });
4801
+ }
4802
+ }
4803
+
4804
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
4805
+ function FromProperties17(K, options) {
4806
+ const Acc = {};
4807
+ for (const K2 of globalThis.Object.getOwnPropertyNames(K))
4808
+ Acc[K2] = Partial(K[K2], Clone(options));
4809
+ return Acc;
4810
+ }
4811
+ function FromMappedResult11(R, options) {
4812
+ return FromProperties17(R.properties, options);
4813
+ }
4814
+ function PartialFromMappedResult(R, options) {
4815
+ const P = FromMappedResult11(R, options);
4816
+ return MappedResult(P);
4817
+ }
4818
+
4819
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
4820
+ function FromComputed4(target, parameters) {
4821
+ return Computed("Required", [Computed(target, parameters)]);
4822
+ }
4823
+ function FromRef4($ref) {
4824
+ return Computed("Required", [Ref($ref)]);
4825
+ }
4826
+ function FromProperties18(properties) {
4827
+ const requiredProperties = {};
4828
+ for (const K of globalThis.Object.getOwnPropertyNames(properties))
4829
+ requiredProperties[K] = Discard(properties[K], [OptionalKind]);
4830
+ return requiredProperties;
4831
+ }
4832
+ function FromObject6(type, properties) {
4833
+ const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
4834
+ const mappedProperties = FromProperties18(properties);
4835
+ return Object2(mappedProperties, options);
4836
+ }
4837
+ function FromRest7(types) {
4838
+ return types.map((type) => RequiredResolve(type));
4839
+ }
4840
+ function RequiredResolve(type) {
4841
+ return (
4842
+ // Mappable
4843
+ IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : (
4844
+ // Intrinsic
4845
+ IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
4846
+ // Passthrough
4847
+ Object2({})
4848
+ )
4849
+ )
4850
+ );
4851
+ }
4852
+ function Required(type, options) {
4853
+ if (IsMappedResult(type)) {
4854
+ return RequiredFromMappedResult(type, options);
4855
+ } else {
4856
+ return CreateType({ ...RequiredResolve(type), ...options });
4857
+ }
4858
+ }
4859
+
4860
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
4861
+ function FromProperties19(P, options) {
4862
+ const Acc = {};
4863
+ for (const K2 of globalThis.Object.getOwnPropertyNames(P))
4864
+ Acc[K2] = Required(P[K2], options);
4865
+ return Acc;
4866
+ }
4867
+ function FromMappedResult12(R, options) {
4868
+ return FromProperties19(R.properties, options);
4869
+ }
4870
+ function RequiredFromMappedResult(R, options) {
4871
+ const P = FromMappedResult12(R, options);
4872
+ return MappedResult(P);
4873
+ }
4874
+
4875
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
4876
+ function DereferenceParameters(moduleProperties, types) {
4877
+ return types.map((type) => {
4878
+ return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
4879
+ });
4880
+ }
4881
+ function Dereference(moduleProperties, ref) {
4882
+ return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
4883
+ }
4884
+ function FromAwaited(parameters) {
4885
+ return Awaited(parameters[0]);
4886
+ }
4887
+ function FromIndex(parameters) {
4888
+ return Index(parameters[0], parameters[1]);
4889
+ }
4890
+ function FromKeyOf(parameters) {
4891
+ return KeyOf(parameters[0]);
4892
+ }
4893
+ function FromPartial(parameters) {
4894
+ return Partial(parameters[0]);
4895
+ }
4896
+ function FromOmit(parameters) {
4897
+ return Omit(parameters[0], parameters[1]);
4898
+ }
4899
+ function FromPick(parameters) {
4900
+ return Pick(parameters[0], parameters[1]);
4901
+ }
4902
+ function FromRequired(parameters) {
4903
+ return Required(parameters[0]);
4904
+ }
4905
+ function FromComputed5(moduleProperties, target, parameters) {
4906
+ const dereferenced = DereferenceParameters(moduleProperties, parameters);
4907
+ return target === "Awaited" ? FromAwaited(dereferenced) : target === "Index" ? FromIndex(dereferenced) : target === "KeyOf" ? FromKeyOf(dereferenced) : target === "Partial" ? FromPartial(dereferenced) : target === "Omit" ? FromOmit(dereferenced) : target === "Pick" ? FromPick(dereferenced) : target === "Required" ? FromRequired(dereferenced) : Never();
4908
+ }
4909
+ function FromArray6(moduleProperties, type) {
4910
+ return Array2(FromType2(moduleProperties, type));
4911
+ }
4912
+ function FromAsyncIterator3(moduleProperties, type) {
4913
+ return AsyncIterator(FromType2(moduleProperties, type));
4914
+ }
4915
+ function FromConstructor3(moduleProperties, parameters, instanceType) {
4916
+ return Constructor(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, instanceType));
4917
+ }
4918
+ function FromFunction3(moduleProperties, parameters, returnType) {
4919
+ return Function(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, returnType));
4920
+ }
4921
+ function FromIntersect8(moduleProperties, types) {
4922
+ return Intersect(FromTypes2(moduleProperties, types));
4923
+ }
4924
+ function FromIterator3(moduleProperties, type) {
4925
+ return Iterator(FromType2(moduleProperties, type));
4926
+ }
4927
+ function FromObject7(moduleProperties, properties) {
4928
+ return Object2(globalThis.Object.keys(properties).reduce((result, key) => {
4929
+ return { ...result, [key]: FromType2(moduleProperties, properties[key]) };
4930
+ }, {}));
4931
+ }
4932
+ function FromRecord3(moduleProperties, type) {
4933
+ const [value, pattern] = [FromType2(moduleProperties, RecordValue2(type)), RecordPattern(type)];
4934
+ const result = CloneType(type);
4935
+ result.patternProperties[pattern] = value;
4936
+ return result;
4937
+ }
4938
+ function FromTransform(moduleProperties, transform) {
4939
+ return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
4940
+ }
4941
+ function FromTuple5(moduleProperties, types) {
4942
+ return Tuple(FromTypes2(moduleProperties, types));
4943
+ }
4944
+ function FromUnion10(moduleProperties, types) {
4945
+ return Union(FromTypes2(moduleProperties, types));
4946
+ }
4947
+ function FromTypes2(moduleProperties, types) {
4948
+ return types.map((type) => FromType2(moduleProperties, type));
4949
+ }
4950
+ function FromType2(moduleProperties, type) {
4951
+ return (
4952
+ // Modifiers
4953
+ IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : (
4954
+ // Transform
4955
+ IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
4956
+ // Types
4957
+ IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator2(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction2(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator2(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
4958
+ )
4959
+ )
4960
+ );
4961
+ }
4962
+ function ComputeType(moduleProperties, key) {
4963
+ return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
4964
+ }
4965
+ function ComputeModuleProperties(moduleProperties) {
4966
+ return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => {
4967
+ return { ...result, [key]: ComputeType(moduleProperties, key) };
4968
+ }, {});
4969
+ }
4970
+
4971
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/module/module.mjs
4972
+ var TModule = class {
4973
+ constructor($defs) {
4974
+ const computed = ComputeModuleProperties($defs);
4975
+ const identified = this.WithIdentifiers(computed);
4976
+ this.$defs = identified;
4977
+ }
4978
+ /** `[Json]` Imports a Type by Key. */
4979
+ Import(key, options) {
4980
+ const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) };
4981
+ return CreateType({ [Kind]: "Import", $defs, $ref: key });
4982
+ }
4983
+ // prettier-ignore
4984
+ WithIdentifiers($defs) {
4985
+ return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => {
4986
+ return { ...result, [key]: { ...$defs[key], $id: key } };
4987
+ }, {});
4988
+ }
4989
+ };
4990
+ function Module(properties) {
4991
+ return new TModule(properties);
4992
+ }
4993
+
4994
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
4995
+ function Not(type, options) {
4996
+ return CreateType({ [Kind]: "Not", not: type }, options);
4997
+ }
4998
+
4999
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
5000
+ function Parameters(schema, options) {
5001
+ return IsFunction2(schema) ? Tuple(schema.parameters, options) : Never();
5002
+ }
5003
+
5004
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
5005
+ var Ordinal = 0;
5006
+ function Recursive(callback, options = {}) {
5007
+ if (IsUndefined(options.$id))
5008
+ options.$id = `T${Ordinal++}`;
5009
+ const thisType = CloneType(callback({ [Kind]: "This", $ref: `${options.$id}` }));
5010
+ thisType.$id = options.$id;
5011
+ return CreateType({ [Hint]: "Recursive", ...thisType }, options);
5012
+ }
5013
+
5014
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
5015
+ function RegExp2(unresolved, options) {
5016
+ const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
5017
+ return CreateType({ [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags }, options);
5018
+ }
5019
+
5020
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
5021
+ function RestResolve(T) {
5022
+ return IsIntersect(T) ? T.allOf : IsUnion(T) ? T.anyOf : IsTuple(T) ? T.items ?? [] : [];
5023
+ }
5024
+ function Rest(T) {
5025
+ return RestResolve(T);
5026
+ }
5027
+
5028
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
5029
+ function ReturnType(schema, options) {
5030
+ return IsFunction2(schema) ? CreateType(schema.returns, options) : Never(options);
5031
+ }
5032
+
5033
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
5034
+ var TransformDecodeBuilder = class {
5035
+ constructor(schema) {
5036
+ this.schema = schema;
5037
+ }
5038
+ Decode(decode) {
5039
+ return new TransformEncodeBuilder(this.schema, decode);
5040
+ }
5041
+ };
5042
+ var TransformEncodeBuilder = class {
5043
+ constructor(schema, decode) {
5044
+ this.schema = schema;
5045
+ this.decode = decode;
5046
+ }
5047
+ EncodeTransform(encode, schema) {
5048
+ const Encode = (value) => schema[TransformKind].Encode(encode(value));
5049
+ const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
5050
+ const Codec = { Encode, Decode };
5051
+ return { ...schema, [TransformKind]: Codec };
5052
+ }
5053
+ EncodeSchema(encode, schema) {
5054
+ const Codec = { Decode: this.decode, Encode: encode };
5055
+ return { ...schema, [TransformKind]: Codec };
5056
+ }
5057
+ Encode(encode) {
5058
+ return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
5059
+ }
5060
+ };
5061
+ function Transform(schema) {
5062
+ return new TransformDecodeBuilder(schema);
5063
+ }
5064
+
5065
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
5066
+ function Unsafe(options = {}) {
5067
+ return CreateType({ [Kind]: options[Kind] ?? "Unsafe" }, options);
5068
+ }
5069
+
5070
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
5071
+ function Void(options) {
5072
+ return CreateType({ [Kind]: "Void", type: "void" }, options);
5073
+ }
5074
+
5075
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
5076
+ var type_exports2 = {};
5077
+ __export(type_exports2, {
5078
+ Any: () => Any,
5079
+ Argument: () => Argument,
5080
+ Array: () => Array2,
5081
+ AsyncIterator: () => AsyncIterator,
5082
+ Awaited: () => Awaited,
5083
+ BigInt: () => BigInt,
5084
+ Boolean: () => Boolean2,
5085
+ Capitalize: () => Capitalize,
5086
+ Composite: () => Composite,
5087
+ Const: () => Const,
5088
+ Constructor: () => Constructor,
5089
+ ConstructorParameters: () => ConstructorParameters,
5090
+ Date: () => Date2,
5091
+ Enum: () => Enum,
5092
+ Exclude: () => Exclude,
5093
+ Extends: () => Extends,
5094
+ Extract: () => Extract,
5095
+ Function: () => Function,
5096
+ Index: () => Index,
5097
+ InstanceType: () => InstanceType,
5098
+ Instantiate: () => Instantiate,
5099
+ Integer: () => Integer,
5100
+ Intersect: () => Intersect,
5101
+ Iterator: () => Iterator,
5102
+ KeyOf: () => KeyOf,
5103
+ Literal: () => Literal,
5104
+ Lowercase: () => Lowercase,
5105
+ Mapped: () => Mapped,
5106
+ Module: () => Module,
5107
+ Never: () => Never,
5108
+ Not: () => Not,
5109
+ Null: () => Null,
5110
+ Number: () => Number2,
5111
+ Object: () => Object2,
5112
+ Omit: () => Omit,
5113
+ Optional: () => Optional,
5114
+ Parameters: () => Parameters,
5115
+ Partial: () => Partial,
5116
+ Pick: () => Pick,
5117
+ Promise: () => Promise2,
5118
+ Readonly: () => Readonly,
5119
+ ReadonlyOptional: () => ReadonlyOptional,
5120
+ Record: () => Record,
5121
+ Recursive: () => Recursive,
5122
+ Ref: () => Ref,
5123
+ RegExp: () => RegExp2,
5124
+ Required: () => Required,
5125
+ Rest: () => Rest,
5126
+ ReturnType: () => ReturnType,
5127
+ String: () => String2,
5128
+ Symbol: () => Symbol2,
5129
+ TemplateLiteral: () => TemplateLiteral,
5130
+ Transform: () => Transform,
5131
+ Tuple: () => Tuple,
5132
+ Uint8Array: () => Uint8Array2,
5133
+ Uncapitalize: () => Uncapitalize,
5134
+ Undefined: () => Undefined,
5135
+ Union: () => Union,
5136
+ Unknown: () => Unknown,
5137
+ Unsafe: () => Unsafe,
5138
+ Uppercase: () => Uppercase,
5139
+ Void: () => Void
5140
+ });
5141
+
5142
+ // ../../node_modules/.pnpm/@sinclair+typebox@0.34.48/node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
5143
+ var Type = type_exports2;
5144
+
5145
+ // ../../packages/runner-pi/dist/tool-refs.js
5146
+ var LOG_PREFIX2 = "[bunny-agent:pi-tool-ref]";
5147
+ function buildToolDefinitionsFromRefs(tools) {
5148
+ return tools.map((spec) => buildOne(spec));
5149
+ }
5150
+ function buildOne(spec) {
5151
+ const parameters = Type.Unsafe(spec.inputSchema);
5152
+ return {
5153
+ name: spec.name,
5154
+ label: spec.name,
5155
+ description: spec.description,
5156
+ parameters,
5157
+ async execute(_toolCallId, params, signal) {
5158
+ let response;
5159
+ try {
5160
+ response = await executeToolRef(spec, params, signal);
5161
+ } catch (error) {
5162
+ const message = error instanceof Error ? error.message : String(error);
5163
+ return transportErrorResult(spec.name, message);
5164
+ }
5165
+ if (response.status < 200 || response.status >= 300) {
5166
+ return statusErrorResult(spec.name, response.status, response.body);
5167
+ }
5168
+ return okResult(response.body);
5169
+ }
5170
+ };
5171
+ }
5172
+ async function executeToolRef(spec, params, signal) {
5173
+ switch (spec.runtime.type) {
5174
+ case "http":
5175
+ return sendDirectHttpRequest(spec.runtime, params, signal);
5176
+ case "module":
5177
+ return executeModuleTool(spec.runtime, params, signal);
5178
+ }
5179
+ }
5180
+ async function sendDirectHttpRequest(runtime, params, signal) {
5181
+ const response = await fetch(runtime.url, {
5182
+ method: "POST",
5183
+ signal,
5184
+ headers: {
5185
+ "Content-Type": "application/json",
5186
+ ...runtime.headers ?? {}
5187
+ },
5188
+ body: JSON.stringify(params)
5189
+ });
5190
+ const body = await response.text();
5191
+ return { status: response.status, body };
5192
+ }
5193
+ async function executeModuleTool(runtime, params, signal) {
5194
+ const mod = await import(runtime.module);
5195
+ const exportName = runtime.exportName ?? "execute";
5196
+ const fn = mod[exportName];
5197
+ if (typeof fn !== "function") {
5198
+ return {
5199
+ status: 500,
5200
+ body: `module tool export "${exportName}" is not a function`
5201
+ };
5202
+ }
5203
+ const result = await fn(params, { signal });
5204
+ return { status: 200, body: serializeResult(result) };
5205
+ }
5206
+ function okResult(text) {
5207
+ return {
5208
+ content: [{ type: "text", text }],
5209
+ details: void 0
5210
+ };
5211
+ }
5212
+ function statusErrorResult(toolName, status, body) {
5213
+ return {
5214
+ content: [
5215
+ {
5216
+ type: "text",
5217
+ text: `${LOG_PREFIX2} tool "${toolName}" failed (status ${status}): ${body}`
5218
+ }
5219
+ ],
5220
+ details: void 0
5221
+ };
5222
+ }
5223
+ function transportErrorResult(toolName, message) {
5224
+ return {
5225
+ content: [
5226
+ {
5227
+ type: "text",
5228
+ text: `${LOG_PREFIX2} tool "${toolName}" transport error: ${message}`
5229
+ }
5230
+ ],
5231
+ details: void 0
5232
+ };
5233
+ }
5234
+ function serializeResult(result) {
5235
+ if (typeof result === "string")
5236
+ return result;
5237
+ return JSON.stringify(result);
5238
+ }
5239
+
5240
+ // ../../packages/runner-pi/dist/pi-runner.js
5241
+ var LOG_PREFIX3 = "[bunny-agent:pi]";
5242
+ function parseModelSpec(model) {
5243
+ const trimmed = model.trim();
5244
+ const separator = trimmed.indexOf(":");
5245
+ if (separator <= 0 || separator === trimmed.length - 1) {
5246
+ throw new Error(`Invalid pi model "${model}". Expected format "<provider>:<model>", for example "google:gemini-2.5-pro".`);
5247
+ }
5248
+ return {
5249
+ provider: trimmed.slice(0, separator),
5250
+ modelName: trimmed.slice(separator + 1)
5251
+ };
5252
+ }
5253
+ function resolveImageModelName(chatProvider, env) {
5254
+ const spec = env?.IMAGE_GENERATION_MODEL;
5255
+ if (!spec)
5256
+ return void 0;
5257
+ try {
5258
+ const { provider, modelName } = parseModelSpec(spec);
5259
+ return provider === chatProvider ? modelName : void 0;
5260
+ } catch {
5261
+ return void 0;
5262
+ }
5263
+ }
5264
+ function getEnvValue(optionsEnv, name) {
5265
+ return optionsEnv?.[name] ?? process.env[name];
5266
+ }
5267
+ function applyModelOverrides(model, provider, optionsEnv) {
5268
+ if (model == null)
5269
+ return;
5270
+ const openAiBaseUrl = getEnvValue(optionsEnv, "OPENAI_BASE_URL");
5271
+ const geminiBaseUrl = getEnvValue(optionsEnv, "GEMINI_BASE_URL");
5272
+ const anthropicBaseUrl = getEnvValue(optionsEnv, "ANTHROPIC_BASE_URL");
5273
+ if (provider === "openai" && openAiBaseUrl) {
5274
+ model.baseUrl = openAiBaseUrl;
5275
+ } else if (provider === "google" && geminiBaseUrl) {
5276
+ model.baseUrl = geminiBaseUrl;
5277
+ } else if (provider === "anthropic" && anthropicBaseUrl) {
5278
+ model.baseUrl = anthropicBaseUrl;
5279
+ }
5280
+ }
5281
+ function getErrorFromAgentEndMessages(messages) {
5282
+ for (let i = messages.length - 1; i >= 0; i--) {
5283
+ const m = messages[i];
5284
+ if (m.role === "assistant" && m.errorMessage) {
5285
+ return m.errorMessage;
5286
+ }
5287
+ }
5288
+ return void 0;
5289
+ }
5290
+ function traceRawMessage(debugCwd, data, reset = false, optionsEnv) {
5291
+ const debugVal = getEnvValue(optionsEnv, "DEBUG");
5292
+ const enabled = debugVal === "true" || debugVal === "1";
5293
+ if (!enabled)
5294
+ return;
5295
+ try {
5296
+ const file = join8(debugCwd, "pi-message-stream-debug.json");
5297
+ if (reset && existsSync5(file))
5298
+ unlinkSync3(file);
5299
+ const type = data !== null && typeof data === "object" ? data.type : void 0;
5300
+ let payload = data;
5301
+ try {
5302
+ payload = data !== void 0 ? JSON.parse(JSON.stringify(data)) : void 0;
5303
+ } catch {
5304
+ payload = "[non-serializable]";
5305
+ }
5306
+ const entry = { _t: (/* @__PURE__ */ new Date()).toISOString(), type, payload };
5307
+ appendFileSync2(file, JSON.stringify(entry, null, 2) + ",\n");
5308
+ } catch {
5309
+ }
5310
+ }
5311
+ function createPiRunner(options = {}) {
5312
+ const modelSpec = options.model;
5313
+ if (modelSpec == null || modelSpec.trim() === "") {
5314
+ throw new Error("Pi runner: model is required. Pass a model in the form <provider>:<model>, e.g. openai:gpt-4o or google:gemini-2.5-flash.");
5315
+ }
5316
+ const { provider, modelName } = parseModelSpec(modelSpec.trim());
5317
+ const cwd = options.cwd || process.cwd();
5318
+ const apiKeyEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_API_KEY`;
5319
+ const inlineApiKey = typeof options.env?.[apiKeyEnvKey] === "string" && options.env[apiKeyEnvKey].length > 0 ? options.env[apiKeyEnvKey] : void 0;
5320
+ const modelRegistry = ModelRegistry.inMemory(AuthStorage.create());
5321
+ const defaultModel = getModel(provider, modelName);
5322
+ let model = defaultModel ?? modelRegistry.find(provider, modelName);
5323
+ if (model == null) {
5324
+ const baseUrlEnvKey = `${provider.toUpperCase().replace(/-/g, "_")}_BASE_URL`;
5325
+ const baseUrl = getEnvValue(options.env, baseUrlEnvKey) ?? getEnvValue(options.env, "OPENAI_BASE_URL");
5326
+ if (!baseUrl) {
5327
+ throw new Error(`Pi runner: model "${modelSpec}" not found in built-in catalog. Set ${baseUrlEnvKey} (or OPENAI_BASE_URL) to auto-register it.`);
5328
+ }
5329
+ modelRegistry.registerProvider(provider, {
5330
+ baseUrl,
5331
+ apiKey: inlineApiKey ?? apiKeyEnvKey,
5332
+ api: "openai-completions",
5333
+ models: [
5334
+ {
5335
+ id: modelName,
5336
+ name: modelName,
5337
+ reasoning: false,
5338
+ input: ["text", "image"],
5339
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
5340
+ contextWindow: 128e3,
5341
+ maxTokens: 8192
5342
+ }
5343
+ ]
5344
+ });
5345
+ const registered = modelRegistry.find(provider, modelName);
5346
+ if (!registered) {
5347
+ throw new Error(`Pi runner: failed to resolve model "${modelSpec}" after registration.`);
5348
+ }
5349
+ model = registered;
5350
+ }
5351
+ applyModelOverrides(model, provider, options.env);
5352
+ const imageModelName = resolveImageModelName(provider, options.env);
5353
+ return {
5354
+ async *run(userInput) {
5355
+ if (inlineApiKey !== void 0) {
5356
+ modelRegistry.authStorage.setRuntimeApiKey(provider, inlineApiKey);
5357
+ }
5358
+ try {
5359
+ const resume = options.sessionId?.trim();
5360
+ const sessionManager = await (async () => {
5361
+ if (resume !== void 0 && resume !== "") {
5362
+ if (resume.includes("/")) {
5363
+ return SessionManager2.open(resume);
5364
+ }
5365
+ const sessionPath2 = resolveSessionPathById(cwd, resume);
5366
+ console.error(`${LOG_PREFIX3} resume: id=${resume} path=${sessionPath2 ?? "(not found)"}`);
5367
+ if (sessionPath2) {
5368
+ if (isSessionFileTooLarge(sessionPath2)) {
5369
+ const context = extractSessionContext(sessionPath2);
5370
+ console.error(`${LOG_PREFIX3} session file too large, starting fresh${context ? " (with context)" : ""}`);
5371
+ const newMgr = SessionManager2.create(cwd);
5372
+ if (context) {
5373
+ const firstId = newMgr.getEntries()[0]?.id ?? "";
5374
+ newMgr.appendCompaction(context, firstId, 0);
5375
+ }
5376
+ return newMgr;
5377
+ }
5378
+ return SessionManager2.open(sessionPath2);
5379
+ }
5380
+ return SessionManager2.create(cwd);
5381
+ }
5382
+ return SessionManager2.create(cwd);
5383
+ })();
5384
+ const resourceLoader = options.skillPaths ? new BunnyAgentResourceLoader({
5385
+ cwd,
5386
+ skillPaths: options.skillPaths,
5387
+ appendSystemPrompt: options.systemPrompt
5388
+ }) : void 0;
5389
+ if (options.skillPaths && options.skillPaths.length > 0) {
5390
+ console.error(`${LOG_PREFIX3} runner: cwd=${cwd} skillPaths=${JSON.stringify(options.skillPaths)}`);
5391
+ }
5392
+ if (resourceLoader) {
5393
+ await resourceLoader.reload();
5394
+ }
5395
+ const customTools = options.env && Object.keys(options.env).length > 0 ? buildSecretAwareTools(cwd, options.env) : [];
5396
+ if (imageModelName) {
5397
+ const apiKey = await modelRegistry.authStorage.getApiKey(provider) ?? "";
5398
+ customTools.push(buildImageGenerateTool(cwd, imageModelName, model.baseUrl, apiKey), buildImageEditTool(cwd, imageModelName, model.baseUrl, apiKey));
5399
+ }
5400
+ if (options.customTools && options.customTools.length > 0) {
5401
+ customTools.push(...options.customTools);
5402
+ }
5403
+ if (options.toolRefs && options.toolRefs.length > 0) {
5404
+ customTools.push(...buildToolDefinitionsFromRefs(options.toolRefs));
5405
+ }
5406
+ const { session } = await createAgentSession({
5407
+ cwd,
5408
+ model,
5409
+ sessionManager,
5410
+ modelRegistry,
5411
+ resourceLoader,
2677
5412
  customTools
2678
5413
  });
2679
5414
  const eventQueue = [];
@@ -2865,13 +5600,15 @@ function dispatchRunner(runner, base, cwd, options) {
2865
5600
  env: base.env,
2866
5601
  abortController: base.abortController
2867
5602
  }).run(options.userInput);
2868
- case "pi":
5603
+ case "pi": {
2869
5604
  return createPiRunner({
2870
5605
  ...base,
2871
5606
  cwd,
2872
5607
  sessionId: base.resume,
2873
- skillPaths: options.skillPaths ?? discoverSkillPaths(cwd)
5608
+ skillPaths: options.skillPaths ?? discoverSkillPaths(cwd),
5609
+ toolRefs: options.toolRefs
2874
5610
  }).run(options.userInput);
5611
+ }
2875
5612
  case "opencode":
2876
5613
  return createOpenCodeRunner({
2877
5614
  model: options.model,
@@ -2929,6 +5666,27 @@ async function runAgent(options) {
2929
5666
  config({ path: resolve3(process.cwd(), ".env") });
2930
5667
  config({ path: resolve3(process.cwd(), "../.env") });
2931
5668
  config({ path: resolve3(process.cwd(), "../../.env") });
5669
+ function takeToolRefsFromEnv() {
5670
+ const raw = process.env.BUNNY_AGENT_TOOL_REFS_JSON;
5671
+ if (!raw) return null;
5672
+ delete process.env.BUNNY_AGENT_TOOL_REFS_JSON;
5673
+ try {
5674
+ const parsed = JSON.parse(raw);
5675
+ if (!Array.isArray(parsed.tools)) {
5676
+ console.error(
5677
+ "[bunny-agent] BUNNY_AGENT_TOOL_REFS_JSON missing tools array; ignoring."
5678
+ );
5679
+ return null;
5680
+ }
5681
+ return parsed.tools;
5682
+ } catch (err) {
5683
+ const message = err instanceof Error ? err.message : String(err);
5684
+ console.error(
5685
+ `[bunny-agent] Failed to parse BUNNY_AGENT_TOOL_REFS_JSON: ${message}`
5686
+ );
5687
+ return null;
5688
+ }
5689
+ }
2932
5690
  function getSubcommand() {
2933
5691
  for (let i = 2; i < process.argv.length; i++) {
2934
5692
  const a = process.argv[i];
@@ -3141,6 +5899,7 @@ async function main() {
3141
5899
  case "run": {
3142
5900
  const args = parseRunArgs();
3143
5901
  process.chdir(args.cwd);
5902
+ const toolRefs = takeToolRefsFromEnv();
3144
5903
  await runAgent({
3145
5904
  runner: args.runner,
3146
5905
  model: args.model,
@@ -3150,7 +5909,8 @@ async function main() {
3150
5909
  allowedTools: args.allowedTools,
3151
5910
  skillPaths: args.skillPaths,
3152
5911
  resume: args.resume,
3153
- yolo: args.yolo
5912
+ yolo: args.yolo,
5913
+ ...toolRefs ? { toolRefs } : {}
3154
5914
  });
3155
5915
  break;
3156
5916
  }