nao-core 0.0.12__py3-none-any.whl → 0.0.14__py3-none-any.whl
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.
- nao_core/__init__.py +1 -1
- nao_core/bin/db.sqlite +0 -0
- nao_core/bin/fastapi/main.py +102 -0
- nao_core/bin/public/assets/_chatId-z5gRlor1.js +1 -0
- nao_core/bin/public/assets/chat-messages-DUR3D342.js +1 -0
- nao_core/bin/public/assets/index-BDlcD_HE.js +1 -0
- nao_core/bin/public/assets/index-Bc7icYyJ.css +1 -0
- nao_core/bin/public/assets/index-CGg3ZQH6.js +49 -0
- nao_core/bin/public/assets/{login-CGCfd7iQ.js → login-D87n9R5V.js} +1 -1
- nao_core/bin/public/assets/signinForm-9PY1Lvqj.js +1 -0
- nao_core/bin/public/assets/{signup-BGjbIX9B.js → signup-B7NC1g08.js} +1 -1
- nao_core/bin/public/index.html +2 -2
- nao_core/commands/chat.py +67 -25
- nao_core/commands/debug.py +0 -4
- nao_core/commands/init.py +3 -3
- nao_core/commands/sync.py +273 -44
- nao_core/config/__init__.py +13 -0
- nao_core/{config.py → config/base.py} +4 -66
- nao_core/config/databases/__init__.py +29 -0
- nao_core/config/databases/base.py +72 -0
- nao_core/config/databases/bigquery.py +42 -0
- nao_core/config/llm/__init__.py +16 -0
- {nao_core-0.0.12.dist-info → nao_core-0.0.14.dist-info}/METADATA +3 -1
- nao_core-0.0.14.dist-info/RECORD +39 -0
- nao_core/bin/public/assets/index-BUcR0FCx.css +0 -1
- nao_core/bin/public/assets/index-DDQ8i103.js +0 -14
- nao_core/bin/public/assets/index-nOBqrovO.js +0 -36
- nao_core/bin/public/assets/signinForm-BGrBZeLW.js +0 -1
- nao_core-0.0.12.dist-info/RECORD +0 -31
- {nao_core-0.0.12.dist-info → nao_core-0.0.14.dist-info}/WHEEL +0 -0
- {nao_core-0.0.12.dist-info → nao_core-0.0.14.dist-info}/entry_points.txt +0 -0
- {nao_core-0.0.12.dist-info → nao_core-0.0.14.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{q as Pe,y as to,r as $,j as z,v as te,B as Ir,z as kr,A as ro}from"./index-DDQ8i103.js";const no=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],oo=Pe("arrow-down",no);const ao=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],so=Pe("arrow-up",ao);const io=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],$t=Pe("bot",io);const co=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],uo=Pe("loader-circle",co);const lo=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],po=Pe("user",lo);var zr="vercel.ai.error",fo=Symbol.for(zr),At,Pt,ae=class Tr extends(Pt=Error,At=fo,Pt){constructor({name:t,message:r,cause:n}){super(r),this[At]=!0,this.name=t,this.cause=n}static isInstance(t){return Tr.hasMarker(t,zr)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};function xr(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Nr="AI_InvalidArgumentError",Or=`vercel.ai.error.${Nr}`,mo=Symbol.for(Or),Rt,jt,ho=class extends(jt=ae,Rt=mo,jt){constructor({message:e,cause:t,argument:r}){super({name:Nr,message:e,cause:t}),this[Rt]=!0,this.argument=r}static isInstance(e){return ae.hasMarker(e,Or)}},Zr="AI_JSONParseError",$r=`vercel.ai.error.${Zr}`,go=Symbol.for($r),Ct,Mt,Dt=class extends(Mt=ae,Ct=go,Mt){constructor({text:e,cause:t}){super({name:Zr,message:`JSON parsing failed: Text: ${e}.
|
|
2
|
-
Error message: ${xr(t)}`,cause:t}),this[Ct]=!0,this.text=e}static isInstance(e){return ae.hasMarker(e,$r)}},Ar="AI_TypeValidationError",Pr=`vercel.ai.error.${Ar}`,vo=Symbol.for(Pr),Lt,Ut,_e=class ht extends(Ut=ae,Lt=vo,Ut){constructor({value:t,cause:r}){super({name:Ar,message:`Type validation failed: Value: ${JSON.stringify(t)}.
|
|
3
|
-
Error message: ${xr(r)}`,cause:r}),this[Lt]=!0,this.value=t}static isInstance(t){return ae.hasMarker(t,Pr)}static wrap({value:t,cause:r}){return ht.isInstance(r)&&r.value===t?r:new ht({value:t,cause:r})}};function f(e,t,r){function n(i,u){if(i._zod||Object.defineProperty(i,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,u);const c=s.prototype,d=Object.keys(c);for(let l=0;l<d.length;l++){const v=d[l];v in i||(i[v]=c[v].bind(i))}}const o=r?.Parent??Object;class a extends o{}Object.defineProperty(a,"name",{value:e});function s(i){var u;const c=r?.Parent?new a:this;n(c,i),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class ve extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Rr extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const jr={};function se(e){return jr}function Cr(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function gt(e,t){return typeof t=="bigint"?t.toString():t}function et(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function It(e){return e==null}function kt(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function _o(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(n)){const u=n.match(/\d?e-(\d?)/);u?.[1]&&(o=Number.parseInt(u[1]))}const a=r>o?r:o,s=Number.parseInt(e.toFixed(a).replace(".","")),i=Number.parseInt(t.toFixed(a).replace(".",""));return s%i/10**a}const Ft=Symbol("evaluating");function Z(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Ft)return n===void 0&&(n=Ft,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function de(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function pe(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Jt(e){return JSON.stringify(e)}function yo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Mr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function xe(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const bo=et(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ye(e){if(xe(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(xe(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Dr(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e}const wo=new Set(["string","number","symbol"]);function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ce(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function So(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Eo={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Io(e,t){const r=e._zod.def,n=pe(e._zod.def,{get shape(){const o={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=r.shape[a])}return de(this,"shape",o),o},checks:[]});return ce(e,n)}function ko(e,t){const r=e._zod.def,n=pe(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return de(this,"shape",o),o},checks:[]});return ce(e,n)}function zo(e,t){if(!ye(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=pe(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return de(this,"shape",a),a},checks:[]});return ce(e,o)}function To(e,t){if(!ye(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return de(this,"shape",n),n},checks:e._zod.def.checks};return ce(e,r)}function xo(e,t){const r=pe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return de(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ce(e,r)}function No(e,t,r){const n=pe(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(a[s]=e?new e({type:"optional",innerType:o[s]}):o[s])}else for(const s in o)a[s]=e?new e({type:"optional",innerType:o[s]}):o[s];return de(this,"shape",a),a},checks:[]});return ce(t,n)}function Oo(e,t,r){const n=pe(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(r)for(const s in r){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(a[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)a[s]=new e({type:"nonoptional",innerType:o[s]});return de(this,"shape",a),a},checks:[]});return ce(t,n)}function he(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ge(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Me(e){return typeof e=="string"?e:e?.message}function ie(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const o=Me(e.inst?._zod.def?.error?.(e))??Me(t?.error?.(e))??Me(r.customError?.(e))??Me(r.localeError?.(e))??"Invalid input";n.message=o}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function zt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ne(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const Lr=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,gt,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ur=f("$ZodError",Lr),Fr=f("$ZodError",Lr,{Parent:Error});function Zo(e,t=r=>r.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}function $o(e,t=r=>r.message){const r={_errors:[]},n=o=>{for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(s=>n({issues:s}));else if(a.code==="invalid_key")n({issues:a.issues});else if(a.code==="invalid_element")n({issues:a.issues});else if(a.path.length===0)r._errors.push(t(a));else{let s=r,i=0;for(;i<a.path.length;){const u=a.path[i];i===a.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(t(a))):s[u]=s[u]||{_errors:[]},s=s[u],i++}}};return n(e),r}const Tt=e=>(t,r,n,o)=>{const a=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new ve;if(s.issues.length){const i=new(o?.Err??e)(s.issues.map(u=>ie(u,a,se())));throw Mr(i,o?.callee),i}return s.value},xt=e=>async(t,r,n,o)=>{const a=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise&&(s=await s),s.issues.length){const i=new(o?.Err??e)(s.issues.map(u=>ie(u,a,se())));throw Mr(i,o?.callee),i}return s.value},tt=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new ve;return a.issues.length?{success:!1,error:new(e??Ur)(a.issues.map(s=>ie(s,o,se())))}:{success:!0,data:a.value}},Ao=tt(Fr),rt=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(s=>ie(s,o,se())))}:{success:!0,data:a.value}},Po=rt(Fr),Ro=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Tt(e)(t,r,o)},jo=e=>(t,r,n)=>Tt(e)(t,r,n),Co=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return xt(e)(t,r,o)},Mo=e=>async(t,r,n)=>xt(e)(t,r,n),Do=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return tt(e)(t,r,o)},Lo=e=>(t,r,n)=>tt(e)(t,r,n),Uo=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return rt(e)(t,r,o)},Fo=e=>async(t,r,n)=>rt(e)(t,r,n),Jo=/^[cC][^\s-]{8,}$/,Bo=/^[0-9a-z]+$/,Vo=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qo=/^[0-9a-vA-V]{20}$/,Wo=/^[A-Za-z0-9]{27}$/,Go=/^[a-zA-Z0-9_-]{21}$/,Yo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ho=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Bt=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Xo=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ko="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Qo(){return new RegExp(Ko,"u")}const ea=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ta=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ra=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,na=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,oa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jr=/^[A-Za-z0-9_-]*$/,aa=/^\+(?:[0-9]){6,14}[0-9]$/,Br="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sa=new RegExp(`^${Br}$`);function Vr(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ia(e){return new RegExp(`^${Vr(e)}$`)}function ca(e){const t=Vr({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Br}T(?:${n})$`)}const ua=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},la=/^-?\d+$/,da=/^-?\d+(?:\.\d+)?/,pa=/^(?:true|false)$/i,fa=/^null$/i,ma=/^[^A-Z]*$/,ha=/^[^a-z]*$/,W=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),qr={number:"number",bigint:"bigint",object:"date"},Wr=f("$ZodCheckLessThan",(e,t)=>{W.init(e,t);const r=qr[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,a=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Gr=f("$ZodCheckGreaterThan",(e,t)=>{W.init(e,t);const r=qr[typeof t.value];e._zod.onattach.push(n=>{const o=n._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ga=f("$ZodCheckMultipleOf",(e,t)=>{W.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):_o(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),va=f("$ZodCheckNumberFormat",(e,t)=>{W.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,a]=Eo[t.format];e._zod.onattach.push(s=>{const i=s._zod.bag;i.format=t.format,i.minimum=o,i.maximum=a,r&&(i.pattern=la)}),e._zod.check=s=>{const i=s.value;if(r){if(!Number.isInteger(i)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){i>0?s.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort}):s.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,continue:!t.abort});return}}i<o&&s.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>a&&s.issues.push({origin:"number",input:i,code:"too_big",maximum:a,inst:e})}}),_a=f("$ZodCheckMaxLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!It(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const o=n.value;if(o.length<=t.maximum)return;const s=zt(o);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ya=f("$ZodCheckMinLength",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!It(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const o=n.value;if(o.length>=t.minimum)return;const s=zt(o);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ba=f("$ZodCheckLengthEquals",(e,t)=>{var r;W.init(e,t),(r=e._zod.def).when??(r.when=n=>{const o=n.value;return!It(o)&&o.length!==void 0}),e._zod.onattach.push(n=>{const o=n._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=n=>{const o=n.value,a=o.length;if(a===t.length)return;const s=zt(o),i=a>t.length;n.issues.push({origin:s,...i?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),nt=f("$ZodCheckStringFormat",(e,t)=>{var r,n;W.init(e,t),e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),wa=f("$ZodCheckRegex",(e,t)=>{nt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Sa=f("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ma),nt.init(e,t)}),Ea=f("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ha),nt.init(e,t)}),Ia=f("$ZodCheckIncludes",(e,t)=>{W.init(e,t);const r=be(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(o=>{const a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ka=f("$ZodCheckStartsWith",(e,t)=>{W.init(e,t);const r=new RegExp(`^${be(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),za=f("$ZodCheckEndsWith",(e,t)=>{W.init(e,t);const r=new RegExp(`.*${be(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Ta=f("$ZodCheckOverwrite",(e,t)=>{W.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class xa{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const n=t.split(`
|
|
4
|
-
`).filter(s=>s),o=Math.min(...n.map(s=>s.length-s.trimStart().length)),a=n.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of a)this.content.push(s)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,o.join(`
|
|
5
|
-
`))}}const Na={major:4,minor:2,patch:1},M=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Na;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const a of o._zod.onattach)a(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,i,u)=>{let c=he(s),d;for(const l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;const v=s.issues.length,h=l._zod.check(s);if(h instanceof Promise&&u?.async===!1)throw new ve;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,s.issues.length!==v&&(c||(c=he(s,v)))});else{if(s.issues.length===v)continue;c||(c=he(s,v))}}return d?d.then(()=>s):s},a=(s,i,u)=>{if(he(s))return s.aborted=!0,s;const c=o(i,n,u);if(c instanceof Promise){if(u.async===!1)throw new ve;return c.then(d=>e._zod.parse(d,u))}return e._zod.parse(c,u)};e._zod.run=(s,i)=>{if(i.skipChecks)return e._zod.parse(s,i);if(i.direction==="backward"){const c=e._zod.parse({value:s.value,issues:[]},{...i,skipChecks:!0});return c instanceof Promise?c.then(d=>a(d,s,i)):a(c,s,i)}const u=e._zod.parse(s,i);if(u instanceof Promise){if(i.async===!1)throw new ve;return u.then(c=>o(c,n,i))}return o(u,n,i)}}e["~standard"]={validate:o=>{try{const a=Ao(e,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Po(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}}),Nt=f("$ZodString",(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ua(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),D=f("$ZodStringFormat",(e,t)=>{nt.init(e,t),Nt.init(e,t)}),Oa=f("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ho),D.init(e,t)}),Za=f("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Bt(n))}else t.pattern??(t.pattern=Bt());D.init(e,t)}),$a=f("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xo),D.init(e,t)}),Aa=f("$ZodURL",(e,t)=>{D.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Pa=f("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Qo()),D.init(e,t)}),Ra=f("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Go),D.init(e,t)}),ja=f("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Jo),D.init(e,t)}),Ca=f("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Bo),D.init(e,t)}),Ma=f("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Vo),D.init(e,t)}),Da=f("$ZodXID",(e,t)=>{t.pattern??(t.pattern=qo),D.init(e,t)}),La=f("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wo),D.init(e,t)}),Ua=f("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=ca(t)),D.init(e,t)}),Fa=f("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sa),D.init(e,t)}),Ja=f("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ia(t)),D.init(e,t)}),Ba=f("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Yo),D.init(e,t)}),Va=f("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ea),D.init(e,t),e._zod.bag.format="ipv4"}),qa=f("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ta),D.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Wa=f("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ra),D.init(e,t)}),Ga=f("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=na),D.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[o,a]=n;if(!a)throw new Error;const s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Yr(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ya=f("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=oa),D.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Yr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ha(e){if(!Jr.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Yr(r)}const Xa=f("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Jr),D.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ha(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ka=f("$ZodE164",(e,t)=>{t.pattern??(t.pattern=aa),D.init(e,t)});function Qa(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const es=f("$ZodJWT",(e,t)=>{D.init(e,t),e._zod.check=r=>{Qa(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Hr=f("$ZodNumber",(e,t)=>{M.init(e,t),e._zod.pattern=e._zod.bag.pattern??da,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;const a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...a?{received:a}:{}}),r}}),ts=f("$ZodNumberFormat",(e,t)=>{va.init(e,t),Hr.init(e,t)}),rs=f("$ZodBoolean",(e,t)=>{M.init(e,t),e._zod.pattern=pa,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),ns=f("$ZodNull",(e,t)=>{M.init(e,t),e._zod.pattern=fa,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),os=f("$ZodUnknown",(e,t)=>{M.init(e,t),e._zod.parse=r=>r}),as=f("$ZodNever",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Vt(e,t,r){e.issues.length&&t.issues.push(...ge(r,e.issues)),t.value[r]=e.value}const ss=f("$ZodArray",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const a=[];for(let s=0;s<o.length;s++){const i=o[s],u=t.element._zod.run({value:i,issues:[]},n);u instanceof Promise?a.push(u.then(c=>Vt(c,r,s))):Vt(u,r,s)}return a.length?Promise.all(a).then(()=>r):r}});function Be(e,t,r,n){e.issues.length&&t.issues.push(...ge(r,e.issues)),e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function Xr(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=So(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Kr(e,t,r,n,o,a){const s=[],i=o.keySet,u=o.catchall._zod,c=u.def.type;for(const d in t){if(i.has(d))continue;if(c==="never"){s.push(d);continue}const l=u.run({value:t[d],issues:[]},n);l instanceof Promise?e.push(l.then(v=>Be(v,r,d,t))):Be(l,r,d,t)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}const is=f("$ZodObject",(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const i=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u={...i};return Object.defineProperty(t,"shape",{value:u}),u}})}const n=et(()=>Xr(t));Z(e._zod,"propValues",()=>{const i=t.shape,u={};for(const c in i){const d=i[c]._zod;if(d.values){u[c]??(u[c]=new Set);for(const l of d.values)u[c].add(l)}}return u});const o=xe,a=t.catchall;let s;e._zod.parse=(i,u)=>{s??(s=n.value);const c=i.value;if(!o(c))return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;i.value={};const d=[],l=s.shape;for(const v of s.keys){const T=l[v]._zod.run({value:c[v],issues:[]},u);T instanceof Promise?d.push(T.then(w=>Be(w,i,v,c))):Be(T,i,v,c)}return a?Kr(d,c,i,u,n.value,e):d.length?Promise.all(d).then(()=>i):i}}),cs=f("$ZodObjectJIT",(e,t)=>{is.init(e,t);const r=e._zod.parse,n=et(()=>Xr(t)),o=v=>{const h=new xa(["shape","payload","ctx"]),T=n.value,w=p=>{const b=Jt(p);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let E=0;for(const p of T.keys)g[p]=`key_${E++}`;h.write("const newResult = {};");for(const p of T.keys){const b=g[p],I=Jt(p);h.write(`const ${b} = ${w(p)};`),h.write(`
|
|
6
|
-
if (${b}.issues.length) {
|
|
7
|
-
payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
8
|
-
...iss,
|
|
9
|
-
path: iss.path ? [${I}, ...iss.path] : [${I}]
|
|
10
|
-
})));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (${b}.value === undefined) {
|
|
15
|
-
if (${I} in input) {
|
|
16
|
-
newResult[${I}] = undefined;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
newResult[${I}] = ${b}.value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const _=h.compile();return(p,b)=>_(v,p,b)};let a;const s=xe,i=!jr.jitless,c=i&&bo.value,d=t.catchall;let l;e._zod.parse=(v,h)=>{l??(l=n.value);const T=v.value;return s(T)?i&&c&&h?.async===!1&&h.jitless!==!0?(a||(a=o(t.shape)),v=a(v,h),d?Kr([],T,v,h,l,e):v):r(v,h):(v.issues.push({expected:"object",code:"invalid_type",input:T,inst:e}),v)}});function qt(e,t,r,n){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const o=e.filter(a=>!he(a));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(a=>a.issues.map(s=>ie(s,n,se())))}),t)}const Qr=f("$ZodUnion",(e,t)=>{M.init(e,t),Z(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Z(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${o.map(a=>kt(a.source)).join("|")})$`)}});const r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,a)=>{if(r)return n(o,a);let s=!1;const i=[];for(const u of t.options){const c=u._zod.run({value:o.value,issues:[]},a);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(u=>qt(u,o,e,a)):qt(i,o,e,a)}}),us=f("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Qr.init(e,t);const r=e._zod.parse;Z(e._zod,"propValues",()=>{const o={};for(const a of t.options){const s=a._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[i,u]of Object.entries(s)){o[i]||(o[i]=new Set);for(const c of u)o[i].add(c)}}return o});const n=et(()=>{const o=t.options,a=new Map;for(const s of o){const i=s._zod.propValues?.[t.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const u of i){if(a.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);a.set(u,s)}}return a});e._zod.parse=(o,a)=>{const s=o.value;if(!xe(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const i=n.value.get(s?.[t.discriminator]);return i?i._zod.run(o,a):t.unionFallback?r(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),ls=f("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value,a=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);return a instanceof Promise||s instanceof Promise?Promise.all([a,s]).then(([u,c])=>Wt(r,u,c)):Wt(r,a,s)}});function vt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ye(e)&&ye(t)){const r=Object.keys(t),n=Object.keys(e).filter(a=>r.indexOf(a)!==-1),o={...e,...t};for(const a of n){const s=vt(e[a],t[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};o[a]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=e[n],a=t[n],s=vt(o,a);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Wt(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),he(e))return e;const n=vt(t.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return e.value=n.data,e}const ds=f("$ZodRecord",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!ye(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const a=[],s=t.keyType._zod.values;if(s){r.value={};const i=new Set;for(const c of s)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){i.add(typeof c=="number"?c.toString():c);const d=t.valueType._zod.run({value:o[c],issues:[]},n);d instanceof Promise?a.push(d.then(l=>{l.issues.length&&r.issues.push(...ge(c,l.issues)),r.value[c]=l.value})):(d.issues.length&&r.issues.push(...ge(c,d.issues)),r.value[c]=d.value)}let u;for(const c in o)i.has(c)||(u=u??[],u.push(c));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{r.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const u=t.keyType._zod.run({value:i,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){t.mode==="loose"?r.value[i]=o[i]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>ie(d,n,se())),input:i,path:[i],inst:e});continue}const c=t.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?a.push(c.then(d=>{d.issues.length&&r.issues.push(...ge(i,d.issues)),r.value[u.value]=d.value})):(c.issues.length&&r.issues.push(...ge(i,c.issues)),r.value[u.value]=c.value)}}return a.length?Promise.all(a).then(()=>r):r}}),ps=f("$ZodEnum",(e,t)=>{M.init(e,t);const r=Cr(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>wo.has(typeof o)).map(o=>typeof o=="string"?be(o):o.toString()).join("|")})$`),e._zod.parse=(o,a)=>{const s=o.value;return n.has(s)||o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),fs=f("$ZodLiteral",(e,t)=>{if(M.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?be(n):n?be(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{const a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),n}}),ms=f("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Rr(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(r.value=s,r));if(o instanceof Promise)throw new ve;return r.value=o,r}});function Gt(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hs=f("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Z(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${kt(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Gt(a,r.value)):Gt(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),gs=f("$ZodNullable",(e,t)=>{M.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${kt(r.source)}|null)$`):void 0}),Z(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),vs=f("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Yt(a,t)):Yt(o,t)}});function Yt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const _s=f("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ys=f("$ZodNonOptional",(e,t)=>{M.init(e,t),Z(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>Ht(a,e)):Ht(o,e)}});function Ht(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const bs=f("$ZodCatch",(e,t)=>{M.init(e,t),Z(e._zod,"optin",()=>t.innerType._zod.optin),Z(e._zod,"optout",()=>t.innerType._zod.optout),Z(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(a=>(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(s=>ie(s,n,se()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>ie(a,n,se()))},input:r.value}),r.issues=[]),r)}}),ws=f("$ZodPipe",(e,t)=>{M.init(e,t),Z(e._zod,"values",()=>t.in._zod.values),Z(e._zod,"optin",()=>t.in._zod.optin),Z(e._zod,"optout",()=>t.out._zod.optout),Z(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const a=t.out._zod.run(r,n);return a instanceof Promise?a.then(s=>De(s,t.in,n)):De(a,t.in,n)}const o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>De(a,t.out,n)):De(o,t.out,n)}});function De(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Ss=f("$ZodReadonly",(e,t)=>{M.init(e,t),Z(e._zod,"propValues",()=>t.innerType._zod.propValues),Z(e._zod,"values",()=>t.innerType._zod.values),Z(e._zod,"optin",()=>t.innerType?._zod?.optin),Z(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Xt):Xt(o)}});function Xt(e){return e.value=Object.freeze(e.value),e}const Es=f("$ZodLazy",(e,t)=>{M.init(e,t),Z(e._zod,"innerType",()=>t.getter()),Z(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Z(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Z(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Z(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Is=f("$ZodCustom",(e,t)=>{W.init(e,t),M.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(a=>Kt(a,r,n,e));Kt(o,r,n,e)}});function Kt(e,t,r,n){if(!e){const o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Ne(o))}}var Qt;class ks{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function zs(){return new ks}(Qt=globalThis).__zod_globalRegistry??(Qt.__zod_globalRegistry=zs());const Ie=globalThis.__zod_globalRegistry;function Ts(e,t){return new e({type:"string",...y(t)})}function xs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...y(t)})}function er(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...y(t)})}function Ns(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...y(t)})}function Os(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...y(t)})}function Zs(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...y(t)})}function $s(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...y(t)})}function As(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...y(t)})}function Ps(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...y(t)})}function Rs(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...y(t)})}function js(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...y(t)})}function Cs(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...y(t)})}function Ms(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...y(t)})}function Ds(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...y(t)})}function Ls(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...y(t)})}function Us(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...y(t)})}function Fs(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...y(t)})}function Js(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...y(t)})}function Bs(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...y(t)})}function Vs(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...y(t)})}function qs(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...y(t)})}function Ws(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...y(t)})}function Gs(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...y(t)})}function Ys(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...y(t)})}function Hs(e,t){return new e({type:"string",format:"date",check:"string_format",...y(t)})}function Xs(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...y(t)})}function Ks(e,t){return new e({type:"string",format:"duration",check:"string_format",...y(t)})}function Qs(e,t){return new e({type:"number",checks:[],...y(t)})}function ei(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...y(t)})}function ti(e,t){return new e({type:"boolean",...y(t)})}function ri(e,t){return new e({type:"null",...y(t)})}function ni(e){return new e({type:"unknown"})}function oi(e,t){return new e({type:"never",...y(t)})}function tr(e,t){return new Wr({check:"less_than",...y(t),value:e,inclusive:!1})}function it(e,t){return new Wr({check:"less_than",...y(t),value:e,inclusive:!0})}function rr(e,t){return new Gr({check:"greater_than",...y(t),value:e,inclusive:!1})}function ct(e,t){return new Gr({check:"greater_than",...y(t),value:e,inclusive:!0})}function nr(e,t){return new ga({check:"multiple_of",...y(t),value:e})}function en(e,t){return new _a({check:"max_length",...y(t),maximum:e})}function Ve(e,t){return new ya({check:"min_length",...y(t),minimum:e})}function tn(e,t){return new ba({check:"length_equals",...y(t),length:e})}function ai(e,t){return new wa({check:"string_format",format:"regex",...y(t),pattern:e})}function si(e){return new Sa({check:"string_format",format:"lowercase",...y(e)})}function ii(e){return new Ea({check:"string_format",format:"uppercase",...y(e)})}function ci(e,t){return new Ia({check:"string_format",format:"includes",...y(t),includes:e})}function ui(e,t){return new ka({check:"string_format",format:"starts_with",...y(t),prefix:e})}function li(e,t){return new za({check:"string_format",format:"ends_with",...y(t),suffix:e})}function we(e){return new Ta({check:"overwrite",tx:e})}function di(e){return we(t=>t.normalize(e))}function pi(){return we(e=>e.trim())}function fi(){return we(e=>e.toLowerCase())}function mi(){return we(e=>e.toUpperCase())}function hi(){return we(e=>yo(e))}function gi(e,t,r){return new e({type:"array",element:t,...y(r)})}function vi(e,t,r){const n=y(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function _i(e,t,r){return new e({type:"custom",check:"custom",fn:t,...y(r)})}function yi(e){const t=bi(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Ne(n,r.value,t._zod.def));else{const o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Ne(o))}},e(r.value,r)));return t}function bi(e,t){const r=new W({check:"custom",...y(t)});return r._zod.check=e,r}function qe(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ie,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function C(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const i=e._zod.toJSONSchema?.();if(i)s.schema=i;else{const d={...r,schemaPath:[...r.schemaPath,e],path:r.path},l=e._zod.parent;if(l)s.ref=l,C(l,t,d),t.seen.get(l).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{const v=s.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,v,d)}}const u=t.metadataRegistry.get(e);return u&&Object.assign(s.schema,u),t.io==="input"&&B(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function We(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=a=>{const s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(a[0])?.id,l=e.external.uri??(h=>h);if(d)return{ref:l(d)};const v=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=v,{defId:v,ref:`${l("__shared")}#/${s}/${v}`}}if(a[1]===r)return{ref:"#"};const u=`#/${s}/`,c=a[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:u+c}},o=a=>{if(a[1].schema.$ref)return;const s=a[1],{ref:i,defId:u}=n(a);s.def={...s.schema},u&&(s.defId=u);const c=s.schema;for(const d in c)delete c[d];c.$ref=i};if(e.cycles==="throw")for(const a of e.seen.entries()){const s=a[1];if(s.cycle)throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
23
|
-
|
|
24
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const s=a[1];if(t===a[0]){o(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(s.cycle){o(a);continue}if(s.count>1&&e.reused==="ref"){o(a);continue}}}function Ge(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=s=>{const i=e.seen.get(s),u=i.def??i.schema,c={...u};if(i.ref===null)return;const d=i.ref;if(i.ref=null,d){n(d);const l=e.seen.get(d).schema;l.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(l)):(Object.assign(u,l),Object.assign(u,c))}i.isParent||e.override({zodSchema:s,jsonSchema:u,path:i.path??[]})};for(const s of[...e.seen.entries()].reverse())n(s[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,r.def??r.schema);const a=e.external?.defs??{};for(const s of e.seen.entries()){const i=s[1];i.def&&i.defId&&(a[i.defId]=i.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ye(t,"input"),output:Ye(t,"output")}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function B(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return B(n.element,r);if(n.type==="set")return B(n.valueType,r);if(n.type==="lazy")return B(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return B(n.innerType,r);if(n.type==="intersection")return B(n.left,r)||B(n.right,r);if(n.type==="record"||n.type==="map")return B(n.keyType,r)||B(n.valueType,r);if(n.type==="pipe")return B(n.in,r)||B(n.out,r);if(n.type==="object"){for(const o in n.shape)if(B(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(const o of n.options)if(B(o,r))return!0;return!1}if(n.type==="tuple"){for(const o of n.items)if(B(o,r))return!0;return!!(n.rest&&B(n.rest,r))}return!1}const wi=(e,t={})=>r=>{const n=qe({...r,processors:t});return C(e,n),We(n,e),Ge(n,e)},Ye=(e,t)=>r=>{const{libraryOptions:n,target:o}=r??{},a=qe({...n??{},target:o,io:t,processors:{}});return C(e,a),We(a,e),Ge(a,e)},Si={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},rn=(e,t,r,n)=>{const o=r;o.type="string";const{minimum:a,maximum:s,format:i,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof a=="number"&&(o.minLength=a),typeof s=="number"&&(o.maxLength=s),i&&(o.format=Si[i]??i,o.format===""&&delete o.format),c&&(o.contentEncoding=c),u&&u.size>0){const d=[...u];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(l=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},nn=(e,t,r,n)=>{const o=r,{minimum:a,maximum:s,format:i,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;typeof i=="string"&&i.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof a=="number"&&(o.minimum=a,typeof d=="number"&&t.target!=="draft-04"&&(d>=a?delete o.minimum:delete o.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c),typeof s=="number"&&(o.maximum=s,typeof c=="number"&&t.target!=="draft-04"&&(c<=s?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},on=(e,t,r,n)=>{r.type="boolean"},Ei=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Ii=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},an=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},ki=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},zi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},sn=(e,t,r,n)=>{r.not={}},Ti=(e,t,r,n)=>{},cn=(e,t,r,n)=>{},xi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},un=(e,t,r,n)=>{const o=e._zod.def,a=Cr(o.entries);a.every(s=>typeof s=="number")&&(r.type="number"),a.every(s=>typeof s=="string")&&(r.type="string"),r.enum=a},ln=(e,t,r,n)=>{const o=e._zod.def,a=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(s))}else a.push(s);if(a.length!==0)if(a.length===1){const s=a[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else a.every(s=>typeof s=="number")&&(r.type="number"),a.every(s=>typeof s=="string")&&(r.type="string"),a.every(s=>typeof s=="boolean")&&(r.type="boolean"),a.every(s=>s===null)&&(r.type="null"),r.enum=a},Ni=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Oi=(e,t,r,n)=>{const o=r,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=a.source},Zi=(e,t,r,n)=>{const o=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:i,mime:u}=e._zod.bag;s!==void 0&&(a.minLength=s),i!==void 0&&(a.maxLength=i),u?u.length===1?(a.contentMediaType=u[0],Object.assign(o,a)):o.anyOf=u.map(c=>({...a,contentMediaType:c})):Object.assign(o,a)},$i=(e,t,r,n)=>{r.type="boolean"},dn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ai=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},pn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Pi=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Ri=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},fn=(e,t,r,n)=>{const o=r,a=e._zod.def,{minimum:s,maximum:i}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof i=="number"&&(o.maxItems=i),o.type="array",o.items=C(a.element,t,{...n,path:[...n.path,"items"]})},mn=(e,t,r,n)=>{const o=r,a=e._zod.def;o.type="object",o.properties={};const s=a.shape;for(const c in s)o.properties[c]=C(s[c],t,{...n,path:[...n.path,"properties",c]});const i=new Set(Object.keys(s)),u=new Set([...i].filter(c=>{const d=a.shape[c]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(o.required=Array.from(u)),a.catchall?._zod.def.type==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=C(a.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},hn=(e,t,r,n)=>{const o=e._zod.def,a=o.inclusive===!1,s=o.options.map((i,u)=>C(i,t,{...n,path:[...n.path,a?"oneOf":"anyOf",u]}));a?r.oneOf=s:r.anyOf=s},gn=(e,t,r,n)=>{const o=e._zod.def,a=C(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=C(o.right,t,{...n,path:[...n.path,"allOf",1]}),i=c=>"allOf"in c&&Object.keys(c).length===1,u=[...i(a)?a.allOf:[a],...i(s)?s.allOf:[s]];r.allOf=u},ji=(e,t,r,n)=>{const o=r,a=e._zod.def;o.type="array";const s=t.target==="draft-2020-12"?"prefixItems":"items",i=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=a.items.map((v,h)=>C(v,t,{...n,path:[...n.path,s,h]})),c=a.rest?C(a.rest,t,{...n,path:[...n.path,i,...t.target==="openapi-3.0"?[a.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=u,c&&(o.items=c)):t.target==="openapi-3.0"?(o.items={anyOf:u},c&&o.items.anyOf.push(c),o.minItems=u.length,c||(o.maxItems=u.length)):(o.items=u,c&&(o.additionalItems=c));const{minimum:d,maximum:l}=e._zod.bag;typeof d=="number"&&(o.minItems=d),typeof l=="number"&&(o.maxItems=l)},vn=(e,t,r,n)=>{const o=r,a=e._zod.def;o.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=C(a.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=C(a.valueType,t,{...n,path:[...n.path,"additionalProperties"]})},_n=(e,t,r,n)=>{const o=e._zod.def,a=C(o.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},yn=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType},bn=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},wn=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Sn=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},En=(e,t,r,n)=>{const o=e._zod.def,a=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;C(a,t,n);const s=t.seen.get(e);s.ref=a},In=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType,r.readOnly=!0},Ci=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType},kn=(e,t,r,n)=>{const o=e._zod.def;C(o.innerType,t,n);const a=t.seen.get(e);a.ref=o.innerType},zn=(e,t,r,n)=>{const o=e._zod.innerType;C(o,t,n);const a=t.seen.get(e);a.ref=o},or={string:rn,number:nn,boolean:on,bigint:Ei,symbol:Ii,null:an,undefined:ki,void:zi,never:sn,any:Ti,unknown:cn,date:xi,enum:un,literal:ln,nan:Ni,template_literal:Oi,file:Zi,success:$i,custom:dn,function:Ai,transform:pn,map:Pi,set:Ri,array:fn,object:mn,union:hn,intersection:gn,tuple:ji,record:vn,nullable:_n,nonoptional:yn,default:bn,prefault:wn,catch:Sn,pipe:En,readonly:In,promise:Ci,optional:kn,lazy:zn};function Mi(e,t){if("_idmap"in e){const n=e,o=qe({...t,processors:or}),a={};for(const u of n._idmap.entries()){const[c,d]=u;C(d,o)}const s={},i={registry:n,uri:t?.uri,defs:a};o.external=i;for(const u of n._idmap.entries()){const[c,d]=u;We(o,d),s[c]=Ge(o,d)}if(Object.keys(a).length>0){const u=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:a}}return{schemas:s}}const r=qe({...t,processors:or});return C(e,r),We(r,e),Ge(r,e)}const Di=f("ZodISODateTime",(e,t)=>{Ua.init(e,t),U.init(e,t)});function Li(e){return Ys(Di,e)}const Ui=f("ZodISODate",(e,t)=>{Fa.init(e,t),U.init(e,t)});function Fi(e){return Hs(Ui,e)}const Ji=f("ZodISOTime",(e,t)=>{Ja.init(e,t),U.init(e,t)});function Bi(e){return Xs(Ji,e)}const Vi=f("ZodISODuration",(e,t)=>{Ba.init(e,t),U.init(e,t)});function qi(e){return Ks(Vi,e)}const Wi=(e,t)=>{Ur.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>$o(e,r)},flatten:{value:r=>Zo(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,gt,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,gt,2)}},isEmpty:{get(){return e.issues.length===0}}})},H=f("ZodError",Wi,{Parent:Error}),Gi=Tt(H),Yi=xt(H),Hi=tt(H),Tn=rt(H),Xi=Ro(H),Ki=jo(H),Qi=Co(H),ec=Mo(H),tc=Do(H),rc=Lo(H),nc=Uo(H),oc=Fo(H),L=f("ZodType",(e,t)=>(M.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ye(e,"input"),output:Ye(e,"output")}}),e.toJSONSchema=wi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(pe(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>ce(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Gi(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>Hi(e,r,n),e.parseAsync=async(r,n)=>Yi(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Tn(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Xi(e,r,n),e.decode=(r,n)=>Ki(e,r,n),e.encodeAsync=async(r,n)=>Qi(e,r,n),e.decodeAsync=async(r,n)=>ec(e,r,n),e.safeEncode=(r,n)=>tc(e,r,n),e.safeDecode=(r,n)=>rc(e,r,n),e.safeEncodeAsync=async(r,n)=>nc(e,r,n),e.safeDecodeAsync=async(r,n)=>oc(e,r,n),e.refine=(r,n)=>e.check(Kc(r,n)),e.superRefine=r=>e.check(Qc(r)),e.overwrite=r=>e.check(we(r)),e.optional=()=>ir(e),e.nullable=()=>cr(e),e.nullish=()=>ir(cr(e)),e.nonoptional=r=>Bc(e,r),e.array=()=>Se(e),e.or=r=>q([e,r]),e.and=r=>Pc(e,r),e.transform=r=>ur(e,Mc(r)),e.default=r=>Uc(e,r),e.prefault=r=>Jc(e,r),e.catch=r=>qc(e,r),e.pipe=r=>ur(e,r),e.readonly=()=>Yc(e),e.describe=r=>{const n=e.clone();return Ie.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return Ie.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Ie.get(e);const n=e.clone();return Ie.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),xn=f("_ZodString",(e,t)=>{Nt.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,a)=>rn(e,n,o);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(ai(...n)),e.includes=(...n)=>e.check(ci(...n)),e.startsWith=(...n)=>e.check(ui(...n)),e.endsWith=(...n)=>e.check(li(...n)),e.min=(...n)=>e.check(Ve(...n)),e.max=(...n)=>e.check(en(...n)),e.length=(...n)=>e.check(tn(...n)),e.nonempty=(...n)=>e.check(Ve(1,...n)),e.lowercase=n=>e.check(si(n)),e.uppercase=n=>e.check(ii(n)),e.trim=()=>e.check(pi()),e.normalize=(...n)=>e.check(di(...n)),e.toLowerCase=()=>e.check(fi()),e.toUpperCase=()=>e.check(mi()),e.slugify=()=>e.check(hi())}),ac=f("ZodString",(e,t)=>{Nt.init(e,t),xn.init(e,t),e.email=r=>e.check(xs(sc,r)),e.url=r=>e.check(As(ic,r)),e.jwt=r=>e.check(Gs(Sc,r)),e.emoji=r=>e.check(Ps(cc,r)),e.guid=r=>e.check(er(ar,r)),e.uuid=r=>e.check(Ns(Le,r)),e.uuidv4=r=>e.check(Os(Le,r)),e.uuidv6=r=>e.check(Zs(Le,r)),e.uuidv7=r=>e.check($s(Le,r)),e.nanoid=r=>e.check(Rs(uc,r)),e.guid=r=>e.check(er(ar,r)),e.cuid=r=>e.check(js(lc,r)),e.cuid2=r=>e.check(Cs(dc,r)),e.ulid=r=>e.check(Ms(pc,r)),e.base64=r=>e.check(Vs(yc,r)),e.base64url=r=>e.check(qs(bc,r)),e.xid=r=>e.check(Ds(fc,r)),e.ksuid=r=>e.check(Ls(mc,r)),e.ipv4=r=>e.check(Us(hc,r)),e.ipv6=r=>e.check(Fs(gc,r)),e.cidrv4=r=>e.check(Js(vc,r)),e.cidrv6=r=>e.check(Bs(_c,r)),e.e164=r=>e.check(Ws(wc,r)),e.datetime=r=>e.check(Li(r)),e.date=r=>e.check(Fi(r)),e.time=r=>e.check(Bi(r)),e.duration=r=>e.check(qi(r))});function m(e){return Ts(ac,e)}const U=f("ZodStringFormat",(e,t)=>{D.init(e,t),xn.init(e,t)}),sc=f("ZodEmail",(e,t)=>{$a.init(e,t),U.init(e,t)}),ar=f("ZodGUID",(e,t)=>{Oa.init(e,t),U.init(e,t)}),Le=f("ZodUUID",(e,t)=>{Za.init(e,t),U.init(e,t)}),ic=f("ZodURL",(e,t)=>{Aa.init(e,t),U.init(e,t)}),cc=f("ZodEmoji",(e,t)=>{Pa.init(e,t),U.init(e,t)}),uc=f("ZodNanoID",(e,t)=>{Ra.init(e,t),U.init(e,t)}),lc=f("ZodCUID",(e,t)=>{ja.init(e,t),U.init(e,t)}),dc=f("ZodCUID2",(e,t)=>{Ca.init(e,t),U.init(e,t)}),pc=f("ZodULID",(e,t)=>{Ma.init(e,t),U.init(e,t)}),fc=f("ZodXID",(e,t)=>{Da.init(e,t),U.init(e,t)}),mc=f("ZodKSUID",(e,t)=>{La.init(e,t),U.init(e,t)}),hc=f("ZodIPv4",(e,t)=>{Va.init(e,t),U.init(e,t)}),gc=f("ZodIPv6",(e,t)=>{qa.init(e,t),U.init(e,t)}),vc=f("ZodCIDRv4",(e,t)=>{Wa.init(e,t),U.init(e,t)}),_c=f("ZodCIDRv6",(e,t)=>{Ga.init(e,t),U.init(e,t)}),yc=f("ZodBase64",(e,t)=>{Ya.init(e,t),U.init(e,t)}),bc=f("ZodBase64URL",(e,t)=>{Xa.init(e,t),U.init(e,t)}),wc=f("ZodE164",(e,t)=>{Ka.init(e,t),U.init(e,t)}),Sc=f("ZodJWT",(e,t)=>{es.init(e,t),U.init(e,t)}),Nn=f("ZodNumber",(e,t)=>{Hr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,a)=>nn(e,n,o),e.gt=(n,o)=>e.check(rr(n,o)),e.gte=(n,o)=>e.check(ct(n,o)),e.min=(n,o)=>e.check(ct(n,o)),e.lt=(n,o)=>e.check(tr(n,o)),e.lte=(n,o)=>e.check(it(n,o)),e.max=(n,o)=>e.check(it(n,o)),e.int=n=>e.check(sr(n)),e.safe=n=>e.check(sr(n)),e.positive=n=>e.check(rr(0,n)),e.nonnegative=n=>e.check(ct(0,n)),e.negative=n=>e.check(tr(0,n)),e.nonpositive=n=>e.check(it(0,n)),e.multipleOf=(n,o)=>e.check(nr(n,o)),e.step=(n,o)=>e.check(nr(n,o)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Ec(e){return Qs(Nn,e)}const Ic=f("ZodNumberFormat",(e,t)=>{ts.init(e,t),Nn.init(e,t)});function sr(e){return ei(Ic,e)}const kc=f("ZodBoolean",(e,t)=>{rs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>on(e,r,n)});function V(e){return ti(kc,e)}const zc=f("ZodNull",(e,t)=>{ns.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>an(e,r,n)});function Tc(e){return ri(zc,e)}const xc=f("ZodUnknown",(e,t)=>{os.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cn()});function ee(){return ni(xc)}const Nc=f("ZodNever",(e,t)=>{as.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sn(e,r,n)});function On(e){return oi(Nc,e)}const Oc=f("ZodArray",(e,t)=>{ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fn(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(Ve(r,n)),e.nonempty=r=>e.check(Ve(1,r)),e.max=(r,n)=>e.check(en(r,n)),e.length=(r,n)=>e.check(tn(r,n)),e.unwrap=()=>e.element});function Se(e,t){return gi(Oc,e,t)}const Zn=f("ZodObject",(e,t)=>{cs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mn(e,r,n,o),Z(e,"shape",()=>t.shape),e.keyof=()=>An(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ee()}),e.loose=()=>e.clone({...e._zod.def,catchall:ee()}),e.strict=()=>e.clone({...e._zod.def,catchall:On()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>zo(e,r),e.safeExtend=r=>To(e,r),e.merge=r=>xo(e,r),e.pick=r=>Io(e,r),e.omit=r=>ko(e,r),e.partial=(...r)=>No(Pn,e,r[0]),e.required=(...r)=>Oo(Rn,e,r[0])});function P(e,t){const r={type:"object",shape:e??{},...y(t)};return new Zn(r)}function R(e,t){return new Zn({type:"object",shape:e,catchall:On(),...y(t)})}const $n=f("ZodUnion",(e,t)=>{Qr.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hn(e,r,n,o),e.options=t.options});function q(e,t){return new $n({type:"union",options:e,...y(t)})}const Zc=f("ZodDiscriminatedUnion",(e,t)=>{$n.init(e,t),us.init(e,t)});function $c(e,t,r){return new Zc({type:"union",options:t,discriminator:e,...y(r)})}const Ac=f("ZodIntersection",(e,t)=>{ls.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gn(e,r,n,o)});function Pc(e,t){return new Ac({type:"intersection",left:e,right:t})}const Rc=f("ZodRecord",(e,t)=>{ds.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vn(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Oe(e,t,r){return new Rc({type:"record",keyType:e,valueType:t,...y(r)})}const _t=f("ZodEnum",(e,t)=>{ps.init(e,t),L.init(e,t),e._zod.processJSONSchema=(n,o,a)=>un(e,n,o),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{const a={};for(const s of n)if(r.has(s))a[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new _t({...t,checks:[],...y(o),entries:a})},e.exclude=(n,o)=>{const a={...t.entries};for(const s of n)if(r.has(s))delete a[s];else throw new Error(`Key ${s} not found in enum`);return new _t({...t,checks:[],...y(o),entries:a})}});function An(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new _t({type:"enum",entries:r,...y(t)})}const jc=f("ZodLiteral",(e,t)=>{fs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ln(e,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function S(e,t){return new jc({type:"literal",values:Array.isArray(e)?e:[e],...y(t)})}const Cc=f("ZodTransform",(e,t)=>{ms.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pn(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Rr(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(Ne(a,r.value,t));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(Ne(s))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(a=>(r.value=a,r)):(r.value=o,r)}});function Mc(e){return new Cc({type:"transform",transform:e})}const Pn=f("ZodOptional",(e,t)=>{hs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Pn({type:"optional",innerType:e})}const Dc=f("ZodNullable",(e,t)=>{gs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_n(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cr(e){return new Dc({type:"nullable",innerType:e})}const Lc=f("ZodDefault",(e,t)=>{vs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Uc(e,t){return new Lc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Dr(t)}})}const Fc=f("ZodPrefault",(e,t)=>{_s.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Jc(e,t){return new Fc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Dr(t)}})}const Rn=f("ZodNonOptional",(e,t)=>{ys.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Bc(e,t){return new Rn({type:"nonoptional",innerType:e,...y(t)})}const Vc=f("ZodCatch",(e,t)=>{bs.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sn(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function qc(e,t){return new Vc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Wc=f("ZodPipe",(e,t)=>{ws.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>En(e,r,n,o),e.in=t.in,e.out=t.out});function ur(e,t){return new Wc({type:"pipe",in:e,out:t})}const Gc=f("ZodReadonly",(e,t)=>{Ss.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>In(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e){return new Gc({type:"readonly",innerType:e})}const Hc=f("ZodLazy",(e,t)=>{Es.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zn(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Xc(e){return new Hc({type:"lazy",getter:e})}const Ot=f("ZodCustom",(e,t)=>{Is.init(e,t),L.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dn(e,r)});function jn(e,t){return vi(Ot,e??(()=>!0),t)}function Kc(e,t={}){return _i(Ot,e,t)}function Qc(e){return yi(e)}function He(e,t={error:`Input not instance of ${e.name}`}){const r=new Ot({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...y(t)});return r._zod.bag.Class=e,r}var Ze;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{const a={};for(const s of o)a[s]=s;return a},e.getValidEnumValues=o=>{const a=e.objectKeys(o).filter(i=>typeof o[o[i]]!="number"),s={};for(const i of a)s[i]=o[i];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(a){return o[a]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{const a=[];for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&a.push(s);return a},e.find=(o,a)=>{for(const s of o)if(a(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,a=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(a)}e.joinValues=n,e.jsonStringifyReplacer=(o,a)=>typeof a=="bigint"?a.toString():a})(Ze||(Ze={}));var lr;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(lr||(lr={}));Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);Ze.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xe extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(a){return a.message},n={_errors:[]},o=a=>{for(const s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let i=n,u=0;for(;u<s.path.length;){const c=s.path[u];u===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(r(s))):i[c]=i[c]||{_errors:[]},i=i[c],u++}}};return o(this),n}static assert(t){if(!(t instanceof Xe))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r=Object.create(null),n=[];for(const o of this.issues)if(o.path.length>0){const a=o.path[0];r[a]=r[a]||[],r[a].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Xe.create=e=>new Xe(e);var dr;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(dr||(dr={}));var k;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(k||(k={}));class pr extends Error{constructor(t,r){super(t),this.name="ParseError",this.type=r.type,this.field=r.field,this.value=r.value,this.line=r.line}}function ut(e){}function eu(e){if(typeof e=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:t=ut,onError:r=ut,onRetry:n=ut,onComment:o}=e;let a="",s=!0,i,u="",c="";function d(w){const g=s?w.replace(/^\xEF\xBB\xBF/,""):w,[E,_]=tu(`${a}${g}`);for(const p of E)l(p);a=_,s=!1}function l(w){if(w===""){h();return}if(w.startsWith(":")){o&&o(w.slice(w.startsWith(": ")?2:1));return}const g=w.indexOf(":");if(g!==-1){const E=w.slice(0,g),_=w[g+1]===" "?2:1,p=w.slice(g+_);v(E,p,w);return}v(w,"",w)}function v(w,g,E){switch(w){case"event":c=g;break;case"data":u=`${u}${g}
|
|
25
|
-
`;break;case"id":i=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?n(parseInt(g,10)):r(new pr(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:E}));break;default:r(new pr(`Unknown field "${w.length>20?`${w.slice(0,20)}…`:w}"`,{type:"unknown-field",field:w,value:g,line:E}));break}}function h(){u.length>0&&t({id:i,event:c||void 0,data:u.endsWith(`
|
|
26
|
-
`)?u.slice(0,-1):u}),i=void 0,u="",c=""}function T(w={}){a&&w.consume&&l(a),s=!0,i=void 0,u="",c="",a=""}return{feed:d,reset:T}}function tu(e){const t=[];let r="",n=0;for(;n<e.length;){const o=e.indexOf("\r",n),a=e.indexOf(`
|
|
27
|
-
`,n);let s=-1;if(o!==-1&&a!==-1?s=Math.min(o,a):o!==-1?o===e.length-1?s=-1:s=o:a!==-1&&(s=a),s===-1){r=e.slice(n);break}else{const i=e.slice(n,s);t.push(i),n=s+1,e[n-1]==="\r"&&e[n]===`
|
|
28
|
-
`&&n++}}return[t,r]}class ru extends TransformStream{constructor({onError:t,onRetry:r,onComment:n}={}){let o;super({start(a){o=eu({onEvent:s=>{a.enqueue(s)},onError(s){t==="terminate"?a.error(s):typeof t=="function"&&t(s)},onRetry:r,onComment:n})},transform(a){o.feed(a)}})}}var Re=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const o=()=>{const a=r.length,s=new Array(t);for(let i=0;i<t;i++)s[i]=r[Math.random()*a|0];return s.join("")};if(e==null)return o;if(r.includes(n))throw new ho({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${o()}`},nu=Re();function fr(e=globalThis){var t,r,n;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(n=(r=e.process)==null?void 0:r.versions)!=null&&n.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function ue(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((r,n)=>{t[n.toLowerCase()]=r});else{Array.isArray(e)||(e=Object.entries(e));for(const[r,n]of e)n!=null&&(t[r.toLowerCase()]=n)}return t}function mr(e,...t){const r=new Headers(ue(e)),n=r.get("user-agent")||"";return r.set("user-agent",[n,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var ou=/"__proto__"\s*:/,au=/"constructor"\s*:/;function hr(e){const t=JSON.parse(e);return t===null||typeof t!="object"||ou.test(e)===!1&&au.test(e)===!1?t:su(t)}function su(e){let t=[e];for(;t.length;){const r=t;t=[];for(const n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in n){const a=n[o];a&&typeof a=="object"&&t.push(a)}}}return e}function iu(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return hr(e)}try{return hr(e)}finally{Error.stackTraceLimit=t}}function Ue(e){if(e.type==="object"){e.additionalProperties=!1;const t=e.properties;if(t!=null)for(const r in t)t[r]=Ue(t[r])}return e.type==="array"&&e.items!=null&&(Array.isArray(e.items)?e.items=e.items.map(t=>Ue(t)):e.items=Ue(e.items)),e}var cu=Symbol("Let zodToJsonSchema decide on which parser to use"),gr={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},uu=e=>typeof e=="string"?{...gr,name:e}:{...gr,...e};function G(){return{}}function lu(e,t){var r,n,o;const a={type:"array"};return(r=e.type)!=null&&r._def&&((o=(n=e.type)==null?void 0:n._def)==null?void 0:o.typeName)!==k.ZodAny&&(a.items=A(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(a.minItems=e.minLength.value),e.maxLength&&(a.maxItems=e.maxLength.value),e.exactLength&&(a.minItems=e.exactLength.value,a.maxItems=e.exactLength.value),a}function du(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function pu(){return{type:"boolean"}}function Cn(e,t){return A(e.type._def,t)}var fu=(e,t)=>A(e.innerType._def,t);function Mn(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((o,a)=>Mn(e,t,o))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return mu(e)}}var mu=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value;break}return t};function hu(e,t){return{...A(e.innerType._def,t),default:e.defaultValue()}}function gu(e,t){return t.effectStrategy==="input"?A(e.schema._def,t):G()}function vu(e){return{type:"string",enum:Array.from(e.values)}}var _u=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function yu(e,t){const r=[A(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),A(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),n=[];return r.forEach(o=>{if(_u(o))n.push(...o.allOf);else{let a=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:s,...i}=o;a=i}n.push(a)}}),n.length?{allOf:n}:void 0}function bu(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var lt=void 0,X={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(lt===void 0&&(lt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),lt),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Dn(e,t){const r={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":K(r,"email",n.message,t);break;case"format:idn-email":K(r,"idn-email",n.message,t);break;case"pattern:zod":J(r,X.email,n.message,t);break}break;case"url":K(r,"uri",n.message,t);break;case"uuid":K(r,"uuid",n.message,t);break;case"regex":J(r,n.regex,n.message,t);break;case"cuid":J(r,X.cuid,n.message,t);break;case"cuid2":J(r,X.cuid2,n.message,t);break;case"startsWith":J(r,RegExp(`^${dt(n.value,t)}`),n.message,t);break;case"endsWith":J(r,RegExp(`${dt(n.value,t)}$`),n.message,t);break;case"datetime":K(r,"date-time",n.message,t);break;case"date":K(r,"date",n.message,t);break;case"time":K(r,"time",n.message,t);break;case"duration":K(r,"duration",n.message,t);break;case"length":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"includes":{J(r,RegExp(dt(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&K(r,"ipv4",n.message,t),n.version!=="v4"&&K(r,"ipv6",n.message,t);break}case"base64url":J(r,X.base64url,n.message,t);break;case"jwt":J(r,X.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&J(r,X.ipv4Cidr,n.message,t),n.version!=="v4"&&J(r,X.ipv6Cidr,n.message,t);break}case"emoji":J(r,X.emoji(),n.message,t);break;case"ulid":{J(r,X.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{K(r,"binary",n.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{J(r,X.base64,n.message,t);break}}break}case"nanoid":J(r,X.nanoid,n.message,t)}return r}function dt(e,t){return t.patternStrategy==="escape"?Su(e):e}var wu=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Su(e){let t="";for(let r=0;r<e.length;r++)wu.has(e[r])||(t+="\\"),t+=e[r];return t}function K(e,t,r,n){var o;e.format||(o=e.anyOf)!=null&&o.some(a=>a.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function J(e,t,r,n){var o;e.pattern||(o=e.allOf)!=null&&o.some(a=>a.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:vr(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=vr(t,n)}function vr(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=n.i?e.source.toLowerCase():e.source;let a="",s=!1,i=!1,u=!1;for(let c=0;c<o.length;c++){if(s){a+=o[c],s=!1;continue}if(n.i){if(i){if(o[c].match(/[a-z]/)){u?(a+=o[c],a+=`${o[c-2]}-${o[c]}`.toUpperCase(),u=!1):o[c+1]==="-"&&((r=o[c+2])!=null&&r.match(/[a-z]/))?(a+=o[c],u=!0):a+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){a+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(n.m){if(o[c]==="^"){a+=`(^|(?<=[\r
|
|
29
|
-
]))`;continue}else if(o[c]==="$"){a+=`($|(?=[\r
|
|
30
|
-
]))`;continue}}if(n.s&&o[c]==="."){a+=i?`${o[c]}\r
|
|
31
|
-
`:`[${o[c]}\r
|
|
32
|
-
]`;continue}a+=o[c],o[c]==="\\"?s=!0:i&&o[c]==="]"?i=!1:!i&&o[c]==="["&&(i=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return a}function Ln(e,t){var r,n,o,a,s,i;const u={type:"object",additionalProperties:(r=A(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===k.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:c,...d}=Dn(e.keyType._def,t);return{...u,propertyNames:d}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===k.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if(((s=e.keyType)==null?void 0:s._def.typeName)===k.ZodBranded&&e.keyType._def.type._def.typeName===k.ZodString&&((i=e.keyType._def.type._def.checks)!=null&&i.length)){const{type:c,...d}=Cn(e.keyType._def,t);return{...u,propertyNames:d}}}return u}function Eu(e,t){if(t.mapStrategy==="record")return Ln(e,t);const r=A(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||G(),n=A(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||G();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function Iu(e){const t=e.values,n=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),o=Array.from(new Set(n.map(a=>typeof a)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:n}}function ku(){return{not:G()}}function zu(){return{type:"null"}}var yt={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Tu(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in yt&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((o,a)=>{const s=yt[a._def.typeName];return s&&!o.includes(s)?[...o,s]:o},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((o,a)=>{const s=typeof a._def.value;switch(s){case"string":case"number":case"boolean":return[...o,s];case"bigint":return[...o,"integer"];case"object":if(a._def.value===null)return[...o,"null"];default:return o}},[]);if(n.length===r.length){const o=n.filter((a,s,i)=>i.indexOf(a)===s);return{type:o.length>1?o:o[0],enum:r.reduce((a,s)=>a.includes(s._def.value)?a:[...a,s._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,o)=>[...n,...o._def.values.filter(a=>!n.includes(a))],[])};return xu(e,t)}var xu=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,o)=>A(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Nu(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[yt[e.innerType._def.typeName],"null"]};const r=A(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Ou(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value;break}return t}function Zu(e,t){const r={type:"object",properties:{}},n=[],o=e.shape();for(const s in o){let i=o[s];if(i===void 0||i._def===void 0)continue;const u=Au(i),c=A(i._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});c!==void 0&&(r.properties[s]=c,u||n.push(s))}n.length&&(r.required=n);const a=$u(e,t);return a!==void 0&&(r.additionalProperties=a),r}function $u(e,t){if(e.catchall._def.typeName!=="ZodNever")return A(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function Au(e){try{return e.isOptional()}catch{return!0}}var Pu=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return A(e.innerType._def,t);const n=A(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:G()},n]}:G()},Ru=(e,t)=>{if(t.pipeStrategy==="input")return A(e.in._def,t);if(t.pipeStrategy==="output")return A(e.out._def,t);const r=A(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=A(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(o=>o!==void 0)}};function ju(e,t){return A(e.type._def,t)}function Cu(e,t){const n={type:"array",uniqueItems:!0,items:A(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Mu(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>A(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:A(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>A(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function Du(){return{not:G()}}function Lu(){return G()}var Uu=(e,t)=>A(e.innerType._def,t),Fu=(e,t,r)=>{switch(t){case k.ZodString:return Dn(e,r);case k.ZodNumber:return Ou(e);case k.ZodObject:return Zu(e,r);case k.ZodBigInt:return du(e);case k.ZodBoolean:return pu();case k.ZodDate:return Mn(e,r);case k.ZodUndefined:return Du();case k.ZodNull:return zu();case k.ZodArray:return lu(e,r);case k.ZodUnion:case k.ZodDiscriminatedUnion:return Tu(e,r);case k.ZodIntersection:return yu(e,r);case k.ZodTuple:return Mu(e,r);case k.ZodRecord:return Ln(e,r);case k.ZodLiteral:return bu(e);case k.ZodEnum:return vu(e);case k.ZodNativeEnum:return Iu(e);case k.ZodNullable:return Nu(e,r);case k.ZodOptional:return Pu(e,r);case k.ZodMap:return Eu(e,r);case k.ZodSet:return Cu(e,r);case k.ZodLazy:return()=>e.getter()._def;case k.ZodPromise:return ju(e,r);case k.ZodNaN:case k.ZodNever:return ku();case k.ZodEffects:return gu(e,r);case k.ZodAny:return G();case k.ZodUnknown:return Lu();case k.ZodDefault:return hu(e,r);case k.ZodBranded:return Cn(e,r);case k.ZodReadonly:return Uu(e,r);case k.ZodCatch:return fu(e,r);case k.ZodPipeline:return Ru(e,r);case k.ZodFunction:case k.ZodVoid:case k.ZodSymbol:return;default:return(n=>{})()}},Ju=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function A(e,t,r=!1){var n;const o=t.seen.get(e);if(t.override){const u=(n=t.override)==null?void 0:n.call(t,e,t,o,r);if(u!==cu)return u}if(o&&!r){const u=Bu(o,t);if(u!==void 0)return u}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const s=Fu(e,e.typeName,t),i=typeof s=="function"?A(s(),t):s;if(i&&Vu(e,t,i),t.postProcess){const u=t.postProcess(i,e,t);return a.jsonSchema=i,u}return a.jsonSchema=i,i}var Bu=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ju(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),G()):t.$refStrategy==="seen"?G():void 0}},Vu=(e,t,r)=>(e.description&&(r.description=e.description),r),qu=e=>{const t=uu(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},Wu=(e,t)=>{var r;const n=qu(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,l])=>{var v;return{...c,[d]:(v=A(l._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?v:G()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,s=(r=A(e._def,a===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,a]},!1))!=null?r:G(),i=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;i!==void 0&&(s.title=i);const u=a===void 0?o?{...s,[n.definitionPath]:o}:s:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,a].join("/"),[n.definitionPath]:{...o,[a]:s}};return u.$schema="http://json-schema.org/draft-07/schema#",u},bt=Symbol.for("vercel.ai.schema");function Gu(e){let t;return()=>(t==null&&(t=e()),t)}function ot(e,{validate:t}={}){return{[bt]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function Yu(e){return typeof e=="object"&&e!==null&&bt in e&&e[bt]===!0&&"jsonSchema"in e&&"validate"in e}function Zt(e){return e==null?ot({properties:{},additionalProperties:!1}):Yu(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Un(e):Hu(e):e()}function Hu(e){return ot(()=>e["~standard"].jsonSchema.input({target:"draft-07"}),{validate:async t=>{const r=await e["~standard"].validate(t);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new _e({value:t,cause:r.issues})}}})}function Xu(e,t){var r;const n=(r=void 0)!=null?r:!1;return ot(()=>Wu(e,{$refStrategy:n?"root":"none"}),{validate:async o=>{const a=await e.safeParseAsync(o);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Ku(e,t){var r;const n=(r=void 0)!=null?r:!1;return ot(()=>Ue(Mi(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async o=>{const a=await Tn(e,o);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function Qu(e){return"_zod"in e}function Un(e,t){return Qu(e)?Ku(e):Xu(e)}async function _r({value:e,schema:t}){const r=await $e({value:e,schema:t});if(!r.success)throw _e.wrap({value:e,cause:r.error});return r.value}async function $e({value:e,schema:t}){const r=Zt(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const n=await r.validate(e);return n.success?{success:!0,value:n.value,rawValue:e}:{success:!1,error:_e.wrap({value:e,cause:n.error}),rawValue:e}}catch(n){return{success:!1,error:_e.wrap({value:e,cause:n}),rawValue:e}}}async function le({text:e,schema:t}){try{const r=iu(e);return t==null?{success:!0,value:r,rawValue:r}:await $e({value:r,schema:t})}catch(r){return{success:!1,error:Dt.isInstance(r)?r:new Dt({text:e,cause:r}),rawValue:void 0}}}function el({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new ru).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await le({text:r,schema:t}))}}))}async function ne(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var tl=Object.defineProperty,rl=(e,t)=>{for(var r in t)tl(e,r,{get:t[r],enumerable:!0})},Fn="AI_NoObjectGeneratedError",Jn=`vercel.ai.error.${Fn}`,nl=Symbol.for(Jn),Bn,oe=class extends ae{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:o,finishReason:a}){super({name:Fn,message:e,cause:t}),this[Bn]=!0,this.text=r,this.response=n,this.usage=o,this.finishReason=a}static isInstance(e){return ae.hasMarker(e,Jn)}};Bn=nl;var yr="6.0.3",Vn=q([m(),He(Uint8Array),He(ArrayBuffer),jn(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]),Ae=Xc(()=>q([Tc(),m(),Ec(),V(),Oe(m(),Ae.optional()),Se(Ae)])),N=Oe(m(),Oe(m(),Ae.optional())),qn=P({type:S("text"),text:m(),providerOptions:N.optional()}),ol=P({type:S("image"),image:q([Vn,He(URL)]),mediaType:m().optional(),providerOptions:N.optional()}),Wn=P({type:S("file"),data:q([Vn,He(URL)]),filename:m().optional(),mediaType:m(),providerOptions:N.optional()}),al=P({type:S("reasoning"),text:m(),providerOptions:N.optional()}),sl=P({type:S("tool-call"),toolCallId:m(),toolName:m(),input:ee(),providerOptions:N.optional(),providerExecuted:V().optional()}),il=$c("type",[P({type:S("text"),value:m(),providerOptions:N.optional()}),P({type:S("json"),value:Ae,providerOptions:N.optional()}),P({type:S("execution-denied"),reason:m().optional(),providerOptions:N.optional()}),P({type:S("error-text"),value:m(),providerOptions:N.optional()}),P({type:S("error-json"),value:Ae,providerOptions:N.optional()}),P({type:S("content"),value:Se(q([P({type:S("text"),text:m(),providerOptions:N.optional()}),P({type:S("media"),data:m(),mediaType:m()}),P({type:S("file-data"),data:m(),mediaType:m(),filename:m().optional(),providerOptions:N.optional()}),P({type:S("file-url"),url:m(),providerOptions:N.optional()}),P({type:S("file-id"),fileId:q([m(),Oe(m(),m())]),providerOptions:N.optional()}),P({type:S("image-data"),data:m(),mediaType:m(),providerOptions:N.optional()}),P({type:S("image-url"),url:m(),providerOptions:N.optional()}),P({type:S("image-file-id"),fileId:q([m(),Oe(m(),m())]),providerOptions:N.optional()}),P({type:S("custom"),providerOptions:N.optional()})]))})]),Gn=P({type:S("tool-result"),toolCallId:m(),toolName:m(),output:il,providerOptions:N.optional()}),cl=P({type:S("tool-approval-request"),approvalId:m(),toolCallId:m()}),ul=P({type:S("tool-approval-response"),approvalId:m(),approved:V(),reason:m().optional()}),ll=P({role:S("system"),content:m(),providerOptions:N.optional()}),dl=P({role:S("user"),content:q([m(),Se(q([qn,ol,Wn]))]),providerOptions:N.optional()}),pl=P({role:S("assistant"),content:q([m(),Se(q([qn,Wn,al,sl,Gn,cl]))]),providerOptions:N.optional()}),fl=P({role:S("tool"),content:Se(q([Gn,ul])),providerOptions:N.optional()});q([ll,dl,pl,fl]);function Yn(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const r={...e};for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const o=t[n];if(o===void 0)continue;const a=n in e?e[n]:void 0,s=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),i=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);s&&i?r[n]=Yn(a,o):r[n]=o}return r}var ml={};rl(ml,{array:()=>_l,choice:()=>yl,json:()=>bl,object:()=>vl,text:()=>gl});function hl(e){const t=["ROOT"];let r=-1,n=null;function o(u,c,d){switch(u){case'"':{r=c,t.pop(),t.push(d),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=c,n=c,t.pop(),t.push(d),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(d),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=c,t.pop(),t.push(d),t.push("INSIDE_NUMBER");break}case"{":{r=c,t.pop(),t.push(d),t.push("INSIDE_OBJECT_START");break}case"[":{r=c,t.pop(),t.push(d),t.push("INSIDE_ARRAY_START");break}}}function a(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=c,t.pop();break}}}function s(u,c){switch(u){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}}}for(let u=0;u<e.length;u++){const c=e[u];switch(t[t.length-1]){case"ROOT":o(c,u,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=u,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{o(c,u,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(c,u);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),r=u;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=u}break}case"INSIDE_ARRAY_START":{c==="]"?(r=u,t.pop()):(r=u,o(c,u,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=u,t.pop();break}default:{r=u;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{o(c,u,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=u;break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=u;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,u),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,u);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,u);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,u);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const l=e.substring(n,u+1);!"false".startsWith(l)&&!"true".startsWith(l)&&!"null".startsWith(l)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(c,u):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&s(c,u)):r=u;break}}}let i=e.slice(0,r+1);for(let u=t.length-1;u>=0;u--)switch(t[u]){case"INSIDE_STRING":{i+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{i+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{i+="]";break}case"INSIDE_LITERAL":{const d=e.substring(n,e.length);"true".startsWith(d)?i+="true".slice(d.length):"false".startsWith(d)?i+="false".slice(d.length):"null".startsWith(d)&&(i+="null".slice(d.length))}}return i}async function je(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await le({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await le({text:hl(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var gl=()=>({responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}}}),vl=({schema:e,name:t,description:r})=>{const n=Zt(e);return{responseFormat:ne(n.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...r!=null&&{description:r}})),async parseCompleteOutput({text:o},a){const s=await le({text:o});if(!s.success)throw new oe({message:"No object generated: could not parse the response.",cause:s.error,text:o,response:a.response,usage:a.usage,finishReason:a.finishReason});const i=await $e({value:s.value,schema:n});if(!i.success)throw new oe({message:"No object generated: response did not match schema.",cause:i.error,text:o,response:a.response,usage:a.usage,finishReason:a.finishReason});return i.value},async parsePartialOutput({text:o}){const a=await je(o);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:a.value}}}}},_l=({element:e,name:t,description:r})=>{const n=Zt(e);return{responseFormat:ne(n.jsonSchema).then(o=>{const{$schema:a,...s}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:s}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}}),async parseCompleteOutput({text:o},a){const s=await le({text:o});if(!s.success)throw new oe({message:"No object generated: could not parse the response.",cause:s.error,text:o,response:a.response,usage:a.usage,finishReason:a.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))throw new oe({message:"No object generated: response did not match schema.",cause:new _e({value:i,cause:"response must be an object with an elements array"}),text:o,response:a.response,usage:a.usage,finishReason:a.finishReason});for(const u of i.elements){const c=await $e({value:u,schema:n});if(!c.success)throw new oe({message:"No object generated: response did not match schema.",cause:c.error,text:o,response:a.response,usage:a.usage,finishReason:a.finishReason})}return i.elements},async parsePartialOutput({text:o}){const a=await je(o);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("elements"in s)||!Array.isArray(s.elements))return;const i=a.state==="repaired-parse"&&s.elements.length>0?s.elements.slice(0,-1):s.elements,u=[];for(const c of i){const d=await $e({value:c,schema:n});d.success&&u.push(d.value)}return{partial:u}}}}}},yl=({options:e,name:t,description:r})=>({responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}),async parseCompleteOutput({text:n},o){const a=await le({text:n});if(!a.success)throw new oe({message:"No object generated: could not parse the response.",cause:a.error,text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string"||!e.includes(s.result))throw new oe({message:"No object generated: response did not match schema.",cause:new _e({value:s,cause:"response must be an object that contains a choice value."}),text:n,response:o.response,usage:o.usage,finishReason:o.finishReason});return s.result},async parsePartialOutput({text:n}){const o=await je(n);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const a=o.value;if(a==null||typeof a!="object"||!("result"in a)||typeof a.result!="string")return;const s=e.filter(i=>i.startsWith(a.result));return o.state==="successful-parse"?s.includes(a.result)?{partial:a.result}:void 0:s.length===1?{partial:s[0]}:void 0}}}}),bl=({name:e,description:t}={})=>({responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:r},n){const o=await le({text:r});if(!o.success)throw new oe({message:"No object generated: could not parse the response.",cause:o.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return o.value},async parsePartialOutput({text:r}){const n=await je(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}}});Re({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
|
|
33
|
-
|
|
34
|
-
`)},flush(e){e.enqueue(`data: [DONE]
|
|
35
|
-
|
|
36
|
-
`)}})}});var wl=Gu(()=>Un(q([R({type:S("text-start"),id:m(),providerMetadata:N.optional()}),R({type:S("text-delta"),id:m(),delta:m(),providerMetadata:N.optional()}),R({type:S("text-end"),id:m(),providerMetadata:N.optional()}),R({type:S("error"),errorText:m()}),R({type:S("tool-input-start"),toolCallId:m(),toolName:m(),providerExecuted:V().optional(),dynamic:V().optional(),title:m().optional()}),R({type:S("tool-input-delta"),toolCallId:m(),inputTextDelta:m()}),R({type:S("tool-input-available"),toolCallId:m(),toolName:m(),input:ee(),providerExecuted:V().optional(),providerMetadata:N.optional(),dynamic:V().optional(),title:m().optional()}),R({type:S("tool-input-error"),toolCallId:m(),toolName:m(),input:ee(),providerExecuted:V().optional(),providerMetadata:N.optional(),dynamic:V().optional(),errorText:m(),title:m().optional()}),R({type:S("tool-approval-request"),approvalId:m(),toolCallId:m()}),R({type:S("tool-output-available"),toolCallId:m(),output:ee(),providerExecuted:V().optional(),dynamic:V().optional(),preliminary:V().optional()}),R({type:S("tool-output-error"),toolCallId:m(),errorText:m(),providerExecuted:V().optional(),dynamic:V().optional()}),R({type:S("tool-output-denied"),toolCallId:m()}),R({type:S("reasoning-start"),id:m(),providerMetadata:N.optional()}),R({type:S("reasoning-delta"),id:m(),delta:m(),providerMetadata:N.optional()}),R({type:S("reasoning-end"),id:m(),providerMetadata:N.optional()}),R({type:S("source-url"),sourceId:m(),url:m(),title:m().optional(),providerMetadata:N.optional()}),R({type:S("source-document"),sourceId:m(),mediaType:m(),title:m(),filename:m().optional(),providerMetadata:N.optional()}),R({type:S("file"),url:m(),mediaType:m(),providerMetadata:N.optional()}),R({type:jn(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:m().optional(),data:ee(),transient:V().optional()}),R({type:S("start-step")}),R({type:S("finish-step")}),R({type:S("start"),messageId:m().optional(),messageMetadata:ee().optional()}),R({type:S("finish"),finishReason:An(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:ee().optional()}),R({type:S("abort")}),R({type:S("message-metadata"),messageMetadata:ee()})])));function Sl(e){return e.type.startsWith("data-")}function wt(e){return e.type.startsWith("tool-")}function El(e){return e.type==="dynamic-tool"}function Ke(e){return wt(e)||El(e)}function br(e){return e.type.split("-").slice(1).join("-")}function Il({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function kl({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:o,onToolCall:a,onData:s}){return e.pipeThrough(new TransformStream({async transform(i,u){await n(async({state:c,write:d})=>{var l,v,h,T;function w(p){const I=c.message.parts.filter(Ke).find(x=>x.toolCallId===p);if(I==null)throw new Error(`no tool invocation found for tool call ${p}`);return I}function g(p){var b;const I=c.message.parts.find(F=>wt(F)&&F.toolCallId===p.toolCallId),x=p,O=I;I!=null?(I.state=p.state,O.input=x.input,O.output=x.output,O.errorText=x.errorText,O.rawInput=x.rawInput,O.preliminary=x.preliminary,p.title!==void 0&&(O.title=p.title),O.providerExecuted=(b=x.providerExecuted)!=null?b:I.providerExecuted,x.providerMetadata!=null&&I.state==="input-available"&&(I.callProviderMetadata=x.providerMetadata)):c.message.parts.push({type:`tool-${p.toolName}`,toolCallId:p.toolCallId,state:p.state,title:p.title,input:x.input,output:x.output,rawInput:x.rawInput,errorText:x.errorText,providerExecuted:x.providerExecuted,preliminary:x.preliminary,...x.providerMetadata!=null?{callProviderMetadata:x.providerMetadata}:{}})}function E(p){var b,I;const x=c.message.parts.find(Ee=>Ee.type==="dynamic-tool"&&Ee.toolCallId===p.toolCallId),O=p,F=x;x!=null?(x.state=p.state,F.toolName=p.toolName,F.input=O.input,F.output=O.output,F.errorText=O.errorText,F.rawInput=(b=O.rawInput)!=null?b:F.rawInput,F.preliminary=O.preliminary,p.title!==void 0&&(F.title=p.title),F.providerExecuted=(I=O.providerExecuted)!=null?I:x.providerExecuted,O.providerMetadata!=null&&x.state==="input-available"&&(x.callProviderMetadata=O.providerMetadata)):c.message.parts.push({type:"dynamic-tool",toolName:p.toolName,toolCallId:p.toolCallId,state:p.state,input:O.input,output:O.output,errorText:O.errorText,preliminary:O.preliminary,providerExecuted:O.providerExecuted,title:p.title,...O.providerMetadata!=null?{callProviderMetadata:O.providerMetadata}:{}})}async function _(p){if(p!=null){const b=c.message.metadata!=null?Yn(c.message.metadata,p):p;t!=null&&await _r({value:b,schema:t}),c.message.metadata=b}}switch(i.type){case"text-start":{const p={type:"text",text:"",providerMetadata:i.providerMetadata,state:"streaming"};c.activeTextParts[i.id]=p,c.message.parts.push(p),d();break}case"text-delta":{const p=c.activeTextParts[i.id];p.text+=i.delta,p.providerMetadata=(l=i.providerMetadata)!=null?l:p.providerMetadata,d();break}case"text-end":{const p=c.activeTextParts[i.id];p.state="done",p.providerMetadata=(v=i.providerMetadata)!=null?v:p.providerMetadata,delete c.activeTextParts[i.id],d();break}case"reasoning-start":{const p={type:"reasoning",text:"",providerMetadata:i.providerMetadata,state:"streaming"};c.activeReasoningParts[i.id]=p,c.message.parts.push(p),d();break}case"reasoning-delta":{const p=c.activeReasoningParts[i.id];p.text+=i.delta,p.providerMetadata=(h=i.providerMetadata)!=null?h:p.providerMetadata,d();break}case"reasoning-end":{const p=c.activeReasoningParts[i.id];p.providerMetadata=(T=i.providerMetadata)!=null?T:p.providerMetadata,p.state="done",delete c.activeReasoningParts[i.id],d();break}case"file":{c.message.parts.push({type:"file",mediaType:i.mediaType,url:i.url}),d();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:i.sourceId,url:i.url,title:i.title,providerMetadata:i.providerMetadata}),d();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:i.sourceId,mediaType:i.mediaType,title:i.title,filename:i.filename,providerMetadata:i.providerMetadata}),d();break}case"tool-input-start":{const p=c.message.parts.filter(wt);c.partialToolCalls[i.toolCallId]={text:"",toolName:i.toolName,index:p.length,dynamic:i.dynamic,title:i.title},i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title}):g({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-streaming",input:void 0,providerExecuted:i.providerExecuted,title:i.title}),d();break}case"tool-input-delta":{const p=c.partialToolCalls[i.toolCallId];p.text+=i.inputTextDelta;const{value:b}=await je(p.text);p.dynamic?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"input-streaming",input:b,title:p.title}):g({toolCallId:i.toolCallId,toolName:p.toolName,state:"input-streaming",input:b,title:p.title}),d();break}case"tool-input-available":{i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}):g({toolCallId:i.toolCallId,toolName:i.toolName,state:"input-available",input:i.input,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata,title:i.title}),d(),a&&!i.providerExecuted&&await a({toolCall:i});break}case"tool-input-error":{i.dynamic?E({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}):g({toolCallId:i.toolCallId,toolName:i.toolName,state:"output-error",input:void 0,rawInput:i.input,errorText:i.errorText,providerExecuted:i.providerExecuted,providerMetadata:i.providerMetadata}),d();break}case"tool-approval-request":{const p=w(i.toolCallId);p.state="approval-requested",p.approval={id:i.approvalId},d();break}case"tool-output-denied":{const p=w(i.toolCallId);p.state="output-denied",d();break}case"tool-output-available":{const p=w(i.toolCallId);p.type==="dynamic-tool"?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"output-available",input:p.input,output:i.output,preliminary:i.preliminary,providerExecuted:i.providerExecuted,title:p.title}):g({toolCallId:i.toolCallId,toolName:br(p),state:"output-available",input:p.input,output:i.output,providerExecuted:i.providerExecuted,preliminary:i.preliminary,title:p.title}),d();break}case"tool-output-error":{const p=w(i.toolCallId);p.type==="dynamic-tool"?E({toolCallId:i.toolCallId,toolName:p.toolName,state:"output-error",input:p.input,errorText:i.errorText,providerExecuted:i.providerExecuted,title:p.title}):g({toolCallId:i.toolCallId,toolName:br(p),state:"output-error",input:p.input,rawInput:p.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,title:p.title}),d();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts={},c.activeReasoningParts={};break}case"start":{i.messageId!=null&&(c.message.id=i.messageId),await _(i.messageMetadata),(i.messageId!=null||i.messageMetadata!=null)&&d();break}case"finish":{i.finishReason!=null&&(c.finishReason=i.finishReason),await _(i.messageMetadata),i.messageMetadata!=null&&d();break}case"message-metadata":{await _(i.messageMetadata),i.messageMetadata!=null&&d();break}case"error":{o?.(new Error(i.errorText));break}default:if(Sl(i)){r?.[i.type]!=null&&await _r({value:i.data,schema:r[i.type]});const p=i;if(p.transient){s?.(p);break}const b=p.id!=null?c.message.parts.find(I=>p.type===I.type&&p.id===I.id):void 0;b!=null?b.data=p.data:c.message.parts.push(p),s?.(p),d()}}u.enqueue(i)})}}))}async function zl({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:n}=await r.read();if(n)break}}catch(n){t?.(n)}finally{r.releaseLock()}}Re({prefix:"aitxt",size:24});Re({prefix:"aiobj",size:24});var Tl=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){r(n)}}),this.processQueue()})}};Re({prefix:"aiobj",size:24});async function xl(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:r,type:n}=t,o=await new Promise((a,s)=>{const i=new FileReader;i.onload=u=>{var c;a((c=u.target)==null?void 0:c.result)},i.onerror=u=>s(u),i.readAsDataURL(t)});return{type:"file",mediaType:n,filename:r,url:o}}))}var Nl=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:o,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:s}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=o,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=s}async sendMessages({abortSignal:e,...t}){var r,n,o,a,s;const i=await ne(this.body),u=await ne(this.headers),c=await ne(this.credentials),d={...ue(u),...ue(t.headers)},l=await((r=this.prepareSendMessagesRequest)==null?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...i,...t.body},headers:d,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),v=(n=l?.api)!=null?n:this.api,h=l?.headers!==void 0?ue(l.headers):d,T=l?.body!==void 0?l.body:{...i,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},w=(o=l?.credentials)!=null?o:c,E=await((a=this.fetch)!=null?a:globalThis.fetch)(v,{method:"POST",headers:mr({"Content-Type":"application/json",...h},`ai-sdk/${yr}`,fr()),body:JSON.stringify(T),credentials:w,signal:e});if(!E.ok)throw new Error((s=await E.text())!=null?s:"Failed to fetch the chat response.");if(!E.body)throw new Error("The response body is empty.");return this.processResponseStream(E.body)}async reconnectToStream(e){var t,r,n,o,a;const s=await ne(this.body),i=await ne(this.headers),u=await ne(this.credentials),c={...ue(i),...ue(e.headers)},d=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...s,...e.body},headers:c,credentials:u,requestMetadata:e.metadata})),l=(r=d?.api)!=null?r:`${this.api}/${e.chatId}/stream`,v=d?.headers!==void 0?ue(d.headers):c,h=(n=d?.credentials)!=null?n:u,w=await((o=this.fetch)!=null?o:globalThis.fetch)(l,{method:"GET",headers:mr(v,`ai-sdk/${yr}`,fr()),credentials:h});if(w.status===204)return null;if(!w.ok)throw new Error((a=await w.text())!=null?a:"Failed to fetch the chat response.");if(!w.body)throw new Error("The response body is empty.");return this.processResponseStream(w.body)}},Hn=class extends Nl{constructor(e={}){super(e)}processResponseStream(e){return el({stream:e,schema:wl}).pipeThrough(new TransformStream({async transform(t,r){if(!t.success)throw t.error;r.enqueue(t.value)}}))}},Ol=class{constructor({generateId:e=nu,id:t=e(),transport:r=new Hn,messageMetadataSchema:n,dataPartSchemas:o,state:a,onError:s,onToolCall:i,onFinish:u,onData:c,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new Tl,this.sendMessage=async(l,v)=>{var h,T,w,g;if(l==null){await this.makeRequest({trigger:"submit-message",messageId:(h=this.lastMessage)==null?void 0:h.id,...v});return}let E;if("text"in l||"files"in l?E={parts:[...Array.isArray(l.files)?l.files:await xl(l.files),..."text"in l&&l.text!=null?[{type:"text",text:l.text}]:[]]}:E=l,l.messageId!=null){const _=this.state.messages.findIndex(p=>p.id===l.messageId);if(_===-1)throw new Error(`message with id ${l.messageId} not found`);if(this.state.messages[_].role!=="user")throw new Error(`message with id ${l.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,_+1),this.state.replaceMessage(_,{...E,id:l.messageId,role:(T=E.role)!=null?T:"user",metadata:l.metadata})}else this.state.pushMessage({...E,id:(w=E.id)!=null?w:this.generateId(),role:(g=E.role)!=null?g:"user",metadata:l.metadata});await this.makeRequest({trigger:"submit-message",messageId:l.messageId,...v})},this.regenerate=async({messageId:l,...v}={})=>{const h=l==null?this.state.messages.length-1:this.state.messages.findIndex(T=>T.id===l);if(h===-1)throw new Error(`message ${l} not found`);this.state.messages=this.state.messages.slice(0,this.messages[h].role==="assistant"?h:h+1),await this.makeRequest({trigger:"regenerate-message",messageId:l,...v})},this.resumeStream=async(l={})=>{await this.makeRequest({trigger:"resume-stream",...l})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:l,approved:v,reason:h})=>this.jobExecutor.run(async()=>{var T,w;const g=this.state.messages,E=g[g.length-1],_=p=>Ke(p)&&p.state==="approval-requested"&&p.approval.id===l?{...p,state:"approval-responded",approval:{id:l,approved:v,reason:h}}:p;this.state.replaceMessage(g.length-1,{...E,parts:E.parts.map(_)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(_)),this.status!=="streaming"&&this.status!=="submitted"&&((T=this.sendAutomaticallyWhen)!=null&&T.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(w=this.lastMessage)==null?void 0:w.id})}),this.addToolOutput=async({state:l="output-available",tool:v,toolCallId:h,output:T,errorText:w})=>this.jobExecutor.run(async()=>{var g,E;const _=this.state.messages,p=_[_.length-1],b=I=>Ke(I)&&I.toolCallId===h?{...I,state:l,output:T,errorText:w}:I;this.state.replaceMessage(_.length-1,{...p,parts:p.parts.map(b)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(b)),this.status!=="streaming"&&this.status!=="submitted"&&((g=this.sendAutomaticallyWhen)!=null&&g.call(this,{messages:this.state.messages}))&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var l;this.status!=="streaming"&&this.status!=="submitted"||(l=this.activeResponse)!=null&&l.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=o,this.state=a,this.onError=s,this.onToolCall=i,this.onFinish=u,this.onData=c,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:o}){var a,s,i,u;this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let d=!1,l=!1,v=!1;try{const h={state:Il({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};h.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=h;let T;if(e==="resume-stream"){const g=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(g==null){this.setStatus({status:"ready"});return}T=g}else T=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:o});const w=g=>this.jobExecutor.run(()=>g({state:h.state,write:()=>{var E;this.setStatus({status:"streaming"}),h.state.message.id===((E=this.lastMessage)==null?void 0:E.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await zl({stream:kl({stream:T,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:w,onError:g=>{throw g}}),onError:g=>{throw g}}),this.setStatus({status:"ready"})}catch(h){if(d||h.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;v=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(l=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{(s=this.onFinish)==null||s.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:l,isError:v,finishReason:(a=this.activeResponse)==null?void 0:a.state.finishReason})}catch(h){console.error(h)}this.activeResponse=void 0}(i=this.sendAutomaticallyWhen)!=null&&i.call(this,{messages:this.state.messages})&&!v&&await this.makeRequest({trigger:"submit-message",messageId:(u=this.lastMessage)==null?void 0:u.id,metadata:t,headers:r,body:n})}};function Zl({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const r=t.parts.reduce((o,a,s)=>a.type==="step-start"?s:o,-1),n=t.parts.slice(r+1).filter(Ke).filter(o=>!o.providerExecuted);return n.length>0&&n.every(o=>o.state==="output-available"||o.state==="output-error")}var pt,wr;function $l(){if(wr)return pt;wr=1;function e(t,r){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let n,o=0;return function(...s){clearTimeout(n);const i=Date.now(),u=i-o,c=r-u;c<=0?(o=i,t.apply(this,s)):n=setTimeout(()=>{o=Date.now(),t.apply(this,s)},c)}}return pt=e,pt}var Al=$l();const Pl=to(Al);var Xn=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},j=(e,t,r)=>(Xn(e,t,"read from private field"),r?r.call(e):t.get(e)),Q=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},re=(e,t,r,n)=>(Xn(e,t,"write to private field"),t.set(e,r),r);function Rl(e,t){return t!=null?Pl(e,t):e}var Y,Fe,Je,ke,ze,Te,fe,St,Et,jl=class{constructor(e=[]){Q(this,Y,void 0),Q(this,Fe,"ready"),Q(this,Je,void 0),Q(this,ke,new Set),Q(this,ze,new Set),Q(this,Te,new Set),this.pushMessage=t=>{re(this,Y,j(this,Y).concat(t)),j(this,fe).call(this)},this.popMessage=()=>{re(this,Y,j(this,Y).slice(0,-1)),j(this,fe).call(this)},this.replaceMessage=(t,r)=>{re(this,Y,[...j(this,Y).slice(0,t),this.snapshot(r),...j(this,Y).slice(t+1)]),j(this,fe).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,r)=>{const n=r?Rl(t,r):t;return j(this,ke).add(n),()=>{j(this,ke).delete(n)}},this["~registerStatusCallback"]=t=>(j(this,ze).add(t),()=>{j(this,ze).delete(t)}),this["~registerErrorCallback"]=t=>(j(this,Te).add(t),()=>{j(this,Te).delete(t)}),Q(this,fe,()=>{j(this,ke).forEach(t=>t())}),Q(this,St,()=>{j(this,ze).forEach(t=>t())}),Q(this,Et,()=>{j(this,Te).forEach(t=>t())}),re(this,Y,e)}get status(){return j(this,Fe)}set status(e){re(this,Fe,e),j(this,St).call(this)}get error(){return j(this,Je)}set error(e){re(this,Je,e),j(this,Et).call(this)}get messages(){return j(this,Y)}set messages(e){re(this,Y,[...e]),j(this,fe).call(this)}};Y=new WeakMap;Fe=new WeakMap;Je=new WeakMap;ke=new WeakMap;ze=new WeakMap;Te=new WeakMap;fe=new WeakMap;St=new WeakMap;Et=new WeakMap;var me,Sr=class extends Ol{constructor({messages:e,...t}){const r=new jl(e);super({...t,state:r}),Q(this,me,void 0),this["~registerMessagesCallback"]=(n,o)=>j(this,me)["~registerMessagesCallback"](n,o),this["~registerStatusCallback"]=n=>j(this,me)["~registerStatusCallback"](n),this["~registerErrorCallback"]=n=>j(this,me)["~registerErrorCallback"](n),re(this,me,r)}};me=new WeakMap;function Cl({experimental_throttle:e,resume:t=!1,...r}={}){const n=$.useRef("chat"in r?r.chat:new Sr(r));("chat"in r&&r.chat!==n.current||"id"in r&&n.current.id!==r.id)&&(n.current="chat"in r?r.chat:new Sr(r));const a=$.useCallback(d=>n.current["~registerMessagesCallback"](d,e),[e,n.current.id]),s=$.useSyncExternalStore(a,()=>n.current.messages,()=>n.current.messages),i=$.useSyncExternalStore(n.current["~registerStatusCallback"],()=>n.current.status,()=>n.current.status),u=$.useSyncExternalStore(n.current["~registerErrorCallback"],()=>n.current.error,()=>n.current.error),c=$.useCallback(d=>{typeof d=="function"&&(d=d(n.current.messages)),n.current.messages=d},[n]);return $.useEffect(()=>{t&&n.current.resumeStream()},[t,n]),{id:n.current.id,messages:s,setMessages:c,sendMessage:n.current.sendMessage,regenerate:n.current.regenerate,clearError:n.current.clearError,stop:n.current.stop,error:u,resumeStream:n.current.resumeStream,status:i,addToolResult:n.current.addToolOutput,addToolOutput:n.current.addToolOutput,addToolApprovalResponse:n.current.addToolApprovalResponse}}const Ml={damping:.7,stiffness:.05,mass:1.25},Dl=70,Ll=1e3/60,Ul=350;let at=!1;globalThis.document?.addEventListener("mousedown",()=>{at=!0});globalThis.document?.addEventListener("mouseup",()=>{at=!1});globalThis.document?.addEventListener("click",()=>{at=!1});const Fl=(e={})=>{const[t,r]=$.useState(!1),[n,o]=$.useState(e.initial!==!1),[a,s]=$.useState(!1),i=$.useRef(null);i.current=e;const u=$.useCallback(()=>{if(!at)return!1;const _=window.getSelection();if(!_||!_.rangeCount)return!1;const p=_.getRangeAt(0);return p.commonAncestorContainer.contains(g.current)||g.current?.contains(p.commonAncestorContainer)},[]),c=$.useCallback(_=>{l.isAtBottom=_,o(_)},[]),d=$.useCallback(_=>{l.escapedFromLock=_,r(_)},[]),l=$.useMemo(()=>{let _;return{escapedFromLock:t,isAtBottom:n,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(p){g.current&&(g.current.scrollTop=p,l.ignoreScrollToTop=g.current.scrollTop)},get targetScrollTop(){return!g.current||!E.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!E.current)return 0;const{targetScrollTop:p}=this;if(!e.targetScrollTop)return p;if(_?.targetScrollTop===p)return _.calculatedScrollTop;const b=Math.max(Math.min(e.targetScrollTop(p,{scrollElement:g.current,contentElement:E.current}),p),0);return _={targetScrollTop:p,calculatedScrollTop:b},requestAnimationFrame(()=>{_=void 0}),b},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Dl}}},[]),v=$.useCallback((_={})=>{typeof _=="string"&&(_={animation:_}),_.preserveScrollPosition||c(!0);const p=Date.now()+(Number(_.wait)||0),b=mt(i.current,_.animation),{ignoreEscapes:I=!1}=_;let x,O=l.calculatedTargetScrollTop;_.duration instanceof Promise?_.duration.finally(()=>{x=Date.now()}):x=p+(_.duration??0);const F=async()=>{const Ee=new Promise(requestAnimationFrame).then(()=>{if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:Ce}=l,st=performance.now(),eo=(st-(l.lastTick??st))/Ll;if(l.animation||(l.animation={behavior:b,promise:Ee,ignoreEscapes:I}),l.animation.behavior===b&&(l.lastTick=st),u()||p>Date.now())return F();if(Ce<Math.min(O,l.calculatedTargetScrollTop)){if(l.animation?.behavior===b){if(b==="instant")return l.scrollTop=l.calculatedTargetScrollTop,F();l.velocity=(b.damping*l.velocity+b.stiffness*l.scrollDifference)/b.mass,l.accumulated+=l.velocity*eo,l.scrollTop+=l.accumulated,l.scrollTop!==Ce&&(l.accumulated=0)}return F()}return x>Date.now()?(O=l.calculatedTargetScrollTop,F()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?v({animation:mt(i.current,i.current.resize),ignoreEscapes:I,duration:Math.max(0,x-Date.now())||void 0}):l.isAtBottom)});return Ee.then(Ce=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),Ce))};return _.wait!==!0&&(l.animation=void 0),l.animation?.behavior===b?l.animation.promise:F()},[c,u,l]),h=$.useCallback(()=>{d(!0),c(!1)},[d,c]),T=$.useCallback(({target:_})=>{if(_!==g.current)return;const{scrollTop:p,ignoreScrollToTop:b}=l;let{lastScrollTop:I=p}=l;l.lastScrollTop=p,l.ignoreScrollToTop=void 0,b&&b>p&&(I=b),s(l.isNearBottom),setTimeout(()=>{if(l.resizeDifference||p===b)return;if(u()){d(!0),c(!1);return}const x=p>I,O=p<I;if(l.animation?.ignoreEscapes){l.scrollTop=I;return}O&&(d(!0),c(!1)),x&&d(!1),!l.escapedFromLock&&l.isNearBottom&&c(!0)},1)},[d,c,u,l]),w=$.useCallback(({target:_,deltaY:p})=>{let b=_;for(;!["scroll","auto"].includes(getComputedStyle(b).overflow);){if(!b.parentElement)return;b=b.parentElement}b===g.current&&p<0&&g.current.scrollHeight>g.current.clientHeight&&!l.animation?.ignoreEscapes&&(d(!0),c(!1))},[d,c,l]),g=Er(_=>{g.current?.removeEventListener("scroll",T),g.current?.removeEventListener("wheel",w),_?.addEventListener("scroll",T,{passive:!0}),_?.addEventListener("wheel",w,{passive:!0})},[]),E=Er(_=>{if(l.resizeObserver?.disconnect(),!_)return;let p;l.resizeObserver=new ResizeObserver(([b])=>{const{height:I}=b.contentRect,x=I-(p??I);if(l.resizeDifference=x,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),s(l.isNearBottom),x>=0){const O=mt(i.current,p?i.current.resize:i.current.initial);v({animation:O,wait:!0,preserveScrollPosition:!0,duration:O==="instant"?void 0:Ul})}else l.isNearBottom&&(d(!1),c(!0));p=I,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===x&&(l.resizeDifference=0)},1)})}),l.resizeObserver?.observe(_)},[]);return{contentRef:E,scrollRef:g,scrollToBottom:v,stopScroll:h,isAtBottom:n||a,isNearBottom:a,escapedFromLock:t,state:l}};function Er(e,t){const r=$.useCallback(n=>(r.current=n,e(n)),t);return r}const ft=new Map;function mt(...e){const t={...Ml};let r=!1;for(const o of e){if(o==="instant"){r=!0;continue}typeof o=="object"&&(r=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const n=JSON.stringify(t);return ft.has(n)||ft.set(n,Object.freeze(t)),r?"instant":ft.get(n)}const Kn=$.createContext(null),Jl=typeof window<"u"?$.useLayoutEffect:$.useEffect;function Qe({instance:e,children:t,resize:r,initial:n,mass:o,damping:a,stiffness:s,targetScrollTop:i,contextRef:u,...c}){const d=$.useRef(null),l=$.useCallback((I,x)=>(b?.targetScrollTop??i)?.(I,x)??I,[i]),v=Fl({mass:o,damping:a,stiffness:s,resize:r,initial:n,targetScrollTop:l}),{scrollRef:h,contentRef:T,scrollToBottom:w,stopScroll:g,isAtBottom:E,escapedFromLock:_,state:p}=e??v,b=$.useMemo(()=>({scrollToBottom:w,stopScroll:g,scrollRef:h,isAtBottom:E,escapedFromLock:_,contentRef:T,state:p,get targetScrollTop(){return d.current},set targetScrollTop(I){d.current=I}}),[w,E,T,h,g,_,p]);return $.useImperativeHandle(u,()=>b,[b]),Jl(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),z.jsx(Kn.Provider,{value:b,children:z.jsx("div",{...c,children:typeof t=="function"?t(b):t})})}(function(e){function t({children:r,...n}){const o=Qn();return z.jsx("div",{ref:o.scrollRef,style:{height:"100%",width:"100%"},children:z.jsx("div",{...n,ref:o.contentRef,children:typeof r=="function"?r(o):r})})}e.Content=t})(Qe||(Qe={}));function Qn(){const e=$.useContext(Kn);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Bl=({className:e,...t})=>z.jsx(Qe,{className:te("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Vl=({className:e,...t})=>z.jsx(Qe.Content,{className:te("flex flex-col gap-8 p-4",e),...t}),ql=({className:e,title:t="No messages yet",description:r="Start a conversation to see messages here",icon:n,children:o,...a})=>z.jsx("div",{className:te("flex size-full flex-col items-center justify-center gap-3 p-8 text-center",e),...a,children:o??z.jsxs(z.Fragment,{children:[n&&z.jsx("div",{className:"text-muted-foreground",children:n}),z.jsxs("div",{className:"space-y-1",children:[z.jsx("h3",{className:"font-medium text-sm",children:t}),r&&z.jsx("p",{className:"text-muted-foreground text-sm",children:r})]})]})}),Wl=({className:e,...t})=>{const{isAtBottom:r,scrollToBottom:n}=Qn(),o=$.useCallback(()=>{n()},[n]);return!r&&z.jsx(Ir,{className:te("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full",e),onClick:o,size:"icon",type:"button",variant:"outline",...t,children:z.jsx(oo,{className:"size-4"})})};function Gl({className:e,...t}){return z.jsx("textarea",{"data-slot":"textarea",className:te("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}function Yl({className:e,...t}){return z.jsx("div",{"data-slot":"input-group",role:"group",className:te("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}const Hl=kr("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function Xl({className:e,align:t="inline-start",...r}){return z.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:te(Hl({align:t}),e),onClick:n=>{n.target.closest("button")||n.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}const Kl=kr("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function Ql({className:e,type:t="button",variant:r="ghost",size:n="xs",...o}){return z.jsx(Ir,{type:t,"data-size":n,variant:r,className:te(Kl({size:n}),e),...o})}function ed({className:e,...t}){return z.jsx(Gl,{"data-slot":"input-group-control",className:te("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}function td(e){const t=["☀️ Sunny","🌤️ Partly Cloudy","☁️ Cloudy","🌧️ Rainy","⛈️ Stormy","❄️ Snowy","🌫️ Foggy"],r=t[Math.floor(Math.random()*t.length)],n=Math.floor(Math.random()*35)+5,o=Math.floor(Math.random()*60)+30,a=Math.floor(Math.random()*30)+5;return{city:e,condition:r,temperature:`${n}°C`,humidity:`${o}%`,wind:`${a} km/h`}}function nd(){const[e,t]=$.useState(""),{data:r}=ro(),{messages:n,sendMessage:o,status:a,addToolOutput:s}=Cl({transport:new Hn({api:"/api/chat"}),sendAutomaticallyWhen:Zl,onToolCall:({toolCall:c})=>{if(c.toolName==="getWeather"){const d=c.input,l=td(d.city);s({tool:"getWeather",toolCallId:c.toolCallId,output:l})}}}),i=a==="streaming"||a==="submitted",u=c=>{c.preventDefault(),!(!e.trim()||i)&&(o({text:e}),t(""))};return z.jsxs("div",{className:"flex h-screen flex-col bg-linear-to-b from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900 gap-2",children:[z.jsxs(Bl,{children:[z.jsx(Vl,{children:n.length===0?z.jsx(ql,{icon:z.jsx($t,{className:"size-8"}),title:`Welcome${r?.user?`, ${r.user.name}`:""} !`,description:"Ask me about the weather in any city"}):n.map(c=>z.jsxs("div",{className:`flex gap-3 ${c.role==="user"?"justify-end":"justify-start"}`,children:[c.role==="assistant"&&z.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10",children:z.jsx($t,{className:"size-4"})}),z.jsx("div",{className:`max-w-[80%] rounded-2xl px-4 py-2 ${c.role==="user"?"bg-primary text-primary-foreground":"bg-muted"}`,children:z.jsx("pre",{className:"whitespace-pre-wrap text-sm",children:JSON.stringify(c,null,2)})}),c.role==="user"&&z.jsx("div",{className:"flex size-8 shrink-0 items-center justify-center rounded-full bg-primary",children:z.jsx(po,{className:"size-4 text-primary-foreground"})})]},c.id))}),z.jsx(Wl,{})]}),z.jsx("div",{className:"border-t bg-white/50 p-4 backdrop-blur-sm dark:bg-slate-900/50 mt-auto",children:z.jsx("form",{onSubmit:u,className:"mx-auto max-w-3xl",children:z.jsxs(Yl,{children:[z.jsx(ed,{placeholder:"Ask about the weather...",value:e,onChange:c=>t(c.target.value),onKeyDown:c=>{c.key==="Enter"&&!c.shiftKey&&(c.preventDefault(),u(c))}}),z.jsx(Xl,{align:"block-end",children:z.jsxs(Ql,{type:"submit",variant:"default",className:"rounded-full ml-auto",size:"icon-xs",disabled:!e||i,children:[i?z.jsx(uo,{className:"animate-spin"}):z.jsx(so,{}),z.jsx("span",{className:"sr-only",children:"Send"})]})})]})})})]})}export{nd as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as J,p as F,b as f,c as j,d as y,n as N,i as T,e as D,t as X,f as O,g as Y,h as Z,k as L,l as V,r as b,m as W,o as q,q as K,j as o,v as B,w as ee,B as z,x as te,L as se}from"./index-DDQ8i103.js";var re=class extends J{constructor(e,t){super(),this.options=t,this.#s=e,this.#i=null,this.#r=F(),this.bindMethods(),this.setOptions(t)}#s;#e=void 0;#p=void 0;#t=void 0;#a;#h;#r;#i;#m;#u;#d;#o;#l;#n;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),A(this.#e,this.options)?this.#c():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return M(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return M(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#R(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,s=this.#e;if(this.options=this.#s.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof f(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),t._defaulted&&!j(this.options,t)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&H(this.#e,s,this.options,t)&&this.#c(),this.updateResult(),r&&(this.#e!==s||f(this.options.enabled,this.#e)!==f(t.enabled,this.#e)||y(this.options.staleTime,this.#e)!==y(t.staleTime,this.#e))&&this.#b();const i=this.#v();r&&(this.#e!==s||f(this.options.enabled,this.#e)!==f(t.enabled,this.#e)||i!==this.#n)&&this.#g(i)}getOptimisticResult(e){const t=this.#s.getQueryCache().build(this.#s,e),s=this.createResult(t,e);return ne(this,s)&&(this.#t=s,this.#h=this.options,this.#a=this.#e.state),s}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(s,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(e){this.#f.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#s.defaultQueryOptions(e),s=this.#s.getQueryCache().build(this.#s,t);return s.fetch().then(()=>this.createResult(s,t))}fetch(e){return this.#c({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#c(e){this.#S();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(N)),t}#b(){this.#y();const e=y(this.options.staleTime,this.#e);if(T||this.#t.isStale||!D(e))return;const s=X(this.#t.dataUpdatedAt,e)+1;this.#o=O.setTimeout(()=>{this.#t.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#g(e){this.#R(),this.#n=e,!(T||f(this.options.enabled,this.#e)===!1||!D(this.#n)||this.#n===0)&&(this.#l=O.setInterval(()=>{(this.options.refetchIntervalInBackground||Y.isFocused())&&this.#c()},this.#n))}#x(){this.#b(),this.#g(this.#v())}#y(){this.#o&&(O.clearTimeout(this.#o),this.#o=void 0)}#R(){this.#l&&(O.clearInterval(this.#l),this.#l=void 0)}createResult(e,t){const s=this.#e,r=this.options,i=this.#t,h=this.#a,n=this.#h,v=e!==s?e.state:this.#p,{state:l}=e;let a={...l},u=!1,c;if(t._optimisticResults){const d=this.hasListeners(),S=!d&&A(e,t),x=d&&H(e,s,t,r);(S||x)&&(a={...a,...Z(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(a.fetchStatus="idle")}let{error:R,errorUpdatedAt:Q,status:g}=a;c=a.data;let k=!1;if(t.placeholderData!==void 0&&c===void 0&&g==="pending"){let d;i?.isPlaceholderData&&t.placeholderData===n?.placeholderData?(d=i.data,k=!0):d=typeof t.placeholderData=="function"?t.placeholderData(this.#d?.state.data,this.#d):t.placeholderData,d!==void 0&&(g="success",c=L(i?.data,d,t),u=!0)}if(t.select&&c!==void 0&&!k)if(i&&c===h?.data&&t.select===this.#m)c=this.#u;else try{this.#m=t.select,c=t.select(c),c=L(i?.data,c,t),this.#u=c,this.#i=null}catch(d){this.#i=d}this.#i&&(R=this.#i,c=this.#u,Q=Date.now(),g="error");const E=a.fetchStatus==="fetching",C=g==="pending",I=g==="error",P=C&&E,U=c!==void 0,m={status:g,fetchStatus:a.fetchStatus,isPending:C,isSuccess:g==="success",isError:I,isInitialLoading:P,isLoading:P,data:c,dataUpdatedAt:a.dataUpdatedAt,error:R,errorUpdatedAt:Q,failureCount:a.fetchFailureCount,failureReason:a.fetchFailureReason,errorUpdateCount:a.errorUpdateCount,isFetched:a.dataUpdateCount>0||a.errorUpdateCount>0,isFetchedAfterMount:a.dataUpdateCount>v.dataUpdateCount||a.errorUpdateCount>v.errorUpdateCount,isFetching:E,isRefetching:E&&!C,isLoadingError:I&&!U,isPaused:a.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:I&&U,isStale:_(e,t),refetch:this.refetch,promise:this.#r,isEnabled:f(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const d=w=>{m.status==="error"?w.reject(m.error):m.data!==void 0&&w.resolve(m.data)},S=()=>{const w=this.#r=m.promise=F();d(w)},x=this.#r;switch(x.status){case"pending":e.queryHash===s.queryHash&&d(x);break;case"fulfilled":(m.status==="error"||m.data!==x.value)&&S();break;case"rejected":(m.status!=="error"||m.error!==x.reason)&&S();break}}return m}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#a=this.#e.state,this.#h=this.options,this.#a.data!==void 0&&(this.#d=this.#e),j(t,e))return;this.#t=t;const s=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const h=new Set(i??this.#f);return this.options.throwOnError&&h.add("error"),Object.keys(this.#t).some(n=>{const p=n;return this.#t[p]!==e[p]&&h.has(p)})};this.#w({listeners:s()})}#S(){const e=this.#s.getQueryCache().build(this.#s,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#p=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#w(e){V.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#s.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ie(e,t){return f(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function A(e,t){return ie(e,t)||e.state.data!==void 0&&M(e,t,t.refetchOnMount)}function M(e,t,s){if(f(t.enabled,e)!==!1&&y(t.staleTime,e)!=="static"){const r=typeof s=="function"?s(e):s;return r==="always"||r!==!1&&_(e,t)}return!1}function H(e,t,s,r){return(e!==t||f(r.enabled,e)===!1)&&(!s.suspense||e.state.status!=="error")&&_(e,s)}function _(e,t){return f(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function ne(e,t){return!j(e.getCurrentResult(),t)}var $=b.createContext(!1),ae=()=>b.useContext($);$.Provider;function oe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var le=b.createContext(oe()),ce=()=>b.useContext(le),he=(e,t,s)=>{const r=s?.state.error&&typeof e.throwOnError=="function"?W(e.throwOnError,[s.state.error,s]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},ue=e=>{b.useEffect(()=>{e.clearReset()},[e])},de=({result:e,errorResetBoundary:t,throwOnError:s,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||W(s,[e.error,r])),fe=e=>{if(e.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},pe=(e,t)=>e.isLoading&&e.isFetching&&!t,me=(e,t)=>e?.suspense&&t.isPending,G=(e,t,s)=>t.fetchOptimistic(e).catch(()=>{s.clearReset()});function be(e,t,s){const r=ae(),i=ce(),h=q(),n=h.defaultQueryOptions(e);h.getDefaultOptions().queries?._experimental_beforeQuery?.(n);const p=h.getQueryCache().get(n.queryHash);n._optimisticResults=r?"isRestoring":"optimistic",fe(n),he(n,i,p),ue(i);const v=!h.getQueryCache().get(n.queryHash),[l]=b.useState(()=>new t(h,n)),a=l.getOptimisticResult(n),u=!r&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(c=>{const R=u?l.subscribe(V.batchCalls(c)):N;return l.updateResult(),R},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(n)},[n,l]),me(n,a))throw G(n,l,i);if(de({result:a,errorResetBoundary:i,throwOnError:n.throwOnError,query:p,suspense:n.suspense}))throw a.error;return h.getDefaultOptions().queries?._experimental_afterQuery?.(n,a),n.experimental_prefetchInRender&&!T&&pe(a,r)&&(v?G(n,l,i):p?.promise)?.catch(N).finally(()=>{l.updateResult()}),n.notifyOnChangeProps?a:l.trackResult(a)}function ve(e,t){return be(e,re)}const ge=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],xe=K("eye-off",ge);const ye=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Re=K("eye",ye);function Se({className:e,type:t,...s}){const[r,i]=b.useState(!1),h=t==="password",n=h&&r?"text":t;return h?o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:n,"data-slot":"input",className:B("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive","pr-10",e),...s}),o.jsx("button",{type:"button",onClick:()=>i(!r),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:r?o.jsx(xe,{size:16}):o.jsx(Re,{size:16})})]}):o.jsx("input",{type:t,"data-slot":"input",className:B("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...s})}function Ee({title:e,fields:t,formData:s,onSubmit:r,onChange:i,submitButtonText:h,footerText:n,footerLinkText:p,footerLinkTo:v,error:l}){const a=ve(ee.hasGoogleSetup.queryOptions());return o.jsxs("div",{className:"container mx-auto w-full max-w-2xl p-12",children:[o.jsx("h1",{className:"text-4xl font-bold mb-8 text-center",children:e}),l&&o.jsx("p",{className:"text-red-500 text-center mb-4 text-2xl",children:l}),o.jsxs("form",{onSubmit:r,className:"space-y-6",children:[t.map(u=>o.jsxs("div",{className:"space-y-3",children:[o.jsx("label",{htmlFor:u.id,className:"text-base font-medium",children:u.label}),o.jsx(Se,{id:u.id,name:u.name,type:u.type,placeholder:u.placeholder,value:s[u.name],onChange:i,required:!0,className:"h-12 text-base"})]},u.id)),o.jsx(z,{type:"submit",className:"w-full h-12 text-base",children:h})]}),a.data&&o.jsxs("div",{className:"mt-8",children:[o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-gray-300"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"px-2 bg-background text-muted-foreground",children:"Or continue with"})})]}),o.jsx("div",{className:"flex justify-center items-center gap-4 p-4",children:o.jsx(z,{type:"button",variant:"outline",onClick:te,children:o.jsx("img",{src:"/google-icon.svg",alt:"Google",className:"w-5 h-5"})})})]}),o.jsxs("p",{className:"text-center text-sm text-muted-foreground mt-8",children:[n," ",o.jsx(se,{to:v,className:"text-primary hover:underline font-medium",children:p})]})]})}export{Ee as S};
|
nao_core-0.0.12.dist-info/RECORD
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
nao_core/__init__.py,sha256=WcAlXO4djxo-7DamkDEUddIVt7aDHo0joNLQIa_y34U,46
|
|
2
|
-
nao_core/config.py,sha256=uNZ_q6f6IC3i7e8SFu-CXJhcCboNNm3UjnL4KHpw-cw,4527
|
|
3
|
-
nao_core/main.py,sha256=f00vLL4s2B2kCMa8y3lI56LX3TnUppWzYmqM6eOGomA,205
|
|
4
|
-
nao_core/bin/db.sqlite,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
nao_core/bin/nao-chat-server,sha256=JxuPOtwbfj-2O-L8PTkxZ0qwqN2QFniyA8UahdNkvFA,64657392
|
|
6
|
-
nao_core/bin/migrations-postgres/0000_supreme_cable.sql,sha256=BR_BcHRpUr35pbrRDOsFbRm9u4wC-AQ9orGuAc4BJok,3751
|
|
7
|
-
nao_core/bin/migrations-postgres/meta/0000_snapshot.json,sha256=lAf2CNFAqTtLw2mjsF2vdKryTb5UbkwSa1K9XmCcdyY,15080
|
|
8
|
-
nao_core/bin/migrations-postgres/meta/_journal.json,sha256=zIBPX9lX4UnSgo3fzeoQXh2u3M9ZlyxRDvs8-VzBJbI,207
|
|
9
|
-
nao_core/bin/migrations-sqlite/0000_cloudy_squirrel_girl.sql,sha256=i8NqZSv7qTzcVIoLBE0pNcuM4ZCp4WS9iYMUXxzqCT0,3609
|
|
10
|
-
nao_core/bin/migrations-sqlite/meta/0000_snapshot.json,sha256=q-O9sjRNmCT3s0-ZyF1gZ60ZaDH24wGjC-VHG-2RdVU,15268
|
|
11
|
-
nao_core/bin/migrations-sqlite/meta/_journal.json,sha256=-8raNXK1aCMrt-25YnnIM4GRb9w_JT6AtiDDBQfBgx0,210
|
|
12
|
-
nao_core/bin/public/favicon.ico,sha256=PRD32mxgMXg0AIFmjErFs66XQ8qaJiqw_NMS-7n0i90,3870
|
|
13
|
-
nao_core/bin/public/github-icon.svg,sha256=drFeRxLjsnngoGOh4heU3E5mX_xUsmGgFOc_mnjXKwU,1926
|
|
14
|
-
nao_core/bin/public/google-icon.svg,sha256=bTmcoH4gkdoV2Atl2kp-pLFpFZNL85FR_8GAKv9LL5I,1140
|
|
15
|
-
nao_core/bin/public/index.html,sha256=0yNSTPcMrqOTqzdtXW_f6cFgRREu2p---I9zJ3MFfDU,673
|
|
16
|
-
nao_core/bin/public/assets/index-BUcR0FCx.css,sha256=eFyOpg9FkG1rNO1e-wzN9bZrg75o2SyY7w3CLWEbtFM,33934
|
|
17
|
-
nao_core/bin/public/assets/index-DDQ8i103.js,sha256=ehrsXjqcN9NUdM62zT_GP4QNtdy2tk6Ds03d18mc-r4,391372
|
|
18
|
-
nao_core/bin/public/assets/index-nOBqrovO.js,sha256=g3UApSCzInHrcOvwaJLAfPl02CHbfqv--29xXdP__U0,147313
|
|
19
|
-
nao_core/bin/public/assets/login-CGCfd7iQ.js,sha256=d7y6AY48csru9I-5z1kf5MddbweZGSQ6RNxR_Y7YfoI,793
|
|
20
|
-
nao_core/bin/public/assets/signinForm-BGrBZeLW.js,sha256=Chxtb6izq0yHfLCc15es9-JoBOt9TGpyiWJHs9dBR60,12840
|
|
21
|
-
nao_core/bin/public/assets/signup-BGjbIX9B.js,sha256=MRPVZjq_sQb5gkrSB3irmN3SVDD3AxqlzQKqozTxq9Y,832
|
|
22
|
-
nao_core/commands/__init__.py,sha256=rFCuUyA9wM4hS6CxCt2M_5W4VysyQXh6HkA_hyRCxPc,207
|
|
23
|
-
nao_core/commands/chat.py,sha256=xhcBfP40IedunfLX73VNDM5VOGBDnqqii4khoVE-imY,4430
|
|
24
|
-
nao_core/commands/debug.py,sha256=G4SWixljwSh_S_wNdVaSFW8L3TM8rX4e4abC3gQNgjY,4865
|
|
25
|
-
nao_core/commands/init.py,sha256=lL4Zn8KIhgH2hRTFOBuQIHpiReSeOF517J4s4zBdwEk,5175
|
|
26
|
-
nao_core/commands/sync.py,sha256=1jynQ6vSip5XXs1YNJjIpq_mgdP4jvonQ21bnE1dkRY,4696
|
|
27
|
-
nao_core-0.0.12.dist-info/METADATA,sha256=z9bCPOxVkrsy1Im3Abv0iLbJhTvvnS89jCra1ECMhHI,5143
|
|
28
|
-
nao_core-0.0.12.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
29
|
-
nao_core-0.0.12.dist-info/entry_points.txt,sha256=SZakIiNybgS3pl_OEZVLyLSweadeBFoEMBECMoj9czY,42
|
|
30
|
-
nao_core-0.0.12.dist-info/licenses/LICENSE,sha256=rn5YtWB6E5hPQI49tCTNSyqlArWGsB6HzA5FfSbRHRs,1066
|
|
31
|
-
nao_core-0.0.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|