retell-sync-cli 3.13.5 → 3.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +1392 -1006
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ function __accessProp(key) {
9
+ return this[key];
10
+ }
11
+ var __toESMCache_node;
12
+ var __toESMCache_esm;
8
13
  var __toESM = (mod, isNodeMode, target) => {
14
+ var canCache = mod != null && typeof mod === "object";
15
+ if (canCache) {
16
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
17
+ var cached = cache.get(mod);
18
+ if (cached)
19
+ return cached;
20
+ }
9
21
  target = mod != null ? __create(__getProtoOf(mod)) : {};
10
22
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
23
  for (let key of __getOwnPropNames(mod))
12
24
  if (!__hasOwnProp.call(to, key))
13
25
  __defProp(to, key, {
14
- get: () => mod[key],
26
+ get: __accessProp.bind(mod, key),
15
27
  enumerable: true
16
28
  });
29
+ if (canCache)
30
+ cache.set(mod, to);
17
31
  return to;
18
32
  };
19
33
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
+ var __returnValue = (v) => v;
35
+ function __exportSetter(name, newValue) {
36
+ this[name] = __returnValue.bind(null, newValue);
37
+ }
20
38
  var __export = (target, all) => {
21
39
  for (var name in all)
22
40
  __defProp(target, name, {
23
41
  get: all[name],
24
42
  enumerable: true,
25
43
  configurable: true,
26
- set: (newValue) => all[name] = () => newValue
44
+ set: __exportSetter.bind(all, name)
27
45
  });
28
46
  };
29
47
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -2122,46 +2140,6 @@ var require_commander = __commonJS((exports) => {
2122
2140
  exports.InvalidOptionArgumentError = InvalidArgumentError;
2123
2141
  });
2124
2142
 
2125
- // ../../node_modules/.bun/cli-width@4.1.0/node_modules/cli-width/index.js
2126
- var require_cli_width = __commonJS((exports, module) => {
2127
- module.exports = cliWidth;
2128
- function normalizeOpts(options) {
2129
- const defaultOpts = {
2130
- defaultWidth: 0,
2131
- output: process.stdout,
2132
- tty: __require("tty")
2133
- };
2134
- if (!options) {
2135
- return defaultOpts;
2136
- }
2137
- Object.keys(defaultOpts).forEach(function(key) {
2138
- if (!options[key]) {
2139
- options[key] = defaultOpts[key];
2140
- }
2141
- });
2142
- return options;
2143
- }
2144
- function cliWidth(options) {
2145
- const opts = normalizeOpts(options);
2146
- if (opts.output.getWindowSize) {
2147
- return opts.output.getWindowSize()[0] || opts.defaultWidth;
2148
- }
2149
- if (opts.tty.getWindowSize) {
2150
- return opts.tty.getWindowSize()[1] || opts.defaultWidth;
2151
- }
2152
- if (opts.output.columns) {
2153
- return opts.output.columns;
2154
- }
2155
- if (process.env.CLI_WIDTH) {
2156
- const width = parseInt(process.env.CLI_WIDTH, 10);
2157
- if (!isNaN(width) && width !== 0) {
2158
- return width;
2159
- }
2160
- }
2161
- return opts.defaultWidth;
2162
- }
2163
- });
2164
-
2165
2143
  // ../../node_modules/.bun/cli-boxes@3.0.0/node_modules/cli-boxes/boxes.json
2166
2144
  var require_boxes = __commonJS((exports, module) => {
2167
2145
  module.exports = {
@@ -4574,14 +4552,14 @@ var require_bool = __commonJS((exports) => {
4574
4552
 
4575
4553
  // ../../node_modules/.bun/yaml@2.8.2/node_modules/yaml/dist/stringify/stringifyNumber.js
4576
4554
  var require_stringifyNumber = __commonJS((exports) => {
4577
- function stringifyNumber({ format, minFractionDigits, tag, value }) {
4555
+ function stringifyNumber({ format: format3, minFractionDigits, tag, value }) {
4578
4556
  if (typeof value === "bigint")
4579
4557
  return String(value);
4580
4558
  const num = typeof value === "number" ? value : Number(value);
4581
4559
  if (!isFinite(num))
4582
4560
  return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
4583
4561
  let n7 = Object.is(value, -0) ? "-0" : JSON.stringify(value);
4584
- if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n7)) {
4562
+ if (!format3 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n7)) {
4585
4563
  let i2 = n7.indexOf(".");
4586
4564
  if (i2 < 0) {
4587
4565
  i2 = n7.length;
@@ -9235,7 +9213,7 @@ var require_public_api = __commonJS((exports) => {
9235
9213
  }
9236
9214
  return doc2;
9237
9215
  }
9238
- function parse6(src, reviver, options) {
9216
+ function parse8(src, reviver, options) {
9239
9217
  let _reviver = undefined;
9240
9218
  if (typeof reviver === "function") {
9241
9219
  _reviver = reviver;
@@ -9276,7 +9254,7 @@ var require_public_api = __commonJS((exports) => {
9276
9254
  return value.toString(options);
9277
9255
  return new Document.Document(value, _replacer, options).toString(options);
9278
9256
  }
9279
- exports.parse = parse6;
9257
+ exports.parse = parse8;
9280
9258
  exports.parseAllDocuments = parseAllDocuments;
9281
9259
  exports.parseDocument = parseDocument;
9282
9260
  exports.stringify = stringify;
@@ -96501,6 +96479,46 @@ ${Me12.join(`
96501
96479
  Y42 = k0(G42);
96502
96480
  });
96503
96481
 
96482
+ // ../../node_modules/.bun/cli-width@4.1.0/node_modules/cli-width/index.js
96483
+ var require_cli_width = __commonJS((exports, module) => {
96484
+ module.exports = cliWidth;
96485
+ function normalizeOpts(options8) {
96486
+ const defaultOpts = {
96487
+ defaultWidth: 0,
96488
+ output: process.stdout,
96489
+ tty: __require("tty")
96490
+ };
96491
+ if (!options8) {
96492
+ return defaultOpts;
96493
+ }
96494
+ Object.keys(defaultOpts).forEach(function(key2) {
96495
+ if (!options8[key2]) {
96496
+ options8[key2] = defaultOpts[key2];
96497
+ }
96498
+ });
96499
+ return options8;
96500
+ }
96501
+ function cliWidth(options8) {
96502
+ const opts = normalizeOpts(options8);
96503
+ if (opts.output.getWindowSize) {
96504
+ return opts.output.getWindowSize()[0] || opts.defaultWidth;
96505
+ }
96506
+ if (opts.tty.getWindowSize) {
96507
+ return opts.tty.getWindowSize()[1] || opts.defaultWidth;
96508
+ }
96509
+ if (opts.output.columns) {
96510
+ return opts.output.columns;
96511
+ }
96512
+ if (process.env.CLI_WIDTH) {
96513
+ const width = parseInt(process.env.CLI_WIDTH, 10);
96514
+ if (!isNaN(width) && width !== 0) {
96515
+ return width;
96516
+ }
96517
+ }
96518
+ return opts.defaultWidth;
96519
+ }
96520
+ });
96521
+
96504
96522
  // ../../node_modules/.bun/mute-stream@3.0.0/node_modules/mute-stream/lib/index.js
96505
96523
  var require_lib = __commonJS((exports, module) => {
96506
96524
  var Stream = __require("stream");
@@ -96642,214 +96660,6 @@ class ExitPromptError extends Error {
96642
96660
  name = "ExitPromptError";
96643
96661
  }
96644
96662
 
96645
- // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
96646
- var signals = [];
96647
- signals.push("SIGHUP", "SIGINT", "SIGTERM");
96648
- if (process.platform !== "win32") {
96649
- signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
96650
- }
96651
- if (process.platform === "linux") {
96652
- signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
96653
- }
96654
-
96655
- // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
96656
- var processOk = (process2) => !!process2 && typeof process2 === "object" && typeof process2.removeListener === "function" && typeof process2.emit === "function" && typeof process2.reallyExit === "function" && typeof process2.listeners === "function" && typeof process2.kill === "function" && typeof process2.pid === "number" && typeof process2.on === "function";
96657
- var kExitEmitter = Symbol.for("signal-exit emitter");
96658
- var global2 = globalThis;
96659
- var ObjectDefineProperty = Object.defineProperty.bind(Object);
96660
-
96661
- class Emitter {
96662
- emitted = {
96663
- afterExit: false,
96664
- exit: false
96665
- };
96666
- listeners = {
96667
- afterExit: [],
96668
- exit: []
96669
- };
96670
- count = 0;
96671
- id = Math.random();
96672
- constructor() {
96673
- if (global2[kExitEmitter]) {
96674
- return global2[kExitEmitter];
96675
- }
96676
- ObjectDefineProperty(global2, kExitEmitter, {
96677
- value: this,
96678
- writable: false,
96679
- enumerable: false,
96680
- configurable: false
96681
- });
96682
- }
96683
- on(ev, fn) {
96684
- this.listeners[ev].push(fn);
96685
- }
96686
- removeListener(ev, fn) {
96687
- const list = this.listeners[ev];
96688
- const i = list.indexOf(fn);
96689
- if (i === -1) {
96690
- return;
96691
- }
96692
- if (i === 0 && list.length === 1) {
96693
- list.length = 0;
96694
- } else {
96695
- list.splice(i, 1);
96696
- }
96697
- }
96698
- emit(ev, code, signal) {
96699
- if (this.emitted[ev]) {
96700
- return false;
96701
- }
96702
- this.emitted[ev] = true;
96703
- let ret = false;
96704
- for (const fn of this.listeners[ev]) {
96705
- ret = fn(code, signal) === true || ret;
96706
- }
96707
- if (ev === "exit") {
96708
- ret = this.emit("afterExit", code, signal) || ret;
96709
- }
96710
- return ret;
96711
- }
96712
- }
96713
-
96714
- class SignalExitBase {
96715
- }
96716
- var signalExitWrap = (handler) => {
96717
- return {
96718
- onExit(cb, opts) {
96719
- return handler.onExit(cb, opts);
96720
- },
96721
- load() {
96722
- return handler.load();
96723
- },
96724
- unload() {
96725
- return handler.unload();
96726
- }
96727
- };
96728
- };
96729
-
96730
- class SignalExitFallback extends SignalExitBase {
96731
- onExit() {
96732
- return () => {};
96733
- }
96734
- load() {}
96735
- unload() {}
96736
- }
96737
-
96738
- class SignalExit extends SignalExitBase {
96739
- #hupSig = process2.platform === "win32" ? "SIGINT" : "SIGHUP";
96740
- #emitter = new Emitter;
96741
- #process;
96742
- #originalProcessEmit;
96743
- #originalProcessReallyExit;
96744
- #sigListeners = {};
96745
- #loaded = false;
96746
- constructor(process2) {
96747
- super();
96748
- this.#process = process2;
96749
- this.#sigListeners = {};
96750
- for (const sig of signals) {
96751
- this.#sigListeners[sig] = () => {
96752
- const listeners = this.#process.listeners(sig);
96753
- let { count } = this.#emitter;
96754
- const p = process2;
96755
- if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
96756
- count += p.__signal_exit_emitter__.count;
96757
- }
96758
- if (listeners.length === count) {
96759
- this.unload();
96760
- const ret = this.#emitter.emit("exit", null, sig);
96761
- const s = sig === "SIGHUP" ? this.#hupSig : sig;
96762
- if (!ret)
96763
- process2.kill(process2.pid, s);
96764
- }
96765
- };
96766
- }
96767
- this.#originalProcessReallyExit = process2.reallyExit;
96768
- this.#originalProcessEmit = process2.emit;
96769
- }
96770
- onExit(cb, opts) {
96771
- if (!processOk(this.#process)) {
96772
- return () => {};
96773
- }
96774
- if (this.#loaded === false) {
96775
- this.load();
96776
- }
96777
- const ev = opts?.alwaysLast ? "afterExit" : "exit";
96778
- this.#emitter.on(ev, cb);
96779
- return () => {
96780
- this.#emitter.removeListener(ev, cb);
96781
- if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
96782
- this.unload();
96783
- }
96784
- };
96785
- }
96786
- load() {
96787
- if (this.#loaded) {
96788
- return;
96789
- }
96790
- this.#loaded = true;
96791
- this.#emitter.count += 1;
96792
- for (const sig of signals) {
96793
- try {
96794
- const fn = this.#sigListeners[sig];
96795
- if (fn)
96796
- this.#process.on(sig, fn);
96797
- } catch (_) {}
96798
- }
96799
- this.#process.emit = (ev, ...a) => {
96800
- return this.#processEmit(ev, ...a);
96801
- };
96802
- this.#process.reallyExit = (code) => {
96803
- return this.#processReallyExit(code);
96804
- };
96805
- }
96806
- unload() {
96807
- if (!this.#loaded) {
96808
- return;
96809
- }
96810
- this.#loaded = false;
96811
- signals.forEach((sig) => {
96812
- const listener = this.#sigListeners[sig];
96813
- if (!listener) {
96814
- throw new Error("Listener not defined for signal: " + sig);
96815
- }
96816
- try {
96817
- this.#process.removeListener(sig, listener);
96818
- } catch (_) {}
96819
- });
96820
- this.#process.emit = this.#originalProcessEmit;
96821
- this.#process.reallyExit = this.#originalProcessReallyExit;
96822
- this.#emitter.count -= 1;
96823
- }
96824
- #processReallyExit(code) {
96825
- if (!processOk(this.#process)) {
96826
- return 0;
96827
- }
96828
- this.#process.exitCode = code || 0;
96829
- this.#emitter.emit("exit", this.#process.exitCode, null);
96830
- return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
96831
- }
96832
- #processEmit(ev, ...args) {
96833
- const og = this.#originalProcessEmit;
96834
- if (ev === "exit" && processOk(this.#process)) {
96835
- if (typeof args[0] === "number") {
96836
- this.#process.exitCode = args[0];
96837
- }
96838
- const ret = og.call(this.#process, ev, ...args);
96839
- this.#emitter.emit("exit", this.#process.exitCode, null);
96840
- return ret;
96841
- } else {
96842
- return og.call(this.#process, ev, ...args);
96843
- }
96844
- }
96845
- }
96846
- var process2 = globalThis.process;
96847
- var {
96848
- onExit,
96849
- load,
96850
- unload
96851
- } = signalExitWrap(processOk(process2) ? new SignalExit(process2) : new SignalExitFallback);
96852
-
96853
96663
  // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
96854
96664
  var ANSI_BACKGROUND_OFFSET = 10;
96855
96665
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -97028,16 +96838,16 @@ var ansiStyles = assembleStyles();
97028
96838
  var ansi_styles_default = ansiStyles;
97029
96839
 
97030
96840
  // ../../node_modules/.bun/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
97031
- import process3 from "process";
96841
+ import process2 from "process";
97032
96842
  import os from "os";
97033
96843
  import tty from "tty";
97034
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process3.argv) {
96844
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
97035
96845
  const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
97036
96846
  const position = argv.indexOf(prefix + flag);
97037
96847
  const terminatorPosition = argv.indexOf("--");
97038
96848
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
97039
96849
  }
97040
- var { env } = process3;
96850
+ var { env } = process2;
97041
96851
  var flagForceColor;
97042
96852
  if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
97043
96853
  flagForceColor = 0;
@@ -97093,7 +96903,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
97093
96903
  if (env.TERM === "dumb") {
97094
96904
  return min;
97095
96905
  }
97096
- if (process3.platform === "win32") {
96906
+ if (process2.platform === "win32") {
97097
96907
  const osRelease = os.release().split(".");
97098
96908
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
97099
96909
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
@@ -97385,7 +97195,7 @@ function diff(obj, newObj, options = { cyclesFix: true }, _stack = []) {
97385
97195
  }
97386
97196
 
97387
97197
  // src/commands/deploy.ts
97388
- import path17 from "path";
97198
+ import path19 from "path";
97389
97199
 
97390
97200
  // ../../node_modules/.bun/remeda@2.33.6/node_modules/remeda/dist/lazyDataLastImpl-DtF3cihj.js
97391
97201
  function e(e2, t, n) {
@@ -97542,7 +97352,7 @@ function r2(e4, n7) {
97542
97352
 
97543
97353
  // src/lib/agents.ts
97544
97354
  import fs8 from "fs/promises";
97545
- import path15 from "path";
97355
+ import path17 from "path";
97546
97356
 
97547
97357
  // ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
97548
97358
  var exports_external = {};
@@ -97801,7 +97611,7 @@ __export(exports_core2, {
97801
97611
  safeDecode: () => safeDecode,
97802
97612
  registry: () => registry,
97803
97613
  regexes: () => exports_regexes,
97804
- process: () => process4,
97614
+ process: () => process3,
97805
97615
  prettifyError: () => prettifyError,
97806
97616
  parseAsync: () => parseAsync,
97807
97617
  parse: () => parse,
@@ -108265,7 +108075,7 @@ function initializeContext(params) {
108265
108075
  external: params?.external ?? undefined
108266
108076
  };
108267
108077
  }
108268
- function process4(schema, ctx, _params = { path: [], schemaPath: [] }) {
108078
+ function process3(schema, ctx, _params = { path: [], schemaPath: [] }) {
108269
108079
  var _a2;
108270
108080
  const def = schema._zod.def;
108271
108081
  const seen = ctx.seen.get(schema);
@@ -108302,7 +108112,7 @@ function process4(schema, ctx, _params = { path: [], schemaPath: [] }) {
108302
108112
  if (parent) {
108303
108113
  if (!result.ref)
108304
108114
  result.ref = parent;
108305
- process4(parent, ctx, params);
108115
+ process3(parent, ctx, params);
108306
108116
  ctx.seen.get(parent).isParent = true;
108307
108117
  }
108308
108118
  }
@@ -108578,14 +108388,14 @@ function isTransforming(_schema, _ctx) {
108578
108388
  }
108579
108389
  var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
108580
108390
  const ctx = initializeContext({ ...params, processors });
108581
- process4(schema, ctx);
108391
+ process3(schema, ctx);
108582
108392
  extractDefs(ctx, schema);
108583
108393
  return finalize(ctx, schema);
108584
108394
  };
108585
108395
  var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
108586
108396
  const { libraryOptions, target } = params ?? {};
108587
108397
  const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
108588
- process4(schema, ctx);
108398
+ process3(schema, ctx);
108589
108399
  extractDefs(ctx, schema);
108590
108400
  return finalize(ctx, schema);
108591
108401
  };
@@ -108836,7 +108646,7 @@ var arrayProcessor = (schema, ctx, _json, params) => {
108836
108646
  if (typeof maximum === "number")
108837
108647
  json.maxItems = maximum;
108838
108648
  json.type = "array";
108839
- json.items = process4(def.element, ctx, { ...params, path: [...params.path, "items"] });
108649
+ json.items = process3(def.element, ctx, { ...params, path: [...params.path, "items"] });
108840
108650
  };
108841
108651
  var objectProcessor = (schema, ctx, _json, params) => {
108842
108652
  const json = _json;
@@ -108845,7 +108655,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
108845
108655
  json.properties = {};
108846
108656
  const shape = def.shape;
108847
108657
  for (const key in shape) {
108848
- json.properties[key] = process4(shape[key], ctx, {
108658
+ json.properties[key] = process3(shape[key], ctx, {
108849
108659
  ...params,
108850
108660
  path: [...params.path, "properties", key]
108851
108661
  });
@@ -108868,7 +108678,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
108868
108678
  if (ctx.io === "output")
108869
108679
  json.additionalProperties = false;
108870
108680
  } else if (def.catchall) {
108871
- json.additionalProperties = process4(def.catchall, ctx, {
108681
+ json.additionalProperties = process3(def.catchall, ctx, {
108872
108682
  ...params,
108873
108683
  path: [...params.path, "additionalProperties"]
108874
108684
  });
@@ -108877,7 +108687,7 @@ var objectProcessor = (schema, ctx, _json, params) => {
108877
108687
  var unionProcessor = (schema, ctx, json, params) => {
108878
108688
  const def = schema._zod.def;
108879
108689
  const isExclusive = def.inclusive === false;
108880
- const options = def.options.map((x, i2) => process4(x, ctx, {
108690
+ const options = def.options.map((x, i2) => process3(x, ctx, {
108881
108691
  ...params,
108882
108692
  path: [...params.path, isExclusive ? "oneOf" : "anyOf", i2]
108883
108693
  }));
@@ -108889,11 +108699,11 @@ var unionProcessor = (schema, ctx, json, params) => {
108889
108699
  };
108890
108700
  var intersectionProcessor = (schema, ctx, json, params) => {
108891
108701
  const def = schema._zod.def;
108892
- const a = process4(def.left, ctx, {
108702
+ const a = process3(def.left, ctx, {
108893
108703
  ...params,
108894
108704
  path: [...params.path, "allOf", 0]
108895
108705
  });
108896
- const b = process4(def.right, ctx, {
108706
+ const b = process3(def.right, ctx, {
108897
108707
  ...params,
108898
108708
  path: [...params.path, "allOf", 1]
108899
108709
  });
@@ -108910,11 +108720,11 @@ var tupleProcessor = (schema, ctx, _json, params) => {
108910
108720
  json.type = "array";
108911
108721
  const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
108912
108722
  const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
108913
- const prefixItems = def.items.map((x, i2) => process4(x, ctx, {
108723
+ const prefixItems = def.items.map((x, i2) => process3(x, ctx, {
108914
108724
  ...params,
108915
108725
  path: [...params.path, prefixPath, i2]
108916
108726
  }));
108917
- const rest = def.rest ? process4(def.rest, ctx, {
108727
+ const rest = def.rest ? process3(def.rest, ctx, {
108918
108728
  ...params,
108919
108729
  path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
108920
108730
  }) : null;
@@ -108954,7 +108764,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
108954
108764
  const keyBag = keyType._zod.bag;
108955
108765
  const patterns = keyBag?.patterns;
108956
108766
  if (def.mode === "loose" && patterns && patterns.size > 0) {
108957
- const valueSchema = process4(def.valueType, ctx, {
108767
+ const valueSchema = process3(def.valueType, ctx, {
108958
108768
  ...params,
108959
108769
  path: [...params.path, "patternProperties", "*"]
108960
108770
  });
@@ -108964,12 +108774,12 @@ var recordProcessor = (schema, ctx, _json, params) => {
108964
108774
  }
108965
108775
  } else {
108966
108776
  if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
108967
- json.propertyNames = process4(def.keyType, ctx, {
108777
+ json.propertyNames = process3(def.keyType, ctx, {
108968
108778
  ...params,
108969
108779
  path: [...params.path, "propertyNames"]
108970
108780
  });
108971
108781
  }
108972
- json.additionalProperties = process4(def.valueType, ctx, {
108782
+ json.additionalProperties = process3(def.valueType, ctx, {
108973
108783
  ...params,
108974
108784
  path: [...params.path, "additionalProperties"]
108975
108785
  });
@@ -108984,7 +108794,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
108984
108794
  };
108985
108795
  var nullableProcessor = (schema, ctx, json, params) => {
108986
108796
  const def = schema._zod.def;
108987
- const inner = process4(def.innerType, ctx, params);
108797
+ const inner = process3(def.innerType, ctx, params);
108988
108798
  const seen = ctx.seen.get(schema);
108989
108799
  if (ctx.target === "openapi-3.0") {
108990
108800
  seen.ref = def.innerType;
@@ -108995,20 +108805,20 @@ var nullableProcessor = (schema, ctx, json, params) => {
108995
108805
  };
108996
108806
  var nonoptionalProcessor = (schema, ctx, _json, params) => {
108997
108807
  const def = schema._zod.def;
108998
- process4(def.innerType, ctx, params);
108808
+ process3(def.innerType, ctx, params);
108999
108809
  const seen = ctx.seen.get(schema);
109000
108810
  seen.ref = def.innerType;
109001
108811
  };
109002
108812
  var defaultProcessor = (schema, ctx, json, params) => {
109003
108813
  const def = schema._zod.def;
109004
- process4(def.innerType, ctx, params);
108814
+ process3(def.innerType, ctx, params);
109005
108815
  const seen = ctx.seen.get(schema);
109006
108816
  seen.ref = def.innerType;
109007
108817
  json.default = JSON.parse(JSON.stringify(def.defaultValue));
109008
108818
  };
109009
108819
  var prefaultProcessor = (schema, ctx, json, params) => {
109010
108820
  const def = schema._zod.def;
109011
- process4(def.innerType, ctx, params);
108821
+ process3(def.innerType, ctx, params);
109012
108822
  const seen = ctx.seen.get(schema);
109013
108823
  seen.ref = def.innerType;
109014
108824
  if (ctx.io === "input")
@@ -109016,7 +108826,7 @@ var prefaultProcessor = (schema, ctx, json, params) => {
109016
108826
  };
109017
108827
  var catchProcessor = (schema, ctx, json, params) => {
109018
108828
  const def = schema._zod.def;
109019
- process4(def.innerType, ctx, params);
108829
+ process3(def.innerType, ctx, params);
109020
108830
  const seen = ctx.seen.get(schema);
109021
108831
  seen.ref = def.innerType;
109022
108832
  let catchValue;
@@ -109030,32 +108840,32 @@ var catchProcessor = (schema, ctx, json, params) => {
109030
108840
  var pipeProcessor = (schema, ctx, _json, params) => {
109031
108841
  const def = schema._zod.def;
109032
108842
  const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
109033
- process4(innerType, ctx, params);
108843
+ process3(innerType, ctx, params);
109034
108844
  const seen = ctx.seen.get(schema);
109035
108845
  seen.ref = innerType;
109036
108846
  };
109037
108847
  var readonlyProcessor = (schema, ctx, json, params) => {
109038
108848
  const def = schema._zod.def;
109039
- process4(def.innerType, ctx, params);
108849
+ process3(def.innerType, ctx, params);
109040
108850
  const seen = ctx.seen.get(schema);
109041
108851
  seen.ref = def.innerType;
109042
108852
  json.readOnly = true;
109043
108853
  };
109044
108854
  var promiseProcessor = (schema, ctx, _json, params) => {
109045
108855
  const def = schema._zod.def;
109046
- process4(def.innerType, ctx, params);
108856
+ process3(def.innerType, ctx, params);
109047
108857
  const seen = ctx.seen.get(schema);
109048
108858
  seen.ref = def.innerType;
109049
108859
  };
109050
108860
  var optionalProcessor = (schema, ctx, _json, params) => {
109051
108861
  const def = schema._zod.def;
109052
- process4(def.innerType, ctx, params);
108862
+ process3(def.innerType, ctx, params);
109053
108863
  const seen = ctx.seen.get(schema);
109054
108864
  seen.ref = def.innerType;
109055
108865
  };
109056
108866
  var lazyProcessor = (schema, ctx, _json, params) => {
109057
108867
  const innerType = schema._zod.innerType;
109058
- process4(innerType, ctx, params);
108868
+ process3(innerType, ctx, params);
109059
108869
  const seen = ctx.seen.get(schema);
109060
108870
  seen.ref = innerType;
109061
108871
  };
@@ -109107,7 +108917,7 @@ function toJSONSchema(input, params) {
109107
108917
  const defs = {};
109108
108918
  for (const entry of registry2._idmap.entries()) {
109109
108919
  const [_, schema] = entry;
109110
- process4(schema, ctx2);
108920
+ process3(schema, ctx2);
109111
108921
  }
109112
108922
  const schemas = {};
109113
108923
  const external = {
@@ -109130,7 +108940,7 @@ function toJSONSchema(input, params) {
109130
108940
  return { schemas };
109131
108941
  }
109132
108942
  const ctx = initializeContext({ ...params, processors: allProcessors });
109133
- process4(input, ctx);
108943
+ process3(input, ctx);
109134
108944
  extractDefs(ctx, input);
109135
108945
  return finalize(ctx, input);
109136
108946
  }
@@ -109176,7 +108986,7 @@ class JSONSchemaGenerator {
109176
108986
  });
109177
108987
  }
109178
108988
  process(schema, _params = { path: [], schemaPath: [] }) {
109179
- return process4(schema, this.ctx, _params);
108989
+ return process3(schema, this.ctx, _params);
109180
108990
  }
109181
108991
  emit(schema, _params) {
109182
108992
  if (_params) {
@@ -111117,7 +110927,8 @@ var DisconnectionReasonSchema = exports_external.enum([
111117
110927
  "error_retell",
111118
110928
  "error_unknown",
111119
110929
  "error_user_not_joined",
111120
- "registered_call_timeout"
110930
+ "registered_call_timeout",
110931
+ "unknown"
111121
110932
  ]);
111122
110933
  var UserSentimentSchema = exports_external.enum([
111123
110934
  "Negative",
@@ -111482,6 +111293,285 @@ function withMetadataArgument(func, _arguments) {
111482
111293
  args.push(metadata_min_json_default);
111483
111294
  return func.apply(this, args);
111484
111295
  }
111296
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/isObject.js
111297
+ var objectConstructor = {}.constructor;
111298
+ function isObject2(object2) {
111299
+ return object2 !== undefined && object2 !== null && object2.constructor === objectConstructor;
111300
+ }
111301
+
111302
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/normalizeArguments.js
111303
+ function _typeof(o) {
111304
+ "@babel/helpers - typeof";
111305
+ return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
111306
+ return typeof o2;
111307
+ } : function(o2) {
111308
+ return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
111309
+ }, _typeof(o);
111310
+ }
111311
+ function ownKeys(e4, r3) {
111312
+ var t9 = Object.keys(e4);
111313
+ if (Object.getOwnPropertySymbols) {
111314
+ var o = Object.getOwnPropertySymbols(e4);
111315
+ r3 && (o = o.filter(function(r4) {
111316
+ return Object.getOwnPropertyDescriptor(e4, r4).enumerable;
111317
+ })), t9.push.apply(t9, o);
111318
+ }
111319
+ return t9;
111320
+ }
111321
+ function _objectSpread(e4) {
111322
+ for (var r3 = 1;r3 < arguments.length; r3++) {
111323
+ var t9 = arguments[r3] != null ? arguments[r3] : {};
111324
+ r3 % 2 ? ownKeys(Object(t9), true).forEach(function(r4) {
111325
+ _defineProperty(e4, r4, t9[r4]);
111326
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e4, Object.getOwnPropertyDescriptors(t9)) : ownKeys(Object(t9)).forEach(function(r4) {
111327
+ Object.defineProperty(e4, r4, Object.getOwnPropertyDescriptor(t9, r4));
111328
+ });
111329
+ }
111330
+ return e4;
111331
+ }
111332
+ function _defineProperty(e4, r3, t9) {
111333
+ return (r3 = _toPropertyKey(r3)) in e4 ? Object.defineProperty(e4, r3, { value: t9, enumerable: true, configurable: true, writable: true }) : e4[r3] = t9, e4;
111334
+ }
111335
+ function _toPropertyKey(t9) {
111336
+ var i2 = _toPrimitive(t9, "string");
111337
+ return _typeof(i2) == "symbol" ? i2 : i2 + "";
111338
+ }
111339
+ function _toPrimitive(t9, r3) {
111340
+ if (_typeof(t9) != "object" || !t9)
111341
+ return t9;
111342
+ var e4 = t9[Symbol.toPrimitive];
111343
+ if (e4 !== undefined) {
111344
+ var i2 = e4.call(t9, r3 || "default");
111345
+ if (_typeof(i2) != "object")
111346
+ return i2;
111347
+ throw new TypeError("@@toPrimitive must return a primitive value.");
111348
+ }
111349
+ return (r3 === "string" ? String : Number)(t9);
111350
+ }
111351
+ function _slicedToArray(r3, e4) {
111352
+ return _arrayWithHoles(r3) || _iterableToArrayLimit(r3, e4) || _unsupportedIterableToArray(r3, e4) || _nonIterableRest();
111353
+ }
111354
+ function _nonIterableRest() {
111355
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
111356
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
111357
+ }
111358
+ function _unsupportedIterableToArray(r3, a) {
111359
+ if (r3) {
111360
+ if (typeof r3 == "string")
111361
+ return _arrayLikeToArray(r3, a);
111362
+ var t9 = {}.toString.call(r3).slice(8, -1);
111363
+ return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray(r3, a) : undefined;
111364
+ }
111365
+ }
111366
+ function _arrayLikeToArray(r3, a) {
111367
+ (a == null || a > r3.length) && (a = r3.length);
111368
+ for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
111369
+ n7[e4] = r3[e4];
111370
+ return n7;
111371
+ }
111372
+ function _iterableToArrayLimit(r3, l) {
111373
+ var t9 = r3 == null ? null : typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
111374
+ if (t9 != null) {
111375
+ var e4, n7, i2, u, a = [], f = true, o = false;
111376
+ try {
111377
+ if (i2 = (t9 = t9.call(r3)).next, l === 0) {
111378
+ if (Object(t9) !== t9)
111379
+ return;
111380
+ f = false;
111381
+ } else
111382
+ for (;!(f = (e4 = i2.call(t9)).done) && (a.push(e4.value), a.length !== l); f = true)
111383
+ ;
111384
+ } catch (r4) {
111385
+ o = true, n7 = r4;
111386
+ } finally {
111387
+ try {
111388
+ if (!f && t9["return"] != null && (u = t9["return"](), Object(u) !== u))
111389
+ return;
111390
+ } finally {
111391
+ if (o)
111392
+ throw n7;
111393
+ }
111394
+ }
111395
+ return a;
111396
+ }
111397
+ }
111398
+ function _arrayWithHoles(r3) {
111399
+ if (Array.isArray(r3))
111400
+ return r3;
111401
+ }
111402
+ function normalizeArguments(args) {
111403
+ var _Array$prototype$slic = Array.prototype.slice.call(args), _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3];
111404
+ var text;
111405
+ var options;
111406
+ var metadata;
111407
+ if (typeof arg_1 === "string") {
111408
+ text = arg_1;
111409
+ } else
111410
+ throw new TypeError("A text for parsing must be a string.");
111411
+ if (!arg_2 || typeof arg_2 === "string") {
111412
+ if (arg_4) {
111413
+ options = arg_3;
111414
+ metadata = arg_4;
111415
+ } else {
111416
+ options = undefined;
111417
+ metadata = arg_3;
111418
+ }
111419
+ if (arg_2) {
111420
+ options = _objectSpread({
111421
+ defaultCountry: arg_2
111422
+ }, options);
111423
+ }
111424
+ } else if (isObject2(arg_2)) {
111425
+ if (arg_3) {
111426
+ options = arg_2;
111427
+ metadata = arg_3;
111428
+ } else {
111429
+ metadata = arg_2;
111430
+ }
111431
+ } else
111432
+ throw new Error("Invalid second argument: ".concat(arg_2));
111433
+ return {
111434
+ text,
111435
+ options,
111436
+ metadata
111437
+ };
111438
+ }
111439
+
111440
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/constants.js
111441
+ var MIN_LENGTH_FOR_NSN = 2;
111442
+ var MAX_LENGTH_FOR_NSN = 17;
111443
+ var MAX_LENGTH_COUNTRY_CODE = 3;
111444
+ var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9";
111445
+ var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
111446
+ var SLASHES = "\uFF0F/";
111447
+ var DOTS = "\uFF0E.";
111448
+ var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
111449
+ var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]";
111450
+ var TILDES = "~\u2053\u223C\uFF5E";
111451
+ var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
111452
+ var PLUS_CHARS = "+\uFF0B";
111453
+
111454
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/ParseError.js
111455
+ function _typeof2(o) {
111456
+ "@babel/helpers - typeof";
111457
+ return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
111458
+ return typeof o2;
111459
+ } : function(o2) {
111460
+ return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
111461
+ }, _typeof2(o);
111462
+ }
111463
+ function _defineProperties(e4, r3) {
111464
+ for (var t9 = 0;t9 < r3.length; t9++) {
111465
+ var o = r3[t9];
111466
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey2(o.key), o);
111467
+ }
111468
+ }
111469
+ function _createClass(e4, r3, t9) {
111470
+ return r3 && _defineProperties(e4.prototype, r3), t9 && _defineProperties(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
111471
+ }
111472
+ function _toPropertyKey2(t9) {
111473
+ var i2 = _toPrimitive2(t9, "string");
111474
+ return _typeof2(i2) == "symbol" ? i2 : i2 + "";
111475
+ }
111476
+ function _toPrimitive2(t9, r3) {
111477
+ if (_typeof2(t9) != "object" || !t9)
111478
+ return t9;
111479
+ var e4 = t9[Symbol.toPrimitive];
111480
+ if (e4 !== undefined) {
111481
+ var i2 = e4.call(t9, r3 || "default");
111482
+ if (_typeof2(i2) != "object")
111483
+ return i2;
111484
+ throw new TypeError("@@toPrimitive must return a primitive value.");
111485
+ }
111486
+ return (r3 === "string" ? String : Number)(t9);
111487
+ }
111488
+ function _classCallCheck(a, n7) {
111489
+ if (!(a instanceof n7))
111490
+ throw new TypeError("Cannot call a class as a function");
111491
+ }
111492
+ function _callSuper(t9, o, e4) {
111493
+ return o = _getPrototypeOf(o), _possibleConstructorReturn(t9, _isNativeReflectConstruct() ? Reflect.construct(o, e4 || [], _getPrototypeOf(t9).constructor) : o.apply(t9, e4));
111494
+ }
111495
+ function _possibleConstructorReturn(t9, e4) {
111496
+ if (e4 && (_typeof2(e4) == "object" || typeof e4 == "function"))
111497
+ return e4;
111498
+ if (e4 !== undefined)
111499
+ throw new TypeError("Derived constructors may only return object or undefined");
111500
+ return _assertThisInitialized(t9);
111501
+ }
111502
+ function _assertThisInitialized(e4) {
111503
+ if (e4 === undefined)
111504
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
111505
+ return e4;
111506
+ }
111507
+ function _inherits(t9, e4) {
111508
+ if (typeof e4 != "function" && e4 !== null)
111509
+ throw new TypeError("Super expression must either be null or a function");
111510
+ t9.prototype = Object.create(e4 && e4.prototype, { constructor: { value: t9, writable: true, configurable: true } }), Object.defineProperty(t9, "prototype", { writable: false }), e4 && _setPrototypeOf(t9, e4);
111511
+ }
111512
+ function _wrapNativeSuper(t9) {
111513
+ var r3 = typeof Map == "function" ? new Map : undefined;
111514
+ return _wrapNativeSuper = function _wrapNativeSuper2(t10) {
111515
+ if (t10 === null || !_isNativeFunction(t10))
111516
+ return t10;
111517
+ if (typeof t10 != "function")
111518
+ throw new TypeError("Super expression must either be null or a function");
111519
+ if (r3 !== undefined) {
111520
+ if (r3.has(t10))
111521
+ return r3.get(t10);
111522
+ r3.set(t10, Wrapper);
111523
+ }
111524
+ function Wrapper() {
111525
+ return _construct(t10, arguments, _getPrototypeOf(this).constructor);
111526
+ }
111527
+ return Wrapper.prototype = Object.create(t10.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }), _setPrototypeOf(Wrapper, t10);
111528
+ }, _wrapNativeSuper(t9);
111529
+ }
111530
+ function _construct(t9, e4, r3) {
111531
+ if (_isNativeReflectConstruct())
111532
+ return Reflect.construct.apply(null, arguments);
111533
+ var o = [null];
111534
+ o.push.apply(o, e4);
111535
+ var p = new (t9.bind.apply(t9, o));
111536
+ return r3 && _setPrototypeOf(p, r3.prototype), p;
111537
+ }
111538
+ function _isNativeReflectConstruct() {
111539
+ try {
111540
+ var t9 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
111541
+ } catch (t10) {}
111542
+ return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
111543
+ return !!t9;
111544
+ })();
111545
+ }
111546
+ function _isNativeFunction(t9) {
111547
+ try {
111548
+ return Function.toString.call(t9).indexOf("[native code]") !== -1;
111549
+ } catch (n7) {
111550
+ return typeof t9 == "function";
111551
+ }
111552
+ }
111553
+ function _setPrototypeOf(t9, e4) {
111554
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t10, e5) {
111555
+ return t10.__proto__ = e5, t10;
111556
+ }, _setPrototypeOf(t9, e4);
111557
+ }
111558
+ function _getPrototypeOf(t9) {
111559
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t10) {
111560
+ return t10.__proto__ || Object.getPrototypeOf(t10);
111561
+ }, _getPrototypeOf(t9);
111562
+ }
111563
+ var ParseError = /* @__PURE__ */ function(_Error) {
111564
+ function ParseError2(code) {
111565
+ var _this;
111566
+ _classCallCheck(this, ParseError2);
111567
+ _this = _callSuper(this, ParseError2, [code]);
111568
+ Object.setPrototypeOf(_this, ParseError2.prototype);
111569
+ _this.name = _this.constructor.name;
111570
+ return _this;
111571
+ }
111572
+ _inherits(ParseError2, _Error);
111573
+ return _createClass(ParseError2);
111574
+ }(/* @__PURE__ */ _wrapNativeSuper(Error));
111485
111575
 
111486
111576
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/tools/semver-compare.js
111487
111577
  function semver_compare_default(a, b) {
@@ -111507,45 +111597,39 @@ function semver_compare_default(a, b) {
111507
111597
  return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
111508
111598
  }
111509
111599
 
111510
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/isObject.js
111511
- var objectConstructor = {}.constructor;
111512
- function isObject2(object2) {
111513
- return object2 !== undefined && object2 !== null && object2.constructor === objectConstructor;
111514
- }
111515
-
111516
111600
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/metadata.js
111517
- function _typeof(o) {
111601
+ function _typeof3(o) {
111518
111602
  "@babel/helpers - typeof";
111519
- return _typeof = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
111603
+ return _typeof3 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
111520
111604
  return typeof o2;
111521
111605
  } : function(o2) {
111522
111606
  return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
111523
- }, _typeof(o);
111607
+ }, _typeof3(o);
111524
111608
  }
111525
- function _classCallCheck(a, n7) {
111609
+ function _classCallCheck2(a, n7) {
111526
111610
  if (!(a instanceof n7))
111527
111611
  throw new TypeError("Cannot call a class as a function");
111528
111612
  }
111529
- function _defineProperties(e4, r3) {
111613
+ function _defineProperties2(e4, r3) {
111530
111614
  for (var t9 = 0;t9 < r3.length; t9++) {
111531
111615
  var o = r3[t9];
111532
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey(o.key), o);
111616
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey3(o.key), o);
111533
111617
  }
111534
111618
  }
111535
- function _createClass(e4, r3, t9) {
111536
- return r3 && _defineProperties(e4.prototype, r3), t9 && _defineProperties(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
111619
+ function _createClass2(e4, r3, t9) {
111620
+ return r3 && _defineProperties2(e4.prototype, r3), t9 && _defineProperties2(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
111537
111621
  }
111538
- function _toPropertyKey(t9) {
111539
- var i2 = _toPrimitive(t9, "string");
111540
- return _typeof(i2) == "symbol" ? i2 : i2 + "";
111622
+ function _toPropertyKey3(t9) {
111623
+ var i2 = _toPrimitive3(t9, "string");
111624
+ return _typeof3(i2) == "symbol" ? i2 : i2 + "";
111541
111625
  }
111542
- function _toPrimitive(t9, r3) {
111543
- if (_typeof(t9) != "object" || !t9)
111626
+ function _toPrimitive3(t9, r3) {
111627
+ if (_typeof3(t9) != "object" || !t9)
111544
111628
  return t9;
111545
111629
  var e4 = t9[Symbol.toPrimitive];
111546
111630
  if (e4 !== undefined) {
111547
111631
  var i2 = e4.call(t9, r3 || "default");
111548
- if (_typeof(i2) != "object")
111632
+ if (_typeof3(i2) != "object")
111549
111633
  return i2;
111550
111634
  throw new TypeError("@@toPrimitive must return a primitive value.");
111551
111635
  }
@@ -111557,12 +111641,12 @@ var DEFAULT_EXT_PREFIX = " ext. ";
111557
111641
  var CALLING_CODE_REG_EXP = /^\d+$/;
111558
111642
  var Metadata = /* @__PURE__ */ function() {
111559
111643
  function Metadata2(metadata) {
111560
- _classCallCheck(this, Metadata2);
111644
+ _classCallCheck2(this, Metadata2);
111561
111645
  validateMetadata(metadata);
111562
111646
  this.metadata = metadata;
111563
111647
  setVersion.call(this, metadata);
111564
111648
  }
111565
- return _createClass(Metadata2, [{
111649
+ return _createClass2(Metadata2, [{
111566
111650
  key: "getCountries",
111567
111651
  value: function getCountries() {
111568
111652
  return Object.keys(this.metadata.countries).filter(function(_) {
@@ -111758,12 +111842,12 @@ var Metadata = /* @__PURE__ */ function() {
111758
111842
  }();
111759
111843
  var NumberingPlan = /* @__PURE__ */ function() {
111760
111844
  function NumberingPlan2(metadata, globalMetadataObject) {
111761
- _classCallCheck(this, NumberingPlan2);
111845
+ _classCallCheck2(this, NumberingPlan2);
111762
111846
  this.globalMetadataObject = globalMetadataObject;
111763
111847
  this.metadata = metadata;
111764
111848
  setVersion.call(this, globalMetadataObject.metadata);
111765
111849
  }
111766
- return _createClass(NumberingPlan2, [{
111850
+ return _createClass2(NumberingPlan2, [{
111767
111851
  key: "callingCode",
111768
111852
  value: function callingCode() {
111769
111853
  return this.metadata[0];
@@ -111891,11 +111975,11 @@ var NumberingPlan = /* @__PURE__ */ function() {
111891
111975
  }();
111892
111976
  var Format = /* @__PURE__ */ function() {
111893
111977
  function Format2(format, metadata) {
111894
- _classCallCheck(this, Format2);
111978
+ _classCallCheck2(this, Format2);
111895
111979
  this._format = format;
111896
111980
  this.metadata = metadata;
111897
111981
  }
111898
- return _createClass(Format2, [{
111982
+ return _createClass2(Format2, [{
111899
111983
  key: "pattern",
111900
111984
  value: function pattern() {
111901
111985
  return this._format[0];
@@ -111940,11 +112024,11 @@ var Format = /* @__PURE__ */ function() {
111940
112024
  var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
111941
112025
  var Type = /* @__PURE__ */ function() {
111942
112026
  function Type2(type, metadata) {
111943
- _classCallCheck(this, Type2);
112027
+ _classCallCheck2(this, Type2);
111944
112028
  this.type = type;
111945
112029
  this.metadata = metadata;
111946
112030
  }
111947
- return _createClass(Type2, [{
112031
+ return _createClass2(Type2, [{
111948
112032
  key: "pattern",
111949
112033
  value: function pattern() {
111950
112034
  if (this.metadata.v1)
@@ -111993,7 +112077,7 @@ function validateMetadata(metadata) {
111993
112077
  }
111994
112078
  }
111995
112079
  var typeOf = function typeOf2(_) {
111996
- return _typeof(_);
112080
+ return _typeof3(_);
111997
112081
  };
111998
112082
  function getCountryCallingCode(country, metadata) {
111999
112083
  metadata = new Metadata(metadata);
@@ -112025,12 +112109,120 @@ function setVersion(metadata) {
112025
112109
  }
112026
112110
  }
112027
112111
 
112028
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js
112112
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js
112113
+ var RFC3966_EXTN_PREFIX = ";ext=";
112114
+ var getExtensionDigitsPattern = function getExtensionDigitsPattern2(maxLength) {
112115
+ return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
112116
+ };
112117
+ function createExtensionPattern(purpose) {
112118
+ var extLimitAfterExplicitLabel = "20";
112119
+ var extLimitAfterLikelyLabel = "15";
112120
+ var extLimitAfterAmbiguousChar = "9";
112121
+ var extLimitWhenNotSure = "6";
112122
+ var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*";
112123
+ var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*";
112124
+ var optionalExtnSuffix = "#?";
112125
+ var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)";
112126
+ var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)";
112127
+ var ambiguousSeparator = "[- ]+";
112128
+ var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*";
112129
+ var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
112130
+ var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
112131
+ var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
112132
+ var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
112133
+ var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
112134
+ var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
112135
+ var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
112136
+ return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
112137
+ }
112138
+
112139
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js
112140
+ var MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{" + MIN_LENGTH_FOR_NSN + "}";
112141
+ var VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}" + "(?:" + "[" + VALID_PUNCTUATION + "]*" + "[" + VALID_DIGITS + "]" + "){3,}" + "[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
112142
+ var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp("^" + "[" + PLUS_CHARS + "]{0,1}" + "(?:" + "[" + VALID_PUNCTUATION + "]*" + "[" + VALID_DIGITS + "]" + "){1,2}" + "$", "i");
112143
+ var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + "(?:" + createExtensionPattern() + ")?";
112144
+ var VALID_PHONE_NUMBER_PATTERN = new RegExp("^" + MIN_LENGTH_PHONE_NUMBER_PATTERN + "$" + "|" + "^" + VALID_PHONE_NUMBER_WITH_EXTENSION + "$", "i");
112145
+ function isViablePhoneNumber(number4) {
112146
+ return number4.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number4);
112147
+ }
112148
+ function isViablePhoneNumberStart(number4) {
112149
+ return VALID_PHONE_NUMBER_START_REG_EXP.test(number4);
112150
+ }
112151
+
112152
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js
112153
+ var EXTN_PATTERN = new RegExp("(?:" + createExtensionPattern() + ")$", "i");
112154
+ function extractExtension(number4) {
112155
+ var start = number4.search(EXTN_PATTERN);
112156
+ if (start < 0) {
112157
+ return {};
112158
+ }
112159
+ var numberWithoutExtension = number4.slice(0, start);
112160
+ var matches = number4.match(EXTN_PATTERN);
112161
+ var i2 = 1;
112162
+ while (i2 < matches.length) {
112163
+ if (matches[i2]) {
112164
+ return {
112165
+ number: numberWithoutExtension,
112166
+ ext: matches[i2]
112167
+ };
112168
+ }
112169
+ i2++;
112170
+ }
112171
+ }
112172
+
112173
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/parseDigits.js
112174
+ var DIGITS = {
112175
+ "0": "0",
112176
+ "1": "1",
112177
+ "2": "2",
112178
+ "3": "3",
112179
+ "4": "4",
112180
+ "5": "5",
112181
+ "6": "6",
112182
+ "7": "7",
112183
+ "8": "8",
112184
+ "9": "9",
112185
+ "\uFF10": "0",
112186
+ "\uFF11": "1",
112187
+ "\uFF12": "2",
112188
+ "\uFF13": "3",
112189
+ "\uFF14": "4",
112190
+ "\uFF15": "5",
112191
+ "\uFF16": "6",
112192
+ "\uFF17": "7",
112193
+ "\uFF18": "8",
112194
+ "\uFF19": "9",
112195
+ "\u0660": "0",
112196
+ "\u0661": "1",
112197
+ "\u0662": "2",
112198
+ "\u0663": "3",
112199
+ "\u0664": "4",
112200
+ "\u0665": "5",
112201
+ "\u0666": "6",
112202
+ "\u0667": "7",
112203
+ "\u0668": "8",
112204
+ "\u0669": "9",
112205
+ "\u06F0": "0",
112206
+ "\u06F1": "1",
112207
+ "\u06F2": "2",
112208
+ "\u06F3": "3",
112209
+ "\u06F4": "4",
112210
+ "\u06F5": "5",
112211
+ "\u06F6": "6",
112212
+ "\u06F7": "7",
112213
+ "\u06F8": "8",
112214
+ "\u06F9": "9"
112215
+ };
112216
+ function parseDigit(character) {
112217
+ return DIGITS[character];
112218
+ }
112219
+
112220
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js
112029
112221
  function _createForOfIteratorHelperLoose(r3, e4) {
112030
112222
  var t9 = typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
112031
112223
  if (t9)
112032
112224
  return (t9 = t9.call(r3)).next.bind(t9);
112033
- if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray(r3)) || e4 && r3 && typeof r3.length == "number") {
112225
+ if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray2(r3)) || e4 && r3 && typeof r3.length == "number") {
112034
112226
  t9 && (r3 = t9);
112035
112227
  var o = 0;
112036
112228
  return function() {
@@ -112040,15 +112232,64 @@ function _createForOfIteratorHelperLoose(r3, e4) {
112040
112232
  throw new TypeError(`Invalid attempt to iterate non-iterable instance.
112041
112233
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
112042
112234
  }
112043
- function _unsupportedIterableToArray(r3, a) {
112235
+ function _unsupportedIterableToArray2(r3, a) {
112044
112236
  if (r3) {
112045
112237
  if (typeof r3 == "string")
112046
- return _arrayLikeToArray(r3, a);
112238
+ return _arrayLikeToArray2(r3, a);
112047
112239
  var t9 = {}.toString.call(r3).slice(8, -1);
112048
- return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray(r3, a) : undefined;
112240
+ return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray2(r3, a) : undefined;
112049
112241
  }
112050
112242
  }
112051
- function _arrayLikeToArray(r3, a) {
112243
+ function _arrayLikeToArray2(r3, a) {
112244
+ (a == null || a > r3.length) && (a = r3.length);
112245
+ for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
112246
+ n7[e4] = r3[e4];
112247
+ return n7;
112248
+ }
112249
+ function parseIncompletePhoneNumber(string4) {
112250
+ var result = "";
112251
+ for (var _iterator = _createForOfIteratorHelperLoose(string4.split("")), _step;!(_step = _iterator()).done; ) {
112252
+ var character = _step.value;
112253
+ result += parsePhoneNumberCharacter(character, result) || "";
112254
+ }
112255
+ return result;
112256
+ }
112257
+ function parsePhoneNumberCharacter(character, prevParsedCharacters, eventListener) {
112258
+ if (character === "+") {
112259
+ if (prevParsedCharacters) {
112260
+ if (typeof eventListener === "function") {
112261
+ eventListener("end");
112262
+ }
112263
+ return;
112264
+ }
112265
+ return "+";
112266
+ }
112267
+ return parseDigit(character);
112268
+ }
112269
+ // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/mergeArrays.js
112270
+ function _createForOfIteratorHelperLoose2(r3, e4) {
112271
+ var t9 = typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
112272
+ if (t9)
112273
+ return (t9 = t9.call(r3)).next.bind(t9);
112274
+ if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray3(r3)) || e4 && r3 && typeof r3.length == "number") {
112275
+ t9 && (r3 = t9);
112276
+ var o = 0;
112277
+ return function() {
112278
+ return o >= r3.length ? { done: true } : { done: false, value: r3[o++] };
112279
+ };
112280
+ }
112281
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
112282
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
112283
+ }
112284
+ function _unsupportedIterableToArray3(r3, a) {
112285
+ if (r3) {
112286
+ if (typeof r3 == "string")
112287
+ return _arrayLikeToArray3(r3, a);
112288
+ var t9 = {}.toString.call(r3).slice(8, -1);
112289
+ return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray3(r3, a) : undefined;
112290
+ }
112291
+ }
112292
+ function _arrayLikeToArray3(r3, a) {
112052
112293
  (a == null || a > r3.length) && (a = r3.length);
112053
112294
  for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
112054
112295
  n7[e4] = r3[e4];
@@ -112056,7 +112297,7 @@ function _arrayLikeToArray(r3, a) {
112056
112297
  }
112057
112298
  function mergeArrays(a, b) {
112058
112299
  var merged = a.slice();
112059
- for (var _iterator = _createForOfIteratorHelperLoose(b), _step;!(_step = _iterator()).done; ) {
112300
+ for (var _iterator = _createForOfIteratorHelperLoose2(b), _step;!(_step = _iterator()).done; ) {
112060
112301
  var element = _step.value;
112061
112302
  if (a.indexOf(element) < 0) {
112062
112303
  merged.push(element);
@@ -112159,11 +112400,11 @@ function matchesEntirely(text, regularExpressionText) {
112159
112400
  }
112160
112401
 
112161
112402
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/getNumberType.js
112162
- function _createForOfIteratorHelperLoose2(r3, e4) {
112403
+ function _createForOfIteratorHelperLoose3(r3, e4) {
112163
112404
  var t9 = typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
112164
112405
  if (t9)
112165
112406
  return (t9 = t9.call(r3)).next.bind(t9);
112166
- if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray2(r3)) || e4 && r3 && typeof r3.length == "number") {
112407
+ if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray4(r3)) || e4 && r3 && typeof r3.length == "number") {
112167
112408
  t9 && (r3 = t9);
112168
112409
  var o = 0;
112169
112410
  return function() {
@@ -112173,15 +112414,15 @@ function _createForOfIteratorHelperLoose2(r3, e4) {
112173
112414
  throw new TypeError(`Invalid attempt to iterate non-iterable instance.
112174
112415
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
112175
112416
  }
112176
- function _unsupportedIterableToArray2(r3, a) {
112417
+ function _unsupportedIterableToArray4(r3, a) {
112177
112418
  if (r3) {
112178
112419
  if (typeof r3 == "string")
112179
- return _arrayLikeToArray2(r3, a);
112420
+ return _arrayLikeToArray4(r3, a);
112180
112421
  var t9 = {}.toString.call(r3).slice(8, -1);
112181
- return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray2(r3, a) : undefined;
112422
+ return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray4(r3, a) : undefined;
112182
112423
  }
112183
112424
  }
112184
- function _arrayLikeToArray2(r3, a) {
112425
+ function _arrayLikeToArray4(r3, a) {
112185
112426
  (a == null || a > r3.length) && (a = r3.length);
112186
112427
  for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
112187
112428
  n7[e4] = r3[e4];
@@ -112211,7 +112452,7 @@ function getNumberType(input, options, metadata) {
112211
112452
  }
112212
112453
  return "FIXED_LINE";
112213
112454
  }
112214
- for (var _iterator = _createForOfIteratorHelperLoose2(NON_FIXED_LINE_PHONE_TYPES), _step;!(_step = _iterator()).done; ) {
112455
+ for (var _iterator = _createForOfIteratorHelperLoose3(NON_FIXED_LINE_PHONE_TYPES), _step;!(_step = _iterator()).done; ) {
112215
112456
  var type = _step.value;
112216
112457
  if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
112217
112458
  return type;
@@ -112261,20 +112502,6 @@ function couldNationalNumberBelongToCountry(nationalNumber, country, metadata) {
112261
112502
  return false;
112262
112503
  }
112263
112504
 
112264
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/constants.js
112265
- var MIN_LENGTH_FOR_NSN = 2;
112266
- var MAX_LENGTH_FOR_NSN = 17;
112267
- var MAX_LENGTH_COUNTRY_CODE = 3;
112268
- var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9";
112269
- var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
112270
- var SLASHES = "\uFF0F/";
112271
- var DOTS = "\uFF0E.";
112272
- var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
112273
- var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]";
112274
- var TILDES = "~\u2053\u223C\uFF5E";
112275
- var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
112276
- var PLUS_CHARS = "+\uFF0B";
112277
-
112278
112505
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js
112279
112506
  var CAPTURING_DIGIT_PATTERN = new RegExp("([" + VALID_DIGITS + "])");
112280
112507
  function stripIddPrefix(number4, country, callingCode, metadata) {
@@ -112342,11 +112569,11 @@ function extractNationalNumberFromPossiblyIncompleteNumber(number4, metadata) {
112342
112569
  }
112343
112570
 
112344
112571
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js
112345
- function _createForOfIteratorHelperLoose3(r3, e4) {
112572
+ function _createForOfIteratorHelperLoose4(r3, e4) {
112346
112573
  var t9 = typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
112347
112574
  if (t9)
112348
112575
  return (t9 = t9.call(r3)).next.bind(t9);
112349
- if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray3(r3)) || e4 && r3 && typeof r3.length == "number") {
112576
+ if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray5(r3)) || e4 && r3 && typeof r3.length == "number") {
112350
112577
  t9 && (r3 = t9);
112351
112578
  var o = 0;
112352
112579
  return function() {
@@ -112356,15 +112583,15 @@ function _createForOfIteratorHelperLoose3(r3, e4) {
112356
112583
  throw new TypeError(`Invalid attempt to iterate non-iterable instance.
112357
112584
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
112358
112585
  }
112359
- function _unsupportedIterableToArray3(r3, a) {
112586
+ function _unsupportedIterableToArray5(r3, a) {
112360
112587
  if (r3) {
112361
112588
  if (typeof r3 == "string")
112362
- return _arrayLikeToArray3(r3, a);
112589
+ return _arrayLikeToArray5(r3, a);
112363
112590
  var t9 = {}.toString.call(r3).slice(8, -1);
112364
- return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray3(r3, a) : undefined;
112591
+ return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray5(r3, a) : undefined;
112365
112592
  }
112366
112593
  }
112367
- function _arrayLikeToArray3(r3, a) {
112594
+ function _arrayLikeToArray5(r3, a) {
112368
112595
  (a == null || a > r3.length) && (a = r3.length);
112369
112596
  for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
112370
112597
  n7[e4] = r3[e4];
@@ -112373,7 +112600,7 @@ function _arrayLikeToArray3(r3, a) {
112373
112600
  function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
112374
112601
  var { countries, metadata } = _ref;
112375
112602
  metadata = new Metadata(metadata);
112376
- for (var _iterator = _createForOfIteratorHelperLoose3(countries), _step;!(_step = _iterator()).done; ) {
112603
+ for (var _iterator = _createForOfIteratorHelperLoose4(countries), _step;!(_step = _iterator()).done; ) {
112377
112604
  var country = _step.value;
112378
112605
  metadata.selectNumberingPlan(country);
112379
112606
  if (metadata.leadingDigits()) {
@@ -112454,6 +112681,7 @@ function isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {
112454
112681
  return true;
112455
112682
  }
112456
112683
  }
112684
+
112457
112685
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js
112458
112686
  function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number4, country, defaultCountry, defaultCallingCode, metadata) {
112459
112687
  var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadata) : defaultCallingCode;
@@ -112551,46 +112779,6 @@ function getIddPrefix(country, callingCode, metadata) {
112551
112779
  }
112552
112780
  }
112553
112781
 
112554
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js
112555
- var RFC3966_EXTN_PREFIX = ";ext=";
112556
- var getExtensionDigitsPattern = function getExtensionDigitsPattern2(maxLength) {
112557
- return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
112558
- };
112559
- function createExtensionPattern(purpose) {
112560
- var extLimitAfterExplicitLabel = "20";
112561
- var extLimitAfterLikelyLabel = "15";
112562
- var extLimitAfterAmbiguousChar = "9";
112563
- var extLimitWhenNotSure = "6";
112564
- var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*";
112565
- var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*";
112566
- var optionalExtnSuffix = "#?";
112567
- var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)";
112568
- var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)";
112569
- var ambiguousSeparator = "[- ]+";
112570
- var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*";
112571
- var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
112572
- var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
112573
- var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
112574
- var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
112575
- var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
112576
- var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
112577
- var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
112578
- return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
112579
- }
112580
-
112581
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js
112582
- var MIN_LENGTH_PHONE_NUMBER_PATTERN = "[" + VALID_DIGITS + "]{" + MIN_LENGTH_FOR_NSN + "}";
112583
- var VALID_PHONE_NUMBER = "[" + PLUS_CHARS + "]{0,1}" + "(?:" + "[" + VALID_PUNCTUATION + "]*" + "[" + VALID_DIGITS + "]" + "){3,}" + "[" + VALID_PUNCTUATION + VALID_DIGITS + "]*";
112584
- var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp("^" + "[" + PLUS_CHARS + "]{0,1}" + "(?:" + "[" + VALID_PUNCTUATION + "]*" + "[" + VALID_DIGITS + "]" + "){1,2}" + "$", "i");
112585
- var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + "(?:" + createExtensionPattern() + ")?";
112586
- var VALID_PHONE_NUMBER_PATTERN = new RegExp("^" + MIN_LENGTH_PHONE_NUMBER_PATTERN + "$" + "|" + "^" + VALID_PHONE_NUMBER_WITH_EXTENSION + "$", "i");
112587
- function isViablePhoneNumber(number4) {
112588
- return number4.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number4);
112589
- }
112590
- function isViablePhoneNumberStart(number4) {
112591
- return VALID_PHONE_NUMBER_START_REG_EXP.test(number4);
112592
- }
112593
-
112594
112782
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/RFC3966.js
112595
112783
  function formatRFC3966(_ref) {
112596
112784
  var { number: number4, ext } = _ref;
@@ -112728,15 +112916,15 @@ function pickFirstMatchingElement(elements, testFunction) {
112728
112916
  }
112729
112917
 
112730
112918
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/PhoneNumber.js
112731
- function _typeof2(o) {
112919
+ function _typeof4(o) {
112732
112920
  "@babel/helpers - typeof";
112733
- return _typeof2 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
112921
+ return _typeof4 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
112734
112922
  return typeof o2;
112735
112923
  } : function(o2) {
112736
112924
  return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
112737
- }, _typeof2(o);
112925
+ }, _typeof4(o);
112738
112926
  }
112739
- function ownKeys(e4, r3) {
112927
+ function ownKeys2(e4, r3) {
112740
112928
  var t9 = Object.keys(e4);
112741
112929
  if (Object.getOwnPropertySymbols) {
112742
112930
  var o = Object.getOwnPropertySymbols(e4);
@@ -112746,44 +112934,44 @@ function ownKeys(e4, r3) {
112746
112934
  }
112747
112935
  return t9;
112748
112936
  }
112749
- function _objectSpread(e4) {
112937
+ function _objectSpread2(e4) {
112750
112938
  for (var r3 = 1;r3 < arguments.length; r3++) {
112751
112939
  var t9 = arguments[r3] != null ? arguments[r3] : {};
112752
- r3 % 2 ? ownKeys(Object(t9), true).forEach(function(r4) {
112753
- _defineProperty(e4, r4, t9[r4]);
112754
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e4, Object.getOwnPropertyDescriptors(t9)) : ownKeys(Object(t9)).forEach(function(r4) {
112940
+ r3 % 2 ? ownKeys2(Object(t9), true).forEach(function(r4) {
112941
+ _defineProperty2(e4, r4, t9[r4]);
112942
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e4, Object.getOwnPropertyDescriptors(t9)) : ownKeys2(Object(t9)).forEach(function(r4) {
112755
112943
  Object.defineProperty(e4, r4, Object.getOwnPropertyDescriptor(t9, r4));
112756
112944
  });
112757
112945
  }
112758
112946
  return e4;
112759
112947
  }
112760
- function _defineProperty(e4, r3, t9) {
112761
- return (r3 = _toPropertyKey2(r3)) in e4 ? Object.defineProperty(e4, r3, { value: t9, enumerable: true, configurable: true, writable: true }) : e4[r3] = t9, e4;
112948
+ function _defineProperty2(e4, r3, t9) {
112949
+ return (r3 = _toPropertyKey4(r3)) in e4 ? Object.defineProperty(e4, r3, { value: t9, enumerable: true, configurable: true, writable: true }) : e4[r3] = t9, e4;
112762
112950
  }
112763
- function _classCallCheck2(a, n7) {
112951
+ function _classCallCheck3(a, n7) {
112764
112952
  if (!(a instanceof n7))
112765
112953
  throw new TypeError("Cannot call a class as a function");
112766
112954
  }
112767
- function _defineProperties2(e4, r3) {
112955
+ function _defineProperties3(e4, r3) {
112768
112956
  for (var t9 = 0;t9 < r3.length; t9++) {
112769
112957
  var o = r3[t9];
112770
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey2(o.key), o);
112958
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey4(o.key), o);
112771
112959
  }
112772
112960
  }
112773
- function _createClass2(e4, r3, t9) {
112774
- return r3 && _defineProperties2(e4.prototype, r3), t9 && _defineProperties2(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
112961
+ function _createClass3(e4, r3, t9) {
112962
+ return r3 && _defineProperties3(e4.prototype, r3), t9 && _defineProperties3(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
112775
112963
  }
112776
- function _toPropertyKey2(t9) {
112777
- var i2 = _toPrimitive2(t9, "string");
112778
- return _typeof2(i2) == "symbol" ? i2 : i2 + "";
112964
+ function _toPropertyKey4(t9) {
112965
+ var i2 = _toPrimitive4(t9, "string");
112966
+ return _typeof4(i2) == "symbol" ? i2 : i2 + "";
112779
112967
  }
112780
- function _toPrimitive2(t9, r3) {
112781
- if (_typeof2(t9) != "object" || !t9)
112968
+ function _toPrimitive4(t9, r3) {
112969
+ if (_typeof4(t9) != "object" || !t9)
112782
112970
  return t9;
112783
112971
  var e4 = t9[Symbol.toPrimitive];
112784
112972
  if (e4 !== undefined) {
112785
112973
  var i2 = e4.call(t9, r3 || "default");
112786
- if (_typeof2(i2) != "object")
112974
+ if (_typeof4(i2) != "object")
112787
112975
  return i2;
112788
112976
  throw new TypeError("@@toPrimitive must return a primitive value.");
112789
112977
  }
@@ -112792,7 +112980,7 @@ function _toPrimitive2(t9, r3) {
112792
112980
  var USE_NON_GEOGRAPHIC_COUNTRY_CODE2 = false;
112793
112981
  var PhoneNumber = /* @__PURE__ */ function() {
112794
112982
  function PhoneNumber2(countryOrCountryCallingCode, nationalNumber, metadata) {
112795
- _classCallCheck2(this, PhoneNumber2);
112983
+ _classCallCheck3(this, PhoneNumber2);
112796
112984
  if (!countryOrCountryCallingCode) {
112797
112985
  throw new TypeError("First argument is required");
112798
112986
  }
@@ -112831,7 +113019,7 @@ var PhoneNumber = /* @__PURE__ */ function() {
112831
113019
  return metadata;
112832
113020
  };
112833
113021
  }
112834
- return _createClass2(PhoneNumber2, [{
113022
+ return _createClass3(PhoneNumber2, [{
112835
113023
  key: "setExt",
112836
113024
  value: function setExt(ext) {
112837
113025
  this.ext = ext;
@@ -112879,7 +113067,7 @@ var PhoneNumber = /* @__PURE__ */ function() {
112879
113067
  }, {
112880
113068
  key: "format",
112881
113069
  value: function format(_format, options) {
112882
- return formatNumber(this, _format, options ? _objectSpread(_objectSpread({}, options), {}, {
113070
+ return formatNumber(this, _format, options ? _objectSpread2(_objectSpread2({}, options), {}, {
112883
113071
  v2: true
112884
113072
  }) : {
112885
113073
  v2: true
@@ -112928,246 +113116,6 @@ function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJs
112928
113116
  }
112929
113117
  var E164_NUMBER_REGEXP = /^\+\d+$/;
112930
113118
 
112931
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/ParseError.js
112932
- function _typeof3(o) {
112933
- "@babel/helpers - typeof";
112934
- return _typeof3 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
112935
- return typeof o2;
112936
- } : function(o2) {
112937
- return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
112938
- }, _typeof3(o);
112939
- }
112940
- function _defineProperties3(e4, r3) {
112941
- for (var t9 = 0;t9 < r3.length; t9++) {
112942
- var o = r3[t9];
112943
- o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e4, _toPropertyKey3(o.key), o);
112944
- }
112945
- }
112946
- function _createClass3(e4, r3, t9) {
112947
- return r3 && _defineProperties3(e4.prototype, r3), t9 && _defineProperties3(e4, t9), Object.defineProperty(e4, "prototype", { writable: false }), e4;
112948
- }
112949
- function _toPropertyKey3(t9) {
112950
- var i2 = _toPrimitive3(t9, "string");
112951
- return _typeof3(i2) == "symbol" ? i2 : i2 + "";
112952
- }
112953
- function _toPrimitive3(t9, r3) {
112954
- if (_typeof3(t9) != "object" || !t9)
112955
- return t9;
112956
- var e4 = t9[Symbol.toPrimitive];
112957
- if (e4 !== undefined) {
112958
- var i2 = e4.call(t9, r3 || "default");
112959
- if (_typeof3(i2) != "object")
112960
- return i2;
112961
- throw new TypeError("@@toPrimitive must return a primitive value.");
112962
- }
112963
- return (r3 === "string" ? String : Number)(t9);
112964
- }
112965
- function _classCallCheck3(a, n7) {
112966
- if (!(a instanceof n7))
112967
- throw new TypeError("Cannot call a class as a function");
112968
- }
112969
- function _callSuper(t9, o, e4) {
112970
- return o = _getPrototypeOf(o), _possibleConstructorReturn(t9, _isNativeReflectConstruct() ? Reflect.construct(o, e4 || [], _getPrototypeOf(t9).constructor) : o.apply(t9, e4));
112971
- }
112972
- function _possibleConstructorReturn(t9, e4) {
112973
- if (e4 && (_typeof3(e4) == "object" || typeof e4 == "function"))
112974
- return e4;
112975
- if (e4 !== undefined)
112976
- throw new TypeError("Derived constructors may only return object or undefined");
112977
- return _assertThisInitialized(t9);
112978
- }
112979
- function _assertThisInitialized(e4) {
112980
- if (e4 === undefined)
112981
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
112982
- return e4;
112983
- }
112984
- function _inherits(t9, e4) {
112985
- if (typeof e4 != "function" && e4 !== null)
112986
- throw new TypeError("Super expression must either be null or a function");
112987
- t9.prototype = Object.create(e4 && e4.prototype, { constructor: { value: t9, writable: true, configurable: true } }), Object.defineProperty(t9, "prototype", { writable: false }), e4 && _setPrototypeOf(t9, e4);
112988
- }
112989
- function _wrapNativeSuper(t9) {
112990
- var r3 = typeof Map == "function" ? new Map : undefined;
112991
- return _wrapNativeSuper = function _wrapNativeSuper2(t10) {
112992
- if (t10 === null || !_isNativeFunction(t10))
112993
- return t10;
112994
- if (typeof t10 != "function")
112995
- throw new TypeError("Super expression must either be null or a function");
112996
- if (r3 !== undefined) {
112997
- if (r3.has(t10))
112998
- return r3.get(t10);
112999
- r3.set(t10, Wrapper);
113000
- }
113001
- function Wrapper() {
113002
- return _construct(t10, arguments, _getPrototypeOf(this).constructor);
113003
- }
113004
- return Wrapper.prototype = Object.create(t10.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }), _setPrototypeOf(Wrapper, t10);
113005
- }, _wrapNativeSuper(t9);
113006
- }
113007
- function _construct(t9, e4, r3) {
113008
- if (_isNativeReflectConstruct())
113009
- return Reflect.construct.apply(null, arguments);
113010
- var o = [null];
113011
- o.push.apply(o, e4);
113012
- var p = new (t9.bind.apply(t9, o));
113013
- return r3 && _setPrototypeOf(p, r3.prototype), p;
113014
- }
113015
- function _isNativeReflectConstruct() {
113016
- try {
113017
- var t9 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
113018
- } catch (t10) {}
113019
- return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
113020
- return !!t9;
113021
- })();
113022
- }
113023
- function _isNativeFunction(t9) {
113024
- try {
113025
- return Function.toString.call(t9).indexOf("[native code]") !== -1;
113026
- } catch (n7) {
113027
- return typeof t9 == "function";
113028
- }
113029
- }
113030
- function _setPrototypeOf(t9, e4) {
113031
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t10, e5) {
113032
- return t10.__proto__ = e5, t10;
113033
- }, _setPrototypeOf(t9, e4);
113034
- }
113035
- function _getPrototypeOf(t9) {
113036
- return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t10) {
113037
- return t10.__proto__ || Object.getPrototypeOf(t10);
113038
- }, _getPrototypeOf(t9);
113039
- }
113040
- var ParseError = /* @__PURE__ */ function(_Error) {
113041
- function ParseError2(code) {
113042
- var _this;
113043
- _classCallCheck3(this, ParseError2);
113044
- _this = _callSuper(this, ParseError2, [code]);
113045
- Object.setPrototypeOf(_this, ParseError2.prototype);
113046
- _this.name = _this.constructor.name;
113047
- return _this;
113048
- }
113049
- _inherits(ParseError2, _Error);
113050
- return _createClass3(ParseError2);
113051
- }(/* @__PURE__ */ _wrapNativeSuper(Error));
113052
-
113053
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js
113054
- var EXTN_PATTERN = new RegExp("(?:" + createExtensionPattern() + ")$", "i");
113055
- function extractExtension(number4) {
113056
- var start = number4.search(EXTN_PATTERN);
113057
- if (start < 0) {
113058
- return {};
113059
- }
113060
- var numberWithoutExtension = number4.slice(0, start);
113061
- var matches = number4.match(EXTN_PATTERN);
113062
- var i2 = 1;
113063
- while (i2 < matches.length) {
113064
- if (matches[i2]) {
113065
- return {
113066
- number: numberWithoutExtension,
113067
- ext: matches[i2]
113068
- };
113069
- }
113070
- i2++;
113071
- }
113072
- }
113073
-
113074
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/parseDigits.js
113075
- var DIGITS = {
113076
- "0": "0",
113077
- "1": "1",
113078
- "2": "2",
113079
- "3": "3",
113080
- "4": "4",
113081
- "5": "5",
113082
- "6": "6",
113083
- "7": "7",
113084
- "8": "8",
113085
- "9": "9",
113086
- "\uFF10": "0",
113087
- "\uFF11": "1",
113088
- "\uFF12": "2",
113089
- "\uFF13": "3",
113090
- "\uFF14": "4",
113091
- "\uFF15": "5",
113092
- "\uFF16": "6",
113093
- "\uFF17": "7",
113094
- "\uFF18": "8",
113095
- "\uFF19": "9",
113096
- "\u0660": "0",
113097
- "\u0661": "1",
113098
- "\u0662": "2",
113099
- "\u0663": "3",
113100
- "\u0664": "4",
113101
- "\u0665": "5",
113102
- "\u0666": "6",
113103
- "\u0667": "7",
113104
- "\u0668": "8",
113105
- "\u0669": "9",
113106
- "\u06F0": "0",
113107
- "\u06F1": "1",
113108
- "\u06F2": "2",
113109
- "\u06F3": "3",
113110
- "\u06F4": "4",
113111
- "\u06F5": "5",
113112
- "\u06F6": "6",
113113
- "\u06F7": "7",
113114
- "\u06F8": "8",
113115
- "\u06F9": "9"
113116
- };
113117
- function parseDigit(character) {
113118
- return DIGITS[character];
113119
- }
113120
-
113121
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js
113122
- function _createForOfIteratorHelperLoose4(r3, e4) {
113123
- var t9 = typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
113124
- if (t9)
113125
- return (t9 = t9.call(r3)).next.bind(t9);
113126
- if (Array.isArray(r3) || (t9 = _unsupportedIterableToArray4(r3)) || e4 && r3 && typeof r3.length == "number") {
113127
- t9 && (r3 = t9);
113128
- var o = 0;
113129
- return function() {
113130
- return o >= r3.length ? { done: true } : { done: false, value: r3[o++] };
113131
- };
113132
- }
113133
- throw new TypeError(`Invalid attempt to iterate non-iterable instance.
113134
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
113135
- }
113136
- function _unsupportedIterableToArray4(r3, a) {
113137
- if (r3) {
113138
- if (typeof r3 == "string")
113139
- return _arrayLikeToArray4(r3, a);
113140
- var t9 = {}.toString.call(r3).slice(8, -1);
113141
- return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray4(r3, a) : undefined;
113142
- }
113143
- }
113144
- function _arrayLikeToArray4(r3, a) {
113145
- (a == null || a > r3.length) && (a = r3.length);
113146
- for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
113147
- n7[e4] = r3[e4];
113148
- return n7;
113149
- }
113150
- function parseIncompletePhoneNumber(string4) {
113151
- var result = "";
113152
- for (var _iterator = _createForOfIteratorHelperLoose4(string4.split("")), _step;!(_step = _iterator()).done; ) {
113153
- var character = _step.value;
113154
- result += parsePhoneNumberCharacter(character, result) || "";
113155
- }
113156
- return result;
113157
- }
113158
- function parsePhoneNumberCharacter(character, prevParsedCharacters, eventListener) {
113159
- if (character === "+") {
113160
- if (prevParsedCharacters) {
113161
- if (typeof eventListener === "function") {
113162
- eventListener("end");
113163
- }
113164
- return;
113165
- }
113166
- return "+";
113167
- }
113168
- return parseDigit(character);
113169
- }
113170
-
113171
113119
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js
113172
113120
  var PLUS_SIGN = "+";
113173
113121
  var RFC3966_VISUAL_SEPARATOR_ = "[\\-\\.\\(\\)]?";
@@ -113414,61 +113362,6 @@ function parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCo
113414
113362
  }
113415
113363
 
113416
113364
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js
113417
- function _typeof4(o) {
113418
- "@babel/helpers - typeof";
113419
- return _typeof4 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
113420
- return typeof o2;
113421
- } : function(o2) {
113422
- return o2 && typeof Symbol == "function" && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
113423
- }, _typeof4(o);
113424
- }
113425
- function ownKeys2(e4, r3) {
113426
- var t9 = Object.keys(e4);
113427
- if (Object.getOwnPropertySymbols) {
113428
- var o = Object.getOwnPropertySymbols(e4);
113429
- r3 && (o = o.filter(function(r4) {
113430
- return Object.getOwnPropertyDescriptor(e4, r4).enumerable;
113431
- })), t9.push.apply(t9, o);
113432
- }
113433
- return t9;
113434
- }
113435
- function _objectSpread2(e4) {
113436
- for (var r3 = 1;r3 < arguments.length; r3++) {
113437
- var t9 = arguments[r3] != null ? arguments[r3] : {};
113438
- r3 % 2 ? ownKeys2(Object(t9), true).forEach(function(r4) {
113439
- _defineProperty2(e4, r4, t9[r4]);
113440
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e4, Object.getOwnPropertyDescriptors(t9)) : ownKeys2(Object(t9)).forEach(function(r4) {
113441
- Object.defineProperty(e4, r4, Object.getOwnPropertyDescriptor(t9, r4));
113442
- });
113443
- }
113444
- return e4;
113445
- }
113446
- function _defineProperty2(e4, r3, t9) {
113447
- return (r3 = _toPropertyKey4(r3)) in e4 ? Object.defineProperty(e4, r3, { value: t9, enumerable: true, configurable: true, writable: true }) : e4[r3] = t9, e4;
113448
- }
113449
- function _toPropertyKey4(t9) {
113450
- var i2 = _toPrimitive4(t9, "string");
113451
- return _typeof4(i2) == "symbol" ? i2 : i2 + "";
113452
- }
113453
- function _toPrimitive4(t9, r3) {
113454
- if (_typeof4(t9) != "object" || !t9)
113455
- return t9;
113456
- var e4 = t9[Symbol.toPrimitive];
113457
- if (e4 !== undefined) {
113458
- var i2 = e4.call(t9, r3 || "default");
113459
- if (_typeof4(i2) != "object")
113460
- return i2;
113461
- throw new TypeError("@@toPrimitive must return a primitive value.");
113462
- }
113463
- return (r3 === "string" ? String : Number)(t9);
113464
- }
113465
- function parsePhoneNumberWithError(text, options, metadata) {
113466
- return parse5(text, _objectSpread2(_objectSpread2({}, options), {}, {
113467
- v2: true
113468
- }), metadata);
113469
- }
113470
-
113471
- // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/normalizeArguments.js
113472
113365
  function _typeof5(o) {
113473
113366
  "@babel/helpers - typeof";
113474
113367
  return _typeof5 = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(o2) {
@@ -113517,93 +113410,10 @@ function _toPrimitive5(t9, r3) {
113517
113410
  }
113518
113411
  return (r3 === "string" ? String : Number)(t9);
113519
113412
  }
113520
- function _slicedToArray(r3, e4) {
113521
- return _arrayWithHoles(r3) || _iterableToArrayLimit(r3, e4) || _unsupportedIterableToArray5(r3, e4) || _nonIterableRest();
113522
- }
113523
- function _nonIterableRest() {
113524
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
113525
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
113526
- }
113527
- function _unsupportedIterableToArray5(r3, a) {
113528
- if (r3) {
113529
- if (typeof r3 == "string")
113530
- return _arrayLikeToArray5(r3, a);
113531
- var t9 = {}.toString.call(r3).slice(8, -1);
113532
- return t9 === "Object" && r3.constructor && (t9 = r3.constructor.name), t9 === "Map" || t9 === "Set" ? Array.from(r3) : t9 === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t9) ? _arrayLikeToArray5(r3, a) : undefined;
113533
- }
113534
- }
113535
- function _arrayLikeToArray5(r3, a) {
113536
- (a == null || a > r3.length) && (a = r3.length);
113537
- for (var e4 = 0, n7 = Array(a);e4 < a; e4++)
113538
- n7[e4] = r3[e4];
113539
- return n7;
113540
- }
113541
- function _iterableToArrayLimit(r3, l) {
113542
- var t9 = r3 == null ? null : typeof Symbol != "undefined" && r3[Symbol.iterator] || r3["@@iterator"];
113543
- if (t9 != null) {
113544
- var e4, n7, i2, u, a = [], f = true, o = false;
113545
- try {
113546
- if (i2 = (t9 = t9.call(r3)).next, l === 0) {
113547
- if (Object(t9) !== t9)
113548
- return;
113549
- f = false;
113550
- } else
113551
- for (;!(f = (e4 = i2.call(t9)).done) && (a.push(e4.value), a.length !== l); f = true)
113552
- ;
113553
- } catch (r4) {
113554
- o = true, n7 = r4;
113555
- } finally {
113556
- try {
113557
- if (!f && t9["return"] != null && (u = t9["return"](), Object(u) !== u))
113558
- return;
113559
- } finally {
113560
- if (o)
113561
- throw n7;
113562
- }
113563
- }
113564
- return a;
113565
- }
113566
- }
113567
- function _arrayWithHoles(r3) {
113568
- if (Array.isArray(r3))
113569
- return r3;
113570
- }
113571
- function normalizeArguments(args) {
113572
- var _Array$prototype$slic = Array.prototype.slice.call(args), _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4), arg_1 = _Array$prototype$slic2[0], arg_2 = _Array$prototype$slic2[1], arg_3 = _Array$prototype$slic2[2], arg_4 = _Array$prototype$slic2[3];
113573
- var text;
113574
- var options;
113575
- var metadata;
113576
- if (typeof arg_1 === "string") {
113577
- text = arg_1;
113578
- } else
113579
- throw new TypeError("A text for parsing must be a string.");
113580
- if (!arg_2 || typeof arg_2 === "string") {
113581
- if (arg_4) {
113582
- options = arg_3;
113583
- metadata = arg_4;
113584
- } else {
113585
- options = undefined;
113586
- metadata = arg_3;
113587
- }
113588
- if (arg_2) {
113589
- options = _objectSpread3({
113590
- defaultCountry: arg_2
113591
- }, options);
113592
- }
113593
- } else if (isObject2(arg_2)) {
113594
- if (arg_3) {
113595
- options = arg_2;
113596
- metadata = arg_3;
113597
- } else {
113598
- metadata = arg_2;
113599
- }
113600
- } else
113601
- throw new Error("Invalid second argument: ".concat(arg_2));
113602
- return {
113603
- text,
113604
- options,
113605
- metadata
113606
- };
113413
+ function parsePhoneNumberWithError(text, options, metadata) {
113414
+ return parse5(text, _objectSpread3(_objectSpread3({}, options), {}, {
113415
+ v2: true
113416
+ }), metadata);
113607
113417
  }
113608
113418
 
113609
113419
  // ../../node_modules/.bun/libphonenumber-js@1.12.36/node_modules/libphonenumber-js/es6/parsePhoneNumber_.js
@@ -113758,7 +113568,7 @@ function createCallSchemas(config2) {
113758
113568
  const endedFields = exports_external.object({
113759
113569
  end_timestamp: exports_external.coerce.date().catch(new Date(0)),
113760
113570
  duration_ms: exports_external.number().catch(0),
113761
- disconnection_reason: DisconnectionReasonSchema.catch("error_unknown"),
113571
+ disconnection_reason: DisconnectionReasonSchema.catch("unknown"),
113762
113572
  transcript: exports_external.string().optional(),
113763
113573
  transcript_object: exports_external.array(TimestampedUtteranceSchema).optional(),
113764
113574
  scrubbed_transcript_with_tool_calls: exports_external.array(TranscriptEntrySchema).optional(),
@@ -114137,32 +113947,102 @@ var GlobalNodeSettingSchema = exports_external.object({
114137
113947
  negative_finetune_examples: exports_external.array(FinetuneExampleSchema).optional(),
114138
113948
  cool_down: exports_external.number().optional()
114139
113949
  });
114140
- var FlowNodeSchema = exports_external.object({
114141
- id: exports_external.string().optional(),
114142
- name: exports_external.string().optional(),
114143
- type: FlowNodeTypeSchema.optional(),
114144
- instruction: exports_external.object({
114145
- type: FlowInstructionTypeSchema.optional(),
114146
- text: exports_external.string().optional()
114147
- }).optional(),
114148
- display_position: DisplayPositionSchema.nullable().optional(),
114149
- edges: exports_external.array(FlowEdgeSchema).optional(),
114150
- edge: FlowEdgeSchema.optional(),
114151
- else_edge: FlowEdgeSchema.optional(),
114152
- skip_response_edge: FlowEdgeSchema.optional(),
113950
+ var InstructionSchema = exports_external.object({
113951
+ type: FlowInstructionTypeSchema,
113952
+ text: exports_external.string()
113953
+ });
113954
+ var baseNodeFields = {
113955
+ id: exports_external.string(),
113956
+ name: exports_external.string(),
113957
+ display_position: DisplayPositionSchema.default({ x: 0, y: 0 })
113958
+ };
113959
+ var ConversationNodeSchema = exports_external.object({
113960
+ ...baseNodeFields,
113961
+ type: exports_external.literal("conversation"),
113962
+ instruction: InstructionSchema,
113963
+ edges: exports_external.array(FlowEdgeSchema),
114153
113964
  always_edge: FlowEdgeSchema.optional(),
113965
+ skip_response_edge: FlowEdgeSchema.optional(),
114154
113966
  start_speaker: StartSpeakerSchema.optional(),
114155
113967
  interruption_sensitivity: exports_external.number().optional(),
114156
113968
  global_node_setting: GlobalNodeSettingSchema.optional(),
114157
113969
  finetune_transition_examples: exports_external.array(FinetuneExampleSchema).nullable().optional(),
114158
- finetune_conversation_examples: exports_external.array(FinetuneExampleSchema).nullable().optional(),
114159
- tool_id: exports_external.string().optional(),
114160
- tool_type: exports_external.string().optional(),
114161
- speak_during_execution: exports_external.boolean().optional(),
114162
- wait_for_result: exports_external.boolean().optional(),
114163
- transfer_destination: TransferDestinationSchema.optional(),
114164
- transfer_option: TransferOptionSchema.optional()
113970
+ finetune_conversation_examples: exports_external.array(FinetuneExampleSchema).nullable().optional()
113971
+ });
113972
+ var EndNodeSchema = exports_external.object({
113973
+ ...baseNodeFields,
113974
+ type: exports_external.literal("end"),
113975
+ instruction: InstructionSchema.optional(),
113976
+ speak_during_execution: exports_external.boolean().default(false)
114165
113977
  });
113978
+ var FunctionNodeSchema = exports_external.object({
113979
+ ...baseNodeFields,
113980
+ type: exports_external.literal("function"),
113981
+ instruction: InstructionSchema.optional(),
113982
+ tool_id: exports_external.string(),
113983
+ tool_type: exports_external.string(),
113984
+ speak_during_execution: exports_external.boolean().default(false),
113985
+ wait_for_result: exports_external.boolean(),
113986
+ edges: exports_external.array(FlowEdgeSchema),
113987
+ else_edge: FlowEdgeSchema.optional(),
113988
+ global_node_setting: GlobalNodeSettingSchema.optional()
113989
+ });
113990
+ var TransferCallNodeSchema = exports_external.object({
113991
+ ...baseNodeFields,
113992
+ type: exports_external.literal("transfer_call"),
113993
+ instruction: InstructionSchema,
113994
+ transfer_destination: TransferDestinationSchema,
113995
+ transfer_option: TransferOptionSchema,
113996
+ speak_during_execution: exports_external.boolean().default(false),
113997
+ edge: FlowEdgeSchema
113998
+ });
113999
+ var BranchNodeSchema = exports_external.object({
114000
+ ...baseNodeFields,
114001
+ type: exports_external.literal("branch"),
114002
+ edges: exports_external.array(FlowEdgeSchema),
114003
+ else_edge: FlowEdgeSchema
114004
+ });
114005
+ var ComponentNodeSchema = exports_external.object({
114006
+ ...baseNodeFields,
114007
+ type: exports_external.literal("component"),
114008
+ component_id: exports_external.string(),
114009
+ component_type: exports_external.string(),
114010
+ edges: exports_external.array(FlowEdgeSchema),
114011
+ else_edge: FlowEdgeSchema.optional()
114012
+ });
114013
+ var PressDigitNodeSchema = exports_external.looseObject({
114014
+ ...baseNodeFields,
114015
+ type: exports_external.literal("press_digit")
114016
+ });
114017
+ var SmsNodeSchema = exports_external.looseObject({
114018
+ ...baseNodeFields,
114019
+ type: exports_external.literal("sms")
114020
+ });
114021
+ var ExtractDynamicVariablesNodeSchema = exports_external.looseObject({
114022
+ ...baseNodeFields,
114023
+ type: exports_external.literal("extract_dynamic_variables")
114024
+ });
114025
+ var AgentSwapNodeSchema = exports_external.looseObject({
114026
+ ...baseNodeFields,
114027
+ type: exports_external.literal("agent_swap")
114028
+ });
114029
+ var McpNodeSchema = exports_external.looseObject({
114030
+ ...baseNodeFields,
114031
+ type: exports_external.literal("mcp")
114032
+ });
114033
+ var FlowNodeSchema = exports_external.discriminatedUnion("type", [
114034
+ ConversationNodeSchema,
114035
+ EndNodeSchema,
114036
+ FunctionNodeSchema,
114037
+ TransferCallNodeSchema,
114038
+ BranchNodeSchema,
114039
+ ComponentNodeSchema,
114040
+ PressDigitNodeSchema,
114041
+ SmsNodeSchema,
114042
+ ExtractDynamicVariablesNodeSchema,
114043
+ AgentSwapNodeSchema,
114044
+ McpNodeSchema
114045
+ ]);
114166
114046
  var FlowComponentSchema = exports_external.object({
114167
114047
  conversation_flow_component_id: exports_external.string().optional(),
114168
114048
  name: exports_external.string().optional(),
@@ -114172,6 +114052,17 @@ var FlowComponentSchema = exports_external.object({
114172
114052
  start_node_id: exports_external.string().optional(),
114173
114053
  begin_tag_display_position: DisplayPositionSchema.nullable().optional()
114174
114054
  });
114055
+ var ConversationFlowComponentResponseSchema = exports_external.object({
114056
+ conversation_flow_component_id: exports_external.string(),
114057
+ user_modified_timestamp: exports_external.number(),
114058
+ linked_conversation_flow_ids: exports_external.array(exports_external.string()).optional(),
114059
+ name: exports_external.string().optional(),
114060
+ nodes: exports_external.array(FlowNodeSchema).optional(),
114061
+ tools: exports_external.array(LlmToolSchema).nullable().optional(),
114062
+ mcps: exports_external.array(McpConfigSchema).nullable().optional(),
114063
+ start_node_id: exports_external.string().nullable().optional(),
114064
+ begin_tag_display_position: DisplayPositionSchema.nullable().optional()
114065
+ });
114175
114066
  var FlowModelChoiceSchema = exports_external.object({
114176
114067
  type: exports_external.literal("cascading"),
114177
114068
  model: LlmModelSchema,
@@ -114411,8 +114302,11 @@ var llmFieldDocs = {
114411
114302
  tool_call_strict_mode: "Whether to use strict mode for tool calls. Only applicable when using certain supported models."
114412
114303
  };
114413
114304
 
114305
+ // src/lib/flow-helpers.ts
114306
+ import path15 from "path";
114307
+
114414
114308
  // ../../node_modules/.bun/boxen@8.0.1/node_modules/boxen/index.js
114415
- import process5 from "process";
114309
+ import process4 from "process";
114416
114310
 
114417
114311
  // ../../node_modules/.bun/ansi-regex@6.2.2/node_modules/ansi-regex/index.js
114418
114312
  function ansiRegex({ onlyFirst = false } = {}) {
@@ -114954,7 +114848,7 @@ var NEWLINE = `
114954
114848
  var PAD = " ";
114955
114849
  var NONE = "none";
114956
114850
  var terminalColumns = () => {
114957
- const { env: env2, stdout, stderr } = process5;
114851
+ const { env: env2, stdout, stderr } = process4;
114958
114852
  if (stdout?.columns) {
114959
114853
  return stdout.columns;
114960
114854
  }
@@ -115138,8 +115032,8 @@ var boxContent = (content, contentWidth, options) => {
115138
115032
  return result2;
115139
115033
  };
115140
115034
  var sanitizeOptions = (options) => {
115141
- if (options.fullscreen && process5?.stdout) {
115142
- let newDimensions = [process5.stdout.columns, process5.stdout.rows];
115035
+ if (options.fullscreen && process4?.stdout) {
115036
+ let newDimensions = [process4.stdout.columns, process4.stdout.rows];
115143
115037
  if (typeof options.fullscreen === "function") {
115144
115038
  newDimensions = options.fullscreen(...newDimensions);
115145
115039
  }
@@ -115254,7 +115148,7 @@ import path6 from "path";
115254
115148
  import { fileURLToPath as fileURLToPath2 } from "url";
115255
115149
  import v8 from "v8";
115256
115150
  import assert2 from "assert";
115257
- import { format, inspect } from "util";
115151
+ import { format as format3, inspect } from "util";
115258
115152
  import { createRequire } from "module";
115259
115153
 
115260
115154
  // ../../node_modules/.bun/prettier@3.7.4/node_modules/prettier/doc.mjs
@@ -115376,15 +115270,15 @@ var InvalidDocError = class extends Error {
115376
115270
  };
115377
115271
  var invalid_doc_error_default = InvalidDocError;
115378
115272
  var traverseDocOnExitStackMarker = {};
115379
- function traverseDoc(doc2, onEnter, onExit2, shouldTraverseConditionalGroups) {
115273
+ function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) {
115380
115274
  const docsStack = [doc2];
115381
115275
  while (docsStack.length > 0) {
115382
115276
  const doc22 = docsStack.pop();
115383
115277
  if (doc22 === traverseDocOnExitStackMarker) {
115384
- onExit2(docsStack.pop());
115278
+ onExit(docsStack.pop());
115385
115279
  continue;
115386
115280
  }
115387
- if (onExit2) {
115281
+ if (onExit) {
115388
115282
  docsStack.push(doc22, traverseDocOnExitStackMarker);
115389
115283
  }
115390
115284
  const docType = get_doc_type_default(doc22);
@@ -117269,7 +117163,7 @@ var require_fill_range = __commonJS2({
117269
117163
  let padded = zeros(startString) || zeros(endString) || zeros(stepString);
117270
117164
  let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
117271
117165
  let toNumber = padded === false && stringify2(start, end, options8) === false;
117272
- let format3 = options8.transform || transform2(toNumber);
117166
+ let format32 = options8.transform || transform2(toNumber);
117273
117167
  if (options8.toRegex && step === 1) {
117274
117168
  return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options8);
117275
117169
  }
@@ -117281,7 +117175,7 @@ var require_fill_range = __commonJS2({
117281
117175
  if (options8.toRegex === true && step > 1) {
117282
117176
  push2(a5);
117283
117177
  } else {
117284
- range.push(pad(format3(a5, index), maxLen, toNumber));
117178
+ range.push(pad(format32(a5, index), maxLen, toNumber));
117285
117179
  }
117286
117180
  a5 = descending ? a5 - step : a5 + step;
117287
117181
  index++;
@@ -117295,7 +117189,7 @@ var require_fill_range = __commonJS2({
117295
117189
  if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
117296
117190
  return invalidRange(start, end, options8);
117297
117191
  }
117298
- let format3 = options8.transform || ((val) => String.fromCharCode(val));
117192
+ let format32 = options8.transform || ((val) => String.fromCharCode(val));
117299
117193
  let a5 = `${start}`.charCodeAt(0);
117300
117194
  let b7 = `${end}`.charCodeAt(0);
117301
117195
  let descending = a5 > b7;
@@ -117307,7 +117201,7 @@ var require_fill_range = __commonJS2({
117307
117201
  let range = [];
117308
117202
  let index = 0;
117309
117203
  while (descending ? a5 >= b7 : a5 <= b7) {
117310
- range.push(format3(a5, index));
117204
+ range.push(format32(a5, index));
117311
117205
  a5 = descending ? a5 - step : a5 + step;
117312
117206
  index++;
117313
117207
  }
@@ -117561,7 +117455,7 @@ var require_parse = __commonJS2({
117561
117455
  CHAR_NO_BREAK_SPACE,
117562
117456
  CHAR_ZERO_WIDTH_NOBREAK_SPACE
117563
117457
  } = require_constants();
117564
- var parse7 = (input, options8 = {}) => {
117458
+ var parse72 = (input, options8 = {}) => {
117565
117459
  if (typeof input !== "string") {
117566
117460
  throw new TypeError("Expected a string");
117567
117461
  }
@@ -117765,7 +117659,7 @@ var require_parse = __commonJS2({
117765
117659
  push2({ type: "eos" });
117766
117660
  return ast;
117767
117661
  };
117768
- module.exports = parse7;
117662
+ module.exports = parse72;
117769
117663
  }
117770
117664
  });
117771
117665
  var require_braces = __commonJS2({
@@ -117773,7 +117667,7 @@ var require_braces = __commonJS2({
117773
117667
  var stringify2 = require_stringify2();
117774
117668
  var compile = require_compile();
117775
117669
  var expand = require_expand();
117776
- var parse7 = require_parse();
117670
+ var parse72 = require_parse();
117777
117671
  var braces = (input, options8 = {}) => {
117778
117672
  let output = [];
117779
117673
  if (Array.isArray(input)) {
@@ -117793,7 +117687,7 @@ var require_braces = __commonJS2({
117793
117687
  }
117794
117688
  return output;
117795
117689
  };
117796
- braces.parse = (input, options8 = {}) => parse7(input, options8);
117690
+ braces.parse = (input, options8 = {}) => parse72(input, options8);
117797
117691
  braces.stringify = (input, options8 = {}) => {
117798
117692
  if (typeof input === "string") {
117799
117693
  return stringify2(braces.parse(input, options8), options8);
@@ -118370,7 +118264,7 @@ var require_parse2 = __commonJS2({
118370
118264
  var syntaxError2 = (type, char) => {
118371
118265
  return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
118372
118266
  };
118373
- var parse7 = (input, options8) => {
118267
+ var parse72 = (input, options8) => {
118374
118268
  if (typeof input !== "string") {
118375
118269
  throw new TypeError("Expected a string");
118376
118270
  }
@@ -118520,7 +118414,7 @@ var require_parse2 = __commonJS2({
118520
118414
  output = token2.close = `)$))${extglobStar}`;
118521
118415
  }
118522
118416
  if (token2.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
118523
- const expression = parse7(rest, { ...options8, fastpaths: false }).output;
118417
+ const expression = parse72(rest, { ...options8, fastpaths: false }).output;
118524
118418
  output = token2.close = `)${expression})${extglobStar})`;
118525
118419
  }
118526
118420
  if (token2.prev.type === "bos") {
@@ -119049,7 +118943,7 @@ var require_parse2 = __commonJS2({
119049
118943
  }
119050
118944
  return state;
119051
118945
  };
119052
- parse7.fastpaths = (input, options8) => {
118946
+ parse72.fastpaths = (input, options8) => {
119053
118947
  const opts = { ...options8 };
119054
118948
  const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
119055
118949
  const len = input.length;
@@ -119118,14 +119012,14 @@ var require_parse2 = __commonJS2({
119118
119012
  }
119119
119013
  return source2;
119120
119014
  };
119121
- module.exports = parse7;
119015
+ module.exports = parse72;
119122
119016
  }
119123
119017
  });
119124
119018
  var require_picomatch = __commonJS2({
119125
119019
  "node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports, module) {
119126
119020
  var path15 = __require2("path");
119127
119021
  var scan = require_scan();
119128
- var parse7 = require_parse2();
119022
+ var parse72 = require_parse2();
119129
119023
  var utils2 = require_utils2();
119130
119024
  var constants = require_constants2();
119131
119025
  var isObject22 = (val) => val && typeof val === "object" && !Array.isArray(val);
@@ -119191,11 +119085,11 @@ var require_picomatch = __commonJS2({
119191
119085
  return { isMatch: false, output: "" };
119192
119086
  }
119193
119087
  const opts = options8 || {};
119194
- const format3 = opts.format || (posix ? utils2.toPosixSlashes : null);
119088
+ const format32 = opts.format || (posix ? utils2.toPosixSlashes : null);
119195
119089
  let match = input === glob;
119196
- let output = match && format3 ? format3(input) : input;
119090
+ let output = match && format32 ? format32(input) : input;
119197
119091
  if (match === false) {
119198
- output = format3 ? format3(input) : input;
119092
+ output = format32 ? format32(input) : input;
119199
119093
  match = output === glob;
119200
119094
  }
119201
119095
  if (match === false || opts.capture === true) {
@@ -119215,7 +119109,7 @@ var require_picomatch = __commonJS2({
119215
119109
  picomatch.parse = (pattern, options8) => {
119216
119110
  if (Array.isArray(pattern))
119217
119111
  return pattern.map((p4) => picomatch.parse(p4, options8));
119218
- return parse7(pattern, { ...options8, fastpaths: false });
119112
+ return parse72(pattern, { ...options8, fastpaths: false });
119219
119113
  };
119220
119114
  picomatch.scan = (input, options8) => scan(input, options8);
119221
119115
  picomatch.compileRe = (state, options8, returnOutput = false, returnState = false) => {
@@ -119241,10 +119135,10 @@ var require_picomatch = __commonJS2({
119241
119135
  }
119242
119136
  let parsed = { negated: false, fastpaths: true };
119243
119137
  if (options8.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
119244
- parsed.output = parse7.fastpaths(input, options8);
119138
+ parsed.output = parse72.fastpaths(input, options8);
119245
119139
  }
119246
119140
  if (!parsed.output) {
119247
- parsed = parse7(input, options8);
119141
+ parsed = parse72(input, options8);
119248
119142
  }
119249
119143
  return picomatch.compileRe(parsed, options8, returnOutput, returnState);
119250
119144
  };
@@ -123368,9 +123262,9 @@ var require_fnmatch = __commonJS2({
123368
123262
  }
123369
123263
  return ret;
123370
123264
  }
123371
- Minimatch.prototype.parse = parse7;
123265
+ Minimatch.prototype.parse = parse72;
123372
123266
  var SUBPARSE = {};
123373
- function parse7(pattern, isSub) {
123267
+ function parse72(pattern, isSub) {
123374
123268
  var options8 = this.options;
123375
123269
  if (!options8.noglobstar && pattern === "**")
123376
123270
  return GLOBSTAR;
@@ -123842,7 +123736,7 @@ var require_ini = __commonJS2({
123842
123736
  param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
123843
123737
  comment: /^\s*[#;].*$/
123844
123738
  };
123845
- function parse7(file2) {
123739
+ function parse72(file2) {
123846
123740
  return __awaiter(this, undefined, undefined, function() {
123847
123741
  return __generator(this, function(_a7) {
123848
123742
  return [2, new Promise(function(resolve3, reject) {
@@ -123857,7 +123751,7 @@ var require_ini = __commonJS2({
123857
123751
  });
123858
123752
  });
123859
123753
  }
123860
- exports.parse = parse7;
123754
+ exports.parse = parse72;
123861
123755
  function parseSync(file2) {
123862
123756
  return parseString2(fs42.readFileSync(file2, "utf8"));
123863
123757
  }
@@ -124259,7 +124153,7 @@ var require_src = __commonJS2({
124259
124153
  return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
124260
124154
  }
124261
124155
  exports.parseFromFilesSync = parseFromFilesSync;
124262
- function parse7(_filepath, _options) {
124156
+ function parse72(_filepath, _options) {
124263
124157
  if (_options === undefined) {
124264
124158
  _options = {};
124265
124159
  }
@@ -124274,7 +124168,7 @@ var require_src = __commonJS2({
124274
124168
  });
124275
124169
  });
124276
124170
  }
124277
- exports.parse = parse7;
124171
+ exports.parse = parse72;
124278
124172
  function parseSync(_filepath, _options) {
124279
124173
  if (_options === undefined) {
124280
124174
  _options = {};
@@ -125147,7 +125041,7 @@ __export3(index_exports, {
125147
125041
  check: () => check2,
125148
125042
  clearConfigCache: () => clearCache3,
125149
125043
  doc: () => exports_doc,
125150
- format: () => format2,
125044
+ format: () => format22,
125151
125045
  formatWithCursor: () => formatWithCursor2,
125152
125046
  getFileInfo: () => get_file_info_default,
125153
125047
  getSupportInfo: () => getSupportInfo2,
@@ -128785,7 +128679,7 @@ function getMessage(key2, parameters, self2) {
128785
128679
  if (parameters.length === 0)
128786
128680
  return message;
128787
128681
  parameters.unshift(message);
128788
- return Reflect.apply(format, null, parameters);
128682
+ return Reflect.apply(format3, null, parameters);
128789
128683
  }
128790
128684
  function determineSpecificType(value) {
128791
128685
  if (value === null || value === undefined) {
@@ -128951,9 +128845,9 @@ function getFileProtocolModuleFormat(url3, _context, ignoreErrors) {
128951
128845
  }
128952
128846
  return "module";
128953
128847
  }
128954
- const format3 = extensionFormatMap[value];
128955
- if (format3)
128956
- return format3;
128848
+ const format32 = extensionFormatMap[value];
128849
+ if (format32)
128850
+ return format32;
128957
128851
  if (ignoreErrors) {
128958
128852
  return;
128959
128853
  }
@@ -129018,8 +128912,8 @@ function emitLegacyIndexDeprecation(url3, packageJsonUrl, base, main) {
129018
128912
  if (process42.noDeprecation) {
129019
128913
  return;
129020
128914
  }
129021
- const format3 = defaultGetFormatWithoutErrors(url3, { parentURL: base.href });
129022
- if (format3 !== "module")
128915
+ const format32 = defaultGetFormatWithoutErrors(url3, { parentURL: base.href });
128916
+ if (format32 !== "module")
129023
128917
  return;
129024
128918
  const urlPath = fileURLToPath4(url3.href);
129025
128919
  const packagePath = fileURLToPath4(new URL(".", packageJsonUrl));
@@ -129605,11 +129499,11 @@ async function loadExternalConfig(externalConfig, configFile) {
129605
129499
  var load_external_config_default = loadExternalConfig;
129606
129500
  async function loadConfig(configFile) {
129607
129501
  const { base: fileName, ext: extension } = path8.parse(configFile);
129608
- const load2 = fileName === "package.json" ? loadConfigFromPackageJson : fileName === "package.yaml" ? loadConfigFromPackageYaml : loaders_default[extension];
129609
- if (!load2) {
129502
+ const load = fileName === "package.json" ? loadConfigFromPackageJson : fileName === "package.yaml" ? loadConfigFromPackageYaml : loaders_default[extension];
129503
+ if (!load) {
129610
129504
  throw new Error(`No loader specified for extension "${extension || "noExt"}"`);
129611
129505
  }
129612
- let config2 = await load2(configFile);
129506
+ let config2 = await load(configFile);
129613
129507
  if (!config2) {
129614
129508
  return;
129615
129509
  }
@@ -133713,7 +133607,7 @@ function withPlugins(fn9, optionsArgumentIndex = 1) {
133713
133607
  };
133714
133608
  }
133715
133609
  var formatWithCursor2 = withPlugins(formatWithCursor);
133716
- async function format2(text, options8) {
133610
+ async function format22(text, options8) {
133717
133611
  const { formatted } = await formatWithCursor2(text, {
133718
133612
  ...options8,
133719
133613
  cursorOffset: -1
@@ -133721,7 +133615,7 @@ async function format2(text, options8) {
133721
133615
  return formatted;
133722
133616
  }
133723
133617
  async function check2(text, options8) {
133724
- return await format2(text, options8) === text;
133618
+ return await format22(text, options8) === text;
133725
133619
  }
133726
133620
  async function clearCache3() {
133727
133621
  clearCache();
@@ -133935,6 +133829,87 @@ function createFlowVisualization(current, previous, next) {
133935
133829
  `);
133936
133830
  }
133937
133831
 
133832
+ // src/lib/flow-helpers.ts
133833
+ function collectEdges(node) {
133834
+ switch (node.type) {
133835
+ case "conversation":
133836
+ return [
133837
+ ...node.edges ?? [],
133838
+ ...node.always_edge ? [node.always_edge] : []
133839
+ ];
133840
+ case "function":
133841
+ case "branch":
133842
+ case "component":
133843
+ return node.edges ?? [];
133844
+ case "transfer_call":
133845
+ return node.edge ? [node.edge] : [];
133846
+ default:
133847
+ return [];
133848
+ }
133849
+ }
133850
+ async function extractNodePrompts(nodes, dirPath, files) {
133851
+ const nodeNameById = new Map;
133852
+ const incomingEdges = new Map;
133853
+ for (const n8 of nodes) {
133854
+ if (n8.id && n8.name)
133855
+ nodeNameById.set(n8.id, n8.name);
133856
+ for (const edge of collectEdges(n8)) {
133857
+ const destId = edge.destination_node_id;
133858
+ if (destId) {
133859
+ if (!incomingEdges.has(destId))
133860
+ incomingEdges.set(destId, []);
133861
+ if (n8.name)
133862
+ incomingEdges.get(destId).push(n8.name);
133863
+ }
133864
+ }
133865
+ }
133866
+ for (const node of nodes) {
133867
+ if (node.type === "conversation" && node.id && node.instruction?.type === "prompt" && typeof node.instruction.text === "string" && !node.instruction.text.startsWith("file://")) {
133868
+ const nodeHash = node.id.slice(-FILE_HASH_LENGTH);
133869
+ const nodeName = node.name ? `${toSnakeCase(node.name)}_${nodeHash}` : `${node.type}_${nodeHash}`;
133870
+ const nodeFileName = `nodes/${nodeName}.md`;
133871
+ const previous = incomingEdges.get(node.id) ?? [];
133872
+ const next = [
133873
+ ...node.edges ?? [],
133874
+ ...node.always_edge ? [node.always_edge] : []
133875
+ ].map((e31) => e31.destination_node_id ? nodeNameById.get(e31.destination_node_id) : undefined).filter((name) => !!name);
133876
+ const flowViz = node.name ? createFlowVisualization(node.name, previous, next) : undefined;
133877
+ files[path15.join(dirPath, nodeFileName)] = await writeMarkdown(node.instruction.text, { nodeId: node.id, flow: flowViz });
133878
+ node.instruction.text = `file://./${nodeFileName}`;
133879
+ }
133880
+ }
133881
+ }
133882
+ var roundPos = (p4) => ({
133883
+ x: Math.round(p4.x),
133884
+ y: Math.round(p4.y)
133885
+ });
133886
+ async function extractPositions(config2, dirPath, files) {
133887
+ const positions = {};
133888
+ if (config2.begin_tag_display_position) {
133889
+ positions.begin_tag = roundPos(config2.begin_tag_display_position);
133890
+ delete config2.begin_tag_display_position;
133891
+ }
133892
+ if (config2.nodes) {
133893
+ for (const node of config2.nodes) {
133894
+ if (node.id && node.display_position) {
133895
+ (positions.nodes ??= {})[node.id] = roundPos(node.display_position);
133896
+ delete node.display_position;
133897
+ }
133898
+ }
133899
+ }
133900
+ if (config2.components) {
133901
+ for (const comp of config2.components) {
133902
+ if (comp.name && comp.begin_tag_display_position) {
133903
+ (positions.components ??= {})[comp.name] = roundPos(comp.begin_tag_display_position);
133904
+ delete comp.begin_tag_display_position;
133905
+ }
133906
+ }
133907
+ }
133908
+ if (Object.keys(positions).length > 0) {
133909
+ files[path15.join(dirPath, ".positions.json")] = await writeJson(positions);
133910
+ }
133911
+ }
133912
+
133938
133913
  // src/lib/agents.ts
133939
133914
  var RETELL_BASE_URL = "https://api.retellai.com";
133940
133915
  function getApiKey() {
@@ -134182,23 +134157,23 @@ async function getLocalState({
134182
134157
  const agentIdGlob = new Bun.Glob("*/.agent.json");
134183
134158
  for await (const agentIdPath of agentIdGlob.scan(agentsDir)) {
134184
134159
  if (agentIdSet) {
134185
- const metaContent = await Bun.file(path15.join(agentsDir, agentIdPath)).text();
134160
+ const metaContent = await Bun.file(path17.join(agentsDir, agentIdPath)).text();
134186
134161
  const meta3 = zod_default.object({ id: zod_default.string() }).safeParse(JSON.parse(metaContent));
134187
134162
  if (!meta3.success || !agentIdSet.has(meta3.data.id)) {
134188
134163
  continue;
134189
134164
  }
134190
134165
  }
134191
- const agentDirName = path15.dirname(agentIdPath);
134192
- const agentDirFull = path15.join(agentsDir, agentDirName);
134166
+ const agentDirName = path17.dirname(agentIdPath);
134167
+ const agentDirFull = path17.join(agentsDir, agentDirName);
134193
134168
  const filesGlob = new Bun.Glob("**/*");
134194
134169
  for await (const file2 of filesGlob.scan({ cwd: agentDirFull, dot: true })) {
134195
- const filePath = path15.join(agentDirFull, file2);
134170
+ const filePath = path17.join(agentDirFull, file2);
134196
134171
  const stat2 = await fs8.stat(filePath);
134197
134172
  if (stat2.isFile()) {
134198
134173
  files[`${agentDirName}/${file2}`] = await Bun.file(filePath).text();
134199
134174
  }
134200
134175
  }
134201
- files[agentIdPath] = await Bun.file(path15.join(agentsDir, agentIdPath)).text();
134176
+ files[agentIdPath] = await Bun.file(path17.join(agentsDir, agentIdPath)).text();
134202
134177
  }
134203
134178
  return canonicalizeFromFiles(files);
134204
134179
  }
@@ -134209,21 +134184,21 @@ async function writeState(state, {
134209
134184
  const files = await serializeState(state, { agentsDir });
134210
134185
  const writtenFiles = new Set;
134211
134186
  for (const [filePath, content] of Object.entries(files)) {
134212
- const fullPath = path15.resolve(filePath);
134213
- await fs8.mkdir(path15.dirname(fullPath), { recursive: true });
134187
+ const fullPath = path17.resolve(filePath);
134188
+ await fs8.mkdir(path17.dirname(fullPath), { recursive: true });
134214
134189
  await Bun.write(fullPath, content);
134215
- writtenFiles.add(path15.relative(agentsDir, filePath));
134190
+ writtenFiles.add(path17.relative(agentsDir, filePath));
134216
134191
  }
134217
- const writtenDirs = new Set([...writtenFiles].map((f7) => f7.split(path15.sep)[0]).filter(Boolean));
134192
+ const writtenDirs = new Set([...writtenFiles].map((f7) => f7.split(path17.sep)[0]).filter(Boolean));
134218
134193
  const managedAgentIds = agentIds ? new Set(agentIds) : null;
134219
134194
  const existingDirs = await fs8.readdir(agentsDir, { withFileTypes: true });
134220
134195
  for (const dirent of existingDirs) {
134221
134196
  if (!dirent.isDirectory())
134222
134197
  continue;
134223
134198
  const dirName = dirent.name;
134224
- const dirPath = path15.join(agentsDir, dirName);
134199
+ const dirPath = path17.join(agentsDir, dirName);
134225
134200
  if (managedAgentIds) {
134226
- const metaPath = path15.join(dirPath, ".agent.json");
134201
+ const metaPath = path17.join(dirPath, ".agent.json");
134227
134202
  const metaFile = Bun.file(metaPath);
134228
134203
  const metaExists = await metaFile.exists();
134229
134204
  if (metaExists) {
@@ -134239,9 +134214,9 @@ async function writeState(state, {
134239
134214
  } else {
134240
134215
  const existingFiles = await listFilesRecursive(dirPath);
134241
134216
  for (const existingFile of existingFiles) {
134242
- const relativePath = path15.join(dirName, existingFile);
134217
+ const relativePath = path17.join(dirName, existingFile);
134243
134218
  if (!writtenFiles.has(relativePath)) {
134244
- await fs8.rm(path15.join(dirPath, existingFile));
134219
+ await fs8.rm(path17.join(dirPath, existingFile));
134245
134220
  }
134246
134221
  }
134247
134222
  }
@@ -134252,8 +134227,8 @@ async function listFilesRecursive(dir) {
134252
134227
  const files = [];
134253
134228
  for (const entry of entries) {
134254
134229
  if (entry.isDirectory()) {
134255
- const subFiles = await listFilesRecursive(path15.join(dir, entry.name));
134256
- files.push(...subFiles.map((f7) => path15.join(entry.name, f7)));
134230
+ const subFiles = await listFilesRecursive(path17.join(dir, entry.name));
134231
+ files.push(...subFiles.map((f7) => path17.join(entry.name, f7)));
134257
134232
  } else {
134258
134233
  files.push(entry.name);
134259
134234
  }
@@ -134270,101 +134245,32 @@ async function serializeState(state, { agentsDir = DEFAULT_AGENTS_DIR } = {}) {
134270
134245
  if (llm) {
134271
134246
  const { _id: _llmId, _version: _llmVersion, ...llmConfig } = llm;
134272
134247
  if (llmConfig.general_prompt) {
134273
- files[path15.join(agentDirPath, "general_prompt.md")] = await writeMarkdown(llmConfig.general_prompt);
134248
+ files[path17.join(agentDirPath, "general_prompt.md")] = await writeMarkdown(llmConfig.general_prompt);
134274
134249
  llmConfig.general_prompt = "file://./general_prompt.md";
134275
134250
  }
134276
- files[path15.join(agentDirPath, "llm.yaml")] = await writeYaml(llmConfig, { comments: llmFieldDocs });
134251
+ files[path17.join(agentDirPath, "llm.yaml")] = await writeYaml(llmConfig, { comments: llmFieldDocs });
134277
134252
  }
134278
134253
  } else if (agent.response_engine.type === "conversation-flow") {
134279
134254
  const flow = flowMap.get(agent.response_engine.conversation_flow_id);
134280
134255
  if (flow) {
134281
134256
  const { _id: _flowId, _version: _flowVersion, ...flowConfig } = flow;
134282
134257
  if (flowConfig.global_prompt) {
134283
- files[path15.join(agentDirPath, "global_prompt.md")] = await writeMarkdown(flowConfig.global_prompt);
134258
+ files[path17.join(agentDirPath, "global_prompt.md")] = await writeMarkdown(flowConfig.global_prompt);
134284
134259
  flowConfig.global_prompt = "file://./global_prompt.md";
134285
134260
  }
134286
134261
  if (flowConfig.nodes) {
134287
- const nodeNameById = new Map;
134288
- const incomingEdges = new Map;
134289
- for (const n8 of flowConfig.nodes) {
134290
- if (n8.id && n8.name)
134291
- nodeNameById.set(n8.id, n8.name);
134292
- const edgesArray = "edges" in n8 ? n8.edges : undefined;
134293
- const singleEdge = "edge" in n8 ? n8.edge : undefined;
134294
- const alwaysEdge = "always_edge" in n8 ? n8.always_edge : undefined;
134295
- const allEdges = [
134296
- ...edgesArray ?? [],
134297
- ...singleEdge ? [singleEdge] : [],
134298
- ...alwaysEdge ? [alwaysEdge] : []
134299
- ];
134300
- for (const edge of allEdges) {
134301
- const destId = edge.destination_node_id;
134302
- if (destId) {
134303
- if (!incomingEdges.has(destId))
134304
- incomingEdges.set(destId, []);
134305
- if (n8.name)
134306
- incomingEdges.get(destId).push(n8.name);
134307
- }
134308
- }
134309
- }
134310
- for (const node of flowConfig.nodes) {
134311
- if (node.id && node.type === "conversation" && node.instruction?.type === "prompt" && typeof node.instruction.text === "string" && !node.instruction.text.startsWith("file://")) {
134312
- const nodeHash = node.id.slice(-FILE_HASH_LENGTH);
134313
- const nodeName = node.name ? `${toSnakeCase(node.name)}_${nodeHash}` : `${node.type}_${nodeHash}`;
134314
- const nodeFileName = `nodes/${nodeName}.md`;
134315
- const previous = node.id ? incomingEdges.get(node.id) ?? [] : [];
134316
- const nodeEdges = "edges" in node ? node.edges : undefined;
134317
- const nodeAlwaysEdge = "always_edge" in node ? node.always_edge : undefined;
134318
- const next = [
134319
- ...nodeEdges ?? [],
134320
- ...nodeAlwaysEdge ? [nodeAlwaysEdge] : []
134321
- ].map((e31) => e31.destination_node_id ? nodeNameById.get(e31.destination_node_id) : undefined).filter((name) => !!name);
134322
- const flowViz = node.name ? createFlowVisualization(node.name, previous, next) : undefined;
134323
- files[path15.join(agentDirPath, nodeFileName)] = await writeMarkdown(node.instruction.text, {
134324
- nodeId: node.id,
134325
- flow: flowViz
134326
- });
134327
- node.instruction.text = `file://./${nodeFileName}`;
134328
- }
134329
- }
134330
- }
134331
- const roundPos = (p4) => ({
134332
- x: Math.round(p4.x),
134333
- y: Math.round(p4.y)
134334
- });
134335
- const positions = {};
134336
- if (flowConfig.begin_tag_display_position) {
134337
- positions.begin_tag = roundPos(flowConfig.begin_tag_display_position);
134338
- delete flowConfig.begin_tag_display_position;
134339
- }
134340
- if (flowConfig.nodes) {
134341
- for (const node of flowConfig.nodes) {
134342
- if (node.id && node.display_position) {
134343
- (positions.nodes ??= {})[node.id] = roundPos(node.display_position);
134344
- delete node.display_position;
134345
- }
134346
- }
134347
- }
134348
- if (flowConfig.components) {
134349
- for (const comp of flowConfig.components) {
134350
- if (comp.name && comp.begin_tag_display_position) {
134351
- (positions.components ??= {})[comp.name] = roundPos(comp.begin_tag_display_position);
134352
- delete comp.begin_tag_display_position;
134353
- }
134354
- }
134355
- }
134356
- if (Object.keys(positions).length > 0) {
134357
- files[path15.join(agentDirPath, ".positions.json")] = await writeJson(positions);
134262
+ await extractNodePrompts(flowConfig.nodes, agentDirPath, files);
134358
134263
  }
134359
- files[path15.join(agentDirPath, "conversation-flow.yaml")] = await writeYaml(flowConfig, { comments: flowFieldDocs });
134264
+ await extractPositions(flowConfig, agentDirPath, files);
134265
+ files[path17.join(agentDirPath, "conversation-flow.yaml")] = await writeYaml(flowConfig, { comments: flowFieldDocs });
134360
134266
  }
134361
134267
  }
134362
134268
  };
134363
134269
  for (const agent of state.voiceAgents) {
134364
134270
  const agentDirName = getAgentDirName(agent);
134365
- const agentDirPath = path15.join(agentsDir, agentDirName);
134271
+ const agentDirPath = path17.join(agentsDir, agentDirName);
134366
134272
  const responseEngineForMeta = agent.response_engine.type === "custom-llm" ? { type: "custom-llm" } : agent.response_engine;
134367
- files[path15.join(agentDirPath, ".agent.json")] = await writeJson({
134273
+ files[path17.join(agentDirPath, ".agent.json")] = await writeJson({
134368
134274
  id: agent._id,
134369
134275
  version: agent._version,
134370
134276
  channel: "voice",
@@ -134381,13 +134287,13 @@ async function serializeState(state, { agentsDir = DEFAULT_AGENTS_DIR } = {}) {
134381
134287
  llm_websocket_url: agent.response_engine.llm_websocket_url
134382
134288
  } : voiceAgentConfig;
134383
134289
  await serializeResponseEngine(agent, agentDirPath);
134384
- files[path15.join(agentDirPath, "config.yaml")] = await writeYaml(configToWrite, { comments: agentFieldDocs });
134290
+ files[path17.join(agentDirPath, "config.yaml")] = await writeYaml(configToWrite, { comments: agentFieldDocs });
134385
134291
  }
134386
134292
  for (const agent of state.chatAgents) {
134387
134293
  const agentDirName = getAgentDirName(agent);
134388
- const agentDirPath = path15.join(agentsDir, agentDirName);
134294
+ const agentDirPath = path17.join(agentsDir, agentDirName);
134389
134295
  const responseEngineForMeta = agent.response_engine.type === "custom-llm" ? { type: "custom-llm" } : agent.response_engine;
134390
- files[path15.join(agentDirPath, ".agent.json")] = await writeJson({
134296
+ files[path17.join(agentDirPath, ".agent.json")] = await writeJson({
134391
134297
  id: agent._id,
134392
134298
  version: agent._version,
134393
134299
  channel: "chat",
@@ -134404,7 +134310,7 @@ async function serializeState(state, { agentsDir = DEFAULT_AGENTS_DIR } = {}) {
134404
134310
  llm_websocket_url: agent.response_engine.llm_websocket_url
134405
134311
  } : chatAgentConfig;
134406
134312
  await serializeResponseEngine(agent, agentDirPath);
134407
- files[path15.join(agentDirPath, "config.yaml")] = await writeYaml(chatConfigToWrite, { comments: chatAgentFieldDocs });
134313
+ files[path17.join(agentDirPath, "config.yaml")] = await writeYaml(chatConfigToWrite, { comments: chatAgentFieldDocs });
134408
134314
  }
134409
134315
  return files;
134410
134316
  }
@@ -134560,14 +134466,14 @@ function canonicalizeTestCases(testCases) {
134560
134466
  }));
134561
134467
  }
134562
134468
  async function getLocalTestCases(agentDirPath) {
134563
- const testsDir = path15.join(agentDirPath, "tests");
134564
- const metaFile = Bun.file(path15.join(testsDir, ".tests.json"));
134469
+ const testsDir = path17.join(agentDirPath, "tests");
134470
+ const metaFile = Bun.file(path17.join(testsDir, ".tests.json"));
134565
134471
  if (!await metaFile.exists()) {
134566
134472
  return [];
134567
134473
  }
134568
134474
  const metaContent = await metaFile.text();
134569
134475
  const metadata = readJson2(metaContent, zod_default.object({
134570
- response_engine: zod_default.object({}).passthrough(),
134476
+ response_engine: zod_default.looseObject({}),
134571
134477
  test_cases: zod_default.array(zod_default.object({
134572
134478
  id: zod_default.string(),
134573
134479
  name: zod_default.string()
@@ -134576,7 +134482,7 @@ async function getLocalTestCases(agentDirPath) {
134576
134482
  const testCases = [];
134577
134483
  for (const testCaseMeta of metadata.test_cases) {
134578
134484
  const testCaseName = toSnakeCase(testCaseMeta.name);
134579
- const configPath = path15.join(testsDir, `${testCaseName}.yaml`);
134485
+ const configPath = path17.join(testsDir, `${testCaseName}.yaml`);
134580
134486
  const configFile = Bun.file(configPath);
134581
134487
  if (!await configFile.exists()) {
134582
134488
  console.warn(`Warning: Could not find config file for test case ${testCaseMeta.name}`);
@@ -134585,7 +134491,7 @@ async function getLocalTestCases(agentDirPath) {
134585
134491
  const config2 = readYaml(await configFile.text(), zod_default.looseObject({}));
134586
134492
  const resolveFileContent = async (filePath) => {
134587
134493
  const normalizedPath = filePath.replace(/^\.\//, "");
134588
- const fullPath = path15.join(testsDir, normalizedPath);
134494
+ const fullPath = path17.join(testsDir, normalizedPath);
134589
134495
  const content = await Bun.file(fullPath).text();
134590
134496
  return content;
134591
134497
  };
@@ -134620,7 +134526,7 @@ async function fetchAndWriteTestCases({
134620
134526
  ];
134621
134527
  for (const agent of allAgents) {
134622
134528
  const agentDirName = getAgentDirName(agent);
134623
- const agentDirPath = path15.join(agentsDir, agentDirName);
134529
+ const agentDirPath = path17.join(agentsDir, agentDirName);
134624
134530
  const engine = normalizeResponseEngine(agent.response_engine);
134625
134531
  if (!engine)
134626
134532
  continue;
@@ -134633,7 +134539,7 @@ async function fetchAndWriteTestCases({
134633
134539
  continue;
134634
134540
  }
134635
134541
  if (testCases.length === 0) {
134636
- const testsDir = path15.join(agentDirPath, "tests");
134542
+ const testsDir = path17.join(agentDirPath, "tests");
134637
134543
  await fs8.rm(testsDir, { recursive: true, force: true }).catch(() => {});
134638
134544
  continue;
134639
134545
  }
@@ -134649,7 +134555,7 @@ async function writeTestCases(testCases, {
134649
134555
  agentDirPath,
134650
134556
  responseEngine
134651
134557
  }) {
134652
- const testsDir = path15.join(agentDirPath, "tests");
134558
+ const testsDir = path17.join(agentDirPath, "tests");
134653
134559
  await fs8.mkdir(testsDir, { recursive: true });
134654
134560
  const metadata = {
134655
134561
  response_engine: responseEngine,
@@ -134658,7 +134564,7 @@ async function writeTestCases(testCases, {
134658
134564
  name: tc3.name
134659
134565
  }))
134660
134566
  };
134661
- await Bun.write(path15.join(testsDir, ".tests.json"), await writeJson(metadata));
134567
+ await Bun.write(path17.join(testsDir, ".tests.json"), await writeJson(metadata));
134662
134568
  const writtenFiles = new Set([".tests.json"]);
134663
134569
  for (const testCase of testCases) {
134664
134570
  const {
@@ -134671,7 +134577,7 @@ async function writeTestCases(testCases, {
134671
134577
  } = testCase;
134672
134578
  const testCaseName = toSnakeCase(testCase.name);
134673
134579
  const promptFileName = `${testCaseName}_prompt.md`;
134674
- const promptFilePath = path15.join(testsDir, promptFileName);
134580
+ const promptFilePath = path17.join(testsDir, promptFileName);
134675
134581
  await Bun.write(promptFilePath, await writeMarkdown(config2.user_prompt));
134676
134582
  writtenFiles.add(promptFileName);
134677
134583
  const configWithFileRef = {
@@ -134682,13 +134588,13 @@ async function writeTestCases(testCases, {
134682
134588
  const configContent = await writeYaml(configWithFileRef, {
134683
134589
  comments: testCaseFieldDocs
134684
134590
  });
134685
- await Bun.write(path15.join(testsDir, configFileName), configContent);
134591
+ await Bun.write(path17.join(testsDir, configFileName), configContent);
134686
134592
  writtenFiles.add(configFileName);
134687
134593
  }
134688
134594
  const existingFiles = await fs8.readdir(testsDir).catch(() => []);
134689
134595
  for (const file2 of existingFiles) {
134690
134596
  if (!writtenFiles.has(file2)) {
134691
- await fs8.rm(path15.join(testsDir, file2), { force: true });
134597
+ await fs8.rm(path17.join(testsDir, file2), { force: true });
134692
134598
  }
134693
134599
  }
134694
134600
  }
@@ -134840,6 +134746,175 @@ function computeChanges(source2, reference, { includeNew = false } = {}) {
134840
134746
  }
134841
134747
  return changes;
134842
134748
  }
134749
+ function computeComponentChanges(local, remote) {
134750
+ const refMap = new Map(remote.map((c7) => [c7._id, c7]));
134751
+ const changes = [];
134752
+ for (const component of local) {
134753
+ const ref = refMap.get(component._id);
134754
+ if (!ref)
134755
+ continue;
134756
+ const a5 = keyArraysById(n6(ref, ["_id", "_timestamp"]));
134757
+ const b7 = keyArraysById(n6(component, ["_id", "_timestamp"]));
134758
+ const differences = diff(a5, b7);
134759
+ if (differences.length > 0) {
134760
+ changes.push({
134761
+ id: component._id,
134762
+ name: component.name ?? component._id,
134763
+ current: component,
134764
+ differences
134765
+ });
134766
+ }
134767
+ }
134768
+ return changes;
134769
+ }
134770
+
134771
+ // src/lib/components.ts
134772
+ import fs9 from "fs/promises";
134773
+ import path18 from "path";
134774
+ var DEFAULT_COMPONENTS_DIR = "./components";
134775
+ function getComponentDirName(component) {
134776
+ const label2 = component.name ?? component._id;
134777
+ return `${toSnakeCase(label2)}_${component._id.slice(-FILE_HASH_LENGTH)}`;
134778
+ }
134779
+ async function getRemoteComponents({
134780
+ componentIds = null
134781
+ } = {}) {
134782
+ const all = zod_default.array(ConversationFlowComponentResponseSchema).parse(await retellFetch("/list-conversation-flow-components"));
134783
+ const filtered = componentIds ? all.filter((c7) => componentIds.includes(c7.conversation_flow_component_id)) : all;
134784
+ return filtered.map(({ conversation_flow_component_id, user_modified_timestamp, ...rest }) => ({
134785
+ ...rest,
134786
+ _id: conversation_flow_component_id,
134787
+ _timestamp: user_modified_timestamp
134788
+ }));
134789
+ }
134790
+ async function getLocalComponents({
134791
+ componentsDir = DEFAULT_COMPONENTS_DIR,
134792
+ componentIds = null
134793
+ } = {}) {
134794
+ const dirExists = await fs9.stat(componentsDir).then((s5) => s5.isDirectory()).catch(() => false);
134795
+ if (!dirExists)
134796
+ return [];
134797
+ const componentIdSet = componentIds ? new Set(componentIds) : null;
134798
+ const components = [];
134799
+ const glob = new Bun.Glob("*/.component.json");
134800
+ for await (const metaPath of glob.scan(componentsDir)) {
134801
+ const metaContent = await Bun.file(path18.join(componentsDir, metaPath)).text();
134802
+ const meta3 = readJson2(metaContent, zod_default.object({
134803
+ id: zod_default.string(),
134804
+ linked_flow_ids: zod_default.array(zod_default.string()).optional()
134805
+ }));
134806
+ if (componentIdSet && !componentIdSet.has(meta3.id))
134807
+ continue;
134808
+ const dirName = path18.dirname(metaPath);
134809
+ const dirFull = path18.join(componentsDir, dirName);
134810
+ const configContent = await Bun.file(path18.join(dirFull, "config.yaml")).text();
134811
+ const config2 = readYaml(configContent, zod_default.looseObject({}));
134812
+ const resolveFileContent = (filePath) => {
134813
+ const normalizedPath = filePath.replace(/^\.\//, "");
134814
+ const fullPath = path18.join(dirFull, normalizedPath);
134815
+ return Bun.file(fullPath).text();
134816
+ };
134817
+ await resolveFilePlaceholders2(config2, resolveFileContent);
134818
+ const positionsPath = path18.join(dirFull, ".positions.json");
134819
+ const positionsFile = Bun.file(positionsPath);
134820
+ if (await positionsFile.exists()) {
134821
+ const positions = readJson2(await positionsFile.text(), zod_default.looseObject({}));
134822
+ if (positions.begin_tag)
134823
+ config2.begin_tag_display_position = positions.begin_tag;
134824
+ if (positions.nodes && Array.isArray(config2.nodes)) {
134825
+ const nodePositions = positions.nodes;
134826
+ for (const node of config2.nodes) {
134827
+ if (node.id && nodePositions[node.id])
134828
+ node.display_position = nodePositions[node.id];
134829
+ }
134830
+ }
134831
+ }
134832
+ components.push({
134833
+ ...config2,
134834
+ _id: meta3.id,
134835
+ _timestamp: 0
134836
+ });
134837
+ }
134838
+ return components;
134839
+ }
134840
+ async function serializeComponents(components, { componentsDir = DEFAULT_COMPONENTS_DIR } = {}) {
134841
+ const files = {};
134842
+ for (const component of components) {
134843
+ const dirName = getComponentDirName(component);
134844
+ const dirPath = path18.join(componentsDir, dirName);
134845
+ const { _id, _timestamp, linked_conversation_flow_ids, ...config2 } = component;
134846
+ files[path18.join(dirPath, ".component.json")] = await writeJson({
134847
+ id: _id,
134848
+ ...linked_conversation_flow_ids?.length && {
134849
+ linked_flow_ids: linked_conversation_flow_ids
134850
+ }
134851
+ });
134852
+ if (config2.nodes) {
134853
+ await extractNodePrompts(config2.nodes, dirPath, files);
134854
+ }
134855
+ await extractPositions(config2, dirPath, files);
134856
+ files[path18.join(dirPath, "config.yaml")] = await writeYaml(config2);
134857
+ }
134858
+ return files;
134859
+ }
134860
+ async function writeComponents(components, {
134861
+ componentsDir = DEFAULT_COMPONENTS_DIR,
134862
+ componentIds = null
134863
+ } = {}) {
134864
+ const files = await serializeComponents(components, { componentsDir });
134865
+ const writtenFiles = new Set;
134866
+ for (const [filePath, content] of Object.entries(files)) {
134867
+ const fullPath = path18.resolve(filePath);
134868
+ await fs9.mkdir(path18.dirname(fullPath), { recursive: true });
134869
+ await Bun.write(fullPath, content);
134870
+ writtenFiles.add(path18.relative(componentsDir, filePath));
134871
+ }
134872
+ const writtenDirs = new Set([...writtenFiles].map((f7) => f7.split(path18.sep)[0]).filter(Boolean));
134873
+ const managedIds = componentIds ? new Set(componentIds) : null;
134874
+ const dirExists = await fs9.stat(componentsDir).then((s5) => s5.isDirectory()).catch(() => false);
134875
+ if (!dirExists)
134876
+ return;
134877
+ const existingDirs = await fs9.readdir(componentsDir, { withFileTypes: true });
134878
+ for (const dirent of existingDirs) {
134879
+ if (!dirent.isDirectory())
134880
+ continue;
134881
+ const dirName = dirent.name;
134882
+ const dirPath = path18.join(componentsDir, dirName);
134883
+ if (managedIds) {
134884
+ const metaPath = path18.join(dirPath, ".component.json");
134885
+ const metaFile = Bun.file(metaPath);
134886
+ if (await metaFile.exists()) {
134887
+ const meta3 = zod_default.object({ id: zod_default.string() }).safeParse(JSON.parse(await metaFile.text()));
134888
+ if (!meta3.success || !managedIds.has(meta3.data.id))
134889
+ continue;
134890
+ }
134891
+ }
134892
+ if (!writtenDirs.has(dirName)) {
134893
+ await fs9.rm(dirPath, { recursive: true });
134894
+ } else {
134895
+ const existingFiles = await listFilesRecursive2(dirPath);
134896
+ for (const existingFile of existingFiles) {
134897
+ const relativePath = path18.join(dirName, existingFile);
134898
+ if (!writtenFiles.has(relativePath)) {
134899
+ await fs9.rm(path18.join(dirPath, existingFile));
134900
+ }
134901
+ }
134902
+ }
134903
+ }
134904
+ }
134905
+ async function listFilesRecursive2(dir) {
134906
+ const entries = await fs9.readdir(dir, { withFileTypes: true });
134907
+ const files = [];
134908
+ for (const entry of entries) {
134909
+ if (entry.isDirectory()) {
134910
+ const subFiles = await listFilesRecursive2(path18.join(dir, entry.name));
134911
+ files.push(...subFiles.map((f7) => path18.join(entry.name, f7)));
134912
+ } else {
134913
+ files.push(entry.name);
134914
+ }
134915
+ }
134916
+ return files;
134917
+ }
134843
134918
  // ../../node_modules/.bun/cli-spinners@3.4.0/node_modules/cli-spinners/spinners.json
134844
134919
  var spinners_default = {
134845
134920
  dots: {
@@ -136779,12 +136854,12 @@ function useEffect(cb2, depArray) {
136779
136854
  import { styleText } from "util";
136780
136855
 
136781
136856
  // ../../node_modules/.bun/@inquirer+figures@2.0.3/node_modules/@inquirer/figures/dist/index.js
136782
- import process6 from "process";
136857
+ import process5 from "process";
136783
136858
  function isUnicodeSupported() {
136784
- if (process6.platform !== "win32") {
136785
- return process6.env["TERM"] !== "linux";
136859
+ if (process5.platform !== "win32") {
136860
+ return process5.env["TERM"] !== "linux";
136786
136861
  }
136787
- return Boolean(process6.env["WT_SESSION"]) || Boolean(process6.env["TERMINUS_SUBLIME"]) || process6.env["ConEmuTask"] === "{cmd::Cmder}" || process6.env["TERM_PROGRAM"] === "Terminus-Sublime" || process6.env["TERM_PROGRAM"] === "vscode" || process6.env["TERM"] === "xterm-256color" || process6.env["TERM"] === "alacritty" || process6.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
136862
+ return Boolean(process5.env["WT_SESSION"]) || Boolean(process5.env["TERMINUS_SUBLIME"]) || process5.env["ConEmuTask"] === "{cmd::Cmder}" || process5.env["TERM_PROGRAM"] === "Terminus-Sublime" || process5.env["TERM_PROGRAM"] === "vscode" || process5.env["TERM"] === "xterm-256color" || process5.env["TERM"] === "alacritty" || process5.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
136788
136863
  }
136789
136864
  var common = {
136790
136865
  circleQuestionMark: "(?)",
@@ -137264,6 +137339,214 @@ var import_mute_stream = __toESM(require_lib(), 1);
137264
137339
  import * as readline2 from "readline";
137265
137340
  import { AsyncResource as AsyncResource3 } from "async_hooks";
137266
137341
 
137342
+ // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
137343
+ var signals = [];
137344
+ signals.push("SIGHUP", "SIGINT", "SIGTERM");
137345
+ if (process.platform !== "win32") {
137346
+ signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
137347
+ }
137348
+ if (process.platform === "linux") {
137349
+ signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
137350
+ }
137351
+
137352
+ // ../../node_modules/.bun/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
137353
+ var processOk = (process6) => !!process6 && typeof process6 === "object" && typeof process6.removeListener === "function" && typeof process6.emit === "function" && typeof process6.reallyExit === "function" && typeof process6.listeners === "function" && typeof process6.kill === "function" && typeof process6.pid === "number" && typeof process6.on === "function";
137354
+ var kExitEmitter = Symbol.for("signal-exit emitter");
137355
+ var global2 = globalThis;
137356
+ var ObjectDefineProperty = Object.defineProperty.bind(Object);
137357
+
137358
+ class Emitter {
137359
+ emitted = {
137360
+ afterExit: false,
137361
+ exit: false
137362
+ };
137363
+ listeners = {
137364
+ afterExit: [],
137365
+ exit: []
137366
+ };
137367
+ count = 0;
137368
+ id = Math.random();
137369
+ constructor() {
137370
+ if (global2[kExitEmitter]) {
137371
+ return global2[kExitEmitter];
137372
+ }
137373
+ ObjectDefineProperty(global2, kExitEmitter, {
137374
+ value: this,
137375
+ writable: false,
137376
+ enumerable: false,
137377
+ configurable: false
137378
+ });
137379
+ }
137380
+ on(ev2, fn9) {
137381
+ this.listeners[ev2].push(fn9);
137382
+ }
137383
+ removeListener(ev2, fn9) {
137384
+ const list = this.listeners[ev2];
137385
+ const i5 = list.indexOf(fn9);
137386
+ if (i5 === -1) {
137387
+ return;
137388
+ }
137389
+ if (i5 === 0 && list.length === 1) {
137390
+ list.length = 0;
137391
+ } else {
137392
+ list.splice(i5, 1);
137393
+ }
137394
+ }
137395
+ emit(ev2, code, signal) {
137396
+ if (this.emitted[ev2]) {
137397
+ return false;
137398
+ }
137399
+ this.emitted[ev2] = true;
137400
+ let ret = false;
137401
+ for (const fn9 of this.listeners[ev2]) {
137402
+ ret = fn9(code, signal) === true || ret;
137403
+ }
137404
+ if (ev2 === "exit") {
137405
+ ret = this.emit("afterExit", code, signal) || ret;
137406
+ }
137407
+ return ret;
137408
+ }
137409
+ }
137410
+
137411
+ class SignalExitBase {
137412
+ }
137413
+ var signalExitWrap = (handler) => {
137414
+ return {
137415
+ onExit(cb2, opts) {
137416
+ return handler.onExit(cb2, opts);
137417
+ },
137418
+ load() {
137419
+ return handler.load();
137420
+ },
137421
+ unload() {
137422
+ return handler.unload();
137423
+ }
137424
+ };
137425
+ };
137426
+
137427
+ class SignalExitFallback extends SignalExitBase {
137428
+ onExit() {
137429
+ return () => {};
137430
+ }
137431
+ load() {}
137432
+ unload() {}
137433
+ }
137434
+
137435
+ class SignalExit extends SignalExitBase {
137436
+ #hupSig = process6.platform === "win32" ? "SIGINT" : "SIGHUP";
137437
+ #emitter = new Emitter;
137438
+ #process;
137439
+ #originalProcessEmit;
137440
+ #originalProcessReallyExit;
137441
+ #sigListeners = {};
137442
+ #loaded = false;
137443
+ constructor(process6) {
137444
+ super();
137445
+ this.#process = process6;
137446
+ this.#sigListeners = {};
137447
+ for (const sig of signals) {
137448
+ this.#sigListeners[sig] = () => {
137449
+ const listeners = this.#process.listeners(sig);
137450
+ let { count } = this.#emitter;
137451
+ const p4 = process6;
137452
+ if (typeof p4.__signal_exit_emitter__ === "object" && typeof p4.__signal_exit_emitter__.count === "number") {
137453
+ count += p4.__signal_exit_emitter__.count;
137454
+ }
137455
+ if (listeners.length === count) {
137456
+ this.unload();
137457
+ const ret = this.#emitter.emit("exit", null, sig);
137458
+ const s5 = sig === "SIGHUP" ? this.#hupSig : sig;
137459
+ if (!ret)
137460
+ process6.kill(process6.pid, s5);
137461
+ }
137462
+ };
137463
+ }
137464
+ this.#originalProcessReallyExit = process6.reallyExit;
137465
+ this.#originalProcessEmit = process6.emit;
137466
+ }
137467
+ onExit(cb2, opts) {
137468
+ if (!processOk(this.#process)) {
137469
+ return () => {};
137470
+ }
137471
+ if (this.#loaded === false) {
137472
+ this.load();
137473
+ }
137474
+ const ev2 = opts?.alwaysLast ? "afterExit" : "exit";
137475
+ this.#emitter.on(ev2, cb2);
137476
+ return () => {
137477
+ this.#emitter.removeListener(ev2, cb2);
137478
+ if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
137479
+ this.unload();
137480
+ }
137481
+ };
137482
+ }
137483
+ load() {
137484
+ if (this.#loaded) {
137485
+ return;
137486
+ }
137487
+ this.#loaded = true;
137488
+ this.#emitter.count += 1;
137489
+ for (const sig of signals) {
137490
+ try {
137491
+ const fn9 = this.#sigListeners[sig];
137492
+ if (fn9)
137493
+ this.#process.on(sig, fn9);
137494
+ } catch (_10) {}
137495
+ }
137496
+ this.#process.emit = (ev2, ...a5) => {
137497
+ return this.#processEmit(ev2, ...a5);
137498
+ };
137499
+ this.#process.reallyExit = (code) => {
137500
+ return this.#processReallyExit(code);
137501
+ };
137502
+ }
137503
+ unload() {
137504
+ if (!this.#loaded) {
137505
+ return;
137506
+ }
137507
+ this.#loaded = false;
137508
+ signals.forEach((sig) => {
137509
+ const listener = this.#sigListeners[sig];
137510
+ if (!listener) {
137511
+ throw new Error("Listener not defined for signal: " + sig);
137512
+ }
137513
+ try {
137514
+ this.#process.removeListener(sig, listener);
137515
+ } catch (_10) {}
137516
+ });
137517
+ this.#process.emit = this.#originalProcessEmit;
137518
+ this.#process.reallyExit = this.#originalProcessReallyExit;
137519
+ this.#emitter.count -= 1;
137520
+ }
137521
+ #processReallyExit(code) {
137522
+ if (!processOk(this.#process)) {
137523
+ return 0;
137524
+ }
137525
+ this.#process.exitCode = code || 0;
137526
+ this.#emitter.emit("exit", this.#process.exitCode, null);
137527
+ return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
137528
+ }
137529
+ #processEmit(ev2, ...args) {
137530
+ const og2 = this.#originalProcessEmit;
137531
+ if (ev2 === "exit" && processOk(this.#process)) {
137532
+ if (typeof args[0] === "number") {
137533
+ this.#process.exitCode = args[0];
137534
+ }
137535
+ const ret = og2.call(this.#process, ev2, ...args);
137536
+ this.#emitter.emit("exit", this.#process.exitCode, null);
137537
+ return ret;
137538
+ } else {
137539
+ return og2.call(this.#process, ev2, ...args);
137540
+ }
137541
+ }
137542
+ }
137543
+ var process6 = globalThis.process;
137544
+ var {
137545
+ onExit,
137546
+ load,
137547
+ unload
137548
+ } = signalExitWrap(processOk(process6) ? new SignalExit(process6) : new SignalExitFallback);
137549
+
137267
137550
  // ../../node_modules/.bun/@inquirer+core@11.1.1+6925fcdbe69ee712/node_modules/@inquirer/core/dist/lib/screen-manager.js
137268
137551
  import { stripVTControlCharacters } from "util";
137269
137552
 
@@ -137682,7 +137965,8 @@ var dist_default4 = createPrompt((config2, done) => {
137682
137965
  // src/lib/sync-config.ts
137683
137966
  var SYNC_CONFIG_FILE = ".retell-sync.json";
137684
137967
  var syncConfigSchema = zod_default.object({
137685
- agents: zod_default.array(zod_default.string()).optional()
137968
+ agents: zod_default.array(zod_default.string()).optional(),
137969
+ components: zod_default.array(zod_default.string()).optional()
137686
137970
  });
137687
137971
  async function readSyncConfig() {
137688
137972
  const file2 = Bun.file(SYNC_CONFIG_FILE);
@@ -137712,21 +137996,23 @@ async function selectAgentsInteractive() {
137712
137996
  p4.set("pagination_key_version", String(opts.pagination_key_version));
137713
137997
  return p4.toString();
137714
137998
  };
137715
- const [voiceAgents, chatAgents] = await Promise.all([
137999
+ const [voiceAgents, chatAgents, config2] = await Promise.all([
137716
138000
  retellPagination(async (opts) => zod_default.array(VoiceAgentResponseSchema).parse(await retellFetch(`/list-agents?${paginationParams(opts)}`)), "agent_id"),
137717
- retellPagination(async (opts) => zod_default.array(ChatAgentResponseSchema).parse(await retellFetch(`/list-chat-agents?${paginationParams(opts)}`)), "agent_id")
138001
+ retellPagination(async (opts) => zod_default.array(ChatAgentResponseSchema).parse(await retellFetch(`/list-chat-agents?${paginationParams(opts)}`)), "agent_id"),
138002
+ readSyncConfig()
137718
138003
  ]);
138004
+ const preSelected = new Set(config2?.agents ?? []);
137719
138005
  const voiceAgentMap = new Map;
137720
138006
  for (const agent of voiceAgents) {
137721
- const existing = voiceAgentMap.get(agent.agent_id);
137722
- if (!existing || (agent.version ?? 0) > (existing.version ?? 0)) {
138007
+ const existing2 = voiceAgentMap.get(agent.agent_id);
138008
+ if (!existing2 || (agent.version ?? 0) > (existing2.version ?? 0)) {
137723
138009
  voiceAgentMap.set(agent.agent_id, { ...agent, _channel: "voice" });
137724
138010
  }
137725
138011
  }
137726
138012
  const chatAgentMap = new Map;
137727
138013
  for (const agent of chatAgents) {
137728
- const existing = chatAgentMap.get(agent.agent_id);
137729
- if (!existing || (agent.version ?? 0) > (existing.version ?? 0)) {
138014
+ const existing2 = chatAgentMap.get(agent.agent_id);
138015
+ if (!existing2 || (agent.version ?? 0) > (existing2.version ?? 0)) {
137730
138016
  chatAgentMap.set(agent.agent_id, { ...agent, _channel: "chat" });
137731
138017
  }
137732
138018
  }
@@ -137739,21 +138025,17 @@ async function selectAgentsInteractive() {
137739
138025
  message: "Select agents to sync:",
137740
138026
  choices: allAgents.map((agent) => ({
137741
138027
  name: `${agent.agent_name ?? agent.agent_id} (${agent._channel})`,
137742
- value: agent.agent_id
138028
+ value: agent.agent_id,
138029
+ checked: preSelected.has(agent.agent_id)
137743
138030
  }))
137744
138031
  });
137745
138032
  if (selected.length === 0) {
137746
138033
  warn("No agents selected");
137747
138034
  return [];
137748
138035
  }
137749
- const save = await dist_default4({
137750
- message: `Save selection to ${SYNC_CONFIG_FILE}?`,
137751
- default: true
137752
- });
137753
- if (save) {
137754
- await writeSyncConfig({ agents: selected });
137755
- dim(`Saved to ${SYNC_CONFIG_FILE}`);
137756
- }
138036
+ const existing = await readSyncConfig() ?? {};
138037
+ await writeSyncConfig({ ...existing, agents: selected });
138038
+ dim(`Saved to ${SYNC_CONFIG_FILE}`);
137757
138039
  return selected;
137758
138040
  }
137759
138041
  async function resolveAgentIds(args, { all = false, select = false } = {}) {
@@ -137773,6 +138055,51 @@ async function resolveAgentIds(args, { all = false, select = false } = {}) {
137773
138055
  }
137774
138056
  return selectAgentsInteractive();
137775
138057
  }
138058
+ async function selectComponentsInteractive() {
138059
+ const [allComponents, config2] = await Promise.all([
138060
+ zod_default.array(ConversationFlowComponentResponseSchema).parse(await retellFetch("/list-conversation-flow-components")),
138061
+ readSyncConfig()
138062
+ ]);
138063
+ if (allComponents.length === 0) {
138064
+ warn("No shared components found in the account");
138065
+ return [];
138066
+ }
138067
+ const preSelected = new Set(config2?.components ?? []);
138068
+ const sorted = [...allComponents].sort((a5, b7) => (a5.name ?? a5.conversation_flow_component_id).localeCompare(b7.name ?? b7.conversation_flow_component_id));
138069
+ const selected = await dist_default3({
138070
+ message: "Select components to sync:",
138071
+ choices: sorted.map((c7) => ({
138072
+ name: c7.name ?? c7.conversation_flow_component_id,
138073
+ value: c7.conversation_flow_component_id,
138074
+ checked: preSelected.has(c7.conversation_flow_component_id)
138075
+ }))
138076
+ });
138077
+ if (selected.length === 0) {
138078
+ warn("No components selected");
138079
+ return [];
138080
+ }
138081
+ const existing = await readSyncConfig() ?? {};
138082
+ await writeSyncConfig({ ...existing, components: selected });
138083
+ dim(`Saved to ${SYNC_CONFIG_FILE}`);
138084
+ return selected;
138085
+ }
138086
+ async function resolveComponentIds({
138087
+ all = false,
138088
+ select = false
138089
+ } = {}) {
138090
+ if (select) {
138091
+ return selectComponentsInteractive();
138092
+ }
138093
+ if (all) {
138094
+ return null;
138095
+ }
138096
+ const config2 = await readSyncConfig();
138097
+ if (config2?.components && config2.components.length > 0) {
138098
+ dim(`Using ${config2.components.length} component(s) from ${SYNC_CONFIG_FILE}`);
138099
+ return config2.components;
138100
+ }
138101
+ return;
138102
+ }
137776
138103
 
137777
138104
  // src/commands/pull.ts
137778
138105
  var {$: $10 } = globalThis.Bun;
@@ -137802,12 +138129,18 @@ async function pullCommand(agentIdArgs, opts, cmd) {
137802
138129
  process.exitCode = 1;
137803
138130
  return;
137804
138131
  }
138132
+ const componentIds = await resolveComponentIds({
138133
+ all: opts.all,
138134
+ select: opts.select
138135
+ });
137805
138136
  await pull({
137806
138137
  agentsDir: globalOpts.agentsDir,
137807
138138
  agentIds,
137808
138139
  yes: opts.yes,
137809
138140
  version: version2,
137810
- tests: opts.tests ?? true
138141
+ tests: opts.tests ?? true,
138142
+ componentsDir: globalOpts.componentsDir,
138143
+ componentIds
137811
138144
  });
137812
138145
  } catch (err) {
137813
138146
  if (err instanceof ExitPromptError) {
@@ -137822,7 +138155,9 @@ async function pull({
137822
138155
  agentIds = null,
137823
138156
  yes = false,
137824
138157
  version: version2,
137825
- tests = true
138158
+ tests = true,
138159
+ componentsDir,
138160
+ componentIds
137826
138161
  } = {}) {
137827
138162
  const scopeLabel = agentIds ? `${agentIds.length} agent(s)` : "all agents";
137828
138163
  const versionLabel = version2 != null ? ` (version ${version2})` : "";
@@ -137859,6 +138194,14 @@ async function pull({
137859
138194
  const agentsWithTests = testResults.filter((r5) => r5.testCount > 0).length;
137860
138195
  testSpinner.stop(source_default.dim(`${pluralize("test case", totalTests, true)} across ${pluralize("agent", agentsWithTests, true)}`));
137861
138196
  }
138197
+ if (componentIds !== undefined) {
138198
+ const compSpinner = createSpinner("Fetching shared components...");
138199
+ const remoteComponents = await getRemoteComponents({ componentIds });
138200
+ compSpinner.stop(source_default.dim(pluralize("component", remoteComponents.length, true)));
138201
+ const compWriteSpinner = createSpinner("Writing component files...");
138202
+ await writeComponents(remoteComponents, { componentsDir, componentIds });
138203
+ compWriteSpinner.stop(source_default.green("Done"));
138204
+ }
137862
138205
  console.log(source_default.dim(`Files written to ${source_default.bold(agentsDir)}. Review with git diff.`));
137863
138206
  }
137864
138207
 
@@ -137872,11 +138215,17 @@ async function deployCommand(agentIdArgs, opts, cmd) {
137872
138215
  all: opts.all,
137873
138216
  select: opts.select
137874
138217
  });
138218
+ const componentIds = await resolveComponentIds({
138219
+ all: opts.all,
138220
+ select: opts.select
138221
+ });
137875
138222
  const affectedIds = await deploy({
137876
138223
  agentsDir: globalOpts.agentsDir,
137877
138224
  agentIds,
137878
138225
  dryRun: opts.dryRun,
137879
- verbose: opts.verbose
138226
+ verbose: opts.verbose,
138227
+ componentsDir: globalOpts.componentsDir,
138228
+ componentIds
137880
138229
  });
137881
138230
  if (opts.quiet && affectedIds.length > 0) {
137882
138231
  console.log(affectedIds.join(" "));
@@ -137893,7 +138242,9 @@ async function deploy({
137893
138242
  agentsDir = DEFAULT_AGENTS_DIR,
137894
138243
  agentIds = null,
137895
138244
  dryRun = false,
137896
- verbose = false
138245
+ verbose = false,
138246
+ componentsDir,
138247
+ componentIds
137897
138248
  } = {}) {
137898
138249
  const scopeLabel = agentIds ? `${agentIds.length} agent(s)` : "all agents";
137899
138250
  bold(`Deploying ${scopeLabel} to Retell draft...`);
@@ -137920,7 +138271,7 @@ async function deploy({
137920
138271
  if (agent.response_engine.type !== "retell-llm" && agent.response_engine.type !== "conversation-flow") {
137921
138272
  continue;
137922
138273
  }
137923
- const agentDirPath = path17.join(agentsDir, getAgentDirName(agent));
138274
+ const agentDirPath = path19.join(agentsDir, getAgentDirName(agent));
137924
138275
  const localTestCases = await getLocalTestCases(agentDirPath);
137925
138276
  if (localTestCases.length === 0)
137926
138277
  continue;
@@ -137967,10 +138318,22 @@ async function deploy({
137967
138318
  }
137968
138319
  }
137969
138320
  }
137970
- const changes = { ...baseChanges, testCases: testCaseChanges };
138321
+ let componentChanges = [];
138322
+ if (componentIds !== undefined) {
138323
+ const [localComponents, remoteComponents] = await Promise.all([
138324
+ getLocalComponents({ componentsDir, componentIds }),
138325
+ getRemoteComponents({ componentIds })
138326
+ ]);
138327
+ componentChanges = computeComponentChanges(localComponents, remoteComponents);
138328
+ }
138329
+ const changes = {
138330
+ ...baseChanges,
138331
+ testCases: testCaseChanges,
138332
+ components: componentChanges
138333
+ };
137971
138334
  const totalAgentChanges = changes.voiceAgents.length + changes.chatAgents.length;
137972
- spinner.stop(source_default.dim(`Found ${source_default.white(totalAgentChanges)} agent changes, ${source_default.white(changes.llms.length)} LLM changes, ${source_default.white(changes.flows.length)} flow changes, ${source_default.white(changes.testCases.length)} test case changes`));
137973
- const totalChanges = totalAgentChanges + changes.llms.length + changes.flows.length + changes.testCases.length;
138335
+ spinner.stop(source_default.dim(`Found ${source_default.white(totalAgentChanges)} agent, ${source_default.white(changes.llms.length)} LLM, ${source_default.white(changes.flows.length)} flow, ${source_default.white(changes.testCases.length)} test case, ${source_default.white(changes.components.length)} component changes`));
138336
+ const totalChanges = totalAgentChanges + changes.llms.length + changes.flows.length + changes.testCases.length + changes.components.length;
137974
138337
  const affectedAgentIds = findAffectedAgentIds(changes, localState);
137975
138338
  if (totalChanges === 0) {
137976
138339
  success2("No changes to deploy");
@@ -138023,6 +138386,19 @@ async function deploy({
138023
138386
  const { _id, ...updateData } = change.current;
138024
138387
  await updateTestCaseDefinition(_id, updateData);
138025
138388
  return { type: "test case", id: _id, name: change.name };
138389
+ }),
138390
+ ...changes.components.map(async (change) => {
138391
+ const {
138392
+ _id,
138393
+ _timestamp,
138394
+ linked_conversation_flow_ids: _linkedFlows,
138395
+ ...updateData
138396
+ } = change.current;
138397
+ await retellFetch(`/update-conversation-flow-component/${_id}`, {
138398
+ method: "PATCH",
138399
+ body: JSON.stringify(updateData)
138400
+ });
138401
+ return { type: "component", id: _id, name: change.name };
138026
138402
  })
138027
138403
  ]);
138028
138404
  spinner.stop(source_default.dim("Done"));
@@ -138037,7 +138413,7 @@ async function deploy({
138037
138413
  success2(`Deployed ${pluralize("change", totalChanges, true)}`);
138038
138414
  if (!isQuiet()) {
138039
138415
  bold("Syncing latest state...");
138040
- await pull({ agentsDir, agentIds });
138416
+ await pull({ agentsDir, agentIds, componentsDir, componentIds });
138041
138417
  }
138042
138418
  return [...affectedAgentIds];
138043
138419
  }
@@ -138143,6 +138519,16 @@ Test cases to update:`));
138143
138519
  }
138144
138520
  }
138145
138521
  }
138522
+ if (changes.components.length > 0) {
138523
+ console.log(source_default.cyan(`
138524
+ Shared components to update:`));
138525
+ for (const change of changes.components) {
138526
+ console.log(` ${source_default.bold(change.name)} ${source_default.dim(`(${change.id})`)}`);
138527
+ for (const d5 of change.differences) {
138528
+ printDiff(d5, { verbose });
138529
+ }
138530
+ }
138531
+ }
138146
138532
  }
138147
138533
 
138148
138534
  // src/commands/publish.ts
@@ -138318,8 +138704,8 @@ function patchAgentList(agents, publishedIds, publishedVersions, agentNames, dir
138318
138704
 
138319
138705
  // src/cli.ts
138320
138706
  var program2 = new Command;
138321
- program2.name("retell").description("Retell AI agent management CLI").option("-w, --agents-dir <dir>", "Directory for agent files", DEFAULT_AGENTS_DIR);
138322
- program2.command("pull [agentIds...]").description("Pull agents from Retell API (pulls latest draft state by default)").option("-a, --all", "Pull all agents in the account").option("-s, --select", "Force interactive agent selection").option("-y, --yes", "Skip confirmation prompts").option("-v, --version <number>", "Pull a specific version (requires agent IDs)").option("--no-tests", "Skip pulling test case definitions").action(pullCommand);
138323
- program2.command("deploy [agentIds...]").description("Deploy local changes to Retell draft").option("-a, --all", "Deploy all agents in the account").option("-s, --select", "Force interactive agent selection").option("-n, --dry-run", "Show changes without applying").option("-v, --verbose", "Show full diff details (use with --dry-run)").option("-q, --quiet", "Output only affected agent IDs (for piping)").action(deployCommand);
138707
+ program2.name("retell").description("Retell AI agent management CLI").option("-w, --agents-dir <dir>", "Directory for agent files", DEFAULT_AGENTS_DIR).option("--components-dir <dir>", "Directory for shared component files", DEFAULT_COMPONENTS_DIR);
138708
+ program2.command("pull [agentIds...]").description("Pull agents and shared components from Retell API").option("-a, --all", "Pull all agents in the account").option("-s, --select", "Force interactive selection for agents and components").option("-y, --yes", "Skip confirmation prompts").option("-v, --version <number>", "Pull a specific version (requires agent IDs)").option("--no-tests", "Skip pulling test case definitions").action(pullCommand);
138709
+ program2.command("deploy [agentIds...]").description("Deploy local agent and component changes to Retell").option("-a, --all", "Deploy all agents in the account").option("-s, --select", "Force interactive selection for agents and components").option("-n, --dry-run", "Show changes without applying").option("-v, --verbose", "Show full diff details (use with --dry-run)").option("-q, --quiet", "Output only affected agent IDs (for piping)").action(deployCommand);
138324
138710
  program2.command("publish [agentIds...]").description("Publish agents with unpublished draft changes").option("-a, --all", "Publish all agents in the account").option("-s, --select", "Force interactive agent selection").option("-n, --dry-run", "Show what would be published without publishing").option("-q, --quiet", "Output only published agent IDs (for piping)").action(publishCommand);
138325
138711
  program2.parse();