@yukino.js/yukino 0.0.20 → 0.0.21
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/README.md +12 -38
- package/dist/anthropic-LB4T3BEN.js +4 -0
- package/dist/browser/dist/index.html +2 -2
- package/dist/browser/dist/static/chunk-3HWUJ4KR.js +1 -0
- package/dist/browser/dist/static/{highlight-ZDY7K2CR.js → highlight-KNDEBJWF.js} +10 -10
- package/dist/browser/dist/static/index.css +1 -1
- package/dist/browser/dist/static/index.js +40 -40
- package/dist/{chunk-LUBMW3QT.js → chunk-57IGGFHK.js} +5 -5
- package/dist/{chunk-Q6322VDG.js → chunk-5AOJ5ZSQ.js} +20 -20
- package/dist/chunk-5D3QKHYQ.js +36 -0
- package/dist/{chunk-SLZKGKP5.js → chunk-CEP5W4VW.js} +1 -1
- package/dist/{chunk-FK5B4XFN.js → chunk-ENUOAMFA.js} +1 -1
- package/dist/{chunk-T3MBBXTU.js → chunk-FCZRCSNM.js} +29 -29
- package/dist/{chunk-D64ZLLSN.js → chunk-WKTO7XPO.js} +1 -1
- package/dist/{chunk-3V2Q65BE.js → chunk-XXTMMEVY.js} +197 -198
- package/dist/lib/{anthropic-UZXEGJN5.js → anthropic-TYBMDJP3.js} +3 -3
- package/dist/lib/{chunk-6RBU5LDC.js → chunk-3QGT2MSI.js} +0 -42
- package/dist/lib/{chunk-V3WAJBLN.js → chunk-IPKULHXR.js} +2 -2
- package/dist/lib/{chunk-FHJHT233.js → chunk-NIUCGP4C.js} +80 -238
- package/dist/lib/{chunk-2QPNVR5H.js → chunk-OPEO6D4O.js} +2 -5
- package/dist/lib/{chunk-Y3EO3KLE.js → chunk-ZNDE6BQM.js} +2 -2
- package/dist/lib/index.d.ts +616 -819
- package/dist/lib/index.js +666 -1441
- package/dist/lib/{openai-DNNUHOKV.js → openai-Z2JCYL6F.js} +3 -3
- package/dist/lib/{providers-NBWCB4EA.js → providers-RONNZOUT.js} +2 -2
- package/dist/{main-IEQSD5OX.js → main-V4RKN5MY.js} +221 -221
- package/dist/main.js +2 -2
- package/dist/{openai-SRAHPUVF.js → openai-UOCUBMFA.js} +1 -1
- package/dist/{providers-ETXXDQGM.js → providers-NYJNJO7D.js} +1 -1
- package/dist/server-7QJH5UCM.js +14 -0
- package/dist/{server-N2WSM46R.js → server-XFB4HEJU.js} +1 -1
- package/package.json +4 -4
- package/dist/anthropic-XJSWCDJD.js +0 -4
- package/dist/chunk-ZZF3DILS.js +0 -38
- package/dist/server-HXOWUX6N.js +0 -14
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
3
|
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
-
import{a as g,b as $,c as U,d as v,e as S,f as R}from"./chunk-
|
|
4
|
+
import{a as g,b as $,c as U,d as v,e as S,f as R}from"./chunk-ENUOAMFA.js";import{a as c}from"./chunk-CEP5W4VW.js";import{B as y}from"./chunk-QSKJBSCI.js";import"./chunk-7MKA3SHV.js";import{realpathSync as _}from"fs";import{fileURLToPath as H}from"url";import{execFile as N,spawn as I}from"child_process";import{readFileSync as L,realpathSync as A}from"fs";import{dirname as f,isAbsolute as F,join as W,relative as G,sep as Y}from"path";import{fileURLToPath as j}from"url";function P(e,t,n=process.platform){return n!=="win32"?{command:e,args:t}:{command:"powershell.exe",args:["-NoProfile","-NonInteractive","-Command",`$ErrorActionPreference = 'Stop'; [Console]::OutputEncoding = [System.Text.UTF8Encoding]::new($false); & ${[e,...t].map(u=>`'${u.replaceAll("'","''")}'`).join(" ")}; exit $LASTEXITCODE`]}}function D(){let e=f(j(import.meta.url));for(;;){try{let n=JSON.parse(L(W(e,"package.json"),"utf8"));if(y.object({name:y.string()}).safeParse(n).data?.name===g)return e}catch{}let t=f(e);if(t===e)throw new Error(U);e=t}}function V(e,t){try{let n=G(A(t),A(e));return n!==""&&n!==".."&&!n.startsWith(`..${Y}`)&&!F(n)}catch{return!1}}async function b(e,t=D()){let n=t.replaceAll("\\","/").toLowerCase(),i=/\/(?:\.pnpm|pnpm)\//u.test(n)?"pnpm":/\/(?:\.yarn|yarn)\//u.test(n)?"yarn":"npm",u=P(i,i==="yarn"?["global","dir"]:["root","-g"]),d="";try{d=await new Promise((m,o)=>{N(u.command,u.args,{encoding:"utf8",timeout:1e4,windowsHide:!0},(r,s)=>{r?o(new Error(r.message,{cause:r})):m(s.trim())})})}catch{}let p=f(f(t)),l=i==="npm"&&n.endsWith(`/lib/node_modules/${g}`)?f(f(p)):void 0,h=[d,...l?[p]:[]];if(i==="pnpm"&&d&&h.push(f(d)),!h.some(m=>m&&V(t,m)))throw new Error(v);return{command:i,args:[...i==="yarn"?["global","add"]:["install","-g"],...l?["--prefix",l]:[],`${g}@${e}`,`--registry=${$}`]}}async function O(e){let t=P(e.command,e.args);await new Promise((n,i)=>{let u=I(t.command,t.args,{stdio:"inherit"});u.once("error",i),u.once("close",(d,p)=>{d===0?n():i(new Error(p?`${e.command} was terminated by ${p}.`:`${e.command} exited with code ${d??"unknown"}.`))})})}async function M(e){try{let t=await R({tag:e});if(!S(t,c)){console.log(`Yukino is already up to date (v${c}).`);return}let n=await b(t);console.log(`Updating Yukino from v${c} to v${t} with ${n.command}...`),await O(n),console.log(`Updated Yukino from v${c} to v${t}.`)}catch(t){console.error(`Update failed: ${t instanceof Error?t.message:String(t)}`),process.exitCode=1}}var z=`Yukino is a terminal-based AI coding agent.
|
|
5
5
|
|
|
6
6
|
Usage: yukino [options]
|
|
7
7
|
|
|
@@ -37,4 +37,4 @@ Examples:
|
|
|
37
37
|
yukino update
|
|
38
38
|
yukino update --tag=canary`,w={remote:"--remote",a2a:"--a2a"},a=class extends Error{},C="-p requires a prompt argument immediately after it; use '-p -- <prompt>' when the prompt starts with '-'",x="Run 'yukino --help' for usage.";function K(e){if(e!=="text"&&e!=="stream-json")throw new a(`--output-format requires 'text' or 'stream-json' (got '${e??"nothing"}')`);return e}function Q(e){let t;for(let n=0;n<e.length;n++){let i=e[n];if(i==="--help"||i==="-h")return{kind:"help",topic:"update"};if(i==="--tag"){let d=e[n+1];if(d===void 0||d.startsWith("-"))throw new a(`Option '--tag' requires a value.
|
|
39
39
|
${E}`);t=d,n+=1;continue}if(i.startsWith("--tag=")){t=i.slice(6);continue}let u=i.startsWith("-")?`Unknown option '${i}'.`:`Unexpected argument '${i}'.`;throw new a(`${u}
|
|
40
|
-
${E}`)}return t===void 0?{kind:"update"}:{kind:"update",tag:t}}function X(e){if(e[0]==="update")return Q(e.slice(1));let t,n,i,u,d=!1,p=()=>t?w[t.kind]:n!==void 0?"-p":i!==void 0?"--resume":u===void 0?void 0:"--output-format",l=o=>{let r=p();if(r===o)throw new a(`Option '${o}' was already specified.`);if(r)throw new a(`${o} cannot be combined with ${r}.`)},h=o=>{if(t)throw new a(`--resume cannot be combined with ${w[t.kind]}.`);if(n!==void 0)throw new a("--resume cannot be combined with -p.");i=o},m=o=>{let r=e[o+1];return r!==void 0&&!r.startsWith("-")?[r,o+1]:[void 0,o]};for(let o=0;o<e.length;o++){let r=e[o];if(d)throw new a(`Unexpected argument "${r}". ${x}`);if(r==="--"){d=!0;continue}if(r==="--help"||r==="-h")return{kind:"help"};if(r==="--version"||r==="-v")return{kind:"version"};switch(r){case"-p":{if(t)throw new a(`-p cannot be combined with ${w[t.kind]}.`);if(n!==void 0)throw new a("Option '-p' was already specified.");if(i!==void 0)throw new a("-p cannot be combined with --resume.");if(e[o+1]==="--"){let s=e[o+2];if(!s?.trim())throw new a(C);n=s,d=!0,o+=2}else{let s=e[o+1];if(!s?.trim()||s.startsWith("-"))throw new a(C);n=s,o+=1}continue}case"--output-format":{if(t)throw new a(`--output-format cannot be combined with ${w[t.kind]}.`);u=K(e[o+1]),o+=1;continue}case"--resume":{let s=e[o+1];s!==void 0&&!s.startsWith("-")?(h(s),o+=1):h(!0);continue}case"--remote":{l(r);let[s,k]=m(o);t={kind:"remote",address:s??"18888"},o=k;continue}case"--a2a":{l(r);let[s,k]=m(o);t=s===void 0?{kind:"a2a"}:{kind:"a2a",address:s},o=k;continue}default:{if(r.startsWith("--resume=")){h(r.slice(9)||!0);continue}throw new a(r.startsWith("-")?`Unknown option "${r}". ${x}`:`Unexpected argument "${r}". ${x}`)}}}if(u!==void 0&&n===void 0)throw new a("--output-format requires -p.");return n!==void 0?{kind:"print",prompt:n,outputFormat:u??"text"}:t||(i===void 0?{kind:"ui"}:{kind:"ui",resume:i})}async function B(){let e;try{e=X(process.argv.slice(2))}catch(t){if(!(t instanceof a))throw t;console.error(`Error: ${t.message}`),process.exitCode=1;return}switch(e.kind){case"help":{console.log(e.topic==="update"?J:z);return}case"version":{console.log(c);return}case"update":{await M(e.tag);return}default:{let{runMode:t}=await import("./main-
|
|
40
|
+
${E}`)}return t===void 0?{kind:"update"}:{kind:"update",tag:t}}function X(e){if(e[0]==="update")return Q(e.slice(1));let t,n,i,u,d=!1,p=()=>t?w[t.kind]:n!==void 0?"-p":i!==void 0?"--resume":u===void 0?void 0:"--output-format",l=o=>{let r=p();if(r===o)throw new a(`Option '${o}' was already specified.`);if(r)throw new a(`${o} cannot be combined with ${r}.`)},h=o=>{if(t)throw new a(`--resume cannot be combined with ${w[t.kind]}.`);if(n!==void 0)throw new a("--resume cannot be combined with -p.");i=o},m=o=>{let r=e[o+1];return r!==void 0&&!r.startsWith("-")?[r,o+1]:[void 0,o]};for(let o=0;o<e.length;o++){let r=e[o];if(d)throw new a(`Unexpected argument "${r}". ${x}`);if(r==="--"){d=!0;continue}if(r==="--help"||r==="-h")return{kind:"help"};if(r==="--version"||r==="-v")return{kind:"version"};switch(r){case"-p":{if(t)throw new a(`-p cannot be combined with ${w[t.kind]}.`);if(n!==void 0)throw new a("Option '-p' was already specified.");if(i!==void 0)throw new a("-p cannot be combined with --resume.");if(e[o+1]==="--"){let s=e[o+2];if(!s?.trim())throw new a(C);n=s,d=!0,o+=2}else{let s=e[o+1];if(!s?.trim()||s.startsWith("-"))throw new a(C);n=s,o+=1}continue}case"--output-format":{if(t)throw new a(`--output-format cannot be combined with ${w[t.kind]}.`);u=K(e[o+1]),o+=1;continue}case"--resume":{let s=e[o+1];s!==void 0&&!s.startsWith("-")?(h(s),o+=1):h(!0);continue}case"--remote":{l(r);let[s,k]=m(o);t={kind:"remote",address:s??"18888"},o=k;continue}case"--a2a":{l(r);let[s,k]=m(o);t=s===void 0?{kind:"a2a"}:{kind:"a2a",address:s},o=k;continue}default:{if(r.startsWith("--resume=")){h(r.slice(9)||!0);continue}throw new a(r.startsWith("-")?`Unknown option "${r}". ${x}`:`Unexpected argument "${r}". ${x}`)}}}if(u!==void 0&&n===void 0)throw new a("--output-format requires -p.");return n!==void 0?{kind:"print",prompt:n,outputFormat:u??"text"}:t||(i===void 0?{kind:"ui"}:{kind:"ui",resume:i})}async function B(){let e;try{e=X(process.argv.slice(2))}catch(t){if(!(t instanceof a))throw t;console.error(`Error: ${t.message}`),process.exitCode=1;return}switch(e.kind){case"help":{console.log(e.topic==="update"?J:z);return}case"version":{console.log(c);return}case"update":{await M(e.tag);return}default:{let{runMode:t}=await import("./main-V4RKN5MY.js");await t(e)}}}function Z(){let e=process.argv[1];if(!e)return!1;try{return _(e)===_(H(import.meta.url))}catch{return!1}}Z()&&await B();export{z as CLI_HELP,a as CliUsageError,J as UPDATE_HELP,X as parseCliArgs};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
3
|
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
-
import{a as mn}from"./chunk-P6DHMU7R.js";import{Y as pn,ia as dn,ja as Oe,k as on,ka as Cs,l as an,la as uo,m as un,ma as ce,na as co,o as cn,oa as Ss,p as ln,pa as ks,r as Xr,za as fn}from"./chunk-ZZF3DILS.js";import{Hc as Vr,Ic as be,Jc as ao,Kc as Rs,Oc as te,Pa as io}from"./chunk-Q6322VDG.js";import"./chunk-WLJL66O5.js";import{B as j}from"./chunk-QSKJBSCI.js";import"./chunk-7MKA3SHV.js";function P(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}function c(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)}var Ge=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return Ge=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^t()&15>>+s/4).toString(16))};function Gr(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var Qr=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};var y=class extends Error{},M=class r extends y{constructor(e,t,s,n){super(`${r.makeMessage(e,t,s)}`),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,s){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):s;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,s,n){if(!e||!n)return new Ee({message:s,cause:Qr(t)});let o=t?.error;return e===400?new kt(e,o,s,n):e===401?new $t(e,o,s,n):e===403?new Ot(e,o,s,n):e===404?new Et(e,o,s,n):e===409?new vt(e,o,s,n):e===422?new Tt(e,o,s,n):e===429?new Lt(e,o,s,n):e>=500?new jt(e,o,s,n):new r(e,o,s,n)}},K=class extends M{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Ee=class extends M{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},ve=class extends Ee{constructor({message:e}={}){super({message:e??"Request timed out."})}},kt=class extends M{},$t=class extends M{},Ot=class extends M{},Et=class extends M{},vt=class extends M{},Tt=class extends M{},Lt=class extends M{},jt=class extends M{},Ft=class extends y{constructor(){super("Could not parse response content as the length limit was reached")}},Nt=class extends y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},me=class extends Error{constructor(e){super(e)}},Qe=class extends M{constructor(e,t,s){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,s),this.error_code=o}},Yr=class extends y{constructor(e,t,s){super(e),this.provider=t,this.cause=s}};var Ei=/^[a-z][a-z0-9+.-]*:/i,lo=r=>Ei.test(r),G=r=>(G=Array.isArray,G(r)),hn=G;function $s(r){return typeof r!="object"?{}:r??{}}function _n(r){if(!r)return!0;for(let e in r)return!1;return!0}function po(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Zr(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}var fo=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new y(`${r} must be an integer`);if(e<0)throw new y(`${r} must be a positive integer`);return e};var mo=r=>{try{return JSON.parse(r)}catch{return}};var he=r=>new Promise(e=>setTimeout(e,r));var Te="6.49.0";var yo=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function vi(){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 Ti=()=>{let r=vi();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"X-Stainless-OS":_o(Deno.build.os),"X-Stainless-Arch":ho(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":Te,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"X-Stainless-OS":_o(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ho(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Li();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"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":Te,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Li(){if(typeof navigator>"u"||!navigator)return null;let r=[{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 r){let s=t.exec(navigator.userAgent);if(s){let n=s[1]||0,o=s[2]||0,a=s[3]||0;return{browser:e,version:`${n}.${o}.${a}`}}}return null}var ho=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",_o=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),go,Ao=()=>go??(go=Ti());function Os(){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 gn(...r){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(...r)}function es(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return gn({start(){},async pull(t){let{done:s,value:n}=await e.next();s?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function Es(r){if(r[Symbol.asyncIterator])return r;let e=r.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 yn(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var wo=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var An="RFC3986",bn=r=>String(r),wn={RFC1738:r=>String(r).replace(/%20/g,"+"),RFC3986:bn},Io="RFC1738";var vs=(r,e)=>(vs=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),vs(r,e)),_e=(()=>{let r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})();var In=1024,xo=(r,e,t,s,n)=>{if(r.length===0)return r;let o=r;if(typeof r=="symbol"?o=Symbol.prototype.toString.call(r):typeof r!="string"&&(o=String(r)),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+=In){let d=o.length>=In?o.slice(l,l+In):o,p=[];for(let m=0;m<d.length;++m){let _=d.charCodeAt(m);if(_===45||_===46||_===95||_===126||_>=48&&_<=57||_>=65&&_<=90||_>=97&&_<=122||n===Io&&(_===40||_===41)){p[p.length]=d.charAt(m);continue}if(_<128){p[p.length]=_e[_];continue}if(_<2048){p[p.length]=_e[192|_>>6]+_e[128|_&63];continue}if(_<55296||_>=57344){p[p.length]=_e[224|_>>12]+_e[128|_>>6&63]+_e[128|_&63];continue}m+=1,_=65536+((_&1023)<<10|d.charCodeAt(m)&1023),p[p.length]=_e[240|_>>18]+_e[128|_>>12&63]+_e[128|_>>6&63]+_e[128|_&63]}a+=p.join("")}return a};function Po(r){return!r||typeof r!="object"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function xn(r,e){if(G(r)){let t=[];for(let s=0;s<r.length;s+=1)t.push(e(r[s]));return t}return e(r)}var Co={brackets(r){return String(r)+"[]"},comma:"comma",indices(r,e){return String(r)+"["+e+"]"},repeat(r){return String(r)}},So=function(r,e){Array.prototype.push.apply(r,G(e)?e:[e])},Ro,q={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xo,encodeValuesOnly:!1,format:An,formatter:bn,indices:!1,serializeDate(r){return(Ro??(Ro=Function.prototype.call.bind(Date.prototype.toISOString)))(r)},skipNulls:!1,strictNullHandling:!1};function Fi(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="symbol"||typeof r=="bigint"}var Pn={};function ko(r,e,t,s,n,o,a,l,d,p,m,_,h,w,x,g,I,E){let A=r,$=E,k=0,O=!1;for(;($=$.get(Pn))!==void 0&&!O;){let F=$.get(r);if(k+=1,typeof F<"u"){if(F===k)throw new RangeError("Cyclic object value");O=!0}typeof $.get(Pn)>"u"&&(k=0)}if(typeof p=="function"?A=p(e,A):A instanceof Date?A=h?.(A):t==="comma"&&G(A)&&(A=xn(A,function(F){return F instanceof Date?h?.(F):F})),A===null){if(o)return d&&!g?d(e,q.encoder,I,"key",w):e;A=""}if(Fi(A)||Po(A)){if(d){let F=g?e:d(e,q.encoder,I,"key",w);return[x?.(F)+"="+x?.(d(A,q.encoder,I,"value",w))]}return[x?.(e)+"="+x?.(String(A))]}let R=[];if(typeof A>"u")return R;let b;if(t==="comma"&&G(A))g&&d&&(A=xn(A,d)),b=[{value:A.length>0?A.join(",")||null:void 0}];else if(G(p))b=p;else{let F=Object.keys(A);b=m?F.sort(m):F}let v=l?String(e).replace(/\./g,"%2E"):String(e),N=s&&G(A)&&A.length===1?v+"[]":v;if(n&&G(A)&&A.length===0)return N+"[]";for(let F=0;F<b.length;++F){let U=b[F],St=typeof U=="object"&&typeof U.value<"u"?U.value:A[U];if(a&&St===null)continue;let X=_&&l?U.replace(/\./g,"%2E"):U,xs=G(A)?typeof t=="function"?t(N,X):N:N+(_?"."+X:"["+X+"]");E.set(r,k);let Ps=new WeakMap;Ps.set(Pn,E),So(R,ko(St,xs,t,s,n,o,a,l,t==="comma"&&g&&G(A)?null:d,p,m,_,h,w,x,g,I,Ps))}return R}function Ni(r=q){if(typeof r.allowEmptyArrays<"u"&&typeof r.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.encodeDotInKeys<"u"&&typeof r.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(r.encoder!==null&&typeof r.encoder<"u"&&typeof r.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=r.charset||q.charset;if(typeof r.charset<"u"&&r.charset!=="utf-8"&&r.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=An;if(typeof r.format<"u"){if(!vs(wn,r.format))throw new TypeError("Unknown format option provided.");t=r.format}let s=wn[t],n=q.filter;(typeof r.filter=="function"||G(r.filter))&&(n=r.filter);let o;if(r.arrayFormat&&r.arrayFormat in Co?o=r.arrayFormat:"indices"in r?o=r.indices?"indices":"repeat":o=q.arrayFormat,"commaRoundTrip"in r&&typeof r.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof r.allowDots>"u"?r.encodeDotInKeys?!0:q.allowDots:!!r.allowDots;return{addQueryPrefix:typeof r.addQueryPrefix=="boolean"?r.addQueryPrefix:q.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof r.allowEmptyArrays=="boolean"?!!r.allowEmptyArrays:q.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof r.charsetSentinel=="boolean"?r.charsetSentinel:q.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?q.delimiter:r.delimiter,encode:typeof r.encode=="boolean"?r.encode:q.encode,encodeDotInKeys:typeof r.encodeDotInKeys=="boolean"?r.encodeDotInKeys:q.encodeDotInKeys,encoder:typeof r.encoder=="function"?r.encoder:q.encoder,encodeValuesOnly:typeof r.encodeValuesOnly=="boolean"?r.encodeValuesOnly:q.encodeValuesOnly,filter:n,format:t,formatter:s,serializeDate:typeof r.serializeDate=="function"?r.serializeDate:q.serializeDate,skipNulls:typeof r.skipNulls=="boolean"?r.skipNulls:q.skipNulls,sort:typeof r.sort=="function"?r.sort:null,strictNullHandling:typeof r.strictNullHandling=="boolean"?r.strictNullHandling:q.strictNullHandling}}function $o(r,e={}){let t=r,s=Ni(e),n,o;typeof s.filter=="function"?(o=s.filter,t=o("",t)):G(s.filter)&&(o=s.filter,n=o);let a=[];if(typeof t!="object"||t===null)return"";let l=Co[s.arrayFormat],d=l==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);let p=new WeakMap;for(let h=0;h<n.length;++h){let w=n[h];s.skipNulls&&t[w]===null||So(a,ko(t[w],w,l,d,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,p))}let m=a.join(s.delimiter),_=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),m.length>0?_+m:""}function Oo(r){return $o(r,{arrayFormat:"brackets"})}function To(r){let e=0;for(let n of r)e+=n.length;let t=new Uint8Array(e),s=0;for(let n of r)t.set(n,s),s+=n.length;return t}var Eo;function re(r){let e;return(Eo??(e=new globalThis.TextEncoder,Eo=e.encode.bind(e)))(r)}var vo;function Rn(r){let e;return(vo??(e=new globalThis.TextDecoder,vo=e.decode.bind(e)))(r)}var se,ne,Ye=class{constructor(){se.set(this,void 0),ne.set(this,void 0),P(this,se,new Uint8Array,"f"),P(this,ne,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?re(e):e;P(this,se,To([c(this,se,"f"),t]),"f");let s=[],n;for(;(n=Ki(c(this,se,"f"),c(this,ne,"f")))!=null;){if(n.carriage&&c(this,ne,"f")==null){P(this,ne,n.index,"f");continue}if(c(this,ne,"f")!=null&&(n.index!==c(this,ne,"f")+1||n.carriage)){s.push(Rn(c(this,se,"f").subarray(0,c(this,ne,"f")-1))),P(this,se,c(this,se,"f").subarray(c(this,ne,"f")),"f"),P(this,ne,null,"f");continue}let o=c(this,ne,"f")!==null?n.preceding-1:n.preceding,a=Rn(c(this,se,"f").subarray(0,o));s.push(a),P(this,se,c(this,se,"f").subarray(n.index),"f"),P(this,ne,null,"f")}return s}flush(){return c(this,se,"f").length?this.decode(`
|
|
4
|
+
import{a as mn}from"./chunk-P6DHMU7R.js";import{I as dn,J as Oe,K as Cs,L as uo,M as ce,N as co,O as Ss,P as ks,Z as fn,k as on,l as an,m as un,o as cn,p as ln,r as Xr,x as pn}from"./chunk-5D3QKHYQ.js";import{Ac as Rs,Ec as te,Pa as io,xc as Vr,yc as be,zc as ao}from"./chunk-5AOJ5ZSQ.js";import"./chunk-WLJL66O5.js";import{B as j}from"./chunk-QSKJBSCI.js";import"./chunk-7MKA3SHV.js";function P(r,e,t,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t}function c(r,e,t,s){if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!s:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?s:t==="a"?s.call(r):s?s.value:e.get(r)}var Ge=function(){let{crypto:r}=globalThis;if(r?.randomUUID)return Ge=r.randomUUID.bind(r),r.randomUUID();let e=new Uint8Array(1),t=r?()=>r.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,s=>(+s^t()&15>>+s/4).toString(16))};function Gr(r){return typeof r=="object"&&r!==null&&("name"in r&&r.name==="AbortError"||"message"in r&&String(r.message).includes("FetchRequestCanceledException"))}var Qr=r=>{if(r instanceof Error)return r;if(typeof r=="object"&&r!==null){try{if(Object.prototype.toString.call(r)==="[object Error]"){let e=new Error(r.message,r.cause?{cause:r.cause}:{});return r.stack&&(e.stack=r.stack),r.cause&&!e.cause&&(e.cause=r.cause),r.name&&(e.name=r.name),e}}catch{}try{return new Error(JSON.stringify(r))}catch{}}return new Error(r)};var y=class extends Error{},M=class r extends y{constructor(e,t,s,n){super(`${r.makeMessage(e,t,s)}`),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,s){let n=t?.message?typeof t.message=="string"?t.message:JSON.stringify(t.message):t?JSON.stringify(t):s;return e&&n?`${e} ${n}`:e?`${e} status code (no body)`:n||"(no status code or body)"}static generate(e,t,s,n){if(!e||!n)return new Ee({message:s,cause:Qr(t)});let o=t?.error;return e===400?new kt(e,o,s,n):e===401?new $t(e,o,s,n):e===403?new Ot(e,o,s,n):e===404?new Et(e,o,s,n):e===409?new vt(e,o,s,n):e===422?new Tt(e,o,s,n):e===429?new Lt(e,o,s,n):e>=500?new jt(e,o,s,n):new r(e,o,s,n)}},K=class extends M{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},Ee=class extends M{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},ve=class extends Ee{constructor({message:e}={}){super({message:e??"Request timed out."})}},kt=class extends M{},$t=class extends M{},Ot=class extends M{},Et=class extends M{},vt=class extends M{},Tt=class extends M{},Lt=class extends M{},jt=class extends M{},Ft=class extends y{constructor(){super("Could not parse response content as the length limit was reached")}},Nt=class extends y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},me=class extends Error{constructor(e){super(e)}},Qe=class extends M{constructor(e,t,s){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,s),this.error_code=o}},Yr=class extends y{constructor(e,t,s){super(e),this.provider=t,this.cause=s}};var Ei=/^[a-z][a-z0-9+.-]*:/i,lo=r=>Ei.test(r),G=r=>(G=Array.isArray,G(r)),hn=G;function $s(r){return typeof r!="object"?{}:r??{}}function _n(r){if(!r)return!0;for(let e in r)return!1;return!0}function po(r,e){return Object.prototype.hasOwnProperty.call(r,e)}function Zr(r){return r!=null&&typeof r=="object"&&!Array.isArray(r)}var fo=(r,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new y(`${r} must be an integer`);if(e<0)throw new y(`${r} must be a positive integer`);return e};var mo=r=>{try{return JSON.parse(r)}catch{return}};var he=r=>new Promise(e=>setTimeout(e,r));var Te="6.49.0";var yo=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function vi(){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 Ti=()=>{let r=vi();if(r==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"X-Stainless-OS":_o(Deno.build.os),"X-Stainless-Arch":ho(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":Te,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(r==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"X-Stainless-OS":_o(globalThis.process.platform??"unknown"),"X-Stainless-Arch":ho(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=Li();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":Te,"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":Te,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function Li(){if(typeof navigator>"u"||!navigator)return null;let r=[{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 r){let s=t.exec(navigator.userAgent);if(s){let n=s[1]||0,o=s[2]||0,a=s[3]||0;return{browser:e,version:`${n}.${o}.${a}`}}}return null}var ho=r=>r==="x32"?"x32":r==="x86_64"||r==="x64"?"x64":r==="arm"?"arm":r==="aarch64"||r==="arm64"?"arm64":r?`other:${r}`:"unknown",_o=r=>(r=r.toLowerCase(),r.includes("ios")?"iOS":r==="android"?"Android":r==="darwin"?"MacOS":r==="win32"?"Windows":r==="freebsd"?"FreeBSD":r==="openbsd"?"OpenBSD":r==="linux"?"Linux":r?`Other:${r}`:"Unknown"),go,Ao=()=>go??(go=Ti());function Os(){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 gn(...r){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(...r)}function es(r){let e=Symbol.asyncIterator in r?r[Symbol.asyncIterator]():r[Symbol.iterator]();return gn({start(){},async pull(t){let{done:s,value:n}=await e.next();s?t.close():t.enqueue(n)},async cancel(){await e.return?.()}})}function Es(r){if(r[Symbol.asyncIterator])return r;let e=r.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 yn(r){if(r===null||typeof r!="object")return;if(r[Symbol.asyncIterator]){await r[Symbol.asyncIterator]().return?.();return}let e=r.getReader(),t=e.cancel();e.releaseLock(),await t}var wo=({headers:r,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var An="RFC3986",bn=r=>String(r),wn={RFC1738:r=>String(r).replace(/%20/g,"+"),RFC3986:bn},Io="RFC1738";var vs=(r,e)=>(vs=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),vs(r,e)),_e=(()=>{let r=[];for(let e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r})();var In=1024,xo=(r,e,t,s,n)=>{if(r.length===0)return r;let o=r;if(typeof r=="symbol"?o=Symbol.prototype.toString.call(r):typeof r!="string"&&(o=String(r)),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+=In){let d=o.length>=In?o.slice(l,l+In):o,p=[];for(let m=0;m<d.length;++m){let _=d.charCodeAt(m);if(_===45||_===46||_===95||_===126||_>=48&&_<=57||_>=65&&_<=90||_>=97&&_<=122||n===Io&&(_===40||_===41)){p[p.length]=d.charAt(m);continue}if(_<128){p[p.length]=_e[_];continue}if(_<2048){p[p.length]=_e[192|_>>6]+_e[128|_&63];continue}if(_<55296||_>=57344){p[p.length]=_e[224|_>>12]+_e[128|_>>6&63]+_e[128|_&63];continue}m+=1,_=65536+((_&1023)<<10|d.charCodeAt(m)&1023),p[p.length]=_e[240|_>>18]+_e[128|_>>12&63]+_e[128|_>>6&63]+_e[128|_&63]}a+=p.join("")}return a};function Po(r){return!r||typeof r!="object"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}function xn(r,e){if(G(r)){let t=[];for(let s=0;s<r.length;s+=1)t.push(e(r[s]));return t}return e(r)}var Co={brackets(r){return String(r)+"[]"},comma:"comma",indices(r,e){return String(r)+"["+e+"]"},repeat(r){return String(r)}},So=function(r,e){Array.prototype.push.apply(r,G(e)?e:[e])},Ro,q={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:xo,encodeValuesOnly:!1,format:An,formatter:bn,indices:!1,serializeDate(r){return(Ro??(Ro=Function.prototype.call.bind(Date.prototype.toISOString)))(r)},skipNulls:!1,strictNullHandling:!1};function Fi(r){return typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="symbol"||typeof r=="bigint"}var Pn={};function ko(r,e,t,s,n,o,a,l,d,p,m,_,h,w,x,g,I,E){let A=r,$=E,k=0,O=!1;for(;($=$.get(Pn))!==void 0&&!O;){let F=$.get(r);if(k+=1,typeof F<"u"){if(F===k)throw new RangeError("Cyclic object value");O=!0}typeof $.get(Pn)>"u"&&(k=0)}if(typeof p=="function"?A=p(e,A):A instanceof Date?A=h?.(A):t==="comma"&&G(A)&&(A=xn(A,function(F){return F instanceof Date?h?.(F):F})),A===null){if(o)return d&&!g?d(e,q.encoder,I,"key",w):e;A=""}if(Fi(A)||Po(A)){if(d){let F=g?e:d(e,q.encoder,I,"key",w);return[x?.(F)+"="+x?.(d(A,q.encoder,I,"value",w))]}return[x?.(e)+"="+x?.(String(A))]}let R=[];if(typeof A>"u")return R;let b;if(t==="comma"&&G(A))g&&d&&(A=xn(A,d)),b=[{value:A.length>0?A.join(",")||null:void 0}];else if(G(p))b=p;else{let F=Object.keys(A);b=m?F.sort(m):F}let v=l?String(e).replace(/\./g,"%2E"):String(e),N=s&&G(A)&&A.length===1?v+"[]":v;if(n&&G(A)&&A.length===0)return N+"[]";for(let F=0;F<b.length;++F){let U=b[F],St=typeof U=="object"&&typeof U.value<"u"?U.value:A[U];if(a&&St===null)continue;let X=_&&l?U.replace(/\./g,"%2E"):U,xs=G(A)?typeof t=="function"?t(N,X):N:N+(_?"."+X:"["+X+"]");E.set(r,k);let Ps=new WeakMap;Ps.set(Pn,E),So(R,ko(St,xs,t,s,n,o,a,l,t==="comma"&&g&&G(A)?null:d,p,m,_,h,w,x,g,I,Ps))}return R}function Ni(r=q){if(typeof r.allowEmptyArrays<"u"&&typeof r.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof r.encodeDotInKeys<"u"&&typeof r.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(r.encoder!==null&&typeof r.encoder<"u"&&typeof r.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=r.charset||q.charset;if(typeof r.charset<"u"&&r.charset!=="utf-8"&&r.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let t=An;if(typeof r.format<"u"){if(!vs(wn,r.format))throw new TypeError("Unknown format option provided.");t=r.format}let s=wn[t],n=q.filter;(typeof r.filter=="function"||G(r.filter))&&(n=r.filter);let o;if(r.arrayFormat&&r.arrayFormat in Co?o=r.arrayFormat:"indices"in r?o=r.indices?"indices":"repeat":o=q.arrayFormat,"commaRoundTrip"in r&&typeof r.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let a=typeof r.allowDots>"u"?r.encodeDotInKeys?!0:q.allowDots:!!r.allowDots;return{addQueryPrefix:typeof r.addQueryPrefix=="boolean"?r.addQueryPrefix:q.addQueryPrefix,allowDots:a,allowEmptyArrays:typeof r.allowEmptyArrays=="boolean"?!!r.allowEmptyArrays:q.allowEmptyArrays,arrayFormat:o,charset:e,charsetSentinel:typeof r.charsetSentinel=="boolean"?r.charsetSentinel:q.charsetSentinel,commaRoundTrip:!!r.commaRoundTrip,delimiter:typeof r.delimiter>"u"?q.delimiter:r.delimiter,encode:typeof r.encode=="boolean"?r.encode:q.encode,encodeDotInKeys:typeof r.encodeDotInKeys=="boolean"?r.encodeDotInKeys:q.encodeDotInKeys,encoder:typeof r.encoder=="function"?r.encoder:q.encoder,encodeValuesOnly:typeof r.encodeValuesOnly=="boolean"?r.encodeValuesOnly:q.encodeValuesOnly,filter:n,format:t,formatter:s,serializeDate:typeof r.serializeDate=="function"?r.serializeDate:q.serializeDate,skipNulls:typeof r.skipNulls=="boolean"?r.skipNulls:q.skipNulls,sort:typeof r.sort=="function"?r.sort:null,strictNullHandling:typeof r.strictNullHandling=="boolean"?r.strictNullHandling:q.strictNullHandling}}function $o(r,e={}){let t=r,s=Ni(e),n,o;typeof s.filter=="function"?(o=s.filter,t=o("",t)):G(s.filter)&&(o=s.filter,n=o);let a=[];if(typeof t!="object"||t===null)return"";let l=Co[s.arrayFormat],d=l==="comma"&&s.commaRoundTrip;n||(n=Object.keys(t)),s.sort&&n.sort(s.sort);let p=new WeakMap;for(let h=0;h<n.length;++h){let w=n[h];s.skipNulls&&t[w]===null||So(a,ko(t[w],w,l,d,s.allowEmptyArrays,s.strictNullHandling,s.skipNulls,s.encodeDotInKeys,s.encode?s.encoder:null,s.filter,s.sort,s.allowDots,s.serializeDate,s.format,s.formatter,s.encodeValuesOnly,s.charset,p))}let m=a.join(s.delimiter),_=s.addQueryPrefix===!0?"?":"";return s.charsetSentinel&&(s.charset==="iso-8859-1"?_+="utf8=%26%2310003%3B&":_+="utf8=%E2%9C%93&"),m.length>0?_+m:""}function Oo(r){return $o(r,{arrayFormat:"brackets"})}function To(r){let e=0;for(let n of r)e+=n.length;let t=new Uint8Array(e),s=0;for(let n of r)t.set(n,s),s+=n.length;return t}var Eo;function re(r){let e;return(Eo??(e=new globalThis.TextEncoder,Eo=e.encode.bind(e)))(r)}var vo;function Rn(r){let e;return(vo??(e=new globalThis.TextDecoder,vo=e.decode.bind(e)))(r)}var se,ne,Ye=class{constructor(){se.set(this,void 0),ne.set(this,void 0),P(this,se,new Uint8Array,"f"),P(this,ne,null,"f")}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?re(e):e;P(this,se,To([c(this,se,"f"),t]),"f");let s=[],n;for(;(n=Ki(c(this,se,"f"),c(this,ne,"f")))!=null;){if(n.carriage&&c(this,ne,"f")==null){P(this,ne,n.index,"f");continue}if(c(this,ne,"f")!=null&&(n.index!==c(this,ne,"f")+1||n.carriage)){s.push(Rn(c(this,se,"f").subarray(0,c(this,ne,"f")-1))),P(this,se,c(this,se,"f").subarray(c(this,ne,"f")),"f"),P(this,ne,null,"f");continue}let o=c(this,ne,"f")!==null?n.preceding-1:n.preceding,a=Rn(c(this,se,"f").subarray(0,o));s.push(a),P(this,se,c(this,se,"f").subarray(n.index),"f"),P(this,ne,null,"f")}return s}flush(){return c(this,se,"f").length?this.decode(`
|
|
5
5
|
`):[]}};se=new WeakMap,ne=new WeakMap;Ye.NEWLINE_CHARS=new Set([`
|
|
6
6
|
`,"\r"]);Ye.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function Ki(r,e){for(let n=e??0;n<r.length;n++){if(r[n]===10)return{preceding:n,index:n+1,carriage:!1};if(r[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function Lo(r){for(let s=0;s<r.length-1;s++){if(r[s]===10&&r[s+1]===10||r[s]===13&&r[s+1]===13)return s+2;if(r[s]===13&&r[s+1]===10&&s+3<r.length&&r[s+2]===13&&r[s+3]===10)return s+4}return-1}var Ls={off:0,error:200,warn:300,info:400,debug:500},Cn=(r,e,t)=>{if(r){if(po(Ls,r))return r;B(t).warn(`${e} was set to ${JSON.stringify(r)}, expected one of ${JSON.stringify(Object.keys(Ls))}`)}};function ts(){}function Ts(r,e,t){return!e||Ls[r]>Ls[t]?ts:e[r].bind(e)}var Bi={error:ts,warn:ts,info:ts,debug:ts},jo=new WeakMap;function B(r){let e=r.logger,t=r.logLevel??"off";if(!e)return Bi;let s=jo.get(e);if(s&&s[0]===t)return s[1];let n={error:Ts("error",e,t),warn:Ts("warn",e,t),info:Ts("info",e,t),debug:Ts("debug",e,t)};return jo.set(e,[t,n]),n}var we=r=>(r.options&&(r.options={...r.options},delete r.options.headers),r.headers&&(r.headers=Object.fromEntries((r.headers instanceof Headers?[...r.headers]:Object.entries(r.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 r&&(r.retryOfRequestLogID&&(r.retryOf=r.retryOfRequestLogID),delete r.retryOfRequestLogID),r);var rs,ee=class r{constructor(e,t,s){this.iterator=e,rs.set(this,void 0),this.controller=t,P(this,rs,s,"f")}static fromSSEResponse(e,t,s,n){let o=!1,a=s?B(s):console;async function*l(){if(o)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");o=!0;let d=!1;try{for await(let p of Ui(e,t))if(!d){if(p.data.startsWith("[DONE]")){d=!0;continue}if(p.event===null||!p.event.startsWith("thread.")){let m;try{m=JSON.parse(p.data)}catch(_){throw a.error("Could not parse message into JSON:",p.data),a.error("From chunk:",p.raw),_}if(m&&m.error)throw new M(void 0,m.error,void 0,e.headers);yield n?{event:p.event,data:m}:m}else{let m;try{m=JSON.parse(p.data)}catch(_){throw console.error("Could not parse message into JSON:",p.data),console.error("From chunk:",p.raw),_}if(p.event=="error")throw new M(void 0,m.error,m.message,void 0);yield{event:p.event,data:m}}}d=!0}catch(p){if(Gr(p))return;throw p}finally{d||t.abort()}}return new r(l,t,s)}static fromReadableStream(e,t,s){let n=!1;async function*o(){let l=new Ye,d=e.getReader(),p=!1,m,_=()=>{m??(m=d.cancel()),m.catch(()=>{})};t.signal.addEventListener("abort",_,{once:!0});try{if(t.signal.aborted){_();return}for(;;){let{value:h,done:w}=await d.read();if(w){p=!0;break}if(t.signal.aborted)return;for(let x of l.decode(h)){if(t.signal.aborted)return;yield x}}if(t.signal.aborted)return;for(let h of l.flush()){if(t.signal.aborted)return;yield h}}finally{t.signal.removeEventListener("abort",_),p||_(),d.releaseLock()}}async function*a(){if(n)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");n=!0;let l=!1;try{for await(let d of o())l||d&&(yield JSON.parse(d));l=!0}catch(d){if(t.signal.aborted||Gr(d))return;throw d}finally{l||t.abort()}}return new r(a,t,s)}[(rs=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],t=[],s=this.iterator(),n=o=>({next:()=>{if(o.length===0){let a=s.next();e.push(a),t.push(a)}return o.shift()}});return[new r(()=>n(e),this.controller,c(this,rs,"f")),new r(()=>n(t),this.controller,c(this,rs,"f"))]}toReadableStream(){let e=this,t;return gn({async start(){t=e[Symbol.asyncIterator]()},async pull(s){try{let{value:n,done:o}=await t.next();if(o)return s.close();let a=re(JSON.stringify(n)+`
|
|
7
7
|
`);s.enqueue(a)}catch(n){s.error(n)}},async cancel(){await t.return?.()}})}};async function*Ui(r,e){if(!r.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new y("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 y("Attempted to iterate over a response with no body");let t=new Sn,s=new Ye,n=Es(r.body);for await(let o of zi(n))for(let a of s.decode(o)){let l=t.decode(a);l&&(yield l)}for(let o of s.flush()){let a=t.decode(o);a&&(yield a)}}async function*zi(r){let e=new Uint8Array;for await(let t of r){if(t==null)continue;let s=t instanceof ArrayBuffer?new Uint8Array(t):typeof t=="string"?re(t):t,n=new Uint8Array(e.length+s.length);n.set(e),n.set(s,e.length),e=n;let o;for(;(o=Lo(e))!==-1;)yield e.slice(0,o),e=e.slice(o)}e.length>0&&(yield e)}var Sn=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(`
|