integration-tour 1.0.9 → 1.0.10

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 (3) hide show
  1. package/README.md +3 -1
  2. package/dist/cli.js +687 -287
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2722,38 +2722,9 @@ __export(cli_exports, {
2722
2722
  });
2723
2723
  module.exports = __toCommonJS(cli_exports);
2724
2724
  var import_promises3 = require("node:fs/promises");
2725
+ var import_promises4 = require("node:readline/promises");
2725
2726
  var import_node_path4 = require("node:path");
2726
2727
 
2727
- // ../../lib/storyboard/timing.ts
2728
- var VOICE_LEAD = 400;
2729
- var VOICE_TAIL = 600;
2730
- function activeScenes(sb) {
2731
- return sb.scenes.filter((s) => sb.settings.showFailure || !s.failurePath);
2732
- }
2733
- function sceneDuration(sb, scene) {
2734
- if (!sb.settings.voiceover || !scene.voiceMs) return scene.duration;
2735
- return Math.max(scene.duration, Math.ceil(VOICE_LEAD + scene.voiceMs + VOICE_TAIL));
2736
- }
2737
- function totalDuration(sb) {
2738
- return activeScenes(sb).reduce((sum, s) => sum + sceneDuration(sb, s), 0);
2739
- }
2740
- function summaryItems(sb) {
2741
- const items = [];
2742
- let failure;
2743
- for (const scene of activeScenes(sb)) {
2744
- if (!scene.summaryLine) continue;
2745
- if (scene.kind === "call" && scene.outcome === "failure") {
2746
- failure = scene.summaryLine;
2747
- continue;
2748
- }
2749
- items.push(scene.summaryLine);
2750
- if (failure) items.push(failure);
2751
- failure = void 0;
2752
- }
2753
- if (failure) items.push(failure);
2754
- return items;
2755
- }
2756
-
2757
2728
  // ../../lib/oas/fit.ts
2758
2729
  var CIRCULAR_TARGET = "x-circular-target";
2759
2730
  function circularTarget(schema2) {
@@ -3923,7 +3894,7 @@ function uuidLike(name) {
3923
3894
  function idWords(name) {
3924
3895
  const all = name.replace(/[_-]?(uu|s|g)?id$/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z])([A-Z][a-z])/g, "$1_$2").toLowerCase().split(/[^a-z]+/).filter(Boolean);
3925
3896
  const kept = all.filter((w) => !ID_NOISE.test(w));
3926
- return (kept.length ? kept : all).map((w, i, list7) => i === list7.length - 1 ? singular(w) : w);
3897
+ return (kept.length ? kept : all).map((w, i, list8) => i === list8.length - 1 ? singular(w) : w);
3927
3898
  }
3928
3899
  function seedHash(seed) {
3929
3900
  let h = 2166136261;
@@ -3937,6 +3908,196 @@ function singular(word) {
3937
3908
  return word;
3938
3909
  }
3939
3910
 
3911
+ // ../../lib/text.ts
3912
+ function cut(text3, max) {
3913
+ const end = Math.max(0, max);
3914
+ const last = text3.charCodeAt(end - 1);
3915
+ return text3.slice(0, last >= 55296 && last <= 56319 ? end - 1 : end);
3916
+ }
3917
+ function firstSentence(text3) {
3918
+ if (!text3) return void 0;
3919
+ const plain = text3.replace(/<[^<>]+>/g, "").replace(/\s+/g, " ").trim();
3920
+ const match = plain.match(/^(.{1,90}?[.!?])(\s|$)/);
3921
+ return match ? match[1] : cut(plain, 90);
3922
+ }
3923
+ var HALVES = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g;
3924
+ function wellFormed(text3) {
3925
+ return text3.replace(HALVES, (c) => c.length === 2 ? c : "");
3926
+ }
3927
+ function clip(text3, max) {
3928
+ return text3.length > max ? `${cut(text3, max - 1)}\u2026` : text3;
3929
+ }
3930
+ function plainText(markdown) {
3931
+ return markdown.replace(/<[^>]+>/g, " ").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\*\*|__|`/g, "").replace(/(^|\s)[*_]([^*_\s][^*_]*?)[*_](?=[\s.,;:!?)]|$)/g, "$1$2").replace(/^\s{0,3}(#{1,6}|>)\s+/gm, "").replace(/\s+/g, " ").trim();
3932
+ }
3933
+
3934
+ // ../../lib/oas/secrets.ts
3935
+ var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
3936
+ function secretName(name) {
3937
+ if (/idempotency/i.test(name)) return false;
3938
+ return /secret|passw(or)?d|pwd|token|api[-_]?key|apikey|credential|signature|session|cookie|bearer|jwt|^auth(orization)?$/i.test(name) || /(^|[_-])key$|[a-z0-9]Key$|^key$/i.test(name);
3939
+ }
3940
+ var SECRET_VALUE = /^(sk|rk)_(live|test)_|^whsec_|^gh[pousr]_|^github_pat_|^xox[abposr]-|^(AKIA|ASIA)[0-9A-Z]{12,}|^eyJ[\w-]+\.[\w-]+|^(bearer|basic)\s|^sk-[\w-]{20,}|^AIza[\w-]{30,}|^ya29\.[\w-]{20,}|^SG\.[\w-]{16,}\.[\w-]{16,}|^npm_[A-Za-z0-9]{30,}|^glpat-[\w-]{20,}|^hf_[A-Za-z0-9]{30,}|^shp(at|ss|ca|pa)_[a-fA-F0-9]{32}|^sq0(atp|csp)-[\w-]{20,}|^-----BEGIN [A-Z ]*PRIVATE KEY-----/i;
3941
+ function credentialName(name) {
3942
+ if (/^key$/i.test(name.trim()) || /(type|kind|url|uri|endpoint|expires?(_?(in|at))?|name|count|length|hint|prefix)$/i.test(name)) return false;
3943
+ return secretName(name) || /(^|[^a-z])auth([^a-z]|$)/i.test(name);
3944
+ }
3945
+ var BOT_TOKEN = /^bot\d{5,}:[\w-]{30,}$/;
3946
+ var PREFIXED_ID = /^[a-z]{1,10}_/;
3947
+ function pathSecret(segment) {
3948
+ const s = segment.trim();
3949
+ if (BOT_TOKEN.test(s)) return "bot_token";
3950
+ return SECRET_VALUE.test(s) || randomToken(s) ? "token" : void 0;
3951
+ }
3952
+ function randomToken(value) {
3953
+ const s = value.trim();
3954
+ if (s.length < 24 || s.startsWith("/") || s.includes("://") || !/^[A-Za-z0-9_\-.~:+/=]+$/.test(s)) return false;
3955
+ return /[a-z]/.test(s) && /[A-Z]/.test(s) && /\d/.test(s) && !PREFIXED_ID.test(s);
3956
+ }
3957
+ var SECRET_IN_TEXT = /\b(?:(?:sk|rk)_(?:live|test)_\w+|whsec_\w+|gh[pousr]_\w+|github_pat_\w+|xox[abposr]-[\w-]+|(?:AKIA|ASIA)[0-9A-Z]{12,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|sk-[\w-]{20,}|AIza[\w-]{30,}|ya29\.[\w-]{20,}|SG\.[\w-]{16,}\.[\w-]{16,}|npm_[A-Za-z0-9]{30,}|glpat-[\w-]{20,}|hf_[A-Za-z0-9]{30,}|shp(?:at|ss|ca|pa)_[a-fA-F0-9]{32}|sq0(?:atp|csp)-[\w-]{20,})|-----BEGIN [A-Z ]{0,40}PRIVATE KEY-----[A-Za-z0-9+/=\s\\]{0,20000}(?:-----END [A-Z ]{0,40}PRIVATE KEY-----)?/g;
3958
+ var DOTS = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
3959
+ var MAX_TEXT_SCAN = 2 * 1024 * 1024;
3960
+ function withoutCredentialsInText(text3, hid) {
3961
+ if (!text3.trim()) return text3;
3962
+ const hide = (name) => {
3963
+ hid.add(name);
3964
+ return DOTS;
3965
+ };
3966
+ const held = (value) => value.trim() !== "" && !value.includes("{{") && value !== DOTS;
3967
+ return withoutKeysInText(
3968
+ cut(text3, MAX_TEXT_SCAN).replace(/<([A-Za-z_][\w.:-]{0,100})((?:\s[^<>]{0,2000})?)>([^<]{1,10000})<\//g, (whole, tag2, attributes, content) => {
3969
+ const local = tag2.slice(tag2.lastIndexOf(":") + 1);
3970
+ return credentialName(local) && held(content) ? `<${tag2}${attributes}>${hide(local)}</` : whole;
3971
+ }).replace(/(?<![\w.-])(["']?)([A-Za-z_][\w.-]{0,100})\1(\s{0,5}[=:]\s{0,5})(?:"((?:[^"\\\n]|\\.){0,10000})"|'((?:[^'\\\n]|\\.){0,10000})')/g, (whole, quote, name, separator, double, single) => {
3972
+ const value = double ?? single ?? "";
3973
+ if (!credentialName(name) || !held(value)) return whole;
3974
+ const around = double !== void 0 ? '"' : "'";
3975
+ return `${quote}${name}${quote}${separator}${around}${hide(name)}${around}`;
3976
+ }).replace(/^([ \t]{0,20})([A-Za-z][\w-]{0,100})([ \t]{0,5}:[ \t]{0,5})([^\r\n]{1,10000})$/gm, (whole, indent, name, separator, value) => {
3977
+ const header = /^(authorization|proxy-authorization|cookie)$/i.test(name);
3978
+ if (!(credentialName(name) || header) || !held(value) || /^["']/.test(value)) return whole;
3979
+ const scheme = /^authorization$/i.test(name) ? value.match(/^([A-Za-z][\w-]*)\s+\S/)?.[1] : void 0;
3980
+ return `${indent}${name}${separator}${scheme ? `${scheme} ` : ""}${hide(name)}`;
3981
+ }).replace(
3982
+ /(^|[\s&?;,{(])([A-Za-z_][\w.-]{0,100})(\s{0,5}[=:]\s{0,5})([^\s&;,"'<>)}]{1,10000})/g,
3983
+ (whole, before, name, separator, value) => credentialName(name) && held(value) && !/^(authorization|proxy-authorization|cookie)$/i.test(name) ? `${before}${name}${separator}${hide(name)}` : whole
3984
+ ),
3985
+ hid
3986
+ );
3987
+ }
3988
+ function withoutKeysInText(text3, hid, name = "a key") {
3989
+ return text3.replace(SECRET_IN_TEXT, () => {
3990
+ hid.add(name);
3991
+ return DOTS;
3992
+ });
3993
+ }
3994
+ function withoutUserinfo(address) {
3995
+ return address.replace(/^([a-z][a-z\d+.-]*:\/\/)?[^/@\s]*@/i, (_, scheme) => scheme ?? "");
3996
+ }
3997
+ function hiddenAs(name) {
3998
+ return /passw(or)?d|pwd/i.test(name) ? DOTS : placeholder(name || "secret");
3999
+ }
4000
+ function secretField(name) {
4001
+ if (/(^|[_-])ids?$|[a-z0-9]Ids?$|(type|kind|url|uri|endpoint|expires?(_?(in|at))?|name|count|length|hint|prefix|method|mode|status|state|scheme|format|version|required|enabled)$/i.test(name)) return false;
4002
+ if (/(next|prev(ious)?|page|continuation|pagination|cursor|sync|resume|start|end|delta|change|watch|version|concurrency|lock)[-_]?token$/i.test(name)) return false;
4003
+ return /(passw(or)?d|passphrase|pwd|secrets?|credentials?|api[-_]?keys?|apikeys?|(private|access|signing|encryption|master|license|integration|consumer|client|app|account|service|auth|routing)[-_]?keys?|token)$/i.test(name) || /password[-_]?confirm(ation)?$|secret[-_]?(access[-_]?)?(key|token|value|string)$|^(authorization|auth|bearer|jwt|cookie)$/i.test(name);
4004
+ }
4005
+ function shownValue(value, name = "", depth = 0) {
4006
+ if (depth > 40) return value;
4007
+ if (typeof value === "string") {
4008
+ const v = value.trim();
4009
+ if (!v || isPlaceholder(v) || v.includes("{{")) return value;
4010
+ if (secretField(name)) return hiddenAs(name);
4011
+ return SECRET_VALUE.test(v) ? DOTS : withoutKeysInText(value, /* @__PURE__ */ new Set());
4012
+ }
4013
+ if (Array.isArray(value)) return value.map((v) => shownValue(v, name, depth + 1));
4014
+ if (isObj(value)) return Object.fromEntries(Object.entries(value).map(([key, v]) => [key, shownValue(v, key, depth + 1)]));
4015
+ return value;
4016
+ }
4017
+ function shownParam(name, value) {
4018
+ const v = value.trim();
4019
+ if (!v || isPlaceholder(v) || v.includes("{{")) return value;
4020
+ if (credentialName(name) || /^(proxy-)?authorization$|^cookie$|^sig$|^key$/i.test(name.trim())) return hiddenAs(name);
4021
+ return SECRET_VALUE.test(v) ? DOTS : withoutKeysInText(value, /* @__PURE__ */ new Set());
4022
+ }
4023
+ function shownQuery(query) {
4024
+ return query.split("&").map((part) => {
4025
+ const eq = part.indexOf("=");
4026
+ if (eq < 0) return withoutKeysInText(part, /* @__PURE__ */ new Set());
4027
+ const value = decoded(part.slice(eq + 1));
4028
+ const shown = shownParam(decoded(part.slice(0, eq)), value);
4029
+ return shown === value ? withoutKeysInText(part, /* @__PURE__ */ new Set()) : `${part.slice(0, eq)}=${shown}`;
4030
+ }).join("&");
4031
+ }
4032
+ function shownAddress(address, random = false) {
4033
+ const at = withoutUserinfo(address.trim());
4034
+ const end = at.search(/[?#]/);
4035
+ const head = end < 0 ? at : at.slice(0, end);
4036
+ const scheme = head.match(/^[a-z][a-z\d+.-]*:\/\/[^/]*/i)?.[0] ?? "";
4037
+ const path = head.slice(scheme.length).split("/").map((segment) => {
4038
+ const s = decoded(segment);
4039
+ if (!s || s.includes("{") || isPlaceholder(s)) return segment;
4040
+ if (BOT_TOKEN.test(s)) return "<bot_token>";
4041
+ if (SECRET_VALUE.test(s) || random && randomToken(s)) return "<token>";
4042
+ return withoutKeysInText(segment, /* @__PURE__ */ new Set());
4043
+ }).join("/");
4044
+ if (end < 0) return scheme + path;
4045
+ const rest = at.slice(end).replace(/([?#])([^?#]*)/g, (_, mark, part) => `${mark}${shownQuery(part)}`);
4046
+ return scheme + path + rest;
4047
+ }
4048
+ function shownCommand(command) {
4049
+ const words2 = command.split(/(\s+)/);
4050
+ let after;
4051
+ return words2.map((word) => {
4052
+ if (/^\s+$/.test(word) || !word) return word;
4053
+ const option = after;
4054
+ after = void 0;
4055
+ if (option !== void 0) return /^-/.test(word) ? word : hiddenAs(option);
4056
+ const set2 = word.match(/^(-{0,2})([A-Za-z_][\w.-]*)=(.+)$/);
4057
+ if (set2 && credentialName(set2[2])) return `${set2[1]}${set2[2]}=${hiddenAs(set2[2])}`;
4058
+ const flag = word.match(/^--?([A-Za-z][\w-]*)$/);
4059
+ if (flag && credentialName(flag[1])) after = flag[1];
4060
+ return SECRET_VALUE.test(word) || randomToken(word) ? DOTS : withoutKeysInText(word, /* @__PURE__ */ new Set());
4061
+ }).join("");
4062
+ }
4063
+ function decoded(text3) {
4064
+ try {
4065
+ return decodeURIComponent(text3.replace(/\+/g, " "));
4066
+ } catch {
4067
+ return text3;
4068
+ }
4069
+ }
4070
+
4071
+ // ../../lib/storyboard/timing.ts
4072
+ var VOICE_LEAD = 400;
4073
+ var VOICE_TAIL = 600;
4074
+ function activeScenes(sb) {
4075
+ return sb.scenes.filter((s) => sb.settings.showFailure || !s.failurePath);
4076
+ }
4077
+ function sceneDuration(sb, scene) {
4078
+ if (!sb.settings.voiceover || !scene.voiceMs) return scene.duration;
4079
+ return Math.max(scene.duration, Math.ceil(VOICE_LEAD + scene.voiceMs + VOICE_TAIL));
4080
+ }
4081
+ function totalDuration(sb) {
4082
+ return activeScenes(sb).reduce((sum, s) => sum + sceneDuration(sb, s), 0);
4083
+ }
4084
+ function summaryItems(sb) {
4085
+ const items = [];
4086
+ let failure;
4087
+ for (const scene of activeScenes(sb)) {
4088
+ if (!scene.summaryLine) continue;
4089
+ if (scene.kind === "call" && scene.outcome === "failure") {
4090
+ failure = scene.summaryLine;
4091
+ continue;
4092
+ }
4093
+ items.push(scene.summaryLine);
4094
+ if (failure) items.push(failure);
4095
+ failure = void 0;
4096
+ }
4097
+ if (failure) items.push(failure);
4098
+ return items;
4099
+ }
4100
+
3940
4101
  // ../../lib/render/code.ts
3941
4102
  function codeRequest(sb, scene) {
3942
4103
  let url = /^[a-z][a-z\d+.-]*:\/\//i.test(scene.path) ? scene.path : `${sb.api.baseUrl}${scene.path}`;
@@ -4165,7 +4326,7 @@ function python(req) {
4165
4326
  const files = typed.length ? typed : parts;
4166
4327
  const fields = typed.length ? parts.filter((p) => !p.file && !p.type) : [];
4167
4328
  const file = (p) => p.file ? `open(${jsString(filePath(p.name))}, "rb")` : p.type ? `(None, ${jsString(p.text)}, ${jsString(p.type)})` : `(None, ${jsString(p.text)})`;
4168
- const twice = (list7) => new Set(list7.map((p) => p.name)).size < list7.length;
4329
+ const twice = (list8) => new Set(list8.map((p) => p.name)).size < list8.length;
4169
4330
  if (files.length) {
4170
4331
  args.push(twice(files) ? ["files=[", ...files.map((p) => ` (${jsString(p.name)}, ${file(p)}),`), "],"] : ["files={", ...files.map((p) => ` ${jsString(p.name)}: ${file(p)},`), "},"]);
4171
4332
  }
@@ -4314,23 +4475,6 @@ function pretty(value, as, indent) {
4314
4475
  return text3.split("\n").map((line) => line.replace(/("(?:[^"\\]|\\.)*")|\b(true|false|null)\b/g, (_, str2, word) => str2 ?? { true: "True", false: "False", null: "None" }[word]));
4315
4476
  }
4316
4477
 
4317
- // ../../lib/text.ts
4318
- function cut(text3, max) {
4319
- const end = Math.max(0, max);
4320
- const last = text3.charCodeAt(end - 1);
4321
- return text3.slice(0, last >= 55296 && last <= 56319 ? end - 1 : end);
4322
- }
4323
- var HALVES = /[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDFFF]/g;
4324
- function wellFormed(text3) {
4325
- return text3.replace(HALVES, (c) => c.length === 2 ? c : "");
4326
- }
4327
- function clip(text3, max) {
4328
- return text3.length > max ? `${cut(text3, max - 1)}\u2026` : text3;
4329
- }
4330
- function plainText(markdown) {
4331
- return markdown.replace(/<[^>]+>/g, " ").replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\*\*|__|`/g, "").replace(/(^|\s)[*_]([^*_\s][^*_]*?)[*_](?=[\s.,;:!?)]|$)/g, "$1$2").replace(/^\s{0,3}(#{1,6}|>)\s+/gm, "").replace(/\s+/g, " ").trim();
4332
- }
4333
-
4334
4478
  // ../../lib/render/frame.ts
4335
4479
  var WATERMARK = "Made with integrationtour.com";
4336
4480
  var DARK = {
@@ -5259,68 +5403,47 @@ function pointer(root, path) {
5259
5403
  }
5260
5404
 
5261
5405
  // ../../lib/oas/postman.ts
5262
- var isObj = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
5406
+ var isObj2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
5263
5407
  var PLACEHOLDER_HOST = "https://api.example.com";
5264
5408
  var SCHEMA_URL = /schema\.(get)?postman\.com\/json\/collection\/v(\d+)\.(\d+)/i;
5265
5409
  function collectionIn(raw) {
5266
- if (!isObj(raw)) return void 0;
5267
- const doc = isObj(raw.collection) ? raw.collection : raw;
5268
- if (!isObj(doc.info) || !Array.isArray(doc.item) || "openapi" in doc || "swagger" in doc) return void 0;
5410
+ if (!isObj2(raw)) return void 0;
5411
+ const doc = isObj2(raw.collection) ? raw.collection : raw;
5412
+ if (!isObj2(doc.info) || !Array.isArray(doc.item) || "openapi" in doc || "swagger" in doc) return void 0;
5269
5413
  return typeof doc.info.name === "string" || typeof doc.info.schema === "string" ? doc : void 0;
5270
5414
  }
5271
5415
  function isPostmanCollection(raw) {
5272
5416
  return collectionIn(raw) !== void 0;
5273
5417
  }
5274
5418
  function isPostmanV1(raw) {
5275
- return isObj(raw) && !isObj(raw.info) && typeof raw.name === "string" && Array.isArray(raw.requests) && (Array.isArray(raw.order) || Array.isArray(raw.folders));
5419
+ return isObj2(raw) && !isObj2(raw.info) && typeof raw.name === "string" && Array.isArray(raw.requests) && (Array.isArray(raw.order) || Array.isArray(raw.folders));
5276
5420
  }
5277
5421
  function isPostmanEnvironment(raw) {
5278
- return isObj(raw) && Array.isArray(raw.values) && (raw._postman_variable_scope === "environment" || raw._postman_variable_scope === "globals");
5279
- }
5280
- function secretName(name) {
5281
- if (/idempotency/i.test(name)) return false;
5282
- return /secret|passw(or)?d|pwd|token|api[-_]?key|apikey|credential|signature|session|cookie|bearer|jwt|^auth(orization)?$/i.test(name) || /(^|[_-])key$|[a-z0-9]Key$|^key$/i.test(name);
5283
- }
5284
- var SECRET_VALUE = /^(sk|rk)_(live|test)_|^whsec_|^gh[pousr]_|^github_pat_|^xox[abposr]-|^(AKIA|ASIA)[0-9A-Z]{12,}|^eyJ[\w-]+\.[\w-]+|^(bearer|basic)\s|^sk-[\w-]{20,}|^AIza[\w-]{30,}|^ya29\.[\w-]{20,}|^SG\.[\w-]{16,}\.[\w-]{16,}|^npm_[A-Za-z0-9]{30,}|^glpat-[\w-]{20,}|^hf_[A-Za-z0-9]{30,}|^shp(at|ss|ca|pa)_[a-fA-F0-9]{32}|^sq0(atp|csp)-[\w-]{20,}|^-----BEGIN [A-Z ]*PRIVATE KEY-----/i;
5285
- function credentialName(name) {
5286
- if (/^key$/i.test(name.trim()) || /(type|kind|url|uri|endpoint|expires?(_?(in|at))?|name|count|length|hint|prefix)$/i.test(name)) return false;
5287
- return secretName(name) || /(^|[^a-z])auth([^a-z]|$)/i.test(name);
5288
- }
5289
- var BOT_TOKEN = /^bot\d{5,}:[\w-]{30,}$/;
5290
- var PREFIXED_ID = /^[a-z]{1,10}_/;
5291
- function pathSecret(segment) {
5292
- const s = segment.trim();
5293
- if (BOT_TOKEN.test(s)) return "bot_token";
5294
- if (SECRET_VALUE.test(s)) return "token";
5295
- const random = s.length >= 24 && /^[A-Za-z0-9_\-.~:]+$/.test(s) && /[a-z]/.test(s) && /[A-Z]/.test(s) && /\d/.test(s);
5296
- return random && !PREFIXED_ID.test(s) ? "token" : void 0;
5297
- }
5298
- function withoutUserinfo(address) {
5299
- return address.replace(/^([a-z][a-z\d+.-]*:\/\/)?[^/@\s]*@/i, (_, scheme) => scheme ?? "");
5300
- }
5301
- function hiddenAs(name) {
5302
- return /passw(or)?d|pwd/i.test(name) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : placeholder(name || "secret");
5422
+ return isObj2(raw) && Array.isArray(raw.values) && (raw._postman_variable_scope === "environment" || raw._postman_variable_scope === "globals");
5303
5423
  }
5304
5424
  function withoutCredential(name, value, hid) {
5305
- if (!given(value) || !(credentialName(name) || SECRET_VALUE.test(value.trim()))) return value;
5306
- hid.add(name || "a value");
5307
- return hiddenAs(name);
5425
+ if (!given(value)) return value;
5426
+ if (credentialName(name) || SECRET_VALUE.test(value.trim())) {
5427
+ hid.add(name || "a value");
5428
+ return credentialName(name) ? hiddenAs(name) : DOTS;
5429
+ }
5430
+ return withoutKeysInText(value, hid, name || "a value");
5308
5431
  }
5309
5432
  function withoutCredentials(value, hid, name = "", depth = 0) {
5310
5433
  if (depth > 40) return value;
5311
5434
  if (typeof value === "string") return withoutCredential(name, value, hid);
5312
5435
  if (Array.isArray(value)) return value.map((v) => withoutCredentials(v, hid, name, depth + 1));
5313
- if (isObj(value)) return Object.fromEntries(Object.entries(value).map(([key, v]) => [key, withoutCredentials(v, hid, key, depth + 1)]));
5436
+ if (isObj2(value)) return Object.fromEntries(Object.entries(value).map(([key, v]) => [key, withoutCredentials(v, hid, key, depth + 1)]));
5314
5437
  return value;
5315
5438
  }
5316
- function readVariables(list7, into) {
5317
- if (!Array.isArray(list7)) return;
5318
- for (const v of list7) {
5319
- if (!isObj(v) || v.disabled === true || v.enabled === false) continue;
5439
+ function readVariables(list8, into) {
5440
+ if (!Array.isArray(list8)) return;
5441
+ for (const v of list8) {
5442
+ if (!isObj2(v) || v.disabled === true || v.enabled === false) continue;
5320
5443
  const key = typeof v.key === "string" ? v.key.trim() : typeof v.id === "string" ? v.id.trim() : "";
5321
- const value = typeof v.value === "string" ? v.value : typeof v.value === "number" || typeof v.value === "boolean" ? String(v.value) : isObj(v.value) || Array.isArray(v.value) ? JSON.stringify(v.value) : "";
5444
+ const value = typeof v.value === "string" ? v.value : typeof v.value === "number" || typeof v.value === "boolean" ? String(v.value) : isObj2(v.value) || Array.isArray(v.value) ? JSON.stringify(v.value) : "";
5322
5445
  if (!key || value === "") continue;
5323
- into.set(key, { value, secret: v.type === "secret" || secretName(key) || SECRET_VALUE.test(value.trim()) });
5446
+ into.set(key, { value, secret: v.type === "secret" || secretName(key) || credentialName(key) || SECRET_VALUE.test(value.trim()) || randomToken(value) });
5324
5447
  }
5325
5448
  }
5326
5449
  var VARIABLE = /\{\{([^{}]+)\}\}/g;
@@ -5365,7 +5488,7 @@ var Variables = class {
5365
5488
  }
5366
5489
  };
5367
5490
  function textOf(description) {
5368
- const text3 = typeof description === "string" ? description : isObj(description) && typeof description.content === "string" ? description.content : void 0;
5491
+ const text3 = typeof description === "string" ? description : isObj2(description) && typeof description.content === "string" ? description.content : void 0;
5369
5492
  return text3?.trim() ? text3.trim() : void 0;
5370
5493
  }
5371
5494
  function headerList(raw) {
@@ -5380,7 +5503,7 @@ function headerList(raw) {
5380
5503
  function pairs(raw) {
5381
5504
  if (!Array.isArray(raw)) return [];
5382
5505
  return raw.flatMap((p) => {
5383
- if (!isObj(p) || typeof p.key !== "string" || !p.key.trim()) return [];
5506
+ if (!isObj2(p) || typeof p.key !== "string" || !p.key.trim()) return [];
5384
5507
  const description = textOf(p.description);
5385
5508
  return [{ key: p.key.trim(), value: p.value === void 0 || p.value === null ? "" : String(p.value), disabled: p.disabled === true, ...description ? { description } : {} }];
5386
5509
  });
@@ -5388,11 +5511,11 @@ function pairs(raw) {
5388
5511
  function urlOf(request) {
5389
5512
  const url = request.url;
5390
5513
  if (typeof url === "string") return url.trim() ? parseUrl(url) : void 0;
5391
- if (!isObj(url)) return void 0;
5514
+ if (!isObj2(url)) return void 0;
5392
5515
  const raw = typeof url.raw === "string" && url.raw.trim() ? parseUrl(url.raw) : void 0;
5393
5516
  const host = Array.isArray(url.host) ? url.host.map(String).join(".") : typeof url.host === "string" ? url.host : raw?.host;
5394
5517
  if (host === void 0 && !raw) return void 0;
5395
- const path = Array.isArray(url.path) ? url.path.map((s) => isObj(s) ? String(s.value ?? "") : String(s)) : typeof url.path === "string" ? url.path.split("/") : raw?.path ?? [];
5518
+ const path = Array.isArray(url.path) ? url.path.map((s) => isObj2(s) ? String(s.value ?? "") : String(s)) : typeof url.path === "string" ? url.path.split("/") : raw?.path ?? [];
5396
5519
  const port = typeof url.port === "string" || typeof url.port === "number" ? String(url.port) : raw?.port;
5397
5520
  return {
5398
5521
  protocol: typeof url.protocol === "string" && url.protocol ? url.protocol : raw?.protocol,
@@ -5421,11 +5544,11 @@ function parseUrl(text3) {
5421
5544
  if (port) host = host.slice(0, -port[0].length);
5422
5545
  const query = search.split("&").filter(Boolean).map((pair) => {
5423
5546
  const eq = pair.indexOf("=");
5424
- return { key: decoded(eq < 0 ? pair : pair.slice(0, eq)), value: eq < 0 ? "" : decoded(pair.slice(eq + 1)), disabled: false };
5547
+ return { key: decoded2(eq < 0 ? pair : pair.slice(0, eq)), value: eq < 0 ? "" : decoded2(pair.slice(eq + 1)), disabled: false };
5425
5548
  });
5426
5549
  return { ...protocol ? { protocol: protocol[1] } : {}, host, ...port ? { port: port[1] } : {}, path: slash < 0 ? [] : rest.slice(slash + 1).split("/"), query, variables: [] };
5427
5550
  }
5428
- function decoded(text3) {
5551
+ function decoded2(text3) {
5429
5552
  try {
5430
5553
  return decodeURIComponent(text3.replace(/\+/g, " "));
5431
5554
  } catch {
@@ -5456,10 +5579,10 @@ function pathOf(url, vars, params, hid) {
5456
5579
  const colon = segment.match(/^:([A-Za-z_][\w-]*)(.*)$/);
5457
5580
  if (colon) {
5458
5581
  const [, name, rest] = colon;
5459
- if (!params.has(name)) params.set(name, colonParam(name, url.variables, vars));
5582
+ if (!params.has(name)) params.set(name, colonParam(name, url.variables, vars, hid));
5460
5583
  return `{${name}}${vars.fill(rest, false)}`;
5461
5584
  }
5462
- const secret = segment.includes("{{") ? void 0 : pathSecret(decoded(segment));
5585
+ const secret = segment.includes("{{") ? void 0 : pathSecret(decoded2(segment));
5463
5586
  if (secret) {
5464
5587
  let param = secret;
5465
5588
  for (let n = 2; params.has(param); n++) param = `${secret}_${n}`;
@@ -5479,19 +5602,22 @@ function pathOf(url, vars, params, hid) {
5479
5602
  });
5480
5603
  return `/${out.join("/")}`;
5481
5604
  }
5482
- function colonParam(name, variables, vars) {
5483
- const variable = variables.find((v) => isObj(v) && (v.key === name || v.id === name));
5484
- const value = isObj(variable) && variable.value !== void 0 && variable.value !== null ? vars.fill(String(variable.value), false).trim() : "";
5485
- const description = isObj(variable) ? textOf(variable.description) : void 0;
5486
- return { name, in: "path", required: true, schema: isPlaceholder2(value) ? placeholderSchema(value) : { type: "string" }, ...given(value) ? { example: value } : {}, ...description ? { description } : {} };
5605
+ function colonParam(name, variables, vars, hid) {
5606
+ const variable = variables.find((v) => isObj2(v) && (v.key === name || v.id === name));
5607
+ const value = isObj2(variable) && variable.value !== void 0 && variable.value !== null ? vars.fill(String(variable.value), false).trim() : "";
5608
+ const description = isObj2(variable) ? textOf(variable.description) : void 0;
5609
+ const secret = given(value) && (credentialName(name) || SECRET_VALUE.test(value) || randomToken(value));
5610
+ if (secret) hid.add(name);
5611
+ const example = secret ? placeholder(name) : value;
5612
+ return { name, in: "path", required: true, schema: isPlaceholder2(value) ? placeholderSchema(value) : { type: "string" }, ...given(value) ? { example } : {}, ...description ? { description } : {} };
5487
5613
  }
5488
5614
  function valueOf(value) {
5489
5615
  return isPlaceholder2(value) ? { schema: placeholderSchema(value) } : { schema: { type: "string" }, example: value };
5490
5616
  }
5491
5617
  function settingsOf(auth, type2) {
5492
5618
  const raw = auth[type2];
5493
- if (Array.isArray(raw)) return Object.fromEntries(raw.flatMap((s) => isObj(s) && typeof s.key === "string" ? [[s.key, s.value]] : []));
5494
- return isObj(raw) ? raw : {};
5619
+ if (Array.isArray(raw)) return Object.fromEntries(raw.flatMap((s) => isObj2(s) && typeof s.key === "string" ? [[s.key, s.value]] : []));
5620
+ return isObj2(raw) ? raw : {};
5495
5621
  }
5496
5622
  var SIGNED = {
5497
5623
  oauth1: ["oauth1", "OAuth"],
@@ -5676,7 +5802,7 @@ function holdsPlaceholder(value, depth = 0) {
5676
5802
  if (isPlaceholder2(value)) return true;
5677
5803
  if (depth > 12) return false;
5678
5804
  if (Array.isArray(value)) return value.some((v) => holdsPlaceholder(v, depth + 1));
5679
- return isObj(value) && Object.values(value).some((v) => holdsPlaceholder(v, depth + 1));
5805
+ return isObj2(value) && Object.values(value).some((v) => holdsPlaceholder(v, depth + 1));
5680
5806
  }
5681
5807
  var given = (value) => value.trim() !== "" && !value.includes("{{") && !isPlaceholder2(value);
5682
5808
  function schemaOf(value, options, depth = 0) {
@@ -5686,7 +5812,7 @@ function schemaOf(value, options, depth = 0) {
5686
5812
  const first = value.find((v) => v !== null && v !== void 0);
5687
5813
  return { type: "array", items: first === void 0 ? {} : schemaOf(first, options, depth + 1), ...options.examples && !holdsPlaceholder(value) ? { example: value } : {} };
5688
5814
  }
5689
- if (isObj(value)) {
5815
+ if (isObj2(value)) {
5690
5816
  const keys = Object.keys(value);
5691
5817
  const required = options.required === "all" ? keys : options.required ? keys.filter((k) => !isPlaceholder2(value[k])) : [];
5692
5818
  return { type: "object", properties: Object.fromEntries(keys.map((k) => [k, schemaOf(value[k], options, depth + 1)])), ...required.length ? { required } : {} };
@@ -5702,28 +5828,28 @@ function payloadOf(value, required) {
5702
5828
  return { schema: schemaOf(value, { required }), example: value };
5703
5829
  }
5704
5830
  function bodyOf(raw, contentType, vars, hid) {
5705
- if (!isObj(raw) || raw.disabled === true) return void 0;
5831
+ if (!isObj2(raw) || raw.disabled === true) return void 0;
5706
5832
  const mode = typeof raw.mode === "string" ? raw.mode : "";
5707
5833
  switch (mode) {
5708
5834
  case "raw": {
5709
5835
  const text3 = typeof raw.raw === "string" ? raw.raw : "";
5710
5836
  if (!text3.trim()) return void 0;
5711
- const options = isObj(raw.options) && isObj(raw.options.raw) ? raw.options.raw : {};
5837
+ const options = isObj2(raw.options) && isObj2(raw.options.raw) ? raw.options.raw : {};
5712
5838
  const language = typeof options.language === "string" ? options.language.toLowerCase() : "";
5713
5839
  const type2 = contentType ?? RAW_TYPES[language] ?? (looksJson(text3) ? "application/json" : "text/plain");
5714
5840
  if (/json/i.test(type2)) {
5715
5841
  const value = jsonBody(text3, vars);
5716
5842
  if (value !== void 0) return { media: type2, ...payloadOf(withoutCredentials(value, hid), true) };
5717
- return { media: "text/plain", schema: { type: "string" }, example: vars.fill(text3) };
5843
+ return { media: "text/plain", schema: { type: "string" }, example: withoutCredentialsInText(vars.fill(text3), hid) };
5718
5844
  }
5719
- return { media: type2, schema: { type: "string" }, example: vars.fill(text3) };
5845
+ return { media: type2, schema: { type: "string" }, example: withoutCredentialsInText(vars.fill(text3), hid) };
5720
5846
  }
5721
5847
  case "urlencoded":
5722
5848
  case "formdata": {
5723
5849
  const multipart = mode === "formdata";
5724
5850
  const fields = pairs(raw[mode]);
5725
5851
  if (!fields.length) return void 0;
5726
- const files = new Set(Array.isArray(raw[mode]) ? raw[mode].flatMap((f) => multipart && isObj(f) && f.type === "file" && typeof f.key === "string" ? [f.key.trim()] : []) : []);
5852
+ const files = new Set(Array.isArray(raw[mode]) ? raw[mode].flatMap((f) => multipart && isObj2(f) && f.type === "file" && typeof f.key === "string" ? [f.key.trim()] : []) : []);
5727
5853
  const entries = fields.map((f) => {
5728
5854
  const key = vars.fill(f.key, false);
5729
5855
  return { key, file: files.has(f.key), value: withoutCredential(key, vars.fill(f.value, !f.disabled), hid), field: f };
@@ -5745,10 +5871,10 @@ function bodyOf(raw, contentType, vars, hid) {
5745
5871
  case "file":
5746
5872
  return { media: contentType ?? "application/octet-stream", schema: { type: "string", format: "binary" } };
5747
5873
  case "graphql": {
5748
- const g = isObj(raw.graphql) ? raw.graphql : {};
5749
- const query = typeof g.query === "string" ? vars.fill(g.query) : "";
5874
+ const g = isObj2(raw.graphql) ? raw.graphql : {};
5875
+ const query = typeof g.query === "string" ? withoutCredentialsInText(vars.fill(g.query), hid) : "";
5750
5876
  if (!query.trim()) return void 0;
5751
- const sent = typeof g.variables === "string" && g.variables.trim() ? jsonBody(g.variables, vars) : isObj(g.variables) ? g.variables : void 0;
5877
+ const sent = typeof g.variables === "string" && g.variables.trim() ? jsonBody(g.variables, vars) : isObj2(g.variables) ? g.variables : void 0;
5752
5878
  const variables = sent === void 0 ? void 0 : withoutCredentials(sent, hid);
5753
5879
  const example = { query, ...variables !== void 0 ? { variables } : {} };
5754
5880
  return { media: "application/json", ...payloadOf(example, true) };
@@ -5760,20 +5886,20 @@ function bodyOf(raw, contentType, vars, hid) {
5760
5886
  function responsesOf(saved, requestName, hid) {
5761
5887
  const out = {};
5762
5888
  for (const r of saved) {
5763
- if (!isObj(r)) continue;
5889
+ if (!isObj2(r)) continue;
5764
5890
  const code = typeof r.code === "number" && r.code >= 100 && r.code < 600 ? r.code : 200;
5765
5891
  const status = String(Math.trunc(code));
5766
5892
  if (out[status]) continue;
5767
5893
  const headers = headerList(r.header);
5768
5894
  const type2 = mainType(headers.find((h) => /^content-type$/i.test(h.key))?.value) ?? PREVIEW_TYPES[String(r._postman_previewlanguage)];
5769
- const name = typeof r.name === "string" ? r.name.trim() : "";
5895
+ const name = typeof r.name === "string" ? withoutKeysInText(r.name.trim(), hid) : "";
5770
5896
  const response = { description: (name !== requestName ? name : "") || (typeof r.status === "string" ? r.status.trim() : "") };
5771
5897
  if (headers.some((h) => /^retry-after$/i.test(h.key))) response.headers = { "Retry-After": { schema: { type: "integer" } } };
5772
5898
  const body = typeof r.body === "string" ? r.body : "";
5773
5899
  if (body.trim()) {
5774
5900
  const value = (type2 ? /json/i.test(type2) : looksJson(body)) ? parseJson(body) : void 0;
5775
5901
  if (value !== void 0) response.content = { [type2 ?? "application/json"]: payloadOf(withoutCredentials(value, hid), "all") };
5776
- else response.content = { [type2 && !/json/i.test(type2) ? type2 : "text/plain"]: { schema: { type: "string" }, example: body } };
5902
+ else response.content = { [type2 && !/json/i.test(type2) ? type2 : "text/plain"]: { schema: { type: "string" }, example: withoutCredentialsInText(body, hid) } };
5777
5903
  }
5778
5904
  out[status] = response;
5779
5905
  }
@@ -5799,17 +5925,17 @@ function operationIdFor(name, used) {
5799
5925
  used.add(unique);
5800
5926
  return unique;
5801
5927
  }
5802
- var ownAuth = (auth) => isObj(auth) && auth.type !== "inherit" ? auth : void 0;
5928
+ var ownAuth = (auth) => isObj2(auth) && auth.type !== "inherit" ? auth : void 0;
5803
5929
  function collect(items, folder, auth, out, counts, depth = 0) {
5804
5930
  if (!Array.isArray(items) || depth > 50) return;
5805
5931
  for (const item of items) {
5806
- if (!isObj(item)) continue;
5807
- const name = typeof item.name === "string" ? item.name.trim() : "";
5932
+ if (!isObj2(item)) continue;
5933
+ const name = typeof item.name === "string" ? withoutKeysInText(item.name.trim(), /* @__PURE__ */ new Set()) : "";
5808
5934
  if (Array.isArray(item.item)) {
5809
5935
  collect(item.item, name || folder, ownAuth(item.auth) ?? auth, out, counts, depth + 1);
5810
5936
  continue;
5811
5937
  }
5812
- const request = typeof item.request === "string" ? { method: "GET", url: item.request } : isObj(item.request) ? item.request : void 0;
5938
+ const request = typeof item.request === "string" ? { method: "GET", url: item.request } : isObj2(item.request) ? item.request : void 0;
5813
5939
  if (!request) {
5814
5940
  counts.noRequest++;
5815
5941
  continue;
@@ -5821,7 +5947,7 @@ function collect(items, folder, auth, out, counts, depth = 0) {
5821
5947
  function versionOf(v) {
5822
5948
  if (typeof v === "string") return v.trim();
5823
5949
  if (typeof v === "number") return String(v);
5824
- if (isObj(v) && typeof v.major === "number") return `${v.major}.${Number(v.minor) || 0}.${Number(v.patch) || 0}${typeof v.identifier === "string" && v.identifier ? `-${v.identifier}` : ""}`;
5950
+ if (isObj2(v) && typeof v.major === "number") return `${v.major}.${Number(v.minor) || 0}.${Number(v.patch) || 0}${typeof v.identifier === "string" && v.identifier ? `-${v.identifier}` : ""}`;
5825
5951
  return "";
5826
5952
  }
5827
5953
  var sameRequirement = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
@@ -5894,11 +6020,11 @@ function convertPostman(raw, environments = [], source) {
5894
6020
  } else if (!known) shapes.set(shape, path);
5895
6021
  const item = paths[path] ??= {};
5896
6022
  const slots = FIXED_METHODS.has(method) ? item : item.additionalOperations ??= {};
5897
- const name = bareName(vars.fill(r.name, false));
6023
+ const name = withoutKeysInText(bareName(vars.fill(r.name, false)), hid);
5898
6024
  const responses = responsesOf(r.responses, r.name, hid);
5899
6025
  const success = Object.keys(responses).some((s) => /^2/.test(s));
5900
6026
  const existing = slots[method];
5901
- if (isObj(existing)) {
6027
+ if (isObj2(existing)) {
5902
6028
  const into = existing.responses;
5903
6029
  if (success && into["200"]?.[UNSAVED]) delete into["200"];
5904
6030
  for (const [status, response] of Object.entries(responses)) into[status] ??= response;
@@ -5952,7 +6078,7 @@ function convertPostman(raw, environments = [], source) {
5952
6078
  const op = {
5953
6079
  ...operationId ? { operationId } : {},
5954
6080
  ...namesUrl(name) || !name ? {} : { summary: name },
5955
- ...r.description ? { description: r.description } : {},
6081
+ ...r.description ? { description: withoutKeysInText(r.description, hid) } : {},
5956
6082
  ...r.folder ? { tags: [r.folder] } : {},
5957
6083
  ...parameters.length ? { parameters } : {},
5958
6084
  ...body ? { requestBody: { ...BODILESS.has(lowered) ? {} : { required: true }, content: { [body.media]: { schema: body.schema, ...body.example !== void 0 ? { example: body.example } : {} } } } } : {},
@@ -5995,10 +6121,11 @@ function convertPostman(raw, environments = [], source) {
5995
6121
  if (notes.has("oauth2")) warnings.push("The OAuth 2.0 settings don't give the URLs its grant needs, so the video shows the access token being sent, not fetched.");
5996
6122
  const unknown = [...notes].filter((n) => n !== "oauth2");
5997
6123
  if (unknown.length) warnings.push(`${app}'s ${list2(unknown)} auth can't be shown, so requests that use it show none.`);
5998
- const description = textOf(info.description);
6124
+ const about = textOf(info.description);
6125
+ const description = about && withoutKeysInText(about, /* @__PURE__ */ new Set());
5999
6126
  const doc = {
6000
6127
  openapi: custom ? "3.2.0" : "3.0.3",
6001
- info: { title: typeof info.name === "string" && info.name.trim() ? info.name.trim() : `${app} collection`, version: versionOf(info.version), ...description ? { description } : {} },
6128
+ info: { title: typeof info.name === "string" && info.name.trim() ? withoutKeysInText(info.name.trim(), /* @__PURE__ */ new Set()) : `${app} collection`, version: versionOf(info.version), ...description ? { description } : {} },
6002
6129
  servers: [{ url: top }],
6003
6130
  paths,
6004
6131
  ...Object.keys(schemes.byName).length ? { components: { securitySchemes: schemes.byName } } : {},
@@ -6009,17 +6136,17 @@ function convertPostman(raw, environments = [], source) {
6009
6136
  }
6010
6137
 
6011
6138
  // ../../lib/oas/insomnia.ts
6012
- var isObj2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6139
+ var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6013
6140
  var V5_TYPE = /^(collection|spec|environment|mock|mcpClient)\.insomnia(\.rest)?\/5\.\d+$/;
6014
6141
  var INSOMNIA_IDS = "x-insomnia-requests";
6015
6142
  function insomniaKind(raw) {
6016
- if (!isObj2(raw)) return void 0;
6143
+ if (!isObj3(raw)) return void 0;
6017
6144
  if (typeof raw.type === "string") {
6018
6145
  const kind = raw.type.match(V5_TYPE)?.[1];
6019
6146
  return kind === "spec" ? "design" : kind === "mcpClient" ? "mcp" : kind;
6020
6147
  }
6021
6148
  if (raw._type !== "export" || !Array.isArray(raw.resources)) return void 0;
6022
- const resources = raw.resources.filter(isObj2);
6149
+ const resources = raw.resources.filter(isObj3);
6023
6150
  const workspace = resources.find((r) => r._type === "workspace");
6024
6151
  if (workspace?.scope === "design" || resources.some((r) => r._type === "api_spec" && typeof r.contents === "string" && r.contents.trim())) return "design";
6025
6152
  if (workspace || resources.some((r) => r._type === "request")) return "collection";
@@ -6027,11 +6154,11 @@ function insomniaKind(raw) {
6027
6154
  return "collection";
6028
6155
  }
6029
6156
  function insomniaMcpUrl(raw) {
6030
- const request = isObj2(raw) && isObj2(raw.mcpRequest) ? raw.mcpRequest : void 0;
6157
+ const request = isObj3(raw) && isObj3(raw.mcpRequest) ? raw.mcpRequest : void 0;
6031
6158
  return typeof request?.url === "string" && /^https?:\/\//i.test(request.url.trim()) ? request.url.trim() : void 0;
6032
6159
  }
6033
6160
  function readInsomnia(raw, parseYaml2) {
6034
- if (!isObj2(raw)) throw new Error("Not an Insomnia export.");
6161
+ if (!isObj3(raw)) throw new Error("Not an Insomnia export.");
6035
6162
  const workspace = typeof raw.type === "string" ? fromV5(raw) : fromV4(raw, parseYaml2);
6036
6163
  const notes = [...workspace.notes];
6037
6164
  if (isOpenApi(workspace.spec)) {
@@ -6043,22 +6170,22 @@ function readInsomnia(raw, parseYaml2) {
6043
6170
  return { ...converted, label: `an Insomnia collection (export format ${workspace.format})`, notes: [...notes, ...converted.notes] };
6044
6171
  }
6045
6172
  function isOpenApi(doc) {
6046
- return isObj2(doc) && (doc.openapi !== void 0 || doc.swagger !== void 0);
6173
+ return isObj3(doc) && (doc.openapi !== void 0 || doc.swagger !== void 0);
6047
6174
  }
6048
6175
  var text = (v) => typeof v === "string" ? v : "";
6049
6176
  var textOrUndefined = (v) => typeof v === "string" && v.trim() ? v.trim() : void 0;
6050
6177
  var sortKey = (v) => typeof v === "number" && Number.isFinite(v) ? v : 0;
6051
6178
  var bySortKey = (nodes2) => nodes2.map((n, i) => ({ n, i })).sort((a, b) => a.n.sortKey - b.n.sortKey || a.i - b.i).map(({ n }) => n);
6052
6179
  function fromV5(raw) {
6053
- const meta = isObj2(raw.meta) ? raw.meta : {};
6054
- const spec = isObj2(raw.spec) ? raw.spec : void 0;
6055
- const environments = isObj2(raw.environments) ? raw.environments : void 0;
6056
- const subs = Array.isArray(environments?.subEnvironments) ? environments.subEnvironments.filter(isObj2).map(v5Environment) : [];
6180
+ const meta = isObj3(raw.meta) ? raw.meta : {};
6181
+ const spec = isObj3(raw.spec) ? raw.spec : void 0;
6182
+ const environments = isObj3(raw.environments) ? raw.environments : void 0;
6183
+ const subs = Array.isArray(environments?.subEnvironments) ? environments.subEnvironments.filter(isObj3).map(v5Environment) : [];
6057
6184
  return {
6058
6185
  name: textOrUndefined(raw.name) ?? "Insomnia collection",
6059
6186
  ...textOrUndefined(meta.description) ? { description: textOrUndefined(meta.description) } : {},
6060
6187
  format: "5",
6061
- ...spec && isObj2(spec.contents) && Object.keys(spec.contents).length ? { spec: spec.contents } : {},
6188
+ ...spec && isObj3(spec.contents) && Object.keys(spec.contents).length ? { spec: spec.contents } : {},
6062
6189
  ...spec && typeof spec.file === "string" ? { specFile: spec.file } : {},
6063
6190
  items: v5Nodes(raw.collection, 0),
6064
6191
  ...environments ? { base: v5Environment(environments) } : {},
@@ -6067,14 +6194,14 @@ function fromV5(raw) {
6067
6194
  };
6068
6195
  }
6069
6196
  function v5Environment(env) {
6070
- const meta = isObj2(env.meta) ? env.meta : {};
6197
+ const meta = isObj3(env.meta) ? env.meta : {};
6071
6198
  const secret = new Set(Array.isArray(env.confidentialKeys) ? env.confidentialKeys.filter((k) => typeof k === "string") : []);
6072
- return { name: textOrUndefined(env.name) ?? "Environment", data: isObj2(env.data) ? env.data : {}, secret, private: meta.isPrivate === true, sortKey: sortKey(meta.sortKey) };
6199
+ return { name: textOrUndefined(env.name) ?? "Environment", data: isObj3(env.data) ? env.data : {}, secret, private: meta.isPrivate === true, sortKey: sortKey(meta.sortKey) };
6073
6200
  }
6074
- function v5Nodes(list7, depth) {
6075
- if (!Array.isArray(list7) || depth > 50) return [];
6076
- return list7.filter(isObj2).map((item) => {
6077
- const meta = isObj2(item.meta) ? item.meta : {};
6201
+ function v5Nodes(list8, depth) {
6202
+ if (!Array.isArray(list8) || depth > 50) return [];
6203
+ return list8.filter(isObj3).map((item) => {
6204
+ const meta = isObj3(item.meta) ? item.meta : {};
6078
6205
  const id = text(meta.id);
6079
6206
  const base = { id, name: text(item.name).trim(), ...textOrUndefined(meta.description) ? { description: textOrUndefined(meta.description) } : {}, private: meta.isPrivate === true, sortKey: sortKey(meta.sortKey) };
6080
6207
  if (Array.isArray(item.children) || item.method === void 0 && item.url === void 0) {
@@ -6084,7 +6211,7 @@ function v5Nodes(list7, depth) {
6084
6211
  });
6085
6212
  }
6086
6213
  function fromV4(raw, parseYaml2) {
6087
- const resources = raw.resources.filter(isObj2);
6214
+ const resources = raw.resources.filter(isObj3);
6088
6215
  const notes = [];
6089
6216
  const children = /* @__PURE__ */ new Map();
6090
6217
  for (const r of resources) {
@@ -6125,8 +6252,8 @@ function fromV4(raw, parseYaml2) {
6125
6252
  const base = environments[0];
6126
6253
  const env = (r) => ({
6127
6254
  name: textOrUndefined(r.name) ?? "Environment",
6128
- data: isObj2(r.data) ? r.data : {},
6129
- secret: new Set(Array.isArray(r.kvPairData) ? r.kvPairData.filter((p) => isObj2(p) && (p.type === "secret" || p.isConfidential === true) && typeof p.name === "string").map((p) => String(p.name)) : []),
6255
+ data: isObj3(r.data) ? r.data : {},
6256
+ secret: new Set(Array.isArray(r.kvPairData) ? r.kvPairData.filter((p) => isObj3(p) && (p.type === "secret" || p.isConfidential === true) && typeof p.name === "string").map((p) => String(p.name)) : []),
6130
6257
  private: r.isPrivate === true,
6131
6258
  sortKey: sortKey(r.metaSortKey)
6132
6259
  });
@@ -6149,14 +6276,14 @@ function pickEnvironment(subs) {
6149
6276
  const reachable = usable(subs).filter((s) => !THIS_MACHINE.test(JSON.stringify(s.data)));
6150
6277
  return reachable.find((s) => PUBLIC_ENV.test(s.name)) ?? reachable.find((s) => !LOCAL_ENV.test(s.name)) ?? reachable[0];
6151
6278
  }
6152
- function flatten(data, secret, into, prefix = "", depth = 0) {
6279
+ function flatten(data, secret, into, prefix = "", depth = 0, inside2 = false) {
6153
6280
  if (depth > 10) return;
6154
6281
  for (const [key, value] of Object.entries(data)) {
6155
6282
  const name = prefix ? `${prefix}.${key}` : key;
6156
- const marked = secret.has(name) || secret.has(key);
6157
- if (isObj2(value)) {
6283
+ const marked = inside2 || secret.has(name) || secret.has(key);
6284
+ if (isObj3(value)) {
6158
6285
  into.set(name, { value: JSON.stringify(value), secret: marked });
6159
- flatten(value, secret, into, name, depth + 1);
6286
+ flatten(value, secret, into, name, depth + 1, marked || credentialName(key));
6160
6287
  } else if (Array.isArray(value)) into.set(name, { value: JSON.stringify(value), secret: marked });
6161
6288
  else if (value !== null && value !== void 0) into.set(name, { value: String(value), secret: marked });
6162
6289
  }
@@ -6184,6 +6311,11 @@ function variableName(expression) {
6184
6311
  e = e.replace(/\[\s*(['"])(.*?)\1\s*\]/g, ".$2").replace(/^\./, "");
6185
6312
  return e && !/[{}"']/.test(e) ? e : void 0;
6186
6313
  }
6314
+ function promptDefault(args) {
6315
+ const [title, label, value, , masked] = args;
6316
+ const asks = [label, title].some((t) => typeof t === "string" && credentialName(t.trim().replace(/\s+/g, "_")));
6317
+ return typeof value === "string" && value && masked !== true && !asks ? value : void 0;
6318
+ }
6187
6319
  function tagArgs(source) {
6188
6320
  const out = [];
6189
6321
  for (const m of source.matchAll(/'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)"|(-?\d+(?:\.\d+)?)|\b(true|false)\b/g)) {
@@ -6251,33 +6383,28 @@ function tagValue(tag2, args, names, context) {
6251
6383
  case "response":
6252
6384
  return `{{${unclaimed(responseField(args, context.requests), defined)}}}`;
6253
6385
  case "prompt": {
6254
- const [title, label, value, , masked] = args;
6255
- if (typeof value === "string" && value && masked !== true) return translate(value, names, context);
6256
- return `{{${unclaimed(wordsName(String(label || title || ""), "prompt"), defined)}}}`;
6257
- }
6258
- case "base64": {
6259
- const [action, , value] = args;
6260
- if (action === "encode" && typeof value === "string" && !/[{%]/.test(value)) {
6261
- const bytes = new TextEncoder().encode(value);
6262
- return btoa(String.fromCharCode(...bytes));
6263
- }
6264
- return `{{${unclaimed(tag2, defined)}}}`;
6386
+ const value = promptDefault(args);
6387
+ if (value !== void 0) return translate(value, names, context);
6388
+ return `{{${unclaimed(wordsName(String(args[1] || args[0] || ""), "prompt"), defined)}}}`;
6265
6389
  }
6390
+ // What a base64 tag encodes is nearly always a credential (Basic auth's "user:password"), and
6391
+ // its encoding gives it back to anyone: like a hash, a cookie, another request's field, a
6392
+ // file and a vault's secret, there's nothing to show.
6266
6393
  default:
6267
6394
  return `{{${unclaimed(tag2.replace(/[^\w]+/g, "_"), defined)}}}`;
6268
6395
  }
6269
6396
  }
6270
6397
  var OWN_HEADER = (name, value) => /^user-agent$/i.test(name) && /^insomnia\//i.test(value.trim());
6271
- function pairsOf(list7) {
6272
- if (!Array.isArray(list7)) return [];
6273
- return list7.filter(isObj2).flatMap((p) => {
6398
+ function pairsOf(list8) {
6399
+ if (!Array.isArray(list8)) return [];
6400
+ return list8.filter(isObj3).flatMap((p) => {
6274
6401
  const name = text(p.name);
6275
6402
  if (!name.trim()) return [];
6276
6403
  return [{ name, value: typeof p.value === "string" ? p.value : p.value === void 0 || p.value === null ? "" : String(p.value), disabled: p.disabled === true, ...textOrUndefined(p.description) ? { description: textOrUndefined(p.description) } : {} }];
6277
6404
  });
6278
6405
  }
6279
6406
  function ownAuth2(auth) {
6280
- return isObj2(auth) && typeof auth.type === "string" && auth.type !== "none" && auth.disabled !== true ? auth : void 0;
6407
+ return isObj3(auth) && typeof auth.type === "string" && auth.type !== "none" && auth.disabled !== true ? auth : void 0;
6281
6408
  }
6282
6409
  var GRANTS2 = {
6283
6410
  authorization_code: "authorization_code",
@@ -6288,22 +6415,22 @@ var GRANTS2 = {
6288
6415
  };
6289
6416
  function postmanAuth(auth, tr) {
6290
6417
  const s = (key) => tr(text(auth[key]));
6291
- const list7 = (entries) => Object.entries(entries).map(([key, value]) => ({ key, value, type: "string" }));
6418
+ const list8 = (entries) => Object.entries(entries).map(([key, value]) => ({ key, value, type: "string" }));
6292
6419
  switch (auth.type) {
6293
6420
  case "bearer": {
6294
6421
  const prefix = text(auth.prefix).trim();
6295
6422
  if (prefix && !/^bearer$/i.test(prefix)) return { header: { name: "Authorization", value: `${prefix} ${s("token")}`, disabled: false } };
6296
- return { auth: { type: "bearer", bearer: list7({ token: s("token") }) } };
6423
+ return { auth: { type: "bearer", bearer: list8({ token: s("token") }) } };
6297
6424
  }
6298
6425
  case "singleToken":
6299
- return { auth: { type: "bearer", bearer: list7({ token: s("token") }) } };
6426
+ return { auth: { type: "bearer", bearer: list8({ token: s("token") }) } };
6300
6427
  case "basic":
6301
- return { auth: { type: "basic", basic: list7({ username: s("username"), password: s("password") }) } };
6428
+ return { auth: { type: "basic", basic: list8({ username: s("username"), password: s("password") }) } };
6302
6429
  case "apikey":
6303
- return { auth: { type: "apikey", apikey: list7({ key: s("key"), value: s("value"), in: auth.addTo === "queryParams" ? "query" : auth.addTo === "cookie" ? "cookie" : "header" }) } };
6430
+ return { auth: { type: "apikey", apikey: list8({ key: s("key"), value: s("value"), in: auth.addTo === "queryParams" ? "query" : auth.addTo === "cookie" ? "cookie" : "header" }) } };
6304
6431
  case "oauth2": {
6305
6432
  const grant = GRANTS2[text(auth.grantType)] ?? "authorization_code";
6306
- return { auth: { type: "oauth2", oauth2: list7({ grant_type: auth.usePkce === true && grant === "authorization_code" ? "authorization_code_with_pkce" : grant, accessTokenUrl: s("accessTokenUrl"), authUrl: s("authorizationUrl"), scope: s("scope") }) } };
6433
+ return { auth: { type: "oauth2", oauth2: list8({ grant_type: auth.usePkce === true && grant === "authorization_code" ? "authorization_code_with_pkce" : grant, accessTokenUrl: s("accessTokenUrl"), authUrl: s("authorizationUrl"), scope: s("scope") }) } };
6307
6434
  }
6308
6435
  case "iam":
6309
6436
  return { auth: { type: "awsv4" } };
@@ -6313,14 +6440,14 @@ function postmanAuth(auth, tr) {
6313
6440
  }
6314
6441
  var JSON_TYPE = /[/+]json$/i;
6315
6442
  function postmanBody(body, tr) {
6316
- if (!isObj2(body)) return {};
6443
+ if (!isObj3(body)) return {};
6317
6444
  const media = text(body.mimeType).trim().toLowerCase();
6318
6445
  const params = pairsOf(body.params);
6319
6446
  if (media === "application/x-www-form-urlencoded") {
6320
6447
  return params.length ? { body: { mode: "urlencoded", urlencoded: params.map((p) => ({ key: tr(p.name), value: tr(p.value), disabled: p.disabled, ...p.description ? { description: p.description } : {} })) }, media } : {};
6321
6448
  }
6322
6449
  if (media.startsWith("multipart/")) {
6323
- const raw = Array.isArray(body.params) ? body.params.filter(isObj2) : [];
6450
+ const raw = Array.isArray(body.params) ? body.params.filter(isObj3) : [];
6324
6451
  const fields = raw.filter((p) => text(p.name).trim());
6325
6452
  return fields.length ? { body: { mode: "formdata", formdata: fields.map((p) => ({ key: tr(text(p.name)), value: tr(text(p.value)), type: p.type === "file" ? "file" : "text", ...text(p.fileName) ? { src: text(p.fileName) } : {}, disabled: p.disabled === true })) }, media: "multipart/form-data" } : {};
6326
6453
  }
@@ -6332,7 +6459,7 @@ function postmanBody(body, tr) {
6332
6459
  } catch {
6333
6460
  parsed = void 0;
6334
6461
  }
6335
- if (isObj2(parsed) && typeof parsed.query === "string" && parsed.query.trim()) {
6462
+ if (isObj3(parsed) && typeof parsed.query === "string" && parsed.query.trim()) {
6336
6463
  return { body: { mode: "graphql", graphql: { query: parsed.query, ...parsed.variables !== void 0 && parsed.variables !== null ? { variables: JSON.stringify(parsed.variables) } : {} } }, media: "application/json" };
6337
6464
  }
6338
6465
  return {};
@@ -6348,9 +6475,9 @@ function folderNames(items, taken, into) {
6348
6475
  if (!node2.children || depth > 50) continue;
6349
6476
  const names = new Map(inherited);
6350
6477
  const env = node2.fields.environment;
6351
- if (isObj2(env) && Object.keys(env).length) {
6478
+ if (isObj3(env) && Object.keys(env).length) {
6352
6479
  const values = /* @__PURE__ */ new Map();
6353
- const secret = new Set([...Array.isArray(node2.fields.confidentialKeys) ? node2.fields.confidentialKeys : [], ...Array.isArray(node2.fields.kvPairData) ? node2.fields.kvPairData.filter((p) => isObj2(p) && p.type === "secret").map((p) => p.name) : []].filter((k) => typeof k === "string"));
6480
+ const secret = new Set([...Array.isArray(node2.fields.confidentialKeys) ? node2.fields.confidentialKeys : [], ...Array.isArray(node2.fields.kvPairData) ? node2.fields.kvPairData.filter((p) => isObj3(p) && p.type === "secret").map((p) => p.name) : []].filter((k) => typeof k === "string"));
6354
6481
  flatten(env, secret, values);
6355
6482
  for (const [name, v] of values) {
6356
6483
  const known = into.get(name) ?? taken.get(name);
@@ -6438,11 +6565,11 @@ function postmanRequest(node2, inheritedHeaders, tr) {
6438
6565
  const query = [
6439
6566
  ...q < 0 ? [] : url.slice(q + 1).split("&").filter(Boolean).map((pair) => {
6440
6567
  const eq = pair.indexOf("=");
6441
- return { key: decoded2(eq < 0 ? pair : pair.slice(0, eq)), value: eq < 0 ? "" : decoded2(pair.slice(eq + 1)) };
6568
+ return { key: decoded3(eq < 0 ? pair : pair.slice(0, eq)), value: eq < 0 ? "" : decoded3(pair.slice(eq + 1)) };
6442
6569
  }),
6443
6570
  ...pairsOf(f.parameters).map((p) => ({ key: tr(p.name), value: tr(p.value), ...p.disabled ? { disabled: true } : {}, ...p.description ? { description: p.description } : {} }))
6444
6571
  ];
6445
- const pathParameters = Array.isArray(f.pathParameters) ? f.pathParameters.filter(isObj2) : [];
6572
+ const pathParameters = Array.isArray(f.pathParameters) ? f.pathParameters.filter(isObj3) : [];
6446
6573
  return {
6447
6574
  id: node2.id,
6448
6575
  name: node2.name,
@@ -6457,7 +6584,7 @@ function postmanRequest(node2, inheritedHeaders, tr) {
6457
6584
  response: []
6458
6585
  };
6459
6586
  }
6460
- function decoded2(value) {
6587
+ function decoded3(value) {
6461
6588
  try {
6462
6589
  return decodeURIComponent(value.replace(/\+/g, " "));
6463
6590
  } catch {
@@ -6466,15 +6593,15 @@ function decoded2(value) {
6466
6593
  }
6467
6594
 
6468
6595
  // ../../lib/oas/swagger1.ts
6469
- var isObj3 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6596
+ var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6470
6597
  function isSwagger1(doc) {
6471
- return isObj3(doc) && doc.swaggerVersion !== void 0 && doc.swagger === void 0 && doc.openapi === void 0;
6598
+ return isObj4(doc) && doc.swaggerVersion !== void 0 && doc.swagger === void 0 && doc.openapi === void 0;
6472
6599
  }
6473
6600
  function namesDeclarations(doc) {
6474
- return !inline(doc) && arr(doc.apis).some((api) => isObj3(api) && typeof api.path === "string");
6601
+ return !inline(doc) && arr(doc.apis).some((api) => isObj4(api) && typeof api.path === "string");
6475
6602
  }
6476
6603
  function inline(doc) {
6477
- return doc.resourcePath !== void 0 || arr(doc.apis).some((api) => isObj3(api) && api.operations !== void 0);
6604
+ return doc.resourcePath !== void 0 || arr(doc.apis).some((api) => isObj4(api) && api.operations !== void 0);
6478
6605
  }
6479
6606
  function declarationUrls(listing, url) {
6480
6607
  const out = /* @__PURE__ */ new Map();
@@ -6489,7 +6616,7 @@ function declarationUrls(listing, url) {
6489
6616
  }
6490
6617
  if (String(listing.swaggerVersion) === "1.0" && /\.json$/i.test(base.pathname)) base = new URL(".", base);
6491
6618
  for (const api of arr(listing.apis)) {
6492
- if (!isObj3(api) || typeof api.path !== "string" || api.operations !== void 0) continue;
6619
+ if (!isObj4(api) || typeof api.path !== "string" || api.operations !== void 0) continue;
6493
6620
  const path = api.path.replace("{format}", "json");
6494
6621
  try {
6495
6622
  const target = /^[a-z][a-z\d+.-]*:/i.test(path) ? new URL(path) : new URL(`${base.href.replace(/\/$/, "")}/${path.replace(/^\//, "")}`);
@@ -6506,9 +6633,9 @@ function convertSwagger1(root, declaration = () => void 0) {
6506
6633
  if (inline(root)) resources.push({ doc: root });
6507
6634
  else {
6508
6635
  for (const api of arr(root.apis)) {
6509
- if (!isObj3(api) || typeof api.path !== "string") continue;
6636
+ if (!isObj4(api) || typeof api.path !== "string") continue;
6510
6637
  const doc2 = declaration(api.path);
6511
- if (!isObj3(doc2)) {
6638
+ if (!isObj4(doc2)) {
6512
6639
  missing.push(api.path);
6513
6640
  continue;
6514
6641
  }
@@ -6516,13 +6643,13 @@ function convertSwagger1(root, declaration = () => void 0) {
6516
6643
  resources.push({ doc: doc2, tag: name ? { name, ...typeof api.description === "string" ? { description: api.description } : {} } : void 0 });
6517
6644
  }
6518
6645
  }
6519
- const models = new Set(resources.flatMap(({ doc: doc2 }) => isObj3(doc2.models) ? Object.keys(doc2.models) : []));
6646
+ const models = new Set(resources.flatMap(({ doc: doc2 }) => isObj4(doc2.models) ? Object.keys(doc2.models) : []));
6520
6647
  const types2 = new TypeMapper(models);
6521
- const { definitions: securityDefinitions, names: securityNames } = securityDefinitionsOf(isObj3(root.authorizations) ? root.authorizations : {});
6648
+ const { definitions: securityDefinitions, names: securityNames } = securityDefinitionsOf(isObj4(root.authorizations) ? root.authorizations : {});
6522
6649
  const security = (auth) => {
6523
- if (!isObj3(auth)) return void 0;
6650
+ if (!isObj4(auth)) return void 0;
6524
6651
  return Object.entries(auth).flatMap(
6525
- ([name, scopes]) => (securityNames.get(name) ?? [name]).map((n) => ({ [n]: arr(scopes).flatMap((s) => isObj3(s) && typeof s.scope === "string" ? [s.scope] : []) }))
6652
+ ([name, scopes]) => (securityNames.get(name) ?? [name]).map((n) => ({ [n]: arr(scopes).flatMap((s) => isObj4(s) && typeof s.scope === "string" ? [s.scope] : []) }))
6526
6653
  );
6527
6654
  };
6528
6655
  const bases = resources.map(({ doc: doc2 }) => baseOf(doc2.basePath ?? root.basePath, root.basePath));
@@ -6534,7 +6661,7 @@ function convertSwagger1(root, declaration = () => void 0) {
6534
6661
  const definitions = {};
6535
6662
  let anySecurity = false;
6536
6663
  resources.forEach(({ doc: doc2, tag: tag2 }, i) => {
6537
- Object.assign(definitions, definitionsOf(isObj3(doc2.models) ? doc2.models : {}, types2));
6664
+ Object.assign(definitions, definitionsOf(isObj4(doc2.models) ? doc2.models : {}, types2));
6538
6665
  const defaults = {
6539
6666
  produces: strings(doc2.produces),
6540
6667
  consumes: strings(doc2.consumes),
@@ -6542,11 +6669,11 @@ function convertSwagger1(root, declaration = () => void 0) {
6542
6669
  tags: tag2 ? [tag2.name] : void 0
6543
6670
  };
6544
6671
  for (const api of arr(doc2.apis)) {
6545
- if (!isObj3(api) || typeof api.path !== "string" || !Array.isArray(api.operations)) continue;
6672
+ if (!isObj4(api) || typeof api.path !== "string" || !Array.isArray(api.operations)) continue;
6546
6673
  const path = `${prefixes[i].slice(common2.length)}/${api.path.replace(/^\//, "").replace("{format}", "json")}`.replace(/\/$/, "") || "/";
6547
- const item = isObj3(paths[path]) ? paths[path] : paths[path] = {};
6674
+ const item = isObj4(paths[path]) ? paths[path] : paths[path] = {};
6548
6675
  for (const op of api.operations) {
6549
- if (!isObj3(op)) continue;
6676
+ if (!isObj4(op)) continue;
6550
6677
  const method = String(op.method ?? op.httpMethod ?? "get").toLowerCase();
6551
6678
  const opSecurity = security(op.authorizations) ?? defaults.security;
6552
6679
  if (opSecurity?.length) anySecurity = true;
@@ -6558,7 +6685,7 @@ function convertSwagger1(root, declaration = () => void 0) {
6558
6685
  deprecated: lenient(op.deprecated) === true ? true : void 0,
6559
6686
  produces: strings(op.produces) ?? defaults.produces,
6560
6687
  consumes: strings(op.consumes) ?? defaults.consumes,
6561
- parameters: arr(op.parameters).flatMap((p) => isObj3(p) ? [parameterOf(p, types2)] : []),
6688
+ parameters: arr(op.parameters).flatMap((p) => isObj4(p) ? [parameterOf(p, types2)] : []),
6562
6689
  responses: responsesOf2(op, types2),
6563
6690
  security: opSecurity
6564
6691
  });
@@ -6569,7 +6696,7 @@ function convertSwagger1(root, declaration = () => void 0) {
6569
6696
  });
6570
6697
  const firstScheme = Object.keys(securityDefinitions)[0];
6571
6698
  const host = origin && origin !== "null" ? new URL(origin) : void 0;
6572
- const info = isObj3(root.info) ? root.info : {};
6699
+ const info = isObj4(root.info) ? root.info : {};
6573
6700
  const doc = clean({
6574
6701
  swagger: "2.0",
6575
6702
  info: clean({
@@ -6642,11 +6769,11 @@ var TypeMapper = class {
6642
6769
  const out = this.named(old.type ?? old.dataType ?? old.responseClass ?? old.$ref, allowRef);
6643
6770
  if (old.items !== void 0) {
6644
6771
  const items = typeof old.items === "string" ? { type: old.items } : old.items;
6645
- if (isObj3(items)) out.items = this.data(items, allowRef);
6772
+ if (isObj4(items)) out.items = this.data(items, allowRef);
6646
6773
  }
6647
- if (out.type === "array" && !isObj3(out.items)) out.items = {};
6774
+ if (out.type === "array" && !isObj4(out.items)) out.items = {};
6648
6775
  const defaultValue = old.defaultValue ?? old.default;
6649
- const allowable = isObj3(old.allowableValues) ? old.allowableValues : void 0;
6776
+ const allowable = isObj4(old.allowableValues) ? old.allowableValues : void 0;
6650
6777
  const valueType = String(allowable?.valueType ?? "").toUpperCase();
6651
6778
  return clean({
6652
6779
  ...out,
@@ -6696,14 +6823,14 @@ function parameterOf(old, types2) {
6696
6823
  if (where === "body") return { ...base, schema: types2.data(old, true) };
6697
6824
  let schema2 = types2.data(old, false);
6698
6825
  if (schema2.type === void 0 || schema2.$ref !== void 0) schema2 = { ...schema2, $ref: void 0, type: "string" };
6699
- if (schema2.type === "array" && isObj3(schema2.items) && schema2.items.type === void 0) schema2.items = { ...schema2.items, type: "string" };
6826
+ if (schema2.type === "array" && isObj4(schema2.items) && schema2.items.type === void 0) schema2.items = { ...schema2.items, type: "string" };
6700
6827
  if (lenient(old.allowMultiple) === true && schema2.type !== "array") schema2 = { type: "array", items: schema2 };
6701
6828
  return clean({ ...base, ...schema2 });
6702
6829
  }
6703
6830
  function responsesOf2(op, types2) {
6704
6831
  const responses = {};
6705
6832
  for (const r of [...arr(op.responseMessages), ...arr(op.errorResponses)]) {
6706
- if (!isObj3(r) || r.code === void 0) continue;
6833
+ if (!isObj4(r) || r.code === void 0) continue;
6707
6834
  const schema2 = types2.named(r.responseModel, true);
6708
6835
  responses[String(r.code)] = clean({ description: String(r.message ?? r.reason ?? ""), schema: Object.keys(schema2).length ? schema2 : void 0 });
6709
6836
  }
@@ -6715,10 +6842,10 @@ function responsesOf2(op, types2) {
6715
6842
  }
6716
6843
  function definitionsOf(models, types2) {
6717
6844
  const out = {};
6718
- for (const [id, model] of Object.entries(models)) if (isObj3(model)) out[id] = modelOf(model, types2);
6845
+ for (const [id, model] of Object.entries(models)) if (isObj4(model)) out[id] = modelOf(model, types2);
6719
6846
  for (const [id, parent] of Object.entries(models)) {
6720
- for (const child of arr(isObj3(parent) ? parent.subTypes : void 0)) {
6721
- if (typeof child !== "string" || !isObj3(out[child])) continue;
6847
+ for (const child of arr(isObj4(parent) ? parent.subTypes : void 0)) {
6848
+ if (typeof child !== "string" || !isObj4(out[child])) continue;
6722
6849
  const current2 = out[child];
6723
6850
  out[child] = { allOf: [...Array.isArray(current2.allOf) ? current2.allOf : [current2], { $ref: `#/definitions/${id}` }] };
6724
6851
  }
@@ -6728,8 +6855,8 @@ function definitionsOf(models, types2) {
6728
6855
  function modelOf(old, types2) {
6729
6856
  const properties = {};
6730
6857
  const required = Array.isArray(old.required) ? old.required.filter((r) => typeof r === "string") : [];
6731
- for (const [name, prop] of Object.entries(isObj3(old.properties) ? old.properties : {})) {
6732
- if (!isObj3(prop)) continue;
6858
+ for (const [name, prop] of Object.entries(isObj4(old.properties) ? old.properties : {})) {
6859
+ if (!isObj4(prop)) continue;
6733
6860
  if (lenient(prop.required) === true && !required.includes(name)) required.push(name);
6734
6861
  properties[name] = modelOf(prop, types2);
6735
6862
  }
@@ -6741,15 +6868,15 @@ function modelOf(old, types2) {
6741
6868
  properties: Object.keys(properties).length ? properties : void 0,
6742
6869
  discriminator: typeof old.discriminator === "string" ? old.discriminator : void 0,
6743
6870
  example: old.example,
6744
- items: isObj3(old.items) ? modelOf(old.items, types2) : void 0
6871
+ items: isObj4(old.items) ? modelOf(old.items, types2) : void 0
6745
6872
  });
6746
6873
  }
6747
6874
  function securityDefinitionsOf(old) {
6748
6875
  const definitions = {};
6749
6876
  const names = /* @__PURE__ */ new Map();
6750
6877
  for (const [name, auth] of Object.entries(old)) {
6751
- if (!isObj3(auth)) continue;
6752
- const scopes = Object.fromEntries(arr(auth.scopes).flatMap((s) => isObj3(s) && typeof s.scope === "string" ? [[s.scope, typeof s.description === "string" ? s.description : s.scope]] : []));
6878
+ if (!isObj4(auth)) continue;
6879
+ const scopes = Object.fromEntries(arr(auth.scopes).flatMap((s) => isObj4(s) && typeof s.scope === "string" ? [[s.scope, typeof s.description === "string" ? s.description : s.scope]] : []));
6753
6880
  if (auth.type === "basicAuth" || auth.type === "basic") {
6754
6881
  definitions[name] = { type: "basic" };
6755
6882
  names.set(name, [name]);
@@ -6757,11 +6884,11 @@ function securityDefinitionsOf(old) {
6757
6884
  definitions[name] = { type: "apiKey", in: auth.passAs === "query" ? "query" : "header", name: typeof auth.keyname === "string" ? auth.keyname : "api_key" };
6758
6885
  names.set(name, [name]);
6759
6886
  } else if (auth.type === "oauth2") {
6760
- const grants = isObj3(auth.grantTypes) ? Object.entries(auth.grantTypes) : [];
6887
+ const grants = isObj4(auth.grantTypes) ? Object.entries(auth.grantTypes) : [];
6761
6888
  const made = [];
6762
6889
  for (const [grant, detail] of grants) {
6763
- const d = isObj3(detail) ? detail : {};
6764
- const endpoint = (key2) => isObj3(d[key2]) && typeof d[key2].url === "string" ? d[key2].url : void 0;
6890
+ const d = isObj4(detail) ? detail : {};
6891
+ const endpoint = (key2) => isObj4(d[key2]) && typeof d[key2].url === "string" ? d[key2].url : void 0;
6765
6892
  const flow = grant === "implicit" ? clean({ flow: "implicit", authorizationUrl: endpoint("loginEndpoint") }) : grant === "authorization_code" ? clean({ flow: "accessCode", authorizationUrl: endpoint("tokenRequestEndpoint"), tokenUrl: endpoint("tokenEndpoint") }) : void 0;
6766
6893
  if (!flow) continue;
6767
6894
  const key = grants.length > 1 ? `${name}_${flow.flow}` : name;
@@ -6790,7 +6917,7 @@ function clean(obj) {
6790
6917
  for (const [key, value] of Object.entries(obj)) {
6791
6918
  if (value === void 0) continue;
6792
6919
  if (Array.isArray(value) && value.length === 0) continue;
6793
- if (isObj3(value) && Object.keys(value).length === 0 && key !== "paths" && key !== "schema" && key !== "items") continue;
6920
+ if (isObj4(value) && Object.keys(value).length === 0 && key !== "paths" && key !== "schema" && key !== "items") continue;
6794
6921
  out[key] = value;
6795
6922
  }
6796
6923
  return out;
@@ -6803,27 +6930,27 @@ function strings(value) {
6803
6930
  }
6804
6931
 
6805
6932
  // ../../lib/oas/swagger2.ts
6806
- var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6933
+ var isObj5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
6807
6934
  var SCHEMA_FIELDS = ["type", "format", "items", "enum", "default", "minimum", "maximum", "exclusiveMinimum", "exclusiveMaximum", "minLength", "maxLength", "pattern", "minItems", "maxItems", "uniqueItems", "multipleOf"];
6808
6935
  var OAUTH_FLOWS = { implicit: "implicit", password: "password", application: "clientCredentials", accessCode: "authorizationCode" };
6809
6936
  function convertSwagger2(doc) {
6810
6937
  const consumes = strings2(doc.consumes) ?? ["application/json"];
6811
6938
  const produces = strings2(doc.produces) ?? ["application/json"];
6812
- const sharedParams = isObj4(doc.parameters) ? doc.parameters : {};
6939
+ const sharedParams = isObj5(doc.parameters) ? doc.parameters : {};
6813
6940
  const resolveParam = (p) => {
6814
- const ref = isObj4(p) && typeof p.$ref === "string" ? p.$ref.match(/^#\/parameters\/(.+)$/)?.[1] : void 0;
6941
+ const ref = isObj5(p) && typeof p.$ref === "string" ? p.$ref.match(/^#\/parameters\/(.+)$/)?.[1] : void 0;
6815
6942
  return ref !== void 0 ? sharedParams[decodePointer(ref)] : p;
6816
6943
  };
6817
6944
  const paths = {};
6818
- for (const [path, rawItem] of Object.entries(isObj4(doc.paths) ? doc.paths : {})) {
6819
- if (!isObj4(rawItem)) continue;
6945
+ for (const [path, rawItem] of Object.entries(isObj5(doc.paths) ? doc.paths : {})) {
6946
+ if (!isObj5(rawItem)) continue;
6820
6947
  const item = {};
6821
6948
  const pathParams = arr2(rawItem.parameters).map(resolveParam);
6822
- const plain = pathParams.filter((p) => isObj4(p) && p.in !== "body" && p.in !== "formData");
6949
+ const plain = pathParams.filter((p) => isObj5(p) && p.in !== "body" && p.in !== "formData");
6823
6950
  if (plain.length) item.parameters = plain.map(convertParameter);
6824
6951
  for (const method of ["get", "put", "post", "delete", "options", "head", "patch"]) {
6825
6952
  const op = rawItem[method];
6826
- if (!isObj4(op)) continue;
6953
+ if (!isObj5(op)) continue;
6827
6954
  const params = mergeParams(pathParams, arr2(op.parameters).map(resolveParam));
6828
6955
  const out2 = {};
6829
6956
  for (const key of ["operationId", "summary", "description", "tags", "deprecated", "security", "externalDocs"]) if (op[key] !== void 0) out2[key] = op[key];
@@ -6837,9 +6964,9 @@ function convertSwagger2(doc) {
6837
6964
  paths[path] = item;
6838
6965
  }
6839
6966
  const components = {};
6840
- if (isObj4(doc.definitions)) components.schemas = convertSchemas(doc.definitions);
6841
- if (isObj4(doc.responses)) components.responses = Object.fromEntries(Object.entries(doc.responses).map(([k, r]) => [k, convertResponse(r, produces)]));
6842
- if (isObj4(doc.securityDefinitions)) components.securitySchemes = Object.fromEntries(Object.entries(doc.securityDefinitions).map(([k, s]) => [k, convertSecurity(s)]));
6967
+ if (isObj5(doc.definitions)) components.schemas = convertSchemas(doc.definitions);
6968
+ if (isObj5(doc.responses)) components.responses = Object.fromEntries(Object.entries(doc.responses).map(([k, r]) => [k, convertResponse(r, produces)]));
6969
+ if (isObj5(doc.securityDefinitions)) components.securitySchemes = Object.fromEntries(Object.entries(doc.securityDefinitions).map(([k, s]) => [k, convertSecurity(s)]));
6843
6970
  const out = { openapi: "3.0.3", info: doc.info, paths, ...Object.keys(components).length ? { components } : {} };
6844
6971
  const servers = serversOf(doc);
6845
6972
  if (servers.length) out.servers = servers;
@@ -6858,11 +6985,11 @@ function serversOf(doc) {
6858
6985
  }
6859
6986
  function mergeParams(shared, own) {
6860
6987
  const byKey = /* @__PURE__ */ new Map();
6861
- for (const p of [...shared, ...own]) if (isObj4(p) && typeof p.name === "string") byKey.set(`${p.in}:${p.name}`, p);
6988
+ for (const p of [...shared, ...own]) if (isObj5(p) && typeof p.name === "string") byKey.set(`${p.in}:${p.name}`, p);
6862
6989
  return [...byKey.values()];
6863
6990
  }
6864
6991
  function convertParameter(raw) {
6865
- const p = isObj4(raw) ? raw : {};
6992
+ const p = isObj5(raw) ? raw : {};
6866
6993
  const out = { name: p.name, in: p.in };
6867
6994
  for (const key of ["description", "required", "deprecated", "allowEmptyValue"]) if (p[key] !== void 0) out[key] = p[key];
6868
6995
  out.schema = schemaFromFields(p);
@@ -6871,7 +6998,7 @@ function convertParameter(raw) {
6871
6998
  }
6872
6999
  function schemaFromFields(p) {
6873
7000
  const schema2 = {};
6874
- for (const key of SCHEMA_FIELDS) if (p[key] !== void 0) schema2[key] = key === "items" && isObj4(p.items) ? schemaFromFields(p.items) : p[key];
7001
+ for (const key of SCHEMA_FIELDS) if (p[key] !== void 0) schema2[key] = key === "items" && isObj5(p.items) ? schemaFromFields(p.items) : p[key];
6875
7002
  if (schema2.type === "file") return { type: "string", format: "binary" };
6876
7003
  return schema2;
6877
7004
  }
@@ -6893,15 +7020,15 @@ function requestBody(params, consumes) {
6893
7020
  }
6894
7021
  function convertResponses(raw, produces) {
6895
7022
  const out = {};
6896
- for (const [status, response] of Object.entries(isObj4(raw) ? raw : {})) out[status] = convertResponse(response, produces);
7023
+ for (const [status, response] of Object.entries(isObj5(raw) ? raw : {})) out[status] = convertResponse(response, produces);
6897
7024
  return out;
6898
7025
  }
6899
7026
  function convertResponse(raw, produces) {
6900
- const r = isObj4(raw) ? raw : {};
7027
+ const r = isObj5(raw) ? raw : {};
6901
7028
  if (typeof r.$ref === "string") return { $ref: r.$ref };
6902
7029
  const out = { description: typeof r.description === "string" ? r.description : "" };
6903
- if (isObj4(r.headers)) out.headers = Object.fromEntries(Object.entries(r.headers).map(([name, h]) => [name, { ...isObj4(h) && typeof h.description === "string" ? { description: h.description } : {}, schema: schemaFromFields(isObj4(h) ? h : {}) }]));
6904
- const examples = isObj4(r.examples) ? r.examples : {};
7030
+ if (isObj5(r.headers)) out.headers = Object.fromEntries(Object.entries(r.headers).map(([name, h]) => [name, { ...isObj5(h) && typeof h.description === "string" ? { description: h.description } : {}, schema: schemaFromFields(isObj5(h) ? h : {}) }]));
7031
+ const examples = isObj5(r.examples) ? r.examples : {};
6905
7032
  if (r.schema !== void 0 || Object.keys(examples).length) {
6906
7033
  const types2 = [.../* @__PURE__ */ new Set([...produces, ...Object.keys(examples)])];
6907
7034
  out.content = Object.fromEntries(
@@ -6915,7 +7042,7 @@ function convertSchemas(defs) {
6915
7042
  }
6916
7043
  function convertSchema(raw) {
6917
7044
  if (Array.isArray(raw)) return raw.map(convertSchema);
6918
- if (!isObj4(raw)) return raw;
7045
+ if (!isObj5(raw)) return raw;
6919
7046
  const out = {};
6920
7047
  for (const [key, value] of Object.entries(raw)) {
6921
7048
  if (key === "x-nullable") out.nullable = value;
@@ -6929,12 +7056,12 @@ function convertSchema(raw) {
6929
7056
  return out;
6930
7057
  }
6931
7058
  function convertSecurity(raw) {
6932
- const s = isObj4(raw) ? raw : {};
7059
+ const s = isObj5(raw) ? raw : {};
6933
7060
  if (s.type === "basic") return { type: "http", scheme: "basic", ...typeof s.description === "string" ? { description: s.description } : {} };
6934
7061
  if (s.type === "apiKey") return { type: "apiKey", name: s.name, in: s.in };
6935
7062
  if (s.type === "oauth2") {
6936
7063
  const flow = OAUTH_FLOWS[String(s.flow)] ?? "clientCredentials";
6937
- const details = { scopes: isObj4(s.scopes) ? s.scopes : {} };
7064
+ const details = { scopes: isObj5(s.scopes) ? s.scopes : {} };
6938
7065
  if (typeof s.authorizationUrl === "string") details.authorizationUrl = s.authorizationUrl;
6939
7066
  if (typeof s.tokenUrl === "string") details.tokenUrl = s.tokenUrl;
6940
7067
  return { type: "oauth2", flows: { [flow]: details } };
@@ -6943,7 +7070,7 @@ function convertSecurity(raw) {
6943
7070
  }
6944
7071
  function rewriteRefs(node2) {
6945
7072
  if (Array.isArray(node2)) return node2.map(rewriteRefs);
6946
- if (!isObj4(node2)) return node2;
7073
+ if (!isObj5(node2)) return node2;
6947
7074
  const out = {};
6948
7075
  for (const [key, value] of Object.entries(node2)) {
6949
7076
  if (key === "$ref" && typeof value === "string") out[key] = value.replace(/^#\/definitions\//, "#/components/schemas/").replace(/^#\/responses\//, "#/components/responses/");
@@ -6967,12 +7094,12 @@ var HTTP_METHODS = ["get", "post", "put", "patch", "delete", "head", "options",
6967
7094
  var SAFE_METHODS = /* @__PURE__ */ new Set(["get", "head", "options", "trace", "query"]);
6968
7095
  var METHOD_TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
6969
7096
  function operationsOf(item) {
6970
- if (!isObj5(item)) return [];
7097
+ if (!isObj6(item)) return [];
6971
7098
  const out = [];
6972
- for (const method of HTTP_METHODS) if (isObj5(item[method])) out.push([method, item[method]]);
6973
- if (isObj5(item.additionalOperations)) {
7099
+ for (const method of HTTP_METHODS) if (isObj6(item[method])) out.push([method, item[method]]);
7100
+ if (isObj6(item.additionalOperations)) {
6974
7101
  for (const [method, op] of Object.entries(item.additionalOperations)) {
6975
- if (isObj5(op) && METHOD_TOKEN.test(method) && !HTTP_METHODS.includes(method.toLowerCase())) out.push([method, op]);
7102
+ if (isObj6(op) && METHOD_TOKEN.test(method) && !HTTP_METHODS.includes(method.toLowerCase())) out.push([method, op]);
6976
7103
  }
6977
7104
  }
6978
7105
  return out;
@@ -6980,7 +7107,7 @@ function operationsOf(item) {
6980
7107
  function methodName(method) {
6981
7108
  return HTTP_METHODS.includes(method) ? method.toUpperCase() : method;
6982
7109
  }
6983
- function isObj5(value) {
7110
+ function isObj6(value) {
6984
7111
  return typeof value === "object" && value !== null && !Array.isArray(value);
6985
7112
  }
6986
7113
 
@@ -7801,10 +7928,10 @@ function toolOperation(shape, prefix, idFor, context, requiresAuth, style) {
7801
7928
  id: tool.name,
7802
7929
  method: "tools/call",
7803
7930
  path: tool.name,
7804
- summary: firstSentence(tool.description) ?? tool.title ?? label,
7931
+ summary: firstSentence2(tool.description) ?? tool.title ?? label,
7805
7932
  label,
7806
7933
  tags: [],
7807
- deprecated: [tool.title, firstSentence(tool.description)].some((text3) => typeof text3 === "string" && /\[deprecated\]|\(deprecated\)|^\W*deprecated\b/i.test(text3)),
7934
+ deprecated: [tool.title, firstSentence2(tool.description)].some((text3) => typeof text3 === "string" && /\[deprecated\]|\(deprecated\)|^\W*deprecated\b/i.test(text3)),
7808
7935
  resource: shape.provides ?? shape.noun,
7809
7936
  ...shape.verb ? { action: shape.verb } : {},
7810
7937
  pathParams: [],
@@ -7836,7 +7963,7 @@ function toolOperation(shape, prefix, idFor, context, requiresAuth, style) {
7836
7963
  function toolLabel(shape, prefix) {
7837
7964
  const { tool, verb } = shape;
7838
7965
  if (tool.title && (asLabel(tool.title) || tool.title.length <= 40)) return asLabel(tool.title) ?? (verbOf(tool.title.split(" ")[0]) ? sentenceCase(tool.title) : tool.title);
7839
- if (!verb) return asLabel(firstSentence(tool.description) ?? "") ?? tool.name;
7966
+ if (!verb) return asLabel(firstSentence2(tool.description) ?? "") ?? tool.name;
7840
7967
  const rest = shape.rest.length ? shape.rest.map(written) : prefix ? [capitalize(prefix)] : [];
7841
7968
  return capitalize([verb, ...rest].join(" "));
7842
7969
  }
@@ -7886,7 +8013,7 @@ function listTools(server, requiresAuth, style) {
7886
8013
  }
7887
8014
  function toolsListResult(tools, style) {
7888
8015
  return {
7889
- tools: tools.map((t) => ({ name: t.name, ...t.title ? { title: t.title } : {}, description: clip(firstSentence(t.description) ?? t.title ?? t.name, 90), inputSchema: t.inputSchema ?? { type: "object" } })),
8016
+ tools: tools.map((t) => ({ name: t.name, ...t.title ? { title: t.title } : {}, description: clip(firstSentence2(t.description) ?? t.title ?? t.name, 90), inputSchema: t.inputSchema ?? { type: "object" } })),
7890
8017
  ...resultFields(style, LIST_TTL_MS)
7891
8018
  };
7892
8019
  }
@@ -7908,7 +8035,7 @@ function readOperation(id, uri, name, description, mimeType, params, examples, r
7908
8035
  id,
7909
8036
  method: "resources/read",
7910
8037
  path: uri,
7911
- summary: firstSentence(description) ?? label,
8038
+ summary: firstSentence2(description) ?? label,
7912
8039
  label: clip(label, 60),
7913
8040
  tags: [],
7914
8041
  deprecated: false,
@@ -7933,7 +8060,7 @@ function promptOperation(prompt, requiresAuth, style) {
7933
8060
  id: `prompt:${prompt.name}`,
7934
8061
  method: "prompts/get",
7935
8062
  path: prompt.name,
7936
- summary: firstSentence(prompt.description) ?? label,
8063
+ summary: firstSentence2(prompt.description) ?? label,
7937
8064
  label: clip(label, 60),
7938
8065
  tags: [],
7939
8066
  deprecated: false,
@@ -7945,7 +8072,7 @@ function promptOperation(prompt, requiresAuth, style) {
7945
8072
  request: fixed(values, true),
7946
8073
  success: {
7947
8074
  status: "result",
7948
- payload: fixed({ messages: [{ role: "user", content: { type: "text", text: clip(firstSentence(prompt.description) ?? `${label}.`, 120) } }], ...resultFields(style) }, true)
8075
+ payload: fixed({ messages: [{ role: "user", content: { type: "text", text: clip(firstSentence2(prompt.description) ?? `${label}.`, 120) } }], ...resultFields(style) }, true)
7949
8076
  },
7950
8077
  errors: [],
7951
8078
  callbacks: [],
@@ -7999,7 +8126,7 @@ function objectShape(schema2, depth = 0) {
7999
8126
  if (Array.isArray(schema2.required)) required.push(...schema2.required.filter((r) => typeof r === "string"));
8000
8127
  return { properties, required: [...new Set(required)] };
8001
8128
  }
8002
- function firstSentence(text3) {
8129
+ function firstSentence2(text3) {
8003
8130
  if (!text3) return void 0;
8004
8131
  const plain = text3.replace(/\s+/g, " ").trim();
8005
8132
  if (!plain) return void 0;
@@ -8024,7 +8151,7 @@ function written(word) {
8024
8151
  // ../../lib/oas/model.ts
8025
8152
  var VERSION_SEGMENT = /^(v\d+(\.\d+)*|\d{4}-\d{2}-\d{2}|api|rest)$/i;
8026
8153
  function buildModel(doc) {
8027
- if (doc["x-mcp"]) return mcpModel(doc["x-mcp"]);
8154
+ if (doc["x-mcp"]) return shownModel(mcpModel(doc["x-mcp"]));
8028
8155
  const baseUrl = baseUrlOf(doc);
8029
8156
  const operations = [];
8030
8157
  const seen = /* @__PURE__ */ new Set();
@@ -8043,7 +8170,7 @@ function buildModel(doc) {
8043
8170
  webhooks.push(...webhooksFromPathItem(name, item));
8044
8171
  }
8045
8172
  for (const op of operations) webhooks.push(...op.callbacks);
8046
- return {
8173
+ return shownModel({
8047
8174
  title: doc.info.title,
8048
8175
  version: doc.info.version,
8049
8176
  description: doc.info.description,
@@ -8052,6 +8179,52 @@ function buildModel(doc) {
8052
8179
  auth: authOf2(doc),
8053
8180
  webhooks,
8054
8181
  tags: (Array.isArray(doc.tags) ? doc.tags : []).flatMap((t) => isObject2(t) && typeof t.name === "string" ? [t.name] : [])
8182
+ });
8183
+ }
8184
+ function shownModel(model) {
8185
+ const keys = (text3) => withoutKeysInText(text3, /* @__PURE__ */ new Set());
8186
+ const address = (url) => model.mcp && !/^[a-z][a-z\d+.-]*:\/\//i.test(url) ? shownCommand(url) : shownAddress(url, Boolean(model.mcp));
8187
+ const payload = (p) => {
8188
+ if (!p) return p;
8189
+ let memo;
8190
+ return {
8191
+ contentType: p.contentType,
8192
+ get value() {
8193
+ memo ??= { value: typeof p.value === "string" && isTextKind(mediaKind(p.contentType)) ? withoutCredentialsInText(p.value, /* @__PURE__ */ new Set()) : shownValue(p.value) };
8194
+ return memo.value;
8195
+ },
8196
+ get generated() {
8197
+ return p.generated;
8198
+ },
8199
+ ...p.schema ? { schema: p.schema } : {}
8200
+ };
8201
+ };
8202
+ const hooks = /* @__PURE__ */ new Map();
8203
+ const hook = (w) => {
8204
+ if (!hooks.has(w)) hooks.set(w, { ...w, summary: keys(w.summary), ...w.payload ? { payload: payload(w.payload) } : {} });
8205
+ return hooks.get(w);
8206
+ };
8207
+ return {
8208
+ ...model,
8209
+ title: keys(model.title),
8210
+ ...model.description ? { description: keys(model.description) } : {},
8211
+ baseUrl: address(model.baseUrl),
8212
+ operations: model.operations.map((op) => ({
8213
+ ...op,
8214
+ summary: keys(op.summary),
8215
+ // A label made from a summary that held a key spells the key as words: the summary names the call instead.
8216
+ ...op.label ? keys(op.summary) === op.summary ? { label: keys(op.label) } : { label: void 0 } : {},
8217
+ ...op.baseUrl ? { baseUrl: address(op.baseUrl) } : {},
8218
+ ...op.query ? { query: shownQuery(op.query) } : {},
8219
+ ...op.headers ? { headers: op.headers.map(([name, value]) => [name, shownParam(name, value)]) } : {},
8220
+ ...op.cookies ? { cookies: op.cookies.map(([name, value]) => [name, shownParam(name, value)]) } : {},
8221
+ pathParamExamples: Object.fromEntries(Object.entries(op.pathParamExamples).map(([name, value]) => [name, typeof value === "string" && (secretField(name) || SECRET_VALUE.test(value.trim())) && !isPlaceholder(value) ? placeholder(name) : value])),
8222
+ ...op.request ? { request: payload(op.request) } : {},
8223
+ ...op.success ? { success: { ...op.success, ...op.success.payload ? { payload: payload(op.success.payload) } : {} } } : {},
8224
+ errors: op.errors.map((e) => ({ ...e, ...e.description ? { description: keys(e.description) } : {}, ...e.payload ? { payload: payload(e.payload) } : {} })),
8225
+ callbacks: op.callbacks.map(hook)
8226
+ })),
8227
+ webhooks: model.webhooks.map(hook)
8055
8228
  };
8056
8229
  }
8057
8230
  var PATH_EXTENSION = /\.(json|xml|csv|ya?ml|html?|txt)$/i;
@@ -8074,7 +8247,8 @@ function pathVerb(segment) {
8074
8247
  const first = segment.match(/^[A-Za-z][a-z]*/)?.[0].toLowerCase();
8075
8248
  return first !== void 0 && first !== "file" && LABEL_VERBS.has(first);
8076
8249
  }
8077
- function toOperation(doc, baseUrl, path, method, op, item) {
8250
+ function toOperation(doc, baseUrl, path, method, written2, item) {
8251
+ const op = { ...written2, ...typeof written2.summary === "string" ? { summary: withoutKeysInText(written2.summary, /* @__PURE__ */ new Set()) } : {}, ...typeof written2.description === "string" ? { description: withoutKeysInText(written2.description, /* @__PURE__ */ new Set()) } : {} };
8078
8252
  const segments = routeSegments(path);
8079
8253
  const statics = [];
8080
8254
  segments.forEach((s, index) => {
@@ -8167,7 +8341,7 @@ function toOperation(doc, baseUrl, path, method, op, item) {
8167
8341
  id: said(op.operationId) ?? `${methodName(method)} ${path}`,
8168
8342
  method,
8169
8343
  path,
8170
- summary: (said(op.summary) ?? firstSentence2(op.description) ?? `${methodName(method)} ${path}`).trim(),
8344
+ summary: (said(op.summary) ?? firstSentence(op.description) ?? `${methodName(method)} ${path}`).trim(),
8171
8345
  get label() {
8172
8346
  if (label === null) label = specLabel(op);
8173
8347
  return label;
@@ -8275,7 +8449,7 @@ function webhooksFromPathItem(name, item, sourceOperationId) {
8275
8449
  out.push({
8276
8450
  name,
8277
8451
  method,
8278
- summary: (said(op.summary) ?? firstSentence2(op.description) ?? name).trim(),
8452
+ summary: (said(op.summary) ?? firstSentence(op.description) ?? name).trim(),
8279
8453
  // The API sends webhooks, so their bodies read like responses (no writeOnly fields).
8280
8454
  payload: media ? lazyPayload(type2, media, "response") : void 0,
8281
8455
  ...ack ? { ack: ack.toUpperCase() } : {},
@@ -8506,14 +8680,8 @@ function serverUrl(server) {
8506
8680
  function said(text3) {
8507
8681
  return typeof text3 === "string" && text3.trim() ? text3 : void 0;
8508
8682
  }
8509
- function firstSentence2(text3) {
8510
- if (!text3) return void 0;
8511
- const plain = text3.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim();
8512
- const match = plain.match(/^(.{1,90}?[.!?])(\s|$)/);
8513
- return match ? match[1] : cut(plain, 90);
8514
- }
8515
8683
  function saysDeprecated(op) {
8516
- return [op.summary, firstSentence2(op.description)].some((text3) => typeof text3 === "string" && /\[deprecated\]|\(deprecated\)|^\W*deprecated\b/i.test(text3));
8684
+ return [op.summary, firstSentence(op.description)].some((text3) => typeof text3 === "string" && /\[deprecated\]|\(deprecated\)|^\W*deprecated\b/i.test(text3));
8517
8685
  }
8518
8686
  var PRE_RELEASE = /\b(beta|preview|alpha|experimental)\b/i;
8519
8687
  var STAGE_FIELDS = ["x-release-status", "x-stability", "x-stability-level", "x-maturity", "x-status", "x-lifecycle"];
@@ -8530,7 +8698,7 @@ function inPreview(doc, op, item) {
8530
8698
  if (typeof op.summary === "string" && /[[(](beta|preview|alpha|experimental)[\])]/i.test(op.summary)) return true;
8531
8699
  let tags = previewTagsOf.get(doc);
8532
8700
  if (!tags) {
8533
- const named = (list7) => Array.isArray(list7) ? list7 : [];
8701
+ const named = (list8) => Array.isArray(list8) ? list8 : [];
8534
8702
  tags = new Set(named(doc.tags).flatMap((tag2) => isObject2(tag2) && typeof tag2.name === "string" && PRE_RELEASE.test(tag2.name) ? [tag2.name] : []));
8535
8703
  for (const group of named(doc["x-tagGroups"])) {
8536
8704
  if (isObject2(group) && typeof group.name === "string" && PRE_RELEASE.test(group.name)) for (const tag2 of named(group.tags)) tags.add(String(tag2));
@@ -8547,7 +8715,7 @@ var QUALIFIER = /^(for|in|from|on|with|to|by|using|via|that|which|when|where|wit
8547
8715
  var LABEL_CUT = 40;
8548
8716
  var LABEL_MAX = 60;
8549
8717
  function specLabel(op) {
8550
- const texts = [op.summary, firstSentence2(op.description)];
8718
+ const texts = [op.summary, firstSentence(op.description)];
8551
8719
  if (!op.summary && !op.description && op.operationId && !/^(post|put|patch|head|options)/i.test(op.operationId)) texts.push(op.operationId);
8552
8720
  for (const text3 of texts) {
8553
8721
  const label = typeof text3 === "string" ? asLabel(text3) : void 0;
@@ -8994,8 +9162,8 @@ function hooksOf(ops, webhooks) {
8994
9162
  const writes = /* @__PURE__ */ new Map();
8995
9163
  for (const op of ops) {
8996
9164
  if (isRead(op)) continue;
8997
- const list7 = writes.get(op.resource);
8998
- if (list7) list7.push(op);
9165
+ const list8 = writes.get(op.resource);
9166
+ if (list8) list8.push(op);
8999
9167
  else writes.set(op.resource, [op]);
9000
9168
  }
9001
9169
  return { named: webhooks.filter((w) => !w.sourceOperationId).map((hook) => ({ hook, name: words(hook.name).map(singular) })), writes };
@@ -9899,7 +10067,7 @@ var DEFAULT_SETTINGS = { showFailure: false, aspect: "16:9", watermark: true, vo
9899
10067
  var RETRY_NOTE = "The retry succeeds.";
9900
10068
  function buildStoryboard(model, workflow, settings = {}) {
9901
10069
  const config = { ...DEFAULT_SETTINGS, ...settings, watermark: true };
9902
- if (model.mcp) return buildMcpStoryboard(model, workflow, config);
10070
+ if (model.mcp) return shownStoryboard(buildMcpStoryboard(model, workflow, config));
9903
10071
  const byId = new Map(model.operations.map((op) => [op.id, op]));
9904
10072
  const calls = workflow.steps.flatMap((step) => {
9905
10073
  const op = byId.get(step.operationId);
@@ -9971,15 +10139,60 @@ function buildStoryboard(model, workflow, settings = {}) {
9971
10139
  caption: "That's the whole integration."
9972
10140
  });
9973
10141
  const told = coherent(echoedIds(scenes, model), model);
9974
- return {
10142
+ return shownStoryboard({
9975
10143
  version: 1,
9976
10144
  api: { title: apiTitle, version: clip(model.version, 40), baseUrl: clip(model.baseUrl, 300) },
9977
10145
  workflow: { name, source: workflow.source },
9978
10146
  nodes: { client: "Your app", api: apiTitle, webhook: webhook ? "Your server" : void 0 },
9979
10147
  scenes: failure ? failuresAsRetried(told, model, failure.error, callAuth(ops[failure.index], auth)?.kind) : told,
9980
10148
  settings: config
10149
+ });
10150
+ }
10151
+ function shownStoryboard(sb) {
10152
+ const keys = (text3) => withoutKeysInText(text3, /* @__PURE__ */ new Set());
10153
+ const mcp = sb.api.protocol === "mcp";
10154
+ const url = (text3) => /^[a-z][a-z\d+.-]*:\/\//i.test(text3);
10155
+ const endpoint = (text3) => mcp && !url(text3) ? shownCommand(text3) : shownAddress(text3, mcp);
10156
+ const address = (text3) => !mcp || url(text3) ? shownAddress(text3, mcp) : keys(text3);
10157
+ return {
10158
+ ...sb,
10159
+ api: { ...sb.api, title: keys(sb.api.title), baseUrl: endpoint(sb.api.baseUrl) },
10160
+ workflow: { ...sb.workflow, name: keys(sb.workflow.name) },
10161
+ nodes: { ...sb.nodes, client: keys(sb.nodes.client), api: keys(sb.nodes.api) },
10162
+ scenes: sb.scenes.map((scene) => shownScene(scene, address))
9981
10163
  };
9982
10164
  }
10165
+ function shownScene(scene, address) {
10166
+ const keys = (text4) => withoutKeysInText(text4, /* @__PURE__ */ new Set());
10167
+ const payload = (value, type2) => typeof value === "string" && type2 ? withoutCredentialsInText(value, /* @__PURE__ */ new Set()) : shownValue(value);
10168
+ const text3 = { caption: keys(scene.caption), ...scene.speech ? { speech: keys(scene.speech) } : {}, ...scene.summaryLine ? { summaryLine: keys(scene.summaryLine) } : {} };
10169
+ switch (scene.kind) {
10170
+ case "title":
10171
+ return { ...scene, ...text3, title: keys(scene.title), subtitle: keys(scene.subtitle) };
10172
+ case "call":
10173
+ return {
10174
+ ...scene,
10175
+ ...text3,
10176
+ ...address ? { path: address(scene.path) } : {},
10177
+ ...scene.request !== void 0 ? { request: payload(scene.request, scene.requestType) } : {},
10178
+ ...scene.response !== void 0 ? { response: payload(scene.response, scene.responseType) } : {},
10179
+ ...scene.headers ? { headers: scene.headers.map(([name, value]) => [name, shownParam(name, value)]) } : {},
10180
+ ...scene.cookies ? { cookies: scene.cookies.map(([name, value]) => [name, shownParam(name, value)]) } : {},
10181
+ ...scene.recovery ? { recovery: keys(scene.recovery) } : {}
10182
+ };
10183
+ case "webhook":
10184
+ return { ...scene, ...text3, event: keys(scene.event), ...scene.payload !== void 0 ? { payload: payload(scene.payload, scene.payloadType) } : {} };
10185
+ case "auth":
10186
+ return {
10187
+ ...scene,
10188
+ ...text3,
10189
+ ...address && scene.tokenUrl ? { tokenUrl: address(scene.tokenUrl) } : {},
10190
+ ...address && scene.requestLine ? { requestLine: scene.requestLine.replace(/\S+$/, (url) => address(url)) } : {}
10191
+ };
10192
+ default:
10193
+ return { ...scene, ...text3 };
10194
+ }
10195
+ }
9983
10196
  function echoedIds(scenes, model) {
9984
10197
  let before = [];
9985
10198
  let current2 = scenes;
@@ -10132,7 +10345,7 @@ function failureScene(id, base, op, error, sends, fieldNames2 = op.bodyFields) {
10132
10345
  if (error.status === "isError") {
10133
10346
  const missing = invalid ? `the required argument "${invalid.field}" is missing` : void 0;
10134
10347
  const ending = isObject2(error.payload?.value) ? error.payload.value : {};
10135
- return {
10348
+ return shownScene({
10136
10349
  ...base,
10137
10350
  id,
10138
10351
  kind: "call",
@@ -10146,9 +10359,9 @@ function failureScene(id, base, op, error, sends, fieldNames2 = op.bodyFields) {
10146
10359
  recovery: clip(invalid ? `The model adds "${invalid.field}" and calls again` : "The model reads the error and calls again", 160),
10147
10360
  failurePath: true,
10148
10361
  summaryLine: "Recover from a tool error: the model fixes its arguments"
10149
- };
10362
+ });
10150
10363
  }
10151
- return {
10364
+ return shownScene({
10152
10365
  ...base,
10153
10366
  id,
10154
10367
  kind: "call",
@@ -10163,7 +10376,7 @@ function failureScene(id, base, op, error, sends, fieldNames2 = op.bodyFields) {
10163
10376
  recovery: clip(invalid ? `Add "${invalid.field}" and resend` : recoveryFor(error, op, sends), 160),
10164
10377
  failurePath: true,
10165
10378
  summaryLine: `Handle ${statusCode(error.status)}: ${lowerFirst2(recoveryFor(error, op, sends))}`
10166
- };
10379
+ });
10167
10380
  }
10168
10381
  var fieldNames = /* @__PURE__ */ new WeakMap();
10169
10382
  function fieldNamesOf(model) {
@@ -11070,8 +11283,155 @@ function unknownKeys(raw, known, where, problems) {
11070
11283
  for (const key of Object.keys(raw)) if (!known.includes(key)) problems.push(`${where} has \`${key}\`, which a flow file doesn't use there.`);
11071
11284
  }
11072
11285
 
11286
+ // ../../lib/storyboard/review.ts
11287
+ var KIND_WORDS = {
11288
+ email: "an email address",
11289
+ phone: "a phone number",
11290
+ address: "a private network's address",
11291
+ card: "a card number",
11292
+ account: "a bank account",
11293
+ id: "an ID number",
11294
+ key: "may be a key"
11295
+ };
11296
+ function reviewOf(sb) {
11297
+ const found = new Findings();
11298
+ found.address(sb.api.baseUrl, sb.api.protocol === "mcp" ? "the server's address" : "every call's address");
11299
+ for (const scene of sb.scenes) {
11300
+ if (scene.kind === "call") {
11301
+ const where = callName(scene.summaryLine, scene.caption);
11302
+ found.address(scene.path, where);
11303
+ for (const [name, value] of [...scene.headers ?? [], ...scene.cookies ?? []]) found.value(name, value, where, true);
11304
+ found.payload(scene.request, "", where);
11305
+ found.payload(scene.response, "", where);
11306
+ } else if (scene.kind === "webhook") found.payload(scene.payload, "", `the ${scene.event} webhook`);
11307
+ }
11308
+ return found.review();
11309
+ }
11310
+ function mergeReviews(reviews) {
11311
+ const found = new Findings();
11312
+ for (const r of reviews) {
11313
+ for (const name of r.hidden) found.hid(name);
11314
+ for (const f of r.check) found.add(f.kind, f.value, f.where);
11315
+ }
11316
+ return found.review();
11317
+ }
11318
+ function reviewLines(review, max = 8) {
11319
+ const lines = [];
11320
+ if (review.hidden.length) lines.push(`Hidden on its own: ${list6(review.hidden, 6)}.`);
11321
+ if (review.check.length) {
11322
+ lines.push("To check before it's shared, as it may be personal or internal:");
11323
+ for (const f of review.check.slice(0, max)) lines.push(` ${f.value} (${KIND_WORDS[f.kind]}), in ${f.where}`);
11324
+ if (review.check.length > max) lines.push(` \u2026and ${review.check.length - max} more.`);
11325
+ } else lines.push("Nothing else in it looks personal or internal, but a name or a password can look like any word: look through it.");
11326
+ return lines;
11327
+ }
11328
+ function callName(summaryLine, caption) {
11329
+ const name = (summaryLine ?? "").replace(/\s*\([A-Z]+ [^)]*\)$/, "").trim();
11330
+ return name || caption.slice(0, 60);
11331
+ }
11332
+ var isObj7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
11333
+ function list6(names, max) {
11334
+ if (names.length <= max) return names.length > 1 ? `${names.slice(0, -1).join(", ")} and ${names.at(-1)}` : names.join("");
11335
+ return `${names.slice(0, max).join(", ")} and ${names.length - max} more`;
11336
+ }
11337
+ var Findings = class {
11338
+ hiddenNames = /* @__PURE__ */ new Set();
11339
+ checks = /* @__PURE__ */ new Map();
11340
+ hid(name) {
11341
+ if (name) this.hiddenNames.add(name);
11342
+ }
11343
+ add(kind, value, where) {
11344
+ const key = `${kind}|${value}`;
11345
+ if (!this.checks.has(key)) this.checks.set(key, { kind, value: value.length > 80 ? `${value.slice(0, 79)}\u2026` : value, where });
11346
+ }
11347
+ /** An address: a host on a private network, a random segment of its path, and its query's values. */
11348
+ address(address, where) {
11349
+ this.text(address, where);
11350
+ const query = address.indexOf("?");
11351
+ for (const segment of (query < 0 ? address : address.slice(0, query)).replace(/^[a-z][a-z\d+.-]*:\/\/[^/]*/i, "").split("/")) {
11352
+ if (/^<(bot_)?token>$/.test(segment)) this.hid("a token in the address");
11353
+ else if (mayBeKey("", segment)) this.add("key", segment, where);
11354
+ }
11355
+ if (query >= 0) {
11356
+ for (const part of address.slice(query + 1).split(/[&#]/)) {
11357
+ const eq = part.indexOf("=");
11358
+ if (eq > 0) this.value(decodeURIComponentSafe(part.slice(0, eq)), decodeURIComponentSafe(part.slice(eq + 1)), where, true);
11359
+ }
11360
+ }
11361
+ }
11362
+ /** A header's, a parameter's, a cookie's (`param`) or a field's value. */
11363
+ value(name, value, where, param) {
11364
+ const v = value.trim();
11365
+ if (!v) return;
11366
+ const secret = param ? credentialName(name) || /^(proxy-)?authorization$|^cookie$|^sig$|^key$/i.test(name.trim()) : secretField(name) || credentialName(name);
11367
+ if (v.includes(DOTS) || secret && (v === hiddenAs(name) || /^[A-Za-z][\w-]*\s+<token>$/.test(v))) {
11368
+ this.hid(name || "a value");
11369
+ return;
11370
+ }
11371
+ if (/^<[\w.-]+>$/.test(v) || v.includes("{{")) return;
11372
+ if (mayBeKey(name, v)) this.add("key", v, where);
11373
+ this.text(v, where);
11374
+ }
11375
+ /** A payload: each value by the field it's in, a text body as text. */
11376
+ payload(value, name, where, depth = 0) {
11377
+ if (depth > 40) return;
11378
+ if (typeof value === "string") this.value(name, value, where, false);
11379
+ else if (Array.isArray(value)) for (const v of value) this.payload(v, name, where, depth + 1);
11380
+ else if (isObj7(value)) for (const [key, v] of Object.entries(value)) this.payload(v, key, where, depth + 1);
11381
+ }
11382
+ /** Any text: the personal and internal values in it. */
11383
+ text(text3, where) {
11384
+ if (text3.length > 2e5) text3 = text3.slice(0, 2e5);
11385
+ for (const [, email, domain] of text3.matchAll(/\b([A-Za-z0-9._%+-]{1,64}@((?:[A-Za-z0-9-]{1,63}\.){1,8}[A-Za-z]{2,24}))\b/g)) if (!RESERVED_DOMAIN.test(domain)) this.add("email", email, where);
11386
+ for (const [phone] of text3.matchAll(/(?<![\w+])\+[1-9]\d{7,14}\b/g)) if (!/^\+1(\d{3}555|555)\d+$/.test(phone)) this.add("phone", phone, where);
11387
+ for (const [host] of text3.matchAll(PRIVATE_HOST)) this.add("address", host, where);
11388
+ for (const [run] of text3.matchAll(/(?<![\w-])(?:\d[ -]?){12,15}\d(?![\w-])/g)) {
11389
+ const digits = run.replace(/[ -]/g, "");
11390
+ if (/^(4\d{12}(\d{3})?|5[1-5]\d{14}|2[2-7]\d{14}|3[47]\d{13}|6(011|5\d\d)\d{12})$/.test(digits) && luhn(digits) && !TEST_CARDS.has(digits)) this.add("card", run, where);
11391
+ }
11392
+ for (const [iban] of text3.matchAll(/\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b/g)) if (ibanValid(iban) && !EXAMPLE_IBANS.has(iban)) this.add("account", iban, where);
11393
+ for (const [ssn] of text3.matchAll(/(?<![\d-])(?!000|666|9\d\d)\d{3}-(?!00)\d{2}-(?!0000)\d{4}(?![\d-])/g)) if (ssn !== "123-45-6789" && ssn !== "078-05-1120") this.add("id", ssn, where);
11394
+ }
11395
+ review() {
11396
+ return { hidden: [...this.hiddenNames], check: [...this.checks.values()] };
11397
+ }
11398
+ };
11399
+ function mayBeKey(name, value) {
11400
+ if (/(hash|checksum|digest|md5|sha\d*|etag|fingerprint|gravatar_id|node_id|(next|prev(ious)?|page|continuation|pagination|cursor|sync|resume|start|end|delta|change|watch|version|concurrency|lock)[-_]?token)$/i.test(name) || /^[a-z]{2,12}[-_:]/.test(value)) return false;
11401
+ return /^[a-f0-9]{32}$/i.test(value) || value.length >= 32 && randomToken(value);
11402
+ }
11403
+ var RESERVED_DOMAIN = /(^|\.)(example\.(com|net|org)|example|test|invalid|localhost)$/i;
11404
+ var PRIVATE_HOST = /\b(localhost|127(?:\.\d{1,3}){3}|10(?:\.\d{1,3}){3}|192\.168(?:\.\d{1,3}){2}|172\.(?:1[6-9]|2\d|3[01])(?:\.\d{1,3}){2}|169\.254(?:\.\d{1,3}){2}|[a-z0-9-]{1,63}(?:\.[a-z0-9-]{1,63}){0,8}\.(?:internal|local|localdomain|lan|corp|intranet|home\.arpa))\b/gi;
11405
+ var TEST_CARDS = /* @__PURE__ */ new Set(["4242424242424242", "4000056655665556", "5555555555554444", "2223003122003222", "5200828282828210", "5105105105105100", "378282246310005", "371449635398431", "6011111111111117", "6011000990139424", "4111111111111111", "4012888888881881", "4000000000000002", "4000000000009995", "4000002500003155", "4000000000003220", "4000000000000077", "5454545454545454", "4917610000000000", "4988438843884305", "4166676667666746", "4646464646464644", "4000020000000000", "4111111145551142", "5136333333333335", "2222400070000005"]);
11406
+ var EXAMPLE_IBANS = /* @__PURE__ */ new Set(["GB82WEST12345698765432", "DE89370400440532013000", "GB29NWBK60161331926819", "FR1420041010050500013M02606", "NL91ABNA0417164300", "GB33BUKB20201555555555", "CH9300762011623852957"]);
11407
+ function luhn(digits) {
11408
+ let sum = 0;
11409
+ for (let i = 0; i < digits.length; i++) {
11410
+ let d = Number(digits[digits.length - 1 - i]);
11411
+ if (i % 2) d = d * 2 > 9 ? d * 2 - 9 : d * 2;
11412
+ sum += d;
11413
+ }
11414
+ return sum % 10 === 0;
11415
+ }
11416
+ function ibanValid(iban) {
11417
+ const moved = `${iban.slice(4)}${iban.slice(0, 4)}`;
11418
+ let rest = 0;
11419
+ for (const c of moved) {
11420
+ const n = /\d/.test(c) ? c : String(c.charCodeAt(0) - 55);
11421
+ for (const d of n) rest = (rest * 10 + Number(d)) % 97;
11422
+ }
11423
+ return rest === 1;
11424
+ }
11425
+ function decodeURIComponentSafe(text3) {
11426
+ try {
11427
+ return decodeURIComponent(text3.replace(/\+/g, " "));
11428
+ } catch {
11429
+ return text3;
11430
+ }
11431
+ }
11432
+
11073
11433
  // package.json
11074
- var version = "1.0.9";
11434
+ var version = "1.0.10";
11075
11435
 
11076
11436
  // src/files.ts
11077
11437
  var import_node_fs = require("node:fs");
@@ -14410,7 +14770,8 @@ var MCP_HINT = "If it's an MCP server, open it in MCP Inspector (npx @modelconte
14410
14770
  function specUrl(input, base) {
14411
14771
  const text3 = input.trim();
14412
14772
  if (!text3) throw new SpecError("Enter the URL of an OpenAPI spec.");
14413
- const invalid = new SpecError(`That isn't a valid URL: ${text3.length > 80 ? `${text3.slice(0, 79)}\u2026` : text3}`);
14773
+ const shown = shownAddress(text3, true);
14774
+ const invalid = new SpecError(`That isn't a valid URL: ${shown.length > 80 ? `${shown.slice(0, 79)}\u2026` : shown}`);
14414
14775
  let url;
14415
14776
  try {
14416
14777
  url = new URL(/^[a-z][a-z\d+.-]*:\/\//i.test(text3) || text3.startsWith("/") ? text3 : `https://${text3}`, base);
@@ -14565,8 +14926,8 @@ function arazzoTitle(doc) {
14565
14926
  }
14566
14927
  function arazzoWorkflows(doc, model, source) {
14567
14928
  const notes = /* @__PURE__ */ new Set();
14568
- const list7 = (Array.isArray(doc.workflows) ? doc.workflows : []).filter((w) => isObject2(w) && typeof w.workflowId === "string");
14569
- const byId = new Map(list7.map((w) => [w.workflowId, w]));
14929
+ const list8 = (Array.isArray(doc.workflows) ? doc.workflows : []).filter((w) => isObject2(w) && typeof w.workflowId === "string");
14930
+ const byId = new Map(list8.map((w) => [w.workflowId, w]));
14570
14931
  const byOperationId = new Map(model.operations.map((op) => [op.id, op]));
14571
14932
  const prefix = `$sourceDescriptions.${source}.`;
14572
14933
  const operationFor = (step) => {
@@ -14684,7 +15045,7 @@ function arazzoWorkflows(doc, model, source) {
14684
15045
  return isObject2(resolved) ? resolved : {};
14685
15046
  };
14686
15047
  const workflows = [];
14687
- for (const workflow of list7) {
15048
+ for (const workflow of list8) {
14688
15049
  const steps = expand(workflow, { inputs: inputsOf(workflow) }, 0);
14689
15050
  if (!steps.length) {
14690
15051
  notes.add(`The workflow ${workflow.workflowId} has no steps on this API description, so it isn't offered.`);
@@ -14992,7 +15353,7 @@ function downloads(own, allowPrivate = false, resolve4 = import_node_dns.lookup)
14992
15353
  return {
14993
15354
  allowed: async (url) => {
14994
15355
  if (open(url)) return void 0;
14995
- if (url.protocol !== "https:" && url.protocol !== "http:") return `${url.href} isn't an http or https address, so it isn't read.`;
15356
+ if (url.protocol !== "https:" && url.protocol !== "http:") return `${shownAddress(url.href, true)} isn't an http or https address, so it isn't read.`;
14996
15357
  return privateHost(url) ? `${url.host} ${REFUSED}` : void 0;
14997
15358
  },
14998
15359
  download: (input, init) => {
@@ -15044,7 +15405,7 @@ function publicLookup(resolve4) {
15044
15405
  }
15045
15406
  function publicFetch(url, init, lookup) {
15046
15407
  if (privateHost(url)) return Promise.reject(new SpecError(`${url.host} ${REFUSED}`));
15047
- if (url.protocol !== "https:" && url.protocol !== "http:") return Promise.reject(new SpecError(`${url.href} isn't an http or https address, so it isn't read.`));
15408
+ if (url.protocol !== "https:" && url.protocol !== "http:") return Promise.reject(new SpecError(`${shownAddress(url.href, true)} isn't an http or https address, so it isn't read.`));
15048
15409
  const send = url.protocol === "https:" ? import_node_https.request : import_node_http.request;
15049
15410
  return new Promise((resolve4, reject) => {
15050
15411
  const request = send(url, {
@@ -15285,7 +15646,7 @@ var import_promises2 = require("node:fs/promises");
15285
15646
  var import_node_path3 = require("node:path");
15286
15647
 
15287
15648
  // ../../lib/embed/playerScript.generated.ts
15288
- var PLAYER_SCRIPT = '(function () {\n"use strict";\nvar defs = {\n"lib/embed/player": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nconst frame_1 = require("../render/frame");\nconst timing_1 = require("../storyboard/timing");\nconst ICONS = {\n play: \'<path d="M8 5.2v13.6a.6.6 0 0 0 .9.5l10.6-6.8a.6.6 0 0 0 0-1L8.9 4.7a.6.6 0 0 0-.9.5z" fill="currentColor"/>\',\n pause: \'<path d="M7 5h3.2v14H7zM13.8 5H17v14h-3.2z" fill="currentColor"/>\',\n replay: \'<path d="M19.5 11.5A7.5 7.5 0 1 0 17.3 17M19.5 5v6.5H13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n prev: \'<path d="M6.5 5.5v13M17.5 6.2v11.6a.5.5 0 0 1-.8.4l-8.3-5.8a.5.5 0 0 1 0-.8l8.3-5.8a.5.5 0 0 1 .8.4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n next: \'<path d="M17.5 5.5v13M6.5 6.2v11.6a.5.5 0 0 0 .8.4l8.3-5.8a.5.5 0 0 0 0-.8L7.3 5.8a.5.5 0 0 0-.8.4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n copy: \'<path d="M9 9.5h9.5v10H9zM6 15.5H5.5v-10h9.5V6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n expand: \'<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n};\nconst icon = (name) => `<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true">${ICONS[name]}</svg>`;\nfunction fmt(ms) {\n const s = Math.floor(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;\n}\nfunction button(label, name, className = "") {\n const b = document.createElement("button");\n b.type = "button";\n b.className = className;\n b.setAttribute("aria-label", label);\n b.title = label;\n b.innerHTML = icon(name);\n return b;\n}\nconst SITE = "https://integrationtour.com/";\nfunction credit(aspect) {\n const a = document.createElement("a");\n a.className = "credit";\n a.href = SITE;\n a.target = "_blank";\n a.rel = "noopener";\n a.setAttribute("aria-label", `${frame_1.WATERMARK} (opens in a new tab)`);\n a.addEventListener("click", (e) => e.stopPropagation());\n place(a, aspect, (0, frame_1.watermarkBox)(aspect));\n return a;\n}\nfunction place(link, aspect, box) {\n const size = (0, frame_1.sizeFor)(aspect);\n const pad = 8;\n const share = (value, of) => `${((value / of) * 100).toFixed(3)}%`;\n link.style.left = share(box.x - pad, size.width);\n link.style.top = share(box.y - pad, size.height);\n link.style.width = share(box.w + 2 * pad, size.width);\n link.style.height = share(box.h + 2 * pad, size.height);\n}\nfunction fit(link, frame, aspect) {\n const text = frame.querySelector("svg > text:last-child");\n if (!(text instanceof SVGTextElement) || text.textContent !== frame_1.WATERMARK)\n return false;\n let width = 0;\n try {\n width = text.getComputedTextLength();\n }\n catch {\n }\n if (!(width > 0))\n return false;\n const box = (0, frame_1.watermarkBox)(aspect);\n place(link, aspect, { ...box, x: box.x + box.w - width, w: width });\n return true;\n}\nfunction start(root, sb) {\n const total = (0, timing_1.totalDuration)(sb);\n const starts = (0, frame_1.sceneStarts)(sb);\n let time = 0;\n let playing = false;\n let last = null;\n const stage = document.createElement("div");\n stage.className = `stage ${sb.settings.aspect === "9:16" ? "portrait" : sb.settings.aspect === "1:1" ? "square" : "wide"}`;\n const frame = document.createElement("div");\n frame.setAttribute("role", "img");\n stage.append(frame);\n const link = sb.settings.watermark ? credit(sb.settings.aspect) : undefined;\n if (link)\n stage.append(link);\n let fitted = false;\n const controls = document.createElement("div");\n controls.className = "controls";\n const prev = button("Previous scene", "prev");\n const play = button("Play", "play", "play");\n const next = button("Next scene", "next");\n const seek = document.createElement("input");\n seek.type = "range";\n seek.min = "0";\n seek.max = String(total);\n seek.step = "50";\n seek.setAttribute("aria-label", "Seek");\n const clock = document.createElement("span");\n clock.className = "time";\n const copy = button("Copy this payload as JSON", "copy");\n const full = button("Full screen", "expand");\n controls.append(prev, play, next, seek, clock, copy, full);\n const status = document.createElement("p");\n status.className = "status";\n status.setAttribute("role", "status");\n root.append(stage, controls, status);\n root.tabIndex = 0;\n const draw = () => {\n const at = (0, frame_1.sceneAt)(sb, Math.min(time, total));\n frame.innerHTML = (0, frame_1.renderFrame)(sb, time);\n frame.setAttribute("aria-label", at.scene.caption);\n if (link && !fitted)\n fitted = fit(link, frame, sb.settings.aspect);\n seek.value = String(Math.round(time));\n clock.textContent = `${fmt(time)} / ${fmt(total)} \xB7 ${at.index + 1}/${at.count}`;\n const ended = !playing && time >= total;\n play.innerHTML = icon(playing ? "pause" : ended ? "replay" : "play");\n play.setAttribute("aria-label", playing ? "Pause" : ended ? "Replay" : "Play");\n prev.disabled = at.index === 0;\n next.disabled = at.index === at.count - 1;\n };\n const tick = (now) => {\n if (!playing)\n return;\n time = Math.min(total, time + (last === null ? 0 : now - last));\n last = now;\n if (time >= total)\n playing = false;\n draw();\n if (playing)\n requestAnimationFrame(tick);\n };\n const toggle = () => {\n if (!playing && time >= total)\n time = 0;\n playing = !playing;\n last = null;\n draw();\n if (playing)\n requestAnimationFrame(tick);\n };\n const step = (delta) => {\n const index = Math.max(0, Math.min(starts.length - 1, (0, frame_1.sceneAt)(sb, Math.min(time, total)).index + delta));\n playing = false;\n time = starts[index] + Math.min(900, total - starts[index]);\n draw();\n };\n const payload = () => {\n const { scene, progress } = (0, frame_1.sceneAt)(sb, Math.min(time, total));\n if (scene.kind === "call" || scene.kind === "auth")\n return progress < 0.52 ? scene.request : scene.response;\n return scene.kind === "webhook" ? scene.payload : undefined;\n };\n const say = (text) => {\n status.textContent = text;\n window.setTimeout(() => status.textContent === text && (status.textContent = ""), 2500);\n };\n copy.addEventListener("click", async () => {\n const value = payload();\n if (value === undefined)\n return say("This scene has no payload to copy.");\n const text = typeof value === "string" ? value : JSON.stringify(value, null, 2);\n try {\n await navigator.clipboard.writeText(text);\n }\n catch {\n const area = document.createElement("textarea");\n area.value = text;\n document.body.append(area);\n area.select();\n document.execCommand("copy");\n area.remove();\n }\n say("Copied the payload as JSON.");\n });\n full.addEventListener("click", () => {\n if (document.fullscreenElement)\n void document.exitFullscreen();\n else if (root.requestFullscreen)\n void root.requestFullscreen().catch(() => root.classList.toggle("filled"));\n else\n root.classList.toggle("filled");\n });\n play.addEventListener("click", toggle);\n prev.addEventListener("click", () => step(-1));\n next.addEventListener("click", () => step(1));\n stage.addEventListener("click", toggle);\n seek.addEventListener("input", () => {\n playing = false;\n time = Number(seek.value);\n draw();\n });\n root.addEventListener("keydown", (e) => {\n if (e.target.tagName === "INPUT" && e.key !== " ")\n return;\n if (e.key === " ") {\n e.preventDefault();\n toggle();\n }\n else if (e.key === "ArrowRight")\n step(1);\n else if (e.key === "ArrowLeft")\n step(-1);\n else if (e.key === "f")\n full.click();\n else if (e.key === "Escape")\n root.classList.remove("filled");\n });\n draw();\n}\nconst root = document.getElementById("flow-player");\nconst data = document.getElementById("flow-storyboard");\nif (root && (data === null || data === void 0 ? void 0 : data.textContent))\n start(root, JSON.parse(data.textContent));\n\n}, {"../render/frame":"lib/render/frame","../storyboard/timing":"lib/storyboard/timing"}],\n"lib/render/frame": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.WATERMARK = void 0;\nexports.paletteFor = paletteFor;\nexports.sizeFor = sizeFor;\nexports.outputSize = outputSize;\nexports.sceneAt = sceneAt;\nexports.sceneStarts = sceneStarts;\nexports.renderFrame = renderFrame;\nexports.watermarkBox = watermarkBox;\nexports.jsonLines = jsonLines;\nexports.wrap = wrap;\nexports.esc = esc;\nconst timing_1 = require("../storyboard/timing");\nconst code_1 = require("./code");\nconst text_1 = require("../text");\nexports.WATERMARK = "Made with integrationtour.com";\nconst DARK = {\n bg: "#0b1120",\n panel: "#131c31",\n panelEdge: "#26324d",\n text: "#e6ebf5",\n muted: "#8e9ab3",\n client: "#5cc8ff",\n api: "#a58bff",\n accent: "#5cc8ff",\n ok: "#3ddc97",\n bad: "#ff6b6b",\n hook: "#ffb547",\n key: "#ffd166",\n jsonKey: "#7cc7ff",\n jsonString: "#b8e986",\n jsonOther: "#f7b17a",\n};\nconst LIGHT = {\n bg: "#f5f7fb",\n panel: "#ffffff",\n panelEdge: "#d5dce8",\n text: "#0f172a",\n muted: "#5b6a82",\n client: "#0369a1",\n api: "#6d28d9",\n accent: "#0369a1",\n ok: "#047857",\n bad: "#c81e1e",\n hook: "#b45309",\n key: "#a16207",\n jsonKey: "#0f5f8f",\n jsonString: "#166534",\n jsonOther: "#b4410c",\n};\nconst HEX_COLOR = /^#[0-9a-f]{6}$/i;\nfunction paletteFor(settings) {\n const base = settings.theme === "light" ? LIGHT : DARK;\n return settings.brandColor && HEX_COLOR.test(settings.brandColor) ? { ...base, api: settings.brandColor, accent: settings.brandColor } : base;\n}\nlet C = DARK;\nconst SANS = "Inter, \'Segoe UI\', Roboto, Helvetica, Arial, sans-serif";\nconst MONO = "\'JetBrains Mono\', \'SFMono-Regular\', Menlo, Consolas, monospace";\nfunction sizeFor(aspect) {\n if (aspect === "9:16")\n return { width: 720, height: 1280 };\n return aspect === "1:1" ? { width: 720, height: 720 } : { width: 1280, height: 720 };\n}\nfunction outputSize(settings) {\n var _a;\n const { width, height } = sizeFor(settings.aspect);\n const scale = ((_a = settings.resolution) !== null && _a !== void 0 ? _a : 720) / 720;\n return { width: Math.round(width * scale), height: Math.round(height * scale) };\n}\nfunction layoutFor(aspect) {\n if (aspect === "9:16") {\n const client = { x: 48, y: 290, w: 624, h: 110 };\n const api = { x: 48, y: 1040, w: 624, h: 110 };\n return {\n width: 720,\n height: 1280,\n stacked: true,\n caption: { x: 48, y: 110, width: 624, size: 32, minSize: 26, maxLines: 4 },\n client,\n api,\n webhook: client,\n card: { x: 136, y: 450, w: 536, h: 550 },\n lane: { from: [92, 400], to: [92, 1040] },\n hookLane: { from: [92, 1040], to: [92, 400] },\n monoSize: 16,\n title: { size: 52, logo: 120, subtitle: 26 },\n stepSize: 18,\n summary: { left: 64, top: 360, bottom: 100, size: 26, gap: 64 },\n };\n }\n if (aspect === "1:1") {\n const client = { x: 40, y: 200, w: 240, h: 92 };\n return {\n width: 720,\n height: 720,\n stacked: true,\n caption: { x: 40, y: 72, width: 640, size: 30, minSize: 24, maxLines: 3 },\n client,\n api: { x: 440, y: 200, w: 240, h: 92 },\n webhook: client,\n card: { x: 40, y: 324, w: 640, h: 326 },\n lane: { from: [280, 246], to: [440, 246] },\n hookLane: { from: [440, 246], to: [280, 246] },\n monoSize: 15,\n title: { size: 44, logo: 80, subtitle: 22 },\n stepSize: 16,\n summary: { left: 56, top: 200, bottom: 70, size: 22, gap: 48 },\n };\n }\n const client = { x: 64, y: 250, w: 250, h: 130 };\n const api = { x: 966, y: 250, w: 250, h: 130 };\n const webhook = { x: 64, y: 480, w: 250, h: 110 };\n return {\n width: 1280,\n height: 720,\n stacked: false,\n caption: { x: 64, y: 92, width: 1152, size: 30, minSize: 24, maxLines: 2 },\n client,\n api,\n webhook,\n card: { x: 354, y: 352, w: 572, h: 300 },\n lane: { from: [314, 315], to: [966, 315] },\n hookLane: { from: [966, 380], to: [314, 535] },\n monoSize: 15,\n title: { size: 56, logo: 92, subtitle: 24 },\n stepSize: 15,\n summary: { left: 200, top: 220, bottom: 70, size: 24, gap: 56 },\n };\n}\nfunction sceneAt(sb, t) {\n const scenes = (0, timing_1.activeScenes)(sb);\n let start = 0;\n for (let i = 0; i < scenes.length; i++) {\n const duration = (0, timing_1.sceneDuration)(sb, scenes[i]);\n const end = start + duration;\n if (t < end || i === scenes.length - 1) {\n return { scene: scenes[i], index: i, count: scenes.length, start, duration, progress: clamp01((t - start) / duration) };\n }\n start = end;\n }\n throw new Error("Storyboard has no scenes.");\n}\nfunction sceneStarts(sb) {\n const starts = [];\n let t = 0;\n for (const s of (0, timing_1.activeScenes)(sb)) {\n starts.push(t);\n t += (0, timing_1.sceneDuration)(sb, s);\n }\n return starts;\n}\nfunction renderFrame(sb, t, size) {\n var _a, _b;\n C = paletteFor(sb.settings);\n const L = layoutFor(sb.settings.aspect);\n const total = (0, timing_1.totalDuration)(sb);\n const at = sceneAt(sb, Math.max(0, Math.min(t, total)));\n const fade = at.index === 0 ? 1 : clamp01((at.progress * at.duration) / 300);\n let body;\n switch (at.scene.kind) {\n case "title":\n body = titleScene(L, at.scene, at.progress, sb.settings.logo);\n break;\n case "summary":\n body = summaryScene(L, at.scene, at.progress, (0, timing_1.summaryItems)(sb));\n break;\n case "auth":\n body = authScene(L, sb, at.scene, at.progress);\n break;\n case "webhook":\n body = webhookScene(L, sb, at.scene, at.progress);\n break;\n default:\n body = callScene(L, sb, at.scene, at.progress);\n }\n const parts = [\n `<svg xmlns="http://www.w3.org/2000/svg" width="${(_a = size === null || size === void 0 ? void 0 : size.width) !== null && _a !== void 0 ? _a : L.width}" height="${(_b = size === null || size === void 0 ? void 0 : size.height) !== null && _b !== void 0 ? _b : L.height}" viewBox="0 0 ${L.width} ${L.height}" font-family="${esc(SANS)}">`,\n `<rect width="${L.width}" height="${L.height}" fill="${C.bg}"/>`,\n grid(L),\n `<g opacity="${fade.toFixed(3)}">${body}</g>`,\n progressBar(L, total ? Math.min(t, total) / total : 0),\n sb.settings.watermark ? watermark(L) : "",\n `</svg>`,\n ];\n return parts.join("");\n}\nfunction titleScene(L, scene, p, logo) {\n let size = L.title.size;\n while (size > L.title.size * 0.72 && wrap(scene.title, L.width - 160, size, Infinity).length > 3)\n size -= 2;\n const lines = wrap(scene.title, L.width - 160, size, 3);\n const mark = logo && /^data:image\\/(png|jpeg|gif|webp);base64,[a-z0-9+/=]+$/i.test(logo) ? { h: L.title.logo, gap: 34 } : undefined;\n const top = L.height / 2 - (lines.length * size * 1.15) / 2 + (mark ? (mark.h + mark.gap) / 2 : 0);\n const out = lines.map((line, i) => `<text x="${L.width / 2}" y="${top + i * size * 1.15}" text-anchor="middle" font-size="${size}" font-weight="700" fill="${C.text}">${esc(line)}</text>`);\n const subY = top + lines.length * size * 1.15 + 24;\n out.push(`<text x="${L.width / 2}" y="${subY}" text-anchor="middle" font-size="${L.title.subtitle}" fill="${C.muted}">${esc(fit(scene.subtitle, L.width - 160, L.title.subtitle))}</text>`);\n if (mark) {\n const bottom = top - size * 0.78 - mark.gap;\n out.push(`<image href="${esc(logo)}" x="${L.width / 2 - 200}" y="${(bottom - mark.h).toFixed(1)}" width="400" height="${mark.h}" preserveAspectRatio="xMidYMid meet"/>`);\n }\n const dotsY = subY + 70;\n [C.client, C.api, C.hook].forEach((color, i) => {\n const glow = pulse(p, 0.25 + i * 0.15, 0.55 + i * 0.15);\n const cx = L.width / 2 + (i - 1) * 40;\n if (glow > 0)\n out.push(`<circle cx="${cx}" cy="${dotsY}" r="${(8 + 10 * glow).toFixed(1)}" fill="${color}" opacity="${(0.25 * glow).toFixed(3)}"/>`);\n out.push(`<circle cx="${cx}" cy="${dotsY}" r="8" fill="${color}"/>`);\n });\n return out.join("");\n}\nconst MIN_SUMMARY_GAP = 34;\nconst MIN_SUMMARY_SIZE = 18;\nfunction summaryScene(L, scene, p, items) {\n const out = [captionText(L, scene.caption)];\n const { left, top, bottom, size, gap } = L.summary;\n const textX = left + 44;\n const room = L.height - bottom - top;\n const plan = summaryPlan(items, L.width - textX - 56, room, size, gap);\n const r = Math.min(14, plan.gap * 0.32);\n const stagger = Math.min(0.08, 0.6 / plan.blocks.length);\n let y = top;\n plan.blocks.forEach((lines, i) => {\n const appear = clamp01((p - 0.08 - i * stagger) / 0.12);\n const more = plan.more && i === plan.blocks.length - 1;\n out.push(`<g opacity="${appear.toFixed(3)}">`, more\n ? ""\n : `<circle cx="${left + 14}" cy="${(y - 8).toFixed(1)}" r="${r.toFixed(1)}" fill="${C.ok}" opacity="0.18"/><path d="M${left + 7} ${(y - 8).toFixed(1)} l5 5 l9 -10" stroke="${C.ok}" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`, ...lines.map((line, j) => `<text x="${textX}" y="${(y + j * plan.lineHeight).toFixed(1)}" font-size="${plan.size}" fill="${more ? C.muted : C.text}">${esc(line)}</text>`), `</g>`);\n y += plan.gap + (lines.length - 1) * plan.lineHeight;\n });\n return out.join("");\n}\nfunction summaryPlan(items, width, room, baseSize, baseGap) {\n const measure = (size) => {\n const lineHeight = Math.round(size * 1.2);\n const blocks = items.map((item) => wrap(item, width, size, 2));\n const extra = blocks.reduce((n, lines) => n + lines.length - 1, 0) * lineHeight;\n return { blocks, lineHeight, extra, minGap: Math.max(MIN_SUMMARY_GAP, size * 1.45) };\n };\n for (let size = baseSize; size >= MIN_SUMMARY_SIZE; size--) {\n const { blocks, lineHeight, extra, minGap } = measure(size);\n const gaps = Math.max(1, blocks.length - 1);\n if (gaps * minGap + extra <= room)\n return { blocks, size, lineHeight, gap: Math.min(baseGap, (room - extra) / gaps), more: false };\n }\n const { blocks, lineHeight, minGap } = measure(MIN_SUMMARY_SIZE);\n const kept = [];\n let used = 0;\n for (const lines of blocks) {\n const need = (kept.length ? minGap : 0) + (lines.length - 1) * lineHeight;\n if (used + need + minGap > room)\n break;\n kept.push(lines);\n used += need;\n }\n kept.push([`+${items.length - kept.length} more`]);\n return { blocks: kept, size: MIN_SUMMARY_SIZE, lineHeight, gap: minGap, more: true };\n}\nfunction callScene(L, sb, scene, p) {\n var _a;\n const failed = scene.outcome === "failure";\n const responseColor = failed ? C.bad : C.ok;\n const requestPhase = p < 0.52;\n const mcp = sb.api.protocol === "mcp";\n const call = `${scene.method} ${scene.path}`.trim();\n const outcome = outcomeText(scene.status);\n const out = [\n stepLabel(L, `Step ${scene.step} of ${scene.stepCount}${failed ? " \xB7 failure path" : ""}`, failed ? C.bad : C.muted),\n captionText(L, scene.caption),\n ...nodes(L, sb, pulse(p, 0.4, 0.52)),\n lane(L),\n ];\n if (!L.stacked)\n out.push(laneLabel(L, call));\n if (!L.stacked && sb.scenes.some((s) => s.kind === "webhook"))\n out.push(node(L.webhook, "WEBHOOKS", (_a = sb.nodes.webhook) !== null && _a !== void 0 ? _a : "Your server", C.hook, 0, 0.35));\n if (p >= 0.1 && p < 0.4)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.1) / 0.3), C.client));\n if (p >= 0.52 && p < 0.8)\n out.push(packet(L.lane.to, L.lane.from, ease((p - 0.52) / 0.28), responseColor));\n const cardIn = clamp01((p - 0.08) / 0.08);\n if (requestPhase) {\n const code = sb.settings.code ? (0, code_1.callCode)(sb, scene, sb.settings.code) : undefined;\n out.push(card(L, call, C.client, scene.request, scene.request === undefined && !code ? (mcp ? "No params" : "No request body") : undefined, cardIn, { code }));\n }\n else {\n out.push(card(L, mcp && failed ? `result \xB7 ${outcome}` : outcome, responseColor, scene.response, scene.response === undefined ? "No response body" : undefined, 1, { fold: mcp ? SCHEMA_KEYS : undefined }));\n }\n if (p >= 0.8) {\n const appear = clamp01((p - 0.8) / 0.06);\n out.push(badge(L.client, outcome, responseColor, appear));\n if (failed && scene.recovery)\n out.push(recoveryNote(L, scene.recovery, appear));\n }\n if (requestPhase ? scene.requestGenerated && p >= 0.08 : scene.responseGenerated) {\n const written = mcp && (requestPhase ? scene.method === "prompts/get" : isRecord(scene.response) && !("structuredContent" in scene.response));\n out.push(`<text x="${L.card.x + L.card.w}" y="${L.card.y + L.card.h + 22}" text-anchor="end" font-size="13" fill="${C.muted}">${written ? "Example text written for the video" : "Example generated from the schema"}</text>`);\n }\n return out.join("");\n}\nfunction nodes(L, sb, glow, clientOpacity = 1) {\n const mcp = sb.api.protocol === "mcp";\n return [node(L.client, mcp ? "MCP CLIENT" : "CLIENT", sb.nodes.client, C.client, 0, clientOpacity), node(L.api, mcp ? "MCP SERVER" : "API", sb.nodes.api, C.api, glow)];\n}\nfunction outcomeText(status) {\n if (status === "result")\n return "result";\n if (status === "isError")\n return "isError: true";\n const why = reason(status);\n return why ? `${status} ${why}` : status;\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction authScene(L, sb, scene, p) {\n var _a;\n const out = [stepLabel(L, `Authentication \xB7 ${scene.scheme}`, C.key), captionText(L, scene.caption), ...nodes(L, sb, pulse(p, 0.4, 0.52)), lane(L)];\n if (scene.requestLine) {\n if (!L.stacked)\n out.push(laneLabel(L, scene.requestLine));\n if (p >= 0.1 && p < 0.4)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.1) / 0.3), C.client));\n if (p >= 0.52 && p < 0.8)\n out.push(packet(L.lane.to, L.lane.from, ease((p - 0.52) / 0.28), C.key));\n const code = sb.settings.code && sb.api.protocol !== "mcp" && scene.requestType ? (0, code_1.authCode)(sb, scene, sb.settings.code) : undefined;\n const form = !code && /form-urlencoded/i.test((_a = scene.requestType) !== null && _a !== void 0 ? _a : "") && isRecord(scene.request);\n if (p < 0.52)\n out.push(card(L, scene.requestLine, C.client, form ? formText(scene.request) : scene.request, undefined, clamp01((p - 0.08) / 0.08), { code, form }));\n else\n out.push(card(L, "200 OK \xB7 access token", C.key, scene.response, undefined, 1));\n if (p >= 0.8)\n out.push(badge(L.client, "Token stored", C.key, clamp01((p - 0.8) / 0.06)));\n }\n else {\n if (!L.stacked)\n out.push(laneLabel(L, scene.headerLine.split("\\n")[0]));\n if (p >= 0.2 && p < 0.6)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.2) / 0.4), C.key));\n const every = sb.scenes.every((s) => s.kind !== "call" || s.credentials === undefined);\n out.push(card(L, every ? "Sent with every request" : "Sent with each call that needs it", C.key, undefined, scene.headerLine, clamp01((p - 0.08) / 0.08)));\n if (p >= 0.62)\n out.push(badge(L.api, "Authenticated", C.ok, clamp01((p - 0.62) / 0.06)));\n }\n return out.join("");\n}\nfunction webhookScene(L, sb, scene, p) {\n var _a, _b, _c;\n const receiver = L.stacked ? node(L.webhook, "WEBHOOKS", (_a = sb.nodes.webhook) !== null && _a !== void 0 ? _a : "Your server", C.hook, pulse(p, 0.55, 0.7)) : "";\n const out = [\n stepLabel(L, `Webhook \xB7 ${scene.event}`, C.hook),\n captionText(L, scene.caption),\n L.stacked ? receiver : node(L.client, "CLIENT", sb.nodes.client, C.client, 0, 0.45),\n node(L.api, "API", sb.nodes.api, C.api, pulse(p, 0.05, 0.18)),\n ];\n if (!L.stacked)\n out.push(node(L.webhook, "WEBHOOKS", (_b = sb.nodes.webhook) !== null && _b !== void 0 ? _b : "Your server", C.hook, pulse(p, 0.55, 0.7)));\n out.push(`<line x1="${L.hookLane.from[0]}" y1="${L.hookLane.from[1]}" x2="${L.hookLane.to[0]}" y2="${L.hookLane.to[1]}" stroke="${C.hook}" stroke-opacity="0.35" stroke-width="2" stroke-dasharray="6 8"/>`);\n if (p >= 0.18 && p < 0.55)\n out.push(packet(L.hookLane.from, L.hookLane.to, ease((p - 0.18) / 0.37), C.hook));\n out.push(card(L, `${scene.method} ${scene.event}`, C.hook, scene.payload, scene.payload === undefined ? "Event payload" : undefined, clamp01((p - 0.1) / 0.08)));\n if (scene.payloadGenerated && scene.payload !== undefined) {\n out.push(`<text x="${L.card.x + L.card.w}" y="${L.card.y + L.card.h + 22}" text-anchor="end" font-size="13" fill="${C.muted}">Example generated from the schema</text>`);\n }\n if (p >= 0.72) {\n const ack = (_c = scene.ack) !== null && _c !== void 0 ? _c : "2XX";\n const said = `${outcomeText(ack)} \xB7 acknowledged`;\n out.push(badge(L.webhook, said.length <= Math.floor((L.webhook.w - 20) / (15 * 0.6)) ? said : `${ack} \xB7 acknowledged`, C.ok, clamp01((p - 0.72) / 0.06)));\n }\n return out.join("");\n}\nfunction grid(L) {\n const dots = [];\n for (let x = 32; x < L.width; x += 48) {\n for (let y = 32; y < L.height; y += 48)\n dots.push(`M${x} ${y}h1`);\n }\n return `<path d="${dots.join("")}" stroke="${C.panelEdge}" stroke-width="2" stroke-linecap="round" opacity="0.5"/>`;\n}\nfunction stepLabel(L, text, color) {\n return `<text x="${L.caption.x}" y="${L.caption.y - L.caption.size - 10}" font-size="${L.stepSize}" font-weight="600" letter-spacing="1.5" fill="${color}">${esc(text.toUpperCase())}</text>`;\n}\nfunction captionText(L, caption) {\n const { x, y } = L.caption;\n const { size, lines } = fitCaption(L, caption);\n return lines.map((line, i) => `<text x="${x}" y="${y + i * size * 1.25}" font-size="${size}" font-weight="600" fill="${C.text}">${esc(line)}</text>`).join("");\n}\nfunction fitCaption(L, caption) {\n const { width, size, minSize, maxLines } = L.caption;\n const whole = caption.split(/\\s+/).filter(Boolean).join(" ");\n for (const limit of [maxLines, maxLines + 1]) {\n for (let s = size; s >= minSize; s--) {\n const lines = wrap(caption, width, s, Infinity);\n if (lines.length <= limit && lines.join(" ") === whole)\n return { size: s, lines };\n }\n }\n return { size: minSize, lines: wrap(caption, width, minSize, maxLines + 1) };\n}\nfunction node(box, kicker, name, color, glow, opacity = 1) {\n const size = 22;\n return [\n `<g opacity="${opacity}">`,\n glow > 0 ? `<rect x="${box.x - 6}" y="${box.y - 6}" width="${box.w + 12}" height="${box.h + 12}" rx="20" fill="none" stroke="${color}" stroke-width="3" opacity="${(glow * 0.6).toFixed(3)}"/>` : "",\n `<rect x="${box.x}" y="${box.y}" width="${box.w}" height="${box.h}" rx="16" fill="${C.panel}" stroke="${color}" stroke-width="2"/>`,\n `<rect x="${box.x}" y="${box.y}" width="6" height="${box.h}" rx="3" fill="${color}"/>`,\n `<text x="${box.x + 28}" y="${box.y + box.h / 2 - 8}" font-size="13" font-weight="700" letter-spacing="2" fill="${color}">${esc(kicker)}</text>`,\n `<text x="${box.x + 28}" y="${box.y + box.h / 2 + 22}" font-size="${size}" font-weight="600" fill="${C.text}">${esc(fit(name, box.w - 48, size))}</text>`,\n `</g>`,\n ].join("");\n}\nfunction lane(L) {\n const [x1, y1] = L.lane.from;\n const [x2, y2] = L.lane.to;\n return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${C.panelEdge}" stroke-width="2" stroke-dasharray="6 8"/>`;\n}\nfunction laneLabel(L, text) {\n const [x1, y1] = L.lane.from;\n const [x2] = L.lane.to;\n return `<text x="${(x1 + x2) / 2}" y="${y1 - 16}" text-anchor="middle" font-family="${esc(MONO)}" font-size="16" fill="${C.muted}">${esc(fit(text, x2 - x1 - 40, 16, true))}</text>`;\n}\nfunction packet(from, to, t, color) {\n const x = from[0] + (to[0] - from[0]) * t;\n const y = from[1] + (to[1] - from[1]) * t;\n return `<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="18" fill="${color}" opacity="0.2"/><circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="9" fill="${color}"/>`;\n}\nconst SCHEMA_KEYS = new Set(["inputSchema", "outputSchema"]);\nfunction card(L, header, color, value, note, opacity, { code, fold, form } = {}) {\n const { x, y, w, h } = L.card;\n const size = code ? L.monoSize - 2 : L.monoSize;\n const lineHeight = Math.round(size * 1.4);\n const maxLines = Math.floor((h - 64) / lineHeight);\n const maxChars = Math.floor((w - 40) / (size * 0.6));\n const out = [\n `<g opacity="${opacity.toFixed(3)}">`,\n `<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="14" fill="${C.panel}" stroke="${C.panelEdge}" stroke-width="1.5"/>`,\n `<rect x="${x}" y="${y}" width="${w}" height="44" rx="14" fill="${color}" opacity="0.14"/>`,\n `<text x="${x + 20}" y="${y + 28}" font-family="${esc(MONO)}" font-size="${size}" font-weight="700" fill="${color}">${esc(fit(header, w - 40, size, true))}</text>`,\n ];\n if (note !== undefined) {\n note\n .split("\\n")\n .slice(0, maxLines)\n .forEach((line, i) => out.push(`<text x="${x + 20}" y="${y + 44 + (i + 1) * lineHeight + 4}" font-family="${esc(MONO)}" font-size="${size}" fill="${C.muted}">${esc(fit(line, w - 40, size, true))}</text>`));\n }\n else {\n const lines = code ? codeTspans(code, maxLines, maxChars) : form ? formTspans(String(value), maxLines, maxChars) : jsonLines(value, maxLines, maxChars, fold);\n lines.forEach((line, i) => out.push(`<text x="${x + 20}" y="${y + 44 + (i + 1) * lineHeight + 4}" font-family="${esc(MONO)}" font-size="${size}" xml:space="preserve">${line}</text>`));\n }\n out.push(`</g>`);\n return out.join("");\n}\nfunction badge(box, text, color, opacity) {\n const size = 15;\n const w = Math.min(box.w, textWidth(text, size, true) + 28);\n const x = box.x + box.w - w;\n const y = box.y - 40;\n return `<g opacity="${opacity.toFixed(3)}"><rect x="${x}" y="${y}" width="${w}" height="30" rx="15" fill="${color}" opacity="0.18"/><rect x="${x}" y="${y}" width="${w}" height="30" rx="15" fill="none" stroke="${color}" stroke-width="1.5"/><text x="${x + w / 2}" y="${y + 20}" text-anchor="middle" font-family="${esc(MONO)}" font-size="${size}" font-weight="700" fill="${color}">${esc(fit(text, w - 20, size, true))}</text></g>`;\n}\nfunction recoveryNote(L, text, opacity) {\n const box = L.stacked ? { x: L.card.x, y: L.client.y + L.client.h + 6 } : { x: L.client.x, y: L.client.y + L.client.h + 22 };\n const width = L.stacked ? L.card.w : L.client.w;\n const lines = wrap(`\u21BB ${text}`, width, 17, L.stacked ? 1 : 3);\n return `<g opacity="${opacity.toFixed(3)}">${lines\n .map((line, i) => `<text x="${box.x}" y="${box.y + 18 + i * 22}" font-size="17" font-weight="600" fill="${C.hook}">${esc(line)}</text>`)\n .join("")}</g>`;\n}\nfunction progressBar(L, fraction) {\n return `<rect x="0" y="${L.height - 4}" width="${L.width}" height="4" fill="${C.panelEdge}"/><rect x="0" y="${L.height - 4}" width="${(L.width * clamp01(fraction)).toFixed(1)}" height="4" fill="${C.accent}"/>`;\n}\nconst MARK = { size: 15, right: 24, bottom: 20 };\nfunction watermark(L) {\n return `<text x="${L.width - MARK.right}" y="${L.height - MARK.bottom}" text-anchor="end" font-size="${MARK.size}" font-weight="600" fill="${C.muted}" opacity="0.75">${esc(exports.WATERMARK)}</text>`;\n}\nfunction watermarkBox(aspect) {\n const L = layoutFor(aspect);\n const w = exports.WATERMARK.length * MARK.size * 0.6;\n return { x: L.width - MARK.right - w, y: L.height - MARK.bottom - MARK.size, w, h: MARK.size * 1.3 };\n}\nconst FOLDED = "\\uE000";\nfunction jsonLines(value, maxLines, maxChars, fold) {\n var _a, _b;\n let text;\n try {\n const replacer = fold ? (key, v) => (fold.has(key) && isRecord(v) ? FOLDED : v) : undefined;\n text = typeof value === "string" ? value : ((_b = (_a = JSON.stringify(value, replacer, 2)) === null || _a === void 0 ? void 0 : _a.replace(/"\\uE000"/g, "{ \u2026 }")) !== null && _b !== void 0 ? _b : "");\n }\n catch {\n text = String(value);\n }\n let lines = text.split("\\n");\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), " \u2026"];\n const xml = typeof value === "string" && /^\\s*</.test(value);\n return lines.map((raw) => {\n const line = (0, text_1.clip)(raw, maxChars);\n if (xml)\n return xmlTspans(line);\n const field = typeof value === "string" ? line.match(/^(event|data|id|retry):( ?)(.*)$/) : null;\n if (field)\n return `<tspan fill="${C.jsonKey}">${esc(field[1])}</tspan><tspan fill="${C.muted}">:${field[2]}</tspan>${colorValue(field[3])}`;\n const m = line.match(/^(\\s*)("(?:[^"\\\\]|\\\\.)*")(:\\s?)(.*)$/);\n if (!m)\n return colorValue(line);\n return `<tspan fill="${C.muted}">${esc(m[1])}</tspan><tspan fill="${C.jsonKey}">${esc(m[2])}</tspan><tspan fill="${C.muted}">${esc(m[3])}</tspan>${colorValue(m[4])}`;\n });\n}\nfunction formText(fields) {\n return Object.entries(fields)\n .map(([key, value], i) => `${i ? "&" : ""}${key}=${typeof value === "string" ? value : JSON.stringify(value)}`)\n .join("\\n");\n}\nfunction formTspans(text, maxLines, maxChars) {\n let lines = text.split("\\n");\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), "\u2026"];\n return lines.map((raw) => {\n const line = (0, text_1.clip)(raw, maxChars);\n const m = line.match(/^(&?)([^=]*)(=?)(.*)$/);\n return `<tspan fill="${C.muted}">${esc(m[1])}</tspan><tspan fill="${C.jsonKey}">${esc(m[2])}</tspan><tspan fill="${C.muted}">${esc(m[3])}</tspan><tspan fill="${C.jsonString}">${esc(m[4])}</tspan>`;\n });\n}\nconst XML_TOKEN = /(<\\/?[\\w.:-]+|\\/?>)|("[^"]*"?)|([\\w.:-]+=)/g;\nfunction xmlTspans(line) {\n const out = [];\n let last = 0;\n for (const m of line.matchAll(XML_TOKEN)) {\n if (m.index > last)\n out.push(`<tspan fill="${C.jsonString}">${esc(line.slice(last, m.index))}</tspan>`);\n const [token, tag, str] = m;\n out.push(`<tspan fill="${tag ? C.jsonKey : str ? C.jsonString : C.muted}">${esc(token)}</tspan>`);\n last = m.index + token.length;\n }\n if (last < line.length)\n out.push(`<tspan fill="${C.jsonString}">${esc(line.slice(last))}</tspan>`);\n return out.join("");\n}\nfunction codeTspans(code, maxLines, maxChars) {\n let lines = code.flatMap((line) => softWrap(line, maxChars));\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), " \u2026"];\n return lines.map((line) => {\n const out = [];\n let last = 0;\n for (const m of line.matchAll(CODE_TOKEN)) {\n if (m.index > last)\n out.push(`<tspan fill="${C.text}">${esc(line.slice(last, m.index))}</tspan>`);\n const [token, str, num, word] = m;\n const color = str ? (/^\\s*:/.test(line.slice(m.index + token.length)) ? C.jsonKey : C.jsonString) : num ? C.jsonOther : word ? C.key : m.index === 0 || /\\s/.test(line[m.index - 1]) ? C.client : C.text;\n out.push(`<tspan fill="${color}">${esc(token)}</tspan>`);\n last = m.index + token.length;\n }\n if (last < line.length)\n out.push(`<tspan fill="${C.text}">${esc(line.slice(last))}</tspan>`);\n return out.join("");\n });\n}\nconst CODE_TOKEN = /("(?:[^"\\\\]|\\\\.)*"?|\'(?:[^\'\\\\]|\\\\.)*\'?)|(\\b\\d+(?:\\.\\d+)?\\b)|(\\b(?:curl|await|fetch|requests|new|JSON|FormData|URLSearchParams|open|True|False|None|true|false|null)\\b)|(--?[a-zA-Z][\\w-]*)/g;\nfunction softWrap(line, max) {\n const indent = line.match(/^\\s*/)[0].length + 4;\n const out = [];\n let rest = line;\n while (rest.length > max && out.length < 40) {\n const window = rest.slice(0, max);\n const at = Math.max(window.lastIndexOf("/"), window.lastIndexOf(" "), window.lastIndexOf(","));\n const piece = at > indent ? rest.slice(0, at + 1) : (0, text_1.cut)(rest, max);\n out.push(piece);\n rest = " ".repeat(indent) + rest.slice(piece.length).trimStart();\n }\n return [...out, (0, text_1.clip)(rest, max)];\n}\nfunction colorValue(text) {\n const trimmed = text.trim();\n const color = trimmed.startsWith(\'"\') ? C.jsonString : /^[\\d\\-tfn]/.test(trimmed) ? C.jsonOther : C.muted;\n return `<tspan fill="${color}">${esc(text)}</tspan>`;\n}\nfunction textWidth(text, size, mono = false) {\n return text.length * size * (mono ? 0.6 : 0.54);\n}\nfunction fit(text, width, size, mono = false) {\n const max = Math.floor(width / (size * (mono ? 0.6 : 0.54)));\n return text.length > max ? (0, text_1.cut)(text, Math.max(1, max - 1)) + "\u2026" : text;\n}\nfunction wrap(text, width, size, maxLines) {\n const max = Math.max(8, Math.floor(width / (size * 0.54)));\n const words = text.split(/\\s+/).filter(Boolean);\n const lines = [];\n let current = "";\n for (const word of words) {\n const next = current ? `${current} ${word}` : word;\n if (next.length <= max)\n current = next;\n else {\n if (current)\n lines.push(current);\n current = (0, text_1.clip)(word, max);\n }\n }\n if (current)\n lines.push(current);\n if (lines.length > maxLines) {\n const kept = lines.slice(0, maxLines);\n kept[maxLines - 1] = fit(`${kept[maxLines - 1]} \u2026`, width, size);\n return kept;\n }\n return lines;\n}\nconst NOT_XML = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\uD800-\\uDFFF\uFFFE\uFFFF]/g;\nfunction esc(text) {\n return text\n .replace(NOT_XML, (c) => (c.length === 2 ? c : c < " " ? " " : ""))\n .replace(/&/g, "&amp;")\n .replace(/</g, "&lt;")\n .replace(/>/g, "&gt;")\n .replace(/"/g, "&quot;")\n .replace(/\'/g, "&#39;");\n}\nconst REASONS = {\n "200": "OK",\n "201": "Created",\n "202": "Accepted",\n "204": "No Content",\n "206": "Partial Content",\n "301": "Moved Permanently",\n "302": "Found",\n "303": "See Other",\n "304": "Not Modified",\n "307": "Temporary Redirect",\n "308": "Permanent Redirect",\n "400": "Bad Request",\n "401": "Unauthorized",\n "402": "Payment Required",\n "403": "Forbidden",\n "404": "Not Found",\n "405": "Method Not Allowed",\n "409": "Conflict",\n "410": "Gone",\n "412": "Precondition Failed",\n "413": "Content Too Large",\n "422": "Unprocessable",\n "429": "Too Many Requests",\n "500": "Server Error",\n "502": "Bad Gateway",\n "503": "Unavailable",\n "504": "Gateway Timeout",\n};\nfunction reason(status) {\n var _a;\n return (_a = REASONS[status]) !== null && _a !== void 0 ? _a : "";\n}\nfunction clamp01(n) {\n return Math.max(0, Math.min(1, n));\n}\nfunction ease(t) {\n const x = clamp01(t);\n return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;\n}\nfunction pulse(p, a, b) {\n if (p < a || p > b)\n return 0;\n return Math.sin(((p - a) / (b - a)) * Math.PI);\n}\n\n}, {"../storyboard/timing":"lib/storyboard/timing","./code":"lib/render/code","../text":"lib/text"}],\n"lib/storyboard/timing": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.VOICE_LEAD = void 0;\nexports.activeScenes = activeScenes;\nexports.sceneDuration = sceneDuration;\nexports.totalDuration = totalDuration;\nexports.voiceCues = voiceCues;\nexports.summaryItems = summaryItems;\nexports.VOICE_LEAD = 400;\nconst VOICE_TAIL = 600;\nfunction activeScenes(sb) {\n return sb.scenes.filter((s) => sb.settings.showFailure || !s.failurePath);\n}\nfunction sceneDuration(sb, scene) {\n if (!sb.settings.voiceover || !scene.voiceMs)\n return scene.duration;\n return Math.max(scene.duration, Math.ceil(exports.VOICE_LEAD + scene.voiceMs + VOICE_TAIL));\n}\nfunction totalDuration(sb) {\n return activeScenes(sb).reduce((sum, s) => sum + sceneDuration(sb, s), 0);\n}\nfunction voiceCues(sb) {\n if (!sb.settings.voiceover)\n return [];\n const cues = [];\n let t = 0;\n for (const scene of activeScenes(sb)) {\n if (scene.voiceMs)\n cues.push({ sceneId: scene.id, at: t + exports.VOICE_LEAD });\n t += sceneDuration(sb, scene);\n }\n return cues;\n}\nfunction summaryItems(sb) {\n const items = [];\n let failure;\n for (const scene of activeScenes(sb)) {\n if (!scene.summaryLine)\n continue;\n if (scene.kind === "call" && scene.outcome === "failure") {\n failure = scene.summaryLine;\n continue;\n }\n items.push(scene.summaryLine);\n if (failure)\n items.push(failure);\n failure = undefined;\n }\n if (failure)\n items.push(failure);\n return items;\n}\n\n}, {}],\n"lib/render/code": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.CODE_STYLES = void 0;\nexports.codeRequest = codeRequest;\nexports.authCode = authCode;\nexports.callCode = callCode;\nexports.codeLines = codeLines;\nconst examples_1 = require("../oas/examples");\nconst timing_1 = require("../storyboard/timing");\nexports.CODE_STYLES = [\n { style: "curl", label: "curl" },\n { style: "javascript", label: "JavaScript" },\n { style: "python", label: "Python" },\n];\nfunction codeRequest(sb, scene) {\n var _a, _b, _c, _d;\n let url = /^[a-z][a-z\\d+.-]*:\\/\\//i.test(scene.path) ? scene.path : `${sb.api.baseUrl}${scene.path}`;\n const body = /^(GET|HEAD)$/.test(scene.method) && isEmptyValue(scene.request) ? undefined : scene.request;\n const req = { method: scene.method, url, headers: [], body, contentType: scene.requestType, ...(scene.encoding ? { encoding: scene.encoding } : {}) };\n const auth = sb.scenes.find((s) => s.kind === "auth");\n const credentials = (_a = scene.credentials) !== null && _a !== void 0 ? _a : ((auth === null || auth === void 0 ? void 0 : auth.kind) === "auth" ? ((_b = auth.credentials) !== null && _b !== void 0 ? _b : auth.headerLine.split("\\n").map(fromLine)) : []);\n const cookies = ((_c = scene.cookies) !== null && _c !== void 0 ? _c : []).map(([name, value]) => `${name}=${value}`);\n for (const credential of credentials) {\n if (!credential)\n continue;\n const c = { ...credential, value: credential.value.replace(/\u2026/g, "...") };\n if (c.in === "query")\n url += (url.includes("?") ? "&" : "?") + `${c.name}=${c.value}`;\n else if (c.in === "cookie")\n cookies.unshift(`${c.name}=${c.value}`);\n else if (c.in === "certificate")\n req.certificate = { cert: c.name, key: c.value };\n else if (c.in === "digest")\n req.digest = { username: c.name, password: c.value };\n else\n req.headers.push([c.name, c.value]);\n }\n req.headers.push(...((_d = scene.headers) !== null && _d !== void 0 ? _d : []));\n if (cookies.length)\n req.headers.push(["Cookie", cookies.join("; ")]);\n return { ...req, url };\n}\nfunction fromLine(line) {\n if (line.startsWith("?")) {\n const eq = line.indexOf("=");\n return eq > 1 ? { in: "query", name: line.slice(1, eq), value: line.slice(eq + 1) } : undefined;\n }\n const colon = line.indexOf(":");\n return colon > 0 ? { in: "header", name: line.slice(0, colon).trim(), value: line.slice(colon + 1).trim() } : undefined;\n}\nfunction bodyKind(req) {\n var _a, _b;\n const type = (_b = (_a = req.contentType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : "";\n if (req.body === undefined)\n return "none";\n if (type.includes("multipart/form-data") && isObject(req.body))\n return "multipart";\n if (type.includes("x-www-form-urlencoded") && isObject(req.body))\n return "form";\n if (typeof req.body === "string" && req.body === examples_1.BINARY_PLACEHOLDER)\n return "binary";\n if (typeof req.body === "string" && type && !/json/.test(type))\n return "text";\n return "json";\n}\nconst isFile = (value) => value === examples_1.BINARY_PLACEHOLDER;\nfunction fieldText(value) {\n return typeof value === "string" ? value : value === undefined || value === null ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);\n}\nfunction formPairs(body, encoding = {}) {\n var _a, _b, _c, _d;\n const out = [];\n for (const [name, value] of Object.entries(body)) {\n if (value === null || value === undefined)\n continue;\n const style = (_b = (_a = encoding[name]) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : "form";\n const explode = (_d = (_c = encoding[name]) === null || _c === void 0 ? void 0 : _c.explode) !== null && _d !== void 0 ? _d : style === "form";\n if (style === "deepObject" && typeof value === "object" && value !== null)\n out.push(...bracketed(name, value));\n else if (Array.isArray(value)) {\n if (explode && style === "form")\n out.push(...value.map((item) => [name, fieldText(item)]));\n else\n out.push([name, value.map(fieldText).join(style === "spaceDelimited" ? " " : style === "pipeDelimited" ? "|" : ",")]);\n }\n else if (isObject(value)) {\n if (explode)\n out.push(...Object.entries(value).map(([key, v]) => [key, fieldText(v)]));\n else\n out.push([name, Object.entries(value).flatMap(([key, v]) => [key, fieldText(v)]).join(",")]);\n }\n else\n out.push([name, fieldText(value)]);\n }\n return out;\n}\nfunction bracketed(name, value) {\n if (Array.isArray(value))\n return value.flatMap((item, i) => bracketed(`${name}[${i}]`, item));\n if (isObject(value))\n return Object.entries(value).flatMap(([key, v]) => bracketed(`${name}[${key}]`, v));\n return [[name, fieldText(value)]];\n}\nfunction formObject(body) {\n return Object.fromEntries(Object.entries(body).flatMap(([key, value]) => (value === null || value === undefined ? [] : [[key, typeof value === "boolean" ? String(value) : value]])));\n}\nfunction flat(body) {\n return Object.values(body).every((value) => typeof value !== "object" || value === null);\n}\nfunction multipartParts(body, encoding = {}) {\n var _a;\n const parts = [];\n for (const [name, value] of Object.entries(body)) {\n if (value === null || value === undefined)\n continue;\n const type = (_a = encoding[name]) === null || _a === void 0 ? void 0 : _a.contentType;\n const items = Array.isArray(value) && !value.some((v) => typeof v === "object" && v !== null) ? value : [value];\n for (const item of items) {\n if (isFile(item))\n parts.push({ name, file: true });\n else if (typeof item === "object" && item !== null)\n parts.push({ name, text: JSON.stringify(item), type: type !== null && type !== void 0 ? type : "application/json" });\n else\n parts.push({ name, text: fieldText(item), ...(type && !/^text\\/plain\\b/i.test(type) ? { type } : {}) });\n }\n }\n return parts;\n}\nfunction filePath(name) {\n return /^[\\w-]+$/.test(name) ? name : "file";\n}\nfunction isObject(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction isEmptyValue(value) {\n return value === undefined || (typeof value === "object" && value !== null && Object.keys(value).length === 0);\n}\nfunction authCode(sb, scene, style) {\n var _a, _b, _c, _d;\n const target = (_b = (_a = scene.requestLine) === null || _a === void 0 ? void 0 : _a.replace(/^POST\\s+/, "")) !== null && _b !== void 0 ? _b : "";\n const url = (_c = scene.tokenUrl) !== null && _c !== void 0 ? _c : (/^https?:\\/\\//i.test(target) ? target : `${sb.api.baseUrl}${target}`);\n return codeLines({ method: "POST", url, headers: [], body: scene.request, contentType: (_d = scene.requestType) !== null && _d !== void 0 ? _d : "application/x-www-form-urlencoded" }, style);\n}\nfunction callCode(sb, scene, style) {\n return sb.api.protocol === "mcp" ? mcpCode(sb, scene, style) : codeLines(codeRequest(sb, scene), style);\n}\nfunction codeLines(req, style) {\n switch (style) {\n case "curl":\n return curl(req);\n case "javascript":\n return javascript(req);\n default:\n return python(req);\n }\n}\nfunction curl(req) {\n var _a, _b, _c;\n const kind = bodyKind(req);\n const parts = [];\n const method = req.method === "HEAD" ? " -I" : req.method === "GET" || (req.method === "POST" && kind !== "none") ? "" : ` -X ${shellQuote(req.method)}`;\n const glob = /[[\\]{}]/.test(req.url) ? " -g" : "";\n parts.push([`curl${glob}${method} ${shellQuote(req.url, /[?&]/.test(req.url))}`]);\n if (req.certificate)\n parts.push([` --cert ${shellQuote(req.certificate.cert)} --key ${shellQuote(req.certificate.key)}`]);\n if (req.digest)\n parts.push([` --digest -u ${shellQuote(`${req.digest.username}:${req.digest.password}`, true)}`]);\n for (const [name, value] of req.headers)\n parts.push([` -H ${shellQuote(`${name}: ${value}`, true)}`]);\n const body = req.body;\n const contentType = (type) => [` -H ${shellQuote(`Content-Type: ${type}`, true)}`];\n if (kind === "json") {\n parts.push(contentType((_a = req.contentType) !== null && _a !== void 0 ? _a : "application/json"));\n parts.push(quotedData(pretty(body, "json", 2)));\n }\n else if (kind === "form" && isObject(body)) {\n for (const [key, value] of formPairs(body, req.encoding))\n parts.push([` --data-urlencode ${shellQuote(`${key}=${value}`, true)}`]);\n }\n else if (kind === "multipart" && isObject(body)) {\n for (const part of multipartParts(body, req.encoding))\n parts.push([` ${formPart(part)}`]);\n }\n else if (kind === "binary") {\n parts.push(contentType((_b = req.contentType) !== null && _b !== void 0 ? _b : "application/octet-stream"), [" --data-binary @file"]);\n }\n else if (kind === "text") {\n parts.push(contentType((_c = req.contentType) !== null && _c !== void 0 ? _c : "text/plain"), quotedData(String(body).split("\\n")));\n }\n return parts.flatMap((part, p) => part.map((line, i) => (p < parts.length - 1 && i === part.length - 1 ? `${line} \\\\` : line)));\n}\nfunction formPart(part) {\n const value = part.file ? `@${filePath(part.name)}` : part.text;\n if (part.name.includes("="))\n return `--form-string ${shellQuote(`${part.name}=${value}`, true)}`;\n if (part.file)\n return `-F ${shellQuote(`${part.name}=${value}`, true)}`;\n if (part.type) {\n const text = readsMore(value) ? `"${value.replace(/[\\\\"]/g, "\\\\$&")}"` : value;\n return `-F \'${escapeSingle(`${part.name}=${text}${formType(part.type)}`)}\'`;\n }\n return `${readsMore(value) ? "--form-string" : "-F"} ${shellQuote(`${part.name}=${value}`, true)}`;\n}\nfunction formType(type) {\n const [essence, ...params] = type.split(",")[0].split(";").map((s) => s.trim());\n if (!/^[\\w.+*-]+\\/[\\w.+*-]+$/.test(essence))\n return "";\n const kept = params.filter((p) => /^[\\w.+-]+=[^\\s"\\\\]*$/.test(p) && !/^(type|filename|headers|encoder)=/i.test(p));\n return `;type=${[essence, ...kept].join("; ")}`;\n}\nfunction readsMore(text) {\n return /^[@<"\\s]|;|\\s$/.test(text);\n}\nfunction quotedData(lines) {\n const body = lines.map(escapeSingle);\n return body.length === 1 ? [` -d \'${body[0]}\'`] : [` -d \'${body[0]}`, ...body.slice(1, -1).map((l) => ` ${l}`), ` ${body.at(-1)}\'`];\n}\nfunction shellQuote(text, always = false) {\n if (!always && !/[^\\w@%+=:,./-]/.test(text))\n return text;\n return /["\\\\$`!]/.test(text) ? `\'${escapeSingle(text)}\'` : `"${text}"`;\n}\nfunction escapeSingle(text) {\n return text.replace(/\'/g, `\'\\\\\'\'`);\n}\nfunction javascript(req) {\n var _a, _b, _c;\n const kind = bodyKind(req);\n const lines = [];\n const headers = [...req.headers];\n let body = [];\n if (req.certificate)\n lines.push(`// Sent over mutual TLS with ${req.certificate.cert} and ${req.certificate.key}`);\n if (req.digest) {\n lines.push("// Answer the API\'s Digest challenge with your username and password");\n headers.push(["Authorization", `Digest username="${req.digest.username}", nonce="...", response="..."`]);\n }\n if (kind === "json") {\n headers.push(["Content-Type", (_a = req.contentType) !== null && _a !== void 0 ? _a : "application/json"]);\n body = wrapLines("body: JSON.stringify(", pretty(req.body, "json", 2), "),");\n }\n else if (kind === "multipart" && isObject(req.body)) {\n lines.push("const form = new FormData();");\n for (const part of multipartParts(req.body, req.encoding)) {\n const value = part.file ? "file" : part.type ? `new Blob([${jsString(part.text)}], { type: ${jsString(part.type)} })` : jsString(part.text);\n lines.push(`form.append(${jsString(part.name)}, ${value});`);\n }\n body = ["body: form,"];\n }\n else if (kind === "form" && isObject(req.body)) {\n body = flat(req.body) && !req.encoding\n ? wrapLines("body: new URLSearchParams(", pretty(formObject(req.body), "json", 2), "),")\n : ["body: new URLSearchParams([", ...formPairs(req.body, req.encoding).map(([k, v]) => ` [${jsString(k)}, ${jsString(v)}],`), "]),"];\n }\n else if (kind === "binary") {\n headers.push(["Content-Type", (_b = req.contentType) !== null && _b !== void 0 ? _b : "application/octet-stream"]);\n body = ["body: file,"];\n }\n else if (kind === "text") {\n headers.push(["Content-Type", (_c = req.contentType) !== null && _c !== void 0 ? _c : "text/plain"]);\n const text = String(req.body);\n body = text.includes("\\n") ? wrapLines("body: `", text.replace(/[`\\\\]|\\$\\{/g, (m) => `\\\\${m}`).split("\\n"), "`,") : [`body: ${jsString(text)},`];\n }\n const options = [\n ...(req.method === "GET" ? [] : [`method: ${jsString(req.method)},`]),\n ...(headers.length ? ["headers: {", ...headers.map(([n, v]) => ` ${jsString(n)}: ${jsString(v)},`), "},"] : []),\n ...body,\n ];\n if (!options.length)\n return [...lines, `await fetch(${jsString(req.url)});`];\n return [...lines, `await fetch(${jsString(req.url)}, {`, ...options.map((l) => ` ${l}`), "});"];\n}\nfunction jsString(text) {\n return JSON.stringify(text);\n}\nconst PYTHON_METHODS = new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);\nfunction python(req) {\n var _a, _b;\n const kind = bodyKind(req);\n const args = [[`${jsString(req.url)},`]];\n const headers = [...req.headers];\n if (kind === "binary")\n headers.push(["Content-Type", (_a = req.contentType) !== null && _a !== void 0 ? _a : "application/octet-stream"]);\n if (kind === "text")\n headers.push(["Content-Type", (_b = req.contentType) !== null && _b !== void 0 ? _b : "text/plain"]);\n if (headers.length === 1)\n args.push([`headers={${jsString(headers[0][0])}: ${jsString(headers[0][1])}},`]);\n else if (headers.length)\n args.push(["headers={", ...headers.map(([n, v]) => ` ${jsString(n)}: ${jsString(v)},`), "},"]);\n if (req.certificate)\n args.push([`cert=(${jsString(req.certificate.cert)}, ${jsString(req.certificate.key)}),`]);\n if (req.digest)\n args.push([`auth=requests.auth.HTTPDigestAuth(${jsString(req.digest.username)}, ${jsString(req.digest.password)}),`]);\n if (kind === "json")\n args.push(wrapLines("json=", pretty(req.body, "python", 4), ","));\n else if (kind === "form" && isObject(req.body)) {\n if (flat(req.body) && !req.encoding)\n args.push(wrapLines("data=", pretty(formObject(req.body), "python", 4), ","));\n else\n args.push(["data=[", ...formPairs(req.body, req.encoding).map(([k, v]) => ` (${jsString(k)}, ${jsString(v)}),`), "],"]);\n }\n else if (kind === "multipart" && isObject(req.body)) {\n const parts = multipartParts(req.body, req.encoding);\n const typed = parts.filter((p) => p.file || p.type);\n const files = typed.length ? typed : parts;\n const fields = typed.length ? parts.filter((p) => !p.file && !p.type) : [];\n const file = (p) => (p.file ? `open(${jsString(filePath(p.name))}, "rb")` : p.type ? `(None, ${jsString(p.text)}, ${jsString(p.type)})` : `(None, ${jsString(p.text)})`);\n const twice = (list) => new Set(list.map((p) => p.name)).size < list.length;\n if (files.length) {\n args.push(twice(files) ? ["files=[", ...files.map((p) => ` (${jsString(p.name)}, ${file(p)}),`), "],"] : ["files={", ...files.map((p) => ` ${jsString(p.name)}: ${file(p)},`), "},"]);\n }\n if (fields.length) {\n args.push(twice(fields) ? ["data=[", ...fields.map((p) => ` (${jsString(p.name)}, ${jsString(p.text)}),`), "],"] : ["data={", ...fields.map((p) => ` ${jsString(p.name)}: ${jsString(p.text)},`), "},"]);\n }\n }\n else if (kind === "binary")\n args.push([`data=open("file", "rb"),`]);\n else if (kind === "text") {\n const text = String(req.body);\n args.push(text.includes("\\n") ? wrapLines(\'data="""\', text.replace(/\\\\/g, "\\\\\\\\").replace(/"""/g, \'\\\\"\\\\"\\\\"\').split("\\n"), \'""",\') : [`data=${jsString(text)},`]);\n }\n const call = PYTHON_METHODS.has(req.method) ? `requests.${req.method.toLowerCase()}(` : `requests.request(${jsString(req.method)},`;\n return [call, ...args.flat().map((l) => ` ${l}`), ")"];\n}\nconst MCP_VERSION = "2026-07-28";\nconst VERSION_HEADER_SINCE = "2025-06-18";\nconst SESSION_ID = "1868a90c...";\nconst CLIENT_INFO = { name: "your-agent", version: "1.0.0" };\nfunction mcpCode(sb, scene, style) {\n const http = /^https?:\\/\\//i.test(sb.api.baseUrl);\n const auth = sb.scenes.some((s) => s.kind === "auth");\n switch (style) {\n case "curl":\n return mcpWire(sb, scene, http);\n case "javascript":\n return mcpJavaScript(sb, scene, http, auth);\n default:\n return mcpPython(sb, scene, http, auth);\n }\n}\nfunction rpcBody(sb, scene, modern) {\n var _a;\n const meta = { "io.modelcontextprotocol/protocolVersion": MCP_VERSION, "io.modelcontextprotocol/clientInfo": CLIENT_INFO, "io.modelcontextprotocol/clientCapabilities": {} };\n const params = scene.method === "tools/call"\n ? { name: scene.path, arguments: (_a = scene.request) !== null && _a !== void 0 ? _a : {} }\n : scene.method === "resources/read"\n ? { uri: scene.path }\n : scene.method === "prompts/get"\n ? { name: scene.path, ...(scene.request !== undefined ? { arguments: scene.request } : {}) }\n : {};\n if (!modern)\n return { jsonrpc: "2.0", id: rpcId(sb, scene), method: scene.method, ...(Object.keys(params).length ? { params } : {}) };\n return { jsonrpc: "2.0", id: rpcId(sb, scene), method: scene.method, params: { ...params, _meta: meta } };\n}\nfunction rpcId(sb, scene) {\n const index = (0, timing_1.activeScenes)(sb)\n .filter((s) => s.kind === "call")\n .indexOf(scene);\n return index >= 0 ? index + 1 : scene.step;\n}\nfunction mcpWire(sb, scene, http) {\n var _a, _b, _c;\n const revision = (_a = sb.api.revision) !== null && _a !== void 0 ? _a : MCP_VERSION;\n const modern = revision >= MCP_VERSION;\n const body = JSON.stringify(rpcBody(sb, scene, modern));\n if (!http) {\n if (modern)\n return [`echo \'${escapeSingle(body)}\' \\\\`, ` | ${sb.api.baseUrl}`];\n const init = JSON.stringify({ jsonrpc: "2.0", id: 0, method: "initialize", params: { protocolVersion: revision, capabilities: {}, clientInfo: CLIENT_INFO } });\n return [`printf \'%s\\\\n\' \\\\`, ` \'${escapeSingle(init)}\' \\\\`, ` \'{"jsonrpc":"2.0","method":"notifications/initialized"}\' \\\\`, ` \'${escapeSingle(body)}\' \\\\`, ` | ${sb.api.baseUrl}`];\n }\n const headers = [["Accept", "application/json, text/event-stream"]];\n if (modern) {\n headers.push(["MCP-Protocol-Version", MCP_VERSION], ["Mcp-Method", scene.method]);\n if (scene.method !== "tools/list")\n headers.push(["Mcp-Name", headerValue(scene.path)]);\n for (const { name, path } of (_b = scene.paramHeaders) !== null && _b !== void 0 ? _b : []) {\n const value = path.reduce((at, key) => (isObject(at) ? at[key] : undefined), scene.request);\n if (typeof value === "string" || typeof value === "boolean" || (typeof value === "number" && Number.isSafeInteger(value)))\n headers.push([`Mcp-Param-${name}`, headerValue(String(value))]);\n }\n }\n else {\n if (revision >= VERSION_HEADER_SINCE)\n headers.push(["MCP-Protocol-Version", revision]);\n if (sb.api.session !== false)\n headers.push(["Mcp-Session-Id", SESSION_ID]);\n }\n const auth = sb.scenes.find((s) => s.kind === "auth");\n if ((auth === null || auth === void 0 ? void 0 : auth.kind) === "auth")\n for (const c of (_c = auth.credentials) !== null && _c !== void 0 ? _c : [])\n if (c.in === "header")\n headers.push([c.name, c.value.replace(/\u2026/g, "...")]);\n return [`curl ${shellQuote(sb.api.baseUrl)} \\\\`, ...headers.map(([n, v]) => ` -H ${shellQuote(`${n}: ${v}`, true)} \\\\`), ` --json \'${escapeSingle(body)}\'`];\n}\nfunction headerValue(text) {\n const plain = /^[\\x21-\\x7e]([\\x20-\\x7e\\t]*[\\x21-\\x7e])?$/.test(text) && !/^=\\?base64\\?.*\\?=$/.test(text);\n if (plain)\n return text;\n const bytes = new TextEncoder().encode(text);\n let binary = "";\n for (const byte of bytes)\n binary += String.fromCharCode(byte);\n return `=?base64?${btoa(binary)}?=`;\n}\nfunction mcpJavaScript(sb, scene, http, auth) {\n var _a, _b, _c;\n switch (scene.method) {\n case "tools/list": {\n const command = sb.api.baseUrl.split(" ");\n const transport = http\n ? [` new StreamableHTTPClientTransport(new URL(${jsString(sb.api.baseUrl)})${auth ? ", { authProvider }" : ""}),`]\n : [` new StdioClientTransport({ command: ${jsString(command[0])}, args: ${list(command.slice(1))} }),`];\n const negotiate = ((_a = sb.api.revision) !== null && _a !== void 0 ? _a : MCP_VERSION) >= MCP_VERSION ? `, { versionNegotiation: { mode: "auto" } }` : "";\n return [\n `import { Client${http ? ", StreamableHTTPClientTransport" : ""} } from "@modelcontextprotocol/client";`,\n ...(http ? [] : [`import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";`]),\n "",\n `const client = new Client({ name: "your-agent", version: "1.0.0" }${negotiate});`,\n "await client.connect(",\n ...transport,\n ");",\n "const { tools } = await client.listTools();",\n ];\n }\n case "resources/read":\n return [`const { contents } = await client.readResource({ uri: ${jsString(scene.path)} });`];\n case "prompts/get":\n return ["const { messages } = await client.getPrompt({", ` name: ${jsString(scene.path)},`, ...indented(" ", wrapLines("arguments: ", pretty((_b = scene.request) !== null && _b !== void 0 ? _b : {}, "json", 2), ",")), "});"];\n default:\n return ["const result = await client.callTool({", ` name: ${jsString(scene.path)},`, ...indented(" ", wrapLines("arguments: ", pretty((_c = scene.request) !== null && _c !== void 0 ? _c : {}, "json", 2), ",")), "});"];\n }\n}\nfunction mcpPython(sb, scene, http, auth) {\n var _a, _b;\n switch (scene.method) {\n case "tools/list": {\n if (http && auth) {\n return [\n "import httpx2",\n "from mcp import Client",\n "from mcp.client.streamable_http import streamable_http_client",\n "",\n "http = httpx2.AsyncClient(auth=oauth) # an OAuthClientProvider",\n `async with Client(streamable_http_client(${jsString(sb.api.baseUrl)}, http_client=http)) as client:`,\n " result = await client.list_tools()",\n ];\n }\n if (http)\n return ["from mcp import Client", "", `async with Client(${jsString(sb.api.baseUrl)}) as client:`, " result = await client.list_tools()"];\n const [command, ...args] = sb.api.baseUrl.split(" ");\n return [\n "from mcp import Client, StdioServerParameters",\n "",\n `server = StdioServerParameters(command=${jsString(command)}, args=${list(args)})`,\n "async with Client(server) as client:",\n " result = await client.list_tools()",\n ];\n }\n case "resources/read":\n return [`result = await client.read_resource(${jsString(scene.path)})`];\n case "prompts/get":\n return ["result = await client.get_prompt(", ` ${jsString(scene.path)},`, ...indented(" ", wrapLines("", pretty((_a = scene.request) !== null && _a !== void 0 ? _a : {}, "python", 4), ",")), ")"];\n default:\n return ["result = await client.call_tool(", ` ${jsString(scene.path)},`, ...indented(" ", wrapLines("", pretty((_b = scene.request) !== null && _b !== void 0 ? _b : {}, "python", 4), ",")), ")"];\n }\n}\nfunction list(items) {\n return `[${items.map(jsString).join(", ")}]`;\n}\nfunction indented(indent, lines) {\n return lines.map((line) => `${indent}${line}`);\n}\nfunction wrapLines(head, lines, tail) {\n if (lines.length === 1)\n return [`${head}${lines[0]}${tail}`];\n return [`${head}${lines[0]}`, ...lines.slice(1, -1), `${lines.at(-1)}${tail}`];\n}\nfunction pretty(value, as, indent) {\n var _a;\n const text = (_a = JSON.stringify(value, null, indent)) !== null && _a !== void 0 ? _a : "null";\n if (as === "json")\n return text.split("\\n");\n return text.split("\\n").map((line) => line.replace(/("(?:[^"\\\\]|\\\\.)*")|\\b(true|false|null)\\b/g, (_, str, word) => str !== null && str !== void 0 ? str : { true: "True", false: "False", null: "None" }[word]));\n}\n\n}, {"../oas/examples":"lib/oas/examples","../storyboard/timing":"lib/storyboard/timing"}],\n"lib/oas/examples": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.PLACEHOLDER_UUID = exports.BINARY_PLACEHOLDER = void 0;\nexports.mediaKind = mediaKind;\nexports.isTextKind = isTextKind;\nexports.exampleForMedia = exampleForMedia;\nexports.toXml = toXml;\nexports.exampleForParameter = exampleForParameter;\nexports.exampleFromSchema = exampleFromSchema;\nexports.conform = conform;\nexports.placeholder = placeholder;\nexports.isPlaceholder = isPlaceholder;\nexports.patternExample = patternExample;\nexports.isIdName = isIdName;\nexports.idLike = idLike;\nexports.uuidLike = uuidLike;\nexports.singular = singular;\nconst fit_1 = require("./fit");\nexports.BINARY_PLACEHOLDER = "<binary data>";\nconst BINARY_MEDIA = /octet-stream|^(image|audio|video|font)\\/|application\\/(pdf|zip|gzip|x-tar)/i;\nfunction mediaKind(contentType) {\n const type = contentType.toLowerCase().split(";")[0].trim();\n if (/^application\\/(x-)?(ndjson|jsonl|jsonlines|json-lines)$|json-seq$/.test(type))\n return "sequence";\n if (/json/.test(type))\n return "json";\n if (type === "application/x-www-form-urlencoded")\n return "form";\n if (type.startsWith("multipart/"))\n return "multipart";\n if (/[/+]xml$/.test(type))\n return "xml";\n if (type === "text/event-stream")\n return "events";\n if (BINARY_MEDIA.test(type))\n return "binary";\n if (type.startsWith("text/") || /^application\\/(x-)?(yaml|csv|graphql|javascript|sql)$/.test(type))\n return "text";\n return "json";\n}\nfunction isTextKind(kind) {\n return kind === "xml" || kind === "sequence" || kind === "events" || kind === "text";\n}\nfunction exampleForMedia(media, mode = "response", contentType = "", subject) {\n if (!media)\n return { value: undefined, generated: false };\n const kind = mediaKind(contentType);\n const given = documentedExample(media, kind);\n if (given !== undefined && !isTextKind(kind) && media.schema && otherShape(given, media.schema)) {\n return { value: conform(exampleFromSchema(media.schema, "", 0, mode, undefined, subject), media.schema, mode, "", 0, undefined, subject), generated: true };\n }\n if (given !== undefined) {\n if (!isTextKind(kind) && kind !== "binary" && media.schema) {\n const fixed = conform(given, media.schema, mode, "", 0, undefined, subject);\n return { value: fixed, generated: fixed !== given };\n }\n return { value: serialize(given, kind, media, contentType), generated: false };\n }\n if (BINARY_MEDIA.test(contentType) && (!media.schema || media.schema.type === "string" || media.schema.format === "binary")) {\n return { value: exports.BINARY_PLACEHOLDER, generated: true };\n }\n if (isTextKind(kind) && (media.schema || media.itemSchema))\n return { value: textFromSchema(media, kind, mode, contentType), generated: true };\n if (media.schema)\n return { value: conform(exampleFromSchema(media.schema, "", 0, mode, undefined, subject), media.schema, mode, "", 0, undefined, subject), generated: true };\n return { value: undefined, generated: false };\n}\nfunction otherShape(example, schema) {\n if (!isRecord(example) || !Object.keys(example).length)\n return false;\n const names = new Set();\n const patterns = [];\n let open = false;\n const collect = (s, depth) => {\n var _a, _b, _c, _d, _e;\n if (!s || typeof s !== "object" || depth > 6)\n return;\n const target = (0, fit_1.circularTarget)(s);\n if (target)\n return collect(target, depth + 1);\n for (const key of Object.keys((_a = s.properties) !== null && _a !== void 0 ? _a : {}))\n names.add(key);\n patterns.push(...Object.keys((_b = s.patternProperties) !== null && _b !== void 0 ? _b : {}));\n if (isRecord(s.additionalProperties))\n open = true;\n for (const part of [...((_c = s.allOf) !== null && _c !== void 0 ? _c : []), ...((_d = s.oneOf) !== null && _d !== void 0 ? _d : []), ...((_e = s.anyOf) !== null && _e !== void 0 ? _e : [])])\n collect(part, depth + 1);\n };\n collect(schema, 0);\n if (!names.size || open)\n return false;\n return !Object.keys(example).some((key) => names.has(key) || patterns.some((pattern) => (0, fit_1.matchesPattern)(pattern, key)));\n}\nfunction documentedExample(media, kind) {\n var _a;\n if (media.example !== undefined)\n return media.example;\n for (const example of Object.values((_a = media.examples) !== null && _a !== void 0 ? _a : {})) {\n const value = exampleValue(example, isTextKind(kind));\n if (value !== undefined)\n return kind === "json" && (example === null || example === void 0 ? void 0 : example.dataValue) === undefined && (example === null || example === void 0 ? void 0 : example.value) === undefined ? parseJsonText(value) : value;\n }\n return undefined;\n}\nfunction exampleValue(example, text) {\n if (!example || typeof example !== "object")\n return undefined;\n const serialized = typeof example.serializedValue === "string" ? example.serializedValue : undefined;\n if (text && serialized !== undefined)\n return serialized;\n if (example.dataValue !== undefined)\n return example.dataValue;\n return example.value !== undefined ? example.value : serialized;\n}\nfunction parseJsonText(value) {\n if (typeof value !== "string")\n return value;\n try {\n return JSON.parse(value);\n }\n catch {\n return value;\n }\n}\nfunction serialize(value, kind, media, contentType) {\n if (!isTextKind(kind) || typeof value === "string")\n return value;\n switch (kind) {\n case "xml":\n return toXml(value, media.schema);\n case "sequence":\n return (Array.isArray(value) ? value : [value]).map((item) => JSON.stringify(item)).join("\\n");\n case "events":\n return (Array.isArray(value) ? value : [value]).map((event) => toEvent(event, media.itemSchema)).join("\\n\\n");\n default:\n return toText(value, contentType);\n }\n}\nfunction textFromSchema(media, kind, mode, contentType) {\n var _a, _b;\n const schema = (_a = media.schema) !== null && _a !== void 0 ? _a : {};\n const made = (s) => conform(exampleFromSchema(s, "", 0, mode), s, mode);\n if (kind === "xml")\n return toXml(made(schema), schema);\n if (kind === "sequence" || kind === "events") {\n const item = (_b = media.itemSchema) !== null && _b !== void 0 ? _b : (schema.items && (schema.type === "array" || Array.isArray(schema.type)) ? schema.items : schema);\n const value = made(item);\n return kind === "sequence" ? JSON.stringify(value) : toEvent(value, item);\n }\n return toText(made(schema), contentType);\n}\nfunction toEvent(value, schema) {\n var _a, _b, _c;\n const fields = isRecord(value) && "data" in value ? value : { data: value };\n const lines = [];\n for (const key of ["event", "id", "retry"])\n if (fields[key] !== undefined && fields[key] !== null)\n lines.push(`${key}: ${String(fields[key])}`);\n let data = fields.data;\n const dataSchema = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a.data;\n if (typeof data === "string" && (dataSchema === null || dataSchema === void 0 ? void 0 : dataSchema.contentSchema) && /json/i.test((_b = dataSchema.contentMediaType) !== null && _b !== void 0 ? _b : "json"))\n data = exampleFromSchema(dataSchema.contentSchema, "data");\n for (const line of (typeof data === "string" ? data : (_c = JSON.stringify(data)) !== null && _c !== void 0 ? _c : "").split("\\n"))\n lines.push(`data: ${line}`);\n return lines.join("\\n");\n}\nfunction toText(value, contentType) {\n if (typeof value === "string")\n return value;\n if (/csv/i.test(contentType) && Array.isArray(value) && value.every(isRecord)) {\n const columns = [...new Set(value.flatMap((row) => Object.keys(row)))];\n const cell = (v) => (/[",\\n]/.test(String(v !== null && v !== void 0 ? v : "")) ? `"${String(v).replace(/"/g, \'""\')}"` : String(v !== null && v !== void 0 ? v : ""));\n return [columns.join(","), ...value.map((row) => columns.map((c) => cell(row[c])).join(","))].join("\\n");\n }\n return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);\n}\nfunction toXml(value, schema, name) {\n var _a, _b, _c, _d, _e, _f, _g;\n const lines = [];\n const rootName = (_d = (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : name) !== null && _c !== void 0 ? _c : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _d !== void 0 ? _d : (Array.isArray(value) ? "items" : "data");\n if (Array.isArray(value)) {\n const items = schema === null || schema === void 0 ? void 0 : schema.items;\n const itemName = (_g = (_f = (_e = items === null || items === void 0 ? void 0 : items.xml) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : items === null || items === void 0 ? void 0 : items.title) !== null && _g !== void 0 ? _g : singular(rootName);\n lines.push(`<${xmlName(rootName, schema)}${namespaceAttr(schema)}>`);\n for (const item of value)\n writeXml(lines, itemName, item, items, 1);\n lines.push(`</${xmlName(rootName, schema)}>`);\n }\n else {\n writeXml(lines, rootName, value, schema, 0, true);\n }\n return lines.join("\\n");\n}\nfunction writeXml(lines, name, value, schema, depth, root = false) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n const pad = " ".repeat(depth);\n const xml = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) !== null && _a !== void 0 ? _a : {};\n const qname = xmlName((_b = xml.name) !== null && _b !== void 0 ? _b : name, schema);\n if (Array.isArray(value)) {\n const items = schema === null || schema === void 0 ? void 0 : schema.items;\n const itemName = (_d = (_c = items === null || items === void 0 ? void 0 : items.xml) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : name;\n if (xml.nodeType === "element" || xml.wrapped === true) {\n lines.push(`${pad}<${qname}${namespaceAttr(schema)}>`);\n for (const item of value)\n writeXml(lines, itemName, item, items, depth + 1);\n lines.push(`${pad}</${qname}>`);\n }\n else {\n for (const item of value)\n writeXml(lines, itemName, item, items, depth);\n }\n return;\n }\n if (value === null || value === undefined) {\n lines.push(`${pad}<${qname} xsi:nil="true"/>`);\n return;\n }\n if (!isRecord(value)) {\n lines.push(`${pad}<${qname}${root ? namespaceAttr(schema) : ""}>${escapeXml(String(value))}</${qname}>`);\n return;\n }\n const properties = propertiesOf(schema);\n const attributes = [];\n const children = [];\n let text;\n for (const [key, child] of Object.entries(value)) {\n const prop = properties[key];\n const nodeType = (_f = (_e = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _e === void 0 ? void 0 : _e.nodeType) !== null && _f !== void 0 ? _f : (((_g = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _g === void 0 ? void 0 : _g.attribute) ? "attribute" : undefined);\n if (nodeType === "attribute") {\n if (child !== null && child !== undefined)\n attributes.push(` ${xmlName((_j = (_h = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : key, prop)}="${escapeXml(String(child), true)}"`);\n }\n else if (nodeType === "text" || nodeType === "cdata") {\n text = nodeType === "cdata" ? `<![CDATA[${String(child)}]]>` : escapeXml(String(child));\n }\n else {\n children.push([key, child, prop]);\n }\n }\n const open = `${pad}<${qname}${namespaceAttr(schema)}${attributes.join("")}`;\n if (!children.length) {\n lines.push(text === undefined ? `${open}/>` : `${open}>${text}</${qname}>`);\n return;\n }\n lines.push(`${open}>${text !== null && text !== void 0 ? text : ""}`);\n for (const [key, child, prop] of children)\n writeXml(lines, key, child, prop, depth + 1);\n lines.push(`${pad}</${qname}>`);\n}\nfunction propertiesOf(schema, depth = 0) {\n var _a, _b;\n if (!schema || depth > 4)\n return {};\n const out = {};\n for (const part of (_a = schema.allOf) !== null && _a !== void 0 ? _a : [])\n Object.assign(out, propertiesOf(part, depth + 1));\n return Object.assign(out, (_b = schema.properties) !== null && _b !== void 0 ? _b : {});\n}\nfunction xmlName(name, schema) {\n var _a;\n let clean = name.replace(/[^\\w.:-]/g, "_");\n if (!/^[A-Za-z_]/.test(clean))\n clean = `_${clean}`;\n const prefix = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.prefix;\n return prefix && !clean.includes(":") ? `${prefix}:${clean}` : clean;\n}\nfunction namespaceAttr(schema) {\n var _a, _b;\n const ns = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.namespace;\n if (!ns)\n return "";\n return ` xmlns${((_b = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _b === void 0 ? void 0 : _b.prefix) ? `:${schema.xml.prefix}` : ""}="${escapeXml(ns, true)}"`;\n}\nfunction escapeXml(text, attribute = false) {\n if (isPlaceholder(text))\n return `{${text.slice(1, -1)}}`;\n const out = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");\n return attribute ? out.replace(/"/g, "&quot;") : out;\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction exampleForParameter(param) {\n var _a;\n const typed = (value) => (value === undefined || !param.schema ? value : asType(value, param.schema));\n const given = typed(param.example);\n if (given !== undefined)\n return given;\n for (const example of Object.values((_a = param.examples) !== null && _a !== void 0 ? _a : {})) {\n const value = typed(exampleValue(example, false));\n if (value !== undefined)\n return value;\n }\n const content = param.content && Object.entries(param.content)[0];\n if (content)\n return exampleForMedia(content[1], "request", content[0]).value;\n if (param.schema)\n return exampleFromSchema(param.schema, param.name);\n return idLike(param.name);\n}\nconst MAX_DEPTH = 4;\nconst HARD_DEPTH = 12;\nconst MAX_PROPERTIES = 12;\nconst NODE_BUDGET = 250;\nconst MAX_LIST = 20;\nconst MAX_TRIES = 6;\nfunction exampleFromSchema(schema, name = "", depth = 0, mode = "response", budget = { left: NODE_BUDGET }, owner) {\n var _a;\n if (!schema || typeof schema !== "object")\n return null;\n budget.left--;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return depth >= HARD_DEPTH ? {} : exampleFromSchema(target, name, Math.max(depth + 1, MAX_DEPTH), mode, budget, owner);\n if (schema["x-circular"])\n return depth > 1 ? null : { id: idLike((_a = schema.title) !== null && _a !== void 0 ? _a : name) };\n for (const example of [schema.example, ...(Array.isArray(schema.examples) ? schema.examples.slice(0, 1) : [])]) {\n const value = example === undefined ? undefined : asType(example, schema);\n if (value !== undefined)\n return fitted(value, schema, name, depth, mode, budget, owner);\n }\n if (schema.const !== undefined)\n return schema.const;\n const fallback = schema.default === undefined ? undefined : asType(schema.default, schema);\n if (fallback !== undefined)\n return fitted(fallback, schema, name, depth, mode, budget, owner);\n return fromSchema(schema, name, depth, mode, budget, owner);\n}\nfunction fromSchema(schema, name, depth, mode, budget, owner) {\n var _a, _b;\n if (Array.isArray(schema.enum) && schema.enum.length)\n return enumValue(schema.enum, schema.description);\n if ((_a = schema.allOf) === null || _a === void 0 ? void 0 : _a.length)\n return fromParts(schema, name, depth, mode, budget, owner);\n const variants = ((_b = schema.oneOf) === null || _b === void 0 ? void 0 : _b.length) ? schema.oneOf : schema.anyOf;\n if (variants === null || variants === void 0 ? void 0 : variants.length)\n return fromVariant(schema, variants, name, depth, mode, budget, owner);\n const type = Array.isArray(schema.type) ? schema.type.find((t) => t !== "null") : schema.type;\n const inferred = type !== null && type !== void 0 ? type : (schema.properties ? "object" : schema.items || schema.prefixItems ? "array" : undefined);\n switch (inferred) {\n case "object":\n return objectFor(schema, depth, mode, budget, owner);\n case "array":\n return listFor(schema, name, depth, mode, budget, owner);\n case "integer":\n case "number":\n return numberFor(schema, name, inferred === "integer");\n case "boolean":\n return booleanFor(name);\n case "string":\n return stringFor(schema, name, owner);\n default:\n return null;\n }\n}\nfunction objectFor(schema, depth, mode, budget, owner) {\n var _a, _b;\n const out = {};\n if (depth >= HARD_DEPTH)\n return out;\n const required = new Set(Array.isArray(schema.required) ? schema.required : []);\n let props = Object.entries((_a = schema.properties) !== null && _a !== void 0 ? _a : {}).filter(([, prop]) => !(mode === "request" ? prop === null || prop === void 0 ? void 0 : prop.readOnly : prop === null || prop === void 0 ? void 0 : prop.writeOnly));\n props = props.filter(([key, prop]) => required.has(key) || (prop === null || prop === void 0 ? void 0 : prop.deprecated) !== true);\n const answer = mode === "response" && !budget.full;\n if (answer)\n props = props.filter(([key, prop]) => required.has(key) || ((ID_FIELDS.has(key) || saysSomething(prop)) && !brokenExample(prop, mode)));\n if (depth >= MAX_DEPTH)\n props = props.filter(([key]) => required.has(key));\n props.sort(([a], [b]) => Number(required.has(b)) - Number(required.has(a)));\n if (mode === "request")\n props = telling(props, required);\n for (const [key, prop] of props) {\n if (!required.has(key) && (budget.left <= 0 || Object.keys(out).length >= MAX_PROPERTIES))\n continue;\n if (!required.has(key) && recursive(prop))\n continue;\n const value = fieldValue(prop, key, depth + 1, mode, budget, (_b = schema.title) !== null && _b !== void 0 ? _b : owner);\n if (!required.has(key) && (value === null || (mode === "request" && isEmpty(value))))\n continue;\n out[key] = value;\n }\n return out;\n}\nfunction fieldValue(prop, key, depth, mode, budget, owner) {\n if (mode === "response" && !budget.full && allowsNull(prop) && (!givesValue(prop) || brokenExample(prop, mode)))\n return null;\n return exampleFromSchema(prop, key, depth, mode, budget, owner);\n}\nfunction brokenExample(prop, mode) {\n if (!prop || typeof prop !== "object" || prop.example === undefined || prop.example === null)\n return false;\n if ((0, fit_1.fits)(prop.example, prop, mode))\n return false;\n const typed = asType(prop.example, prop);\n if (typed === undefined)\n return true;\n const plain = (v) => v === null || typeof v !== "object";\n return (plain(typed) || (Array.isArray(typed) && typed.every(plain))) && !(0, fit_1.fits)(typed, prop, mode);\n}\nfunction recursive(schema) {\n const own = (s) => isRecord(s) && s["x-circular"] !== undefined;\n return own(schema) || (isRecord(schema) && own(schema.items));\n}\nconst ID_FIELDS = new Set(["id", "sid", "gid", "uuid"]);\nfunction givesValue(schema, depth = 0) {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > 4)\n return false;\n if (schema.example !== undefined || (Array.isArray(schema.examples) && schema.examples.length > 0) || schema.default !== undefined || schema.const !== undefined)\n return true;\n if (Array.isArray(schema.enum) && schema.enum.filter((v) => v !== null).length === 1 && !allowsNull(schema))\n return true;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return givesValue(target, depth + 1);\n const parts = [...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []), ...((_b = schema.oneOf) !== null && _b !== void 0 ? _b : []), ...((_c = schema.anyOf) !== null && _c !== void 0 ? _c : [])];\n return parts.some((part) => part && typeof part === "object" && part.type !== "null" && givesValue(part, depth + 1));\n}\nconst saying = new WeakMap();\nfunction saysSomething(schema, depth = 0) {\n var _a, _b, _c, _d, _e, _f;\n if (!schema || typeof schema !== "object" || depth > 1)\n return false;\n const found = (_a = saying.get(schema)) !== null && _a !== void 0 ? _a : [];\n if (found[depth] !== undefined)\n return found[depth];\n found[depth] = false;\n saying.set(schema, found);\n const target = (0, fit_1.circularTarget)(schema);\n const parts = [...((_b = schema.allOf) !== null && _b !== void 0 ? _b : []), ...((_c = schema.oneOf) !== null && _c !== void 0 ? _c : []), ...((_d = schema.anyOf) !== null && _d !== void 0 ? _d : []), ...(target ? [target] : [])];\n const inside = [...Object.values((_e = schema.properties) !== null && _e !== void 0 ? _e : {}), ...(schema.items && typeof schema.items === "object" ? [schema.items] : []), ...((_f = schema.prefixItems) !== null && _f !== void 0 ? _f : [])];\n const usable = (part) => part && typeof part === "object" && part.type !== "null";\n const own = depth === 0 ? givesValue(schema) : schema.example !== undefined || (Array.isArray(schema.examples) && schema.examples.length > 0);\n const says = own || parts.some((part) => usable(part) && saysSomething(part, depth)) || inside.some((part) => usable(part) && saysSomething(part, depth + 1));\n found[depth] = says;\n return says;\n}\nfunction allowsNull(schema) {\n var _a, _b;\n if (!schema || typeof schema !== "object")\n return false;\n if (schema.nullable === true || (Array.isArray(schema.type) && schema.type.includes("null")) || schema.type === "null")\n return true;\n if (Array.isArray(schema.enum) && schema.enum.includes(null))\n return true;\n const variants = [...((_a = schema.oneOf) !== null && _a !== void 0 ? _a : []), ...((_b = schema.anyOf) !== null && _b !== void 0 ? _b : [])];\n const isNull = (v) => v.type === "null" || (Array.isArray(v.type) && v.type.length === 1 && v.type[0] === "null") || (Array.isArray(v.enum) && v.enum.length === 1 && v.enum[0] === null);\n return variants.some((v) => v && typeof v === "object" && isNull(v));\n}\nfunction listFor(schema, name, depth, mode, budget, owner) {\n var _a;\n const least = Math.min(Math.max(0, typeof schema.minItems === "number" ? schema.minItems : 0), MAX_LIST);\n const most = typeof schema.maxItems === "number" ? Math.max(0, schema.maxItems) : Infinity;\n if (most === 0)\n return [];\n if ((depth >= MAX_DEPTH || budget.left <= 0) && least === 0)\n return [];\n const itemName = singular(name);\n const itemOwner = itemName && !CONTAINERS.test(itemName) ? itemName : owner;\n const prefix = ((_a = schema.prefixItems) !== null && _a !== void 0 ? _a : []).slice(0, most);\n const out = prefix.map((item) => exampleFromSchema(item, itemName, depth + 1, mode, budget, itemOwner));\n const items = isRecord(schema.items) ? schema.items : undefined;\n const answer = mode === "response" && !budget.full;\n const shows = !answer || depth === 0 || (depth === 1 && CONTAINERS.test(name)) || saysSomething(items);\n const want = Math.min(most, Math.max(least, prefix.length ? prefix.length : items && shows ? 1 : 0));\n while (out.length < want) {\n if (!items) {\n out.push(null);\n continue;\n }\n const value = exampleFromSchema(items, itemName, depth + 1, mode, budget, itemOwner);\n if (answer && out.length >= least && isRecord(value) && !Object.keys(value).length)\n break;\n out.push(out.length > prefix.length ? distinct(value, out, items, mode) : value);\n }\n return out;\n}\nconst CONTAINERS = /^(data|items?|results?|list|entr(y|ie)|records?|values?|objects?|nodes?|edges?|elements?|rows?|hits?|match(e)?|contents?|resources?)$/i;\nfunction distinct(value, taken, schema, mode) {\n var _a, _b, _c, _d;\n const n = taken.length + 1;\n const free = (candidate) => !taken.some((t) => (0, fit_1.equal)(t, candidate)) && (0, fit_1.fits)(candidate, schema, mode);\n if (!taken.some((t) => (0, fit_1.equal)(t, value)))\n return value;\n const candidates = [];\n if (Array.isArray(schema.enum))\n candidates.push(...schema.enum);\n if (typeof value === "string" && isPlaceholder(value))\n candidates.push(`${value.slice(0, -1)}_${n}>`);\n if (typeof value === "string") {\n const at = value.indexOf("@");\n if (at > 0)\n candidates.push(`${value.slice(0, at)}+${n}${value.slice(at)}`);\n candidates.push(`${value}_${n}`, `${value}${n}`, `${n}${value.slice(1)}`);\n }\n else if (typeof value === "number")\n candidates.push(value + n - 1, value + (n - 1) * 10, value - (n - 1));\n else if (typeof value === "boolean")\n candidates.push(!value);\n else if (isRecord(value)) {\n const key = (_a = Object.keys(value).find((k) => k === "id" || isIdName(k))) !== null && _a !== void 0 ? _a : Object.keys(value).find((k) => typeof value[k] === "string" || typeof value[k] === "number");\n if (key !== undefined) {\n const inner = (_c = (_b = schema.properties) === null || _b === void 0 ? void 0 : _b[key]) !== null && _c !== void 0 ? _c : {};\n const varied = distinct(value[key], taken.flatMap((t) => (isRecord(t) ? [t[key]] : [])), inner, mode);\n candidates.push({ ...value, [key]: varied });\n }\n }\n return (_d = candidates.find(free)) !== null && _d !== void 0 ? _d : value;\n}\nconst ON_FLAGS = /^(is_?|has_?|can_?)?(enabled|active|verified|valid|available|visible|confirmed|success|successful|ok|allowed|approved|ready|supported)$/i;\nfunction booleanFor(name) {\n return ON_FLAGS.test(name.replace(/-/g, "_"));\n}\nfunction fitted(value, schema, name, depth, mode, budget, owner) {\n return (0, fit_1.fits)(value, schema, mode) ? value : conform(value, schema, mode, name, depth, budget, owner);\n}\nfunction conform(value, schema, mode = "response", name = "", depth = 0, budget = { left: NODE_BUDGET }, owner) {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > HARD_DEPTH || (0, fit_1.fits)(value, schema, mode))\n return value;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return conform(value, target, mode, name, depth + 1, budget, owner);\n const fresh = () => fromSchema({ ...schema, example: undefined, examples: undefined, default: undefined }, name, depth, mode, budget, owner);\n const variants = ((_a = schema.oneOf) === null || _a === void 0 ? void 0 : _a.length) ? schema.oneOf : ((_b = schema.anyOf) === null || _b === void 0 ? void 0 : _b.length) ? schema.anyOf : undefined;\n if (variants) {\n const base = { ...schema, oneOf: undefined, anyOf: undefined };\n const ranked = variants\n .filter((v) => isRecord(v))\n .map((v) => ({ v, misses: (0, fit_1.misfits)(value, { allOf: [base, v] }, mode, 40).length }))\n .sort((a, b) => a.misses - b.misses);\n let closest;\n for (const { v } of ranked.slice(0, MAX_TRIES)) {\n const fixed = conform(value, { allOf: [base, v] }, mode, name, depth + 1, budget, owner);\n if ((0, fit_1.fits)(fixed, schema, mode))\n return fixed;\n closest !== null && closest !== void 0 ? closest : (closest = fixed);\n }\n const made = fresh();\n return (0, fit_1.fits)(made, schema, mode) || closest === undefined ? made : closest;\n }\n if ((_c = schema.allOf) === null || _c === void 0 ? void 0 : _c.length) {\n let fixed = value;\n const required = requiredIn(schema);\n for (const part of [...schema.allOf, { ...schema, allOf: undefined }]) {\n if (isRecord(part))\n fixed = conform(fixed, required.length ? { ...part, required: [...new Set([...(Array.isArray(part.required) ? part.required : []), ...required])] } : part, mode, name, depth + 1, budget, owner);\n }\n if ((0, fit_1.fits)(fixed, schema, mode))\n return fixed;\n const made = fresh();\n return (0, fit_1.fits)(made, schema, mode) ? made : fixed;\n }\n return conformOne(value, schema, mode, name, depth, budget, owner);\n}\nfunction conformOne(value, schema, mode, name, depth, budget, owner) {\n var _a, _b, _c, _d, _e;\n if ((0, fit_1.fits)(value, { ...schema, allOf: undefined, oneOf: undefined, anyOf: undefined, not: undefined }, mode))\n return value;\n const fresh = () => fromSchema({ ...schema, example: undefined, examples: undefined, default: undefined }, name, depth, mode, budget, owner);\n const types = typesOf(schema);\n if (types.length && !(value === null && schema.nullable) && !ofType(value, schema)) {\n const typed = asType(value, schema);\n return typed !== undefined && (0, fit_1.fits)(typed, schema, mode) ? typed : fresh();\n }\n if (schema.const !== undefined && !(0, fit_1.equal)(value, schema.const))\n return schema.const;\n if (Array.isArray(schema.enum) && schema.enum.length && !schema.enum.some((e) => (0, fit_1.equal)(e, value)))\n return enumValue(schema.enum, schema.description);\n if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null)\n return fresh();\n if (Array.isArray(value)) {\n const legacy = Array.isArray(schema.items) ? schema.items : undefined;\n const prefix = (_b = (_a = schema.prefixItems) !== null && _a !== void 0 ? _a : legacy) !== null && _b !== void 0 ? _b : [];\n const items = !legacy && isRecord(schema.items) ? schema.items : undefined;\n let out = value.map((item, i) => conform(item, i < prefix.length ? prefix[i] : items, mode, singular(name), depth + 1, budget, singular(name) || owner));\n if (schema.uniqueItems === true)\n out = out.filter((item, i) => out.findIndex((other) => (0, fit_1.equal)(other, item)) === i);\n if (typeof schema.maxItems === "number")\n out = out.slice(0, Math.max(0, schema.maxItems));\n const least = Math.min(typeof schema.minItems === "number" ? schema.minItems : 0, MAX_LIST);\n while (out.length < least) {\n const index = out.length;\n const sub = index < prefix.length ? prefix[index] : items;\n const made = sub ? exampleFromSchema(sub, singular(name), depth + 1, mode, budget, singular(name) || owner) : null;\n out.push(sub ? distinct(made, out, sub, mode) : made);\n }\n return out;\n }\n if (isRecord(value)) {\n const props = (isRecord(schema.properties) ? schema.properties : {});\n const patterns = isRecord(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];\n const extra = schema.additionalProperties;\n const title = (_c = schema.title) !== null && _c !== void 0 ? _c : owner;\n const out = {};\n for (const [key, item] of Object.entries(value)) {\n const prop = Object.prototype.hasOwnProperty.call(props, key) ? props[key] : undefined;\n const matched = (_d = patterns.find(([pattern]) => (0, fit_1.matchesPattern)(pattern, key))) === null || _d === void 0 ? void 0 : _d[1];\n if (!prop && !matched && extra === false)\n continue;\n const sub = (_e = prop !== null && prop !== void 0 ? prop : matched) !== null && _e !== void 0 ? _e : (isRecord(extra) ? extra : undefined);\n const optional = !(Array.isArray(schema.required) && schema.required.includes(key));\n if (item === null && sub && !allowsNull(sub) && optional)\n continue;\n if (mode === "response" && !budget.full && optional && sub && item !== null && typeof item !== "object" && !(0, fit_1.fits)(item, sub, mode)) {\n const typed = asType(item, sub);\n if (typed === undefined || !(0, fit_1.fits)(typed, sub, mode))\n continue;\n }\n setField(out, key, sub ? conform(item, sub, mode, key, depth + 1, budget, title) : item);\n }\n for (const key of Array.isArray(schema.required) ? schema.required : []) {\n if (typeof key !== "string" || key in out)\n continue;\n const prop = props[key];\n if (prop && (mode === "request" ? prop.readOnly : prop.writeOnly))\n continue;\n const sub = prop !== null && prop !== void 0 ? prop : (isRecord(extra) ? extra : undefined);\n setField(out, key, sub ? fieldValue(sub, key, depth + 1, mode, budget, title) : null);\n }\n for (const [key, prop] of Object.entries(props)) {\n if (typeof schema.minProperties !== "number" || Object.keys(out).length >= schema.minProperties)\n break;\n if (!(key in out))\n setField(out, key, exampleFromSchema(prop, key, depth + 1, mode, budget, title));\n }\n return out;\n }\n return fresh();\n}\nfunction setField(out, key, value) {\n if (key === "__proto__")\n Object.defineProperty(out, key, { value, enumerable: true, writable: true, configurable: true });\n else\n out[key] = value;\n}\nfunction asType(value, schema) {\n const types = typesOf(schema);\n if (ofType(value, schema))\n return value;\n if (typeof value === "string" && (types.includes("object") || types.includes("array"))) {\n try {\n const parsed = JSON.parse(value);\n if (ofType(parsed, schema))\n return parsed;\n }\n catch {\n }\n }\n if (types.includes("string") && Array.isArray(value) && value.length && value.every((v) => typeof v === "string" || typeof v === "number"))\n return value.join(",");\n if (types.includes("object") && Array.isArray(value) && value.length === 1 && isRecord(value[0]))\n return value[0];\n if (typeof value === "string" && value.trim() && (types.includes("number") || types.includes("integer")) && ofType(Number(value), schema))\n return Number(value);\n if (typeof value === "string" && types.includes("boolean") && /^(true|false)$/.test(value))\n return value === "true";\n if (typeof value === "number" && types.includes("string") && Number.isFinite(value))\n return String(value);\n return undefined;\n}\nfunction typesOf(schema) {\n return (Array.isArray(schema.type) ? schema.type : [schema.type]).filter((t) => typeof t === "string");\n}\nfunction ofType(value, schema) {\n const types = typesOf(schema);\n if (!types.length || (value === null && schema.nullable))\n return true;\n return types.some((t) => (t === "integer" ? Number.isInteger(value) : t === "number" ? typeof value === "number" : t === "object" ? isRecord(value) : t === "array" ? Array.isArray(value) : t === "null" ? value === null : typeof value === t));\n}\nfunction sharedProperties(parts) {\n const all = new Map();\n const collect = (schema, title, depth) => {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > 4)\n return;\n for (const part of (_a = schema.allOf) !== null && _a !== void 0 ? _a : [])\n collect(part, title, depth + 1);\n for (const [key, def] of Object.entries((_b = schema.properties) !== null && _b !== void 0 ? _b : {})) {\n if (!def || typeof def !== "object")\n continue;\n const entry = (_c = all.get(key)) !== null && _c !== void 0 ? _c : { defs: [] };\n if (!entry.defs.includes(def))\n entry.defs.push(def);\n entry.title = title;\n all.set(key, entry);\n }\n };\n for (const part of parts)\n collect(part, part.title, 0);\n return new Map([...all].filter(([, entry]) => entry.defs.length > 1));\n}\nfunction requiredIn(schema, depth = 0) {\n var _a;\n if (!schema || typeof schema !== "object" || depth > 4)\n return [];\n const own = Array.isArray(schema.required) ? schema.required.filter((r) => typeof r === "string") : [];\n return [...new Set([...own, ...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []).flatMap((part) => requiredIn(part, depth + 1))])];\n}\nfunction fromParts(schema, name, depth, mode, budget, owner) {\n var _a, _b, _c;\n const merged = {};\n const plain = [];\n const required = requiredIn(schema);\n const parts = [...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []), ...(schema.properties ? [{ ...schema, allOf: undefined }] : [])].filter((part) => part && typeof part === "object");\n const again = { left: budget.left, full: budget.full };\n for (const part of parts) {\n const whole = { ...part, ...(schema.title ? { title: schema.title } : {}), ...(required.length ? { required: [...new Set([...(Array.isArray(part.required) ? part.required : []), ...required])] } : {}) };\n const value = exampleFromSchema(whole, name, depth, mode, budget, owner);\n if (isRecord(value))\n Object.assign(merged, value);\n else if (value !== null && value !== undefined)\n plain.push(value);\n }\n for (const [key, { defs, title }] of sharedProperties(parts)) {\n if (!(key in merged) || defs.every((def) => (0, fit_1.fits)(merged[key], def, mode)))\n continue;\n const value = exampleFromSchema({ allOf: defs }, key, depth + 1, mode, again, (_c = (_b = schema.title) !== null && _b !== void 0 ? _b : title) !== null && _c !== void 0 ? _c : owner);\n if (value !== null && value !== undefined)\n merged[key] = value;\n }\n if (plain.length && Object.keys(merged).length === 0) {\n const fitting = [...plain].reverse().find((value) => parts.every((part) => (0, fit_1.fits)(value, part, mode)));\n if (fitting !== undefined)\n return fitting;\n for (const variant of parts.flatMap((part) => { var _a, _b; return [...((_a = part.oneOf) !== null && _a !== void 0 ? _a : []), ...((_b = part.anyOf) !== null && _b !== void 0 ? _b : [])]; })) {\n if (!isRecord(variant) || variant.type === "null")\n continue;\n const value = exampleFromSchema(variant, name, depth, mode, again, owner);\n if (value !== null && value !== undefined && parts.every((part) => (0, fit_1.fits)(value, part, mode)))\n return value;\n }\n const items = parts.flatMap((part) => (part.items && typeof part.items === "object" ? [part.items] : []));\n if (items.length > 1 && plain.some(Array.isArray))\n return exampleFromSchema({ type: "array", items: { allOf: items } }, name, depth, mode, again, owner);\n return plain[0];\n }\n return merged;\n}\nconst ENDINGS = /^(cancel+ed|cancel+ing|failed|failure|errored|error|declined|rejected|expired|deleted|voided|void|refunded|disputed|revoked|suspended|blocked|disabled|inactive|abandoned|lost|unpaid|past_due|incomplete_expired)$/i;\nfunction enumValue(values, description) {\n var _a, _b;\n const said = values.filter((v) => v !== "" && v !== null);\n const mentioned = (v) => {\n if (typeof v !== "string" || !description)\n return Infinity;\n const at = description.search(new RegExp(`[\\`\'"]${v.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&")}[\\`\'"]`));\n return at < 0 ? Infinity : at;\n };\n const ordered = said.map((v, i) => ({ v, i, at: mentioned(v) })).sort((a, b) => a.at - b.at || a.i - b.i).map(({ v }) => v);\n return (_b = (_a = ordered.find((v) => typeof v !== "string" || !ENDINGS.test(v))) !== null && _a !== void 0 ? _a : ordered[0]) !== null && _b !== void 0 ? _b : values[0];\n}\nfunction fromVariant(schema, variants, name, depth, mode, budget, owner) {\n var _a;\n const usable = variants.filter((v) => v && typeof v === "object" && v.type !== "null" && Object.keys(v).some((k) => !/^(description|title|nullable)$/.test(k)));\n const first = (schema.properties && usable.find((v) => v.properties || v.type === "object")) || usable[0] || variants[0];\n const exclusive = Boolean((_a = schema.oneOf) === null || _a === void 0 ? void 0 : _a.length);\n let made;\n for (const variant of [first, ...usable.filter((v) => v !== first)].slice(0, MAX_TRIES)) {\n const value = fromOneVariant(schema, variants, variant, exclusive, name, depth, mode, budget, owner);\n if (made === undefined)\n made = value;\n if ((0, fit_1.fits)(value, schema, mode))\n return value;\n }\n if (mode === "response" && !budget.full) {\n const full = { left: budget.left, full: true };\n const value = fromVariant(schema, variants, name, depth, mode, full, owner);\n budget.left = full.left;\n if ((0, fit_1.fits)(value, schema, mode))\n return value;\n }\n return made;\n}\nfunction fromOneVariant(schema, variants, variant, exclusive, name, depth, mode, budget, owner) {\n var _a, _b, _c, _d, _e;\n if (variant && typeof variant === "object" && !describesValue(variant)) {\n const required = [...new Set([...(Array.isArray(schema.required) ? schema.required : []), ...(Array.isArray(variant.required) ? variant.required : [])])];\n const others = exclusive ? new Set(variants.filter((v) => v !== variant && isRecord(v) && Array.isArray(v.required)).flatMap((v) => v.required).filter((k) => !required.includes(k))) : new Set();\n const properties = schema.properties && others.size ? Object.fromEntries(Object.entries(schema.properties).filter(([key]) => !others.has(key))) : schema.properties;\n return exampleFromSchema({ ...schema, oneOf: undefined, anyOf: undefined, ...(properties ? { properties } : {}), ...(required.length ? { required } : {}) }, name, depth, mode, budget, owner);\n }\n const value = exampleFromSchema(variant, name, depth, mode, budget, owner);\n if (!value || typeof value !== "object" || Array.isArray(value))\n return value;\n const out = schema.properties ? { ...exampleFromSchema({ ...schema, oneOf: undefined, anyOf: undefined }, name, depth, mode, budget, owner), ...value } : { ...value };\n const discriminator = schema.discriminator;\n const property = discriminator === null || discriminator === void 0 ? void 0 : discriminator.propertyName;\n const mapping = discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping;\n if (property && isRecord(mapping) && !((_b = (_a = variant.properties) === null || _a === void 0 ? void 0 : _a[property]) === null || _b === void 0 ? void 0 : _b.enum) && ((_d = (_c = variant.properties) === null || _c === void 0 ? void 0 : _c[property]) === null || _d === void 0 ? void 0 : _d.const) === undefined) {\n const entries = Object.entries(mapping);\n const named = entries.find(([, target]) => variant.title && typeof target === "string" && target.split("/").pop() === variant.title);\n const entry = (_e = named !== null && named !== void 0 ? named : entries[variants.indexOf(variant)]) !== null && _e !== void 0 ? _e : entries[0];\n if (entry)\n out[property] = entry[0];\n }\n return out;\n}\nconst VALUE_KEYWORDS = ["type", "properties", "items", "prefixItems", "allOf", "oneOf", "anyOf", "enum", "const", "example", "examples", "default", "format", "pattern", "additionalProperties", "$ref", "x-circular"];\nfunction describesValue(schema) {\n return VALUE_KEYWORDS.some((key) => key in schema);\n}\nconst MAX_OPTIONAL = 3;\nconst TELLING_NAMES = /^(to|from|subject|text|html|body|content|message|title|name|email|description|amount|currency|quantity|customer|price|product|channel|phone|url|\\w+_url)$/i;\nfunction telling(props, required) {\n const must = props.filter(([key]) => required.has(key));\n const rank = ([key, prop]) => (TELLING_NAMES.test(key) || isIdName(key) ? 0 : 2) + (looksReal(key, prop) ? 0 : 1);\n const optional = props\n .filter(([key]) => !required.has(key))\n .map((entry, i) => ({ entry, i, rank: rank(entry) }))\n .sort((a, b) => a.rank - b.rank || a.i - b.i)\n .slice(0, must.length ? MAX_OPTIONAL : MAX_OPTIONAL + 1)\n .sort((a, b) => a.i - b.i);\n return [...must, ...optional.map((o) => o.entry)];\n}\nfunction looksReal(key, prop) {\n if (!prop || typeof prop !== "object")\n return false;\n if (prop.example !== undefined || prop.examples !== undefined || prop.default !== undefined || prop.enum || prop.const !== undefined)\n return true;\n const type = Array.isArray(prop.type) ? prop.type.find((t) => t !== "null") : prop.type;\n if ((type && type !== "string") || prop.format || prop.pattern)\n return true;\n return saysWhatItHolds(key, prop);\n}\nfunction isEmpty(value) {\n return value === undefined || (Array.isArray(value) && value.length === 0) || (isRecord(value) && Object.keys(value).length === 0);\n}\nconst WHOLE_NUMBER = /(^|[_-])(number|num|no|index|idx|page|position|pos|id|count|version|year|port|rank|level|step|line|row|column|col|size)$|[a-z0-9](Number|Num|Index|Page|Position|Id|Count|Version|Year|Port|Rank|Level|Step|Line|Row|Column|Size)$|^(number|num|index|page|position|id|count|version|year|port|rank|level|step|line|row|column|size|offset|depth)$/;\nfunction numberFor(schema, name, integer) {\n const lower = name.toLowerCase();\n const step = integer ? 1 : 0.5;\n let value;\n if (/(created|updated|timestamp|_at$|time)/.test(lower) || /[a-z0-9]At$/.test(name))\n value = 1767225600;\n else if (/(amount|price|total|cost|balance)/.test(lower))\n value = integer ? 2000 : 20.0;\n else if (/(quantity|count|qty)/.test(lower))\n value = 1;\n else if (/(limit|page_size|per_page)/.test(lower))\n value = 10;\n else if (/(retry|seconds|delay)/.test(lower))\n value = 30;\n else\n value = integer || WHOLE_NUMBER.test(name) ? 1 : 1.5;\n if (schema.minimum !== undefined && value < schema.minimum)\n value = schema.minimum;\n if (schema.maximum !== undefined && value > schema.maximum)\n value = schema.maximum;\n const exclusiveMin = typeof schema.exclusiveMinimum === "number" ? schema.exclusiveMinimum : schema.exclusiveMinimum === true ? schema.minimum : undefined;\n const exclusiveMax = typeof schema.exclusiveMaximum === "number" ? schema.exclusiveMaximum : schema.exclusiveMaximum === true ? schema.maximum : undefined;\n if (exclusiveMin !== undefined && value <= exclusiveMin)\n value = exclusiveMin + step;\n if (exclusiveMax !== undefined && value >= exclusiveMax)\n value = exclusiveMax - step;\n return value;\n}\nconst HOOKISH = /(webhook|callback|hook|notif)/i;\nfunction stringFor(schema, name, owner) {\n var _a, _b;\n switch (schema.format) {\n case "date-time":\n return "2026-01-01T12:00:00Z";\n case "date":\n return "2026-01-01";\n case "time":\n return "12:00:00Z";\n case "duration":\n return "PT1H";\n case "email":\n case "idn-email":\n return `${(name.replace(/[^A-Za-z0-9_.-]+/g, "_").replace(/^[_.-]+|[_.-]+$/g, "") || "email").toLowerCase()}@example.com`;\n case "uri":\n case "url":\n case "iri":\n case "uri-reference":\n case "iri-reference":\n return HOOKISH.test(name) ? "https://example.com/webhooks" : "https://example.com";\n case "uri-template":\n return "https://example.com/{id}";\n case "hostname":\n case "idn-hostname":\n return "example.com";\n case "uuid":\n return name === "id" && owner ? uuidLike(owner) : isIdName(name) ? uuidLike(name) : exports.PLACEHOLDER_UUID;\n case "ipv4":\n return "203.0.113.10";\n case "ipv6":\n return "2001:db8::10";\n case "byte":\n return "aGVsbG8=";\n case "binary":\n return exports.BINARY_PLACEHOLDER;\n case "password":\n return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";\n case "regex":\n return "^[a-z]+$";\n case "json-pointer":\n return "/data";\n }\n if (schema.contentMediaType && !schema.contentEncoding) {\n if (/json/i.test(schema.contentMediaType))\n return JSON.stringify(schema.contentSchema ? exampleFromSchema(schema.contentSchema, name) : {});\n return exports.BINARY_PLACEHOLDER;\n }\n const value = sized((_a = namedValue(name, schema, owner)) !== null && _a !== void 0 ? _a : placeholder(name || "value"), schema);\n const pattern = schema.pattern;\n if (typeof pattern !== "string")\n return value;\n const told = (0, fit_1.patternVerdict)(pattern, value);\n if (told === true)\n return value;\n const patterned = patternExample(pattern);\n if (patterned)\n return patterned;\n const shapes = [idLike(name), "12345678901", "+15555550123", "email@example.com", "https://example.com", "example", "EXAMPLE", "Example", "1", "a", "A1"];\n const fitting = shapes.map((shape) => sized(shape, schema)).find((shape) => (0, fit_1.patternVerdict)(pattern, shape) === true);\n if (fitting !== undefined)\n return fitting;\n return (_b = (told === undefined ? shapeNamed(name, schema) : undefined)) !== null && _b !== void 0 ? _b : value;\n}\nfunction shapeNamed(name, schema) {\n const lower = name.toLowerCase();\n const shape = /phone|fax|mobile|(^|_)tel(_|$)|msisdn/.test(lower) ? "+15555550123" : /e-?mail/.test(lower) ? "email@example.com" : /(^|_)(url|uri|link|href|website)$|[a-z](Url|Uri)$/i.test(name) ? "https://example.com" : undefined;\n return shape === undefined ? undefined : sized(shape, schema);\n}\nfunction sized(value, schema) {\n let out = value;\n const held = isPlaceholder(out);\n if (schema.maxLength !== undefined && out.length > schema.maxLength)\n out = held && schema.maxLength >= 3 ? `${out.slice(0, schema.maxLength - 1)}>` : out.slice(0, schema.maxLength);\n if (schema.minLength !== undefined && out.length < schema.minLength)\n out = held ? `${out.slice(0, -1).padEnd(schema.minLength - 1, "_")}>` : out.padEnd(schema.minLength, "x");\n return out;\n}\nfunction placeholder(name) {\n const clean = name.replace(/[^A-Za-z0-9_.-]+/g, "_").replace(/^[_.-]+|[_.-]+$/g, "");\n return `<${clean.slice(0, 60) || "value"}>`;\n}\nfunction isPlaceholder(value) {\n return typeof value === "string" && /^<[A-Za-z0-9_.-]{1,64}>$/.test(value);\n}\nexports.PLACEHOLDER_UUID = "00000000-0000-4000-8000-000000000000";\nfunction namedValue(name, schema, owner) {\n var _a, _b;\n const lower = name.toLowerCase().replace(/-/g, "_");\n const about = ((_a = schema.description) !== null && _a !== void 0 ? _a : "").toLowerCase();\n if (lower === "id" && owner)\n return idLike(owner);\n if (isIdName(name) || /\\bID\\b/.test((_b = schema.description) !== null && _b !== void 0 ? _b : ""))\n return idLike(name);\n if ((lower === "object" || lower === "type") && schema.title)\n return schema.title.toLowerCase();\n if ((lower === "name" || lower.endsWith("_name")) && (/\\b(domain|hostname)s?\\b/.test(about) || nounOf(owner) === "domain"))\n return "example.com";\n if (/^(domain|host|hostname)$/.test(lower))\n return "example.com";\n if (/(^|_)password$/.test(lower))\n return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";\n return undefined;\n}\nconst TELLING_FIELD = [\n /^(from|sender|to|recipients?|reply_?to|cc|bcc|subject|title|headline|html|text|body|content|message|comment|notes?|caption|prompt|input|slug|language|lang|locale|tz|locality|date|object|type|domain|host|hostname)$/,\n /email|currency|phone|country|url|uri|status|description/,\n /^(first_?name|given_?name|last_?name|family_?name|surname|company|company_?name|business_?name|organi[sz]ation(_?name)?|user_?name|handle|login|screen_?name)$/,\n /(^|_)(name|date|fax|city|state|province|postal_?code|zip|zip_?code|postcode|street|line_?[12]|address_?(line_?)?[12]|time_?zone|colou?r|password)$/,\n /(_at|_time|^time|timestamp)$/,\n];\nfunction saysWhatItHolds(name, schema) {\n var _a;\n const lower = name.toLowerCase().replace(/-/g, "_");\n return isIdName(name) || /\\bID\\b/.test((_a = schema.description) !== null && _a !== void 0 ? _a : "") || TELLING_FIELD.some((re) => re.test(lower));\n}\nfunction nounOf(owner) {\n const words = (owner !== null && owner !== void 0 ? owner : "")\n .replace(/([a-z0-9])([A-Z])/g, "$1_$2")\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter((w) => w && !/^(create|update|new|send|add|get|list|post|put|patch|set|make|place|request|response|body|input|params|parameters|payload|object|data|schema|model|dto|options?|opts|args|arguments|events?|created|updated|deleted|changed|v\\d+)$/.test(w));\n return words.length ? singular(words.slice(-2).join("_")) : undefined;\n}\nfunction patternExample(pattern) {\n let whole;\n try {\n whole = new RegExp(pattern);\n }\n catch {\n return undefined;\n }\n const readable = [pattern, ...(REPEATED_GROUP.test(pattern) ? [] : [withoutLookarounds(pattern)])];\n for (const text of readable) {\n if (text === undefined)\n continue;\n const node = parsePattern(text);\n if (!node)\n continue;\n const value = sample(node, { next: 0 });\n if (value !== undefined && value.length <= 200 && whole.test(value))\n return value;\n }\n return undefined;\n}\nconst REPEATED_GROUP = /\\)(?:[*+]|\\{\\d+,?\\d*\\})/;\nfunction withoutLookarounds(pattern) {\n if (!/\\(\\?<?[=!]/.test(pattern))\n return undefined;\n let out = "";\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === "\\\\") {\n out += pattern.slice(i, i + 2);\n i++;\n continue;\n }\n if (/^\\(\\?<?[=!]/.test(pattern.slice(i, i + 4))) {\n let depth = 0;\n let j = i;\n for (; j < pattern.length; j++) {\n if (pattern[j] === "\\\\")\n j++;\n else if (pattern[j] === "[") {\n j = pattern.indexOf("]", j + 2);\n if (j < 0)\n return undefined;\n }\n else if (pattern[j] === "(")\n depth++;\n else if (pattern[j] === ")" && --depth === 0)\n break;\n }\n if (j >= pattern.length)\n return undefined;\n i = j;\n continue;\n }\n out += pattern[i];\n }\n return out;\n}\nconst POOLS = [[..."1a2b3c4d5e6f7a8b9c0d"], [..."ABCDEFGHJKxyz_-."], [..."LMNPQRSTUVWXYZghijklmnopqrstuvw+=:/@~!*\'(),;$&? "]];\nconst CONTROL = { t: "\\t", n: "\\n", r: "\\r", v: "\\v", f: "\\f" };\nfunction parsePattern(pattern) {\n let i = 0;\n const fail = () => {\n i = pattern.length + 1;\n return undefined;\n };\n const choice = () => {\n var _a;\n const options = [];\n let parts = [];\n while (i < pattern.length && pattern[i] !== ")") {\n const c = pattern[i];\n if (c === "|") {\n options.push({ kind: "sequence", parts });\n parts = [];\n i++;\n continue;\n }\n let atom;\n if (c === "^" || c === "$") {\n i++;\n continue;\n }\n else if (c === "(") {\n if (pattern.startsWith("(?:", i))\n i += 3;\n else if (pattern[i + 1] === "?")\n return fail();\n else\n i++;\n atom = choice();\n if (pattern[i] !== ")")\n return fail();\n i++;\n }\n else if (c === "[") {\n const close = pattern.indexOf("]", pattern[i + 1] === "]" ? i + 2 : i + 1);\n if (close < 0)\n return fail();\n const text = pattern.slice(i, close + 1);\n i = close + 1;\n let set;\n try {\n set = new RegExp(`^${text}$`);\n }\n catch {\n return fail();\n }\n atom = { kind: "chars", accepts: (ch) => set.test(ch) };\n }\n else if (c === "\\\\") {\n const e = pattern[i + 1];\n i += 2;\n if (e === undefined || /[0-9bBkpPc]/.test(e))\n return fail();\n if (/[dwsDWS]/.test(e)) {\n const set = new RegExp(`^\\\\${e}$`);\n atom = { kind: "chars", accepts: (ch) => set.test(ch) };\n }\n else {\n const code = (e === "x" && pattern.slice(i).match(/^[0-9a-fA-F]{2}/)) || (e === "u" && pattern.slice(i).match(/^[0-9a-fA-F]{4}/));\n if (code)\n i += code[0].length;\n const literal = code ? String.fromCharCode(parseInt(code[0], 16)) : ((_a = CONTROL[e]) !== null && _a !== void 0 ? _a : e);\n atom = { kind: "chars", accepts: (ch) => ch === literal, literal };\n }\n }\n else if (c === ".") {\n i++;\n atom = { kind: "chars", accepts: (ch) => ch !== "\\n", literal: "." };\n }\n else if ("*+?{".includes(c)) {\n return fail();\n }\n else {\n i++;\n atom = { kind: "chars", accepts: (ch) => ch === c, literal: c };\n }\n if (!atom)\n return fail();\n const q = pattern.slice(i).match(/^(\\*|\\+|\\?|\\{(\\d+)(?:(,)(\\d*))?\\})\\??/);\n if (q) {\n i += q[0].length;\n const min = q[2] !== undefined ? Number(q[2]) : q[1] === "+" ? 1 : 0;\n const max = q[2] !== undefined ? (q[3] ? (q[4] ? Number(q[4]) : Infinity) : min) : q[1] === "?" ? 1 : Infinity;\n const count = q[1] === "?" ? 1 : Math.min(Math.max(min, Math.min(10, max)), 64);\n if (count < min)\n return fail();\n atom = { kind: "repeat", node: atom, count };\n }\n parts.push(atom);\n }\n options.push({ kind: "sequence", parts });\n return options.length === 1 ? options[0] : { kind: "choice", options };\n };\n const node = choice();\n return i === pattern.length ? node : undefined;\n}\nfunction sample(node, state) {\n var _a;\n switch (node.kind) {\n case "chars": {\n if (node.literal !== undefined)\n return node.literal;\n for (const pool of POOLS) {\n for (let n = 0; n < pool.length; n++) {\n const ch = pool[(state.next + n) % pool.length];\n if (node.accepts(ch)) {\n state.next = (state.next + n + 1) % pool.length;\n return ch;\n }\n }\n }\n return undefined;\n }\n case "sequence": {\n let out = "";\n for (const part of node.parts) {\n const value = sample(part, state);\n if (value === undefined)\n return undefined;\n out += value;\n }\n return out;\n }\n case "repeat": {\n let out = "";\n for (let n = 0; n < node.count; n++) {\n const value = sample(node.node, state);\n if (value === undefined)\n return undefined;\n out += value;\n }\n return out;\n }\n case "choice": {\n const values = node.options.map((option) => sample(option, { ...state })).filter((v) => v !== undefined);\n return (_a = values.find((v) => v.length > 1)) !== null && _a !== void 0 ? _a : values[0];\n }\n }\n}\nfunction isIdName(name) {\n const lower = name.toLowerCase();\n return lower === "id" || lower.endsWith("_id") || lower.endsWith("-id") || /[a-z0-9]Id$/.test(name);\n}\nconst ID_NOISE = /^(create|update|new|send|add|get|list|post|put|patch|set|make|place|request|response|body|input|output|params|parameters|payload|object|data|schema|model|dto|options?|opts|args|arguments|events?|created|updated|deleted|changed|v\\d+)$/;\nfunction idLike(name) {\n const words = idWords(name);\n return words.length ? `<${words.join("_")}_id>` : "<id>";\n}\nfunction uuidLike(name) {\n const words = idWords(name);\n const n = 1 + (seedHash(`uuid:${words.length ? words.join("_") : "obj"}`) % 9999);\n return `${exports.PLACEHOLDER_UUID.slice(0, -12)}${String(n).padStart(12, "0")}`;\n}\nfunction idWords(name) {\n const all = name\n .replace(/[_-]?(uu|s|g)?id$/i, "")\n .replace(/([a-z0-9])([A-Z])/g, "$1_$2")\n .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2")\n .toLowerCase()\n .split(/[^a-z]+/)\n .filter(Boolean);\n const kept = all.filter((w) => !ID_NOISE.test(w));\n return (kept.length ? kept : all).map((w, i, list) => (i === list.length - 1 ? singular(w) : w));\n}\nfunction seedHash(seed) {\n let h = 2166136261;\n for (let i = 0; i < seed.length; i++)\n h = Math.imul(h ^ seed.charCodeAt(i), 16777619) >>> 0;\n return h || 1;\n}\nfunction singular(word) {\n if (/ies$/i.test(word))\n return word.slice(0, -3) + "y";\n if (/(ses|xes|ches|shes)$/i.test(word))\n return word.slice(0, -2);\n if (/s$/i.test(word) && !/ss$/i.test(word))\n return word.slice(0, -1);\n return word;\n}\n\n}, {"./fit":"lib/oas/fit"}],\n"lib/oas/fit": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.CIRCULAR_TARGET = void 0;\nexports.circularTarget = circularTarget;\nexports.fits = fits;\nexports.misfits = misfits;\nexports.typesOf = typesOf;\nexports.equal = equal;\nexports.patternVerdict = patternVerdict;\nexports.matchesPattern = matchesPattern;\nexports.formatFits = formatFits;\nexports.CIRCULAR_TARGET = "x-circular-target";\nfunction circularTarget(schema) {\n const target = schema[exports.CIRCULAR_TARGET];\n return target && typeof target === "object" ? target : undefined;\n}\nconst MAX_DEPTH = 40;\nconst MAX_STEPS = 50000;\nfunction fits(value, schema, mode = "response") {\n return misfits(value, schema, mode, 1).length === 0;\n}\nfunction misfits(value, schema, mode = "response", limit = 20) {\n const out = [];\n check(value, schema, [], 0, out, { counter: { steps: 0 }, limit, mode });\n return out;\n}\nfunction check(value, schema, path, depth, out, state) {\n var _a, _b, _c;\n if (out.length >= state.limit || schema === undefined || schema === true || depth > MAX_DEPTH || ++state.counter.steps > MAX_STEPS)\n return;\n if (schema === false)\n return void out.push({ path, keyword: "false" });\n if (typeof schema !== "object" || schema === null)\n return;\n const miss = (keyword, at = path) => void out.push({ path: at, keyword });\n const target = circularTarget(schema);\n if (target)\n return check(value, target, path, depth + 1, out, state);\n const nullable = schema.nullable === true;\n const types = typesOf(schema);\n if (value === null && nullable)\n return;\n if (types.length && !types.some((t) => isType(value, t)))\n return miss("type");\n if (schema.const !== undefined && !equal(value, schema.const))\n miss("const");\n if (Array.isArray(schema.enum) && schema.enum.length && !schema.enum.some((e) => equal(e, value)))\n miss("enum");\n if (typeof value === "string") {\n const length = [...value].length;\n if (typeof schema.minLength === "number" && length < schema.minLength)\n miss("minLength");\n if (typeof schema.maxLength === "number" && length > schema.maxLength)\n miss("maxLength");\n if (typeof schema.pattern === "string" && !matchesPattern(schema.pattern, value))\n miss("pattern");\n if (typeof schema.format === "string" && !formatFits(schema.format, value))\n miss("format");\n }\n else if (typeof value === "number") {\n const { minimum, maximum, exclusiveMinimum: exMin, exclusiveMaximum: exMax } = schema;\n if (typeof minimum === "number" && (exMin === true ? value <= minimum : value < minimum))\n miss("minimum");\n if (typeof maximum === "number" && (exMax === true ? value >= maximum : value > maximum))\n miss("maximum");\n if (typeof exMin === "number" && value <= exMin)\n miss("exclusiveMinimum");\n if (typeof exMax === "number" && value >= exMax)\n miss("exclusiveMaximum");\n if (typeof schema.multipleOf === "number" && schema.multipleOf > 0 && !multipleOf(value, schema.multipleOf))\n miss("multipleOf");\n if (schema.format === "int32" && !(Number.isInteger(value) && value >= -(2 ** 31) && value < 2 ** 31))\n miss("format");\n }\n else if (Array.isArray(value)) {\n if (typeof schema.minItems === "number" && value.length < schema.minItems)\n miss("minItems");\n if (typeof schema.maxItems === "number" && value.length > schema.maxItems)\n miss("maxItems");\n if (schema.uniqueItems === true && new Set(value.map((v) => canonical(v))).size < value.length)\n miss("uniqueItems");\n const legacy = Array.isArray(schema.items) ? schema.items : undefined;\n const prefix = (_b = (_a = schema.prefixItems) !== null && _a !== void 0 ? _a : legacy) !== null && _b !== void 0 ? _b : [];\n value.forEach((item, i) => {\n if (i < prefix.length)\n check(item, prefix[i], [...path, i], depth + 1, out, state);\n else if (!legacy && isSchema(schema.items))\n check(item, schema.items, [...path, i], depth + 1, out, state);\n });\n }\n else if (isRecord(value)) {\n const props = isRecord(schema.properties) ? schema.properties : {};\n const omitted = (key) => {\n const prop = props[key];\n return isSchema(prop) && (state.mode === "request" ? prop.readOnly === true : prop.writeOnly === true);\n };\n if (Array.isArray(schema.required))\n for (const key of schema.required)\n if (typeof key === "string" && !(key in value) && !omitted(key))\n miss("required", [...path, key]);\n const count = Object.keys(value).length;\n if (typeof schema.minProperties === "number" && count < schema.minProperties)\n miss("minProperties");\n if (typeof schema.maxProperties === "number" && count > schema.maxProperties)\n miss("maxProperties");\n const patterns = isRecord(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];\n for (const [key, item] of Object.entries(value)) {\n if (out.length >= state.limit)\n break;\n let known = false;\n if (Object.prototype.hasOwnProperty.call(props, key)) {\n known = true;\n check(item, props[key], [...path, key], depth + 1, out, state);\n }\n for (const [pattern, sub] of patterns) {\n if (matchesPattern(pattern, key)) {\n known = true;\n check(item, sub, [...path, key], depth + 1, out, state);\n }\n }\n if (!known) {\n const extra = schema.additionalProperties;\n if (extra === false)\n miss("additionalProperties", [...path, key]);\n else if (isSchema(extra))\n check(item, extra, [...path, key], depth + 1, out, state);\n }\n }\n }\n for (const part of (_c = schema.allOf) !== null && _c !== void 0 ? _c : [])\n if (isSchema(part))\n check(value, part, path, depth + 1, out, state);\n if (Array.isArray(schema.anyOf) && schema.anyOf.length && !schema.anyOf.some((v) => fitsAt(value, v, depth, state)))\n miss("anyOf");\n if (Array.isArray(schema.oneOf) && schema.oneOf.length) {\n const fitting = countIn(value, schema.oneOf, depth, state, 2);\n if (fitting !== 1)\n miss(fitting === 0 ? "oneOf" : "oneOf-many");\n }\n if (isSchema(schema.not) && fitsAt(value, schema.not, depth, state))\n miss("not");\n const conditional = schema;\n if (isSchema(conditional.if)) {\n const branch = fitsAt(value, conditional.if, depth, state) ? conditional.then : conditional.else;\n if (isSchema(branch))\n check(value, branch, path, depth + 1, out, state);\n }\n}\nfunction fitsAt(value, schema, depth, state) {\n const found = [];\n check(value, schema, [], depth + 1, found, { counter: state.counter, limit: 1, mode: state.mode });\n return found.length === 0;\n}\nfunction countIn(value, variants, depth, s, stop) {\n let n = 0;\n for (const v of variants) {\n if (isSchema(v) && fitsAt(value, v, depth, s) && ++n >= stop)\n break;\n }\n return n;\n}\nfunction isSchema(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction typesOf(schema) {\n return (Array.isArray(schema.type) ? schema.type : [schema.type]).filter((t) => typeof t === "string");\n}\nfunction isType(value, type) {\n switch (type) {\n case "integer":\n return typeof value === "number" && Number.isInteger(value);\n case "number":\n return typeof value === "number" && Number.isFinite(value);\n case "string":\n return typeof value === "string";\n case "boolean":\n return typeof value === "boolean";\n case "array":\n return Array.isArray(value);\n case "object":\n return isRecord(value);\n case "null":\n return value === null;\n default:\n return true;\n }\n}\nfunction multipleOf(value, step) {\n const quotient = value / step;\n return Math.abs(quotient - Math.round(quotient)) < 1e-9;\n}\nfunction equal(a, b) {\n return canonical(a) === canonical(b);\n}\nfunction canonical(value) {\n var _a;\n if (Array.isArray(value))\n return `[${value.map(canonical).join(",")}]`;\n if (isRecord(value))\n return `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonical(value[k])}`).join(",")}}`;\n return (_a = JSON.stringify(value)) !== null && _a !== void 0 ? _a : "undefined";\n}\nconst REPEATED_GROUP = /\\)(?:[*+]|\\{\\d+,?\\d*\\})/;\nconst compiled = new Map();\nfunction patternVerdict(pattern, value) {\n if (value.length > 40 || REPEATED_GROUP.test(pattern))\n return undefined;\n const re = compiledPattern(pattern);\n return re === null ? undefined : re.test(value);\n}\nfunction matchesPattern(pattern, value) {\n if (value.length > 2000 || REPEATED_GROUP.test(pattern))\n return true;\n const re = compiledPattern(pattern);\n return re === null || re.test(value);\n}\nfunction compiledPattern(pattern) {\n let re = compiled.get(pattern);\n if (re === undefined) {\n try {\n re = new RegExp(pattern, "u");\n }\n catch {\n try {\n re = new RegExp(pattern);\n }\n catch {\n re = null;\n }\n }\n if (compiled.size > 2000)\n compiled.clear();\n compiled.set(pattern, re);\n }\n return re;\n}\nconst DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst TIME = /^(\\d{2}):(\\d{2}):(\\d{2})(\\.\\d+)?(z|[+-]\\d{2}(:?\\d{2})?)$/i;\nconst FORMATS = {\n "date-time": (text) => {\n const [date, time] = text.split(/t|\\s/i);\n return time !== undefined && FORMATS.date(date) && FORMATS.time(time);\n },\n date: (text) => {\n const m = text.match(DATE);\n if (!m)\n return false;\n const month = Number(m[2]);\n const day = Number(m[3]);\n return month >= 1 && month <= 12 && day >= 1 && day <= new Date(Date.UTC(Number(m[1]), month, 0)).getUTCDate();\n },\n time: (text) => {\n const m = text.match(TIME);\n return Boolean(m) && Number(m[1]) <= 23 && Number(m[2]) <= 59 && Number(m[3]) <= 60;\n },\n email: (text) => /^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(text),\n uri: (text) => /^[a-z][a-z0-9+.-]*:[^\\s]*$/i.test(text) && !/\\s/.test(text),\n url: (text) => /^[a-z][a-z0-9+.-]*:\\/\\/[^\\s]+$/i.test(text),\n "uri-reference": (text) => !/[\\s<>"\\\\^`{}|]/.test(text),\n "uri-template": (text) => !/[\\s<>"\\\\^`|]/.test(text),\n uuid: (text) => /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(text),\n ipv4: (text) => /^((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/.test(text),\n ipv6: (text) => { var _a; return /^[0-9a-f:.]+$/i.test(text) && text.includes(":") && ((_a = text.match(/::/g)) !== null && _a !== void 0 ? _a : []).length <= 1; },\n hostname: (text) => text.length <= 253 && /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\\.?$/i.test(text),\n byte: (text) => /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(text),\n duration: (text) => /^P(?!$)(\\d+(?:\\.\\d+)?Y)?(\\d+(?:\\.\\d+)?M)?(\\d+(?:\\.\\d+)?W)?(\\d+(?:\\.\\d+)?D)?(T(?=\\d)(\\d+(?:\\.\\d+)?H)?(\\d+(?:\\.\\d+)?M)?(\\d+(?:\\.\\d+)?S)?)?$/.test(text),\n regex: (text) => {\n try {\n new RegExp(text);\n return true;\n }\n catch {\n return false;\n }\n },\n "json-pointer": (text) => /^(?:\\/(?:[^~/]|~0|~1)*)*$/.test(text),\n};\nfunction formatFits(format, text) {\n const test = FORMATS[format];\n return test ? test(text) : true;\n}\n\n}, {}],\n"lib/text": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.cut = cut;\nexports.wellFormed = wellFormed;\nexports.clip = clip;\nexports.plainText = plainText;\nfunction cut(text, max) {\n const end = Math.max(0, max);\n const last = text.charCodeAt(end - 1);\n return text.slice(0, last >= 0xd800 && last <= 0xdbff ? end - 1 : end);\n}\nconst HALVES = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDFFF]/g;\nfunction wellFormed(text) {\n return text.replace(HALVES, (c) => (c.length === 2 ? c : ""));\n}\nfunction clip(text, max) {\n return text.length > max ? `${cut(text, max - 1)}\u2026` : text;\n}\nfunction plainText(markdown) {\n return markdown\n .replace(/<[^>]+>/g, " ")\n .replace(/!\\[([^\\]]*)\\]\\([^)]*\\)/g, "$1")\n .replace(/\\[([^\\]]*)\\]\\([^)]*\\)/g, "$1")\n .replace(/\\*\\*|__|`/g, "")\n .replace(/(^|\\s)[*_]([^*_\\s][^*_]*?)[*_](?=[\\s.,;:!?)]|$)/g, "$1$2")\n .replace(/^\\s{0,3}(#{1,6}|>)\\s+/gm, "")\n .replace(/\\s+/g, " ")\n .trim();\n}\n\n}, {}]\n};\nvar cache = {};\nfunction load(id) {\n var m = cache[id];\n if (m) return m.exports;\n m = cache[id] = { exports: {} };\n defs[id][0](m, m.exports, function (spec) { return load(defs[id][1][spec]); });\n return m.exports;\n}\nload("lib/embed/player");\n})();';
15649
+ var PLAYER_SCRIPT = '(function () {\n"use strict";\nvar defs = {\n"lib/embed/player": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nconst frame_1 = require("../render/frame");\nconst timing_1 = require("../storyboard/timing");\nconst ICONS = {\n play: \'<path d="M8 5.2v13.6a.6.6 0 0 0 .9.5l10.6-6.8a.6.6 0 0 0 0-1L8.9 4.7a.6.6 0 0 0-.9.5z" fill="currentColor"/>\',\n pause: \'<path d="M7 5h3.2v14H7zM13.8 5H17v14h-3.2z" fill="currentColor"/>\',\n replay: \'<path d="M19.5 11.5A7.5 7.5 0 1 0 17.3 17M19.5 5v6.5H13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n prev: \'<path d="M6.5 5.5v13M17.5 6.2v11.6a.5.5 0 0 1-.8.4l-8.3-5.8a.5.5 0 0 1 0-.8l8.3-5.8a.5.5 0 0 1 .8.4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n next: \'<path d="M17.5 5.5v13M6.5 6.2v11.6a.5.5 0 0 0 .8.4l8.3-5.8a.5.5 0 0 0 0-.8L7.3 5.8a.5.5 0 0 0-.8.4z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n copy: \'<path d="M9 9.5h9.5v10H9zM6 15.5H5.5v-10h9.5V6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n expand: \'<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>\',\n};\nconst icon = (name) => `<svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true">${ICONS[name]}</svg>`;\nfunction fmt(ms) {\n const s = Math.floor(ms / 1000);\n return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`;\n}\nfunction button(label, name, className = "") {\n const b = document.createElement("button");\n b.type = "button";\n b.className = className;\n b.setAttribute("aria-label", label);\n b.title = label;\n b.innerHTML = icon(name);\n return b;\n}\nconst SITE = "https://integrationtour.com/";\nfunction credit(aspect) {\n const a = document.createElement("a");\n a.className = "credit";\n a.href = SITE;\n a.target = "_blank";\n a.rel = "noopener";\n a.setAttribute("aria-label", `${frame_1.WATERMARK} (opens in a new tab)`);\n a.addEventListener("click", (e) => e.stopPropagation());\n place(a, aspect, (0, frame_1.watermarkBox)(aspect));\n return a;\n}\nfunction place(link, aspect, box) {\n const size = (0, frame_1.sizeFor)(aspect);\n const pad = 8;\n const share = (value, of) => `${((value / of) * 100).toFixed(3)}%`;\n link.style.left = share(box.x - pad, size.width);\n link.style.top = share(box.y - pad, size.height);\n link.style.width = share(box.w + 2 * pad, size.width);\n link.style.height = share(box.h + 2 * pad, size.height);\n}\nfunction fit(link, frame, aspect) {\n const text = frame.querySelector("svg > text:last-child");\n if (!(text instanceof SVGTextElement) || text.textContent !== frame_1.WATERMARK)\n return false;\n let width = 0;\n try {\n width = text.getComputedTextLength();\n }\n catch {\n }\n if (!(width > 0))\n return false;\n const box = (0, frame_1.watermarkBox)(aspect);\n place(link, aspect, { ...box, x: box.x + box.w - width, w: width });\n return true;\n}\nfunction start(root, sb) {\n const total = (0, timing_1.totalDuration)(sb);\n const starts = (0, frame_1.sceneStarts)(sb);\n let time = 0;\n let playing = false;\n let last = null;\n const stage = document.createElement("div");\n stage.className = `stage ${sb.settings.aspect === "9:16" ? "portrait" : sb.settings.aspect === "1:1" ? "square" : "wide"}`;\n const frame = document.createElement("div");\n frame.setAttribute("role", "img");\n stage.append(frame);\n const link = sb.settings.watermark ? credit(sb.settings.aspect) : undefined;\n if (link)\n stage.append(link);\n let fitted = false;\n const controls = document.createElement("div");\n controls.className = "controls";\n const prev = button("Previous scene", "prev");\n const play = button("Play", "play", "play");\n const next = button("Next scene", "next");\n const seek = document.createElement("input");\n seek.type = "range";\n seek.min = "0";\n seek.max = String(total);\n seek.step = "50";\n seek.setAttribute("aria-label", "Seek");\n const clock = document.createElement("span");\n clock.className = "time";\n const copy = button("Copy this payload as JSON", "copy");\n const full = button("Full screen", "expand");\n controls.append(prev, play, next, seek, clock, copy, full);\n const status = document.createElement("p");\n status.className = "status";\n status.setAttribute("role", "status");\n root.append(stage, controls, status);\n root.tabIndex = 0;\n const draw = () => {\n const at = (0, frame_1.sceneAt)(sb, Math.min(time, total));\n frame.innerHTML = (0, frame_1.renderFrame)(sb, time);\n frame.setAttribute("aria-label", at.scene.caption);\n if (link && !fitted)\n fitted = fit(link, frame, sb.settings.aspect);\n seek.value = String(Math.round(time));\n clock.textContent = `${fmt(time)} / ${fmt(total)} \xB7 ${at.index + 1}/${at.count}`;\n const ended = !playing && time >= total;\n play.innerHTML = icon(playing ? "pause" : ended ? "replay" : "play");\n play.setAttribute("aria-label", playing ? "Pause" : ended ? "Replay" : "Play");\n prev.disabled = at.index === 0;\n next.disabled = at.index === at.count - 1;\n };\n const tick = (now) => {\n if (!playing)\n return;\n time = Math.min(total, time + (last === null ? 0 : now - last));\n last = now;\n if (time >= total)\n playing = false;\n draw();\n if (playing)\n requestAnimationFrame(tick);\n };\n const toggle = () => {\n if (!playing && time >= total)\n time = 0;\n playing = !playing;\n last = null;\n draw();\n if (playing)\n requestAnimationFrame(tick);\n };\n const step = (delta) => {\n const index = Math.max(0, Math.min(starts.length - 1, (0, frame_1.sceneAt)(sb, Math.min(time, total)).index + delta));\n playing = false;\n time = starts[index] + Math.min(900, total - starts[index]);\n draw();\n };\n const payload = () => {\n const { scene, progress } = (0, frame_1.sceneAt)(sb, Math.min(time, total));\n if (scene.kind === "call" || scene.kind === "auth")\n return progress < 0.52 ? scene.request : scene.response;\n return scene.kind === "webhook" ? scene.payload : undefined;\n };\n const say = (text) => {\n status.textContent = text;\n window.setTimeout(() => status.textContent === text && (status.textContent = ""), 2500);\n };\n copy.addEventListener("click", async () => {\n const value = payload();\n if (value === undefined)\n return say("This scene has no payload to copy.");\n const text = typeof value === "string" ? value : JSON.stringify(value, null, 2);\n try {\n await navigator.clipboard.writeText(text);\n }\n catch {\n const area = document.createElement("textarea");\n area.value = text;\n document.body.append(area);\n area.select();\n document.execCommand("copy");\n area.remove();\n }\n say("Copied the payload as JSON.");\n });\n full.addEventListener("click", () => {\n if (document.fullscreenElement)\n void document.exitFullscreen();\n else if (root.requestFullscreen)\n void root.requestFullscreen().catch(() => root.classList.toggle("filled"));\n else\n root.classList.toggle("filled");\n });\n play.addEventListener("click", toggle);\n prev.addEventListener("click", () => step(-1));\n next.addEventListener("click", () => step(1));\n stage.addEventListener("click", toggle);\n seek.addEventListener("input", () => {\n playing = false;\n time = Number(seek.value);\n draw();\n });\n root.addEventListener("keydown", (e) => {\n if (e.target.tagName === "INPUT" && e.key !== " ")\n return;\n if (e.key === " ") {\n e.preventDefault();\n toggle();\n }\n else if (e.key === "ArrowRight")\n step(1);\n else if (e.key === "ArrowLeft")\n step(-1);\n else if (e.key === "f")\n full.click();\n else if (e.key === "Escape")\n root.classList.remove("filled");\n });\n draw();\n}\nconst root = document.getElementById("flow-player");\nconst data = document.getElementById("flow-storyboard");\nif (root && (data === null || data === void 0 ? void 0 : data.textContent))\n start(root, JSON.parse(data.textContent));\n\n}, {"../render/frame":"lib/render/frame","../storyboard/timing":"lib/storyboard/timing"}],\n"lib/render/frame": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.WATERMARK = void 0;\nexports.paletteFor = paletteFor;\nexports.sizeFor = sizeFor;\nexports.outputSize = outputSize;\nexports.sceneAt = sceneAt;\nexports.sceneStarts = sceneStarts;\nexports.renderFrame = renderFrame;\nexports.watermarkBox = watermarkBox;\nexports.jsonLines = jsonLines;\nexports.wrap = wrap;\nexports.esc = esc;\nconst timing_1 = require("../storyboard/timing");\nconst code_1 = require("./code");\nconst text_1 = require("../text");\nexports.WATERMARK = "Made with integrationtour.com";\nconst DARK = {\n bg: "#0b1120",\n panel: "#131c31",\n panelEdge: "#26324d",\n text: "#e6ebf5",\n muted: "#8e9ab3",\n client: "#5cc8ff",\n api: "#a58bff",\n accent: "#5cc8ff",\n ok: "#3ddc97",\n bad: "#ff6b6b",\n hook: "#ffb547",\n key: "#ffd166",\n jsonKey: "#7cc7ff",\n jsonString: "#b8e986",\n jsonOther: "#f7b17a",\n};\nconst LIGHT = {\n bg: "#f5f7fb",\n panel: "#ffffff",\n panelEdge: "#d5dce8",\n text: "#0f172a",\n muted: "#5b6a82",\n client: "#0369a1",\n api: "#6d28d9",\n accent: "#0369a1",\n ok: "#047857",\n bad: "#c81e1e",\n hook: "#b45309",\n key: "#a16207",\n jsonKey: "#0f5f8f",\n jsonString: "#166534",\n jsonOther: "#b4410c",\n};\nconst HEX_COLOR = /^#[0-9a-f]{6}$/i;\nfunction paletteFor(settings) {\n const base = settings.theme === "light" ? LIGHT : DARK;\n return settings.brandColor && HEX_COLOR.test(settings.brandColor) ? { ...base, api: settings.brandColor, accent: settings.brandColor } : base;\n}\nlet C = DARK;\nconst SANS = "Inter, \'Segoe UI\', Roboto, Helvetica, Arial, sans-serif";\nconst MONO = "\'JetBrains Mono\', \'SFMono-Regular\', Menlo, Consolas, monospace";\nfunction sizeFor(aspect) {\n if (aspect === "9:16")\n return { width: 720, height: 1280 };\n return aspect === "1:1" ? { width: 720, height: 720 } : { width: 1280, height: 720 };\n}\nfunction outputSize(settings) {\n var _a;\n const { width, height } = sizeFor(settings.aspect);\n const scale = ((_a = settings.resolution) !== null && _a !== void 0 ? _a : 720) / 720;\n return { width: Math.round(width * scale), height: Math.round(height * scale) };\n}\nfunction layoutFor(aspect) {\n if (aspect === "9:16") {\n const client = { x: 48, y: 290, w: 624, h: 110 };\n const api = { x: 48, y: 1040, w: 624, h: 110 };\n return {\n width: 720,\n height: 1280,\n stacked: true,\n caption: { x: 48, y: 110, width: 624, size: 32, minSize: 26, maxLines: 4 },\n client,\n api,\n webhook: client,\n card: { x: 136, y: 450, w: 536, h: 550 },\n lane: { from: [92, 400], to: [92, 1040] },\n hookLane: { from: [92, 1040], to: [92, 400] },\n monoSize: 16,\n title: { size: 52, logo: 120, subtitle: 26 },\n stepSize: 18,\n summary: { left: 64, top: 360, bottom: 100, size: 26, gap: 64 },\n };\n }\n if (aspect === "1:1") {\n const client = { x: 40, y: 200, w: 240, h: 92 };\n return {\n width: 720,\n height: 720,\n stacked: true,\n caption: { x: 40, y: 72, width: 640, size: 30, minSize: 24, maxLines: 3 },\n client,\n api: { x: 440, y: 200, w: 240, h: 92 },\n webhook: client,\n card: { x: 40, y: 324, w: 640, h: 326 },\n lane: { from: [280, 246], to: [440, 246] },\n hookLane: { from: [440, 246], to: [280, 246] },\n monoSize: 15,\n title: { size: 44, logo: 80, subtitle: 22 },\n stepSize: 16,\n summary: { left: 56, top: 200, bottom: 70, size: 22, gap: 48 },\n };\n }\n const client = { x: 64, y: 250, w: 250, h: 130 };\n const api = { x: 966, y: 250, w: 250, h: 130 };\n const webhook = { x: 64, y: 480, w: 250, h: 110 };\n return {\n width: 1280,\n height: 720,\n stacked: false,\n caption: { x: 64, y: 92, width: 1152, size: 30, minSize: 24, maxLines: 2 },\n client,\n api,\n webhook,\n card: { x: 354, y: 352, w: 572, h: 300 },\n lane: { from: [314, 315], to: [966, 315] },\n hookLane: { from: [966, 380], to: [314, 535] },\n monoSize: 15,\n title: { size: 56, logo: 92, subtitle: 24 },\n stepSize: 15,\n summary: { left: 200, top: 220, bottom: 70, size: 24, gap: 56 },\n };\n}\nfunction sceneAt(sb, t) {\n const scenes = (0, timing_1.activeScenes)(sb);\n let start = 0;\n for (let i = 0; i < scenes.length; i++) {\n const duration = (0, timing_1.sceneDuration)(sb, scenes[i]);\n const end = start + duration;\n if (t < end || i === scenes.length - 1) {\n return { scene: scenes[i], index: i, count: scenes.length, start, duration, progress: clamp01((t - start) / duration) };\n }\n start = end;\n }\n throw new Error("Storyboard has no scenes.");\n}\nfunction sceneStarts(sb) {\n const starts = [];\n let t = 0;\n for (const s of (0, timing_1.activeScenes)(sb)) {\n starts.push(t);\n t += (0, timing_1.sceneDuration)(sb, s);\n }\n return starts;\n}\nfunction renderFrame(sb, t, size) {\n var _a, _b;\n C = paletteFor(sb.settings);\n const L = layoutFor(sb.settings.aspect);\n const total = (0, timing_1.totalDuration)(sb);\n const at = sceneAt(sb, Math.max(0, Math.min(t, total)));\n const fade = at.index === 0 ? 1 : clamp01((at.progress * at.duration) / 300);\n let body;\n switch (at.scene.kind) {\n case "title":\n body = titleScene(L, at.scene, at.progress, sb.settings.logo);\n break;\n case "summary":\n body = summaryScene(L, at.scene, at.progress, (0, timing_1.summaryItems)(sb));\n break;\n case "auth":\n body = authScene(L, sb, at.scene, at.progress);\n break;\n case "webhook":\n body = webhookScene(L, sb, at.scene, at.progress);\n break;\n default:\n body = callScene(L, sb, at.scene, at.progress);\n }\n const parts = [\n `<svg xmlns="http://www.w3.org/2000/svg" width="${(_a = size === null || size === void 0 ? void 0 : size.width) !== null && _a !== void 0 ? _a : L.width}" height="${(_b = size === null || size === void 0 ? void 0 : size.height) !== null && _b !== void 0 ? _b : L.height}" viewBox="0 0 ${L.width} ${L.height}" font-family="${esc(SANS)}">`,\n `<rect width="${L.width}" height="${L.height}" fill="${C.bg}"/>`,\n grid(L),\n `<g opacity="${fade.toFixed(3)}">${body}</g>`,\n progressBar(L, total ? Math.min(t, total) / total : 0),\n sb.settings.watermark ? watermark(L) : "",\n `</svg>`,\n ];\n return parts.join("");\n}\nfunction titleScene(L, scene, p, logo) {\n let size = L.title.size;\n while (size > L.title.size * 0.72 && wrap(scene.title, L.width - 160, size, Infinity).length > 3)\n size -= 2;\n const lines = wrap(scene.title, L.width - 160, size, 3);\n const mark = logo && /^data:image\\/(png|jpeg|gif|webp);base64,[a-z0-9+/=]+$/i.test(logo) ? { h: L.title.logo, gap: 34 } : undefined;\n const top = L.height / 2 - (lines.length * size * 1.15) / 2 + (mark ? (mark.h + mark.gap) / 2 : 0);\n const out = lines.map((line, i) => `<text x="${L.width / 2}" y="${top + i * size * 1.15}" text-anchor="middle" font-size="${size}" font-weight="700" fill="${C.text}">${esc(line)}</text>`);\n const subY = top + lines.length * size * 1.15 + 24;\n out.push(`<text x="${L.width / 2}" y="${subY}" text-anchor="middle" font-size="${L.title.subtitle}" fill="${C.muted}">${esc(fit(scene.subtitle, L.width - 160, L.title.subtitle))}</text>`);\n if (mark) {\n const bottom = top - size * 0.78 - mark.gap;\n out.push(`<image href="${esc(logo)}" x="${L.width / 2 - 200}" y="${(bottom - mark.h).toFixed(1)}" width="400" height="${mark.h}" preserveAspectRatio="xMidYMid meet"/>`);\n }\n const dotsY = subY + 70;\n [C.client, C.api, C.hook].forEach((color, i) => {\n const glow = pulse(p, 0.25 + i * 0.15, 0.55 + i * 0.15);\n const cx = L.width / 2 + (i - 1) * 40;\n if (glow > 0)\n out.push(`<circle cx="${cx}" cy="${dotsY}" r="${(8 + 10 * glow).toFixed(1)}" fill="${color}" opacity="${(0.25 * glow).toFixed(3)}"/>`);\n out.push(`<circle cx="${cx}" cy="${dotsY}" r="8" fill="${color}"/>`);\n });\n return out.join("");\n}\nconst MIN_SUMMARY_GAP = 34;\nconst MIN_SUMMARY_SIZE = 18;\nfunction summaryScene(L, scene, p, items) {\n const out = [captionText(L, scene.caption)];\n const { left, top, bottom, size, gap } = L.summary;\n const textX = left + 44;\n const room = L.height - bottom - top;\n const plan = summaryPlan(items, L.width - textX - 56, room, size, gap);\n const r = Math.min(14, plan.gap * 0.32);\n const stagger = Math.min(0.08, 0.6 / plan.blocks.length);\n let y = top;\n plan.blocks.forEach((lines, i) => {\n const appear = clamp01((p - 0.08 - i * stagger) / 0.12);\n const more = plan.more && i === plan.blocks.length - 1;\n out.push(`<g opacity="${appear.toFixed(3)}">`, more\n ? ""\n : `<circle cx="${left + 14}" cy="${(y - 8).toFixed(1)}" r="${r.toFixed(1)}" fill="${C.ok}" opacity="0.18"/><path d="M${left + 7} ${(y - 8).toFixed(1)} l5 5 l9 -10" stroke="${C.ok}" stroke-width="3" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`, ...lines.map((line, j) => `<text x="${textX}" y="${(y + j * plan.lineHeight).toFixed(1)}" font-size="${plan.size}" fill="${more ? C.muted : C.text}">${esc(line)}</text>`), `</g>`);\n y += plan.gap + (lines.length - 1) * plan.lineHeight;\n });\n return out.join("");\n}\nfunction summaryPlan(items, width, room, baseSize, baseGap) {\n const measure = (size) => {\n const lineHeight = Math.round(size * 1.2);\n const blocks = items.map((item) => wrap(item, width, size, 2));\n const extra = blocks.reduce((n, lines) => n + lines.length - 1, 0) * lineHeight;\n return { blocks, lineHeight, extra, minGap: Math.max(MIN_SUMMARY_GAP, size * 1.45) };\n };\n for (let size = baseSize; size >= MIN_SUMMARY_SIZE; size--) {\n const { blocks, lineHeight, extra, minGap } = measure(size);\n const gaps = Math.max(1, blocks.length - 1);\n if (gaps * minGap + extra <= room)\n return { blocks, size, lineHeight, gap: Math.min(baseGap, (room - extra) / gaps), more: false };\n }\n const { blocks, lineHeight, minGap } = measure(MIN_SUMMARY_SIZE);\n const kept = [];\n let used = 0;\n for (const lines of blocks) {\n const need = (kept.length ? minGap : 0) + (lines.length - 1) * lineHeight;\n if (used + need + minGap > room)\n break;\n kept.push(lines);\n used += need;\n }\n kept.push([`+${items.length - kept.length} more`]);\n return { blocks: kept, size: MIN_SUMMARY_SIZE, lineHeight, gap: minGap, more: true };\n}\nfunction callScene(L, sb, scene, p) {\n var _a;\n const failed = scene.outcome === "failure";\n const responseColor = failed ? C.bad : C.ok;\n const requestPhase = p < 0.52;\n const mcp = sb.api.protocol === "mcp";\n const call = `${scene.method} ${scene.path}`.trim();\n const outcome = outcomeText(scene.status);\n const out = [\n stepLabel(L, `Step ${scene.step} of ${scene.stepCount}${failed ? " \xB7 failure path" : ""}`, failed ? C.bad : C.muted),\n captionText(L, scene.caption),\n ...nodes(L, sb, pulse(p, 0.4, 0.52)),\n lane(L),\n ];\n if (!L.stacked)\n out.push(laneLabel(L, call));\n if (!L.stacked && sb.scenes.some((s) => s.kind === "webhook"))\n out.push(node(L.webhook, "WEBHOOKS", (_a = sb.nodes.webhook) !== null && _a !== void 0 ? _a : "Your server", C.hook, 0, 0.35));\n if (p >= 0.1 && p < 0.4)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.1) / 0.3), C.client));\n if (p >= 0.52 && p < 0.8)\n out.push(packet(L.lane.to, L.lane.from, ease((p - 0.52) / 0.28), responseColor));\n const cardIn = clamp01((p - 0.08) / 0.08);\n if (requestPhase) {\n const code = sb.settings.code ? (0, code_1.callCode)(sb, scene, sb.settings.code) : undefined;\n out.push(card(L, call, C.client, scene.request, scene.request === undefined && !code ? (mcp ? "No params" : "No request body") : undefined, cardIn, { code }));\n }\n else {\n out.push(card(L, mcp && failed ? `result \xB7 ${outcome}` : outcome, responseColor, scene.response, scene.response === undefined ? "No response body" : undefined, 1, { fold: mcp ? SCHEMA_KEYS : undefined }));\n }\n if (p >= 0.8) {\n const appear = clamp01((p - 0.8) / 0.06);\n out.push(badge(L.client, outcome, responseColor, appear));\n if (failed && scene.recovery)\n out.push(recoveryNote(L, scene.recovery, appear));\n }\n if (requestPhase ? scene.requestGenerated && p >= 0.08 : scene.responseGenerated) {\n const written = mcp && (requestPhase ? scene.method === "prompts/get" : isRecord(scene.response) && !("structuredContent" in scene.response));\n out.push(`<text x="${L.card.x + L.card.w}" y="${L.card.y + L.card.h + 22}" text-anchor="end" font-size="13" fill="${C.muted}">${written ? "Example text written for the video" : "Example generated from the schema"}</text>`);\n }\n return out.join("");\n}\nfunction nodes(L, sb, glow, clientOpacity = 1) {\n const mcp = sb.api.protocol === "mcp";\n return [node(L.client, mcp ? "MCP CLIENT" : "CLIENT", sb.nodes.client, C.client, 0, clientOpacity), node(L.api, mcp ? "MCP SERVER" : "API", sb.nodes.api, C.api, glow)];\n}\nfunction outcomeText(status) {\n if (status === "result")\n return "result";\n if (status === "isError")\n return "isError: true";\n const why = reason(status);\n return why ? `${status} ${why}` : status;\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction authScene(L, sb, scene, p) {\n var _a;\n const out = [stepLabel(L, `Authentication \xB7 ${scene.scheme}`, C.key), captionText(L, scene.caption), ...nodes(L, sb, pulse(p, 0.4, 0.52)), lane(L)];\n if (scene.requestLine) {\n if (!L.stacked)\n out.push(laneLabel(L, scene.requestLine));\n if (p >= 0.1 && p < 0.4)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.1) / 0.3), C.client));\n if (p >= 0.52 && p < 0.8)\n out.push(packet(L.lane.to, L.lane.from, ease((p - 0.52) / 0.28), C.key));\n const code = sb.settings.code && sb.api.protocol !== "mcp" && scene.requestType ? (0, code_1.authCode)(sb, scene, sb.settings.code) : undefined;\n const form = !code && /form-urlencoded/i.test((_a = scene.requestType) !== null && _a !== void 0 ? _a : "") && isRecord(scene.request);\n if (p < 0.52)\n out.push(card(L, scene.requestLine, C.client, form ? formText(scene.request) : scene.request, undefined, clamp01((p - 0.08) / 0.08), { code, form }));\n else\n out.push(card(L, "200 OK \xB7 access token", C.key, scene.response, undefined, 1));\n if (p >= 0.8)\n out.push(badge(L.client, "Token stored", C.key, clamp01((p - 0.8) / 0.06)));\n }\n else {\n if (!L.stacked)\n out.push(laneLabel(L, scene.headerLine.split("\\n")[0]));\n if (p >= 0.2 && p < 0.6)\n out.push(packet(L.lane.from, L.lane.to, ease((p - 0.2) / 0.4), C.key));\n const every = sb.scenes.every((s) => s.kind !== "call" || s.credentials === undefined);\n out.push(card(L, every ? "Sent with every request" : "Sent with each call that needs it", C.key, undefined, scene.headerLine, clamp01((p - 0.08) / 0.08)));\n if (p >= 0.62)\n out.push(badge(L.api, "Authenticated", C.ok, clamp01((p - 0.62) / 0.06)));\n }\n return out.join("");\n}\nfunction webhookScene(L, sb, scene, p) {\n var _a, _b, _c;\n const receiver = L.stacked ? node(L.webhook, "WEBHOOKS", (_a = sb.nodes.webhook) !== null && _a !== void 0 ? _a : "Your server", C.hook, pulse(p, 0.55, 0.7)) : "";\n const out = [\n stepLabel(L, `Webhook \xB7 ${scene.event}`, C.hook),\n captionText(L, scene.caption),\n L.stacked ? receiver : node(L.client, "CLIENT", sb.nodes.client, C.client, 0, 0.45),\n node(L.api, "API", sb.nodes.api, C.api, pulse(p, 0.05, 0.18)),\n ];\n if (!L.stacked)\n out.push(node(L.webhook, "WEBHOOKS", (_b = sb.nodes.webhook) !== null && _b !== void 0 ? _b : "Your server", C.hook, pulse(p, 0.55, 0.7)));\n out.push(`<line x1="${L.hookLane.from[0]}" y1="${L.hookLane.from[1]}" x2="${L.hookLane.to[0]}" y2="${L.hookLane.to[1]}" stroke="${C.hook}" stroke-opacity="0.35" stroke-width="2" stroke-dasharray="6 8"/>`);\n if (p >= 0.18 && p < 0.55)\n out.push(packet(L.hookLane.from, L.hookLane.to, ease((p - 0.18) / 0.37), C.hook));\n out.push(card(L, `${scene.method} ${scene.event}`, C.hook, scene.payload, scene.payload === undefined ? "Event payload" : undefined, clamp01((p - 0.1) / 0.08)));\n if (scene.payloadGenerated && scene.payload !== undefined) {\n out.push(`<text x="${L.card.x + L.card.w}" y="${L.card.y + L.card.h + 22}" text-anchor="end" font-size="13" fill="${C.muted}">Example generated from the schema</text>`);\n }\n if (p >= 0.72) {\n const ack = (_c = scene.ack) !== null && _c !== void 0 ? _c : "2XX";\n const said = `${outcomeText(ack)} \xB7 acknowledged`;\n out.push(badge(L.webhook, said.length <= Math.floor((L.webhook.w - 20) / (15 * 0.6)) ? said : `${ack} \xB7 acknowledged`, C.ok, clamp01((p - 0.72) / 0.06)));\n }\n return out.join("");\n}\nfunction grid(L) {\n const dots = [];\n for (let x = 32; x < L.width; x += 48) {\n for (let y = 32; y < L.height; y += 48)\n dots.push(`M${x} ${y}h1`);\n }\n return `<path d="${dots.join("")}" stroke="${C.panelEdge}" stroke-width="2" stroke-linecap="round" opacity="0.5"/>`;\n}\nfunction stepLabel(L, text, color) {\n return `<text x="${L.caption.x}" y="${L.caption.y - L.caption.size - 10}" font-size="${L.stepSize}" font-weight="600" letter-spacing="1.5" fill="${color}">${esc(text.toUpperCase())}</text>`;\n}\nfunction captionText(L, caption) {\n const { x, y } = L.caption;\n const { size, lines } = fitCaption(L, caption);\n return lines.map((line, i) => `<text x="${x}" y="${y + i * size * 1.25}" font-size="${size}" font-weight="600" fill="${C.text}">${esc(line)}</text>`).join("");\n}\nfunction fitCaption(L, caption) {\n const { width, size, minSize, maxLines } = L.caption;\n const whole = caption.split(/\\s+/).filter(Boolean).join(" ");\n for (const limit of [maxLines, maxLines + 1]) {\n for (let s = size; s >= minSize; s--) {\n const lines = wrap(caption, width, s, Infinity);\n if (lines.length <= limit && lines.join(" ") === whole)\n return { size: s, lines };\n }\n }\n return { size: minSize, lines: wrap(caption, width, minSize, maxLines + 1) };\n}\nfunction node(box, kicker, name, color, glow, opacity = 1) {\n const size = 22;\n return [\n `<g opacity="${opacity}">`,\n glow > 0 ? `<rect x="${box.x - 6}" y="${box.y - 6}" width="${box.w + 12}" height="${box.h + 12}" rx="20" fill="none" stroke="${color}" stroke-width="3" opacity="${(glow * 0.6).toFixed(3)}"/>` : "",\n `<rect x="${box.x}" y="${box.y}" width="${box.w}" height="${box.h}" rx="16" fill="${C.panel}" stroke="${color}" stroke-width="2"/>`,\n `<rect x="${box.x}" y="${box.y}" width="6" height="${box.h}" rx="3" fill="${color}"/>`,\n `<text x="${box.x + 28}" y="${box.y + box.h / 2 - 8}" font-size="13" font-weight="700" letter-spacing="2" fill="${color}">${esc(kicker)}</text>`,\n `<text x="${box.x + 28}" y="${box.y + box.h / 2 + 22}" font-size="${size}" font-weight="600" fill="${C.text}">${esc(fit(name, box.w - 48, size))}</text>`,\n `</g>`,\n ].join("");\n}\nfunction lane(L) {\n const [x1, y1] = L.lane.from;\n const [x2, y2] = L.lane.to;\n return `<line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${C.panelEdge}" stroke-width="2" stroke-dasharray="6 8"/>`;\n}\nfunction laneLabel(L, text) {\n const [x1, y1] = L.lane.from;\n const [x2] = L.lane.to;\n return `<text x="${(x1 + x2) / 2}" y="${y1 - 16}" text-anchor="middle" font-family="${esc(MONO)}" font-size="16" fill="${C.muted}">${esc(fit(text, x2 - x1 - 40, 16, true))}</text>`;\n}\nfunction packet(from, to, t, color) {\n const x = from[0] + (to[0] - from[0]) * t;\n const y = from[1] + (to[1] - from[1]) * t;\n return `<circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="18" fill="${color}" opacity="0.2"/><circle cx="${x.toFixed(1)}" cy="${y.toFixed(1)}" r="9" fill="${color}"/>`;\n}\nconst SCHEMA_KEYS = new Set(["inputSchema", "outputSchema"]);\nfunction card(L, header, color, value, note, opacity, { code, fold, form } = {}) {\n const { x, y, w, h } = L.card;\n const size = code ? L.monoSize - 2 : L.monoSize;\n const lineHeight = Math.round(size * 1.4);\n const maxLines = Math.floor((h - 64) / lineHeight);\n const maxChars = Math.floor((w - 40) / (size * 0.6));\n const out = [\n `<g opacity="${opacity.toFixed(3)}">`,\n `<rect x="${x}" y="${y}" width="${w}" height="${h}" rx="14" fill="${C.panel}" stroke="${C.panelEdge}" stroke-width="1.5"/>`,\n `<rect x="${x}" y="${y}" width="${w}" height="44" rx="14" fill="${color}" opacity="0.14"/>`,\n `<text x="${x + 20}" y="${y + 28}" font-family="${esc(MONO)}" font-size="${size}" font-weight="700" fill="${color}">${esc(fit(header, w - 40, size, true))}</text>`,\n ];\n if (note !== undefined) {\n note\n .split("\\n")\n .slice(0, maxLines)\n .forEach((line, i) => out.push(`<text x="${x + 20}" y="${y + 44 + (i + 1) * lineHeight + 4}" font-family="${esc(MONO)}" font-size="${size}" fill="${C.muted}">${esc(fit(line, w - 40, size, true))}</text>`));\n }\n else {\n const lines = code ? codeTspans(code, maxLines, maxChars) : form ? formTspans(String(value), maxLines, maxChars) : jsonLines(value, maxLines, maxChars, fold);\n lines.forEach((line, i) => out.push(`<text x="${x + 20}" y="${y + 44 + (i + 1) * lineHeight + 4}" font-family="${esc(MONO)}" font-size="${size}" xml:space="preserve">${line}</text>`));\n }\n out.push(`</g>`);\n return out.join("");\n}\nfunction badge(box, text, color, opacity) {\n const size = 15;\n const w = Math.min(box.w, textWidth(text, size, true) + 28);\n const x = box.x + box.w - w;\n const y = box.y - 40;\n return `<g opacity="${opacity.toFixed(3)}"><rect x="${x}" y="${y}" width="${w}" height="30" rx="15" fill="${color}" opacity="0.18"/><rect x="${x}" y="${y}" width="${w}" height="30" rx="15" fill="none" stroke="${color}" stroke-width="1.5"/><text x="${x + w / 2}" y="${y + 20}" text-anchor="middle" font-family="${esc(MONO)}" font-size="${size}" font-weight="700" fill="${color}">${esc(fit(text, w - 20, size, true))}</text></g>`;\n}\nfunction recoveryNote(L, text, opacity) {\n const box = L.stacked ? { x: L.card.x, y: L.client.y + L.client.h + 6 } : { x: L.client.x, y: L.client.y + L.client.h + 22 };\n const width = L.stacked ? L.card.w : L.client.w;\n const lines = wrap(`\u21BB ${text}`, width, 17, L.stacked ? 1 : 3);\n return `<g opacity="${opacity.toFixed(3)}">${lines\n .map((line, i) => `<text x="${box.x}" y="${box.y + 18 + i * 22}" font-size="17" font-weight="600" fill="${C.hook}">${esc(line)}</text>`)\n .join("")}</g>`;\n}\nfunction progressBar(L, fraction) {\n return `<rect x="0" y="${L.height - 4}" width="${L.width}" height="4" fill="${C.panelEdge}"/><rect x="0" y="${L.height - 4}" width="${(L.width * clamp01(fraction)).toFixed(1)}" height="4" fill="${C.accent}"/>`;\n}\nconst MARK = { size: 15, right: 24, bottom: 20 };\nfunction watermark(L) {\n return `<text x="${L.width - MARK.right}" y="${L.height - MARK.bottom}" text-anchor="end" font-size="${MARK.size}" font-weight="600" fill="${C.muted}" opacity="0.75">${esc(exports.WATERMARK)}</text>`;\n}\nfunction watermarkBox(aspect) {\n const L = layoutFor(aspect);\n const w = exports.WATERMARK.length * MARK.size * 0.6;\n return { x: L.width - MARK.right - w, y: L.height - MARK.bottom - MARK.size, w, h: MARK.size * 1.3 };\n}\nconst FOLDED = "\\uE000";\nfunction jsonLines(value, maxLines, maxChars, fold) {\n var _a, _b;\n let text;\n try {\n const replacer = fold ? (key, v) => (fold.has(key) && isRecord(v) ? FOLDED : v) : undefined;\n text = typeof value === "string" ? value : ((_b = (_a = JSON.stringify(value, replacer, 2)) === null || _a === void 0 ? void 0 : _a.replace(/"\\uE000"/g, "{ \u2026 }")) !== null && _b !== void 0 ? _b : "");\n }\n catch {\n text = String(value);\n }\n let lines = text.split("\\n");\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), " \u2026"];\n const xml = typeof value === "string" && /^\\s*</.test(value);\n return lines.map((raw) => {\n const line = (0, text_1.clip)(raw, maxChars);\n if (xml)\n return xmlTspans(line);\n const field = typeof value === "string" ? line.match(/^(event|data|id|retry):( ?)(.*)$/) : null;\n if (field)\n return `<tspan fill="${C.jsonKey}">${esc(field[1])}</tspan><tspan fill="${C.muted}">:${field[2]}</tspan>${colorValue(field[3])}`;\n const m = line.match(/^(\\s*)("(?:[^"\\\\]|\\\\.)*")(:\\s?)(.*)$/);\n if (!m)\n return colorValue(line);\n return `<tspan fill="${C.muted}">${esc(m[1])}</tspan><tspan fill="${C.jsonKey}">${esc(m[2])}</tspan><tspan fill="${C.muted}">${esc(m[3])}</tspan>${colorValue(m[4])}`;\n });\n}\nfunction formText(fields) {\n return Object.entries(fields)\n .map(([key, value], i) => `${i ? "&" : ""}${key}=${typeof value === "string" ? value : JSON.stringify(value)}`)\n .join("\\n");\n}\nfunction formTspans(text, maxLines, maxChars) {\n let lines = text.split("\\n");\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), "\u2026"];\n return lines.map((raw) => {\n const line = (0, text_1.clip)(raw, maxChars);\n const m = line.match(/^(&?)([^=]*)(=?)(.*)$/);\n return `<tspan fill="${C.muted}">${esc(m[1])}</tspan><tspan fill="${C.jsonKey}">${esc(m[2])}</tspan><tspan fill="${C.muted}">${esc(m[3])}</tspan><tspan fill="${C.jsonString}">${esc(m[4])}</tspan>`;\n });\n}\nconst XML_TOKEN = /(<\\/?[\\w.:-]+|\\/?>)|("[^"]*"?)|([\\w.:-]+=)/g;\nfunction xmlTspans(line) {\n const out = [];\n let last = 0;\n for (const m of line.matchAll(XML_TOKEN)) {\n if (m.index > last)\n out.push(`<tspan fill="${C.jsonString}">${esc(line.slice(last, m.index))}</tspan>`);\n const [token, tag, str] = m;\n out.push(`<tspan fill="${tag ? C.jsonKey : str ? C.jsonString : C.muted}">${esc(token)}</tspan>`);\n last = m.index + token.length;\n }\n if (last < line.length)\n out.push(`<tspan fill="${C.jsonString}">${esc(line.slice(last))}</tspan>`);\n return out.join("");\n}\nfunction codeTspans(code, maxLines, maxChars) {\n let lines = code.flatMap((line) => softWrap(line, maxChars));\n if (lines.length > maxLines)\n lines = [...lines.slice(0, Math.max(1, maxLines - 1)), " \u2026"];\n return lines.map((line) => {\n const out = [];\n let last = 0;\n for (const m of line.matchAll(CODE_TOKEN)) {\n if (m.index > last)\n out.push(`<tspan fill="${C.text}">${esc(line.slice(last, m.index))}</tspan>`);\n const [token, str, num, word] = m;\n const color = str ? (/^\\s*:/.test(line.slice(m.index + token.length)) ? C.jsonKey : C.jsonString) : num ? C.jsonOther : word ? C.key : m.index === 0 || /\\s/.test(line[m.index - 1]) ? C.client : C.text;\n out.push(`<tspan fill="${color}">${esc(token)}</tspan>`);\n last = m.index + token.length;\n }\n if (last < line.length)\n out.push(`<tspan fill="${C.text}">${esc(line.slice(last))}</tspan>`);\n return out.join("");\n });\n}\nconst CODE_TOKEN = /("(?:[^"\\\\]|\\\\.)*"?|\'(?:[^\'\\\\]|\\\\.)*\'?)|(\\b\\d+(?:\\.\\d+)?\\b)|(\\b(?:curl|await|fetch|requests|new|JSON|FormData|URLSearchParams|open|True|False|None|true|false|null)\\b)|(--?[a-zA-Z][\\w-]*)/g;\nfunction softWrap(line, max) {\n const indent = line.match(/^\\s*/)[0].length + 4;\n const out = [];\n let rest = line;\n while (rest.length > max && out.length < 40) {\n const window = rest.slice(0, max);\n const at = Math.max(window.lastIndexOf("/"), window.lastIndexOf(" "), window.lastIndexOf(","));\n const piece = at > indent ? rest.slice(0, at + 1) : (0, text_1.cut)(rest, max);\n out.push(piece);\n rest = " ".repeat(indent) + rest.slice(piece.length).trimStart();\n }\n return [...out, (0, text_1.clip)(rest, max)];\n}\nfunction colorValue(text) {\n const trimmed = text.trim();\n const color = trimmed.startsWith(\'"\') ? C.jsonString : /^[\\d\\-tfn]/.test(trimmed) ? C.jsonOther : C.muted;\n return `<tspan fill="${color}">${esc(text)}</tspan>`;\n}\nfunction textWidth(text, size, mono = false) {\n return text.length * size * (mono ? 0.6 : 0.54);\n}\nfunction fit(text, width, size, mono = false) {\n const max = Math.floor(width / (size * (mono ? 0.6 : 0.54)));\n return text.length > max ? (0, text_1.cut)(text, Math.max(1, max - 1)) + "\u2026" : text;\n}\nfunction wrap(text, width, size, maxLines) {\n const max = Math.max(8, Math.floor(width / (size * 0.54)));\n const words = text.split(/\\s+/).filter(Boolean);\n const lines = [];\n let current = "";\n for (const word of words) {\n const next = current ? `${current} ${word}` : word;\n if (next.length <= max)\n current = next;\n else {\n if (current)\n lines.push(current);\n current = (0, text_1.clip)(word, max);\n }\n }\n if (current)\n lines.push(current);\n if (lines.length > maxLines) {\n const kept = lines.slice(0, maxLines);\n kept[maxLines - 1] = fit(`${kept[maxLines - 1]} \u2026`, width, size);\n return kept;\n }\n return lines;\n}\nconst NOT_XML = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\u0000-\\u0008\\u000B\\u000C\\u000E-\\u001F\\uD800-\\uDFFF\uFFFE\uFFFF]/g;\nfunction esc(text) {\n return text\n .replace(NOT_XML, (c) => (c.length === 2 ? c : c < " " ? " " : ""))\n .replace(/&/g, "&amp;")\n .replace(/</g, "&lt;")\n .replace(/>/g, "&gt;")\n .replace(/"/g, "&quot;")\n .replace(/\'/g, "&#39;");\n}\nconst REASONS = {\n "200": "OK",\n "201": "Created",\n "202": "Accepted",\n "204": "No Content",\n "206": "Partial Content",\n "301": "Moved Permanently",\n "302": "Found",\n "303": "See Other",\n "304": "Not Modified",\n "307": "Temporary Redirect",\n "308": "Permanent Redirect",\n "400": "Bad Request",\n "401": "Unauthorized",\n "402": "Payment Required",\n "403": "Forbidden",\n "404": "Not Found",\n "405": "Method Not Allowed",\n "409": "Conflict",\n "410": "Gone",\n "412": "Precondition Failed",\n "413": "Content Too Large",\n "422": "Unprocessable",\n "429": "Too Many Requests",\n "500": "Server Error",\n "502": "Bad Gateway",\n "503": "Unavailable",\n "504": "Gateway Timeout",\n};\nfunction reason(status) {\n var _a;\n return (_a = REASONS[status]) !== null && _a !== void 0 ? _a : "";\n}\nfunction clamp01(n) {\n return Math.max(0, Math.min(1, n));\n}\nfunction ease(t) {\n const x = clamp01(t);\n return x < 0.5 ? 4 * x * x * x : 1 - Math.pow(-2 * x + 2, 3) / 2;\n}\nfunction pulse(p, a, b) {\n if (p < a || p > b)\n return 0;\n return Math.sin(((p - a) / (b - a)) * Math.PI);\n}\n\n}, {"../storyboard/timing":"lib/storyboard/timing","./code":"lib/render/code","../text":"lib/text"}],\n"lib/storyboard/timing": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.VOICE_LEAD = void 0;\nexports.activeScenes = activeScenes;\nexports.sceneDuration = sceneDuration;\nexports.totalDuration = totalDuration;\nexports.voiceCues = voiceCues;\nexports.summaryItems = summaryItems;\nexports.VOICE_LEAD = 400;\nconst VOICE_TAIL = 600;\nfunction activeScenes(sb) {\n return sb.scenes.filter((s) => sb.settings.showFailure || !s.failurePath);\n}\nfunction sceneDuration(sb, scene) {\n if (!sb.settings.voiceover || !scene.voiceMs)\n return scene.duration;\n return Math.max(scene.duration, Math.ceil(exports.VOICE_LEAD + scene.voiceMs + VOICE_TAIL));\n}\nfunction totalDuration(sb) {\n return activeScenes(sb).reduce((sum, s) => sum + sceneDuration(sb, s), 0);\n}\nfunction voiceCues(sb) {\n if (!sb.settings.voiceover)\n return [];\n const cues = [];\n let t = 0;\n for (const scene of activeScenes(sb)) {\n if (scene.voiceMs)\n cues.push({ sceneId: scene.id, at: t + exports.VOICE_LEAD });\n t += sceneDuration(sb, scene);\n }\n return cues;\n}\nfunction summaryItems(sb) {\n const items = [];\n let failure;\n for (const scene of activeScenes(sb)) {\n if (!scene.summaryLine)\n continue;\n if (scene.kind === "call" && scene.outcome === "failure") {\n failure = scene.summaryLine;\n continue;\n }\n items.push(scene.summaryLine);\n if (failure)\n items.push(failure);\n failure = undefined;\n }\n if (failure)\n items.push(failure);\n return items;\n}\n\n}, {}],\n"lib/render/code": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.CODE_STYLES = void 0;\nexports.codeRequest = codeRequest;\nexports.authCode = authCode;\nexports.callCode = callCode;\nexports.codeLines = codeLines;\nconst examples_1 = require("../oas/examples");\nconst timing_1 = require("../storyboard/timing");\nexports.CODE_STYLES = [\n { style: "curl", label: "curl" },\n { style: "javascript", label: "JavaScript" },\n { style: "python", label: "Python" },\n];\nfunction codeRequest(sb, scene) {\n var _a, _b, _c, _d;\n let url = /^[a-z][a-z\\d+.-]*:\\/\\//i.test(scene.path) ? scene.path : `${sb.api.baseUrl}${scene.path}`;\n const body = /^(GET|HEAD)$/.test(scene.method) && isEmptyValue(scene.request) ? undefined : scene.request;\n const req = { method: scene.method, url, headers: [], body, contentType: scene.requestType, ...(scene.encoding ? { encoding: scene.encoding } : {}) };\n const auth = sb.scenes.find((s) => s.kind === "auth");\n const credentials = (_a = scene.credentials) !== null && _a !== void 0 ? _a : ((auth === null || auth === void 0 ? void 0 : auth.kind) === "auth" ? ((_b = auth.credentials) !== null && _b !== void 0 ? _b : auth.headerLine.split("\\n").map(fromLine)) : []);\n const cookies = ((_c = scene.cookies) !== null && _c !== void 0 ? _c : []).map(([name, value]) => `${name}=${value}`);\n for (const credential of credentials) {\n if (!credential)\n continue;\n const c = { ...credential, value: credential.value.replace(/\u2026/g, "...") };\n if (c.in === "query")\n url += (url.includes("?") ? "&" : "?") + `${c.name}=${c.value}`;\n else if (c.in === "cookie")\n cookies.unshift(`${c.name}=${c.value}`);\n else if (c.in === "certificate")\n req.certificate = { cert: c.name, key: c.value };\n else if (c.in === "digest")\n req.digest = { username: c.name, password: c.value };\n else\n req.headers.push([c.name, c.value]);\n }\n req.headers.push(...((_d = scene.headers) !== null && _d !== void 0 ? _d : []));\n if (cookies.length)\n req.headers.push(["Cookie", cookies.join("; ")]);\n return { ...req, url };\n}\nfunction fromLine(line) {\n if (line.startsWith("?")) {\n const eq = line.indexOf("=");\n return eq > 1 ? { in: "query", name: line.slice(1, eq), value: line.slice(eq + 1) } : undefined;\n }\n const colon = line.indexOf(":");\n return colon > 0 ? { in: "header", name: line.slice(0, colon).trim(), value: line.slice(colon + 1).trim() } : undefined;\n}\nfunction bodyKind(req) {\n var _a, _b;\n const type = (_b = (_a = req.contentType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : "";\n if (req.body === undefined)\n return "none";\n if (type.includes("multipart/form-data") && isObject(req.body))\n return "multipart";\n if (type.includes("x-www-form-urlencoded") && isObject(req.body))\n return "form";\n if (typeof req.body === "string" && req.body === examples_1.BINARY_PLACEHOLDER)\n return "binary";\n if (typeof req.body === "string" && type && !/json/.test(type))\n return "text";\n return "json";\n}\nconst isFile = (value) => value === examples_1.BINARY_PLACEHOLDER;\nfunction fieldText(value) {\n return typeof value === "string" ? value : value === undefined || value === null ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);\n}\nfunction formPairs(body, encoding = {}) {\n var _a, _b, _c, _d;\n const out = [];\n for (const [name, value] of Object.entries(body)) {\n if (value === null || value === undefined)\n continue;\n const style = (_b = (_a = encoding[name]) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : "form";\n const explode = (_d = (_c = encoding[name]) === null || _c === void 0 ? void 0 : _c.explode) !== null && _d !== void 0 ? _d : style === "form";\n if (style === "deepObject" && typeof value === "object" && value !== null)\n out.push(...bracketed(name, value));\n else if (Array.isArray(value)) {\n if (explode && style === "form")\n out.push(...value.map((item) => [name, fieldText(item)]));\n else\n out.push([name, value.map(fieldText).join(style === "spaceDelimited" ? " " : style === "pipeDelimited" ? "|" : ",")]);\n }\n else if (isObject(value)) {\n if (explode)\n out.push(...Object.entries(value).map(([key, v]) => [key, fieldText(v)]));\n else\n out.push([name, Object.entries(value).flatMap(([key, v]) => [key, fieldText(v)]).join(",")]);\n }\n else\n out.push([name, fieldText(value)]);\n }\n return out;\n}\nfunction bracketed(name, value) {\n if (Array.isArray(value))\n return value.flatMap((item, i) => bracketed(`${name}[${i}]`, item));\n if (isObject(value))\n return Object.entries(value).flatMap(([key, v]) => bracketed(`${name}[${key}]`, v));\n return [[name, fieldText(value)]];\n}\nfunction formObject(body) {\n return Object.fromEntries(Object.entries(body).flatMap(([key, value]) => (value === null || value === undefined ? [] : [[key, typeof value === "boolean" ? String(value) : value]])));\n}\nfunction flat(body) {\n return Object.values(body).every((value) => typeof value !== "object" || value === null);\n}\nfunction multipartParts(body, encoding = {}) {\n var _a;\n const parts = [];\n for (const [name, value] of Object.entries(body)) {\n if (value === null || value === undefined)\n continue;\n const type = (_a = encoding[name]) === null || _a === void 0 ? void 0 : _a.contentType;\n const items = Array.isArray(value) && !value.some((v) => typeof v === "object" && v !== null) ? value : [value];\n for (const item of items) {\n if (isFile(item))\n parts.push({ name, file: true });\n else if (typeof item === "object" && item !== null)\n parts.push({ name, text: JSON.stringify(item), type: type !== null && type !== void 0 ? type : "application/json" });\n else\n parts.push({ name, text: fieldText(item), ...(type && !/^text\\/plain\\b/i.test(type) ? { type } : {}) });\n }\n }\n return parts;\n}\nfunction filePath(name) {\n return /^[\\w-]+$/.test(name) ? name : "file";\n}\nfunction isObject(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction isEmptyValue(value) {\n return value === undefined || (typeof value === "object" && value !== null && Object.keys(value).length === 0);\n}\nfunction authCode(sb, scene, style) {\n var _a, _b, _c, _d;\n const target = (_b = (_a = scene.requestLine) === null || _a === void 0 ? void 0 : _a.replace(/^POST\\s+/, "")) !== null && _b !== void 0 ? _b : "";\n const url = (_c = scene.tokenUrl) !== null && _c !== void 0 ? _c : (/^https?:\\/\\//i.test(target) ? target : `${sb.api.baseUrl}${target}`);\n return codeLines({ method: "POST", url, headers: [], body: scene.request, contentType: (_d = scene.requestType) !== null && _d !== void 0 ? _d : "application/x-www-form-urlencoded" }, style);\n}\nfunction callCode(sb, scene, style) {\n return sb.api.protocol === "mcp" ? mcpCode(sb, scene, style) : codeLines(codeRequest(sb, scene), style);\n}\nfunction codeLines(req, style) {\n switch (style) {\n case "curl":\n return curl(req);\n case "javascript":\n return javascript(req);\n default:\n return python(req);\n }\n}\nfunction curl(req) {\n var _a, _b, _c;\n const kind = bodyKind(req);\n const parts = [];\n const method = req.method === "HEAD" ? " -I" : req.method === "GET" || (req.method === "POST" && kind !== "none") ? "" : ` -X ${shellQuote(req.method)}`;\n const glob = /[[\\]{}]/.test(req.url) ? " -g" : "";\n parts.push([`curl${glob}${method} ${shellQuote(req.url, /[?&]/.test(req.url))}`]);\n if (req.certificate)\n parts.push([` --cert ${shellQuote(req.certificate.cert)} --key ${shellQuote(req.certificate.key)}`]);\n if (req.digest)\n parts.push([` --digest -u ${shellQuote(`${req.digest.username}:${req.digest.password}`, true)}`]);\n for (const [name, value] of req.headers)\n parts.push([` -H ${shellQuote(`${name}: ${value}`, true)}`]);\n const body = req.body;\n const contentType = (type) => [` -H ${shellQuote(`Content-Type: ${type}`, true)}`];\n if (kind === "json") {\n parts.push(contentType((_a = req.contentType) !== null && _a !== void 0 ? _a : "application/json"));\n parts.push(quotedData(pretty(body, "json", 2)));\n }\n else if (kind === "form" && isObject(body)) {\n for (const [key, value] of formPairs(body, req.encoding))\n parts.push([` --data-urlencode ${shellQuote(`${key}=${value}`, true)}`]);\n }\n else if (kind === "multipart" && isObject(body)) {\n for (const part of multipartParts(body, req.encoding))\n parts.push([` ${formPart(part)}`]);\n }\n else if (kind === "binary") {\n parts.push(contentType((_b = req.contentType) !== null && _b !== void 0 ? _b : "application/octet-stream"), [" --data-binary @file"]);\n }\n else if (kind === "text") {\n parts.push(contentType((_c = req.contentType) !== null && _c !== void 0 ? _c : "text/plain"), quotedData(String(body).split("\\n")));\n }\n return parts.flatMap((part, p) => part.map((line, i) => (p < parts.length - 1 && i === part.length - 1 ? `${line} \\\\` : line)));\n}\nfunction formPart(part) {\n const value = part.file ? `@${filePath(part.name)}` : part.text;\n if (part.name.includes("="))\n return `--form-string ${shellQuote(`${part.name}=${value}`, true)}`;\n if (part.file)\n return `-F ${shellQuote(`${part.name}=${value}`, true)}`;\n if (part.type) {\n const text = readsMore(value) ? `"${value.replace(/[\\\\"]/g, "\\\\$&")}"` : value;\n return `-F \'${escapeSingle(`${part.name}=${text}${formType(part.type)}`)}\'`;\n }\n return `${readsMore(value) ? "--form-string" : "-F"} ${shellQuote(`${part.name}=${value}`, true)}`;\n}\nfunction formType(type) {\n const [essence, ...params] = type.split(",")[0].split(";").map((s) => s.trim());\n if (!/^[\\w.+*-]+\\/[\\w.+*-]+$/.test(essence))\n return "";\n const kept = params.filter((p) => /^[\\w.+-]+=[^\\s"\\\\]*$/.test(p) && !/^(type|filename|headers|encoder)=/i.test(p));\n return `;type=${[essence, ...kept].join("; ")}`;\n}\nfunction readsMore(text) {\n return /^[@<"\\s]|;|\\s$/.test(text);\n}\nfunction quotedData(lines) {\n const body = lines.map(escapeSingle);\n return body.length === 1 ? [` -d \'${body[0]}\'`] : [` -d \'${body[0]}`, ...body.slice(1, -1).map((l) => ` ${l}`), ` ${body.at(-1)}\'`];\n}\nfunction shellQuote(text, always = false) {\n if (!always && !/[^\\w@%+=:,./-]/.test(text))\n return text;\n return /["\\\\$`!]/.test(text) ? `\'${escapeSingle(text)}\'` : `"${text}"`;\n}\nfunction escapeSingle(text) {\n return text.replace(/\'/g, `\'\\\\\'\'`);\n}\nfunction javascript(req) {\n var _a, _b, _c;\n const kind = bodyKind(req);\n const lines = [];\n const headers = [...req.headers];\n let body = [];\n if (req.certificate)\n lines.push(`// Sent over mutual TLS with ${req.certificate.cert} and ${req.certificate.key}`);\n if (req.digest) {\n lines.push("// Answer the API\'s Digest challenge with your username and password");\n headers.push(["Authorization", `Digest username="${req.digest.username}", nonce="...", response="..."`]);\n }\n if (kind === "json") {\n headers.push(["Content-Type", (_a = req.contentType) !== null && _a !== void 0 ? _a : "application/json"]);\n body = wrapLines("body: JSON.stringify(", pretty(req.body, "json", 2), "),");\n }\n else if (kind === "multipart" && isObject(req.body)) {\n lines.push("const form = new FormData();");\n for (const part of multipartParts(req.body, req.encoding)) {\n const value = part.file ? "file" : part.type ? `new Blob([${jsString(part.text)}], { type: ${jsString(part.type)} })` : jsString(part.text);\n lines.push(`form.append(${jsString(part.name)}, ${value});`);\n }\n body = ["body: form,"];\n }\n else if (kind === "form" && isObject(req.body)) {\n body = flat(req.body) && !req.encoding\n ? wrapLines("body: new URLSearchParams(", pretty(formObject(req.body), "json", 2), "),")\n : ["body: new URLSearchParams([", ...formPairs(req.body, req.encoding).map(([k, v]) => ` [${jsString(k)}, ${jsString(v)}],`), "]),"];\n }\n else if (kind === "binary") {\n headers.push(["Content-Type", (_b = req.contentType) !== null && _b !== void 0 ? _b : "application/octet-stream"]);\n body = ["body: file,"];\n }\n else if (kind === "text") {\n headers.push(["Content-Type", (_c = req.contentType) !== null && _c !== void 0 ? _c : "text/plain"]);\n const text = String(req.body);\n body = text.includes("\\n") ? wrapLines("body: `", text.replace(/[`\\\\]|\\$\\{/g, (m) => `\\\\${m}`).split("\\n"), "`,") : [`body: ${jsString(text)},`];\n }\n const options = [\n ...(req.method === "GET" ? [] : [`method: ${jsString(req.method)},`]),\n ...(headers.length ? ["headers: {", ...headers.map(([n, v]) => ` ${jsString(n)}: ${jsString(v)},`), "},"] : []),\n ...body,\n ];\n if (!options.length)\n return [...lines, `await fetch(${jsString(req.url)});`];\n return [...lines, `await fetch(${jsString(req.url)}, {`, ...options.map((l) => ` ${l}`), "});"];\n}\nfunction jsString(text) {\n return JSON.stringify(text);\n}\nconst PYTHON_METHODS = new Set(["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]);\nfunction python(req) {\n var _a, _b;\n const kind = bodyKind(req);\n const args = [[`${jsString(req.url)},`]];\n const headers = [...req.headers];\n if (kind === "binary")\n headers.push(["Content-Type", (_a = req.contentType) !== null && _a !== void 0 ? _a : "application/octet-stream"]);\n if (kind === "text")\n headers.push(["Content-Type", (_b = req.contentType) !== null && _b !== void 0 ? _b : "text/plain"]);\n if (headers.length === 1)\n args.push([`headers={${jsString(headers[0][0])}: ${jsString(headers[0][1])}},`]);\n else if (headers.length)\n args.push(["headers={", ...headers.map(([n, v]) => ` ${jsString(n)}: ${jsString(v)},`), "},"]);\n if (req.certificate)\n args.push([`cert=(${jsString(req.certificate.cert)}, ${jsString(req.certificate.key)}),`]);\n if (req.digest)\n args.push([`auth=requests.auth.HTTPDigestAuth(${jsString(req.digest.username)}, ${jsString(req.digest.password)}),`]);\n if (kind === "json")\n args.push(wrapLines("json=", pretty(req.body, "python", 4), ","));\n else if (kind === "form" && isObject(req.body)) {\n if (flat(req.body) && !req.encoding)\n args.push(wrapLines("data=", pretty(formObject(req.body), "python", 4), ","));\n else\n args.push(["data=[", ...formPairs(req.body, req.encoding).map(([k, v]) => ` (${jsString(k)}, ${jsString(v)}),`), "],"]);\n }\n else if (kind === "multipart" && isObject(req.body)) {\n const parts = multipartParts(req.body, req.encoding);\n const typed = parts.filter((p) => p.file || p.type);\n const files = typed.length ? typed : parts;\n const fields = typed.length ? parts.filter((p) => !p.file && !p.type) : [];\n const file = (p) => (p.file ? `open(${jsString(filePath(p.name))}, "rb")` : p.type ? `(None, ${jsString(p.text)}, ${jsString(p.type)})` : `(None, ${jsString(p.text)})`);\n const twice = (list) => new Set(list.map((p) => p.name)).size < list.length;\n if (files.length) {\n args.push(twice(files) ? ["files=[", ...files.map((p) => ` (${jsString(p.name)}, ${file(p)}),`), "],"] : ["files={", ...files.map((p) => ` ${jsString(p.name)}: ${file(p)},`), "},"]);\n }\n if (fields.length) {\n args.push(twice(fields) ? ["data=[", ...fields.map((p) => ` (${jsString(p.name)}, ${jsString(p.text)}),`), "],"] : ["data={", ...fields.map((p) => ` ${jsString(p.name)}: ${jsString(p.text)},`), "},"]);\n }\n }\n else if (kind === "binary")\n args.push([`data=open("file", "rb"),`]);\n else if (kind === "text") {\n const text = String(req.body);\n args.push(text.includes("\\n") ? wrapLines(\'data="""\', text.replace(/\\\\/g, "\\\\\\\\").replace(/"""/g, \'\\\\"\\\\"\\\\"\').split("\\n"), \'""",\') : [`data=${jsString(text)},`]);\n }\n const call = PYTHON_METHODS.has(req.method) ? `requests.${req.method.toLowerCase()}(` : `requests.request(${jsString(req.method)},`;\n return [call, ...args.flat().map((l) => ` ${l}`), ")"];\n}\nconst MCP_VERSION = "2026-07-28";\nconst VERSION_HEADER_SINCE = "2025-06-18";\nconst SESSION_ID = "1868a90c...";\nconst CLIENT_INFO = { name: "your-agent", version: "1.0.0" };\nfunction mcpCode(sb, scene, style) {\n const http = /^https?:\\/\\//i.test(sb.api.baseUrl);\n const auth = sb.scenes.some((s) => s.kind === "auth");\n switch (style) {\n case "curl":\n return mcpWire(sb, scene, http);\n case "javascript":\n return mcpJavaScript(sb, scene, http, auth);\n default:\n return mcpPython(sb, scene, http, auth);\n }\n}\nfunction rpcBody(sb, scene, modern) {\n var _a;\n const meta = { "io.modelcontextprotocol/protocolVersion": MCP_VERSION, "io.modelcontextprotocol/clientInfo": CLIENT_INFO, "io.modelcontextprotocol/clientCapabilities": {} };\n const params = scene.method === "tools/call"\n ? { name: scene.path, arguments: (_a = scene.request) !== null && _a !== void 0 ? _a : {} }\n : scene.method === "resources/read"\n ? { uri: scene.path }\n : scene.method === "prompts/get"\n ? { name: scene.path, ...(scene.request !== undefined ? { arguments: scene.request } : {}) }\n : {};\n if (!modern)\n return { jsonrpc: "2.0", id: rpcId(sb, scene), method: scene.method, ...(Object.keys(params).length ? { params } : {}) };\n return { jsonrpc: "2.0", id: rpcId(sb, scene), method: scene.method, params: { ...params, _meta: meta } };\n}\nfunction rpcId(sb, scene) {\n const index = (0, timing_1.activeScenes)(sb)\n .filter((s) => s.kind === "call")\n .indexOf(scene);\n return index >= 0 ? index + 1 : scene.step;\n}\nfunction mcpWire(sb, scene, http) {\n var _a, _b, _c;\n const revision = (_a = sb.api.revision) !== null && _a !== void 0 ? _a : MCP_VERSION;\n const modern = revision >= MCP_VERSION;\n const body = JSON.stringify(rpcBody(sb, scene, modern));\n if (!http) {\n if (modern)\n return [`echo \'${escapeSingle(body)}\' \\\\`, ` | ${sb.api.baseUrl}`];\n const init = JSON.stringify({ jsonrpc: "2.0", id: 0, method: "initialize", params: { protocolVersion: revision, capabilities: {}, clientInfo: CLIENT_INFO } });\n return [`printf \'%s\\\\n\' \\\\`, ` \'${escapeSingle(init)}\' \\\\`, ` \'{"jsonrpc":"2.0","method":"notifications/initialized"}\' \\\\`, ` \'${escapeSingle(body)}\' \\\\`, ` | ${sb.api.baseUrl}`];\n }\n const headers = [["Accept", "application/json, text/event-stream"]];\n if (modern) {\n headers.push(["MCP-Protocol-Version", MCP_VERSION], ["Mcp-Method", scene.method]);\n if (scene.method !== "tools/list")\n headers.push(["Mcp-Name", headerValue(scene.path)]);\n for (const { name, path } of (_b = scene.paramHeaders) !== null && _b !== void 0 ? _b : []) {\n const value = path.reduce((at, key) => (isObject(at) ? at[key] : undefined), scene.request);\n if (typeof value === "string" || typeof value === "boolean" || (typeof value === "number" && Number.isSafeInteger(value)))\n headers.push([`Mcp-Param-${name}`, headerValue(String(value))]);\n }\n }\n else {\n if (revision >= VERSION_HEADER_SINCE)\n headers.push(["MCP-Protocol-Version", revision]);\n if (sb.api.session !== false)\n headers.push(["Mcp-Session-Id", SESSION_ID]);\n }\n const auth = sb.scenes.find((s) => s.kind === "auth");\n if ((auth === null || auth === void 0 ? void 0 : auth.kind) === "auth")\n for (const c of (_c = auth.credentials) !== null && _c !== void 0 ? _c : [])\n if (c.in === "header")\n headers.push([c.name, c.value.replace(/\u2026/g, "...")]);\n return [`curl ${shellQuote(sb.api.baseUrl)} \\\\`, ...headers.map(([n, v]) => ` -H ${shellQuote(`${n}: ${v}`, true)} \\\\`), ` --json \'${escapeSingle(body)}\'`];\n}\nfunction headerValue(text) {\n const plain = /^[\\x21-\\x7e]([\\x20-\\x7e\\t]*[\\x21-\\x7e])?$/.test(text) && !/^=\\?base64\\?.*\\?=$/.test(text);\n if (plain)\n return text;\n const bytes = new TextEncoder().encode(text);\n let binary = "";\n for (const byte of bytes)\n binary += String.fromCharCode(byte);\n return `=?base64?${btoa(binary)}?=`;\n}\nfunction mcpJavaScript(sb, scene, http, auth) {\n var _a, _b, _c;\n switch (scene.method) {\n case "tools/list": {\n const command = sb.api.baseUrl.split(" ");\n const transport = http\n ? [` new StreamableHTTPClientTransport(new URL(${jsString(sb.api.baseUrl)})${auth ? ", { authProvider }" : ""}),`]\n : [` new StdioClientTransport({ command: ${jsString(command[0])}, args: ${list(command.slice(1))} }),`];\n const negotiate = ((_a = sb.api.revision) !== null && _a !== void 0 ? _a : MCP_VERSION) >= MCP_VERSION ? `, { versionNegotiation: { mode: "auto" } }` : "";\n return [\n `import { Client${http ? ", StreamableHTTPClientTransport" : ""} } from "@modelcontextprotocol/client";`,\n ...(http ? [] : [`import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";`]),\n "",\n `const client = new Client({ name: "your-agent", version: "1.0.0" }${negotiate});`,\n "await client.connect(",\n ...transport,\n ");",\n "const { tools } = await client.listTools();",\n ];\n }\n case "resources/read":\n return [`const { contents } = await client.readResource({ uri: ${jsString(scene.path)} });`];\n case "prompts/get":\n return ["const { messages } = await client.getPrompt({", ` name: ${jsString(scene.path)},`, ...indented(" ", wrapLines("arguments: ", pretty((_b = scene.request) !== null && _b !== void 0 ? _b : {}, "json", 2), ",")), "});"];\n default:\n return ["const result = await client.callTool({", ` name: ${jsString(scene.path)},`, ...indented(" ", wrapLines("arguments: ", pretty((_c = scene.request) !== null && _c !== void 0 ? _c : {}, "json", 2), ",")), "});"];\n }\n}\nfunction mcpPython(sb, scene, http, auth) {\n var _a, _b;\n switch (scene.method) {\n case "tools/list": {\n if (http && auth) {\n return [\n "import httpx2",\n "from mcp import Client",\n "from mcp.client.streamable_http import streamable_http_client",\n "",\n "http = httpx2.AsyncClient(auth=oauth) # an OAuthClientProvider",\n `async with Client(streamable_http_client(${jsString(sb.api.baseUrl)}, http_client=http)) as client:`,\n " result = await client.list_tools()",\n ];\n }\n if (http)\n return ["from mcp import Client", "", `async with Client(${jsString(sb.api.baseUrl)}) as client:`, " result = await client.list_tools()"];\n const [command, ...args] = sb.api.baseUrl.split(" ");\n return [\n "from mcp import Client, StdioServerParameters",\n "",\n `server = StdioServerParameters(command=${jsString(command)}, args=${list(args)})`,\n "async with Client(server) as client:",\n " result = await client.list_tools()",\n ];\n }\n case "resources/read":\n return [`result = await client.read_resource(${jsString(scene.path)})`];\n case "prompts/get":\n return ["result = await client.get_prompt(", ` ${jsString(scene.path)},`, ...indented(" ", wrapLines("", pretty((_a = scene.request) !== null && _a !== void 0 ? _a : {}, "python", 4), ",")), ")"];\n default:\n return ["result = await client.call_tool(", ` ${jsString(scene.path)},`, ...indented(" ", wrapLines("", pretty((_b = scene.request) !== null && _b !== void 0 ? _b : {}, "python", 4), ",")), ")"];\n }\n}\nfunction list(items) {\n return `[${items.map(jsString).join(", ")}]`;\n}\nfunction indented(indent, lines) {\n return lines.map((line) => `${indent}${line}`);\n}\nfunction wrapLines(head, lines, tail) {\n if (lines.length === 1)\n return [`${head}${lines[0]}${tail}`];\n return [`${head}${lines[0]}`, ...lines.slice(1, -1), `${lines.at(-1)}${tail}`];\n}\nfunction pretty(value, as, indent) {\n var _a;\n const text = (_a = JSON.stringify(value, null, indent)) !== null && _a !== void 0 ? _a : "null";\n if (as === "json")\n return text.split("\\n");\n return text.split("\\n").map((line) => line.replace(/("(?:[^"\\\\]|\\\\.)*")|\\b(true|false|null)\\b/g, (_, str, word) => str !== null && str !== void 0 ? str : { true: "True", false: "False", null: "None" }[word]));\n}\n\n}, {"../oas/examples":"lib/oas/examples","../storyboard/timing":"lib/storyboard/timing"}],\n"lib/oas/examples": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.PLACEHOLDER_UUID = exports.BINARY_PLACEHOLDER = void 0;\nexports.mediaKind = mediaKind;\nexports.isTextKind = isTextKind;\nexports.exampleForMedia = exampleForMedia;\nexports.toXml = toXml;\nexports.exampleForParameter = exampleForParameter;\nexports.exampleFromSchema = exampleFromSchema;\nexports.conform = conform;\nexports.placeholder = placeholder;\nexports.isPlaceholder = isPlaceholder;\nexports.patternExample = patternExample;\nexports.isIdName = isIdName;\nexports.idLike = idLike;\nexports.uuidLike = uuidLike;\nexports.singular = singular;\nconst fit_1 = require("./fit");\nexports.BINARY_PLACEHOLDER = "<binary data>";\nconst BINARY_MEDIA = /octet-stream|^(image|audio|video|font)\\/|application\\/(pdf|zip|gzip|x-tar)/i;\nfunction mediaKind(contentType) {\n const type = contentType.toLowerCase().split(";")[0].trim();\n if (/^application\\/(x-)?(ndjson|jsonl|jsonlines|json-lines)$|json-seq$/.test(type))\n return "sequence";\n if (/json/.test(type))\n return "json";\n if (type === "application/x-www-form-urlencoded")\n return "form";\n if (type.startsWith("multipart/"))\n return "multipart";\n if (/[/+]xml$/.test(type))\n return "xml";\n if (type === "text/event-stream")\n return "events";\n if (BINARY_MEDIA.test(type))\n return "binary";\n if (type.startsWith("text/") || /^application\\/(x-)?(yaml|csv|graphql|javascript|sql)$/.test(type))\n return "text";\n return "json";\n}\nfunction isTextKind(kind) {\n return kind === "xml" || kind === "sequence" || kind === "events" || kind === "text";\n}\nfunction exampleForMedia(media, mode = "response", contentType = "", subject) {\n if (!media)\n return { value: undefined, generated: false };\n const kind = mediaKind(contentType);\n const given = documentedExample(media, kind);\n if (given !== undefined && !isTextKind(kind) && media.schema && otherShape(given, media.schema)) {\n return { value: conform(exampleFromSchema(media.schema, "", 0, mode, undefined, subject), media.schema, mode, "", 0, undefined, subject), generated: true };\n }\n if (given !== undefined) {\n if (!isTextKind(kind) && kind !== "binary" && media.schema) {\n const fixed = conform(given, media.schema, mode, "", 0, undefined, subject);\n return { value: fixed, generated: fixed !== given };\n }\n return { value: serialize(given, kind, media, contentType), generated: false };\n }\n if (BINARY_MEDIA.test(contentType) && (!media.schema || media.schema.type === "string" || media.schema.format === "binary")) {\n return { value: exports.BINARY_PLACEHOLDER, generated: true };\n }\n if (isTextKind(kind) && (media.schema || media.itemSchema))\n return { value: textFromSchema(media, kind, mode, contentType), generated: true };\n if (media.schema)\n return { value: conform(exampleFromSchema(media.schema, "", 0, mode, undefined, subject), media.schema, mode, "", 0, undefined, subject), generated: true };\n return { value: undefined, generated: false };\n}\nfunction otherShape(example, schema) {\n if (!isRecord(example) || !Object.keys(example).length)\n return false;\n const names = new Set();\n const patterns = [];\n let open = false;\n const collect = (s, depth) => {\n var _a, _b, _c, _d, _e;\n if (!s || typeof s !== "object" || depth > 6)\n return;\n const target = (0, fit_1.circularTarget)(s);\n if (target)\n return collect(target, depth + 1);\n for (const key of Object.keys((_a = s.properties) !== null && _a !== void 0 ? _a : {}))\n names.add(key);\n patterns.push(...Object.keys((_b = s.patternProperties) !== null && _b !== void 0 ? _b : {}));\n if (isRecord(s.additionalProperties))\n open = true;\n for (const part of [...((_c = s.allOf) !== null && _c !== void 0 ? _c : []), ...((_d = s.oneOf) !== null && _d !== void 0 ? _d : []), ...((_e = s.anyOf) !== null && _e !== void 0 ? _e : [])])\n collect(part, depth + 1);\n };\n collect(schema, 0);\n if (!names.size || open)\n return false;\n return !Object.keys(example).some((key) => names.has(key) || patterns.some((pattern) => (0, fit_1.matchesPattern)(pattern, key)));\n}\nfunction documentedExample(media, kind) {\n var _a;\n if (media.example !== undefined)\n return media.example;\n for (const example of Object.values((_a = media.examples) !== null && _a !== void 0 ? _a : {})) {\n const value = exampleValue(example, isTextKind(kind));\n if (value !== undefined)\n return kind === "json" && (example === null || example === void 0 ? void 0 : example.dataValue) === undefined && (example === null || example === void 0 ? void 0 : example.value) === undefined ? parseJsonText(value) : value;\n }\n return undefined;\n}\nfunction exampleValue(example, text) {\n if (!example || typeof example !== "object")\n return undefined;\n const serialized = typeof example.serializedValue === "string" ? example.serializedValue : undefined;\n if (text && serialized !== undefined)\n return serialized;\n if (example.dataValue !== undefined)\n return example.dataValue;\n return example.value !== undefined ? example.value : serialized;\n}\nfunction parseJsonText(value) {\n if (typeof value !== "string")\n return value;\n try {\n return JSON.parse(value);\n }\n catch {\n return value;\n }\n}\nfunction serialize(value, kind, media, contentType) {\n if (!isTextKind(kind) || typeof value === "string")\n return value;\n switch (kind) {\n case "xml":\n return toXml(value, media.schema);\n case "sequence":\n return (Array.isArray(value) ? value : [value]).map((item) => JSON.stringify(item)).join("\\n");\n case "events":\n return (Array.isArray(value) ? value : [value]).map((event) => toEvent(event, media.itemSchema)).join("\\n\\n");\n default:\n return toText(value, contentType);\n }\n}\nfunction textFromSchema(media, kind, mode, contentType) {\n var _a, _b;\n const schema = (_a = media.schema) !== null && _a !== void 0 ? _a : {};\n const made = (s) => conform(exampleFromSchema(s, "", 0, mode), s, mode);\n if (kind === "xml")\n return toXml(made(schema), schema);\n if (kind === "sequence" || kind === "events") {\n const item = (_b = media.itemSchema) !== null && _b !== void 0 ? _b : (schema.items && (schema.type === "array" || Array.isArray(schema.type)) ? schema.items : schema);\n const value = made(item);\n return kind === "sequence" ? JSON.stringify(value) : toEvent(value, item);\n }\n return toText(made(schema), contentType);\n}\nfunction toEvent(value, schema) {\n var _a, _b, _c;\n const fields = isRecord(value) && "data" in value ? value : { data: value };\n const lines = [];\n for (const key of ["event", "id", "retry"])\n if (fields[key] !== undefined && fields[key] !== null)\n lines.push(`${key}: ${String(fields[key])}`);\n let data = fields.data;\n const dataSchema = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a.data;\n if (typeof data === "string" && (dataSchema === null || dataSchema === void 0 ? void 0 : dataSchema.contentSchema) && /json/i.test((_b = dataSchema.contentMediaType) !== null && _b !== void 0 ? _b : "json"))\n data = exampleFromSchema(dataSchema.contentSchema, "data");\n for (const line of (typeof data === "string" ? data : (_c = JSON.stringify(data)) !== null && _c !== void 0 ? _c : "").split("\\n"))\n lines.push(`data: ${line}`);\n return lines.join("\\n");\n}\nfunction toText(value, contentType) {\n if (typeof value === "string")\n return value;\n if (/csv/i.test(contentType) && Array.isArray(value) && value.every(isRecord)) {\n const columns = [...new Set(value.flatMap((row) => Object.keys(row)))];\n const cell = (v) => (/[",\\n]/.test(String(v !== null && v !== void 0 ? v : "")) ? `"${String(v).replace(/"/g, \'""\')}"` : String(v !== null && v !== void 0 ? v : ""));\n return [columns.join(","), ...value.map((row) => columns.map((c) => cell(row[c])).join(","))].join("\\n");\n }\n return typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value);\n}\nfunction toXml(value, schema, name) {\n var _a, _b, _c, _d, _e, _f, _g;\n const lines = [];\n const rootName = (_d = (_c = (_b = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : name) !== null && _c !== void 0 ? _c : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _d !== void 0 ? _d : (Array.isArray(value) ? "items" : "data");\n if (Array.isArray(value)) {\n const items = schema === null || schema === void 0 ? void 0 : schema.items;\n const itemName = (_g = (_f = (_e = items === null || items === void 0 ? void 0 : items.xml) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : items === null || items === void 0 ? void 0 : items.title) !== null && _g !== void 0 ? _g : singular(rootName);\n lines.push(`<${xmlName(rootName, schema)}${namespaceAttr(schema)}>`);\n for (const item of value)\n writeXml(lines, itemName, item, items, 1);\n lines.push(`</${xmlName(rootName, schema)}>`);\n }\n else {\n writeXml(lines, rootName, value, schema, 0, true);\n }\n return lines.join("\\n");\n}\nfunction writeXml(lines, name, value, schema, depth, root = false) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j;\n const pad = " ".repeat(depth);\n const xml = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) !== null && _a !== void 0 ? _a : {};\n const qname = xmlName((_b = xml.name) !== null && _b !== void 0 ? _b : name, schema);\n if (Array.isArray(value)) {\n const items = schema === null || schema === void 0 ? void 0 : schema.items;\n const itemName = (_d = (_c = items === null || items === void 0 ? void 0 : items.xml) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : name;\n if (xml.nodeType === "element" || xml.wrapped === true) {\n lines.push(`${pad}<${qname}${namespaceAttr(schema)}>`);\n for (const item of value)\n writeXml(lines, itemName, item, items, depth + 1);\n lines.push(`${pad}</${qname}>`);\n }\n else {\n for (const item of value)\n writeXml(lines, itemName, item, items, depth);\n }\n return;\n }\n if (value === null || value === undefined) {\n lines.push(`${pad}<${qname} xsi:nil="true"/>`);\n return;\n }\n if (!isRecord(value)) {\n lines.push(`${pad}<${qname}${root ? namespaceAttr(schema) : ""}>${escapeXml(String(value))}</${qname}>`);\n return;\n }\n const properties = propertiesOf(schema);\n const attributes = [];\n const children = [];\n let text;\n for (const [key, child] of Object.entries(value)) {\n const prop = properties[key];\n const nodeType = (_f = (_e = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _e === void 0 ? void 0 : _e.nodeType) !== null && _f !== void 0 ? _f : (((_g = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _g === void 0 ? void 0 : _g.attribute) ? "attribute" : undefined);\n if (nodeType === "attribute") {\n if (child !== null && child !== undefined)\n attributes.push(` ${xmlName((_j = (_h = prop === null || prop === void 0 ? void 0 : prop.xml) === null || _h === void 0 ? void 0 : _h.name) !== null && _j !== void 0 ? _j : key, prop)}="${escapeXml(String(child), true)}"`);\n }\n else if (nodeType === "text" || nodeType === "cdata") {\n text = nodeType === "cdata" ? `<![CDATA[${String(child)}]]>` : escapeXml(String(child));\n }\n else {\n children.push([key, child, prop]);\n }\n }\n const open = `${pad}<${qname}${namespaceAttr(schema)}${attributes.join("")}`;\n if (!children.length) {\n lines.push(text === undefined ? `${open}/>` : `${open}>${text}</${qname}>`);\n return;\n }\n lines.push(`${open}>${text !== null && text !== void 0 ? text : ""}`);\n for (const [key, child, prop] of children)\n writeXml(lines, key, child, prop, depth + 1);\n lines.push(`${pad}</${qname}>`);\n}\nfunction propertiesOf(schema, depth = 0) {\n var _a, _b;\n if (!schema || depth > 4)\n return {};\n const out = {};\n for (const part of (_a = schema.allOf) !== null && _a !== void 0 ? _a : [])\n Object.assign(out, propertiesOf(part, depth + 1));\n return Object.assign(out, (_b = schema.properties) !== null && _b !== void 0 ? _b : {});\n}\nfunction xmlName(name, schema) {\n var _a;\n let clean = name.replace(/[^\\w.:-]/g, "_");\n if (!/^[A-Za-z_]/.test(clean))\n clean = `_${clean}`;\n const prefix = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.prefix;\n return prefix && !clean.includes(":") ? `${prefix}:${clean}` : clean;\n}\nfunction namespaceAttr(schema) {\n var _a, _b;\n const ns = (_a = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _a === void 0 ? void 0 : _a.namespace;\n if (!ns)\n return "";\n return ` xmlns${((_b = schema === null || schema === void 0 ? void 0 : schema.xml) === null || _b === void 0 ? void 0 : _b.prefix) ? `:${schema.xml.prefix}` : ""}="${escapeXml(ns, true)}"`;\n}\nfunction escapeXml(text, attribute = false) {\n if (isPlaceholder(text))\n return `{${text.slice(1, -1)}}`;\n const out = text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");\n return attribute ? out.replace(/"/g, "&quot;") : out;\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction exampleForParameter(param) {\n var _a;\n const typed = (value) => (value === undefined || !param.schema ? value : asType(value, param.schema));\n const given = typed(param.example);\n if (given !== undefined)\n return given;\n for (const example of Object.values((_a = param.examples) !== null && _a !== void 0 ? _a : {})) {\n const value = typed(exampleValue(example, false));\n if (value !== undefined)\n return value;\n }\n const content = param.content && Object.entries(param.content)[0];\n if (content)\n return exampleForMedia(content[1], "request", content[0]).value;\n if (param.schema)\n return exampleFromSchema(param.schema, param.name);\n return idLike(param.name);\n}\nconst MAX_DEPTH = 4;\nconst HARD_DEPTH = 12;\nconst MAX_PROPERTIES = 12;\nconst NODE_BUDGET = 250;\nconst MAX_LIST = 20;\nconst MAX_TRIES = 6;\nfunction exampleFromSchema(schema, name = "", depth = 0, mode = "response", budget = { left: NODE_BUDGET }, owner) {\n var _a;\n if (!schema || typeof schema !== "object")\n return null;\n budget.left--;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return depth >= HARD_DEPTH ? {} : exampleFromSchema(target, name, Math.max(depth + 1, MAX_DEPTH), mode, budget, owner);\n if (schema["x-circular"])\n return depth > 1 ? null : { id: idLike((_a = schema.title) !== null && _a !== void 0 ? _a : name) };\n for (const example of [schema.example, ...(Array.isArray(schema.examples) ? schema.examples.slice(0, 1) : [])]) {\n const value = example === undefined ? undefined : asType(example, schema);\n if (value !== undefined)\n return fitted(value, schema, name, depth, mode, budget, owner);\n }\n if (schema.const !== undefined)\n return schema.const;\n const fallback = schema.default === undefined ? undefined : asType(schema.default, schema);\n if (fallback !== undefined)\n return fitted(fallback, schema, name, depth, mode, budget, owner);\n return fromSchema(schema, name, depth, mode, budget, owner);\n}\nfunction fromSchema(schema, name, depth, mode, budget, owner) {\n var _a, _b;\n if (Array.isArray(schema.enum) && schema.enum.length)\n return enumValue(schema.enum, schema.description);\n if ((_a = schema.allOf) === null || _a === void 0 ? void 0 : _a.length)\n return fromParts(schema, name, depth, mode, budget, owner);\n const variants = ((_b = schema.oneOf) === null || _b === void 0 ? void 0 : _b.length) ? schema.oneOf : schema.anyOf;\n if (variants === null || variants === void 0 ? void 0 : variants.length)\n return fromVariant(schema, variants, name, depth, mode, budget, owner);\n const type = Array.isArray(schema.type) ? schema.type.find((t) => t !== "null") : schema.type;\n const inferred = type !== null && type !== void 0 ? type : (schema.properties ? "object" : schema.items || schema.prefixItems ? "array" : undefined);\n switch (inferred) {\n case "object":\n return objectFor(schema, depth, mode, budget, owner);\n case "array":\n return listFor(schema, name, depth, mode, budget, owner);\n case "integer":\n case "number":\n return numberFor(schema, name, inferred === "integer");\n case "boolean":\n return booleanFor(name);\n case "string":\n return stringFor(schema, name, owner);\n default:\n return null;\n }\n}\nfunction objectFor(schema, depth, mode, budget, owner) {\n var _a, _b;\n const out = {};\n if (depth >= HARD_DEPTH)\n return out;\n const required = new Set(Array.isArray(schema.required) ? schema.required : []);\n let props = Object.entries((_a = schema.properties) !== null && _a !== void 0 ? _a : {}).filter(([, prop]) => !(mode === "request" ? prop === null || prop === void 0 ? void 0 : prop.readOnly : prop === null || prop === void 0 ? void 0 : prop.writeOnly));\n props = props.filter(([key, prop]) => required.has(key) || (prop === null || prop === void 0 ? void 0 : prop.deprecated) !== true);\n const answer = mode === "response" && !budget.full;\n if (answer)\n props = props.filter(([key, prop]) => required.has(key) || ((ID_FIELDS.has(key) || saysSomething(prop)) && !brokenExample(prop, mode)));\n if (depth >= MAX_DEPTH)\n props = props.filter(([key]) => required.has(key));\n props.sort(([a], [b]) => Number(required.has(b)) - Number(required.has(a)));\n if (mode === "request")\n props = telling(props, required);\n for (const [key, prop] of props) {\n if (!required.has(key) && (budget.left <= 0 || Object.keys(out).length >= MAX_PROPERTIES))\n continue;\n if (!required.has(key) && recursive(prop))\n continue;\n const value = fieldValue(prop, key, depth + 1, mode, budget, (_b = schema.title) !== null && _b !== void 0 ? _b : owner);\n if (!required.has(key) && (value === null || (mode === "request" && isEmpty(value))))\n continue;\n out[key] = value;\n }\n return out;\n}\nfunction fieldValue(prop, key, depth, mode, budget, owner) {\n if (mode === "response" && !budget.full && allowsNull(prop) && (!givesValue(prop) || brokenExample(prop, mode)))\n return null;\n return exampleFromSchema(prop, key, depth, mode, budget, owner);\n}\nfunction brokenExample(prop, mode) {\n if (!prop || typeof prop !== "object" || prop.example === undefined || prop.example === null)\n return false;\n if ((0, fit_1.fits)(prop.example, prop, mode))\n return false;\n const typed = asType(prop.example, prop);\n if (typed === undefined)\n return true;\n const plain = (v) => v === null || typeof v !== "object";\n return (plain(typed) || (Array.isArray(typed) && typed.every(plain))) && !(0, fit_1.fits)(typed, prop, mode);\n}\nfunction recursive(schema) {\n const own = (s) => isRecord(s) && s["x-circular"] !== undefined;\n return own(schema) || (isRecord(schema) && own(schema.items));\n}\nconst ID_FIELDS = new Set(["id", "sid", "gid", "uuid"]);\nfunction givesValue(schema, depth = 0) {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > 4)\n return false;\n if (schema.example !== undefined || (Array.isArray(schema.examples) && schema.examples.length > 0) || schema.default !== undefined || schema.const !== undefined)\n return true;\n if (Array.isArray(schema.enum) && schema.enum.filter((v) => v !== null).length === 1 && !allowsNull(schema))\n return true;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return givesValue(target, depth + 1);\n const parts = [...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []), ...((_b = schema.oneOf) !== null && _b !== void 0 ? _b : []), ...((_c = schema.anyOf) !== null && _c !== void 0 ? _c : [])];\n return parts.some((part) => part && typeof part === "object" && part.type !== "null" && givesValue(part, depth + 1));\n}\nconst saying = new WeakMap();\nfunction saysSomething(schema, depth = 0) {\n var _a, _b, _c, _d, _e, _f;\n if (!schema || typeof schema !== "object" || depth > 1)\n return false;\n const found = (_a = saying.get(schema)) !== null && _a !== void 0 ? _a : [];\n if (found[depth] !== undefined)\n return found[depth];\n found[depth] = false;\n saying.set(schema, found);\n const target = (0, fit_1.circularTarget)(schema);\n const parts = [...((_b = schema.allOf) !== null && _b !== void 0 ? _b : []), ...((_c = schema.oneOf) !== null && _c !== void 0 ? _c : []), ...((_d = schema.anyOf) !== null && _d !== void 0 ? _d : []), ...(target ? [target] : [])];\n const inside = [...Object.values((_e = schema.properties) !== null && _e !== void 0 ? _e : {}), ...(schema.items && typeof schema.items === "object" ? [schema.items] : []), ...((_f = schema.prefixItems) !== null && _f !== void 0 ? _f : [])];\n const usable = (part) => part && typeof part === "object" && part.type !== "null";\n const own = depth === 0 ? givesValue(schema) : schema.example !== undefined || (Array.isArray(schema.examples) && schema.examples.length > 0);\n const says = own || parts.some((part) => usable(part) && saysSomething(part, depth)) || inside.some((part) => usable(part) && saysSomething(part, depth + 1));\n found[depth] = says;\n return says;\n}\nfunction allowsNull(schema) {\n var _a, _b;\n if (!schema || typeof schema !== "object")\n return false;\n if (schema.nullable === true || (Array.isArray(schema.type) && schema.type.includes("null")) || schema.type === "null")\n return true;\n if (Array.isArray(schema.enum) && schema.enum.includes(null))\n return true;\n const variants = [...((_a = schema.oneOf) !== null && _a !== void 0 ? _a : []), ...((_b = schema.anyOf) !== null && _b !== void 0 ? _b : [])];\n const isNull = (v) => v.type === "null" || (Array.isArray(v.type) && v.type.length === 1 && v.type[0] === "null") || (Array.isArray(v.enum) && v.enum.length === 1 && v.enum[0] === null);\n return variants.some((v) => v && typeof v === "object" && isNull(v));\n}\nfunction listFor(schema, name, depth, mode, budget, owner) {\n var _a;\n const least = Math.min(Math.max(0, typeof schema.minItems === "number" ? schema.minItems : 0), MAX_LIST);\n const most = typeof schema.maxItems === "number" ? Math.max(0, schema.maxItems) : Infinity;\n if (most === 0)\n return [];\n if ((depth >= MAX_DEPTH || budget.left <= 0) && least === 0)\n return [];\n const itemName = singular(name);\n const itemOwner = itemName && !CONTAINERS.test(itemName) ? itemName : owner;\n const prefix = ((_a = schema.prefixItems) !== null && _a !== void 0 ? _a : []).slice(0, most);\n const out = prefix.map((item) => exampleFromSchema(item, itemName, depth + 1, mode, budget, itemOwner));\n const items = isRecord(schema.items) ? schema.items : undefined;\n const answer = mode === "response" && !budget.full;\n const shows = !answer || depth === 0 || (depth === 1 && CONTAINERS.test(name)) || saysSomething(items);\n const want = Math.min(most, Math.max(least, prefix.length ? prefix.length : items && shows ? 1 : 0));\n while (out.length < want) {\n if (!items) {\n out.push(null);\n continue;\n }\n const value = exampleFromSchema(items, itemName, depth + 1, mode, budget, itemOwner);\n if (answer && out.length >= least && isRecord(value) && !Object.keys(value).length)\n break;\n out.push(out.length > prefix.length ? distinct(value, out, items, mode) : value);\n }\n return out;\n}\nconst CONTAINERS = /^(data|items?|results?|list|entr(y|ie)|records?|values?|objects?|nodes?|edges?|elements?|rows?|hits?|match(e)?|contents?|resources?)$/i;\nfunction distinct(value, taken, schema, mode) {\n var _a, _b, _c, _d;\n const n = taken.length + 1;\n const free = (candidate) => !taken.some((t) => (0, fit_1.equal)(t, candidate)) && (0, fit_1.fits)(candidate, schema, mode);\n if (!taken.some((t) => (0, fit_1.equal)(t, value)))\n return value;\n const candidates = [];\n if (Array.isArray(schema.enum))\n candidates.push(...schema.enum);\n if (typeof value === "string" && isPlaceholder(value))\n candidates.push(`${value.slice(0, -1)}_${n}>`);\n if (typeof value === "string") {\n const at = value.indexOf("@");\n if (at > 0)\n candidates.push(`${value.slice(0, at)}+${n}${value.slice(at)}`);\n candidates.push(`${value}_${n}`, `${value}${n}`, `${n}${value.slice(1)}`);\n }\n else if (typeof value === "number")\n candidates.push(value + n - 1, value + (n - 1) * 10, value - (n - 1));\n else if (typeof value === "boolean")\n candidates.push(!value);\n else if (isRecord(value)) {\n const key = (_a = Object.keys(value).find((k) => k === "id" || isIdName(k))) !== null && _a !== void 0 ? _a : Object.keys(value).find((k) => typeof value[k] === "string" || typeof value[k] === "number");\n if (key !== undefined) {\n const inner = (_c = (_b = schema.properties) === null || _b === void 0 ? void 0 : _b[key]) !== null && _c !== void 0 ? _c : {};\n const varied = distinct(value[key], taken.flatMap((t) => (isRecord(t) ? [t[key]] : [])), inner, mode);\n candidates.push({ ...value, [key]: varied });\n }\n }\n return (_d = candidates.find(free)) !== null && _d !== void 0 ? _d : value;\n}\nconst ON_FLAGS = /^(is_?|has_?|can_?)?(enabled|active|verified|valid|available|visible|confirmed|success|successful|ok|allowed|approved|ready|supported)$/i;\nfunction booleanFor(name) {\n return ON_FLAGS.test(name.replace(/-/g, "_"));\n}\nfunction fitted(value, schema, name, depth, mode, budget, owner) {\n return (0, fit_1.fits)(value, schema, mode) ? value : conform(value, schema, mode, name, depth, budget, owner);\n}\nfunction conform(value, schema, mode = "response", name = "", depth = 0, budget = { left: NODE_BUDGET }, owner) {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > HARD_DEPTH || (0, fit_1.fits)(value, schema, mode))\n return value;\n const target = (0, fit_1.circularTarget)(schema);\n if (target)\n return conform(value, target, mode, name, depth + 1, budget, owner);\n const fresh = () => fromSchema({ ...schema, example: undefined, examples: undefined, default: undefined }, name, depth, mode, budget, owner);\n const variants = ((_a = schema.oneOf) === null || _a === void 0 ? void 0 : _a.length) ? schema.oneOf : ((_b = schema.anyOf) === null || _b === void 0 ? void 0 : _b.length) ? schema.anyOf : undefined;\n if (variants) {\n const base = { ...schema, oneOf: undefined, anyOf: undefined };\n const ranked = variants\n .filter((v) => isRecord(v))\n .map((v) => ({ v, misses: (0, fit_1.misfits)(value, { allOf: [base, v] }, mode, 40).length }))\n .sort((a, b) => a.misses - b.misses);\n let closest;\n for (const { v } of ranked.slice(0, MAX_TRIES)) {\n const fixed = conform(value, { allOf: [base, v] }, mode, name, depth + 1, budget, owner);\n if ((0, fit_1.fits)(fixed, schema, mode))\n return fixed;\n closest !== null && closest !== void 0 ? closest : (closest = fixed);\n }\n const made = fresh();\n return (0, fit_1.fits)(made, schema, mode) || closest === undefined ? made : closest;\n }\n if ((_c = schema.allOf) === null || _c === void 0 ? void 0 : _c.length) {\n let fixed = value;\n const required = requiredIn(schema);\n for (const part of [...schema.allOf, { ...schema, allOf: undefined }]) {\n if (isRecord(part))\n fixed = conform(fixed, required.length ? { ...part, required: [...new Set([...(Array.isArray(part.required) ? part.required : []), ...required])] } : part, mode, name, depth + 1, budget, owner);\n }\n if ((0, fit_1.fits)(fixed, schema, mode))\n return fixed;\n const made = fresh();\n return (0, fit_1.fits)(made, schema, mode) ? made : fixed;\n }\n return conformOne(value, schema, mode, name, depth, budget, owner);\n}\nfunction conformOne(value, schema, mode, name, depth, budget, owner) {\n var _a, _b, _c, _d, _e;\n if ((0, fit_1.fits)(value, { ...schema, allOf: undefined, oneOf: undefined, anyOf: undefined, not: undefined }, mode))\n return value;\n const fresh = () => fromSchema({ ...schema, example: undefined, examples: undefined, default: undefined }, name, depth, mode, budget, owner);\n const types = typesOf(schema);\n if (types.length && !(value === null && schema.nullable) && !ofType(value, schema)) {\n const typed = asType(value, schema);\n return typed !== undefined && (0, fit_1.fits)(typed, schema, mode) ? typed : fresh();\n }\n if (schema.const !== undefined && !(0, fit_1.equal)(value, schema.const))\n return schema.const;\n if (Array.isArray(schema.enum) && schema.enum.length && !schema.enum.some((e) => (0, fit_1.equal)(e, value)))\n return enumValue(schema.enum, schema.description);\n if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null)\n return fresh();\n if (Array.isArray(value)) {\n const legacy = Array.isArray(schema.items) ? schema.items : undefined;\n const prefix = (_b = (_a = schema.prefixItems) !== null && _a !== void 0 ? _a : legacy) !== null && _b !== void 0 ? _b : [];\n const items = !legacy && isRecord(schema.items) ? schema.items : undefined;\n let out = value.map((item, i) => conform(item, i < prefix.length ? prefix[i] : items, mode, singular(name), depth + 1, budget, singular(name) || owner));\n if (schema.uniqueItems === true)\n out = out.filter((item, i) => out.findIndex((other) => (0, fit_1.equal)(other, item)) === i);\n if (typeof schema.maxItems === "number")\n out = out.slice(0, Math.max(0, schema.maxItems));\n const least = Math.min(typeof schema.minItems === "number" ? schema.minItems : 0, MAX_LIST);\n while (out.length < least) {\n const index = out.length;\n const sub = index < prefix.length ? prefix[index] : items;\n const made = sub ? exampleFromSchema(sub, singular(name), depth + 1, mode, budget, singular(name) || owner) : null;\n out.push(sub ? distinct(made, out, sub, mode) : made);\n }\n return out;\n }\n if (isRecord(value)) {\n const props = (isRecord(schema.properties) ? schema.properties : {});\n const patterns = isRecord(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];\n const extra = schema.additionalProperties;\n const title = (_c = schema.title) !== null && _c !== void 0 ? _c : owner;\n const out = {};\n for (const [key, item] of Object.entries(value)) {\n const prop = Object.prototype.hasOwnProperty.call(props, key) ? props[key] : undefined;\n const matched = (_d = patterns.find(([pattern]) => (0, fit_1.matchesPattern)(pattern, key))) === null || _d === void 0 ? void 0 : _d[1];\n if (!prop && !matched && extra === false)\n continue;\n const sub = (_e = prop !== null && prop !== void 0 ? prop : matched) !== null && _e !== void 0 ? _e : (isRecord(extra) ? extra : undefined);\n const optional = !(Array.isArray(schema.required) && schema.required.includes(key));\n if (item === null && sub && !allowsNull(sub) && optional)\n continue;\n if (mode === "response" && !budget.full && optional && sub && item !== null && typeof item !== "object" && !(0, fit_1.fits)(item, sub, mode)) {\n const typed = asType(item, sub);\n if (typed === undefined || !(0, fit_1.fits)(typed, sub, mode))\n continue;\n }\n setField(out, key, sub ? conform(item, sub, mode, key, depth + 1, budget, title) : item);\n }\n for (const key of Array.isArray(schema.required) ? schema.required : []) {\n if (typeof key !== "string" || key in out)\n continue;\n const prop = props[key];\n if (prop && (mode === "request" ? prop.readOnly : prop.writeOnly))\n continue;\n const sub = prop !== null && prop !== void 0 ? prop : (isRecord(extra) ? extra : undefined);\n setField(out, key, sub ? fieldValue(sub, key, depth + 1, mode, budget, title) : null);\n }\n for (const [key, prop] of Object.entries(props)) {\n if (typeof schema.minProperties !== "number" || Object.keys(out).length >= schema.minProperties)\n break;\n if (!(key in out))\n setField(out, key, exampleFromSchema(prop, key, depth + 1, mode, budget, title));\n }\n return out;\n }\n return fresh();\n}\nfunction setField(out, key, value) {\n if (key === "__proto__")\n Object.defineProperty(out, key, { value, enumerable: true, writable: true, configurable: true });\n else\n out[key] = value;\n}\nfunction asType(value, schema) {\n const types = typesOf(schema);\n if (ofType(value, schema))\n return value;\n if (typeof value === "string" && (types.includes("object") || types.includes("array"))) {\n try {\n const parsed = JSON.parse(value);\n if (ofType(parsed, schema))\n return parsed;\n }\n catch {\n }\n }\n if (types.includes("string") && Array.isArray(value) && value.length && value.every((v) => typeof v === "string" || typeof v === "number"))\n return value.join(",");\n if (types.includes("object") && Array.isArray(value) && value.length === 1 && isRecord(value[0]))\n return value[0];\n if (typeof value === "string" && value.trim() && (types.includes("number") || types.includes("integer")) && ofType(Number(value), schema))\n return Number(value);\n if (typeof value === "string" && types.includes("boolean") && /^(true|false)$/.test(value))\n return value === "true";\n if (typeof value === "number" && types.includes("string") && Number.isFinite(value))\n return String(value);\n return undefined;\n}\nfunction typesOf(schema) {\n return (Array.isArray(schema.type) ? schema.type : [schema.type]).filter((t) => typeof t === "string");\n}\nfunction ofType(value, schema) {\n const types = typesOf(schema);\n if (!types.length || (value === null && schema.nullable))\n return true;\n return types.some((t) => (t === "integer" ? Number.isInteger(value) : t === "number" ? typeof value === "number" : t === "object" ? isRecord(value) : t === "array" ? Array.isArray(value) : t === "null" ? value === null : typeof value === t));\n}\nfunction sharedProperties(parts) {\n const all = new Map();\n const collect = (schema, title, depth) => {\n var _a, _b, _c;\n if (!schema || typeof schema !== "object" || depth > 4)\n return;\n for (const part of (_a = schema.allOf) !== null && _a !== void 0 ? _a : [])\n collect(part, title, depth + 1);\n for (const [key, def] of Object.entries((_b = schema.properties) !== null && _b !== void 0 ? _b : {})) {\n if (!def || typeof def !== "object")\n continue;\n const entry = (_c = all.get(key)) !== null && _c !== void 0 ? _c : { defs: [] };\n if (!entry.defs.includes(def))\n entry.defs.push(def);\n entry.title = title;\n all.set(key, entry);\n }\n };\n for (const part of parts)\n collect(part, part.title, 0);\n return new Map([...all].filter(([, entry]) => entry.defs.length > 1));\n}\nfunction requiredIn(schema, depth = 0) {\n var _a;\n if (!schema || typeof schema !== "object" || depth > 4)\n return [];\n const own = Array.isArray(schema.required) ? schema.required.filter((r) => typeof r === "string") : [];\n return [...new Set([...own, ...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []).flatMap((part) => requiredIn(part, depth + 1))])];\n}\nfunction fromParts(schema, name, depth, mode, budget, owner) {\n var _a, _b, _c;\n const merged = {};\n const plain = [];\n const required = requiredIn(schema);\n const parts = [...((_a = schema.allOf) !== null && _a !== void 0 ? _a : []), ...(schema.properties ? [{ ...schema, allOf: undefined }] : [])].filter((part) => part && typeof part === "object");\n const again = { left: budget.left, full: budget.full };\n for (const part of parts) {\n const whole = { ...part, ...(schema.title ? { title: schema.title } : {}), ...(required.length ? { required: [...new Set([...(Array.isArray(part.required) ? part.required : []), ...required])] } : {}) };\n const value = exampleFromSchema(whole, name, depth, mode, budget, owner);\n if (isRecord(value))\n Object.assign(merged, value);\n else if (value !== null && value !== undefined)\n plain.push(value);\n }\n for (const [key, { defs, title }] of sharedProperties(parts)) {\n if (!(key in merged) || defs.every((def) => (0, fit_1.fits)(merged[key], def, mode)))\n continue;\n const value = exampleFromSchema({ allOf: defs }, key, depth + 1, mode, again, (_c = (_b = schema.title) !== null && _b !== void 0 ? _b : title) !== null && _c !== void 0 ? _c : owner);\n if (value !== null && value !== undefined)\n merged[key] = value;\n }\n if (plain.length && Object.keys(merged).length === 0) {\n const fitting = [...plain].reverse().find((value) => parts.every((part) => (0, fit_1.fits)(value, part, mode)));\n if (fitting !== undefined)\n return fitting;\n for (const variant of parts.flatMap((part) => { var _a, _b; return [...((_a = part.oneOf) !== null && _a !== void 0 ? _a : []), ...((_b = part.anyOf) !== null && _b !== void 0 ? _b : [])]; })) {\n if (!isRecord(variant) || variant.type === "null")\n continue;\n const value = exampleFromSchema(variant, name, depth, mode, again, owner);\n if (value !== null && value !== undefined && parts.every((part) => (0, fit_1.fits)(value, part, mode)))\n return value;\n }\n const items = parts.flatMap((part) => (part.items && typeof part.items === "object" ? [part.items] : []));\n if (items.length > 1 && plain.some(Array.isArray))\n return exampleFromSchema({ type: "array", items: { allOf: items } }, name, depth, mode, again, owner);\n return plain[0];\n }\n return merged;\n}\nconst ENDINGS = /^(cancel+ed|cancel+ing|failed|failure|errored|error|declined|rejected|expired|deleted|voided|void|refunded|disputed|revoked|suspended|blocked|disabled|inactive|abandoned|lost|unpaid|past_due|incomplete_expired)$/i;\nfunction enumValue(values, description) {\n var _a, _b;\n const said = values.filter((v) => v !== "" && v !== null);\n const mentioned = (v) => {\n if (typeof v !== "string" || !description)\n return Infinity;\n const at = description.search(new RegExp(`[\\`\'"]${v.replace(/[.*+?^${}()|[\\]\\\\]/g, "\\\\$&")}[\\`\'"]`));\n return at < 0 ? Infinity : at;\n };\n const ordered = said.map((v, i) => ({ v, i, at: mentioned(v) })).sort((a, b) => a.at - b.at || a.i - b.i).map(({ v }) => v);\n return (_b = (_a = ordered.find((v) => typeof v !== "string" || !ENDINGS.test(v))) !== null && _a !== void 0 ? _a : ordered[0]) !== null && _b !== void 0 ? _b : values[0];\n}\nfunction fromVariant(schema, variants, name, depth, mode, budget, owner) {\n var _a;\n const usable = variants.filter((v) => v && typeof v === "object" && v.type !== "null" && Object.keys(v).some((k) => !/^(description|title|nullable)$/.test(k)));\n const first = (schema.properties && usable.find((v) => v.properties || v.type === "object")) || usable[0] || variants[0];\n const exclusive = Boolean((_a = schema.oneOf) === null || _a === void 0 ? void 0 : _a.length);\n let made;\n for (const variant of [first, ...usable.filter((v) => v !== first)].slice(0, MAX_TRIES)) {\n const value = fromOneVariant(schema, variants, variant, exclusive, name, depth, mode, budget, owner);\n if (made === undefined)\n made = value;\n if ((0, fit_1.fits)(value, schema, mode))\n return value;\n }\n if (mode === "response" && !budget.full) {\n const full = { left: budget.left, full: true };\n const value = fromVariant(schema, variants, name, depth, mode, full, owner);\n budget.left = full.left;\n if ((0, fit_1.fits)(value, schema, mode))\n return value;\n }\n return made;\n}\nfunction fromOneVariant(schema, variants, variant, exclusive, name, depth, mode, budget, owner) {\n var _a, _b, _c, _d, _e;\n if (variant && typeof variant === "object" && !describesValue(variant)) {\n const required = [...new Set([...(Array.isArray(schema.required) ? schema.required : []), ...(Array.isArray(variant.required) ? variant.required : [])])];\n const others = exclusive ? new Set(variants.filter((v) => v !== variant && isRecord(v) && Array.isArray(v.required)).flatMap((v) => v.required).filter((k) => !required.includes(k))) : new Set();\n const properties = schema.properties && others.size ? Object.fromEntries(Object.entries(schema.properties).filter(([key]) => !others.has(key))) : schema.properties;\n return exampleFromSchema({ ...schema, oneOf: undefined, anyOf: undefined, ...(properties ? { properties } : {}), ...(required.length ? { required } : {}) }, name, depth, mode, budget, owner);\n }\n const value = exampleFromSchema(variant, name, depth, mode, budget, owner);\n if (!value || typeof value !== "object" || Array.isArray(value))\n return value;\n const out = schema.properties ? { ...exampleFromSchema({ ...schema, oneOf: undefined, anyOf: undefined }, name, depth, mode, budget, owner), ...value } : { ...value };\n const discriminator = schema.discriminator;\n const property = discriminator === null || discriminator === void 0 ? void 0 : discriminator.propertyName;\n const mapping = discriminator === null || discriminator === void 0 ? void 0 : discriminator.mapping;\n if (property && isRecord(mapping) && !((_b = (_a = variant.properties) === null || _a === void 0 ? void 0 : _a[property]) === null || _b === void 0 ? void 0 : _b.enum) && ((_d = (_c = variant.properties) === null || _c === void 0 ? void 0 : _c[property]) === null || _d === void 0 ? void 0 : _d.const) === undefined) {\n const entries = Object.entries(mapping);\n const named = entries.find(([, target]) => variant.title && typeof target === "string" && target.split("/").pop() === variant.title);\n const entry = (_e = named !== null && named !== void 0 ? named : entries[variants.indexOf(variant)]) !== null && _e !== void 0 ? _e : entries[0];\n if (entry)\n out[property] = entry[0];\n }\n return out;\n}\nconst VALUE_KEYWORDS = ["type", "properties", "items", "prefixItems", "allOf", "oneOf", "anyOf", "enum", "const", "example", "examples", "default", "format", "pattern", "additionalProperties", "$ref", "x-circular"];\nfunction describesValue(schema) {\n return VALUE_KEYWORDS.some((key) => key in schema);\n}\nconst MAX_OPTIONAL = 3;\nconst TELLING_NAMES = /^(to|from|subject|text|html|body|content|message|title|name|email|description|amount|currency|quantity|customer|price|product|channel|phone|url|\\w+_url)$/i;\nfunction telling(props, required) {\n const must = props.filter(([key]) => required.has(key));\n const rank = ([key, prop]) => (TELLING_NAMES.test(key) || isIdName(key) ? 0 : 2) + (looksReal(key, prop) ? 0 : 1);\n const optional = props\n .filter(([key]) => !required.has(key))\n .map((entry, i) => ({ entry, i, rank: rank(entry) }))\n .sort((a, b) => a.rank - b.rank || a.i - b.i)\n .slice(0, must.length ? MAX_OPTIONAL : MAX_OPTIONAL + 1)\n .sort((a, b) => a.i - b.i);\n return [...must, ...optional.map((o) => o.entry)];\n}\nfunction looksReal(key, prop) {\n if (!prop || typeof prop !== "object")\n return false;\n if (prop.example !== undefined || prop.examples !== undefined || prop.default !== undefined || prop.enum || prop.const !== undefined)\n return true;\n const type = Array.isArray(prop.type) ? prop.type.find((t) => t !== "null") : prop.type;\n if ((type && type !== "string") || prop.format || prop.pattern)\n return true;\n return saysWhatItHolds(key, prop);\n}\nfunction isEmpty(value) {\n return value === undefined || (Array.isArray(value) && value.length === 0) || (isRecord(value) && Object.keys(value).length === 0);\n}\nconst WHOLE_NUMBER = /(^|[_-])(number|num|no|index|idx|page|position|pos|id|count|version|year|port|rank|level|step|line|row|column|col|size)$|[a-z0-9](Number|Num|Index|Page|Position|Id|Count|Version|Year|Port|Rank|Level|Step|Line|Row|Column|Size)$|^(number|num|index|page|position|id|count|version|year|port|rank|level|step|line|row|column|size|offset|depth)$/;\nfunction numberFor(schema, name, integer) {\n const lower = name.toLowerCase();\n const step = integer ? 1 : 0.5;\n let value;\n if (/(created|updated|timestamp|_at$|time)/.test(lower) || /[a-z0-9]At$/.test(name))\n value = 1767225600;\n else if (/(amount|price|total|cost|balance)/.test(lower))\n value = integer ? 2000 : 20.0;\n else if (/(quantity|count|qty)/.test(lower))\n value = 1;\n else if (/(limit|page_size|per_page)/.test(lower))\n value = 10;\n else if (/(retry|seconds|delay)/.test(lower))\n value = 30;\n else\n value = integer || WHOLE_NUMBER.test(name) ? 1 : 1.5;\n if (schema.minimum !== undefined && value < schema.minimum)\n value = schema.minimum;\n if (schema.maximum !== undefined && value > schema.maximum)\n value = schema.maximum;\n const exclusiveMin = typeof schema.exclusiveMinimum === "number" ? schema.exclusiveMinimum : schema.exclusiveMinimum === true ? schema.minimum : undefined;\n const exclusiveMax = typeof schema.exclusiveMaximum === "number" ? schema.exclusiveMaximum : schema.exclusiveMaximum === true ? schema.maximum : undefined;\n if (exclusiveMin !== undefined && value <= exclusiveMin)\n value = exclusiveMin + step;\n if (exclusiveMax !== undefined && value >= exclusiveMax)\n value = exclusiveMax - step;\n return value;\n}\nconst HOOKISH = /(webhook|callback|hook|notif)/i;\nfunction stringFor(schema, name, owner) {\n var _a, _b;\n switch (schema.format) {\n case "date-time":\n return "2026-01-01T12:00:00Z";\n case "date":\n return "2026-01-01";\n case "time":\n return "12:00:00Z";\n case "duration":\n return "PT1H";\n case "email":\n case "idn-email":\n return `${(name.replace(/[^A-Za-z0-9_.-]+/g, "_").replace(/^[_.-]+|[_.-]+$/g, "") || "email").toLowerCase()}@example.com`;\n case "uri":\n case "url":\n case "iri":\n case "uri-reference":\n case "iri-reference":\n return HOOKISH.test(name) ? "https://example.com/webhooks" : "https://example.com";\n case "uri-template":\n return "https://example.com/{id}";\n case "hostname":\n case "idn-hostname":\n return "example.com";\n case "uuid":\n return name === "id" && owner ? uuidLike(owner) : isIdName(name) ? uuidLike(name) : exports.PLACEHOLDER_UUID;\n case "ipv4":\n return "203.0.113.10";\n case "ipv6":\n return "2001:db8::10";\n case "byte":\n return "aGVsbG8=";\n case "binary":\n return exports.BINARY_PLACEHOLDER;\n case "password":\n return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";\n case "regex":\n return "^[a-z]+$";\n case "json-pointer":\n return "/data";\n }\n if (schema.contentMediaType && !schema.contentEncoding) {\n if (/json/i.test(schema.contentMediaType))\n return JSON.stringify(schema.contentSchema ? exampleFromSchema(schema.contentSchema, name) : {});\n return exports.BINARY_PLACEHOLDER;\n }\n const value = sized((_a = namedValue(name, schema, owner)) !== null && _a !== void 0 ? _a : placeholder(name || "value"), schema);\n const pattern = schema.pattern;\n if (typeof pattern !== "string")\n return value;\n const told = (0, fit_1.patternVerdict)(pattern, value);\n if (told === true)\n return value;\n const patterned = patternExample(pattern);\n if (patterned)\n return patterned;\n const shapes = [idLike(name), "12345678901", "+15555550123", "email@example.com", "https://example.com", "example", "EXAMPLE", "Example", "1", "a", "A1"];\n const fitting = shapes.map((shape) => sized(shape, schema)).find((shape) => (0, fit_1.patternVerdict)(pattern, shape) === true);\n if (fitting !== undefined)\n return fitting;\n return (_b = (told === undefined ? shapeNamed(name, schema) : undefined)) !== null && _b !== void 0 ? _b : value;\n}\nfunction shapeNamed(name, schema) {\n const lower = name.toLowerCase();\n const shape = /phone|fax|mobile|(^|_)tel(_|$)|msisdn/.test(lower) ? "+15555550123" : /e-?mail/.test(lower) ? "email@example.com" : /(^|_)(url|uri|link|href|website)$|[a-z](Url|Uri)$/i.test(name) ? "https://example.com" : undefined;\n return shape === undefined ? undefined : sized(shape, schema);\n}\nfunction sized(value, schema) {\n let out = value;\n const held = isPlaceholder(out);\n if (schema.maxLength !== undefined && out.length > schema.maxLength)\n out = held && schema.maxLength >= 3 ? `${out.slice(0, schema.maxLength - 1)}>` : out.slice(0, schema.maxLength);\n if (schema.minLength !== undefined && out.length < schema.minLength)\n out = held ? `${out.slice(0, -1).padEnd(schema.minLength - 1, "_")}>` : out.padEnd(schema.minLength, "x");\n return out;\n}\nfunction placeholder(name) {\n const clean = name.replace(/[^A-Za-z0-9_.-]+/g, "_").replace(/^[_.-]+|[_.-]+$/g, "");\n return `<${clean.slice(0, 60) || "value"}>`;\n}\nfunction isPlaceholder(value) {\n return typeof value === "string" && /^<[A-Za-z0-9_.-]{1,64}>$/.test(value);\n}\nexports.PLACEHOLDER_UUID = "00000000-0000-4000-8000-000000000000";\nfunction namedValue(name, schema, owner) {\n var _a, _b;\n const lower = name.toLowerCase().replace(/-/g, "_");\n const about = ((_a = schema.description) !== null && _a !== void 0 ? _a : "").toLowerCase();\n if (lower === "id" && owner)\n return idLike(owner);\n if (isIdName(name) || /\\bID\\b/.test((_b = schema.description) !== null && _b !== void 0 ? _b : ""))\n return idLike(name);\n if ((lower === "object" || lower === "type") && schema.title)\n return schema.title.toLowerCase();\n if ((lower === "name" || lower.endsWith("_name")) && (/\\b(domain|hostname)s?\\b/.test(about) || nounOf(owner) === "domain"))\n return "example.com";\n if (/^(domain|host|hostname)$/.test(lower))\n return "example.com";\n if (/(^|_)password$/.test(lower))\n return "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";\n return undefined;\n}\nconst TELLING_FIELD = [\n /^(from|sender|to|recipients?|reply_?to|cc|bcc|subject|title|headline|html|text|body|content|message|comment|notes?|caption|prompt|input|slug|language|lang|locale|tz|locality|date|object|type|domain|host|hostname)$/,\n /email|currency|phone|country|url|uri|status|description/,\n /^(first_?name|given_?name|last_?name|family_?name|surname|company|company_?name|business_?name|organi[sz]ation(_?name)?|user_?name|handle|login|screen_?name)$/,\n /(^|_)(name|date|fax|city|state|province|postal_?code|zip|zip_?code|postcode|street|line_?[12]|address_?(line_?)?[12]|time_?zone|colou?r|password)$/,\n /(_at|_time|^time|timestamp)$/,\n];\nfunction saysWhatItHolds(name, schema) {\n var _a;\n const lower = name.toLowerCase().replace(/-/g, "_");\n return isIdName(name) || /\\bID\\b/.test((_a = schema.description) !== null && _a !== void 0 ? _a : "") || TELLING_FIELD.some((re) => re.test(lower));\n}\nfunction nounOf(owner) {\n const words = (owner !== null && owner !== void 0 ? owner : "")\n .replace(/([a-z0-9])([A-Z])/g, "$1_$2")\n .toLowerCase()\n .split(/[^a-z0-9]+/)\n .filter((w) => w && !/^(create|update|new|send|add|get|list|post|put|patch|set|make|place|request|response|body|input|params|parameters|payload|object|data|schema|model|dto|options?|opts|args|arguments|events?|created|updated|deleted|changed|v\\d+)$/.test(w));\n return words.length ? singular(words.slice(-2).join("_")) : undefined;\n}\nfunction patternExample(pattern) {\n let whole;\n try {\n whole = new RegExp(pattern);\n }\n catch {\n return undefined;\n }\n const readable = [pattern, ...(REPEATED_GROUP.test(pattern) ? [] : [withoutLookarounds(pattern)])];\n for (const text of readable) {\n if (text === undefined)\n continue;\n const node = parsePattern(text);\n if (!node)\n continue;\n const value = sample(node, { next: 0 });\n if (value !== undefined && value.length <= 200 && whole.test(value))\n return value;\n }\n return undefined;\n}\nconst REPEATED_GROUP = /\\)(?:[*+]|\\{\\d+,?\\d*\\})/;\nfunction withoutLookarounds(pattern) {\n if (!/\\(\\?<?[=!]/.test(pattern))\n return undefined;\n let out = "";\n for (let i = 0; i < pattern.length; i++) {\n if (pattern[i] === "\\\\") {\n out += pattern.slice(i, i + 2);\n i++;\n continue;\n }\n if (/^\\(\\?<?[=!]/.test(pattern.slice(i, i + 4))) {\n let depth = 0;\n let j = i;\n for (; j < pattern.length; j++) {\n if (pattern[j] === "\\\\")\n j++;\n else if (pattern[j] === "[") {\n j = pattern.indexOf("]", j + 2);\n if (j < 0)\n return undefined;\n }\n else if (pattern[j] === "(")\n depth++;\n else if (pattern[j] === ")" && --depth === 0)\n break;\n }\n if (j >= pattern.length)\n return undefined;\n i = j;\n continue;\n }\n out += pattern[i];\n }\n return out;\n}\nconst POOLS = [[..."1a2b3c4d5e6f7a8b9c0d"], [..."ABCDEFGHJKxyz_-."], [..."LMNPQRSTUVWXYZghijklmnopqrstuvw+=:/@~!*\'(),;$&? "]];\nconst CONTROL = { t: "\\t", n: "\\n", r: "\\r", v: "\\v", f: "\\f" };\nfunction parsePattern(pattern) {\n let i = 0;\n const fail = () => {\n i = pattern.length + 1;\n return undefined;\n };\n const choice = () => {\n var _a;\n const options = [];\n let parts = [];\n while (i < pattern.length && pattern[i] !== ")") {\n const c = pattern[i];\n if (c === "|") {\n options.push({ kind: "sequence", parts });\n parts = [];\n i++;\n continue;\n }\n let atom;\n if (c === "^" || c === "$") {\n i++;\n continue;\n }\n else if (c === "(") {\n if (pattern.startsWith("(?:", i))\n i += 3;\n else if (pattern[i + 1] === "?")\n return fail();\n else\n i++;\n atom = choice();\n if (pattern[i] !== ")")\n return fail();\n i++;\n }\n else if (c === "[") {\n const close = pattern.indexOf("]", pattern[i + 1] === "]" ? i + 2 : i + 1);\n if (close < 0)\n return fail();\n const text = pattern.slice(i, close + 1);\n i = close + 1;\n let set;\n try {\n set = new RegExp(`^${text}$`);\n }\n catch {\n return fail();\n }\n atom = { kind: "chars", accepts: (ch) => set.test(ch) };\n }\n else if (c === "\\\\") {\n const e = pattern[i + 1];\n i += 2;\n if (e === undefined || /[0-9bBkpPc]/.test(e))\n return fail();\n if (/[dwsDWS]/.test(e)) {\n const set = new RegExp(`^\\\\${e}$`);\n atom = { kind: "chars", accepts: (ch) => set.test(ch) };\n }\n else {\n const code = (e === "x" && pattern.slice(i).match(/^[0-9a-fA-F]{2}/)) || (e === "u" && pattern.slice(i).match(/^[0-9a-fA-F]{4}/));\n if (code)\n i += code[0].length;\n const literal = code ? String.fromCharCode(parseInt(code[0], 16)) : ((_a = CONTROL[e]) !== null && _a !== void 0 ? _a : e);\n atom = { kind: "chars", accepts: (ch) => ch === literal, literal };\n }\n }\n else if (c === ".") {\n i++;\n atom = { kind: "chars", accepts: (ch) => ch !== "\\n", literal: "." };\n }\n else if ("*+?{".includes(c)) {\n return fail();\n }\n else {\n i++;\n atom = { kind: "chars", accepts: (ch) => ch === c, literal: c };\n }\n if (!atom)\n return fail();\n const q = pattern.slice(i).match(/^(\\*|\\+|\\?|\\{(\\d+)(?:(,)(\\d*))?\\})\\??/);\n if (q) {\n i += q[0].length;\n const min = q[2] !== undefined ? Number(q[2]) : q[1] === "+" ? 1 : 0;\n const max = q[2] !== undefined ? (q[3] ? (q[4] ? Number(q[4]) : Infinity) : min) : q[1] === "?" ? 1 : Infinity;\n const count = q[1] === "?" ? 1 : Math.min(Math.max(min, Math.min(10, max)), 64);\n if (count < min)\n return fail();\n atom = { kind: "repeat", node: atom, count };\n }\n parts.push(atom);\n }\n options.push({ kind: "sequence", parts });\n return options.length === 1 ? options[0] : { kind: "choice", options };\n };\n const node = choice();\n return i === pattern.length ? node : undefined;\n}\nfunction sample(node, state) {\n var _a;\n switch (node.kind) {\n case "chars": {\n if (node.literal !== undefined)\n return node.literal;\n for (const pool of POOLS) {\n for (let n = 0; n < pool.length; n++) {\n const ch = pool[(state.next + n) % pool.length];\n if (node.accepts(ch)) {\n state.next = (state.next + n + 1) % pool.length;\n return ch;\n }\n }\n }\n return undefined;\n }\n case "sequence": {\n let out = "";\n for (const part of node.parts) {\n const value = sample(part, state);\n if (value === undefined)\n return undefined;\n out += value;\n }\n return out;\n }\n case "repeat": {\n let out = "";\n for (let n = 0; n < node.count; n++) {\n const value = sample(node.node, state);\n if (value === undefined)\n return undefined;\n out += value;\n }\n return out;\n }\n case "choice": {\n const values = node.options.map((option) => sample(option, { ...state })).filter((v) => v !== undefined);\n return (_a = values.find((v) => v.length > 1)) !== null && _a !== void 0 ? _a : values[0];\n }\n }\n}\nfunction isIdName(name) {\n const lower = name.toLowerCase();\n return lower === "id" || lower.endsWith("_id") || lower.endsWith("-id") || /[a-z0-9]Id$/.test(name);\n}\nconst ID_NOISE = /^(create|update|new|send|add|get|list|post|put|patch|set|make|place|request|response|body|input|output|params|parameters|payload|object|data|schema|model|dto|options?|opts|args|arguments|events?|created|updated|deleted|changed|v\\d+)$/;\nfunction idLike(name) {\n const words = idWords(name);\n return words.length ? `<${words.join("_")}_id>` : "<id>";\n}\nfunction uuidLike(name) {\n const words = idWords(name);\n const n = 1 + (seedHash(`uuid:${words.length ? words.join("_") : "obj"}`) % 9999);\n return `${exports.PLACEHOLDER_UUID.slice(0, -12)}${String(n).padStart(12, "0")}`;\n}\nfunction idWords(name) {\n const all = name\n .replace(/[_-]?(uu|s|g)?id$/i, "")\n .replace(/([a-z0-9])([A-Z])/g, "$1_$2")\n .replace(/([A-Z])([A-Z][a-z])/g, "$1_$2")\n .toLowerCase()\n .split(/[^a-z]+/)\n .filter(Boolean);\n const kept = all.filter((w) => !ID_NOISE.test(w));\n return (kept.length ? kept : all).map((w, i, list) => (i === list.length - 1 ? singular(w) : w));\n}\nfunction seedHash(seed) {\n let h = 2166136261;\n for (let i = 0; i < seed.length; i++)\n h = Math.imul(h ^ seed.charCodeAt(i), 16777619) >>> 0;\n return h || 1;\n}\nfunction singular(word) {\n if (/ies$/i.test(word))\n return word.slice(0, -3) + "y";\n if (/(ses|xes|ches|shes)$/i.test(word))\n return word.slice(0, -2);\n if (/s$/i.test(word) && !/ss$/i.test(word))\n return word.slice(0, -1);\n return word;\n}\n\n}, {"./fit":"lib/oas/fit"}],\n"lib/oas/fit": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.CIRCULAR_TARGET = void 0;\nexports.circularTarget = circularTarget;\nexports.fits = fits;\nexports.misfits = misfits;\nexports.typesOf = typesOf;\nexports.equal = equal;\nexports.patternVerdict = patternVerdict;\nexports.matchesPattern = matchesPattern;\nexports.formatFits = formatFits;\nexports.CIRCULAR_TARGET = "x-circular-target";\nfunction circularTarget(schema) {\n const target = schema[exports.CIRCULAR_TARGET];\n return target && typeof target === "object" ? target : undefined;\n}\nconst MAX_DEPTH = 40;\nconst MAX_STEPS = 50000;\nfunction fits(value, schema, mode = "response") {\n return misfits(value, schema, mode, 1).length === 0;\n}\nfunction misfits(value, schema, mode = "response", limit = 20) {\n const out = [];\n check(value, schema, [], 0, out, { counter: { steps: 0 }, limit, mode });\n return out;\n}\nfunction check(value, schema, path, depth, out, state) {\n var _a, _b, _c;\n if (out.length >= state.limit || schema === undefined || schema === true || depth > MAX_DEPTH || ++state.counter.steps > MAX_STEPS)\n return;\n if (schema === false)\n return void out.push({ path, keyword: "false" });\n if (typeof schema !== "object" || schema === null)\n return;\n const miss = (keyword, at = path) => void out.push({ path: at, keyword });\n const target = circularTarget(schema);\n if (target)\n return check(value, target, path, depth + 1, out, state);\n const nullable = schema.nullable === true;\n const types = typesOf(schema);\n if (value === null && nullable)\n return;\n if (types.length && !types.some((t) => isType(value, t)))\n return miss("type");\n if (schema.const !== undefined && !equal(value, schema.const))\n miss("const");\n if (Array.isArray(schema.enum) && schema.enum.length && !schema.enum.some((e) => equal(e, value)))\n miss("enum");\n if (typeof value === "string") {\n const length = [...value].length;\n if (typeof schema.minLength === "number" && length < schema.minLength)\n miss("minLength");\n if (typeof schema.maxLength === "number" && length > schema.maxLength)\n miss("maxLength");\n if (typeof schema.pattern === "string" && !matchesPattern(schema.pattern, value))\n miss("pattern");\n if (typeof schema.format === "string" && !formatFits(schema.format, value))\n miss("format");\n }\n else if (typeof value === "number") {\n const { minimum, maximum, exclusiveMinimum: exMin, exclusiveMaximum: exMax } = schema;\n if (typeof minimum === "number" && (exMin === true ? value <= minimum : value < minimum))\n miss("minimum");\n if (typeof maximum === "number" && (exMax === true ? value >= maximum : value > maximum))\n miss("maximum");\n if (typeof exMin === "number" && value <= exMin)\n miss("exclusiveMinimum");\n if (typeof exMax === "number" && value >= exMax)\n miss("exclusiveMaximum");\n if (typeof schema.multipleOf === "number" && schema.multipleOf > 0 && !multipleOf(value, schema.multipleOf))\n miss("multipleOf");\n if (schema.format === "int32" && !(Number.isInteger(value) && value >= -(2 ** 31) && value < 2 ** 31))\n miss("format");\n }\n else if (Array.isArray(value)) {\n if (typeof schema.minItems === "number" && value.length < schema.minItems)\n miss("minItems");\n if (typeof schema.maxItems === "number" && value.length > schema.maxItems)\n miss("maxItems");\n if (schema.uniqueItems === true && new Set(value.map((v) => canonical(v))).size < value.length)\n miss("uniqueItems");\n const legacy = Array.isArray(schema.items) ? schema.items : undefined;\n const prefix = (_b = (_a = schema.prefixItems) !== null && _a !== void 0 ? _a : legacy) !== null && _b !== void 0 ? _b : [];\n value.forEach((item, i) => {\n if (i < prefix.length)\n check(item, prefix[i], [...path, i], depth + 1, out, state);\n else if (!legacy && isSchema(schema.items))\n check(item, schema.items, [...path, i], depth + 1, out, state);\n });\n }\n else if (isRecord(value)) {\n const props = isRecord(schema.properties) ? schema.properties : {};\n const omitted = (key) => {\n const prop = props[key];\n return isSchema(prop) && (state.mode === "request" ? prop.readOnly === true : prop.writeOnly === true);\n };\n if (Array.isArray(schema.required))\n for (const key of schema.required)\n if (typeof key === "string" && !(key in value) && !omitted(key))\n miss("required", [...path, key]);\n const count = Object.keys(value).length;\n if (typeof schema.minProperties === "number" && count < schema.minProperties)\n miss("minProperties");\n if (typeof schema.maxProperties === "number" && count > schema.maxProperties)\n miss("maxProperties");\n const patterns = isRecord(schema.patternProperties) ? Object.entries(schema.patternProperties) : [];\n for (const [key, item] of Object.entries(value)) {\n if (out.length >= state.limit)\n break;\n let known = false;\n if (Object.prototype.hasOwnProperty.call(props, key)) {\n known = true;\n check(item, props[key], [...path, key], depth + 1, out, state);\n }\n for (const [pattern, sub] of patterns) {\n if (matchesPattern(pattern, key)) {\n known = true;\n check(item, sub, [...path, key], depth + 1, out, state);\n }\n }\n if (!known) {\n const extra = schema.additionalProperties;\n if (extra === false)\n miss("additionalProperties", [...path, key]);\n else if (isSchema(extra))\n check(item, extra, [...path, key], depth + 1, out, state);\n }\n }\n }\n for (const part of (_c = schema.allOf) !== null && _c !== void 0 ? _c : [])\n if (isSchema(part))\n check(value, part, path, depth + 1, out, state);\n if (Array.isArray(schema.anyOf) && schema.anyOf.length && !schema.anyOf.some((v) => fitsAt(value, v, depth, state)))\n miss("anyOf");\n if (Array.isArray(schema.oneOf) && schema.oneOf.length) {\n const fitting = countIn(value, schema.oneOf, depth, state, 2);\n if (fitting !== 1)\n miss(fitting === 0 ? "oneOf" : "oneOf-many");\n }\n if (isSchema(schema.not) && fitsAt(value, schema.not, depth, state))\n miss("not");\n const conditional = schema;\n if (isSchema(conditional.if)) {\n const branch = fitsAt(value, conditional.if, depth, state) ? conditional.then : conditional.else;\n if (isSchema(branch))\n check(value, branch, path, depth + 1, out, state);\n }\n}\nfunction fitsAt(value, schema, depth, state) {\n const found = [];\n check(value, schema, [], depth + 1, found, { counter: state.counter, limit: 1, mode: state.mode });\n return found.length === 0;\n}\nfunction countIn(value, variants, depth, s, stop) {\n let n = 0;\n for (const v of variants) {\n if (isSchema(v) && fitsAt(value, v, depth, s) && ++n >= stop)\n break;\n }\n return n;\n}\nfunction isSchema(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction isRecord(value) {\n return typeof value === "object" && value !== null && !Array.isArray(value);\n}\nfunction typesOf(schema) {\n return (Array.isArray(schema.type) ? schema.type : [schema.type]).filter((t) => typeof t === "string");\n}\nfunction isType(value, type) {\n switch (type) {\n case "integer":\n return typeof value === "number" && Number.isInteger(value);\n case "number":\n return typeof value === "number" && Number.isFinite(value);\n case "string":\n return typeof value === "string";\n case "boolean":\n return typeof value === "boolean";\n case "array":\n return Array.isArray(value);\n case "object":\n return isRecord(value);\n case "null":\n return value === null;\n default:\n return true;\n }\n}\nfunction multipleOf(value, step) {\n const quotient = value / step;\n return Math.abs(quotient - Math.round(quotient)) < 1e-9;\n}\nfunction equal(a, b) {\n return canonical(a) === canonical(b);\n}\nfunction canonical(value) {\n var _a;\n if (Array.isArray(value))\n return `[${value.map(canonical).join(",")}]`;\n if (isRecord(value))\n return `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonical(value[k])}`).join(",")}}`;\n return (_a = JSON.stringify(value)) !== null && _a !== void 0 ? _a : "undefined";\n}\nconst REPEATED_GROUP = /\\)(?:[*+]|\\{\\d+,?\\d*\\})/;\nconst compiled = new Map();\nfunction patternVerdict(pattern, value) {\n if (value.length > 40 || REPEATED_GROUP.test(pattern))\n return undefined;\n const re = compiledPattern(pattern);\n return re === null ? undefined : re.test(value);\n}\nfunction matchesPattern(pattern, value) {\n if (value.length > 2000 || REPEATED_GROUP.test(pattern))\n return true;\n const re = compiledPattern(pattern);\n return re === null || re.test(value);\n}\nfunction compiledPattern(pattern) {\n let re = compiled.get(pattern);\n if (re === undefined) {\n try {\n re = new RegExp(pattern, "u");\n }\n catch {\n try {\n re = new RegExp(pattern);\n }\n catch {\n re = null;\n }\n }\n if (compiled.size > 2000)\n compiled.clear();\n compiled.set(pattern, re);\n }\n return re;\n}\nconst DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst TIME = /^(\\d{2}):(\\d{2}):(\\d{2})(\\.\\d+)?(z|[+-]\\d{2}(:?\\d{2})?)$/i;\nconst FORMATS = {\n "date-time": (text) => {\n const [date, time] = text.split(/t|\\s/i);\n return time !== undefined && FORMATS.date(date) && FORMATS.time(time);\n },\n date: (text) => {\n const m = text.match(DATE);\n if (!m)\n return false;\n const month = Number(m[2]);\n const day = Number(m[3]);\n return month >= 1 && month <= 12 && day >= 1 && day <= new Date(Date.UTC(Number(m[1]), month, 0)).getUTCDate();\n },\n time: (text) => {\n const m = text.match(TIME);\n return Boolean(m) && Number(m[1]) <= 23 && Number(m[2]) <= 59 && Number(m[3]) <= 60;\n },\n email: (text) => /^[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(text),\n uri: (text) => /^[a-z][a-z0-9+.-]*:[^\\s]*$/i.test(text) && !/\\s/.test(text),\n url: (text) => /^[a-z][a-z0-9+.-]*:\\/\\/[^\\s]+$/i.test(text),\n "uri-reference": (text) => !/[\\s<>"\\\\^`{}|]/.test(text),\n "uri-template": (text) => !/[\\s<>"\\\\^`|]/.test(text),\n uuid: (text) => /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(text),\n ipv4: (text) => /^((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)\\.){3}(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)$/.test(text),\n ipv6: (text) => { var _a; return /^[0-9a-f:.]+$/i.test(text) && text.includes(":") && ((_a = text.match(/::/g)) !== null && _a !== void 0 ? _a : []).length <= 1; },\n hostname: (text) => text.length <= 253 && /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\\.?$/i.test(text),\n byte: (text) => /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(text),\n duration: (text) => /^P(?!$)(\\d+(?:\\.\\d+)?Y)?(\\d+(?:\\.\\d+)?M)?(\\d+(?:\\.\\d+)?W)?(\\d+(?:\\.\\d+)?D)?(T(?=\\d)(\\d+(?:\\.\\d+)?H)?(\\d+(?:\\.\\d+)?M)?(\\d+(?:\\.\\d+)?S)?)?$/.test(text),\n regex: (text) => {\n try {\n new RegExp(text);\n return true;\n }\n catch {\n return false;\n }\n },\n "json-pointer": (text) => /^(?:\\/(?:[^~/]|~0|~1)*)*$/.test(text),\n};\nfunction formatFits(format, text) {\n const test = FORMATS[format];\n return test ? test(text) : true;\n}\n\n}, {}],\n"lib/text": [function (module, exports, require) {\n"use strict";\nObject.defineProperty(exports, "__esModule", { value: true });\nexports.cut = cut;\nexports.firstSentence = firstSentence;\nexports.wellFormed = wellFormed;\nexports.clip = clip;\nexports.plainText = plainText;\nfunction cut(text, max) {\n const end = Math.max(0, max);\n const last = text.charCodeAt(end - 1);\n return text.slice(0, last >= 0xd800 && last <= 0xdbff ? end - 1 : end);\n}\nfunction firstSentence(text) {\n if (!text)\n return undefined;\n const plain = text.replace(/<[^<>]+>/g, "").replace(/\\s+/g, " ").trim();\n const match = plain.match(/^(.{1,90}?[.!?])(\\s|$)/);\n return match ? match[1] : cut(plain, 90);\n}\nconst HALVES = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]|[\\uD800-\\uDFFF]/g;\nfunction wellFormed(text) {\n return text.replace(HALVES, (c) => (c.length === 2 ? c : ""));\n}\nfunction clip(text, max) {\n return text.length > max ? `${cut(text, max - 1)}\u2026` : text;\n}\nfunction plainText(markdown) {\n return markdown\n .replace(/<[^>]+>/g, " ")\n .replace(/!\\[([^\\]]*)\\]\\([^)]*\\)/g, "$1")\n .replace(/\\[([^\\]]*)\\]\\([^)]*\\)/g, "$1")\n .replace(/\\*\\*|__|`/g, "")\n .replace(/(^|\\s)[*_]([^*_\\s][^*_]*?)[*_](?=[\\s.,;:!?)]|$)/g, "$1$2")\n .replace(/^\\s{0,3}(#{1,6}|>)\\s+/gm, "")\n .replace(/\\s+/g, " ")\n .trim();\n}\n\n}, {}]\n};\nvar cache = {};\nfunction load(id) {\n var m = cache[id];\n if (m) return m.exports;\n m = cache[id] = { exports: {} };\n defs[id][0](m, m.exports, function (spec) { return load(defs[id][1][spec]); });\n return m.exports;\n}\nload("lib/embed/player");\n})();';
15289
15650
 
15290
15651
  // ../../lib/embed/exportHtml.ts
15291
15652
  function interactiveHtml(sb, title) {
@@ -16206,7 +16567,7 @@ var USAGE = `integration-tour ${version}: your API's integration videos, built f
16206
16567
 
16207
16568
  Usage:
16208
16569
  integration-tour render <spec file or URL> [--edits <flow files or folder>]
16209
- [--formats mp4,gif,html] [--out <folder>] [--allow-private-refs]
16570
+ [--formats mp4,gif,html] [--out <folder>] [--allow-private-refs] [--yes]
16210
16571
  integration-tour check <spec file or URL> [--edits <flow files or folder>]
16211
16572
  [--allow-private-refs]
16212
16573
 
@@ -16225,6 +16586,12 @@ render Without --edits, makes a video of each of the top three flows the spec s
16225
16586
  check Builds each video, and fails when a spec change lost a call, an edit or the failure
16226
16587
  a flow file shows, so a pull request can't break a video unnoticed.
16227
16588
 
16589
+ In a terminal, render first says what it hid on its own (credentials) and lists what the videos
16590
+ show that may be personal or internal (an email address, a phone number, a host on a private
16591
+ network, a long random value that may be a key), then asks whether they hold no secrets or
16592
+ personal data before it writes them. --yes answers yes, for a script. It never asks in CI, or
16593
+ where nothing can answer.
16594
+
16228
16595
  Files the spec references are read from its repo, and only JSON and YAML files there. URLs it
16229
16596
  references aren't read from this machine or a private network (such as a cloud's metadata
16230
16597
  address), as a spec in a pull request could have the build fetch what only it can reach, but
@@ -16254,8 +16621,8 @@ Without a license key in ${LICENSE_ENV}, the videos carry the "${WATERMARK}"
16254
16621
  watermark. A paid key removes it: ${BUY_URL}`;
16255
16622
  var MAX_NOTES = 10;
16256
16623
  var COMMANDS = ["render", "check"];
16257
- var OPTIONS = ["--edits", "--formats", "--out", "--allow-private-refs", "--help"];
16258
- async function main(argv, env = process.env, fontsDir = (0, import_node_path4.join)(__dirname, "..", "fonts")) {
16624
+ var OPTIONS = ["--edits", "--formats", "--out", "--allow-private-refs", "--yes", "--help"];
16625
+ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.join)(__dirname, "..", "fonts"), ask = terminalQuestion(env)) {
16259
16626
  const [command, ...rest] = argv;
16260
16627
  if (command === "--version" || command === "-v") {
16261
16628
  console.log(version);
@@ -16275,6 +16642,7 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16275
16642
  let formats = [...DEFAULT_FORMATS];
16276
16643
  let out;
16277
16644
  let allowPrivateRefs = false;
16645
+ let yes = false;
16278
16646
  let editing = false;
16279
16647
  for (let i = 0; i < rest.length; i++) {
16280
16648
  const arg = rest[i];
@@ -16287,6 +16655,9 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16287
16655
  if (flag === "--allow-private-refs") {
16288
16656
  if (inline2 !== void 0) return usage("--allow-private-refs takes no value.");
16289
16657
  allowPrivateRefs = true;
16658
+ } else if (flag === "--yes") {
16659
+ if (inline2 !== void 0) return usage("--yes takes no value.");
16660
+ yes = true;
16290
16661
  } else if (flag === "--edits") {
16291
16662
  if (inline2) edits.push(inline2);
16292
16663
  else if (inline2 !== void 0 || !rest[i + 1] || rest[i + 1].startsWith("-")) return usage("--edits needs a flow file, or a folder of them.");
@@ -16335,7 +16706,7 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16335
16706
  };
16336
16707
  const madeFor = /* @__PURE__ */ new Map();
16337
16708
  const announce = (total) => {
16338
- const made = command === "render" ? `, as ${list6(formats.map((format) => format.toUpperCase()))}` : "";
16709
+ const made = command === "render" ? `, as ${list7(formats.map((format) => format.toUpperCase()))}` : "";
16339
16710
  console.log(` ${command === "render" ? "Making" : "Checking"} ${total} video${total === 1 ? "" : "s"}${made}:`);
16340
16711
  };
16341
16712
  const heading = (n, total, label) => ` Video ${n} of ${total} \xB7 ${label}`;
@@ -16362,7 +16733,7 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16362
16733
  console.log(` Wrote ${(0, import_node_path4.relative)(process.cwd(), written2.path)} (${size(written2.bytes)})`);
16363
16734
  }
16364
16735
  };
16365
- console.log(spec);
16736
+ console.log(isUrl(spec) ? shownAddress(spec, true) : spec);
16366
16737
  let opened;
16367
16738
  try {
16368
16739
  opened = await openSpec(spec, { allowPrivateRefs });
@@ -16372,13 +16743,30 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16372
16743
  }
16373
16744
  for (const note of opened.notes.slice(0, MAX_NOTES)) console.log(` Note: ${note}`);
16374
16745
  if (opened.notes.length > MAX_NOTES) console.log(` \u2026and ${opened.notes.length - MAX_NOTES} more notes.`);
16746
+ const cleared = async (videos) => {
16747
+ if (command !== "render" || yes || !ask || !videos.length) return true;
16748
+ console.log(` Before ${videos.length === 1 ? "the video is" : "the videos are"} written, check what ${videos.length === 1 ? "it shows" : "they show"}:`);
16749
+ for (const line of reviewLines(mergeReviews(videos.map((v) => reviewOf(v.storyboard))))) console.log(` ${line}`);
16750
+ const answer = (await ask(` ${videos.length === 1 ? "Does it" : "Do they"} hold no secrets or personal data? (y/N) `)).trim().toLowerCase();
16751
+ if (answer === "y" || answer === "yes") return true;
16752
+ console.log(" Nothing was written. Change the spec or the flow file, or run it again with --yes once they're checked.");
16753
+ return false;
16754
+ };
16375
16755
  if (flowFiles.length) {
16376
16756
  const files = [...new Set(flowFiles)];
16377
- announce(files.length);
16378
- for (const [i, file] of files.entries()) {
16757
+ const built = [];
16758
+ for (const file of files) {
16379
16759
  try {
16380
- await make(await editedVideo(opened, file, fonts), file, out ?? (0, import_node_path4.dirname)(file), true, i + 1, files.length);
16760
+ built.push({ file, video: await editedVideo(opened, file, fonts) });
16381
16761
  } catch (err) {
16762
+ built.push({ file, err });
16763
+ }
16764
+ }
16765
+ if (!await cleared(built.flatMap((b) => b.video ? [b.video] : []))) return 1;
16766
+ announce(files.length);
16767
+ for (const [i, { file, video, err }] of built.entries()) {
16768
+ if (video) await make(video, file, out ?? (0, import_node_path4.dirname)(file), true, i + 1, files.length);
16769
+ else {
16382
16770
  console.log(heading(i + 1, files.length, file));
16383
16771
  fail(err);
16384
16772
  }
@@ -16386,6 +16774,7 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16386
16774
  } else {
16387
16775
  try {
16388
16776
  const videos = suggestedVideos(opened);
16777
+ if (!await cleared(videos)) return 1;
16389
16778
  announce(videos.length);
16390
16779
  for (const [i, built] of videos.entries()) await make(built, spec, out ?? (isUrl(spec) ? "." : (0, import_node_path4.dirname)(spec)), false, i + 1, videos.length);
16391
16780
  } catch (err) {
@@ -16394,6 +16783,17 @@ async function main(argv, env = process.env, fontsDir = (0, import_node_path4.jo
16394
16783
  }
16395
16784
  return failed ? 1 : 0;
16396
16785
  }
16786
+ function terminalQuestion(env) {
16787
+ if (!process.stdin.isTTY || !process.stdout.isTTY || env.CI) return void 0;
16788
+ return async (question) => {
16789
+ const terminal = (0, import_promises4.createInterface)({ input: process.stdin, output: process.stdout });
16790
+ try {
16791
+ return await terminal.question(question);
16792
+ } finally {
16793
+ terminal.close();
16794
+ }
16795
+ };
16796
+ }
16397
16797
  async function keyIsGood(key) {
16398
16798
  if (!key?.trim()) {
16399
16799
  console.log(`No license key in ${LICENSE_ENV}, so the videos carry the watermark. A paid key removes it: ${BUY_URL}`);
@@ -16446,7 +16846,7 @@ function distance(a, b) {
16446
16846
  }
16447
16847
  return above[b.length];
16448
16848
  }
16449
- function list6(items) {
16849
+ function list7(items) {
16450
16850
  return items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items.at(-1)}`;
16451
16851
  }
16452
16852
  function size(bytes) {