@swifty.js/swifty 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-GABA24KD.js → anthropic-GAI75HYJ.js} +1 -1
- package/dist/{chunk-N5AVRITT.js → chunk-BDSARQW3.js} +3 -3
- package/dist/chunk-LVLDD2BE.js +4 -0
- package/dist/glob_addon.node +0 -0
- package/dist/main.js +2 -2
- package/dist/{openai-GZSRO4RJ.js → openai-SMJX34AX.js} +1 -1
- package/dist/{server-EFD5B7YF.js → server-LIBUDDHX.js} +1 -1
- package/package.json +1 -1
- package/dist/chunk-GS6BRESU.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
3
|
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{g as w}from"./chunk-H7VXSMJR.js";import{l as C}from"./chunk-OXEMDMZF.js";import{e as D,g as F,h as R}from"./chunk-
|
|
4
|
+
import{g as w}from"./chunk-H7VXSMJR.js";import{l as C}from"./chunk-OXEMDMZF.js";import{e as D,g as F,h as R}from"./chunk-LVLDD2BE.js";import{b as O,c as U,d as M,e as $,f as K,g as W}from"./chunk-FZPTNGTU.js";import"./chunk-7MHXMDYC.js";import{C as P,I as N,J as v,K as j,L as I,M as k,N as B,g as S}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import"./chunk-X3UA5OZL.js";var x=N({module:"llm"});var Y=3e3,q=P.object({max_input_tokens:P.coerce.number()});async function at(o){if(o.protocol!=="anthropic")return 0;let t=R(o),s=`${o.base_url.replace(/\/+$/,"")}/v1/models/${encodeURIComponent(o.model)}`,n=new AbortController,a=setTimeout(()=>{n.abort()},Y);try{let l=await fetch(s,{method:"GET",headers:{"anthropic-version":"2023-06-01",...t?{"x-api-key":t}:{}},signal:n.signal});if(!l.ok)return 0;let g=await l.json(),{success:h,error:d,data:f}=await S(q,g);if(!h)return console.error(d.message),0;let y=f.max_input_tokens;return Math.max(y,0)}catch(l){return console.error(l),0}finally{clearTimeout(a)}}function J(){return!0}function H(o){return(o??[]).map(t=>({type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}}))}function L(o){let t=[];return(o.content||!o.images?.length)&&t.push({type:"text",text:o.content}),t.push(...H(o.images)),t}function z(o){let t=[];for(let e of o)if(e.role==="assistant"){let s=[];if(e.thinkingBlocks)for(let n of e.thinkingBlocks)s.push({type:"thinking",thinking:n.thinking,signature:n.signature});if(e.content&&s.push({type:"text",text:e.content}),e.toolUses)for(let n of e.toolUses)s.push({type:"tool_use",id:n.toolUseId,name:n.toolName,input:n.arguments});s.length===0&&s.push({type:"text",text:""}),t.push({role:"assistant",content:s})}else if(e.toolResults&&e.toolResults.length>0){let s=[];for(let n of e.toolResults)s.push({type:"tool_result",tool_use_id:n.toolUseId,is_error:n.isError,content:n.images?.length?[{type:"text",text:n.content},...H(n.images)]:n.content});t.push({role:"user",content:s})}else{if(t.length===0){t.push({role:"user",content:L(e)});continue}let s=!1,n=t[t.length-1],a=n.content;n.role==="user"&&(typeof a=="string"||Array.isArray(a)&&a.length>0&&(a[0].type==="text"||a[0].type==="image"))&&(s=!0),s?(typeof a=="string"&&(a=n.content=a.trim().length>0?[{type:"text",text:a}]:[]),a.push(...L(e))):t.push({role:"user",content:L(e)})}return t}var G=class{client;model;thinking;systemPrompt;maxOutputTokens;contextWindow;constructor(t,e){let s=R(t);if(!s)throw new M("Anthropic API key not found, set ANTHROPIC_API_KEY in .swifty/config.y(a)ml, or via ANTHROPIC_API_KEY env variable.");this.client=new w({apiKey:s,baseURL:t.base_url}),this.model=t.model,this.thinking=t.thinking??!0,this.systemPrompt=e,this.maxOutputTokens=F(t),this.contextWindow=D(t)}setSystemPrompt(t){this.systemPrompt=t}setMaxOutputTokens(t){this.maxOutputTokens=t}async*stream(t,e,s){let n=z(O(t.getMessages())),a=e.map(c=>{let p=c.input_schema;return{name:c.name,description:c.description,input_schema:{type:"object",properties:p.properties,required:p.required??[]}}});a.length>0&&(a[a.length-1].cache_control={type:"ephemeral"}),Q(n);let l={model:this.model,max_tokens:this.maxOutputTokens,stream:!0,system:[{type:"text",text:this.systemPrompt,cache_control:{type:"ephemeral"}}],messages:n,...a.length>0?{tools:a}:{}};this.thinking?J()&&(l.thinking={type:"enabled",budget_tokens:C(this.contextWindow,this.maxOutputTokens)}):l.thinking={type:"enabled",budget_tokens:C(this.contextWindow,this.maxOutputTokens)};let g=0,h=0,d=0,f=0,y="end_turn",b="",A="",T=!1,E=0;try{let c=this.client.messages.stream(l,{...s?{signal:s}:{}}),p="",_="",u="";for await(let i of c)switch(i.type){case"content_block_start":{let r=i.content_block;r.type==="thinking"?(T=!0,b="",A=""):r.type==="tool_use"&&(_=r.id,p=r.name,u="",yield{type:"tool_call_start",toolName:p,toolId:_});break}case"content_block_delta":{let r=i.delta;r.type==="thinking_delta"?(b+=r.thinking,yield{type:"thinking_delta",text:r.thinking}):r.type==="signature_delta"?(x.debug({signature:r.signature},"thinking signature received"),A=r.signature):r.type==="text_delta"?yield{type:"text_delta",text:r.text}:r.type==="input_json_delta"&&(u+=r.partial_json,yield{type:"tool_call_delta",text:r.partial_json});break}case"content_block_stop":{if(T&&(yield{type:"thinking_complete",thinking:b,signature:A},T=!1),p){let r={};if(u)try{let m=JSON.parse(u);r=j(m)?I(m):{[v]:u}}catch(m){x.error({err:m},"llm operation failed"),r={[v]:u}}yield{type:"tool_call_complete",toolId:_,toolName:p,arguments:r},p="",_="",u=""}break}case"message_delta":{i.delta.stop_reason&&(y=i.delta.stop_reason),i.usage.output_tokens&&(h=i.usage.output_tokens,i.usage.input_tokens&&(g=i.usage.input_tokens),i.usage.cache_read_input_tokens&&(d=i.usage.cache_read_input_tokens),i.usage.cache_creation_input_tokens&&(f=i.usage.cache_creation_input_tokens));break}case"message_start":{E=Date.now(),g=i.message.usage.input_tokens,h=i.message.usage.output_tokens,d=i.message.usage.cache_read_input_tokens??0,f=i.message.usage.cache_creation_input_tokens??0;break}case"message_stop":{let m=Date.now()-E;x.debug({elapsedMs:m},"message stream complete");break}}yield{type:"stream_end",stopReason:y,usage:{inputTokens:g,outputTokens:h,cacheReadInputTokens:d,cacheCreationInputTokens:f}}}catch(c){throw x.error({err:c},"llm operation failed"),V(c)}}};function Q(o){for(let t=o.length-1;t>=0;t--){if(o[t].role!=="user")continue;let e=o[t].content;if(typeof e=="string"&&e.length===0||Array.isArray(e)&&e.length===0)return;typeof e=="string"&&(e=o[t].content=[{type:"text",text:e}]);let s=e[e.length-1];for(let n=e.length-1;n>=0;n--)if(e[n].type!=="image"){s=e[n];break}Reflect.set(s,"cache_control",{type:"ephemeral"})}}function V(o){if(o instanceof w.APIError){if(o.status===413||/prompts?\s+too\s+long/i.test(o.message))return new W(`Prompt too long: ${o.message}`);if(o.status===401)return new M(`Invalid API key: ${o.message}`);if(o.status===429){let t=I(o.headers)["retry-after"],e="Rate Limited";if(t){let s=Number.parseInt(k(t));Number.isNaN(s)&&(e+=", please wait."),e+=`, retry after ${k(s)}s.`}else e+=", please wait.";return new $(e,t?k(t):void 0)}return new U(`Anthropic API error (${k(o.status)}): ${o.message}`)}return new K(`Network error: ${B(o)}`)}export{G as AnthropicClient,z as buildAnthropicMessages,at as fetchModelContextWindow,Q as markLastUserTailForCache};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
3
|
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{a as po,b as Ul,c as Fl,f as Hl}from"./chunk-UBV5T4TV.js";import{b as ql,c as Dl,d as Ll,j as uo}from"./chunk-A6H62GTA.js";import{a as er}from"./chunk-OXEMDMZF.js";import{a as Ue,b as Pl,c as ao,d as co}from"./chunk-GS6BRESU.js";import{e as tr}from"./chunk-ZSJ2I5WM.js";import{a as ft}from"./chunk-7MHXMDYC.js";import{A as jl,B as Nl,C as A,D as _,I as C,L as ri,N,P as Rt,Q as Wr,R as E,S as lo,a as El,d as Rl,e as xe,f as Cl,g as Ml,h as p,i as zl,j as B,k as Z,l as Al,m as Il,n as se,o as T,p as x,q as ce,r as ee,s as Qs,t as ei,u as Y,v as ze,w as P,x as re,y as Ol,z as ti}from"./chunk-ISXLT3QN.js";import{a as mt,b as S,d as io}from"./chunk-X3UA5OZL.js";var un=S(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.regexpCode=G.getEsmExportName=G.getProperty=G.safeStringify=G.stringify=G.strConcat=G.addCodeArg=G.str=G._=G.nil=G._Code=G.Name=G.IDENTIFIER=G._CodeOrName=void 0;var cn=class{};G._CodeOrName=cn;G.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ot=class extends cn{constructor(e){if(super(),!G.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};G.Name=Ot;var Ne=class extends cn{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ot&&(r[n.str]=(r[n.str]||0)+1),r),{})}};G._Code=Ne;G.nil=new Ne("");function qd(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Xi(r,e[n]),r.push(t[++n]);return new Ne(r)}G._=qd;var Yi=new Ne("+");function Dd(t,...e){let r=[ln(t[0])],n=0;for(;n<e.length;)r.push(Yi),Xi(r,e[n]),r.push(Yi,ln(t[++n]));return dv(r),new Ne(r)}G.str=Dd;function Xi(t,e){e instanceof Ne?t.push(...e._items):e instanceof Ot?t.push(e):t.push(fv(e))}G.addCodeArg=Xi;function dv(t){let e=1;for(;e<t.length-1;){if(t[e]===Yi){let r=pv(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function pv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ot||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ot))return`"${t}${e.slice(1)}`}function mv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Dd`${t}${e}`}G.strConcat=mv;function fv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:ln(Array.isArray(t)?t.join(","):t)}function hv(t){return new Ne(ln(t))}G.stringify=hv;function ln(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}G.safeStringify=ln;function gv(t){return typeof t=="string"&&G.IDENTIFIER.test(t)?new Ne(`.${t}`):qd`[${t}]`}G.getProperty=gv;function yv(t){if(typeof t=="string"&&G.IDENTIFIER.test(t))return new Ne(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}G.getEsmExportName=yv;function _v(t){return new Ne(t.toString())}G.regexpCode=_v});var ta=S(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ValueScope=Pe.ValueScopeName=Pe.Scope=Pe.varKinds=Pe.UsedValueState=void 0;var Ee=un(),Qi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Bo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Bo||(Pe.UsedValueState=Bo={}));Pe.varKinds={const:new Ee.Name("const"),let:new Ee.Name("let"),var:new Ee.Name("var")};var Go=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ee.Name?e:this.name(e)}name(e){return new Ee.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Pe.Scope=Go;var Ko=class extends Ee.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ee._)`.${new Ee.Name(r)}[${n}]`}};Pe.ValueScopeName=Ko;var wv=(0,Ee._)`\n`,ea=class extends Go{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?wv:Ee.nil}}get(){return this._scope}name(e){return new Ko(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ee._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Ee.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Bo.Started);let l=r(u);if(l){let d=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const;s=(0,Ee._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ee._)`${s}${l}${this.opts._n}`;else throw new Qi(u);c.set(u,Bo.Completed)})}return s}};Pe.ValueScope=ea});var D=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.or=L.and=L.not=L.CodeGen=L.operators=L.varKinds=L.ValueScopeName=L.ValueScope=L.Scope=L.Name=L.regexpCode=L.stringify=L.getProperty=L.nil=L.strConcat=L.str=L._=void 0;var H=un(),Fe=ta(),wt=un();Object.defineProperty(L,"_",{enumerable:!0,get:function(){return wt._}});Object.defineProperty(L,"str",{enumerable:!0,get:function(){return wt.str}});Object.defineProperty(L,"strConcat",{enumerable:!0,get:function(){return wt.strConcat}});Object.defineProperty(L,"nil",{enumerable:!0,get:function(){return wt.nil}});Object.defineProperty(L,"getProperty",{enumerable:!0,get:function(){return wt.getProperty}});Object.defineProperty(L,"stringify",{enumerable:!0,get:function(){return wt.stringify}});Object.defineProperty(L,"regexpCode",{enumerable:!0,get:function(){return wt.regexpCode}});Object.defineProperty(L,"Name",{enumerable:!0,get:function(){return wt.Name}});var Xo=ta();Object.defineProperty(L,"Scope",{enumerable:!0,get:function(){return Xo.Scope}});Object.defineProperty(L,"ValueScope",{enumerable:!0,get:function(){return Xo.ValueScope}});Object.defineProperty(L,"ValueScopeName",{enumerable:!0,get:function(){return Xo.ValueScopeName}});Object.defineProperty(L,"varKinds",{enumerable:!0,get:function(){return Xo.varKinds}});L.operators={GT:new H._Code(">"),GTE:new H._Code(">="),LT:new H._Code("<"),LTE:new H._Code("<="),EQ:new H._Code("==="),NEQ:new H._Code("!=="),NOT:new H._Code("!"),OR:new H._Code("||"),AND:new H._Code("&&"),ADD:new H._Code("+")};var tt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ra=class extends tt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Fe.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=pr(this.rhs,e,r)),this}get names(){return this.rhs instanceof H._CodeOrName?this.rhs.names:{}}},Zo=class extends tt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof H.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=pr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof H.Name?{}:{...this.lhs.names};return Yo(e,this.rhs)}},na=class extends Zo{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oa=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},sa=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ia=class extends tt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},aa=class extends tt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=pr(this.code,e,r),this}get names(){return this.code instanceof H._CodeOrName?this.code.names:{}}},dn=class extends tt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(vv(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>qt(e,r.names),{})}},rt=class extends dn{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ca=class extends dn{},dr=class extends rt{};dr.kind="else";var jt=class t extends rt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new dr(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Ld(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=pr(this.condition,e,r),this}get names(){let e=super.names;return Yo(e,this.condition),this.else&&qt(e,this.else.names),e}};jt.kind="if";var Nt=class extends rt{};Nt.kind="for";var la=class extends Nt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=pr(this.iteration,e,r),this}get names(){return qt(super.names,this.iteration.names)}},ua=class extends Nt{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Fe.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Yo(super.names,this.from);return Yo(e,this.to)}},Jo=class extends Nt{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=pr(this.iterable,e,r),this}get names(){return qt(super.names,this.iterable.names)}},pn=class extends rt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};pn.kind="func";var mn=class extends dn{render(e){return"return "+super.render(e)}};mn.kind="return";var da=class extends rt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&qt(e,this.catch.names),this.finally&&qt(e,this.finally.names),e}},fn=class extends rt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};fn.kind="catch";var hn=class extends rt{render(e){return"finally"+super.render(e)}};hn.kind="finally";var pa=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
4
|
+
import{a as po,b as Ul,c as Fl,f as Hl}from"./chunk-UBV5T4TV.js";import{b as ql,c as Dl,d as Ll,j as uo}from"./chunk-A6H62GTA.js";import{a as er}from"./chunk-OXEMDMZF.js";import{a as Ue,b as Pl,c as ao,d as co}from"./chunk-LVLDD2BE.js";import{e as tr}from"./chunk-ZSJ2I5WM.js";import{a as ft}from"./chunk-7MHXMDYC.js";import{A as jl,B as Nl,C as A,D as _,I as C,L as ri,N,P as Rt,Q as Wr,R as E,S as lo,a as El,d as Rl,e as xe,f as Cl,g as Ml,h as p,i as zl,j as B,k as Z,l as Al,m as Il,n as se,o as T,p as x,q as ce,r as ee,s as Qs,t as ei,u as Y,v as ze,w as P,x as re,y as Ol,z as ti}from"./chunk-ISXLT3QN.js";import{a as mt,b as S,d as io}from"./chunk-X3UA5OZL.js";var un=S(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.regexpCode=G.getEsmExportName=G.getProperty=G.safeStringify=G.stringify=G.strConcat=G.addCodeArg=G.str=G._=G.nil=G._Code=G.Name=G.IDENTIFIER=G._CodeOrName=void 0;var cn=class{};G._CodeOrName=cn;G.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Ot=class extends cn{constructor(e){if(super(),!G.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};G.Name=Ot;var Ne=class extends cn{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Ot&&(r[n.str]=(r[n.str]||0)+1),r),{})}};G._Code=Ne;G.nil=new Ne("");function qd(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Xi(r,e[n]),r.push(t[++n]);return new Ne(r)}G._=qd;var Yi=new Ne("+");function Dd(t,...e){let r=[ln(t[0])],n=0;for(;n<e.length;)r.push(Yi),Xi(r,e[n]),r.push(Yi,ln(t[++n]));return dv(r),new Ne(r)}G.str=Dd;function Xi(t,e){e instanceof Ne?t.push(...e._items):e instanceof Ot?t.push(e):t.push(fv(e))}G.addCodeArg=Xi;function dv(t){let e=1;for(;e<t.length-1;){if(t[e]===Yi){let r=pv(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function pv(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Ot||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Ot))return`"${t}${e.slice(1)}`}function mv(t,e){return e.emptyStr()?t:t.emptyStr()?e:Dd`${t}${e}`}G.strConcat=mv;function fv(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:ln(Array.isArray(t)?t.join(","):t)}function hv(t){return new Ne(ln(t))}G.stringify=hv;function ln(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}G.safeStringify=ln;function gv(t){return typeof t=="string"&&G.IDENTIFIER.test(t)?new Ne(`.${t}`):qd`[${t}]`}G.getProperty=gv;function yv(t){if(typeof t=="string"&&G.IDENTIFIER.test(t))return new Ne(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}G.getEsmExportName=yv;function _v(t){return new Ne(t.toString())}G.regexpCode=_v});var ta=S(Pe=>{"use strict";Object.defineProperty(Pe,"__esModule",{value:!0});Pe.ValueScope=Pe.ValueScopeName=Pe.Scope=Pe.varKinds=Pe.UsedValueState=void 0;var Ee=un(),Qi=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Bo;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Bo||(Pe.UsedValueState=Bo={}));Pe.varKinds={const:new Ee.Name("const"),let:new Ee.Name("let"),var:new Ee.Name("var")};var Go=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Ee.Name?e:this.name(e)}name(e){return new Ee.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Pe.Scope=Go;var Ko=class extends Ee.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Ee._)`.${new Ee.Name(r)}[${n}]`}};Pe.ValueScopeName=Ko;var wv=(0,Ee._)`\n`,ea=class extends Go{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?wv:Ee.nil}}get(){return this._scope}name(e){return new Ko(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ee._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=Ee.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,Bo.Started);let l=r(u);if(l){let d=this.opts.es5?Pe.varKinds.var:Pe.varKinds.const;s=(0,Ee._)`${s}${d} ${u} = ${l};${this.opts._n}`}else if(l=o?.(u))s=(0,Ee._)`${s}${l}${this.opts._n}`;else throw new Qi(u);c.set(u,Bo.Completed)})}return s}};Pe.ValueScope=ea});var D=S(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.or=L.and=L.not=L.CodeGen=L.operators=L.varKinds=L.ValueScopeName=L.ValueScope=L.Scope=L.Name=L.regexpCode=L.stringify=L.getProperty=L.nil=L.strConcat=L.str=L._=void 0;var H=un(),Fe=ta(),wt=un();Object.defineProperty(L,"_",{enumerable:!0,get:function(){return wt._}});Object.defineProperty(L,"str",{enumerable:!0,get:function(){return wt.str}});Object.defineProperty(L,"strConcat",{enumerable:!0,get:function(){return wt.strConcat}});Object.defineProperty(L,"nil",{enumerable:!0,get:function(){return wt.nil}});Object.defineProperty(L,"getProperty",{enumerable:!0,get:function(){return wt.getProperty}});Object.defineProperty(L,"stringify",{enumerable:!0,get:function(){return wt.stringify}});Object.defineProperty(L,"regexpCode",{enumerable:!0,get:function(){return wt.regexpCode}});Object.defineProperty(L,"Name",{enumerable:!0,get:function(){return wt.Name}});var Xo=ta();Object.defineProperty(L,"Scope",{enumerable:!0,get:function(){return Xo.Scope}});Object.defineProperty(L,"ValueScope",{enumerable:!0,get:function(){return Xo.ValueScope}});Object.defineProperty(L,"ValueScopeName",{enumerable:!0,get:function(){return Xo.ValueScopeName}});Object.defineProperty(L,"varKinds",{enumerable:!0,get:function(){return Xo.varKinds}});L.operators={GT:new H._Code(">"),GTE:new H._Code(">="),LT:new H._Code("<"),LTE:new H._Code("<="),EQ:new H._Code("==="),NEQ:new H._Code("!=="),NOT:new H._Code("!"),OR:new H._Code("||"),AND:new H._Code("&&"),ADD:new H._Code("+")};var tt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ra=class extends tt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Fe.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=pr(this.rhs,e,r)),this}get names(){return this.rhs instanceof H._CodeOrName?this.rhs.names:{}}},Zo=class extends tt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof H.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=pr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof H.Name?{}:{...this.lhs.names};return Yo(e,this.rhs)}},na=class extends Zo{constructor(e,r,n,o){super(e,n,o),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},oa=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},sa=class extends tt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},ia=class extends tt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},aa=class extends tt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=pr(this.code,e,r),this}get names(){return this.code instanceof H._CodeOrName?this.code.names:{}}},dn=class extends tt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(vv(e,s.names),n.splice(o,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>qt(e,r.names),{})}},rt=class extends dn{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},ca=class extends dn{},dr=class extends rt{};dr.kind="else";var jt=class t extends rt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new dr(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Ld(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=pr(this.condition,e,r),this}get names(){let e=super.names;return Yo(e,this.condition),this.else&&qt(e,this.else.names),e}};jt.kind="if";var Nt=class extends rt{};Nt.kind="for";var la=class extends Nt{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=pr(this.iteration,e,r),this}get names(){return qt(super.names,this.iteration.names)}},ua=class extends Nt{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o}render(e){let r=e.es5?Fe.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Yo(super.names,this.from);return Yo(e,this.to)}},Jo=class extends Nt{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=pr(this.iterable,e,r),this}get names(){return qt(super.names,this.iterable.names)}},pn=class extends rt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};pn.kind="func";var mn=class extends dn{render(e){return"return "+super.render(e)}};mn.kind="return";var da=class extends rt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&qt(e,this.catch.names),this.finally&&qt(e,this.finally.names),e}},fn=class extends rt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};fn.kind="catch";var hn=class extends rt{render(e){return"finally"+super.render(e)}};hn.kind="finally";var pa=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
5
5
|
`:""},this._extScope=e,this._scope=new Fe.Scope({parent:e}),this._nodes=[new ca]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new ra(e,s,n)),s}const(e,r,n){return this._def(Fe.varKinds.const,e,r,n)}let(e,r,n){return this._def(Fe.varKinds.let,e,r,n)}var(e,r,n){return this._def(Fe.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Zo(e,r,n))}add(e,r){return this._leafNode(new na(e,L.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==H.nil&&this._leafNode(new aa(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,H.addCodeArg)(r,o));return r.push("}"),new H._Code(r)}if(e,r,n){if(this._blockNode(new jt(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new jt(e))}else(){return this._elseNode(new dr)}endIf(){return this._endBlockNode(jt,dr)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new la(e),r)}forRange(e,r,n,o,s=this.opts.es5?Fe.varKinds.var:Fe.varKinds.let){let i=this._scope.toName(e);return this._for(new ua(s,i,r,n),()=>o(i))}forOf(e,r,n,o=Fe.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof H.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,H._)`${i}.length`,a=>{this.var(s,(0,H._)`${i}[${a}]`),n(s)})}return this._for(new Jo("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?Fe.varKinds.var:Fe.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,H._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Jo("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Nt)}label(e){return this._leafNode(new oa(e))}break(e){return this._leafNode(new sa(e))}return(e){let r=new mn;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(mn)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new da;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new fn(s),r(s)}return n&&(this._currNode=o.finally=new hn,this.code(n)),this._endBlockNode(fn,hn)}throw(e){return this._leafNode(new ia(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=H.nil,n,o){return this._blockNode(new pn(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(pn)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof jt))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};L.CodeGen=pa;function qt(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Yo(t,e){return e instanceof H._CodeOrName?qt(t,e.names):t}function pr(t,e,r){if(t instanceof H.Name)return n(t);if(!o(t))return t;return new H._Code(t._items.reduce((s,i)=>(i instanceof H.Name&&(i=n(i)),i instanceof H._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof H._Code&&s._items.some(i=>i instanceof H.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function vv(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Ld(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,H._)`!${ma(t)}`}L.not=Ld;var bv=Ud(L.operators.AND);function Sv(...t){return t.reduce(bv)}L.and=Sv;var kv=Ud(L.operators.OR);function Tv(...t){return t.reduce(kv)}L.or=Tv;function Ud(t){return(e,r)=>e===H.nil?r:r===H.nil?e:(0,H._)`${ma(e)} ${t} ${ma(r)}`}function ma(t){return t instanceof H.Name?t:(0,H._)`(${t})`}});var W=S(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.checkStrictMode=U.getErrorPath=U.Type=U.useFunc=U.setEvaluated=U.evaluatedPropsToName=U.mergeEvaluated=U.eachItem=U.unescapeJsonPointer=U.escapeJsonPointer=U.escapeFragment=U.unescapeFragment=U.schemaRefOrVal=U.schemaHasRulesButRef=U.schemaHasRules=U.checkUnknownRules=U.alwaysValidSchema=U.toHash=void 0;var J=D(),xv=un();function $v(t){let e={};for(let r of t)e[r]=!0;return e}U.toHash=$v;function Ev(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Wd(t,e),!Vd(e,t.self.RULES.all))}U.alwaysValidSchema=Ev;function Wd(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||Kd(t,`unknown keyword: "${s}"`)}U.checkUnknownRules=Wd;function Vd(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}U.schemaHasRules=Vd;function Pv(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}U.schemaHasRulesButRef=Pv;function Rv({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,J._)`${r}`}return(0,J._)`${t}${e}${(0,J.getProperty)(n)}`}U.schemaRefOrVal=Rv;function Cv(t){return Bd(decodeURIComponent(t))}U.unescapeFragment=Cv;function Mv(t){return encodeURIComponent(ha(t))}U.escapeFragment=Mv;function ha(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}U.escapeJsonPointer=ha;function Bd(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}U.unescapeJsonPointer=Bd;function zv(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}U.eachItem=zv;function Fd({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(o,s,i,a)=>{let c=i===void 0?s:i instanceof J.Name?(s instanceof J.Name?t(o,s,i):e(o,s,i),i):s instanceof J.Name?(e(o,i,s),s):r(s,i);return a===J.Name&&!(c instanceof J.Name)?n(o,c):c}}U.mergeEvaluated={props:Fd({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,J._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,J._)`${r} || {}`).code((0,J._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,J._)`${r} || {}`),ga(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Gd}),items:Fd({mergeNames:(t,e,r)=>t.if((0,J._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,J._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,J._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,J._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Gd(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,J._)`{}`);return e!==void 0&&ga(t,r,e),r}U.evaluatedPropsToName=Gd;function ga(t,e,r){Object.keys(r).forEach(n=>t.assign((0,J._)`${e}${(0,J.getProperty)(n)}`,!0))}U.setEvaluated=ga;var Hd={};function Av(t,e){return t.scopeValue("func",{ref:e,code:Hd[e.code]||(Hd[e.code]=new xv._Code(e.code))})}U.useFunc=Av;var fa;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(fa||(U.Type=fa={}));function Iv(t,e,r){if(t instanceof J.Name){let n=e===fa.Num;return r?n?(0,J._)`"[" + ${t} + "]"`:(0,J._)`"['" + ${t} + "']"`:n?(0,J._)`"/" + ${t}`:(0,J._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,J.getProperty)(t).toString():"/"+ha(t)}U.getErrorPath=Iv;function Kd(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}U.checkStrictMode=Kd});var nt=S(ya=>{"use strict";Object.defineProperty(ya,"__esModule",{value:!0});var _e=D(),Ov={data:new _e.Name("data"),valCxt:new _e.Name("valCxt"),instancePath:new _e.Name("instancePath"),parentData:new _e.Name("parentData"),parentDataProperty:new _e.Name("parentDataProperty"),rootData:new _e.Name("rootData"),dynamicAnchors:new _e.Name("dynamicAnchors"),vErrors:new _e.Name("vErrors"),errors:new _e.Name("errors"),this:new _e.Name("this"),self:new _e.Name("self"),scope:new _e.Name("scope"),json:new _e.Name("json"),jsonPos:new _e.Name("jsonPos"),jsonLen:new _e.Name("jsonLen"),jsonPart:new _e.Name("jsonPart")};ya.default=Ov});var gn=S(we=>{"use strict";Object.defineProperty(we,"__esModule",{value:!0});we.extendErrors=we.resetErrorsCount=we.reportExtraError=we.reportError=we.keyword$DataError=we.keywordError=void 0;var V=D(),Qo=W(),be=nt();we.keywordError={message:({keyword:t})=>(0,V.str)`must pass "${t}" keyword validation`};we.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,V.str)`"${t}" keyword must be ${e} ($data)`:(0,V.str)`"${t}" keyword is invalid ($data)`};function jv(t,e=we.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=Yd(t,e,r);n??(i||a)?Zd(s,c):Jd(o,(0,V._)`[${c}]`)}we.reportError=jv;function Nv(t,e=we.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=Yd(t,e,r);Zd(o,a),s||i||Jd(n,be.default.vErrors)}we.reportExtraError=Nv;function qv(t,e){t.assign(be.default.errors,e),t.if((0,V._)`${be.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,V._)`${be.default.vErrors}.length`,e),()=>t.assign(be.default.vErrors,null)))}we.resetErrorsCount=qv;function Dv({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,be.default.errors,a=>{t.const(i,(0,V._)`${be.default.vErrors}[${a}]`),t.if((0,V._)`${i}.instancePath === undefined`,()=>t.assign((0,V._)`${i}.instancePath`,(0,V.strConcat)(be.default.instancePath,s.errorPath))),t.assign((0,V._)`${i}.schemaPath`,(0,V.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,V._)`${i}.schema`,r),t.assign((0,V._)`${i}.data`,n))})}we.extendErrors=Dv;function Zd(t,e){let r=t.const("err",e);t.if((0,V._)`${be.default.vErrors} === null`,()=>t.assign(be.default.vErrors,(0,V._)`[${r}]`),(0,V._)`${be.default.vErrors}.push(${r})`),t.code((0,V._)`${be.default.errors}++`)}function Jd(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0,V._)`new ${t.ValidationError}(${e})`):(r.assign((0,V._)`${n}.errors`,e),r.return(!1))}var Dt={keyword:new V.Name("keyword"),schemaPath:new V.Name("schemaPath"),params:new V.Name("params"),propertyName:new V.Name("propertyName"),message:new V.Name("message"),schema:new V.Name("schema"),parentSchema:new V.Name("parentSchema")};function Yd(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,V._)`{}`:Lv(t,e,r)}function Lv(t,e,r={}){let{gen:n,it:o}=t,s=[Uv(o,r),Fv(t,r)];return Hv(t,e,s),n.object(...s)}function Uv({errorPath:t},{instancePath:e}){let r=e?(0,V.str)`${t}${(0,Qo.getErrorPath)(e,Qo.Type.Str)}`:t;return[be.default.instancePath,(0,V.strConcat)(be.default.instancePath,r)]}function Fv({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0,V.str)`${e}/${t}`;return r&&(o=(0,V.str)`${o}${(0,Qo.getErrorPath)(r,Qo.Type.Str)}`),[Dt.schemaPath,o]}function Hv(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Dt.keyword,o],[Dt.params,typeof e=="function"?e(t):e||(0,V._)`{}`]),c.messages&&n.push([Dt.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Dt.schema,i],[Dt.parentSchema,(0,V._)`${l}${d}`],[be.default.data,s]),u&&n.push([Dt.propertyName,u])}});var Qd=S(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});mr.boolOrEmptySchema=mr.topBoolOrEmptySchema=void 0;var Wv=gn(),Vv=D(),Bv=nt(),Gv={message:"boolean schema is false"};function Kv(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Xd(t,!1):typeof r=="object"&&r.$async===!0?e.return(Bv.default.data):(e.assign((0,Vv._)`${n}.errors`,null),e.return(!0))}mr.topBoolOrEmptySchema=Kv;function Zv(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Xd(t)):r.var(e,!0)}mr.boolOrEmptySchema=Zv;function Xd(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Wv.reportError)(o,Gv,void 0,e)}});var _a=S(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.getRules=fr.isJSONType=void 0;var Jv=["string","number","integer","boolean","null","object","array"],Yv=new Set(Jv);function Xv(t){return typeof t=="string"&&Yv.has(t)}fr.isJSONType=Xv;function Qv(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}fr.getRules=Qv});var wa=S(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:!0});vt.shouldUseRule=vt.shouldUseGroup=vt.schemaHasRulesForType=void 0;function eb({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&ep(t,n)}vt.schemaHasRulesForType=eb;function ep(t,e){return e.rules.some(r=>tp(t,r))}vt.shouldUseGroup=ep;function tp(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}vt.shouldUseRule=tp});var yn=S(ve=>{"use strict";Object.defineProperty(ve,"__esModule",{value:!0});ve.reportTypeError=ve.checkDataTypes=ve.checkDataType=ve.coerceAndCheckDataType=ve.getJSONTypes=ve.getSchemaTypes=ve.DataType=void 0;var tb=_a(),rb=wa(),nb=gn(),q=D(),rp=W(),hr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(hr||(ve.DataType=hr={}));function ob(t){let e=np(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}ve.getSchemaTypes=ob;function np(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(tb.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}ve.getJSONTypes=np;function sb(t,e){let{gen:r,data:n,opts:o}=t,s=ib(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0,rb.schemaHasRulesForType)(t,e[0]));if(i){let a=ba(e,n,o.strictNumbers,hr.Wrong);r.if(a,()=>{s.length?ab(t,e,s):Sa(t)})}return i}ve.coerceAndCheckDataType=sb;var op=new Set(["string","number","integer","boolean","null"]);function ib(t,e){return e?t.filter(r=>op.has(r)||e==="array"&&r==="array"):[]}function ab(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0,q._)`typeof ${o}`),a=n.let("coerced",(0,q._)`undefined`);s.coerceTypes==="array"&&n.if((0,q._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0,q._)`${o}[0]`).assign(i,(0,q._)`typeof ${o}`).if(ba(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0,q._)`${a} !== undefined`);for(let u of r)(op.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Sa(t),n.endIf(),n.if((0,q._)`${a} !== undefined`,()=>{n.assign(o,a),cb(t,a)});function c(u){switch(u){case"string":n.elseIf((0,q._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0,q._)`"" + ${o}`).elseIf((0,q._)`${o} === null`).assign(a,(0,q._)`""`);return;case"number":n.elseIf((0,q._)`${i} == "boolean" || ${o} === null
|
|
6
6
|
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0,q._)`+${o}`);return;case"integer":n.elseIf((0,q._)`${i} === "boolean" || ${o} === null
|
|
7
7
|
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0,q._)`+${o}`);return;case"boolean":n.elseIf((0,q._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,!1).elseIf((0,q._)`${o} === "true" || ${o} === 1`).assign(a,!0);return;case"null":n.elseIf((0,q._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case"array":n.elseIf((0,q._)`${i} === "string" || ${i} === "number"
|
|
8
8
|
|| ${i} === "boolean" || ${o} === null`).assign(a,(0,q._)`[${o}]`)}}}function cb({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,q._)`${e} !== undefined`,()=>t.assign((0,q._)`${e}[${r}]`,n))}function va(t,e,r,n=hr.Correct){let o=n===hr.Correct?q.operators.EQ:q.operators.NEQ,s;switch(t){case"null":return(0,q._)`${e} ${o} null`;case"array":s=(0,q._)`Array.isArray(${e})`;break;case"object":s=(0,q._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=i((0,q._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=i();break;default:return(0,q._)`typeof ${e} ${o} ${t}`}return n===hr.Correct?s:(0,q.not)(s);function i(a=q.nil){return(0,q.and)((0,q._)`typeof ${e} == "number"`,a,r?(0,q._)`isFinite(${e})`:q.nil)}}ve.checkDataType=va;function ba(t,e,r,n){if(t.length===1)return va(t[0],e,r,n);let o,s=(0,rp.toHash)(t);if(s.array&&s.object){let i=(0,q._)`typeof ${e} != "object"`;o=s.null?i:(0,q._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object}else o=q.nil;s.number&&delete s.integer;for(let i in s)o=(0,q.and)(o,va(i,e,r,n));return o}ve.checkDataTypes=ba;var lb={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,q._)`{type: ${t}}`:(0,q._)`{type: ${e}}`};function Sa(t){let e=ub(t);(0,nb.reportError)(e,lb)}ve.reportTypeError=Sa;function ub(t){let{gen:e,data:r,schema:n}=t,o=(0,rp.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var ip=S(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.assignDefaults=void 0;var gr=D(),db=W();function pb(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)sp(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>sp(t,s,o.default))}es.assignDefaults=pb;function sp(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0,gr._)`${s}${(0,gr.getProperty)(e)}`;if(o){(0,db.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,gr._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0,gr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,gr._)`${a} = ${(0,gr.stringify)(r)}`)}});var qe=S(K=>{"use strict";Object.defineProperty(K,"__esModule",{value:!0});K.validateUnion=K.validateArray=K.usePattern=K.callValidateCode=K.schemaProperties=K.allSchemaProperties=K.noPropertyInData=K.propertyInData=K.isOwnProperty=K.hasPropFunc=K.reportMissingProp=K.checkMissingProp=K.checkReportMissingProp=void 0;var X=D(),ka=W(),bt=nt(),mb=W();function fb(t,e){let{gen:r,data:n,it:o}=t;r.if(xa(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0,X._)`${e}`},!0),t.error()})}K.checkReportMissingProp=fb;function hb({gen:t,data:e,it:{opts:r}},n,o){return(0,X.or)(...n.map(s=>(0,X.and)(xa(t,e,s,r.ownProperties),(0,X._)`${o} = ${s}`)))}K.checkMissingProp=hb;function gb(t,e){t.setParams({missingProperty:e},!0),t.error()}K.reportMissingProp=gb;function ap(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,X._)`Object.prototype.hasOwnProperty`})}K.hasPropFunc=ap;function Ta(t,e,r){return(0,X._)`${ap(t)}.call(${e}, ${r})`}K.isOwnProperty=Ta;function yb(t,e,r,n){let o=(0,X._)`${e}${(0,X.getProperty)(r)} !== undefined`;return n?(0,X._)`${o} && ${Ta(t,e,r)}`:o}K.propertyInData=yb;function xa(t,e,r,n){let o=(0,X._)`${e}${(0,X.getProperty)(r)} === undefined`;return n?(0,X.or)(o,(0,X.not)(Ta(t,e,r))):o}K.noPropertyInData=xa;function cp(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}K.allSchemaProperties=cp;function _b(t,e){return cp(e).filter(r=>!(0,ka.alwaysValidSchema)(t,e[r]))}K.schemaProperties=_b;function wb({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0,X._)`${t}, ${e}, ${n}${o}`:e,d=[[bt.default.instancePath,(0,X.strConcat)(bt.default.instancePath,s)],[bt.default.parentData,i.parentData],[bt.default.parentDataProperty,i.parentDataProperty],[bt.default.rootData,bt.default.rootData]];i.opts.dynamicRef&&d.push([bt.default.dynamicAnchors,bt.default.dynamicAnchors]);let m=(0,X._)`${l}, ${r.object(...d)}`;return c!==X.nil?(0,X._)`${a}.call(${c}, ${m})`:(0,X._)`${a}(${m})`}K.callValidateCode=wb;var vb=(0,X._)`new RegExp`;function bb({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,X._)`${o.code==="new RegExp"?vb:(0,mb.useFunc)(t,o)}(${r}, ${n})`})}K.usePattern=bb;function Sb(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",!0);return i(()=>e.assign(a,!1)),a}return e.var(s,!0),i(()=>e.break()),s;function i(a){let c=e.const("len",(0,X._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:ka.Type.Num},s),e.if((0,X.not)(s),a)})}}K.validateArray=Sb;function kb(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,ka.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:!0},a);e.assign(i,(0,X._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0,X.not)(i))})),t.result(i,()=>t.reset(),()=>t.error(!0))}K.validateUnion=kb});var dp=S(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.validateKeywordUsage=Ke.validSchemaType=Ke.funcKeywordCode=Ke.macroKeywordCode=void 0;var Se=D(),Lt=nt(),Tb=qe(),xb=gn();function $b(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=up(r,n,a);i.opts.validateSchema!==!1&&i.self.validateSchema(a,!0);let u=r.name("valid");t.subschema({schema:a,schemaPath:Se.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},u),t.pass(u,()=>t.error(!0))}Ke.macroKeywordCode=$b;function Eb(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;Rb(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=up(n,o,u),d=n.let("valid");t.block$data(d,m),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function m(){if(e.errors===!1)h(),e.modifying&&lp(t),y(()=>t.error());else{let v=e.async?f():g();e.modifying&&lp(t),y(()=>Pb(t,v))}}function f(){let v=n.let("ruleErrs",null);return n.try(()=>h((0,Se._)`await `),$=>n.assign(d,!1).if((0,Se._)`${$} instanceof ${c.ValidationError}`,()=>n.assign(v,(0,Se._)`${$}.errors`),()=>n.throw($))),v}function g(){let v=(0,Se._)`${l}.errors`;return n.assign(v,null),h(Se.nil),v}function h(v=e.async?(0,Se._)`await `:Se.nil){let $=c.opts.passContext?Lt.default.this:Lt.default.self,k=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Se._)`${v}${(0,Tb.callValidateCode)(t,l,$,k)}`,e.modifying)}function y(v){var $;n.if((0,Se.not)(($=e.valid)!==null&&$!==void 0?$:d),v)}}Ke.funcKeywordCode=Eb;function lp(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Se._)`${n.parentData}[${n.parentDataProperty}]`))}function Pb(t,e){let{gen:r}=t;r.if((0,Se._)`Array.isArray(${e})`,()=>{r.assign(Lt.default.vErrors,(0,Se._)`${Lt.default.vErrors} === null ? ${e} : ${Lt.default.vErrors}.concat(${e})`).assign(Lt.default.errors,(0,Se._)`${Lt.default.vErrors}.length`),(0,xb.extendErrors)(t)},()=>t.error())}function Rb({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function up(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Se.stringify)(r)})}function Cb(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Ke.validSchemaType=Cb;function Mb({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Ke.validateKeywordUsage=Mb});var mp=S(St=>{"use strict";Object.defineProperty(St,"__esModule",{value:!0});St.extendSubschemaMode=St.extendSubschemaData=St.getSubschema=void 0;var Ze=D(),pp=W();function zb(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Ze._)`${t.schemaPath}${(0,Ze.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Ze._)`${t.schemaPath}${(0,Ze.getProperty)(e)}${(0,Ze.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,pp.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}St.getSubschema=zb;function Ab(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,m=a.let("data",(0,Ze._)`${e.data}${(0,Ze.getProperty)(r)}`,!0);c(m),t.errorPath=(0,Ze.str)`${u}${(0,pp.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Ze._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty]}if(o!==void 0){let u=o instanceof Ze.Name?o:a.let("data",o,!0);c(u),i!==void 0&&(t.propertyName=i)}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u]}}St.extendSubschemaData=Ab;function Ib(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}St.extendSubschemaMode=Ib});var $a=S((dO,fp)=>{"use strict";fp.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(o=n;o--!==0;)if(!t(e[o],r[o]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r}});var gp=S((pO,hp)=>{"use strict";var kt=hp.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};ts(e,n,o,t,"",t)};kt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};kt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};kt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};kt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ts(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in kt.arrayKeywords)for(var m=0;m<d.length;m++)ts(t,e,r,d[m],o+"/"+l+"/"+m,s,o,l,n,m)}else if(l in kt.propsKeywords){if(d&&typeof d=="object")for(var f in d)ts(t,e,r,d[f],o+"/"+l+"/"+Ob(f),s,o,l,n,f)}else(l in kt.keywords||t.allKeys&&!(l in kt.skipKeywords))&&ts(t,e,r,d,o+"/"+l,s,o,l,n)}r(n,o,s,i,a,c,u)}}function Ob(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var _n=S(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.getSchemaRefs=Re.resolveUrl=Re.normalizeId=Re._getFullPath=Re.getFullPath=Re.inlineRef=void 0;var jb=W(),Nb=$a(),qb=gp(),Db=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Lb(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Ea(t):e?yp(t)<=e:!1}Re.inlineRef=Lb;var Ub=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Ea(t){for(let e in t){if(Ub.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Ea)||typeof r=="object"&&Ea(r))return!0}return!1}function yp(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Db.has(r)&&(typeof t[r]=="object"&&(0,jb.eachItem)(t[r],n=>e+=yp(n)),e===1/0))return 1/0}return e}function _p(t,e="",r){r!==!1&&(e=yr(e));let n=t.parse(e);return wp(t,n)}Re.getFullPath=_p;function wp(t,e){return t.serialize(e).split("#")[0]+"#"}Re._getFullPath=wp;var Fb=/#\/?$/;function yr(t){return t?t.replace(Fb,""):""}Re.normalizeId=yr;function Hb(t,e,r){return r=yr(r),t.resolve(e,r)}Re.resolveUrl=Hb;var Wb=/^[a-z_][-a-z0-9._]*$/i;function Vb(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,o=yr(t[r]||e),s={"":o},i=_p(n,o,!1),a={},c=new Set;return qb(t,{allKeys:!0},(d,m,f,g)=>{if(g===void 0)return;let h=i+m,y=s[g];typeof d[r]=="string"&&(y=v.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),s[m]=y;function v(k){let z=this.opts.uriResolver.resolve;if(k=yr(y?z(y,k):k),c.has(k))throw l(k);c.add(k);let w=this.refs[k];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?u(d,w.schema,k):k!==yr(h)&&(k[0]==="#"?(u(d,a[k],k),a[k]=d):this.refs[k]=h),k}function $(k){if(typeof k=="string"){if(!Wb.test(k))throw new Error(`invalid anchor "${k}"`);v.call(this,`#${k}`)}}}),a;function u(d,m,f){if(m!==void 0&&!Nb(d,m))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Re.getSchemaRefs=Vb});var bn=S(Tt=>{"use strict";Object.defineProperty(Tt,"__esModule",{value:!0});Tt.getData=Tt.KeywordCxt=Tt.validateFunctionCode=void 0;var Tp=Qd(),vp=yn(),Ra=wa(),rs=yn(),Bb=ip(),vn=dp(),Pa=mp(),R=D(),O=nt(),Gb=_n(),ot=W(),wn=gn();function Kb(t){if(Ep(t)&&(Pp(t),$p(t))){Yb(t);return}xp(t,()=>(0,Tp.topBoolOrEmptySchema)(t))}Tt.validateFunctionCode=Kb;function xp({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0,R._)`${O.default.data}, ${O.default.valCxt}`,n.$async,()=>{t.code((0,R._)`"use strict"; ${bp(r,o)}`),Jb(t,o),t.code(s)}):t.func(e,(0,R._)`${O.default.data}, ${Zb(o)}`,n.$async,()=>t.code(bp(r,o)).code(s))}function Zb(t){return(0,R._)`{${O.default.instancePath}="", ${O.default.parentData}, ${O.default.parentDataProperty}, ${O.default.rootData}=${O.default.data}${t.dynamicRef?(0,R._)`, ${O.default.dynamicAnchors}={}`:R.nil}}={}`}function Jb(t,e){t.if(O.default.valCxt,()=>{t.var(O.default.instancePath,(0,R._)`${O.default.valCxt}.${O.default.instancePath}`),t.var(O.default.parentData,(0,R._)`${O.default.valCxt}.${O.default.parentData}`),t.var(O.default.parentDataProperty,(0,R._)`${O.default.valCxt}.${O.default.parentDataProperty}`),t.var(O.default.rootData,(0,R._)`${O.default.valCxt}.${O.default.rootData}`),e.dynamicRef&&t.var(O.default.dynamicAnchors,(0,R._)`${O.default.valCxt}.${O.default.dynamicAnchors}`)},()=>{t.var(O.default.instancePath,(0,R._)`""`),t.var(O.default.parentData,(0,R._)`undefined`),t.var(O.default.parentDataProperty,(0,R._)`undefined`),t.var(O.default.rootData,O.default.data),e.dynamicRef&&t.var(O.default.dynamicAnchors,(0,R._)`{}`)})}function Yb(t){let{schema:e,opts:r,gen:n}=t;xp(t,()=>{r.$comment&&e.$comment&&Cp(t),rS(t),n.let(O.default.vErrors,null),n.let(O.default.errors,0),r.unevaluated&&Xb(t),Rp(t),sS(t)})}function Xb(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,R._)`${r}.evaluated`),e.if((0,R._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,R._)`${t.evaluated}.props`,(0,R._)`undefined`)),e.if((0,R._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,R._)`${t.evaluated}.items`,(0,R._)`undefined`))}function bp(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,R._)`/*# sourceURL=${r} */`:R.nil}function Qb(t,e){if(Ep(t)&&(Pp(t),$p(t))){eS(t,e);return}(0,Tp.boolOrEmptySchema)(t,e)}function $p({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Ep(t){return typeof t.schema!="boolean"}function eS(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&Cp(t),nS(t),oS(t);let s=n.const("_errs",O.default.errors);Rp(t,s),n.var(e,(0,R._)`${s} === ${O.default.errors}`)}function Pp(t){(0,ot.checkUnknownRules)(t),tS(t)}function Rp(t,e){if(t.opts.jtd)return Sp(t,[],!1,e);let r=(0,vp.getSchemaTypes)(t.schema),n=(0,vp.coerceAndCheckDataType)(t,r);Sp(t,r,!n,e)}function tS(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,ot.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function rS(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,ot.checkStrictMode)(t,"default is ignored in the schema root")}function nS(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Gb.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function oS(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Cp({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===!0)t.code((0,R._)`${O.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0,R.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,R._)`${O.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`)}}function sS(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0,R._)`${O.default.errors} === 0`,()=>e.return(O.default.data),()=>e.throw((0,R._)`new ${o}(${O.default.vErrors})`)):(e.assign((0,R._)`${n}.errors`,O.default.vErrors),s.unevaluated&&iS(t),e.return((0,R._)`${O.default.errors} === 0`))}function iS({gen:t,evaluated:e,props:r,items:n}){r instanceof R.Name&&t.assign((0,R._)`${e}.props`,r),n instanceof R.Name&&t.assign((0,R._)`${e}.items`,n)}function Sp(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,ot.schemaHasRulesButRef)(s,l))){o.block(()=>zp(t,"$ref",l.all.$ref.definition));return}c.jtd||aS(t,e),o.block(()=>{for(let m of l.rules)d(m);d(l.post)});function d(m){(0,Ra.shouldUseGroup)(s,m)&&(m.type?(o.if((0,rs.checkDataType)(m.type,i,c.strictNumbers)),kp(t,m),e.length===1&&e[0]===m.type&&r&&(o.else(),(0,rs.reportTypeError)(t)),o.endIf()):kp(t,m),a||o.if((0,R._)`${O.default.errors} === ${n||0}`))}}function kp(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0,Bb.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ra.shouldUseRule)(n,s)&&zp(t,s.keyword,s.definition,e.type)})}function aS(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(cS(t,e),t.opts.allowUnionTypes||lS(t,e),uS(t,t.dataTypes))}function cS(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Mp(t.dataTypes,r)||Ca(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),pS(t,e)}}function lS(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&Ca(t,"use allowUnionTypes to allow union type keyword")}function uS(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0,Ra.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>dS(e,i))&&Ca(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function dS(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Mp(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function pS(t,e){let r=[];for(let n of t.dataTypes)Mp(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function Ca(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,ot.checkStrictMode)(t,e,t.opts.strictTypes)}var ns=class{constructor(e,r,n){if((0,vn.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,ot.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Ap(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,vn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",O.default.errors))}result(e,r,n){this.failResult((0,R.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,R.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,R._)`${r} !== undefined && (${(0,R.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?wn.reportExtraError:wn.reportError)(this,this.def.error,r)}$dataError(){(0,wn.reportError)(this,this.def.$dataError||wn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,wn.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=R.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=R.nil,r=R.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0,R.or)((0,R._)`${o} === undefined`,r)),e!==R.nil&&n.assign(e,!0),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==R.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return(0,R.or)(i(),a());function i(){if(n.length){if(!(r instanceof R.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,R._)`${(0,rs.checkDataTypes)(c,r,s.opts.strictNumbers,rs.DataType.Wrong)}`}return R.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return(0,R._)`!${c}(${r})`}return R.nil}}subschema(e,r){let n=(0,Pa.getSubschema)(this.it,e);(0,Pa.extendSubschemaData)(n,this.it,e),(0,Pa.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return Qb(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=ot.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=ot.mergeEvaluated.items(o,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return o.if(r,()=>this.mergeEvaluated(e,R.Name)),!0}};Tt.KeywordCxt=ns;function zp(t,e,r,n){let o=new ns(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0,vn.funcKeywordCode)(o,r):"macro"in r?(0,vn.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,vn.funcKeywordCode)(o,r)}var mS=/^\/(?:[^~]|~0|~1)*$/,fS=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ap(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return O.default.rootData;if(t[0]==="/"){if(!mS.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=O.default.rootData}else{let u=fS.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0,R._)`${s}${(0,R.getProperty)((0,ot.unescapeJsonPointer)(u))}`,i=(0,R._)`${i} && ${s}`);return i;function c(u,l){return`Cannot access ${u} ${l} levels up, current level is ${e}`}}Tt.getData=Ap});var os=S(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var Ma=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};za.default=Ma});var Sn=S(Oa=>{"use strict";Object.defineProperty(Oa,"__esModule",{value:!0});var Aa=_n(),Ia=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Aa.resolveUrl)(e,r,n),this.missingSchema=(0,Aa.normalizeId)((0,Aa.getFullPath)(e,this.missingRef))}};Oa.default=Ia});var is=S(De=>{"use strict";Object.defineProperty(De,"__esModule",{value:!0});De.resolveSchema=De.getCompilingSchema=De.resolveRef=De.compileSchema=De.SchemaEnv=void 0;var He=D(),hS=os(),Ut=nt(),We=_n(),Ip=W(),gS=bn(),_r=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,We.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};De.SchemaEnv=_r;function Na(t){let e=Op.call(this,t);if(e)return e;let r=(0,We.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new He.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:hS.default,code:(0,He._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Ut.default.data,parentData:Ut.default.parentData,parentDataProperty:Ut.default.parentDataProperty,dataNames:[Ut.default.data],dataPathArr:[He.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,He.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:He.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,He._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,gS.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Ut.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Ut.default.self}`,`${Ut.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:g,items:h}=u;f.evaluated={props:g instanceof He.Name?void 0:g,items:h instanceof He.Name?void 0:h,dynamicProps:g instanceof He.Name,dynamicItems:h instanceof He.Name},f.source&&(f.source.evaluated=(0,He.stringify)(f.evaluated))}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t)}}De.compileSchema=Na;function yS(t,e,r){var n;r=(0,We.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=vS.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new _r({schema:i,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=_S.call(this,s)}De.resolveRef=yS;function _S(t){return(0,We.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Na.call(this,t)}function Op(t){for(let e of this._compilations)if(wS(e,t))return e}De.getCompilingSchema=Op;function wS(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function vS(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ss.call(this,t,e)}function ss(t,e){let r=this.opts.uriResolver.parse(e),n=(0,We._getFullPath)(this.opts.uriResolver,r),o=(0,We.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return ja.call(this,r,t);let s=(0,We.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=ss.call(this,t,i);return typeof a?.schema!="object"?void 0:ja.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||Na.call(this,i),s===(0,We.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0,We.resolveUrl)(this.opts.uriResolver,o,u)),new _r({schema:a,schemaId:c,root:t,baseId:o})}return ja.call(this,r,i)}}De.resolveSchema=ss;var bS=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ja(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Ip.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!bS.has(a)&&u&&(e=(0,We.resolveUrl)(this.opts.uriResolver,e,u))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Ip.schemaHasRulesButRef)(r,this.RULES)){let a=(0,We.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=ss.call(this,n,a)}let{schemaId:i}=this.opts;if(s=s||new _r({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var jp=S((_O,SS)=>{SS.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var La=S((wO,Fp)=>{"use strict";var kS=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),qp=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),qa=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),Dp=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),TS=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function Da(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";e+=t[n]}return e}var xS=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function Np(t){return t.length=0,!0}function $S(t,e,r){if(t.length){let n=Da(t);if(n!=="")e.push(n);else return r.error=!0,!1;t.length=0}return!0}function ES(t){let e=0,r={error:!1,address:"",zone:""},n=[],o=[],s=!1,i=!1,a=$S;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===!0&&(i=!0),!a(o,n,r))break;if(++e>7){r.error=!0;break}c>0&&t[c-1]===":"&&(s=!0),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=Np}else{o.push(u);continue}}return o.length&&(a===Np?r.zone=o.join(""):i?n.push(o.join("")):n.push(Da(o))),r.address=n.join(""),r}function Lp(t){if(PS(t,":")<2)return{host:t,isIPV6:!1};let e=ES(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:!0,escapedHost:n}}}function PS(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function RS(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else{r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n)}return r.join("")}var CS={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},MS=/[@/?#:]/g,zS=/[@/?#]/g;function Up(t,e){let r=e?zS:MS;return r.lastIndex=0,t.replace(r,n=>CS[n])}function AS(t,e=!1){if(t.indexOf("%")===-1)return t;let r="";for(let n=0;n<t.length;n++){if(t[n]==="%"&&n+2<t.length){let o=t.slice(n+1,n+3);if(qa(o)){let s=o.toUpperCase(),i=String.fromCharCode(parseInt(s,16));e&&Dp(i)?r+=i:r+="%"+s,n+=2;continue}}r+=t[n]}return r}function IS(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(qa(n)){let o=n.toUpperCase(),s=String.fromCharCode(parseInt(o,16));s!=="."&&Dp(s)?e+=s:e+="%"+o,r+=2;continue}}TS(t[r])?e+=t[r]:e+=escape(t[r])}return e}function OS(t){let e="";for(let r=0;r<t.length;r++){if(t[r]==="%"&&r+2<t.length){let n=t.slice(r+1,r+3);if(qa(n)){e+="%"+n.toUpperCase(),r+=2;continue}}e+=escape(t[r])}return e}function jS(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!qp(r)){let n=Lp(r);n.isIPV6===!0?r=`[${n.escapedHost}]`:r=Up(r,!1)}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}Fp.exports={nonSimpleDomain:xS,recomposeAuthority:jS,reescapeHostDelimiters:Up,normalizePercentEncoding:AS,normalizePathEncoding:IS,escapePreservingEscapes:OS,removeDotSegments:RS,isIPv4:qp,isUUID:kS,normalizeIPv6:Lp,stringArrayToHexStripped:Da}});var Gp=S((vO,Bp)=>{"use strict";var{isUUID:NS}=La(),qS=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,DS=["http","https","ws","wss","urn","urn:uuid"];function LS(t){return DS.indexOf(t)!==-1}function Ua(t){return t.secure===!0?!0:t.secure===!1?!1:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):!1}function Hp(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Wp(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function US(t){return t.secure=Ua(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function FS(t){if((t.port===(Ua(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function HS(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(qS);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=Fa(o);t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function WS(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=Fa(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=!0,i}function VS(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!NS(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function BS(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Vp={scheme:"http",domainHost:!0,parse:Hp,serialize:Wp},GS={scheme:"https",domainHost:Vp.domainHost,parse:Hp,serialize:Wp},as={scheme:"ws",domainHost:!0,parse:US,serialize:FS},KS={scheme:"wss",domainHost:as.domainHost,parse:as.parse,serialize:as.serialize},ZS={scheme:"urn",parse:HS,serialize:WS,skipNormalize:!0},JS={scheme:"urn:uuid",parse:VS,serialize:BS,skipNormalize:!0},cs={http:Vp,https:GS,ws:as,wss:KS,urn:ZS,"urn:uuid":JS};Object.setPrototypeOf(cs,null);function Fa(t){return t&&(cs[t]||cs[t.toLowerCase()])||void 0}Bp.exports={wsIsSecure:Ua,SCHEMES:cs,isValidSchemeName:LS,getSchemeHandler:Fa}});var Qp=S((bO,ls)=>{"use strict";var{normalizeIPv6:YS,removeDotSegments:kn,recomposeAuthority:XS,normalizePercentEncoding:QS,normalizePathEncoding:ek,escapePreservingEscapes:tk,reescapeHostDelimiters:rk,isIPv4:nk,nonSimpleDomain:ok}=La(),{SCHEMES:sk,getSchemeHandler:Zp}=Gp();function ik(t,e){return typeof t=="string"?t=pk(t,e):typeof t=="object"&&(t=wr(Ft(t,e),e)),t}function ak(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=Jp(wr(t,n),wr(e,n),n,!0);return n.skipEscape=!0,Ft(o,n)}function Jp(t,e,r,n){let o={};return n||(t=wr(Ft(t,r),r),e=wr(Ft(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=kn(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=kn(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=kn(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=kn(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function ck(t,e,r){let n=Kp(t,r),o=Kp(e,r);return n!==void 0&&o!==void 0&&n.toLowerCase()===o.toLowerCase()}function Ft(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],s=Zp(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=QS(r.path):(r.path=tk(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=XS(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=kn(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a)}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var lk=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u,uk=/^(?:[^#/:?]+:)?\/\/([^/?#]*)/;function dk(t,e){if(e[2]!==void 0&&t.path&&t.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof t.port=="number"&&(t.port<0||t.port>65535))return"URI port is malformed."}function Yp(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=!1,s=!1;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let i=t.match(uk);i!==null&&i[1].indexOf("\\")!==-1&&(n.error="URI authority must not contain a literal backslash.",o=!0);let a=t.match(lk);if(a){n.scheme=a[1],n.userinfo=a[3],n.host=a[4],n.port=parseInt(a[5],10),n.path=a[6]||"",n.query=a[7],n.fragment=a[8],isNaN(n.port)&&(n.port=a[5]);let c=dk(n,a);if(c!==void 0&&(n.error=n.error||c,o=!0),n.host)if(nk(n.host)===!1){let d=YS(n.host);n.host=d.host.toLowerCase(),s=d.isIPV6}else s=!0;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let u=Zp(r.scheme||n.scheme);if(!r.unicodeSupport&&(!u||!u.unicodeSupport)&&n.host&&(r.domainHost||u&&u.domainHost)&&s===!1&&ok(n.host))try{n.host=new URL("http://"+n.host).hostname}catch(l){n.error=n.error||"Host's domain name can not be converted to ASCII: "+l}if((!u||u&&!u.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=rk(unescape(n.host),s))),n.path&&(n.path=ek(n.path)),n.fragment))try{n.fragment=encodeURI(decodeURIComponent(n.fragment))}catch{n.error=n.error||"URI malformed"}u&&u.parse&&u.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return{parsed:n,malformedAuthorityOrPort:o}}function wr(t,e){return Yp(t,e).parsed}function pk(t,e){return Xp(t,e).normalized}function Xp(t,e){let{parsed:r,malformedAuthorityOrPort:n}=Yp(t,e);return{normalized:n?t:Ft(r,e),malformedAuthorityOrPort:n}}function Kp(t,e){if(typeof t=="string"){let{normalized:r,malformedAuthorityOrPort:n}=Xp(t,e);return n?void 0:r}if(typeof t=="object")return Ft(t,e)}var Ha={SCHEMES:sk,normalize:ik,resolve:ak,resolveComponent:Jp,equal:ck,serialize:Ft,parse:wr};ls.exports=Ha;ls.exports.default=Ha;ls.exports.fastUri=Ha});var tm=S(Wa=>{"use strict";Object.defineProperty(Wa,"__esModule",{value:!0});var em=Qp();em.code='require("ajv/dist/runtime/uri").default';Wa.default=em});var lm=S(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.CodeGen=he.Name=he.nil=he.stringify=he.str=he._=he.KeywordCxt=void 0;var mk=bn();Object.defineProperty(he,"KeywordCxt",{enumerable:!0,get:function(){return mk.KeywordCxt}});var vr=D();Object.defineProperty(he,"_",{enumerable:!0,get:function(){return vr._}});Object.defineProperty(he,"str",{enumerable:!0,get:function(){return vr.str}});Object.defineProperty(he,"stringify",{enumerable:!0,get:function(){return vr.stringify}});Object.defineProperty(he,"nil",{enumerable:!0,get:function(){return vr.nil}});Object.defineProperty(he,"Name",{enumerable:!0,get:function(){return vr.Name}});Object.defineProperty(he,"CodeGen",{enumerable:!0,get:function(){return vr.CodeGen}});var fk=os(),im=Sn(),hk=_a(),Tn=is(),gk=D(),xn=_n(),us=yn(),Ba=W(),rm=jp(),yk=tm(),am=(t,e)=>new RegExp(t,e);am.code="new RegExp";var _k=["removeAdditional","useDefaults","coerceTypes"],wk=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),vk={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},bk={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},nm=200;function Sk(t){var e,r,n,o,s,i,a,c,u,l,d,m,f,g,h,y,v,$,k,z,w,b,j,ne,oe;let Te=t.strict,Hr=(e=t.code)===null||e===void 0?void 0:e.optimize,oo=Hr===!0||Hr===void 0?1:Hr||0,so=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:am,pt=(o=t.uriResolver)!==null&&o!==void 0?o:yk.default;return{strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:Te)!==null&&i!==void 0?i:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:Te)!==null&&c!==void 0?c:!0,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:Te)!==null&&l!==void 0?l:"log",strictTuples:(m=(d=t.strictTuples)!==null&&d!==void 0?d:Te)!==null&&m!==void 0?m:"log",strictRequired:(g=(f=t.strictRequired)!==null&&f!==void 0?f:Te)!==null&&g!==void 0?g:!1,code:t.code?{...t.code,optimize:oo,regExp:so}:{optimize:oo,regExp:so},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:nm,loopEnum:(y=t.loopEnum)!==null&&y!==void 0?y:nm,meta:(v=t.meta)!==null&&v!==void 0?v:!0,messages:($=t.messages)!==null&&$!==void 0?$:!0,inlineRefs:(k=t.inlineRefs)!==null&&k!==void 0?k:!0,schemaId:(z=t.schemaId)!==null&&z!==void 0?z:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(b=t.validateSchema)!==null&&b!==void 0?b:!0,validateFormats:(j=t.validateFormats)!==null&&j!==void 0?j:!0,unicodeRegExp:(ne=t.unicodeRegExp)!==null&&ne!==void 0?ne:!0,int32range:(oe=t.int32range)!==null&&oe!==void 0?oe:!0,uriResolver:pt}}var $n=class{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Sk(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new gk.ValueScope({scope:{},prefixes:wk,es5:r,lines:n}),this.logger=Pk(e.logger);let o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,hk.getRules)(),om.call(this,vk,e,"NOT SUPPORTED"),om.call(this,bk,e,"DEPRECATED","warn"),this._metaOpts=$k.call(this),e.formats&&Tk.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&xk.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),kk.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=rm;n==="id"&&(o={...rm},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return"$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await s.call(this,l.$schema);let m=this._addSchema(l,d);return m.validate||i.call(this,m)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},!0)}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof im.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r)}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l]}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0,xn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(n,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=sm.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Tn.SchemaEnv({schema:{},schemaId:n});if(r=Tn.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=sm.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,xn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Ck.call(this,n,r),!r)return(0,Ba.eachItem)(n,s=>Va.call(this,s)),this;zk.call(this,r);let o={...r,type:(0,us.getJSONTypes)(r.type),schemaType:(0,us.getJSONTypes)(r.schemaType)};return(0,Ba.eachItem)(n,o.type.length===0?s=>Va.call(this,s,o):s=>o.type.forEach(i=>Va.call(this,s,o,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=cm(l))}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]))}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,xn.normalizeId)(i||n);let u=xn.getSchemaRefs.call(this,e,n);return c=new Tn.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):Tn.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Tn.compileSchema.call(this,e)}finally{this.opts=r}}};$n.ValidationError=fk.default;$n.MissingRefError=im.default;he.default=$n;function om(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`)}}function sm(t){return t=(0,xn.normalizeId)(t),this.schemas[t]||this.refs[t]}function kk(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function Tk(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function xk(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function $k(){let t={...this.opts};for(let e of _k)delete t[e];return t}var Ek={log(){},warn(){},error(){}};function Pk(t){if(t===!1)return Ek;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var Rk=/^[a-z_$][a-z0-9_$:-]*$/i;function Ck(t,e){let{RULES:r}=this;if((0,Ba.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!Rk.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function Va(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,us.getJSONTypes)(e.type),schemaType:(0,us.getJSONTypes)(e.schemaType)}};e.before?Mk.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function Mk(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function zk(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=cm(e)),t.validateSchema=this.compile(e,!0))}var Ak={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function cm(t){return{anyOf:[t,Ak]}}});var um=S(Ga=>{"use strict";Object.defineProperty(Ga,"__esModule",{value:!0});var Ik={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Ga.default=Ik});var fm=S(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.callRef=Ht.getValidate=void 0;var Ok=Sn(),dm=qe(),Ce=D(),br=nt(),pm=is(),ds=W(),jk={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=pm.resolveRef.call(c,u,o,r);if(l===void 0)throw new Ok.default(n.opts.uriResolver,o,r);if(l instanceof pm.SchemaEnv)return m(l);return f(l);function d(){if(s===u)return ps(t,i,s,s.$async);let g=e.scopeValue("root",{ref:u});return ps(t,(0,Ce._)`${g}.validate`,u,u.$async)}function m(g){let h=mm(t,g);ps(t,h,g,g.$async)}function f(g){let h=e.scopeValue("schema",a.code.source===!0?{ref:g,code:(0,Ce.stringify)(g)}:{ref:g}),y=e.name("valid"),v=t.subschema({schema:g,dataTypes:[],schemaPath:Ce.nil,topSchemaRef:h,errSchemaPath:r},y);t.mergeEvaluated(v),t.ok(y)}}};function mm(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Ce._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Ht.getValidate=mm;function ps(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?br.default.this:Ce.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let g=o.let("valid");o.try(()=>{o.code((0,Ce._)`await ${(0,dm.callValidateCode)(t,e,u)}`),f(e),i||o.assign(g,!0)},h=>{o.if((0,Ce._)`!(${h} instanceof ${s.ValidationError})`,()=>o.throw(h)),m(h),i||o.assign(g,!1)}),t.ok(g)}function d(){t.result((0,dm.callValidateCode)(t,e,u),()=>f(e),()=>m(e))}function m(g){let h=(0,Ce._)`${g}.errors`;o.assign(br.default.vErrors,(0,Ce._)`${br.default.vErrors} === null ? ${h} : ${br.default.vErrors}.concat(${h})`),o.assign(br.default.errors,(0,Ce._)`${br.default.vErrors}.length`)}function f(g){var h;if(!s.opts.unevaluated)return;let y=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(y&&!y.dynamicProps)y.props!==void 0&&(s.props=ds.mergeEvaluated.props(o,y.props,s.props));else{let v=o.var("props",(0,Ce._)`${g}.evaluated.props`);s.props=ds.mergeEvaluated.props(o,v,s.props,Ce.Name)}if(s.items!==!0)if(y&&!y.dynamicItems)y.items!==void 0&&(s.items=ds.mergeEvaluated.items(o,y.items,s.items));else{let v=o.var("items",(0,Ce._)`${g}.evaluated.items`);s.items=ds.mergeEvaluated.items(o,v,s.items,Ce.Name)}}}Ht.callRef=ps;Ht.default=jk});var hm=S(Ka=>{"use strict";Object.defineProperty(Ka,"__esModule",{value:!0});var Nk=um(),qk=fm(),Dk=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",Nk.default,qk.default];Ka.default=Dk});var gm=S(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});var ms=D(),xt=ms.operators,fs={maximum:{okStr:"<=",ok:xt.LTE,fail:xt.GT},minimum:{okStr:">=",ok:xt.GTE,fail:xt.LT},exclusiveMaximum:{okStr:"<",ok:xt.LT,fail:xt.GTE},exclusiveMinimum:{okStr:">",ok:xt.GT,fail:xt.LTE}},Lk={message:({keyword:t,schemaCode:e})=>(0,ms.str)`must be ${fs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,ms._)`{comparison: ${fs[t].okStr}, limit: ${e}}`},Uk={keyword:Object.keys(fs),type:"number",schemaType:"number",$data:!0,error:Lk,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,ms._)`${r} ${fs[e].fail} ${n} || isNaN(${r})`)}};Za.default=Uk});var ym=S(Ja=>{"use strict";Object.defineProperty(Ja,"__esModule",{value:!0});var En=D(),Fk={message:({schemaCode:t})=>(0,En.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,En._)`{multipleOf: ${t}}`},Hk={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Fk,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0,En._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0,En._)`${i} !== parseInt(${i})`;t.fail$data((0,En._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`)}};Ja.default=Hk});var wm=S(Ya=>{"use strict";Object.defineProperty(Ya,"__esModule",{value:!0});function _m(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}Ya.default=_m;_m.code='require("ajv/dist/runtime/ucs2length").default'});var vm=S(Xa=>{"use strict";Object.defineProperty(Xa,"__esModule",{value:!0});var Wt=D(),Wk=W(),Vk=wm(),Bk={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Wt.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Wt._)`{limit: ${t}}`},Gk={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Bk,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Wt.operators.GT:Wt.operators.LT,i=o.opts.unicode===!1?(0,Wt._)`${r}.length`:(0,Wt._)`${(0,Wk.useFunc)(t.gen,Vk.default)}(${r})`;t.fail$data((0,Wt._)`${i} ${s} ${n}`)}};Xa.default=Gk});var bm=S(Qa=>{"use strict";Object.defineProperty(Qa,"__esModule",{value:!0});var Kk=qe(),Zk=W(),Sr=D(),Jk={message:({schemaCode:t})=>(0,Sr.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,Sr._)`{pattern: ${t}}`},Yk={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Jk,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0,Sr._)`new RegExp`:(0,Zk.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0,Sr._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,!1)),t.fail$data((0,Sr._)`!${l}`)}else{let c=(0,Kk.usePattern)(t,o);t.fail$data((0,Sr._)`!${c}.test(${r})`)}}};Qa.default=Yk});var Sm=S(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});var Pn=D(),Xk={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Pn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Pn._)`{limit: ${t}}`},Qk={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Xk,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?Pn.operators.GT:Pn.operators.LT;t.fail$data((0,Pn._)`Object.keys(${r}).length ${o} ${n}`)}};ec.default=Qk});var km=S(tc=>{"use strict";Object.defineProperty(tc,"__esModule",{value:!0});var Rn=qe(),Cn=D(),e0=W(),t0={message:({params:{missingProperty:t}})=>(0,Cn.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Cn._)`{missingProperty: ${t}}`},r0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:t0,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:g}=t.it;for(let h of r)if(f?.[h]===void 0&&!g.has(h)){let y=i.schemaEnv.baseId+i.errSchemaPath,v=`required property "${h}" is not defined at "${y}" (strictRequired)`;(0,e0.checkStrictMode)(i,v,i.opts.strictRequired)}}function u(){if(c||s)t.block$data(Cn.nil,d);else for(let f of r)(0,Rn.checkReportMissingProp)(t,f)}function l(){let f=e.let("missing");if(c||s){let g=e.let("valid",!0);t.block$data(g,()=>m(f,g)),t.ok(g)}else e.if((0,Rn.checkMissingProp)(t,r,f)),(0,Rn.reportMissingProp)(t,f),e.else()}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0,Rn.noPropertyInData)(e,o,f,a.ownProperties),()=>t.error())})}function m(f,g){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(g,(0,Rn.propertyInData)(e,o,f,a.ownProperties)),e.if((0,Cn.not)(g),()=>{t.error(),e.break()})},Cn.nil)}}};tc.default=r0});var Tm=S(rc=>{"use strict";Object.defineProperty(rc,"__esModule",{value:!0});var Mn=D(),n0={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Mn.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Mn._)`{limit: ${t}}`},o0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:n0,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?Mn.operators.GT:Mn.operators.LT;t.fail$data((0,Mn._)`${r}.length ${o} ${n}`)}};rc.default=o0});var hs=S(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});var xm=$a();xm.code='require("ajv/dist/runtime/equal").default';nc.default=xm});var $m=S(sc=>{"use strict";Object.defineProperty(sc,"__esModule",{value:!0});var oc=yn(),ge=D(),s0=W(),i0=hs(),a0={message:({params:{i:t,j:e}})=>(0,ge.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ge._)`{i: ${t}, j: ${e}}`},c0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:a0,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0,oc.getSchemaTypes)(s.items):[];t.block$data(c,l,(0,ge._)`${i} === false`),t.ok(c);function l(){let g=e.let("i",(0,ge._)`${r}.length`),h=e.let("j");t.setParams({i:g,j:h}),e.assign(c,!0),e.if((0,ge._)`${g} > 1`,()=>(d()?m:f)(g,h))}function d(){return u.length>0&&!u.some(g=>g==="object"||g==="array")}function m(g,h){let y=e.name("item"),v=(0,oc.checkDataTypes)(u,y,a.opts.strictNumbers,oc.DataType.Wrong),$=e.const("indices",(0,ge._)`{}`);e.for((0,ge._)`;${g}--;`,()=>{e.let(y,(0,ge._)`${r}[${g}]`),e.if(v,(0,ge._)`continue`),u.length>1&&e.if((0,ge._)`typeof ${y} == "string"`,(0,ge._)`${y} += "_"`),e.if((0,ge._)`typeof ${$}[${y}] == "number"`,()=>{e.assign(h,(0,ge._)`${$}[${y}]`),t.error(),e.assign(c,!1).break()}).code((0,ge._)`${$}[${y}] = ${g}`)})}function f(g,h){let y=(0,s0.useFunc)(e,i0.default),v=e.name("outer");e.label(v).for((0,ge._)`;${g}--;`,()=>e.for((0,ge._)`${h} = ${g}; ${h}--;`,()=>e.if((0,ge._)`${y}(${r}[${g}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(v)})))}}};sc.default=c0});var Em=S(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});var ic=D(),l0=W(),u0=hs(),d0={message:"must be equal to constant",params:({schemaCode:t})=>(0,ic._)`{allowedValue: ${t}}`},p0={keyword:"const",$data:!0,error:d0,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,ic._)`!${(0,l0.useFunc)(e,u0.default)}(${r}, ${o})`):t.fail((0,ic._)`${s} !== ${r}`)}};ac.default=p0});var Pm=S(cc=>{"use strict";Object.defineProperty(cc,"__esModule",{value:!0});var zn=D(),m0=W(),f0=hs(),h0={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,zn._)`{allowedValues: ${t}}`},g0={keyword:"enum",schemaType:"array",$data:!0,error:h0,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0,m0.useFunc)(e,f0.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else{if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0,zn.or)(...o.map((g,h)=>m(f,h)))}t.pass(l);function d(){e.assign(l,!1),e.forOf("v",s,f=>e.if((0,zn._)`${u()}(${r}, ${f})`,()=>e.assign(l,!0).break()))}function m(f,g){let h=o[g];return typeof h=="object"&&h!==null?(0,zn._)`${u()}(${r}, ${f}[${g}])`:(0,zn._)`${r} === ${h}`}}};cc.default=g0});var Rm=S(lc=>{"use strict";Object.defineProperty(lc,"__esModule",{value:!0});var y0=gm(),_0=ym(),w0=vm(),v0=bm(),b0=Sm(),S0=km(),k0=Tm(),T0=$m(),x0=Em(),$0=Pm(),E0=[y0.default,_0.default,w0.default,v0.default,b0.default,S0.default,k0.default,T0.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},x0.default,$0.default];lc.default=E0});var dc=S(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.validateAdditionalItems=void 0;var Vt=D(),uc=W(),P0={message:({params:{len:t}})=>(0,Vt.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Vt._)`{limit: ${t}}`},R0={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:P0,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,uc.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Cm(t,n)}};function Cm(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=!0;let a=r.const("len",(0,Vt._)`${o}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,Vt._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,uc.alwaysValidSchema)(i,n)){let u=r.var("valid",(0,Vt._)`${a} <= ${e.length}`);r.if((0,Vt.not)(u),()=>c(u)),t.ok(u)}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:uc.Type.Num},u),i.allErrors||r.if((0,Vt.not)(u),()=>r.break())})}}An.validateAdditionalItems=Cm;An.default=R0});var pc=S(In=>{"use strict";Object.defineProperty(In,"__esModule",{value:!0});In.validateTuple=void 0;var Mm=D(),gs=W(),C0=qe(),M0={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return zm(t,"additionalItems",e);r.items=!0,!(0,gs.alwaysValidSchema)(r,e)&&t.ok((0,C0.validateArray)(t))}};function zm(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=gs.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0,Mm._)`${s}.length`);r.forEach((d,m)=>{(0,gs.alwaysValidSchema)(a,d)||(n.if((0,Mm._)`${u} > ${m}`,()=>t.subschema({keyword:i,schemaProp:m,dataProp:m},c)),t.ok(c))});function l(d){let{opts:m,errSchemaPath:f}=a,g=r.length,h=g===d.minItems&&(g===d.maxItems||d[e]===!1);if(m.strictTuples&&!h){let y=`"${i}" is ${g}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0,gs.checkStrictMode)(a,y,m.strictTuples)}}}In.validateTuple=zm;In.default=M0});var Am=S(mc=>{"use strict";Object.defineProperty(mc,"__esModule",{value:!0});var z0=pc(),A0={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,z0.validateTuple)(t,"items")};mc.default=A0});var Om=S(fc=>{"use strict";Object.defineProperty(fc,"__esModule",{value:!0});var Im=D(),I0=W(),O0=qe(),j0=dc(),N0={message:({params:{len:t}})=>(0,Im.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Im._)`{limit: ${t}}`},q0={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:N0,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=!0,!(0,I0.alwaysValidSchema)(n,e)&&(o?(0,j0.validateAdditionalItems)(t,o):t.ok((0,O0.validateArray)(t)))}};fc.default=q0});var jm=S(hc=>{"use strict";Object.defineProperty(hc,"__esModule",{value:!0});var Le=D(),ys=W(),D0={message:({params:{min:t,max:e}})=>e===void 0?(0,Le.str)`must contain at least ${t} valid item(s)`:(0,Le.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,Le._)`{minContains: ${t}}`:(0,Le._)`{minContains: ${t}, maxContains: ${e}}`},L0={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:D0,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0,Le._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0,ys.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0,ys.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,ys.alwaysValidSchema)(s,r)){let h=(0,Le._)`${l} >= ${i}`;a!==void 0&&(h=(0,Le._)`${h} && ${l} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,!0),a!==void 0&&e.if((0,Le._)`${o}.length > 0`,m)):(e.let(d,!1),m()),t.result(d,()=>t.reset());function m(){let h=e.name("_valid"),y=e.let("count",0);f(h,()=>e.if(h,()=>g(y)))}function f(h,y){e.forRange("i",0,l,v=>{t.subschema({keyword:"contains",dataProp:v,dataPropType:ys.Type.Num,compositeRule:!0},h),y()})}function g(h){e.code((0,Le._)`${h}++`),a===void 0?e.if((0,Le._)`${h} >= ${i}`,()=>e.assign(d,!0).break()):(e.if((0,Le._)`${h} > ${a}`,()=>e.assign(d,!1).break()),i===1?e.assign(d,!0):e.if((0,Le._)`${h} >= ${i}`,()=>e.assign(d,!0)))}}};hc.default=L0});var Dm=S(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.validateSchemaDeps=Je.validatePropertyDeps=Je.error=void 0;var gc=D(),U0=W(),On=qe();Je.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,gc.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,gc._)`{property: ${t},
|
|
9
9
|
missingProperty: ${n},
|
|
10
10
|
depsCount: ${e},
|
|
11
|
-
deps: ${r}}`};var F0={keyword:"dependencies",type:"object",schemaType:"object",error:Je.error,code(t){let[e,r]=H0(t);Nm(t,e),qm(t,r)}};function H0({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Nm(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,On.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,On.checkReportMissingProp)(t,u)}):(r.if((0,gc._)`${c} && (${(0,On.checkMissingProp)(t,a,s)})`),(0,On.reportMissingProp)(t,s),r.else())}}Je.validatePropertyDeps=Nm;function qm(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,U0.alwaysValidSchema)(s,e[a])||(r.if((0,On.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Je.validateSchemaDeps=qm;Je.default=F0});var Um=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var Lm=D(),W0=W(),V0={message:"property name must be valid",params:({params:t})=>(0,Lm._)`{propertyName: ${t.propertyName}}`},B0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:V0,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,W0.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Lm.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};yc.default=B0});var wc=S(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var _s=qe(),Ve=D(),G0=nt(),ws=W(),K0={message:"must NOT have additional properties",params:({params:t})=>(0,Ve._)`{additionalProperty: ${t.additionalProperty}}`},Z0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:K0,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,ws.alwaysValidSchema)(i,r))return;let u=(0,_s.allSchemaProperties)(n.properties),l=(0,_s.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ve._)`${s} === ${G0.default.errors}`);function d(){e.forIn("key",o,y=>{!u.length&&!l.length?g(y):e.if(m(y),()=>g(y))})}function m(y){let v;if(u.length>8){let $=(0,ws.schemaRefOrVal)(i,n.properties,"properties");v=(0,_s.isOwnProperty)(e,$,y)}else u.length?v=(0,Ve.or)(...u.map($=>(0,Ve._)`${y} === ${$}`)):v=Ve.nil;return l.length&&(v=(0,Ve.or)(v,...l.map($=>(0,Ve._)`${(0,_s.usePattern)(t,$)}.test(${y})`))),(0,Ve.not)(v)}function f(y){e.code((0,Ve._)`delete ${o}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ws.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(y,v,!1),e.if((0,Ve.not)(v),()=>{t.reset(),f(y)})):(h(y,v),a||e.if((0,Ve.not)(v),()=>e.break()))}}function h(y,v,$){let k={keyword:"additionalProperties",dataProp:y,dataPropType:ws.Type.Str};$===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,v)}}};_c.default=Z0});var Wm=S(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var J0=bn(),Fm=qe(),vc=W(),Hm=wc(),Y0={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Hm.default.code(new J0.KeywordCxt(s,Hm.default,"additionalProperties"));let i=(0,Fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=vc.mergeEvaluated.props(e,(0,vc.toHash)(i),s.props));let a=i.filter(d=>!(0,vc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Fm.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};bc.default=Y0});var Km=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});var Vm=qe(),vs=D(),Bm=W(),Gm=W(),X0={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,Vm.allSchemaProperties)(r),c=a.filter(h=>(0,Bm.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof vs.Name)&&(s.props=(0,Gm.evaluatedPropsToName)(e,s.props));let{props:d}=s;m();function m(){for(let h of a)u&&f(h),s.allErrors?g(h):(e.var(l,!0),g(h),e.if(l))}function f(h){for(let y in u)new RegExp(h).test(y)&&(0,Bm.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){e.forIn("key",n,y=>{e.if((0,vs._)`${(0,Vm.usePattern)(t,h)}.test(${y})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Gm.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,vs._)`${d}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,vs.not)(l),()=>e.break())})})}}};Sc.default=X0});var Zm=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var Q0=W(),eT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Q0.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};kc.default=eT});var Jm=S(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var tT=qe(),rT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:tT.validateUnion,error:{message:"must match a schema in anyOf"}};Tc.default=rT});var Ym=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var bs=D(),nT=W(),oT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,bs._)`{passingSchemas: ${t.passing}}`},sT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:oT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let m;(0,nT.alwaysValidSchema)(o,l)?e.var(c,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,bs._)`${c} && ${i}`).assign(i,!1).assign(a,(0,bs._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),m&&t.mergeEvaluated(m,bs.Name)})})}}};xc.default=sT});var Xm=S($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var iT=W(),aT={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0,iT.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};$c.default=aT});var tf=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});var Ss=D(),ef=W(),cT={message:({params:t})=>(0,Ss.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ss._)`{failingKeyword: ${t.ifClause}}`},lT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:cT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ef.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Qm(n,"then"),s=Qm(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,Ss.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let m=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(m,i),d?e.assign(d,(0,Ss._)`${l}`):t.setParams({ifClause:l})}}}};function Qm(t,e){let r=t.schema[e];return r!==void 0&&!(0,ef.alwaysValidSchema)(t,r)}Ec.default=lT});var rf=S(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var uT=W(),dT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,uT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pc.default=dT});var nf=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});var pT=dc(),mT=Am(),fT=pc(),hT=Om(),gT=jm(),yT=Dm(),_T=Um(),wT=wc(),vT=Wm(),bT=Km(),ST=Zm(),kT=Jm(),TT=Ym(),xT=Xm(),$T=tf(),ET=rf();function PT(t=!1){let e=[ST.default,kT.default,TT.default,xT.default,$T.default,ET.default,_T.default,wT.default,yT.default,vT.default,bT.default];return t?e.push(mT.default,hT.default):e.push(pT.default,fT.default),e.push(gT.default),e}Rc.default=PT});var of=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});var ie=D(),RT={message:({schemaCode:t})=>(0,ie.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ie._)`{format: ${t}}`},CT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:RT,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,ie._)`${g}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,ie._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,ie._)`${h}.type || "string"`).assign(v,(0,ie._)`${h}.validate`),()=>r.assign(y,(0,ie._)`"string"`).assign(v,h)),t.fail$data((0,ie.or)($(),k()));function $(){return c.strictSchema===!1?ie.nil:(0,ie._)`${i} && !${v}`}function k(){let z=l.$async?(0,ie._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ie._)`${v}(${n})`,w=(0,ie._)`(typeof ${v} == "function" ? ${z} : ${v}.test(${n}))`;return(0,ie._)`${v} && ${v} !== true && ${y} === ${e} && !${w}`}}function f(){let g=d.formats[s];if(!g){$();return}if(g===!0)return;let[h,y,v]=k(g);h===e&&t.pass(z());function $(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function k(w){let b=w instanceof RegExp?(0,ie.regexpCode)(w):c.code.formats?(0,ie._)`${c.code.formats}${(0,ie.getProperty)(s)}`:void 0,j=r.scopeValue("formats",{key:s,ref:w,code:b});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,ie._)`${j}.validate`]:["string",w,j]}function z(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ie._)`await ${v}(${n})`}return typeof y=="function"?(0,ie._)`${v}(${n})`:(0,ie._)`${v}.test(${n})`}}}};Cc.default=CT});var sf=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var MT=of(),zT=[MT.default];Mc.default=zT});var af=S(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.contentVocabulary=kr.metadataVocabulary=void 0;kr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var lf=S(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var AT=hm(),IT=Rm(),OT=nf(),jT=sf(),cf=af(),NT=[AT.default,IT.default,(0,OT.default)(),jT.default,cf.metadataVocabulary,cf.contentVocabulary];zc.default=NT});var df=S(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.DiscrError=void 0;var uf;(function(t){t.Tag="tag",t.Mapping="mapping"})(uf||(ks.DiscrError=uf={}))});var mf=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});var Tr=D(),Ac=df(),pf=is(),qT=Sn(),DT=W(),LT={message:({params:{discrError:t,tagName:e}})=>t===Ac.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},UT={keyword:"discriminator",type:"object",schemaType:"object",error:LT,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Tr._)`${r}${(0,Tr.getProperty)(a)}`);e.if((0,Tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ac.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=m();e.if(!1);for(let g in f)e.elseIf((0,Tr._)`${u} === ${g}`),e.assign(c,d(f[g]));e.else(),t.error(!1,{discrError:Ac.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let g=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},g);return t.mergeEvaluated(h,Tr.Name),g}function m(){var f;let g={},h=v(o),y=!0;for(let z=0;z<i.length;z++){let w=i[z];if(w?.$ref&&!(0,DT.schemaHasRulesButRef)(w,s.self.RULES)){let j=w.$ref;if(w=pf.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,j),w instanceof pf.SchemaEnv&&(w=w.schema),w===void 0)throw new qT.default(s.opts.uriResolver,s.baseId,j)}let b=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof b!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(w)),$(b,z)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:z}){return Array.isArray(z)&&z.includes(a)}function $(z,w){if(z.const)k(z.const,w);else if(z.enum)for(let b of z.enum)k(b,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function k(z,w){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[z]=w}}}};Ic.default=UT});var ff=S((l1,FT)=>{FT.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var jc=S((Q,Oc)=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.MissingRefError=Q.ValidationError=Q.CodeGen=Q.Name=Q.nil=Q.stringify=Q.str=Q._=Q.KeywordCxt=Q.Ajv=void 0;var HT=lm(),WT=lf(),VT=mf(),hf=ff(),BT=["/properties"],Ts="http://json-schema.org/draft-07/schema",xr=class extends HT.default{_addVocabularies(){super._addVocabularies(),WT.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(VT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(hf,BT):hf;this.addMetaSchema(e,Ts,!1),this.refs["http://json-schema.org/schema"]=Ts}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ts)?Ts:void 0)}};Q.Ajv=xr;Oc.exports=Q=xr;Oc.exports.Ajv=xr;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=xr;var GT=bn();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return GT.KeywordCxt}});var $r=D();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return $r._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return $r.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return $r.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return $r.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return $r.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return $r.CodeGen}});var KT=os();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return KT.default}});var ZT=Sn();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return ZT.default}})});var kf=S(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatNames=Xe.fastFormats=Xe.fullFormats=void 0;function Ye(t,e){return{validate:t,compare:e}}Xe.fullFormats={date:Ye(wf,Lc),time:Ye(qc(!0),Uc),"date-time":Ye(gf(!0),bf),"iso-time":Ye(qc(),vf),"iso-date-time":Ye(gf(),Sf),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:tx,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[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,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?: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)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:cx,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:rx,int32:{type:"number",validate:sx},int64:{type:"number",validate:ix},float:{type:"number",validate:_f},double:{type:"number",validate:_f},password:!0,binary:!0};Xe.fastFormats={...Xe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Lc),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Uc),"date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bf),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,vf),"iso-date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Sf),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Xe.formatNames=Object.keys(Xe.fullFormats);function JT(t){return t%4===0&&(t%100!==0||t%400===0)}var YT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,XT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function wf(t){let e=YT.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&JT(r)?29:XT[n])}function Lc(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Nc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function qc(t){return function(r){let n=Nc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Uc(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function vf(t,e){if(!(t&&e))return;let r=Nc.exec(t),n=Nc.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Dc=/t|\s/i;function gf(t){let e=qc(t);return function(n){let o=n.split(Dc);return o.length===2&&wf(o[0])&&e(o[1])}}function bf(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Sf(t,e){if(!(t&&e))return;let[r,n]=t.split(Dc),[o,s]=e.split(Dc),i=Lc(r,o);if(i!==void 0)return i||Uc(n,s)}var QT=/\/|:/,ex=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function tx(t){return QT.test(t)&&ex.test(t)}var yf=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function rx(t){return yf.lastIndex=0,yf.test(t)}var nx=-(2**31),ox=2**31-1;function sx(t){return Number.isInteger(t)&&t<=ox&&t>=nx}function ix(t){return Number.isInteger(t)}function _f(){return!0}var ax=/[^\\]\\Z/;function cx(t){if(ax.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Tf=S(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.formatLimitDefinition=void 0;var lx=jc(),Be=D(),$t=Be.operators,xs={formatMaximum:{okStr:"<=",ok:$t.LTE,fail:$t.GT},formatMinimum:{okStr:">=",ok:$t.GTE,fail:$t.LT},formatExclusiveMaximum:{okStr:"<",ok:$t.LT,fail:$t.GTE},formatExclusiveMinimum:{okStr:">",ok:$t.GT,fail:$t.LTE}},ux={message:({keyword:t,schemaCode:e})=>(0,Be.str)`should be ${xs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Be._)`{comparison: ${xs[t].okStr}, limit: ${e}}`};Er.formatLimitDefinition={keyword:Object.keys(xs),type:"string",schemaType:"string",$data:!0,error:ux,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new lx.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Be._)`${m}[${c.schemaCode}]`);t.fail$data((0,Be.or)((0,Be._)`typeof ${f} != "object"`,(0,Be._)`${f} instanceof RegExp`,(0,Be._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=e.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Be._)`${i.code.formats}${(0,Be.getProperty)(m)}`:void 0});t.fail$data(d(g))}function d(m){return(0,Be._)`${m}.compare(${r}, ${n}) ${xs[o].fail} 0`}},dependencies:["format"]};var dx=t=>(t.addKeyword(Er.formatLimitDefinition),t);Er.default=dx});var Pf=S((jn,Ef)=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var Pr=kf(),px=Tf(),Fc=D(),xf=new Fc.Name("fullFormats"),mx=new Fc.Name("fastFormats"),Hc=(t,e={keywords:!0})=>{if(Array.isArray(e))return $f(t,e,Pr.fullFormats,xf),t;let[r,n]=e.mode==="fast"?[Pr.fastFormats,mx]:[Pr.fullFormats,xf],o=e.formats||Pr.formatNames;return $f(t,o,r,n),e.keywords&&(0,px.default)(t),t};Hc.get=(t,e="full")=>{let n=(e==="fast"?Pr.fastFormats:Pr.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function $f(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Fc._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}Ef.exports=jn=Hc;Object.defineProperty(jn,"__esModule",{value:!0});jn.default=Hc});var nh=S((V1,rh)=>{"use strict";rh.exports=th;th.sync=Vx;var Qf=mt("fs");function Wx(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&t.substr(-o.length).toLowerCase()===o)return!0}return!1}function eh(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Wx(e,r)}function th(t,e,r){Qf.stat(t,function(n,o){r(n,n?!1:eh(o,t,e))})}function Vx(t,e){return eh(Qf.statSync(t),t,e)}});var ch=S((B1,ah)=>{"use strict";ah.exports=sh;sh.sync=Bx;var oh=mt("fs");function sh(t,e,r){oh.stat(t,function(n,o){r(n,n?!1:ih(o,e))})}function Bx(t,e){return ih(oh.statSync(t),e)}function ih(t,e){return t.isFile()&&Gx(t,e)}function Gx(t,e){var r=t.mode,n=t.uid,o=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&o===i||r&a&&n===s||r&l&&s===0;return d}});var uh=S((K1,lh)=>{"use strict";var G1=mt("fs"),js;process.platform==="win32"||global.TESTING_WINDOWS?js=nh():js=ch();lh.exports=ll;ll.sync=Kx;function ll(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){ll(t,e||{},function(s,i){s?o(s):n(i)})})}js(t,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Kx(t,e){try{return js.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var yh=S((Z1,gh)=>{"use strict";var jr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",dh=mt("path"),Zx=jr?";":":",ph=uh(),mh=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),fh=(t,e)=>{let r=e.colon||Zx,n=t.match(/\//)||jr&&t.match(/\\/)?[""]:[...jr?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=jr?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=jr?o.split(r):[""];return jr&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:o}},hh=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:s}=fh(t,e),i=[],a=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&i.length?l(i):d(mh(t));let m=n[u],f=/^".*"$/.test(m)?m.slice(1,-1):m,g=dh.join(f,t),h=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(h,u,0))}),c=(u,l,d)=>new Promise((m,f)=>{if(d===o.length)return m(a(l+1));let g=o[d];ph(u+g,{pathExt:s},(h,y)=>{if(!h&&y)if(e.all)i.push(u+g);else return m(u+g);return m(c(u,l,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},Jx=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=fh(t,e),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=dh.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let m=l+n[d];try{if(ph.sync(m,{pathExt:o}))if(e.all)s.push(m);else return m}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw mh(t)};gh.exports=hh;hh.sync=Jx});var wh=S((J1,ul)=>{"use strict";var _h=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ul.exports=_h;ul.exports.default=_h});var kh=S((Y1,Sh)=>{"use strict";var vh=mt("path"),Yx=yh(),Xx=wh();function bh(t,e){let r=t.options.env||process.env,n=process.cwd(),o=t.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=Yx.sync(t.command,{path:r[Xx({env:r})],pathExt:e?vh.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=vh.resolve(o?t.options.cwd:"",i)),i}function Qx(t){return bh(t)||bh(t,!0)}Sh.exports=Qx});var Th=S((X1,pl)=>{"use strict";var dl=/([()\][%!^"`<>&|;, *?])/g;function e$(t){return t=t.replace(dl,"^$1"),t}function t$(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(dl,"^$1"),e&&(t=t.replace(dl,"^$1")),t}pl.exports.command=e$;pl.exports.argument=t$});var $h=S((Q1,xh)=>{"use strict";xh.exports=/^#!(.*)/});var Ph=S((ej,Eh)=>{"use strict";var r$=$h();Eh.exports=(t="")=>{let e=t.match(r$);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Ch=S((tj,Rh)=>{"use strict";var ml=mt("fs"),n$=Ph();function o$(t){let r=Buffer.alloc(150),n;try{n=ml.openSync(t,"r"),ml.readSync(n,r,0,150,0),ml.closeSync(n)}catch{}return n$(r.toString())}Rh.exports=o$});var Ih=S((rj,Ah)=>{"use strict";var s$=mt("path"),Mh=kh(),zh=Th(),i$=Ch(),a$=process.platform==="win32",c$=/\.(?:com|exe)$/i,l$=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u$(t){t.file=Mh(t);let e=t.file&&i$(t.file);return e?(t.args.unshift(t.file),t.command=e,Mh(t)):t.file}function d$(t){if(!a$)return t;let e=u$(t),r=!c$.test(e);if(t.options.forceShell||r){let n=l$.test(e);t.command=s$.normalize(t.command),t.command=zh.command(t.command),t.args=t.args.map(s=>zh.argument(s,n));let o=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${o}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function p$(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:d$(n)}Ah.exports=p$});var Nh=S((nj,jh)=>{"use strict";var fl=process.platform==="win32";function hl(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function m$(t,e){if(!fl)return;let r=t.emit;t.emit=function(n,o){if(n==="exit"){let s=Oh(o,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Oh(t,e){return fl&&t===1&&!e.file?hl(e.original,"spawn"):null}function f$(t,e){return fl&&t===1&&!e.file?hl(e.original,"spawnSync"):null}jh.exports={hookChildProcess:m$,verifyENOENT:Oh,verifyENOENTSync:f$,notFoundError:hl}});var Lh=S((oj,Nr)=>{"use strict";var qh=mt("child_process"),gl=Ih(),yl=Nh();function Dh(t,e,r){let n=gl(t,e,r),o=qh.spawn(n.command,n.args,n.options);return yl.hookChildProcess(o,n),o}function h$(t,e,r){let n=gl(t,e,r),o=qh.spawnSync(n.command,n.args,n.options);return o.error=o.error||yl.verifyENOENTSync(o.status,n),o}Nr.exports=Dh;Nr.exports.spawn=Dh;Nr.exports.sync=h$;Nr.exports._parse=gl;Nr.exports._enoent=yl});var Bh=S(wl=>{"use strict";var Hh=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,b$=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Wh=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,S$=/\\([\u000b\u0020-\u00ff])/g,k$=/([\\"])/g,Vh=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;wl.format=T$;wl.parse=x$;function T$(t){if(!t||typeof t!="object")throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!Vh.test(r))throw new TypeError("invalid type");var n=r;if(e&&typeof e=="object")for(var o,s=Object.keys(e).sort(),i=0;i<s.length;i++){if(o=s[i],!Wh.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+E$(e[o])}return n}function x$(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?$$(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=r!==-1?e.slice(0,r).trim():e.trim();if(!Vh.test(n))throw new TypeError("invalid media type");var o=new P$(n.toLowerCase());if(r!==-1){var s,i,a;for(Hh.lastIndex=r;i=Hh.exec(e);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(S$,"$1"))),o.parameters[s]=a}if(r!==e.length)throw new TypeError("invalid parameter format")}return o}function $$(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function E$(t){var e=String(t);if(Wh.test(e))return e;if(e.length>0&&!b$.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(k$,"\\$1")+'"'}function P$(t){this.parameters=Object.create(null),this.type=t}});async function ni(t,e){switch(t.protocol){case"anthropic":{let{AnthropicClient:r}=await import("./anthropic-GABA24KD.js");return new r(t,e)}case"openai":{let{OpenAIClient:r}=await import("./openai-GZSRO4RJ.js");return new r(t,e)}case"openai-compat":{let{OpenAICompatClient:r}=await import("./openai-GZSRO4RJ.js");return new r(t,e)}default:throw new Error(`Unknown protocol: ${String(t.protocol)}`)}}import{execSync as Xl}from"child_process";import{platform as Ig,arch as Og}from"os";function Wl(){return{name:"Identity",priority:0,content:`You are Swifty, an AI programming assistant running in a terminal.
|
|
11
|
+
deps: ${r}}`};var F0={keyword:"dependencies",type:"object",schemaType:"object",error:Je.error,code(t){let[e,r]=H0(t);Nm(t,e),qm(t,r)}};function H0({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n]}return[e,r]}function Nm(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0,On.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0,On.checkReportMissingProp)(t,u)}):(r.if((0,gc._)`${c} && (${(0,On.checkMissingProp)(t,a,s)})`),(0,On.reportMissingProp)(t,s),r.else())}}Je.validatePropertyDeps=Nm;function qm(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0,U0.alwaysValidSchema)(s,e[a])||(r.if((0,On.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),t.ok(i))}Je.validateSchemaDeps=qm;Je.default=F0});var Um=S(yc=>{"use strict";Object.defineProperty(yc,"__esModule",{value:!0});var Lm=D(),W0=W(),V0={message:"property name must be valid",params:({params:t})=>(0,Lm._)`{propertyName: ${t.propertyName}}`},B0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:V0,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0,W0.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},s),e.if((0,Lm.not)(s),()=>{t.error(!0),o.allErrors||e.break()})}),t.ok(s)}};yc.default=B0});var wc=S(_c=>{"use strict";Object.defineProperty(_c,"__esModule",{value:!0});var _s=qe(),Ve=D(),G0=nt(),ws=W(),K0={message:"must NOT have additional properties",params:({params:t})=>(0,Ve._)`{additionalProperty: ${t.additionalProperty}}`},Z0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:K0,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&(0,ws.alwaysValidSchema)(i,r))return;let u=(0,_s.allSchemaProperties)(n.properties),l=(0,_s.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Ve._)`${s} === ${G0.default.errors}`);function d(){e.forIn("key",o,y=>{!u.length&&!l.length?g(y):e.if(m(y),()=>g(y))})}function m(y){let v;if(u.length>8){let $=(0,ws.schemaRefOrVal)(i,n.properties,"properties");v=(0,_s.isOwnProperty)(e,$,y)}else u.length?v=(0,Ve.or)(...u.map($=>(0,Ve._)`${y} === ${$}`)):v=Ve.nil;return l.length&&(v=(0,Ve.or)(v,...l.map($=>(0,Ve._)`${(0,_s.usePattern)(t,$)}.test(${y})`))),(0,Ve.not)(v)}function f(y){e.code((0,Ve._)`delete ${o}[${y}]`)}function g(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){t.setParams({additionalProperty:y}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,ws.alwaysValidSchema)(i,r)){let v=e.name("valid");c.removeAdditional==="failing"?(h(y,v,!1),e.if((0,Ve.not)(v),()=>{t.reset(),f(y)})):(h(y,v),a||e.if((0,Ve.not)(v),()=>e.break()))}}function h(y,v,$){let k={keyword:"additionalProperties",dataProp:y,dataPropType:ws.Type.Str};$===!1&&Object.assign(k,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(k,v)}}};_c.default=Z0});var Wm=S(bc=>{"use strict";Object.defineProperty(bc,"__esModule",{value:!0});var J0=bn(),Fm=qe(),vc=W(),Hm=wc(),Y0={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Hm.default.code(new J0.KeywordCxt(s,Hm.default,"additionalProperties"));let i=(0,Fm.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==!0&&(s.props=vc.mergeEvaluated.props(e,(0,vc.toHash)(i),s.props));let a=i.filter(d=>!(0,vc.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0,Fm.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};bc.default=Y0});var Km=S(Sc=>{"use strict";Object.defineProperty(Sc,"__esModule",{value:!0});var Vm=qe(),vs=D(),Bm=W(),Gm=W(),X0={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0,Vm.allSchemaProperties)(r),c=a.filter(h=>(0,Bm.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==!0&&!(s.props instanceof vs.Name)&&(s.props=(0,Gm.evaluatedPropsToName)(e,s.props));let{props:d}=s;m();function m(){for(let h of a)u&&f(h),s.allErrors?g(h):(e.var(l,!0),g(h),e.if(l))}function f(h){for(let y in u)new RegExp(h).test(y)&&(0,Bm.checkStrictMode)(s,`property ${y} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){e.forIn("key",n,y=>{e.if((0,vs._)`${(0,Vm.usePattern)(t,h)}.test(${y})`,()=>{let v=c.includes(h);v||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:y,dataPropType:Gm.Type.Str},l),s.opts.unevaluated&&d!==!0?e.assign((0,vs._)`${d}[${y}]`,!0):!v&&!s.allErrors&&e.if((0,vs.not)(l),()=>e.break())})})}}};Sc.default=X0});var Zm=S(kc=>{"use strict";Object.defineProperty(kc,"__esModule",{value:!0});var Q0=W(),eT={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Q0.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},o),t.failResult(o,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};kc.default=eT});var Jm=S(Tc=>{"use strict";Object.defineProperty(Tc,"__esModule",{value:!0});var tT=qe(),rT={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:tT.validateUnion,error:{message:"must match a schema in anyOf"}};Tc.default=rT});var Ym=S(xc=>{"use strict";Object.defineProperty(xc,"__esModule",{value:!0});var bs=D(),nT=W(),oT={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,bs._)`{passingSchemas: ${t.passing}}`},sT={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:oT,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(!0));function u(){s.forEach((l,d)=>{let m;(0,nT.alwaysValidSchema)(o,l)?e.var(c,!0):m=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,bs._)`${c} && ${i}`).assign(i,!1).assign(a,(0,bs._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,!0),e.assign(a,d),m&&t.mergeEvaluated(m,bs.Name)})})}}};xc.default=sT});var Xm=S($c=>{"use strict";Object.defineProperty($c,"__esModule",{value:!0});var iT=W(),aT={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0,iT.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a)})}};$c.default=aT});var tf=S(Ec=>{"use strict";Object.defineProperty(Ec,"__esModule",{value:!0});var Ss=D(),ef=W(),cT={message:({params:t})=>(0,Ss.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ss._)`{failingKeyword: ${t.ifClause}}`},lT={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:cT,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ef.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=Qm(n,"then"),s=Qm(n,"else");if(!o&&!s)return;let i=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l))}else o?e.if(a,u("then")):e.if((0,Ss.not)(a),u("else"));t.pass(i,()=>t.error(!0));function c(){let l=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(l)}function u(l,d){return()=>{let m=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(m,i),d?e.assign(d,(0,Ss._)`${l}`):t.setParams({ifClause:l})}}}};function Qm(t,e){let r=t.schema[e];return r!==void 0&&!(0,ef.alwaysValidSchema)(t,r)}Ec.default=lT});var rf=S(Pc=>{"use strict";Object.defineProperty(Pc,"__esModule",{value:!0});var uT=W(),dT={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,uT.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Pc.default=dT});var nf=S(Rc=>{"use strict";Object.defineProperty(Rc,"__esModule",{value:!0});var pT=dc(),mT=Am(),fT=pc(),hT=Om(),gT=jm(),yT=Dm(),_T=Um(),wT=wc(),vT=Wm(),bT=Km(),ST=Zm(),kT=Jm(),TT=Ym(),xT=Xm(),$T=tf(),ET=rf();function PT(t=!1){let e=[ST.default,kT.default,TT.default,xT.default,$T.default,ET.default,_T.default,wT.default,yT.default,vT.default,bT.default];return t?e.push(mT.default,hT.default):e.push(pT.default,fT.default),e.push(gT.default),e}Rc.default=PT});var of=S(Cc=>{"use strict";Object.defineProperty(Cc,"__esModule",{value:!0});var ie=D(),RT={message:({schemaCode:t})=>(0,ie.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,ie._)`{format: ${t}}`},CT={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:RT,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?m():f();function m(){let g=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,ie._)`${g}[${i}]`),y=r.let("fType"),v=r.let("format");r.if((0,ie._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(y,(0,ie._)`${h}.type || "string"`).assign(v,(0,ie._)`${h}.validate`),()=>r.assign(y,(0,ie._)`"string"`).assign(v,h)),t.fail$data((0,ie.or)($(),k()));function $(){return c.strictSchema===!1?ie.nil:(0,ie._)`${i} && !${v}`}function k(){let z=l.$async?(0,ie._)`(${h}.async ? await ${v}(${n}) : ${v}(${n}))`:(0,ie._)`${v}(${n})`,w=(0,ie._)`(typeof ${v} == "function" ? ${z} : ${v}.test(${n}))`;return(0,ie._)`${v} && ${v} !== true && ${y} === ${e} && !${w}`}}function f(){let g=d.formats[s];if(!g){$();return}if(g===!0)return;let[h,y,v]=k(g);h===e&&t.pass(z());function $(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${u}"`}}function k(w){let b=w instanceof RegExp?(0,ie.regexpCode)(w):c.code.formats?(0,ie._)`${c.code.formats}${(0,ie.getProperty)(s)}`:void 0,j=r.scopeValue("formats",{key:s,ref:w,code:b});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,ie._)`${j}.validate`]:["string",w,j]}function z(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!l.$async)throw new Error("async format in sync schema");return(0,ie._)`await ${v}(${n})`}return typeof y=="function"?(0,ie._)`${v}(${n})`:(0,ie._)`${v}.test(${n})`}}}};Cc.default=CT});var sf=S(Mc=>{"use strict";Object.defineProperty(Mc,"__esModule",{value:!0});var MT=of(),zT=[MT.default];Mc.default=zT});var af=S(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.contentVocabulary=kr.metadataVocabulary=void 0;kr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];kr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var lf=S(zc=>{"use strict";Object.defineProperty(zc,"__esModule",{value:!0});var AT=hm(),IT=Rm(),OT=nf(),jT=sf(),cf=af(),NT=[AT.default,IT.default,(0,OT.default)(),jT.default,cf.metadataVocabulary,cf.contentVocabulary];zc.default=NT});var df=S(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.DiscrError=void 0;var uf;(function(t){t.Tag="tag",t.Mapping="mapping"})(uf||(ks.DiscrError=uf={}))});var mf=S(Ic=>{"use strict";Object.defineProperty(Ic,"__esModule",{value:!0});var Tr=D(),Ac=df(),pf=is(),qT=Sn(),DT=W(),LT={message:({params:{discrError:t,tagName:e}})=>t===Ac.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Tr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},UT={keyword:"discriminator",type:"object",schemaType:"object",error:LT,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),u=e.const("tag",(0,Tr._)`${r}${(0,Tr.getProperty)(a)}`);e.if((0,Tr._)`typeof ${u} == "string"`,()=>l(),()=>t.error(!1,{discrError:Ac.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=m();e.if(!1);for(let g in f)e.elseIf((0,Tr._)`${u} === ${g}`),e.assign(c,d(f[g]));e.else(),t.error(!1,{discrError:Ac.DiscrError.Mapping,tag:u,tagName:a}),e.endIf()}function d(f){let g=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:f},g);return t.mergeEvaluated(h,Tr.Name),g}function m(){var f;let g={},h=v(o),y=!0;for(let z=0;z<i.length;z++){let w=i[z];if(w?.$ref&&!(0,DT.schemaHasRulesButRef)(w,s.self.RULES)){let j=w.$ref;if(w=pf.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,j),w instanceof pf.SchemaEnv&&(w=w.schema),w===void 0)throw new qT.default(s.opts.uriResolver,s.baseId,j)}let b=(f=w?.properties)===null||f===void 0?void 0:f[a];if(typeof b!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(h||v(w)),$(b,z)}if(!y)throw new Error(`discriminator: "${a}" must be required`);return g;function v({required:z}){return Array.isArray(z)&&z.includes(a)}function $(z,w){if(z.const)k(z.const,w);else if(z.enum)for(let b of z.enum)k(b,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function k(z,w){if(typeof z!="string"||z in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[z]=w}}}};Ic.default=UT});var ff=S((l1,FT)=>{FT.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var jc=S((Q,Oc)=>{"use strict";Object.defineProperty(Q,"__esModule",{value:!0});Q.MissingRefError=Q.ValidationError=Q.CodeGen=Q.Name=Q.nil=Q.stringify=Q.str=Q._=Q.KeywordCxt=Q.Ajv=void 0;var HT=lm(),WT=lf(),VT=mf(),hf=ff(),BT=["/properties"],Ts="http://json-schema.org/draft-07/schema",xr=class extends HT.default{_addVocabularies(){super._addVocabularies(),WT.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(VT.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(hf,BT):hf;this.addMetaSchema(e,Ts,!1),this.refs["http://json-schema.org/schema"]=Ts}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Ts)?Ts:void 0)}};Q.Ajv=xr;Oc.exports=Q=xr;Oc.exports.Ajv=xr;Object.defineProperty(Q,"__esModule",{value:!0});Q.default=xr;var GT=bn();Object.defineProperty(Q,"KeywordCxt",{enumerable:!0,get:function(){return GT.KeywordCxt}});var $r=D();Object.defineProperty(Q,"_",{enumerable:!0,get:function(){return $r._}});Object.defineProperty(Q,"str",{enumerable:!0,get:function(){return $r.str}});Object.defineProperty(Q,"stringify",{enumerable:!0,get:function(){return $r.stringify}});Object.defineProperty(Q,"nil",{enumerable:!0,get:function(){return $r.nil}});Object.defineProperty(Q,"Name",{enumerable:!0,get:function(){return $r.Name}});Object.defineProperty(Q,"CodeGen",{enumerable:!0,get:function(){return $r.CodeGen}});var KT=os();Object.defineProperty(Q,"ValidationError",{enumerable:!0,get:function(){return KT.default}});var ZT=Sn();Object.defineProperty(Q,"MissingRefError",{enumerable:!0,get:function(){return ZT.default}})});var kf=S(Xe=>{"use strict";Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatNames=Xe.fastFormats=Xe.fullFormats=void 0;function Ye(t,e){return{validate:t,compare:e}}Xe.fullFormats={date:Ye(wf,Lc),time:Ye(qc(!0),Uc),"date-time":Ye(gf(!0),bf),"iso-time":Ye(qc(),vf),"iso-date-time":Ye(gf(),Sf),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:tx,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[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,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?: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)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:cx,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:rx,int32:{type:"number",validate:sx},int64:{type:"number",validate:ix},float:{type:"number",validate:_f},double:{type:"number",validate:_f},password:!0,binary:!0};Xe.fastFormats={...Xe.fullFormats,date:Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,Lc),time:Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Uc),"date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,bf),"iso-time":Ye(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,vf),"iso-date-time":Ye(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Sf),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Xe.formatNames=Object.keys(Xe.fullFormats);function JT(t){return t%4===0&&(t%100!==0||t%400===0)}var YT=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,XT=[0,31,28,31,30,31,30,31,31,30,31,30,31];function wf(t){let e=YT.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&JT(r)?29:XT[n])}function Lc(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Nc=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function qc(t){return function(r){let n=Nc.exec(r);if(!n)return!1;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return!1;if(o<=23&&s<=59&&i<60)return!0;let d=s-l*c,m=o-u*c-(d<0?1:0);return(m===23||m===-1)&&(d===59||d===-1)&&i<61}}function Uc(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function vf(t,e){if(!(t&&e))return;let r=Nc.exec(t),n=Nc.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Dc=/t|\s/i;function gf(t){let e=qc(t);return function(n){let o=n.split(Dc);return o.length===2&&wf(o[0])&&e(o[1])}}function bf(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Sf(t,e){if(!(t&&e))return;let[r,n]=t.split(Dc),[o,s]=e.split(Dc),i=Lc(r,o);if(i!==void 0)return i||Uc(n,s)}var QT=/\/|:/,ex=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function tx(t){return QT.test(t)&&ex.test(t)}var yf=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function rx(t){return yf.lastIndex=0,yf.test(t)}var nx=-(2**31),ox=2**31-1;function sx(t){return Number.isInteger(t)&&t<=ox&&t>=nx}function ix(t){return Number.isInteger(t)}function _f(){return!0}var ax=/[^\\]\\Z/;function cx(t){if(ax.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var Tf=S(Er=>{"use strict";Object.defineProperty(Er,"__esModule",{value:!0});Er.formatLimitDefinition=void 0;var lx=jc(),Be=D(),$t=Be.operators,xs={formatMaximum:{okStr:"<=",ok:$t.LTE,fail:$t.GT},formatMinimum:{okStr:">=",ok:$t.GTE,fail:$t.LT},formatExclusiveMaximum:{okStr:"<",ok:$t.LT,fail:$t.GTE},formatExclusiveMinimum:{okStr:">",ok:$t.GT,fail:$t.LTE}},ux={message:({keyword:t,schemaCode:e})=>(0,Be.str)`should be ${xs[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Be._)`{comparison: ${xs[t].okStr}, limit: ${e}}`};Er.formatLimitDefinition={keyword:Object.keys(xs),type:"string",schemaType:"string",$data:!0,error:ux,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new lx.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let m=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0,Be._)`${m}[${c.schemaCode}]`);t.fail$data((0,Be.or)((0,Be._)`typeof ${f} != "object"`,(0,Be._)`${f} instanceof RegExp`,(0,Be._)`typeof ${f}.compare != "function"`,d(f)))}function l(){let m=c.schema,f=a.formats[m];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${m}" does not define "compare" function`);let g=e.scopeValue("formats",{key:m,ref:f,code:i.code.formats?(0,Be._)`${i.code.formats}${(0,Be.getProperty)(m)}`:void 0});t.fail$data(d(g))}function d(m){return(0,Be._)`${m}.compare(${r}, ${n}) ${xs[o].fail} 0`}},dependencies:["format"]};var dx=t=>(t.addKeyword(Er.formatLimitDefinition),t);Er.default=dx});var Pf=S((jn,Ef)=>{"use strict";Object.defineProperty(jn,"__esModule",{value:!0});var Pr=kf(),px=Tf(),Fc=D(),xf=new Fc.Name("fullFormats"),mx=new Fc.Name("fastFormats"),Hc=(t,e={keywords:!0})=>{if(Array.isArray(e))return $f(t,e,Pr.fullFormats,xf),t;let[r,n]=e.mode==="fast"?[Pr.fastFormats,mx]:[Pr.fullFormats,xf],o=e.formats||Pr.formatNames;return $f(t,o,r,n),e.keywords&&(0,px.default)(t),t};Hc.get=(t,e="full")=>{let n=(e==="fast"?Pr.fastFormats:Pr.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function $f(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0,Fc._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i])}Ef.exports=jn=Hc;Object.defineProperty(jn,"__esModule",{value:!0});jn.default=Hc});var nh=S((V1,rh)=>{"use strict";rh.exports=th;th.sync=Vx;var Qf=mt("fs");function Wx(t,e){var r=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!r||(r=r.split(";"),r.indexOf("")!==-1))return!0;for(var n=0;n<r.length;n++){var o=r[n].toLowerCase();if(o&&t.substr(-o.length).toLowerCase()===o)return!0}return!1}function eh(t,e,r){return!t.isSymbolicLink()&&!t.isFile()?!1:Wx(e,r)}function th(t,e,r){Qf.stat(t,function(n,o){r(n,n?!1:eh(o,t,e))})}function Vx(t,e){return eh(Qf.statSync(t),t,e)}});var ch=S((B1,ah)=>{"use strict";ah.exports=sh;sh.sync=Bx;var oh=mt("fs");function sh(t,e,r){oh.stat(t,function(n,o){r(n,n?!1:ih(o,e))})}function Bx(t,e){return ih(oh.statSync(t),e)}function ih(t,e){return t.isFile()&&Gx(t,e)}function Gx(t,e){var r=t.mode,n=t.uid,o=t.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),i=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),c=parseInt("010",8),u=parseInt("001",8),l=a|c,d=r&u||r&c&&o===i||r&a&&n===s||r&l&&s===0;return d}});var uh=S((K1,lh)=>{"use strict";var G1=mt("fs"),js;process.platform==="win32"||global.TESTING_WINDOWS?js=nh():js=ch();lh.exports=ll;ll.sync=Kx;function ll(t,e,r){if(typeof e=="function"&&(r=e,e={}),!r){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(n,o){ll(t,e||{},function(s,i){s?o(s):n(i)})})}js(t,e||{},function(n,o){n&&(n.code==="EACCES"||e&&e.ignoreErrors)&&(n=null,o=!1),r(n,o)})}function Kx(t,e){try{return js.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var yh=S((Z1,gh)=>{"use strict";var jr=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",dh=mt("path"),Zx=jr?";":":",ph=uh(),mh=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),fh=(t,e)=>{let r=e.colon||Zx,n=t.match(/\//)||jr&&t.match(/\\/)?[""]:[...jr?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],o=jr?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=jr?o.split(r):[""];return jr&&t.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:n,pathExt:s,pathExtExe:o}},hh=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:o,pathExtExe:s}=fh(t,e),i=[],a=u=>new Promise((l,d)=>{if(u===n.length)return e.all&&i.length?l(i):d(mh(t));let m=n[u],f=/^".*"$/.test(m)?m.slice(1,-1):m,g=dh.join(f,t),h=!f&&/^\.[\\\/]/.test(t)?t.slice(0,2)+g:g;l(c(h,u,0))}),c=(u,l,d)=>new Promise((m,f)=>{if(d===o.length)return m(a(l+1));let g=o[d];ph(u+g,{pathExt:s},(h,y)=>{if(!h&&y)if(e.all)i.push(u+g);else return m(u+g);return m(c(u,l,d+1))})});return r?a(0).then(u=>r(null,u),r):a(0)},Jx=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:o}=fh(t,e),s=[];for(let i=0;i<r.length;i++){let a=r[i],c=/^".*"$/.test(a)?a.slice(1,-1):a,u=dh.join(c,t),l=!c&&/^\.[\\\/]/.test(t)?t.slice(0,2)+u:u;for(let d=0;d<n.length;d++){let m=l+n[d];try{if(ph.sync(m,{pathExt:o}))if(e.all)s.push(m);else return m}catch{}}}if(e.all&&s.length)return s;if(e.nothrow)return null;throw mh(t)};gh.exports=hh;hh.sync=Jx});var wh=S((J1,ul)=>{"use strict";var _h=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};ul.exports=_h;ul.exports.default=_h});var kh=S((Y1,Sh)=>{"use strict";var vh=mt("path"),Yx=yh(),Xx=wh();function bh(t,e){let r=t.options.env||process.env,n=process.cwd(),o=t.options.cwd!=null,s=o&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(t.options.cwd)}catch{}let i;try{i=Yx.sync(t.command,{path:r[Xx({env:r})],pathExt:e?vh.delimiter:void 0})}catch{}finally{s&&process.chdir(n)}return i&&(i=vh.resolve(o?t.options.cwd:"",i)),i}function Qx(t){return bh(t)||bh(t,!0)}Sh.exports=Qx});var Th=S((X1,pl)=>{"use strict";var dl=/([()\][%!^"`<>&|;, *?])/g;function e$(t){return t=t.replace(dl,"^$1"),t}function t$(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(dl,"^$1"),e&&(t=t.replace(dl,"^$1")),t}pl.exports.command=e$;pl.exports.argument=t$});var $h=S((Q1,xh)=>{"use strict";xh.exports=/^#!(.*)/});var Ph=S((ej,Eh)=>{"use strict";var r$=$h();Eh.exports=(t="")=>{let e=t.match(r$);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),o=r.split("/").pop();return o==="env"?n:n?`${o} ${n}`:o}});var Ch=S((tj,Rh)=>{"use strict";var ml=mt("fs"),n$=Ph();function o$(t){let r=Buffer.alloc(150),n;try{n=ml.openSync(t,"r"),ml.readSync(n,r,0,150,0),ml.closeSync(n)}catch{}return n$(r.toString())}Rh.exports=o$});var Ih=S((rj,Ah)=>{"use strict";var s$=mt("path"),Mh=kh(),zh=Th(),i$=Ch(),a$=process.platform==="win32",c$=/\.(?:com|exe)$/i,l$=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function u$(t){t.file=Mh(t);let e=t.file&&i$(t.file);return e?(t.args.unshift(t.file),t.command=e,Mh(t)):t.file}function d$(t){if(!a$)return t;let e=u$(t),r=!c$.test(e);if(t.options.forceShell||r){let n=l$.test(e);t.command=s$.normalize(t.command),t.command=zh.command(t.command),t.args=t.args.map(s=>zh.argument(s,n));let o=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${o}"`],t.command=process.env.comspec||"cmd.exe",t.options.windowsVerbatimArguments=!0}return t}function p$(t,e,r){e&&!Array.isArray(e)&&(r=e,e=null),e=e?e.slice(0):[],r=Object.assign({},r);let n={command:t,args:e,options:r,file:void 0,original:{command:t,args:e}};return r.shell?n:d$(n)}Ah.exports=p$});var Nh=S((nj,jh)=>{"use strict";var fl=process.platform==="win32";function hl(t,e){return Object.assign(new Error(`${e} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${t.command}`,path:t.command,spawnargs:t.args})}function m$(t,e){if(!fl)return;let r=t.emit;t.emit=function(n,o){if(n==="exit"){let s=Oh(o,e);if(s)return r.call(t,"error",s)}return r.apply(t,arguments)}}function Oh(t,e){return fl&&t===1&&!e.file?hl(e.original,"spawn"):null}function f$(t,e){return fl&&t===1&&!e.file?hl(e.original,"spawnSync"):null}jh.exports={hookChildProcess:m$,verifyENOENT:Oh,verifyENOENTSync:f$,notFoundError:hl}});var Lh=S((oj,Nr)=>{"use strict";var qh=mt("child_process"),gl=Ih(),yl=Nh();function Dh(t,e,r){let n=gl(t,e,r),o=qh.spawn(n.command,n.args,n.options);return yl.hookChildProcess(o,n),o}function h$(t,e,r){let n=gl(t,e,r),o=qh.spawnSync(n.command,n.args,n.options);return o.error=o.error||yl.verifyENOENTSync(o.status,n),o}Nr.exports=Dh;Nr.exports.spawn=Dh;Nr.exports.sync=h$;Nr.exports._parse=gl;Nr.exports._enoent=yl});var Bh=S(wl=>{"use strict";var Hh=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,b$=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Wh=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,S$=/\\([\u000b\u0020-\u00ff])/g,k$=/([\\"])/g,Vh=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;wl.format=T$;wl.parse=x$;function T$(t){if(!t||typeof t!="object")throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!Vh.test(r))throw new TypeError("invalid type");var n=r;if(e&&typeof e=="object")for(var o,s=Object.keys(e).sort(),i=0;i<s.length;i++){if(o=s[i],!Wh.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+E$(e[o])}return n}function x$(t){if(!t)throw new TypeError("argument string is required");var e=typeof t=="object"?$$(t):t;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=r!==-1?e.slice(0,r).trim():e.trim();if(!Vh.test(n))throw new TypeError("invalid media type");var o=new P$(n.toLowerCase());if(r!==-1){var s,i,a;for(Hh.lastIndex=r;i=Hh.exec(e);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,s=i[1].toLowerCase(),a=i[2],a.charCodeAt(0)===34&&(a=a.slice(1,-1),a.indexOf("\\")!==-1&&(a=a.replace(S$,"$1"))),o.parameters[s]=a}if(r!==e.length)throw new TypeError("invalid parameter format")}return o}function $$(t){var e;if(typeof t.getHeader=="function"?e=t.getHeader("content-type"):typeof t.headers=="object"&&(e=t.headers&&t.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function E$(t){var e=String(t);if(Wh.test(e))return e;if(e.length>0&&!b$.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(k$,"\\$1")+'"'}function P$(t){this.parameters=Object.create(null),this.type=t}});async function ni(t,e){switch(t.protocol){case"anthropic":{let{AnthropicClient:r}=await import("./anthropic-GAI75HYJ.js");return new r(t,e)}case"openai":{let{OpenAIClient:r}=await import("./openai-SMJX34AX.js");return new r(t,e)}case"openai-compat":{let{OpenAICompatClient:r}=await import("./openai-SMJX34AX.js");return new r(t,e)}default:throw new Error(`Unknown protocol: ${String(t.protocol)}`)}}import{execSync as Xl}from"child_process";import{platform as Ig,arch as Og}from"os";function Wl(){return{name:"Identity",priority:0,content:`You are Swifty, an AI programming assistant running in a terminal.
|
|
12
12
|
You assist users with software engineering tasks, including writing code, debugging, refactoring, explaining code, and executing commands.
|
|
13
13
|
|
|
14
14
|
IMPORTANT: Avoid introducing security vulnerabilities such as command injection, XSS, SQL injection, and other common exploits. Prioritize writing secure, correct code.
|
|
@@ -248,7 +248,7 @@ ${Te}`,d++}else Of(w,b,ne)?m=w.slice(w.charCodeAt(b+6)===Bt?b+7:b+6,j)||void 0:v
|
|
|
248
248
|
${$l}`,d++;return}if(Of(w,b,ne)){m=w.slice(w.charCodeAt(b+6)===Bt?b+7:b+6,j)||void 0;return}if(ne===105&&w.charCodeAt(b+1)===100&&w.charCodeAt(b+2)===58){let pt=w.slice(w.charCodeAt(b+3)===Bt?b+4:b+3,j);u=pt.includes("\0")?void 0:pt;return}if(ne===58){if(o){let pt=w.slice(b,j);o(pt.slice(w.charCodeAt(b+1)===Bt?2:1))}return}let oe=w.slice(b,j),Te=oe.indexOf(":");if(Te===-1){$(oe,"",oe);return}let Hr=oe.slice(0,Te),oo=oe.charCodeAt(Te+1)===Bt?2:1,so=oe.slice(Te+oo);$(Hr,so,oe)}function $(w,b,j){switch(w){case"event":m=b||void 0;break;case"data":l=d===0?b:`${l}
|
|
249
249
|
${b}`,d++;break;case"id":u=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?n(parseInt(b,10)):r(new Nn(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:j}));break;default:r(new Nn(`Unknown field "${w.length>20?`${w.slice(0,20)}\u2026`:w}"`,{type:"unknown-field",field:w,value:b,line:j}));break}}function k(){d>0&&e({id:u,event:m,data:l}),u=void 0,l="",d=0,m=void 0}function z(w={}){if(w.consume&&i.length>0){let b=i.join("");v(b,0,b.length)}c=!0,u=void 0,l="",d=0,m=void 0,i.length=0,a=0,f=!1}return{feed:g,reset:z}}function If(t,e,r){return r===100&&t.charCodeAt(e+1)===97&&t.charCodeAt(e+2)===116&&t.charCodeAt(e+3)===97&&t.charCodeAt(e+4)===58}function Of(t,e,r){return r===101&&t.charCodeAt(e+1)===118&&t.charCodeAt(e+2)===101&&t.charCodeAt(e+3)===110&&t.charCodeAt(e+4)===116&&t.charCodeAt(e+5)===58}var zs=class extends Event{constructor(e,r){var n,o;super(e),this.code=(n=r?.code)!=null?n:void 0,this.message=(o=r?.message)!=null?o:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,r,n){return n(jf(this),r)}[Symbol.for("Deno.customInspect")](e,r){return e(jf(this),r)}};function yx(t){let e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function Vc(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(Vc).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${Vc(t.cause)}`:t.message:`${t}`}function jf(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var qf=t=>{throw TypeError(t)},Qc=(t,e,r)=>e.has(t)||qf("Cannot "+r),F=(t,e,r)=>(Qc(t,e,"read from private field"),r?r.call(t):e.get(t)),ue=(t,e,r)=>e.has(t)?qf("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),te=(t,e,r,n)=>(Qc(t,e,"write to private field"),e.set(t,r),r),st=(t,e,r)=>(Qc(t,e,"access private method"),r),Me,Gt,Rr,Ms,As,Ln,zr,Un,Et,Cr,Ar,Mr,qn,Ge,Bc,Gc,Kc,Nf,Zc,Jc,Dn,Yc,Xc,Kt=class extends EventTarget{constructor(e,r){var n,o;super(),ue(this,Ge),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,ue(this,Me),ue(this,Gt),ue(this,Rr),ue(this,Ms),ue(this,As),ue(this,Ln),ue(this,zr),ue(this,Un,null),ue(this,Et),ue(this,Cr),ue(this,Ar,null),ue(this,Mr,null),ue(this,qn,null),ue(this,Gc,async s=>{var i;F(this,Cr).reset();let{body:a,redirected:c,status:u,headers:l}=s;if(u===204){st(this,Ge,Dn).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?te(this,Rr,new URL(s.url)):te(this,Rr,void 0),u!==200){st(this,Ge,Dn).call(this,`Non-200 status code (${u})`,u);return}if(!(l.get("content-type")||"").startsWith("text/event-stream")){st(this,Ge,Dn).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(F(this,Me)===this.CLOSED)return;te(this,Me,this.OPEN);let d=new Event("open");if((i=F(this,qn))==null||i.call(this,d),this.dispatchEvent(d),typeof a!="object"||!a||!("getReader"in a)){st(this,Ge,Dn).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}let m=new TextDecoder,f=a.getReader(),g=!0;do{let{done:h,value:y}=await f.read();y&&F(this,Cr).feed(m.decode(y,{stream:!h})),h&&(g=!1,F(this,Cr).reset(),st(this,Ge,Yc).call(this))}while(g)}),ue(this,Kc,s=>{te(this,Et,void 0),!(s.name==="AbortError"||s.type==="aborted")&&st(this,Ge,Yc).call(this,Vc(s))}),ue(this,Zc,s=>{typeof s.id=="string"&&te(this,Un,s.id);let i=new MessageEvent(s.event||"message",{data:s.data,origin:F(this,Rr)?F(this,Rr).origin:F(this,Gt).origin,lastEventId:s.id||""});F(this,Mr)&&(!s.event||s.event==="message")&&F(this,Mr).call(this,i),this.dispatchEvent(i)}),ue(this,Jc,s=>{te(this,Ln,s)}),ue(this,Xc,()=>{te(this,zr,void 0),F(this,Me)===this.CONNECTING&&st(this,Ge,Bc).call(this)});try{if(e instanceof URL)te(this,Gt,e);else if(typeof e=="string")te(this,Gt,new URL(e,_x()));else throw new Error("Invalid URL")}catch{throw yx("An invalid or illegal string was specified")}te(this,Cr,Cs({onEvent:F(this,Zc),onRetry:F(this,Jc)})),te(this,Me,this.CONNECTING),te(this,Ln,3e3),te(this,As,(n=r?.fetch)!=null?n:globalThis.fetch),te(this,Ms,(o=r?.withCredentials)!=null?o:!1),st(this,Ge,Bc).call(this)}get readyState(){return F(this,Me)}get url(){return F(this,Gt).href}get withCredentials(){return F(this,Ms)}get onerror(){return F(this,Ar)}set onerror(e){te(this,Ar,e)}get onmessage(){return F(this,Mr)}set onmessage(e){te(this,Mr,e)}get onopen(){return F(this,qn)}set onopen(e){te(this,qn,e)}addEventListener(e,r,n){let o=r;super.addEventListener(e,o,n)}removeEventListener(e,r,n){let o=r;super.removeEventListener(e,o,n)}close(){F(this,zr)&&clearTimeout(F(this,zr)),F(this,Me)!==this.CLOSED&&(F(this,Et)&&F(this,Et).abort(),te(this,Me,this.CLOSED),te(this,Et,void 0))}};Me=new WeakMap,Gt=new WeakMap,Rr=new WeakMap,Ms=new WeakMap,As=new WeakMap,Ln=new WeakMap,zr=new WeakMap,Un=new WeakMap,Et=new WeakMap,Cr=new WeakMap,Ar=new WeakMap,Mr=new WeakMap,qn=new WeakMap,Ge=new WeakSet,Bc=function(){te(this,Me,this.CONNECTING),te(this,Et,new AbortController),F(this,As)(F(this,Gt),st(this,Ge,Nf).call(this)).then(F(this,Gc)).catch(F(this,Kc))},Gc=new WeakMap,Kc=new WeakMap,Nf=function(){var t;let e={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...F(this,Un)?{"Last-Event-ID":F(this,Un)}:void 0},cache:"no-store",signal:(t=F(this,Et))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},Zc=new WeakMap,Jc=new WeakMap,Dn=function(t,e){var r;F(this,Me)!==this.CLOSED&&te(this,Me,this.CLOSED);let n=new zs("error",{code:e,message:t});(r=F(this,Ar))==null||r.call(this,n),this.dispatchEvent(n)},Yc=function(t,e){var r;if(F(this,Me)===this.CLOSED)return;te(this,Me,this.CONNECTING);let n=new zs("error",{code:e,message:t});(r=F(this,Ar))==null||r.call(this,n),this.dispatchEvent(n),te(this,zr,setTimeout(F(this,Xc),F(this,Ln)))},Xc=new WeakMap,Kt.CONNECTING=0,Kt.OPEN=1,Kt.CLOSED=2;function _x(){let t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}function Ir(t){return t?t instanceof Headers?Object.fromEntries(t.entries()):Array.isArray(t)?Object.fromEntries(t):{...t}:{}}function Is(t=fetch,e){return e?async(r,n)=>{let o={...e,...n,headers:n?.headers?{...Ir(e.headers),...Ir(n.headers)}:e.headers};return t(r,o)}:t}var el;el=globalThis.crypto?.webcrypto??globalThis.crypto??import("crypto").then(t=>t.webcrypto);async function wx(t){return(await el).getRandomValues(new Uint8Array(t))}async function vx(t){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",r=Math.pow(2,8)-Math.pow(2,8)%e.length,n="";for(;n.length<t;){let o=await wx(t-n.length);for(let s of o)s<r&&(n+=e[s%e.length])}return n}async function bx(t){return await vx(t)}async function Sx(t){let e=await(await el).subtle.digest("SHA-256",new TextEncoder().encode(t));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function tl(t){if(t||(t=43),t<43||t>128)throw`Expected a length between 43 and 128. Received ${t}.`;let e=await bx(t),r=await Sx(e);return{code_verifier:e,code_challenge:r}}var ye=zl().superRefine((t,e)=>{if(!URL.canParse(t))return e.addIssue({code:jl.custom,message:"URL must be parseable",fatal:!0}),El}).refine(t=>{let e=new URL(t);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Lf=ce({resource:p().url(),authorization_servers:T(ye).optional(),jwks_uri:p().url().optional(),scopes_supported:T(p()).optional(),bearer_methods_supported:T(p()).optional(),resource_signing_alg_values_supported:T(p()).optional(),resource_name:p().optional(),resource_documentation:p().optional(),resource_policy_uri:p().url().optional(),resource_tos_uri:p().url().optional(),tls_client_certificate_bound_access_tokens:Z().optional(),authorization_details_types_supported:T(p()).optional(),dpop_signing_alg_values_supported:T(p()).optional(),dpop_bound_access_tokens_required:Z().optional()}),rl=ce({issuer:p(),authorization_endpoint:ye,token_endpoint:ye,registration_endpoint:ye.optional(),scopes_supported:T(p()).optional(),response_types_supported:T(p()),response_modes_supported:T(p()).optional(),grant_types_supported:T(p()).optional(),token_endpoint_auth_methods_supported:T(p()).optional(),token_endpoint_auth_signing_alg_values_supported:T(p()).optional(),service_documentation:ye.optional(),revocation_endpoint:ye.optional(),revocation_endpoint_auth_methods_supported:T(p()).optional(),revocation_endpoint_auth_signing_alg_values_supported:T(p()).optional(),introspection_endpoint:p().optional(),introspection_endpoint_auth_methods_supported:T(p()).optional(),introspection_endpoint_auth_signing_alg_values_supported:T(p()).optional(),code_challenge_methods_supported:T(p()).optional(),client_id_metadata_document_supported:Z().optional()}),kx=ce({issuer:p(),authorization_endpoint:ye,token_endpoint:ye,userinfo_endpoint:ye.optional(),jwks_uri:ye,registration_endpoint:ye.optional(),scopes_supported:T(p()).optional(),response_types_supported:T(p()),response_modes_supported:T(p()).optional(),grant_types_supported:T(p()).optional(),acr_values_supported:T(p()).optional(),subject_types_supported:T(p()),id_token_signing_alg_values_supported:T(p()),id_token_encryption_alg_values_supported:T(p()).optional(),id_token_encryption_enc_values_supported:T(p()).optional(),userinfo_signing_alg_values_supported:T(p()).optional(),userinfo_encryption_alg_values_supported:T(p()).optional(),userinfo_encryption_enc_values_supported:T(p()).optional(),request_object_signing_alg_values_supported:T(p()).optional(),request_object_encryption_alg_values_supported:T(p()).optional(),request_object_encryption_enc_values_supported:T(p()).optional(),token_endpoint_auth_methods_supported:T(p()).optional(),token_endpoint_auth_signing_alg_values_supported:T(p()).optional(),display_values_supported:T(p()).optional(),claim_types_supported:T(p()).optional(),claims_supported:T(p()).optional(),service_documentation:p().optional(),claims_locales_supported:T(p()).optional(),ui_locales_supported:T(p()).optional(),claims_parameter_supported:Z().optional(),request_parameter_supported:Z().optional(),request_uri_parameter_supported:Z().optional(),require_request_uri_registration:Z().optional(),op_policy_uri:ye.optional(),op_tos_uri:ye.optional(),client_id_metadata_document_supported:Z().optional()}),Uf=x({...kx.shape,...rl.pick({code_challenge_methods_supported:!0}).shape}),Ff=x({access_token:p(),id_token:p().optional(),token_type:p(),expires_in:Nl.number().optional(),scope:p().optional(),refresh_token:p().optional()}).strip(),Hf=x({error:p(),error_description:p().optional(),error_uri:p().optional()}),Df=ye.optional().or(P("").transform(()=>{})),Tx=x({redirect_uris:T(ye),token_endpoint_auth_method:p().optional(),grant_types:T(p()).optional(),response_types:T(p()).optional(),client_name:p().optional(),client_uri:ye.optional(),logo_uri:Df,scope:p().optional(),contacts:T(p()).optional(),tos_uri:Df,policy_uri:p().optional(),jwks_uri:ye.optional(),jwks:Il().optional(),software_id:p().optional(),software_version:p().optional(),software_statement:p().optional()}).strip(),xx=x({client_id:p(),client_secret:p().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional()}).strip(),Wf=Tx.merge(xx),P1=x({error:p(),error_description:p().optional()}).strip(),R1=x({token:p(),token_type_hint:p().optional()}).strip();function Vf(t){let e=typeof t=="string"?new URL(t):new URL(t.href);return e.hash="",e}function Bf({requestedResource:t,configuredResource:e}){let r=typeof t=="string"?new URL(t):new URL(t.href),n=typeof e=="string"?new URL(e):new URL(e.href);if(r.origin!==n.origin||r.pathname.length<n.pathname.length)return!1;let o=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",s=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";return o.startsWith(s)}var ae=class extends Error{constructor(e,r){super(e),this.errorUri=r,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Fn=class extends ae{};Fn.errorCode="invalid_request";var Zt=class extends ae{};Zt.errorCode="invalid_client";var Jt=class extends ae{};Jt.errorCode="invalid_grant";var Yt=class extends ae{};Yt.errorCode="unauthorized_client";var Hn=class extends ae{};Hn.errorCode="unsupported_grant_type";var Wn=class extends ae{};Wn.errorCode="invalid_scope";var Vn=class extends ae{};Vn.errorCode="access_denied";var it=class extends ae{};it.errorCode="server_error";var Bn=class extends ae{};Bn.errorCode="temporarily_unavailable";var Gn=class extends ae{};Gn.errorCode="unsupported_response_type";var Kn=class extends ae{};Kn.errorCode="unsupported_token_type";var Zn=class extends ae{};Zn.errorCode="invalid_token";var Jn=class extends ae{};Jn.errorCode="method_not_allowed";var Yn=class extends ae{};Yn.errorCode="too_many_requests";var Xt=class extends ae{};Xt.errorCode="invalid_client_metadata";var Xn=class extends ae{};Xn.errorCode="insufficient_scope";var Qn=class extends ae{};Qn.errorCode="invalid_target";var Gf={[Fn.errorCode]:Fn,[Zt.errorCode]:Zt,[Jt.errorCode]:Jt,[Yt.errorCode]:Yt,[Hn.errorCode]:Hn,[Wn.errorCode]:Wn,[Vn.errorCode]:Vn,[it.errorCode]:it,[Bn.errorCode]:Bn,[Gn.errorCode]:Gn,[Kn.errorCode]:Kn,[Zn.errorCode]:Zn,[Jn.errorCode]:Jn,[Yn.errorCode]:Yn,[Xt.errorCode]:Xt,[Xn.errorCode]:Xn,[Qn.errorCode]:Qn};var ke=class extends Error{constructor(e){super(e??"Unauthorized")}};function $x(t){return["client_secret_basic","client_secret_post","none"].includes(t)}var nl="code",ol="S256";function Ex(t,e){let r=t.client_secret!==void 0;return"token_endpoint_auth_method"in t&&t.token_endpoint_auth_method&&$x(t.token_endpoint_auth_method)&&(e.length===0||e.includes(t.token_endpoint_auth_method))?t.token_endpoint_auth_method:e.length===0?r?"client_secret_basic":"none":r&&e.includes("client_secret_basic")?"client_secret_basic":r&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":r?"client_secret_post":"none"}function Px(t,e,r,n){let{client_id:o,client_secret:s}=e;switch(t){case"client_secret_basic":Rx(o,s,r);return;case"client_secret_post":Cx(o,s,n);return;case"none":Mx(o,n);return;default:throw new Error(`Unsupported client authentication method: ${t}`)}}function Rx(t,e,r){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let n=btoa(`${t}:${e}`);r.set("Authorization",`Basic ${n}`)}function Cx(t,e,r){r.set("client_id",t),e&&r.set("client_secret",e)}function Mx(t,e){e.set("client_id",t)}async function Zf(t){let e=t instanceof Response?t.status:void 0,r=t instanceof Response?await t.text():t;try{let n=Hf.parse(JSON.parse(r)),{error:o,error_description:s,error_uri:i}=n,a=Gf[o]||it;return new a(s||"",i)}catch(n){let o=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${n}. Raw body: ${r}`;return new it(o)}}async function at(t,e){try{return await sl(t,e)}catch(r){if(r instanceof Zt||r instanceof Yt)return await t.invalidateCredentials?.("all"),await sl(t,e);if(r instanceof Jt)return await t.invalidateCredentials?.("tokens"),await sl(t,e);throw r}}async function sl(t,{serverUrl:e,authorizationCode:r,scope:n,resourceMetadataUrl:o,fetchFn:s}){let i=await t.discoveryState?.(),a,c,u,l=o;if(!l&&i?.resourceMetadataUrl&&(l=new URL(i.resourceMetadataUrl)),i?.authorizationServerUrl){if(c=i.authorizationServerUrl,a=i.resourceMetadata,u=i.authorizationServerMetadata??await Yf(c,{fetchFn:s}),!a)try{a=await Jf(e,{resourceMetadataUrl:l},s)}catch{}(u!==i.authorizationServerMetadata||a!==i.resourceMetadata)&&await t.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}else{let k=await qx(e,{resourceMetadataUrl:l,fetchFn:s});c=k.authorizationServerUrl,u=k.authorizationServerMetadata,a=k.resourceMetadata,await t.saveDiscoveryState?.({authorizationServerUrl:String(c),resourceMetadataUrl:l?.toString(),resourceMetadata:a,authorizationServerMetadata:u})}let d=await Ax(e,t,a),m=n||a?.scopes_supported?.join(" ")||t.clientMetadata.scope,f=await Promise.resolve(t.clientInformation());if(!f){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");let k=u?.client_id_metadata_document_supported===!0,z=t.clientMetadataUrl;if(z&&!zx(z))throw new Xt(`clientMetadataUrl must be a valid HTTPS URL with a non-root pathname, got: ${z}`);if(k&&z)f={client_id:z},await t.saveClientInformation?.(f);else{if(!t.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let b=await Hx(c,{metadata:u,clientMetadata:t.clientMetadata,scope:m,fetchFn:s});await t.saveClientInformation(b),f=b}}let g=!t.redirectUrl;if(r!==void 0||g){let k=await Fx(t,c,{metadata:u,resource:d,authorizationCode:r,fetchFn:s});return await t.saveTokens(k),"AUTHORIZED"}let h=await t.tokens();if(h?.refresh_token)try{let k=await Ux(c,{metadata:u,clientInformation:f,refreshToken:h.refresh_token,resource:d,addClientAuthentication:t.addClientAuthentication,fetchFn:s});return await t.saveTokens(k),"AUTHORIZED"}catch(k){if(!(!(k instanceof ae)||k instanceof it))throw k}let y=t.state?await t.state():void 0,{authorizationUrl:v,codeVerifier:$}=await Dx(c,{metadata:u,clientInformation:f,state:y,redirectUrl:t.redirectUrl,scope:m,resource:d});return await t.saveCodeVerifier($),await t.redirectToAuthorization(v),"REDIRECT"}function zx(t){if(!t)return!1;try{let e=new URL(t);return e.protocol==="https:"&&e.pathname!=="/"}catch{return!1}}async function Ax(t,e,r){let n=Vf(t);if(e.validateResourceURL)return await e.validateResourceURL(n,r?.resource);if(r){if(!Bf({requestedResource:n,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${n} (or origin)`);return new URL(r.resource)}}function Or(t){let e=t.headers.get("WWW-Authenticate");if(!e)return{};let[r,n]=e.split(" ");if(r.toLowerCase()!=="bearer"||!n)return{};let o=il(t,"resource_metadata")||void 0,s;if(o)try{s=new URL(o)}catch{}let i=il(t,"scope")||void 0,a=il(t,"error")||void 0;return{resourceMetadataUrl:s,scope:i,error:a}}function il(t,e){let r=t.headers.get("WWW-Authenticate");if(!r)return null;let n=new RegExp(`${e}=(?:"([^"]+)"|([^\\s,]+))`),o=r.match(n);return o?o[1]||o[2]:null}async function Jf(t,e,r=fetch){let n=await jx(t,"oauth-protected-resource",r,{protocolVersion:e?.protocolVersion,metadataUrl:e?.resourceMetadataUrl});if(!n||n.status===404)throw await n?.body?.cancel(),new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!n.ok)throw await n.body?.cancel(),new Error(`HTTP ${n.status} trying to load well-known OAuth protected resource metadata.`);return Lf.parse(await n.json())}async function al(t,e,r=fetch){try{return await r(t,{headers:e})}catch(n){if(n instanceof TypeError)return e?al(t,void 0,r):void 0;throw n}}function Ix(t,e="",r={}){return e.endsWith("/")&&(e=e.slice(0,-1)),r.prependPathname?`${e}/.well-known/${t}`:`/.well-known/${t}${e}`}async function Kf(t,e,r=fetch){return await al(t,{"MCP-Protocol-Version":e},r)}function Ox(t,e){return!t||t.status>=400&&t.status<500&&e!=="/"}async function jx(t,e,r,n){let o=new URL(t),s=n?.protocolVersion??cr,i;if(n?.metadataUrl)i=new URL(n.metadataUrl);else{let c=Ix(e,o.pathname);i=new URL(c,n?.metadataServerUrl??o),i.search=o.search}let a=await Kf(i,s,r);if(!n?.metadataUrl&&Ox(a,o.pathname)){let c=new URL(`/.well-known/${e}`,o);a=await Kf(c,s,r)}return a}function Nx(t){let e=typeof t=="string"?new URL(t):t,r=e.pathname!=="/",n=[];if(!r)return n.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),n.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),n;let o=e.pathname;return o.endsWith("/")&&(o=o.slice(0,-1)),n.push({url:new URL(`/.well-known/oauth-authorization-server${o}`,e.origin),type:"oauth"}),n.push({url:new URL(`/.well-known/openid-configuration${o}`,e.origin),type:"oidc"}),n.push({url:new URL(`${o}/.well-known/openid-configuration`,e.origin),type:"oidc"}),n}async function Yf(t,{fetchFn:e=fetch,protocolVersion:r=cr}={}){let n={"MCP-Protocol-Version":r,Accept:"application/json"},o=Nx(t);for(let{url:s,type:i}of o){let a=await al(s,n,e);if(a){if(!a.ok){if(await a.body?.cancel(),a.status>=400&&a.status<500)continue;throw new Error(`HTTP ${a.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${s}`)}return i==="oauth"?rl.parse(await a.json()):Uf.parse(await a.json())}}}async function qx(t,e){let r,n;try{r=await Jf(t,{resourceMetadataUrl:e?.resourceMetadataUrl},e?.fetchFn),r.authorization_servers&&r.authorization_servers.length>0&&(n=r.authorization_servers[0])}catch{}n||(n=String(new URL("/",t)));let o=await Yf(n,{fetchFn:e?.fetchFn});return{authorizationServerUrl:n,authorizationServerMetadata:o,resourceMetadata:r}}async function Dx(t,{metadata:e,clientInformation:r,redirectUrl:n,scope:o,state:s,resource:i}){let a;if(e){if(a=new URL(e.authorization_endpoint),!e.response_types_supported.includes(nl))throw new Error(`Incompatible auth server: does not support response type ${nl}`);if(e.code_challenge_methods_supported&&!e.code_challenge_methods_supported.includes(ol))throw new Error(`Incompatible auth server: does not support code challenge method ${ol}`)}else a=new URL("/authorize",t);let c=await tl(),u=c.code_verifier,l=c.code_challenge;return a.searchParams.set("response_type",nl),a.searchParams.set("client_id",r.client_id),a.searchParams.set("code_challenge",l),a.searchParams.set("code_challenge_method",ol),a.searchParams.set("redirect_uri",String(n)),s&&a.searchParams.set("state",s),o&&a.searchParams.set("scope",o),o?.includes("offline_access")&&a.searchParams.append("prompt","consent"),i&&a.searchParams.set("resource",i.href),{authorizationUrl:a,codeVerifier:u}}function Lx(t,e,r){return new URLSearchParams({grant_type:"authorization_code",code:t,code_verifier:e,redirect_uri:String(r)})}async function Xf(t,{metadata:e,tokenRequestParams:r,clientInformation:n,addClientAuthentication:o,resource:s,fetchFn:i}){let a=e?.token_endpoint?new URL(e.token_endpoint):new URL("/token",t),c=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"});if(s&&r.set("resource",s.href),o)await o(c,r,a,e);else if(n){let l=e?.token_endpoint_auth_methods_supported??[],d=Ex(n,l);Px(d,n,c,r)}let u=await(i??fetch)(a,{method:"POST",headers:c,body:r});if(!u.ok)throw await Zf(u);return Ff.parse(await u.json())}async function Ux(t,{metadata:e,clientInformation:r,refreshToken:n,resource:o,addClientAuthentication:s,fetchFn:i}){let a=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),c=await Xf(t,{metadata:e,tokenRequestParams:a,clientInformation:r,addClientAuthentication:s,resource:o,fetchFn:i});return{refresh_token:n,...c}}async function Fx(t,e,{metadata:r,resource:n,authorizationCode:o,fetchFn:s}={}){let i=t.clientMetadata.scope,a;if(t.prepareTokenRequest&&(a=await t.prepareTokenRequest(i)),!a){if(!o)throw new Error("Either provider.prepareTokenRequest() or authorizationCode is required");if(!t.redirectUrl)throw new Error("redirectUrl is required for authorization_code flow");let u=await t.codeVerifier();a=Lx(o,u,t.redirectUrl)}let c=await t.clientInformation();return Xf(e,{metadata:r,tokenRequestParams:a,clientInformation:c??void 0,addClientAuthentication:t.addClientAuthentication,resource:n,fetchFn:s})}async function Hx(t,{metadata:e,clientMetadata:r,scope:n,fetchFn:o}){let s;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");s=new URL(e.registration_endpoint)}else s=new URL("/register",t);let i=await(o??fetch)(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,...n!==void 0?{scope:n}:{}})});if(!i.ok)throw await Zf(i);return Wf.parse(await i.json())}var cl=class extends Error{constructor(e,r,n){super(`SSE error: ${r}`),this.code=e,this.event=n}},Os=class{constructor(e,r){this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=r?.eventSourceInit,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Is(r?.fetch,r?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new ke("No auth provider");let e;try{e=await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new ke;return await this._startOrAuth()}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Ir(this._requestInit?.headers);return new Headers({...e,...r})}_startOrAuth(){let e=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((r,n)=>{this._eventSource=new Kt(this._url.href,{...this._eventSourceInit,fetch:async(o,s)=>{let i=await this._commonHeaders();i.set("Accept","text/event-stream");let a=await e(o,{...s,headers:i});if(a.status===401&&a.headers.has("www-authenticate")){let{resourceMetadataUrl:c,scope:u}=Or(a);this._resourceMetadataUrl=c,this._scope=u}return a}}),this._abortController=new AbortController,this._eventSource.onerror=o=>{if(o.code===401&&this._authProvider){this._authThenStart().then(r,n);return}let s=new cl(o.code,o.message,o);n(s),this.onerror?.(s)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",o=>{let s=o;try{if(this._endpoint=new URL(s.data,this._url),this._endpoint.origin!==this._url.origin)throw new Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(i){n(i),this.onerror?.(i),this.close();return}r()}),this._eventSource.onmessage=o=>{let s=o,i;try{i=yt.parse(JSON.parse(s.data))}catch(a){this.onerror?.(a);return}this.onmessage?.(i)}})}async start(){if(this._eventSource)throw new Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(e){if(!this._authProvider)throw new ke("No auth provider");if(await at(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(e){if(!this._endpoint)throw new Error("Not connected");try{let r=await this._commonHeaders();r.set("content-type","application/json");let n={...this._requestInit,method:"POST",headers:r,body:JSON.stringify(e),signal:this._abortController?.signal},o=await(this._fetch??fetch)(this._endpoint,n);if(!o.ok){let s=await o.text().catch(()=>null);if(o.status===401&&this._authProvider){let{resourceMetadataUrl:i,scope:a}=Or(o);if(this._resourceMetadataUrl=i,this._scope=a,await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke;return this.send(e)}throw new Error(`Error POSTing to endpoint (HTTP ${o.status}): ${s}`)}await o.body?.cancel()}catch(r){throw this.onerror?.(r),r}}setProtocolVersion(e){this._protocolVersion=e}};var Fh=io(Lh(),1);import _l from"process";import{PassThrough as _$}from"stream";var g$=10*1024*1024,Ns=class{constructor(e){this._maxBufferSize=e?.maxBufferSize??g$}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
250
250
|
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),y$(r)}clear(){this._buffer=void 0}};function y$(t){return yt.parse(JSON.parse(t))}function Uh(t){return JSON.stringify(t)+`
|
|
251
|
-
`}var w$=_l.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function v$(){let t={};for(let e of w$){let r=_l.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var qs=class{constructor(e){this._stderrStream=null,this._serverParams=e,this._readBuffer=new Ns({maxBufferSize:e.maxBufferSize}),(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new _$)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,Fh.default)(this._serverParams.command,this._serverParams.args??[],{env:{...v$(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:_l.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",n=>{r(n),this.onerror?.(n)}),this._process.on("spawn",()=>{e()}),this._process.on("close",n=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",n=>{this.onerror?.(n)}),this._process.stdout?.on("data",n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}}),this._process.stdout?.on("error",n=>{this.onerror?.(n)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let r=new Promise(n=>{e.once("close",()=>{n()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let n=Uh(e);this._process.stdin.write(n)?r():this._process.stdin.once("drain",r)})}};var Gh=io(Bh(),1);function Kh(t){if(t)try{return Gh.default.parse(t).type}catch{let e=(t.split(";",1)[0]??"").trim().toLowerCase();return e===""||t.slice(e.length).includes(",")?void 0:e}}var Ds=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Cs({onEvent:a=>{i.enqueue(a)},onError(a){typeof e=="function"&&e(a),(e==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var R$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Pt=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Ls=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Is(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??R$}async _authThenStart(){if(!this._authProvider)throw new ke("No auth provider");let e;try{e=await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new ke;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Ir(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Pt(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ds({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:g}=await l.read();if(g)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=yt.parse(JSON.parse(f.data));zt(h)&&(c=!0,s!==void 0&&(h.id=s)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new ke("No auth provider");if(await at(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Qr(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Pt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:g,scope:h}=Or(a);if(this._resourceMetadataUrl=g,this._scope=h,await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:g,scope:h,error:y}=Or(a);if(y==="insufficient_scope"){let v=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===v)throw new Pt(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),g&&(this._resourceMetadataUrl=g),this._lastUpscopingHeader=v??void 0,await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new ke;return this.send(e)}}throw new Pt(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Ed(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type"),m=Kh(d);if(l)if(m==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(m==="application/json"){let f=await a.json(),g=Array.isArray(f)?f.map(h=>yt.parse(h)):[yt.parse(f)];for(let h of g)this.onmessage?.(h)}else throw await a.body?.cancel(),new Pt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Pt(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};import{readFileSync as C$}from"fs";import Zh from"path";import{fileURLToPath as M$}from"url";var z$=A.object({version:A.string()});function A$(){return"0.0.7"}var Jh=A$();var I$=C({module:"mcp"});function Yh(t){return t.replace(/\$\{(\w+)\}|\$(\w+)/g,(e,r,n)=>process.env[r||n]??"")}function O$(t){let e={};for(let[r,n]of Object.entries(t))e[r]=n??"";return e}var Us=class{name;config;client=null;transport=null;constructor(e){this.name=e.name,this.config=e}async connect(){if(this.config.command){let e=process.env;if(this.config.env)for(let[r,n]of Object.entries(this.config.env))e[r]=Yh(n);this.transport=new qs({command:this.config.command,args:this.config.args??[],env:O$(e),stderr:"ignore"})}else if(this.config.url){let e=new URL(this.config.url),r={};if(this.config.headers)for(let[o,s]of Object.entries(this.config.headers))r[o]=Yh(s);let n={requestInit:{headers:r}};this.transport=this.config.transport==="sse"?new Os(e,n):new Ls(e,n)}else throw new Error(`MCP server '${this.name}': needs either 'command' (stdio) or 'url' (http/sse)`);this.client=new Rs({name:"swifty",version:Jh},{}),await this.client.connect(this.transport)}getInstructions(){return this.client?.getInstructions()??""}async listTools(){if(!this.client)throw new Error("Not connected");return(await this.client.listTools()).tools.map(({name:r,description:n,inputSchema:{properties:o,...s}})=>({name:r,description:n??"",inputSchema:{...s,properties:o??{}}}))}async callTool(e,r){if(!this.client)throw new Error("Not connected");let n=await this.client.callTool({name:e,arguments:r}),o;return n.content&&Array.isArray(n.content)?o=n.content.map(s=>s.type==="text"?s.text??"":JSON.stringify(s)).join(`
|
|
251
|
+
`}var w$=_l.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function v$(){let t={};for(let e of w$){let r=_l.env[e];r!==void 0&&(r.startsWith("()")||(t[e]=r))}return t}var qs=class{constructor(e){this._stderrStream=null,this._serverParams=e,this._readBuffer=new Ns({maxBufferSize:e.maxBufferSize}),(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new _$)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,r)=>{this._process=(0,Fh.default)(this._serverParams.command,this._serverParams.args??[],{env:{...v$(),...this._serverParams.env},stdio:["pipe","pipe",this._serverParams.stderr??"inherit"],shell:!1,windowsHide:_l.platform==="win32",cwd:this._serverParams.cwd}),this._process.on("error",n=>{r(n),this.onerror?.(n)}),this._process.on("spawn",()=>{e()}),this._process.on("close",n=>{this._process=void 0,this.onclose?.()}),this._process.stdin?.on("error",n=>{this.onerror?.(n)}),this._process.stdout?.on("data",n=>{try{this._readBuffer.append(n),this.processReadBuffer()}catch(o){this.onerror?.(o),this.close().catch(()=>{})}}),this._process.stdout?.on("error",n=>{this.onerror?.(n)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){return this._stderrStream?this._stderrStream:this._process?.stderr??null}get pid(){return this._process?.pid??null}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._process){let e=this._process;this._process=void 0;let r=new Promise(n=>{e.once("close",()=>{n()})});try{e.stdin?.end()}catch{}if(await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())]),e.exitCode===null){try{e.kill("SIGTERM")}catch{}await Promise.race([r,new Promise(n=>setTimeout(n,2e3).unref())])}if(e.exitCode===null)try{e.kill("SIGKILL")}catch{}}this._readBuffer.clear()}send(e){return new Promise(r=>{if(!this._process?.stdin)throw new Error("Not connected");let n=Uh(e);this._process.stdin.write(n)?r():this._process.stdin.once("drain",r)})}};var Gh=io(Bh(),1);function Kh(t){if(t)try{return Gh.default.parse(t).type}catch{let e=(t.split(";",1)[0]??"").trim().toLowerCase();return e===""||t.slice(e.length).includes(",")?void 0:e}}var Ds=class extends TransformStream{constructor({onError:e,onRetry:r,onComment:n,maxBufferSize:o}={}){let s;super({start(i){s=Cs({onEvent:a=>{i.enqueue(a)},onError(a){typeof e=="function"&&e(a),(e==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:r,onComment:n,maxBufferSize:o})},transform(i){s.feed(i)}})}};var R$={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},Pt=class extends Error{constructor(e,r){super(`Streamable HTTP error: ${r}`),this.code=e}},Ls=class{constructor(e,r){this._hasCompletedAuthFlow=!1,this._url=e,this._resourceMetadataUrl=void 0,this._scope=void 0,this._requestInit=r?.requestInit,this._authProvider=r?.authProvider,this._fetch=r?.fetch,this._fetchWithInit=Is(r?.fetch,r?.requestInit),this._sessionId=r?.sessionId,this._reconnectionOptions=r?.reconnectionOptions??R$}async _authThenStart(){if(!this._authProvider)throw new ke("No auth provider");let e;try{e=await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(r){throw this.onerror?.(r),r}if(e!=="AUTHORIZED")throw new ke;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){let e={};if(this._authProvider){let n=await this._authProvider.tokens();n&&(e.Authorization=`Bearer ${n.access_token}`)}this._sessionId&&(e["mcp-session-id"]=this._sessionId),this._protocolVersion&&(e["mcp-protocol-version"]=this._protocolVersion);let r=Ir(this._requestInit?.headers);return new Headers({...e,...r})}async _startOrAuthSse(e){let{resumptionToken:r}=e;try{let n=await this._commonHeaders();n.set("Accept","text/event-stream"),r&&n.set("last-event-id",r);let o=await(this._fetch??fetch)(this._url,{method:"GET",headers:n,signal:this._abortController?.signal});if(!o.ok){if(await o.body?.cancel(),o.status===401&&this._authProvider)return await this._authThenStart();if(o.status===405)return;throw new Pt(o.status,`Failed to open SSE stream: ${o.statusText}`)}this._handleSseStream(o.body,e,!0)}catch(n){throw this.onerror?.(n),n}}_getNextReconnectionDelay(e){if(this._serverRetryMs!==void 0)return this._serverRetryMs;let r=this._reconnectionOptions.initialReconnectionDelay,n=this._reconnectionOptions.reconnectionDelayGrowFactor,o=this._reconnectionOptions.maxReconnectionDelay;return Math.min(r*Math.pow(n,e),o)}_scheduleReconnection(e,r=0){let n=this._reconnectionOptions.maxRetries;if(r>=n){this.onerror?.(new Error(`Maximum reconnection attempts (${n}) exceeded.`));return}let o=this._getNextReconnectionDelay(r);this._reconnectionTimeout=setTimeout(()=>{this._startOrAuthSse(e).catch(s=>{this.onerror?.(new Error(`Failed to reconnect SSE stream: ${s instanceof Error?s.message:String(s)}`)),this._scheduleReconnection(e,r+1)})},o)}_handleSseStream(e,r,n){if(!e)return;let{onresumptiontoken:o,replayMessageId:s}=r,i,a=!1,c=!1;(async()=>{try{let l=e.pipeThrough(new TextDecoderStream).pipeThrough(new Ds({onRetry:f=>{this._serverRetryMs=f}})).getReader();for(;;){let{value:f,done:g}=await l.read();if(g)break;if(f.id&&(i=f.id,a=!0,o?.(f.id)),!!f.data&&(!f.event||f.event==="message"))try{let h=yt.parse(JSON.parse(f.data));zt(h)&&(c=!0,s!==void 0&&(h.id=s)),this.onmessage?.(h)}catch(h){this.onerror?.(h)}}(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted&&this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(l){if(this.onerror?.(new Error(`SSE stream disconnected: ${l}`)),(n||a)&&!c&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:i,onresumptiontoken:o,replayMessageId:s},0)}catch(f){this.onerror?.(new Error(`Failed to reconnect: ${f instanceof Error?f.message:String(f)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new ke("No auth provider");if(await at(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke("Failed to authorize")}async close(){this._reconnectionTimeout&&(clearTimeout(this._reconnectionTimeout),this._reconnectionTimeout=void 0),this._abortController?.abort(),this.onclose?.()}async send(e,r){try{let{resumptionToken:n,onresumptiontoken:o}=r||{};if(n){this._startOrAuthSse({resumptionToken:n,replayMessageId:Qr(e)?e.id:void 0}).catch(f=>this.onerror?.(f));return}let s=await this._commonHeaders();s.set("content-type","application/json"),s.set("accept","application/json, text/event-stream");let i={...this._requestInit,method:"POST",headers:s,body:JSON.stringify(e),signal:this._abortController?.signal},a=await(this._fetch??fetch)(this._url,i),c=a.headers.get("mcp-session-id");if(c&&(this._sessionId=c),!a.ok){let f=await a.text().catch(()=>null);if(a.status===401&&this._authProvider){if(this._hasCompletedAuthFlow)throw new Pt(401,"Server returned 401 after successful authentication");let{resourceMetadataUrl:g,scope:h}=Or(a);if(this._resourceMetadataUrl=g,this._scope=h,await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new ke;return this._hasCompletedAuthFlow=!0,this.send(e)}if(a.status===403&&this._authProvider){let{resourceMetadataUrl:g,scope:h,error:y}=Or(a);if(y==="insufficient_scope"){let v=a.headers.get("WWW-Authenticate");if(this._lastUpscopingHeader===v)throw new Pt(403,"Server returned 403 after trying upscoping");if(h&&(this._scope=h),g&&(this._resourceMetadataUrl=g),this._lastUpscopingHeader=v??void 0,await at(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetch})!=="AUTHORIZED")throw new ke;return this.send(e)}}throw new Pt(a.status,`Error POSTing to endpoint: ${f}`)}if(this._hasCompletedAuthFlow=!1,this._lastUpscopingHeader=void 0,a.status===202){await a.body?.cancel(),Ed(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(f=>this.onerror?.(f));return}let l=(Array.isArray(e)?e:[e]).filter(f=>"method"in f&&"id"in f&&f.id!==void 0).length>0,d=a.headers.get("content-type"),m=Kh(d);if(l)if(m==="text/event-stream")this._handleSseStream(a.body,{onresumptiontoken:o},!1);else if(m==="application/json"){let f=await a.json(),g=Array.isArray(f)?f.map(h=>yt.parse(h)):[yt.parse(f)];for(let h of g)this.onmessage?.(h)}else throw await a.body?.cancel(),new Pt(-1,`Unexpected content type: ${d}`);else await a.body?.cancel()}catch(n){throw this.onerror?.(n),n}}get sessionId(){return this._sessionId}async terminateSession(){if(this._sessionId)try{let e=await this._commonHeaders(),r={...this._requestInit,method:"DELETE",headers:e,signal:this._abortController?.signal},n=await(this._fetch??fetch)(this._url,r);if(await n.body?.cancel(),!n.ok&&n.status!==405)throw new Pt(n.status,`Failed to terminate session: ${n.statusText}`);this._sessionId=void 0}catch(e){throw this.onerror?.(e),e}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}async resumeStream(e,r){await this._startOrAuthSse({resumptionToken:e,onresumptiontoken:r?.onresumptiontoken})}};import{readFileSync as C$}from"fs";import Zh from"path";import{fileURLToPath as M$}from"url";var z$=A.object({version:A.string()});function A$(){return"0.0.8"}var Jh=A$();var I$=C({module:"mcp"});function Yh(t){return t.replace(/\$\{(\w+)\}|\$(\w+)/g,(e,r,n)=>process.env[r||n]??"")}function O$(t){let e={};for(let[r,n]of Object.entries(t))e[r]=n??"";return e}var Us=class{name;config;client=null;transport=null;constructor(e){this.name=e.name,this.config=e}async connect(){if(this.config.command){let e=process.env;if(this.config.env)for(let[r,n]of Object.entries(this.config.env))e[r]=Yh(n);this.transport=new qs({command:this.config.command,args:this.config.args??[],env:O$(e),stderr:"ignore"})}else if(this.config.url){let e=new URL(this.config.url),r={};if(this.config.headers)for(let[o,s]of Object.entries(this.config.headers))r[o]=Yh(s);let n={requestInit:{headers:r}};this.transport=this.config.transport==="sse"?new Os(e,n):new Ls(e,n)}else throw new Error(`MCP server '${this.name}': needs either 'command' (stdio) or 'url' (http/sse)`);this.client=new Rs({name:"swifty",version:Jh},{}),await this.client.connect(this.transport)}getInstructions(){return this.client?.getInstructions()??""}async listTools(){if(!this.client)throw new Error("Not connected");return(await this.client.listTools()).tools.map(({name:r,description:n,inputSchema:{properties:o,...s}})=>({name:r,description:n??"",inputSchema:{...s,properties:o??{}}}))}async callTool(e,r){if(!this.client)throw new Error("Not connected");let n=await this.client.callTool({name:e,arguments:r}),o;return n.content&&Array.isArray(n.content)?o=n.content.map(s=>s.type==="text"?s.text??"":JSON.stringify(s)).join(`
|
|
252
252
|
`):o=JSON.stringify(n),{output:o,isError:n.isError===!0}}async disconnect(){try{await this.client?.close()}catch(e){I$.error({err:e},"mcp operation failed")}this.client=null,this.transport=null}};var j$=C({module:"mcp"}),Xh=class{clients=new Map;async connectAll(e){let r={tools:[],servers:[],errors:[],instructions:[]};for(let n of e){let o=new Us(n);try{await o.connect(),this.clients.set(n.name,o),r.servers.push(n.name);let s=await o.listTools();for(let a of s)r.tools.push({serverName:n.name,tool:a});let i=o.getInstructions();i&&r.instructions.push({serverName:n.name,text:i})}catch(s){j$.error({err:s},"mcp operation failed"),r.errors.push({serverName:n.name,error:N(s)})}}return r}getClient(e){return this.clients.get(e)}async disconnectAll(){for(let e of this.clients.values())await e.disconnect();this.clients.clear()}};var N$=C({module:"mcp"});function q$(t,e){let r=n=>n.replace(/[^a-zA-Z0-9_-]/g,"_");return`mcp__${r(t)}__${r(e)}`}var Qh=class{name;description;category="command";deferred=!0;client;originalName;inputSchema;constructor(e,r,n){this.name=q$(r,n.name),this.description=n.description,this.originalName=n.name,this.client=e,this.inputSchema=n.inputSchema}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(e,r){try{let{output:n,isError:o}=await this.client.callTool(this.originalName,r);return{output:n,isError:o}}catch(n){return N$.error({err:n},"mcp operation failed"),{output:`MCP tool error: ${N(n)}`,isError:!0}}}};import{readdirSync as D$,readFileSync as tg,existsSync as rg,statSync as qr}from"fs";import{homedir as eo}from"os";import{join as Ie}from"path";function eg(){return[]}var to=C({module:"skills"}),ng=class{entries=new Map;workDir="";dirModTimes=new Map;load(e){this.workDir=e;for(let n of eg())this.entries.set(n.meta.name,{skill:n,filePath:"",loadedMtimeMs:0});let r=[Ie(eo(),".trae","skills"),Ie(eo(),".claude","skills"),Ie(eo(),".github","skills"),Ie(eo(),".swifty","skills"),Ie(e,".trae","skills"),Ie(e,".claude","skills"),Ie(e,".github","skills"),Ie(e,".swifty","skills")];for(let n of r)rg(n)&&this.scanDirectory(n);this.snapshotDirModTimes()}needsReload(){for(let[r,n]of this.dirModTimes)try{if(qr(r).mtimeMs!==n)return!0}catch{if(n!==0)return!0}let e=this.skillDirPaths();for(let r of e)if(!this.dirModTimes.has(r))try{return qr(r),!0}catch{}return!1}reload(){this.entries.clear(),this.load(this.workDir)}snapshotDirModTimes(){this.dirModTimes.clear();for(let e of this.skillDirPaths())try{this.dirModTimes.set(e,qr(e).mtimeMs)}catch{this.dirModTimes.set(e,0)}}skillDirPaths(){return[Ie(eo(),".swifty","skills"),...this.workDir?[Ie(this.workDir,".swifty","skills")]:[]]}scanDirectory(e){let r;try{r=D$(e)}catch(n){to.error({err:n},"skills operation failed");return}for(let n of r){let o=Ie(e,n);if(qr(o).isDirectory()){let i=Ie(o,"SKILL.md");rg(i)&&this.loadSkill(i,o,!0)}}}loadSkill(e,r,n){try{let o=tg(e,"utf-8"),s=og(o);if(!s)return;let i={meta:s.meta,body:s.body,sourceDir:r,isDirectory:n},a=0;try{a=qr(e).mtimeMs}catch(c){to.error({err:c},"skills operation failed")}this.entries.set(i.meta.name,{skill:i,filePath:e,loadedMtimeMs:a})}catch(o){to.error({err:o},"skills operation failed")}}list(){return[...this.entries.values()].map(e=>e.skill.meta)}get(e){let r=this.entries.get(e);if(r){if(r.filePath&&r.loadedMtimeMs>0)try{let n=qr(r.filePath).mtimeMs;if(n>r.loadedMtimeMs){let o=tg(r.filePath,"utf-8"),s=og(o);s&&(r.skill={meta:s.meta,body:s.body,sourceDir:r.skill.sourceDir,isDirectory:r.skill.isDirectory},r.loadedMtimeMs=n)}}catch(n){to.error({err:n},"skills operation failed")}return r.skill}}has(e){return this.entries.has(e)}};function L$(t){let e=E(ri(t),"mode");return e==="inline"||e==="fork"?e:E(ri(t),"context")==="fork"?"fork":"inline"}var U$=A.looseObject({name:A.string(),description:A.string().optional(),allowed_tools:A.array(A.string()).optional(),mode:A.enum(["inline","fork"]).optional(),model:A.string().optional(),fork_context:A.enum(["full","none","recent"]).optional()});function og(t){if(!t.startsWith("---"))return null;let e=t.indexOf("---",3);if(e===-1)return null;let r=t.slice(3,e).trim(),n=t.slice(e+3).trim();try{let o=ft.load(r),s=xe(U$,o);return{meta:{name:s.name,description:s.description??"",mode:L$(o),model:s.model,forkContext:s.fork_context},body:n}}catch(o){return to.error({err:o},"skills operation failed"),null}}function Zj(t,e){let r=t.list();if(r.length===0)return"";let o=[`## Available Skills
|
|
253
253
|
`,`Skills are installed at: ${Ie(e,".swifty","skills")}`,`When creating new skills, always place them under this directory as <skill-name>/SKILL.md.
|
|
254
254
|
`,`Only Skill names and one-line descriptions are listed below. To activate a Skill on demand call the LoadSkill tool with {name: "<skill-name>"}. After activation the Skill's full SOP gets pinned to the environment context, and any tools the Skill declares get registered. Users can also invoke a Skill directly with /<name>.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
+
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
+
import{a as x}from"./chunk-7MHXMDYC.js";import{C as o,I as S,b as u,c as m}from"./chunk-ISXLT3QN.js";import{existsSync as E,readFileSync as $}from"fs";import{homedir as I}from"os";import{join as l}from"path";function p(e){return!!e._zod}function c(e,n){return p(e)?u(e,n):e.safeParse(n)}async function ee(e,n){return p(e)?await m(e,n):await e.safeParseAsync(n)}function oe(e){if(!e)return;let n;if(p(e)?n=e._zod?.def?.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function ne(e){if(p(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(r!==void 0)return r}var g=S({module:"config"}),A={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"};function N(e){return _.has(e)}var _=new Set(Object.keys(A)),d=class extends Error{constructor(n){super(n),this.name="ConfigError"}},P=o.object({name:o.string(),protocol:o.enum(["anthropic","openai","openai-compat"]),base_url:o.string(),model:o.string(),api_key:o.string().optional(),thinking:o.boolean().optional(),context_window:o.coerce.number().optional(),max_output_tokens:o.coerce.number().optional()}),V=[["1m",1e6],["gpt-4.1",1e6],["gpt-4o",128e3],["gpt-4-turbo",128e3],["o1",2e5],["o3",2e5],["o4",2e5],["gpt-3.5",16385],["claude",2e5]];function j(e){let n=e.toLowerCase();for(let[t,r]of V)if(n.includes(t))return r;return n.includes("claude")?2e5:128e3}function de(e){return e.context_window&&e.context_window>0?e.context_window:j(e.model)}var w=new Map;async function pe(e,n){if(e.context_window&&e.context_window>0)return e.context_window;if(e.protocol==="anthropic"){let t=`${e.name}-${e.model}`,r=w.get(t);if(r===void 0){try{r=await(n??(await import("./anthropic-GAI75HYJ.js")).fetchModelContextWindow)(e)}catch(i){g.error({err:i},"config operation failed"),r=0}w.set(t,r)}if(r&&r>0)return r}return j(e.model)}function ue(e){return e.max_output_tokens&&e.max_output_tokens>0?e.max_output_tokens:e.thinking?64e3:8192}function me(e){if(e.api_key)return e.api_key;let n=N(e.protocol)?A[e.protocol]:"";return n?process.env[n]??"":""}var O=o.object({name:o.string(),command:o.string().optional(),args:o.array(o.string()).optional(),url:o.string().optional(),transport:o.string().optional(),headers:o.record(o.string(),o.string()).optional(),env:o.record(o.string(),o.string()).optional()}),z=o.object({id:o.string().optional(),event:o.string(),condition:o.string().optional(),action:o.object({type:o.string(),command:o.string().optional(),url:o.string().optional(),method:o.string().optional(),prompt:o.string().optional()}),reject:o.boolean().optional(),once:o.boolean().optional(),async:o.boolean().optional(),on_error:o.string().optional()}),M=o.object({enabled:o.boolean().optional(),auto_allow:o.boolean().optional(),network_enabled:o.boolean().optional()}),T=o.looseObject({providers:o.array(P),permission_mode:o.string().optional(),mcp_servers:o.array(O).default([]),hooks:o.array(z).default([]),sandbox:M.optional(),enable_coordinator_mode:o.boolean().optional(),enable_fork:o.boolean().optional()});function ge(e){return e.enable_fork!==!1}function Y(e){return typeof e=="object"&&e!==null}function C(e){let n=$(e,"utf-8"),t=x.load(n);if(!Y(t))return g.error({path:e},"invalid yaml"),{providers:[],mcp_servers:[],hooks:[]};let r=c(T,t);if(r.success){let a=r.data;return{providers:a.providers,permission_mode:a.permission_mode,mcp_servers:a.mcp_servers,hooks:a.hooks}}g.error({error:r.error},"config error");let i=[],s,f=[],y=[],v,b=!1,h=!0;if("providers"in t){let a=c(o.array(P),t.providers);a.success&&(i=a.data)}if("permission_mode"in t&&typeof t.permission_mode=="string"&&(s=t.permission_mode),"mcp_servers"in t){let a=c(o.array(O),t.mcp_servers);a.success&&(f=a.data)}if("hooks"in t){let a=c(o.array(z),t.hooks);a.success&&(y=a.data)}if("sandbox"in t){let a=c(M,t.sandbox);a.success&&(v=a.data)}return"enable_coordinator_mode"in t&&(b=!!t.enable_coordinator_mode),"enable_fork"in t&&(h=!!t.enable_fork),{providers:i,permission_mode:s,mcp_servers:f,hooks:y,sandbox:v,enable_coordinator_mode:b,enable_fork:h}}function K(e,n){if(n.providers.length>0&&(e.providers=n.providers),n.permission_mode&&(e.permission_mode=n.permission_mode),n.mcp_servers.length>0){let t=new Map;for(let r=0;r<e.mcp_servers.length;r++){let i=e.mcp_servers[r];t.set(i.name,r)}for(let r of n.mcp_servers){let i=t.get(r.name);i!==void 0?e.mcp_servers[i]=r:(e.mcp_servers.push(r),t.set(r.name,e.mcp_servers.length-1))}}return e.hooks=[...e.hooks,...n.hooks],n.sandbox&&(e.sandbox={...e.sandbox,...n.sandbox}),n.enable_coordinator_mode&&(e.enable_coordinator_mode=!0),n.enable_fork!==void 0&&(e.enable_fork=n.enable_fork),e}function k(e){if(e.providers.length===0)throw new d("At least one provider MUST be configured.");let n=["name","protocol","base_url","model"];for(let t=0;t<e.providers.length;t++){let r=e.providers[t],i={name:r.name,protocol:r.protocol,base_url:r.base_url,model:r.model},s=n.filter(f=>!(f in i));if(s.length>0)throw new d(`Provider #${String(t+1)}: missing fields: ${s.join(", ")}`);if(!_.has(r.protocol))throw new d(`Provider #${String(t+1)}: invalid protocol '${r.protocol}', MUST be one of: ${Array.from(_).join(", ")}`)}}function _e(e){if(e){let s=C(e);return k(s),s}let n=process.cwd(),t=I(),r=[l(t,".swifty","config.yml"),l(t,".swifty","config.yaml"),l(n,".swifty","config.yml"),l(n,".swifty","config.yaml"),l(n,".swifty","config.local.yml"),l(n,".swifty","config.local.yaml")],i=null;for(let s of r){if(!E(s))continue;let f=C(s);i?i=K(i,f):i=f}if(!i)throw new d("No config file found, expected .swifty/config.y(a)ml under project or $HOME/.swifty/config.y(a)ml.");return k(i),i}export{c as a,ee as b,oe as c,ne as d,de as e,pe as f,ue as g,me as h,ge as i,_e as j};
|
package/dist/glob_addon.node
CHANGED
|
Binary file
|
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
3
|
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{$ as _0,A as Mg,B as xg,C as Lg,D as Qg,E as Ug,F as A0,G as Bv,H as Pg,I as Fg,J as Gg,K as zg,L as wv,M as kv,O as cC,P as uC,Q as dC,R as AC,S as Mv,T as xv,U as Lv,V as _C,W as pC,X as gC,Y as Qv,Z as Uv,_ as Pv,a as Ng,aa as Fv,b as Og,ba as Gv,c as vg,ca as kE,d as Cv,da as zv,e as yv,ea as p0,f as Tv,fa as mC,g as Iv,ga as Hv,h as nC,ha as Yv,i as bv,ia as qv,j as Bg,ja as Kv,k as Rv,ka as Vv,l as rC,la as Wv,m as wE,ma as Jv,n as iC,p as cd,q as oC,r as sC,s as lC,t as Nv,u as Dv,v as d0,w as Ov,x as JA,y as kg,z as vv}from"./chunk-N5AVRITT.js";import{a as wg}from"./chunk-UBV5T4TV.js";import{c as NE}from"./chunk-XBHVVB5A.js";import{a as gv,b as mv,d as BE,e as fv,f as Ev,g as hv,h as aC,i as Sv,j as Rg}from"./chunk-A6H62GTA.js";import{a as ld,b as cv,f as Ig,g as c0,h as u0,i as uv,j as dv,k as Av,o as _v}from"./chunk-OXEMDMZF.js";import{e as OE,f as pv,g as tC,i as vE,j as bg}from"./chunk-GS6BRESU.js";import"./chunk-FZPTNGTU.js";import{e as Dg}from"./chunk-ZSJ2I5WM.js";import"./chunk-7MHXMDYC.js";import{C as _r,E as ov,F as DE,G as $S,H as eC,I as si,K as sv,L as lv,N as zi,R as ws,e as rv,f as iv}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import{a as WA,b as L,c as G7,d as Ke}from"./chunk-X3UA5OZL.js";var oB=L(ra=>{"use strict";var f0=Symbol.for("react.transitional.element"),z7=Symbol.for("react.portal"),H7=Symbol.for("react.fragment"),Y7=Symbol.for("react.strict_mode"),q7=Symbol.for("react.profiler"),K7=Symbol.for("react.consumer"),V7=Symbol.for("react.context"),W7=Symbol.for("react.forward_ref"),J7=Symbol.for("react.suspense"),X7=Symbol.for("react.memo"),eB=Symbol.for("react.lazy"),j7=Symbol.for("react.activity"),Xv=Symbol.iterator;function Z7(e){return e===null||typeof e!="object"?null:(e=Xv&&e[Xv]||e["@@iterator"],typeof e=="function"?e:null)}var tB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aB=Object.assign,nB={};function Yg(e,t,a){this.props=e,this.context=t,this.refs=nB,this.updater=a||tB}Yg.prototype.isReactComponent={};Yg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Yg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rB(){}rB.prototype=Yg.prototype;function E0(e,t,a){this.props=e,this.context=t,this.refs=nB,this.updater=a||tB}var h0=E0.prototype=new rB;h0.constructor=E0;aB(h0,Yg.prototype);h0.isPureReactComponent=!0;var jv=Array.isArray;function m0(){}var xn={H:null,A:null,T:null,S:null},iB=Object.prototype.hasOwnProperty;function S0(e,t,a){var i=a.ref;return{$$typeof:f0,type:e,key:t,ref:i!==void 0?i:null,props:a}}function $7(e,t){return S0(e.type,t,e.props)}function C0(e){return typeof e=="object"&&e!==null&&e.$$typeof===f0}function ez(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var Zv=/\/+/g;function g0(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ez(""+e.key):t.toString(36)}function tz(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(m0,m0):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Hg(e,t,a,i,l){var u=typeof e;(u==="undefined"||u==="boolean")&&(e=null);var _=!1;if(e===null)_=!0;else switch(u){case"bigint":case"string":case"number":_=!0;break;case"object":switch(e.$$typeof){case f0:case z7:_=!0;break;case eB:return _=e._init,Hg(_(e._payload),t,a,i,l)}}if(_)return l=l(e),_=i===""?"."+g0(e,0):i,jv(l)?(a="",_!=null&&(a=_.replace(Zv,"$&/")+"/"),Hg(l,t,a,"",function(S){return S})):l!=null&&(C0(l)&&(l=$7(l,a+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(Zv,"$&/")+"/")+_)),t.push(l)),1;_=0;var p=i===""?".":i+":";if(jv(e))for(var E=0;E<e.length;E++)i=e[E],u=p+g0(i,E),_+=Hg(i,t,a,u,l);else if(E=Z7(e),typeof E=="function")for(e=E.call(e),E=0;!(i=e.next()).done;)i=i.value,u=p+g0(i,E++),_+=Hg(i,t,a,u,l);else if(u==="object"){if(typeof e.then=="function")return Hg(tz(e),t,a,i,l);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return _}function fC(e,t,a){if(e==null)return e;var i=[],l=0;return Hg(e,i,"","",function(u){return t.call(a,u,l++)}),i}function az(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var $v=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},nz={map:fC,forEach:function(e,t,a){fC(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return fC(e,function(){t++}),t},toArray:function(e){return fC(e,function(t){return t})||[]},only:function(e){if(!C0(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ra.Activity=j7;ra.Children=nz;ra.Component=Yg;ra.Fragment=H7;ra.Profiler=q7;ra.PureComponent=E0;ra.StrictMode=Y7;ra.Suspense=J7;ra.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=xn;ra.__COMPILER_RUNTIME={__proto__:null,c:function(e){return xn.H.useMemoCache(e)}};ra.cache=function(e){return function(){return e.apply(null,arguments)}};ra.cacheSignal=function(){return null};ra.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var i=aB({},e.props),l=e.key;if(t!=null)for(u in t.key!==void 0&&(l=""+t.key),t)!iB.call(t,u)||u==="key"||u==="__self"||u==="__source"||u==="ref"&&t.ref===void 0||(i[u]=t[u]);var u=arguments.length-2;if(u===1)i.children=a;else if(1<u){for(var _=Array(u),p=0;p<u;p++)_[p]=arguments[p+2];i.children=_}return S0(e.type,l,i)};ra.createContext=function(e){return e={$$typeof:V7,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:K7,_context:e},e};ra.createElement=function(e,t,a){var i,l={},u=null;if(t!=null)for(i in t.key!==void 0&&(u=""+t.key),t)iB.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(l[i]=t[i]);var _=arguments.length-2;if(_===1)l.children=a;else if(1<_){for(var p=Array(_),E=0;E<_;E++)p[E]=arguments[E+2];l.children=p}if(e&&e.defaultProps)for(i in _=e.defaultProps,_)l[i]===void 0&&(l[i]=_[i]);return S0(e,u,l)};ra.createRef=function(){return{current:null}};ra.forwardRef=function(e){return{$$typeof:W7,render:e}};ra.isValidElement=C0;ra.lazy=function(e){return{$$typeof:eB,_payload:{_status:-1,_result:e},_init:az}};ra.memo=function(e,t){return{$$typeof:X7,type:e,compare:t===void 0?null:t}};ra.startTransition=function(e){var t=xn.T,a={};xn.T=a;try{var i=e(),l=xn.S;l!==null&&l(a,i),typeof i=="object"&&i!==null&&typeof i.then=="function"&&i.then(m0,$v)}catch(u){$v(u)}finally{t!==null&&a.types!==null&&(t.types=a.types),xn.T=t}};ra.unstable_useCacheRefresh=function(){return xn.H.useCacheRefresh()};ra.use=function(e){return xn.H.use(e)};ra.useActionState=function(e,t,a){return xn.H.useActionState(e,t,a)};ra.useCallback=function(e,t){return xn.H.useCallback(e,t)};ra.useContext=function(e){return xn.H.useContext(e)};ra.useDebugValue=function(){};ra.useDeferredValue=function(e,t){return xn.H.useDeferredValue(e,t)};ra.useEffect=function(e,t){return xn.H.useEffect(e,t)};ra.useEffectEvent=function(e){return xn.H.useEffectEvent(e)};ra.useId=function(){return xn.H.useId()};ra.useImperativeHandle=function(e,t,a){return xn.H.useImperativeHandle(e,t,a)};ra.useInsertionEffect=function(e,t){return xn.H.useInsertionEffect(e,t)};ra.useLayoutEffect=function(e,t){return xn.H.useLayoutEffect(e,t)};ra.useMemo=function(e,t){return xn.H.useMemo(e,t)};ra.useOptimistic=function(e,t){return xn.H.useOptimistic(e,t)};ra.useReducer=function(e,t,a){return xn.H.useReducer(e,t,a)};ra.useRef=function(e){return xn.H.useRef(e)};ra.useState=function(e){return xn.H.useState(e)};ra.useSyncExternalStore=function(e,t,a){return xn.H.useSyncExternalStore(e,t,a)};ra.useTransition=function(){return xn.H.useTransition()};ra.version="19.2.7"});var sB=L((Zt,EC)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function e(B,j){Object.defineProperty(i.prototype,B,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",j[0],j[1])}})}function t(B){return B===null||typeof B!="object"?null:(B=Ze&&B[Ze]||B["@@iterator"],typeof B=="function"?B:null)}function a(B,j){B=(B=B.constructor)&&(B.displayName||B.name)||"ReactClass";var Ce=B+"."+j;Rt[Ce]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",j,B),Rt[Ce]=!0)}function i(B,j,Ce){this.props=B,this.context=j,this.refs=yt,this.updater=Ce||Xt}function l(){}function u(B,j,Ce){this.props=B,this.context=j,this.refs=yt,this.updater=Ce||Xt}function _(){}function p(B){return""+B}function E(B){try{p(B);var j=!1}catch{j=!0}if(j){j=console;var Ce=j.error,Ue=typeof Symbol=="function"&&Symbol.toStringTag&&B[Symbol.toStringTag]||B.constructor.name||"Object";return Ce.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Ue),p(B)}}function S(B){if(B==null)return null;if(typeof B=="function")return B.$$typeof===za?null:B.displayName||B.name||null;if(typeof B=="string")return B;switch(B){case Me:return"Fragment";case se:return"Profiler";case ze:return"StrictMode";case Se:return"Suspense";case Fe:return"SuspenseList";case Je:return"Activity"}if(typeof B=="object")switch(typeof B.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),B.$$typeof){case at:return"Portal";case te:return B.displayName||"Context";case Pe:return(B._context.displayName||"Context")+".Consumer";case ae:var j=B.render;return B=B.displayName,B||(B=j.displayName||j.name||"",B=B!==""?"ForwardRef("+B+")":"ForwardRef"),B;case _e:return j=B.displayName||null,j!==null?j:S(B.type)||"Memo";case bt:j=B._payload,B=B._init;try{return S(B(j))}catch{}}return null}function T(B){if(B===Me)return"<>";if(typeof B=="object"&&B!==null&&B.$$typeof===bt)return"<...>";try{var j=S(B);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function D(){var B=St.A;return B===null?null:B.getOwner()}function b(){return Error("react-stack-top-frame")}function N(B){if(Sa.call(B,"key")){var j=Object.getOwnPropertyDescriptor(B,"key").get;if(j&&j.isReactWarning)return!1}return B.key!==void 0}function O(B,j){function Ce(){wa||(wa=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}Ce.isReactWarning=!0,Object.defineProperty(B,"key",{get:Ce,configurable:!0})}function x(){var B=S(this.type);return Cn[B]||(Cn[B]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),B=this.props.ref,B!==void 0?B:null}function M(B,j,Ce,Ue,ut,vt){var Nt=Ce.ref;return B={$$typeof:At,type:B,key:j,props:Ce,_owner:Ue},(Nt!==void 0?Nt:null)!==null?Object.defineProperty(B,"ref",{enumerable:!1,get:x}):Object.defineProperty(B,"ref",{enumerable:!1,value:null}),B._store={},Object.defineProperty(B._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(B,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(B,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.defineProperty(B,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:vt}),Object.freeze&&(Object.freeze(B.props),Object.freeze(B)),B}function F(B,j){return j=M(B.type,j,B.props,B._owner,B._debugStack,B._debugTask),B._store&&(j._store.validated=B._store.validated),j}function Z(B){ne(B)?B._store&&(B._store.validated=1):typeof B=="object"&&B!==null&&B.$$typeof===bt&&(B._payload.status==="fulfilled"?ne(B._payload.value)&&B._payload.value._store&&(B._payload.value._store.validated=1):B._store&&(B._store.validated=1))}function ne(B){return typeof B=="object"&&B!==null&&B.$$typeof===At}function ie(B){var j={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Ce){return j[Ce]})}function De(B,j){return typeof B=="object"&&B!==null&&B.key!=null?(E(B.key),ie(""+B.key)):j.toString(36)}function ve(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(_,_):(B.status="pending",B.then(function(j){B.status==="pending"&&(B.status="fulfilled",B.value=j)},function(j){B.status==="pending"&&(B.status="rejected",B.reason=j)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function nt(B,j,Ce,Ue,ut){var vt=typeof B;(vt==="undefined"||vt==="boolean")&&(B=null);var Nt=!1;if(B===null)Nt=!0;else switch(vt){case"bigint":case"string":case"number":Nt=!0;break;case"object":switch(B.$$typeof){case At:case at:Nt=!0;break;case bt:return Nt=B._init,nt(Nt(B._payload),j,Ce,Ue,ut)}}if(Nt){Nt=B,ut=ut(Nt);var $t=Ue===""?"."+De(Nt,0):Ue;return ha(ut)?(Ce="",$t!=null&&(Ce=$t.replace(Bn,"$&/")+"/"),nt(ut,j,Ce,"",function(ln){return ln})):ut!=null&&(ne(ut)&&(ut.key!=null&&(Nt&&Nt.key===ut.key||E(ut.key)),Ce=F(ut,Ce+(ut.key==null||Nt&&Nt.key===ut.key?"":(""+ut.key).replace(Bn,"$&/")+"/")+$t),Ue!==""&&Nt!=null&&ne(Nt)&&Nt.key==null&&Nt._store&&!Nt._store.validated&&(Ce._store.validated=2),ut=Ce),j.push(ut)),1}if(Nt=0,$t=Ue===""?".":Ue+":",ha(B))for(var Gt=0;Gt<B.length;Gt++)Ue=B[Gt],vt=$t+De(Ue,Gt),Nt+=nt(Ue,j,Ce,vt,ut);else if(Gt=t(B),typeof Gt=="function")for(Gt===B.entries&&(gn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),gn=!0),B=Gt.call(B),Gt=0;!(Ue=B.next()).done;)Ue=Ue.value,vt=$t+De(Ue,Gt++),Nt+=nt(Ue,j,Ce,vt,ut);else if(vt==="object"){if(typeof B.then=="function")return nt(ve(B),j,Ce,Ue,ut);throw j=String(B),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return Nt}function ke(B,j,Ce){if(B==null)return B;var Ue=[],ut=0;return nt(B,Ue,"","",function(vt){return j.call(Ce,vt,ut++)}),Ue}function le(B){if(B._status===-1){var j=B._ioInfo;j!=null&&(j.start=j.end=performance.now()),j=B._result;var Ce=j();if(Ce.then(function(ut){if(B._status===0||B._status===-1){B._status=1,B._result=ut;var vt=B._ioInfo;vt!=null&&(vt.end=performance.now()),Ce.status===void 0&&(Ce.status="fulfilled",Ce.value=ut)}},function(ut){if(B._status===0||B._status===-1){B._status=2,B._result=ut;var vt=B._ioInfo;vt!=null&&(vt.end=performance.now()),Ce.status===void 0&&(Ce.status="rejected",Ce.reason=ut)}}),j=B._ioInfo,j!=null){j.value=Ce;var Ue=Ce.displayName;typeof Ue=="string"&&(j.name=Ue)}B._status===-1&&(B._status=0,B._result=Ce)}if(B._status===1)return j=B._result,j===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
4
|
+
import{$ as _0,A as Mg,B as xg,C as Lg,D as Qg,E as Ug,F as A0,G as Bv,H as Pg,I as Fg,J as Gg,K as zg,L as wv,M as kv,O as cC,P as uC,Q as dC,R as AC,S as Mv,T as xv,U as Lv,V as _C,W as pC,X as gC,Y as Qv,Z as Uv,_ as Pv,a as Ng,aa as Fv,b as Og,ba as Gv,c as vg,ca as kE,d as Cv,da as zv,e as yv,ea as p0,f as Tv,fa as mC,g as Iv,ga as Hv,h as nC,ha as Yv,i as bv,ia as qv,j as Bg,ja as Kv,k as Rv,ka as Vv,l as rC,la as Wv,m as wE,ma as Jv,n as iC,p as cd,q as oC,r as sC,s as lC,t as Nv,u as Dv,v as d0,w as Ov,x as JA,y as kg,z as vv}from"./chunk-BDSARQW3.js";import{a as wg}from"./chunk-UBV5T4TV.js";import{c as NE}from"./chunk-XBHVVB5A.js";import{a as gv,b as mv,d as BE,e as fv,f as Ev,g as hv,h as aC,i as Sv,j as Rg}from"./chunk-A6H62GTA.js";import{a as ld,b as cv,f as Ig,g as c0,h as u0,i as uv,j as dv,k as Av,o as _v}from"./chunk-OXEMDMZF.js";import{e as OE,f as pv,g as tC,i as vE,j as bg}from"./chunk-LVLDD2BE.js";import"./chunk-FZPTNGTU.js";import{e as Dg}from"./chunk-ZSJ2I5WM.js";import"./chunk-7MHXMDYC.js";import{C as _r,E as ov,F as DE,G as $S,H as eC,I as si,K as sv,L as lv,N as zi,R as ws,e as rv,f as iv}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import{a as WA,b as L,c as G7,d as Ke}from"./chunk-X3UA5OZL.js";var oB=L(ra=>{"use strict";var f0=Symbol.for("react.transitional.element"),z7=Symbol.for("react.portal"),H7=Symbol.for("react.fragment"),Y7=Symbol.for("react.strict_mode"),q7=Symbol.for("react.profiler"),K7=Symbol.for("react.consumer"),V7=Symbol.for("react.context"),W7=Symbol.for("react.forward_ref"),J7=Symbol.for("react.suspense"),X7=Symbol.for("react.memo"),eB=Symbol.for("react.lazy"),j7=Symbol.for("react.activity"),Xv=Symbol.iterator;function Z7(e){return e===null||typeof e!="object"?null:(e=Xv&&e[Xv]||e["@@iterator"],typeof e=="function"?e:null)}var tB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},aB=Object.assign,nB={};function Yg(e,t,a){this.props=e,this.context=t,this.refs=nB,this.updater=a||tB}Yg.prototype.isReactComponent={};Yg.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Yg.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function rB(){}rB.prototype=Yg.prototype;function E0(e,t,a){this.props=e,this.context=t,this.refs=nB,this.updater=a||tB}var h0=E0.prototype=new rB;h0.constructor=E0;aB(h0,Yg.prototype);h0.isPureReactComponent=!0;var jv=Array.isArray;function m0(){}var xn={H:null,A:null,T:null,S:null},iB=Object.prototype.hasOwnProperty;function S0(e,t,a){var i=a.ref;return{$$typeof:f0,type:e,key:t,ref:i!==void 0?i:null,props:a}}function $7(e,t){return S0(e.type,t,e.props)}function C0(e){return typeof e=="object"&&e!==null&&e.$$typeof===f0}function ez(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(a){return t[a]})}var Zv=/\/+/g;function g0(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ez(""+e.key):t.toString(36)}function tz(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(m0,m0):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Hg(e,t,a,i,l){var u=typeof e;(u==="undefined"||u==="boolean")&&(e=null);var _=!1;if(e===null)_=!0;else switch(u){case"bigint":case"string":case"number":_=!0;break;case"object":switch(e.$$typeof){case f0:case z7:_=!0;break;case eB:return _=e._init,Hg(_(e._payload),t,a,i,l)}}if(_)return l=l(e),_=i===""?"."+g0(e,0):i,jv(l)?(a="",_!=null&&(a=_.replace(Zv,"$&/")+"/"),Hg(l,t,a,"",function(S){return S})):l!=null&&(C0(l)&&(l=$7(l,a+(l.key==null||e&&e.key===l.key?"":(""+l.key).replace(Zv,"$&/")+"/")+_)),t.push(l)),1;_=0;var p=i===""?".":i+":";if(jv(e))for(var E=0;E<e.length;E++)i=e[E],u=p+g0(i,E),_+=Hg(i,t,a,u,l);else if(E=Z7(e),typeof E=="function")for(e=E.call(e),E=0;!(i=e.next()).done;)i=i.value,u=p+g0(i,E++),_+=Hg(i,t,a,u,l);else if(u==="object"){if(typeof e.then=="function")return Hg(tz(e),t,a,i,l);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return _}function fC(e,t,a){if(e==null)return e;var i=[],l=0;return Hg(e,i,"","",function(u){return t.call(a,u,l++)}),i}function az(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(a){(e._status===0||e._status===-1)&&(e._status=1,e._result=a)},function(a){(e._status===0||e._status===-1)&&(e._status=2,e._result=a)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var $v=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},nz={map:fC,forEach:function(e,t,a){fC(e,function(){t.apply(this,arguments)},a)},count:function(e){var t=0;return fC(e,function(){t++}),t},toArray:function(e){return fC(e,function(t){return t})||[]},only:function(e){if(!C0(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ra.Activity=j7;ra.Children=nz;ra.Component=Yg;ra.Fragment=H7;ra.Profiler=q7;ra.PureComponent=E0;ra.StrictMode=Y7;ra.Suspense=J7;ra.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=xn;ra.__COMPILER_RUNTIME={__proto__:null,c:function(e){return xn.H.useMemoCache(e)}};ra.cache=function(e){return function(){return e.apply(null,arguments)}};ra.cacheSignal=function(){return null};ra.cloneElement=function(e,t,a){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var i=aB({},e.props),l=e.key;if(t!=null)for(u in t.key!==void 0&&(l=""+t.key),t)!iB.call(t,u)||u==="key"||u==="__self"||u==="__source"||u==="ref"&&t.ref===void 0||(i[u]=t[u]);var u=arguments.length-2;if(u===1)i.children=a;else if(1<u){for(var _=Array(u),p=0;p<u;p++)_[p]=arguments[p+2];i.children=_}return S0(e.type,l,i)};ra.createContext=function(e){return e={$$typeof:V7,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:K7,_context:e},e};ra.createElement=function(e,t,a){var i,l={},u=null;if(t!=null)for(i in t.key!==void 0&&(u=""+t.key),t)iB.call(t,i)&&i!=="key"&&i!=="__self"&&i!=="__source"&&(l[i]=t[i]);var _=arguments.length-2;if(_===1)l.children=a;else if(1<_){for(var p=Array(_),E=0;E<_;E++)p[E]=arguments[E+2];l.children=p}if(e&&e.defaultProps)for(i in _=e.defaultProps,_)l[i]===void 0&&(l[i]=_[i]);return S0(e,u,l)};ra.createRef=function(){return{current:null}};ra.forwardRef=function(e){return{$$typeof:W7,render:e}};ra.isValidElement=C0;ra.lazy=function(e){return{$$typeof:eB,_payload:{_status:-1,_result:e},_init:az}};ra.memo=function(e,t){return{$$typeof:X7,type:e,compare:t===void 0?null:t}};ra.startTransition=function(e){var t=xn.T,a={};xn.T=a;try{var i=e(),l=xn.S;l!==null&&l(a,i),typeof i=="object"&&i!==null&&typeof i.then=="function"&&i.then(m0,$v)}catch(u){$v(u)}finally{t!==null&&a.types!==null&&(t.types=a.types),xn.T=t}};ra.unstable_useCacheRefresh=function(){return xn.H.useCacheRefresh()};ra.use=function(e){return xn.H.use(e)};ra.useActionState=function(e,t,a){return xn.H.useActionState(e,t,a)};ra.useCallback=function(e,t){return xn.H.useCallback(e,t)};ra.useContext=function(e){return xn.H.useContext(e)};ra.useDebugValue=function(){};ra.useDeferredValue=function(e,t){return xn.H.useDeferredValue(e,t)};ra.useEffect=function(e,t){return xn.H.useEffect(e,t)};ra.useEffectEvent=function(e){return xn.H.useEffectEvent(e)};ra.useId=function(){return xn.H.useId()};ra.useImperativeHandle=function(e,t,a){return xn.H.useImperativeHandle(e,t,a)};ra.useInsertionEffect=function(e,t){return xn.H.useInsertionEffect(e,t)};ra.useLayoutEffect=function(e,t){return xn.H.useLayoutEffect(e,t)};ra.useMemo=function(e,t){return xn.H.useMemo(e,t)};ra.useOptimistic=function(e,t){return xn.H.useOptimistic(e,t)};ra.useReducer=function(e,t,a){return xn.H.useReducer(e,t,a)};ra.useRef=function(e){return xn.H.useRef(e)};ra.useState=function(e){return xn.H.useState(e)};ra.useSyncExternalStore=function(e,t,a){return xn.H.useSyncExternalStore(e,t,a)};ra.useTransition=function(){return xn.H.useTransition()};ra.version="19.2.7"});var sB=L((Zt,EC)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function e(B,j){Object.defineProperty(i.prototype,B,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",j[0],j[1])}})}function t(B){return B===null||typeof B!="object"?null:(B=Ze&&B[Ze]||B["@@iterator"],typeof B=="function"?B:null)}function a(B,j){B=(B=B.constructor)&&(B.displayName||B.name)||"ReactClass";var Ce=B+"."+j;Rt[Ce]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",j,B),Rt[Ce]=!0)}function i(B,j,Ce){this.props=B,this.context=j,this.refs=yt,this.updater=Ce||Xt}function l(){}function u(B,j,Ce){this.props=B,this.context=j,this.refs=yt,this.updater=Ce||Xt}function _(){}function p(B){return""+B}function E(B){try{p(B);var j=!1}catch{j=!0}if(j){j=console;var Ce=j.error,Ue=typeof Symbol=="function"&&Symbol.toStringTag&&B[Symbol.toStringTag]||B.constructor.name||"Object";return Ce.call(j,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",Ue),p(B)}}function S(B){if(B==null)return null;if(typeof B=="function")return B.$$typeof===za?null:B.displayName||B.name||null;if(typeof B=="string")return B;switch(B){case Me:return"Fragment";case se:return"Profiler";case ze:return"StrictMode";case Se:return"Suspense";case Fe:return"SuspenseList";case Je:return"Activity"}if(typeof B=="object")switch(typeof B.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),B.$$typeof){case at:return"Portal";case te:return B.displayName||"Context";case Pe:return(B._context.displayName||"Context")+".Consumer";case ae:var j=B.render;return B=B.displayName,B||(B=j.displayName||j.name||"",B=B!==""?"ForwardRef("+B+")":"ForwardRef"),B;case _e:return j=B.displayName||null,j!==null?j:S(B.type)||"Memo";case bt:j=B._payload,B=B._init;try{return S(B(j))}catch{}}return null}function T(B){if(B===Me)return"<>";if(typeof B=="object"&&B!==null&&B.$$typeof===bt)return"<...>";try{var j=S(B);return j?"<"+j+">":"<...>"}catch{return"<...>"}}function D(){var B=St.A;return B===null?null:B.getOwner()}function b(){return Error("react-stack-top-frame")}function N(B){if(Sa.call(B,"key")){var j=Object.getOwnPropertyDescriptor(B,"key").get;if(j&&j.isReactWarning)return!1}return B.key!==void 0}function O(B,j){function Ce(){wa||(wa=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",j))}Ce.isReactWarning=!0,Object.defineProperty(B,"key",{get:Ce,configurable:!0})}function x(){var B=S(this.type);return Cn[B]||(Cn[B]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),B=this.props.ref,B!==void 0?B:null}function M(B,j,Ce,Ue,ut,vt){var Nt=Ce.ref;return B={$$typeof:At,type:B,key:j,props:Ce,_owner:Ue},(Nt!==void 0?Nt:null)!==null?Object.defineProperty(B,"ref",{enumerable:!1,get:x}):Object.defineProperty(B,"ref",{enumerable:!1,value:null}),B._store={},Object.defineProperty(B._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(B,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(B,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ut}),Object.defineProperty(B,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:vt}),Object.freeze&&(Object.freeze(B.props),Object.freeze(B)),B}function F(B,j){return j=M(B.type,j,B.props,B._owner,B._debugStack,B._debugTask),B._store&&(j._store.validated=B._store.validated),j}function Z(B){ne(B)?B._store&&(B._store.validated=1):typeof B=="object"&&B!==null&&B.$$typeof===bt&&(B._payload.status==="fulfilled"?ne(B._payload.value)&&B._payload.value._store&&(B._payload.value._store.validated=1):B._store&&(B._store.validated=1))}function ne(B){return typeof B=="object"&&B!==null&&B.$$typeof===At}function ie(B){var j={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(Ce){return j[Ce]})}function De(B,j){return typeof B=="object"&&B!==null&&B.key!=null?(E(B.key),ie(""+B.key)):j.toString(36)}function ve(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(_,_):(B.status="pending",B.then(function(j){B.status==="pending"&&(B.status="fulfilled",B.value=j)},function(j){B.status==="pending"&&(B.status="rejected",B.reason=j)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function nt(B,j,Ce,Ue,ut){var vt=typeof B;(vt==="undefined"||vt==="boolean")&&(B=null);var Nt=!1;if(B===null)Nt=!0;else switch(vt){case"bigint":case"string":case"number":Nt=!0;break;case"object":switch(B.$$typeof){case At:case at:Nt=!0;break;case bt:return Nt=B._init,nt(Nt(B._payload),j,Ce,Ue,ut)}}if(Nt){Nt=B,ut=ut(Nt);var $t=Ue===""?"."+De(Nt,0):Ue;return ha(ut)?(Ce="",$t!=null&&(Ce=$t.replace(Bn,"$&/")+"/"),nt(ut,j,Ce,"",function(ln){return ln})):ut!=null&&(ne(ut)&&(ut.key!=null&&(Nt&&Nt.key===ut.key||E(ut.key)),Ce=F(ut,Ce+(ut.key==null||Nt&&Nt.key===ut.key?"":(""+ut.key).replace(Bn,"$&/")+"/")+$t),Ue!==""&&Nt!=null&&ne(Nt)&&Nt.key==null&&Nt._store&&!Nt._store.validated&&(Ce._store.validated=2),ut=Ce),j.push(ut)),1}if(Nt=0,$t=Ue===""?".":Ue+":",ha(B))for(var Gt=0;Gt<B.length;Gt++)Ue=B[Gt],vt=$t+De(Ue,Gt),Nt+=nt(Ue,j,Ce,vt,ut);else if(Gt=t(B),typeof Gt=="function")for(Gt===B.entries&&(gn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),gn=!0),B=Gt.call(B),Gt=0;!(Ue=B.next()).done;)Ue=Ue.value,vt=$t+De(Ue,Gt++),Nt+=nt(Ue,j,Ce,vt,ut);else if(vt==="object"){if(typeof B.then=="function")return nt(ve(B),j,Ce,Ue,ut);throw j=String(B),Error("Objects are not valid as a React child (found: "+(j==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":j)+"). If you meant to render a collection of children, use an array instead.")}return Nt}function ke(B,j,Ce){if(B==null)return B;var Ue=[],ut=0;return nt(B,Ue,"","",function(vt){return j.call(Ce,vt,ut++)}),Ue}function le(B){if(B._status===-1){var j=B._ioInfo;j!=null&&(j.start=j.end=performance.now()),j=B._result;var Ce=j();if(Ce.then(function(ut){if(B._status===0||B._status===-1){B._status=1,B._result=ut;var vt=B._ioInfo;vt!=null&&(vt.end=performance.now()),Ce.status===void 0&&(Ce.status="fulfilled",Ce.value=ut)}},function(ut){if(B._status===0||B._status===-1){B._status=2,B._result=ut;var vt=B._ioInfo;vt!=null&&(vt.end=performance.now()),Ce.status===void 0&&(Ce.status="rejected",Ce.reason=ut)}}),j=B._ioInfo,j!=null){j.value=Ce;var Ue=Ce.displayName;typeof Ue=="string"&&(j.name=Ue)}B._status===-1&&(B._status=0,B._result=Ce)}if(B._status===1)return j=B._result,j===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
5
5
|
|
|
6
6
|
Your code should look like:
|
|
7
7
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -461,7 +461,7 @@ ${rt}`)):Re==="feedback"&&Qe&&fn(Qe)},[_e,Me]),Eo=(0,ct.useCallback)(Re=>{Gt(!1)
|
|
|
461
461
|
|
|
462
462
|
*[cancelled]*`}]),N(Oe=>[...Oe,{role:"system",content:"(response interrupted)"}])}ie.current=Date.now(),ne(null),F(!0),x(""),tt(null),ke([]);try{await Xr()}catch(rt){let Oe=zi(rt);if(ws(lv(rt),"name")==="AbortError"||Oe.includes("abort")){let ft=De.current;ft&&N(v=>[...v,{role:"assistant",content:ft+`
|
|
463
463
|
|
|
464
|
-
*[cancelled]*`}]),N(v=>[...v,{role:"system",content:"(response interrupted)"}])}else{let ft=De.current;ft&&N(v=>[...v,{role:"assistant",content:ft}]),tt(Oe),N(v=>[...v,{role:"system",content:`Error: ${Oe}`}])}}finally{let rt=Math.floor((Date.now()-ie.current)/1e3);ne(`\u273B ${Dv()} for ${String(rt)}s`),F(!1),ke([]),vt.current=null,fr.current=!1}};return E==="providerSelect"?(0,da.jsx)($G,{providers:e,onSelect:bl}):(0,da.jsxs)(st,{flexDirection:"column",width:"100%",children:[(0,da.jsxs)(st,{flexDirection:"column",paddingTop:0,flexGrow:1,children:[(0,da.jsx)(gy,{items:[{type:"brand",_key:"brand",model:T.model||T.name,workDir:_e},...b.map((Re,Qe)=>({type:"message",_key:`message-${String(Qe)}`,message:Re}))],children:Re=>Re.type==="brand"?(0,da.jsxs)(st,{flexDirection:"column",children:[(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:" /\\_/\\ "}),(0,da.jsxs)(J,{dimColor:!0,children:["Swifty v",cC]})]}),(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:"( o o ) "}),(0,da.jsx)(J,{dimColor:!0,children:Re.model})]}),(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:" > < "}),(0,da.jsx)(J,{dimColor:!0,children:Re.workDir})]}),(0,da.jsx)(J,{children:" "})]},Re._key):(0,da.jsx)(vG,{message:Re.message,expanded:Jr},Re._key)},`transcript-${Xt.current}`),(0,da.jsx)(OG,{messages:[],streamingText:M?O:void 0,expanded:Jr}),nt.length>0&&!yn&&(0,da.jsx)(p7,{tools:nt}),Ai.length>0&&!yn&&(0,da.jsx)(st,{flexDirection:"column",paddingLeft:1,children:Ai.map(Re=>(0,da.jsxs)(J,{color:"magenta",children:[Va.dot," ",Re.label," subagent \xB7 turn ",Re.turn,Re.lastTool?` \xB7 ${Re.lastTool}`:""]},Re.id))}),M&&!yn&&(0,da.jsxs)(st,{paddingLeft:1,flexDirection:"column",children:[(0,da.jsx)(c7,{inputTokens:le,outputTokens:dt}),Xi.length>0&&(0,da.jsx)(ED,{teammates:Xi,leaderTokens:le+dt})]}),!M&&Xi.some(Re=>Re.status==="running")&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(ED,{teammates:Xi})}),he&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{color:"red",children:he})}),!M&&Z&&!yn&&!Ir&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{dimColor:!0,children:Z})}),(0,da.jsx)(J,{children:" "})]}),At&&(0,da.jsx)(jG,{onSelect:Oi}),$t&&(0,da.jsx)(e7,{snapshots:ln,onComplete:Eo,onCancel:()=>{Gt(!1)}}),Ir&&(0,da.jsx)(XG,{toolName:Ir.toolName,argsSummary:Ir.argsSummary,reason:Ir.reason,onComplete:Re=>{Nt.current?.(Re),Nt.current=null,di(null)}}),yn&&(0,da.jsx)(_x,{questions:yn,onComplete:Re=>{Ni.current?.(Re),Ni.current=null,Xn(null)}}),Wr&&(0,da.jsx)(A7,{teammates:Xi,onClose:()=>{br(!1)},onKill:(Re,Qe)=>{let lt=Xe.current.get(Qe);lt&<.stopMember(Re)},onShutdown:(Re,Qe)=>{let lt=Xe.current.get(Qe);lt&<.sendMessage("lead",Re,"[shutdown] Please finish and exit")}}),Il&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{dimColor:!0,children:"Press Ctrl+C again to exit."})}),(0,da.jsx)(u7,{count:Xi.filter(Re=>Re.status==="running"||Re.status==="idle").length}),(0,da.jsx)(WG,{onSubmit:Re=>{fn(Re)},disabled:$t||Ir!==null||yn!==null,history:Se,commands:jt.current.listCommands(),usageTracker:ha.current,inputState:he?"error":M||$t||Ir?"idle":"focused",permMode:Lt,onModeChange:Re=>{Ct(Re)},workDir:_e,insertTextRef:mr,onEscape:()=>{M&&vt.current?.abort()}})]})}function qse(e,t){return t?a=>e(a)&&t(a):e}var Kse="\x1B[?2026h",Vse="\x1B[?2026l";function Wse(){if(process.env.TMUX)return!1;let e=process.env.TERM_PROGRAM,t=process.env.TERM;if(e==="iTerm.app"||e==="WezTerm"||e==="WarpTerminal"||e==="ghostty"||e==="contour"||e==="vscode"||e==="alacritty"||t?.includes("kitty")||process.env.KITTY_WINDOW_ID||t==="xterm-ghostty"||t?.startsWith("foot")||t?.includes("alacritty")||process.env.ZED_TERM||process.env.WT_SESSION)return!0;let a=process.env.VTE_VERSION;return!!(a&&parseInt(a,10)>=6800)}function E7(){if(!Wse())return;let e=process.stdout.write.bind(process.stdout),t="",a=!1;process.stdout.write=function(i,l,u){let _=typeof i=="string"?i:Buffer.isBuffer(i)?i.toString():String(i);return t+=_,a||(a=!0,queueMicrotask(()=>{let p=Kse+t+Vse;t="",a=!1,e(p)})),typeof l=="function"?l():typeof u=="function"&&u(),!0}}var h7=Ke(qa(),1);async function Jse(){let e=process.argv.slice(2),t=ZM(e);if(t){try{await $M(t)}catch(_){console.error(`teammate: ${zi(_)}`),process.exit(1)}return}let a="";for(let _=0;_<e.length;_++)e[_]==="--remote"&&(a=":18888",_+1<e.length&&!e[_+1].startsWith("-")&&(a=e[_+1],_++));let i=WM(e);if(i){try{await JM(i)}catch(_){console.error(`Error: ${zi(_)}`),process.exit(1)}return}let l;try{l=bg()}catch(_){console.error(`Error: ${zi(_)}`),process.exit(1)}if(e.includes("--remote")&&a){let{RemoteServer:_}=await import("./server-
|
|
464
|
+
*[cancelled]*`}]),N(v=>[...v,{role:"system",content:"(response interrupted)"}])}else{let ft=De.current;ft&&N(v=>[...v,{role:"assistant",content:ft}]),tt(Oe),N(v=>[...v,{role:"system",content:`Error: ${Oe}`}])}}finally{let rt=Math.floor((Date.now()-ie.current)/1e3);ne(`\u273B ${Dv()} for ${String(rt)}s`),F(!1),ke([]),vt.current=null,fr.current=!1}};return E==="providerSelect"?(0,da.jsx)($G,{providers:e,onSelect:bl}):(0,da.jsxs)(st,{flexDirection:"column",width:"100%",children:[(0,da.jsxs)(st,{flexDirection:"column",paddingTop:0,flexGrow:1,children:[(0,da.jsx)(gy,{items:[{type:"brand",_key:"brand",model:T.model||T.name,workDir:_e},...b.map((Re,Qe)=>({type:"message",_key:`message-${String(Qe)}`,message:Re}))],children:Re=>Re.type==="brand"?(0,da.jsxs)(st,{flexDirection:"column",children:[(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:" /\\_/\\ "}),(0,da.jsxs)(J,{dimColor:!0,children:["Swifty v",cC]})]}),(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:"( o o ) "}),(0,da.jsx)(J,{dimColor:!0,children:Re.model})]}),(0,da.jsxs)(J,{children:[(0,da.jsx)(J,{color:vd.focused,children:" > < "}),(0,da.jsx)(J,{dimColor:!0,children:Re.workDir})]}),(0,da.jsx)(J,{children:" "})]},Re._key):(0,da.jsx)(vG,{message:Re.message,expanded:Jr},Re._key)},`transcript-${Xt.current}`),(0,da.jsx)(OG,{messages:[],streamingText:M?O:void 0,expanded:Jr}),nt.length>0&&!yn&&(0,da.jsx)(p7,{tools:nt}),Ai.length>0&&!yn&&(0,da.jsx)(st,{flexDirection:"column",paddingLeft:1,children:Ai.map(Re=>(0,da.jsxs)(J,{color:"magenta",children:[Va.dot," ",Re.label," subagent \xB7 turn ",Re.turn,Re.lastTool?` \xB7 ${Re.lastTool}`:""]},Re.id))}),M&&!yn&&(0,da.jsxs)(st,{paddingLeft:1,flexDirection:"column",children:[(0,da.jsx)(c7,{inputTokens:le,outputTokens:dt}),Xi.length>0&&(0,da.jsx)(ED,{teammates:Xi,leaderTokens:le+dt})]}),!M&&Xi.some(Re=>Re.status==="running")&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(ED,{teammates:Xi})}),he&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{color:"red",children:he})}),!M&&Z&&!yn&&!Ir&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{dimColor:!0,children:Z})}),(0,da.jsx)(J,{children:" "})]}),At&&(0,da.jsx)(jG,{onSelect:Oi}),$t&&(0,da.jsx)(e7,{snapshots:ln,onComplete:Eo,onCancel:()=>{Gt(!1)}}),Ir&&(0,da.jsx)(XG,{toolName:Ir.toolName,argsSummary:Ir.argsSummary,reason:Ir.reason,onComplete:Re=>{Nt.current?.(Re),Nt.current=null,di(null)}}),yn&&(0,da.jsx)(_x,{questions:yn,onComplete:Re=>{Ni.current?.(Re),Ni.current=null,Xn(null)}}),Wr&&(0,da.jsx)(A7,{teammates:Xi,onClose:()=>{br(!1)},onKill:(Re,Qe)=>{let lt=Xe.current.get(Qe);lt&<.stopMember(Re)},onShutdown:(Re,Qe)=>{let lt=Xe.current.get(Qe);lt&<.sendMessage("lead",Re,"[shutdown] Please finish and exit")}}),Il&&(0,da.jsx)(st,{paddingLeft:1,children:(0,da.jsx)(J,{dimColor:!0,children:"Press Ctrl+C again to exit."})}),(0,da.jsx)(u7,{count:Xi.filter(Re=>Re.status==="running"||Re.status==="idle").length}),(0,da.jsx)(WG,{onSubmit:Re=>{fn(Re)},disabled:$t||Ir!==null||yn!==null,history:Se,commands:jt.current.listCommands(),usageTracker:ha.current,inputState:he?"error":M||$t||Ir?"idle":"focused",permMode:Lt,onModeChange:Re=>{Ct(Re)},workDir:_e,insertTextRef:mr,onEscape:()=>{M&&vt.current?.abort()}})]})}function qse(e,t){return t?a=>e(a)&&t(a):e}var Kse="\x1B[?2026h",Vse="\x1B[?2026l";function Wse(){if(process.env.TMUX)return!1;let e=process.env.TERM_PROGRAM,t=process.env.TERM;if(e==="iTerm.app"||e==="WezTerm"||e==="WarpTerminal"||e==="ghostty"||e==="contour"||e==="vscode"||e==="alacritty"||t?.includes("kitty")||process.env.KITTY_WINDOW_ID||t==="xterm-ghostty"||t?.startsWith("foot")||t?.includes("alacritty")||process.env.ZED_TERM||process.env.WT_SESSION)return!0;let a=process.env.VTE_VERSION;return!!(a&&parseInt(a,10)>=6800)}function E7(){if(!Wse())return;let e=process.stdout.write.bind(process.stdout),t="",a=!1;process.stdout.write=function(i,l,u){let _=typeof i=="string"?i:Buffer.isBuffer(i)?i.toString():String(i);return t+=_,a||(a=!0,queueMicrotask(()=>{let p=Kse+t+Vse;t="",a=!1,e(p)})),typeof l=="function"?l():typeof u=="function"&&u(),!0}}var h7=Ke(qa(),1);async function Jse(){let e=process.argv.slice(2),t=ZM(e);if(t){try{await $M(t)}catch(_){console.error(`teammate: ${zi(_)}`),process.exit(1)}return}let a="";for(let _=0;_<e.length;_++)e[_]==="--remote"&&(a=":18888",_+1<e.length&&!e[_+1].startsWith("-")&&(a=e[_+1],_++));let i=WM(e);if(i){try{await JM(i)}catch(_){console.error(`Error: ${zi(_)}`),process.exit(1)}return}let l;try{l=bg()}catch(_){console.error(`Error: ${zi(_)}`),process.exit(1)}if(e.includes("--remote")&&a){let{RemoteServer:_}=await import("./server-LIBUDDHX.js");DE({sessionId:Ig(),mode:"remote"});let p=new _({providers:l.providers,mcpServers:l.mcp_servers,hookConfigs:l.hooks,addr:a,enableCoordinatorMode:l.enable_coordinator_mode??!1,forkDisabled:!vE(l)});try{await p.run()}catch(E){console.error(`Remote server error: ${zi(E)}`),process.exit(1)}return}DE({sessionId:Ig(),mode:"tui"}),E7(),await zb((0,h7.jsx)(f7,{providers:l.providers,permissionMode:l.permission_mode,mcpServers:l.mcp_servers,hooks:l.hooks,sandboxConfig:l.sandbox,enableCoordinatorMode:l.enable_coordinator_mode,forkDisabled:!vE(l)}),{exitOnCtrlC:!1}).waitUntilExit()}Jse().catch(e=>{console.error(e),eC.fatal({err:e},"main() unhandled error"),process.exit(-1)});process.on("exit",$S);process.on("unhandledRejection",e=>{console.error("unhandled rejection:",e),eC.fatal({err:e},"unhandled rejection"),process.exit(1)});process.on("uncaughtException",e=>{console.error("uncaught exception:",e),eC.fatal({err:e},"uncaught exception"),process.exit(1)});
|
|
465
465
|
/*! Bundled license information:
|
|
466
466
|
|
|
467
467
|
react/cjs/react.production.js:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
3
|
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{g as Zs,h as en}from"./chunk-GS6BRESU.js";import{b as Gs,c as Xn,d as gs,e as Gn,f as Qn,g as Yn}from"./chunk-FZPTNGTU.js";import"./chunk-7MHXMDYC.js";import{I as Jn,J as Dr,K as Qs,L as ys,M as Ys,R as Vn}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import"./chunk-X3UA5OZL.js";function x(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function c(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}var He=function(){let{crypto:s}=globalThis;if(s?.randomUUID)return He=s.randomUUID.bind(s),s.randomUUID();let e=new Uint8Array(1),t=s?()=>s.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^t()&15>>+r/4).toString(16))};function zr(s){return typeof s=="object"&&s!==null&&("name"in s&&s.name==="AbortError"||"message"in s&&String(s.message).includes("FetchRequestCanceledException"))}var qr=s=>{if(s instanceof Error)return s;if(typeof s=="object"&&s!==null){try{if(Object.prototype.toString.call(s)==="[object Error]"){let e=new Error(s.message,s.cause?{cause:s.cause}:{});return s.stack&&(e.stack=s.stack),s.cause&&!e.cause&&(e.cause=s.cause),s.name&&(e.name=s.name),e}}catch{}try{return new Error(JSON.stringify(s))}catch{}}return new Error(s)};var g=class extends Error{},F=class s extends g{constructor(e,t,r,n){super(`${s.makeMessage(e,t,r)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=t;let o=t;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,t,r){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,r,n){if(!e||!n)return new Se({message:r,cause:qr(t)});let o=t?.error;return e===400?new Pt(e,o,r,n):e===401?new xt(e,o,r,n):e===403?new Rt(e,o,r,n):e===404?new St(e,o,r,n):e===409?new Ct(e,o,r,n):e===422?new kt(e,o,r,n):e===429?new $t(e,o,r,n):e>=500?new Et(e,o,r,n):new s(e,o,r,n)}},M=class extends F{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Se=class extends F{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},Ce=class extends Se{constructor({message:e}={}){super({message:e??"Request timed out."})}},Pt=class extends F{},xt=class extends F{},Rt=class extends F{},St=class extends F{},Ct=class extends F{},kt=class extends F{},$t=class extends F{},Et=class extends F{},Ot=class extends g{constructor(){super("Could not parse response content as the length limit was reached")}},vt=class extends g{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},pe=class extends Error{constructor(e){super(e)}},We=class extends F{constructor(e,t,r){let n="OAuth2 authentication error",o;if(t&&typeof t=="object"){let a=t;o=a.error;let l=a.error_description;l&&typeof l=="string"?n=l:o&&(n=o)}super(e,t,n,r),this.error_code=o}},Hr=class extends g{constructor(e,t,r){super(e),this.provider=t,this.cause=r}};var _i=/^[a-z][a-z0-9+.-]*:/i,Zn=s=>_i.test(s),X=s=>(X=Array.isArray,X(s)),tn=X;function As(s){return typeof s!="object"?{}:s??{}}function rn(s){if(!s)return!0;for(let e in s)return!1;return!0}function eo(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function Wr(s){return s!=null&&typeof s=="object"&&!Array.isArray(s)}var to=(s,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new g(`${s} must be an integer`);if(e<0)throw new g(`${s} must be a positive integer`);return e};var ro=s=>{try{return JSON.parse(s)}catch{return}};var de=s=>new Promise(e=>setTimeout(e,s));var ke="6.49.0";var io=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function yi(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var gi=()=>{let s=yi();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":no(Deno.build.os),"X-Stainless-Arch":so(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":no(globalThis.process.platform??"unknown"),"X-Stainless-Arch":so(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Ai();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Ai(){if(typeof navigator>"u"||!navigator)return null;let s=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of s){let r=t.exec(navigator.userAgent);if(r){let n=r[1]||0,o=r[2]||0,a=r[3]||0;return{browser:e,version:`${n}.${o}.${a}`}}}return null}var so=s=>s==="x32"?"x32":s==="x86_64"||s==="x64"?"x64":s==="arm"?"arm":s==="aarch64"||s==="arm64"?"arm64":s?`other:${s}`:"unknown",no=s=>(s=s.toLowerCase(),s.includes("ios")?"iOS":s==="android"?"Android":s==="darwin"?"MacOS":s==="win32"?"Windows":s==="freebsd"?"FreeBSD":s==="openbsd"?"OpenBSD":s==="linux"?"Linux":s?`Other:${s}`:"Unknown"),oo,ao=()=>oo??(oo=gi());function bs(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sn(...s){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...s)}function Jr(s){let e=Symbol.asyncIterator in s?s[Symbol.asyncIterator]():s[Symbol.iterator]();return sn({start(){},async pull(t){let{done:r,value:n}=await e.next();r?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function ws(s){if(s[Symbol.asyncIterator])return s;let e=s.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function nn(s){if(s===null||typeof s!="object")return;if(s[Symbol.asyncIterator]){await s[Symbol.asyncIterator]().return?.();return}let e=s.getReader(),t=e.cancel();e.releaseLock(),await t}var co=({headers:s,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var on="RFC3986",an=s=>String(s),un={RFC1738:s=>String(s).replace(/%20/g,"+"),RFC3986:an},lo="RFC1738";var Is=(s,e)=>(Is=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Is(s,e)),me=(()=>{let s=[];for(let e=0;e<256;++e)s.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return s})();var cn=1024,po=(s,e,t,r,n)=>{if(s.length===0)return s;let o=s;if(typeof s=="symbol"?o=Symbol.prototype.toString.call(s):typeof s!="string"&&(o=String(s)),t==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});let a="";for(let l=0;l<o.length;l+=cn){let m=o.length>=cn?o.slice(l,l+cn):o,p=[];for(let _=0;_<m.length;++_){let f=m.charCodeAt(_);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||n===lo&&(f===40||f===41)){p[p.length]=m.charAt(_);continue}if(f<128){p[p.length]=me[f];continue}if(f<2048){p[p.length]=me[192|f>>6]+me[128|f&63];continue}if(f<55296||f>=57344){p[p.length]=me[224|f>>12]+me[128|f>>6&63]+me[128|f&63];continue}_+=1,f=65536+((f&1023)<<10|m.charCodeAt(_)&1023),p[p.length]=me[240|f>>18]+me[128|f>>12&63]+me[128|f>>6&63]+me[128|f&63]}a+=p.join("")}return a};function mo(s){return!s||typeof s!="object"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function ln(s,e){if(X(s)){let t=[];for(let r=0;r<s.length;r+=1)t.push(e(s[r]));return t}return e(s)}var fo={brackets(s){return String(s)+"[]"},comma:"comma",indices(s,e){return String(s)+"["+e+"]"},repeat(s){return String(s)}},_o=function(s,e){Array.prototype.push.apply(s,X(e)?e:[e])},ho,D={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:po,encodeValuesOnly:!1,format:on,formatter:an,indices:!1,serializeDate(s){return(ho??(ho=Function.prototype.call.bind(Date.prototype.toISOString)))(s)},skipNulls:!1,strictNullHandling:!1};function wi(s){return typeof s=="string"||typeof s=="number"||typeof s=="boolean"||typeof s=="symbol"||typeof s=="bigint"}var pn={};function yo(s,e,t,r,n,o,a,l,m,p,_,f,d,b,I,A,w,k){let y=s,P=k,R=0,v=!1;for(;(P=P.get(pn))!==void 0&&!v;){let T=P.get(s);if(R+=1,typeof T<"u"){if(T===R)throw new RangeError("Cyclic object value");v=!0}typeof P.get(pn)>"u"&&(R=0)}if(typeof p=="function"?y=p(e,y):y instanceof Date?y=d?.(y):t==="comma"&&X(y)&&(y=ln(y,function(T){return T instanceof Date?d?.(T):T})),y===null){if(o)return m&&!A?m(e,D.encoder,w,"key",b):e;y=""}if(wi(y)||mo(y)){if(m){let T=A?e:m(e,D.encoder,w,"key",b);return[I?.(T)+"="+I?.(m(y,D.encoder,w,"value",b))]}return[I?.(e)+"="+I?.(String(y))]}let $=[];if(typeof y>"u")return $;let L;if(t==="comma"&&X(y))A&&m&&(y=ln(y,m)),L=[{value:y.length>0?y.join(",")||null:void 0}];else if(X(p))L=p;else{let T=Object.keys(y);L=_?T.sort(_):T}let j=l?String(e).replace(/\./g,"%2E"):String(e),N=r&&X(y)&&y.length===1?j+"[]":j;if(n&&X(y)&&y.length===0)return N+"[]";for(let T=0;T<L.length;++T){let W=L[T],It=typeof W=="object"&&typeof W.value<"u"?W.value:y[W];if(a&&It===null)continue;let J=f&&l?W.replace(/\./g,"%2E"):W,fs=X(y)?typeof t=="function"?t(N,J):N:N+(f?"."+J:"["+J+"]");k.set(s,R);let _s=new WeakMap;_s.set(pn,k),_o($,yo(It,fs,t,r,n,o,a,l,t==="comma"&&A&&X(y)?null:m,p,_,f,d,b,I,A,w,_s))}return $}function Ii(s=D){if(typeof s.allowEmptyArrays<"u"&&typeof s.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof s.encodeDotInKeys<"u"&&typeof s.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(s.encoder!==null&&typeof s.encoder<"u"&&typeof s.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=s.charset||D.charset;if(typeof s.charset<"u"&&s.charset!=="utf-8"&&s.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=on;if(typeof s.format<"u"){if(!Is(un,s.format))throw new TypeError("Unknown format option provided.");t=s.format}let r=un[t],n=D.filter;(typeof s.filter=="function"||X(s.filter))&&(n=s.filter);let o;if(s.arrayFormat&&s.arrayFormat in fo?o=s.arrayFormat:"indices"in s?o=s.indices?"indices":"repeat":o=D.arrayFormat,"commaRoundTrip"in s&&typeof s.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof s.allowDots>"u"?s.encodeDotInKeys?!0:D.allowDots:!!s.allowDots;return{addQueryPrefix:typeof s.addQueryPrefix=="boolean"?s.addQueryPrefix:D.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof s.allowEmptyArrays=="boolean"?!!s.allowEmptyArrays:D.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof s.charsetSentinel=="boolean"?s.charsetSentinel:D.charsetSentinel,commaRoundTrip:!!s.commaRoundTrip,delimiter:typeof s.delimiter>"u"?D.delimiter:s.delimiter,encode:typeof s.encode=="boolean"?s.encode:D.encode,encodeDotInKeys:typeof s.encodeDotInKeys=="boolean"?s.encodeDotInKeys:D.encodeDotInKeys,encoder:typeof s.encoder=="function"?s.encoder:D.encoder,encodeValuesOnly:typeof s.encodeValuesOnly=="boolean"?s.encodeValuesOnly:D.encodeValuesOnly,filter:n,format:t,formatter:r,serializeDate:typeof s.serializeDate=="function"?s.serializeDate:D.serializeDate,skipNulls:typeof s.skipNulls=="boolean"?s.skipNulls:D.skipNulls,sort:typeof s.sort=="function"?s.sort:null,strictNullHandling:typeof s.strictNullHandling=="boolean"?s.strictNullHandling:D.strictNullHandling}}function go(s,e={}){let t=s,r=Ii(e),n,o;typeof r.filter=="function"?(o=r.filter,t=o("",t)):X(r.filter)&&(o=r.filter,n=o);let a=[];if(typeof t!="object"||t===null)return"";let l=fo[r.arrayFormat],m=l==="comma"&&r.commaRoundTrip;n||(n=Object.keys(t)),r.sort&&n.sort(r.sort);let p=new WeakMap;for(let d=0;d<n.length;++d){let b=n[d];r.skipNulls&&t[b]===null||_o(a,yo(t[b],b,l,m,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,p))}let _=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),_.length>0?f+_:""}function Ao(s){return go(s,{arrayFormat:"brackets"})}function Io(s){let e=0;for(let n of s)e+=n.length;let t=new Uint8Array(e),r=0;for(let n of s)t.set(n,r),r+=n.length;return t}var bo;function ee(s){let e;return(bo??(e=new globalThis.TextEncoder,bo=e.encode.bind(e)))(s)}var wo;function dn(s){let e;return(wo??(e=new globalThis.TextDecoder,wo=e.decode.bind(e)))(s)}var te,re,Je=class{constructor(){te.set(this,void 0),re.set(this,void 0),x(this,te,new Uint8Array,"f"),x(this,re,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?ee(e):e;x(this,te,Io([c(this,te,"f"),t]),"f");let r=[],n;for(;(n=xi(c(this,te,"f"),c(this,re,"f")))!=null;){if(n.carriage&&c(this,re,"f")==null){x(this,re,n.index,"f");continue}if(c(this,re,"f")!=null&&(n.index!==c(this,re,"f")+1||n.carriage)){r.push(dn(c(this,te,"f").subarray(0,c(this,re,"f")-1))),x(this,te,c(this,te,"f").subarray(c(this,re,"f")),"f"),x(this,re,null,"f");continue}let o=c(this,re,"f")!==null?n.preceding-1:n.preceding,a=dn(c(this,te,"f").subarray(0,o));r.push(a),x(this,te,c(this,te,"f").subarray(n.index),"f"),x(this,re,null,"f")}return r}flush(){return c(this,te,"f").length?this.decode(`
|
|
4
|
+
import{g as Zs,h as en}from"./chunk-LVLDD2BE.js";import{b as Gs,c as Xn,d as gs,e as Gn,f as Qn,g as Yn}from"./chunk-FZPTNGTU.js";import"./chunk-7MHXMDYC.js";import{I as Jn,J as Dr,K as Qs,L as ys,M as Ys,R as Vn}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import"./chunk-X3UA5OZL.js";function x(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function c(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}var He=function(){let{crypto:s}=globalThis;if(s?.randomUUID)return He=s.randomUUID.bind(s),s.randomUUID();let e=new Uint8Array(1),t=s?()=>s.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,r=>(+r^t()&15>>+r/4).toString(16))};function zr(s){return typeof s=="object"&&s!==null&&("name"in s&&s.name==="AbortError"||"message"in s&&String(s.message).includes("FetchRequestCanceledException"))}var qr=s=>{if(s instanceof Error)return s;if(typeof s=="object"&&s!==null){try{if(Object.prototype.toString.call(s)==="[object Error]"){let e=new Error(s.message,s.cause?{cause:s.cause}:{});return s.stack&&(e.stack=s.stack),s.cause&&!e.cause&&(e.cause=s.cause),s.name&&(e.name=s.name),e}}catch{}try{return new Error(JSON.stringify(s))}catch{}}return new Error(s)};var g=class extends Error{},F=class s extends g{constructor(e,t,r,n){super(`${s.makeMessage(e,t,r)}`),this.status=e,this.headers=n,this.requestID=n?.get("x-request-id"),this.error=t;let o=t;this.code=o?.code,this.param=o?.param,this.type=o?.type}static makeMessage(e,t,r){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):r;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,r,n){if(!e||!n)return new Se({message:r,cause:qr(t)});let o=t?.error;return e===400?new Pt(e,o,r,n):e===401?new xt(e,o,r,n):e===403?new Rt(e,o,r,n):e===404?new St(e,o,r,n):e===409?new Ct(e,o,r,n):e===422?new kt(e,o,r,n):e===429?new $t(e,o,r,n):e>=500?new Et(e,o,r,n):new s(e,o,r,n)}},M=class extends F{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Se=class extends F{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},Ce=class extends Se{constructor({message:e}={}){super({message:e??"Request timed out."})}},Pt=class extends F{},xt=class extends F{},Rt=class extends F{},St=class extends F{},Ct=class extends F{},kt=class extends F{},$t=class extends F{},Et=class extends F{},Ot=class extends g{constructor(){super("Could not parse response content as the length limit was reached")}},vt=class extends g{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},pe=class extends Error{constructor(e){super(e)}},We=class extends F{constructor(e,t,r){let n="OAuth2 authentication error",o;if(t&&typeof t=="object"){let a=t;o=a.error;let l=a.error_description;l&&typeof l=="string"?n=l:o&&(n=o)}super(e,t,n,r),this.error_code=o}},Hr=class extends g{constructor(e,t,r){super(e),this.provider=t,this.cause=r}};var _i=/^[a-z][a-z0-9+.-]*:/i,Zn=s=>_i.test(s),X=s=>(X=Array.isArray,X(s)),tn=X;function As(s){return typeof s!="object"?{}:s??{}}function rn(s){if(!s)return!0;for(let e in s)return!1;return!0}function eo(s,e){return Object.prototype.hasOwnProperty.call(s,e)}function Wr(s){return s!=null&&typeof s=="object"&&!Array.isArray(s)}var to=(s,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new g(`${s} must be an integer`);if(e<0)throw new g(`${s} must be a positive integer`);return e};var ro=s=>{try{return JSON.parse(s)}catch{return}};var de=s=>new Promise(e=>setTimeout(e,s));var ke="6.49.0";var io=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function yi(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var gi=()=>{let s=yi();if(s==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":no(Deno.build.os),"X-Stainless-Arch":so(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(s==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":no(globalThis.process.platform??"unknown"),"X-Stainless-Arch":so(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Ai();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ke,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Ai(){if(typeof navigator>"u"||!navigator)return null;let s=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:t}of s){let r=t.exec(navigator.userAgent);if(r){let n=r[1]||0,o=r[2]||0,a=r[3]||0;return{browser:e,version:`${n}.${o}.${a}`}}}return null}var so=s=>s==="x32"?"x32":s==="x86_64"||s==="x64"?"x64":s==="arm"?"arm":s==="aarch64"||s==="arm64"?"arm64":s?`other:${s}`:"unknown",no=s=>(s=s.toLowerCase(),s.includes("ios")?"iOS":s==="android"?"Android":s==="darwin"?"MacOS":s==="win32"?"Windows":s==="freebsd"?"FreeBSD":s==="openbsd"?"OpenBSD":s==="linux"?"Linux":s?`Other:${s}`:"Unknown"),oo,ao=()=>oo??(oo=gi());function bs(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function sn(...s){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...s)}function Jr(s){let e=Symbol.asyncIterator in s?s[Symbol.asyncIterator]():s[Symbol.iterator]();return sn({start(){},async pull(t){let{done:r,value:n}=await e.next();r?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function ws(s){if(s[Symbol.asyncIterator])return s;let e=s.getReader();return{async next(){try{let t=await e.read();return t?.done&&e.releaseLock(),t}catch(t){throw e.releaseLock(),t}},async return(){let t=e.cancel();return e.releaseLock(),await t,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function nn(s){if(s===null||typeof s!="object")return;if(s[Symbol.asyncIterator]){await s[Symbol.asyncIterator]().return?.();return}let e=s.getReader(),t=e.cancel();e.releaseLock(),await t}var co=({headers:s,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var on="RFC3986",an=s=>String(s),un={RFC1738:s=>String(s).replace(/%20/g,"+"),RFC3986:an},lo="RFC1738";var Is=(s,e)=>(Is=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Is(s,e)),me=(()=>{let s=[];for(let e=0;e<256;++e)s.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return s})();var cn=1024,po=(s,e,t,r,n)=>{if(s.length===0)return s;let o=s;if(typeof s=="symbol"?o=Symbol.prototype.toString.call(s):typeof s!="string"&&(o=String(s)),t==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(l){return"%26%23"+parseInt(l.slice(2),16)+"%3B"});let a="";for(let l=0;l<o.length;l+=cn){let m=o.length>=cn?o.slice(l,l+cn):o,p=[];for(let _=0;_<m.length;++_){let f=m.charCodeAt(_);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||n===lo&&(f===40||f===41)){p[p.length]=m.charAt(_);continue}if(f<128){p[p.length]=me[f];continue}if(f<2048){p[p.length]=me[192|f>>6]+me[128|f&63];continue}if(f<55296||f>=57344){p[p.length]=me[224|f>>12]+me[128|f>>6&63]+me[128|f&63];continue}_+=1,f=65536+((f&1023)<<10|m.charCodeAt(_)&1023),p[p.length]=me[240|f>>18]+me[128|f>>12&63]+me[128|f>>6&63]+me[128|f&63]}a+=p.join("")}return a};function mo(s){return!s||typeof s!="object"?!1:!!(s.constructor&&s.constructor.isBuffer&&s.constructor.isBuffer(s))}function ln(s,e){if(X(s)){let t=[];for(let r=0;r<s.length;r+=1)t.push(e(s[r]));return t}return e(s)}var fo={brackets(s){return String(s)+"[]"},comma:"comma",indices(s,e){return String(s)+"["+e+"]"},repeat(s){return String(s)}},_o=function(s,e){Array.prototype.push.apply(s,X(e)?e:[e])},ho,D={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:po,encodeValuesOnly:!1,format:on,formatter:an,indices:!1,serializeDate(s){return(ho??(ho=Function.prototype.call.bind(Date.prototype.toISOString)))(s)},skipNulls:!1,strictNullHandling:!1};function wi(s){return typeof s=="string"||typeof s=="number"||typeof s=="boolean"||typeof s=="symbol"||typeof s=="bigint"}var pn={};function yo(s,e,t,r,n,o,a,l,m,p,_,f,d,b,I,A,w,k){let y=s,P=k,R=0,v=!1;for(;(P=P.get(pn))!==void 0&&!v;){let T=P.get(s);if(R+=1,typeof T<"u"){if(T===R)throw new RangeError("Cyclic object value");v=!0}typeof P.get(pn)>"u"&&(R=0)}if(typeof p=="function"?y=p(e,y):y instanceof Date?y=d?.(y):t==="comma"&&X(y)&&(y=ln(y,function(T){return T instanceof Date?d?.(T):T})),y===null){if(o)return m&&!A?m(e,D.encoder,w,"key",b):e;y=""}if(wi(y)||mo(y)){if(m){let T=A?e:m(e,D.encoder,w,"key",b);return[I?.(T)+"="+I?.(m(y,D.encoder,w,"value",b))]}return[I?.(e)+"="+I?.(String(y))]}let $=[];if(typeof y>"u")return $;let L;if(t==="comma"&&X(y))A&&m&&(y=ln(y,m)),L=[{value:y.length>0?y.join(",")||null:void 0}];else if(X(p))L=p;else{let T=Object.keys(y);L=_?T.sort(_):T}let j=l?String(e).replace(/\./g,"%2E"):String(e),N=r&&X(y)&&y.length===1?j+"[]":j;if(n&&X(y)&&y.length===0)return N+"[]";for(let T=0;T<L.length;++T){let W=L[T],It=typeof W=="object"&&typeof W.value<"u"?W.value:y[W];if(a&&It===null)continue;let J=f&&l?W.replace(/\./g,"%2E"):W,fs=X(y)?typeof t=="function"?t(N,J):N:N+(f?"."+J:"["+J+"]");k.set(s,R);let _s=new WeakMap;_s.set(pn,k),_o($,yo(It,fs,t,r,n,o,a,l,t==="comma"&&A&&X(y)?null:m,p,_,f,d,b,I,A,w,_s))}return $}function Ii(s=D){if(typeof s.allowEmptyArrays<"u"&&typeof s.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof s.encodeDotInKeys<"u"&&typeof s.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(s.encoder!==null&&typeof s.encoder<"u"&&typeof s.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=s.charset||D.charset;if(typeof s.charset<"u"&&s.charset!=="utf-8"&&s.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=on;if(typeof s.format<"u"){if(!Is(un,s.format))throw new TypeError("Unknown format option provided.");t=s.format}let r=un[t],n=D.filter;(typeof s.filter=="function"||X(s.filter))&&(n=s.filter);let o;if(s.arrayFormat&&s.arrayFormat in fo?o=s.arrayFormat:"indices"in s?o=s.indices?"indices":"repeat":o=D.arrayFormat,"commaRoundTrip"in s&&typeof s.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof s.allowDots>"u"?s.encodeDotInKeys?!0:D.allowDots:!!s.allowDots;return{addQueryPrefix:typeof s.addQueryPrefix=="boolean"?s.addQueryPrefix:D.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof s.allowEmptyArrays=="boolean"?!!s.allowEmptyArrays:D.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof s.charsetSentinel=="boolean"?s.charsetSentinel:D.charsetSentinel,commaRoundTrip:!!s.commaRoundTrip,delimiter:typeof s.delimiter>"u"?D.delimiter:s.delimiter,encode:typeof s.encode=="boolean"?s.encode:D.encode,encodeDotInKeys:typeof s.encodeDotInKeys=="boolean"?s.encodeDotInKeys:D.encodeDotInKeys,encoder:typeof s.encoder=="function"?s.encoder:D.encoder,encodeValuesOnly:typeof s.encodeValuesOnly=="boolean"?s.encodeValuesOnly:D.encodeValuesOnly,filter:n,format:t,formatter:r,serializeDate:typeof s.serializeDate=="function"?s.serializeDate:D.serializeDate,skipNulls:typeof s.skipNulls=="boolean"?s.skipNulls:D.skipNulls,sort:typeof s.sort=="function"?s.sort:null,strictNullHandling:typeof s.strictNullHandling=="boolean"?s.strictNullHandling:D.strictNullHandling}}function go(s,e={}){let t=s,r=Ii(e),n,o;typeof r.filter=="function"?(o=r.filter,t=o("",t)):X(r.filter)&&(o=r.filter,n=o);let a=[];if(typeof t!="object"||t===null)return"";let l=fo[r.arrayFormat],m=l==="comma"&&r.commaRoundTrip;n||(n=Object.keys(t)),r.sort&&n.sort(r.sort);let p=new WeakMap;for(let d=0;d<n.length;++d){let b=n[d];r.skipNulls&&t[b]===null||_o(a,yo(t[b],b,l,m,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,p))}let _=a.join(r.delimiter),f=r.addQueryPrefix===!0?"?":"";return r.charsetSentinel&&(r.charset==="iso-8859-1"?f+="utf8=%26%2310003%3B&":f+="utf8=%E2%9C%93&"),_.length>0?f+_:""}function Ao(s){return go(s,{arrayFormat:"brackets"})}function Io(s){let e=0;for(let n of s)e+=n.length;let t=new Uint8Array(e),r=0;for(let n of s)t.set(n,r),r+=n.length;return t}var bo;function ee(s){let e;return(bo??(e=new globalThis.TextEncoder,bo=e.encode.bind(e)))(s)}var wo;function dn(s){let e;return(wo??(e=new globalThis.TextDecoder,wo=e.decode.bind(e)))(s)}var te,re,Je=class{constructor(){te.set(this,void 0),re.set(this,void 0),x(this,te,new Uint8Array,"f"),x(this,re,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?ee(e):e;x(this,te,Io([c(this,te,"f"),t]),"f");let r=[],n;for(;(n=xi(c(this,te,"f"),c(this,re,"f")))!=null;){if(n.carriage&&c(this,re,"f")==null){x(this,re,n.index,"f");continue}if(c(this,re,"f")!=null&&(n.index!==c(this,re,"f")+1||n.carriage)){r.push(dn(c(this,te,"f").subarray(0,c(this,re,"f")-1))),x(this,te,c(this,te,"f").subarray(c(this,re,"f")),"f"),x(this,re,null,"f");continue}let o=c(this,re,"f")!==null?n.preceding-1:n.preceding,a=dn(c(this,te,"f").subarray(0,o));r.push(a),x(this,te,c(this,te,"f").subarray(n.index),"f"),x(this,re,null,"f")}return r}flush(){return c(this,te,"f").length?this.decode(`
|
|
5
5
|
`):[]}};te=new WeakMap,re=new WeakMap;Je.NEWLINE_CHARS=new Set([`
|
|
6
6
|
`,"\r"]);Je.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function xi(s,e){for(let n=e??0;n<s.length;n++){if(s[n]===10)return{preceding:n,index:n+1,carriage:!1};if(s[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function Po(s){for(let r=0;r<s.length-1;r++){if(s[r]===10&&s[r+1]===10||s[r]===13&&s[r+1]===13)return r+2;if(s[r]===13&&s[r+1]===10&&r+3<s.length&&s[r+2]===13&&s[r+3]===10)return r+4}return-1}var xs={off:0,error:200,warn:300,info:400,debug:500},mn=(s,e,t)=>{if(s){if(eo(xs,s))return s;K(t).warn(`${e} was set to ${JSON.stringify(s)}, expected one of ${JSON.stringify(Object.keys(xs))}`)}};function Vr(){}function Ps(s,e,t){return!e||xs[s]>xs[t]?Vr:e[s].bind(e)}var Ri={error:Vr,warn:Vr,info:Vr,debug:Vr},xo=new WeakMap;function K(s){let e=s.logger,t=s.logLevel??"off";if(!e)return Ri;let r=xo.get(e);if(r&&r[0]===t)return r[1];let n={error:Ps("error",e,t),warn:Ps("warn",e,t),info:Ps("info",e,t),debug:Ps("debug",e,t)};return xo.set(e,[t,n]),n}var ye=s=>(s.options&&(s.options={...s.options},delete s.options.headers),s.headers&&(s.headers=Object.fromEntries((s.headers instanceof Headers?[...s.headers]:Object.entries(s.headers)).map(([e,t])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="api-key"||e.toLowerCase()==="x-api-key"||e.toLowerCase()==="x-amz-security-token"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":t]))),"retryOfRequestLogID"in s&&(s.retryOfRequestLogID&&(s.retryOf=s.retryOfRequestLogID),delete s.retryOfRequestLogID),s);var Xr,Z=class s{constructor(e,t,r){this.iterator=e,Xr.set(this,void 0),this.controller=t,x(this,Xr,r,"f")}static fromSSEResponse(e,t,r,n){let o=!1,a=r?K(r):console;async function*l(){if(o)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let m=!1;try{for await(let p of Si(e,t))if(!m){if(p.data.startsWith("[DONE]")){m=!0;continue}if(p.event===null||!p.event.startsWith("thread.")){let _;try{_=JSON.parse(p.data)}catch(f){throw a.error("Could not parse message into JSON:",p.data),a.error("From chunk:",p.raw),f}if(_&&_.error)throw new F(void 0,_.error,void 0,e.headers);yield n?{event:p.event,data:_}:_}else{let _;try{_=JSON.parse(p.data)}catch(f){throw console.error("Could not parse message into JSON:",p.data),console.error("From chunk:",p.raw),f}if(p.event=="error")throw new F(void 0,_.error,_.message,void 0);yield{event:p.event,data:_}}}m=!0}catch(p){if(zr(p))return;throw p}finally{m||t.abort()}}return new s(l,t,r)}static fromReadableStream(e,t,r){let n=!1;async function*o(){let l=new Je,m=e.getReader(),p=!1,_,f=()=>{_??(_=m.cancel()),_.catch(()=>{})};t.signal.addEventListener("abort",f,{once:!0});try{if(t.signal.aborted){f();return}for(;;){let{value:d,done:b}=await m.read();if(b){p=!0;break}if(t.signal.aborted)return;for(let I of l.decode(d)){if(t.signal.aborted)return;yield I}}if(t.signal.aborted)return;for(let d of l.flush()){if(t.signal.aborted)return;yield d}}finally{t.signal.removeEventListener("abort",f),p||f(),m.releaseLock()}}async function*a(){if(n)throw new g("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let l=!1;try{for await(let m of o())l||m&&(yield JSON.parse(m));l=!0}catch(m){if(t.signal.aborted||zr(m))return;throw m}finally{l||t.abort()}}return new s(a,t,r)}[(Xr=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],r=this.iterator(),n=o=>({next:()=>{if(o.length===0){let a=r.next();e.push(a),t.push(a)}return o.shift()}});return[new s(()=>n(e),this.controller,c(this,Xr,"f")),new s(()=>n(t),this.controller,c(this,Xr,"f"))]}toReadableStream(){let e=this,t;return sn({async start(){t=e[Symbol.asyncIterator]()},async pull(r){try{let{value:n,done:o}=await t.next();if(o)return r.close();let a=ee(JSON.stringify(n)+`
|
|
7
7
|
`);r.enqueue(a)}catch(n){r.error(n)}},async cancel(){await t.return?.()}})}};async function*Si(s,e){if(!s.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new g("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new g("Attempted to iterate over a response with no body");let t=new hn,r=new Je,n=ws(s.body);for await(let o of Ci(n))for(let a of r.decode(o)){let l=t.decode(a);l&&(yield l)}for(let o of r.flush()){let a=t.decode(o);a&&(yield a)}}async function*Ci(s){let e=new Uint8Array;for await(let t of s){if(t==null)continue;let r=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?ee(t):t,n=new Uint8Array(e.length+r.length);n.set(e),n.set(r,e.length),e=n;let o;for(;(o=Po(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var hn=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let o={event:this.event,data:this.data.join(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
3
|
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{$ as ki,A as ce,B as pe,C as li,D as le,E as ue,H as me,I as ui,J as mi,K as de,N as ct,P as di,Q as xi,R as vi,T as fi,V as bi,W as gi,X as hi,Y as yi,Z as Be,_ as wi,a as Ie,aa as ji,b as He,ba as qi,c as $e,ca as Ei,da as Si,ea as Ci,fa as Ti,ga as zi,h as ei,ha as _i,ia as Pi,j as ai,ja as Ai,ka as Ri,l as ii,la as Oi,m as ni,ma as Li,n as si,o as oi,p as Ge,q as ti,r as ri,s as ci,y as pi}from"./chunk-
|
|
4
|
+
import{$ as ki,A as ce,B as pe,C as li,D as le,E as ue,H as me,I as ui,J as mi,K as de,N as ct,P as di,Q as xi,R as vi,T as fi,V as bi,W as gi,X as hi,Y as yi,Z as Be,_ as wi,a as Ie,aa as ji,b as He,ba as qi,c as $e,ca as Ei,da as Si,ea as Ci,fa as Ti,ga as zi,h as ei,ha as _i,ia as Pi,j as ai,ja as Ai,ka as Ri,l as ii,la as Oi,m as ni,ma as Li,n as si,o as oi,p as Ge,q as ti,r as ri,s as ci,y as pi}from"./chunk-BDSARQW3.js";import{a as re}from"./chunk-UBV5T4TV.js";import{a as Ue,b as Ha}from"./chunk-XBHVVB5A.js";import{a as Va,d as Qa,j as Y}from"./chunk-A6H62GTA.js";import{a as L,e as Ga,f as Ba,g as oe,h as De,i as Xa,j as Wa,k as te,o as Za}from"./chunk-OXEMDMZF.js";import{e as Ya,f as Ja,g as Ka}from"./chunk-LVLDD2BE.js";import"./chunk-FZPTNGTU.js";import{e as J}from"./chunk-ZSJ2I5WM.js";import"./chunk-7MHXMDYC.js";import{D as E,I as $a,R as Ne}from"./chunk-ISXLT3QN.js";import"./chunk-MQ5XOYLD.js";import{a as x,b as l,d as rt}from"./chunk-X3UA5OZL.js";var Fi=l((_l,Mi)=>{"use strict";Mi.exports=pt;function pt(e,a){if(!Array.isArray(e))throw new TypeError("arg must be an array of [ee, events...] arrays");for(var i=[],n=0;n<e.length;n++){var s=e[n];if(!Array.isArray(s)||s.length<2)throw new TypeError("each array member must be [ee, events...]");for(var o=s[0],t=1;t<s.length;t++){var r=s[t],c=lt(r,p);o.on(r,c),i.push({ee:o,event:r,fn:c})}}function p(){m(),a.apply(null,arguments)}function m(){for(var d,f=0;f<i.length;f++)d=i[f],d.ee.removeListener(d.event,d.fn)}function u(d){a=d}return u.cancel=m,u}function lt(e,a){return function(n){for(var s=new Array(arguments.length),o=this,t=e==="error"?n:null,r=0;r<s.length;r++)s[r]=arguments[r];a(t,o,e,s)}}});var We=l((Pl,Xe)=>{"use strict";Xe.exports=mt;Xe.exports.isFinished=Di;var Ui=bt(),Ni=Fi(),ut=typeof setImmediate=="function"?setImmediate:function(e){process.nextTick(e.bind.apply(e,arguments))};function mt(e,a){return Di(e)!==!1?(ut(a,null,e),e):(xt(e,gt(a)),e)}function Di(e){var a=e.socket;if(typeof e.finished=="boolean")return!!(e.finished||a&&!a.writable);if(typeof e.complete=="boolean")return!!(e.upgrade||!a||!a.readable||e.complete&&!e.readable)}function dt(e,a){var i,n,s=!1;function o(r){i.cancel(),n.cancel(),s=!0,a(r)}i=n=Ni([[e,"end","finish"]],o);function t(r){e.removeListener("socket",t),!s&&i===n&&(n=Ni([[r,"error","close"]],o))}if(e.socket){t(e.socket);return}e.on("socket",t),e.socket===void 0&&ft(e,t)}function xt(e,a){var i=e.__onFinished;(!i||!i.queue)&&(i=e.__onFinished=vt(e),dt(e,i)),i.queue.push(a)}function vt(e){function a(i){if(e.__onFinished===a&&(e.__onFinished=null),!!a.queue){var n=a.queue;a.queue=null;for(var s=0;s<n.length;s++)n[s](i,e)}}return a.queue=[],a}function ft(e,a){var i=e.assignSocket;typeof i=="function"&&(e.assignSocket=function(s){i.call(this,s),a(s)})}function bt(){try{return x("async_hooks")}catch{return{}}}function gt(e){var a;return Ui.AsyncResource&&(a=new Ui.AsyncResource(e.name||"bound-anonymous-fn")),!a||!a.runInAsyncScope?e:a.runInAsyncScope.bind(a,e,null)}});var Hi=l((Al,Ii)=>{"use strict";Ii.exports=ht;function ht(e){if(!Array.isArray(e))throw new TypeError("Middleware stack must be an array!");for(let a of e)if(typeof a!="function")throw new TypeError("Middleware must be composed of functions!");return function(a,i){let n=-1;return s(0);function s(o){if(o<=n)return Promise.reject(new Error("next() called multiple times"));n=o;let t=e[o];if(o===e.length&&(t=i),!t)return Promise.resolve();try{return Promise.resolve(t(a,s.bind(null,o+1)))}catch(r){return Promise.reject(r)}}}}});var $i=l((Rl,yt)=>{yt.exports={"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}});var K=l((Ol,Bi)=>{"use strict";var Ze=$i();Bi.exports=_;_.message=Ze;_.code=wt(Ze);_.codes=kt(Ze);_.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0};_.empty={204:!0,205:!0,304:!0};_.retry={502:!0,503:!0,504:!0};function wt(e){var a={};return Object.keys(e).forEach(function(n){var s=e[n],o=Number(n);a[s.toLowerCase()]=o}),a}function kt(e){return Object.keys(e).map(function(i){return Number(i)})}function jt(e){var a=e.toLowerCase();if(!Object.prototype.hasOwnProperty.call(_.code,a))throw new Error('invalid status message: "'+e+'"');return _.code[a]}function Gi(e){if(!Object.prototype.hasOwnProperty.call(_.message,e))throw new Error("invalid status code: "+e);return _.message[e]}function _(e){if(typeof e=="number")return Gi(e);if(typeof e!="string")throw new TypeError("code must be a number or string");var a=parseInt(e,10);return isNaN(a)?jt(e):Gi(a)}});var Je=l((Ll,Yi)=>{"use strict";var qt=x("path").relative;Yi.exports=zt;var Et=process.cwd();function Wi(e,a){for(var i=e.split(/[ ,]+/),n=String(a).toLowerCase(),s=0;s<i.length;s++){var o=i[s];if(o&&(o==="*"||o.toLowerCase()===n))return!0}return!1}function St(e,a,i){var n=Object.getOwnPropertyDescriptor(e,a),s=n.value;return n.get=function(){return s},n.writable&&(n.set=function(t){return s=t}),delete n.value,delete n.writable,Object.defineProperty(e,a,n),n}function Ct(e){for(var a="",i=0;i<e;i++)a+=", arg"+i;return a.substr(2)}function Tt(e){var a=this.name+": "+this.namespace;this.message&&(a+=" deprecated "+this.message);for(var i=0;i<e.length;i++)a+=`
|
|
5
5
|
at `+e[i].toString();return a}function zt(e){if(!e)throw new TypeError("argument namespace is required");var a=ve(),i=H(a[1]),n=i[0];function s(o){xe.call(s,o)}return s._file=n,s._ignored=Pt(e),s._namespace=e,s._traced=At(e),s._warned=Object.create(null),s.function=Mt,s.property=Ft,s}function _t(e,a){var i=typeof e.listenerCount!="function"?e.listeners(a).length:e.listenerCount(a);return i>0}function Pt(e){if(process.noDeprecation)return!0;var a=process.env.NO_DEPRECATION||"";return Wi(a,e)}function At(e){if(process.traceDeprecation)return!0;var a=process.env.TRACE_DEPRECATION||"";return Wi(a,e)}function xe(e,a){var i=_t(process,"deprecation");if(!(!i&&this._ignored)){var n,s,o,t,r=0,c=!1,p=ve(),m=this._file;for(a?(t=a,o=H(p[1]),o.name=t.name,m=o[0]):(r=2,t=H(p[r]),o=t);r<p.length;r++)if(n=H(p[r]),s=n[0],s===m)c=!0;else if(s===this._file)m=this._file;else if(c)break;var u=n?t.join(":")+"__"+n.join(":"):void 0;if(!(u!==void 0&&u in this._warned)){this._warned[u]=!0;var d=e;if(d||(d=o===t||!o.name?Xi(t):Xi(o)),i){var f=Zi(this._namespace,d,p.slice(r));process.emit("deprecation",f);return}var h=process.stderr.isTTY?Ot:Rt,P=h.call(this,d,n,p.slice(r));process.stderr.write(P+`
|
|
6
6
|
`,"utf8")}}}function H(e){var a=e.getFileName()||"<anonymous>",i=e.getLineNumber(),n=e.getColumnNumber();e.isEval()&&(a=e.getEvalOrigin()+", "+a);var s=[a,i,n];return s.callSite=e,s.name=e.getFunctionName(),s}function Xi(e){var a=e.callSite,i=e.name;i||(i="<anonymous@"+Ye(e)+">");var n=a.getThis(),s=n&&a.getTypeName();return s==="Object"&&(s=void 0),s==="Function"&&(s=n.name||s),s&&a.getMethodName()?s+"."+i:i}function Rt(e,a,i){var n=new Date().toUTCString(),s=n+" "+this._namespace+" deprecated "+e;if(this._traced){for(var o=0;o<i.length;o++)s+=`
|
|
7
7
|
at `+i[o].toString();return s}return a&&(s+=" at "+Ye(a)),s}function Ot(e,a,i){var n="\x1B[36;1m"+this._namespace+"\x1B[22;39m \x1B[33;1mdeprecated\x1B[22;39m \x1B[0m"+e+"\x1B[39m";if(this._traced){for(var s=0;s<i.length;s++)n+=`
|
package/package.json
CHANGED
package/dist/chunk-GS6BRESU.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __swiftyCreateRequire } from "node:module";
|
|
3
|
-
const require = __swiftyCreateRequire(import.meta.url);
|
|
4
|
-
import{a as x}from"./chunk-7MHXMDYC.js";import{C as o,I as S,b as u,c as m}from"./chunk-ISXLT3QN.js";import{existsSync as E,readFileSync as $}from"fs";import{homedir as I}from"os";import{join as d}from"path";function p(e){return!!e._zod}function c(e,n){return p(e)?u(e,n):e.safeParse(n)}async function ee(e,n){return p(e)?await m(e,n):await e.safeParseAsync(n)}function oe(e){if(!e)return;let n;if(p(e)?n=e._zod?.def?.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function ne(e){if(p(e)){let s=e._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(r!==void 0)return r}var g=S({module:"config"}),A={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"};function N(e){return _.has(e)}var _=new Set(Object.keys(A)),l=class extends Error{constructor(n){super(n),this.name="ConfigError"}},P=o.object({name:o.string(),protocol:o.enum(["anthropic","openai","openai-compat"]),base_url:o.string(),model:o.string(),api_key:o.string().optional(),thinking:o.boolean().optional(),context_window:o.coerce.number().optional(),max_output_tokens:o.coerce.number().optional()}),V=[["1m",1e6],["gpt-4.1",1e6],["gpt-4o",128e3],["gpt-4-turbo",128e3],["o1",2e5],["o3",2e5],["o4",2e5],["gpt-3.5",16385],["claude",2e5]];function j(e){let n=e.toLowerCase();for(let[t,r]of V)if(n.includes(t))return r;return n.includes("claude")?2e5:128e3}function le(e){return e.context_window&&e.context_window>0?e.context_window:j(e.model)}var w=new Map;async function pe(e,n){if(e.context_window&&e.context_window>0)return e.context_window;if(e.protocol==="anthropic"){let t=`${e.name}-${e.model}`,r=w.get(t);if(r===void 0){try{r=await(n??(await import("./anthropic-GABA24KD.js")).fetchModelContextWindow)(e)}catch(i){g.error({err:i},"config operation failed"),r=0}w.set(t,r)}if(r&&r>0)return r}return j(e.model)}function ue(e){return e.max_output_tokens&&e.max_output_tokens>0?e.max_output_tokens:e.thinking?64e3:8192}function me(e){if(e.api_key)return e.api_key;let n=N(e.protocol)?A[e.protocol]:"";return n?process.env[n]??"":""}var z=o.object({name:o.string(),command:o.string().optional(),args:o.array(o.string()).optional(),url:o.string().optional(),transport:o.string().optional(),headers:o.record(o.string(),o.string()).optional(),env:o.record(o.string(),o.string()).optional()}),O=o.object({id:o.string().optional(),event:o.string(),condition:o.string().optional(),action:o.object({type:o.string(),command:o.string().optional(),url:o.string().optional(),method:o.string().optional(),prompt:o.string().optional()}),reject:o.boolean().optional(),once:o.boolean().optional(),async:o.boolean().optional(),on_error:o.string().optional()}),M=o.object({enabled:o.boolean().optional(),auto_allow:o.boolean().optional(),network_enabled:o.boolean().optional()}),T=o.object({providers:o.array(P),permission_mode:o.string().optional(),mcp_servers:o.array(z).default([]),hooks:o.array(O).default([]),sandbox:M.optional(),enable_coordinator_mode:o.boolean().optional(),enable_fork:o.boolean().optional()});function ge(e){return e.enable_fork!==!1}function Y(e){return typeof e=="object"&&e!==null}function C(e){let n=$(e,"utf-8"),t=x.load(n);if(!Y(t))return g.error({path:e},"invalid yaml"),{providers:[],mcp_servers:[],hooks:[]};let r=c(T,t);if(r.success){let a=r.data;return{providers:a.providers,permission_mode:a.permission_mode,mcp_servers:a.mcp_servers,hooks:a.hooks}}g.error({error:r.error},"config error");let i=[],s,f=[],y=[],v,b=!1,h=!0;if("providers"in t){let a=c(o.array(P),t.providers);a.success&&(i=a.data)}if("permission_mode"in t&&typeof t.permission_mode=="string"&&(s=t.permission_mode),"mcp_servers"in t){let a=c(o.array(z),t.mcp_servers);a.success&&(f=a.data)}if("hooks"in t){let a=c(o.array(O),t.hooks);a.success&&(y=a.data)}if("sandbox"in t){let a=c(M,t.sandbox);a.success&&(v=a.data)}return"enable_coordinator_mode"in t&&(b=!!t.enable_coordinator_mode),"enable_fork"in t&&(h=!!t.enable_fork),{providers:i,permission_mode:s,mcp_servers:f,hooks:y,sandbox:v,enable_coordinator_mode:b,enable_fork:h}}function K(e,n){if(n.providers.length>0&&(e.providers=n.providers),n.permission_mode&&(e.permission_mode=n.permission_mode),n.mcp_servers.length>0){let t=new Map;for(let r=0;r<e.mcp_servers.length;r++){let i=e.mcp_servers[r];t.set(i.name,r)}for(let r of n.mcp_servers){let i=t.get(r.name);i!==void 0?e.mcp_servers[i]=r:(e.mcp_servers.push(r),t.set(r.name,e.mcp_servers.length-1))}}return e.hooks=[...e.hooks,...n.hooks],n.sandbox&&(e.sandbox={...e.sandbox,...n.sandbox}),n.enable_coordinator_mode&&(e.enable_coordinator_mode=!0),n.enable_fork!==void 0&&(e.enable_fork=n.enable_fork),e}function k(e){if(e.providers.length===0)throw new l("At least one provider MUST be configured.");let n=["name","protocol","base_url","model"];for(let t=0;t<e.providers.length;t++){let r=e.providers[t],i={name:r.name,protocol:r.protocol,base_url:r.base_url,model:r.model},s=n.filter(f=>!(f in i));if(s.length>0)throw new l(`Provider #${String(t+1)}: missing fields: ${s.join(", ")}`);if(!_.has(r.protocol))throw new l(`Provider #${String(t+1)}: invalid protocol '${r.protocol}', MUST be one of: ${Array.from(_).join(", ")}`)}}function _e(e){if(e){let s=C(e);return k(s),s}let n=process.cwd(),t=I(),r=[d(t,".swifty","config.yml"),d(t,".swifty","config.yaml"),d(n,".swifty","config.yml"),d(n,".swifty","config.yaml"),d(n,".swifty","config.local.yml"),d(n,".swifty","config.local.yaml")],i=null;for(let s of r){if(!E(s))continue;let f=C(s);i?i=K(i,f):i=f}if(!i)throw new l("No config file found, expected .swifty/config.y(a)ml under project or $HOME/.swifty/config.y(a)ml.");return k(i),i}export{c as a,ee as b,oe as c,ne as d,le as e,pe as f,ue as g,me as h,ge as i,_e as j};
|