@gram-ai/elements 1.21.2 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Chat/stories/StyleIsolation.stories.d.ts +6 -0
- package/dist/components/Chat/stories/Theme.stories.d.ts +8 -0
- package/dist/components/Chat/stories/ToolMentions.stories.d.ts +19 -0
- package/dist/components/ChatHistory.d.ts +5 -0
- package/dist/components/ShadowRoot.d.ts +8 -0
- package/dist/components/assistant-ui/mentioned-tools-badges.d.ts +10 -0
- package/dist/components/assistant-ui/tool-mention-autocomplete.d.ts +12 -0
- package/dist/elements.cjs +1 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +1 -1
- package/dist/embedded.d.ts +0 -0
- package/dist/hooks/useGramThreadListAdapter.d.ts +7 -0
- package/dist/hooks/useMCPTools.d.ts +2 -1
- package/dist/hooks/useToolMentions.d.ts +17 -0
- package/dist/index-DSGCuihM.cjs +145 -0
- package/dist/index-DSGCuihM.cjs.map +1 -0
- package/dist/index-DiaPGyWF.js +38113 -0
- package/dist/index-DiaPGyWF.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/lib/tool-mentions.d.ts +20 -0
- package/dist/{profiler-DPH9zydw.cjs → profiler-Cr1UEa8B.cjs} +2 -2
- package/dist/{profiler-DPH9zydw.cjs.map → profiler-Cr1UEa8B.cjs.map} +1 -1
- package/dist/{profiler-D_HNXmyv.js → profiler-DL_h66-O.js} +2 -2
- package/dist/{profiler-D_HNXmyv.js.map → profiler-DL_h66-O.js.map} +1 -1
- package/dist/{startRecording-DOMzQAAr.js → startRecording-BW2zkd0-.js} +2 -2
- package/dist/{startRecording-DOMzQAAr.js.map → startRecording-BW2zkd0-.js.map} +1 -1
- package/dist/{startRecording-B97e4Mlu.cjs → startRecording-D8-ckYMS.cjs} +2 -2
- package/dist/{startRecording-B97e4Mlu.cjs.map → startRecording-D8-ckYMS.cjs.map} +1 -1
- package/dist/types/index.d.ts +20 -0
- package/package.json +13 -4
- package/src/components/Chat/index.tsx +4 -13
- package/src/components/Chat/stories/StyleIsolation.stories.tsx +41 -0
- package/src/components/Chat/stories/Theme.stories.tsx +74 -0
- package/src/components/Chat/stories/ToolApproval.stories.tsx +0 -1
- package/src/components/Chat/stories/ToolMentions.stories.tsx +62 -0
- package/src/components/ChatHistory.tsx +16 -0
- package/src/components/ShadowRoot.tsx +90 -0
- package/src/components/assistant-ui/markdown-text.tsx +0 -2
- package/src/components/assistant-ui/mentioned-tools-badges.tsx +105 -0
- package/src/components/assistant-ui/thread-list.tsx +1 -3
- package/src/components/assistant-ui/thread.tsx +106 -1
- package/src/components/assistant-ui/tool-mention-autocomplete.tsx +253 -0
- package/src/components/ui/tool-ui.tsx +1 -1
- package/src/contexts/ElementsProvider.tsx +67 -10
- package/src/embedded.ts +3 -0
- package/src/global.css +45 -0
- package/src/hooks/useGramThreadListAdapter.tsx +90 -9
- package/src/hooks/useMCPTools.ts +4 -1
- package/src/hooks/useToolMentions.ts +93 -0
- package/src/index.ts +2 -1
- package/src/lib/tool-mentions.ts +106 -0
- package/src/types/index.ts +23 -0
- package/src/vite-env.d.ts +5 -0
- package/dist/index-BVvrv2G3.cjs +0 -169
- package/dist/index-BVvrv2G3.cjs.map +0 -1
- package/dist/index-OU3wjArm.js +0 -54670
- package/dist/index-OU3wjArm.js.map +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";const p=require("react/jsx-runtime"),$=require("./index-D8g4LkEy.cjs"),N=require("react"),z=require("@assistant-ui/react"),dd=require("@assistant-ui/react-ai-sdk"),Lt=require("motion/react"),K1=require("motion/react-m"),Y1=require("zustand/shallow"),fd=require("react-dom"),gu=require("@assistant-ui/react-markdown"),X1=require("remark-gfm"),Q1=require("shiki");function md(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const _=md(N),Ut=md(K1),Vv=md(fd);function Zv({tools:e}){return p.jsx(p.Fragment,{children:Object.entries(e).map(([,t])=>t({}))})}var Bv="vercel.ai.error",eO=Symbol.for(Bv),qv,tO=class Gv extends Error{constructor({name:t,message:r,cause:o}){super(r),this[qv]=!0,this.name=t,this.cause=o}static isInstance(t){return Gv.hasMarker(t,Bv)}static hasMarker(t,r){const o=Symbol.for(r);return t!=null&&typeof t=="object"&&o in t&&typeof t[o]=="boolean"&&t[o]===!0}};qv=eO;var ee=tO,Hv="AI_APICallError",Wv=`vercel.ai.error.${Hv}`,rO=Symbol.for(Wv),Jv,st=class extends ee{constructor({message:t,url:r,requestBodyValues:o,statusCode:n,responseHeaders:i,responseBody:a,cause:s,isRetryable:c=n!=null&&(n===408||n===409||n===429||n>=500),data:l}){super({name:Hv,message:t,cause:s}),this[Jv]=!0,this.url=r,this.requestBodyValues=o,this.statusCode=n,this.responseHeaders=i,this.responseBody=a,this.isRetryable=c,this.data=l}static isInstance(t){return ee.hasMarker(t,Wv)}};Jv=rO;var Kv="AI_EmptyResponseBodyError",Yv=`vercel.ai.error.${Kv}`,nO=Symbol.for(Yv),Xv,oO=class extends ee{constructor({message:t="Empty response body"}={}){super({name:Kv,message:t}),this[Xv]=!0}static isInstance(t){return ee.hasMarker(t,Yv)}};Xv=nO;function uo(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Qv="AI_InvalidArgumentError",ey=`vercel.ai.error.${Qv}`,iO=Symbol.for(ey),ty,pd=class extends ee{constructor({message:t,cause:r,argument:o}){super({name:Qv,message:t,cause:r}),this[ty]=!0,this.argument=o}static isInstance(t){return ee.hasMarker(t,ey)}};ty=iO;var ry="AI_InvalidPromptError",ny=`vercel.ai.error.${ry}`,aO=Symbol.for(ny),oy,In=class extends ee{constructor({prompt:t,message:r,cause:o}){super({name:ry,message:`Invalid prompt: ${r}`,cause:o}),this[oy]=!0,this.prompt=t}static isInstance(t){return ee.hasMarker(t,ny)}};oy=aO;var iy="AI_JSONParseError",ay=`vercel.ai.error.${iy}`,sO=Symbol.for(ay),sy,Ha=class extends ee{constructor({text:t,cause:r}){super({name:iy,message:`JSON parsing failed: Text: ${t}.
|
|
2
|
+
Error message: ${uo(r)}`,cause:r}),this[sy]=!0,this.text=t}static isInstance(t){return ee.hasMarker(t,ay)}};sy=sO;var cy="AI_NoSuchModelError",ly=`vercel.ai.error.${cy}`,cO=Symbol.for(ly),uy,lO=class extends ee{constructor({errorName:e=cy,modelId:t,modelType:r,message:o=`No such ${r}: ${t}`}){super({name:e,message:o}),this[uy]=!0,this.modelId=t,this.modelType=r}static isInstance(e){return ee.hasMarker(e,ly)}};uy=cO;var dy="AI_TypeValidationError",fy=`vercel.ai.error.${dy}`,uO=Symbol.for(fy),my,dO=class hu extends ee{constructor({value:t,cause:r}){super({name:dy,message:`Type validation failed: Value: ${JSON.stringify(t)}.
|
|
3
|
+
Error message: ${uo(r)}`,cause:r}),this[my]=!0,this.value=t}static isInstance(t){return ee.hasMarker(t,fy)}static wrap({value:t,cause:r}){return hu.isInstance(r)&&r.value===t?r:new hu({value:t,cause:r})}};my=uO;var Ko=dO;let Fp=class 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 vl(e){}function fO(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=vl,onError:r=vl,onRetry:o=vl,onComment:n}=e;let i="",a=!0,s,c="",l="";function u(g){const y=a?g.replace(/^\xEF\xBB\xBF/,""):g,[b,w]=mO(`${i}${y}`);for(const x of b)d(x);i=w,a=!1}function d(g){if(g===""){m();return}if(g.startsWith(":")){n&&n(g.slice(g.startsWith(": ")?2:1));return}const y=g.indexOf(":");if(y!==-1){const b=g.slice(0,y),w=g[y+1]===" "?2:1,x=g.slice(y+w);f(b,x,g);return}f(g,"",g)}function f(g,y,b){switch(g){case"event":l=y;break;case"data":c=`${c}${y}
|
|
4
|
+
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?o(parseInt(y,10)):r(new Fp(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:b}));break;default:r(new Fp(`Unknown field "${g.length>20?`${g.slice(0,20)}…`:g}"`,{type:"unknown-field",field:g,value:y,line:b}));break}}function m(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
|
|
5
|
+
`)?c.slice(0,-1):c}),s=void 0,c="",l=""}function h(g={}){i&&g.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:h}}function mO(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),i=e.indexOf(`
|
|
6
|
+
`,o);let a=-1;if(n!==-1&&i!==-1?a=Math.min(n,i):n!==-1?n===e.length-1?a=-1:a=n:i!==-1&&(a=i),a===-1){r=e.slice(o);break}else{const s=e.slice(o,a);t.push(s),o=a+1,e[o-1]==="\r"&&e[o]===`
|
|
7
|
+
`&&o++}}return[t,r]}let Wa=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o}={}){let n;super({start(i){n=fO({onEvent:a=>{i.enqueue(a)},onError(a){t==="terminate"?i.error(a):typeof t=="function"&&t(a)},onRetry:r,onComment:o})},transform(i){n.feed(i)}})}};const gd=Object.freeze({status:"aborted"});function T(e,t,r){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);const l=a.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){const f=u[d];f in s||(s[f]=l[f].bind(s))}}const n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var c;const l=r?.Parent?new i:this;o(l,s),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}const py=Symbol("zod_brand");class tn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Rs extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ja={};function Xe(e){return e&&Object.assign(Ja,e),Ja}function pO(e){return e}function gO(e){return e}function hO(e){}function vO(e){throw new Error("Unexpected value in exhaustive check")}function yO(e){}function hd(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function R(e,t="|"){return e.map(r=>J(r)).join(t)}function Ka(e,t){return typeof t=="bigint"?t.toString():t}function xi(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function pn(e){return e==null}function Ps(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function gy(e,t){const r=(e.toString().split(".")[1]||"").length,o=t.toString();let n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){const c=o.match(/\d?e-(\d?)/);c?.[1]&&(n=Number.parseInt(c[1]))}const i=r>n?r:n,a=Number.parseInt(e.toFixed(i).replace(".","")),s=Number.parseInt(t.toFixed(i).replace(".",""));return a%s/10**i}const Vp=Symbol("evaluating");function de(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Vp)return o===void 0&&(o=Vp,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function bO(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function wr(...e){const t={};for(const r of e){const o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function _O(e){return wr(e._zod.def)}function wO(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function xO(e){const t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{const n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function SO(e=10){const t="abcdefghijklmnopqrstuvwxyz";let r="";for(let o=0;o<e;o++)r+=t[Math.floor(Math.random()*t.length)];return r}function vu(e){return JSON.stringify(e)}function hy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const vd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const vy=xi(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function nn(e){if(Gn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Gn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function js(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}function kO(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const EO=e=>{const t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Ya=new Set(["string","number","symbol"]),yy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function fr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Nt(e,t,r){const o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function C(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 IO(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function J(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function by(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const _y={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]},wy={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xy(e,t){const r=e._zod.def,o=wr(e._zod.def,{get shape(){const n={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(n[i]=r.shape[i])}return Fr(this,"shape",n),n},checks:[]});return Nt(e,o)}function Sy(e,t){const r=e._zod.def,o=wr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete n[i]}return Fr(this,"shape",n),n},checks:[]});return Nt(e,o)}function ky(e,t){if(!nn(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 n=wr(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Fr(this,"shape",i),i},checks:[]});return Nt(e,n)}function Ey(e,t){if(!nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const o={...e._zod.def.shape,...t};return Fr(this,"shape",o),o},checks:e._zod.def.checks};return Nt(e,r)}function Iy(e,t){const r=wr(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Fr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Nt(e,r)}function Ty(e,t,r){const o=wr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const a in r){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=e?new e({type:"optional",innerType:n[a]}):n[a])}else for(const a in n)i[a]=e?new e({type:"optional",innerType:n[a]}):n[a];return Fr(this,"shape",i),i},checks:[]});return Nt(t,o)}function $y(e,t,r){const o=wr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(const a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return Fr(this,"shape",i),i},checks:[]});return Nt(t,o)}function Kr(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 Ft(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Fo(e){return typeof e=="string"?e:e?.message}function At(e,t,r){const o={...e,path:e.path??[]};if(!e.message){const n=Fo(e.inst?._zod.def?.error?.(e))??Fo(t?.error?.(e))??Fo(r.customError?.(e))??Fo(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Ds(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function zs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hn(...e){const[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function TO(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Oy(e){const t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function Ay(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function $O(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Oy(t+r)}function OO(e){return Ay(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function AO(e){const t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");const r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function CO(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class NO{constructor(...t){}}const Cy=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:wy,Class:NO,NUMBER_FORMAT_RANGES:_y,aborted:Kr,allowsEval:vy,assert:yO,assertEqual:pO,assertIs:hO,assertNever:vO,assertNotEqual:gO,assignProp:Fr,base64ToUint8Array:Oy,base64urlToUint8Array:$O,cached:xi,captureStackTrace:vd,cleanEnum:TO,cleanRegex:Ps,clone:Nt,cloneDef:_O,createTransparentProxy:IO,defineLazy:de,esc:vu,escapeRegex:fr,extend:ky,finalizeIssue:At,floatSafeRemainder:gy,getElementAtPath:wO,getEnumValues:hd,getLengthableOrigin:zs,getParsedType:EO,getSizableOrigin:Ds,hexToUint8Array:AO,isObject:Gn,isPlainObject:nn,issue:Hn,joinValues:R,jsonStringifyReplacer:Ka,merge:Iy,mergeDefs:wr,normalizeParams:C,nullish:pn,numKeys:kO,objectClone:bO,omit:Sy,optionalKeys:by,partial:Ty,pick:xy,prefixIssues:Ft,primitiveTypes:yy,promiseAllObject:xO,propertyKeyTypes:Ya,randomString:SO,required:$y,safeExtend:Ey,shallowClone:js,slugify:hy,stringifyPrimitive:J,uint8ArrayToBase64:Ay,uint8ArrayToBase64url:OO,uint8ArrayToHex:CO,unwrapMessage:Fo},Symbol.toStringTag,{value:"Module"})),Ny=(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,Ka,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},yd=T("$ZodError",Ny),kt=T("$ZodError",Ny,{Parent:Error});function bd(e,t=r=>r.message){const r={},o=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):o.push(t(n));return{formErrors:o,fieldErrors:r}}function _d(e,t=r=>r.message){const r={_errors:[]},o=n=>{for(const i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;for(;s<i.path.length;){const c=i.path[s];s===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],s++}}};return o(e),r}function Ry(e,t=r=>r.message){const r={errors:[]},o=(n,i=[])=>{var a,s;for(const c of n.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(l=>o({issues:l},c.path));else if(c.code==="invalid_key")o({issues:c.issues},c.path);else if(c.code==="invalid_element")o({issues:c.issues},c.path);else{const l=[...i,...c.path];if(l.length===0){r.errors.push(t(c));continue}let u=r,d=0;for(;d<l.length;){const f=l[d],m=d===l.length-1;typeof f=="string"?(u.properties??(u.properties={}),(a=u.properties)[f]??(a[f]={errors:[]}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),m&&u.errors.push(t(c)),d++}}};return o(e),r}function Py(e){const t=[],r=e.map(o=>typeof o=="object"?o.key:o);for(const o of r)typeof o=="number"?t.push(`[${o}]`):typeof o=="symbol"?t.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?t.push(`[${JSON.stringify(o)}]`):(t.length&&t.push("."),t.push(o));return t.join("")}function jy(e){const t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(const o of r)t.push(`✖ ${o.message}`),o.path?.length&&t.push(` → at ${Py(o.path)}`);return t.join(`
|
|
8
|
+
`)}const Si=e=>(t,r,o,n)=>{const i=o?Object.assign(o,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new tn;if(a.issues.length){const s=new(n?.Err??e)(a.issues.map(c=>At(c,i,Xe())));throw vd(s,n?.callee),s}return a.value},yu=Si(kt),ki=e=>async(t,r,o,n)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const s=new(n?.Err??e)(a.issues.map(c=>At(c,i,Xe())));throw vd(s,n?.callee),s}return a.value},bu=ki(kt),Ei=e=>(t,r,o)=>{const n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new tn;return i.issues.length?{success:!1,error:new(e??yd)(i.issues.map(a=>At(a,n,Xe())))}:{success:!0,data:i.value}},Dy=Ei(kt),Ii=e=>async(t,r,o)=>{const n=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},n);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>At(a,n,Xe())))}:{success:!0,data:i.value}},zy=Ii(kt),wd=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Si(e)(t,r,n)},RO=wd(kt),xd=e=>(t,r,o)=>Si(e)(t,r,o),PO=xd(kt),Sd=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ki(e)(t,r,n)},jO=Sd(kt),kd=e=>async(t,r,o)=>ki(e)(t,r,o),DO=kd(kt),Ed=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ei(e)(t,r,n)},zO=Ed(kt),Id=e=>(t,r,o)=>Ei(e)(t,r,o),MO=Id(kt),Td=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ii(e)(t,r,n)},UO=Td(kt),$d=e=>async(t,r,o)=>Ii(e)(t,r,o),LO=$d(kt),My=/^[cC][^\s-]{8,}$/,Uy=/^[0-9a-z]+$/,Ly=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Fy=/^[0-9a-vA-V]{20}$/,Vy=/^[A-Za-z0-9]{27}$/,Zy=/^[a-zA-Z0-9_-]{21}$/,By=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,FO=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qy=/^([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})$/,Wn=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)$/,VO=Wn(4),ZO=Wn(6),BO=Wn(7),Gy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,qO=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,GO=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Hy=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,HO=Hy,WO=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,JO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Wy(){return new RegExp(JO,"u")}const Jy=/^(?:(?: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])$/,Ky=/^(([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}|:))$/,Yy=e=>{const t=fr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Xy=/^((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])$/,Qy=/^(([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])$/,eb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Od=/^[A-Za-z0-9_-]*$/,tb=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,rb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,nb=/^\+(?:[0-9]){6,14}[0-9]$/,ob="(?:(?:\\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])))",ib=new RegExp(`^${ob}$`);function ab(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 sb(e){return new RegExp(`^${ab(e)}$`)}function cb(e){const t=ab({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${r.join("|")})`;return new RegExp(`^${ob}T(?:${o})$`)}const lb=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ub=/^-?\d+n?$/,db=/^-?\d+$/,fb=/^-?\d+(?:\.\d+)?/,mb=/^(?:true|false)$/i,pb=/^null$/i,gb=/^undefined$/i,hb=/^[^A-Z]*$/,vb=/^[^a-z]*$/,yb=/^[0-9a-fA-F]*$/;function Ti(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function $i(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const KO=/^[0-9a-fA-F]{32}$/,YO=Ti(22,"=="),XO=$i(22),QO=/^[0-9a-fA-F]{40}$/,eA=Ti(27,"="),tA=$i(27),rA=/^[0-9a-fA-F]{64}$/,nA=Ti(43,"="),oA=$i(43),iA=/^[0-9a-fA-F]{96}$/,aA=Ti(64,""),sA=$i(64),cA=/^[0-9a-fA-F]{128}$/,lA=Ti(86,"=="),uA=$i(86),Ad=Object.freeze(Object.defineProperty({__proto__:null,base64:eb,base64url:Od,bigint:ub,boolean:mb,browserEmail:WO,cidrv4:Xy,cidrv6:Qy,cuid:My,cuid2:Uy,date:ib,datetime:cb,domain:rb,duration:By,e164:nb,email:Gy,emoji:Wy,extendedDuration:FO,guid:qy,hex:yb,hostname:tb,html5Email:qO,idnEmail:HO,integer:db,ipv4:Jy,ipv6:Ky,ksuid:Vy,lowercase:hb,mac:Yy,md5_base64:YO,md5_base64url:XO,md5_hex:KO,nanoid:Zy,null:pb,number:fb,rfc5322Email:GO,sha1_base64:eA,sha1_base64url:tA,sha1_hex:QO,sha256_base64:nA,sha256_base64url:oA,sha256_hex:rA,sha384_base64:aA,sha384_base64url:sA,sha384_hex:iA,sha512_base64:lA,sha512_base64url:uA,sha512_hex:cA,string:lb,time:sb,ulid:Ly,undefined:gb,unicodeEmail:Hy,uppercase:vb,uuid:Wn,uuid4:VO,uuid6:ZO,uuid7:BO,xid:Fy},Symbol.toStringTag,{value:"Module"})),Ae=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),bb={number:"number",bigint:"bigint",object:"date"},Cd=T("$ZodCheckLessThan",(e,t)=>{Ae.init(e,t);const r=bb[typeof t.value];e._zod.onattach.push(o=>{const n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value<=t.value:o.value<t.value)||o.issues.push({origin:r,code:"too_big",maximum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nd=T("$ZodCheckGreaterThan",(e,t)=>{Ae.init(e,t);const r=bb[typeof t.value];e._zod.onattach.push(o=>{const n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:r,code:"too_small",minimum:t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_b=T("$ZodCheckMultipleOf",(e,t)=>{Ae.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.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):gy(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})}}),wb=T("$ZodCheckNumberFormat",(e,t)=>{Ae.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),o=r?"int":"number",[n,i]=_y[t.format];e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,s.minimum=n,s.maximum=i,r&&(s.pattern=db)}),e._zod.check=a=>{const s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,continue:!t.abort});return}}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>i&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inst:e})}}),xb=T("$ZodCheckBigIntFormat",(e,t)=>{Ae.init(e,t);const[r,o]=wy[t.format];e._zod.onattach.push(n=>{const i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=n=>{const i=n.value;i<r&&n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>o&&n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inst:e})}}),Sb=T("$ZodCheckMaxSize",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const n=o.value;n.size<=t.maximum||o.issues.push({origin:Ds(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),kb=T("$ZodCheckMinSize",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const n=o.value;n.size>=t.minimum||o.issues.push({origin:Ds(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Eb=T("$ZodCheckSizeEquals",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{const n=o.value,i=n.size;if(i===t.size)return;const a=i>t.size;o.issues.push({origin:Ds(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Ib=T("$ZodCheckMaxLength",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const n=o.value;if(n.length<=t.maximum)return;const a=zs(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Tb=T("$ZodCheckMinLength",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const n=o.value;if(n.length>=t.minimum)return;const a=zs(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$b=T("$ZodCheckLengthEquals",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{const n=o.value,i=n.length;if(i===t.length)return;const a=zs(n),s=i>t.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Oi=T("$ZodCheckStringFormat",(e,t)=>{var r,o;Ae.init(e,t),e._zod.onattach.push(n=>{const i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ob=T("$ZodCheckRegex",(e,t)=>{Oi.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})}}),Ab=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hb),Oi.init(e,t)}),Cb=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=vb),Oi.init(e,t)}),Nb=T("$ZodCheckIncludes",(e,t)=>{Ae.init(e,t);const r=fr(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rb=T("$ZodCheckStartsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`^${fr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Pb=T("$ZodCheckEndsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`.*${fr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Zp(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues))}const jb=T("$ZodCheckProperty",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{const o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>Zp(n,r,t.property));Zp(o,r,t.property)}}),Db=T("$ZodCheckMimeType",(e,t)=>{Ae.init(e,t);const r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),zb=T("$ZodCheckOverwrite",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Mb{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 o=t.split(`
|
|
9
|
+
`).filter(a=>a),n=Math.min(...o.map(a=>a.length-a.trimStart().length)),i=o.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,r=this?.args,n=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...r,n.join(`
|
|
10
|
+
`))}}const Ub={major:4,minor:2,patch:1},Y=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ub;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const n of o)for(const i of n._zod.onattach)i(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const n=(a,s,c)=>{let l=Kr(a),u;for(const d of s){if(d._zod.def.when){if(!d._zod.def.when(a))continue}else if(l)continue;const f=a.issues.length,m=d._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new tn;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await m,a.issues.length!==f&&(l||(l=Kr(a,f)))});else{if(a.issues.length===f)continue;l||(l=Kr(a,f))}}return u?u.then(()=>a):a},i=(a,s,c)=>{if(Kr(a))return a.aborted=!0,a;const l=n(s,o,c);if(l instanceof Promise){if(c.async===!1)throw new tn;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(a,s)=>{if(s.skipChecks)return e._zod.parse(a,s);if(s.direction==="backward"){const l=e._zod.parse({value:a.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(u=>i(u,a,s)):i(l,a,s)}const c=e._zod.parse(a,s);if(c instanceof Promise){if(s.async===!1)throw new tn;return c.then(l=>n(l,o,s))}return n(c,o,s)}}e["~standard"]={validate:n=>{try{const i=Dy(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return zy(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}}),Ai=T("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lb(e._zod.bag),e._zod.parse=(r,o)=>{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}}),Ee=T("$ZodStringFormat",(e,t)=>{Oi.init(e,t),Ai.init(e,t)}),Lb=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=qy),Ee.init(e,t)}),Fb=T("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wn(o))}else t.pattern??(t.pattern=Wn());Ee.init(e,t)}),Vb=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Gy),Ee.init(e,t)}),Zb=T("$ZodURL",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{try{const o=r.value.trim(),n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.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(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.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=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Bb=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Wy()),Ee.init(e,t)}),qb=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Zy),Ee.init(e,t)}),Gb=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=My),Ee.init(e,t)}),Hb=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Uy),Ee.init(e,t)}),Wb=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ly),Ee.init(e,t)}),Jb=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fy),Ee.init(e,t)}),Kb=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Vy),Ee.init(e,t)}),Yb=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=cb(t)),Ee.init(e,t)}),Xb=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ib),Ee.init(e,t)}),Qb=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sb(t)),Ee.init(e,t)}),e_=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=By),Ee.init(e,t)}),t_=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Jy),Ee.init(e,t),e._zod.bag.format="ipv4"}),r_=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ky),Ee.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})}}}),n_=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Yy(t.delimiter)),Ee.init(e,t),e._zod.bag.format="mac"}),o_=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xy),Ee.init(e,t)}),i_=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qy),Ee.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[n,i]=o;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${n}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Rd(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const a_=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eb),Ee.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Rd(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function s_(e){if(!Od.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Rd(r)}const c_=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Od),Ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{s_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),l_=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nb),Ee.init(e,t)});function u_(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[o]=r;if(!o)return!1;const n=JSON.parse(atob(o));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}const d_=T("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{u_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),f_=T("$ZodCustomStringFormat",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Pd=T("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=e._zod.bag.pattern??fb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;const i=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),r}}),m_=T("$ZodNumberFormat",(e,t)=>{wb.init(e,t),Pd.init(e,t)}),jd=T("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=mb,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}const n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),Dd=T("$ZodBigInt",(e,t)=>{Y.init(e,t),e._zod.pattern=ub,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),p_=T("$ZodBigIntFormat",(e,t)=>{xb.init(e,t),Dd.init(e,t)}),g_=T("$ZodSymbol",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),h_=T("$ZodUndefined",(e,t)=>{Y.init(e,t),e._zod.pattern=gb,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,o)=>{const n=r.value;return typeof n>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),r}}),v_=T("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=pb,e._zod.values=new Set([null]),e._zod.parse=(r,o)=>{const n=r.value;return n===null||r.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),r}}),y_=T("$ZodAny",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),b_=T("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),__=T("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),w_=T("$ZodVoid",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),x_=T("$ZodDate",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Bp(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}const S_=T("$ZodArray",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const i=[];for(let a=0;a<n.length;a++){const s=n[a],c=t.element._zod.run({value:s,issues:[]},o);c instanceof Promise?i.push(c.then(l=>Bp(l,r,a))):Bp(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Xa(e,t,r,o){e.issues.length&&t.issues.push(...Ft(r,e.issues)),e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}function k_(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const r=by(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function E_(e,t,r,o,n,i){const a=[],s=n.keySet,c=n.catchall._zod,l=c.def.type;for(const u in t){if(s.has(u))continue;if(l==="never"){a.push(u);continue}const d=c.run({value:t[u],issues:[]},o);d instanceof Promise?e.push(d.then(f=>Xa(f,r,u,t))):Xa(d,r,u,t)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}const I_=T("$ZodObject",(e,t)=>{if(Y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const s=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=xi(()=>k_(t));de(e._zod,"propValues",()=>{const s=t.shape,c={};for(const l in s){const u=s[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(const d of u.values)c[l].add(d)}}return c});const n=Gn,i=t.catchall;let a;e._zod.parse=(s,c)=>{a??(a=o.value);const l=s.value;if(!n(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};const u=[],d=a.shape;for(const f of a.keys){const h=d[f]._zod.run({value:l[f],issues:[]},c);h instanceof Promise?u.push(h.then(g=>Xa(g,s,f,l))):Xa(h,s,f,l)}return i?E_(u,l,s,c,o.value,e):u.length?Promise.all(u).then(()=>s):s}}),T_=T("$ZodObjectJIT",(e,t)=>{I_.init(e,t);const r=e._zod.parse,o=xi(()=>k_(t)),n=f=>{const m=new Mb(["shape","payload","ctx"]),h=o.value,g=x=>{const v=vu(x);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const y=Object.create(null);let b=0;for(const x of h.keys)y[x]=`key_${b++}`;m.write("const newResult = {};");for(const x of h.keys){const v=y[x],k=vu(x);m.write(`const ${v} = ${g(x)};`),m.write(`
|
|
11
|
+
if (${v}.issues.length) {
|
|
12
|
+
payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
|
|
13
|
+
...iss,
|
|
14
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
15
|
+
})));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if (${v}.value === undefined) {
|
|
20
|
+
if (${k} in input) {
|
|
21
|
+
newResult[${k}] = undefined;
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
newResult[${k}] = ${v}.value;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");const w=m.compile();return(x,v)=>w(f,x,v)};let i;const a=Gn,s=!Ja.jitless,l=s&&vy.value,u=t.catchall;let d;e._zod.parse=(f,m)=>{d??(d=o.value);const h=f.value;return a(h)?s&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=n(t.shape)),f=i(f,m),u?E_([],h,f,m,d,e):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function qp(e,t,r,o){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const n=e.filter(i=>!Kr(i));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>At(a,o,Xe())))}),t)}const Ms=T("$ZodUnion",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),de(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),de(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),de(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>Ps(i.source)).join("|")})$`)}});const r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let a=!1;const s=[];for(const c of t.options){const l=c._zod.run({value:n.value,issues:[]},i);if(l instanceof Promise)s.push(l),a=!0;else{if(l.issues.length===0)return l;s.push(l)}}return a?Promise.all(s).then(c=>qp(c,n,e,i)):qp(s,n,e,i)}});function Gp(e,t,r,o){const n=e.filter(i=>i.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>At(a,o,Xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}const $_=T("$ZodXor",(e,t)=>{Ms.init(e,t),t.inclusive=!1;const r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,i)=>{if(r)return o(n,i);let a=!1;const s=[];for(const c of t.options){const l=c._zod.run({value:n.value,issues:[]},i);l instanceof Promise?(s.push(l),a=!0):s.push(l)}return a?Promise.all(s).then(c=>Gp(c,n,e,i)):Gp(s,n,e,i)}}),O_=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ms.init(e,t);const r=e._zod.parse;de(e._zod,"propValues",()=>{const n={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[s,c]of Object.entries(a)){n[s]||(n[s]=new Set);for(const l of c)n[s].add(l)}}return n});const o=xi(()=>{const n=t.options,i=new Map;for(const a of n){const s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const c of s){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(n,i)=>{const a=n.value;if(!Gn(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;const s=o.value.get(a?.[t.discriminator]);return s?s._zod.run(n,i):t.unionFallback?r(n,i):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),n)}}),A_=T("$ZodIntersection",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,l])=>Hp(r,c,l)):Hp(r,i,a)}});function _u(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(nn(e)&&nn(t)){const r=Object.keys(t),o=Object.keys(e).filter(i=>r.indexOf(i)!==-1),n={...e,...t};for(const i of o){const a=_u(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let o=0;o<e.length;o++){const n=e[o],i=t[o],a=_u(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Hp(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),Kr(e))return e;const o=_u(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const zd=T("$ZodTuple",(e,t)=>{Y.init(e,t);const r=t.items;e._zod.parse=(o,n)=>{const i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];const a=[],s=[...r].reverse().findIndex(u=>u._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){const u=i.length>r.length,d=i.length<c-1;if(u||d)return o.issues.push({...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),o}let l=-1;for(const u of r){if(l++,l>=i.length&&l>=c)continue;const d=u._zod.run({value:i[l],issues:[]},n);d instanceof Promise?a.push(d.then(f=>fa(f,o,l))):fa(d,o,l)}if(t.rest){const u=i.slice(r.length);for(const d of u){l++;const f=t.rest._zod.run({value:d,issues:[]},n);f instanceof Promise?a.push(f.then(m=>fa(m,o,l))):fa(f,o,l)}}return a.length?Promise.all(a).then(()=>o):o}});function fa(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}const C_=T("$ZodRecord",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!nn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a){r.value={};const s=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){s.add(typeof l=="number"?l.toString():l);const u=t.valueType._zod.run({value:n[l],issues:[]},o);u instanceof Promise?i.push(u.then(d=>{d.issues.length&&r.issues.push(...Ft(l,d.issues)),r.value[l]=d.value})):(u.issues.length&&r.issues.push(...Ft(l,u.issues)),r.value[l]=u.value)}let c;for(const l in n)s.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(const s of Reflect.ownKeys(n)){if(s==="__proto__")continue;const c=t.keyType._zod.run({value:s,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){t.mode==="loose"?r.value[s]=n[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(u=>At(u,o,Xe())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:n[s],issues:[]},o);l instanceof Promise?i.push(l.then(u=>{u.issues.length&&r.issues.push(...Ft(s,u.issues)),r.value[c.value]=u.value})):(l.issues.length&&r.issues.push(...Ft(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),N_=T("$ZodMap",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;const i=[];r.value=new Map;for(const[a,s]of n){const c=t.keyType._zod.run({value:a,issues:[]},o),l=t.valueType._zod.run({value:s,issues:[]},o);c instanceof Promise||l instanceof Promise?i.push(Promise.all([c,l]).then(([u,d])=>{Wp(u,d,r,a,n,e,o)})):Wp(c,l,r,a,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function Wp(e,t,r,o,n,i,a){e.issues.length&&(Ya.has(typeof o)?r.issues.push(...Ft(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(s=>At(s,a,Xe()))})),t.issues.length&&(Ya.has(typeof o)?r.issues.push(...Ft(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(s=>At(s,a,Xe()))})),r.value.set(e.value,t.value)}const R_=T("$ZodSet",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;const i=[];r.value=new Set;for(const a of n){const s=t.valueType._zod.run({value:a,issues:[]},o);s instanceof Promise?i.push(s.then(c=>Jp(c,r))):Jp(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function Jp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const P_=T("$ZodEnum",(e,t)=>{Y.init(e,t);const r=hd(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Ya.has(typeof n)).map(n=>typeof n=="string"?fr(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),j_=T("$ZodLiteral",(e,t)=>{if(Y.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(o=>typeof o=="string"?fr(o):o?fr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),D_=T("$ZodFile",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),z_=T("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Rs(e.constructor.name);const n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(a=>(r.value=a,r));if(n instanceof Promise)throw new tn;return r.value=n,r}});function Kp(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const M_=T("$ZodOptional",(e,t)=>{Y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ps(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Kp(i,r.value)):Kp(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),U_=T("$ZodNullable",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ps(r.source)}|null)$`):void 0}),de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>r.value===null?r:t.innerType._zod.run(r,o)}),L_=T("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Yp(i,t)):Yp(n,t)}});function Yp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const F_=T("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),V_=T("$ZodNonOptional",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>Xp(i,e)):Xp(n,e)}});function Xp(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 Z_=T("$ZodSuccess",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Rs("ZodSuccess");const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),B_=T("$ZodCatch",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>At(a,o,Xe()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(i=>At(i,o,Xe()))},input:r.value}),r.issues=[]),r)}}),q_=T("$ZodNaN",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),G_=T("$ZodPipe",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>ma(a,t.in,o)):ma(i,t.in,o)}const n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>ma(i,t.out,o)):ma(n,t.out,o)}});function ma(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Md=T("$ZodCodec",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){const i=t.in._zod.run(r,o);return i instanceof Promise?i.then(a=>pa(a,t,o)):pa(i,t,o)}else{const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>pa(a,t,o)):pa(i,t,o)}}});function pa(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){const n=t.transform(e.value,e);return n instanceof Promise?n.then(i=>ga(e,i,t.out,r)):ga(e,n,t.out,r)}else{const n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>ga(e,i,t.in,r)):ga(e,n,t.in,r)}}function ga(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}const H_=T("$ZodReadonly",(e,t)=>{Y.init(e,t),de(e._zod,"propValues",()=>t.innerType._zod.propValues),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"optin",()=>t.innerType?._zod?.optin),de(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(Qp):Qp(n)}});function Qp(e){return e.value=Object.freeze(e.value),e}const W_=T("$ZodTemplateLiteral",(e,t)=>{Y.init(e,t);const r=[];for(const o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);const n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,a))}else if(o===null||yy.has(typeof o))r.push(fr(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),J_=T("$ZodFunction",(e,t)=>(Y.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){const n=e._def.input?yu(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?yu(e._def.output,i):i}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...o){const n=e._def.input?await bu(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await bu(e._def.output,i):i}},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{const o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new zd({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{const o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),K_=T("$ZodPromise",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),Y_=T("$ZodLazy",(e,t)=>{Y.init(e,t),de(e._zod,"innerType",()=>t.getter()),de(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),de(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),de(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),de(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),X_=T("$ZodCustom",(e,t)=>{Ae.init(e,t),Y.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{const o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>eg(i,r,o,e));eg(n,r,o,e)}});function eg(e,t,r,o){if(!e){const n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Hn(n))}}const dA=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${J(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:i.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`:i.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`:i.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`:`${o[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${R(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function fA(){return{localeError:dA()}}const mA=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${J(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`:i.format==="ends_with"?`Yanlış mətn: "${i.suffix}" ilə bitməlidir`:i.format==="includes"?`Yanlış mətn: "${i.includes}" daxil olmalıdır`:i.format==="regex"?`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${o[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function pA(){return{localeError:mA()}}function tg(e,t,r,o){const n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}const gA=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${J(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=tg(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${i}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);if(a){const s=Number(n.minimum),c=tg(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${i.prefix}"`:i.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${i.suffix}"`:i.format==="includes"?`Няправільны радок: павінен змяшчаць "${i.includes}"`:i.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`:`Няправільны ${o[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${R(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function hA(){return{localeError:gA()}}const vA=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"масив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},yA=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(o){return e[o]??null}const r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"};return o=>{switch(o.code){case"invalid_type":return`Невалиден вход: очакван ${o.expected}, получен ${vA(o.input)}`;case"invalid_value":return o.values.length===1?`Невалиден вход: очакван ${J(o.values[0])}`:`Невалидна опция: очаквано едно от ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Твърде голямо: очаква се ${o.origin??"стойност"} да съдържа ${n}${o.maximum.toString()} ${i.unit??"елемента"}`:`Твърде голямо: очаква се ${o.origin??"стойност"} да бъде ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Твърде малко: очаква се ${o.origin} да съдържа ${n}${o.minimum.toString()} ${i.unit}`:`Твърде малко: очаква се ${o.origin} да бъде ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;if(n.format==="starts_with")return`Невалиден низ: трябва да започва с "${n.prefix}"`;if(n.format==="ends_with")return`Невалиден низ: трябва да завършва с "${n.suffix}"`;if(n.format==="includes")return`Невалиден низ: трябва да включва "${n.includes}"`;if(n.format==="regex")return`Невалиден низ: трябва да съвпада с ${n.pattern}`;let i="Невалиден";return n.format==="emoji"&&(i="Невалидно"),n.format==="datetime"&&(i="Невалидно"),n.format==="date"&&(i="Невалидна"),n.format==="time"&&(i="Невалидно"),n.format==="duration"&&(i="Невалидна"),`${i} ${r[n.format]??o.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${o.divisor}`;case"unrecognized_keys":return`Неразпознат${o.keys.length>1?"и":""} ключ${o.keys.length>1?"ове":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${o.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${o.origin}`;default:return"Невалиден вход"}}};function bA(){return{localeError:yA()}}const _A=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${J(n.values[0])}`:`Opció invàlida: s'esperava una de ${R(n.values," o ")}`;case"too_big":{const i=n.inclusive?"com a màxim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"com a mínim":"més de",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Format invàlid: ha de començar amb "${i.prefix}"`:i.format==="ends_with"?`Format invàlid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format invàlid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${i.pattern}`:`Format invàlid per a ${o[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function wA(){return{localeError:_A()}}const xA=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${J(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Neplatný řetězec: musí začínat na "${i.prefix}"`:i.format==="ends_with"?`Neplatný řetězec: musí končit na "${i.suffix}"`:i.format==="includes"?`Neplatný řetězec: musí obsahovat "${i.includes}"`:i.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`:`Neplatný formát ${o[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${R(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function SA(){return{localeError:xA()}}const kA=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function r(a){return e[a]??null}function o(a){return t[a]??a}const n=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"tal";case"object":return Array.isArray(a)?"liste":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype&&a.constructor?a.constructor.name:"objekt"}return s},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return a=>{switch(a.code){case"invalid_type":return`Ugyldigt input: forventede ${o(a.expected)}, fik ${o(n(a.input))}`;case"invalid_value":return a.values.length===1?`Ugyldig værdi: forventede ${J(a.values[0])}`:`Ugyldigt valg: forventede en af følgende ${R(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",c=r(a.origin),l=o(a.origin);return c?`For stor: forventede ${l??"value"} ${c.verb} ${s} ${a.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${l??"value"} havde ${s} ${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",c=r(a.origin),l=o(a.origin);return c?`For lille: forventede ${l} ${c.verb} ${s} ${a.minimum.toString()} ${c.unit}`:`For lille: forventede ${l} havde ${s} ${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??a.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${R(a.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${a.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${a.origin}`;default:return"Ugyldigt input"}}};function EA(){return{localeError:kA()}}const IA=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${J(n.values[0])}`:`Ungültige Option: erwartet eine von ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ungültiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ungültiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ungültiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`:`Ungültig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function TA(){return{localeError:IA()}}const $A=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},OA=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function t(o){return e[o]??null}const r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return o=>{switch(o.code){case"invalid_type":return`Invalid input: expected ${o.expected}, received ${$A(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${J(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Q_(){return{localeError:OA()}}const AA=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"nombro";case"object":{if(Array.isArray(e))return"tabelo";if(e===null)return"senvalora";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},CA=()=>{const e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(o){return e[o]??null}const r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"};return o=>{switch(o.code){case"invalid_type":return`Nevalida enigo: atendiĝis ${o.expected}, riceviĝis ${AA(o.input)}`;case"invalid_value":return o.values.length===1?`Nevalida enigo: atendiĝis ${J(o.values[0])}`:`Nevalida opcio: atendiĝis unu el ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${i.unit}`:`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`:n.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`:n.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${n.includes}"`:n.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`:`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function NA(){return{localeError:CA()}}const RA=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(a){return e[a]??null}function o(a){return t[a]??a}const n=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"number";case"object":return Array.isArray(a)?"array":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype?a.constructor.name:"object"}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return a=>{switch(a.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(a.expected)}, recibido ${o(n(a.input))}`;case"invalid_value":return a.values.length===1?`Entrada inválida: se esperaba ${J(a.values[0])}`:`Opción inválida: se esperaba una de ${R(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",c=r(a.origin),l=o(a.origin);return c?`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${s}${a.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${l??"valor"} fuera ${s}${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",c=r(a.origin),l=o(a.origin);return c?`Demasiado pequeño: se esperaba que ${l} tuviera ${s}${a.minimum.toString()} ${c.unit}`:`Demasiado pequeño: se esperaba que ${l} fuera ${s}${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??a.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${a.divisor}`;case"unrecognized_keys":return`Llave${a.keys.length>1?"s":""} desconocida${a.keys.length>1?"s":""}: ${R(a.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(a.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(a.origin)}`;default:return"Entrada inválida"}}};function PA(){return{localeError:RA()}}const jA=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: میبایست ${n.expected} میبود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: میبایست ${J(n.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${R(n.values,"|")} میبود`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{const i=n;return i.format==="starts_with"?`رشته نامعتبر: باید با "${i.prefix}" شروع شود`:i.format==="ends_with"?`رشته نامعتبر: باید با "${i.suffix}" تمام شود`:i.format==="includes"?`رشته نامعتبر: باید شامل "${i.includes}" باشد`:i.format==="regex"?`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`:`${o[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${R(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function DA(){return{localeError:jA()}}const zA=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${J(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${i}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen syöte: täytyy sisältää "${i.includes}"`:i.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`:`Virheellinen ${o[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${R(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function MA(){return{localeError:zA()}}const UA=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${J(n.values[0])} attendu`:`Option invalide : une valeur parmi ${R(n.values,"|")} attendue`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${i.pattern}`:`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function LA(){return{localeError:UA()}}const FA=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${J(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"≤":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"≥":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au motif ${i.pattern}`:`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function VA(){return{localeError:FA()}}const ZA=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=l=>l?e[l]:void 0,o=l=>{const u=r(l);return u?u.label:l??e.unknown.label},n=l=>`ה${o(l)}`,i=l=>(r(l)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=l=>l?t[l]??null:null,s=l=>{const u=typeof l;switch(u){case"number":return Number.isNaN(l)?"NaN":"number";case"object":return Array.isArray(l)?"array":l===null?"null":Object.getPrototypeOf(l)!==Object.prototype&&l.constructor?l.constructor.name:"object";default:return u}},c={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}};return l=>{switch(l.code){case"invalid_type":{const u=l.expected,d=o(u),f=s(l.input),m=e[f]?.label??f;return`קלט לא תקין: צריך להיות ${d}, התקבל ${m}`}case"invalid_value":{if(l.values.length===1)return`ערך לא תקין: הערך חייב להיות ${J(l.values[0])}`;const u=l.values.map(m=>J(m));if(l.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${u[0]} או ${u[1]}`;const d=u[u.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${u.slice(0,-1).join(", ")} או ${d}`}case"too_big":{const u=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"או פחות":"לכל היותר"}`.trim();if(l.origin==="number"){const h=l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`;return`גדול מדי: ${d} צריך להיות ${h}`}if(l.origin==="array"||l.origin==="set"){const h=l.origin==="set"?"צריכה":"צריך",g=l.inclusive?`${l.maximum} ${u?.unit??""} או פחות`:`פחות מ-${l.maximum} ${u?.unit??""}`;return`גדול מדי: ${d} ${h} להכיל ${g}`.trim()}const f=l.inclusive?"<=":"<",m=i(l.origin??"value");return u?.unit?`${u.longLabel} מדי: ${d} ${m} ${f}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"גדול"} מדי: ${d} ${m} ${f}${l.maximum.toString()}`}case"too_small":{const u=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"או יותר":"לפחות"}`.trim();if(l.origin==="number"){const h=l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`;return`קטן מדי: ${d} צריך להיות ${h}`}if(l.origin==="array"||l.origin==="set"){const h=l.origin==="set"?"צריכה":"צריך";if(l.minimum===1&&l.inclusive){const y=(l.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${h} להכיל ${y}`}const g=l.inclusive?`${l.minimum} ${u?.unit??""} או יותר`:`יותר מ-${l.minimum} ${u?.unit??""}`;return`קטן מדי: ${d} ${h} להכיל ${g}`.trim()}const f=l.inclusive?">=":">",m=i(l.origin??"value");return u?.unit?`${u.shortLabel} מדי: ${d} ${m} ${f}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"קטן"} מדי: ${d} ${m} ${f}${l.minimum.toString()}`}case"invalid_format":{const u=l;if(u.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${u.prefix}"`;if(u.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${u.suffix}"`;if(u.format==="includes")return`המחרוזת חייבת לכלול "${u.includes}"`;if(u.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${u.pattern}`;const d=c[u.format],f=d?.label??u.format,h=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${f} לא ${h}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${R(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(l.origin??"array")}`;default:return"קלט לא תקין"}}};function BA(){return{localeError:ZA()}}const qA=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${J(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`:i.format==="ends_with"?`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`:i.format==="includes"?`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`:i.format==="regex"?`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`:`Érvénytelen ${o[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function GA(){return{localeError:qA()}}const HA=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${J(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${o[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function WA(){return{localeError:HA()}}const JA=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"númer";case"object":{if(Array.isArray(e))return"fylki";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},KA=()=>{const e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(o){return e[o]??null}const r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"};return o=>{switch(o.code){case"invalid_type":return`Rangt gildi: Þú slóst inn ${JA(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":return o.values.length===1?`Rangt gildi: gert ráð fyrir ${J(o.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${n}${o.maximum.toString()} ${i.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${n}${o.minimum.toString()} ${i.unit}`:`Of lítið: gert er ráð fyrir að ${o.origin} sé ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Ógildur strengur: verður að byrja á "${n.prefix}"`:n.format==="ends_with"?`Ógildur strengur: verður að enda á "${n.suffix}"`:n.format==="includes"?`Ógildur strengur: verður að innihalda "${n.includes}"`:n.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${n.pattern}`:`Rangt ${r[n.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${R(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function YA(){return{localeError:KA()}}const XA=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${J(n.values[0])}`:`Opzione non valida: atteso uno tra ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${R(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function QA(){return{localeError:XA()}}const eC=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${J(n.values[0])}が期待されました`:`無効な選択: ${R(n.values,"、")}のいずれかである必要があります`;case"too_big":{const i=n.inclusive?"以下である":"より小さい",a=t(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${i}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{const i=n.inclusive?"以上である":"より大きい",a=t(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${i}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{const i=n;return i.format==="starts_with"?`無効な文字列: "${i.prefix}"で始まる必要があります`:i.format==="ends_with"?`無効な文字列: "${i.suffix}"で終わる必要があります`:i.format==="includes"?`無効な文字列: "${i.includes}"を含む必要があります`:i.format==="regex"?`無効な文字列: パターン${i.pattern}に一致する必要があります`:`無効な${o[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${R(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function tC(){return{localeError:eC()}}const rC=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"რიცხვი";case"object":{if(Array.isArray(e))return"მასივი";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return{string:"სტრინგი",boolean:"ბულეანი",undefined:"undefined",bigint:"bigint",symbol:"symbol",function:"ფუნქცია"}[t]??t},nC=()=>{const e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(o){return e[o]??null}const r={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული სტრინგი",base64url:"base64url-კოდირებული სტრინგი",json_string:"JSON სტრინგი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"};return o=>{switch(o.code){case"invalid_type":return`არასწორი შეყვანა: მოსალოდნელი ${o.expected}, მიღებული ${rC(o.input)}`;case"invalid_value":return o.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${J(o.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${R(o.values,"|")}-დან`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${n}${o.maximum.toString()} ${i.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${n}${o.minimum.toString()} ${i.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${n.prefix}"-ით`:n.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${n.suffix}"-ით`:n.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${n.includes}"-ს`:n.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`:`არასწორი ${r[n.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${R(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function oC(){return{localeError:nC()}}const iC=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${J(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`:i.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`:i.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`:i.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`:`មិនត្រឹមត្រូវ៖ ${o[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${R(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function ew(){return{localeError:iC()}}function aC(){return ew()}const sC=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${J(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${R(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const i=n.inclusive?"이하":"미만",a=i==="미만"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${a}`}case"too_small":{const i=n.inclusive?"이상":"초과",a=i==="이상"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${a}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`:i.format==="ends_with"?`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`:i.format==="includes"?`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`:i.format==="regex"?`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`:`잘못된 ${o[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${R(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function cC(){return{localeError:sC()}}const lC=e=>Vo(typeof e,e),Vo=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return t===void 0?"nežinomas objektas":t===null?"nulinė reikšmė":Array.isArray(t)?"masyvas":Object.getPrototypeOf(t)!==Object.prototype&&t.constructor?t.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return e},No=e=>e.charAt(0).toUpperCase()+e.slice(1);function rg(e){const t=Math.abs(e),r=t%10,o=t%100;return o>=11&&o<=19||r===0?"many":r===1?"one":"few"}const uC=()=>{const e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(o,n,i,a){const s=e[o]??null;return s===null?s:{unit:s.unit[n],verb:s.verb[a][i?"inclusive":"notInclusive"]}}const r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"};return o=>{switch(o.code){case"invalid_type":return`Gautas tipas ${lC(o.input)}, o tikėtasi - ${Vo(o.expected)}`;case"invalid_value":return o.values.length===1?`Privalo būti ${J(o.values[0])}`:`Privalo būti vienas iš ${R(o.values,"|")} pasirinkimų`;case"too_big":{const n=Vo(o.origin),i=t(o.origin,rg(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${No(n??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${No(n??o.origin??"reikšmė")} turi būti ${a} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{const n=Vo(o.origin),i=t(o.origin,rg(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${No(n??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${No(n??o.origin??"reikšmė")} turi būti ${a} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Eilutė privalo prasidėti "${n.prefix}"`:n.format==="ends_with"?`Eilutė privalo pasibaigti "${n.suffix}"`:n.format==="includes"?`Eilutė privalo įtraukti "${n.includes}"`:n.format==="regex"?`Eilutė privalo atitikti ${n.pattern}`:`Neteisingas ${r[n.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${R(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const n=Vo(o.origin);return`${No(n??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function dC(){return{localeError:uC()}}const fC=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${J(n.values[0])}`:`Грешана опција: се очекува една ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неважечка низа: мора да започнува со "${i.prefix}"`:i.format==="ends_with"?`Неважечка низа: мора да завршува со "${i.suffix}"`:i.format==="includes"?`Неважечка низа: мора да вклучува "${i.includes}"`:i.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${i.pattern}`:`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${R(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function mC(){return{localeError:fC()}}const pC=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${J(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${o[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function gC(){return{localeError:pC()}}const hC=()=>{const e={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${J(n.values[0])}`:`Ongeldige optie: verwacht één van ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Te groot: verwacht dat ${n.origin??"waarde"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elementen"}`:`Te groot: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Te klein: verwacht dat ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Te klein: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function vC(){return{localeError:hC()}}const yC=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${J(n.values[0])}`:`Ugyldig valg: forventet en av ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ugyldig streng: må starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: må ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: må inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: må matche mønsteret ${i.pattern}`:`Ugyldig ${o[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function bC(){return{localeError:yC()}}const _C=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${J(n.values[0])}`:`Fâsit tercih: mûteberler ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Fâsit metin: "${i.prefix}" ile başlamalı.`:i.format==="ends_with"?`Fâsit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`Fâsit metin: "${i.includes}" ihtivâ etmeli.`:i.format==="regex"?`Fâsit metin: ${i.pattern} nakşına uymalı.`:`Fâsit ${o[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function wC(){return{localeError:_C()}}const xC=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${J(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${R(n.values,"|")} څخه وای`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{const i=n;return i.format==="starts_with"?`ناسم متن: باید د "${i.prefix}" سره پیل شي`:i.format==="ends_with"?`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`:i.format==="includes"?`ناسم متن: باید "${i.includes}" ولري`:i.format==="regex"?`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`:`${o[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${R(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function SC(){return{localeError:xC()}}const kC=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${J(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`:i.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`:i.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`:i.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`:`Nieprawidłow(y/a/e) ${o[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function EC(){return{localeError:kC()}}const IC=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${J(n.values[0])}`:`Opção inválida: esperada uma das ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Texto inválido: deve começar com "${i.prefix}"`:i.format==="ends_with"?`Texto inválido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inválido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inválido: deve corresponder ao padrão ${i.pattern}`:`${o[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function TC(){return{localeError:IC()}}function ng(e,t,r,o){const n=Math.abs(e),i=n%10,a=n%100;return a>=11&&a<=19?o:i===1?t:i>=2&&i<=4?r:o}const $C=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${J(n.values[0])}`:`Неверный вариант: ожидалось одно из ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=ng(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${i}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);if(a){const s=Number(n.minimum),c=ng(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неверная строка: должна начинаться с "${i.prefix}"`:i.format==="ends_with"?`Неверная строка: должна заканчиваться на "${i.suffix}"`:i.format==="includes"?`Неверная строка: должна содержать "${i.includes}"`:i.format==="regex"?`Неверная строка: должна соответствовать шаблону ${i.pattern}`:`Неверный ${o[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function OC(){return{localeError:$C()}}const AC=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${J(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Neveljaven niz: mora se začeti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se končati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${o[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${R(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function CC(){return{localeError:AC()}}const NC=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${J(n.values[0])}`:`Ogiltigt val: förväntade en av ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ogiltig sträng: måste börja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig sträng: måste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig sträng: måste innehålla "${i.includes}"`:i.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`:`Ogiltig(t) ${o[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function RC(){return{localeError:NC()}}const PC=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${J(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${R(n.values,"|")} இல் ஒன்று`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const i=n;return i.format==="starts_with"?`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`:i.format==="ends_with"?`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`:i.format==="includes"?`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`:i.format==="regex"?`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${o[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function jC(){return{localeError:PC()}}const DC=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${J(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=t(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"อย่างน้อย":"มากกว่า",a=t(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`:i.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`:i.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`:i.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`:`รูปแบบไม่ถูกต้อง: ${o[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${R(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function zC(){return{localeError:DC()}}const MC=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},UC=()=>{const e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(o){return e[o]??null}const r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"};return o=>{switch(o.code){case"invalid_type":return`Geçersiz değer: beklenen ${o.expected}, alınan ${MC(o.input)}`;case"invalid_value":return o.values.length===1?`Geçersiz değer: beklenen ${J(o.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${i.unit??"öğe"}`:`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${i.unit}`:`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${R(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function LC(){return{localeError:UC()}}const FC=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${J(n.values[0])}`:`Неправильна опція: очікується одне з ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неправильний рядок: повинен починатися з "${i.prefix}"`:i.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`:i.format==="includes"?`Неправильний рядок: повинен містити "${i.includes}"`:i.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`:`Неправильний ${o[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function tw(){return{localeError:FC()}}function VC(){return tw()}const ZC=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${J(n.values[0])} متوقع تھا`:`غلط آپشن: ${R(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const i=n;return i.format==="starts_with"?`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`:i.format==="ends_with"?`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`:i.format==="includes"?`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`:i.format==="regex"?`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`:`غلط ${o[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${R(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function BC(){return{localeError:ZC()}}const qC=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${J(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`:i.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`:i.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`:i.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`:`${o[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${R(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function GC(){return{localeError:qC()}}const HC=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${J(n.values[0])}`:`无效选项:期望以下之一 ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`无效字符串:必须以 "${i.prefix}" 开头`:i.format==="ends_with"?`无效字符串:必须以 "${i.suffix}" 结尾`:i.format==="includes"?`无效字符串:必须包含 "${i.includes}"`:i.format==="regex"?`无效字符串:必须满足正则表达式 ${i.pattern}`:`无效${o[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function WC(){return{localeError:HC()}}const JC=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${J(n.values[0])}`:`無效的選項:預期為以下其中之一 ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`無效的字串:必須以 "${i.prefix}" 開頭`:i.format==="ends_with"?`無效的字串:必須以 "${i.suffix}" 結尾`:i.format==="includes"?`無效的字串:必須包含 "${i.includes}"`:i.format==="regex"?`無效的字串:必須符合格式 ${i.pattern}`:`無效的 ${o[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${R(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function KC(){return{localeError:JC()}}const YC=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(n))return"akopọ";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return n=>{switch(n.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${n.expected}, àmọ̀ a rí ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${J(n.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${i}${n.maximum}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${a.verb} ${i}${n.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${i}${n.minimum}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`:i.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`:i.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`:i.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`:`Aṣìṣe: ${o[i.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${R(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function XC(){return{localeError:YC()}}const rw=Object.freeze(Object.defineProperty({__proto__:null,ar:fA,az:pA,be:hA,bg:bA,ca:wA,cs:SA,da:EA,de:TA,en:Q_,eo:NA,es:PA,fa:DA,fi:MA,fr:LA,frCA:VA,he:BA,hu:GA,id:WA,is:YA,it:QA,ja:tC,ka:oC,kh:aC,km:ew,ko:cC,lt:dC,mk:mC,ms:gC,nl:vC,no:bC,ota:wC,pl:EC,ps:SC,pt:TC,ru:OC,sl:CC,sv:RC,ta:jC,th:zC,tr:LC,ua:VC,uk:tw,ur:BC,vi:GC,yo:XC,zhCN:WC,zhTW:KC},Symbol.toStringTag,{value:"Module"}));var og;const nw=Symbol("ZodOutput"),ow=Symbol("ZodInput");class iw{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const o=r[0];if(this._map.set(t,o),o&&typeof o=="object"&&"id"in o){if(this._idmap.has(o.id))throw new Error(`ID ${o.id} already exists in the registry`);this._idmap.set(o.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 o={...this.get(r)??{}};delete o.id;const n={...o,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Ud(){return new iw}(og=globalThis).__zod_globalRegistry??(og.__zod_globalRegistry=Ud());const Vt=globalThis.__zod_globalRegistry;function aw(e,t){return new e({type:"string",...C(t)})}function sw(e,t){return new e({type:"string",coerce:!0,...C(t)})}function Ld(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...C(t)})}function Qa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...C(t)})}function Fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...C(t)})}function Vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...C(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...C(t)})}function Bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...C(t)})}function Us(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...C(t)})}function qd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...C(t)})}function Gd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...C(t)})}function Hd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...C(t)})}function Wd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...C(t)})}function Jd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...C(t)})}function Kd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...C(t)})}function Yd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...C(t)})}function Xd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...C(t)})}function Qd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...C(t)})}function cw(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...C(t)})}function ef(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...C(t)})}function tf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...C(t)})}function rf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...C(t)})}function nf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...C(t)})}function of(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...C(t)})}function af(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...C(t)})}const lw={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function uw(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...C(t)})}function dw(e,t){return new e({type:"string",format:"date",check:"string_format",...C(t)})}function fw(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...C(t)})}function mw(e,t){return new e({type:"string",format:"duration",check:"string_format",...C(t)})}function pw(e,t){return new e({type:"number",checks:[],...C(t)})}function gw(e,t){return new e({type:"number",coerce:!0,checks:[],...C(t)})}function hw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...C(t)})}function vw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...C(t)})}function yw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...C(t)})}function bw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...C(t)})}function _w(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...C(t)})}function ww(e,t){return new e({type:"boolean",...C(t)})}function xw(e,t){return new e({type:"boolean",coerce:!0,...C(t)})}function Sw(e,t){return new e({type:"bigint",...C(t)})}function kw(e,t){return new e({type:"bigint",coerce:!0,...C(t)})}function Ew(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...C(t)})}function Iw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...C(t)})}function Tw(e,t){return new e({type:"symbol",...C(t)})}function $w(e,t){return new e({type:"undefined",...C(t)})}function Ow(e,t){return new e({type:"null",...C(t)})}function Aw(e){return new e({type:"any"})}function Cw(e){return new e({type:"unknown"})}function Nw(e,t){return new e({type:"never",...C(t)})}function Rw(e,t){return new e({type:"void",...C(t)})}function Pw(e,t){return new e({type:"date",...C(t)})}function jw(e,t){return new e({type:"date",coerce:!0,...C(t)})}function Dw(e,t){return new e({type:"nan",...C(t)})}function Rr(e,t){return new Cd({check:"less_than",...C(t),value:e,inclusive:!1})}function Ot(e,t){return new Cd({check:"less_than",...C(t),value:e,inclusive:!0})}function Pr(e,t){return new Nd({check:"greater_than",...C(t),value:e,inclusive:!1})}function dt(e,t){return new Nd({check:"greater_than",...C(t),value:e,inclusive:!0})}function sf(e){return Pr(0,e)}function cf(e){return Rr(0,e)}function lf(e){return Ot(0,e)}function uf(e){return dt(0,e)}function Jn(e,t){return new _b({check:"multiple_of",...C(t),value:e})}function Ci(e,t){return new Sb({check:"max_size",...C(t),maximum:e})}function Kn(e,t){return new kb({check:"min_size",...C(t),minimum:e})}function Ls(e,t){return new Eb({check:"size_equals",...C(t),size:e})}function Ni(e,t){return new Ib({check:"max_length",...C(t),maximum:e})}function on(e,t){return new Tb({check:"min_length",...C(t),minimum:e})}function Ri(e,t){return new $b({check:"length_equals",...C(t),length:e})}function Fs(e,t){return new Ob({check:"string_format",format:"regex",...C(t),pattern:e})}function Vs(e){return new Ab({check:"string_format",format:"lowercase",...C(e)})}function Zs(e){return new Cb({check:"string_format",format:"uppercase",...C(e)})}function Bs(e,t){return new Nb({check:"string_format",format:"includes",...C(t),includes:e})}function qs(e,t){return new Rb({check:"string_format",format:"starts_with",...C(t),prefix:e})}function Gs(e,t){return new Pb({check:"string_format",format:"ends_with",...C(t),suffix:e})}function df(e,t,r){return new jb({check:"property",property:e,schema:t,...C(r)})}function Hs(e,t){return new Db({check:"mime_type",mime:e,...C(t)})}function xr(e){return new zb({check:"overwrite",tx:e})}function Ws(e){return xr(t=>t.normalize(e))}function Js(){return xr(e=>e.trim())}function Ks(){return xr(e=>e.toLowerCase())}function Ys(){return xr(e=>e.toUpperCase())}function Xs(){return xr(e=>hy(e))}function zw(e,t,r){return new e({type:"array",element:t,...C(r)})}function QC(e,t,r){return new e({type:"union",options:t,...C(r)})}function eN(e,t,r){return new e({type:"union",options:t,inclusive:!1,...C(r)})}function tN(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...C(o)})}function rN(e,t,r){return new e({type:"intersection",left:t,right:r})}function nN(e,t,r,o){const n=r instanceof Y,i=n?o:r,a=n?r:null;return new e({type:"tuple",items:t,rest:a,...C(i)})}function oN(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...C(o)})}function iN(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...C(o)})}function aN(e,t,r){return new e({type:"set",valueType:t,...C(r)})}function sN(e,t,r){const o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...C(r)})}function cN(e,t,r){return new e({type:"enum",entries:t,...C(r)})}function lN(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...C(r)})}function Mw(e,t){return new e({type:"file",...C(t)})}function uN(e,t){return new e({type:"transform",transform:t})}function dN(e,t){return new e({type:"optional",innerType:t})}function fN(e,t){return new e({type:"nullable",innerType:t})}function mN(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():js(r)}})}function pN(e,t,r){return new e({type:"nonoptional",innerType:t,...C(r)})}function gN(e,t){return new e({type:"success",innerType:t})}function hN(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function vN(e,t,r){return new e({type:"pipe",in:t,out:r})}function yN(e,t){return new e({type:"readonly",innerType:t})}function bN(e,t,r){return new e({type:"template_literal",parts:t,...C(r)})}function _N(e,t){return new e({type:"lazy",getter:t})}function wN(e,t){return new e({type:"promise",innerType:t})}function Uw(e,t,r){const o=C(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Lw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...C(r)})}function Fw(e){const t=Vw(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Hn(o,r.value,t._zod.def));else{const n=o;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(Hn(n))}},e(r.value,r)));return t}function Vw(e,t){const r=new Ae({check:"custom",...C(t)});return r._zod.check=e,r}function Zw(e){const t=new Ae({check:"describe"});return t._zod.onattach=[r=>{const o=Vt.get(r)??{};Vt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Bw(e){const t=new Ae({check:"meta"});return t._zod.onattach=[r=>{const o=Vt.get(r)??{};Vt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function qw(e,t){const r=C(t);let o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(o=o.map(m=>typeof m=="string"?m.toLowerCase():m),n=n.map(m=>typeof m=="string"?m.toLowerCase():m));const i=new Set(o),a=new Set(n),s=e.Codec??Md,c=e.Boolean??jd,l=e.String??Ai,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:u,out:d,transform:((m,h)=>{let g=m;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((m,h)=>m===!0?o[0]||"true":n[0]||"false"),error:r.error});return f}function Pi(e,t,r,o={}){const n=C(o),i={...C(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Yn(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??Vt,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 ke(e,t,r={path:[],schemaPath:[]}){var o;const n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const u={...r,schemaPath:[...r.schemaPath,e],path:r.path},d=e._zod.parent;if(d)a.ref=d,ke(d,t,u),t.seen.get(d).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{const f=a.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,u)}}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&it(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Xn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(i[0])?.id,d=e.external.uri??(m=>m);if(u)return{ref:d(u)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};const c=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+l}},n=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:s,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const l=a.schema;for(const u in l)delete l[u];l.$ref=s};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
28
|
+
|
|
29
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){n(i);continue}if(e.external){const c=e.external.registry.get(i[0])?.id;if(t!==i[0]&&c){n(i);continue}}if(e.metadataRegistry.get(i[0])?.id){n(i);continue}if(a.cycle){n(i);continue}if(a.count>1&&e.reused==="ref"){n(i);continue}}}function Qn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=a=>{const s=e.seen.get(a),c=s.def??s.schema,l={...c};if(s.ref===null)return;const u=s.ref;if(s.ref=null,u){o(u);const d=e.seen.get(u).schema;d.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(d)):(Object.assign(c,d),Object.assign(c,l))}s.isParent||e.override({zodSchema:a,jsonSchema:c,path:s.path??[]})};for(const a of[...e.seen.entries()].reverse())o(a[0]);const n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(a)}Object.assign(n,r.def??r.schema);const i=e.external?.defs??{};for(const a of e.seen.entries()){const s=a[1];s.def&&s.defId&&(i[s.defId]=s.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{const a=JSON.parse(JSON.stringify(n));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yo(t,"input"),output:Yo(t,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function it(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return it(o.element,r);if(o.type==="set")return it(o.valueType,r);if(o.type==="lazy")return it(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return it(o.innerType,r);if(o.type==="intersection")return it(o.left,r)||it(o.right,r);if(o.type==="record"||o.type==="map")return it(o.keyType,r)||it(o.valueType,r);if(o.type==="pipe")return it(o.in,r)||it(o.out,r);if(o.type==="object"){for(const n in o.shape)if(it(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(const n of o.options)if(it(n,r))return!0;return!1}if(o.type==="tuple"){for(const n of o.items)if(it(n,r))return!0;return!!(o.rest&&it(o.rest,r))}return!1}const Gw=(e,t={})=>r=>{const o=Yn({...r,processors:t});return ke(e,o),Xn(o,e),Qn(o,e)},Yo=(e,t)=>r=>{const{libraryOptions:o,target:n}=r??{},i=Yn({...o??{},target:n,io:t,processors:{}});return ke(e,i),Xn(i,e),Qn(i,e)},xN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Hw=(e,t,r,o)=>{const n=r;n.type="string";const{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(n.minLength=i),typeof a=="number"&&(n.maxLength=a),s&&(n.format=xN[s]??s,n.format===""&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){const u=[...c];u.length===1?n.pattern=u[0].source:u.length>1&&(n.allOf=[...u.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Ww=(e,t,r,o)=>{const n=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s=="string"&&s.includes("int")?n.type="integer":n.type="number",typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u),typeof i=="number"&&(n.minimum=i,typeof u=="number"&&t.target!=="draft-04"&&(u>=i?delete n.minimum:delete n.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l),typeof a=="number"&&(n.maximum=a,typeof l=="number"&&t.target!=="draft-04"&&(l<=a?delete n.maximum:delete n.exclusiveMaximum)),typeof c=="number"&&(n.multipleOf=c)},Jw=(e,t,r,o)=>{r.type="boolean"},Kw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Yw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Xw=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Qw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},e0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},t0=(e,t,r,o)=>{r.not={}},r0=(e,t,r,o)=>{},n0=(e,t,r,o)=>{},o0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},i0=(e,t,r,o)=>{const n=e._zod.def,i=hd(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},a0=(e,t,r,o)=>{const n=e._zod.def,i=[];for(const a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},s0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},c0=(e,t,r,o)=>{const n=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},l0=(e,t,r,o)=>{const n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;a!==void 0&&(i.minLength=a),s!==void 0&&(i.maxLength=s),c?c.length===1?(i.contentMediaType=c[0],Object.assign(n,i)):n.anyOf=c.map(l=>({...i,contentMediaType:l})):Object.assign(n,i)},u0=(e,t,r,o)=>{r.type="boolean"},d0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},f0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},m0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},p0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},g0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},h0=(e,t,r,o)=>{const n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=ke(i.element,t,{...o,path:[...o.path,"items"]})},v0=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object",n.properties={};const a=i.shape;for(const l in a)n.properties[l]=ke(a[l],t,{...o,path:[...o.path,"properties",l]});const s=new Set(Object.keys(a)),c=new Set([...s].filter(l=>{const u=i.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(n.required=Array.from(c)),i.catchall?._zod.def.type==="never"?n.additionalProperties=!1:i.catchall?i.catchall&&(n.additionalProperties=ke(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},ff=(e,t,r,o)=>{const n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,c)=>ke(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));i?r.oneOf=a:r.anyOf=a},y0=(e,t,r,o)=>{const n=e._zod.def,i=ke(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=ke(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},b0=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="array";const a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((f,m)=>ke(f,t,{...o,path:[...o.path,a,m]})),l=i.rest?ke(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=c,l&&(n.items=l)):t.target==="openapi-3.0"?(n.items={anyOf:c},l&&n.items.anyOf.push(l),n.minItems=c.length,l||(n.maxItems=c.length)):(n.items=c,l&&(n.additionalItems=l));const{minimum:u,maximum:d}=e._zod.bag;typeof u=="number"&&(n.minItems=u),typeof d=="number"&&(n.maxItems=d)},_0=(e,t,r,o)=>{const n=r,i=e._zod.def;n.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=ke(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=ke(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})},w0=(e,t,r,o)=>{const n=e._zod.def,i=ke(n.innerType,t,o),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},x0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},S0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},k0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},E0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},I0=(e,t,r,o)=>{const n=e._zod.def,i=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;ke(i,t,o);const a=t.seen.get(e);a.ref=i},T0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},$0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},O0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},A0=(e,t,r,o)=>{const n=e._zod.innerType;ke(n,t,o);const i=t.seen.get(e);i.ref=n},wu={string:Hw,number:Ww,boolean:Jw,bigint:Kw,symbol:Yw,null:Xw,undefined:Qw,void:e0,never:t0,any:r0,unknown:n0,date:o0,enum:i0,literal:a0,nan:s0,template_literal:c0,file:l0,success:u0,custom:d0,function:f0,transform:m0,map:p0,set:g0,array:h0,object:v0,union:ff,intersection:y0,tuple:b0,record:_0,nullable:w0,nonoptional:x0,default:S0,prefault:k0,catch:E0,pipe:I0,readonly:T0,promise:$0,optional:O0,lazy:A0};function mf(e,t){if("_idmap"in e){const o=e,n=Yn({...t,processors:wu}),i={};for(const c of o._idmap.entries()){const[l,u]=c;ke(u,n)}const a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(const c of o._idmap.entries()){const[l,u]=c;Xn(n,u),a[l]=Qn(n,u)}if(Object.keys(i).length>0){const c=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}const r=Yn({...t,processors:wu});return ke(e,r),Xn(r,e),Qn(r,e)}class SN{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Yn({processors:wu,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return ke(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Xn(this.ctx,t);const o=Qn(this.ctx,t),{"~standard":n,...i}=o;return i}}const kN=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),EN=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:y_,$ZodArray:S_,$ZodAsyncError:tn,$ZodBase64:a_,$ZodBase64URL:c_,$ZodBigInt:Dd,$ZodBigIntFormat:p_,$ZodBoolean:jd,$ZodCIDRv4:o_,$ZodCIDRv6:i_,$ZodCUID:Gb,$ZodCUID2:Hb,$ZodCatch:B_,$ZodCheck:Ae,$ZodCheckBigIntFormat:xb,$ZodCheckEndsWith:Pb,$ZodCheckGreaterThan:Nd,$ZodCheckIncludes:Nb,$ZodCheckLengthEquals:$b,$ZodCheckLessThan:Cd,$ZodCheckLowerCase:Ab,$ZodCheckMaxLength:Ib,$ZodCheckMaxSize:Sb,$ZodCheckMimeType:Db,$ZodCheckMinLength:Tb,$ZodCheckMinSize:kb,$ZodCheckMultipleOf:_b,$ZodCheckNumberFormat:wb,$ZodCheckOverwrite:zb,$ZodCheckProperty:jb,$ZodCheckRegex:Ob,$ZodCheckSizeEquals:Eb,$ZodCheckStartsWith:Rb,$ZodCheckStringFormat:Oi,$ZodCheckUpperCase:Cb,$ZodCodec:Md,$ZodCustom:X_,$ZodCustomStringFormat:f_,$ZodDate:x_,$ZodDefault:L_,$ZodDiscriminatedUnion:O_,$ZodE164:l_,$ZodEmail:Vb,$ZodEmoji:Bb,$ZodEncodeError:Rs,$ZodEnum:P_,$ZodError:yd,$ZodFile:D_,$ZodFunction:J_,$ZodGUID:Lb,$ZodIPv4:t_,$ZodIPv6:r_,$ZodISODate:Xb,$ZodISODateTime:Yb,$ZodISODuration:e_,$ZodISOTime:Qb,$ZodIntersection:A_,$ZodJWT:d_,$ZodKSUID:Kb,$ZodLazy:Y_,$ZodLiteral:j_,$ZodMAC:n_,$ZodMap:N_,$ZodNaN:q_,$ZodNanoID:qb,$ZodNever:__,$ZodNonOptional:V_,$ZodNull:v_,$ZodNullable:U_,$ZodNumber:Pd,$ZodNumberFormat:m_,$ZodObject:I_,$ZodObjectJIT:T_,$ZodOptional:M_,$ZodPipe:G_,$ZodPrefault:F_,$ZodPromise:K_,$ZodReadonly:H_,$ZodRealError:kt,$ZodRecord:C_,$ZodRegistry:iw,$ZodSet:R_,$ZodString:Ai,$ZodStringFormat:Ee,$ZodSuccess:Z_,$ZodSymbol:g_,$ZodTemplateLiteral:W_,$ZodTransform:z_,$ZodTuple:zd,$ZodType:Y,$ZodULID:Wb,$ZodURL:Zb,$ZodUUID:Fb,$ZodUndefined:h_,$ZodUnion:Ms,$ZodUnknown:b_,$ZodVoid:w_,$ZodXID:Jb,$ZodXor:$_,$brand:py,$constructor:T,$input:ow,$output:nw,Doc:Mb,JSONSchema:kN,JSONSchemaGenerator:SN,NEVER:gd,TimePrecision:lw,_any:Aw,_array:zw,_base64:rf,_base64url:nf,_bigint:Sw,_boolean:ww,_catch:hN,_check:Vw,_cidrv4:ef,_cidrv6:tf,_coercedBigint:kw,_coercedBoolean:xw,_coercedDate:jw,_coercedNumber:gw,_coercedString:sw,_cuid:Hd,_cuid2:Wd,_custom:Uw,_date:Pw,_decode:xd,_decodeAsync:kd,_default:mN,_discriminatedUnion:tN,_e164:of,_email:Ld,_emoji:qd,_encode:wd,_encodeAsync:Sd,_endsWith:Gs,_enum:sN,_file:Mw,_float32:vw,_float64:yw,_gt:Pr,_gte:dt,_guid:Qa,_includes:Bs,_int:hw,_int32:bw,_int64:Ew,_intersection:rN,_ipv4:Xd,_ipv6:Qd,_isoDate:dw,_isoDateTime:uw,_isoDuration:mw,_isoTime:fw,_jwt:af,_ksuid:Yd,_lazy:_N,_length:Ri,_literal:lN,_lowercase:Vs,_lt:Rr,_lte:Ot,_mac:cw,_map:iN,_max:Ot,_maxLength:Ni,_maxSize:Ci,_mime:Hs,_min:dt,_minLength:on,_minSize:Kn,_multipleOf:Jn,_nan:Dw,_nanoid:Gd,_nativeEnum:cN,_negative:cf,_never:Nw,_nonnegative:uf,_nonoptional:pN,_nonpositive:lf,_normalize:Ws,_null:Ow,_nullable:fN,_number:pw,_optional:dN,_overwrite:xr,_parse:Si,_parseAsync:ki,_pipe:vN,_positive:sf,_promise:wN,_property:df,_readonly:yN,_record:oN,_refine:Lw,_regex:Fs,_safeDecode:Id,_safeDecodeAsync:$d,_safeEncode:Ed,_safeEncodeAsync:Td,_safeParse:Ei,_safeParseAsync:Ii,_set:aN,_size:Ls,_slugify:Xs,_startsWith:qs,_string:aw,_stringFormat:Pi,_stringbool:qw,_success:gN,_superRefine:Fw,_symbol:Tw,_templateLiteral:bN,_toLowerCase:Ks,_toUpperCase:Ys,_transform:uN,_trim:Js,_tuple:nN,_uint32:_w,_uint64:Iw,_ulid:Jd,_undefined:$w,_union:QC,_unknown:Cw,_uppercase:Zs,_url:Us,_uuid:Fd,_uuidv4:Vd,_uuidv6:Zd,_uuidv7:Bd,_void:Rw,_xid:Kd,_xor:eN,clone:Nt,config:Xe,createStandardJSONSchemaMethod:Yo,createToJSONSchemaMethod:Gw,decode:PO,decodeAsync:DO,describe:Zw,encode:RO,encodeAsync:jO,extractDefs:Xn,finalize:Qn,flattenError:bd,formatError:_d,globalConfig:Ja,globalRegistry:Vt,initializeContext:Yn,isValidBase64:Rd,isValidBase64URL:s_,isValidJWT:u_,locales:rw,meta:Bw,parse:yu,parseAsync:bu,prettifyError:jy,process:ke,regexes:Ad,registry:Ud,safeDecode:MO,safeDecodeAsync:LO,safeEncode:zO,safeEncodeAsync:UO,safeParse:Dy,safeParseAsync:zy,toDotPath:Py,toJSONSchema:mf,treeifyError:Ry,util:Cy,version:Ub},Symbol.toStringTag,{value:"Module"})),IN=Object.freeze(Object.defineProperty({__proto__:null,endsWith:Gs,gt:Pr,gte:dt,includes:Bs,length:Ri,lowercase:Vs,lt:Rr,lte:Ot,maxLength:Ni,maxSize:Ci,mime:Hs,minLength:on,minSize:Kn,multipleOf:Jn,negative:cf,nonnegative:uf,nonpositive:lf,normalize:Ws,overwrite:xr,positive:sf,property:df,regex:Fs,size:Ls,slugify:Xs,startsWith:qs,toLowerCase:Ks,toUpperCase:Ys,trim:Js,uppercase:Zs},Symbol.toStringTag,{value:"Module"})),pf=T("ZodISODateTime",(e,t)=>{Yb.init(e,t),Ie.init(e,t)});function C0(e){return uw(pf,e)}const gf=T("ZodISODate",(e,t)=>{Xb.init(e,t),Ie.init(e,t)});function N0(e){return dw(gf,e)}const hf=T("ZodISOTime",(e,t)=>{Qb.init(e,t),Ie.init(e,t)});function R0(e){return fw(hf,e)}const vf=T("ZodISODuration",(e,t)=>{e_.init(e,t),Ie.init(e,t)});function P0(e){return mw(vf,e)}const j0=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:gf,ZodISODateTime:pf,ZodISODuration:vf,ZodISOTime:hf,date:N0,datetime:C0,duration:P0,time:R0},Symbol.toStringTag,{value:"Module"})),D0=(e,t)=>{yd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>_d(e,r)},flatten:{value:r=>bd(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ka,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ka,2)}},isEmpty:{get(){return e.issues.length===0}}})},TN=T("ZodError",D0),Et=T("ZodError",D0,{Parent:Error}),z0=Si(Et),M0=ki(Et),U0=Ei(Et),yf=Ii(Et),L0=wd(Et),F0=xd(Et),V0=Sd(Et),Z0=kd(Et),B0=Ed(Et),q0=Id(Et),G0=Td(Et),H0=$d(Et),ie=T("ZodType",(e,t)=>(Y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yo(e,"input"),output:Yo(e,"output")}}),e.toJSONSchema=Gw(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(wr(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})),e.clone=(r,o)=>Nt(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>z0(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>U0(e,r,o),e.parseAsync=async(r,o)=>M0(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>yf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>L0(e,r,o),e.decode=(r,o)=>F0(e,r,o),e.encodeAsync=async(r,o)=>V0(e,r,o),e.decodeAsync=async(r,o)=>Z0(e,r,o),e.safeEncode=(r,o)=>B0(e,r,o),e.safeDecode=(r,o)=>q0(e,r,o),e.safeEncodeAsync=async(r,o)=>G0(e,r,o),e.safeDecodeAsync=async(r,o)=>H0(e,r,o),e.refine=(r,o)=>e.check(nm(r,o)),e.superRefine=r=>e.check(om(r)),e.overwrite=r=>e.check(xr(r)),e.optional=()=>re(e),e.nullable=()=>Qo(e),e.nullish=()=>re(Qo(e)),e.nonoptional=r=>qf(e,r),e.array=()=>D(e),e.or=r=>fe([e,r]),e.and=r=>Nf(e,r),e.transform=r=>ei(e,wc(r)),e.default=r=>Vf(e,r),e.prefault=r=>Bf(e,r),e.catch=r=>Wf(e,r),e.pipe=r=>ei(e,r),e.readonly=()=>Yf(e),e.describe=r=>{const o=e.clone();return Vt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Vt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Vt.get(e);const o=e.clone();return Vt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Qs=T("_ZodString",(e,t)=>{Ai.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Hw(e,o,n);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...o)=>e.check(Fs(...o)),e.includes=(...o)=>e.check(Bs(...o)),e.startsWith=(...o)=>e.check(qs(...o)),e.endsWith=(...o)=>e.check(Gs(...o)),e.min=(...o)=>e.check(on(...o)),e.max=(...o)=>e.check(Ni(...o)),e.length=(...o)=>e.check(Ri(...o)),e.nonempty=(...o)=>e.check(on(1,...o)),e.lowercase=o=>e.check(Vs(o)),e.uppercase=o=>e.check(Zs(o)),e.trim=()=>e.check(Js()),e.normalize=(...o)=>e.check(Ws(...o)),e.toLowerCase=()=>e.check(Ks()),e.toUpperCase=()=>e.check(Ys()),e.slugify=()=>e.check(Xs())}),ji=T("ZodString",(e,t)=>{Ai.init(e,t),Qs.init(e,t),e.email=r=>e.check(Ld(ec,r)),e.url=r=>e.check(Us(Di,r)),e.jwt=r=>e.check(af(hc,r)),e.emoji=r=>e.check(qd(tc,r)),e.guid=r=>e.check(Qa(Xo,r)),e.uuid=r=>e.check(Fd(Qt,r)),e.uuidv4=r=>e.check(Vd(Qt,r)),e.uuidv6=r=>e.check(Zd(Qt,r)),e.uuidv7=r=>e.check(Bd(Qt,r)),e.nanoid=r=>e.check(Gd(rc,r)),e.guid=r=>e.check(Qa(Xo,r)),e.cuid=r=>e.check(Hd(nc,r)),e.cuid2=r=>e.check(Wd(oc,r)),e.ulid=r=>e.check(Jd(ic,r)),e.base64=r=>e.check(rf(fc,r)),e.base64url=r=>e.check(nf(pc,r)),e.xid=r=>e.check(Kd(ac,r)),e.ksuid=r=>e.check(Yd(sc,r)),e.ipv4=r=>e.check(Xd(cc,r)),e.ipv6=r=>e.check(Qd(lc,r)),e.cidrv4=r=>e.check(ef(uc,r)),e.cidrv6=r=>e.check(tf(dc,r)),e.e164=r=>e.check(of(gc,r)),e.datetime=r=>e.check(C0(r)),e.date=r=>e.check(N0(r)),e.time=r=>e.check(R0(r)),e.duration=r=>e.check(P0(r))});function S(e){return aw(ji,e)}const Ie=T("ZodStringFormat",(e,t)=>{Ee.init(e,t),Qs.init(e,t)}),ec=T("ZodEmail",(e,t)=>{Vb.init(e,t),Ie.init(e,t)});function W0(e){return Ld(ec,e)}const Xo=T("ZodGUID",(e,t)=>{Lb.init(e,t),Ie.init(e,t)});function J0(e){return Qa(Xo,e)}const Qt=T("ZodUUID",(e,t)=>{Fb.init(e,t),Ie.init(e,t)});function K0(e){return Fd(Qt,e)}function Y0(e){return Vd(Qt,e)}function X0(e){return Zd(Qt,e)}function Q0(e){return Bd(Qt,e)}const Di=T("ZodURL",(e,t)=>{Zb.init(e,t),Ie.init(e,t)});function ex(e){return Us(Di,e)}function tx(e){return Us(Di,{protocol:/^https?$/,hostname:rb,...C(e)})}const tc=T("ZodEmoji",(e,t)=>{Bb.init(e,t),Ie.init(e,t)});function rx(e){return qd(tc,e)}const rc=T("ZodNanoID",(e,t)=>{qb.init(e,t),Ie.init(e,t)});function nx(e){return Gd(rc,e)}const nc=T("ZodCUID",(e,t)=>{Gb.init(e,t),Ie.init(e,t)});function ox(e){return Hd(nc,e)}const oc=T("ZodCUID2",(e,t)=>{Hb.init(e,t),Ie.init(e,t)});function ix(e){return Wd(oc,e)}const ic=T("ZodULID",(e,t)=>{Wb.init(e,t),Ie.init(e,t)});function ax(e){return Jd(ic,e)}const ac=T("ZodXID",(e,t)=>{Jb.init(e,t),Ie.init(e,t)});function sx(e){return Kd(ac,e)}const sc=T("ZodKSUID",(e,t)=>{Kb.init(e,t),Ie.init(e,t)});function cx(e){return Yd(sc,e)}const cc=T("ZodIPv4",(e,t)=>{t_.init(e,t),Ie.init(e,t)});function lx(e){return Xd(cc,e)}const bf=T("ZodMAC",(e,t)=>{n_.init(e,t),Ie.init(e,t)});function ux(e){return cw(bf,e)}const lc=T("ZodIPv6",(e,t)=>{r_.init(e,t),Ie.init(e,t)});function dx(e){return Qd(lc,e)}const uc=T("ZodCIDRv4",(e,t)=>{o_.init(e,t),Ie.init(e,t)});function fx(e){return ef(uc,e)}const dc=T("ZodCIDRv6",(e,t)=>{i_.init(e,t),Ie.init(e,t)});function mx(e){return tf(dc,e)}const fc=T("ZodBase64",(e,t)=>{a_.init(e,t),Ie.init(e,t)});function mc(e){return rf(fc,e)}const pc=T("ZodBase64URL",(e,t)=>{c_.init(e,t),Ie.init(e,t)});function px(e){return nf(pc,e)}const gc=T("ZodE164",(e,t)=>{l_.init(e,t),Ie.init(e,t)});function gx(e){return of(gc,e)}const hc=T("ZodJWT",(e,t)=>{d_.init(e,t),Ie.init(e,t)});function hx(e){return af(hc,e)}const fo=T("ZodCustomStringFormat",(e,t)=>{f_.init(e,t),Ie.init(e,t)});function vx(e,t,r={}){return Pi(fo,e,t,r)}function yx(e){return Pi(fo,"hostname",tb,e)}function bx(e){return Pi(fo,"hex",yb,e)}function _x(e,t){const r=t?.enc??"hex",o=`${e}_${r}`,n=Ad[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Pi(fo,o,n,t)}const zi=T("ZodNumber",(e,t)=>{Pd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Ww(e,o,n),e.gt=(o,n)=>e.check(Pr(o,n)),e.gte=(o,n)=>e.check(dt(o,n)),e.min=(o,n)=>e.check(dt(o,n)),e.lt=(o,n)=>e.check(Rr(o,n)),e.lte=(o,n)=>e.check(Ot(o,n)),e.max=(o,n)=>e.check(Ot(o,n)),e.int=o=>e.check(es(o)),e.safe=o=>e.check(es(o)),e.positive=o=>e.check(Pr(0,o)),e.nonnegative=o=>e.check(dt(0,o)),e.negative=o=>e.check(Rr(0,o)),e.nonpositive=o=>e.check(Ot(0,o)),e.multipleOf=(o,n)=>e.check(Jn(o,n)),e.step=(o,n)=>e.check(Jn(o,n)),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 Z(e){return pw(zi,e)}const gn=T("ZodNumberFormat",(e,t)=>{m_.init(e,t),zi.init(e,t)});function es(e){return hw(gn,e)}function wx(e){return vw(gn,e)}function xx(e){return yw(gn,e)}function Sx(e){return bw(gn,e)}function kx(e){return _w(gn,e)}const Mi=T("ZodBoolean",(e,t)=>{jd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Jw(e,r,o)});function mt(e){return ww(Mi,e)}const Ui=T("ZodBigInt",(e,t)=>{Dd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Kw(e,o),e.gte=(o,n)=>e.check(dt(o,n)),e.min=(o,n)=>e.check(dt(o,n)),e.gt=(o,n)=>e.check(Pr(o,n)),e.gte=(o,n)=>e.check(dt(o,n)),e.min=(o,n)=>e.check(dt(o,n)),e.lt=(o,n)=>e.check(Rr(o,n)),e.lte=(o,n)=>e.check(Ot(o,n)),e.max=(o,n)=>e.check(Ot(o,n)),e.positive=o=>e.check(Pr(BigInt(0),o)),e.negative=o=>e.check(Rr(BigInt(0),o)),e.nonpositive=o=>e.check(Ot(BigInt(0),o)),e.nonnegative=o=>e.check(dt(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(Jn(o,n));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Ex(e){return Sw(Ui,e)}const vc=T("ZodBigIntFormat",(e,t)=>{p_.init(e,t),Ui.init(e,t)});function Ix(e){return Ew(vc,e)}function Tx(e){return Iw(vc,e)}const _f=T("ZodSymbol",(e,t)=>{g_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yw(e,r)});function $x(e){return Tw(_f,e)}const wf=T("ZodUndefined",(e,t)=>{h_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qw(e,r)});function Ox(e){return $w(wf,e)}const xf=T("ZodNull",(e,t)=>{v_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xw(e,r,o)});function yc(e){return Ow(xf,e)}const Sf=T("ZodAny",(e,t)=>{y_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>r0()});function Me(){return Aw(Sf)}const kf=T("ZodUnknown",(e,t)=>{b_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>n0()});function Qe(){return Cw(kf)}const Ef=T("ZodNever",(e,t)=>{__.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>t0(e,r,o)});function bc(e){return Nw(Ef,e)}const If=T("ZodVoid",(e,t)=>{w_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>e0(e,r)});function Ax(e){return Rw(If,e)}const _c=T("ZodDate",(e,t)=>{x_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>o0(e,o),e.min=(o,n)=>e.check(dt(o,n)),e.max=(o,n)=>e.check(Ot(o,n));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Cx(e){return Pw(_c,e)}const Tf=T("ZodArray",(e,t)=>{S_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>h0(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(on(r,o)),e.nonempty=r=>e.check(on(1,r)),e.max=(r,o)=>e.check(Ni(r,o)),e.length=(r,o)=>e.check(Ri(r,o)),e.unwrap=()=>e.element});function D(e,t){return zw(Tf,e,t)}function Nx(e){const t=e._zod.def.shape;return hn(Object.keys(t))}const Li=T("ZodObject",(e,t)=>{T_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>v0(e,r,o,n),de(e,"shape",()=>t.shape),e.keyof=()=>hn(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Qe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qe()}),e.strict=()=>e.clone({...e._zod.def,catchall:bc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>ky(e,r),e.safeExtend=r=>Ey(e,r),e.merge=r=>Iy(e,r),e.pick=r=>xy(e,r),e.omit=r=>Sy(e,r),e.partial=(...r)=>Ty(xc,e,r[0]),e.required=(...r)=>$y(Sc,e,r[0])});function O(e,t){const r={type:"object",shape:e??{},...C(t)};return new Li(r)}function Rx(e,t){return new Li({type:"object",shape:e,catchall:bc(),...C(t)})}function Ir(e,t){return new Li({type:"object",shape:e,catchall:Qe(),...C(t)})}const Fi=T("ZodUnion",(e,t)=>{Ms.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ff(e,r,o,n),e.options=t.options});function fe(e,t){return new Fi({type:"union",options:e,...C(t)})}const $f=T("ZodXor",(e,t)=>{Fi.init(e,t),$_.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ff(e,r,o,n),e.options=t.options});function Px(e,t){return new $f({type:"union",options:e,inclusive:!1,...C(t)})}const Of=T("ZodDiscriminatedUnion",(e,t)=>{Fi.init(e,t),O_.init(e,t)});function Af(e,t,r){return new Of({type:"union",options:t,discriminator:e,...C(r)})}const Cf=T("ZodIntersection",(e,t)=>{A_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>y0(e,r,o,n)});function Nf(e,t){return new Cf({type:"intersection",left:e,right:t})}const Rf=T("ZodTuple",(e,t)=>{zd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>b0(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Pf(e,t,r){const o=t instanceof Y,n=o?r:t,i=o?t:null;return new Rf({type:"tuple",items:e,rest:i,...C(n)})}const Vi=T("ZodRecord",(e,t)=>{C_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_0(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function nr(e,t,r){return new Vi({type:"record",keyType:e,valueType:t,...C(r)})}function jx(e,t,r){const o=Nt(e);return o._zod.values=void 0,new Vi({type:"record",keyType:o,valueType:t,...C(r)})}function Dx(e,t,r){return new Vi({type:"record",keyType:e,valueType:t,mode:"loose",...C(r)})}const jf=T("ZodMap",(e,t)=>{N_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>p0(e,r),e.keyType=t.keyType,e.valueType=t.valueType});function zx(e,t,r){return new jf({type:"map",keyType:e,valueType:t,...C(r)})}const Df=T("ZodSet",(e,t)=>{R_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>g0(e,r),e.min=(...r)=>e.check(Kn(...r)),e.nonempty=r=>e.check(Kn(1,r)),e.max=(...r)=>e.check(Ci(...r)),e.size=(...r)=>e.check(Ls(...r))});function Mx(e,t){return new Df({type:"set",valueType:e,...C(t)})}const eo=T("ZodEnum",(e,t)=>{P_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>i0(e,o,n),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{const i={};for(const a of o)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new eo({...t,checks:[],...C(n),entries:i})},e.exclude=(o,n)=>{const i={...t.entries};for(const a of o)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new eo({...t,checks:[],...C(n),entries:i})}});function hn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new eo({type:"enum",entries:r,...C(t)})}function Ux(e,t){return new eo({type:"enum",entries:e,...C(t)})}const zf=T("ZodLiteral",(e,t)=>{j_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>a0(e,r,o),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 B(e,t){return new zf({type:"literal",values:Array.isArray(e)?e:[e],...C(t)})}const Mf=T("ZodFile",(e,t)=>{D_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>l0(e,r,o),e.min=(r,o)=>e.check(Kn(r,o)),e.max=(r,o)=>e.check(Ci(r,o)),e.mime=(r,o)=>e.check(Hs(Array.isArray(r)?r:[r],o))});function Lx(e){return Mw(Mf,e)}const Uf=T("ZodTransform",(e,t)=>{z_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>m0(e,r),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Rs(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(Hn(i,r.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(Hn(a))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(i=>(r.value=i,r)):(r.value=n,r)}});function wc(e){return new Uf({type:"transform",transform:e})}const xc=T("ZodOptional",(e,t)=>{M_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function re(e){return new xc({type:"optional",innerType:e})}const Lf=T("ZodNullable",(e,t)=>{U_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>w0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Qo(e){return new Lf({type:"nullable",innerType:e})}function Fx(e){return re(Qo(e))}const Ff=T("ZodDefault",(e,t)=>{L_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>S0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Vf(e,t){return new Ff({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():js(t)}})}const Zf=T("ZodPrefault",(e,t)=>{F_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Bf(e,t){return new Zf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():js(t)}})}const Sc=T("ZodNonOptional",(e,t)=>{V_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>x0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function qf(e,t){return new Sc({type:"nonoptional",innerType:e,...C(t)})}const Gf=T("ZodSuccess",(e,t)=>{Z_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>u0(e,r,o),e.unwrap=()=>e._zod.def.innerType});function Vx(e){return new Gf({type:"success",innerType:e})}const Hf=T("ZodCatch",(e,t)=>{B_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wf(e,t){return new Hf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Jf=T("ZodNaN",(e,t)=>{q_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>s0(e,r)});function Zx(e){return Dw(Jf,e)}const kc=T("ZodPipe",(e,t)=>{G_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I0(e,r,o,n),e.in=t.in,e.out=t.out});function ei(e,t){return new kc({type:"pipe",in:e,out:t})}const Ec=T("ZodCodec",(e,t)=>{kc.init(e,t),Md.init(e,t)});function Bx(e,t,r){return new Ec({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const Kf=T("ZodReadonly",(e,t)=>{H_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>T0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yf(e){return new Kf({type:"readonly",innerType:e})}const Xf=T("ZodTemplateLiteral",(e,t)=>{W_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>c0(e,r,o)});function qx(e,t){return new Xf({type:"template_literal",parts:e,...C(t)})}const Qf=T("ZodLazy",(e,t)=>{Y_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>A0(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Ic(e){return new Qf({type:"lazy",getter:e})}const em=T("ZodPromise",(e,t)=>{K_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Gx(e){return new em({type:"promise",innerType:e})}const tm=T("ZodFunction",(e,t)=>{J_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>f0(e,r)});function ts(e){return new tm({type:"function",input:Array.isArray(e?.input)?Pf(e?.input):e?.input??D(Qe()),output:e?.output??Qe()})}const Zi=T("ZodCustom",(e,t)=>{X_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>d0(e,r)});function Hx(e){const t=new Ae({check:"custom"});return t._zod.check=e,t}function rm(e,t){return Uw(Zi,e??(()=>!0),t)}function nm(e,t={}){return Lw(Zi,e,t)}function om(e){return Fw(e)}const Wx=Zw,Jx=Bw;function to(e,t={error:`Input not instance of ${e.name}`}){const r=new Zi({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...C(t)});return r._zod.bag.Class=e,r}const Kx=(...e)=>qw({Codec:Ec,Boolean:Mi,String:ji},...e);function Yx(e){const t=Ic(()=>fe([S(e),Z(),mt(),yc(),D(t),nr(S(),t)]));return t}function Xx(e,t){return ei(wc(e),t)}const $N=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Sf,ZodArray:Tf,ZodBase64:fc,ZodBase64URL:pc,ZodBigInt:Ui,ZodBigIntFormat:vc,ZodBoolean:Mi,ZodCIDRv4:uc,ZodCIDRv6:dc,ZodCUID:nc,ZodCUID2:oc,ZodCatch:Hf,ZodCodec:Ec,ZodCustom:Zi,ZodCustomStringFormat:fo,ZodDate:_c,ZodDefault:Ff,ZodDiscriminatedUnion:Of,ZodE164:gc,ZodEmail:ec,ZodEmoji:tc,ZodEnum:eo,ZodFile:Mf,ZodFunction:tm,ZodGUID:Xo,ZodIPv4:cc,ZodIPv6:lc,ZodIntersection:Cf,ZodJWT:hc,ZodKSUID:sc,ZodLazy:Qf,ZodLiteral:zf,ZodMAC:bf,ZodMap:jf,ZodNaN:Jf,ZodNanoID:rc,ZodNever:Ef,ZodNonOptional:Sc,ZodNull:xf,ZodNullable:Lf,ZodNumber:zi,ZodNumberFormat:gn,ZodObject:Li,ZodOptional:xc,ZodPipe:kc,ZodPrefault:Zf,ZodPromise:em,ZodReadonly:Kf,ZodRecord:Vi,ZodSet:Df,ZodString:ji,ZodStringFormat:Ie,ZodSuccess:Gf,ZodSymbol:_f,ZodTemplateLiteral:Xf,ZodTransform:Uf,ZodTuple:Rf,ZodType:ie,ZodULID:ic,ZodURL:Di,ZodUUID:Qt,ZodUndefined:wf,ZodUnion:Fi,ZodUnknown:kf,ZodVoid:If,ZodXID:ac,ZodXor:$f,_ZodString:Qs,_default:Vf,_function:ts,any:Me,array:D,base64:mc,base64url:px,bigint:Ex,boolean:mt,catch:Wf,check:Hx,cidrv4:fx,cidrv6:mx,codec:Bx,cuid:ox,cuid2:ix,custom:rm,date:Cx,describe:Wx,discriminatedUnion:Af,e164:gx,email:W0,emoji:rx,enum:hn,file:Lx,float32:wx,float64:xx,function:ts,guid:J0,hash:_x,hex:bx,hostname:yx,httpUrl:tx,instanceof:to,int:es,int32:Sx,int64:Ix,intersection:Nf,ipv4:lx,ipv6:dx,json:Yx,jwt:hx,keyof:Nx,ksuid:cx,lazy:Ic,literal:B,looseObject:Ir,looseRecord:Dx,mac:ux,map:zx,meta:Jx,nan:Zx,nanoid:nx,nativeEnum:Ux,never:bc,nonoptional:qf,null:yc,nullable:Qo,nullish:Fx,number:Z,object:O,optional:re,partialRecord:jx,pipe:ei,prefault:Bf,preprocess:Xx,promise:Gx,readonly:Yf,record:nr,refine:nm,set:Mx,strictObject:Rx,string:S,stringFormat:vx,stringbool:Kx,success:Vx,superRefine:om,symbol:$x,templateLiteral:qx,transform:wc,tuple:Pf,uint32:kx,uint64:Tx,ulid:ax,undefined:Ox,union:fe,unknown:Qe,url:ex,uuid:K0,uuidv4:Y0,uuidv6:X0,uuidv7:Q0,void:Ax,xid:sx,xor:Px},Symbol.toStringTag,{value:"Module"})),Qx={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function ON(e){Xe({customError:e})}function AN(){return Xe().customError}var xu;xu||(xu={});const j={...$N,...IN,iso:j0};function CN(e,t){const r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function NN(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");const r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;const o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){const n=r[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function eS(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return j.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){const n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return j.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);const i=NN(n,t),a=Ye(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){const n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return j.null();if(n.length===0)return j.never();if(n.length===1)return j.literal(n[0]);if(n.every(a=>typeof a=="string"))return j.enum(n);const i=n.map(a=>j.literal(a));return i.length<2?i[0]:j.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return j.literal(e.const);const r=e.type;if(Array.isArray(r)){const n=r.map(i=>{const a={...e,type:i};return eS(a,t)});return n.length===0?j.never():n.length===1?n[0]:j.union(n)}if(!r)return j.any();let o;switch(r){case"string":{let n=j.string();if(e.format){const i=e.format;i==="email"?n=n.check(j.email()):i==="uri"||i==="uri-reference"?n=n.check(j.url()):i==="uuid"||i==="guid"?n=n.check(j.uuid()):i==="date-time"?n=n.check(j.iso.datetime()):i==="date"?n=n.check(j.iso.date()):i==="time"?n=n.check(j.iso.time()):i==="duration"?n=n.check(j.iso.duration()):i==="ipv4"?n=n.check(j.ipv4()):i==="ipv6"?n=n.check(j.ipv6()):i==="mac"?n=n.check(j.mac()):i==="cidr"?n=n.check(j.cidrv4()):i==="cidr-v6"?n=n.check(j.cidrv6()):i==="base64"?n=n.check(j.base64()):i==="base64url"?n=n.check(j.base64url()):i==="e164"?n=n.check(j.e164()):i==="jwt"?n=n.check(j.jwt()):i==="emoji"?n=n.check(j.emoji()):i==="nanoid"?n=n.check(j.nanoid()):i==="cuid"?n=n.check(j.cuid()):i==="cuid2"?n=n.check(j.cuid2()):i==="ulid"?n=n.check(j.ulid()):i==="xid"?n=n.check(j.xid()):i==="ksuid"&&(n=n.check(j.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?j.number().int():j.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=j.boolean();break}case"null":{o=j.null();break}case"object":{const n={},i=e.properties||{},a=new Set(e.required||[]);for(const[c,l]of Object.entries(i)){const u=Ye(l,t);n[c]=a.has(c)?u:u.optional()}if(e.propertyNames){const c=Ye(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Ye(e.additionalProperties,t):j.any();if(Object.keys(n).length===0){o=j.record(c,l);break}const u=j.object(n).passthrough(),d=j.looseRecord(c,l);o=j.intersection(u,d);break}if(e.patternProperties){const c=e.patternProperties,l=Object.keys(c),u=[];for(const f of l){const m=Ye(c[f],t),h=j.string().regex(new RegExp(f));u.push(j.looseRecord(h,m))}const d=[];if(Object.keys(n).length>0&&d.push(j.object(n).passthrough()),d.push(...u),d.length===0)o=j.object({}).passthrough();else if(d.length===1)o=d[0];else{let f=j.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)f=j.intersection(f,d[m]);o=f}break}const s=j.object(n);e.additionalProperties===!1?o=s.strict():typeof e.additionalProperties=="object"?o=s.catchall(Ye(e.additionalProperties,t)):o=s.passthrough();break}case"array":{const n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){const a=n.map(c=>Ye(c,t)),s=i&&typeof i=="object"&&!Array.isArray(i)?Ye(i,t):void 0;s?o=j.tuple(a).rest(s):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(Array.isArray(i)){const a=i.map(c=>Ye(c,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Ye(e.additionalItems,t):void 0;s?o=j.tuple(a).rest(s):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(i!==void 0){const a=Ye(i,t);let s=j.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=j.array(j.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(o=o.describe(e.description)),e.default!==void 0&&(o=o.default(e.default)),o}function Ye(e,t){if(typeof e=="boolean")return e?j.any():j.never();let r=eS(e,t);const o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){const n=e.anyOf.map(a=>Ye(a,t)),i=j.union(n);r=o?j.intersection(r,i):i}if(e.oneOf&&Array.isArray(e.oneOf)){const n=e.oneOf.map(a=>Ye(a,t)),i=j.xor(n);r=o?j.intersection(r,i):i}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:j.any();else{let n=o?r:Ye(e.allOf[0],t);const i=o?0:1;for(let a=i;a<e.allOf.length;a++)n=j.intersection(n,Ye(e.allOf[a],t));r=n}return e.nullable===!0&&t.version==="openapi-3.0"&&(r=j.nullable(r)),e.readOnly===!0&&(r=j.readonly(r)),r}function RN(e,t){if(typeof e=="boolean")return e?j.any():j.never();const r=CN(e,t?.defaultTarget),o=e.$defs||e.definitions||{};return Ye(e,{version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e})}function PN(e){return sw(ji,e)}function jN(e){return gw(zi,e)}function DN(e){return xw(Mi,e)}function zN(e){return kw(Ui,e)}function MN(e){return jw(_c,e)}const UN=Object.freeze(Object.defineProperty({__proto__:null,bigint:zN,boolean:DN,date:MN,number:jN,string:PN},Symbol.toStringTag,{value:"Module"}));Xe(Q_());const ig=Object.freeze(Object.defineProperty({__proto__:null,$brand:py,$input:ow,$output:nw,NEVER:gd,TimePrecision:lw,ZodAny:Sf,ZodArray:Tf,ZodBase64:fc,ZodBase64URL:pc,ZodBigInt:Ui,ZodBigIntFormat:vc,ZodBoolean:Mi,ZodCIDRv4:uc,ZodCIDRv6:dc,ZodCUID:nc,ZodCUID2:oc,ZodCatch:Hf,ZodCodec:Ec,ZodCustom:Zi,ZodCustomStringFormat:fo,ZodDate:_c,ZodDefault:Ff,ZodDiscriminatedUnion:Of,ZodE164:gc,ZodEmail:ec,ZodEmoji:tc,ZodEnum:eo,ZodError:TN,ZodFile:Mf,get ZodFirstPartyTypeKind(){return xu},ZodFunction:tm,ZodGUID:Xo,ZodIPv4:cc,ZodIPv6:lc,ZodISODate:gf,ZodISODateTime:pf,ZodISODuration:vf,ZodISOTime:hf,ZodIntersection:Cf,ZodIssueCode:Qx,ZodJWT:hc,ZodKSUID:sc,ZodLazy:Qf,ZodLiteral:zf,ZodMAC:bf,ZodMap:jf,ZodNaN:Jf,ZodNanoID:rc,ZodNever:Ef,ZodNonOptional:Sc,ZodNull:xf,ZodNullable:Lf,ZodNumber:zi,ZodNumberFormat:gn,ZodObject:Li,ZodOptional:xc,ZodPipe:kc,ZodPrefault:Zf,ZodPromise:em,ZodReadonly:Kf,ZodRealError:Et,ZodRecord:Vi,ZodSet:Df,ZodString:ji,ZodStringFormat:Ie,ZodSuccess:Gf,ZodSymbol:_f,ZodTemplateLiteral:Xf,ZodTransform:Uf,ZodTuple:Rf,ZodType:ie,ZodULID:ic,ZodURL:Di,ZodUUID:Qt,ZodUndefined:wf,ZodUnion:Fi,ZodUnknown:kf,ZodVoid:If,ZodXID:ac,ZodXor:$f,_ZodString:Qs,_default:Vf,_function:ts,any:Me,array:D,base64:mc,base64url:px,bigint:Ex,boolean:mt,catch:Wf,check:Hx,cidrv4:fx,cidrv6:mx,clone:Nt,codec:Bx,coerce:UN,config:Xe,core:EN,cuid:ox,cuid2:ix,custom:rm,date:Cx,decode:F0,decodeAsync:Z0,describe:Wx,discriminatedUnion:Af,e164:gx,email:W0,emoji:rx,encode:L0,encodeAsync:V0,endsWith:Gs,enum:hn,file:Lx,flattenError:bd,float32:wx,float64:xx,formatError:_d,fromJSONSchema:RN,function:ts,getErrorMap:AN,globalRegistry:Vt,gt:Pr,gte:dt,guid:J0,hash:_x,hex:bx,hostname:yx,httpUrl:tx,includes:Bs,instanceof:to,int:es,int32:Sx,int64:Ix,intersection:Nf,ipv4:lx,ipv6:dx,iso:j0,json:Yx,jwt:hx,keyof:Nx,ksuid:cx,lazy:Ic,length:Ri,literal:B,locales:rw,looseObject:Ir,looseRecord:Dx,lowercase:Vs,lt:Rr,lte:Ot,mac:ux,map:zx,maxLength:Ni,maxSize:Ci,meta:Jx,mime:Hs,minLength:on,minSize:Kn,multipleOf:Jn,nan:Zx,nanoid:nx,nativeEnum:Ux,negative:cf,never:bc,nonnegative:uf,nonoptional:qf,nonpositive:lf,normalize:Ws,null:yc,nullable:Qo,nullish:Fx,number:Z,object:O,optional:re,overwrite:xr,parse:z0,parseAsync:M0,partialRecord:jx,pipe:ei,positive:sf,prefault:Bf,preprocess:Xx,prettifyError:jy,promise:Gx,property:df,readonly:Yf,record:nr,refine:nm,regex:Fs,regexes:Ad,registry:Ud,safeDecode:q0,safeDecodeAsync:H0,safeEncode:B0,safeEncodeAsync:G0,safeParse:U0,safeParseAsync:yf,set:Mx,setErrorMap:ON,size:Ls,slugify:Xs,startsWith:qs,strictObject:Rx,string:S,stringFormat:vx,stringbool:Kx,success:Vx,superRefine:om,symbol:$x,templateLiteral:qx,toJSONSchema:mf,toLowerCase:Ks,toUpperCase:Ys,transform:wc,treeifyError:Ry,trim:Js,tuple:Pf,uint32:kx,uint64:Tx,ulid:ax,undefined:Ox,union:fe,unknown:Qe,uppercase:Zs,url:ex,util:Cy,uuid:K0,uuidv4:Y0,uuidv6:X0,uuidv7:Q0,void:Ax,xid:sx,xor:Px},Symbol.toStringTag,{value:"Module"}));var ti;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{const i={};for(const a of n)i[a]=a;return i},e.getValidEnumValues=n=>{const i=e.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),a={};for(const s of i)a[s]=n[s];return e.objectValues(a)},e.objectValues=n=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const i=[];for(const a in n)Object.prototype.hasOwnProperty.call(n,a)&&i.push(a);return i},e.find=(n,i)=>{for(const a of n)if(i(a))return a},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>typeof i=="bigint"?i.toString():i})(ti||(ti={}));var ag;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(ag||(ag={}));ti.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ti.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 rs extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};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(i){return i.message},o={_errors:[]},n=i=>{for(const a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(n);else if(a.code==="invalid_return_type")n(a.returnTypeError);else if(a.code==="invalid_arguments")n(a.argumentsError);else if(a.path.length===0)o._errors.push(r(a));else{let s=o,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(a))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return n(this),o}static assert(t){if(!(t instanceof rs))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ti.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r=Object.create(null),o=[];for(const n of this.issues)if(n.path.length>0){const i=n.path[0];r[i]=r[i]||[],r[i].push(t(n))}else o.push(t(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}}rs.create=e=>new rs(e);var sg;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(sg||(sg={}));var X;(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"})(X||(X={}));var LN=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const i=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*i|0];return a.join("")};if(e==null)return n;if(r.includes(o))throw new pd({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`};LN();function tS(e=globalThis){var t,r,o;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(o=(r=e.process)==null?void 0:r.versions)!=null&&o.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function FN(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((r,o)=>{t[o.toLowerCase()]=r});else{Array.isArray(e)||(e=Object.entries(e));for(const[r,o]of e)o!=null&&(t[r.toLowerCase()]=o)}return t}function rS(e,...t){const r=new Headers(FN(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var VN=Symbol.for("vercel.ai.validator");function ZN(e){return{...e,type:"dynamic"}}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var BN=Symbol.for("vercel.ai.schema");function qN(e,{validate:t}={}){return{[BN]:!0,_type:void 0,[VN]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}let im;im=globalThis.crypto;async function GN(e){return(await im).getRandomValues(new Uint8Array(e))}async function HN(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const o=await GN(e);for(let n=0;n<e;n++){const i=o[n]%t.length;r+=t[i]}return r}async function WN(e){return await HN(e)}async function JN(e){const t=await(await im).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function KN(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await WN(e),r=await JN(t);return{code_verifier:t,code_challenge:r}}var YN="AI_MCPClientError",nS=`vercel.ai.error.${YN}`,XN=Symbol.for(nS),cg,lg,we=class extends(lg=ee,cg=XN,lg){constructor({name:e="MCPClientError",message:t,cause:r,data:o,code:n}){super({name:e,message:t,cause:r}),this[cg]=!0,this.data=o,this.code=n}static isInstance(e){return ee.hasMarker(e,nS)}},mo="2025-06-18",QN=[mo,"2025-03-26","2024-11-05"],eR=Ir({name:S(),version:S()}),Tc=Ir({_meta:re(O({}).loose())}),mr=Tc,oS=O({method:S(),params:re(Tc)}),iS=O({applyDefaults:re(mt())}).loose(),tR=Ir({experimental:re(O({}).loose()),logging:re(O({}).loose()),prompts:re(Ir({listChanged:re(mt())})),resources:re(Ir({subscribe:re(mt()),listChanged:re(mt())})),tools:re(Ir({listChanged:re(mt())})),elicitation:re(iS)});O({elicitation:re(iS)}).loose();var rR=mr.extend({protocolVersion:S(),capabilities:tR,serverInfo:eR,instructions:re(S())}),am=mr.extend({nextCursor:re(S())}),nR=O({name:S(),description:re(S()),inputSchema:O({type:B("object"),properties:re(O({}).loose())}).loose()}).loose(),oR=am.extend({tools:D(nR)}),aS=O({type:B("text"),text:S()}).loose(),sS=O({type:B("image"),data:mc(),mimeType:S()}).loose(),iR=O({uri:S(),name:S(),title:re(S()),description:re(S()),mimeType:re(S()),size:re(Z())}).loose(),aR=am.extend({resources:D(iR)}),cS=O({uri:S(),name:re(S()),title:re(S()),mimeType:re(S())}).loose(),lS=cS.extend({text:S()}),uS=cS.extend({blob:mc()}),dS=O({type:B("resource"),resource:fe([lS,uS])}).loose(),sR=mr.extend({content:D(fe([aS,sS,dS])),isError:mt().default(!1).optional()}).or(mr.extend({toolResult:Qe()})),cR=O({uriTemplate:S(),name:S(),title:re(S()),description:re(S()),mimeType:re(S())}).loose(),lR=mr.extend({resourceTemplates:D(cR)}),uR=mr.extend({contents:D(fe([lS,uS]))}),dR=O({name:S(),description:re(S()),required:re(mt())}).loose(),fR=O({name:S(),title:re(S()),description:re(S()),arguments:re(D(dR))}).loose(),mR=am.extend({prompts:D(fR)}),pR=O({role:fe([B("user"),B("assistant")]),content:fe([aS,sS,dS])}).loose(),gR=mr.extend({description:re(S()),messages:D(pR)}),hR=Tc.extend({message:S(),requestedSchema:Qe()}),ug=oS.extend({method:B("elicitation/create"),params:hR}),vR=mr.extend({action:fe([B("accept"),B("decline"),B("cancel")]),content:re(nr(S(),Qe()))}),$c="2.0",yR=O({jsonrpc:B($c),id:fe([S(),Z().int()])}).merge(oS).strict(),bR=O({jsonrpc:B($c),id:fe([S(),Z().int()]),result:mr}).strict(),_R=O({jsonrpc:B($c),id:fe([S(),Z().int()]),error:O({code:Z().int(),message:S(),data:re(Qe())})}).strict(),wR=O({jsonrpc:B($c)}).merge(O({method:S(),params:re(Tc)})).strict(),Zo=fe([yR,wR,bR,_R]),fS=typeof __PACKAGE_VERSION__<"u"?__PACKAGE_VERSION__:"0.0.0-test",mS=O({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:Z().optional(),scope:S().optional(),refresh_token:S().optional()}).strip(),ft=S().url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qx.custom,message:"URL must be parseable",fatal:!0}),gd}).refine(e=>{const t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),xR=O({resource:S().url(),authorization_servers:D(ft).optional(),jwks_uri:S().url().optional(),scopes_supported:D(S()).optional(),bearer_methods_supported:D(S()).optional(),resource_signing_alg_values_supported:D(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:D(S()).optional(),dpop_signing_alg_values_supported:D(S()).optional(),dpop_bound_access_tokens_required:mt().optional()}).passthrough(),pS=O({issuer:S(),authorization_endpoint:ft,token_endpoint:ft,registration_endpoint:ft.optional(),scopes_supported:D(S()).optional(),response_types_supported:D(S()),grant_types_supported:D(S()).optional(),code_challenge_methods_supported:D(S()),token_endpoint_auth_methods_supported:D(S()).optional(),token_endpoint_auth_signing_alg_values_supported:D(S()).optional()}).passthrough(),SR=O({issuer:S(),authorization_endpoint:ft,token_endpoint:ft,userinfo_endpoint:ft.optional(),jwks_uri:ft,registration_endpoint:ft.optional(),scopes_supported:D(S()).optional(),response_types_supported:D(S()),grant_types_supported:D(S()).optional(),subject_types_supported:D(S()),id_token_signing_alg_values_supported:D(S()),claims_supported:D(S()).optional(),token_endpoint_auth_methods_supported:D(S()).optional()}).passthrough(),kR=SR.merge(pS.pick({code_challenge_methods_supported:!0})),ER=O({client_id:S(),client_secret:S().optional(),client_id_issued_at:Z().optional(),client_secret_expires_at:Z().optional()}).strip(),IR=O({redirect_uris:D(ft),token_endpoint_auth_method:S().optional(),grant_types:D(S()).optional(),response_types:D(S()).optional(),client_name:S().optional(),client_uri:ft.optional(),logo_uri:ft.optional(),scope:S().optional(),contacts:D(S()).optional(),tos_uri:ft.optional(),policy_uri:S().optional(),jwks_uri:ft.optional(),jwks:Me().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),TR=O({error:S(),error_description:S().optional(),error_uri:S().optional()}),$R=IR.merge(ER),OR="AI_MCPClientOAuthError",gS=`vercel.ai.error.${OR}`,AR=Symbol.for(gS),dg,fg,Bi=class extends(fg=ee,dg=AR,fg){constructor({name:e="MCPClientOAuthError",message:t,cause:r}){super({name:e,message:t,cause:r}),this[dg]=!0}static isInstance(e){return ee.hasMarker(e,gS)}},ro=class extends Bi{};ro.errorCode="server_error";var ns=class extends Bi{};ns.errorCode="invalid_client";var os=class extends Bi{};os.errorCode="invalid_grant";var is=class extends Bi{};is.errorCode="unauthorized_client";var CR={[ro.errorCode]:ro,[ns.errorCode]:ns,[os.errorCode]:os,[is.errorCode]:is};function NR(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function RR({requestedResource:e,configuredResource:t}){const r=typeof e=="string"?new URL(e):new URL(e.href),o=typeof t=="string"?new URL(t):new URL(t.href);if(r.origin!==o.origin||r.pathname.length<o.pathname.length)return!1;const n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/",i=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(i)}var as=class extends Error{constructor(e="Unauthorized"){super(e),this.name="UnauthorizedError"}};function ss(e){var t;const r=(t=e.headers.get("www-authenticate"))!=null?t:e.headers.get("WWW-Authenticate");if(!r)return;const[o,n]=r.split(" ");if(o.toLowerCase()!=="bearer"||!n)return;const i=/resource_metadata="([^"]*)"/,a=r.match(i);if(a)try{return new URL(a[1])}catch{return}}function PR(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function sm(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?sm(e,void 0,r):void 0;throw o}}async function mg(e,t,r=fetch){return await sm(e,{"MCP-Protocol-Version":t},r)}function jR(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function DR(e,t,r,o){var n,i;const a=new URL(e),s=(n=o?.protocolVersion)!=null?n:mo;let c;if(o?.metadataUrl)c=new URL(o.metadataUrl);else{const u=PR(t,a.pathname);c=new URL(u,(i=o?.metadataServerUrl)!=null?i:a),c.search=a.search}let l=await mg(c,s,r);if(!o?.metadataUrl&&jR(l,a.pathname)){const u=new URL(`/.well-known/${t}`,a);l=await mg(u,s,r)}return l}async function zR(e,t,r=fetch){const o=await DR(e,"oauth-protected-resource",r,{protocolVersion:t?.protocolVersion,metadataUrl:t?.resourceMetadataUrl});if(!o||o.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!o.ok)throw new Error(`HTTP ${o.status} trying to load well-known OAuth protected resource metadata.`);return xR.parse(await o.json())}function MR(e){const t=typeof e=="string"?new URL(e):e,r=t.pathname!=="/",o=[];if(!r)return o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/openid-configuration",t.origin),type:"oidc"}),o;let n=t.pathname;return n.endsWith("/")&&(n=n.slice(0,-1)),o.push({url:new URL(`/.well-known/oauth-authorization-server${n}`,t.origin),type:"oauth"}),o.push({url:new URL("/.well-known/oauth-authorization-server",t.origin),type:"oauth"}),o.push({url:new URL(`/.well-known/openid-configuration${n}`,t.origin),type:"oidc"}),o.push({url:new URL(`${n}/.well-known/openid-configuration`,t.origin),type:"oidc"}),o}async function UR(e,{fetchFn:t=fetch,protocolVersion:r=mo}={}){var o;const n={"MCP-Protocol-Version":r},i=MR(e);for(const{url:a,type:s}of i){const c=await sm(a,n,t);if(c){if(!c.ok){if(c.status>=400&&c.status<500)continue;throw new Error(`HTTP ${c.status} trying to load ${s==="oauth"?"OAuth":"OpenID provider"} metadata from ${a}`)}if(s==="oauth")return pS.parse(await c.json());{const l=kR.parse(await c.json());if(!((o=l.code_challenge_methods_supported)!=null&&o.includes("S256")))throw new Error(`Incompatible OIDC provider at ${a}: does not support S256 code challenge method required by MCP specification`);return l}}}}async function LR(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:i,resource:a}){const s="code",c="S256";let l;if(t){if(l=new URL(t.authorization_endpoint),!t.response_types_supported.includes(s))throw new Error(`Incompatible auth server: does not support response type ${s}`);if(!t.code_challenge_methods_supported||!t.code_challenge_methods_supported.includes(c))throw new Error(`Incompatible auth server: does not support code challenge method ${c}`)}else l=new URL("/authorize",e);const u=await KN(),d=u.code_verifier,f=u.code_challenge;return l.searchParams.set("response_type",s),l.searchParams.set("client_id",r.client_id),l.searchParams.set("code_challenge",f),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(o)),i&&l.searchParams.set("state",i),n&&l.searchParams.set("scope",n),n?.includes("offline_access")&&l.searchParams.append("prompt","consent"),a&&l.searchParams.set("resource",a.href),{authorizationUrl:l,codeVerifier:d}}function hS(e,t){const r=e.client_secret!==void 0;return t.length===0?r?"client_secret_post":"none":r&&t.includes("client_secret_basic")?"client_secret_basic":r&&t.includes("client_secret_post")?"client_secret_post":t.includes("none")?"none":r?"client_secret_post":"none"}function vS(e,t,r,o){const{client_id:n,client_secret:i}=t;switch(e){case"client_secret_basic":FR(n,i,r);return;case"client_secret_post":VR(n,i,o);return;case"none":ZR(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function FR(e,t,r){if(!t)throw new Error("client_secret_basic authentication requires a client_secret");const o=btoa(`${e}:${t}`);r.set("Authorization",`Basic ${o}`)}function VR(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function ZR(e,t){t.set("client_id",e)}async function cm(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const o=TR.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:a}=o,s=CR[n]||ro;return new s({message:i||"",cause:a})}catch(o){const n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new ro({message:n})}}async function BR(e,{metadata:t,clientInformation:r,authorizationCode:o,codeVerifier:n,redirectUri:i,resource:a,addClientAuthentication:s,fetchFn:c}){var l;const u="authorization_code",d=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e);if(t?.grant_types_supported&&!t.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const f=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),m=new URLSearchParams({grant_type:u,code:o,code_verifier:n,redirect_uri:String(i)});if(s)s(f,m,e,t);else{const g=(l=t?.token_endpoint_auth_methods_supported)!=null?l:[],y=hS(r,g);vS(y,r,f,m)}a&&m.set("resource",a.href);const h=await(c??fetch)(d,{method:"POST",headers:f,body:m});if(!h.ok)throw await cm(h);return mS.parse(await h.json())}async function qR(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:a}){var s;const c="refresh_token";let l;if(t){if(l=new URL(t.token_endpoint),t.grant_types_supported&&!t.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else l=new URL("/token",e);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:o});if(i)i(u,d,e,t);else{const m=(s=t?.token_endpoint_auth_methods_supported)!=null?s:[],h=hS(r,m);vS(h,r,u,d)}n&&d.set("resource",n.href);const f=await(a??fetch)(l,{method:"POST",headers:u,body:d});if(!f.ok)throw await cm(f);return mS.parse({refresh_token:o,...await f.json()})}async function GR(e,{metadata:t,clientMetadata:r,fetchFn:o}){let n;if(t){if(!t.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");n=new URL(t.registration_endpoint)}else n=new URL("/register",e);const i=await(o??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!i.ok)throw await cm(i);return $R.parse(await i.json())}async function cs(e,t){var r,o;try{return await yl(e,t)}catch(n){if(n instanceof ns||n instanceof is)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await yl(e,t);if(n instanceof os)return await((o=e.invalidateCredentials)==null?void 0:o.call(e,"tokens")),await yl(e,t);throw n}}async function HR(e,t,r){const o=NR(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!RR({requestedResource:o,configuredResource:r.resource}))throw new Error(`Protected resource ${r.resource} does not match expected ${o} (or origin)`);return new URL(r.resource)}}async function yl(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:i}){let a,s;try{a=await zR(t,{resourceMetadataUrl:n},i),a.authorization_servers&&a.authorization_servers.length>0&&(s=a.authorization_servers[0])}catch{}s||(s=t);const c=await HR(t,e,a),l=await UR(s,{fetchFn:i});let u=await Promise.resolve(e.clientInformation());if(!u){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const g=await GR(s,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(g),u=g}if(r!==void 0){const g=await e.codeVerifier(),y=await BR(s,{metadata:l,clientInformation:u,authorizationCode:r,codeVerifier:g,redirectUri:e.redirectUrl,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(y),"AUTHORIZED"}const d=await e.tokens();if(d?.refresh_token)try{const g=await qR(s,{metadata:l,clientInformation:u,refreshToken:d.refresh_token,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof Bi)||g instanceof ro))throw g}const f=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:h}=await LR(s,{metadata:l,clientInformation:u,state:f,redirectUrl:e.redirectUrl,scope:o||e.clientMetadata.scope,resource:c});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(m),"REDIRECT"}var WR=class{constructor({url:e,headers:t,authProvider:r}){this.connected=!1,this.url=new URL(e),this.headers=t,this.authProvider=r}async commonHeaders(e){const t={...this.headers,...e,"mcp-protocol-version":mo};if(this.authProvider){const r=await this.authProvider.tokens();r?.access_token&&(t.Authorization=`Bearer ${r.access_token}`)}return rS(t,`ai-sdk/${fS}`,tS())}async start(){return new Promise((e,t)=>{if(this.connected)return e();this.abortController=new AbortController;const r=async(o=!1)=>{var n,i,a,s,c;try{const l=await this.commonHeaders({Accept:"text/event-stream"}),u=await fetch(this.url.href,{headers:l,signal:(n=this.abortController)==null?void 0:n.signal});if(u.status===401&&this.authProvider&&!o){this.resourceMetadataUrl=ss(u);try{if(await cs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const g=new as;return(i=this.onerror)==null||i.call(this,g),t(g)}}catch(h){return(a=this.onerror)==null||a.call(this,h),t(h)}return r(!0)}if(!u.ok||!u.body){let h=`MCP SSE Transport Error: ${u.status} ${u.statusText}`;u.status===405&&(h+=". This server does not support SSE transport. Try using `http` transport instead");const g=new we({message:h});return(s=this.onerror)==null||s.call(this,g),t(g)}const f=u.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader(),m=async()=>{var h,g,y;try{for(;;){const{done:b,value:w}=await f.read();if(b){if(this.connected)throw this.connected=!1,new we({message:"MCP SSE Transport Error: Connection closed unexpectedly"});return}const{event:x,data:v}=w;if(x==="endpoint"){if(this.endpoint=new URL(v,this.url),this.endpoint.origin!==this.url.origin)throw new we({message:`MCP SSE Transport Error: Endpoint origin does not match connection origin: ${this.endpoint.origin}`});this.connected=!0,e()}else if(x==="message")try{const k=Zo.parse(JSON.parse(v));(h=this.onmessage)==null||h.call(this,k)}catch(k){const E=new we({message:"MCP SSE Transport Error: Failed to parse message",cause:k});(g=this.onerror)==null||g.call(this,E)}}}catch(b){if(b instanceof Error&&b.name==="AbortError")return;(y=this.onerror)==null||y.call(this,b),t(b)}};this.sseConnection={close:()=>f.cancel()},m()}catch(l){if(l instanceof Error&&l.name==="AbortError")return;(c=this.onerror)==null||c.call(this,l),t(l)}};r()})}async close(){var e,t,r;this.connected=!1,(e=this.sseConnection)==null||e.close(),(t=this.abortController)==null||t.abort(),(r=this.onclose)==null||r.call(this)}async send(e){if(!this.endpoint||!this.connected)throw new we({message:"MCP SSE Transport Error: Not connected"});const t=this.endpoint,r=async(o=!1)=>{var n,i,a,s,c;try{const u={method:"POST",headers:await this.commonHeaders({"Content-Type":"application/json"}),body:JSON.stringify(e),signal:(n=this.abortController)==null?void 0:n.signal},d=await fetch(t,u);if(d.status===401&&this.authProvider&&!o){this.resourceMetadataUrl=ss(d);try{if(await cs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const m=new as;(i=this.onerror)==null||i.call(this,m);return}}catch(f){(a=this.onerror)==null||a.call(this,f);return}return r(!0)}if(!d.ok){const f=await d.text().catch(()=>null),m=new we({message:`MCP SSE Transport Error: POSTing to endpoint (HTTP ${d.status}): ${f}`});(s=this.onerror)==null||s.call(this,m);return}}catch(l){(c=this.onerror)==null||c.call(this,l);return}};await r()}},JR=class{constructor({url:e,headers:t,authProvider:r}){this.inboundReconnectAttempts=0,this.reconnectionOptions={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},this.url=new URL(e),this.headers=t,this.authProvider=r}async commonHeaders(e){const t={...this.headers,...e,"mcp-protocol-version":mo};if(this.sessionId&&(t["mcp-session-id"]=this.sessionId),this.authProvider){const r=await this.authProvider.tokens();r?.access_token&&(t.Authorization=`Bearer ${r.access_token}`)}return rS(t,`ai-sdk/${fS}`,tS())}async start(){if(this.abortController)throw new we({message:"MCP HTTP Transport Error: Transport already started. Note: client.connect() calls start() automatically."});this.abortController=new AbortController,this.openInboundSse()}async close(){var e,t,r;(e=this.inboundSseConnection)==null||e.close();try{if(this.sessionId&&this.abortController&&!this.abortController.signal.aborted){const o=await this.commonHeaders({});await fetch(this.url,{method:"DELETE",headers:o,signal:this.abortController.signal}).catch(()=>{})}}catch{}(t=this.abortController)==null||t.abort(),(r=this.onclose)==null||r.call(this)}async send(e){const t=async(r=!1)=>{var o,n,i,a,s,c,l;try{const d={method:"POST",headers:await this.commonHeaders({"Content-Type":"application/json",Accept:"application/json, text/event-stream"}),body:JSON.stringify(e),signal:(o=this.abortController)==null?void 0:o.signal},f=await fetch(this.url,d),m=f.headers.get("mcp-session-id");if(m&&(this.sessionId=m),f.status===401&&this.authProvider&&!r){this.resourceMetadataUrl=ss(f);try{if(await cs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED")throw new as}catch(y){throw(n=this.onerror)==null||n.call(this,y),y}return t(!0)}if(f.status===202){this.inboundSseConnection||this.openInboundSse();return}if(!f.ok){const y=await f.text().catch(()=>null);let b=`MCP HTTP Transport Error: POSTing to endpoint (HTTP ${f.status}): ${y}`;f.status===404&&(b+=". This server does not support HTTP transport. Try using `sse` transport instead");const w=new we({message:b});throw(i=this.onerror)==null||i.call(this,w),w}const h=f.headers.get("content-type")||"";if(h.includes("application/json")){const y=await f.json(),b=Array.isArray(y)?y.map(w=>Zo.parse(w)):[Zo.parse(y)];for(const w of b)(a=this.onmessage)==null||a.call(this,w);return}if(h.includes("text/event-stream")){if(!f.body){const x=new we({message:"MCP HTTP Transport Error: text/event-stream response without body"});throw(s=this.onerror)==null||s.call(this,x),x}const b=f.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader();(async()=>{var x,v,k;try{for(;;){const{done:E,value:I}=await b.read();if(E)return;const{event:A,data:M}=I;if(A==="message")try{const U=Zo.parse(JSON.parse(M));(x=this.onmessage)==null||x.call(this,U)}catch(U){const K=new we({message:"MCP HTTP Transport Error: Failed to parse message",cause:U});(v=this.onerror)==null||v.call(this,K)}}}catch(E){if(E instanceof Error&&E.name==="AbortError")return;(k=this.onerror)==null||k.call(this,E)}})();return}const g=new we({message:`MCP HTTP Transport Error: Unexpected content type: ${h}`});throw(c=this.onerror)==null||c.call(this,g),g}catch(u){throw(l=this.onerror)==null||l.call(this,u),u}};await t()}getNextReconnectionDelay(e){const{initialReconnectionDelay:t,reconnectionDelayGrowFactor:r,maxReconnectionDelay:o}=this.reconnectionOptions;return Math.min(t*Math.pow(r,e),o)}scheduleInboundSseReconnection(){var e;const{maxRetries:t}=this.reconnectionOptions;if(t>0&&this.inboundReconnectAttempts>=t){(e=this.onerror)==null||e.call(this,new we({message:`MCP HTTP Transport Error: Maximum reconnection attempts (${t}) exceeded.`}));return}const r=this.getNextReconnectionDelay(this.inboundReconnectAttempts);this.inboundReconnectAttempts+=1,setTimeout(async()=>{var o;(o=this.abortController)!=null&&o.signal.aborted||await this.openInboundSse(!1,this.lastInboundEventId)},r)}async openInboundSse(e=!1,t){var r,o,n,i,a,s;try{const c=await this.commonHeaders({Accept:"text/event-stream"});t&&(c["last-event-id"]=t);const l=await fetch(this.url.href,{method:"GET",headers:c,signal:(r=this.abortController)==null?void 0:r.signal}),u=l.headers.get("mcp-session-id");if(u&&(this.sessionId=u),l.status===401&&this.authProvider&&!e){this.resourceMetadataUrl=ss(l);try{if(await cs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const g=new as;(o=this.onerror)==null||o.call(this,g);return}}catch(h){(n=this.onerror)==null||n.call(this,h);return}return this.openInboundSse(!0,t)}if(l.status===405)return;if(!l.ok||!l.body){const h=new we({message:`MCP HTTP Transport Error: GET SSE failed: ${l.status} ${l.statusText}`});(i=this.onerror)==null||i.call(this,h);return}const f=l.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader(),m=async()=>{var h,g,y,b;try{for(;;){const{done:w,value:x}=await f.read();if(w)return;const{event:v,data:k,id:E}=x;if(E&&(this.lastInboundEventId=E),v==="message")try{const I=Zo.parse(JSON.parse(k));(h=this.onmessage)==null||h.call(this,I)}catch(I){const A=new we({message:"MCP HTTP Transport Error: Failed to parse message",cause:I});(g=this.onerror)==null||g.call(this,A)}}}catch(w){if(w instanceof Error&&w.name==="AbortError")return;(y=this.onerror)==null||y.call(this,w),(b=this.abortController)!=null&&b.signal.aborted||this.scheduleInboundSseReconnection()}};this.inboundSseConnection={close:()=>f.cancel()},this.inboundReconnectAttempts=0,m()}catch(c){if(c instanceof Error&&c.name==="AbortError")return;(a=this.onerror)==null||a.call(this,c),(s=this.abortController)!=null&&s.signal.aborted||this.scheduleInboundSseReconnection()}}};function KR(e){switch(e.type){case"sse":return new WR(e);case"http":return new JR(e);default:throw new we({message:"Unsupported or invalid transport configuration. If you are using a custom transport, make sure it implements the MCPTransport interface."})}}function YR(e){return"start"in e&&typeof e.start=="function"&&"send"in e&&typeof e.send=="function"&&"close"in e&&typeof e.close=="function"}var XR="1.0.0";async function QR(e){const t=new eP(e);return await t.init(),t}var eP=class{constructor({transport:e,name:t="ai-sdk-mcp-client",version:r=XR,onUncaughtError:o,capabilities:n}){this.requestMessageId=0,this.responseHandlers=new Map,this.serverCapabilities={},this.isClosed=!0,this.onUncaughtError=o,this.clientCapabilities=n??{},YR(e)?this.transport=e:this.transport=KR(e),this.transport.onclose=()=>this.onClose(),this.transport.onerror=i=>this.onError(i),this.transport.onmessage=i=>{if("method"in i){"id"in i?this.onRequestMessage(i):this.onError(new we({message:"Unsupported message type"}));return}this.onResponse(i)},this.clientInfo={name:t,version:r}}async init(){try{await this.transport.start(),this.isClosed=!1;const e=await this.request({request:{method:"initialize",params:{protocolVersion:mo,capabilities:this.clientCapabilities,clientInfo:this.clientInfo}},resultSchema:rR});if(e===void 0)throw new we({message:"Server sent invalid initialize result"});if(!QN.includes(e.protocolVersion))throw new we({message:`Server's protocol version is not supported: ${e.protocolVersion}`});return this.serverCapabilities=e.capabilities,await this.notification({method:"notifications/initialized"}),this}catch(e){throw await this.close(),e}}async close(){var e;this.isClosed||(await((e=this.transport)==null?void 0:e.close()),this.onClose())}assertCapability(e){switch(e){case"initialize":break;case"tools/list":case"tools/call":if(!this.serverCapabilities.tools)throw new we({message:"Server does not support tools"});break;case"resources/list":case"resources/read":case"resources/templates/list":if(!this.serverCapabilities.resources)throw new we({message:"Server does not support resources"});break;case"prompts/list":case"prompts/get":if(!this.serverCapabilities.prompts)throw new we({message:"Server does not support prompts"});break;default:throw new we({message:`Unsupported method: ${e}`})}}async request({request:e,resultSchema:t,options:r}){return new Promise((o,n)=>{if(this.isClosed)return n(new we({message:"Attempted to send a request from a closed client"}));this.assertCapability(e.method);const i=r?.signal;i?.throwIfAborted();const a=this.requestMessageId++,s={...e,jsonrpc:"2.0",id:a},c=()=>{this.responseHandlers.delete(a)};this.responseHandlers.set(a,l=>{if(i?.aborted)return n(new we({message:"Request was aborted",cause:i.reason}));if(l instanceof Error)return n(l);try{const u=t.parse(l.result);o(u)}catch(u){const d=new we({message:"Failed to parse server response",cause:u});n(d)}}),this.transport.send(s).catch(l=>{c(),n(l)})})}async listTools({params:e,options:t}={}){try{return this.request({request:{method:"tools/list",params:e},resultSchema:oR,options:t})}catch(r){throw r}}async callTool({name:e,args:t,options:r}){try{return this.request({request:{method:"tools/call",params:{name:e,arguments:t}},resultSchema:sR,options:{signal:r?.abortSignal}})}catch(o){throw o}}async listResourcesInternal({params:e,options:t}={}){try{return this.request({request:{method:"resources/list",params:e},resultSchema:aR,options:t})}catch(r){throw r}}async readResourceInternal({uri:e,options:t}){try{return this.request({request:{method:"resources/read",params:{uri:e}},resultSchema:uR,options:t})}catch(r){throw r}}async listResourceTemplatesInternal({options:e}={}){try{return this.request({request:{method:"resources/templates/list"},resultSchema:lR,options:e})}catch(t){throw t}}async listPromptsInternal({params:e,options:t}={}){try{return this.request({request:{method:"prompts/list",params:e},resultSchema:mR,options:t})}catch(r){throw r}}async getPromptInternal({name:e,args:t,options:r}){try{return this.request({request:{method:"prompts/get",params:{name:e,arguments:t}},resultSchema:gR,options:r})}catch(o){throw o}}async notification(e){const t={...e,jsonrpc:"2.0"};await this.transport.send(t)}async tools({schemas:e="automatic"}={}){var t;const r={};try{const o=await this.listTools();for(const{name:n,description:i,inputSchema:a}of o.tools){if(e!=="automatic"&&!(n in e))continue;const s=this,c=async(u,d)=>{var f;return(f=d?.abortSignal)==null||f.throwIfAborted(),s.callTool({name:n,args:u,options:d})},l=e==="automatic"?ZN({description:i,inputSchema:qN({...a,properties:(t=a.properties)!=null?t:{},additionalProperties:!1}),execute:c}):{description:i,inputSchema:e[n].inputSchema,execute:c};r[n]=l}return r}catch(o){throw o}}listResources({params:e,options:t}={}){return this.listResourcesInternal({params:e,options:t})}readResource({uri:e,options:t}){return this.readResourceInternal({uri:e,options:t})}listResourceTemplates({options:e}={}){return this.listResourceTemplatesInternal({options:e})}listPrompts({params:e,options:t}={}){return this.listPromptsInternal({params:e,options:t})}getPrompt({name:e,arguments:t,options:r}){return this.getPromptInternal({name:e,args:t,options:r})}onElicitationRequest(e,t){if(e!==ug)throw new we({message:"Unsupported request schema. Only ElicitationRequestSchema is supported."});this.elicitationRequestHandler=t}async onRequestMessage(e){try{if(e.method!=="elicitation/create"){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32601,message:`Unsupported request method: ${e.method}`}});return}if(!this.elicitationRequestHandler){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32601,message:"No elicitation handler registered on client"}});return}const t=ug.safeParse({method:e.method,params:e.params});if(!t.success){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Invalid elicitation request: ${t.error.message}`,data:t.error.issues}});return}try{const r=await this.elicitationRequestHandler(t.data),o=vR.parse(r);await this.transport.send({jsonrpc:"2.0",id:e.id,result:o})}catch(r){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32603,message:r instanceof Error?r.message:"Failed to handle elicitation request"}}),this.onError(r)}}catch(t){this.onError(t)}}onClose(){if(this.isClosed)return;this.isClosed=!0;const e=new we({message:"Connection closed"});for(const t of this.responseHandlers.values())t(e);this.responseHandlers.clear()}onError(e){this.onUncaughtError&&this.onUncaughtError(e)}onResponse(e){const t=Number(e.id),r=this.responseHandlers.get(t);if(r===void 0)throw new we({message:`Protocol error: Received a response for an unknown message ID: ${JSON.stringify(e)}`});this.responseHandlers.delete(t),r("result"in e?e:new we({message:e.error.message,code:e.error.code,data:e.error.data,cause:e.error}))}},qi=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},tP={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},rP=class{#e=tP;#t=!1;setTimeoutProvider(e){process.env.NODE_ENV!=="production"&&this.#t&&e!==this.#e&&console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.",{previous:this.#e,provider:e}),this.#e=e,process.env.NODE_ENV!=="production"&&(this.#t=!1)}setTimeout(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return process.env.NODE_ENV!=="production"&&(this.#t=!0),this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Yr=new rP;function nP(e){setTimeout(e,0)}var an=typeof window>"u"||"Deno"in globalThis;function ut(){}function oP(e,t){return typeof e=="function"?e(t):e}function Su(e){return typeof e=="number"&&e>=0&&e!==1/0}function yS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Or(e,t){return typeof e=="function"?e(t):e}function Tt(e,t){return typeof e=="function"?e(t):e}function pg(e,t){const{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:a,stale:s}=e;if(a){if(o){if(t.queryHash!==lm(a,t.options))return!1}else if(!ni(t.queryKey,a))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof s=="boolean"&&t.isStale()!==s||n&&n!==t.state.fetchStatus||i&&!i(t))}function gg(e,t){const{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(ri(t.options.mutationKey)!==ri(i))return!1}else if(!ni(t.options.mutationKey,i))return!1}return!(o&&t.state.status!==o||n&&!n(t))}function lm(e,t){return(t?.queryKeyHashFn||ri)(e)}function ri(e){return JSON.stringify(e,(t,r)=>Iu(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ni(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ni(e[r],t[r])):!1}var iP=Object.prototype.hasOwnProperty;function ku(e,t){if(e===t)return e;const r=hg(e)&&hg(t);if(!r&&!(Iu(e)&&Iu(t)))return t;const n=(r?e:Object.keys(e)).length,i=r?t:Object.keys(t),a=i.length,s=r?new Array(a):{};let c=0;for(let l=0;l<a;l++){const u=r?l:i[l],d=e[u],f=t[u];if(d===f){s[u]=d,(r?l<n:iP.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){s[u]=f;continue}const m=ku(d,f);s[u]=m,m===d&&c++}return n===a&&c===n?e:s}function Eu(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function hg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Iu(e){if(!vg(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!vg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vg(e){return Object.prototype.toString.call(e)==="[object Object]"}function aP(e){return new Promise(t=>{Yr.setTimeout(t,e)})}function Tu(e,t,r){if(typeof r.structuralSharing=="function")return r.structuralSharing(e,t);if(r.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return ku(e,t)}catch(o){throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`),o}return ku(e,t)}return t}function sP(e,t,r=0){const o=[...e,t];return r&&o.length>r?o.slice(1):o}function cP(e,t,r=0){const o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ls=Symbol();function bS(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===ls&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ls?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function lP(e,t){return typeof e=="function"?e(...t):!!e}var uP=class extends qi{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!an&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},um=new uP;function $u(){let e,t;const r=new Promise((n,i)=>{e=n,t=i});r.status="pending",r.catch(()=>{});function o(n){Object.assign(r,n),delete r.resolve,delete r.reject}return r.resolve=n=>{o({status:"fulfilled",value:n}),e(n)},r.reject=n=>{o({status:"rejected",reason:n}),t(n)},r}var dP=nP;function fP(){let e=[],t=0,r=s=>{s()},o=s=>{s()},n=dP;const i=s=>{t?e.push(s):n(()=>{r(s)})},a=()=>{const s=e;e=[],s.length&&n(()=>{o(()=>{s.forEach(c=>{r(c)})})})};return{batch:s=>{let c;t++;try{c=s()}finally{t--,t||a()}return c},batchCalls:s=>(...c)=>{i(()=>{s(...c)})},schedule:i,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{o=s},setScheduler:s=>{n=s}}}var We=fP(),mP=class extends qi{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!an&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#r=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},us=new mP;function pP(e){return Math.min(1e3*2**e,3e4)}function _S(e){return(e??"online")==="online"?us.isOnline():!0}var Ou=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function wS(e){let t=!1,r=0,o;const n=$u(),i=()=>n.status!=="pending",a=g=>{if(!i()){const y=new Ou(g);f(y),e.onCancel?.(y)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>um.isFocused()&&(e.networkMode==="always"||us.isOnline())&&e.canRun(),u=()=>_S(e.networkMode)&&e.canRun(),d=g=>{i()||(o?.(),n.resolve(g))},f=g=>{i()||(o?.(),n.reject(g))},m=()=>new Promise(g=>{o=y=>{(i()||l())&&g(y)},e.onPause?.()}).then(()=>{o=void 0,i()||e.onContinue?.()}),h=()=>{if(i())return;let g;const y=r===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(d).catch(b=>{if(i())return;const w=e.retry??(an?0:3),x=e.retryDelay??pP,v=typeof x=="function"?x(r,b):x,k=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,b);if(t||!k){f(b);return}r++,e.onFail?.(r,b),aP(v).then(()=>l()?void 0:m()).then(()=>{t?f(b):h()})})};return{promise:n,status:()=>n.status,cancel:a,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),n)}}var xS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Su(this.gcTime)&&(this.#e=Yr.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(an?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Yr.clearTimeout(this.#e),this.#e=void 0)}},gP=class extends xS{#e;#t;#r;#o;#n;#s;#a;constructor(e){super(),this.#a=!1,this.#s=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#o=e.client,this.#r=this.#o.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=bg(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(e){if(this.options={...this.#s,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=bg(this.options);t.data!==void 0&&(this.setState(yg(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=Tu(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(ut).catch(ut):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Tt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ls||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Or(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!yS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#n&&(this.#a?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(e&&this.setOptions(e),!this.options.queryFn){const s=this.observers.find(c=>c.options.queryFn);s&&this.setOptions(s.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=s=>{Object.defineProperty(s,"signal",{enumerable:!0,get:()=>(this.#a=!0,r.signal)})},n=()=>{const s=bS(this.options,t),l=(()=>{const u={client:this.#o,queryKey:this.queryKey,meta:this.meta};return o(u),u})();return this.#a=!1,this.options.persister?this.options.persister(s,l,this):s(l)},a=(()=>{const s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#o,state:this.state,fetchFn:n};return o(s),s})();this.options.behavior?.onFetch(a,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#i({type:"fetch",meta:a.fetchOptions?.meta}),this.#n=wS({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:s=>{s instanceof Ou&&s.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(s,c)=>{this.#i({type:"failed",failureCount:s,error:c})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const s=await this.#n.start();if(s===void 0)throw process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),new Error(`${this.queryHash} data is undefined`);return this.setData(s),this.#r.config.onSuccess?.(s,this),this.#r.config.onSettled?.(s,this.state.error,this),s}catch(s){if(s instanceof Ou){if(s.silent)return this.#n.promise;if(s.revert){if(this.state.data===void 0)throw s;return this.state.data}}throw this.#i({type:"error",error:s}),this.#r.config.onError?.(s,this),this.#r.config.onSettled?.(this.state.data,s,this),s}finally{this.scheduleGc()}}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...SS(r.data,this.options),fetchMeta:e.meta??null};case"success":const o={...r,...yg(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?o:void 0,o;case"error":const n=e.error;return{...r,error:n,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:n,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),We.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function SS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:_S(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yg(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bg(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,o=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?o??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var hP=class extends qi{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#a=$u(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#o=void 0;#n;#s;#a;#i;#g;#f;#m;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),_g(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Au(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Au(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#_(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tt(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#t.setOptions(this.options),t._defaulted&&!Eu(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&wg(this.#t,r,this.options,t)&&this.#d(),this.updateResult(),o&&(this.#t!==r||Tt(this.options.enabled,this.#t)!==Tt(t.enabled,this.#t)||Or(this.options.staleTime,this.#t)!==Or(t.staleTime,this.#t))&&this.#h();const n=this.#v();o&&(this.#t!==r||Tt(this.options.enabled,this.#t)!==Tt(t.enabled,this.#t)||n!==this.#c)&&this.#y(n)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return yP(this,r)&&(this.#o=r,this.#s=this.options,this.#n=this.#t.state),r}getCurrentResult(){return this.#o}trackResult(e,t){return new Proxy(e,{get:(r,o)=>(this.trackProp(o),t?.(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#o))}#d(e){this.#x();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ut)),t}#h(){this.#_();const e=Or(this.options.staleTime,this.#t);if(an||this.#o.isStale||!Su(e))return;const r=yS(this.#o.dataUpdatedAt,e)+1;this.#l=Yr.setTimeout(()=>{this.#o.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(an||Tt(this.options.enabled,this.#t)===!1||!Su(this.#c)||this.#c===0)&&(this.#u=Yr.setInterval(()=>{(this.options.refetchIntervalInBackground||um.isFocused())&&this.#d()},this.#c))}#b(){this.#h(),this.#y(this.#v())}#_(){this.#l&&(Yr.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(Yr.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,o=this.options,n=this.#o,i=this.#n,a=this.#s,c=e!==r?e.state:this.#r,{state:l}=e;let u={...l},d=!1,f;if(t._optimisticResults){const A=this.hasListeners(),M=!A&&_g(e,t),U=A&&wg(e,r,t,o);(M||U)&&(u={...u,...SS(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:m,errorUpdatedAt:h,status:g}=u;f=u.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&g==="pending"){let A;n?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(A=n.data,y=!0):A=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,A!==void 0&&(g="success",f=Tu(n?.data,A,t),d=!0)}if(t.select&&f!==void 0&&!y)if(n&&f===i?.data&&t.select===this.#g)f=this.#f;else try{this.#g=t.select,f=t.select(f),f=Tu(n?.data,f,t),this.#f=f,this.#i=null}catch(A){this.#i=A}this.#i&&(m=this.#i,f=this.#f,h=Date.now(),g="error");const b=u.fetchStatus==="fetching",w=g==="pending",x=g==="error",v=w&&b,k=f!==void 0,I={status:g,fetchStatus:u.fetchStatus,isPending:w,isSuccess:g==="success",isError:x,isInitialLoading:v,isLoading:v,data:f,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:x&&!k,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:x&&k,isStale:dm(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Tt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const A=K=>{I.status==="error"?K.reject(I.error):I.data!==void 0&&K.resolve(I.data)},M=()=>{const K=this.#a=I.promise=$u();A(K)},U=this.#a;switch(U.status){case"pending":e.queryHash===r.queryHash&&A(U);break;case"fulfilled":(I.status==="error"||I.data!==U.value)&&M();break;case"rejected":(I.status!=="error"||I.error!==U.reason)&&M();break}}return I}updateResult(){const e=this.#o,t=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#s=this.options,this.#n.data!==void 0&&(this.#m=this.#t),Eu(t,e))return;this.#o=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:o}=this.options,n=typeof o=="function"?o():o;if(n==="all"||!n&&!this.#p.size)return!0;const i=new Set(n??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#o).some(a=>{const s=a;return this.#o[s]!==e[s]&&i.has(s)})};this.#S({listeners:r()})}#x(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){We.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#o)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function vP(e,t){return Tt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _g(e,t){return vP(e,t)||e.state.data!==void 0&&Au(e,t,t.refetchOnMount)}function Au(e,t,r){if(Tt(t.enabled,e)!==!1&&Or(t.staleTime,e)!=="static"){const o=typeof r=="function"?r(e):r;return o==="always"||o!==!1&&dm(e,t)}return!1}function wg(e,t,r,o){return(e!==t||Tt(o.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&dm(e,r)}function dm(e,t){return Tt(t.enabled,e)!==!1&&e.isStaleByTime(Or(t.staleTime,e))}function yP(e,t){return!Eu(e.getCurrentResult(),t)}function xg(e){return{onFetch:(t,r)=>{const o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},c=0;const l=async()=>{let u=!1;const d=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=bS(t.options,t.fetchOptions),m=async(h,g,y)=>{if(u)return Promise.reject();if(g==null&&h.pages.length)return Promise.resolve(h);const w=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return d(E),E})(),x=await f(w),{maxPages:v}=t.options,k=y?cP:sP;return{pages:k(h.pages,x,v),pageParams:k(h.pageParams,g,v)}};if(n&&i.length){const h=n==="backward",g=h?bP:Sg,y={pages:i,pageParams:a},b=g(o,y);s=await m(y,b,h)}else{const h=e??i.length;do{const g=c===0?a[0]??o.initialPageParam:Sg(o,s);if(c>0&&g==null)break;s=await m(s,g),c++}while(c<h)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function Sg(e,{pages:t,pageParams:r}){const o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function bP(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var _P=class extends xS{#e;#t;#r;#o;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#r=e.mutationCache,this.#t=[],this.state=e.state||wP(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#o?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#o=wS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(i,a)=>{this.#n({type:"failed",failureCount:i,error:a})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const o=this.state.status==="pending",n=!this.#o.canStart();try{if(o)t();else{this.#n({type:"pending",variables:e,isPaused:n}),await this.#r.config.onMutate?.(e,this,r);const a=await this.options.onMutate?.(e,r);a!==this.state.context&&this.#n({type:"pending",context:a,variables:e,isPaused:n})}const i=await this.#o.start();return await this.#r.config.onSuccess?.(i,e,this.state.context,this,r),await this.options.onSuccess?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,e,this.state.context,r),this.#n({type:"success",data:i}),i}catch(i){try{throw await this.#r.config.onError?.(i,e,this.state.context,this,r),await this.options.onError?.(i,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,i,e,this.state.context,r),i}finally{this.#n({type:"error",error:i})}}finally{this.#r.runNext(this)}}#n(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),We.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function wP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var xP=class extends qi{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(e,t,r){const o=new _P({client:e,mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(o),o}add(e){this.#e.add(e);const t=ha(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=ha(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const o=r.indexOf(e);o!==-1&&r.splice(o,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=ha(e);if(typeof t=="string"){const o=this.#t.get(t)?.find(n=>n.state.status==="pending");return!o||o===e}else return!0}runNext(e){const t=ha(e);return typeof t=="string"?this.#t.get(t)?.find(o=>o!==e&&o.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){We.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>gg(t,r))}findAll(e={}){return this.getAll().filter(t=>gg(e,t))}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return We.batch(()=>Promise.all(e.map(t=>t.continue().catch(ut))))}};function ha(e){return e.options.scope?.id}var SP=class extends qi{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const o=t.queryKey,n=t.queryHash??lm(o,t);let i=this.get(n);return i||(i=new gP({client:e,queryKey:o,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){We.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>pg(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>pg(e,r)):t}notify(e){We.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){We.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){We.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},kP=class{#e;#t;#r;#o;#n;#s;#a;#i;constructor(e={}){this.#e=e.queryCache||new SP,this.#t=e.mutationCache||new xP,this.#r=e.defaultOptions||{},this.#o=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=um.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=us.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#e.build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Or(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const o=r.data;return[t,o]})}setQueryData(e,t,r){const o=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(o.queryHash)?.state.data,a=oP(t,i);if(a!==void 0)return this.#e.build(this,o).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return We.batch(()=>this.#e.findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;We.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return We.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},o=We.batch(()=>this.#e.findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(ut).catch(ut)}invalidateQueries(e,t={}){return We.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},o=We.batch(()=>this.#e.findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(ut)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(ut)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(Or(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ut).catch(ut)}fetchInfiniteQuery(e){return e.behavior=xg(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ut).catch(ut)}ensureInfiniteQueryData(e){return e.behavior=xg(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return us.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#o.set(ri(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#o.values()],r={};return t.forEach(o=>{ni(e,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(ri(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(o=>{ni(e,o.mutationKey)&&Object.assign(r,o.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=lm(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===ls&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},kS=_.createContext(void 0),ES=e=>{const t=_.useContext(kS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},EP=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(kS.Provider,{value:e,children:t})),IS=_.createContext(!1),IP=()=>_.useContext(IS);IS.Provider;function TP(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $P=_.createContext(TP()),OP=()=>_.useContext($P),AP=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},CP=e=>{_.useEffect(()=>{e.clearReset()},[e])},NP=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||lP(r,[e.error,o])),RP=e=>{if(e.suspense){const r=n=>n==="static"?n:Math.max(n??1e3,1e3),o=e.staleTime;e.staleTime=typeof o=="function"?(...n)=>r(o(...n)):r(o),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},PP=(e,t)=>e.isLoading&&e.isFetching&&!t,jP=(e,t)=>e?.suspense&&t.isPending,kg=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function DP(e,t,r){if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const o=IP(),n=OP(),i=ES(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),process.env.NODE_ENV!=="production"&&(a.queryFn||console.error(`[${a.queryHash}]: No queryFn was passed as an option, and no default queryFn was found. The queryFn parameter is only optional when using a default queryFn. More info here: https://tanstack.com/query/latest/docs/framework/react/guides/default-query-function`)),a._optimisticResults=o?"isRestoring":"optimistic",RP(a),AP(a,n),CP(n);const s=!i.getQueryCache().get(a.queryHash),[c]=_.useState(()=>new t(i,a)),l=c.getOptimisticResult(a),u=!o&&e.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(d=>{const f=u?c.subscribe(We.batchCalls(d)):ut;return c.updateResult(),f},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),_.useEffect(()=>{c.setOptions(a)},[a,c]),jP(a,l))throw kg(a,c,n);if(NP({result:l,errorResetBoundary:n,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw l.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!an&&PP(l,o)&&(s?kg(a,c,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ut).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?l:c.trackResult(l)}function TS(e,t){return DP(e,hP)}function zP({auth:e,mcp:t,environment:r,gramEnvironment:o}){const n=Object.entries(e.headers??{}).map((a,s)=>`${a}:${s}`);return TS({queryKey:["mcpTools",t,o,...n],queryFn:async()=>($.assert(!e.isLoading,"No auth found"),$.assert(t,"No MCP URL found"),await(await QR({name:"gram-elements-mcp-client",transport:{type:"http",url:t,headers:{...MP(r??{}),...e.headers,...o&&{"Gram-Environment":o}}}})).tools()),enabled:!e.isLoading&&!!t,staleTime:1/0,gcTime:1/0})}const Eg="MCP-";function MP(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,o])=>{const n=r.replace(/_/g,"-"),i=n.startsWith(Eg)?n:`${Eg}${n}`;return t[i]=o,t},{})}const $S=()=>{const e=N.useContext($.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function UP(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const Oc={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},ur=console,jn={};Object.keys(Oc).forEach(e=>{jn[e]=ur[e]});const Ro="Datadog Browser SDK:",Q={debug:jn.debug.bind(ur,Ro),log:jn.log.bind(ur,Ro),info:jn.info.bind(ur,Ro),warn:jn.warn.bind(ur,Ro),error:jn.error.bind(ur,Ro)},Ac="https://docs.datadoghq.com",LP=`${Ac}/real_user_monitoring/browser/troubleshooting`,fm="More details:";function OS(e,t){return(...r)=>{try{return e(...r)}catch(o){Q.error(t,o)}}}function Xr(e){return e!==0&&Math.random()*100<=e}function Bo(e,t){return+e.toFixed(t)}function FP(e){return Gi(e)&&e>=0&&e<=100}function Gi(e){return typeof e=="number"}function oi(e){return{...e}}function ds(e,t){return Object.keys(e).some(r=>e[r]===t)}function Vr(e){return Object.keys(e).length===0}function AS(e,t){const r={};for(const o of Object.keys(e))r[o]=t(e[o]);return r}function It(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}const or=It(),Cc="WorkerGlobalScope"in or;function jr(e,t){const r=It();let o;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(o=e[r.Zone.__symbol__(t)]),o||(o=e[t]),o}let Cu,CS=!1;function VP(e){Cu=e}function ZP(e){CS=e}function ne(e){return function(){return Ar(e,this,arguments)}}function Ar(e,t,r){try{return e.apply(t,r)}catch(o){pr(o)}}function pr(e){if(Nu(e),Cu)try{Cu(e)}catch(t){Nu(t)}}function Nu(...e){CS&&Q.error("[MONITOR]",...e)}function Je(e,t){return jr(It(),"setTimeout")(ne(e),t)}function vt(e){jr(It(),"clearTimeout")(e)}function po(e,t){return jr(It(),"setInterval")(ne(e),t)}function Nc(e){jr(It(),"clearInterval")(e)}function Ig(e){var t;const r=(t=or.queueMicrotask)===null||t===void 0?void 0:t.bind(or);typeof r=="function"?r(ne(e)):Promise.resolve().then(ne(e))}class ge{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.addObserver(t),{unsubscribe:()=>this.removeObserver(t)}}notify(t){this.observers.forEach(r=>r(t))}addObserver(t){this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0)}removeObserver(t){this.observers=this.observers.filter(r=>t!==r),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}function NS(...e){return new ge(t=>{const r=e.map(o=>o.subscribe(n=>t.notify(n)));return()=>r.forEach(o=>o.unsubscribe())})}class RS extends ge{constructor(t){super(),this.maxBufferSize=t,this.buffer=[]}notify(t){this.buffer.push(t),this.buffer.length>this.maxBufferSize&&this.buffer.shift(),super.notify(t)}subscribe(t){let r=!1;const o={unsubscribe:()=>{r=!0,this.removeObserver(t)}};return Ig(()=>{for(const n of this.buffer){if(r)return;t(n)}r||this.addObserver(t)}),o}unbuffer(){Ig(()=>{this.maxBufferSize=this.buffer.length=0})}}const Ke=1e3,lt=60*Ke,PS=60*lt,BP=24*PS,jS=365*BP;function Hi(e){return{relative:e,timeStamp:GP(e)}}function qP(e){return{relative:pm(e),timeStamp:e}}function GP(e){const t=ct()-performance.now();return t>Wi()?Math.round(go(t,e)):HP(e)}function DS(){return Math.round(ct()-go(Wi(),performance.now()))}function oe(e){return Gi(e)?Bo(e*1e6,0):e}function ct(){return new Date().getTime()}function Be(){return ct()}function _t(){return performance.now()}function Ue(){return{relative:_t(),timeStamp:Be()}}function mm(){return{relative:0,timeStamp:Wi()}}function Ne(e,t){return t-e}function go(e,t){return e+t}function pm(e){return e-Wi()}function HP(e){return Math.round(go(Wi(),e))}function WP(e){return e<jS}let bl;function Wi(){var e,t;return bl===void 0&&(bl=(t=(e=performance.timing)===null||e===void 0?void 0:e.navigationStart)!==null&&t!==void 0?t:performance.timeOrigin),bl}function Ji(e,t,r){const o=r&&r.leading!==void 0?r.leading:!0,n=r&&r.trailing!==void 0?r.trailing:!0;let i=!1,a,s;return{throttled:(...c)=>{if(i){a=c;return}o?e(...c):a=c,i=!0,s=Je(()=>{n&&a&&e(...a),i=!1,a=void 0},t)},cancel:()=>{vt(s),i=!1,a=void 0}}}function _e(){}function et(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,et)}const no=/([\w-]+)\s*=\s*([^;]+)/g;function ii(e,t){for(no.lastIndex=0;;){const r=no.exec(e);if(r){if(r[1]===t)return r[2]}else break}}function JP(e){const t=new Map;for(no.lastIndex=0;;){const r=no.exec(e);if(r){const o=r[1],n=r[2];t.has(o)?t.get(o).push(n):t.set(o,[n])}else break}return t}function KP(e){const t=new Map;for(no.lastIndex=0;;){const r=no.exec(e);if(r)t.set(r[1],r[2]);else break}return t}function gm(e,t,r=""){const o=e.charCodeAt(t-1),i=o>=55296&&o<=56319?t+1:t;return e.length<=i?e:`${e.slice(0,i)}${r}`}function YP(){return zS()===0}function XP(){return zS()===1}let va;function zS(){return va??(va=QP())}function QP(e=window){var t;const r=e.navigator.userAgent;return e.chrome||/HeadlessChrome/.test(r)?0:((t=e.navigator.vendor)===null||t===void 0?void 0:t.indexOf("Apple"))===0||/safari/i.test(r)&&!/chrome|android/i.test(r)?1:2}function hm(e){return Ki(e,location.href).href}function ej(e){try{return!!Ki(e)}catch{return!1}}function tj(e){const t=Ki(e).pathname;return t[0]==="/"?t:`/${t}`}function Ki(e,t){const{URL:r}=rj();try{return t!==void 0?new r(e,t):new r(e)}catch(o){throw new Error(`Failed to construct URL: ${String(o)}`)}}let _l;function rj(){if(!_l){let e,t;try{e=document.createElement("iframe"),e.style.display="none",document.body.appendChild(e),t=e.contentWindow}catch{t=or}_l={URL:t.URL},e?.remove()}return _l}function Rc(e,t,r=0,o){const n=new Date;n.setTime(n.getTime()+r);const i=`expires=${n.toUTCString()}`,a=o&&o.crossSite?"none":"strict",s=o&&o.domain?`;domain=${o.domain}`:"",c=o&&o.secure?";secure":"",l=o&&o.partitioned?";partitioned":"";document.cookie=`${e}=${t};${i};path=/;samesite=${a}${s}${c}${l}`}function Pc(e){return ii(document.cookie,e)}function nj(e){return JP(document.cookie).get(e)||[]}let wl;function Tr(e){return wl||(wl=KP(document.cookie)),wl.get(e)}function MS(e,t){Rc(e,"",0,t)}function oj(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${et()}`,r="test";Rc(t,r,lt,e);const o=Pc(t)===r;return MS(t,e),o}catch(t){return Q.error(t),!1}}let xl;function US(e=location.hostname,t=document.referrer){if(xl===void 0){const r=ij(e,t);if(r){const o=`dd_site_test_${et()}`,n="test",i=r.split(".");let a=i.pop();for(;i.length&&!Pc(o);)a=`${i.pop()}.${a}`,Rc(o,n,Ke,{domain:a});MS(o,{domain:a}),xl=a}}return xl}function ij(e,t){try{return e||Ki(t).hostname}catch{}}const gr="_dd_s";function LS(e,t){for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(t(o,r,e))return o}}function FS(e){return Object.values(e)}function jc(e){return Object.entries(e)}const vn=4*PS,VS=15*lt,aj=jS,ZS="0",oo={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},BS=/^([a-zA-Z]+)=([a-z0-9-]+)$/,vm="&";function sj(e){return!!e&&(e.indexOf(vm)!==-1||BS.test(e))}const cj="1";function Gr(e,t){const r={isExpired:cj};return t.trackAnonymousUser&&e?.anonymousId&&(r.anonymousId=e?.anonymousId),r}function ja(e){return Vr(e)}function qS(e){return!ja(e)}function qo(e){return e.isExpired!==void 0||!lj(e)}function lj(e){return(e.created===void 0||ct()-Number(e.created)<vn)&&(e.expire===void 0||ct()<Number(e.expire))}function GS(e){e.expire=String(ct()+VS)}function Ru(e){return jc(e).map(([t,r])=>t==="anonymousId"?`aid=${r}`:`${t}=${r}`).join(vm)}function Dc(e){const t={};return sj(e)&&e.split(vm).forEach(r=>{const o=BS.exec(r);if(o!==null){const[,n,i]=o;n==="aid"?t.anonymousId=i:t[n]=i}}),t}const uj="_dd",dj="_dd_r",fj="_dd_l",mj="rum",pj="logs";function gj(e){if(!Tr(gr)){const r=Tr(uj),o=Tr(dj),n=Tr(fj),i={};r&&(i.id=r),n&&/^[01]$/.test(n)&&(i[pj]=n),o&&/^[012]$/.test(o)&&(i[mj]=o),qS(i)&&(GS(i),e.persistSession(i))}}const hj=0;function Tg(e){const t=yj(e);return t&&oj(t)?{type:oo.COOKIE,cookieOptions:t}:void 0}function vj(e,t){const r={isLockEnabled:YP(),persistSession:o=>$g(t,e,o,VS),retrieveSession:()=>HS(t,e),expireSession:o=>$g(t,e,Gr(o,e),vn)};return gj(r),r}function $g(e,t,r,o){let n=Ru(r);t.betaEncodeCookieOptions&&(n=Ru({...r,...Vr(r)?{}:{c:WS(e)}})),Rc(gr,n,t.trackAnonymousUser?aj:o,e)}function HS(e,t){if(t.betaEncodeCookieOptions)return bj(e);const r=Pc(gr);return Dc(r)}function yj(e){const t={};if(t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains){const r=US();if(!r)return;t.domain=r}return t}function WS(e){const t=e.domain?e.domain.split(".").length-1:0;let r=0;return r|=hj<<5,r|=t<<1,r|=e.crossSite?1:0,r.toString(16)}function bj(e){const t=nj(gr),r=WS(e);let o;for(const n of t.reverse())if(o=Dc(n),o.c===r)break;return o==null||delete o.c,o??{}}const _j="_dd_test_";function Og(){try{const e=et(),t=`${_j}${e}`;localStorage.setItem(t,e);const r=localStorage.getItem(t);return localStorage.removeItem(t),e===r?{type:oo.LOCAL_STORAGE}:void 0}catch{return}}function wj(e){return{isLockEnabled:!1,persistSession:JS,retrieveSession:KS,expireSession:t=>xj(t,e)}}function JS(e){localStorage.setItem(gr,Ru(e))}function KS(){const e=localStorage.getItem(gr);return Dc(e)}function xj(e,t){JS(Gr(e,t))}const Sj=10,kj=100,Ej=Ke,YS="--",XS=[];let Da;function Hr(e,t,r=0){var o;const{isLockEnabled:n,persistSession:i,expireSession:a}=t,s=f=>i({...f,lock:l}),c=()=>{const{lock:f,...m}=t.retrieveSession();return{session:m,lock:f&&!Tj(f)?f:void 0}};if(Da||(Da=e),e!==Da){XS.push(e);return}if(n&&r>=kj){Ag(t);return}let l,u=c();if(n){if(u.lock){ya(e,t,r);return}if(l=Ij(),s(u.session),u=c(),u.lock!==l){ya(e,t,r);return}}let d=e.process(u.session);if(n&&(u=c(),u.lock!==l)){ya(e,t,r);return}if(d&&(qo(d)?a(d):(GS(d),n?s(d):i(d))),n&&!(d&&qo(d))){if(u=c(),u.lock!==l){ya(e,t,r);return}i(u.session),d=u.session}(o=e.after)===null||o===void 0||o.call(e,d||u.session),Ag(t)}function ya(e,t,r){Je(()=>{Hr(e,t,r+1)},Sj)}function Ag(e){Da=void 0;const t=XS.shift();t&&Hr(t,e)}function Ij(){return et()+YS+Be()}function Tj(e){const[,t]=e.split(YS);return!t||Ne(Number(t),Be())>Ej}const Cg=Ke;function $j(e){switch(e.sessionPersistence){case oo.COOKIE:return Tg(e);case oo.LOCAL_STORAGE:return Og();case void 0:{let t=Tg(e);return!t&&e.allowFallbackToLocalStorage&&(t=Og()),t}default:Q.error(`Invalid session persistence '${String(e.sessionPersistence)}'`)}}function Oj(e,t){return e.type===oo.COOKIE?vj(t,e.cookieOptions):wj(t)}function Aj(e,t,r,o,n=Oj(e,t)){const i=new ge,a=new ge,s=new ge,c=po(m,Cg);let l;g();const{throttled:u,cancel:d}=Ji(()=>{Hr({process:E=>{if(ja(E))return;const I=h(E);return y(I),I},after:E=>{qS(E)&&!b()&&v(E),l=E}},n)},Cg);function f(){Hr({process:E=>b()?h(E):void 0},n)}function m(){const E=n.retrieveSession();qo(E)?Hr({process:I=>qo(I)?Gr(I,t):void 0,after:h},n):h(E)}function h(E){return qo(E)&&(E=Gr(E,t)),b()&&(w(E)?x():(s.notify({previousState:l,newState:E}),l=E)),E}function g(){Hr({process:E=>{if(ja(E))return E.anonymousId=et(),Gr(E,t)},after:E=>{l=E}},n)}function y(E){if(ja(E))return!1;const I=o(E[r]);E[r]=I,delete E.isExpired,I!==ZS&&!E.id&&(E.id=et(),E.created=String(ct()))}function b(){return l?.[r]!==void 0}function w(E){return l.id!==E.id||l[r]!==E[r]}function x(){l=Gr(l,t),a.notify()}function v(E){l=E,i.notify()}function k(E){Hr({process:I=>({...I,...E}),after:h},n)}return{expandOrRenewSession:u,expandSession:f,getSession:()=>l,renewObservable:i,expireObservable:a,sessionStateUpdateObservable:s,restartSession:g,expire:E=>{d(),E===!1&&l&&delete l.anonymousId,n.expireSession(l),h(Gr(l,t))},stop:()=>{Nc(c)},updateSessionState:k}}const Pu={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Cj(e){const t=new ge;return{tryToInit(r){e||(e=r)},update(r){e=r,t.notify()},isGranted(){return e===Pu.GRANTED},observable:t}}function yn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function ai(e){const t=yn(e);return t==="string"||t==="function"||e instanceof RegExp}function zc(e,t,r=!1){return e.some(o=>{try{if(typeof o=="function")return o(t);if(o instanceof RegExp)return o.test(t);if(typeof o=="string")return r?t.startsWith(o):o===t}catch(n){Q.error(n)}return!1})}const Nj=["chrome-extension://","moz-extension://"];function Ng(e){return Nj.some(t=>e.includes(t))}function Rj(e,t=""){if(Ng(e))return!1;const o=t.split(`
|
|
30
|
+
`).filter(n=>{const i=n.trim();return i.length&&/^at\s+|@/.test(i)})[1]||"";return Ng(o)}const Pj="Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.",jj="SDK initialized on a non-allowed domain.";function Dj(e,t,r=typeof location<"u"?location.origin:""){const o=e.allowedTrackingOrigins;if(!o)return Rj(r,t)?(Q.error(Pj),!1):!0;const n=zc(o,r);return n||Q.error(jj),n}const QS="datad0g.com",zj="dd0g-gov.com",Qr="datadoghq.com",Mj="datadoghq.eu",Uj="ddog-gov.com",Lj="pci.browser-intake-datadoghq.com",Fj=["ddsource","dd-api-key","dd-request-id"];function Wr(e,t,r){const o=Vj(e,t);return{build(n,i){const a=Zj(e,t,n,i,r);return o(a)},trackType:t}}function Vj(e,t){const r=`/api/v2/${t}`,o=e.proxy;if(typeof o=="string"){const i=hm(o);return a=>`${i}?ddforward=${encodeURIComponent(`${r}?${a}`)}`}if(typeof o=="function")return i=>o({path:r,parameters:i});const n=ek(t,e);return i=>`https://${n}${r}?${i}`}function ek(e,t){const{site:r=Qr,internalAnalyticsSubdomain:o}=t;if(e==="logs"&&t.usePciIntake&&r===Qr)return Lj;if(o&&r===Qr)return`${o}.${Qr}`;if(r===zj)return`http-intake.logs.${r}`;const n=r.split("."),i=n.pop();return`browser-intake-${n.join("-")}.${i}`}function Zj({clientToken:e,internalAnalyticsSubdomain:t,source:r="browser"},o,n,{retry:i,encoding:a},s=[]){const c=[`ddsource=${r}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.24.1")}`,"dd-evp-origin=browser",`dd-request-id=${et()}`].concat(s);return a&&c.push(`dd-evp-encoding=${a}`),o==="rum"&&(c.push(`batch_time=${Be()}`,`_dd.api=${n}`),i&&c.push(`_dd.retry_count=${i.count}`,`_dd.retry_after=${i.lastFailureStatus}`)),t&&c.reverse(),c.join("&")}function Bj(e){const t=e.site||Qr,r=qj(e.source),o=Gj({...e,site:t,source:r});return{replica:Hj({...e,site:t,source:r}),site:t,source:r,...o}}function qj(e){return e==="flutter"||e==="unity"?e:"browser"}function Gj(e){return{logsEndpointBuilder:Wr(e,"logs"),rumEndpointBuilder:Wr(e,"rum"),profilingEndpointBuilder:Wr(e,"profile"),sessionReplayEndpointBuilder:Wr(e,"replay"),exposuresEndpointBuilder:Wr(e,"exposures")}}function Hj(e){if(!e.replica)return;const t={...e,site:Qr,clientToken:e.replica.clientToken};return{logsEndpointBuilder:Wr(t,"logs"),rumEndpointBuilder:Wr(t,"rum",[`application.id=${e.replica.applicationId}`])}}function Wj(e){return Fj.every(t=>e.includes(t))}const Dn={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input",MASK_UNLESS_ALLOWLISTED:"mask-unless-allowlisted"},ju={ALL:"all",SAMPLED:"sampled"};function Sl(e,t){return e!=null&&typeof e!="string"?(Q.error(`${t} must be defined as a string`),!1):!0}function Jj(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(Q.error(`Site should be a valid Datadog site. ${fm} ${Ac}/getting_started/site/.`),!1):!0}function zn(e,t){return e!==void 0&&!FP(e)?(Q.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function Kj(e,t){var r,o,n,i,a,s,c,l,u,d;if(!e||!e.clientToken){Q.error("Client Token is not configured, we will not send any data.");return}if(e.allowedTrackingOrigins!==void 0&&!Array.isArray(e.allowedTrackingOrigins)){Q.error("Allowed Tracking Origins must be an array");return}if(!(!Jj(e.site)||!zn(e.sessionSampleRate,"Session")||!zn(e.telemetrySampleRate,"Telemetry")||!zn(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!zn(e.telemetryUsageSampleRate,"Telemetry Usage")||!Sl(e.version,"Version")||!Sl(e.env,"Env")||!Sl(e.service,"Service")||!Dj(e,t??""))){if(e.trackingConsent!==void 0&&!ds(Pu,e.trackingConsent)){Q.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:e.beforeSend&&OS(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Cc?void 0:$j(e),sessionSampleRate:(r=e.sessionSampleRate)!==null&&r!==void 0?r:100,telemetrySampleRate:(o=e.telemetrySampleRate)!==null&&o!==void 0?o:20,telemetryConfigurationSampleRate:(n=e.telemetryConfigurationSampleRate)!==null&&n!==void 0?n:5,telemetryUsageSampleRate:(i=e.telemetryUsageSampleRate)!==null&&i!==void 0?i:5,service:(a=e.service)!==null&&a!==void 0?a:void 0,env:(s=e.env)!==null&&s!==void 0?s:void 0,version:(c=e.version)!==null&&c!==void 0?c:void 0,datacenter:(l=e.datacenter)!==null&&l!==void 0?l:void 0,silentMultipleInit:!!e.silentMultipleInit,allowUntrustedEvents:!!e.allowUntrustedEvents,trackingConsent:(u=e.trackingConsent)!==null&&u!==void 0?u:Pu.GRANTED,trackAnonymousUser:(d=e.trackAnonymousUser)!==null&&d!==void 0?d:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,betaEncodeCookieOptions:!!e.betaEncodeCookieOptions,variant:e.variant,sdkVersion:e.sdkVersion,...Bj(e)}}}function Yj(e){return{session_sample_rate:e.sessionSampleRate,telemetry_sample_rate:e.telemetrySampleRate,telemetry_configuration_sample_rate:e.telemetryConfigurationSampleRate,telemetry_usage_sample_rate:e.telemetryUsageSampleRate,use_before_send:!!e.beforeSend,use_partitioned_cross_site_session_cookie:e.usePartitionedCrossSiteSessionCookie,use_secure_session_cookie:e.useSecureSessionCookie,use_proxy:!!e.proxy,silent_multiple_init:e.silentMultipleInit,track_session_across_subdomains:e.trackSessionAcrossSubdomains,track_anonymous_user:e.trackAnonymousUser,session_persistence:e.sessionPersistence,allow_fallback_to_local_storage:!!e.allowFallbackToLocalStorage,store_contexts_across_pages:!!e.storeContextsAcrossPages,allow_untrusted_events:!!e.allowUntrustedEvents,tracking_consent:e.trackingConsent,use_allowed_tracking_origins:Array.isArray(e.allowedTrackingOrigins),beta_encode_cookie_options:e.betaEncodeCookieOptions,source:e.source,sdk_version:e.sdkVersion,variant:e.variant}}var Dr;(function(e){e.TRACK_INTAKE_REQUESTS="track_intake_requests",e.USE_TREE_WALKER_FOR_ACTION_NAME="use_tree_walker_for_action_name",e.FEATURE_OPERATION_VITAL="feature_operation_vital",e.SHORT_SESSION_INVESTIGATION="short_session_investigation",e.AVOID_FETCH_KEEPALIVE="avoid_fetch_keepalive"})(Dr||(Dr={}));const ym=new Set;function Xj(e){Array.isArray(e)&&Qj(e.filter(t=>ds(Dr,t)))}function Qj(e){e.forEach(t=>{ym.add(t)})}function Yi(e){return ym.has(e)}function e2(){return ym}const io="?";function Xi(e){var t,r;const o=[];let n=kl(e,"stack");const i=String(e);if(n&&n.startsWith(i)&&(n=n.slice(i.length)),n&&n.split(`
|
|
31
|
+
`).forEach(a=>{const s=n2(a)||i2(a)||s2(a)||u2(a);s&&(!s.func&&s.line&&(s.func=io),o.push(s))}),o.length>0&&p2()&&e instanceof Error){const a=[];let s=e;for(;(s=Object.getPrototypeOf(s))&&rk(s);){const c=((t=s.constructor)===null||t===void 0?void 0:t.name)||io;a.push(c)}for(let c=a.length-1;c>=0&&((r=o[0])===null||r===void 0?void 0:r.func)===a[c];c--)o.shift()}return{message:kl(e,"message"),name:kl(e,"name"),stack:o}}const tk="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",ao="(?::(\\d+))",t2=new RegExp(`^\\s*at (.*?) ?\\(${tk}${ao}?${ao}?\\)?\\s*$`,"i"),r2=new RegExp(`\\((\\S*)${ao}${ao}\\)`);function n2(e){const t=t2.exec(e);if(!t)return;const r=t[2]&&t[2].indexOf("native")===0,o=t[2]&&t[2].indexOf("eval")===0,n=r2.exec(t[2]);return o&&n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3]),{args:r?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||io,line:t[3]?+t[3]:void 0,url:r?void 0:t[2]}}const o2=new RegExp(`^\\s*at ?${tk}${ao}?${ao}??\\s*$`,"i");function i2(e){const t=o2.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:io,line:t[2]?+t[2]:void 0,url:t[1]}}const a2=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function s2(e){const t=a2.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||io,line:+t[3],url:t[2]}}const c2=/^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i,l2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function u2(e){const t=c2.exec(e);if(!t)return;const r=t[3]&&t[3].indexOf(" > eval")>-1,o=l2.exec(t[3]);return r&&o&&(t[3]=o[1],t[4]=o[2],t[5]=void 0),{args:t[2]?t[2].split(","):[],column:t[5]?+t[5]:void 0,func:t[1]||io,line:t[4]?+t[4]:void 0,url:t[3]}}function kl(e,t){if(typeof e!="object"||!e||!(t in e))return;const r=e[t];return typeof r=="string"?r:void 0}function d2(e,t,r,o){if(t===void 0)return;const{name:n,message:i}=m2(e);return{name:n,message:i,stack:[{url:t,column:o,line:r}]}}const f2=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function m2(e){let t,r;return{}.toString.call(e)==="[object String]"&&([,t,r]=f2.exec(e)),{name:t,message:r}}function rk(e){return String(e.constructor).startsWith("class ")}let ba;function p2(){if(ba!==void 0)return ba;class e extends Error{constructor(){super(),this.name="Error"}}const[t,r]=[e,Error].map(o=>new o);return ba=rk(Object.getPrototypeOf(t))&&r.stack!==t.stack,ba}function fs(e){const r=new Error(e);r.name="HandlingStack";let o;return Ar(()=>{const n=Xi(r);n.stack=n.stack.slice(2),o=Qi(n)}),o}function Qi(e){let t=nk(e);return e.stack.forEach(r=>{const o=r.func==="?"?"<anonymous>":r.func,n=r.args&&r.args.length>0?`(${r.args.join(", ")})`:"",i=r.line?`:${r.line}`:"",a=r.line&&r.column?`:${r.column}`:"";t+=`
|
|
32
|
+
at ${o}${n} @ ${r.url}${i}${a}`}),t}function nk(e){return`${e.name||"Error"}: ${e.message}`}function Bt(e,t,r,{computeHandlingStack:o}={}){let n=e[t];if(typeof n!="function")if(t in e&&t.startsWith("on"))n=_e;else return{stop:_e};let i=!1;const a=function(){if(i)return n.apply(this,arguments);const s=Array.from(arguments);let c;Ar(r,null,[{target:this,parameters:s,onPostCall:u=>{c=u},handlingStack:o?fs("instrumented method"):void 0}]);const l=n.apply(this,s);return c&&Ar(c,null,[l]),l};return e[t]=a,{stop:()=>{i=!0,e[t]===a&&(e[t]=n)}}}function g2(e,t,r){const o=Object.getOwnPropertyDescriptor(e,t);if(!o||!o.set||!o.configurable)return{stop:_e};const n=_e;let i=(s,c)=>{Je(()=>{i!==n&&r(s,c)},0)};const a=function(s){o.set.call(this,s),i(this,s)};return Object.defineProperty(e,t,{set:a}),{stop:()=>{var s;((s=Object.getOwnPropertyDescriptor(e,t))===null||s===void 0?void 0:s.set)===a&&Object.defineProperty(e,t,o),i=n}}}const bn=1024,ok=1024*bn,h2=/[^\u0000-\u007F]/;function ik(e){return h2.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function ak(e){if(e.length===1)return e[0];const t=e.reduce((n,i)=>n+i.length,0),r=new Uint8Array(t);let o=0;for(const n of e)r.set(n,o),o+=n.length;return r}function ho(e,t,r){if(typeof e!="object"||e===null)return JSON.stringify(e);const o=Mn(Object.prototype),n=Mn(Array.prototype),i=Mn(Object.getPrototypeOf(e)),a=Mn(e);try{return JSON.stringify(e,t,r)}catch{return"<error: unable to serialize object>"}finally{o(),n(),i(),a()}}function Mn(e){const t=e,r=t.toJSON;return r?(delete t.toJSON,()=>{t.toJSON=r}):_e}const v2=220*bn,y2="$",b2=3;function $e(e,t=v2){const r=Mn(Object.prototype),o=Mn(Array.prototype),n=[],i=new WeakMap,a=El(e,y2,void 0,n,i),s=JSON.stringify(a);let c=s?s.length:0;if(c>t){Il(t,"discarded",e);return}for(;n.length>0&&c<t;){const l=n.shift();let u=0;if(Array.isArray(l.source))for(let d=0;d<l.source.length;d++){const f=El(l.source[d],l.path,d,n,i);if(f!==void 0?c+=JSON.stringify(f).length:c+=4,c+=u,u=1,c>t){Il(t,"truncated",e);break}l.target[d]=f}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const f=El(l.source[d],l.path,d,n,i);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+b2,u=1),c>t){Il(t,"truncated",e);break}l.target[d]=f}}return r(),o(),a}function El(e,t,r,o,n){const i=x2(e);if(!i||typeof i!="object")return _2(i);const a=Du(i);if(a!=="[Object]"&&a!=="[Array]"&&a!=="[Error]")return a;const s=e;if(n.has(s))return`[Reference seen at ${n.get(s)}]`;const c=r!==void 0?`${t}.${r}`:t,l=Array.isArray(i)?[]:{};return n.set(s,c),o.push({source:i,target:l,path:c}),l}function _2(e){return typeof e=="bigint"?`[BigInt] ${e.toString()}`:typeof e=="function"?`[Function] ${e.name||"unknown"}`:typeof e=="symbol"?`[Symbol] ${e.description||e.toString()}`:e}function Du(e){try{if(e instanceof Event)return w2(e);if(e instanceof RegExp)return`[RegExp] ${e.toString()}`;const r=Object.prototype.toString.call(e).match(/\[object (.*)\]/);if(r&&r[1])return`[${r[1]}]`}catch{}return"[Unserializable]"}function w2(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?Du(e.currentTarget):null,target:e.target?Du(e.target):null}}function x2(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function Il(e,t,r){Q.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,r)}const sk="No stack, consider using an instance of Error";function bm({stackTrace:e,originalError:t,handlingStack:r,componentStack:o,startClocks:n,nonErrorPrefix:i,useFallbackStack:a=!0,source:s,handling:c}){const l=_n(t);return!e&&l&&(e=Xi(t)),{startClocks:n,source:s,handling:c,handlingStack:r,componentStack:o,originalError:t,type:e?e.name:void 0,message:S2(e,l,i,t),stack:e?Qi(e):a?sk:void 0,causes:l?I2(t,s):void 0,fingerprint:k2(t),context:E2(t)}}function S2(e,t,r,o){return e?.message&&e?.name?e.message:t?"Empty message":`${r} ${ho($e(o))}`}function k2(e){return _n(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function E2(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function _n(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function I2(e,t){let r=e;const o=[];for(;_n(r?.cause)&&o.length<10;){const n=Xi(r.cause);o.push({message:r.cause.message,source:t,type:n?.name,stack:n&&Qi(n)}),r=r.cause}return o.length?o:void 0}const vo={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function T2(){return new ge(e=>{const t=(n,i)=>{const a=bm({stackTrace:i,originalError:n,startClocks:Ue(),nonErrorPrefix:"Uncaught",source:vo.SOURCE,handling:"unhandled"});e.notify(a)},{stop:r}=$2(t),{stop:o}=O2(t);return()=>{r(),o()}})}function $2(e){return Bt(It(),"onerror",({parameters:[t,r,o,n,i]})=>{let a;_n(i)||(a=d2(t,r,o,n)),e(i??t,a)})}function O2(e){return Bt(It(),"onunhandledrejection",({parameters:[t]})=>{e(t.reason||"Empty reason")})}function A2(e){const t={version:"6.24.1",onReady(r){r()},...e};return Object.defineProperty(t,"_setDebug",{get(){return ZP},enumerable:!1}),t}function C2(e,t,r){const o=e[t];o&&!o.q&&o.version&&Q.warn("SDK is loaded more than once. This is unsupported and might have unexpected behavior."),e[t]=r,o&&o.q&&o.q.forEach(n=>OS(n,"onReady callback threw an error:")())}function ck(e,t){t.silentMultipleInit||Q.error(`${e} is already initialized.`)}function Oe(e,t,r,o,n){return hr(e,t,[r],o,n)}function hr(e,t,r,o,{once:n,capture:i,passive:a}={}){const s=ne(f=>{!f.isTrusted&&!f.__ddIsTrusted&&!e.allowUntrustedEvents||(n&&d(),o(f))}),c=a?{capture:i,passive:a}:i,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=jr(l,"addEventListener");r.forEach(f=>u.call(t,f,s,c));function d(){const f=jr(l,"removeEventListener");r.forEach(m=>f.call(t,m,s,c))}return{stop:d}}const si={intervention:"intervention",cspViolation:"csp_violation"};function N2(e,t){const r=[];t.includes(si.cspViolation)&&r.push(P2(e));const o=t.filter(n=>n!==si.cspViolation);return o.length&&r.push(R2(o)),NS(...r)}function R2(e){return new ge(t=>{if(!window.ReportingObserver)return;const r=ne((n,i)=>n.forEach(a=>t.notify(j2(a)))),o=new window.ReportingObserver(r,{types:e,buffered:!0});return o.observe(),()=>{o.disconnect()}})}function P2(e){return new ge(t=>{const{stop:r}=Oe(e,document,"securitypolicyviolation",o=>{t.notify(D2(o))});return r})}function j2(e){const{type:t,body:r}=e;return lk({type:r.id,message:`${t}: ${r.message}`,originalError:e,stack:uk(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function D2(e){const t=`'${e.blockedURI}' blocked by '${e.effectiveDirective}' directive`;return lk({type:e.effectiveDirective,message:`${si.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:uk(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${gm(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function lk(e){return{startClocks:Ue(),source:vo.REPORT,handling:"unhandled",...e}}function uk(e,t,r,o,n){return r?Qi({name:e,message:t,stack:[{func:"?",url:r,line:o??void 0,column:n??void 0}]}):void 0}const z2=200;function _m(e){const{env:t,service:r,version:o,datacenter:n,sdkVersion:i,variant:a}=e,s=[Tn("sdk_version",i??"6.24.1")];return t&&s.push(Tn("env",t)),r&&s.push(Tn("service",r)),o&&s.push(Tn("version",o)),n&&s.push(Tn("datacenter",n)),a&&s.push(Tn("variant",a)),s}function Tn(e,t){const r=t?`${e}:${t}`:e;return(r.length>z2||U2(r))&&Q.warn(`Tag ${r} doesn't meet tag requirements and will be sanitized. ${fm} ${Ac}/getting_started/tagging/#defining-tags`),M2(r)}function M2(e){return e.replace(/,/g,"_")}function U2(e){return L2()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(e):!1}function L2(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function wm(e,t){const r=or.__ddBrowserSdkExtensionCallback;r&&r({type:e,payload:t})}function ms(e,t,r=F2()){if(t===void 0)return e;if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const n=t.flags||[t.global?"g":"",t.ignoreCase?"i":"",t.multiline?"m":"",t.sticky?"y":"",t.unicode?"u":""].join("");return new RegExp(t.source,n)}if(r.hasAlreadyBeenSeen(t))return;if(Array.isArray(t)){const n=Array.isArray(e)?e:[];for(let i=0;i<t.length;++i)n[i]=ms(n[i],t[i],r);return n}const o=yn(e)==="object"?e:{};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=ms(o[n],t[n],r));return o}function xm(e){return ms(void 0,e)}function vr(...e){let t;for(const r of e)r!=null&&(t=ms(t,r));return t}function F2(){if(typeof WeakSet<"u"){const t=new WeakSet;return{hasAlreadyBeenSeen(r){const o=t.has(r);return o||t.add(r),o}}}const e=[];return{hasAlreadyBeenSeen(t){const r=e.indexOf(t)>=0;return r||e.push(t),r}}}function dk(){var e;const t=or.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function V2(e){return e>=500}function Z2(e){try{return e.clone()}catch{return}}const B2=80*bn,q2=32,fk=20*ok,G2=lt,mk=Ke;function pk(e,t,r,o,n,i){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?hk(e,t,r,i,{onSuccess:()=>vk(0,t,r,o,n,i),onFailure:()=>{t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e}),gk(t,r,o,n,i)}}):t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e})}function gk(e,t,r,o,n){e.transportStatus===2&&Je(()=>{const i=e.queuedPayloads.first();hk(i,e,t,n,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=mk,vk(1,e,t,r,o,n)},onFailure:()=>{e.currentBackoffTime=Math.min(G2,e.currentBackoffTime*2),gk(e,t,r,o,n)}})},e.currentBackoffTime)}function hk(e,t,r,o,{onSuccess:n,onFailure:i}){t.bandwidthMonitor.add(e),r(e,a=>{t.bandwidthMonitor.remove(e),H2(a)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:a.status},o.notify({type:"failure",bandwidth:t.bandwidthMonitor.stats(),payload:e}),i()):(t.transportStatus=0,o.notify({type:"success",bandwidth:t.bandwidthMonitor.stats(),payload:e}),n())})}function vk(e,t,r,o,n,i){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(n({message:`Reached max ${o} events size queued for upload: ${fk/ok}MiB`,source:vo.AGENT,startClocks:Ue()}),t.queueFullReported=!0);const a=t.queuedPayloads;for(t.queuedPayloads=yk();a.size()>0;)pk(a.dequeue(),t,r,o,n,i)}function H2(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||V2(e.status))}function W2(){return{transportStatus:0,currentBackoffTime:mk,bandwidthMonitor:J2(),queuedPayloads:yk(),queueFullReported:!1}}function yk(){const e=[];return{bytesCount:0,enqueue(t){return this.isFull()?!1:(e.push(t),this.bytesCount+=t.bytesCount,!0)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=fk}}}function J2(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=B2&&this.ongoingRequestCount<q2},add(e){this.ongoingRequestCount+=1,this.ongoingByteCount+=e.bytesCount},remove(e){this.ongoingRequestCount-=1,this.ongoingByteCount-=e.bytesCount},stats(){return{ongoingByteCount:this.ongoingByteCount,ongoingRequestCount:this.ongoingRequestCount}}}}const zu=16*bn;function Sm(e,t,r=zu){const o=new ge,n=W2();return{observable:o,send:i=>{for(const a of e)pk(i,n,(s,c)=>{Yi(Dr.AVOID_FETCH_KEEPALIVE)?ps(a,s,c):X2(a,r,s,c)},a.trackType,t,o)},sendOnExit:i=>{for(const a of e)K2(a,r,i)}}}function K2(e,t,r){if(!!navigator.sendBeacon&&r.bytesCount<t)try{const n=e.build("beacon",r);if(navigator.sendBeacon(n,r.data))return}catch(n){Y2(n)}ps(e,r)}let Rg=!1;function Y2(e){Rg||(Rg=!0,pr(e))}function X2(e,t,r,o){if(Q2()&&r.bytesCount<t){const i=e.build("fetch-keepalive",r);fetch(i,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(ne(a=>o?.({status:a.status,type:a.type}))).catch(ne(()=>ps(e,r,o)))}else ps(e,r,o)}function ps(e,t,r){const o=e.build("fetch",t);fetch(o,{method:"POST",body:t.data,mode:"cors"}).then(ne(n=>r?.({status:n.status,type:n.type}))).catch(ne(()=>r?.({status:0})))}function Q2(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function yo(){const e=eD();if(e)return{getCapabilities(){var t;return JSON.parse(((t=e.getCapabilities)===null||t===void 0?void 0:t.call(e))||"[]")},getPrivacyLevel(){var t;return(t=e.getPrivacyLevel)===null||t===void 0?void 0:t.call(e)},getAllowedWebViewHosts(){return JSON.parse(e.getAllowedWebViewHosts())},send(t,r,o){const n=o?{id:o}:void 0;e.send(JSON.stringify({eventType:t,event:r,view:n}))}}}function bk(e){const t=yo();return!!t&&t.getCapabilities().includes(e)}function sn(e){var t;e===void 0&&(e=(t=It().location)===null||t===void 0?void 0:t.hostname);const r=yo();return!!r&&r.getAllowedWebViewHosts().some(o=>e===o||e.endsWith(`.${o}`))}function eD(){return It().DatadogEventBridge}const Ln={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function tD(e){return new ge(t=>{const{stop:r}=hr(e,window,["visibilitychange","freeze"],n=>{n.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:Ln.HIDDEN}):n.type==="freeze"&&t.notify({reason:Ln.FROZEN})},{capture:!0}),o=Oe(e,window,"beforeunload",()=>{t.notify({reason:Ln.UNLOADING})}).stop;return()=>{r(),o()}})}function _k(e){return FS(Ln).includes(e)}const Pg=256*bn;function wk({encoder:e,request:t,flushController:r}){let o={};const n=r.flushObservable.subscribe(u=>l(u));function i(u,d,f){r.notifyBeforeAddMessage(d),f!==void 0?(o[f]=u,r.notifyAfterAddMessage()):e.write(e.isEmpty?u:`
|
|
33
|
+
${u}`,m=>{r.notifyAfterAddMessage(m-d)})}function a(u){return u!==void 0&&o[u]!==void 0}function s(u){const d=o[u];delete o[u];const f=e.estimateEncodedBytesCount(d);r.notifyAfterRemoveMessage(f)}function c(u,d){const f=ho(u),m=e.estimateEncodedBytesCount(f);if(m>=Pg){Q.warn(`Discarded a message whose size was bigger than the maximum allowed size ${Pg/bn}KiB. ${fm} ${LP}/#technical-limitations`);return}a(d)&&s(d),i(f,m,d)}function l(u){const d=FS(o).join(`
|
|
34
|
+
`);o={};const f=_k(u.reason),m=f?t.sendOnExit:t.send;if(f&&e.isAsync){const h=e.finishSync();h.outputBytesCount&&m(jg(h));const g=[h.pendingData,d].filter(Boolean).join(`
|
|
35
|
+
`);g&&m({data:g,bytesCount:ik(g)})}else d&&e.write(e.isEmpty?d:`
|
|
36
|
+
${d}`),e.finish(h=>{m(jg(h))})}return{flushController:r,add:c,upsert:c,stop:n.unsubscribe}}function jg(e){let t;return typeof e.output=="string"?t=e.output:t=new Blob([e.output],{type:"text/plain"}),{data:t,bytesCount:e.outputBytesCount,encoding:e.encoding}}const rD=30*Ke,nD=Cc?1:50;function xk({pageMayExitObservable:e,sessionExpireObservable:t}){const r=e.subscribe(d=>s(d.reason)),o=t.subscribe(()=>s("session_expire")),n=new ge(()=>()=>{r.unsubscribe(),o.unsubscribe()});let i=0,a=0;function s(d){if(a===0)return;const f=a,m=i;a=0,i=0,u(),n.notify({reason:d,messagesCount:f,bytesCount:m})}let c;function l(){c===void 0&&(c=Je(()=>{s("duration_limit")},rD))}function u(){vt(c),c=void 0}return{flushObservable:n,get messagesCount(){return a},notifyBeforeAddMessage(d){i+d>=zu&&s("bytes_limit"),a+=1,i+=d,l()},notifyAfterAddMessage(d=0){i+=d,a>=nD?s("messages_limit"):i>=zu&&s("bytes_limit")},notifyAfterRemoveMessage(d){i-=d,a-=1,a===0&&u()}}}const zr="DISCARDED",wt="SKIPPED";function oD(){const e={};return{register(t,r){return e[t]||(e[t]=[]),e[t].push(r),{unregister:()=>{e[t]=e[t].filter(o=>o!==r)}}},triggerHook(t,r){const o=e[t]||[],n=[];for(const i of o){const a=i(r);if(a===zr)return zr;a!==wt&&n.push(a)}return vr(...n)}}}const Cr={LOG:"log",CONFIGURATION:"configuration",USAGE:"usage"},iD=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],aD=1,sD=[Uj],cD=15;let Tl;function bo(){return Tl||(Tl=new RS(100)),Tl}function lD(e,t,r,o,n,i){const a=new ge,{stop:s}=dD(t,o,n,i,a),{enabled:c,metricsEnabled:l}=uD(e,t,r,a);return{stop:s,enabled:c,metricsEnabled:l}}function uD(e,t,r,o,n=aD,i=cD){const a={},s=!sD.includes(t.site)&&Xr(t.telemetrySampleRate),c={[Cr.LOG]:s,[Cr.CONFIGURATION]:s&&Xr(t.telemetryConfigurationSampleRate),[Cr.USAGE]:s&&Xr(t.telemetryUsageSampleRate),metric:s&&Xr(n)},l=fD(),u=bo();return u.subscribe(({rawEvent:f,metricName:m})=>{if(m&&!c.metric||!c[f.type])return;const h=m||f.status||f.type;let g=a[h];if(g||(g=a[h]=new Set),g.size>=i)return;const y=ho(f);if(g.has(y))return;const b=r.triggerHook(1,{startTime:Ue().relative});if(b===zr)return;const w=d(b,e,f,l);o.notify(w),wm("telemetry",w),g.add(y)}),u.unbuffer(),VP(km),{enabled:s,metricsEnabled:c.metric};function d(f,m,h,g){const b={type:"telemetry",date:Ue().timeStamp,service:m,version:"6.24.1",source:"browser",_dd:{format_version:2},telemetry:vr(h,{runtime_env:g,connectivity:dk(),sdk_setup:"npm"}),ddtags:_m(t).join(","),experimental_features:Array.from(e2())};return vr(b,f)}}function dD(e,t,r,o,n){const i=[];if(sn()){const a=yo(),s=n.subscribe(c=>a.send("internal_telemetry",c));i.push(s.unsubscribe)}else{const a=[e.rumEndpointBuilder];e.replica&&mD(e)&&a.push(e.replica.rumEndpointBuilder);const s=wk({encoder:o(4),request:Sm(a,t),flushController:xk({pageMayExitObservable:r,sessionExpireObservable:new ge})});i.push(s.stop);const c=n.subscribe(s.add);i.push(c.unsubscribe)}return{stop:()=>i.forEach(a=>a())}}function fD(){var e;return{is_local_file:((e=or.location)===null||e===void 0?void 0:e.protocol)==="file:",is_worker:Cc}}function mD(e){return e.site===QS}function _o(e,t){Nu(Oc.debug,e,t),bo().notify({rawEvent:{type:Cr.LOG,message:e,status:"debug",...t}})}function km(e,t){bo().notify({rawEvent:{type:Cr.LOG,status:"error",...gD(e),...t}})}function pD(e){bo().notify({rawEvent:{type:Cr.CONFIGURATION,configuration:e}})}function ea(e,t){bo().notify({rawEvent:{type:Cr.LOG,message:e,status:"debug",...t},metricName:e})}function Ve(e){bo().notify({rawEvent:{type:Cr.USAGE,usage:e}})}function gD(e){if(_n(e)){const t=Xi(e);return{error:{kind:t.name,stack:Qi(hD(t))},message:t.message}}return{error:{stack:sk},message:`Uncaught ${ho(e)}`}}function hD(e){return e.stack=e.stack.filter(t=>!t.url||iD.some(r=>t.url.startsWith(r))),e}function Sk(e,t){const r=e.indexOf(t);r>=0&&e.splice(r,1)}function rn(e){return Array.isArray(e)&&e.length>0}const _a=1/0,vD=lt;let Po=null;const za=new Set;function yD(){za.forEach(e=>e())}function wo({expireDelay:e,maxEntries:t}){let r=[];Po||(Po=po(()=>yD(),vD));const o=()=>{const u=_t()-e;for(;r.length>0&&r[r.length-1].endTime<u;)r.pop()};za.add(o);function n(u,d){const f={value:u,startTime:d,endTime:_a,remove:()=>{Sk(r,f)},close:m=>{f.endTime=m}};return t&&r.length>=t&&r.pop(),r.unshift(f),f}function i(u=_a,d={returnInactive:!1}){for(const f of r)if(f.startTime<=u){if(d.returnInactive||u<=f.endTime)return f.value;break}}function a(u){const d=r[0];d&&d.endTime===_a&&d.close(u)}function s(u=_a,d=0){const f=go(u,d);return r.filter(m=>m.startTime<=f&&u<=m.endTime).map(m=>m.value)}function c(){r=[]}function l(){za.delete(o),za.size===0&&Po&&(Nc(Po),Po=null)}return{add:n,find:i,closeActive:a,findAll:s,reset:c,stop:l}}const bD="datadog-synthetics-public-id",_D="datadog-synthetics-result-id",wD="datadog-synthetics-injects-rum";function kk(){return Cc?!1:!!(or._DATADOG_SYNTHETICS_INJECTS_RUM||Tr(wD))}function Ek(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||Tr(bD);return typeof e=="string"?e:void 0}function Ik(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||Tr(_D);return typeof e=="string"?e:void 0}function Tk(){return!!(Ek()&&Ik())}const xD=lt,SD=vn;function kD(e,t,r,o){const n=new ge,i=new ge,a=Aj(e.sessionStoreStrategyType,e,t,r),s=wo({expireDelay:SD});if(a.renewObservable.subscribe(()=>{s.add(c(),_t()),n.notify()}),a.expireObservable.subscribe(()=>{i.notify(),s.closeActive(_t())}),a.expandOrRenewSession(),s.add(c(),mm().relative),Yi(Dr.SHORT_SESSION_INVESTIGATION)){const l=a.getSession();l&&OD(e,l)}o.observable.subscribe(()=>{o.isGranted()?a.expandOrRenewSession():a.expire(!1)}),ED(e,()=>{o.isGranted()&&a.expandOrRenewSession()}),ID(e,()=>a.expandSession()),TD(e,()=>a.restartSession());function c(){const l=a.getSession();return l?{id:l.id,trackingType:l[t],isReplayForced:!!l.forcedReplay,anonymousId:l.anonymousId}:($D(e).catch(()=>{}),{id:"invalid",trackingType:ZS,isReplayForced:!1,anonymousId:void 0})}return{findSession:(l,u)=>s.find(l,u),renewObservable:n,expireObservable:i,sessionStateUpdateObservable:a.sessionStateUpdateObservable,expire:a.expire,updateSessionState:a.updateSessionState}}function ED(e,t){const{stop:r}=hr(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function ID(e,t){const r=()=>{document.visibilityState==="visible"&&t()},{stop:o}=Oe(e,document,"visibilitychange",r);po(r,xD)}function TD(e,t){const{stop:r}=Oe(e,window,"resume",t,{capture:!0})}async function $D(e){const t=e.sessionStoreStrategyType;if(!t)return;let r,o;t.type===oo.COOKIE?(r=HS(t.cookieOptions,e),o={cookie:await $k(),currentDomain:`${window.location.protocol}//${window.location.hostname}`}):r=KS(),_o("Unexpected session state",{sessionStoreStrategyType:t.type,session:r,isSyntheticsTest:Tk(),createdTimestamp:r?.created,expireTimestamp:r?.expire,...o})}function OD(e,t){if(!window.cookieStore||!t.created)return;const r=Number(t.created),o=ct(),{stop:n}=Oe(e,cookieStore,"change",i);function i(a){const s=LS(a.changed,l=>l.name===gr);if(!s)return;const c=ct()-r;if(c>14*lt)n();else{const l=Dc(s.value);if(l.id&&l.id!==t.id){n();const u=ct()-o;$k().then(d=>{_o("Session cookie changed",{time:u,session_age:c,old:t,new:l,cookie:d})}).catch(pr)}}}}async function $k(){let e;return"cookieStore"in window?e=await window.cookieStore.getAll(gr):e=document.cookie.split(/\s*;\s*/).filter(t=>t.startsWith(gr)),{count:e.length,domain:US()||"undefined",...e}}function AD(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(r,o){const n=ik(r);t+=n,e+=r,o&&o(n)},finish(r){r(this.finishSync())},finishSync(){const r={output:e,outputBytesCount:t,rawBytesCount:t,pendingData:""};return e="",t=0,r},estimateEncodedBytesCount(r){return r.length}}}class CD{constructor(){this.callbacks={}}notify(t,r){const o=this.callbacks[t];o&&o.forEach(n=>n(r))}subscribe(t,r){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(r),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(o=>r!==o)}}}}const ND=3e3;function $l(e,t,r=ND){let o=0,n=!1;return{isLimitReached(){if(o===0&&Je(()=>{o=0},lt),o+=1,o<=r||n)return n=!1,!1;if(o===r+1){n=!0;try{t({message:`Reached max number of ${e}s by minute: ${r}`,source:vo.AGENT,startClocks:Ue()})}finally{n=!1}}return!0}}}function Em(e,t,r){return document.readyState===t||document.readyState==="complete"?(r(),{stop:_e}):Oe(e,window,t==="complete"?"load":"DOMContentLoaded",r,{once:!0})}function RD(e,t){return new Promise(r=>{Em(e,t,r)})}let Ol;const Im=new WeakMap;function PD(e){return Ol||(Ol=jD(e)),Ol}function jD(e){return new ge(t=>{const{stop:r}=Bt(XMLHttpRequest.prototype,"open",DD),{stop:o}=Bt(XMLHttpRequest.prototype,"send",i=>{zD(i,e,t)},{computeHandlingStack:!0}),{stop:n}=Bt(XMLHttpRequest.prototype,"abort",MD);return()=>{r(),o(),n()}})}function DD({target:e,parameters:[t,r]}){Im.set(e,{state:"open",method:String(t).toUpperCase(),url:hm(String(r))})}function zD({target:e,parameters:[t],handlingStack:r},o,n){const i=Im.get(e);if(!i)return;const a=i;a.state="start",a.startClocks=Ue(),a.isAborted=!1,a.xhr=e,a.handlingStack=r,a.requestBody=t;let s=!1;const{stop:c}=Bt(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&l()}),l=()=>{if(u(),c(),s)return;s=!0;const d=i;d.state="complete",d.duration=Ne(a.startClocks.timeStamp,Be()),d.status=e.status,typeof e.response=="string"&&(d.responseBody=e.response),n.notify(oi(d))},{stop:u}=Oe(o,e,"loadend",l);n.notify(a)}function MD({target:e}){const t=Im.get(e);t&&(t.isAborted=!0)}async function UD(e,t){const r=e.getReader(),o=[];for(;;){const n=await r.read();if(n.done)break;t.collectStreamBody&&o.push(n.value)}return r.cancel().catch(_e),t.collectStreamBody?ak(o):void 0}let Al;const Ok=[];function Ak({responseBodyAction:e}={}){return e&&Ok.push(e),Al||(Al=LD()),Al}function LD(){return new ge(e=>{if(!or.fetch)return;const{stop:t}=Bt(or,"fetch",r=>FD(r,e),{computeHandlingStack:!0});return t})}function FD({parameters:e,onPostCall:t,handlingStack:r},o){const[n,i]=e;let a=i&&i.method;a===void 0&&n instanceof Request&&(a=n.method);const s=a!==void 0?String(a).toUpperCase():"GET",c=n instanceof Request?n.url:hm(String(n)),l=Ue(),u={state:"start",init:i,input:n,method:s,startClocks:l,url:c,handlingStack:r};o.notify(u),e[0]=u.input,e[1]=u.init,t(d=>{VD(o,d,u).catch(pr)})}async function VD(e,t,r){var o,n;const i=r;i.state="resolve";let a;try{a=await t}catch(c){i.status=0,i.isAborted=((n=(o=i.init)===null||o===void 0?void 0:o.signal)===null||n===void 0?void 0:n.aborted)||c instanceof DOMException&&c.code===DOMException.ABORT_ERR,i.error=c,e.notify(i);return}i.response=a,i.status=a.status,i.responseType=a.type,i.isAborted=!1;const s=Ok.reduce((c,l)=>Math.max(c,l(i)),0);if(s!==0){const c=Z2(a);if(c&&c.body)try{const l=await UD(c.body,{collectStreamBody:s===2});i.responseBody=l&&new TextDecoder().decode(l)}catch{}}e.notify(i)}function Ck(e,t){if(window.requestIdleCallback&&window.cancelIdleCallback){const r=window.requestIdleCallback(ne(e),t);return()=>window.cancelIdleCallback(r)}return BD(e)}const ZD=50;function BD(e){const t=ct(),r=Je(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,ZD-(ct()-t))})},0);return()=>vt(r)}const qD=Ke,GD=30;function HD(){const e=[];function t(o){let n;if(o.didTimeout){const i=performance.now();n=()=>GD-(performance.now()-i)}else n=o.timeRemaining.bind(o);for(;n()>0&&e.length;)e.shift()();e.length&&r()}function r(){Ck(t,{timeout:qD})}return{push(o){e.push(o)===1&&r()},stop(){e.length=0}}}let Cl={};function WD(e){const t=e.map(r=>(Cl[r]||(Cl[r]=JD(r)),Cl[r]));return NS(...t)}function JD(e){return new ge(t=>{const r=ur[e];return ur[e]=(...o)=>{r.apply(console,o);const n=fs("console error");Ar(()=>{t.notify(KD(o,e,n))})},()=>{ur[e]=r}})}function KD(e,t,r){const o=e.map(n=>YD(n)).join(" ");if(t===Oc.error){const n=e.find(_n),i=bm({originalError:n,handlingStack:r,startClocks:Ue(),source:vo.CONSOLE,handling:"handled",nonErrorPrefix:"Provided",useFallbackStack:!1});return i.message=o,{api:t,message:o,handlingStack:r,error:i}}return{api:t,message:o,error:void 0,handlingStack:r}}function YD(e){return typeof e=="string"?$e(e):_n(e)?nk(Xi(e)):ho($e(e),void 0,2)}const XD=500;function QD(){const e=[];return{add:n=>{e.push(n)>XD&&e.splice(0,1)},remove:n=>{Sk(e,n)},drain:n=>{e.forEach(i=>i(n)),e.length=0}}}function ez(e){const t=yn(e)==="object";return t||Q.error("Unsupported context:",e),t}function Nl(e,t,r){const o={...e};for(const[n,{required:i,type:a}]of Object.entries(t))a==="string"&&!Dg(o[n])&&(o[n]=String(o[n])),i&&Dg(o[n])&&Q.warn(`The property ${n} of ${r} is required; context will not be sent to the intake.`);return o}function Dg(e){return e==null||e===""}function Mc(e="",{propertiesConfig:t={}}={}){let r={};const o=new ge,n={getContext:()=>xm(r),setContext:i=>{ez(i)?r=$e(Nl(i,t,e)):n.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=$e(Nl({...r,[i]:a},t,e)),o.notify()},removeContextProperty:i=>{delete r[i],Nl(r,t,e),o.notify()},clearContext:()=>{r={},o.notify()},changeObservable:o};return n}function rt(e,t,r,o){return ne((...n)=>(o&&Ve({feature:o}),e()[t][r](...n)))}const tz="_dd_c",rz=[];function Tm(e,t,r,o){const n=nz(r,o);rz.push(Oe(e,window,"storage",({key:l})=>{n===l&&a()})),t.changeObservable.subscribe(s);const i=vr(c(),t.getContext());Vr(i)||t.setContext(i);function a(){t.setContext(c())}function s(){localStorage.setItem(n,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(n);return l?JSON.parse(l):{}}}function nz(e,t){return`${tz}_${e}_${t}`}function oz(e,t,r){const o=Nk();return t.storeContextsAcrossPages&&Tm(t,o,r,4),e.register(0,()=>{const n=o.getContext();return Vr(n)||!n.id?wt:{account:n}}),o}function Nk(){return Mc("account",{propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}})}function iz(e,t,r,o){const n=Rk();return t.storeContextsAcrossPages&&Tm(t,n,r,2),e.register(0,()=>({context:n.getContext()})),n}function Rk(){return Mc("global context")}function az(e,t,r,o){const n=Pk();return t.storeContextsAcrossPages&&Tm(t,n,o,1),e.register(0,({eventType:i,startTime:a})=>{const s=n.getContext(),c=r.findTrackedSession(a);return c&&c.anonymousId&&!s.anonymous_id&&t.trackAnonymousUser&&(s.anonymous_id=c.anonymousId),Vr(s)?wt:{type:i,usr:s}}),e.register(1,({startTime:i})=>{var a;return{anonymous_id:(a=r.findTrackedSession(i))===null||a===void 0?void 0:a.anonymousId}}),n}function Pk(){return Mc("user",{propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}})}const Ze={userContext:"userContext",globalContext:"globalContext",accountContext:"accountContext"},nt={getContext:"getContext",setContext:"setContext",setContextProperty:"setContextProperty",removeContextProperty:"removeContextProperty",clearContext:"clearContext"},at={DOCUMENT:"document",XHR:"xhr",BEACON:"beacon",FETCH:"fetch",CSS:"css",JS:"js",IMAGE:"image",FONT:"font",MEDIA:"media",OTHER:"other"},Uc={FETCH:at.FETCH,XHR:at.XHR},sz=500;function cz(e=T2){const t=new RS(sz),r=e().subscribe(o=>{t.notify({type:0,error:o})});return{observable:t,stop:()=>{r.unsubscribe()}}}function lz(){try{return new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const te={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",VITAL:"vital"},jk={LONG_TASK:"long-task",LONG_ANIMATION_FRAME:"long-animation-frame"},dr={INITIAL_LOAD:"initial_load",ROUTE_CHANGE:"route_change",BF_CACHE:"bf_cache"},Lc={CLICK:"click",CUSTOM:"custom"},jo={RAGE_CLICK:"rage_click",ERROR_CLICK:"error_click",DEAD_CLICK:"dead_click"},ci={DURATION:"duration",OPERATION_STEP:"operation_step"};function uz(){return{vitalsByName:new Map,vitalsByReference:new WeakMap}}function dz(e,t,r){function o(a){return!t.wasInPageStateDuringPeriod("frozen",a.startClocks.relative,a.duration)}function n(a){o(a)&&e.notify(12,zg(a))}function i(a,s,c,l){if(!Yi(Dr.FEATURE_OPERATION_VITAL))return;const{operationKey:u,context:d,description:f}=c||{},m={name:a,type:ci.OPERATION_STEP,operationKey:u,failureReason:l,stepType:s,startClocks:Ue(),context:$e(d),description:f};e.notify(12,zg(m))}return{addOperationStepVital:i,addDurationVital:n,startDurationVital:(a,s={})=>Dk(r,a,s),stopDurationVital:(a,s={})=>{zk(n,r,a,s)}}}function Dk({vitalsByName:e,vitalsByReference:t},r,o={}){const n={name:r,startClocks:Ue(),...o},i={__dd_vital_reference:!0};return e.set(r,n),t.set(i,n),i}function zk(e,{vitalsByName:t,vitalsByReference:r},o,n={}){const i=typeof o=="string"?t.get(o):r.get(o);i&&(e(fz(i,i.startClocks,n,Ue())),typeof o=="string"?t.delete(o):r.delete(o))}function fz(e,t,r,o){var n;return{name:e.name,type:ci.DURATION,startClocks:t,duration:Ne(t.timeStamp,o.timeStamp),context:vr(e.context,r.context),description:(n=r.description)!==null&&n!==void 0?n:e.description}}function zg(e){const{startClocks:t,type:r,name:o,description:n,context:i}=e,a={id:et(),type:r,name:o,description:n,...r===ci.DURATION?{duration:oe(e.duration)}:{step_type:e.stepType,operation_key:e.operationKey,failure_reason:e.failureReason}};return{rawRumEvent:{date:t.timeStamp,vital:a,type:te.VITAL,context:i},startTime:t.relative,duration:r===ci.DURATION?e.duration:void 0,domainContext:{}}}function Mk(e,t,r){if(e)for(const o of e){const n=o[t];n&&n(r)}}const Mg=new Map;function Uk(e,t){if(t===100)return!0;if(t===0)return!1;const r=Mg.get(t);if(r&&e===r.sessionId)return r.decision;let o;return window.BigInt?o=mz(BigInt(`0x${e.split("-")[4]}`),t):o=Xr(t),Mg.set(t,{sessionId:e,decision:o}),o}function mz(e,t){const r=BigInt("1111111111111111111"),o=BigInt("0x10000000000000000"),n=e*r%o;return Number(n)<=t/100*Number(o)}function pz(){return Fk(64)}function Lk(){return Fk(63)}function Fk(e){const t=crypto.getRandomValues(new Uint32Array(2));return e===63&&(t[t.length-1]>>>=1),{toString(r=10){let o=t[1],n=t[0],i="";do{const a=o%r*4294967296+n;o=Math.floor(o/r),n=Math.floor(a/r),i=(a%r).toString(r)+i}while(o||n);return i}}}function $n(e){return e.toString(16).padStart(16,"0")}function gz(e){const t=e;return yn(t)==="object"&&ai(t.match)&&Array.isArray(t.propagatorTypes)}function hz(e){e.status===0&&!e.isAborted&&(e.traceId=void 0,e.spanId=void 0,e.traceSampled=void 0)}function vz(e,t,r,o){return{clearTracingIfNeeded:hz,traceFetch:n=>Ug(e,n,t,r,o,i=>{var a;if(n.input instanceof Request&&!(!((a=n.init)===null||a===void 0)&&a.headers))n.input=new Request(n.input),Object.keys(i).forEach(s=>{n.input.headers.append(s,i[s])});else{n.init=oi(n.init);const s=[];n.init.headers instanceof Headers?n.init.headers.forEach((c,l)=>{s.push([l,c])}):Array.isArray(n.init.headers)?n.init.headers.forEach(c=>{s.push(c)}):n.init.headers&&Object.keys(n.init.headers).forEach(c=>{s.push([c,n.init.headers[c]])}),n.init.headers=s.concat(jc(i))}}),traceXhr:(n,i)=>Ug(e,n,t,r,o,a=>{Object.keys(a).forEach(s=>{i.setRequestHeader(s,a[s])})})}}function Ug(e,t,r,o,n,i){const a=r.findTrackedSession();if(!a)return;const s=e.allowedTracingUrls.find(u=>zc([u.match],t.url,!0));if(!s)return;const c=Uk(a.id,e.traceSampleRate);(c||e.traceContextInjection===ju.ALL)&&(t.traceSampled=c,t.traceId=pz(),t.spanId=Lk(),i(yz(t.traceId,t.spanId,t.traceSampled,a.id,s.propagatorTypes,o,n,e)))}function yz(e,t,r,o,n,i,a,s){const c={};if(n.forEach(l=>{switch(l){case"datadog":{Object.assign(c,{"x-datadog-origin":"rum","x-datadog-parent-id":t.toString(),"x-datadog-sampling-priority":r?"1":"0","x-datadog-trace-id":e.toString()});break}case"tracecontext":{Object.assign(c,{traceparent:`00-0000000000000000${$n(e)}-${$n(t)}-0${r?"1":"0"}`,tracestate:`dd=s:${r?"1":"0"};o:rum`});break}case"b3":{Object.assign(c,{b3:`${$n(e)}-${$n(t)}-${r?"1":"0"}`});break}case"b3multi":{Object.assign(c,{"X-B3-TraceId":$n(e),"X-B3-SpanId":$n(t),"X-B3-Sampled":r?"1":"0"});break}}}),s.propagateTraceBaggage){const l={"session.id":o},u=i.getContext().id;typeof u=="string"&&(l["user.id"]=u);const d=a.getContext().id;typeof d=="string"&&(l["account.id"]=d);const f=Object.entries(l).map(([m,h])=>`${m}=${encodeURIComponent(h)}`).join(",");f&&(c.baggage=f)}return c}const Vk=["tracecontext","datadog"];function bz(e,t){var r,o,n,i,a,s,c;if(e.trackFeatureFlagsForEvents!==void 0&&!Array.isArray(e.trackFeatureFlagsForEvents)&&Q.warn("trackFeatureFlagsForEvents should be an array"),!e.applicationId){Q.error("Application ID is not configured, no RUM data will be collected.");return}if(!zn(e.sessionReplaySampleRate,"Session Replay")||!zn(e.traceSampleRate,"Trace"))return;if(e.excludedActivityUrls!==void 0&&!Array.isArray(e.excludedActivityUrls)){Q.error("Excluded Activity Urls should be an array");return}const l=_z(e);if(!l)return;const u=Kj(e,t),d=xz(e);if(!u)return;const f=(r=e.sessionReplaySampleRate)!==null&&r!==void 0?r:0;return{applicationId:e.applicationId,actionNameAttribute:e.actionNameAttribute,sessionReplaySampleRate:f,startSessionReplayRecordingManually:e.startSessionReplayRecordingManually!==void 0?!!e.startSessionReplayRecordingManually:f===0,traceSampleRate:(o=e.traceSampleRate)!==null&&o!==void 0?o:100,rulePsr:Gi(e.traceSampleRate)?e.traceSampleRate/100:void 0,allowedTracingUrls:l,excludedActivityUrls:(n=e.excludedActivityUrls)!==null&&n!==void 0?n:[],workerUrl:e.workerUrl,compressIntakeRequests:!!e.compressIntakeRequests,trackUserInteractions:!!(!((i=e.trackUserInteractions)!==null&&i!==void 0)||i),trackViewsManually:!!e.trackViewsManually,trackResources:!!(!((a=e.trackResources)!==null&&a!==void 0)||a),trackLongTasks:!!(!((s=e.trackLongTasks)!==null&&s!==void 0)||s),trackBfcacheViews:!!e.trackBfcacheViews,trackEarlyRequests:!!e.trackEarlyRequests,subdomain:e.subdomain,defaultPrivacyLevel:ds(Dn,e.defaultPrivacyLevel)?e.defaultPrivacyLevel:Dn.MASK,enablePrivacyForActionName:!!e.enablePrivacyForActionName,traceContextInjection:ds(ju,e.traceContextInjection)?e.traceContextInjection:ju.SAMPLED,plugins:e.plugins||[],trackFeatureFlagsForEvents:e.trackFeatureFlagsForEvents||[],profilingSampleRate:(c=e.profilingSampleRate)!==null&&c!==void 0?c:0,propagateTraceBaggage:!!e.propagateTraceBaggage,allowedGraphQlUrls:d,...u}}function _z(e){if(e.allowedTracingUrls===void 0)return[];if(!Array.isArray(e.allowedTracingUrls)){Q.error("Allowed Tracing URLs should be an array");return}if(e.allowedTracingUrls.length!==0&&e.service===void 0){Q.error("Service needs to be configured when tracing is enabled");return}const t=[];return e.allowedTracingUrls.forEach(r=>{ai(r)?t.push({match:r,propagatorTypes:Vk}):gz(r)?t.push(r):Q.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",r)}),t}function wz(e){const t=new Set;return rn(e.allowedTracingUrls)&&e.allowedTracingUrls.forEach(r=>{ai(r)?Vk.forEach(o=>t.add(o)):yn(r)==="object"&&Array.isArray(r.propagatorTypes)&&r.propagatorTypes.forEach(o=>t.add(o))}),Array.from(t)}function xz(e){if(!e.allowedGraphQlUrls)return[];if(!Array.isArray(e.allowedGraphQlUrls))return Q.warn("allowedGraphQlUrls should be an array"),[];const t=[];return e.allowedGraphQlUrls.forEach(r=>{ai(r)?t.push({match:r,trackPayload:!1,trackResponseErrors:!1}):r&&typeof r=="object"&&"match"in r&&ai(r.match)&&t.push({match:r.match,trackPayload:!!r.trackPayload,trackResponseErrors:!!r.trackResponseErrors})}),t}function Sz(e){return rn(e)&&e.some(t=>typeof t=="object"&&"trackPayload"in t?!!t.trackPayload:!1)}function kz(e){return rn(e)&&e.some(t=>typeof t=="object"&&"trackResponseErrors"in t?!!t.trackResponseErrors:!1)}function Ez(e){var t;const r=Yj(e);return{session_replay_sample_rate:e.sessionReplaySampleRate,start_session_replay_recording_manually:e.startSessionReplayRecordingManually,trace_sample_rate:e.traceSampleRate,trace_context_injection:e.traceContextInjection,propagate_trace_baggage:e.propagateTraceBaggage,action_name_attribute:e.actionNameAttribute,use_allowed_tracing_urls:rn(e.allowedTracingUrls),use_allowed_graph_ql_urls:rn(e.allowedGraphQlUrls),use_track_graph_ql_payload:Sz(e.allowedGraphQlUrls),use_track_graph_ql_response_errors:kz(e.allowedGraphQlUrls),selected_tracing_propagators:wz(e),default_privacy_level:e.defaultPrivacyLevel,enable_privacy_for_action_name:e.enablePrivacyForActionName,use_excluded_activity_urls:rn(e.excludedActivityUrls),use_worker_url:!!e.workerUrl,compress_intake_requests:e.compressIntakeRequests,track_views_manually:e.trackViewsManually,track_user_interactions:e.trackUserInteractions,track_resources:e.trackResources,track_long_task:e.trackLongTasks,track_bfcache_views:e.trackBfcacheViews,track_early_requests:e.trackEarlyRequests,plugins:(t=e.plugins)===null||t===void 0?void 0:t.map(o=>{var n;return{name:o.name,...(n=o.getConfigurationTelemetry)===null||n===void 0?void 0:n.call(o)}}),track_feature_flags_for_events:e.trackFeatureFlagsForEvents,remote_configuration_id:e.remoteConfigurationId,profiling_sample_rate:e.profilingSampleRate,use_remote_configuration_proxy:!!e.remoteConfigurationProxy,...r}}function Iz(e){const t=[];let r=0,o;const n={quote:void 0,escapeSequence:void 0};let i="";for(const a of e){if(o=Lg[r].find(s=>Nz[s](a,n)),!o)return[];if(n.escapeSequence!==void 0&&o!==12){if(!jz(n.escapeSequence))return[];i+=zz(n.escapeSequence),n.escapeSequence=void 0}Rz.includes(o)?i+=a:Pz.includes(o)&&i!==""?(t.push(i),i=""):o===12?n.escapeSequence=n.escapeSequence?`${n.escapeSequence}${a}`:a:o===8?n.quote=a:o===9&&(n.quote=void 0),r=o}return Lg[r].includes(1)?(i!==""&&t.push(i),t):[]}const Tz=/[a-zA-Z_$]/,$z=/[a-zA-Z0-9_$]/,Oz=/[0-9]/,Az=/[a-fA-F0-9]/,Cz=`'"`,Nz={0:()=>!1,1:()=>!1,2:e=>Tz.test(e),3:e=>$z.test(e),4:e=>e===".",5:e=>e==="[",6:e=>e==="]",7:e=>Oz.test(e),8:e=>Cz.includes(e),9:(e,t)=>e===t.quote,10:()=>!0,11:e=>e==="\\",12:(e,t)=>t.escapeSequence===void 0?`${t.quote}/\\bfnrtu`.includes(e):t.escapeSequence.startsWith("u")&&t.escapeSequence.length<5?Az.test(e):!1},Lg={0:[2,5],1:[],2:[3,4,5,1],3:[3,4,5,1],4:[2],5:[8,7],6:[4,5,1],7:[7,6],8:[11,9,10],9:[6],10:[11,9,10],11:[12],12:[12,11,9,10]},Rz=[2,3,7,10],Pz=[4,5,6];function jz(e){return`"'/\\bfnrt`.includes(e)||e.startsWith("u")&&e.length===5}const Dz={'"':'"',"'":"'","/":"/","\\":"\\",b:"\b",f:"\f",n:`
|
|
37
|
+
`,r:"\r",t:" "};function zz(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):Dz[e]}const Mz="v1",Uz=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function Lz(e,t){let r;const o=Vz(),n=await Gz(e);return n.ok?(o.increment("fetch","success"),r=Fz(e,n.value,t,o)):(o.increment("fetch","failure"),Q.error(n.error)),ea("remote configuration metrics",{metrics:o.get()}),r}function Fz(e,t,r,o){const n={...e};return Uz.forEach(f=>{f in t&&(n[f]=i(t[f]))}),Object.keys(r).forEach(f=>{t[f]!==void 0&&a(r[f],t[f])}),n;function i(f){if(Array.isArray(f))return f.map(i);if(Zz(f)){if(Bz(f)){const m=f.rcSerializedType;switch(m){case"string":return f.value;case"regex":return Zk(f.value);case"dynamic":return s(f);default:Q.error(`Unsupported remote configuration: "rcSerializedType": "${m}"`);return}}return AS(f,i)}return f}function a(f,m){m.forEach(({key:h,value:g})=>{f.setContextProperty(h,i(g))})}function s(f){const m=f.strategy;let h;switch(m){case"cookie":h=c(f);break;case"dom":h=l(f);break;case"js":h=d(f);break;default:Q.error(`Unsupported remote configuration: "strategy": "${m}"`);return}const g=f.extractor;return g!==void 0&&typeof h=="string"?qz(g,h):h}function c({name:f}){const m=Pc(f);return o.increment("cookie",m!==void 0?"success":"missing"),m}function l({selector:f,attribute:m}){let h;try{h=document.querySelector(f)}catch{Q.error(`Invalid selector in the remote configuration: '${f}'`),o.increment("dom","failure");return}if(!h){o.increment("dom","missing");return}if(u(h,m)){Q.error(`Forbidden element selected by the remote configuration: '${f}'`),o.increment("dom","failure");return}const g=m!==void 0?h.getAttribute(m):h.textContent;if(g===null){o.increment("dom","missing");return}return o.increment("dom","success"),g}function u(f,m){return f.getAttribute("type")==="password"&&m==="value"}function d({path:f}){let m=window;const h=Iz(f);if(h.length===0){Q.error(`Invalid JSON path in the remote configuration: '${f}'`),o.increment("js","failure");return}for(const g of h){if(!(g in m)){o.increment("js","missing");return}try{m=m[g]}catch(y){Q.error(`Error accessing: '${f}'`,y),o.increment("js","failure");return}}return o.increment("js","success"),m}}function Vz(){const e={fetch:{}};return{get:()=>e,increment:(t,r)=>{e[t]||(e[t]={}),e[t][r]||(e[t][r]=0),e[t][r]=e[t][r]+1}}}function Zz(e){return typeof e=="object"&&e!==null}function Bz(e){return"rcSerializedType"in e}function Zk(e){try{return new RegExp(e)}catch{Q.error(`Invalid regex in the remote configuration: '${e}'`)}}function qz(e,t){const r=Zk(e.value);if(r===void 0)return;const o=r.exec(t);if(o===null)return;const[n,i]=o;return i||n}async function Gz(e){let t;try{t=await fetch(Hz(e))}catch{t=void 0}if(!t||!t.ok)return{ok:!1,error:new Error("Error fetching the remote configuration.")};const r=await t.json();return r.rum?{ok:!0,value:r.rum}:{ok:!1,error:new Error("No remote configuration for RUM.")}}function Hz(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${ek("rum",e)}/${Mz}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function Wz({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,o,n){const i=QD(),a=Rk();Rl(a,Ze.globalContext,i);const s=Pk();Rl(s,Ze.userContext,i);const c=Nk();Rl(c,Ze.accountContext,i);let l,u,d,f;const m=r.observable.subscribe(g),h={};function g(){if(!d||!f||!r.isGranted())return;m.unsubscribe();let v;if(f.trackViewsManually){if(!l)return;i.remove(l.callback),v=l.options}const k=n(f,u,v);i.drain(k)}function y(v,k){const E=sn();if(E&&(v=Jz(v)),d=v,pD(Ez(v)),f){ck("DD_RUM",v);return}const I=bz(v,k);if(I){if(!E&&!I.sessionStoreStrategyType){Q.warn("No storage available for session. We will not send any data.");return}I.compressIntakeRequests&&!E&&t&&(u=t(I,"Datadog RUM",_e),!u)||(f=I,Ak().subscribe(_e),r.tryToInit(I.trackingConsent),g())}}const b=v=>{i.add(k=>k.addDurationVital(v))};return{init(v,k,E){if(!v){Q.error("Missing configuration");return}Xj(v.enableExperimentalFeatures),d=v,!(e&&kk())&&(Mk(v.plugins,"onInit",{initConfiguration:v,publicApi:k}),v.remoteConfigurationId?Lz(v,{user:s,context:a}).then(I=>{I&&y(I,E)}).catch(pr):y(v,E))},get initConfiguration(){return d},getInternalContext:_e,stopSession:_e,addTiming(v,k=Be()){i.add(E=>E.addTiming(v,k))},startView(v,k=Ue()){const E=I=>{I.startView(v,k)};i.add(E),l||(l={options:v,callback:E},g())},setViewName(v){i.add(k=>k.setViewName(v))},setViewContext(v){i.add(k=>k.setViewContext(v))},setViewContextProperty(v,k){i.add(E=>E.setViewContextProperty(v,k))},getViewContext:()=>h,globalContext:a,userContext:s,accountContext:c,addAction(v){i.add(k=>k.addAction(v))},addError(v){i.add(k=>k.addError(v))},addFeatureFlagEvaluation(v,k){i.add(E=>E.addFeatureFlagEvaluation(v,k))},startDurationVital(v,k){return Dk(o,v,k)},stopDurationVital(v,k){zk(b,o,v,k)},addDurationVital:b,addOperationStepVital:(v,k,E,I)=>{i.add(A=>A.addOperationStepVital($e(v),k,$e(E),$e(I)))}}}function Jz(e){var t,r;return{...e,applicationId:"00000000-aaaa-0000-aaaa-000000000000",clientToken:"empty",sessionSampleRate:100,defaultPrivacyLevel:(t=e.defaultPrivacyLevel)!==null&&t!==void 0?t:(r=yo())===null||r===void 0?void 0:r.getPrivacyLevel()}}function Rl(e,t,r){e.changeObservable.subscribe(()=>{const o=e.getContext();r.add(n=>n[t].setContext(o))})}function Kz(e,t,r,o={}){const n=Cj(),i=uz(),a=cz().observable;let s=Wz(o,n,i,(d,f,m)=>{const h=f&&o.createDeflateEncoder?y=>o.createDeflateEncoder(d,f,y):AD,g=e(d,t,r,m,h,n,i,a,o.sdkName);return t.onRumStart(g.lifeCycle,d,g.session,g.viewHistory,f,g.telemetry),r.onRumStart(g.lifeCycle,g.hooks,d,g.session,g.viewHistory,h),s=Yz(s,g),Mk(d.plugins,"onRumStart",{strategy:s,addEvent:g.addEvent}),g});const c=()=>s,l=ne(d=>{const f=typeof d=="object"?d:{name:d};s.startView(f),Ve({feature:"start-view"})}),u=A2({init:d=>{const f=new Error().stack;Ar(()=>s.init(d,u,f))},setTrackingConsent:ne(d=>{n.update(d),Ve({feature:"set-tracking-consent",tracking_consent:d})}),setViewName:ne(d=>{s.setViewName(d),Ve({feature:"set-view-name"})}),setViewContext:ne(d=>{s.setViewContext(d),Ve({feature:"set-view-context"})}),setViewContextProperty:ne((d,f)=>{s.setViewContextProperty(d,f),Ve({feature:"set-view-context-property"})}),getViewContext:ne(()=>(Ve({feature:"set-view-context-property"}),s.getViewContext())),getInternalContext:ne(d=>s.getInternalContext(d)),getInitConfiguration:ne(()=>xm(s.initConfiguration)),addAction:(d,f)=>{const m=fs("action");Ar(()=>{s.addAction({name:$e(d),context:$e(f),startClocks:Ue(),type:Lc.CUSTOM,handlingStack:m}),Ve({feature:"add-action"})})},addError:(d,f)=>{const m=fs("error");Ar(()=>{s.addError({error:d,handlingStack:m,context:$e(f),startClocks:Ue()}),Ve({feature:"add-error"})})},addTiming:ne((d,f)=>{s.addTiming($e(d),f)}),setGlobalContext:rt(c,Ze.globalContext,nt.setContext,"set-global-context"),getGlobalContext:rt(c,Ze.globalContext,nt.getContext,"get-global-context"),setGlobalContextProperty:rt(c,Ze.globalContext,nt.setContextProperty,"set-global-context-property"),removeGlobalContextProperty:rt(c,Ze.globalContext,nt.removeContextProperty,"remove-global-context-property"),clearGlobalContext:rt(c,Ze.globalContext,nt.clearContext,"clear-global-context"),setUser:rt(c,Ze.userContext,nt.setContext,"set-user"),getUser:rt(c,Ze.userContext,nt.getContext,"get-user"),setUserProperty:rt(c,Ze.userContext,nt.setContextProperty,"set-user-property"),removeUserProperty:rt(c,Ze.userContext,nt.removeContextProperty,"remove-user-property"),clearUser:rt(c,Ze.userContext,nt.clearContext,"clear-user"),setAccount:rt(c,Ze.accountContext,nt.setContext,"set-account"),getAccount:rt(c,Ze.accountContext,nt.getContext,"get-account"),setAccountProperty:rt(c,Ze.accountContext,nt.setContextProperty,"set-account-property"),removeAccountProperty:rt(c,Ze.accountContext,nt.removeContextProperty,"remove-account-property"),clearAccount:rt(c,Ze.accountContext,nt.clearContext,"clear-account"),startView:l,stopSession:ne(()=>{s.stopSession(),Ve({feature:"stop-session"})}),addFeatureFlagEvaluation:ne((d,f)=>{s.addFeatureFlagEvaluation($e(d),$e(f)),Ve({feature:"add-feature-flag-evaluation"})}),getSessionReplayLink:ne(()=>t.getSessionReplayLink()),startSessionReplayRecording:ne(d=>{t.start(d),Ve({feature:"start-session-replay-recording",force:d&&d.force})}),stopSessionReplayRecording:ne(()=>t.stop()),addDurationVital:ne((d,f)=>{Ve({feature:"add-duration-vital"}),s.addDurationVital({name:$e(d),type:ci.DURATION,startClocks:qP(f.startTime),duration:f.duration,context:$e(f&&f.context),description:$e(f&&f.description)})}),startDurationVital:ne((d,f)=>(Ve({feature:"start-duration-vital"}),s.startDurationVital($e(d),{context:$e(f&&f.context),description:$e(f&&f.description)}))),stopDurationVital:ne((d,f)=>{Ve({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?$e(d):d,{context:$e(f&&f.context),description:$e(f&&f.description)})}),startFeatureOperation:ne((d,f)=>{Ve({feature:"add-operation-step-vital",action_type:"start"}),s.addOperationStepVital(d,"start",f)}),succeedFeatureOperation:ne((d,f)=>{Ve({feature:"add-operation-step-vital",action_type:"succeed"}),s.addOperationStepVital(d,"end",f)}),failFeatureOperation:ne((d,f,m)=>{Ve({feature:"add-operation-step-vital",action_type:"fail"}),s.addOperationStepVital(d,"end",m,f)})});return u}function Yz(e,t){return{init:r=>{ck("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function Xz(){const e=Bk();return new ge(t=>{if(!e)return;const r=new e(ne(o=>t.notify(o)));return r.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>r.disconnect()})}function Bk(){let e;const t=window;if(t.Zone&&(e=jr(t,"MutationObserver"),t.MutationObserver&&e===t.MutationObserver)){const r=new t.MutationObserver(_e),o=jr(r,"originalInstance");e=o&&o.constructor}return e||(e=t.MutationObserver),e}function Qz(){const e=new ge,{stop:t}=Bt(window,"open",()=>e.notify());return{observable:e,stop:t}}function eM(e,t,r,o,n){return{get:i=>{const a=r.findView(i),s=n.findUrl(i),c=t.findTrackedSession(i);if(c&&a&&s){const l=o.findActionId(i);return{application_id:e,session_id:c.id,user_action:l?{id:l}:void 0,view:{id:a.id,name:a.name,referrer:s.referrer,url:s.url}}}}}}const tM=CD,rM=vn;function nM(e){const t=wo({expireDelay:rM});e.subscribe(1,o=>{t.add(r(o),o.startClocks.relative)}),e.subscribe(6,({endClocks:o})=>{t.closeActive(o.relative)}),e.subscribe(3,o=>{const n=t.find(o.startClocks.relative);n&&(o.name&&(n.name=o.name),o.context&&(n.context=o.context),n.sessionIsActive=o.sessionIsActive)}),e.subscribe(10,()=>{t.reset()});function r(o){return{service:o.service,version:o.version,context:o.context,id:o.id,name:o.name,startClocks:o.startClocks}}return{findView:o=>t.find(o),stop:()=>{t.stop()}}}const qk="initial_document",oM=[[at.DOCUMENT,e=>qk===e],[at.XHR,e=>e==="xmlhttprequest"],[at.FETCH,e=>e==="fetch"],[at.BEACON,e=>e==="beacon"],[at.CSS,(e,t)=>/\.css$/i.test(t)],[at.JS,(e,t)=>/\.js$/i.test(t)],[at.IMAGE,(e,t)=>["image","img","icon"].includes(e)||/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(t)!==null],[at.FONT,(e,t)=>/\.(woff|eot|woff2|ttf)$/i.exec(t)!==null],[at.MEDIA,(e,t)=>["audio","video"].includes(e)||/\.(mp3|mp4)$/i.exec(t)!==null]];function iM(e){const t=e.name;if(!ej(t))return at.OTHER;const r=tj(t);for(const[o,n]of oM)if(n(e.initiatorType,r))return o;return at.OTHER}function Fg(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function Gk(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function aM(e){const{duration:t,startTime:r,responseEnd:o}=e;return t===0&&r<o?Ne(r,o):t}function sM(e){if(!Wk(e))return;const{startTime:t,fetchStart:r,workerStart:o,redirectStart:n,redirectEnd:i,domainLookupStart:a,domainLookupEnd:s,connectStart:c,secureConnectionStart:l,connectEnd:u,requestStart:d,responseStart:f,responseEnd:m}=e,h={download:qr(t,f,m),first_byte:qr(t,d,f)};return 0<o&&o<r&&(h.worker=qr(t,o,r)),r<u&&(h.connect=qr(t,c,u),c<=l&&l<=u&&(h.ssl=qr(t,l,u))),r<s&&(h.dns=qr(t,a,s)),t<i&&(h.redirect=qr(t,n,i)),h}function Hk(e){return e.duration>=0}function Wk(e){const t=Fg(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=cM(e)?Fg(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function cM(e){return e.redirectEnd>e.startTime}function qr(e,t,r){if(e<=t&&t<=r)return{duration:oe(Ne(t,r)),start:oe(Ne(e,t))}}function lM(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function uM(e){return e.deliveryType===""?"other":e.deliveryType}function dM(e){if(e.startTime<e.responseStart){const{encodedBodySize:t,decodedBodySize:r,transferSize:o}=e;return{size:r,encoded_body_size:t,decoded_body_size:r,transfer_size:o}}return{size:void 0,encoded_body_size:void 0,decoded_body_size:void 0,transfer_size:void 0}}function $m(e){return e&&(!Wj(e)||Yi(Dr.TRACK_INTAKE_REQUESTS))}const fM=/data:(.+)?(;base64)?,/g,mM=24e3;function Jk(e,t=mM){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(fM);return r?`${r[0]}[...]`:e}const pM=32*bn;function gM(e,t){const r=vM(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const o=hM(e.responseBody);o&&(r.errors_count=o.length,r.errors=o)}return r}}function hM(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!="object")return;const r=t;return rn(r.errors)?r.errors.map(n=>{var i;return{message:n.message,path:n.path,locations:n.locations,code:(i=n.extensions)===null||i===void 0?void 0:i.code}}):void 0}function Kk(e,t){return t.allowedGraphQlUrls.find(r=>zc([r.match],e))}function vM(e,t=!1){if(!e||typeof e!="string")return;let r;try{r=JSON.parse(e)}catch{return}if(!r||!r.query)return;const o=r.query.trim(),n=yM(o),i=r.operationName;if(!n)return;let a;return r.variables&&(a=JSON.stringify(r.variables)),{operationType:n,operationName:i,variables:a,payload:t?gm(o,pM,"..."):void 0}}function yM(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let Vg=1;function bM(e,t,r,o,n){const i=vz(t,r,o,n);_M(e,t,i),wM(e,t,i)}function _M(e,t,r){const o=PD(t).subscribe(n=>{const i=n;if($m(i.url))switch(i.state){case"start":r.traceXhr(i,i.xhr),i.requestIndex=Yk(),e.notify(7,{requestIndex:i.requestIndex,url:i.url});break;case"complete":r.clearTracingIfNeeded(i),e.notify(8,{duration:i.duration,method:i.method,requestIndex:i.requestIndex,spanId:i.spanId,startClocks:i.startClocks,status:i.status,traceId:i.traceId,traceSampled:i.traceSampled,type:Uc.XHR,url:i.url,xhr:i.xhr,isAborted:i.isAborted,handlingStack:i.handlingStack,requestBody:i.requestBody,responseBody:i.responseBody});break}});return{stop:()=>o.unsubscribe()}}function wM(e,t,r){const o=Ak({responseBodyAction:n=>{var i;return!((i=Kk(n.url,t))===null||i===void 0)&&i.trackResponseErrors?2:1}}).subscribe(n=>{var i;const a=n;if($m(a.url))switch(a.state){case"start":r.traceFetch(a),a.requestIndex=Yk(),e.notify(7,{requestIndex:a.requestIndex,url:a.url});break;case"resolve":r.clearTracingIfNeeded(a),e.notify(8,{duration:Ne(a.startClocks.timeStamp,Be()),method:a.method,requestIndex:a.requestIndex,responseType:a.responseType,spanId:a.spanId,startClocks:a.startClocks,status:a.status,traceId:a.traceId,traceSampled:a.traceSampled,type:Uc.FETCH,url:a.url,response:a.response,init:a.init,input:a.input,isAborted:a.isAborted,handlingStack:a.handlingStack,requestBody:(i=a.init)===null||i===void 0?void 0:i.body,responseBody:a.responseBody});break}});return{stop:()=>o.unsubscribe()}}function Yk(){const e=Vg;return Vg+=1,e}function Xk(e){return Gi(e)&&e<0?void 0:e}function Qk({lifeCycle:e,isChildEvent:t,onChange:r=_e}){const o={errorCount:0,longTaskCount:0,resourceCount:0,actionCount:0,frustrationCount:0},n=e.subscribe(13,i=>{var a;if(!(i.type==="view"||i.type==="vital"||!t(i)))switch(i.type){case te.ERROR:o.errorCount+=1,r();break;case te.ACTION:o.actionCount+=1,i.action.frustration&&(o.frustrationCount+=i.action.frustration.type.length),r();break;case te.LONG_TASK:o.longTaskCount+=1,r();break;case te.RESOURCE:!((a=i._dd)===null||a===void 0)&&a.discarded||(o.resourceCount+=1,r());break}});return{stop:()=>{n.unsubscribe()},eventCounts:o}}function xM(e,t){const r=ct();let o=!1;const{stop:n}=hr(e,window,["click","mousedown","keydown","touchstart","pointerdown"],s=>{if(!s.cancelable)return;const c={entryType:"first-input",processingStart:_t(),processingEnd:_t(),startTime:s.timeStamp,duration:0,name:"",cancelable:!1,target:null,toJSON:()=>({})};s.type==="pointerdown"?i(e,c):a(c)},{passive:!0,capture:!0});return{stop:n};function i(s,c){hr(s,window,["pointerup","pointercancel"],l=>{l.type==="pointerup"&&a(c)},{once:!0})}function a(s){if(!o){o=!0,n();const c=s.processingStart-s.startTime;c>=0&&c<ct()-r&&t(s)}}}exports.RumPerformanceEntryType=void 0;(function(e){e.EVENT="event",e.FIRST_INPUT="first-input",e.LARGEST_CONTENTFUL_PAINT="largest-contentful-paint",e.LAYOUT_SHIFT="layout-shift",e.LONG_TASK="longtask",e.LONG_ANIMATION_FRAME="long-animation-frame",e.NAVIGATION="navigation",e.PAINT="paint",e.RESOURCE="resource",e.VISIBILITY_STATE="visibility-state"})(exports.RumPerformanceEntryType||(exports.RumPerformanceEntryType={}));function ir(e,t){return new ge(r=>{if(!window.PerformanceObserver)return;const o=c=>{const l=EM(c);l.length>0&&r.notify(l)};let n,i=!0;const a=new PerformanceObserver(ne(c=>{i?n=Je(()=>o(c.getEntries())):o(c.getEntries())}));try{a.observe(t)}catch{if([exports.RumPerformanceEntryType.RESOURCE,exports.RumPerformanceEntryType.NAVIGATION,exports.RumPerformanceEntryType.LONG_TASK,exports.RumPerformanceEntryType.PAINT].includes(t.type)){t.buffered&&(n=Je(()=>o(performance.getEntriesByType(t.type))));try{a.observe({entryTypes:[t.type]})}catch{return}}}i=!1,SM(e);let s;return!Zr(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=xM(e,c=>{o([c])})),()=>{a.disconnect(),s&&s(),vt(n)}})}let Do;function SM(e){return!Do&&kM()&&"addEventListener"in performance&&(Do=Oe(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{Do?.stop()}}function kM(){return window.performance!==void 0&&"getEntries"in performance}function Zr(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function EM(e){return e.filter(t=>!IM(t))}function IM(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!$m(e.name)||!Hk(e))}function Mu(e){return e.nodeType===Node.TEXT_NODE}function TM(e){return e.nodeType===Node.COMMENT_NODE}function yr(e){return e.nodeType===Node.ELEMENT_NODE}function Om(e){return yr(e)&&!!e.shadowRoot}function eE(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&yr(t.host)}function $M(e){return e.childNodes.length>0||Om(e)}function OM(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;Om(e)&&t(e.shadowRoot)}function tE(e){return eE(e)?e.host:e.parentNode}const rE=100,AM=100,Zg="data-dd-excluded-activity-mutations";function Am(e,t,r,o,n,i){const a=NM(e,t,r,o);return CM(a,n,i)}function CM(e,t,r){let o,n=!1;const i=Je(ne(()=>l({hadActivity:!1})),rE),a=r!==void 0?Je(ne(()=>l({hadActivity:!0,end:Be()})),r):void 0,s=e.subscribe(({isBusy:u})=>{vt(i),vt(o);const d=Be();u||(o=Je(ne(()=>l({hadActivity:!0,end:d})),AM))}),c=()=>{n=!0,vt(i),vt(o),vt(a),s.unsubscribe()};function l(u){n||(c(),t(u))}return{stop:c}}function NM(e,t,r,o){return new ge(n=>{const i=[];let a,s=0;return i.push(t.subscribe(l=>{l.every(RM)||c()}),r.subscribe(c),ir(o,{type:exports.RumPerformanceEntryType.RESOURCE}).subscribe(l=>{l.some(u=>!Pl(o,u.name))&&c()}),e.subscribe(7,l=>{Pl(o,l.url)||(a===void 0&&(a=l.requestIndex),s+=1,c())}),e.subscribe(8,l=>{Pl(o,l.url)||a===void 0||l.requestIndex<a||(s-=1,c())})),()=>{i.forEach(l=>l.unsubscribe())};function c(){n.notify({isBusy:s>0})}})}function Pl(e,t){return zc(e.excludedActivityUrls,t)}function RM(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&yr(t)&&t.matches(`[${Zg}], [${Zg}] *`))}const Fc="data-dd-action-name",nE="Masked Element",oE=[Fc,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],PM=[aE,DM],jM=[aE,zM,MM];function ta(e,t){if(!e.isConnected)return;let r,o=e;for(;o&&o.nodeName!=="HTML";){const n=Bg(o,PM,LM,t,r);if(n)return n;r=Bg(o,jM,FM,t,r)||Vc(UM(o),r),o=o.parentElement}return r}function iE(e){return/[0-9]/.test(e)}function DM(e){if(e.id&&!iE(e.id))return`#${CSS.escape(e.id)}`}function zM(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const o=t[r];if(!iE(o))return`${CSS.escape(e.tagName)}.${CSS.escape(o)}`}}function MM(e){return CSS.escape(e.tagName)}function aE(e,t){if(t){const o=r(t);if(o)return o}for(const o of oE){const n=r(o);if(n)return n}function r(o){if(e.hasAttribute(o))return`${CSS.escape(e.tagName)}[${o}="${CSS.escape(e.getAttribute(o))}"]`}}function UM(e){let t=e.parentElement.firstElementChild,r=1;for(;t&&t!==e;)t.tagName===e.tagName&&(r+=1),t=t.nextElementSibling;return`${CSS.escape(e.tagName)}:nth-of-type(${r})`}function Bg(e,t,r,o,n){for(const i of t){const a=i(e,o);if(a&&r(e,a,n))return Vc(a,n)}}function LM(e,t,r){return e.ownerDocument.querySelectorAll(Vc(t,r)).length===1}function FM(e,t,r){let o;if(r===void 0)o=a=>a.matches(t);else{const a=Vc(`${t}:scope`,r);o=s=>s.querySelector(a)!==null}let i=e.parentElement.firstElementChild;for(;i;){if(i!==e&&o(i))return!1;i=i.nextElementSibling}return!0}function Vc(e,t){return t?`${e}>${t}`:e}const ae={IGNORE:"ignore",HIDDEN:"hidden",ALLOW:Dn.ALLOW,MASK:Dn.MASK,MASK_USER_INPUT:Dn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:Dn.MASK_UNLESS_ALLOWLISTED},Cm="data-dd-privacy",VM="hidden",ZM="dd-privacy-",Ma="***",BM="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",qM={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},GM="x";function Jr(e){return`[${Cm}="${e}"], .${ZM}${e}`}function ra(e,t,r){if(r&&r.has(e))return r.get(e);const o=tE(e),n=o?ra(o,t,r):t,i=cE(e),a=sE(i,n);return r&&r.set(e,a),a}function sE(e,t){switch(t){case ae.HIDDEN:case ae.IGNORE:return t}switch(e){case ae.ALLOW:case ae.MASK:case ae.MASK_USER_INPUT:case ae.MASK_UNLESS_ALLOWLISTED:case ae.HIDDEN:case ae.IGNORE:return e;default:return t}}function cE(e){if(yr(e)){if(e.tagName==="BASE")return ae.ALLOW;if(e.tagName==="INPUT"){const t=e;if(t.type==="password"||t.type==="email"||t.type==="tel"||t.type==="hidden")return ae.MASK;const r=t.getAttribute("autocomplete");if(r&&(r.startsWith("cc-")||r.endsWith("-password")))return ae.MASK}if(e.matches(Jr(ae.HIDDEN)))return ae.HIDDEN;if(e.matches(Jr(ae.MASK)))return ae.MASK;if(e.matches(Jr(ae.MASK_UNLESS_ALLOWLISTED)))return ae.MASK_UNLESS_ALLOWLISTED;if(e.matches(Jr(ae.MASK_USER_INPUT)))return ae.MASK_USER_INPUT;if(e.matches(Jr(ae.ALLOW)))return ae.ALLOW;if(WM(e))return ae.IGNORE}}function Nm(e,t){switch(t){case ae.MASK:case ae.HIDDEN:case ae.IGNORE:return!0;case ae.MASK_UNLESS_ALLOWLISTED:return Mu(e)?wa(e.parentNode)?!0:!dE(e.textContent||""):wa(e);case ae.MASK_USER_INPUT:return Mu(e)?wa(e.parentNode):wa(e);default:return!1}}function lE(e,t,r,o,n){if(o!==ae.MASK&&o!==ae.MASK_UNLESS_ALLOWLISTED||t===Cm||oE.includes(t)||t===n.actionNameAttribute)return!1;switch(t){case"title":case"alt":case"placeholder":return!0}return!!(e==="A"&&t==="href"||e==="IFRAME"&&t==="srcdoc"||r&&t.startsWith("data-")||(e==="IMG"||e==="SOURCE")&&(t==="src"||t==="srcset"))}function wa(e){if(!e||e.nodeType!==e.ELEMENT_NODE)return!1;const t=e;if(t.tagName==="INPUT")switch(t.type){case"button":case"color":case"reset":case"submit":return!1}return!!qM[t.tagName]}const uE=e=>e.replace(/\S/g,GM);function HM(e,t){var r;const o=(r=e.parentElement)===null||r===void 0?void 0:r.tagName;let n=e.textContent||"";if(o==="HEAD"&&!n.trim())return;const a=t;if(o==="SCRIPT")n=Ma;else if(a===ae.HIDDEN)n=Ma;else if(Nm(e,a))if(o==="DATALIST"||o==="SELECT"||o==="OPTGROUP"){if(!n.trim())return}else o==="OPTION"?n=Ma:a===ae.MASK_UNLESS_ALLOWLISTED?n=fE(n):n=uE(n);return n}function WM(e){if(e.nodeName==="SCRIPT")return!0;if(e.nodeName==="LINK"){const r=t("rel");return/preload|prefetch/i.test(r)&&t("as")==="script"||r==="shortcut icon"||r==="icon"}if(e.nodeName==="META"){const r=t("name"),o=t("rel"),n=t("property");return/^msapplication-tile(image|color)$/.test(r)||r==="application-name"||o==="icon"||o==="apple-touch-icon"||o==="shortcut icon"||r==="keywords"||r==="description"||/^(og|twitter|fb):/.test(n)||/^(og|twitter):/.test(r)||r==="pinterest"||r==="robots"||r==="googlebot"||r==="bingbot"||e.hasAttribute("http-equiv")||r==="author"||r==="generator"||r==="framework"||r==="publisher"||r==="progid"||/^article:/.test(n)||/^product:/.test(n)||r==="google-site-verification"||r==="yandex-verification"||r==="csrf-token"||r==="p:domain_verify"||r==="verify-v1"||r==="verification"||r==="shopify-checkout-api-token"}function t(r){return(e.getAttribute(r)||"").toLowerCase()}return!1}function dE(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function fE(e,t){return dE(e)?e:t||uE(e)}const mE=Ke,JM=100;function KM(e,t){const r=[];let o=0,n;i(e);function i(c){c.stopObservable.subscribe(a),r.push(c),vt(n),n=Je(s,mE)}function a(){o===1&&r.every(c=>c.isStopped())&&(o=2,t(r))}function s(){vt(n),o===0&&(o=1,a())}return{tryAppend:c=>o!==0?!1:r.length>0&&!YM(r[r.length-1].event,c.event)?(s(),!1):(i(c),!0),stop:()=>{s()}}}function YM(e,t){return e.target===t.target&&XM(e,t)<=JM&&e.timeStamp-t.timeStamp<=mE}function XM(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function QM(e,t,r=ae.ALLOW){const o=new Map,{actionNameAttribute:n}=t,i=qg(e,Fc)||n&&qg(e,n);return i?{name:i,nameSource:"custom_attribute"}:r===ae.MASK?{name:nE,nameSource:"mask_placeholder"}:Gg(e,e4,t,o)||Gg(e,t4,t,o)||{name:"",nameSource:"blank"}}function qg(e,t){const r=e.closest(`[${t}]`);if(!r)return;const o=r.getAttribute(t);return gE(pE(o.trim()))}const e4=[(e,t,r)=>{if("labels"in e&&e.labels&&e.labels.length>0)return Ua(e.labels[0],t,r)},e=>{if(e.nodeName==="INPUT"){const t=e,r=t.getAttribute("type");if(r==="button"||r==="submit"||r==="reset")return{name:t.value,nameSource:"text_content"}}},(e,t,r)=>{if(e.nodeName==="BUTTON"||e.nodeName==="LABEL"||e.getAttribute("role")==="button")return Ua(e,t,r)},(e,t,r)=>zo(e,"aria-label",t,r),(e,t,r)=>{const o=e.getAttribute("aria-labelledby");if(o)return{name:o.split(/\s+/).map(n=>n4(e,n)).filter(n=>!!n).map(n=>hE(n,t,r)).join(" "),nameSource:"text_content"}},(e,t,r)=>zo(e,"alt",t,r),(e,t,r)=>zo(e,"name",t,r),(e,t,r)=>zo(e,"title",t,r),(e,t,r)=>zo(e,"placeholder",t,r),(e,t,r)=>{if("options"in e&&e.options.length>0)return Ua(e.options[0],t,r)}],t4=[(e,t,r)=>Ua(e,t,r)],r4=10;function Gg(e,t,r,o){let n=e,i=0;for(;i<=r4&&n&&n.nodeName!=="BODY"&&n.nodeName!=="HTML"&&n.nodeName!=="HEAD";){for(const a of t){const s=a(n,r,o);if(s){const{name:c,nameSource:l}=s,u=c&&c.trim();if(u)return{name:gE(pE(u)),nameSource:l}}}if(n.nodeName==="FORM")break;n=n.parentElement,i+=1}}function pE(e){return e.replace(/\s+/g," ")}function gE(e){return e.length>100?`${gm(e,100)} [...]`:e}function n4(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}function zo(e,t,r,o){const{enablePrivacyForActionName:n,defaultPrivacyLevel:i}=r;let a=e.getAttribute(t);if(a&&n){const s=ra(e,i,o);lE(e.tagName,t,a,s,r)&&(a=fE(a,nE))}else a||(a="");return{name:a,nameSource:"standard_attribute"}}function Ua(e,t,r){return{name:hE(e,t,r)||"",nameSource:"text_content"}}function hE(e,t,r){if(e.isContentEditable)return;const{enablePrivacyForActionName:o,actionNameAttribute:n,defaultPrivacyLevel:i}=t;if(Yi(Dr.USE_TREE_WALKER_FOR_ACTION_NAME))return o4(e,n,o,i,r);if("innerText"in e){let a=e.innerText;const s=c=>{const l=e.querySelectorAll(c);for(let u=0;u<l.length;u+=1){const d=l[u];if("innerText"in d){const f=d.innerText;f&&f.trim().length>0&&(a=a.replace(f,""))}}};return s(`[${Fc}]`),n&&s(`[${n}]`),o&&s(`${Jr(ae.HIDDEN)}, ${Jr(ae.MASK)}`),a}return e.textContent}function o4(e,t,r,o,n){const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,s);let a="";for(;i.nextNode();){const c=i.currentNode;if(yr(c)){(c.nodeName==="BR"||c.nodeName==="P"||["block","flex","grid","list-item","table","table-caption"].includes(getComputedStyle(c).display))&&(a+=" ");continue}a+=c.textContent||""}return a.replace(/\s+/g," ").trim();function s(c){const l=ra(c,o,n);if(r&&l&&Nm(c,l))return NodeFilter.FILTER_REJECT;if(yr(c)){if(c.hasAttribute(Fc)||t&&c.hasAttribute(t))return NodeFilter.FILTER_REJECT;const u=getComputedStyle(c);if(u.visibility!=="visible"||u.display==="none"||u.contentVisibility&&u.contentVisibility!=="visible")return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT}}function i4(e,{onPointerDown:t,onPointerUp:r}){let o,n={selection:!1,input:!1,scroll:!1},i;const a=[Oe(e,window,"pointerdown",s=>{Wg(s)&&(o=Hg(),n={selection:!1,input:!1,scroll:!1},i=t(s))},{capture:!0}),Oe(e,window,"selectionchange",()=>{(!o||!Hg())&&(n.selection=!0)},{capture:!0}),Oe(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),Oe(e,window,"pointerup",s=>{if(Wg(s)&&i){const c=n;r(i,s,()=>c),i=void 0}},{capture:!0}),Oe(e,window,"input",()=>{n.input=!0},{capture:!0})];return{stop:()=>{a.forEach(s=>s.stop())}}}function Hg(){const e=window.getSelection();return!e||e.isCollapsed}function Wg(e){return e.target instanceof Element&&e.isPrimary!==!1}const Jg=3;function a4(e,t){if(s4(e))return t.addFrustration(jo.RAGE_CLICK),e.some(Kg)&&t.addFrustration(jo.DEAD_CLICK),t.hasError&&t.addFrustration(jo.ERROR_CLICK),{isRage:!0};const r=e.some(o=>o.getUserActivity().selection);return e.forEach(o=>{o.hasError&&o.addFrustration(jo.ERROR_CLICK),Kg(o)&&!r&&o.addFrustration(jo.DEAD_CLICK)}),{isRage:!1}}function s4(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(Jg-1);t+=1)if(e[t+Jg-1].event.timeStamp-e[t].event.timeStamp<=Ke)return!0;return!1}const c4='input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="range"]),textarea,select,[contenteditable],[contenteditable] *,canvas,a[href],a[href] *';function Kg(e){if(e.hasPageActivity||e.getUserActivity().input||e.getUserActivity().scroll)return!1;let t=e.event.target;return t.tagName==="LABEL"&&t.hasAttribute("for")&&(t=document.getElementById(t.getAttribute("for"))),!t||!t.matches(c4)}const vE=10*Ke,Go=new Map;function l4(e){const t=Go.get(e);return Go.delete(e),t}function yE(e,t){Go.set(e,t),Go.forEach((r,o)=>{Ne(o,_t())>vE&&Go.delete(o)})}const u4=5*lt;function d4(e,t,r,o){const n=wo({expireDelay:u4}),i=new ge;let a;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===Ln.UNLOADING&&u()});const{stop:s}=i4(o,{onPointerDown:d=>f4(o,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:f},m,h)=>{m4(o,e,t,r,n,i,l,d,m,h,f)}});return{stop:()=>{u(),i.notify(),s()},actionContexts:{findActionId:d=>n.findAll(d)}};function l(d){if(!a||!a.tryAppend(d)){const f=d.clone();a=KM(d,m=>{g4(m,f)})}}function u(){a&&a.stop()}}function f4(e,t,r,o,n){let i;if(e.enablePrivacyForActionName?i=ra(o.target,e.defaultPrivacyLevel):i=ae.ALLOW,i===ae.HIDDEN)return;const a=p4(o,i,e);let s=!1;return Am(t,r,n,e,c=>{s=c.hadActivity},rE),{clickActionBase:a,hadActivityOnPointerDown:()=>s}}function m4(e,t,r,o,n,i,a,s,c,l,u){var d;const f=bE(t,n,l,s,c);a(f);const m=(d=s?.target)===null||d===void 0?void 0:d.selector;m&&yE(c.timeStamp,m);const{stop:h}=Am(t,r,o,e,b=>{b.hadActivity&&b.end<f.startClocks.timeStamp?f.discard():b.hadActivity?f.stop(b.end):u()?f.stop(f.startClocks.timeStamp):f.stop()},vE),g=t.subscribe(5,({endClocks:b})=>{f.stop(b.timeStamp)}),y=i.subscribe(()=>{f.stop()});f.stopObservable.subscribe(()=>{g.unsubscribe(),h(),y.unsubscribe()})}function p4(e,t,r){const o=e.target.getBoundingClientRect(),n=ta(e.target,r.actionNameAttribute);n&&yE(e.timeStamp,n);const{name:i,nameSource:a}=QM(e.target,r,t);return{type:Lc.CLICK,target:{width:Math.round(o.width),height:Math.round(o.height),selector:n},position:{x:Math.round(e.clientX-o.left),y:Math.round(e.clientY-o.top)},name:i,nameSource:a}}function bE(e,t,r,o,n){const i=et(),a=Ue(),s=t.add(i,a.relative),c=Qk({lifeCycle:e,isChildEvent:h=>h.action!==void 0&&(Array.isArray(h.action.id)?h.action.id.includes(i):h.action.id===i)});let l=0,u;const d=[],f=new ge;function m(h){l===0&&(u=h,l=1,u?s.close(pm(u)):s.remove(),c.stop(),f.notify())}return{event:n,stop:m,stopObservable:f,get hasError(){return c.eventCounts.errorCount>0},get hasPageActivity(){return u!==void 0},getUserActivity:r,addFrustration:h=>{d.push(h)},startClocks:a,isStopped:()=>l===1||l===2,clone:()=>bE(e,t,r,o,n),validate:h=>{if(m(),l!==1)return;const{resourceCount:g,errorCount:y,longTaskCount:b}=c.eventCounts,w={duration:u&&Ne(a.timeStamp,u),startClocks:a,id:i,frustrationTypes:d,counts:{resourceCount:g,errorCount:y,longTaskCount:b},events:h??[n],event:n,...o};e.notify(0,w),l=2},discard:()=>{m(),l=2}}}function g4(e,t){const{isRage:r}=a4(e,t);r?(e.forEach(o=>o.discard()),t.stop(Be()),t.validate(e.map(o=>o.event))):(t.discard(),e.forEach(o=>o.validate()))}function h4(e,t,r,o,n){const{unsubscribe:i}=e.subscribe(0,c=>{e.notify(12,Yg(c))});t.register(0,({startTime:c,eventType:l})=>{if(l!==te.ERROR&&l!==te.RESOURCE&&l!==te.LONG_TASK)return wt;const u=a.findActionId(c);return u?{type:l,action:{id:u}}:wt}),t.register(1,({startTime:c})=>({action:{id:a.findActionId(c)}}));let a={findActionId:_e},s=_e;return n.trackUserInteractions&&({actionContexts:a,stop:s}=d4(e,r,o,n)),{addAction:c=>{e.notify(12,Yg(c))},actionContexts:a,stop:()=>{i(),s()}}}function Yg(e){const t=jl(e)?{action:{id:e.id,loading_time:Xk(oe(e.duration)),frustration:{type:e.frustrationTypes},error:{count:e.counts.errorCount},long_task:{count:e.counts.longTaskCount},resource:{count:e.counts.resourceCount}},_dd:{action:{target:e.target,position:e.position,name_source:e.nameSource}}}:{context:e.context},r=vr({action:{id:et(),target:{name:e.name},type:e.type},date:e.startClocks.timeStamp,type:te.ACTION},t),o=jl(e)?e.duration:void 0,n=jl(e)?{events:e.events}:{handlingStack:e.handlingStack};return{rawRumEvent:r,duration:o,startTime:e.startClocks.relative,domainContext:n}}function jl(e){return e.type!==Lc.CUSTOM}function v4(e){const t=WD([Oc.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function y4(e,t){const r=N2(e,[si.cspViolation,si.intervention]).subscribe(o=>t.notify(o));return{stop:()=>{r.unsubscribe()}}}function b4(e,t,r){const o=new ge;return r.subscribe(n=>{n.type===0&&o.notify(n.error)}),v4(o),y4(t,o),o.subscribe(n=>e.notify(14,{error:n})),_4(e)}function _4(e){return e.subscribe(14,({error:t})=>{e.notify(12,w4(t))}),{addError:({error:t,handlingStack:r,componentStack:o,startClocks:n,context:i})=>{const a=bm({originalError:t,handlingStack:r,componentStack:o,startClocks:n,nonErrorPrefix:"Provided",source:vo.CUSTOM,handling:"handled"});a.context=vr(a.context,i),e.notify(14,{error:a})}}}function w4(e){const t={date:e.startClocks.timeStamp,error:{id:et(),message:e.message,source:e.source,stack:e.stack,handling_stack:e.handlingStack,component_stack:e.componentStack,type:e.type,handling:e.handling,causes:e.causes,source_type:"browser",fingerprint:e.fingerprint,csp:e.csp},type:te.ERROR,context:e.context},r={error:e.originalError,handlingStack:e.handlingStack};return{rawRumEvent:t,startTime:e.startClocks.relative,domainContext:r}}const Xg=new WeakSet;function x4(e){if(!performance||!("getEntriesByName"in performance))return;const t=performance.getEntriesByName(e.url,"resource");if(!t.length||!("toJSON"in t[0]))return;const r=t.filter(o=>!Xg.has(o)).filter(o=>Hk(o)&&Wk(o)).filter(o=>S4(o,e.startClocks.relative,_E({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return Xg.add(r[0]),r[0].toJSON()}function _E(e){return go(e.startTime,e.duration)}function S4(e,t,r){return e.startTime>=t-1&&_E(e)<=go(r,1)}const k4=2*lt;function E4(e){const t=I4(e)||T4(e);if(!(!t||t.traceTime<=ct()-k4))return t.traceId}function I4(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return wE(t&&t.content,r&&r.content)}function T4(e){const t=$4(e);if(t)return wE(ii(t,"trace-id"),ii(t,"trace-time"))}function wE(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function $4(e){for(let t=0;t<e.childNodes.length;t+=1){const r=Qg(e.childNodes[t]);if(r)return r}if(e.body)for(let t=e.body.childNodes.length-1;t>=0;t-=1){const r=e.body.childNodes[t],o=Qg(r);if(o)return o;if(!Mu(r))break}}function Qg(e){if(e&&TM(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function xE(){if(Zr(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=O4(),t={entryType:exports.RumPerformanceEntryType.NAVIGATION,initiatorType:"navigation",name:window.location.href,startTime:0,duration:e.loadEventEnd,decodedBodySize:0,encodedBodySize:0,transferSize:0,workerStart:0,toJSON:()=>({...t,toJSON:void 0}),...e};return t}function O4(){const e={},t=performance.timing;for(const r in t)if(Gi(t[r])){const o=r,n=t[o];e[o]=n===0?0:pm(n)}return e}function A4(e,t,r=xE){Em(e,"interactive",()=>{const o=r(),n=Object.assign(o.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:qk,duration:o.responseEnd,traceId:E4(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const C4=1e3;function N4(e){const t=new Set,r=e.subscribe(8,o=>{t.add(o),t.size>C4&&(_o("Too many requests"),t.delete(t.values().next().value))});return{getMatchingRequest(o){let n=1/0,i;for(const a of t){const s=o.startTime-a.startClocks.relative;0<=s&&s<n&&a.url===o.name&&(n=Math.abs(s),i=a)}return i&&t.delete(i),i},stop(){r.unsubscribe()}}}function R4(e,t,r,o=HD(),n=A4){let i;const a=t.trackEarlyRequests;a?i=N4(e):e.subscribe(8,l=>{c(()=>P4(l,t,r))});const s=ir(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(l=>{for(const u of l)(a||!Gk(u))&&c(()=>eh(u,t,r,i))});n(t,l=>{c(()=>eh(l,t,r,i))});function c(l){o.push(()=>{const u=l();u&&e.notify(12,u)})}return{stop:()=>{o.stop(),s.unsubscribe()}}}function P4(e,t,r){const o=x4(e);return SE(o,e,r,t)}function eh(e,t,r,o){const n=Gk(e)&&o?o.getMatchingRequest(e):void 0;return SE(e,n,r,t)}function SE(e,t,r,o){if(!e&&!t)return;const n=t?M4(t,o):U4(e,o);if(!o.trackResources&&!n)return;const i=e?Hi(e.startTime):t.startClocks,a=e?aM(e):L4(r,i,t.duration),s=t&&j4(t,o),c=vr({date:i.timeStamp,resource:{id:et(),duration:oe(a),type:t?t.type===Uc.XHR?at.XHR:at.FETCH:iM(e),method:t?t.method:void 0,status_code:t?t.status:F4(e.responseStatus),url:t?Jk(t.url):e.name,protocol:e&&lM(e),delivery_type:e&&uM(e),graphql:s},type:te.RESOURCE,_dd:{discarded:!o.trackResources}},n,e&&z4(e));return{startTime:i.relative,duration:a,rawRumEvent:c,domainContext:D4(e,t)}}function j4(e,t){const r=Kk(e.url,t);if(r)return gM(e,r)}function D4(e,t){if(t){const r={performanceEntry:e,isAborted:t.isAborted,handlingStack:t.handlingStack};return t.type===Uc.XHR?{xhr:t.xhr,...r}:{requestInput:t.input,requestInit:t.init,response:t.response,error:t.error,...r}}return{performanceEntry:e}}function z4(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...dM(e),...sM(e)}}}function M4(e,t){if(e.traceSampled&&e.traceId&&e.spanId)return{_dd:{span_id:e.spanId.toString(),trace_id:e.traceId.toString(),rule_psr:t.rulePsr}}}function U4(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:Lk().toString(),rule_psr:t.rulePsr}}}function L4(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function F4(e){return e===0?void 0:e}function V4(e,t,r){const{stop:o,eventCounts:n}=Qk({lifeCycle:e,isChildEvent:i=>i.view.id===t,onChange:r});return{stop:o,eventCounts:n}}const Z4=10*lt;function B4(e,t,r){return{stop:ir(e,{type:exports.RumPerformanceEntryType.PAINT,buffered:!0}).subscribe(n=>{const i=n.find(a=>a.name==="first-contentful-paint"&&a.startTime<t.timeStamp&&a.startTime<Z4);i&&r(i.startTime)}).unsubscribe}}function q4(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(Ne(e,_t()))})})}function G4(e,t,r){const o=ir(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(n=>{const i=n.find(a=>a.startTime<t.timeStamp);if(i){const a=Ne(i.startTime,i.processingStart);let s;i.target&&yr(i.target)&&(s=ta(i.target,e.actionNameAttribute)),r({delay:a>=0?a:0,time:i.startTime,targetSelector:s})}});return{stop:()=>{o.unsubscribe()}}}function H4(e,t,r=xE){return K4(e,()=>{const o=r();J4(o)||t(W4(o))})}function W4(e){return{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEvent:e.loadEventEnd,firstByte:e.responseStart>=0&&e.responseStart<=_t()?e.responseStart:void 0}}function J4(e){return e.loadEventEnd<=0}function K4(e,t){let r;const{stop:o}=Em(e,"complete",()=>{r=Je(()=>t())});return{stop:()=>{o(),vt(r)}}}const Y4=10*lt;function X4(e,t,r,o){let n=1/0;const{stop:i}=hr(e,r,["pointerdown","keydown"],c=>{n=c.timeStamp},{capture:!0,once:!0});let a=0;const s=ir(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(c=>{const l=LS(c,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<Y4&&u.size>a);if(l){let u;l.element&&(u=ta(l.element,e.actionNameAttribute)),o({value:l.startTime,targetSelector:u,resourceUrl:Q4(l)}),a=l.size}});return{stop:()=>{i(),s.unsubscribe()}}}function Q4(e){return e.url===""?void 0:e.url}function kE(e,t,r=window){if(document.visibilityState==="hidden")return{timeStamp:0,stop:_e};if(Zr(exports.RumPerformanceEntryType.VISIBILITY_STATE)){const i=performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).filter(a=>a.name==="hidden").find(a=>a.startTime>=t.relative);if(i)return{timeStamp:i.startTime,stop:_e}}let o=1/0;const{stop:n}=hr(e,r,["pagehide","visibilitychange"],i=>{(i.type==="pagehide"||document.visibilityState==="hidden")&&(o=i.timeStamp,n())},{capture:!0});return{get timeStamp(){return o},stop:n}}function eU(e,t,r,o){const n={},{stop:i}=H4(e,d=>{r(d.loadEvent),n.navigationTimings=d,o()}),a=kE(e,t),{stop:s}=B4(e,a,d=>{n.firstContentfulPaint=d,o()}),{stop:c}=X4(e,a,window,d=>{n.largestContentfulPaint=d,o()}),{stop:l}=G4(e,a,d=>{n.firstInput=d,o()});function u(){i(),s(),c(),l(),a.stop()}return{stop:u,initialViewMetrics:n}}const Uu=(e,t)=>e*t,tU=(e,t)=>{const r=Math.max(e.left,t.left),o=Math.max(e.top,t.top),n=Math.min(e.right,t.right),i=Math.min(e.bottom,t.bottom);return r>=n||o>=i?0:Uu(n-r,i-o)},th=e=>{const t=Uu(e.previousRect.width,e.previousRect.height),r=Uu(e.currentRect.width,e.currentRect.height),o=tU(e.previousRect,e.currentRect);return t+r-o};function rU(e,t,r){if(!sU())return{stop:_e};let o=0,n;r({value:0});const i=aU(),a=ir(e,{type:exports.RumPerformanceEntryType.LAYOUT_SHIFT,buffered:!0}).subscribe(s=>{var c;for(const l of s){if(l.hadRecentInput||l.startTime<t)continue;const{cumulatedValue:u,isMaxValue:d}=i.update(l);if(d){const f=nU(l.sources);n={target:f?.node?new WeakRef(f.node):void 0,time:Ne(t,l.startTime),previousRect:f?.previousRect,currentRect:f?.currentRect,devicePixelRatio:window.devicePixelRatio}}if(u>o){o=u;const f=(c=n?.target)===null||c===void 0?void 0:c.deref();r({value:Bo(o,4),targetSelector:f&&ta(f,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?rh(n.previousRect):void 0,currentRect:n?.currentRect?rh(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{a.unsubscribe()}}}function nU(e){let t;for(const r of e)if(r.node&&yr(r.node)){const o=th(r);(!t||th(t)<o)&&(t=r)}return t}function rh({x:e,y:t,width:r,height:o}){return{x:e,y:t,width:r,height:o}}const oU=5*Ke,iU=Ke;function aU(){let e=0,t,r,o=0;return{update:n=>{const i=t===void 0||n.startTime-r>=iU||n.startTime-t>=oU;let a;return i?(t=r=n.startTime,o=e=n.value,a=!0):(e+=n.value,r=n.startTime,a=n.value>o,a&&(o=n.value)),{cumulatedValue:e,isMaxValue:a}}}}function sU(){return Zr(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let La,EE=0,Dl=1/0,zl=0;function cU(){"interactionCount"in performance||La||(La=new window.PerformanceObserver(ne(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(Dl=Math.min(Dl,r.interactionId),zl=Math.max(zl,r.interactionId),EE=(zl-Dl)/7+1)})})),La.observe({type:"event",buffered:!0,durationThreshold:0}))}const nh=()=>La?EE:window.performance.interactionCount||0,oh=10,lU=1*lt;function uU(e,t,r){if(!mU())return{getInteractionToNextPaint:()=>{},setViewEnd:_e,stop:_e};const{getViewInteractionCount:o,stopViewInteractionCount:n}=fU(r);let i=1/0;const a=dU(o);let s=-1,c,l;function u(m){for(const g of m)g.interactionId&&g.startTime>=t&&g.startTime<=i&&a.process(g);const h=a.estimateP98Interaction();h&&h.duration!==s&&(s=h.duration,l=Ne(t,h.startTime),c=l4(h.startTime),!c&&h.target&&yr(h.target)&&(c=ta(h.target,e.actionNameAttribute)))}const d=ir(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),f=ir(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,lU),targetSelector:c,time:l};if(o())return{value:0}},setViewEnd:m=>{i=m,n()},stop:()=>{f.unsubscribe(),d.unsubscribe()}}}function dU(e){const t=[];function r(){t.sort((o,n)=>n.duration-o.duration).splice(oh)}return{process(o){const n=t.findIndex(a=>o.interactionId===a.interactionId),i=t[t.length-1];n!==-1?o.duration>t[n].duration&&(t[n]=o,r()):(t.length<oh||o.duration>i.duration)&&(t.push(o),r())},estimateP98Interaction(){const o=Math.min(t.length-1,Math.floor(e()/50));return t[o]}}}function fU(e){cU();const t=e===dr.INITIAL_LOAD?0:nh();let r={stopped:!1};function o(){return nh()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:o(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:o()}}}}function mU(){return Zr(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function pU(e,t,r,o,n,i,a){let s=n===dr.INITIAL_LOAD,c=!0;const l=[],u=kE(o,i);function d(){if(!c&&!s&&l.length>0){const m=Math.max(...l);m<u.timeStamp-i.relative&&a(m)}}const{stop:f}=Am(e,t,r,o,m=>{c&&(c=!1,m.hadActivity&&l.push(Ne(i.timeStamp,m.end)),d())});return{stop:()=>{f(),u.stop()},setLoadEvent:m=>{s&&(s=!1,l.push(m),d())}}}function gU(){let e;const t=window.visualViewport;return t?e=t.pageLeft-t.offsetLeft:window.scrollX!==void 0?e=window.scrollX:e=window.pageXOffset||0,Math.round(e)}function IE(){let e;const t=window.visualViewport;return t?e=t.pageTop-t.offsetTop:window.scrollY!==void 0?e=window.scrollY:e=window.pageYOffset||0,Math.round(e)}let Ml;function TE(e){return Ml||(Ml=hU(e)),Ml}function hU(e){return new ge(t=>{const{throttled:r}=Ji(()=>{t.notify(Zc())},200);return Oe(e,window,"resize",r,{capture:!0,passive:!0}).stop})}function Zc(){const e=window.visualViewport;return e?{width:Number(e.width*e.scale),height:Number(e.height*e.scale)}:{width:Number(window.innerWidth||0),height:Number(window.innerHeight||0)}}const vU=Ke;function yU(e,t,r,o=_U(e)){let n=0,i=0,a=0;const s=o.subscribe(({scrollDepth:c,scrollTop:l,scrollHeight:u})=>{let d=!1;if(c>n&&(n=c,d=!0),u>i){i=u;const f=_t();a=Ne(t.relative,f),d=!0}d&&r({maxDepth:Math.min(n,i),maxDepthScrollTop:l,maxScrollHeight:i,maxScrollHeightTime:a})});return{stop:()=>s.unsubscribe()}}function bU(){const e=IE(),{height:t}=Zc(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),o=Math.round(t+e);return{scrollHeight:r,scrollDepth:o,scrollTop:e}}function _U(e,t=vU){return new ge(r=>{function o(){r.notify(bU())}if(window.ResizeObserver){const n=Ji(o,t,{leading:!1,trailing:!0}),i=document.scrollingElement||document.documentElement,a=new ResizeObserver(ne(n.throttled));i&&a.observe(i);const s=Oe(e,window,"scroll",n.throttled,{passive:!0});return()=>{n.cancel(),a.disconnect(),s.stop()}}})}function wU(e,t,r,o,n,i,a){const s={},{stop:c,setLoadEvent:l}=pU(e,t,r,o,i,a,g=>{s.loadingTime=g,n()}),{stop:u}=yU(o,a,g=>{s.scroll=g}),{stop:d}=rU(o,a.relative,g=>{s.cumulativeLayoutShift=g,n()}),{stop:f,getInteractionToNextPaint:m,setViewEnd:h}=uU(o,a.relative,i);return{stop:()=>{c(),d(),u()},stopINPTracking:f,setLoadEvent:l,setViewEnd:h,getCommonViewMetrics:()=>(s.interactionToNextPaint=m(),s)}}function xU(e,t){const{stop:r}=Oe(e,window,"pageshow",o=>{o.persisted&&t(o)},{capture:!0});return r}function SU(e,t,r){q4(e.relative,o=>{t.firstContentfulPaint=o,t.largestContentfulPaint={value:o},r()})}const kU=3e3,EU=5*lt,IU=5*lt;function TU(e,t,r,o,n,i,a,s){const c=new Set;let l=f(dr.INITIAL_LOAD,mm(),s),u;m();let d;a&&(d=h(i),n.trackBfcacheViews&&(u=xU(n,g=>{l.end();const y=Hi(g.timeStamp);l=f(dr.BF_CACHE,y,void 0)})));function f(g,y,b){const w=$U(t,r,o,n,e,g,y,b);return c.add(w),w.stopObservable.subscribe(()=>{c.delete(w)}),w}function m(){t.subscribe(10,()=>{l=f(dr.ROUTE_CHANGE,void 0,{name:l.name,service:l.service,version:l.version,context:l.contextManager.getContext()})}),t.subscribe(9,()=>{l.end({sessionIsActive:!1})})}function h(g){return g.subscribe(({oldLocation:y,newLocation:b})=>{AU(y,b)&&(l.end(),l=f(dr.ROUTE_CHANGE))})}return{addTiming:(g,y=Be())=>{l.addTiming(g,y)},startView:(g,y)=>{l.end({endClocks:y}),l=f(dr.ROUTE_CHANGE,y,g)},setViewContext:g=>{l.contextManager.setContext(g)},setViewContextProperty:(g,y)=>{l.contextManager.setContextProperty(g,y)},setViewName:g=>{l.setViewName(g)},getViewContext:()=>l.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),l.end(),c.forEach(g=>g.stop())}}}function $U(e,t,r,o,n,i,a=Ue(),s){const c=et(),l=new ge,u={};let d=0,f;const m=oi(n),h=Mc();let g=!0,y=s?.name;const b=s?.service||o.service,w=s?.version||o.version,x=s?.context;x&&h.setContext(x);const v={id:c,name:y,startClocks:a,service:b,version:w,context:x};e.notify(1,v),e.notify(2,v);const{throttled:k,cancel:E}=Ji(V,kU,{leading:!1}),{setLoadEvent:I,setViewEnd:A,stop:M,stopINPTracking:U,getCommonViewMetrics:K}=wU(e,t,r,o,se,i,a),{stop:he,initialViewMetrics:q}=i===dr.INITIAL_LOAD?eU(o,a,I,se):{stop:_e,initialViewMetrics:{}};i===dr.BF_CACHE&&SU(a,q,se);const{stop:F,eventCounts:ce}=V4(e,c,se),le=po(V,EU),pe=e.subscribe(11,ye=>{ye.reason===Ln.UNLOADING&&V()});V(),h.changeObservable.subscribe(se);function G(){e.notify(3,{id:c,name:y,context:h.getContext(),startClocks:a,sessionIsActive:g})}function se(){G(),k()}function V(){E(),G(),d+=1;const ye=f===void 0?Be():f.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:c,name:y,service:b,version:w,context:h.getContext(),loadingType:i,location:m,startClocks:a,commonViewMetrics:K(),initialViewMetrics:q,duration:Ne(a.timeStamp,ye),isActive:f===void 0,sessionIsActive:g,eventCounts:ce})}return{get name(){return y},service:b,version:w,contextManager:h,stopObservable:l,end(ye={}){var ue,ve;f||(f=(ue=ye.endClocks)!==null&&ue!==void 0?ue:Ue(),g=(ve=ye.sessionIsActive)!==null&&ve!==void 0?ve:!0,e.notify(5,{endClocks:f}),e.notify(6,{endClocks:f}),Nc(le),A(f.relative),M(),pe.unsubscribe(),V(),Je(()=>{this.stop()},IU))},stop(){he(),F(),U(),l.notify()},addTiming(ye,ue){if(f)return;const ve=WP(ue)?ue:Ne(a.timeStamp,ue);u[OU(ye)]=ve,se()},setViewName(ye){y=ye,V()}}}function OU(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&Q.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function AU(e,t){return e.pathname!==t.pathname||!CU(t.hash)&&ih(t.hash)!==ih(e.hash)}function CU(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function ih(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function NU(e,t,r,o,n,i,a,s,c,l){return e.subscribe(4,u=>e.notify(12,RU(u,r,s))),t.register(0,({startTime:u,eventType:d})=>{const f=c.findView(u);return f?{type:d,service:f.service,version:f.version,context:f.context,view:{id:f.id,name:f.name}}:zr}),t.register(1,({startTime:u})=>{var d;return{view:{id:(d=c.findView(u))===null||d===void 0?void 0:d.id}}}),TU(o,e,n,i,r,a,!r.trackViewsManually,l)}function RU(e,t,r){var o,n,i,a,s,c,l,u,d,f,m,h,g,y,b,w,x,v;const k=r.getReplayStats(e.id),E=(n=(o=e.commonViewMetrics)===null||o===void 0?void 0:o.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,I={_dd:{document_version:e.documentVersion,replay_stats:k,cls:E?{device_pixel_ratio:E}:void 0,configuration:{start_session_replay_recording_manually:t.startSessionReplayRecordingManually}},date:e.startClocks.timeStamp,type:te.VIEW,view:{action:{count:e.eventCounts.actionCount},frustration:{count:e.eventCounts.frustrationCount},cumulative_layout_shift:(i=e.commonViewMetrics.cumulativeLayoutShift)===null||i===void 0?void 0:i.value,cumulative_layout_shift_time:oe((a=e.commonViewMetrics.cumulativeLayoutShift)===null||a===void 0?void 0:a.time),cumulative_layout_shift_target_selector:(s=e.commonViewMetrics.cumulativeLayoutShift)===null||s===void 0?void 0:s.targetSelector,first_byte:oe((c=e.initialViewMetrics.navigationTimings)===null||c===void 0?void 0:c.firstByte),dom_complete:oe((l=e.initialViewMetrics.navigationTimings)===null||l===void 0?void 0:l.domComplete),dom_content_loaded:oe((u=e.initialViewMetrics.navigationTimings)===null||u===void 0?void 0:u.domContentLoaded),dom_interactive:oe((d=e.initialViewMetrics.navigationTimings)===null||d===void 0?void 0:d.domInteractive),error:{count:e.eventCounts.errorCount},first_contentful_paint:oe(e.initialViewMetrics.firstContentfulPaint),first_input_delay:oe((f=e.initialViewMetrics.firstInput)===null||f===void 0?void 0:f.delay),first_input_time:oe((m=e.initialViewMetrics.firstInput)===null||m===void 0?void 0:m.time),first_input_target_selector:(h=e.initialViewMetrics.firstInput)===null||h===void 0?void 0:h.targetSelector,interaction_to_next_paint:oe((g=e.commonViewMetrics.interactionToNextPaint)===null||g===void 0?void 0:g.value),interaction_to_next_paint_time:oe((y=e.commonViewMetrics.interactionToNextPaint)===null||y===void 0?void 0:y.time),interaction_to_next_paint_target_selector:(b=e.commonViewMetrics.interactionToNextPaint)===null||b===void 0?void 0:b.targetSelector,is_active:e.isActive,name:e.name,largest_contentful_paint:oe((w=e.initialViewMetrics.largestContentfulPaint)===null||w===void 0?void 0:w.value),largest_contentful_paint_target_selector:(x=e.initialViewMetrics.largestContentfulPaint)===null||x===void 0?void 0:x.targetSelector,load_event:oe((v=e.initialViewMetrics.navigationTimings)===null||v===void 0?void 0:v.loadEvent),loading_time:Xk(oe(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:PU(e.commonViewMetrics,e.initialViewMetrics),resource:{count:e.eventCounts.resourceCount},time_spent:oe(e.duration)},display:e.commonViewMetrics.scroll?{scroll:{max_depth:e.commonViewMetrics.scroll.maxDepth,max_depth_scroll_top:e.commonViewMetrics.scroll.maxDepthScrollTop,max_scroll_height:e.commonViewMetrics.scroll.maxScrollHeight,max_scroll_height_time:oe(e.commonViewMetrics.scroll.maxScrollHeightTime)}}:void 0,privacy:{replay_level:t.defaultPrivacyLevel},device:{locale:navigator.language,locales:navigator.languages,time_zone:lz()}};return Vr(e.customTimings)||(I.view.custom_timings=AS(e.customTimings,oe)),{rawRumEvent:I,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function PU({cumulativeLayoutShift:e,interactionToNextPaint:t},{firstContentfulPaint:r,firstInput:o,largestContentfulPaint:n}){return{cls:e&&{score:e.value,timestamp:oe(e.time),target_selector:e.targetSelector,previous_rect:e.previousRect,current_rect:e.currentRect},fcp:r&&{timestamp:oe(r)},fid:o&&{duration:oe(o.delay),timestamp:oe(o.time),target_selector:o.targetSelector},inp:t&&{duration:oe(t.value),timestamp:oe(t.time),target_selector:t.targetSelector},lcp:n&&{timestamp:oe(n.value),target_selector:n.targetSelector,resource_url:n.resourceUrl}}}const jU="rum";function DU(e,t,r){const o=kD(e,jU,n=>MU(e,n),r);return o.expireObservable.subscribe(()=>{t.notify(9)}),o.renewObservable.subscribe(()=>{t.notify(10)}),o.sessionStateUpdateObservable.subscribe(({previousState:n,newState:i})=>{if(!n.forcedReplay&&i.forcedReplay){const a=o.findSession();a&&(a.isReplayForced=!0)}}),{findTrackedSession:n=>{const i=o.findSession(n);if(!(!i||i.trackingType==="0"))return{id:i.id,sessionReplay:i.trackingType==="1"?1:i.isReplayForced?2:0,anonymousId:i.anonymousId}},expire:o.expire,expireObservable:o.expireObservable,setForcedReplay:()=>o.updateSessionState({forcedReplay:"1"})}}function zU(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:bk("records")?1:0};return{findTrackedSession:()=>e,expire:_e,expireObservable:new ge,setForcedReplay:_e}}function MU(e,t){return UU(t)?t:Xr(e.sessionSampleRate)?Xr(e.sessionReplaySampleRate)?"1":"2":"0"}function UU(e){return e==="0"||e==="1"||e==="2"}function LU(e,t,r,o,n,i){const a=[e.rumEndpointBuilder];e.replica&&a.push(e.replica.rumEndpointBuilder);const s=wk({encoder:i(2),request:Sm(a,r),flushController:xk({pageMayExitObservable:o,sessionExpireObservable:n})});return t.subscribe(13,c=>{c.type===te.VIEW?s.upsert(c,c.view.id):s.add(c)}),s}function FU(e){const t=yo();e.subscribe(13,r=>{t.send("rum",r)})}const VU=vn;function ZU(e,t,r,o){const n=wo({expireDelay:VU});let i;e.subscribe(1,({startClocks:c})=>{const l=o.href;n.add(s({url:l,referrer:i||document.referrer}),c.relative),i=l}),e.subscribe(6,({endClocks:c})=>{n.closeActive(c.relative)});const a=r.subscribe(({newLocation:c})=>{const l=n.find();if(l){const u=_t();n.closeActive(u),n.add(s({url:c.href,referrer:l.referrer}),u)}});function s({url:c,referrer:l}){return{url:c,referrer:l}}return t.register(0,({startTime:c,eventType:l})=>{const u=n.find(c);return u?{type:l,view:{url:u.url,referrer:u.referrer}}:zr}),{findUrl:c=>n.find(c),stop:()=>{a.unsubscribe(),n.stop()}}}function BU(e,t){let r=oi(t);return new ge(o=>{const{stop:n}=qU(e,a),{stop:i}=GU(e,a);function a(){if(r.href===t.href)return;const s=oi(t);o.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),i()}})}function qU(e,t){const{stop:r}=Bt(ah("pushState"),"pushState",({onPostCall:i})=>{i(t)}),{stop:o}=Bt(ah("replaceState"),"replaceState",({onPostCall:i})=>{i(t)}),{stop:n}=Oe(e,window,"popstate",t);return{stop:()=>{r(),o(),n()}}}function GU(e,t){return Oe(e,window,"hashchange",t)}function ah(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const HU=vn;function WU(e,t,r){const o=wo({expireDelay:HU});return e.subscribe(1,({startClocks:n})=>{o.add({},n.relative)}),e.subscribe(6,({endClocks:n})=>{o.closeActive(n.relative)}),t.register(0,({startTime:n,eventType:i})=>{if(!r.trackFeatureFlagsForEvents.concat([te.VIEW,te.ERROR]).includes(i))return wt;const s=o.find(n);return!s||Vr(s)?wt:{type:i,feature_flags:s}}),{addFeatureFlagEvaluation:(n,i)=>{const a=o.find();a&&(a[n]=i)}}}const JU=10*Ke;let Fn,xa;function KU(e,t,r){e.metricsEnabled&&($E(),xa=!1,t.subscribe(13,()=>{xa=!0}),r.subscribe(({bytesCount:o,messagesCount:n})=>{xa&&(xa=!1,Fn.batchCount+=1,ch(Fn.batchBytesCount,o),ch(Fn.batchMessagesCount,n))}),po(YU,JU))}function YU(){Fn.batchCount!==0&&(ea("Customer data measures",Fn),$E())}function sh(){return{min:1/0,max:0,sum:0}}function ch(e,t){e.sum+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t)}function $E(){Fn={batchCount:0,batchBytesCount:sh(),batchMessagesCount:sh()}}const XU=4e3,QU=500,e6=vn;function t6(e,t,r=QU){const o=wo({expireDelay:e6,maxEntries:XU});let n;Zr(exports.RumPerformanceEntryType.VISIBILITY_STATE)&&performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).forEach(l=>{const u=l.name==="hidden"?"hidden":"active";a(u,l.startTime)}),a(OE(),_t());const{stop:i}=hr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],c=>{a(n6(c),c.timeStamp)},{capture:!0});function a(c,l=_t()){c!==n&&(n=c,o.closeActive(l),o.add({state:n,startTime:l},l))}function s(c,l,u){return o.findAll(l,u).some(d=>d.state===c)}return e.register(0,({startTime:c,duration:l=0,eventType:u})=>{if(u===te.VIEW){const d=o.findAll(c,l);return{type:u,_dd:{page_states:r6(d,c,r)}}}return u===te.ACTION||u===te.ERROR?{type:u,view:{in_foreground:s("active",c,0)}}:wt}),{wasInPageStateDuringPeriod:s,addPageState:a,stop:()=>{i(),o.stop()}}}function r6(e,t,r){if(e.length!==0)return e.slice(-r).reverse().map(({state:o,startTime:n})=>({state:o,start:oe(Ne(t,n))}))}function n6(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":OE()}function OE(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function o6(e,t){let r;const o=requestAnimationFrame(ne(()=>{r=Zc()})),n=TE(t).subscribe(i=>{r=i}).unsubscribe;return e.register(0,({eventType:i})=>({type:i,display:r?{viewport:r}:void 0})),{stop:()=>{n(),o&&cancelAnimationFrame(o)}}}function i6(e,t){const r=window.cookieStore?a6(e):c6;return new ge(o=>r(t,n=>o.notify(n)))}function a6(e){return(t,r)=>Oe(e,window.cookieStore,"change",n=>{const i=n.changed.find(a=>a.name===t)||n.deleted.find(a=>a.name===t);i&&r(i.value)}).stop}const s6=Ke;function c6(e,t){const r=ii(document.cookie,e),o=po(()=>{const n=ii(document.cookie,e);n!==r&&t(n)},s6);return()=>{Nc(o)}}const lh="datadog-ci-visibility-test-execution-id";function l6(e,t,r=i6(e,lh)){var o;let n=Tr(lh)||((o=window.Cypress)===null||o===void 0?void 0:o.env("traceId"));const i=r.subscribe(a=>{n=a});return t.register(0,({eventType:a})=>typeof n!="string"?wt:{type:a,session:{type:"ci_test"},ci_test:{test_execution_id:n}}),{stop:()=>{i.unsubscribe()}}}function u6(e,t){const r=ir(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(o=>{for(const n of o){const i=Hi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:jk.LONG_ANIMATION_FRAME,duration:oe(n.duration),blocking_duration:oe(n.blockingDuration),first_ui_event_timestamp:oe(n.firstUIEventTimestamp),render_start:oe(n.renderStart),style_and_layout_start:oe(n.styleAndLayoutStart),start_time:oe(n.startTime),scripts:n.scripts.map(s=>({duration:oe(s.duration),pause_duration:oe(s.pauseDuration),forced_style_and_layout_duration:oe(s.forcedStyleAndLayoutDuration),start_time:oe(s.startTime),execution_start:oe(s.executionStart),source_url:s.sourceURL,source_function_name:s.sourceFunctionName,source_char_position:s.sourceCharPosition,invoker:s.invoker,invoker_type:s.invokerType,window_attribution:s.windowAttribution}))},type:te.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:a,startTime:i.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop:()=>r.unsubscribe()}}function d6(e,t){const r=ir(t,{type:exports.RumPerformanceEntryType.LONG_TASK,buffered:!0}).subscribe(o=>{for(const n of o){if(n.entryType!==exports.RumPerformanceEntryType.LONG_TASK||!t.trackLongTasks)break;const i=Hi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:jk.LONG_TASK,duration:oe(n.duration)},type:te.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:a,startTime:i.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop(){r.unsubscribe()}}}function f6(e){e.register(0,({eventType:t})=>{if(!Tk())return wt;const r=Ek(),o=Ik();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:o,injected:kk()}}})}function m6(e,t,r){const o=xm(e),n=r(o);return jc(t).forEach(([i,a])=>Lu(e,o,i.split(/\.|(?=\[\])/),a)),n}function Lu(e,t,r,o){const[n,...i]=r;if(n==="[]"){Array.isArray(e)&&Array.isArray(t)&&e.forEach((a,s)=>Lu(a,t[s],i,o));return}if(!(!uh(e)||!uh(t))){if(i.length>0)return Lu(e[n],t[n],i,o);p6(e,n,t[n],o)}}function p6(e,t,r,o){const n=yn(r);n===o?e[t]=$e(r):o==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function uh(e){return yn(e)==="object"}const On={"view.name":"string","view.url":"string","view.referrer":"string"},An={context:"object"},Cn={service:"string",version:"string"};let AE;function g6(e,t,r,o,n){AE={[te.VIEW]:{"view.performance.lcp.resource_url":"string",...An,...On,...Cn},[te.ERROR]:{"error.message":"string","error.stack":"string","error.resource.url":"string","error.fingerprint":"string",...An,...On,...Cn},[te.RESOURCE]:{"resource.url":"string","resource.graphql.variables":"string",...An,...On,...Cn},[te.ACTION]:{"action.target.name":"string",...An,...On,...Cn},[te.LONG_TASK]:{"long_task.scripts[].source_url":"string","long_task.scripts[].invoker":"string",...An,...On,...Cn},[te.VITAL]:{...An,...On,...Cn}};const i={[te.ERROR]:$l(te.ERROR,o,n),[te.ACTION]:$l(te.ACTION,o,n),[te.VITAL]:$l(te.VITAL,o,n)};t.subscribe(12,({startTime:a,duration:s,rawRumEvent:c,domainContext:l})=>{const u=r.triggerHook(0,{eventType:c.type,startTime:a,duration:s});if(u===zr)return;const d=vr(u,c,{ddtags:_m(e).join(",")});h6(d,e.beforeSend,l,i)&&(Vr(d.context)&&delete d.context,t.notify(13,d))})}function h6(e,t,r,o){var n;if(t){const a=m6(e,AE[e.type],s=>t(s,r));if(a===!1&&e.type!==te.VIEW)return!1;a===!1&&Q.warn("Can't dismiss view events using beforeSend!")}return!((n=o[e.type])===null||n===void 0?void 0:n.isLimitReached())}function v6(e,t,r,o){e.register(0,({eventType:n,startTime:i})=>{const a=t.findTrackedSession(i),s=o.findView(i);if(!a||!s)return zr;let c,l,u;return n===te.VIEW?(c=r.getReplayStats(s.id)?!0:void 0,l=a.sessionReplay===1,u=s.sessionIsActive?void 0:!1):c=r.isRecording()?!0:void 0,{type:n,session:{id:a.id,type:"user",has_replay:c,sampled_for_replay:l,is_active:u}}}),e.register(1,({startTime:n})=>{const i=t.findTrackedSession(n);return i?{session:{id:i.id}}:wt})}function y6(e){e.register(0,({eventType:t})=>({type:t,connectivity:dk()}))}function b6(e,t,r){e.register(0,({eventType:o})=>{const n=t.source;return{type:o,_dd:{format_version:2,drift:DS(),configuration:{session_sample_rate:Bo(t.sessionSampleRate,3),session_replay_sample_rate:Bo(t.sessionReplaySampleRate,3),profiling_sample_rate:Bo(t.profilingSampleRate,3),beta_encode_cookie_options:t.betaEncodeCookieOptions},browser_sdk_version:sn()?"6.24.1":void 0,sdk_name:r},application:{id:t.applicationId},date:Be(),source:n}}),e.register(1,()=>({application:{id:t.applicationId}}))}function _6(e,t){e.register(1,()=>t.isGranted()?wt:zr)}const w6=oD,x6=[te.ACTION,te.ERROR,te.LONG_TASK,te.RESOURCE,te.VITAL];function S6(e){return{addEvent:(t,r,o,n)=>{x6.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:o,duration:n})}}}function k6(e,t){if(!t.metricsEnabled)return{stop:_e};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:o})=>{!o.largestContentfulPaint||!o.navigationTimings||(ea("Initial view metrics",{metrics:E6(o.largestContentfulPaint,o.navigationTimings)}),r())});return{stop:r}}function E6(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function I6(e,t,r,o,n,i,a,s,c){const l=[],u=new tM,d=w6();u.subscribe(13,Fe=>wm("rum",Fe));const f=Fe=>{u.notify(14,{error:Fe}),_o("Error reported to customer",{"error.message":Fe.message})},m=tD(e),h=m.subscribe(Fe=>{u.notify(11,Fe)});l.push(()=>h.unsubscribe());const g=lD("browser-rum-sdk",e,d,f,m,n);l.push(g.stop);const y=sn()?zU():DU(e,u,i);if(sn())FU(u);else{const Fe=LU(e,u,f,m,y.expireObservable,n);l.push(()=>Fe.stop()),KU(g,u,Fe.flushController.flushObservable)}const b=Xz(),w=BU(e,location),{observable:x,stop:v}=Qz();l.push(v),b6(d,e,c);const k=t6(d,e),E=nM(u);l.push(()=>E.stop());const I=ZU(u,d,w,location);l.push(()=>I.stop());const A=WU(u,d,e);v6(d,y,t,E),y6(d),_6(d,i);const M=iz(d,e,"rum"),U=az(d,e,y,"rum"),K=oz(d,e,"rum"),{actionContexts:he,addAction:q,addEvent:F,stop:ce}=T6(u,d,e,k,b,x,f);l.push(ce);const{addTiming:le,startView:pe,setViewName:G,setViewContext:se,setViewContextProperty:V,getViewContext:ye,stop:ue}=NU(u,d,e,location,b,x,w,t,E,o);l.push(ue);const{stop:ve}=k6(u,g);l.push(ve);const{stop:P}=R4(u,e,k);if(l.push(P),e.trackLongTasks)if(Zr(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:Fe}=u6(u,e);l.push(Fe)}else d6(u,e);const{addError:H}=b4(u,e,s);s.unbuffer(),bM(u,e,y,U,K);const me=dz(u,k,a),Te=eM(e.applicationId,y,E,he,I);return l.push(()=>r.stop()),{addAction:q,addEvent:F,addError:H,addTiming:le,addFeatureFlagEvaluation:A.addFeatureFlagEvaluation,startView:pe,setViewContext:se,setViewContextProperty:V,getViewContext:ye,setViewName:G,lifeCycle:u,viewHistory:E,session:y,stopSession:()=>y.expire(),getInternalContext:Te.get,startDurationVital:me.startDurationVital,stopDurationVital:me.stopDurationVital,addDurationVital:me.addDurationVital,addOperationStepVital:me.addOperationStepVital,globalContext:M,userContext:U,accountContext:K,telemetry:g,stop:()=>{l.forEach(Fe=>Fe())},hooks:d}}function T6(e,t,r,o,n,i,a){const s=h4(e,t,n,i,r),c=S6(e),l=o6(t,r),u=l6(r,t);return f6(t),g6(r,e,t,a),{pageStateHistory:o,addAction:s.addAction,addEvent:c.addEvent,actionContexts:s.actionContexts,stop:()=>{s.stop(),u.stop(),l.stop(),o.stop()}}}function $6(e,{session:t,viewContext:r,errorType:o}){const n=t?t.id:"no-session-id",i=[];o!==void 0&&i.push(`error-type=${o}`),r&&(i.push(`seed=${r.id}`),i.push(`from=${r.startClocks.timeStamp}`));const a=O6(e),s=`/rum/replay/sessions/${n}`;return`${a}${s}?${i.join("&")}`}function O6(e){const t=e.site,r=e.subdomain||A6(e);return`https://${r?`${r}.`:""}${t}`}function A6(e){switch(e.site){case Qr:case Mj:return"app";case QS:return"dd";default:return}}const C6=1e3;let $t;function N6(e){return Bc(e).segments_count}function R6(e){Bc(e).segments_count+=1}function P6(e){Bc(e).records_count+=1}function j6(e,t){Bc(e).segments_total_raw_size+=t}function D6(e){return $t?.get(e)}function Bc(e){$t||($t=new Map);let t;return $t.has(e)?t=$t.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},$t.set(e,t),$t.size>C6&&z6()),t}function z6(){if(!$t)return;const e=$t.keys().next().value;e&&$t.delete(e)}function CE(e,t,r){let o=0,n=[],i,a=!0,s=0;const c=[],{stop:l}=Oe(e,t,"message",({data:f})=>{if(f.type!=="wrote"||f.streamId!==r)return;const m=c[0];m&&(m.id===f.id?(c.shift(),o+=f.additionalBytesCount,n.push(f.result),i=f.trailer,m.writeCallback?m.writeCallback(f.result.byteLength):m.finishCallback&&m.finishCallback()):m.id<f.id&&l())});function u(){const f=n.length===0?new Uint8Array(0):ak(n.concat(i)),m={rawBytesCount:o,output:f,outputBytesCount:f.byteLength,encoding:"deflate"};return o=0,n=[],m}function d(){a||(t.postMessage({action:"reset",streamId:r}),a=!0)}return{isAsync:!0,get isEmpty(){return a},write(f,m){t.postMessage({action:"write",id:s,data:f,streamId:r}),c.push({id:s,writeCallback:m,data:f}),a=!1,s+=1},finish(f){d(),c.length?(c.forEach(m=>{delete m.writeCallback}),c[c.length-1].finishCallback=()=>f(u())):f(u())},finishSync(){d();const f=c.map(m=>m.data).join("");return c.length=0,{...u(),pendingData:f}},estimateEncodedBytesCount(f){return f.length/8},stop(){l()}}}function Rm({configuredUrl:e,error:t,source:r,scriptType:o}){if(Q.error(`${r} failed to start: an error occurred while initializing the ${o}:`,t),t instanceof Event||t instanceof Error&&M6(t.message)){let n;e?n=`Please make sure the ${o} URL ${e} is correct and CSP is correctly configured.`:n="Please make sure CSP is correctly configured.",Q.error(`${n} See documentation at ${Ac}/integrations/content_security_policy_logs/#use-csp-with-real-user-monitoring-and-session-replay`)}else o==="worker"&&km(t)}function M6(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const U6=30*Ke;function NE(e){return new Worker(e.workerUrl||URL.createObjectURL(new Blob(['(()=>{function t(t){if(1===t.length)return t[0];const e=t.reduce((t,e)=>t+e.length,0),a=new Uint8Array(e);let n=0;for(const e of t)a.set(e,n),n+=e.length;return a}function e(t){for(var e=t.length;--e>=0;)t[e]=0}var a=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),n=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),r=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),i=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s=Array(576);e(s);var h=Array(60);e(h);var l=Array(512);e(l);var _=Array(256);e(_);var o=Array(29);e(o);var d,u,f,c=Array(30);function p(t,e,a,n,r){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=n,this.max_length=r,this.has_stree=t&&t.length}function g(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}e(c);var v=function(t){return t<256?l[t]:l[256+(t>>>7)]},w=function(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255},m=function(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,w(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a)},b=function(t,e,a){m(t,a[2*e],a[2*e+1])},y=function(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1}while(--e>0);return a>>>1},z=function(t,e,a){var n,r,i=Array(16),s=0;for(n=1;n<=15;n++)i[n]=s=s+a[n-1]<<1;for(r=0;r<=e;r++){var h=t[2*r+1];0!==h&&(t[2*r]=y(i[h]++,h))}},k=function(t){var e;for(e=0;e<286;e++)t.dyn_ltree[2*e]=0;for(e=0;e<30;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.last_lit=t.matches=0},x=function(t){t.bi_valid>8?w(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},A=function(t,e,a,n){var r=2*e,i=2*a;return t[r]<t[i]||t[r]===t[i]&&n[e]<=n[a]},U=function(t,e,a){for(var n=t.heap[a],r=a<<1;r<=t.heap_len&&(r<t.heap_len&&A(e,t.heap[r+1],t.heap[r],t.depth)&&r++,!A(e,n,t.heap[r],t.depth));)t.heap[a]=t.heap[r],a=r,r<<=1;t.heap[a]=n},B=function(t,e,r){var i,s,h,l,d=0;if(0!==t.last_lit)do{i=t.pending_buf[t.d_buf+2*d]<<8|t.pending_buf[t.d_buf+2*d+1],s=t.pending_buf[t.l_buf+d],d++,0===i?b(t,s,e):(h=_[s],b(t,h+256+1,e),0!==(l=a[h])&&(s-=o[h],m(t,s,l)),i--,h=v(i),b(t,h,r),0!==(l=n[h])&&(i-=c[h],m(t,i,l)))}while(d<t.last_lit);b(t,256,e)},I=function(t,e){var a,n,r,i=e.dyn_tree,s=e.stat_desc.static_tree,h=e.stat_desc.has_stree,l=e.stat_desc.elems,_=-1;for(t.heap_len=0,t.heap_max=573,a=0;a<l;a++)0!==i[2*a]?(t.heap[++t.heap_len]=_=a,t.depth[a]=0):i[2*a+1]=0;for(;t.heap_len<2;)i[2*(r=t.heap[++t.heap_len]=_<2?++_:0)]=1,t.depth[r]=0,t.opt_len--,h&&(t.static_len-=s[2*r+1]);for(e.max_code=_,a=t.heap_len>>1;a>=1;a--)U(t,i,a);r=l;do{a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],U(t,i,1),n=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=n,i[2*r]=i[2*a]+i[2*n],t.depth[r]=(t.depth[a]>=t.depth[n]?t.depth[a]:t.depth[n])+1,i[2*a+1]=i[2*n+1]=r,t.heap[1]=r++,U(t,i,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a,n,r,i,s,h,l=e.dyn_tree,_=e.max_code,o=e.stat_desc.static_tree,d=e.stat_desc.has_stree,u=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,c=e.stat_desc.max_length,p=0;for(i=0;i<=15;i++)t.bl_count[i]=0;for(l[2*t.heap[t.heap_max]+1]=0,a=t.heap_max+1;a<573;a++)(i=l[2*l[2*(n=t.heap[a])+1]+1]+1)>c&&(i=c,p++),l[2*n+1]=i,n>_||(t.bl_count[i]++,s=0,n>=f&&(s=u[n-f]),h=l[2*n],t.opt_len+=h*(i+s),d&&(t.static_len+=h*(o[2*n+1]+s)));if(0!==p){do{for(i=c-1;0===t.bl_count[i];)i--;t.bl_count[i]--,t.bl_count[i+1]+=2,t.bl_count[c]--,p-=2}while(p>0);for(i=c;0!==i;i--)for(n=t.bl_count[i];0!==n;)(r=t.heap[--a])>_||(l[2*r+1]!==i&&(t.opt_len+=(i-l[2*r+1])*l[2*r],l[2*r+1]=i),n--)}}(t,e),z(i,_,t.bl_count)},E=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),e[2*(a+1)+1]=65535,n=0;n<=a;n++)r=s,s=e[2*(n+1)+1],++h<l&&r===s||(h<_?t.bl_tree[2*r]+=h:0!==r?(r!==i&&t.bl_tree[2*r]++,t.bl_tree[32]++):h<=10?t.bl_tree[34]++:t.bl_tree[36]++,h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4))},C=function(t,e,a){var n,r,i=-1,s=e[1],h=0,l=7,_=4;for(0===s&&(l=138,_=3),n=0;n<=a;n++)if(r=s,s=e[2*(n+1)+1],!(++h<l&&r===s)){if(h<_)do{b(t,r,t.bl_tree)}while(0!==--h);else 0!==r?(r!==i&&(b(t,r,t.bl_tree),h--),b(t,16,t.bl_tree),m(t,h-3,2)):h<=10?(b(t,17,t.bl_tree),m(t,h-3,3)):(b(t,18,t.bl_tree),m(t,h-11,7));h=0,i=r,0===s?(l=138,_=3):r===s?(l=6,_=3):(l=7,_=4)}},D=!1,M=function(t,e,a,n){m(t,0+(n?1:0),3),function(t,e,a){x(t),w(t,a),w(t,~a),t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a}(t,e,a)},j=M,L=function(t,e,a,n){for(var r=65535&t,i=t>>>16&65535,s=0;0!==a;){a-=s=a>2e3?2e3:a;do{i=i+(r=r+e[n++]|0)|0}while(--s);r%=65521,i%=65521}return r|i<<16},S=new Uint32Array(function(){for(var t,e=[],a=0;a<256;a++){t=a;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t}return e}()),T=function(t,e,a,n){var r=S,i=n+a;t^=-1;for(var s=n;s<i;s++)t=t>>>8^r[255&(t^e[s])];return-1^t},O={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},q=j,F=function(t,e,a){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&a,t.last_lit++,0===e?t.dyn_ltree[2*a]++:(t.matches++,e--,t.dyn_ltree[2*(_[a]+256+1)]++,t.dyn_dtree[2*v(e)]++),t.last_lit===t.lit_bufsize-1},G=-2,H=258,J=262,K=103,N=113,P=666,Q=function(t,e){return t.msg=O[e],e},R=function(t){return(t<<1)-(t>4?9:0)},V=function(t){for(var e=t.length;--e>=0;)t[e]=0},W=function(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask},X=function(t){var e=t.state,a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0))},Y=function(t,e){(function(t,e,a,n){var r,l,_=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,a=4093624447;for(e=0;e<=31;e++,a>>>=1)if(1&a&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<256;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0}(t)),I(t,t.l_desc),I(t,t.d_desc),_=function(t){var e;for(E(t,t.dyn_ltree,t.l_desc.max_code),E(t,t.dyn_dtree,t.d_desc.max_code),I(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*i[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),r=t.opt_len+3+7>>>3,(l=t.static_len+3+7>>>3)<=r&&(r=l)):r=l=a+5,a+4<=r&&-1!==e?M(t,e,a,n):4===t.strategy||l===r?(m(t,2+(n?1:0),3),B(t,s,h)):(m(t,4+(n?1:0),3),function(t,e,a,n){var r;for(m(t,e-257,5),m(t,a-1,5),m(t,n-4,4),r=0;r<n;r++)m(t,t.bl_tree[2*i[r]+1],3);C(t,t.dyn_ltree,e-1),C(t,t.dyn_dtree,a-1)}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,_+1),B(t,t.dyn_ltree,t.dyn_dtree)),k(t),n&&x(t)})(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,X(t.strm)},Z=function(t,e){t.pending_buf[t.pending++]=e},$=function(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e},tt=function(t,e,a,n){var r=t.avail_in;return r>n&&(r=n),0===r?0:(t.avail_in-=r,e.set(t.input.subarray(t.next_in,t.next_in+r),a),1===t.state.wrap?t.adler=L(t.adler,e,r,a):2===t.state.wrap&&(t.adler=T(t.adler,e,r,a)),t.next_in+=r,t.total_in+=r,r)},et=function(t,e){var a,n,r=t.max_chain_length,i=t.strstart,s=t.prev_length,h=t.nice_match,l=t.strstart>t.w_size-J?t.strstart-(t.w_size-J):0,_=t.window,o=t.w_mask,d=t.prev,u=t.strstart+H,f=_[i+s-1],c=_[i+s];t.prev_length>=t.good_match&&(r>>=2),h>t.lookahead&&(h=t.lookahead);do{if(_[(a=e)+s]===c&&_[a+s-1]===f&&_[a]===_[i]&&_[++a]===_[i+1]){i+=2,a++;do{}while(_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&_[++i]===_[++a]&&i<u);if(n=H-(u-i),i=u-H,n>s){if(t.match_start=e,s=n,n>=h)break;f=_[i+s-1],c=_[i+s]}}}while((e=d[e&o])>l&&0!==--r);return s<=t.lookahead?s:t.lookahead},at=function(t){var e,a,n,r,i,s=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=s+(s-J)){t.window.set(t.window.subarray(s,s+s),0),t.match_start-=s,t.strstart-=s,t.block_start-=s,e=a=t.hash_size;do{n=t.head[--e],t.head[e]=n>=s?n-s:0}while(--a);e=a=s;do{n=t.prev[--e],t.prev[e]=n>=s?n-s:0}while(--a);r+=s}if(0===t.strm.avail_in)break;if(a=tt(t.strm,t.window,t.strstart+t.lookahead,r),t.lookahead+=a,t.lookahead+t.insert>=3)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=W(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=W(t,t.ins_h,t.window[i+3-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<J&&0!==t.strm.avail_in)},nt=function(t,e){for(var a,n;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a)),t.match_length>=3)if(n=F(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart}while(0!==--t.match_length);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=W(t,t.ins_h,t.window[t.strstart+1]);else n=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2},rt=function(t,e){for(var a,n,r;;){if(t.lookahead<J){if(at(t),t.lookahead<J&&0===e)return 1;if(0===t.lookahead)break}if(a=0,t.lookahead>=3&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-J&&(t.match_length=et(t,a),t.match_length<=5&&(1===t.strategy||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){r=t.strstart+t.lookahead-3,n=F(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=r&&(t.ins_h=W(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart)}while(0!==--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,n&&(Y(t,!1),0===t.strm.avail_out))return 1}else if(t.match_available){if((n=F(t,0,t.window[t.strstart-1]))&&Y(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=F(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2};function it(t,e,a,n,r){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=n,this.func=r}var st=[new it(0,0,0,0,function(t,e){var a=65535;for(a>t.pending_buf_size-5&&(a=t.pending_buf_size-5);;){if(t.lookahead<=1){if(at(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+a;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,Y(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-J&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(Y(t,!1),t.strm.avail_out),1)}),new it(4,4,8,4,nt),new it(4,5,16,8,nt),new it(4,6,32,32,nt),new it(4,4,16,16,rt),new it(8,16,32,32,rt),new it(8,16,128,128,rt),new it(8,32,128,256,rt),new it(32,128,258,1024,rt),new it(32,258,258,4096,rt)];function ht(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),V(this.dyn_ltree),V(this.dyn_dtree),V(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),V(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),V(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}for(var lt=function(t){var e,i=function(t){if(!t||!t.state)return Q(t,G);t.total_in=t.total_out=0,t.data_type=2;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?42:N,t.adler=2===e.wrap?0:1,e.last_flush=0,function(t){D||(function(){var t,e,i,g,v,w=Array(16);for(i=0,g=0;g<28;g++)for(o[g]=i,t=0;t<1<<a[g];t++)_[i++]=g;for(_[i-1]=g,v=0,g=0;g<16;g++)for(c[g]=v,t=0;t<1<<n[g];t++)l[v++]=g;for(v>>=7;g<30;g++)for(c[g]=v<<7,t=0;t<1<<n[g]-7;t++)l[256+v++]=g;for(e=0;e<=15;e++)w[e]=0;for(t=0;t<=143;)s[2*t+1]=8,t++,w[8]++;for(;t<=255;)s[2*t+1]=9,t++,w[9]++;for(;t<=279;)s[2*t+1]=7,t++,w[7]++;for(;t<=287;)s[2*t+1]=8,t++,w[8]++;for(z(s,287,w),t=0;t<30;t++)h[2*t+1]=5,h[2*t]=y(t,5);d=new p(s,a,257,286,15),u=new p(h,n,0,30,15),f=new p([],r,0,19,7)}(),D=!0),t.l_desc=new g(t.dyn_ltree,d),t.d_desc=new g(t.dyn_dtree,u),t.bl_desc=new g(t.bl_tree,f),t.bi_buf=0,t.bi_valid=0,k(t)}(e),0}(t);return 0===i&&((e=t.state).window_size=2*e.w_size,V(e.head),e.max_lazy_match=st[e.level].max_lazy,e.good_match=st[e.level].good_length,e.nice_match=st[e.level].nice_length,e.max_chain_length=st[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=2,e.match_available=0,e.ins_h=0),i},_t=function(t,e){var a,n;if(!t||!t.state||e>5||e<0)return t?Q(t,G):G;var r=t.state;if(!t.output||!t.input&&0!==t.avail_in||r.status===P&&4!==e)return Q(t,0===t.avail_out?-5:G);r.strm=t;var i=r.last_flush;if(r.last_flush=e,42===r.status)if(2===r.wrap)t.adler=0,Z(r,31),Z(r,139),Z(r,8),r.gzhead?(Z(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Z(r,255&r.gzhead.time),Z(r,r.gzhead.time>>8&255),Z(r,r.gzhead.time>>16&255),Z(r,r.gzhead.time>>24&255),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Z(r,255&r.gzhead.extra.length),Z(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=T(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,0),Z(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),Z(r,3),r.status=N);else{var h=8+(r.w_bits-8<<4)<<8;h|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(h|=32),h+=31-h%31,r.status=N,$(r,h),0!==r.strstart&&($(r,t.adler>>>16),$(r,65535&t.adler)),t.adler=1}if(69===r.status)if(r.gzhead.extra){for(a=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending!==r.pending_buf_size));)Z(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){a=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),X(t),a=r.pending,r.pending===r.pending_buf_size)){n=1;break}n=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Z(r,n)}while(0!==n);r.gzhead.hcrc&&r.pending>a&&(t.adler=T(t.adler,r.pending_buf,r.pending-a,a)),0===n&&(r.status=K)}else r.status=K;if(r.status===K&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&X(t),r.pending+2<=r.pending_buf_size&&(Z(r,255&t.adler),Z(r,t.adler>>8&255),t.adler=0,r.status=N)):r.status=N),0!==r.pending){if(X(t),0===t.avail_out)return r.last_flush=-1,0}else if(0===t.avail_in&&R(e)<=R(i)&&4!==e)return Q(t,-5);if(r.status===P&&0!==t.avail_in)return Q(t,-5);if(0!==t.avail_in||0!==r.lookahead||0!==e&&r.status!==P){var l=2===r.strategy?function(t,e){for(var a;;){if(0===t.lookahead&&(at(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):3===r.strategy?function(t,e){for(var a,n,r,i,s=t.window;;){if(t.lookahead<=H){if(at(t),t.lookahead<=H&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=s[r=t.strstart-1])===s[++r]&&n===s[++r]&&n===s[++r]){i=t.strstart+H;do{}while(n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&n===s[++r]&&r<i);t.match_length=H-(i-r),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(a=F(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=F(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(Y(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(Y(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(Y(t,!1),0===t.strm.avail_out)?1:2}(r,e):st[r.level].func(r,e);if(3!==l&&4!==l||(r.status=P),1===l||3===l)return 0===t.avail_out&&(r.last_flush=-1),0;if(2===l&&(1===e?function(t){m(t,2,3),b(t,256,s),function(t){16===t.bi_valid?(w(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}(r):5!==e&&(q(r,0,0,!1),3===e&&(V(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),X(t),0===t.avail_out))return r.last_flush=-1,0}return 4!==e?0:r.wrap<=0?1:(2===r.wrap?(Z(r,255&t.adler),Z(r,t.adler>>8&255),Z(r,t.adler>>16&255),Z(r,t.adler>>24&255),Z(r,255&t.total_in),Z(r,t.total_in>>8&255),Z(r,t.total_in>>16&255),Z(r,t.total_in>>24&255)):($(r,t.adler>>>16),$(r,65535&t.adler)),X(t),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},ot=function(t){if(!t||!t.state)return G;var e=t.state.status;return 42!==e&&69!==e&&73!==e&&91!==e&&e!==K&&e!==N&&e!==P?Q(t,G):(t.state=null,e===N?Q(t,-3):0)},dt=new Uint8Array(256),ut=0;ut<256;ut++)dt[ut]=ut>=252?6:ut>=248?5:ut>=240?4:ut>=224?3:ut>=192?2:1;dt[254]=dt[254]=1;var ft=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},ct=Object.prototype.toString;function pt(){this.options={level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0};var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new ft,this.strm.avail_out=0;var e,a,n=function(t,e,a,n,r,i){if(!t)return G;var s=1;if(-1===e&&(e=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),r<1||r>9||8!==a||n<8||n>15||e<0||e>9||i<0||i>4)return Q(t,G);8===n&&(n=9);var h=new ht;return t.state=h,h.strm=t,h.wrap=s,h.gzhead=null,h.w_bits=n,h.w_size=1<<h.w_bits,h.w_mask=h.w_size-1,h.hash_bits=r+7,h.hash_size=1<<h.hash_bits,h.hash_mask=h.hash_size-1,h.hash_shift=~~((h.hash_bits+3-1)/3),h.window=new Uint8Array(2*h.w_size),h.head=new Uint16Array(h.hash_size),h.prev=new Uint16Array(h.w_size),h.lit_bufsize=1<<r+6,h.pending_buf_size=4*h.lit_bufsize,h.pending_buf=new Uint8Array(h.pending_buf_size),h.d_buf=1*h.lit_bufsize,h.l_buf=3*h.lit_bufsize,h.level=e,h.strategy=i,h.method=a,lt(t)}(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw Error(O[n]);if(t.header&&(e=this.strm,a=t.header,e&&e.state&&(2!==e.state.wrap||(e.state.gzhead=a))),t.dictionary){var r;if(r="[object ArrayBuffer]"===ct.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=function(t,e){var a=e.length;if(!t||!t.state)return G;var n=t.state,r=n.wrap;if(2===r||1===r&&42!==n.status||n.lookahead)return G;if(1===r&&(t.adler=L(t.adler,e,a,0)),n.wrap=0,a>=n.w_size){0===r&&(V(n.head),n.strstart=0,n.block_start=0,n.insert=0);var i=new Uint8Array(n.w_size);i.set(e.subarray(a-n.w_size,a),0),e=i,a=n.w_size}var s=t.avail_in,h=t.next_in,l=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,at(n);n.lookahead>=3;){var _=n.strstart,o=n.lookahead-2;do{n.ins_h=W(n,n.ins_h,n.window[_+3-1]),n.prev[_&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=_,_++}while(--o);n.strstart=_,n.lookahead=2,at(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,t.next_in=h,t.input=l,t.avail_in=s,n.wrap=r,0}(this.strm,r)))throw Error(O[n]);this._dict_set=!0}}function gt(t,e,a){try{t.postMessage({type:"errored",error:e,streamId:a})}catch(n){t.postMessage({type:"errored",error:e+"",streamId:a})}}function vt(t){const e=t.strm.adler;return new Uint8Array([3,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e])}pt.prototype.push=function(t,e){var a,n,r=this.strm,i=this.options.chunkSize;if(this.ended)return!1;for(n=e===~~e?e:!0===e?4:0,"[object ArrayBuffer]"===ct.call(t)?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(2===n||3===n)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(1===(a=_t(r,n)))return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),a=ot(this.strm),this.onEnd(a),this.ended=!0,0===a;if(0!==r.avail_out){if(n>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},pt.prototype.onData=function(t){this.chunks.push(t)},pt.prototype.onEnd=function(t){0===t&&(this.result=function(t){for(var e=0,a=0,n=t.length;a<n;a++)e+=t[a].length;for(var r=new Uint8Array(e),i=0,s=0,h=t.length;i<h;i++){var l=t[i];r.set(l,s),s+=l.length}return r}(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},function(e=self){try{const a=new Map;e.addEventListener("message",n=>{try{const r=function(e,a){switch(a.action){case"init":return{type:"initialized",version:"6.24.1"};case"write":{let n=e.get(a.streamId);n||(n=new pt,e.set(a.streamId,n));const r=n.chunks.length,i=function(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(t);let e,a,n,r,i,s=t.length,h=0;for(r=0;r<s;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),h+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(h),i=0,r=0;i<h;r++)a=t.charCodeAt(r),55296==(64512&a)&&r+1<s&&(n=t.charCodeAt(r+1),56320==(64512&n)&&(a=65536+(a-55296<<10)+(n-56320),r++)),a<128?e[i++]=a:a<2048?(e[i++]=192|a>>>6,e[i++]=128|63&a):a<65536?(e[i++]=224|a>>>12,e[i++]=128|a>>>6&63,e[i++]=128|63&a):(e[i++]=240|a>>>18,e[i++]=128|a>>>12&63,e[i++]=128|a>>>6&63,e[i++]=128|63&a);return e}(a.data);return n.push(i,2),{type:"wrote",id:a.id,streamId:a.streamId,result:t(n.chunks.slice(r)),trailer:vt(n),additionalBytesCount:i.length}}case"reset":e.delete(a.streamId)}}(a,n.data);r&&e.postMessage(r)}catch(t){gt(e,t,n.data&&"streamId"in n.data?n.data.streamId:void 0)}})}catch(t){gt(e,t)}}()})();'])))}let Re={status:0};function RE(e,t,r,o=NE){switch(Re.status===0&&L6(e,t,o),Re.status){case 1:return Re.initializationFailureCallbacks.push(r),Re.worker;case 3:return Re.worker}}function dh(){return Re.status}function L6(e,t,r=NE){try{const o=r(e),{stop:n}=Oe(e,o,"error",s=>{Ul(e,t,s)}),{stop:i}=Oe(e,o,"message",({data:s})=>{s.type==="errored"?Ul(e,t,s.error,s.streamId):s.type==="initialized"&&V6(s.version)});o.postMessage({action:"init"}),Je(()=>F6(t),U6),Re={status:1,worker:o,stop:()=>{n(),i()},initializationFailureCallbacks:[]}}catch(o){Ul(e,t,o)}}function F6(e){Re.status===1&&(Q.error(`${e} failed to start: a timeout occurred while initializing the Worker`),Re.initializationFailureCallbacks.forEach(t=>t()),Re={status:2})}function V6(e){Re.status===1&&(Re={status:3,worker:Re.worker,stop:Re.stop,version:e})}function Ul(e,t,r,o){Re.status===1||Re.status===0?(Rm({configuredUrl:e.workerUrl,error:r,source:t,scriptType:"worker"}),Re.status===1&&Re.initializationFailureCallbacks.forEach(n=>n()),Re={status:2}):km(r,{worker_version:Re.status===3&&Re.version,stream_id:o})}function PE(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function Z6(e,t,r,o){const n=t.findTrackedSession(),i=B6(n,o),a=r.findView();return $6(e,{viewContext:a,errorType:i,session:n})}function B6(e,t){if(!PE())return"browser-not-supported";if(!e)return"rum-not-tracked";if(e.sessionReplay===0)return"incorrect-session-plan";if(!t)return"replay-not-started"}function q6(e,t){if(!e.metricsEnabled)return{stop:_e};let r,o,n;const{unsubscribe:i}=t.subscribe(a=>{switch(a.type){case"start":r={forced:a.forced,timestamp:Be()},o=void 0,n=void 0;break;case"document-ready":r&&(o=Ne(r.timestamp,Be()));break;case"recorder-settled":r&&(n=Ne(r.timestamp,Be()));break;case"aborted":case"deflate-encoder-load-failed":case"recorder-load-failed":case"succeeded":i(),r&&ea("Recorder init metrics",{metrics:G6(r.forced,n,Ne(r.timestamp,Be()),a.type,o)});break}});return{stop:i}}function G6(e,t,r,o,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:o,waitForDocReadyDuration:n}}function H6(e,t,r,o,n,i,a){let s=0,c;t.subscribe(9,()=>{(s===2||s===3)&&(f(),s=1)}),t.subscribe(10,()=>{s===1&&d()});const l=new ge;q6(a,l);const u=async m=>{l.notify({type:"start",forced:m});const[h]=await Promise.all([fh(l,{type:"recorder-settled"},n()),fh(l,{type:"document-ready"},RD(e,"interactive"))]);if(s!==2){l.notify({type:"aborted"});return}if(!h){s=0,l.notify({type:"recorder-load-failed"});return}const g=i();if(!g){s=0,l.notify({type:"deflate-encoder-load-failed"});return}({stop:c}=h(t,e,r,o,g,a)),s=3,l.notify({type:"succeeded"})};function d(m){const h=r.findTrackedSession();if(W6(h,m)){s=1;return}if(J6(s))return;s=2;const g=K6(h,m)||!1;u(g).catch(pr),g&&r.setForcedReplay()}function f(){s===3&&c?.(),s=0}return{start:d,stop:f,getSessionReplayLink(){return Z6(e,r,o,s!==0)},isRecording:()=>s===3}}function W6(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function J6(e){return e===2||e===3}function K6(e,t){return t&&t.force&&e.sessionReplay===0}async function fh(e,t,r){try{return await r}finally{e.notify(t)}}function Y6(){let e=0;return{strategy:{start(){e=1},stop(){e=2},isRecording:()=>!1,getSessionReplayLink:_e},shouldStartImmediately(t){return e===1||e===0&&!t.startSessionReplayRecordingManually}}}function X6(e,t){if(sn()&&!bk("records")||!PE())return{start:_e,stop:_e,getReplayStats:()=>{},onRumStart:_e,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:o}=Y6();return{start:i=>r.start(i),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>dh()===3&&r.isRecording(),getReplayStats:i=>dh()===3?D6(i):void 0};function n(i,a,s,c,l,u){let d;function f(){return d||(l??(l=RE(a,"Datadog Session Replay",()=>{r.stop()},t)),l&&(d=CE(a,l,1))),d}r=H6(a,i,s,c,e,f,u),o(a)&&r.start()}}async function Q6(e=eL){try{return await e()}catch(t){Rm({error:t,source:"Recorder",scriptType:"module"})}}async function eL(){return(await Promise.resolve().then(()=>require("./startRecording-D8-ckYMS.cjs"))).startRecording}function tL(){return It().Profiler!==void 0}const rL=e=>{let t={status:"starting"};return e.register(0,({eventType:r})=>r!==te.VIEW&&r!==te.LONG_TASK?wt:{type:r,_dd:{profiling:t}}),{get:()=>t,set:r=>{t=r}}};async function nL(e=oL){try{return await e()}catch(t){Rm({error:t,source:"Profiler",scriptType:"module"})}}async function oL(){return(await Promise.resolve().then(()=>require("./profiler-Cr1UEa8B.cjs"))).createRumProfiler}function iL(){let e;function t(r,o,n,i,a,s){const c=i.findTrackedSession();if(!c||!Uk(c.id,n.profilingSampleRate))return;const l=rL(o);if(!tL()){l.set({status:"error",error_reason:"not-supported-by-browser"});return}nL().then(u=>{if(!u){_o("[DD_RUM] Failed to lazy load the RUM Profiler"),l.set({status:"error",error_reason:"failed-to-lazy-load"});return}e=u(n,r,i,l,s),e.start(a.findView())}).catch(pr)}return{onRumStart:t,stop:()=>{e?.stop().catch(pr)}}}const aL=X6(Q6),sL=iL(),Ho=Kz(I6,aL,sL,{startDeflateWorker:RE,createDeflateEncoder:CE,sdkName:"rum"});C2(It(),"DD_RUM",Ho);const Sa={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",service:"gram-elements"};let Fu=!1,Vu=!0;function cL(e={}){if(e.enabled===!1){Vu=!1;return}if(!Fu)try{Ho.init({applicationId:Sa.applicationId,clientToken:Sa.clientToken,site:Sa.site,service:Sa.service,env:process.env.NODE_ENV||"production",sessionSampleRate:100,sessionReplaySampleRate:100,trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0,defaultPrivacyLevel:"mask"}),e.projectSlug&&Ho.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&Ho.setGlobalContextProperty("variant",e.variant),Fu=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),Vu=!1}}function gs(e,t){if(!Vu||!Fu)return;const r=e instanceof Error?e:new Error(String(e));try{Ho.addError(r,{...t,timestamp:new Date().toISOString()})}catch(o){console.warn("[Elements] Failed to track error:",o)}}const Pm=["anthropic/claude-sonnet-4.5","anthropic/claude-haiku-4.5","anthropic/claude-sonnet-4","anthropic/claude-opus-4.5","openai/gpt-4o","openai/gpt-4o-mini","openai/gpt-5.1-codex","openai/gpt-5","openai/gpt-5.1","openai/gpt-4.1","anthropic/claude-3.7-sonnet","anthropic/claude-opus-4","google/gemini-2.5-pro-preview","google/gemini-3-pro-preview","moonshotai/kimi-k2","mistralai/mistral-medium-3","mistralai/mistral-medium-3.1","mistralai/codestral-2501"],lL=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof ig.ZodType?ig.toJSONSchema(r.parameters):r.parameters}])),uL=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let hs=null;function dL(e,t){const r=jE(t);hs={helpers:e,requiresApproval:r}}function fL(){hs=null}function jE(e){if(!e)return()=>!1;if(typeof e=="function")return r=>e({toolName:r});const t=new Set(e);return r=>t.has(r)}const mL=(e,t)=>z.makeAssistantTool({...e,execute:async(r,o)=>{if(hs?.requiresApproval(t)){const{helpers:n}=hs,i=o.toolCallId??"";if(!n.isToolApproved(t)&&!await n.requestApproval(t,i,r))return{content:[{type:"text",text:`Tool "${t}" execution was denied by the user. Please acknowledge this and continue without using this tool's result.`}],isError:!0}}return e.execute?.(r,o)},toolName:t});function pL(e,t,r){if(!t||Array.isArray(t)&&t.length===0)return e;const o=jE(t);return Object.fromEntries(Object.entries(e).map(([n,i])=>{if(!o(n))return[n,i];const a=i.execute;return a?[n,{...i,execute:async(s,c)=>{const l=c??{},u=l.toolCallId??"";return r.isToolApproved(n)||await r.requestApproval(n,u,s)?a(s,l):{content:[{type:"text",text:`Tool "${n}" execution was denied by the user. Please acknowledge this and continue without using this tool's result.`}],isError:!0}}}]:[n,i]}))}const gL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],hL=$.createLucideIcon("arrow-down",gL);const vL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],yL=$.createLucideIcon("arrow-up",vL);const bL=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],_L=$.createLucideIcon("brain",bL);const wL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Nr=$.createLucideIcon("check",wL);const xL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vs=$.createLucideIcon("chevron-down",xL);const SL=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],kL=$.createLucideIcon("chevron-left",SL);const EL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],DE=$.createLucideIcon("chevron-right",EL);const IL=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],jm=$.createLucideIcon("copy",IL);const TL=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],$L=$.createLucideIcon("file-text",TL);const OL=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],ys=$.createLucideIcon("loader",OL);const AL=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],CL=$.createLucideIcon("maximize",AL);const NL=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],RL=$.createLucideIcon("message-circle",NL);const PL=[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]],jL=$.createLucideIcon("minimize",PL);const DL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],zL=$.createLucideIcon("panel-right-close",DL);const ML=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],UL=$.createLucideIcon("panel-right-open",ML);const LL=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],FL=$.createLucideIcon("pencil",LL);const VL=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zE=$.createLucideIcon("plus",VL);const ZL=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],BL=$.createLucideIcon("settings-2",ZL);const qL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],GL=$.createLucideIcon("square",qL);const HL=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ME=$.createLucideIcon("wrench",HL);const WL=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xo=$.createLucideIcon("x",WL);var JL=Object.defineProperty,KL=Object.defineProperties,YL=Object.getOwnPropertyDescriptors,mh=Object.getOwnPropertySymbols,XL=Object.prototype.hasOwnProperty,QL=Object.prototype.propertyIsEnumerable,ph=(e,t,r)=>t in e?JL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xe=(e,t)=>{for(var r in t||(t={}))XL.call(t,r)&&ph(e,r,t[r]);if(mh)for(var r of mh(t))QL.call(t,r)&&ph(e,r,t[r]);return e},bs=(e,t)=>KL(e,YL(t)),UE="vercel.ai.error",e5=Symbol.for(UE),LE,t5=class FE extends Error{constructor({name:t,message:r,cause:o}){super(r),this[LE]=!0,this.name=t,this.cause=o}static isInstance(t){return FE.hasMarker(t,UE)}static hasMarker(t,r){const o=Symbol.for(r);return t!=null&&typeof t=="object"&&o in t&&typeof t[o]=="boolean"&&t[o]===!0}};LE=e5;var ze=t5,VE="AI_APICallError",ZE=`vercel.ai.error.${VE}`,r5=Symbol.for(ZE),BE,Zt=class extends ze{constructor({message:e,url:t,requestBodyValues:r,statusCode:o,responseHeaders:n,responseBody:i,cause:a,isRetryable:s=o!=null&&(o===408||o===409||o===429||o>=500),data:c}){super({name:VE,message:e,cause:a}),this[BE]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=o,this.responseHeaders=n,this.responseBody=i,this.isRetryable=s,this.data=c}static isInstance(e){return ze.hasMarker(e,ZE)}};BE=r5;var qE="AI_EmptyResponseBodyError",GE=`vercel.ai.error.${qE}`,n5=Symbol.for(GE),HE,o5=class extends ze{constructor({message:e="Empty response body"}={}){super({name:qE,message:e}),this[HE]=!0}static isInstance(e){return ze.hasMarker(e,GE)}};HE=n5;function WE(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var JE="AI_InvalidArgumentError",KE=`vercel.ai.error.${JE}`,i5=Symbol.for(KE),YE,XE=class extends ze{constructor({message:t,cause:r,argument:o}){super({name:JE,message:t,cause:r}),this[YE]=!0,this.argument=o}static isInstance(t){return ze.hasMarker(t,KE)}};YE=i5;var QE="AI_InvalidPromptError",eI=`vercel.ai.error.${QE}`,a5=Symbol.for(eI),tI,s5=class extends ze{constructor({prompt:e,message:t,cause:r}){super({name:QE,message:`Invalid prompt: ${t}`,cause:r}),this[tI]=!0,this.prompt=e}static isInstance(e){return ze.hasMarker(e,eI)}};tI=a5;var rI="AI_InvalidResponseDataError",nI=`vercel.ai.error.${rI}`,c5=Symbol.for(nI),oI,Mo=class extends ze{constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:rI,message:t}),this[oI]=!0,this.data=e}static isInstance(e){return ze.hasMarker(e,nI)}};oI=c5;var iI="AI_JSONParseError",aI=`vercel.ai.error.${iI}`,l5=Symbol.for(aI),sI,_s=class extends ze{constructor({text:e,cause:t}){super({name:iI,message:`JSON parsing failed: Text: ${e}.
|
|
38
|
+
Error message: ${WE(t)}`,cause:t}),this[sI]=!0,this.text=e}static isInstance(e){return ze.hasMarker(e,aI)}};sI=l5;var cI="AI_LoadAPIKeyError",lI=`vercel.ai.error.${cI}`,u5=Symbol.for(lI),uI,ka=class extends ze{constructor({message:e}){super({name:cI,message:e}),this[uI]=!0}static isInstance(e){return ze.hasMarker(e,lI)}};uI=u5;var dI="AI_NoContentGeneratedError",fI=`vercel.ai.error.${dI}`,d5=Symbol.for(fI),mI,pI=class extends ze{constructor({message:e="No content generated."}={}){super({name:dI,message:e}),this[mI]=!0}static isInstance(e){return ze.hasMarker(e,fI)}};mI=d5;var gI="AI_TypeValidationError",hI=`vercel.ai.error.${gI}`,f5=Symbol.for(hI),vI,m5=class Zu extends ze{constructor({value:t,cause:r}){super({name:gI,message:`Type validation failed: Value: ${JSON.stringify(t)}.
|
|
39
|
+
Error message: ${WE(r)}`,cause:r}),this[vI]=!0,this.value=t}static isInstance(t){return ze.hasMarker(t,hI)}static wrap({value:t,cause:r}){return Zu.isInstance(r)&&r.value===t?r:new Zu({value:t,cause:r})}};vI=f5;var li=m5,yI="AI_UnsupportedFunctionalityError",bI=`vercel.ai.error.${yI}`,p5=Symbol.for(bI),_I,Er=class extends ze{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:yI,message:t}),this[_I]=!0,this.functionality=e}static isInstance(e){return ze.hasMarker(e,bI)}};_I=p5;var gh=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Ll(e){}function g5(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=Ll,onError:r=Ll,onRetry:o=Ll,onComment:n}=e;let i="",a=!0,s,c="",l="";function u(g){const y=a?g.replace(/^\xEF\xBB\xBF/,""):g,[b,w]=h5(`${i}${y}`);for(const x of b)d(x);i=w,a=!1}function d(g){if(g===""){m();return}if(g.startsWith(":")){n&&n(g.slice(g.startsWith(": ")?2:1));return}const y=g.indexOf(":");if(y!==-1){const b=g.slice(0,y),w=g[y+1]===" "?2:1,x=g.slice(y+w);f(b,x,g);return}f(g,"",g)}function f(g,y,b){switch(g){case"event":l=y;break;case"data":c=`${c}${y}
|
|
40
|
+
`;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?o(parseInt(y,10)):r(new gh(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:b}));break;default:r(new gh(`Unknown field "${g.length>20?`${g.slice(0,20)}…`:g}"`,{type:"unknown-field",field:g,value:y,line:b}));break}}function m(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
|
|
41
|
+
`)?c.slice(0,-1):c}),s=void 0,c="",l=""}function h(g={}){i&&g.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:h}}function h5(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),i=e.indexOf(`
|
|
42
|
+
`,o);let a=-1;if(n!==-1&&i!==-1?a=Math.min(n,i):n!==-1?a=n:i!==-1&&(a=i),a===-1){r=e.slice(o);break}else{const s=e.slice(o,a);t.push(s),o=a+1,e[o-1]==="\r"&&e[o]===`
|
|
43
|
+
`&&o++}}return[t,r]}var v5=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(n){o=g5({onEvent:i=>{n.enqueue(i)},onError(i){e==="terminate"?n.error(i):typeof e=="function"&&e(i)},onRetry:t,onComment:r})},transform(n){o.feed(n)}})}};new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ui(...e){return e.reduce((t,r)=>xe(xe({},t),r??{}),{})}function qc(e){return Object.fromEntries([...e.headers])}var y5=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const i=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*i|0];return a.join("")};if(e==null)return n;if(r.includes(o))throw new XE({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},Mt=y5();function Bu(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var b5=["fetch failed","failed to fetch"];function _5({error:e,url:t,requestBodyValues:r}){if(Bu(e))return e;if(e instanceof TypeError&&b5.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new Zt({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function w5(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>r!=null))}function x5({apiKey:e,environmentVariableName:t,apiKeyParameterName:r="apiKey",description:o}){if(typeof e=="string")return e;if(e!=null)throw new ka({message:`${o} API key must be a string.`});if(typeof process>"u")throw new ka({message:`${o} API key is missing. Pass it using the '${r}' parameter. Environment variables is not supported in this environment.`});if(e=process.env[t],e==null)throw new ka({message:`${o} API key is missing. Pass it using the '${r}' parameter or the ${t} environment variable.`});if(typeof e!="string")throw new ka({message:`${o} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}var S5=/"__proto__"\s*:/,k5=/"constructor"\s*:/;function E5(e){const t=JSON.parse(e);return t===null||typeof t!="object"||S5.test(e)===!1&&k5.test(e)===!1?t:I5(t)}function I5(e){let t=[e];for(;t.length;){const r=t;t=[];for(const o of r){if(Object.prototype.hasOwnProperty.call(o,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(o,"constructor")&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const n in o){const i=o[n];i&&typeof i=="object"&&t.push(i)}}}return e}function Dm(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return E5(e)}finally{Error.stackTraceLimit=t}}var qu=Symbol.for("vercel.ai.validator");function T5(e){return{[qu]:!0,validate:e}}function $5(e){return typeof e=="object"&&e!==null&&qu in e&&e[qu]===!0&&"validate"in e}function O5(e){return $5(e)?e:A5(e)}function A5(e){return T5(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new li({value:t,cause:r.issues})}})}async function C5({value:e,schema:t}){const r=await wI({value:e,schema:t});if(!r.success)throw li.wrap({value:e,cause:r.error});return r.value}async function wI({value:e,schema:t}){const r=O5(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const o=await r.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:li.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:li.wrap({value:e,cause:o}),rawValue:e}}}async function N5({text:e,schema:t}){try{const r=Dm(e);return t==null?r:C5({value:r,schema:t})}catch(r){throw _s.isInstance(r)||li.isInstance(r)?r:new _s({text:e,cause:r})}}async function xI({text:e,schema:t}){try{const r=Dm(e);return t==null?{success:!0,value:r,rawValue:r}:await wI({value:r,schema:t})}catch(r){return{success:!1,error:_s.isInstance(r)?r:new _s({text:e,cause:r}),rawValue:void 0}}}function Fl(e){try{return Dm(e),!0}catch{return!1}}function R5({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new v5).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await xI({text:r,schema:t}))}}))}var P5=()=>globalThis.fetch,di=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>j5({url:e,headers:xe({"Content-Type":"application/json"},t),body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),j5=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=P5()})=>{try{const s=await a(e,{method:"POST",headers:w5(t),body:r.content,signal:i}),c=qc(s);if(!s.ok){let l;try{l=await n({response:s,url:e,requestBodyValues:r.values})}catch(u){throw Bu(u)||Zt.isInstance(u)?u:new Zt({message:"Failed to process error response",cause:u,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw l.value}try{return await o({response:s,url:e,requestBodyValues:r.values})}catch(l){throw l instanceof Error&&(Bu(l)||Zt.isInstance(l))?l:new Zt({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw _5({error:s,url:e,requestBodyValues:r.values})}},D5=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:i})=>{const a=await o.text(),s=qc(o);if(a.trim()==="")return{responseHeaders:s,value:new Zt({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})};try{const c=await N5({text:a,schema:e});return{responseHeaders:s,value:new Zt({message:t(c),url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,data:c,isRetryable:r?.(o,c)})}}catch{return{responseHeaders:s,value:new Zt({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})}}},SI=e=>async({response:t})=>{const r=qc(t);if(t.body==null)throw new o5({});return{responseHeaders:r,value:R5({stream:t.body,schema:e})}},zm=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),i=await xI({text:n,schema:e}),a=qc(t);if(!i.success)throw new Zt({message:"Invalid JSON response",cause:i.error,statusCode:t.status,responseHeaders:a,responseBody:n,url:r,requestBodyValues:o});return{responseHeaders:a,value:i.value,rawValue:i.rawValue}},{btoa:z5}=globalThis;function M5(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return z5(t)}function U5(e){return e?.replace(/\/$/,"")}function Vl(e){return e!=null}var kI=(e=>(e.Unknown="unknown",e.OpenAIResponsesV1="openai-responses-v1",e.XAIResponsesV1="xai-responses-v1",e.AnthropicClaudeV1="anthropic-claude-v1",e.GoogleGeminiV1="google-gemini-v1",e))(kI||{}),Mm=O({id:S().nullish(),format:hn(kI).nullish(),index:Z().optional()}).loose(),L5=O({type:B("reasoning.summary"),summary:S()}).extend(Mm.shape),F5=O({type:B("reasoning.encrypted"),data:S()}).extend(Mm.shape),V5=O({type:B("reasoning.text"),text:S().nullish(),signature:S().nullish()}).extend(Mm.shape),Um=fe([L5,F5,V5]),Fa=fe([Um,Qe().transform(()=>null)]),Lm=D(Fa).transform(e=>e.filter(t=>!!t));fe([O({delta:O({reasoning_details:D(Fa)})}).transform(e=>e.delta.reasoning_details.filter(Vl)),O({message:O({reasoning_details:D(Fa)})}).transform(e=>e.message.reasoning_details.filter(Vl)),O({text:S(),reasoning_details:D(Fa)}).transform(e=>e.reasoning_details.filter(Vl))]);var Gc=O({error:O({code:fe([S(),Z()]).nullable().optional().default(null),message:S(),type:S().nullable().optional().default(null),param:Me().nullable().optional().default(null)}).passthrough()}).passthrough(),fi=D5({errorSchema:Gc,errorToMessage:e=>e.error.message}),EI=O({type:B("file"),file:O({hash:S(),name:S(),content:D(O({type:S(),text:S().optional()}).catchall(Me())).optional()}).catchall(Me())}).catchall(Me()),Z5=O({provider:S(),reasoning_details:D(Um).optional(),annotations:D(EI).optional(),usage:O({promptTokens:Z(),promptTokensDetails:O({cachedTokens:Z()}).catchall(Me()).optional(),completionTokens:Z(),completionTokensDetails:O({reasoningTokens:Z()}).catchall(Me()).optional(),totalTokens:Z(),cost:Z().optional(),costDetails:O({upstreamInferenceCost:Z()}).catchall(Me()).optional()}).catchall(Me())}).catchall(Me()),hh=O({openrouter:O({reasoning_details:D(Um).optional(),annotations:D(EI).optional()}).optional()}).optional();function ws(e){switch(e){case"stop":return"stop";case"length":return"length";case"content_filter":return"content-filter";case"function_call":case"tool_calls":return"tool-calls";default:return"unknown"}}var B5=["wav","mp3","aiff","aac","ogg","flac","m4a","pcm16","pcm24"];function Fm({url:e,protocols:t}){try{const r=new URL(e);return t.has(r.protocol)}catch{return!1}}function Gu({part:e,defaultMediaType:t}){var r,o;if(e.data instanceof Uint8Array){const i=M5(e.data);return`data:${(r=e.mediaType)!=null?r:t};base64,${i}`}const n=e.data.toString();return Fm({url:n,protocols:new Set(["http:","https:"])})||n.startsWith("data:")?n:`data:${(o=e.mediaType)!=null?o:t};base64,${n}`}function vh(e,t){var r;const o=e.match(/^data:([^;]+)/);return o&&(r=o[1])!=null?r:t}function Hu(e){const t=e.match(/^data:[^;]*;base64,(.+)$/);return t?t[1]:e}var q5={mpeg:"mp3",mp3:"mp3","x-wav":"wav",wave:"wav",wav:"wav",ogg:"ogg",vorbis:"ogg",aac:"aac","x-aac":"aac",m4a:"m4a","x-m4a":"m4a",mp4:"m4a",aiff:"aiff","x-aiff":"aiff",flac:"flac","x-flac":"flac",pcm16:"pcm16",pcm24:"pcm24"};function G5(e){const t=Gu({part:e,defaultMediaType:"audio/mpeg"});if(Fm({url:t,protocols:new Set(["http:","https:"])}))throw new Error(`Audio files cannot be provided as URLs.
|
|
44
|
+
|
|
45
|
+
OpenRouter requires audio to be base64-encoded. Please:
|
|
46
|
+
1. Download the audio file locally
|
|
47
|
+
2. Read it as a Buffer or Uint8Array
|
|
48
|
+
3. Pass it as the data parameter
|
|
49
|
+
|
|
50
|
+
The AI SDK will automatically handle base64 encoding.
|
|
51
|
+
|
|
52
|
+
Learn more: https://openrouter.ai/docs/features/multimodal/audio`);const r=Hu(t),o=e.mediaType||"audio/mpeg",n=o.replace("audio/",""),i=q5[n];if(i===void 0){const a=B5.join(", ");throw new Error(`Unsupported audio format: "${o}"
|
|
53
|
+
|
|
54
|
+
OpenRouter supports the following audio formats: ${a}
|
|
55
|
+
|
|
56
|
+
Learn more: https://openrouter.ai/docs/features/multimodal/audio`)}return{data:r,format:i}}function Sr(e){var t,r,o;const n=e?.anthropic,i=e?.openrouter;return(o=(r=(t=i?.cacheControl)!=null?t:i?.cache_control)!=null?r:n?.cacheControl)!=null?o:n?.cache_control}function H5(e){var t,r,o,n,i,a,s,c,l,u;const d=[];for(const{role:f,content:m,providerOptions:h}of e)switch(f){case"system":{d.push({role:"system",content:m,cache_control:Sr(h)});break}case"user":{if(m.length===1&&((t=m[0])==null?void 0:t.type)==="text"){const b=(r=Sr(h))!=null?r:Sr(m[0].providerOptions),w=b?[{type:"text",text:m[0].text,cache_control:b}]:m[0].text;d.push({role:"user",content:w});break}const g=Sr(h),y=m.map(b=>{var w,x,v,k,E,I,A;const M=(w=Sr(b.providerOptions))!=null?w:g;switch(b.type){case"text":return{type:"text",text:b.text,cache_control:M};case"file":{if((x=b.mediaType)!=null&&x.startsWith("image/"))return{type:"image_url",image_url:{url:Gu({part:b,defaultMediaType:"image/jpeg"})},cache_control:M};if((v=b.mediaType)!=null&&v.startsWith("audio/"))return{type:"input_audio",input_audio:G5(b),cache_control:M};const U=String((A=(I=(E=(k=b.providerOptions)==null?void 0:k.openrouter)==null?void 0:E.filename)!=null?I:b.filename)!=null?A:""),K=Gu({part:b,defaultMediaType:"application/pdf"});return Fm({url:K,protocols:new Set(["http:","https:"])})?{type:"file",file:{filename:U,file_data:K}}:{type:"file",file:{filename:U,file_data:K},cache_control:M}}default:return{type:"text",text:"",cache_control:M}}});d.push({role:"user",content:y});break}case"assistant":{let g="",y="";const b=[],w=[];for(const I of m)switch(I.type){case"text":{g+=I.text;break}case"tool-call":{const A=(o=I.providerOptions)==null?void 0:o.openrouter;A?.reasoning_details&&Array.isArray(A.reasoning_details)&&w.push(...A.reasoning_details),b.push({id:I.toolCallId,type:"function",function:{name:I.toolName,arguments:JSON.stringify(I.input)}});break}case"reasoning":{y+=I.text;const A=hh.safeParse(I.providerOptions);A.success&&((i=(n=A.data)==null?void 0:n.openrouter)!=null&&i.reasoning_details)&&w.push(...A.data.openrouter.reasoning_details);break}}const x=hh.safeParse(h),v=x.success?(s=(a=x.data)==null?void 0:a.openrouter)==null?void 0:s.reasoning_details:void 0,k=x.success?(l=(c=x.data)==null?void 0:c.openrouter)==null?void 0:l.annotations:void 0,E=v&&Array.isArray(v)&&v.length>0?v:w.length>0?w:void 0;d.push({role:"assistant",content:g,tool_calls:b.length>0?b:void 0,reasoning:y||void 0,reasoning_details:E,annotations:k,cache_control:Sr(h)});break}case"tool":{for(const g of m){const y=W5(g);d.push({role:"tool",tool_call_id:g.toolCallId,content:y,cache_control:(u=Sr(h))!=null?u:Sr(g.providerOptions)})}break}}return d}function W5(e){return e.output.type==="text"?e.output.value:JSON.stringify(e.output.value)}fe([B("auto"),B("none"),B("required"),O({type:B("function"),function:O({name:S()})})]);function J5(e){switch(e.type){case"auto":case"none":case"required":return e.type;case"tool":return{type:"function",function:{name:e.toolName}};default:throw new XE({argument:"toolChoice",message:`Invalid tool choice type: ${JSON.stringify(e)}`})}}var K5=O({type:B("image_url"),image_url:O({url:S()}).passthrough()}).passthrough(),Y5=fe([K5,Qe().transform(()=>null)]),II=D(Y5).transform(e=>e.filter(t=>!!t)),TI=O({id:S().optional(),model:S().optional(),provider:S().optional(),usage:O({prompt_tokens:Z(),prompt_tokens_details:O({cached_tokens:Z()}).passthrough().nullish(),completion_tokens:Z(),completion_tokens_details:O({reasoning_tokens:Z()}).passthrough().nullish(),total_tokens:Z(),cost:Z().optional(),cost_details:O({upstream_inference_cost:Z().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),X5=fe([TI.extend({choices:D(O({message:O({role:B("assistant"),content:S().nullable().optional(),reasoning:S().nullable().optional(),reasoning_details:Lm.nullish(),images:II.nullish(),tool_calls:D(O({id:S().optional().nullable(),type:B("function"),function:O({name:S(),arguments:S()}).passthrough()}).passthrough()).optional(),annotations:D(fe([O({type:B("url_citation"),url_citation:O({end_index:Z(),start_index:Z(),title:S(),url:S(),content:S().optional()}).passthrough()}).passthrough(),O({type:B("file_annotation"),file_annotation:O({file_id:S(),quote:S().optional()}).passthrough()}).passthrough(),O({type:B("file"),file:O({hash:S(),name:S(),content:D(O({type:S(),text:S().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough(),index:Z().nullish(),logprobs:O({content:D(O({token:S(),logprob:Z(),top_logprobs:D(O({token:S(),logprob:Z()}).passthrough())}).passthrough()).nullable()}).passthrough().nullable().optional(),finish_reason:S().optional().nullable()}).passthrough())}),Gc.extend({user_id:S().optional()})]),Q5=fe([TI.extend({choices:D(O({delta:O({role:hn(["assistant"]).optional(),content:S().nullish(),reasoning:S().nullish().optional(),reasoning_details:Lm.nullish(),images:II.nullish(),tool_calls:D(O({index:Z().nullish(),id:S().nullish(),type:B("function").optional(),function:O({name:S().nullish(),arguments:S().nullish()}).passthrough()}).passthrough()).nullish(),annotations:D(fe([O({type:B("url_citation"),url_citation:O({end_index:Z(),start_index:Z(),title:S(),url:S(),content:S().optional()}).passthrough()}).passthrough(),O({type:B("file_annotation"),file_annotation:O({file_id:S(),quote:S().optional()}).passthrough()}).passthrough(),O({type:B("file"),file:O({hash:S(),name:S(),content:D(O({type:S(),text:S().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough().nullish(),logprobs:O({content:D(O({token:S(),logprob:Z(),top_logprobs:D(O({token:S(),logprob:Z()}).passthrough())}).passthrough()).nullable()}).passthrough().nullish(),finish_reason:S().nullable().optional(),index:Z().nullish()}).passthrough())}),Gc]),eF=class{constructor(e,t,r){this.specificationVersion="v2",this.provider="openrouter",this.defaultObjectGenerationMode="tool",this.supportsImageUrls=!0,this.supportedUrls={"image/*":[/^data:image\/[a-zA-Z]+;base64,/,/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)$/i],"application/*":[/^data:application\//,/^https?:\/\/.+$/]},this.modelId=e,this.settings=t,this.config=r}getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:o,frequencyPenalty:n,presencePenalty:i,seed:a,stopSequences:s,responseFormat:c,topK:l,tools:u,toolChoice:d}){var f;const m=xe(xe({model:this.modelId,models:this.settings.models,logit_bias:this.settings.logitBias,logprobs:this.settings.logprobs===!0||typeof this.settings.logprobs=="number"?!0:void 0,top_logprobs:typeof this.settings.logprobs=="number"?this.settings.logprobs:typeof this.settings.logprobs=="boolean"&&this.settings.logprobs?0:void 0,user:this.settings.user,parallel_tool_calls:this.settings.parallelToolCalls,max_tokens:t,temperature:r,top_p:o,frequency_penalty:n,presence_penalty:i,seed:a,stop:s,response_format:c?.type==="json"?c.schema!=null?{type:"json_schema",json_schema:xe({schema:c.schema,strict:!0,name:(f=c.name)!=null?f:"response"},c.description&&{description:c.description})}:{type:"json_object"}:void 0,top_k:l,messages:H5(e),include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning,usage:this.settings.usage,plugins:this.settings.plugins,web_search_options:this.settings.web_search_options,provider:this.settings.provider,debug:this.settings.debug},this.config.extraBody),this.settings.extraBody);if(u&&u.length>0){const h=u.filter(g=>g.type==="function").map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.inputSchema}}));return bs(xe({},m),{tools:h,tool_choice:d?J5(d):void 0})}return m}async doGenerate(e){var t,r,o,n,i,a,s,c,l,u,d,f,m,h,g,y,b,w,x,v,k,E,I;const M=(e.providerOptions||{}).openrouter||{},U=xe(xe({},this.getArgs(e)),M),{value:K,responseHeaders:he}=await di({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:ui(this.config.headers(),e.headers),body:U,failedResponseHandler:fi,successfulResponseHandler:zm(X5),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in K){const P=K.error;throw new Zt({message:P.message,url:this.config.url({path:"/chat/completions",modelId:this.modelId}),requestBodyValues:U,statusCode:200,responseHeaders:he,data:P})}const q=K,F=q.choices[0];if(!F)throw new pI({message:"No choice in response"});const ce=q.usage?{inputTokens:(t=q.usage.prompt_tokens)!=null?t:0,outputTokens:(r=q.usage.completion_tokens)!=null?r:0,totalTokens:((o=q.usage.prompt_tokens)!=null?o:0)+((n=q.usage.completion_tokens)!=null?n:0),reasoningTokens:(a=(i=q.usage.completion_tokens_details)==null?void 0:i.reasoning_tokens)!=null?a:0,cachedInputTokens:(c=(s=q.usage.prompt_tokens_details)==null?void 0:s.cached_tokens)!=null?c:0}:{inputTokens:0,outputTokens:0,totalTokens:0,reasoningTokens:0,cachedInputTokens:0},le=(l=F.message.reasoning_details)!=null?l:[],pe=le.length>0?le.map(P=>{switch(P.type){case"reasoning.text":{if(P.text)return{type:"reasoning",text:P.text,providerMetadata:{openrouter:{reasoning_details:[P]}}};break}case"reasoning.summary":{if(P.summary)return{type:"reasoning",text:P.summary,providerMetadata:{openrouter:{reasoning_details:[P]}}};break}case"reasoning.encrypted":{if(P.data)return{type:"reasoning",text:"[REDACTED]",providerMetadata:{openrouter:{reasoning_details:[P]}}};break}}return null}).filter(P=>P!==null):F.message.reasoning?[{type:"reasoning",text:F.message.reasoning}]:[],G=[];if(G.push(...pe),F.message.content&&G.push({type:"text",text:F.message.content}),F.message.tool_calls)for(const P of F.message.tool_calls)G.push({type:"tool-call",toolCallId:(u=P.id)!=null?u:Mt(),toolName:P.function.name,input:P.function.arguments,providerMetadata:{openrouter:{reasoning_details:le}}});if(F.message.images)for(const P of F.message.images)G.push({type:"file",mediaType:vh(P.image_url.url,"image/jpeg"),data:Hu(P.image_url.url)});if(F.message.annotations)for(const P of F.message.annotations)P.type==="url_citation"&&G.push({type:"source",sourceType:"url",id:P.url_citation.url,url:P.url_citation.url,title:P.url_citation.title,providerMetadata:{openrouter:{content:P.url_citation.content||""}}});const se=(d=F.message.annotations)==null?void 0:d.filter(P=>P.type==="file"),V=F.message.tool_calls&&F.message.tool_calls.length>0,ye=le.some(P=>P.type==="reasoning.encrypted"&&P.data),ve=V&&ye&&F.finish_reason==="stop"?"tool-calls":ws(F.finish_reason);return{content:G,finishReason:ve,usage:ce,warnings:[],providerMetadata:{openrouter:Z5.parse({provider:(f=q.provider)!=null?f:"",reasoning_details:(m=F.message.reasoning_details)!=null?m:[],annotations:se&&se.length>0?se:void 0,usage:xe(xe(xe({promptTokens:(h=ce.inputTokens)!=null?h:0,completionTokens:(g=ce.outputTokens)!=null?g:0,totalTokens:(y=ce.totalTokens)!=null?y:0,cost:(b=q.usage)==null?void 0:b.cost},((x=(w=q.usage)==null?void 0:w.prompt_tokens_details)==null?void 0:x.cached_tokens)!=null?{promptTokensDetails:{cachedTokens:q.usage.prompt_tokens_details.cached_tokens}}:{}),((k=(v=q.usage)==null?void 0:v.completion_tokens_details)==null?void 0:k.reasoning_tokens)!=null?{completionTokensDetails:{reasoningTokens:q.usage.completion_tokens_details.reasoning_tokens}}:{}),((I=(E=q.usage)==null?void 0:E.cost_details)==null?void 0:I.upstream_inference_cost)!=null?{costDetails:{upstreamInferenceCost:q.usage.cost_details.upstream_inference_cost}}:{})})},request:{body:U},response:{id:q.id,modelId:q.model,headers:he}}}async doStream(e){var t;const o=(e.providerOptions||{}).openrouter||{},n=xe(xe({},this.getArgs(e)),o),{value:i,responseHeaders:a}=await di({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:ui(this.config.headers(),e.headers),body:bs(xe({},n),{stream:!0,stream_options:this.config.compatibility==="strict"?xe({include_usage:!0},(t=this.settings.usage)!=null&&t.include?{include_usage:!0}:{}):void 0}),failedResponseHandler:fi,successfulResponseHandler:SI(Q5),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=[];let c="other";const l={inputTokens:Number.NaN,outputTokens:Number.NaN,totalTokens:Number.NaN,reasoningTokens:Number.NaN,cachedInputTokens:Number.NaN},u={},d=[],f=[];let m=!1,h=!1,g,y,b,w;return{stream:i.pipeThrough(new TransformStream({transform(x,v){var k,E,I,A,M,U,K,he,q,F,ce,le,pe,G,se;if(!x.success){c="error",v.enqueue({type:"error",error:x.error});return}const V=x.value;if("error"in V){c="error",v.enqueue({type:"error",error:V.error});return}if(V.provider&&(w=V.provider),V.id&&(b=V.id,v.enqueue({type:"response-metadata",id:V.id})),V.model&&v.enqueue({type:"response-metadata",modelId:V.model}),V.usage!=null){if(l.inputTokens=V.usage.prompt_tokens,l.outputTokens=V.usage.completion_tokens,l.totalTokens=V.usage.prompt_tokens+V.usage.completion_tokens,u.promptTokens=V.usage.prompt_tokens,V.usage.prompt_tokens_details){const H=(k=V.usage.prompt_tokens_details.cached_tokens)!=null?k:0;l.cachedInputTokens=H,u.promptTokensDetails={cachedTokens:H}}if(u.completionTokens=V.usage.completion_tokens,V.usage.completion_tokens_details){const H=(E=V.usage.completion_tokens_details.reasoning_tokens)!=null?E:0;l.reasoningTokens=H,u.completionTokensDetails={reasoningTokens:H}}u.cost=V.usage.cost,u.totalTokens=V.usage.total_tokens;const P=(I=V.usage.cost_details)==null?void 0:I.upstream_inference_cost;P!=null&&(u.costDetails={upstreamInferenceCost:P})}const ye=V.choices[0];if(ye?.finish_reason!=null&&(c=ws(ye.finish_reason)),ye?.delta==null)return;const ue=ye.delta,ve=(P,H)=>{h||(y=b||Mt(),v.enqueue({providerMetadata:H,type:"reasoning-start",id:y}),h=!0),v.enqueue({providerMetadata:H,type:"reasoning-delta",delta:P,id:y||Mt()})};if(ue.reasoning_details&&ue.reasoning_details.length>0){for(const H of ue.reasoning_details)if(H.type==="reasoning.text"){const me=d[d.length-1];me?.type==="reasoning.text"?(me.text=(me.text||"")+(H.text||""),me.signature=me.signature||H.signature,me.format=me.format||H.format):d.push(xe({},H))}else d.push(H);const P={openrouter:{reasoning_details:ue.reasoning_details}};for(const H of ue.reasoning_details)switch(H.type){case"reasoning.text":{H.text&&ve(H.text,P);break}case"reasoning.encrypted":{H.data&&ve("[REDACTED]",P);break}case"reasoning.summary":{H.summary&&ve(H.summary,P);break}}}else ue.reasoning&&ve(ue.reasoning);if(ue.content&&(h&&!m&&(v.enqueue({type:"reasoning-end",id:y||Mt()}),h=!1),m||(g=b||Mt(),v.enqueue({type:"text-start",id:g}),m=!0),v.enqueue({type:"text-delta",delta:ue.content,id:g||Mt()})),ue.annotations){for(const P of ue.annotations)if(P.type==="url_citation")v.enqueue({type:"source",sourceType:"url",id:P.url_citation.url,url:P.url_citation.url,title:P.url_citation.title,providerMetadata:{openrouter:{content:P.url_citation.content||""}}});else if(P.type==="file"){const H=P.file;H&&typeof H=="object"&&"hash"in H&&"name"in H&&f.push(P)}}if(ue.tool_calls!=null)for(const P of ue.tool_calls){const H=(A=P.index)!=null?A:s.length-1;if(s[H]==null){if(P.type!=="function")throw new Mo({data:P,message:"Expected 'function' type."});if(P.id==null)throw new Mo({data:P,message:"Expected 'id' to be a string."});if(((M=P.function)==null?void 0:M.name)==null)throw new Mo({data:P,message:"Expected 'function.name' to be a string."});s[H]={id:P.id,type:"function",function:{name:P.function.name,arguments:(U=P.function.arguments)!=null?U:""},inputStarted:!1,sent:!1};const Te=s[H];if(Te==null)throw new Mo({data:{index:H,toolCallsLength:s.length},message:`Tool call at index ${H} is missing after creation.`});((K=Te.function)==null?void 0:K.name)!=null&&((he=Te.function)==null?void 0:he.arguments)!=null&&Fl(Te.function.arguments)&&(Te.inputStarted=!0,v.enqueue({type:"tool-input-start",id:Te.id,toolName:Te.function.name}),v.enqueue({type:"tool-input-delta",id:Te.id,delta:Te.function.arguments}),v.enqueue({type:"tool-input-end",id:Te.id}),v.enqueue({type:"tool-call",toolCallId:Te.id,toolName:Te.function.name,input:Te.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),Te.sent=!0);continue}const me=s[H];if(me==null)throw new Mo({data:{index:H,toolCallsLength:s.length,toolCallDelta:P},message:`Tool call at index ${H} is missing during merge.`});me.inputStarted||(me.inputStarted=!0,v.enqueue({type:"tool-input-start",id:me.id,toolName:me.function.name})),((q=P.function)==null?void 0:q.arguments)!=null&&(me.function.arguments+=(ce=(F=P.function)==null?void 0:F.arguments)!=null?ce:""),v.enqueue({type:"tool-input-delta",id:me.id,delta:(le=P.function.arguments)!=null?le:""}),((pe=me.function)==null?void 0:pe.name)!=null&&((G=me.function)==null?void 0:G.arguments)!=null&&Fl(me.function.arguments)&&(v.enqueue({type:"tool-call",toolCallId:(se=me.id)!=null?se:Mt(),toolName:me.function.name,input:me.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),me.sent=!0)}if(ue.images!=null)for(const P of ue.images)v.enqueue({type:"file",mediaType:vh(P.image_url.url,"image/jpeg"),data:Hu(P.image_url.url)})},flush(x){var v;const k=s.length>0,E=d.some(A=>A.type==="reasoning.encrypted"&&A.data);if(k&&E&&c==="stop"&&(c="tool-calls"),c==="tool-calls")for(const A of s)A&&!A.sent&&(x.enqueue({type:"tool-call",toolCallId:(v=A.id)!=null?v:Mt(),toolName:A.function.name,input:Fl(A.function.arguments)?A.function.arguments:"{}",providerMetadata:{openrouter:{reasoning_details:d}}}),A.sent=!0);h&&x.enqueue({type:"reasoning-end",id:y||Mt()}),m&&x.enqueue({type:"text-end",id:g||Mt()});const I={usage:u};w!==void 0&&(I.provider=w),d.length>0&&(I.reasoning_details=d),f.length>0&&(I.annotations=f),x.enqueue({type:"finish",finishReason:c,usage:l,providerMetadata:{openrouter:I}})}})),warnings:[],request:{body:n},response:{headers:a}}}};function tF({prompt:e,inputFormat:t,user:r="user",assistant:o="assistant"}){if(e.length===1&&e[0]&&e[0].role==="user"&&e[0].content.length===1&&e[0].content[0]&&e[0].content[0].type==="text")return{prompt:e[0].content[0].text};let n="";e[0]&&e[0].role==="system"&&(n+=`${e[0].content}
|
|
57
|
+
|
|
58
|
+
`,e=e.slice(1));for(const{role:i,content:a}of e)switch(i){case"system":throw new s5({message:`Unexpected system message in prompt: ${a}`,prompt:e});case"user":{const s=a.map(c=>{switch(c.type){case"text":return c.text;case"file":throw new Er({functionality:"file attachments"});default:return""}}).join("");n+=`${r}:
|
|
59
|
+
${s}
|
|
60
|
+
|
|
61
|
+
`;break}case"assistant":{const s=a.map(c=>{switch(c.type){case"text":return c.text;case"tool-call":throw new Er({functionality:"tool-call messages"});case"tool-result":throw new Er({functionality:"tool-result messages"});case"reasoning":throw new Er({functionality:"reasoning messages"});case"file":throw new Er({functionality:"file attachments"});default:return""}}).join("");n+=`${o}:
|
|
62
|
+
${s}
|
|
63
|
+
|
|
64
|
+
`;break}case"tool":throw new Er({functionality:"tool messages"})}return n+=`${o}:
|
|
65
|
+
`,{prompt:n}}var yh=fe([O({id:S().optional(),model:S().optional(),choices:D(O({text:S(),reasoning:S().nullish().optional(),reasoning_details:Lm.nullish(),finish_reason:S().nullish(),index:Z().nullish(),logprobs:O({tokens:D(S()),token_logprobs:D(Z()),top_logprobs:D(nr(S(),Z())).nullable()}).passthrough().nullable().optional()}).passthrough()),usage:O({prompt_tokens:Z(),prompt_tokens_details:O({cached_tokens:Z()}).passthrough().nullish(),completion_tokens:Z(),completion_tokens_details:O({reasoning_tokens:Z()}).passthrough().nullish(),total_tokens:Z(),cost:Z().optional(),cost_details:O({upstream_inference_cost:Z().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),Gc]),rF=class{constructor(e,t,r){this.specificationVersion="v2",this.provider="openrouter",this.supportsImageUrls=!0,this.supportedUrls={"image/*":[/^data:image\/[a-zA-Z]+;base64,/,/^https?:\/\/.+\.(jpg|jpeg|png|gif|webp)$/i],"text/*":[/^data:text\//,/^https?:\/\/.+$/],"application/*":[/^data:application\//,/^https?:\/\/.+$/]},this.defaultObjectGenerationMode=void 0,this.modelId=e,this.settings=t,this.config=r}getArgs({prompt:e,maxOutputTokens:t,temperature:r,topP:o,frequencyPenalty:n,presencePenalty:i,seed:a,responseFormat:s,topK:c,stopSequences:l,tools:u,toolChoice:d}){const{prompt:f}=tF({prompt:e,inputFormat:"prompt"});if(u?.length)throw new Er({functionality:"tools"});if(d)throw new Er({functionality:"toolChoice"});return xe(xe({model:this.modelId,models:this.settings.models,logit_bias:this.settings.logitBias,logprobs:typeof this.settings.logprobs=="number"?this.settings.logprobs:typeof this.settings.logprobs=="boolean"&&this.settings.logprobs?0:void 0,suffix:this.settings.suffix,user:this.settings.user,max_tokens:t,temperature:r,top_p:o,frequency_penalty:n,presence_penalty:i,seed:a,stop:l,response_format:s,top_k:c,prompt:f,include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning},this.config.extraBody),this.settings.extraBody)}async doGenerate(e){var t,r,o,n,i,a,s,c,l,u,d,f,m,h,g;const b=(e.providerOptions||{}).openrouter||{},w=xe(xe({},this.getArgs(e)),b),{value:x,responseHeaders:v}=await di({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:ui(this.config.headers(),e.headers),body:w,failedResponseHandler:fi,successfulResponseHandler:zm(yh),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in x){const E=x.error;throw new Zt({message:E.message,url:this.config.url({path:"/completions",modelId:this.modelId}),requestBodyValues:w,statusCode:200,responseHeaders:v,data:E})}const k=x.choices[0];if(!k)throw new pI({message:"No choice in OpenRouter completion response"});return{content:[{type:"text",text:(t=k.text)!=null?t:""}],finishReason:ws(k.finish_reason),usage:{inputTokens:(o=(r=x.usage)==null?void 0:r.prompt_tokens)!=null?o:0,outputTokens:(i=(n=x.usage)==null?void 0:n.completion_tokens)!=null?i:0,totalTokens:((s=(a=x.usage)==null?void 0:a.prompt_tokens)!=null?s:0)+((l=(c=x.usage)==null?void 0:c.completion_tokens)!=null?l:0),reasoningTokens:(f=(d=(u=x.usage)==null?void 0:u.completion_tokens_details)==null?void 0:d.reasoning_tokens)!=null?f:0,cachedInputTokens:(g=(h=(m=x.usage)==null?void 0:m.prompt_tokens_details)==null?void 0:h.cached_tokens)!=null?g:0},warnings:[],response:{headers:v}}}async doStream(e){const r=(e.providerOptions||{}).openrouter||{},o=xe(xe({},this.getArgs(e)),r),{value:n,responseHeaders:i}=await di({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:ui(this.config.headers(),e.headers),body:bs(xe({},o),{stream:!0,stream_options:this.config.compatibility==="strict"?{include_usage:!0}:void 0}),failedResponseHandler:fi,successfulResponseHandler:SI(yh),abortSignal:e.abortSignal,fetch:this.config.fetch});let a="other";const s={inputTokens:Number.NaN,outputTokens:Number.NaN,totalTokens:Number.NaN,reasoningTokens:Number.NaN,cachedInputTokens:Number.NaN},c={};return{stream:n.pipeThrough(new TransformStream({transform(l,u){var d,f,m;if(!l.success){a="error",u.enqueue({type:"error",error:l.error});return}const h=l.value;if("error"in h){a="error",u.enqueue({type:"error",error:h.error});return}if(h.usage!=null){if(s.inputTokens=h.usage.prompt_tokens,s.outputTokens=h.usage.completion_tokens,s.totalTokens=h.usage.prompt_tokens+h.usage.completion_tokens,c.promptTokens=h.usage.prompt_tokens,h.usage.prompt_tokens_details){const b=(d=h.usage.prompt_tokens_details.cached_tokens)!=null?d:0;s.cachedInputTokens=b,c.promptTokensDetails={cachedTokens:b}}if(c.completionTokens=h.usage.completion_tokens,h.usage.completion_tokens_details){const b=(f=h.usage.completion_tokens_details.reasoning_tokens)!=null?f:0;s.reasoningTokens=b,c.completionTokensDetails={reasoningTokens:b}}c.cost=h.usage.cost,c.totalTokens=h.usage.total_tokens;const y=(m=h.usage.cost_details)==null?void 0:m.upstream_inference_cost;y!=null&&(c.costDetails={upstreamInferenceCost:y})}const g=h.choices[0];g?.finish_reason!=null&&(a=ws(g.finish_reason)),g?.text!=null&&u.enqueue({type:"text-delta",delta:g.text,id:Mt()})},flush(l){l.enqueue({type:"finish",finishReason:a,usage:s,providerMetadata:{openrouter:{usage:c}}})}})),response:{headers:i}}}},nF=O({prompt_tokens:Z(),total_tokens:Z(),cost:Z().optional()}),oF=O({object:B("embedding"),embedding:D(Z()),index:Z().optional()}),iF=O({id:S().optional(),object:B("list"),data:D(oF),model:S(),usage:nF.optional()}),aF=class{constructor(e,t,r){this.specificationVersion="v2",this.provider="openrouter",this.maxEmbeddingsPerCall=void 0,this.supportsParallelCalls=!0,this.modelId=e,this.settings=t,this.config=r}async doEmbed(e){var t;const{values:r,abortSignal:o,headers:n}=e,i=xe(xe({model:this.modelId,input:r,user:this.settings.user,provider:this.settings.provider},this.config.extraBody),this.settings.extraBody),{value:a,responseHeaders:s}=await di({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:ui(this.config.headers(),n),body:i,failedResponseHandler:fi,successfulResponseHandler:zm(iF),abortSignal:o,fetch:this.config.fetch});return{embeddings:a.data.map(c=>c.embedding),usage:a.usage?{tokens:a.usage.prompt_tokens}:void 0,providerMetadata:(t=a.usage)!=null&&t.cost?{openrouter:{usage:{cost:a.usage.cost}}}:void 0,response:{headers:s,body:a}}}};function sF(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==null))}function cF(e,...t){const r=sF(e??{}),n=[r["user-agent"]||"",...t].filter(Boolean).join(" ");return bs(xe({},r),{"user-agent":n})}var lF="1.5.4";function $I(e={}){var t,r,o;const n=(r=U5((t=e.baseURL)!=null?t:e.baseUrl))!=null?r:"https://openrouter.ai/api/v1",i=(o=e.compatibility)!=null?o:"compatible",a=()=>cF(xe(xe({Authorization:`Bearer ${x5({apiKey:e.apiKey,environmentVariableName:"OPENROUTER_API_KEY",description:"OpenRouter"})}`},e.headers),e.api_keys&&Object.keys(e.api_keys).length>0&&{"X-Provider-API-Keys":JSON.stringify(e.api_keys)}),`ai-sdk/openrouter/${lF}`),s=(f,m={})=>new eF(f,m,{provider:"openrouter.chat",url:({path:h})=>`${n}${h}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),c=(f,m={})=>new rF(f,m,{provider:"openrouter.completion",url:({path:h})=>`${n}${h}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),l=(f,m={})=>new aF(f,m,{provider:"openrouter.embedding",url:({path:h})=>`${n}${h}`,headers:a,fetch:e.fetch,extraBody:e.extraBody}),u=(f,m)=>{if(new.target)throw new Error("The OpenRouter model function cannot be called with the new keyword.");return f==="openai/gpt-3.5-turbo-instruct"?c(f,m):s(f,m)},d=(f,m)=>u(f,m);return d.languageModel=u,d.chat=s,d.completion=c,d.textEmbeddingModel=l,d.embedding=l,d}$I({compatibility:"strict"});function Wu(...e){return e.reduce((t,r)=>({...t,...r??{}}),{})}async function OI(e,t){if(e==null)return Promise.resolve();const r=t?.abortSignal;return new Promise((o,n)=>{if(r?.aborted){n(bh());return}const i=setTimeout(()=>{a(),o()},e),a=()=>{clearTimeout(i),r?.removeEventListener("abort",s)},s=()=>{a(),n(bh())};r?.addEventListener("abort",s)})}function bh(){return new DOMException("Delay was aborted","AbortError")}function na(e){return Object.fromEntries([...e.headers])}var oa=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const i=r.length,a=new Array(t);for(let s=0;s<t;s++)a[s]=r[Math.random()*i|0];return a.join("")};if(e==null)return n;if(r.includes(o))throw new pd({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},uF=oa();function AI(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}function cn(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var dF=["fetch failed","failed to fetch"];function CI({error:e,url:t,requestBodyValues:r}){if(cn(e))return e;if(e instanceof TypeError&&dF.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new st({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function Vm(e=globalThis){var t,r,o;return e.window?"runtime/browser":(t=e.navigator)!=null&&t.userAgent?`runtime/${e.navigator.userAgent.toLowerCase()}`:(o=(r=e.process)==null?void 0:r.versions)!=null&&o.node?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function fF(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((r,o)=>{t[o.toLowerCase()]=r});else{Array.isArray(e)||(e=Object.entries(e));for(const[r,o]of e)o!=null&&(t[r.toLowerCase()]=o)}return t}function Hc(e,...t){const r=new Headers(fF(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var NI="3.0.16",mF=()=>globalThis.fetch,_h=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:o,abortSignal:n,fetch:i=mF()})=>{try{const a=await i(e,{method:"GET",headers:Hc(t,`ai-sdk/provider-utils/${NI}`,Vm()),signal:n}),s=na(a);if(!a.ok){let c;try{c=await o({response:a,url:e,requestBodyValues:{}})}catch(l){throw cn(l)||st.isInstance(l)?l:new st({message:"Failed to process error response",cause:l,statusCode:a.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw c.value}try{return await r({response:a,url:e,requestBodyValues:{}})}catch(c){throw c instanceof Error&&(cn(c)||st.isInstance(c))?c:new st({message:"Failed to process successful response",cause:c,statusCode:a.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(a){throw CI({error:a,url:e,requestBodyValues:{}})}};function pF({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map(([o,n])=>{const i=o.toLowerCase();return i==="*"||i==="*/*"?{mediaTypePrefix:"",regexes:n}:{mediaTypePrefix:i.replace(/\*/,""),regexes:n}}).filter(({mediaTypePrefix:o})=>e.startsWith(o)).flatMap(({regexes:o})=>o).some(o=>o.test(t))}function Va({settingValue:e,environmentVariableName:t}){if(typeof e=="string")return e;if(!(e!=null||typeof process>"u")&&(e=process.env[t],!(e==null||typeof e!="string")))return e}var gF=/"__proto__"\s*:/,hF=/"constructor"\s*:/;function vF(e){const t=JSON.parse(e);return t===null||typeof t!="object"||gF.test(e)===!1&&hF.test(e)===!1?t:yF(t)}function yF(e){let t=[e];for(;t.length;){const r=t;t=[];for(const o of r){if(Object.prototype.hasOwnProperty.call(o,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(o,"constructor")&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const n in o){const i=o[n];i&&typeof i=="object"&&t.push(i)}}}return e}function RI(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return vF(e)}finally{Error.stackTraceLimit=t}}var xs=Symbol.for("vercel.ai.validator");function bF(e){return{[xs]:!0,validate:e}}function _F(e){return typeof e=="object"&&e!==null&&xs in e&&e[xs]===!0&&"validate"in e}function So(e){let t;return()=>(t==null&&(t=e()),t)}function wF(e){return _F(e)?e:typeof e=="function"?e():xF(e)}function xF(e){return bF(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new Ko({value:t,cause:r.issues})}})}async function Ju({value:e,schema:t}){const r=await Mr({value:e,schema:t});if(!r.success)throw Ko.wrap({value:e,cause:r.error});return r.value}async function Mr({value:e,schema:t}){const r=wF(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const o=await r.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:Ko.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:Ko.wrap({value:e,cause:o}),rawValue:e}}}async function SF({text:e,schema:t}){try{const r=RI(e);return t==null?r:Ju({value:r,schema:t})}catch(r){throw Ha.isInstance(r)||Ko.isInstance(r)?r:new Ha({text:e,cause:r})}}async function ln({text:e,schema:t}){try{const r=RI(e);return t==null?{success:!0,value:r,rawValue:r}:await Mr({value:r,schema:t})}catch(r){return{success:!1,error:Ha.isInstance(r)?r:new Ha({text:e,cause:r}),rawValue:void 0}}}function kF({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await ln({text:r,schema:t}))}}))}var EF=()=>globalThis.fetch,Ku=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>IF({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),IF=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=EF()})=>{try{const s=await a(e,{method:"POST",headers:Hc(t,`ai-sdk/provider-utils/${NI}`,Vm()),body:r.content,signal:i}),c=na(s);if(!s.ok){let l;try{l=await n({response:s,url:e,requestBodyValues:r.values})}catch(u){throw cn(u)||st.isInstance(u)?u:new st({message:"Failed to process error response",cause:u,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw l.value}try{return await o({response:s,url:e,requestBodyValues:r.values})}catch(l){throw l instanceof Error&&(cn(l)||st.isInstance(l))?l:new st({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw CI({error:s,url:e,requestBodyValues:r.values})}};async function $r(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var mi=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:i})=>{const a=await o.text(),s=na(o);if(a.trim()==="")return{responseHeaders:s,value:new st({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})};try{const c=await SF({text:a,schema:e});return{responseHeaders:s,value:new st({message:t(c),url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,data:c,isRetryable:r?.(o,c)})}}catch{return{responseHeaders:s,value:new st({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})}}},TF=e=>async({response:t})=>{const r=na(t);if(t.body==null)throw new oO({});return{responseHeaders:r,value:kF({stream:t.body,schema:e})}},Ss=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),i=await ln({text:n,schema:e}),a=na(t);if(!i.success)throw new st({message:"Invalid JSON response",cause:i.error,statusCode:t.status,responseHeaders:a,responseBody:n,url:r,requestBodyValues:o});return{responseHeaders:a,value:i.value,rawValue:i.rawValue}},$F=(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("/")},OF=Symbol("Let zodToJsonSchema decide on which parser to use"),wh={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"},AF=e=>typeof e=="string"?{...wh,name:e}:{...wh,...e};function xt(){return{}}function CF(e,t){var r,o,n;const i={type:"array"};return(r=e.type)!=null&&r._def&&((n=(o=e.type)==null?void 0:o._def)==null?void 0:n.typeName)!==X.ZodAny&&(i.items=Se(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(i.minItems=e.minLength.value),e.maxLength&&(i.maxItems=e.maxLength.value),e.exactLength&&(i.minItems=e.exactLength.value,i.maxItems=e.exactLength.value),i}function NF(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 RF(){return{type:"boolean"}}function PI(e,t){return Se(e.type._def,t)}var PF=(e,t)=>Se(e.innerType._def,t);function jI(e,t,r){const o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>jI(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return jF(e)}}var jF=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 DF(e,t){return{...Se(e.innerType._def,t),default:e.defaultValue()}}function zF(e,t){return t.effectStrategy==="input"?Se(e.schema._def,t):xt()}function MF(e){return{type:"string",enum:Array.from(e.values)}}var UF=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function LF(e,t){const r=[Se(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Se(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(n=>!!n),o=[];return r.forEach(n=>{if(UF(n))o.push(...n.allOf);else{let i=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:a,...s}=n;i=s}o.push(i)}}),o.length?{allOf:o}:void 0}function FF(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 Zl=void 0,Dt={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:()=>(Zl===void 0&&(Zl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Zl),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 DI(e,t){const r={type:"string"};if(e.checks)for(const o of e.checks)switch(o.kind){case"min":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value;break;case"max":r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value;break;case"email":switch(t.emailStrategy){case"format:email":zt(r,"email",o.message,t);break;case"format:idn-email":zt(r,"idn-email",o.message,t);break;case"pattern:zod":ot(r,Dt.email,o.message,t);break}break;case"url":zt(r,"uri",o.message,t);break;case"uuid":zt(r,"uuid",o.message,t);break;case"regex":ot(r,o.regex,o.message,t);break;case"cuid":ot(r,Dt.cuid,o.message,t);break;case"cuid2":ot(r,Dt.cuid2,o.message,t);break;case"startsWith":ot(r,RegExp(`^${Bl(o.value,t)}`),o.message,t);break;case"endsWith":ot(r,RegExp(`${Bl(o.value,t)}$`),o.message,t);break;case"datetime":zt(r,"date-time",o.message,t);break;case"date":zt(r,"date",o.message,t);break;case"time":zt(r,"time",o.message,t);break;case"duration":zt(r,"duration",o.message,t);break;case"length":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value;break;case"includes":{ot(r,RegExp(Bl(o.value,t)),o.message,t);break}case"ip":{o.version!=="v6"&&zt(r,"ipv4",o.message,t),o.version!=="v4"&&zt(r,"ipv6",o.message,t);break}case"base64url":ot(r,Dt.base64url,o.message,t);break;case"jwt":ot(r,Dt.jwt,o.message,t);break;case"cidr":{o.version!=="v6"&&ot(r,Dt.ipv4Cidr,o.message,t),o.version!=="v4"&&ot(r,Dt.ipv6Cidr,o.message,t);break}case"emoji":ot(r,Dt.emoji(),o.message,t);break;case"ulid":{ot(r,Dt.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{zt(r,"binary",o.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{ot(r,Dt.base64,o.message,t);break}}break}case"nanoid":ot(r,Dt.nanoid,o.message,t)}return r}function Bl(e,t){return t.patternStrategy==="escape"?ZF(e):e}var VF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ZF(e){let t="";for(let r=0;r<e.length;r++)VF.has(e[r])||(t+="\\"),t+=e[r];return t}function zt(e,t,r,o){var n;e.format||(n=e.anyOf)!=null&&n.some(i=>i.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&o.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function ot(e,t,r,o){var n;e.pattern||(n=e.allOf)!=null&&n.some(i=>i.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:xh(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=xh(t,o)}function xh(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const o={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},n=o.i?e.source.toLowerCase():e.source;let i="",a=!1,s=!1,c=!1;for(let l=0;l<n.length;l++){if(a){i+=n[l],a=!1;continue}if(o.i){if(s){if(n[l].match(/[a-z]/)){c?(i+=n[l],i+=`${n[l-2]}-${n[l]}`.toUpperCase(),c=!1):n[l+1]==="-"&&((r=n[l+2])!=null&&r.match(/[a-z]/))?(i+=n[l],c=!0):i+=`${n[l]}${n[l].toUpperCase()}`;continue}}else if(n[l].match(/[a-z]/)){i+=`[${n[l]}${n[l].toUpperCase()}]`;continue}}if(o.m){if(n[l]==="^"){i+=`(^|(?<=[\r
|
|
66
|
+
]))`;continue}else if(n[l]==="$"){i+=`($|(?=[\r
|
|
67
|
+
]))`;continue}}if(o.s&&n[l]==="."){i+=s?`${n[l]}\r
|
|
68
|
+
`:`[${n[l]}\r
|
|
69
|
+
]`;continue}i+=n[l],n[l]==="\\"?a=!0:s&&n[l]==="]"?s=!1:!s&&n[l]==="["&&(s=!0)}try{new RegExp(i)}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 i}function zI(e,t){var r,o,n,i,a,s;const c={type:"object",additionalProperties:(r=Se(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((o=e.keyType)==null?void 0:o._def.typeName)===X.ZodString&&((n=e.keyType._def.checks)!=null&&n.length)){const{type:l,...u}=DI(e.keyType._def,t);return{...c,propertyNames:u}}else{if(((i=e.keyType)==null?void 0:i._def.typeName)===X.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((a=e.keyType)==null?void 0:a._def.typeName)===X.ZodBranded&&e.keyType._def.type._def.typeName===X.ZodString&&((s=e.keyType._def.type._def.checks)!=null&&s.length)){const{type:l,...u}=PI(e.keyType._def,t);return{...c,propertyNames:u}}}return c}function BF(e,t){if(t.mapStrategy==="record")return zI(e,t);const r=Se(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||xt(),o=Se(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||xt();return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function qF(e){const t=e.values,o=Object.keys(e.values).filter(i=>typeof t[t[i]]!="number").map(i=>t[i]),n=Array.from(new Set(o.map(i=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function GF(){return{not:xt()}}function HF(){return{type:"null"}}var Yu={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function WF(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(o=>o._def.typeName in Yu&&(!o._def.checks||!o._def.checks.length))){const o=r.reduce((n,i)=>{const a=Yu[i._def.typeName];return a&&!n.includes(a)?[...n,a]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every(o=>o._def.typeName==="ZodLiteral"&&!o.description)){const o=r.reduce((n,i)=>{const a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...n,a];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){const n=o.filter((i,a,s)=>s.indexOf(i)===a);return{type:n.length>1?n:n[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every(o=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter(i=>!o.includes(i))],[])};return JF(e,t)}var JF=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>Se(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(o=>!!o&&(!t.strictUnions||typeof o=="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function KF(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Yu[e.innerType._def.typeName],"null"]};const r=Se(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function YF(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 XF(e,t){const r={type:"object",properties:{}},o=[],n=e.shape();for(const a in n){let s=n[a];if(s===void 0||s._def===void 0)continue;const c=e3(s),l=Se(s._def,{...t,currentPath:[...t.currentPath,"properties",a],propertyPath:[...t.currentPath,"properties",a]});l!==void 0&&(r.properties[a]=l,c||o.push(a))}o.length&&(r.required=o);const i=QF(e,t);return i!==void 0&&(r.additionalProperties=i),r}function QF(e,t){if(e.catchall._def.typeName!=="ZodNever")return Se(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 e3(e){try{return e.isOptional()}catch{return!0}}var t3=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return Se(e.innerType._def,t);const o=Se(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return o?{anyOf:[{not:xt()},o]}:xt()},r3=(e,t)=>{if(t.pipeStrategy==="input")return Se(e.in._def,t);if(t.pipeStrategy==="output")return Se(e.out._def,t);const r=Se(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=Se(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter(n=>n!==void 0)}};function n3(e,t){return Se(e.type._def,t)}function o3(e,t){const o={type:"array",uniqueItems:!0,items:Se(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(o.minItems=e.minSize.value),e.maxSize&&(o.maxItems=e.maxSize.value),o}function i3(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>Se(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:Se(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>Se(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function a3(){return{not:xt()}}function s3(){return xt()}var c3=(e,t)=>Se(e.innerType._def,t),l3=(e,t,r)=>{switch(t){case X.ZodString:return DI(e,r);case X.ZodNumber:return YF(e);case X.ZodObject:return XF(e,r);case X.ZodBigInt:return NF(e);case X.ZodBoolean:return RF();case X.ZodDate:return jI(e,r);case X.ZodUndefined:return a3();case X.ZodNull:return HF();case X.ZodArray:return CF(e,r);case X.ZodUnion:case X.ZodDiscriminatedUnion:return WF(e,r);case X.ZodIntersection:return LF(e,r);case X.ZodTuple:return i3(e,r);case X.ZodRecord:return zI(e,r);case X.ZodLiteral:return FF(e);case X.ZodEnum:return MF(e);case X.ZodNativeEnum:return qF(e);case X.ZodNullable:return KF(e,r);case X.ZodOptional:return t3(e,r);case X.ZodMap:return BF(e,r);case X.ZodSet:return o3(e,r);case X.ZodLazy:return()=>e.getter()._def;case X.ZodPromise:return n3(e,r);case X.ZodNaN:case X.ZodNever:return GF();case X.ZodEffects:return zF(e,r);case X.ZodAny:return xt();case X.ZodUnknown:return s3();case X.ZodDefault:return DF(e,r);case X.ZodBranded:return PI(e,r);case X.ZodReadonly:return c3(e,r);case X.ZodCatch:return PF(e,r);case X.ZodPipeline:return r3(e,r);case X.ZodFunction:case X.ZodVoid:case X.ZodSymbol:return;default:return(o=>{})()}};function Se(e,t,r=!1){var o;const n=t.seen.get(e);if(t.override){const c=(o=t.override)==null?void 0:o.call(t,e,t,n,r);if(c!==OF)return c}if(n&&!r){const c=u3(n,t);if(c!==void 0)return c}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const a=l3(e,e.typeName,t),s=typeof a=="function"?Se(a(),t):a;if(s&&d3(e,t,s),t.postProcess){const c=t.postProcess(s,e,t);return i.jsonSchema=s,c}return i.jsonSchema=s,s}var u3=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:$F(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),xt()):t.$refStrategy==="seen"?xt():void 0}},d3=(e,t,r)=>(e.description&&(r.description=e.description),r),f3=e=>{const t=AF(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(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}},m3=(e,t)=>{var r;const o=f3(t);let n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((l,[u,d])=>{var f;return{...l,[u]:(f=Se(d._def,{...o,currentPath:[...o.basePath,o.definitionPath,u]},!0))!=null?f:xt()}},{}):void 0;const i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,a=(r=Se(e._def,i===void 0?o:{...o,currentPath:[...o.basePath,o.definitionPath,i]},!1))!=null?r:xt(),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(a.title=s);const c=i===void 0?n?{...a,[o.definitionPath]:n}:a:{$ref:[...o.$refStrategy==="relative"?[]:o.basePath,o.definitionPath,i].join("/"),[o.definitionPath]:{...n,[i]:a}};return c.$schema="http://json-schema.org/draft-07/schema#",c},p3=m3;function g3(e,t){var r;const o=(r=void 0)!=null?r:!1;return Zm(()=>p3(e,{$refStrategy:o?"root":"none"}),{validate:async n=>{const i=await e.safeParseAsync(n);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}}})}function h3(e,t){var r;const o=(r=void 0)!=null?r:!1;return Zm(()=>mf(e,{target:"draft-7",io:"output",reused:o?"ref":"inline"}),{validate:async n=>{const i=await yf(e,n);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}}})}function v3(e){return"_zod"in e}function wn(e,t){return v3(e)?h3(e):g3(e)}var Xu=Symbol.for("vercel.ai.schema");function Zm(e,{validate:t}={}){return{[Xu]:!0,_type:void 0,[xs]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function y3(e){return typeof e=="object"&&e!==null&&Xu in e&&e[Xu]===!0&&"jsonSchema"in e&&"validate"in e}function Wc(e){return e==null?Zm({properties:{},additionalProperties:!1}):y3(e)?e:typeof e=="function"?e():wn(e)}var{btoa:b3,atob:_3}=globalThis;function Bm(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=_3(t);return Uint8Array.from(r,o=>o.codePointAt(0))}function Qu(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return b3(t)}function w3(e){return e?.replace(/\/$/,"")}function x3(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}async function*S3({execute:e,input:t,options:r}){const o=e(t,r);if(x3(o)){let n;for await(const i of o)n=i,yield{type:"preliminary",output:i};yield{type:"final",output:n}}else yield{type:"final",output:await o}}var ql,Sh;function k3(){if(Sh)return ql;Sh=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(u,d)=>{for(var f in d)e(u,f,{get:d[f],enumerable:!0})},i=(u,d,f,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let h of r(d))!o.call(u,h)&&h!==f&&e(u,h,{get:()=>d[h],enumerable:!(m=t(d,h))||m.enumerable});return u},a=u=>i(e({},"__esModule",{value:!0}),u),s={};n(s,{SYMBOL_FOR_REQ_CONTEXT:()=>c,getContext:()=>l}),ql=a(s);const c=Symbol.for("@vercel/request-context");function l(){return globalThis[c]?.get?.()??{}}return ql}var Gl,kh;function E3(){if(kh)return Gl;kh=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(d,f)=>{for(var m in f)e(d,m,{get:f[m],enumerable:!0})},i=(d,f,m,h)=>{if(f&&typeof f=="object"||typeof f=="function")for(let g of r(f))!o.call(d,g)&&g!==m&&e(d,g,{get:()=>f[g],enumerable:!(h=t(f,g))||h.enumerable});return d},a=d=>i(e({},"__esModule",{value:!0}),d),s={};n(s,{getContext:()=>c.getContext,getVercelOidcToken:()=>l,getVercelOidcTokenSync:()=>u}),Gl=a(s);var c=k3();async function l(){return""}function u(){return""}return Gl}var MI=E3(),I3="vercel.ai.gateway.error",Hl=Symbol.for(I3),Eh,Ih,St=class UI extends(Ih=Error,Eh=Hl,Ih){constructor({message:t,statusCode:r=500,cause:o}){super(t),this[Eh]=!0,this.statusCode=r,this.cause=o}static isInstance(t){return UI.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&Hl in t&&t[Hl]===!0}},LI="GatewayAuthenticationError",T3=`vercel.ai.gateway.error.${LI}`,Th=Symbol.for(T3),$h,Oh,qm=class FI extends(Oh=St,$h=Th,Oh){constructor({message:t="Authentication failed",statusCode:r=401,cause:o}={}){super({message:t,statusCode:r,cause:o}),this[$h]=!0,this.name=LI,this.type="authentication_error"}static isInstance(t){return St.hasMarker(t)&&Th in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:o="Authentication failed",statusCode:n=401,cause:i}){let a;return t?a=`AI Gateway authentication failed: Invalid API key.
|
|
70
|
+
|
|
71
|
+
Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
72
|
+
|
|
73
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?a=`AI Gateway authentication failed: Invalid OIDC token.
|
|
74
|
+
|
|
75
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
|
|
76
|
+
|
|
77
|
+
Alternatively, use an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys`:a=`AI Gateway authentication failed: No authentication provided.
|
|
78
|
+
|
|
79
|
+
Option 1 - API key:
|
|
80
|
+
Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
|
|
81
|
+
Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
|
|
82
|
+
|
|
83
|
+
Option 2 - OIDC token:
|
|
84
|
+
Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new FI({message:a,statusCode:n,cause:i})}},VI="GatewayInvalidRequestError",$3=`vercel.ai.gateway.error.${VI}`,Ah=Symbol.for($3),Ch,Nh,O3=class extends(Nh=St,Ch=Ah,Nh){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Ch]=!0,this.name=VI,this.type="invalid_request_error"}static isInstance(e){return St.hasMarker(e)&&Ah in e}},ZI="GatewayRateLimitError",A3=`vercel.ai.gateway.error.${ZI}`,Rh=Symbol.for(A3),Ph,jh,C3=class extends(jh=St,Ph=Rh,jh){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Ph]=!0,this.name=ZI,this.type="rate_limit_exceeded"}static isInstance(e){return St.hasMarker(e)&&Rh in e}},BI="GatewayModelNotFoundError",N3=`vercel.ai.gateway.error.${BI}`,Dh=Symbol.for(N3),R3=So(()=>wn(O({modelId:S()}))),zh,Mh,qI=class extends(Mh=St,zh=Dh,Mh){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:o}={}){super({message:e,statusCode:t,cause:o}),this[zh]=!0,this.name=BI,this.type="model_not_found",this.modelId=r}static isInstance(e){return St.hasMarker(e)&&Dh in e}},GI="GatewayInternalServerError",P3=`vercel.ai.gateway.error.${GI}`,Uh=Symbol.for(P3),Lh,Fh,Vh=class extends(Fh=St,Lh=Uh,Fh){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Lh]=!0,this.name=GI,this.type="internal_server_error"}static isInstance(e){return St.hasMarker(e)&&Uh in e}},HI="GatewayResponseError",j3=`vercel.ai.gateway.error.${HI}`,Zh=Symbol.for(j3),Bh,qh,D3=class extends(qh=St,Bh=Zh,qh){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:o,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[Bh]=!0,this.name=HI,this.type="response_error",this.response=r,this.validationError=o}static isInstance(e){return St.hasMarker(e)&&Zh in e}};async function Gh({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:o,authMethod:n}){const i=await Mr({value:e,schema:z3});if(!i.success)return new D3({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:i.error,cause:o});const a=i.value,s=a.error.type,c=a.error.message;switch(s){case"authentication_error":return qm.createContextualError({apiKeyProvided:n==="api-key",oidcTokenProvided:n==="oidc",statusCode:t,cause:o});case"invalid_request_error":return new O3({message:c,statusCode:t,cause:o});case"rate_limit_exceeded":return new C3({message:c,statusCode:t,cause:o});case"model_not_found":{const l=await Mr({value:a.error.param,schema:R3});return new qI({message:c,statusCode:t,modelId:l.success?l.value.modelId:void 0,cause:o})}case"internal_server_error":return new Vh({message:c,statusCode:t,cause:o});default:return new Vh({message:c,statusCode:t,cause:o})}}var z3=So(()=>wn(O({error:O({message:S(),type:S().nullish(),param:Qe().nullish(),code:fe([S(),Z()]).nullish()})})));function un(e,t){var r;return St.isInstance(e)?e:st.isInstance(e)?Gh({response:M3(e),statusCode:(r=e.statusCode)!=null?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):Gh({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function M3(e){if(e.data!==void 0)return e.data;if(e.responseBody!=null)try{return JSON.parse(e.responseBody)}catch{return e.responseBody}return{}}var WI="ai-gateway-auth-method";async function pi(e){const t=await Mr({value:e[WI],schema:U3});return t.success?t.value:void 0}var U3=So(()=>wn(fe([B("api-key"),B("oidc")]))),Hh=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await _h({url:`${this.config.baseURL}/config`,headers:await $r(this.config.headers()),successfulResponseHandler:Ss(L3),failedResponseHandler:mi({errorSchema:Me(),errorToMessage:t=>t}),fetch:this.config.fetch});return e}catch(e){throw await un(e)}}async getCredits(){try{const e=new URL(this.config.baseURL),{value:t}=await _h({url:`${e.origin}/v1/credits`,headers:await $r(this.config.headers()),successfulResponseHandler:Ss(F3),failedResponseHandler:mi({errorSchema:Me(),errorToMessage:r=>r}),fetch:this.config.fetch});return t}catch(e){throw await un(e)}}},L3=So(()=>wn(O({models:D(O({id:S(),name:S(),description:S().nullish(),pricing:O({input:S(),output:S(),input_cache_read:S().nullish(),input_cache_write:S().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:o})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...o?{cacheCreationInputTokens:o}:{}})).nullish(),specification:O({specificationVersion:B("v2"),provider:S(),modelId:S()}),modelType:hn(["language","embedding","image"]).nullish()}))}))),F3=So(()=>wn(O({balance:S(),total_used:S()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),V3=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v2",this.supportedUrls={"*/*":[/.*/]}}get provider(){return this.config.provider}async getArgs(e){const{abortSignal:t,...r}=e;return{args:this.maybeEncodeFileParts(r),warnings:[]}}async doGenerate(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:o}=e,n=await $r(this.config.headers());try{const{responseHeaders:i,value:a,rawValue:s}=await Ku({url:this.getUrl(),headers:Wu(n,e.headers,this.getModelConfigHeaders(this.modelId,!1),await $r(this.config.o11yHeaders)),body:t,successfulResponseHandler:Ss(Me()),failedResponseHandler:mi({errorSchema:Me(),errorToMessage:c=>c}),...o&&{abortSignal:o},fetch:this.config.fetch});return{...a,request:{body:t},response:{headers:i,body:s},warnings:r}}catch(i){throw await un(i,await pi(n))}}async doStream(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:o}=e,n=await $r(this.config.headers());try{const{value:i,responseHeaders:a}=await Ku({url:this.getUrl(),headers:Wu(n,e.headers,this.getModelConfigHeaders(this.modelId,!0),await $r(this.config.o11yHeaders)),body:t,successfulResponseHandler:TF(Me()),failedResponseHandler:mi({errorSchema:Me(),errorToMessage:s=>s}),...o&&{abortSignal:o},fetch:this.config.fetch});return{stream:i.pipeThrough(new TransformStream({start(s){r.length>0&&s.enqueue({type:"stream-start",warnings:r})},transform(s,c){if(s.success){const l=s.value;if(l.type==="raw"&&!e.includeRawChunks)return;l.type==="response-metadata"&&l.timestamp&&typeof l.timestamp=="string"&&(l.timestamp=new Date(l.timestamp)),c.enqueue(l)}else c.error(s.error)}})),request:{body:t},response:{headers:a}}}catch(i){throw await un(i,await pi(n))}}isFilePart(e){return e&&typeof e=="object"&&"type"in e&&e.type==="file"}maybeEncodeFileParts(e){for(const t of e.prompt)for(const r of t.content)if(this.isFilePart(r)){const o=r;if(o.data instanceof Uint8Array){const n=Uint8Array.from(o.data),i=Buffer.from(n).toString("base64");o.data=new URL(`data:${o.mediaType||"application/octet-stream"};base64,${i}`)}}return e}getUrl(){return`${this.config.baseURL}/language-model`}getModelConfigHeaders(e,t){return{"ai-language-model-specification-version":"2","ai-language-model-id":e,"ai-language-model-streaming":String(t)}}},Z3=class{constructor(e,t){this.modelId=e,this.config=t,this.specificationVersion="v2",this.maxEmbeddingsPerCall=2048,this.supportsParallelCalls=!0}get provider(){return this.config.provider}async doEmbed({values:e,headers:t,abortSignal:r,providerOptions:o}){var n;const i=await $r(this.config.headers());try{const{responseHeaders:a,value:s,rawValue:c}=await Ku({url:this.getUrl(),headers:Wu(i,t??{},this.getModelConfigHeaders(),await $r(this.config.o11yHeaders)),body:{input:e.length===1?e[0]:e,...o?{providerOptions:o}:{}},successfulResponseHandler:Ss(B3),failedResponseHandler:mi({errorSchema:Me(),errorToMessage:l=>l}),...r&&{abortSignal:r},fetch:this.config.fetch});return{embeddings:s.embeddings,usage:(n=s.usage)!=null?n:void 0,providerMetadata:s.providerMetadata,response:{headers:a,body:c}}}catch(a){throw await un(a,await pi(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"2","ai-model-id":this.modelId}}},B3=So(()=>wn(O({embeddings:D(D(Z())),usage:O({tokens:Z()}).nullish(),providerMetadata:nr(S(),nr(S(),Qe())).optional()})));async function q3(){var e;return(e=MI.getContext().headers)==null?void 0:e["x-vercel-id"]}var G3="2.0.7",H3="0.0.1";function W3(e={}){var t,r;let o=null,n=null;const i=(t=e.metadataCacheRefreshMillis)!=null?t:1e3*60*5;let a=0;const s=(r=w3(e.baseURL))!=null?r:"https://ai-gateway.vercel.sh/v1/ai",c=async()=>{const h=await K3(e);if(h)return Hc({Authorization:`Bearer ${h.token}`,"ai-gateway-protocol-version":H3,[WI]:h.authMethod,...e.headers},`ai-sdk/gateway/${G3}`);throw qm.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401})},l=()=>{const h=Va({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),g=Va({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),y=Va({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const b=await q3();return{...h&&{"ai-o11y-deployment-id":h},...g&&{"ai-o11y-environment":g},...y&&{"ai-o11y-region":y},...b&&{"ai-o11y-request-id":b}}}},u=h=>new V3(h,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),d=async()=>{var h,g,y;const b=(y=(g=(h=e._internal)==null?void 0:h.currentDate)==null?void 0:g.call(h).getTime())!=null?y:Date.now();return(!o||b-a>i)&&(a=b,o=new Hh({baseURL:s,headers:c,fetch:e.fetch}).getAvailableModels().then(w=>(n=w,w)).catch(async w=>{throw await un(w,await pi(await c()))})),n?Promise.resolve(n):o},f=async()=>new Hh({baseURL:s,headers:c,fetch:e.fetch}).getCredits().catch(async h=>{throw await un(h,await pi(await c()))}),m=function(h){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return u(h)};return m.getAvailableModels=d,m.getCredits=f,m.imageModel=h=>{throw new lO({modelId:h,modelType:"imageModel"})},m.languageModel=u,m.textEmbeddingModel=h=>new Z3(h,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),m}var J3=W3();async function K3(e){const t=Va({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(t)return{token:t,authMethod:"api-key"};try{return{token:await MI.getVercelOidcToken(),authMethod:"oidc"}}catch{return null}}var Y3=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},en="1.9.0",Wh=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function X3(e){var t=new Set([e]),r=new Set,o=e.match(Wh);if(!o)return function(){return!1};var n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(n.prerelease!=null)return function(c){return c===e};function i(s){return r.add(s),!1}function a(s){return t.add(s),!0}return function(c){if(t.has(c))return!0;if(r.has(c))return!1;var l=c.match(Wh);if(!l)return i(c);var u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||n.major!==u.major?i(c):n.major===0?n.minor===u.minor&&n.patch<=u.patch?a(c):i(c):n.minor<=u.minor?a(c):i(c)}}var Q3=X3(en),eV=en.split(".")[0],gi=Symbol.for("opentelemetry.js.api."+eV),hi=Y3;function Gm(e,t,r,o){var n;o===void 0&&(o=!1);var i=hi[gi]=(n=hi[gi])!==null&&n!==void 0?n:{version:en};if(!o&&i[e]){var a=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(a.stack||a.message),!1}if(i.version!==en){var a=new Error("@opentelemetry/api: Registration of version v"+i.version+" for "+e+" does not match previously registered API v"+en);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+en+"."),!0}function vi(e){var t,r,o=(t=hi[gi])===null||t===void 0?void 0:t.version;if(!(!o||!Q3(o)))return(r=hi[gi])===null||r===void 0?void 0:r[e]}function Hm(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+en+".");var r=hi[gi];r&&delete r[e]}var tV=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},rV=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},nV=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("verbose",this._namespace,t)},e})();function Uo(e,t,r){var o=vi("diag");if(o)return r.unshift(t),o[e].apply(o,rV([],tV(r),!1))}var gt;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(gt||(gt={}));function oV(e,t){e<gt.NONE?e=gt.NONE:e>gt.ALL&&(e=gt.ALL),t=t||{};function r(o,n){var i=t[o];return typeof i=="function"&&e>=n?i.bind(t):function(){}}return{error:r("error",gt.ERROR),warn:r("warn",gt.WARN),info:r("info",gt.INFO),debug:r("debug",gt.DEBUG),verbose:r("verbose",gt.VERBOSE)}}var iV=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},aV=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},sV="diag",ks=(function(){function e(){function t(n){return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=vi("diag");if(s)return s[n].apply(s,aV([],iV(i),!1))}}var r=this,o=function(n,i){var a,s,c;if(i===void 0&&(i={logLevel:gt.INFO}),n===r){var l=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=l.stack)!==null&&a!==void 0?a:l.message),!1}typeof i=="number"&&(i={logLevel:i});var u=vi("diag"),d=oV((s=i.logLevel)!==null&&s!==void 0?s:gt.INFO,n);if(u&&!i.suppressOverrideMessage){var f=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+f),d.warn("Current logger will overwrite one already registered from "+f)}return Gm("diag",d,r,!0)};r.setLogger=o,r.disable=function(){Hm(sV,r)},r.createComponentLogger=function(n){return new nV(n)},r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})();function cV(e){return Symbol.for(e)}var lV=(function(){function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(o){return r._currentContext.get(o)},r.setValue=function(o,n){var i=new e(r._currentContext);return i._currentContext.set(o,n),i},r.deleteValue=function(o){var n=new e(r._currentContext);return n._currentContext.delete(o),n}}return e})(),uV=new lV,dV=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},fV=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},mV=(function(){function e(){}return e.prototype.active=function(){return uV},e.prototype.with=function(t,r,o){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];return r.call.apply(r,fV([o],dV(n),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),pV=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},gV=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},Wl="context",hV=new mV,JI=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return Gm(Wl,t,ks.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,o){for(var n,i=[],a=3;a<arguments.length;a++)i[a-3]=arguments[a];return(n=this._getContextManager()).with.apply(n,gV([t,r,o],pV(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return vi(Wl)||hV},e.prototype.disable=function(){this._getContextManager().disable(),Hm(Wl,ks.instance())},e})(),ed;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(ed||(ed={}));var KI="0000000000000000",YI="00000000000000000000000000000000",vV={traceId:YI,spanId:KI,traceFlags:ed.NONE},Wo=(function(){function e(t){t===void 0&&(t=vV),this._spanContext=t}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(t,r){return this},e.prototype.setAttributes=function(t){return this},e.prototype.addEvent=function(t,r){return this},e.prototype.addLink=function(t){return this},e.prototype.addLinks=function(t){return this},e.prototype.setStatus=function(t){return this},e.prototype.updateName=function(t){return this},e.prototype.end=function(t){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(t,r){},e})(),Wm=cV("OpenTelemetry Context Key SPAN");function Jm(e){return e.getValue(Wm)||void 0}function yV(){return Jm(JI.getInstance().active())}function Km(e,t){return e.setValue(Wm,t)}function bV(e){return e.deleteValue(Wm)}function _V(e,t){return Km(e,new Wo(t))}function XI(e){var t;return(t=Jm(e))===null||t===void 0?void 0:t.spanContext()}var wV=/^([0-9a-f]{32})$/i,xV=/^[0-9a-f]{16}$/i;function SV(e){return wV.test(e)&&e!==YI}function kV(e){return xV.test(e)&&e!==KI}function QI(e){return SV(e.traceId)&&kV(e.spanId)}function EV(e){return new Wo(e)}var Jl=JI.getInstance(),eT=(function(){function e(){}return e.prototype.startSpan=function(t,r,o){o===void 0&&(o=Jl.active());var n=!!r?.root;if(n)return new Wo;var i=o&&XI(o);return IV(i)&&QI(i)?new Wo(i):new Wo},e.prototype.startActiveSpan=function(t,r,o,n){var i,a,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(i=r,s=o):(i=r,a=o,s=n);var c=a??Jl.active(),l=this.startSpan(t,i,c),u=Km(c,l);return Jl.with(u,s,void 0,l)}},e})();function IV(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var TV=new eT,$V=(function(){function e(t,r,o,n){this._provider=t,this.name=r,this.version=o,this.options=n}return e.prototype.startSpan=function(t,r,o){return this._getTracer().startSpan(t,r,o)},e.prototype.startActiveSpan=function(t,r,o,n){var i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):TV},e})(),OV=(function(){function e(){}return e.prototype.getTracer=function(t,r,o){return new eT},e})(),AV=new OV,Jh=(function(){function e(){}return e.prototype.getTracer=function(t,r,o){var n;return(n=this.getDelegateTracer(t,r,o))!==null&&n!==void 0?n:new $V(this,t,r,o)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:AV},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateTracer=function(t,r,o){var n;return(n=this._delegate)===null||n===void 0?void 0:n.getTracer(t,r,o)},e})(),Es;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Es||(Es={}));var Kl="trace",CV=(function(){function e(){this._proxyTracerProvider=new Jh,this.wrapSpanContext=EV,this.isSpanContextValid=QI,this.deleteSpan=bV,this.getSpan=Jm,this.getActiveSpan=yV,this.getSpanContext=XI,this.setSpan=Km,this.setSpanContext=_V}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=Gm(Kl,this._proxyTracerProvider,ks.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return vi(Kl)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){Hm(Kl,ks.instance()),this._proxyTracerProvider=new Jh},e})(),NV=CV.getInstance(),RV=Object.defineProperty,PV=(e,t)=>{for(var r in t)RV(e,r,{get:t[r],enumerable:!0})},tT="AI_NoOutputSpecifiedError",rT=`vercel.ai.error.${tT}`,jV=Symbol.for(rT),nT,DV=class extends ee{constructor({message:e="No output specified."}={}){super({name:tT,message:e}),this[nT]=!0}static isInstance(e){return ee.hasMarker(e,rT)}};nT=jV;function zV(e){const t="AI SDK Warning:";switch(e.type){case"unsupported-setting":{let r=`${t} The "${e.setting}" setting is not supported by this model`;return e.details&&(r+=` - ${e.details}`),r}case"unsupported-tool":{const r="name"in e.tool?e.tool.name:"unknown tool";let o=`${t} The tool "${r}" is not supported by this model`;return e.details&&(o+=` - ${e.details}`),o}case"other":return`${t} ${e.message}`;default:return`${t} ${JSON.stringify(e,null,2)}`}}var MV="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",Kh=!1,UV=e=>{if(e.length===0)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t=="function"){t(e);return}Kh||(Kh=!0,console.info(MV));for(const r of e)console.warn(zV(r))}},oT="AI_InvalidArgumentError",iT=`vercel.ai.error.${oT}`,LV=Symbol.for(iT),aT,Yt=class extends ee{constructor({parameter:e,value:t,message:r}){super({name:oT,message:`Invalid argument for parameter ${e}: ${r}`}),this[aT]=!0,this.parameter=e,this.value=t}static isInstance(e){return ee.hasMarker(e,iT)}};aT=LV;var sT="AI_InvalidToolInputError",cT=`vercel.ai.error.${sT}`,FV=Symbol.for(cT),lT,uT=class extends ee{constructor({toolInput:e,toolName:t,cause:r,message:o=`Invalid input for tool ${t}: ${uo(r)}`}){super({name:sT,message:o,cause:r}),this[lT]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return ee.hasMarker(e,cT)}};lT=FV;var dT="AI_NoObjectGeneratedError",fT=`vercel.ai.error.${dT}`,VV=Symbol.for(fT),mT,Yh=class extends ee{constructor({message:e="No object generated.",cause:t,text:r,response:o,usage:n,finishReason:i}){super({name:dT,message:e,cause:t}),this[mT]=!0,this.text=r,this.response=o,this.usage=n,this.finishReason=i}static isInstance(e){return ee.hasMarker(e,fT)}};mT=VV;var pT="AI_NoOutputGeneratedError",gT=`vercel.ai.error.${pT}`,ZV=Symbol.for(gT),hT,BV=class extends ee{constructor({message:e="No output generated.",cause:t}={}){super({name:pT,message:e,cause:t}),this[hT]=!0}static isInstance(e){return ee.hasMarker(e,gT)}};hT=ZV;var vT="AI_NoSuchToolError",yT=`vercel.ai.error.${vT}`,qV=Symbol.for(yT),bT,td=class extends ee{constructor({toolName:e,availableTools:t=void 0,message:r=`Model tried to call unavailable tool '${e}'. ${t===void 0?"No tools are available.":`Available tools: ${t.join(", ")}.`}`}){super({name:vT,message:r}),this[bT]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return ee.hasMarker(e,yT)}};bT=qV;var _T="AI_ToolCallRepairError",wT=`vercel.ai.error.${_T}`,GV=Symbol.for(wT),xT,HV=class extends ee{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${uo(e)}`}){super({name:_T,message:r,cause:e}),this[xT]=!0,this.originalError=t}static isInstance(e){return ee.hasMarker(e,wT)}};xT=GV;var WV=class extends ee{constructor(e){super({name:"AI_UnsupportedModelVersionError",message:`Unsupported model version ${e.version} for provider "${e.provider}" and model "${e.modelId}". AI SDK 5 only supports models that implement specification version "v2".`}),this.version=e.version,this.provider=e.provider,this.modelId=e.modelId}},ST="AI_InvalidMessageRoleError",kT=`vercel.ai.error.${ST}`,JV=Symbol.for(kT),ET,KV=class extends ee{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:ST,message:t}),this[ET]=!0,this.role=e}static isInstance(e){return ee.hasMarker(e,kT)}};ET=JV;var IT="AI_MessageConversionError",TT=`vercel.ai.error.${IT}`,YV=Symbol.for(TT),$T,XV=class extends ee{constructor({originalMessage:e,message:t}){super({name:IT,message:t}),this[$T]=!0,this.originalMessage=e}static isInstance(e){return ee.hasMarker(e,TT)}};$T=YV;var OT="AI_DownloadError",AT=`vercel.ai.error.${OT}`,QV=Symbol.for(AT),CT,Yl=class extends ee{constructor({url:e,statusCode:t,statusText:r,cause:o,message:n=o==null?`Failed to download ${e}: ${t} ${r}`:`Failed to download ${e}: ${o}`}){super({name:OT,message:n,cause:o}),this[CT]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return ee.hasMarker(e,AT)}};CT=QV;var NT="AI_RetryError",RT=`vercel.ai.error.${NT}`,eZ=Symbol.for(RT),PT,Xh=class extends ee{constructor({message:e,reason:t,errors:r}){super({name:NT,message:e}),this[PT]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return ee.hasMarker(e,RT)}};PT=eZ;function jT(e){if(typeof e!="string"){if(e.specificationVersion!=="v2")throw new WV({version:e.specificationVersion,provider:e.provider,modelId:e.modelId});return e}return tZ().languageModel(e)}function tZ(){var e;return(e=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?e:J3}var rZ=[{mediaType:"image/gif",bytesPrefix:[71,73,70]},{mediaType:"image/png",bytesPrefix:[137,80,78,71]},{mediaType:"image/jpeg",bytesPrefix:[255,216]},{mediaType:"image/webp",bytesPrefix:[82,73,70,70,null,null,null,null,87,69,66,80]},{mediaType:"image/bmp",bytesPrefix:[66,77]},{mediaType:"image/tiff",bytesPrefix:[73,73,42,0]},{mediaType:"image/tiff",bytesPrefix:[77,77,0,42]},{mediaType:"image/avif",bytesPrefix:[0,0,0,32,102,116,121,112,97,118,105,102]},{mediaType:"image/heic",bytesPrefix:[0,0,0,32,102,116,121,112,104,101,105,99]}],nZ=e=>{const t=typeof e=="string"?Bm(e):e,r=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(r+10)};function oZ(e){return typeof e=="string"&&e.startsWith("SUQz")||typeof e!="string"&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?nZ(e):e}function iZ({data:e,signatures:t}){const r=oZ(e),o=typeof r=="string"?Bm(r.substring(0,Math.min(r.length,24))):r;for(const n of t)if(o.length>=n.bytesPrefix.length&&n.bytesPrefix.every((i,a)=>i===null||o[a]===i))return n.mediaType}var aZ="5.0.90",sZ=async({url:e})=>{var t;const r=e.toString();try{const o=await fetch(r,{headers:Hc({},`ai-sdk/${aZ}`,Vm())});if(!o.ok)throw new Yl({url:r,statusCode:o.status,statusText:o.statusText});return{data:new Uint8Array(await o.arrayBuffer()),mediaType:(t=o.headers.get("content-type"))!=null?t:void 0}}catch(o){throw Yl.isInstance(o)?o:new Yl({url:r,cause:o})}},cZ=(e=sZ)=>t=>Promise.all(t.map(async r=>r.isUrlSupportedByModel?null:e(r)));function lZ(e){try{const[t,r]=e.split(",");return{mediaType:t.split(";")[0].split(":")[1],base64Content:r}}catch{return{mediaType:void 0,base64Content:void 0}}}var DT=fe([S(),to(Uint8Array),to(ArrayBuffer),rm(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]);function zT(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if(typeof e=="string")try{e=new URL(e)}catch{}if(e instanceof URL&&e.protocol==="data:"){const{mediaType:t,base64Content:r}=lZ(e.toString());if(t==null||r==null)throw new ee({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}function uZ(e){return typeof e=="string"?e:e instanceof ArrayBuffer?Qu(new Uint8Array(e)):Qu(e)}async function dZ({prompt:e,supportedUrls:t,download:r=cZ()}){const o=await mZ(e.messages,r,t);return[...e.system!=null?[{role:"system",content:e.system}]:[],...e.messages.map(n=>fZ({message:n,downloadedAssets:o}))]}function fZ({message:e,downloadedAssets:t}){const r=e.role;switch(r){case"system":return{role:"system",content:e.content,providerOptions:e.providerOptions};case"user":return typeof e.content=="string"?{role:"user",content:[{type:"text",text:e.content}],providerOptions:e.providerOptions}:{role:"user",content:e.content.map(o=>pZ(o,t)).filter(o=>o.type!=="text"||o.text!==""),providerOptions:e.providerOptions};case"assistant":return typeof e.content=="string"?{role:"assistant",content:[{type:"text",text:e.content}],providerOptions:e.providerOptions}:{role:"assistant",content:e.content.filter(o=>o.type!=="text"||o.text!==""||o.providerOptions!=null).map(o=>{const n=o.providerOptions;switch(o.type){case"file":{const{data:i,mediaType:a}=zT(o.data);return{type:"file",data:i,filename:o.filename,mediaType:a??o.mediaType,providerOptions:n}}case"reasoning":return{type:"reasoning",text:o.text,providerOptions:n};case"text":return{type:"text",text:o.text,providerOptions:n};case"tool-call":return{type:"tool-call",toolCallId:o.toolCallId,toolName:o.toolName,input:o.input,providerExecuted:o.providerExecuted,providerOptions:n};case"tool-result":return{type:"tool-result",toolCallId:o.toolCallId,toolName:o.toolName,output:o.output,providerOptions:n}}}),providerOptions:e.providerOptions};case"tool":return{role:"tool",content:e.content.map(o=>({type:"tool-result",toolCallId:o.toolCallId,toolName:o.toolName,output:o.output,providerOptions:o.providerOptions})),providerOptions:e.providerOptions};default:{const o=r;throw new KV({role:o})}}}async function mZ(e,t,r){const o=e.filter(i=>i.role==="user").map(i=>i.content).filter(i=>Array.isArray(i)).flat().filter(i=>i.type==="image"||i.type==="file").map(i=>{var a;const s=(a=i.mediaType)!=null?a:i.type==="image"?"image/*":void 0;let c=i.type==="image"?i.image:i.data;if(typeof c=="string")try{c=new URL(c)}catch{}return{mediaType:s,data:c}}).filter(i=>i.data instanceof URL).map(i=>({url:i.data,isUrlSupportedByModel:i.mediaType!=null&&pF({url:i.data.toString(),mediaType:i.mediaType,supportedUrls:r})})),n=await t(o);return Object.fromEntries(n.map((i,a)=>i==null?null:[o[a].url.toString(),{data:i.data,mediaType:i.mediaType}]).filter(i=>i!=null))}function pZ(e,t){var r;if(e.type==="text")return{type:"text",text:e.text,providerOptions:e.providerOptions};let o;const n=e.type;switch(n){case"image":o=e.image;break;case"file":o=e.data;break;default:throw new Error(`Unsupported part type: ${n}`)}const{data:i,mediaType:a}=zT(o);let s=a??e.mediaType,c=i;if(c instanceof URL){const l=t[c.toString()];l&&(c=l.data,s??(s=l.mediaType))}switch(n){case"image":return(c instanceof Uint8Array||typeof c=="string")&&(s=(r=iZ({data:c,signatures:rZ}))!=null?r:s),{type:"file",mediaType:s??"image/*",filename:void 0,data:c,providerOptions:e.providerOptions};case"file":{if(s==null)throw new Error("Media type is missing for file part");return{type:"file",mediaType:s,filename:e.filename,data:c,providerOptions:e.providerOptions}}}}function gZ({maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:i,seed:a,stopSequences:s}){if(e!=null){if(!Number.isInteger(e))throw new Yt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new Yt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(t!=null&&typeof t!="number")throw new Yt({parameter:"temperature",value:t,message:"temperature must be a number"});if(r!=null&&typeof r!="number")throw new Yt({parameter:"topP",value:r,message:"topP must be a number"});if(o!=null&&typeof o!="number")throw new Yt({parameter:"topK",value:o,message:"topK must be a number"});if(n!=null&&typeof n!="number")throw new Yt({parameter:"presencePenalty",value:n,message:"presencePenalty must be a number"});if(i!=null&&typeof i!="number")throw new Yt({parameter:"frequencyPenalty",value:i,message:"frequencyPenalty must be a number"});if(a!=null&&!Number.isInteger(a))throw new Yt({parameter:"seed",value:a,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:i,stopSequences:s,seed:a}}function hZ(e){return e!=null&&Object.keys(e).length>0}function vZ({tools:e,toolChoice:t,activeTools:r}){return hZ(e)?{tools:(r!=null?Object.entries(e).filter(([n])=>r.includes(n)):Object.entries(e)).map(([n,i])=>{const a=i.type;switch(a){case void 0:case"dynamic":case"function":return{type:"function",name:n,description:i.description,inputSchema:Wc(i.inputSchema).jsonSchema,providerOptions:i.providerOptions};case"provider-defined":return{type:"provider-defined",name:n,id:i.id,args:i.args};default:{const s=a;throw new Error(`Unsupported tool type: ${s}`)}}}),toolChoice:t==null?{type:"auto"}:typeof t=="string"?{type:t}:{type:"tool",toolName:t.toolName}}:{tools:void 0,toolChoice:void 0}}var yi=Ic(()=>fe([yc(),S(),Z(),mt(),nr(S(),yi),D(yi)])),sr=nr(S(),nr(S(),yi)),MT=O({type:B("text"),text:S(),providerOptions:sr.optional()}),yZ=O({type:B("image"),image:fe([DT,to(URL)]),mediaType:S().optional(),providerOptions:sr.optional()}),UT=O({type:B("file"),data:fe([DT,to(URL)]),filename:S().optional(),mediaType:S(),providerOptions:sr.optional()}),bZ=O({type:B("reasoning"),text:S(),providerOptions:sr.optional()}),_Z=O({type:B("tool-call"),toolCallId:S(),toolName:S(),input:Qe(),providerOptions:sr.optional(),providerExecuted:mt().optional()}),wZ=Af("type",[O({type:B("text"),value:S()}),O({type:B("json"),value:yi}),O({type:B("error-text"),value:S()}),O({type:B("error-json"),value:yi}),O({type:B("content"),value:D(fe([O({type:B("text"),text:S()}),O({type:B("media"),data:S(),mediaType:S()})]))})]),LT=O({type:B("tool-result"),toolCallId:S(),toolName:S(),output:wZ,providerOptions:sr.optional()}),xZ=O({role:B("system"),content:S(),providerOptions:sr.optional()}),SZ=O({role:B("user"),content:fe([S(),D(fe([MT,yZ,UT]))]),providerOptions:sr.optional()}),kZ=O({role:B("assistant"),content:fe([S(),D(fe([MT,UT,bZ,_Z,LT]))]),providerOptions:sr.optional()}),EZ=O({role:B("tool"),content:D(LT),providerOptions:sr.optional()}),IZ=fe([xZ,SZ,kZ,EZ]);async function TZ(e){if(e.prompt==null&&e.messages==null)throw new In({prompt:e,message:"prompt or messages must be defined"});if(e.prompt!=null&&e.messages!=null)throw new In({prompt:e,message:"prompt and messages cannot be defined at the same time"});if(e.system!=null&&typeof e.system!="string")throw new In({prompt:e,message:"system must be a string"});let t;if(e.prompt!=null&&typeof e.prompt=="string")t=[{role:"user",content:e.prompt}];else if(e.prompt!=null&&Array.isArray(e.prompt))t=e.prompt;else if(e.messages!=null)t=e.messages;else throw new In({prompt:e,message:"prompt or messages must be defined"});if(t.length===0)throw new In({prompt:e,message:"messages must not be empty"});const r=await Mr({value:t,schema:D(IZ)});if(!r.success)throw new In({prompt:e,message:"The messages must be a ModelMessage[]. If you have passed a UIMessage[], you can use convertToModelMessages to convert them.",cause:r.error});return{messages:t,system:e.system}}function $Z(e){return qm.isInstance(e)||qI.isInstance(e)?new ee({name:"GatewayError",message:"Vercel AI Gateway access failed. If you want to use AI SDK providers directly, use the providers, e.g. @ai-sdk/openai, or register a different global default provider.",cause:e}):e}function rd({operationId:e,telemetry:t}){return{"operation.name":`${e}${t?.functionId!=null?` ${t.functionId}`:""}`,"resource.name":t?.functionId,"ai.operationId":e,"ai.telemetry.functionId":t?.functionId}}function OZ({model:e,settings:t,telemetry:r,headers:o}){var n;return{"ai.model.provider":e.provider,"ai.model.id":e.modelId,...Object.entries(t).reduce((i,[a,s])=>(i[`ai.settings.${a}`]=s,i),{}),...Object.entries((n=r?.metadata)!=null?n:{}).reduce((i,[a,s])=>(i[`ai.telemetry.metadata.${a}`]=s,i),{}),...Object.entries(o??{}).reduce((i,[a,s])=>(s!==void 0&&(i[`ai.request.headers.${a}`]=s),i),{})}}var AZ={startSpan(){return Ea},startActiveSpan(e,t,r,o){if(typeof t=="function")return t(Ea);if(typeof r=="function")return r(Ea);if(typeof o=="function")return o(Ea)}},Ea={spanContext(){return CZ},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},addLink(){return this},addLinks(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this}},CZ={traceId:"",spanId:"",traceFlags:0};function NZ({isEnabled:e=!1,tracer:t}={}){return e?t||NV.getTracer("ai"):AZ}function nd({name:e,tracer:t,attributes:r,fn:o,endWhenDone:n=!0}){return t.startActiveSpan(e,{attributes:r},async i=>{try{const a=await o(i);return n&&i.end(),a}catch(a){try{FT(i,a)}finally{i.end()}throw a}})}function FT(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Es.ERROR,message:t.message})):e.setStatus({code:Es.ERROR})}function Un({telemetry:e,attributes:t}){return e?.isEnabled!==!0?{}:Object.entries(t).reduce((r,[o,n])=>{if(n==null)return r;if(typeof n=="object"&&"input"in n&&typeof n.input=="function"){if(e?.recordInputs===!1)return r;const i=n.input();return i==null?r:{...r,[o]:i}}if(typeof n=="object"&&"output"in n&&typeof n.output=="function"){if(e?.recordOutputs===!1)return r;const i=n.output();return i==null?r:{...r,[o]:i}}return{...r,[o]:n}},{})}function RZ(e){return JSON.stringify(e.map(t=>({...t,content:typeof t.content=="string"?t.content:t.content.map(r=>r.type==="file"?{...r,data:r.data instanceof Uint8Array?uZ(r.data):r.data}:r)})))}function PZ(e,t){return{inputTokens:Lo(e.inputTokens,t.inputTokens),outputTokens:Lo(e.outputTokens,t.outputTokens),totalTokens:Lo(e.totalTokens,t.totalTokens),reasoningTokens:Lo(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:Lo(e.cachedInputTokens,t.cachedInputTokens)}}function Lo(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Qh(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function jZ({error:e,exponentialBackoffDelay:t}){const r=e.responseHeaders;if(!r)return t;let o;const n=r["retry-after-ms"];if(n){const a=parseFloat(n);Number.isNaN(a)||(o=a)}const i=r["retry-after"];if(i&&o===void 0){const a=parseFloat(i);Number.isNaN(a)?o=Date.parse(i)-Date.now():o=a*1e3}return o!=null&&!Number.isNaN(o)&&0<=o&&(o<60*1e3||o<t)?o:t}var DZ=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:o}={})=>async n=>VT(n,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:o});async function VT(e,{maxRetries:t,delayInMs:r,backoffFactor:o,abortSignal:n},i=[]){try{return await e()}catch(a){if(cn(a)||t===0)throw a;const s=AI(a),c=[...i,a],l=c.length;if(l>t)throw new Xh({message:`Failed after ${l} attempts. Last error: ${s}`,reason:"maxRetriesExceeded",errors:c});if(a instanceof Error&&st.isInstance(a)&&a.isRetryable===!0&&l<=t)return await OI(jZ({error:a,exponentialBackoffDelay:r}),{abortSignal:n}),VT(e,{maxRetries:t,delayInMs:o*r,backoffFactor:o,abortSignal:n},c);throw l===1?a:new Xh({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:"errorNotRetryable",errors:c})}}function zZ({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new Yt({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new Yt({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=e??2;return{maxRetries:r,retry:DZ({maxRetries:r,abortSignal:t})}}var MZ=class{constructor({data:e,mediaType:t}){const r=e instanceof Uint8Array;this.base64Data=r?void 0:e,this.uint8ArrayData=r?e:void 0,this.mediaType=t}get base64(){return this.base64Data==null&&(this.base64Data=Qu(this.uint8ArrayData)),this.base64Data}get uint8Array(){return this.uint8ArrayData==null&&(this.uint8ArrayData=Bm(this.base64Data)),this.uint8ArrayData}},UZ=class extends MZ{constructor(e){super(e),this.type="file"}};async function LZ({toolCall:e,tools:t,repairToolCall:r,system:o,messages:n}){try{if(t==null)throw new td({toolName:e.toolName});try{return await ev({toolCall:e,tools:t})}catch(i){if(r==null||!(td.isInstance(i)||uT.isInstance(i)))throw i;let a=null;try{a=await r({toolCall:e,tools:t,inputSchema:({toolName:s})=>{const{inputSchema:c}=t[s];return Wc(c).jsonSchema},system:o,messages:n,error:i})}catch(s){throw new HV({cause:s,originalError:i})}if(a==null)throw i;return await ev({toolCall:a,tools:t})}}catch(i){const a=await ln({text:e.input}),s=a.success?a.value:e.input;return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:s,dynamic:!0,invalid:!0,error:i}}}async function ev({toolCall:e,tools:t}){const r=e.toolName,o=t[r];if(o==null)throw new td({toolName:e.toolName,availableTools:Object.keys(t)});const n=Wc(o.inputSchema),i=e.input.trim()===""?await Mr({value:{},schema:n}):await ln({text:e.input,schema:n});if(i.success===!1)throw new uT({toolName:r,toolInput:e.input,cause:i.error});return o.type==="dynamic"?{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:i.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0}:{type:"tool-call",toolCallId:e.toolCallId,toolName:r,input:i.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}var FZ=class{constructor({content:e,finishReason:t,usage:r,warnings:o,request:n,response:i,providerMetadata:a}){this.content=e,this.finishReason=t,this.usage=r,this.warnings=o,this.request=n,this.response=i,this.providerMetadata=a}get text(){return this.content.filter(e=>e.type==="text").map(e=>e.text).join("")}get reasoning(){return this.content.filter(e=>e.type==="reasoning")}get reasoningText(){return this.reasoning.length===0?void 0:this.reasoning.map(e=>e.text).join("")}get files(){return this.content.filter(e=>e.type==="file").map(e=>e.file)}get sources(){return this.content.filter(e=>e.type==="source")}get toolCalls(){return this.content.filter(e=>e.type==="tool-call")}get staticToolCalls(){return this.toolCalls.filter(e=>e.dynamic!==!0)}get dynamicToolCalls(){return this.toolCalls.filter(e=>e.dynamic===!0)}get toolResults(){return this.content.filter(e=>e.type==="tool-result")}get staticToolResults(){return this.toolResults.filter(e=>e.dynamic!==!0)}get dynamicToolResults(){return this.toolResults.filter(e=>e.dynamic===!0)}};function ZT(e){return({steps:t})=>t.length===e}async function VZ({stopConditions:e,steps:t}){return(await Promise.all(e.map(r=>r({steps:t})))).some(r=>r)}function Jo({output:e,tool:t,errorMode:r}){return r==="text"?{type:"error-text",value:uo(e)}:r==="json"?{type:"error-json",value:tv(e)}:t?.toModelOutput?t.toModelOutput(e):typeof e=="string"?{type:"text",value:e}:{type:"json",value:tv(e)}}function tv(e){return e===void 0?null:e}function rv({content:e,tools:t}){const r=[],o=e.filter(i=>i.type!=="source").filter(i=>(i.type!=="tool-result"||i.providerExecuted)&&(i.type!=="tool-error"||i.providerExecuted)).filter(i=>i.type!=="text"||i.text.length>0).map(i=>{switch(i.type){case"text":return{type:"text",text:i.text,providerOptions:i.providerMetadata};case"reasoning":return{type:"reasoning",text:i.text,providerOptions:i.providerMetadata};case"file":return{type:"file",data:i.file.base64,mediaType:i.file.mediaType,providerOptions:i.providerMetadata};case"tool-call":return{type:"tool-call",toolCallId:i.toolCallId,toolName:i.toolName,input:i.input,providerExecuted:i.providerExecuted,providerOptions:i.providerMetadata};case"tool-result":return{type:"tool-result",toolCallId:i.toolCallId,toolName:i.toolName,output:Jo({tool:t?.[i.toolName],output:i.output,errorMode:"none"}),providerExecuted:!0,providerOptions:i.providerMetadata};case"tool-error":return{type:"tool-result",toolCallId:i.toolCallId,toolName:i.toolName,output:Jo({tool:t?.[i.toolName],output:i.error,errorMode:"json"}),providerOptions:i.providerMetadata}}});o.length>0&&r.push({role:"assistant",content:o});const n=e.filter(i=>i.type==="tool-result"||i.type==="tool-error").filter(i=>!i.providerExecuted).map(i=>({type:"tool-result",toolCallId:i.toolCallId,toolName:i.toolName,output:Jo({tool:t?.[i.toolName],output:i.type==="tool-result"?i.output:i.error,errorMode:i.type==="tool-error"?"text":"none"})}));return n.length>0&&r.push({role:"tool",content:n}),r}oa({prefix:"aitxt",size:24});function Jc(e,t){const r=new Headers(e??{});for(const[o,n]of Object.entries(t))r.has(o)||r.set(o,n);return r}function ZZ({status:e,statusText:t,headers:r,textStream:o}){return new Response(o.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:Jc(r,{"content-type":"text/plain; charset=utf-8"})})}function BT({response:e,status:t,statusText:r,headers:o,stream:n}){e.writeHead(t??200,r,o);const i=n.getReader();(async()=>{try{for(;;){const{done:s,value:c}=await i.read();if(s)break;e.write(c)||await new Promise(u=>{e.once("drain",u)})}}catch(s){throw s}finally{e.end()}})()}function BZ({response:e,status:t,statusText:r,headers:o,textStream:n}){BT({response:e,status:t,statusText:r,headers:Object.fromEntries(Jc(o,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:n.pipeThrough(new TextEncoderStream)})}var qT=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
|
|
85
|
+
|
|
86
|
+
`)},flush(e){e.enqueue(`data: [DONE]
|
|
87
|
+
|
|
88
|
+
`)}})}},GT={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function qZ({status:e,statusText:t,headers:r,stream:o,consumeSseStream:n}){let i=o.pipeThrough(new qT);if(n){const[a,s]=i.tee();i=a,n({stream:s})}return new Response(i.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:Jc(r,GT)})}function GZ({originalMessages:e,responseMessageId:t}){if(e==null)return;const r=e[e.length-1];return r?.role==="assistant"?r.id:typeof t=="function"?t():t}function HZ(e){return e.type.startsWith("data-")}function HT(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 o in t)if(Object.prototype.hasOwnProperty.call(t,o)){const n=t[o];if(n===void 0)continue;const i=o in e?e[o]:void 0,a=n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp),s=i!=null&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp);a&&s?r[o]=HT(i,n):r[o]=n}return r}function WZ(e){const t=["ROOT"];let r=-1,o=null;function n(c,l,u){switch(c){case'"':{r=l,t.pop(),t.push(u),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=l,o=l,t.pop(),t.push(u),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(u),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=l,t.pop(),t.push(u),t.push("INSIDE_NUMBER");break}case"{":{r=l,t.pop(),t.push(u),t.push("INSIDE_OBJECT_START");break}case"[":{r=l,t.pop(),t.push(u),t.push("INSIDE_ARRAY_START");break}}}function i(c,l){switch(c){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=l,t.pop();break}}}function a(c,l){switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=l,t.pop();break}}}for(let c=0;c<e.length;c++){const l=e[c];switch(t[t.length-1]){case"ROOT":n(l,c,"FINISH");break;case"INSIDE_OBJECT_START":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=c,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}}break}case"INSIDE_OBJECT_KEY":{switch(l){case'"':{t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY");break}}break}case"INSIDE_OBJECT_AFTER_KEY":{switch(l){case":":{t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE");break}}break}case"INSIDE_OBJECT_BEFORE_VALUE":{n(l,c,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{i(l,c);break}case"INSIDE_STRING":{switch(l){case'"':{t.pop(),r=c;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=c}break}case"INSIDE_ARRAY_START":{switch(l){case"]":{r=c,t.pop();break}default:{r=c,n(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}}break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(l){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=c,t.pop();break}default:{r=c;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{n(l,c,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),r=c;break}case"INSIDE_NUMBER":{switch(l){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=c;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(l,c),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(l,c);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&i(l,c);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(l,c);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const d=e.substring(o,c+1);!"false".startsWith(d)&&!"true".startsWith(d)&&!"null".startsWith(d)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?i(l,c):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&a(l,c)):r=c;break}}}let s=e.slice(0,r+1);for(let c=t.length-1;c>=0;c--)switch(t[c]){case"INSIDE_STRING":{s+='"';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":{s+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{s+="]";break}case"INSIDE_LITERAL":{const u=e.substring(o,e.length);"true".startsWith(u)?s+="true".slice(u.length):"false".startsWith(u)?s+="false".slice(u.length):"null".startsWith(u)&&(s+="null".slice(u.length))}}return s}async function WT(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await ln({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await ln({text:WZ(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}function Xl(e){return e.type.startsWith("data-")}function Ql(e){return e.type==="text"}function eu(e){return e.type==="file"}function nv(e){return e.type==="reasoning"}function Vn(e){return e.type.startsWith("tool-")}function Ym(e){return e.type==="dynamic-tool"}function ov(e){return Vn(e)||Ym(e)}function Is(e){return e.type.split("-").slice(1).join("-")}function JZ(e){return Ym(e)?e.toolName:Is(e)}function KZ({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function YZ({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:o,onError:n,onToolCall:i,onData:a}){return e.pipeThrough(new TransformStream({async transform(s,c){await o(async({state:l,write:u})=>{var d,f,m,h;function g(v){const E=l.message.parts.filter(Vn).find(I=>I.toolCallId===v);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function y(v){const E=l.message.parts.filter(I=>I.type==="dynamic-tool").find(I=>I.toolCallId===v);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function b(v){var k;const E=l.message.parts.find(M=>Vn(M)&&M.toolCallId===v.toolCallId),I=v,A=E;E!=null?(E.state=v.state,A.input=I.input,A.output=I.output,A.errorText=I.errorText,A.rawInput=I.rawInput,A.preliminary=I.preliminary,A.providerExecuted=(k=I.providerExecuted)!=null?k:E.providerExecuted,I.providerMetadata!=null&&E.state==="input-available"&&(E.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:`tool-${v.toolName}`,toolCallId:v.toolCallId,state:v.state,input:I.input,output:I.output,rawInput:I.rawInput,errorText:I.errorText,providerExecuted:I.providerExecuted,preliminary:I.preliminary,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}function w(v){var k,E;const I=l.message.parts.find(U=>U.type==="dynamic-tool"&&U.toolCallId===v.toolCallId),A=v,M=I;I!=null?(I.state=v.state,M.toolName=v.toolName,M.input=A.input,M.output=A.output,M.errorText=A.errorText,M.rawInput=(k=A.rawInput)!=null?k:M.rawInput,M.preliminary=A.preliminary,M.providerExecuted=(E=A.providerExecuted)!=null?E:I.providerExecuted,A.providerMetadata!=null&&I.state==="input-available"&&(I.callProviderMetadata=A.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:v.toolName,toolCallId:v.toolCallId,state:v.state,input:A.input,output:A.output,errorText:A.errorText,preliminary:A.preliminary,providerExecuted:A.providerExecuted,...A.providerMetadata!=null?{callProviderMetadata:A.providerMetadata}:{}})}async function x(v){if(v!=null){const k=l.message.metadata!=null?HT(l.message.metadata,v):v;t!=null&&await Ju({value:k,schema:t}),l.message.metadata=k}}switch(s.type){case"text-start":{const v={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeTextParts[s.id]=v,l.message.parts.push(v),u();break}case"text-delta":{const v=l.activeTextParts[s.id];v.text+=s.delta,v.providerMetadata=(d=s.providerMetadata)!=null?d:v.providerMetadata,u();break}case"text-end":{const v=l.activeTextParts[s.id];v.state="done",v.providerMetadata=(f=s.providerMetadata)!=null?f:v.providerMetadata,delete l.activeTextParts[s.id],u();break}case"reasoning-start":{const v={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeReasoningParts[s.id]=v,l.message.parts.push(v),u();break}case"reasoning-delta":{const v=l.activeReasoningParts[s.id];v.text+=s.delta,v.providerMetadata=(m=s.providerMetadata)!=null?m:v.providerMetadata,u();break}case"reasoning-end":{const v=l.activeReasoningParts[s.id];v.providerMetadata=(h=s.providerMetadata)!=null?h:v.providerMetadata,v.state="done",delete l.activeReasoningParts[s.id],u();break}case"file":{l.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url}),u();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),u();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),u();break}case"tool-input-start":{const v=l.message.parts.filter(Vn);l.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:v.length,dynamic:s.dynamic},s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}),u();break}case"tool-input-delta":{const v=l.partialToolCalls[s.toolCallId];v.text+=s.inputTextDelta;const{value:k}=await WT(v.text);v.dynamic?w({toolCallId:s.toolCallId,toolName:v.toolName,state:"input-streaming",input:k}):b({toolCallId:s.toolCallId,toolName:v.toolName,state:"input-streaming",input:k}),u();break}case"tool-input-available":{s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u(),i&&!s.providerExecuted&&await i({toolCall:s});break}case"tool-input-error":{s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u();break}case"tool-output-available":{if(s.dynamic){const v=y(s.toolCallId);w({toolCallId:s.toolCallId,toolName:v.toolName,state:"output-available",input:v.input,output:s.output,preliminary:s.preliminary})}else{const v=g(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Is(v),state:"output-available",input:v.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary})}u();break}case"tool-output-error":{if(s.dynamic){const v=y(s.toolCallId);w({toolCallId:s.toolCallId,toolName:v.toolName,state:"output-error",input:v.input,errorText:s.errorText,providerExecuted:s.providerExecuted})}else{const v=g(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Is(v),state:"output-error",input:v.input,rawInput:v.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted})}u();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{s.messageId!=null&&(l.message.id=s.messageId),await x(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&u();break}case"finish":{await x(s.messageMetadata),s.messageMetadata!=null&&u();break}case"message-metadata":{await x(s.messageMetadata),s.messageMetadata!=null&&u();break}case"error":{n?.(new Error(s.errorText));break}default:if(HZ(s)){r?.[s.type]!=null&&await Ju({value:s.data,schema:r[s.type]});const v=s;if(v.transient){a?.(v);break}const k=v.id!=null?l.message.parts.find(E=>v.type===E.type&&v.id===E.id):void 0;k!=null?k.data=v.data:l.message.parts.push(v),a?.(v),u()}}c.enqueue(s)})}}))}function XZ({messageId:e,originalMessages:t=[],onFinish:r,onError:o,stream:n}){let i=t?.[t.length-1];i?.role!=="assistant"?i=void 0:e=i.id;let a=!1;const s=n.pipeThrough(new TransformStream({transform(f,m){if(f.type==="start"){const h=f;h.messageId==null&&e!=null&&(h.messageId=e)}f.type==="abort"&&(a=!0),m.enqueue(f)}}));if(r==null)return s;const c=KZ({lastMessage:i?structuredClone(i):void 0,messageId:e??""}),l=async f=>{await f({state:c,write:()=>{}})};let u=!1;const d=async()=>{if(u||!r)return;u=!0;const f=c.message.id===i?.id;await r({isAborted:a,isContinuation:f,responseMessage:c.message,messages:[...f?t.slice(0,-1):t,c.message]})};return YZ({stream:s,runUpdateMessageJob:l,onError:o}).pipeThrough(new TransformStream({transform(f,m){m.enqueue(f)},async cancel(){await d()},async flush(){await d()}}))}function QZ({response:e,status:t,statusText:r,headers:o,stream:n,consumeSseStream:i}){let a=n.pipeThrough(new qT);if(i){const[s,c]=a.tee();a=s,i({stream:c})}BT({response:e,status:t,statusText:r,headers:Object.fromEntries(Jc(o,GT).entries()),stream:a.pipeThrough(new TextEncoderStream)})}function Ia(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const r=this.getReader();let o=!1;async function n(i){var a;o=!0;try{i&&await((a=r.cancel)==null?void 0:a.call(r))}finally{try{r.releaseLock()}catch{}}}return{async next(){if(o)return{done:!0,value:void 0};const{done:i,value:a}=await r.read();return i?(await n(!0),{done:!0,value:void 0}):{done:!1,value:a}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(i){throw await n(!0),i}}},t}async function eB({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:o}=await r.read();if(o)break}}catch(o){t?.(o)}finally{r.releaseLock()}}function iv(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function tB(){let e=[],t=null,r=!1,o=iv();const n=()=>{r=!0,o.resolve(),e.forEach(a=>a.cancel()),e=[],t?.close()},i=async()=>{if(r&&e.length===0){t?.close();return}if(e.length===0)return o=iv(),await o.promise,i();try{const{value:a,done:s}=await e[0].read();s?(e.shift(),e.length>0?await i():r&&t?.close()):t?.enqueue(a)}catch(a){t?.error(a),e.shift(),n()}};return{stream:new ReadableStream({start(a){t=a},pull:i,async cancel(){for(const a of e)await a.cancel();e=[],r=!0}}),addStream:a=>{if(r)throw new Error("Cannot add inner stream: outer stream is closed");e.push(a.getReader()),o.resolve()},close:()=>{r=!0,o.resolve(),e.length===0&&t?.close()},terminate:n}}var Ta=class{constructor(){this.status={type:"pending"},this._resolve=void 0,this._reject=void 0}get promise(){return this._promise?this._promise:(this._promise=new Promise((e,t)=>{this.status.type==="resolved"?e(this.status.value):this.status.type==="rejected"&&t(this.status.error),this._resolve=e,this._reject=t}),this._promise)}resolve(e){var t;this.status={type:"resolved",value:e},this._promise&&((t=this._resolve)==null||t.call(this,e))}reject(e){var t;this.status={type:"rejected",error:e},this._promise&&((t=this._reject)==null||t.call(this,e))}};function rB(){var e,t;return(t=(e=globalThis?.performance)==null?void 0:e.now())!=null?t:Date.now()}function nB({tools:e,generatorStream:t,tracer:r,telemetry:o,system:n,messages:i,abortSignal:a,repairToolCall:s,experimental_context:c}){let l=null;const u=new ReadableStream({start(b){l=b}}),d=new Set,f=new Map;let m=!1,h;function g(){m&&d.size===0&&(h!=null&&l.enqueue(h),l.close())}const y=new TransformStream({async transform(b,w){const x=b.type;switch(x){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":{w.enqueue(b);break}case"file":{w.enqueue({type:"file",file:new UZ({data:b.data,mediaType:b.mediaType})});break}case"finish":{h={type:"finish",finishReason:b.finishReason,usage:b.usage,providerMetadata:b.providerMetadata};break}case"tool-call":{try{const v=await LZ({toolCall:b,tools:e,repairToolCall:s,system:n,messages:i});if(w.enqueue(v),v.invalid){l.enqueue({type:"tool-error",toolCallId:v.toolCallId,toolName:v.toolName,input:v.input,error:AI(v.error),dynamic:!0});break}const k=e[v.toolName];if(f.set(v.toolCallId,v.input),k.onInputAvailable!=null&&await k.onInputAvailable({input:v.input,toolCallId:v.toolCallId,messages:i,abortSignal:a,experimental_context:c}),k.execute!=null&&v.providerExecuted!==!0){const E=uF();d.add(E),nd({name:"ai.toolCall",attributes:Un({telemetry:o,attributes:{...rd({operationId:"ai.toolCall",telemetry:o}),"ai.toolCall.name":v.toolName,"ai.toolCall.id":v.toolCallId,"ai.toolCall.args":{output:()=>JSON.stringify(v.input)}}}),tracer:r,fn:async I=>{let A;try{const M=S3({execute:k.execute.bind(k),input:v.input,options:{toolCallId:v.toolCallId,messages:i,abortSignal:a,experimental_context:c}});for await(const U of M)l.enqueue({...v,type:"tool-result",output:U.output,...U.type==="preliminary"&&{preliminary:!0}}),U.type==="final"&&(A=U.output)}catch(M){FT(I,M),l.enqueue({...v,type:"tool-error",error:M}),d.delete(E),g();return}d.delete(E),g();try{I.setAttributes(Un({telemetry:o,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(A)}}}))}catch{}}})}}catch(v){l.enqueue({type:"error",error:v})}break}case"tool-result":{const v=b.toolName;b.isError?l.enqueue({type:"tool-error",toolCallId:b.toolCallId,toolName:v,input:f.get(b.toolCallId),providerExecuted:b.providerExecuted,error:b.result}):w.enqueue({type:"tool-result",toolCallId:b.toolCallId,toolName:v,input:f.get(b.toolCallId),output:b.result,providerExecuted:b.providerExecuted});break}default:{const v=x;throw new Error(`Unhandled chunk type: ${v}`)}}},flush(){m=!0,g()}});return new ReadableStream({async start(b){return Promise.all([t.pipeThrough(y).pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){}})),u.pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){b.close()}}))])}})}var oB=oa({prefix:"aitxt",size:24});function iB({model:e,tools:t,toolChoice:r,system:o,prompt:n,messages:i,maxRetries:a,abortSignal:s,headers:c,stopWhen:l=ZT(1),experimental_output:u,experimental_telemetry:d,prepareStep:f,providerOptions:m,experimental_activeTools:h,activeTools:g=h,experimental_repairToolCall:y,experimental_transform:b,experimental_download:w,includeRawChunks:x=!1,onChunk:v,onError:k=({error:F})=>{console.error(F)},onFinish:E,onAbort:I,onStepFinish:A,experimental_context:M,_internal:{now:U=rB,generateId:K=oB,currentDate:he=()=>new Date}={},...q}){return new sB({model:jT(e),telemetry:d,headers:c,settings:q,maxRetries:a,abortSignal:s,system:o,prompt:n,messages:i,tools:t,toolChoice:r,transforms:Qh(b),activeTools:g,repairToolCall:y,stopConditions:Qh(l),output:u,providerOptions:m,prepareStep:f,includeRawChunks:x,onChunk:v,onError:k,onFinish:E,onAbort:I,onStepFinish:A,now:U,currentDate:he,generateId:K,experimental_context:M,download:w})}function aB(e){if(!e)return new TransformStream({transform(a,s){s.enqueue({part:a,partialOutput:void 0})}});let t,r="",o="",n="";function i({controller:a,partialOutput:s=void 0}){a.enqueue({part:{type:"text-delta",id:t,text:o},partialOutput:s}),o=""}return new TransformStream({async transform(a,s){if(a.type==="finish-step"&&o.length>0&&i({controller:s}),a.type!=="text-delta"&&a.type!=="text-start"&&a.type!=="text-end"){s.enqueue({part:a,partialOutput:void 0});return}if(t==null)t=a.id;else if(a.id!==t){s.enqueue({part:a,partialOutput:void 0});return}if(a.type==="text-start"){s.enqueue({part:a,partialOutput:void 0});return}if(a.type==="text-end"){o.length>0&&i({controller:s}),s.enqueue({part:a,partialOutput:void 0});return}r+=a.text,o+=a.text;const c=await e.parsePartial({text:r});if(c!=null){const l=JSON.stringify(c.partial);l!==n&&(i({controller:s,partialOutput:c.partial}),n=l)}}})}var sB=class{constructor({model:e,telemetry:t,headers:r,settings:o,maxRetries:n,abortSignal:i,system:a,prompt:s,messages:c,tools:l,toolChoice:u,transforms:d,activeTools:f,repairToolCall:m,stopConditions:h,output:g,providerOptions:y,prepareStep:b,includeRawChunks:w,now:x,currentDate:v,generateId:k,onChunk:E,onError:I,onFinish:A,onAbort:M,onStepFinish:U,experimental_context:K,download:he}){this._totalUsage=new Ta,this._finishReason=new Ta,this._steps=new Ta,this.output=g,this.includeRawChunks=w,this.tools=l;let q,F=[];const ce=[];let le,pe,G={},se=[];const V=[];let ye,ue={},ve={};const P=new TransformStream({async transform(Pe,je){var Ge,be,Pt,To;je.enqueue(Pe);const{part:L}=Pe;if((L.type==="text-delta"||L.type==="reasoning-delta"||L.type==="source"||L.type==="tool-call"||L.type==="tool-result"||L.type==="tool-input-start"||L.type==="tool-input-delta"||L.type==="raw")&&await E?.({chunk:L}),L.type==="error"&&await I({error:$Z(L.error)}),L.type==="text-start"&&(ue[L.id]={type:"text",text:"",providerMetadata:L.providerMetadata},F.push(ue[L.id])),L.type==="text-delta"){const Ce=ue[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`text part ${L.id} not found`},partialOutput:void 0});return}Ce.text+=L.text,Ce.providerMetadata=(Ge=L.providerMetadata)!=null?Ge:Ce.providerMetadata}if(L.type==="text-end"){const Ce=ue[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`text part ${L.id} not found`},partialOutput:void 0});return}Ce.providerMetadata=(be=L.providerMetadata)!=null?be:Ce.providerMetadata,delete ue[L.id]}if(L.type==="reasoning-start"&&(ve[L.id]={type:"reasoning",text:"",providerMetadata:L.providerMetadata},F.push(ve[L.id])),L.type==="reasoning-delta"){const Ce=ve[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`reasoning part ${L.id} not found`},partialOutput:void 0});return}Ce.text+=L.text,Ce.providerMetadata=(Pt=L.providerMetadata)!=null?Pt:Ce.providerMetadata}if(L.type==="reasoning-end"){const Ce=ve[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`reasoning part ${L.id} not found`},partialOutput:void 0});return}Ce.providerMetadata=(To=L.providerMetadata)!=null?To:Ce.providerMetadata,delete ve[L.id]}if(L.type==="file"&&F.push({type:"file",file:L.file}),L.type==="source"&&F.push(L),L.type==="tool-call"&&F.push(L),L.type==="tool-result"&&!L.preliminary&&F.push(L),L.type==="tool-error"&&F.push(L),L.type==="start-step"&&(G=L.request,se=L.warnings),L.type==="finish-step"){const Ce=rv({content:F,tools:l}),$o=new FZ({content:F,finishReason:L.finishReason,usage:L.usage,warnings:se,request:G,response:{...L.response,messages:[...ce,...Ce]},providerMetadata:L.providerMetadata});await U?.($o),UV(se),V.push($o),F=[],ve={},ue={},ce.push(...Ce),q.resolve()}L.type==="finish"&&(pe=L.totalUsage,le=L.finishReason)},async flush(Pe){try{if(V.length===0){const Pt=new BV({message:"No output generated. Check the stream for errors."});qe._finishReason.reject(Pt),qe._totalUsage.reject(Pt),qe._steps.reject(Pt);return}const je=le??"unknown",Ge=pe??{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};qe._finishReason.resolve(je),qe._totalUsage.resolve(Ge),qe._steps.resolve(V);const be=V[V.length-1];await A?.({finishReason:je,totalUsage:Ge,usage:be.usage,content:be.content,text:be.text,reasoningText:be.reasoningText,reasoning:be.reasoning,files:be.files,sources:be.sources,toolCalls:be.toolCalls,staticToolCalls:be.staticToolCalls,dynamicToolCalls:be.dynamicToolCalls,toolResults:be.toolResults,staticToolResults:be.staticToolResults,dynamicToolResults:be.dynamicToolResults,request:be.request,response:be.response,warnings:be.warnings,providerMetadata:be.providerMetadata,steps:V}),ye.setAttributes(Un({telemetry:t,attributes:{"ai.response.finishReason":je,"ai.response.text":{output:()=>be.text},"ai.response.toolCalls":{output:()=>{var Pt;return(Pt=be.toolCalls)!=null&&Pt.length?JSON.stringify(be.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(be.providerMetadata),"ai.usage.inputTokens":Ge.inputTokens,"ai.usage.outputTokens":Ge.outputTokens,"ai.usage.totalTokens":Ge.totalTokens,"ai.usage.reasoningTokens":Ge.reasoningTokens,"ai.usage.cachedInputTokens":Ge.cachedInputTokens}}))}catch(je){Pe.error(je)}finally{ye.end()}}}),H=tB();this.addStream=H.addStream,this.closeStream=H.close;const me=H.stream.getReader();let Te=new ReadableStream({async start(Pe){Pe.enqueue({type:"start"})},async pull(Pe){function je(){M?.({steps:V}),Pe.enqueue({type:"abort"}),Pe.close()}try{const{done:Ge,value:be}=await me.read();if(Ge){Pe.close();return}if(i?.aborted){je();return}Pe.enqueue(be)}catch(Ge){cn(Ge)&&i?.aborted?je():Pe.error(Ge)}},cancel(Pe){return H.stream.cancel(Pe)}});for(const Pe of d)Te=Te.pipeThrough(Pe({tools:l,stopStream(){H.terminate()}}));this.baseStream=Te.pipeThrough(aB(g)).pipeThrough(P);const{maxRetries:Fe,retry:ll}=zZ({maxRetries:n,abortSignal:i}),Io=NZ(t),Rt=gZ(o),la=OZ({model:e,telemetry:t,headers:r,settings:{...Rt,maxRetries:Fe}}),qe=this;nd({name:"ai.streamText",attributes:Un({telemetry:t,attributes:{...rd({operationId:"ai.streamText",telemetry:t}),...la,"ai.prompt":{input:()=>JSON.stringify({system:a,prompt:s,messages:c})}}}),tracer:Io,endWhenDone:!1,fn:async Pe=>{ye=Pe;async function je({currentStep:Ge,responseMessages:be,usage:Pt}){var To,L,Ce,$o,Cp;const Np=qe.includeRawChunks;q=new Ta;const Rp=await TZ({system:a,prompt:s,messages:c}),Oo=[...Rp.messages,...be],Jt=await b?.({model:e,steps:V,stepNumber:V.length,messages:Oo}),Sn=jT((To=Jt?.model)!=null?To:e),Pp=await dZ({prompt:{system:(L=Jt?.system)!=null?L:Rp.system,messages:(Ce=Jt?.messages)!=null?Ce:Oo},supportedUrls:await Sn.supportedUrls,download:he}),{toolChoice:ul,tools:dl}=vZ({tools:l,toolChoice:($o=Jt?.toolChoice)!=null?$o:u,activeTools:(Cp=Jt?.activeTools)!=null?Cp:f}),{result:{stream:H1,response:jp,request:Dp},doStreamSpan:kn,startTimestampMs:zp}=await ll(()=>nd({name:"ai.streamText.doStream",attributes:Un({telemetry:t,attributes:{...rd({operationId:"ai.streamText.doStream",telemetry:t}),...la,"ai.model.provider":Sn.provider,"ai.model.id":Sn.modelId,"ai.prompt.messages":{input:()=>RZ(Pp)},"ai.prompt.tools":{input:()=>dl?.map(W=>JSON.stringify(W))},"ai.prompt.toolChoice":{input:()=>ul!=null?JSON.stringify(ul):void 0},"gen_ai.system":Sn.provider,"gen_ai.request.model":Sn.modelId,"gen_ai.request.frequency_penalty":Rt.frequencyPenalty,"gen_ai.request.max_tokens":Rt.maxOutputTokens,"gen_ai.request.presence_penalty":Rt.presencePenalty,"gen_ai.request.stop_sequences":Rt.stopSequences,"gen_ai.request.temperature":Rt.temperature,"gen_ai.request.top_k":Rt.topK,"gen_ai.request.top_p":Rt.topP}}),tracer:Io,endWhenDone:!1,fn:async W=>({startTimestampMs:x(),doStreamSpan:W,result:await Sn.doStream({...Rt,tools:dl,toolChoice:ul,responseFormat:g?.responseFormat,prompt:Pp,providerOptions:y,abortSignal:i,headers:r,includeRawChunks:Np})})})),W1=nB({tools:l,generatorStream:H1,tracer:Io,telemetry:t,system:a,messages:Oo,repairToolCall:m,abortSignal:i,experimental_context:K}),J1=Dp??{},ua=[],fl=[];let ml;const pl={};let En="unknown",jt={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},gl,Mp=!0,Kt={id:k(),timestamp:v(),modelId:e.modelId},Up="";qe.addStream(W1.pipeThrough(new TransformStream({async transform(W,He){var Ao,Co,da,lr;if(W.type==="stream-start"){ml=W.warnings;return}if(Mp){const tt=x()-zp;Mp=!1,kn.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":tt}),kn.setAttributes({"ai.response.msToFirstChunk":tt}),He.enqueue({type:"start-step",request:J1,warnings:ml??[]})}const Lp=W.type;switch(Lp){case"text-start":case"text-end":{He.enqueue(W);break}case"text-delta":{W.delta.length>0&&(He.enqueue({type:"text-delta",id:W.id,text:W.delta,providerMetadata:W.providerMetadata}),Up+=W.delta);break}case"reasoning-start":case"reasoning-end":{He.enqueue(W);break}case"reasoning-delta":{He.enqueue({type:"reasoning-delta",id:W.id,text:W.delta,providerMetadata:W.providerMetadata});break}case"tool-call":{He.enqueue(W),ua.push(W);break}case"tool-result":{He.enqueue(W),W.preliminary||fl.push(W);break}case"tool-error":{He.enqueue(W),fl.push(W);break}case"response-metadata":{Kt={id:(Ao=W.id)!=null?Ao:Kt.id,timestamp:(Co=W.timestamp)!=null?Co:Kt.timestamp,modelId:(da=W.modelId)!=null?da:Kt.modelId};break}case"finish":{jt=W.usage,En=W.finishReason,gl=W.providerMetadata;const tt=x()-zp;kn.addEvent("ai.stream.finish"),kn.setAttributes({"ai.response.msToFinish":tt,"ai.response.avgOutputTokensPerSecond":1e3*((lr=jt.outputTokens)!=null?lr:0)/tt});break}case"file":{He.enqueue(W);break}case"source":{He.enqueue(W);break}case"tool-input-start":{pl[W.id]=W.toolName;const tt=l?.[W.toolName];tt?.onInputStart!=null&&await tt.onInputStart({toolCallId:W.id,messages:Oo,abortSignal:i,experimental_context:K}),He.enqueue({...W,dynamic:tt?.type==="dynamic"});break}case"tool-input-end":{delete pl[W.id],He.enqueue(W);break}case"tool-input-delta":{const tt=pl[W.id],hl=l?.[tt];hl?.onInputDelta!=null&&await hl.onInputDelta({inputTextDelta:W.delta,toolCallId:W.id,messages:Oo,abortSignal:i,experimental_context:K}),He.enqueue(W);break}case"error":{He.enqueue(W),En="error";break}case"raw":{Np&&He.enqueue(W);break}default:{const tt=Lp;throw new Error(`Unknown chunk type: ${tt}`)}}},async flush(W){const He=ua.length>0?JSON.stringify(ua):void 0;try{kn.setAttributes(Un({telemetry:t,attributes:{"ai.response.finishReason":En,"ai.response.text":{output:()=>Up},"ai.response.toolCalls":{output:()=>He},"ai.response.id":Kt.id,"ai.response.model":Kt.modelId,"ai.response.timestamp":Kt.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(gl),"ai.usage.inputTokens":jt.inputTokens,"ai.usage.outputTokens":jt.outputTokens,"ai.usage.totalTokens":jt.totalTokens,"ai.usage.reasoningTokens":jt.reasoningTokens,"ai.usage.cachedInputTokens":jt.cachedInputTokens,"gen_ai.response.finish_reasons":[En],"gen_ai.response.id":Kt.id,"gen_ai.response.model":Kt.modelId,"gen_ai.usage.input_tokens":jt.inputTokens,"gen_ai.usage.output_tokens":jt.outputTokens}}))}catch{}finally{kn.end()}W.enqueue({type:"finish-step",finishReason:En,usage:jt,providerMetadata:gl,response:{...Kt,headers:jp?.headers}});const Ao=PZ(Pt,jt);await q.promise;const Co=ua.filter(lr=>lr.providerExecuted!==!0),da=fl.filter(lr=>lr.providerExecuted!==!0);if(Co.length>0&&da.length===Co.length&&!await VZ({stopConditions:h,steps:V})){be.push(...rv({content:V[V.length-1].content,tools:l}));try{await je({currentStep:Ge+1,responseMessages:be,usage:Ao})}catch(lr){W.enqueue({type:"error",error:lr}),qe.closeStream()}}else W.enqueue({type:"finish",finishReason:En,totalUsage:Ao}),qe.closeStream()}})))}await je({currentStep:0,responseMessages:[],usage:{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0}})}}).catch(Pe=>{qe.addStream(new ReadableStream({start(je){je.enqueue({type:"error",error:Pe}),je.close()}})),qe.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(e=>e[e.length-1])}get content(){return this.finalStep.then(e=>e.content)}get warnings(){return this.finalStep.then(e=>e.warnings)}get providerMetadata(){return this.finalStep.then(e=>e.providerMetadata)}get text(){return this.finalStep.then(e=>e.text)}get reasoningText(){return this.finalStep.then(e=>e.reasoningText)}get reasoning(){return this.finalStep.then(e=>e.reasoning)}get sources(){return this.finalStep.then(e=>e.sources)}get files(){return this.finalStep.then(e=>e.files)}get toolCalls(){return this.finalStep.then(e=>e.toolCalls)}get staticToolCalls(){return this.finalStep.then(e=>e.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(e=>e.dynamicToolCalls)}get toolResults(){return this.finalStep.then(e=>e.toolResults)}get staticToolResults(){return this.finalStep.then(e=>e.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(e=>e.dynamicToolResults)}get usage(){return this.finalStep.then(e=>e.usage)}get request(){return this.finalStep.then(e=>e.request)}get response(){return this.finalStep.then(e=>e.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return Ia(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type==="text-delta"&&t.enqueue(e.text)}})))}get fullStream(){return Ia(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await eB({stream:this.fullStream,onError:e?.onError})}catch(r){(t=e?.onError)==null||t.call(e,r)}}get experimental_partialOutputStream(){if(this.output==null)throw new DV;return Ia(this.teeStream().pipeThrough(new TransformStream({transform({partialOutput:e},t){e!=null&&t.enqueue(e)}})))}toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:o,sendReasoning:n=!0,sendSources:i=!1,sendStart:a=!0,sendFinish:s=!0,onError:c=uo}={}){const l=t!=null?GZ({originalMessages:e,responseMessageId:t}):void 0,u={},d=m=>{var h,g;const y=u[m];return((g=(h=this.tools)==null?void 0:h[y])==null?void 0:g.type)==="dynamic"?!0:void 0},f=this.fullStream.pipeThrough(new TransformStream({transform:async(m,h)=>{const g=o?.({part:m}),y=m.type;switch(y){case"text-start":{h.enqueue({type:"text-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-delta":{h.enqueue({type:"text-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-end":{h.enqueue({type:"text-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-start":{h.enqueue({type:"reasoning-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-delta":{n&&h.enqueue({type:"reasoning-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-end":{h.enqueue({type:"reasoning-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"file":{h.enqueue({type:"file",mediaType:m.file.mediaType,url:`data:${m.file.mediaType};base64,${m.file.base64}`});break}case"source":{i&&m.sourceType==="url"&&h.enqueue({type:"source-url",sourceId:m.id,url:m.url,title:m.title,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}}),i&&m.sourceType==="document"&&h.enqueue({type:"source-document",sourceId:m.id,mediaType:m.mediaType,title:m.title,filename:m.filename,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"tool-input-start":{u[m.id]=m.toolName;const b=d(m.id);h.enqueue({type:"tool-input-start",toolCallId:m.id,toolName:m.toolName,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"tool-input-delta":{h.enqueue({type:"tool-input-delta",toolCallId:m.id,inputTextDelta:m.delta});break}case"tool-call":{u[m.toolCallId]=m.toolName;const b=d(m.toolCallId);m.invalid?h.enqueue({type:"tool-input-error",toolCallId:m.toolCallId,toolName:m.toolName,input:m.input,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{},...b!=null?{dynamic:b}:{},errorText:c(m.error)}):h.enqueue({type:"tool-input-available",toolCallId:m.toolCallId,toolName:m.toolName,input:m.input,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{},...b!=null?{dynamic:b}:{}});break}case"tool-result":{const b=d(m.toolCallId);h.enqueue({type:"tool-output-available",toolCallId:m.toolCallId,output:m.output,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.preliminary!=null?{preliminary:m.preliminary}:{},...b!=null?{dynamic:b}:{}});break}case"tool-error":{const b=d(m.toolCallId);h.enqueue({type:"tool-output-error",toolCallId:m.toolCallId,errorText:c(m.error),...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"error":{h.enqueue({type:"error",errorText:c(m.error)});break}case"start-step":{h.enqueue({type:"start-step"});break}case"finish-step":{h.enqueue({type:"finish-step"});break}case"start":{a&&h.enqueue({type:"start",...g!=null?{messageMetadata:g}:{},...l!=null?{messageId:l}:{}});break}case"finish":{s&&h.enqueue({type:"finish",...g!=null?{messageMetadata:g}:{}});break}case"abort":{h.enqueue(m);break}case"tool-input-end":break;case"raw":break;default:{const b=y;throw new Error(`Unknown chunk type: ${b}`)}}g!=null&&y!=="start"&&y!=="finish"&&h.enqueue({type:"message-metadata",messageMetadata:g})}}));return Ia(XZ({stream:f,messageId:l??t?.(),originalMessages:e,onFinish:r,onError:c}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:r,onFinish:o,messageMetadata:n,sendReasoning:i,sendSources:a,sendFinish:s,sendStart:c,onError:l,...u}={}){QZ({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:r,onFinish:o,messageMetadata:n,sendReasoning:i,sendSources:a,sendFinish:s,sendStart:c,onError:l}),...u})}pipeTextStreamToResponse(e,t){BZ({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:o,sendReasoning:n,sendSources:i,sendFinish:a,sendStart:s,onError:c,...l}={}){return qZ({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:o,sendReasoning:n,sendSources:i,sendFinish:a,sendStart:s,onError:c}),...l})}toTextStreamResponse(e){return ZZ({textStream:this.textStream,...e})}};function cB(e,t){const r=[];t?.ignoreIncompleteToolCalls&&(e=e.map(o=>({...o,parts:o.parts.filter(n=>!ov(n)||n.state!=="input-streaming"&&n.state!=="input-available")})));for(const o of e)switch(o.role){case"system":{const n=o.parts.filter(a=>a.type==="text"),i=n.reduce((a,s)=>s.providerMetadata!=null?{...a,...s.providerMetadata}:a,{});r.push({role:"system",content:n.map(a=>a.text).join(""),...Object.keys(i).length>0?{providerOptions:i}:{}});break}case"user":{r.push({role:"user",content:o.parts.map(n=>{var i;if(Ql(n))return{type:"text",text:n.text,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(eu(n))return{type:"file",mediaType:n.mediaType,filename:n.filename,data:n.url,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(Xl(n))return(i=t?.convertDataPart)==null?void 0:i.call(t,n)}).filter(n=>n!=null)});break}case"assistant":{if(o.parts!=null){let n=function(){var a,s,c;if(i.length===0)return;const l=[];for(const d of i)if(Ql(d))l.push({type:"text",text:d.text,...d.providerMetadata!=null?{providerOptions:d.providerMetadata}:{}});else if(eu(d))l.push({type:"file",mediaType:d.mediaType,filename:d.filename,data:d.url});else if(nv(d))l.push({type:"reasoning",text:d.text,providerOptions:d.providerMetadata});else if(Ym(d)){const f=d.toolName;d.state!=="input-streaming"&&l.push({type:"tool-call",toolCallId:d.toolCallId,toolName:f,input:d.input,...d.callProviderMetadata!=null?{providerOptions:d.callProviderMetadata}:{}})}else if(Vn(d)){const f=Is(d);d.state!=="input-streaming"&&(l.push({type:"tool-call",toolCallId:d.toolCallId,toolName:f,input:d.state==="output-error"?(a=d.input)!=null?a:d.rawInput:d.input,providerExecuted:d.providerExecuted,...d.callProviderMetadata!=null?{providerOptions:d.callProviderMetadata}:{}}),d.providerExecuted===!0&&(d.state==="output-available"||d.state==="output-error")&&l.push({type:"tool-result",toolCallId:d.toolCallId,toolName:f,output:Jo({output:d.state==="output-error"?d.errorText:d.output,tool:(s=t?.tools)==null?void 0:s[f],errorMode:d.state==="output-error"?"json":"none"})}))}else if(Xl(d)){const f=(c=t?.convertDataPart)==null?void 0:c.call(t,d);f!=null&&l.push(f)}else{const f=d;throw new Error(`Unsupported part: ${f}`)}r.push({role:"assistant",content:l});const u=i.filter(d=>Vn(d)&&d.providerExecuted!==!0||d.type==="dynamic-tool");u.length>0&&r.push({role:"tool",content:u.map(d=>{var f;switch(d.state){case"output-error":case"output-available":{const m=JZ(d);return{type:"tool-result",toolCallId:d.toolCallId,toolName:m,output:Jo({output:d.state==="output-error"?d.errorText:d.output,tool:(f=t?.tools)==null?void 0:f[m],errorMode:d.state==="output-error"?"text":"none"})}}default:return null}}).filter(d=>d!=null)}),i=[]},i=[];for(const a of o.parts)Ql(a)||nv(a)||eu(a)||ov(a)||Xl(a)?i.push(a):a.type==="step-start"&&n();n();break}break}default:{const n=o.role;throw new XV({originalMessage:o,message:`Unsupported role: ${n}`})}}return r}oa({prefix:"aiobj",size:24});oa({prefix:"aiobj",size:24});var lB={};PV(lB,{object:()=>dB,text:()=>uB});var uB=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),dB=({schema:e})=>{const t=Wc(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const o=await WT(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:o.value};default:{const n=o.state;throw new Error(`Unsupported parse state: ${n}`)}}},async parseOutput({text:r},o){const n=await ln({text:r});if(!n.success)throw new Yh({message:"No object generated: could not parse the response.",cause:n.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=await Mr({value:n.value,schema:t});if(!i.success)throw new Yh({message:"No object generated: response did not match schema.",cause:i.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.value}}},fB={word:/\S+\s+/m,line:/\n+/m};function mB({delayInMs:e=10,chunking:t="word",_internal:{delay:r=OI}={}}={}){let o;if(typeof t=="function")o=n=>{const i=t(n);if(i==null)return null;if(!i.length)throw new Error("Chunking function must return a non-empty string.");if(!n.startsWith(i))throw new Error(`Chunking function must return a match that is a prefix of the buffer. Received: "${i}" expected to start with "${n}"`);return i};else{const n=typeof t=="string"?fB[t]:t;if(n==null)throw new pd({argument:"chunking",message:`Chunking must be "word" or "line" or a RegExp. Received: ${t}`});o=i=>{const a=n.exec(i);return a?i.slice(0,a.index)+a?.[0]:null}}return()=>{let n="",i="";return new TransformStream({async transform(a,s){if(a.type!=="text-delta"){n.length>0&&(s.enqueue({type:"text-delta",text:n,id:i}),n=""),s.enqueue(a);return}a.id!==i&&n.length>0&&(s.enqueue({type:"text-delta",text:n,id:i}),n=""),n+=a.text,i=a.id;let c;for(;(c=o(n))!=null;)s.enqueue({type:"text-delta",text:c,id:i}),n=n.slice(c.length),await r(e)}})}}function av(e){return!!e&&"sessionToken"in e}function pB(e){return e?"sessionFn"in e:!1}const gB=({getSession:e,projectSlug:t})=>{const r=ES(),o=["chatSession",t],n=r.getQueryState(o),i=n?.data!==void 0,a=n?.dataUpdatedAt??0,c=i&&Date.now()-a>1/0,l=!i||c,{data:u}=TS({queryKey:o,queryFn:()=>e({projectSlug:t}),enabled:l&&e!==null,staleTime:1/0,gcTime:1/0});return u??null};async function hB(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug}})).json()).client_token}const vB=({projectSlug:e,auth:t})=>{const r=N.useMemo(()=>av(t)?()=>Promise.resolve(t.sessionToken):!av(t)&&pB(t)?t.sessionFn:hB,[t]),o=gB({getSession:r,projectSlug:e});return o?{headers:{"Gram-Project":e,"Gram-Chat-Session":o},isLoading:!1}:{isLoading:!0}};function yB({children:e}){const[t,r]=N.useState(new Map),[o,n]=N.useState(new Set),i=N.useCallback((d,f,m)=>new Promise(h=>{const g={toolCallId:f,toolName:d,args:m,resolve:h};r(y=>{const b=new Map(y);return b.set(f,g),b})}),[]),a=N.useCallback(d=>{n(f=>{const m=new Set(f);return m.add(d),m})},[]),s=N.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!0);const h=new Map(f);return h.delete(d),h}return f})},[]),c=N.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!1);const h=new Map(f);return h.delete(d),h}return f})},[]),l=N.useCallback(d=>o.has(d),[o]),u=N.useCallback(d=>t.get(d),[t]);return p.jsx($.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:o,requestApproval:i,whitelistTool:a,confirmPendingApproval:s,rejectPendingApproval:c,isToolApproved:l,getPendingApproval:u},children:e})}const bB=function(){let e,t;const r=new Promise((o,n)=>{e=o,t=n});if(!e||!t)throw new Error("Failed to create promise");return{promise:r,resolve:e,reject:t}},_B=()=>{const e=[];let t=!1,r,o;const n=a=>{a.promise||(a.promise=a.reader.read().then(({done:s,value:c})=>{a.promise=void 0,s?(e.splice(e.indexOf(a),1),t&&e.length===0&&r.close()):r.enqueue(c),o?.resolve(),o=void 0}).catch(s=>{console.error(s),e.forEach(c=>{c.reader.cancel()}),e.length=0,r.error(s),o?.reject(s),o=void 0}))};return{readable:new ReadableStream({start(a){r=a},pull(){return o=bB(),e.forEach(a=>{n(a)}),o.promise},cancel(){e.forEach(a=>{a.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&r.close()},addStream(a){if(t)throw new Error("Cannot add streams after the run callback has settled.");const s={reader:a.getReader()};e.push(s),n(s)},enqueue(a){this.addStream(new ReadableStream({start(s){s.enqueue(a),s.close()}}))}}};class sv{_controller;_isClosed=!1;constructor(t){this._controller=t}append(t){return this._controller.enqueue({type:"text-delta",path:[],textDelta:t}),this}close(){this._isClosed||(this._isClosed=!0,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}const JT=e=>new ReadableStream({start(t){return e.start?.(new sv(t))},pull(t){return e.pull?.(new sv(t))},cancel(t){return e.cancel?.(t)}}),cv=()=>{let e;return[JT({start(r){e=r}}),e]};class lv{_controller;_isClosed=!1;_mergeTask;constructor(t){this._controller=t;const r=JT({start:n=>{this._argsTextController=n}});let o=!1;this._mergeTask=r.pipeTo(new WritableStream({write:n=>{switch(n.type){case"text-delta":o=!0,this._controller.enqueue(n);break;case"part-finish":o||this._controller.enqueue({type:"text-delta",textDelta:"{}",path:[]}),this._controller.enqueue({type:"tool-call-args-text-finish",path:[]});break;default:throw new Error(`Unexpected chunk type: ${n.type}`)}}}))}get argsText(){return this._argsTextController}_argsTextController;async setResponse(t){this._argsTextController.close(),await Promise.resolve(),this._controller.enqueue({type:"result",path:[],...t.artifact!==void 0?{artifact:t.artifact}:{},result:t.result,isError:t.isError??!1})}async close(){this._isClosed||(this._isClosed=!0,this._argsTextController.close(),await this._mergeTask,this._controller.enqueue({type:"part-finish",path:[]}),this._controller.close())}}const wB=e=>new ReadableStream({start(t){return e.start?.(new lv(t))},pull(t){return e.pull?.(new lv(t))},cancel(t){return e.cancel?.(t)}}),xB=()=>{let e;return[wB({start(r){e=r}}),e]};class KT{value=-1;up(){return++this.value}}class SB extends TransformStream{constructor(t){super({transform(r,o){o.enqueue({...r,path:[t,...r.path]})}})}}class UW extends TransformStream{constructor(t){super({transform(r,o){const{path:[n,...i]}=r;if(t!==n)throw new Error(`Path mismatch: expected ${t}, got ${n}`);o.enqueue({...r,path:i})}})}}class kB extends TransformStream{constructor(t){const r=new KT,o=new Map;super({transform(n,i){n.type==="part-start"&&n.path.length===0&&o.set(r.up(),t.up());const[a,...s]=n.path;if(a===void 0){i.enqueue(n);return}const c=o.get(a);if(c===void 0)throw new Error("Path not found");i.enqueue({...n,path:[c,...s]})}})}}let EB=(e,t=21)=>(r=t)=>{let o="",n=r|0;for(;n--;)o+=e[Math.random()*e.length|0];return o};const IB=EB("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class Xm{_state;_parentId;constructor(t){this._state=t||{merger:_B(),contentCounter:new KT}}get __internal_isClosed(){return this._state.merger.isSealed()}__internal_getReadable(){return this._state.merger.readable}__internal_subscribeToClose(t){this._state.closeSubscriber=t}_addPart(t,r){this._state.append&&(this._state.append.controller.close(),this._state.append=void 0),this.enqueue({type:"part-start",part:t,path:[]}),this._state.merger.addStream(r.pipeThrough(new SB(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new kB(this._state.contentCounter)))}appendText(t){this._state.append?.kind!=="text"&&(this._state.append={kind:"text",controller:this.addTextPart()}),this._state.append.controller.append(t)}appendReasoning(t){this._state.append?.kind!=="reasoning"&&(this._state.append={kind:"reasoning",controller:this.addReasoningPart()}),this._state.append.controller.append(t)}addTextPart(){const[t,r]=cv();return this._addPart({type:"text"},t),r}addReasoningPart(){const[t,r]=cv();return this._addPart({type:"reasoning"},t),r}addToolCallPart(t){const r=typeof t=="string"?{toolName:t}:t,o=r.toolName,n=r.toolCallId??IB(),[i,a]=xB();return this._addPart({type:"tool-call",toolName:o,toolCallId:n,...this._parentId&&{parentId:this._parentId}},i),r.argsText!==void 0&&(a.argsText.append(r.argsText),a.argsText.close()),r.args!==void 0&&(a.argsText.append(JSON.stringify(r.args)),a.argsText.close()),r.response!==void 0&&a.setResponse(r.response),a}appendSource(t){this._addPart({...t,...this._parentId&&{parentId:this._parentId}},new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}appendFile(t){this._addPart(t,new ReadableStream({start(r){r.enqueue({type:"part-finish",path:[]}),r.close()}}))}enqueue(t){this._state.merger.enqueue(t),t.type==="part-start"&&t.path.length===0&&this._state.contentCounter.up()}withParentId(t){const r=new Xm(this._state);return r._parentId=t,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}}function tu(e){const t=new Xm;return(async()=>{try{await e(t)}catch(o){throw t.__internal_isClosed||t.enqueue({type:"error",path:[],error:String(o)}),o}finally{t.__internal_isClosed||t.close()}})(),t.__internal_getReadable()}function TB(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"?"system":"assistant"}function $B(e){return typeof e=="string"?new Date(e):e}function OB(e){const t=[];return e.content&&t.push({type:"text",text:e.content}),t.length===0&&t.push({type:"text",text:""}),t}function AB(e){const t=[];if(e.content&&t.push({type:"text",text:e.content}),e.toolCalls)try{const r=JSON.parse(e.toolCalls);for(const o of r){const n=o.function?.arguments??o.args??{},i=typeof n=="string"?n:JSON.stringify(n);t.push({type:"tool-call",toolCallId:o.id??o.toolCallId??"",toolName:o.function?.name??o.toolName??"",args:typeof n=="string"?JSON.parse(n):n,argsText:i,result:void 0})}}catch{}return t.length===0&&t.push({type:"text",text:""}),t}function CB(e){const t=TB(e.role),r=$B(e.createdAt),o={unstable_state:void 0,unstable_annotations:void 0,unstable_data:void 0,steps:void 0,submittedFeedback:void 0,custom:{}};return t==="user"?{id:e.id,role:"user",createdAt:r,content:OB(e),attachments:[],metadata:o}:t==="system"?{id:e.id,role:"system",createdAt:r,content:[{type:"text",text:e.content??""}],metadata:o}:{id:e.id,role:"assistant",createdAt:r,content:AB(e),status:{type:"complete",reason:"stop"},metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],steps:[],submittedFeedback:void 0,custom:{}}}}function NB(e){if(e.length===0)return{messages:[],headId:null};const t=[];let r=null;for(const o of e){if(o.role==="system")continue;const n=CB(o);t.push({message:n,parentId:r,runConfig:void 0}),r=o.id}return{messages:t,headId:r}}const RB="__LOCALID_";function Za(e){return!!e?.startsWith(RB)}class PB{constructor(t,r,o){this.apiUrl=t,this.headers=r,this.store=o}async load(){const t=this.store.threadListItem().getState().remoteId;if(!t)return{messages:[],headId:null};try{const r=await fetch(`${this.apiUrl}/rpc/chat.load?id=${encodeURIComponent(t)}`,{headers:this.headers});if(!r.ok)return console.error("Failed to load chat:",r.status),{messages:[],headId:null};const o=await r.json();return NB(o.messages)}catch(r){return console.error("Error loading chat:",r),{messages:[],headId:null}}}async append(){}withFormat(t){return{load:async()=>{const r=this.store.threadListItem().getState().remoteId;if(!r)return{messages:[],headId:null};try{const o=await fetch(`${this.apiUrl}/rpc/chat.load?id=${encodeURIComponent(r)}`,{headers:this.headers});if(!o.ok)return console.error("Failed to load chat (withFormat):",o.status),{messages:[],headId:null};const i=(await o.json()).messages.filter(c=>c.role!=="system");if(i.length===0)return{messages:[],headId:null};let a=null;const s=i.map((c,l)=>{const u=c.id||`fallback-${l}-${Date.now()}`,d={parentId:a,message:{id:u,role:c.role,parts:[{type:"text",text:c.content||""}],createdAt:c.createdAt?new Date(c.createdAt):new Date}};return a=u,d});return{headId:a,messages:s}}catch(o){return console.error("Error loading chat (withFormat):",o),{messages:[],headId:null}}},append:async()=>{}}}}function jB(e){const t=z.useAssistantApi(),[r]=N.useState(()=>new PB(e.current.apiUrl,e.current.headers,t));return r}function DB(e){const t=N.useRef(e);N.useEffect(()=>{t.current=e},[e]);const r=N.useCallback(function({children:n}){const i=jB(t),a=N.useMemo(()=>({history:i}),[i]);return p.jsx(z.RuntimeAdapterProvider,{adapters:a,children:n})},[]);return N.useMemo(()=>({unstable_Provider:r,async list(){try{const o=await fetch(`${t.current.apiUrl}/rpc/chat.list`,{headers:t.current.headers});return o.ok?{threads:(await o.json()).chats.map(i=>({remoteId:i.id,externalId:i.id,status:"regular",title:i.title||"New Chat"}))}:(console.error("Failed to list chats:",o.status),{threads:[]})}catch(o){return console.error("Error listing chats:",o),{threads:[]}}},async initialize(o){if(Za(o)){const n=t.current.localIdToUuidMap?.get(o);if(n)return{remoteId:n,externalId:n};const i=crypto.randomUUID();return t.current.localIdToUuidMap?.set(o,i),{remoteId:i,externalId:i}}return{remoteId:o,externalId:o}},async rename(){},async archive(){},async unarchive(){},async delete(){},async generateTitle(o,n){if(!o||Za(o))return tu(i=>{i.close()});try{const i=await fetch(`${t.current.apiUrl}/rpc/chat.generateTitle`,{method:"POST",headers:{...t.current.headers,"Content-Type":"application/json"},body:JSON.stringify({id:o})});if(i.ok){const s=(await i.json()).title||"New Chat";return tu(c=>{c.appendText(s),c.close()})}i.status!==404&&console.error("Error generating title:",i.status)}catch(i){console.error("Error generating title:",i)}return tu(i=>{i.close()})},async fetch(o){if(!o||Za(o))return{remoteId:o,status:"regular"};try{const n=await fetch(`${t.current.apiUrl}/rpc/chat.load?id=${encodeURIComponent(o)}`,{headers:t.current.headers});if(!n.ok)return console.error("Failed to fetch thread:",n.status),{remoteId:o,status:"regular"};const i=await n.json();return{remoteId:i.id,externalId:i.id,status:"regular",title:i.title||"New Chat"}}catch(n){return console.error("Error fetching thread:",n),{remoteId:o,status:"regular"}}}}),[r])}const Qm="gram-elements",zB="You are a helpful assistant that can answer questions and help with tasks.";function MB(e,t){return`
|
|
89
|
+
${zB}
|
|
90
|
+
|
|
91
|
+
User-provided System Prompt:
|
|
92
|
+
${e??"None provided"}
|
|
93
|
+
|
|
94
|
+
Utilities:
|
|
95
|
+
${t.map(r=>`- ${r.language}: ${r.prompt}`).join(`
|
|
96
|
+
`)}`}function UB(e){return e.map(t=>{const r=t.parts;if(!Array.isArray(r))return t;const o=r.map(n=>{const{callProviderMetadata:i,...a}=n;return a});return{...t,parts:o}})}const LB=({children:e,config:t})=>{const r=UP(t),o=vB({auth:t.api,projectSlug:t.projectSlug}),n=$S(),[i,a]=N.useState(t.model?.defaultModel??Pm[0]),[s,c]=N.useState(t.modal?.defaultExpanded??!1),[l,u]=N.useState(t.modal?.defaultOpen),d=t.plugins??$.recommended,f=MB(t.systemPrompt,d);N.useEffect(()=>{cL({enabled:t.errorTracking?.enabled,projectSlug:t.projectSlug,variant:t.variant})},[]);const{data:m}=zP({auth:o,mcp:t.mcp,environment:t.environment??{},gramEnvironment:t.gramEnvironment}),h=N.useRef({requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool});h.current={requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool};const g=N.useCallback(()=>({requestApproval:(...I)=>h.current.requestApproval(...I),isToolApproved:(...I)=>h.current.isToolApproved(...I),whitelistTool:(...I)=>h.current.whitelistTool(...I)}),[]);N.useEffect(()=>(t.tools?.toolsRequiringApproval&&dL(g(),t.tools.toolsRequiringApproval),()=>{fL()}),[t.tools?.toolsRequiringApproval,g]);const y=N.useRef(null),b=N.useRef(null),w=N.useRef(new Map),x=N.useMemo(()=>({sendMessages:async({messages:I,abortSignal:A})=>{const M=!!t.languageModel;if(o.isLoading)throw new Error("Session is loading");const U=y.current,K=U?.threadListItem?.getState?.(),he=U?.threads?.getState?.(),q=K?.remoteId,F=K?.id??he?.mainThreadId??he?.threadIds?.[0];let ce=q;if(Za(ce)||!ce&&F){const ve=ce??F;if(ve){const P=w.current.get(ve);if(P)ce=P;else{const H=crypto.randomUUID();w.current.set(ve,H),ce=H}}}ce||(b.current||(b.current=crypto.randomUUID()),ce=b.current);const le=y.current?.thread.getModelContext(),pe=lL(uL(le?.tools??{})),G={...o.headers,"Gram-Chat-ID":ce,...t.gramEnvironment&&{"Gram-Environment":t.gramEnvironment}},se=M?null:$I({baseURL:r,apiKey:"unused, but must be set",headers:G});t.languageModel&&console.log("Using custom language model",t.languageModel);const V={...m,...dd.frontendTools(pe)},ye=pL(V,t.tools?.toolsRequiringApproval,g()),ue=t.languageModel?t.languageModel:se.chat(i);try{const ve=UB(I),P=cB(ve);return iB({system:f,model:ue,messages:P,tools:ye,stopWhen:ZT(10),experimental_transform:mB({delayInMs:15}),abortSignal:A,onError:({error:me})=>{console.error("Stream error in onError callback:",me),gs(me,{source:"streaming"})}}).toUIMessageStream()}catch(ve){throw console.error("Error creating stream:",ve),gs(ve,{source:"stream-creation"}),ve}},reconnectToStream:async()=>{throw new Error("Stream reconnection not supported")}}),[t.languageModel,t.tools?.toolsRequiringApproval,i,f,m,g,r,o.headers,o.isLoading]),v=t.history?.enabled??!1,k=N.useMemo(()=>({config:t,setModel:a,model:i,isExpanded:s,setIsExpanded:c,isOpen:l??!1,setIsOpen:u,plugins:d,mcpTools:m}),[t,i,s,l,d,m]),E=t.tools?.frontendTools??{};return v&&!o.isLoading?p.jsx(FB,{transport:x,apiUrl:r,headers:o.headers,contextValue:k,runtimeRef:y,frontendTools:E,localIdToUuidMap:w.current,children:e}):p.jsx(VB,{transport:x,contextValue:k,runtimeRef:y,frontendTools:E,children:e})},FB=({children:e,transport:t,apiUrl:r,headers:o,contextValue:n,runtimeRef:i,frontendTools:a,localIdToUuidMap:s})=>{const c=DB({apiUrl:r,headers:o,localIdToUuidMap:s}),l=N.useCallback(()=>dd.useChatRuntime({transport:t}),[t]),u=z.unstable_useRemoteThreadListRuntime({adapter:c,runtimeHook:l});N.useEffect(()=>{i.current=u},[u,i]);const d=c.unstable_Provider??(({children:f})=>p.jsx(p.Fragment,{children:f}));return p.jsx(z.AssistantRuntimeProvider,{runtime:u,children:p.jsx(d,{children:p.jsxs($.ElementsContext.Provider,{value:n,children:[p.jsx("div",{className:`${Qm} h-full`,children:e}),p.jsx(Zv,{tools:a})]})})})},VB=({children:e,transport:t,contextValue:r,runtimeRef:o,frontendTools:n})=>{const i=dd.useChatRuntime({transport:t});return N.useEffect(()=>{o.current=i},[i,o]),p.jsx(z.AssistantRuntimeProvider,{runtime:i,children:p.jsxs($.ElementsContext.Provider,{value:r,children:[p.jsx("div",{className:`${Qm} h-full`,children:e}),p.jsx(Zv,{tools:n})]})})},ZB=new kP,BB=e=>p.jsx(EP,{client:ZB,children:p.jsx(yB,{children:p.jsx(LB,{...e})})});function uv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ep(...e){return t=>{let r=!1;const o=e.map(n=>{const i=uv(n,t);return!r&&typeof i=="function"&&(r=!0),i});if(r)return()=>{for(let n=0;n<o.length;n++){const i=o[n];typeof i=="function"?i():uv(e[n],null)}}}}function pt(...e){return _.useCallback(ep(...e),e)}var qB=Symbol.for("react.lazy"),Ts=_[" use ".trim().toString()];function GB(e){return typeof e=="object"&&e!==null&&"then"in e}function YT(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===qB&&"_payload"in e&&GB(e._payload)}function XT(e){const t=WB(e),r=_.forwardRef((o,n)=>{let{children:i,...a}=o;YT(i)&&typeof Ts=="function"&&(i=Ts(i._payload));const s=_.Children.toArray(i),c=s.find(YB);if(c){const l=c.props.children,u=s.map(d=>d===c?_.Children.count(l)>1?_.Children.only(null):_.isValidElement(l)?l.props.children:null:d);return p.jsx(t,{...a,ref:n,children:_.isValidElement(l)?_.cloneElement(l,void 0,u):null})}return p.jsx(t,{...a,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}var HB=XT("Slot");function WB(e){const t=_.forwardRef((r,o)=>{let{children:n,...i}=r;if(YT(n)&&typeof Ts=="function"&&(n=Ts(n._payload)),_.isValidElement(n)){const a=QB(n),s=XB(i,n.props);return n.type!==_.Fragment&&(s.ref=o?ep(o,a):a),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QT=Symbol("radix.slottable");function JB(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=QT,t}var KB=JB("Slottable");function YB(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QT}function XB(e,t){const r={...t};for(const o in t){const n=e[o],i=t[o];/^on[A-Z]/.test(o)?n&&i?r[o]=(...s)=>{const c=i(...s);return n(...s),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function QB(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const dv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,fv=$.clsx,e$=(e,t)=>r=>{var o;if(t?.variants==null)return fv(e,r?.class,r?.className);const{variants:n,defaultVariants:i}=t,a=Object.keys(n).map(l=>{const u=r?.[l],d=i?.[l];if(u===null)return null;const f=dv(u)||dv(d);return n[l][f]}),s=r&&Object.entries(r).reduce((l,u)=>{let[d,f]=u;return f===void 0||(l[d]=f),l},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:d,className:f,...m}=u;return Object.entries(m).every(h=>{let[g,y]=h;return Array.isArray(y)?y.includes({...i,...s}[g]):{...i,...s}[g]===y})?[...l,d,f]:l},[]);return fv(e,a,c,r?.class,r?.className)},eq=e$("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none 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",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}}),yt=_.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},i)=>{const a=o?HB:"button";return p.jsx(a,{"data-slot":"button",className:$.cn(eq({variant:t,size:r,className:e})),ref:i,...n})});yt.displayName="Button";const tq=({error:e,onRetry:t})=>p.jsx("div",{className:$.cn("aui-root aui-error-boundary bg-background flex h-full w-full flex-col items-center justify-center p-6"),children:p.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[p.jsx("div",{className:"text-destructive",children:p.jsx($.CircleAlert,{className:"size-12 stroke-[1.5px]"})}),p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("h3",{className:"text-foreground text-xl font-semibold",children:"Something went wrong"}),p.jsx("p",{className:"text-muted-foreground text-base",children:"An error occurred while loading the chat."}),e&&p.jsx("p",{className:"text-muted-foreground/60 max-w-md truncate text-sm",children:e.message})]}),p.jsx(yt,{onClick:t,variant:"default",className:"mt-2",children:"Try again"})]})}),rq=({children:e})=>p.jsx(p.Fragment,{children:e});class tp extends N.Component{constructor(t){super(t),this.handleRetry=()=>{this.setState(r=>({hasError:!1,error:null,resetKey:r.resetKey+1})),this.props.onReset?.()},this.state={hasError:!1,error:null,resetKey:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,r){gs(t,{source:"error-boundary",componentStack:r.componentStack??void 0}),this.props.onError?.(t,r)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:p.jsx(tq,{error:this.state.error,onRetry:this.handleRetry}):p.jsx(rq,{children:this.props.children},this.state.resetKey)}}function De(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}function nq(e,t){const r=_.createContext(t),o=i=>{const{children:a,...s}=i,c=_.useMemo(()=>s,Object.values(s));return p.jsx(r.Provider,{value:c,children:a})};o.displayName=e+"Provider";function n(i){const a=_.useContext(r);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,n]}function ia(e,t=[]){let r=[];function o(i,a){const s=_.createContext(a),c=r.length;r=[...r,a];const l=d=>{const{scope:f,children:m,...h}=d,g=f?.[e]?.[c]||s,y=_.useMemo(()=>h,Object.values(h));return p.jsx(g.Provider,{value:y,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,h=_.useContext(m);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,u]}const n=()=>{const i=r.map(a=>_.createContext(a));return function(s){const c=s?.[e]||i;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,oq(n,...t)]}function oq(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const a=o.reduce((s,{useScope:c,scopeName:l})=>{const d=c(i)[`__scope${l}`];return{...s,...d}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}function rp(e){const t=iq(e),r=_.forwardRef((o,n)=>{const{children:i,...a}=o,s=_.Children.toArray(i),c=s.find(sq);if(c){const l=c.props.children,u=s.map(d=>d===c?_.Children.count(l)>1?_.Children.only(null):_.isValidElement(l)?l.props.children:null:d);return p.jsx(t,{...a,ref:n,children:_.isValidElement(l)?_.cloneElement(l,void 0,u):null})}return p.jsx(t,{...a,ref:n,children:i})});return r.displayName=`${e}.Slot`,r}function iq(e){const t=_.forwardRef((r,o)=>{const{children:n,...i}=r;if(_.isValidElement(n)){const a=lq(n),s=cq(i,n.props);return n.type!==_.Fragment&&(s.ref=o?ep(o,a):a),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var t$=Symbol("radix.slottable");function aq(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=t$,t}function sq(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===t$}function cq(e,t){const r={...t};for(const o in t){const n=e[o],i=t[o];/^on[A-Z]/.test(o)?n&&i?r[o]=(...s)=>{const c=i(...s);return n(...s),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...i}:o==="className"&&(r[o]=[n,i].filter(Boolean).join(" "))}return{...e,...r}}function lq(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var uq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Le=uq.reduce((e,t)=>{const r=rp(`Primitive.${t}`),o=_.forwardRef((n,i)=>{const{asChild:a,...s}=n,c=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...s,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function dq(e,t){e&&Vv.flushSync(()=>e.dispatchEvent(t))}function dn(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...r)=>t.current?.(...r),[])}function fq(e,t=globalThis?.document){const r=dn(e);_.useEffect(()=>{const o=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[r,t])}var mq="DismissableLayer",od="dismissableLayer.update",pq="dismissableLayer.pointerDownOutside",gq="dismissableLayer.focusOutside",mv,r$=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kc=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...c}=e,l=_.useContext(r$),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,m]=_.useState({}),h=pt(t,I=>d(I)),g=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),w=u?g.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,v=w>=b,k=yq(I=>{const A=I.target,M=[...l.branches].some(U=>U.contains(A));!v||M||(n?.(I),a?.(I),I.defaultPrevented||s?.())},f),E=bq(I=>{const A=I.target;[...l.branches].some(U=>U.contains(A))||(i?.(I),a?.(I),I.defaultPrevented||s?.())},f);return fq(I=>{w===l.layers.size-1&&(o?.(I),!I.defaultPrevented&&s&&(I.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(mv=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),pv(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=mv)}},[u,f,r,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),pv())},[u,l]),_.useEffect(()=>{const I=()=>m({});return document.addEventListener(od,I),()=>document.removeEventListener(od,I)},[]),p.jsx(Le.div,{...c,ref:h,style:{pointerEvents:x?v?"auto":"none":void 0,...e.style},onFocusCapture:De(e.onFocusCapture,E.onFocusCapture),onBlurCapture:De(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:De(e.onPointerDownCapture,k.onPointerDownCapture)})});Kc.displayName=mq;var hq="DismissableLayerBranch",vq=_.forwardRef((e,t)=>{const r=_.useContext(r$),o=_.useRef(null),n=pt(t,o);return _.useEffect(()=>{const i=o.current;if(i)return r.branches.add(i),()=>{r.branches.delete(i)}},[r.branches]),p.jsx(Le.div,{...e,ref:n})});vq.displayName=hq;function yq(e,t=globalThis?.document){const r=dn(e),o=_.useRef(!1),n=_.useRef(()=>{});return _.useEffect(()=>{const i=s=>{if(s.target&&!o.current){let c=function(){n$(pq,r,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);o.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function bq(e,t=globalThis?.document){const r=dn(e),o=_.useRef(!1);return _.useEffect(()=>{const n=i=>{i.target&&!o.current&&n$(gq,r,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function pv(){const e=new CustomEvent(od);document.dispatchEvent(e)}function n$(e,t,r,{discrete:o}){const n=r.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?dq(n,i):n.dispatchEvent(i)}var Ct=globalThis?.document?_.useLayoutEffect:()=>{},_q=_[" useId ".trim().toString()]||(()=>{}),wq=0;function Zn(e){const[t,r]=_.useState(_q());return Ct(()=>{r(o=>o??String(wq++))},[e]),t?`radix-${t}`:""}const xq=["top","right","bottom","left"],Ur=Math.min,ht=Math.max,$s=Math.round,$a=Math.floor,tr=e=>({x:e,y:e}),Sq={left:"right",right:"left",bottom:"top",top:"bottom"},kq={start:"end",end:"start"};function id(e,t,r){return ht(e,Ur(t,r))}function br(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function ko(e){return e.split("-")[1]}function np(e){return e==="x"?"y":"x"}function op(e){return e==="y"?"height":"width"}const Eq=new Set(["top","bottom"]);function er(e){return Eq.has(_r(e))?"y":"x"}function ip(e){return np(er(e))}function Iq(e,t,r){r===void 0&&(r=!1);const o=ko(e),n=ip(e),i=op(n);let a=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Os(a)),[a,Os(a)]}function Tq(e){const t=Os(e);return[ad(e),t,ad(t)]}function ad(e){return e.replace(/start|end/g,t=>kq[t])}const gv=["left","right"],hv=["right","left"],$q=["top","bottom"],Oq=["bottom","top"];function Aq(e,t,r){switch(e){case"top":case"bottom":return r?t?hv:gv:t?gv:hv;case"left":case"right":return t?$q:Oq;default:return[]}}function Cq(e,t,r,o){const n=ko(e);let i=Aq(_r(e),r==="start",o);return n&&(i=i.map(a=>a+"-"+n),t&&(i=i.concat(i.map(ad)))),i}function Os(e){return e.replace(/left|right|bottom|top/g,t=>Sq[t])}function Nq(e){return{top:0,right:0,bottom:0,left:0,...e}}function o$(e){return typeof e!="number"?Nq(e):{top:e,right:e,bottom:e,left:e}}function As(e){const{x:t,y:r,width:o,height:n}=e;return{width:o,height:n,top:r,left:t,right:t+o,bottom:r+n,x:t,y:r}}function vv(e,t,r){let{reference:o,floating:n}=e;const i=er(t),a=ip(t),s=op(a),c=_r(t),l=i==="y",u=o.x+o.width/2-n.width/2,d=o.y+o.height/2-n.height/2,f=o[s]/2-n[s]/2;let m;switch(c){case"top":m={x:u,y:o.y-n.height};break;case"bottom":m={x:u,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-n.width,y:d};break;default:m={x:o.x,y:o.y}}switch(ko(t)){case"start":m[a]-=f*(r&&l?-1:1);break;case"end":m[a]+=f*(r&&l?-1:1);break}return m}const Rq=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:i=[],platform:a}=r,s=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=vv(l,o,c),f=o,m={},h=0;for(let g=0;g<s.length;g++){const{name:y,fn:b}=s[g],{x:w,y:x,data:v,reset:k}=await b({x:u,y:d,initialPlacement:o,placement:f,strategy:n,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});u=w??u,d=x??d,m={...m,[y]:{...m[y],...v}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(l=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:d}=vv(l,f,c)),g=-1)}return{x:u,y:d,placement:f,strategy:n,middlewareData:m}};async function bi(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=br(t,e),h=o$(m),y=s[f?d==="floating"?"reference":"floating":d],b=As(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(y)))==null||r?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),w=d==="floating"?{x:o,y:n,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),v=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},k=As(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:c}):w);return{top:(b.top-k.top+h.top)/v.y,bottom:(k.bottom-b.bottom+h.bottom)/v.y,left:(b.left-k.left+h.left)/v.x,right:(k.right-b.right+h.right)/v.x}}const Pq=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:i,platform:a,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=br(e,t)||{};if(l==null)return{};const d=o$(u),f={x:r,y:o},m=ip(n),h=op(m),g=await a.getDimensions(l),y=m==="y",b=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",v=i.reference[h]+i.reference[m]-f[m]-i.floating[h],k=f[m]-i.reference[m],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let I=E?E[x]:0;(!I||!await(a.isElement==null?void 0:a.isElement(E)))&&(I=s.floating[x]||i.floating[h]);const A=v/2-k/2,M=I/2-g[h]/2-1,U=Ur(d[b],M),K=Ur(d[w],M),he=U,q=I-g[h]-K,F=I/2-g[h]/2+A,ce=id(he,F,q),le=!c.arrow&&ko(n)!=null&&F!==ce&&i.reference[h]/2-(F<he?U:K)-g[h]/2<0,pe=le?F<he?F-he:F-q:0;return{[m]:f[m]+pe,data:{[m]:ce,centerOffset:F-ce-pe,...le&&{alignmentOffset:pe}},reset:le}}}),jq=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:i,rects:a,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=br(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const b=_r(n),w=er(s),x=_r(s)===s,v=await(c.isRTL==null?void 0:c.isRTL(l.floating)),k=f||(x||!g?[Os(s)]:Tq(s)),E=h!=="none";!f&&E&&k.push(...Cq(s,g,h,v));const I=[s,...k],A=await bi(t,y),M=[];let U=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&M.push(A[b]),d){const F=Iq(n,a,v);M.push(A[F[0]],A[F[1]])}if(U=[...U,{placement:n,overflows:M}],!M.every(F=>F<=0)){var K,he;const F=(((K=i.flip)==null?void 0:K.index)||0)+1,ce=I[F];if(ce&&(!(d==="alignment"?w!==er(ce):!1)||U.every(G=>er(G.placement)===w?G.overflows[0]>0:!0)))return{data:{index:F,overflows:U},reset:{placement:ce}};let le=(he=U.filter(pe=>pe.overflows[0]<=0).sort((pe,G)=>pe.overflows[1]-G.overflows[1])[0])==null?void 0:he.placement;if(!le)switch(m){case"bestFit":{var q;const pe=(q=U.filter(G=>{if(E){const se=er(G.placement);return se===w||se==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(se=>se>0).reduce((se,V)=>se+V,0)]).sort((G,se)=>G[1]-se[1])[0])==null?void 0:q[0];pe&&(le=pe);break}case"initialPlacement":le=s;break}if(n!==le)return{reset:{placement:le}}}return{}}}};function yv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bv(e){return xq.some(t=>e[t]>=0)}const Dq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:o="referenceHidden",...n}=br(e,t);switch(o){case"referenceHidden":{const i=await bi(t,{...n,elementContext:"reference"}),a=yv(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:bv(a)}}}case"escaped":{const i=await bi(t,{...n,altBoundary:!0}),a=yv(i,r.floating);return{data:{escapedOffsets:a,escaped:bv(a)}}}default:return{}}}}},i$=new Set(["left","top"]);async function zq(e,t){const{placement:r,platform:o,elements:n}=e,i=await(o.isRTL==null?void 0:o.isRTL(n.floating)),a=_r(r),s=ko(r),c=er(r)==="y",l=i$.has(a)?-1:1,u=i&&c?-1:1,d=br(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(m=s==="end"?h*-1:h),c?{x:m*u,y:f*l}:{x:f*l,y:m*u}}const Mq=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:i,placement:a,middlewareData:s}=t,c=await zq(t,e);return a===((r=s.offset)==null?void 0:r.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:i+c.y,data:{...c,placement:a}}}}},Uq=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:n}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...c}=br(e,t),l={x:r,y:o},u=await bi(t,c),d=er(_r(n)),f=np(d);let m=l[f],h=l[d];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+u[y],x=m-u[b];m=id(w,m,x)}if(a){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=h+u[y],x=h-u[b];h=id(w,h,x)}const g=s.fn({...t,[f]:m,[d]:h});return{...g,data:{x:g.x-r,y:g.y-o,enabled:{[f]:i,[d]:a}}}}}},Lq=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:n,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=br(e,t),u={x:r,y:o},d=er(n),f=np(d);let m=u[f],h=u[d];const g=br(s,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const x=f==="y"?"height":"width",v=i.reference[f]-i.floating[x]+y.mainAxis,k=i.reference[f]+i.reference[x]-y.mainAxis;m<v?m=v:m>k&&(m=k)}if(l){var b,w;const x=f==="y"?"width":"height",v=i$.has(_r(n)),k=i.reference[d]-i.floating[x]+(v&&((b=a.offset)==null?void 0:b[d])||0)+(v?0:y.crossAxis),E=i.reference[d]+i.reference[x]+(v?0:((w=a.offset)==null?void 0:w[d])||0)-(v?y.crossAxis:0);h<k?h=k:h>E&&(h=E)}return{[f]:m,[d]:h}}}},Fq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:n,rects:i,platform:a,elements:s}=t,{apply:c=()=>{},...l}=br(e,t),u=await bi(t,l),d=_r(n),f=ko(n),m=er(n)==="y",{width:h,height:g}=i.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const w=g-u.top-u.bottom,x=h-u.left-u.right,v=Ur(g-u[y],w),k=Ur(h-u[b],x),E=!t.middlewareData.shift;let I=v,A=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(A=x),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(I=w),E&&!f){const U=ht(u.left,0),K=ht(u.right,0),he=ht(u.top,0),q=ht(u.bottom,0);m?A=h-2*(U!==0||K!==0?U+K:ht(u.left,u.right)):I=g-2*(he!==0||q!==0?he+q:ht(u.top,u.bottom))}await c({...t,availableWidth:A,availableHeight:I});const M=await a.getDimensions(s.floating);return h!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function Yc(){return typeof window<"u"}function Eo(e){return a$(e)?(e.nodeName||"").toLowerCase():"#document"}function bt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cr(e){var t;return(t=(a$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function a$(e){return Yc()?e instanceof Node||e instanceof bt(e).Node:!1}function qt(e){return Yc()?e instanceof Element||e instanceof bt(e).Element:!1}function ar(e){return Yc()?e instanceof HTMLElement||e instanceof bt(e).HTMLElement:!1}function _v(e){return!Yc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bt(e).ShadowRoot}const Vq=new Set(["inline","contents"]);function aa(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!Vq.has(n)}const Zq=new Set(["table","td","th"]);function Bq(e){return Zq.has(Eo(e))}const qq=[":popover-open",":modal"];function Xc(e){return qq.some(t=>{try{return e.matches(t)}catch{return!1}})}const Gq=["transform","translate","scale","rotate","perspective"],Hq=["transform","translate","scale","rotate","perspective","filter"],Wq=["paint","layout","strict","content"];function ap(e){const t=sp(),r=qt(e)?Gt(e):e;return Gq.some(o=>r[o]?r[o]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||Hq.some(o=>(r.willChange||"").includes(o))||Wq.some(o=>(r.contain||"").includes(o))}function Jq(e){let t=Lr(e);for(;ar(t)&&!so(t);){if(ap(t))return t;if(Xc(t))return null;t=Lr(t)}return null}function sp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Kq=new Set(["html","body","#document"]);function so(e){return Kq.has(Eo(e))}function Gt(e){return bt(e).getComputedStyle(e)}function Qc(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Lr(e){if(Eo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_v(e)&&e.host||cr(e);return _v(t)?t.host:t}function s$(e){const t=Lr(e);return so(t)?e.ownerDocument?e.ownerDocument.body:e.body:ar(t)&&aa(t)?t:s$(t)}function _i(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=s$(e),i=n===((o=e.ownerDocument)==null?void 0:o.body),a=bt(n);if(i){const s=sd(a);return t.concat(a,a.visualViewport||[],aa(n)?n:[],s&&r?_i(s):[])}return t.concat(n,_i(n,[],r))}function sd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function c$(e){const t=Gt(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=ar(e),i=n?e.offsetWidth:r,a=n?e.offsetHeight:o,s=$s(r)!==i||$s(o)!==a;return s&&(r=i,o=a),{width:r,height:o,$:s}}function cp(e){return qt(e)?e:e.contextElement}function Bn(e){const t=cp(e);if(!ar(t))return tr(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:i}=c$(t);let a=(i?$s(r.width):r.width)/o,s=(i?$s(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Yq=tr(0);function l$(e){const t=bt(e);return!sp()||!t.visualViewport?Yq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xq(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==bt(e)?!1:t}function fn(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=cp(e);let a=tr(1);t&&(o?qt(o)&&(a=Bn(o)):a=Bn(e));const s=Xq(i,r,o)?l$(i):tr(0);let c=(n.left+s.x)/a.x,l=(n.top+s.y)/a.y,u=n.width/a.x,d=n.height/a.y;if(i){const f=bt(i),m=o&&qt(o)?bt(o):o;let h=f,g=sd(h);for(;g&&o&&m!==h;){const y=Bn(g),b=g.getBoundingClientRect(),w=Gt(g),x=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,v=b.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,d*=y.y,c+=x,l+=v,h=bt(g),g=sd(h)}}return As({width:u,height:d,x:c,y:l})}function lp(e,t){const r=Qc(e).scrollLeft;return t?t.left+r:fn(cr(e)).left+r}function u$(e,t,r){r===void 0&&(r=!1);const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-(r?0:lp(e,o)),i=o.top+t.scrollTop;return{x:n,y:i}}function Qq(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const i=n==="fixed",a=cr(o),s=t?Xc(t.floating):!1;if(o===a||s&&i)return r;let c={scrollLeft:0,scrollTop:0},l=tr(1);const u=tr(0),d=ar(o);if((d||!d&&!i)&&((Eo(o)!=="body"||aa(a))&&(c=Qc(o)),ar(o))){const m=fn(o);l=Bn(o),u.x=m.x+o.clientLeft,u.y=m.y+o.clientTop}const f=a&&!d&&!i?u$(a,c,!0):tr(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:r.y*l.y-c.scrollTop*l.y+u.y+f.y}}function e9(e){return Array.from(e.getClientRects())}function t9(e){const t=cr(e),r=Qc(e),o=e.ownerDocument.body,n=ht(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=ht(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+lp(e);const s=-r.scrollTop;return Gt(o).direction==="rtl"&&(a+=ht(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:a,y:s}}function r9(e,t){const r=bt(e),o=cr(e),n=r.visualViewport;let i=o.clientWidth,a=o.clientHeight,s=0,c=0;if(n){i=n.width,a=n.height;const l=sp();(!l||l&&t==="fixed")&&(s=n.offsetLeft,c=n.offsetTop)}return{width:i,height:a,x:s,y:c}}const n9=new Set(["absolute","fixed"]);function o9(e,t){const r=fn(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,i=ar(e)?Bn(e):tr(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,c=n*i.x,l=o*i.y;return{width:a,height:s,x:c,y:l}}function wv(e,t,r){let o;if(t==="viewport")o=r9(e,r);else if(t==="document")o=t9(cr(e));else if(qt(t))o=o9(t,r);else{const n=l$(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return As(o)}function d$(e,t){const r=Lr(e);return r===t||!qt(r)||so(r)?!1:Gt(r).position==="fixed"||d$(r,t)}function i9(e,t){const r=t.get(e);if(r)return r;let o=_i(e,[],!1).filter(s=>qt(s)&&Eo(s)!=="body"),n=null;const i=Gt(e).position==="fixed";let a=i?Lr(e):e;for(;qt(a)&&!so(a);){const s=Gt(a),c=ap(a);!c&&s.position==="fixed"&&(n=null),(i?!c&&!n:!c&&s.position==="static"&&!!n&&n9.has(n.position)||aa(a)&&!c&&d$(e,a))?o=o.filter(u=>u!==a):n=s,a=Lr(a)}return t.set(e,o),o}function a9(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const a=[...r==="clippingAncestors"?Xc(t)?[]:i9(t,this._c):[].concat(r),o],s=a[0],c=a.reduce((l,u)=>{const d=wv(t,u,n);return l.top=ht(d.top,l.top),l.right=Ur(d.right,l.right),l.bottom=Ur(d.bottom,l.bottom),l.left=ht(d.left,l.left),l},wv(t,s,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function s9(e){const{width:t,height:r}=c$(e);return{width:t,height:r}}function c9(e,t,r){const o=ar(t),n=cr(t),i=r==="fixed",a=fn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=tr(0);function l(){c.x=lp(n)}if(o||!o&&!i)if((Eo(t)!=="body"||aa(n))&&(s=Qc(t)),o){const m=fn(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else n&&l();i&&!o&&n&&l();const u=n&&!o&&!i?u$(n,s):tr(0),d=a.left+s.scrollLeft-c.x-u.x,f=a.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function ru(e){return Gt(e).position==="static"}function xv(e,t){if(!ar(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return cr(e)===r&&(r=r.ownerDocument.body),r}function f$(e,t){const r=bt(e);if(Xc(e))return r;if(!ar(e)){let n=Lr(e);for(;n&&!so(n);){if(qt(n)&&!ru(n))return n;n=Lr(n)}return r}let o=xv(e,t);for(;o&&Bq(o)&&ru(o);)o=xv(o,t);return o&&so(o)&&ru(o)&&!ap(o)?r:o||Jq(e)||r}const l9=async function(e){const t=this.getOffsetParent||f$,r=this.getDimensions,o=await r(e.floating);return{reference:c9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function u9(e){return Gt(e).direction==="rtl"}const d9={convertOffsetParentRelativeRectToViewportRelativeRect:Qq,getDocumentElement:cr,getClippingRect:a9,getOffsetParent:f$,getElementRects:l9,getClientRects:e9,getDimensions:s9,getScale:Bn,isElement:qt,isRTL:u9};function m$(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function f9(e,t){let r=null,o;const n=cr(e);function i(){var s;clearTimeout(o),(s=r)==null||s.disconnect(),r=null}function a(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),i();const l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=l;if(s||t(),!f||!m)return;const h=$a(d),g=$a(n.clientWidth-(u+f)),y=$a(n.clientHeight-(d+m)),b=$a(u),x={rootMargin:-h+"px "+-g+"px "+-y+"px "+-b+"px",threshold:ht(0,Ur(1,c))||1};let v=!0;function k(E){const I=E[0].intersectionRatio;if(I!==c){if(!v)return a();I?a(!1,I):o=setTimeout(()=>{a(!1,1e-7)},1e3)}I===1&&!m$(l,e.getBoundingClientRect())&&a(),v=!1}try{r=new IntersectionObserver(k,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,x)}r.observe(e)}return a(!0),i}function m9(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=cp(e),u=n||i?[...l?_i(l):[],..._i(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const d=l&&s?f9(l,r):null;let f=-1,m=null;a&&(m=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h,g=c?fn(e):null;c&&y();function y(){const b=fn(e);g&&!m$(g,b)&&r(),g=b,h=requestAnimationFrame(y)}return r(),()=>{var b;u.forEach(w=>{n&&w.removeEventListener("scroll",r),i&&w.removeEventListener("resize",r)}),d?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(h)}}const p9=Mq,g9=Uq,h9=jq,v9=Fq,y9=Dq,Sv=Pq,b9=Lq,_9=(e,t,r)=>{const o=new Map,n={platform:d9,...r},i={...n.platform,_c:o};return Rq(e,t,{...n,platform:i})};var w9=typeof document<"u",x9=function(){},Ba=w9?N.useLayoutEffect:x9;function Cs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,o,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(!Cs(e[o],t[o]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(t,n[o]))return!1;for(o=r;o--!==0;){const i=n[o];if(!(i==="_owner"&&e.$$typeof)&&!Cs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function p$(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kv(e,t){const r=p$(e);return Math.round(t*r)/r}function nu(e){const t=_.useRef(e);return Ba(()=>{t.current=e}),t}function S9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:n,elements:{reference:i,floating:a}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=_.useState(o);Cs(f,o)||m(o);const[h,g]=_.useState(null),[y,b]=_.useState(null),w=_.useCallback(G=>{G!==E.current&&(E.current=G,g(G))},[]),x=_.useCallback(G=>{G!==I.current&&(I.current=G,b(G))},[]),v=i||h,k=a||y,E=_.useRef(null),I=_.useRef(null),A=_.useRef(u),M=c!=null,U=nu(c),K=nu(n),he=nu(l),q=_.useCallback(()=>{if(!E.current||!I.current)return;const G={placement:t,strategy:r,middleware:f};K.current&&(G.platform=K.current),_9(E.current,I.current,G).then(se=>{const V={...se,isPositioned:he.current!==!1};F.current&&!Cs(A.current,V)&&(A.current=V,Vv.flushSync(()=>{d(V)}))})},[f,t,r,K,he]);Ba(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[l]);const F=_.useRef(!1);Ba(()=>(F.current=!0,()=>{F.current=!1}),[]),Ba(()=>{if(v&&(E.current=v),k&&(I.current=k),v&&k){if(U.current)return U.current(v,k,q);q()}},[v,k,q,U,M]);const ce=_.useMemo(()=>({reference:E,floating:I,setReference:w,setFloating:x}),[w,x]),le=_.useMemo(()=>({reference:v,floating:k}),[v,k]),pe=_.useMemo(()=>{const G={position:r,left:0,top:0};if(!le.floating)return G;const se=kv(le.floating,u.x),V=kv(le.floating,u.y);return s?{...G,transform:"translate("+se+"px, "+V+"px)",...p$(le.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:se,top:V}},[r,s,le.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:q,refs:ce,elements:le,floatingStyles:pe}),[u,q,ce,le,pe])}const k9=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:n}=typeof e=="function"?e(r):e;return o&&t(o)?o.current!=null?Sv({element:o.current,padding:n}).fn(r):{}:o?Sv({element:o,padding:n}).fn(r):{}}}},E9=(e,t)=>({...p9(e),options:[e,t]}),I9=(e,t)=>({...g9(e),options:[e,t]}),T9=(e,t)=>({...b9(e),options:[e,t]}),$9=(e,t)=>({...h9(e),options:[e,t]}),O9=(e,t)=>({...v9(e),options:[e,t]}),A9=(e,t)=>({...y9(e),options:[e,t]}),C9=(e,t)=>({...k9(e),options:[e,t]});var N9="Arrow",g$=_.forwardRef((e,t)=>{const{children:r,width:o=10,height:n=5,...i}=e;return p.jsx(Le.svg,{...i,ref:t,width:o,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});g$.displayName=N9;var R9=g$;function P9(e){const[t,r]=_.useState(void 0);return Ct(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const i=n[0];let a,s;if("borderBoxSize"in i){const c=i.borderBoxSize,l=Array.isArray(c)?c[0]:c;a=l.inlineSize,s=l.blockSize}else a=e.offsetWidth,s=e.offsetHeight;r({width:a,height:s})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}var up="Popper",[h$,el]=ia(up),[j9,v$]=h$(up),y$=e=>{const{__scopePopper:t,children:r}=e,[o,n]=_.useState(null);return p.jsx(j9,{scope:t,anchor:o,onAnchorChange:n,children:r})};y$.displayName=up;var b$="PopperAnchor",_$=_.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,i=v$(b$,r),a=_.useRef(null),s=pt(t,a),c=_.useRef(null);return _.useEffect(()=>{const l=c.current;c.current=o?.current||a.current,l!==c.current&&i.onAnchorChange(c.current)}),o?null:p.jsx(Le.div,{...n,ref:s})});_$.displayName=b$;var dp="PopperContent",[D9,z9]=h$(dp),w$=_.forwardRef((e,t)=>{const{__scopePopper:r,side:o="bottom",sideOffset:n=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:h,...g}=e,y=v$(dp,r),[b,w]=_.useState(null),x=pt(t,Te=>w(Te)),[v,k]=_.useState(null),E=P9(v),I=E?.width??0,A=E?.height??0,M=o+(i!=="center"?"-"+i:""),U=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},K=Array.isArray(l)?l:[l],he=K.length>0,q={padding:U,boundary:K.filter(U9),altBoundary:he},{refs:F,floatingStyles:ce,placement:le,isPositioned:pe,middlewareData:G}=S9({strategy:"fixed",placement:M,whileElementsMounted:(...Te)=>m9(...Te,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[E9({mainAxis:n+A,alignmentAxis:a}),c&&I9({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?T9():void 0,...q}),c&&$9({...q}),O9({...q,apply:({elements:Te,rects:Fe,availableWidth:ll,availableHeight:Io})=>{const{width:Rt,height:la}=Fe.reference,qe=Te.floating.style;qe.setProperty("--radix-popper-available-width",`${ll}px`),qe.setProperty("--radix-popper-available-height",`${Io}px`),qe.setProperty("--radix-popper-anchor-width",`${Rt}px`),qe.setProperty("--radix-popper-anchor-height",`${la}px`)}}),v&&C9({element:v,padding:s}),L9({arrowWidth:I,arrowHeight:A}),f&&A9({strategy:"referenceHidden",...q})]}),[se,V]=k$(le),ye=dn(h);Ct(()=>{pe&&ye?.()},[pe,ye]);const ue=G.arrow?.x,ve=G.arrow?.y,P=G.arrow?.centerOffset!==0,[H,me]=_.useState();return Ct(()=>{b&&me(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:F.setFloating,"data-radix-popper-content-wrapper":"",style:{...ce,transform:pe?ce.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:H,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(D9,{scope:r,placedSide:se,onArrowChange:k,arrowX:ue,arrowY:ve,shouldHideArrow:P,children:p.jsx(Le.div,{"data-side":se,"data-align":V,...g,ref:x,style:{...g.style,animation:pe?void 0:"none"}})})})});w$.displayName=dp;var x$="PopperArrow",M9={top:"bottom",right:"left",bottom:"top",left:"right"},S$=_.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,i=z9(x$,o),a=M9[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(R9,{...n,ref:r,style:{...n.style,display:"block"}})})});S$.displayName=x$;function U9(e){return e!==null}var L9=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:o,middlewareData:n}=t,a=n.arrow?.centerOffset!==0,s=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[l,u]=k$(r),d={start:"0%",center:"50%",end:"100%"}[u],f=(n.arrow?.x??0)+s/2,m=(n.arrow?.y??0)+c/2;let h="",g="";return l==="bottom"?(h=a?d:`${f}px`,g=`${-c}px`):l==="top"?(h=a?d:`${f}px`,g=`${o.floating.height+c}px`):l==="right"?(h=`${-c}px`,g=a?d:`${m}px`):l==="left"&&(h=`${o.floating.width+c}px`,g=a?d:`${m}px`),{data:{x:h,y:g}}}});function k$(e){const[t,r="center"]=e.split("-");return[t,r]}var E$=y$,fp=_$,I$=w$,T$=S$,F9="Portal",mp=_.forwardRef((e,t)=>{const{container:r,...o}=e,[n,i]=_.useState(!1);Ct(()=>i(!0),[]);const a=r||n&&globalThis?.document?.body;return a?fd.createPortal(p.jsx(Le.div,{...o,ref:t}),a):null});mp.displayName=F9;function V9(e,t){return _.useReducer((r,o)=>t[r][o]??r,e)}var Br=e=>{const{present:t,children:r}=e,o=Z9(t),n=typeof r=="function"?r({present:o.isPresent}):_.Children.only(r),i=pt(o.ref,B9(n));return typeof r=="function"||o.isPresent?_.cloneElement(n,{ref:i}):null};Br.displayName="Presence";function Z9(e){const[t,r]=_.useState(),o=_.useRef(null),n=_.useRef(e),i=_.useRef("none"),a=e?"mounted":"unmounted",[s,c]=V9(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const l=Oa(o.current);i.current=s==="mounted"?l:"none"},[s]),Ct(()=>{const l=o.current,u=n.current;if(u!==e){const f=i.current,m=Oa(l);e?c("MOUNT"):m==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Ct(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,d=m=>{const g=Oa(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(c("ANIMATION_END"),!n.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=m=>{m.target===t&&(i.current=Oa(o.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:_.useCallback(l=>{o.current=l?getComputedStyle(l):null,r(l)},[])}}function Oa(e){return e?.animationName||"none"}function B9(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var q9=_[" useInsertionEffect ".trim().toString()]||Ct;function tl({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,i,a]=G9({defaultProp:t,onChange:r}),s=e!==void 0,c=s?e:n;{const u=_.useRef(e!==void 0);_.useEffect(()=>{const d=u.current;d!==s&&console.warn(`${o} is changing from ${d?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=s},[s,o])}const l=_.useCallback(u=>{if(s){const d=H9(u)?u(e):u;d!==e&&a.current?.(d)}else i(u)},[s,e,i,a]);return[c,l]}function G9({defaultProp:e,onChange:t}){const[r,o]=_.useState(e),n=_.useRef(r),i=_.useRef(t);return q9(()=>{i.current=t},[t]),_.useEffect(()=>{n.current!==r&&(i.current?.(r),n.current=r)},[r,n]),[r,o,i]}function H9(e){return typeof e=="function"}var W9=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),J9="VisuallyHidden",$$=_.forwardRef((e,t)=>p.jsx(Le.span,{...e,ref:t,style:{...W9,...e.style}}));$$.displayName=J9;var K9=$$,[rl]=ia("Tooltip",[el]),nl=el(),O$="TooltipProvider",Y9=700,cd="tooltip.open",[X9,pp]=rl(O$),A$=e=>{const{__scopeTooltip:t,delayDuration:r=Y9,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:i}=e,a=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const l=c.current;return()=>window.clearTimeout(l)},[]),p.jsx(X9,{scope:t,isOpenDelayedRef:a,delayDuration:r,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,o)},[o]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(l=>{s.current=l},[]),disableHoverableContent:n,children:i})};A$.displayName=O$;var wi="Tooltip",[Q9,sa]=rl(wi),C$=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=e,c=pp(wi,e.__scopeTooltip),l=nl(t),[u,d]=_.useState(null),f=Zn(),m=_.useRef(0),h=a??c.disableHoverableContent,g=s??c.delayDuration,y=_.useRef(!1),[b,w]=tl({prop:o,defaultProp:n??!1,onChange:I=>{I?(c.onOpen(),document.dispatchEvent(new CustomEvent(cd))):c.onClose(),i?.(I)},caller:wi}),x=_.useMemo(()=>b?y.current?"delayed-open":"instant-open":"closed",[b]),v=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,w(!0)},[w]),k=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=_.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{y.current=!0,w(!0),m.current=0},g)},[g,w]);return _.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),p.jsx(E$,{...l,children:p.jsx(Q9,{scope:t,contentId:f,open:b,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?E():v()},[c.isOpenDelayedRef,E,v]),onTriggerLeave:_.useCallback(()=>{h?k():(window.clearTimeout(m.current),m.current=0)},[k,h]),onOpen:v,onClose:k,disableHoverableContent:h,children:r})})};C$.displayName=wi;var ld="TooltipTrigger",N$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=sa(ld,r),i=pp(ld,r),a=nl(r),s=_.useRef(null),c=pt(t,s,n.onTriggerChange),l=_.useRef(!1),u=_.useRef(!1),d=_.useCallback(()=>l.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(fp,{asChild:!0,...a,children:p.jsx(Le.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...o,ref:c,onPointerMove:De(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:De(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:De(e.onPointerDown,()=>{n.open&&n.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:De(e.onFocus,()=>{l.current||n.onOpen()}),onBlur:De(e.onBlur,n.onClose),onClick:De(e.onClick,n.onClose)})})});N$.displayName=ld;var gp="TooltipPortal",[e8,t8]=rl(gp,{forceMount:void 0}),R$=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,i=sa(gp,t);return p.jsx(e8,{scope:t,forceMount:r,children:p.jsx(Br,{present:r||i.open,children:p.jsx(mp,{asChild:!0,container:n,children:o})})})};R$.displayName=gp;var co="TooltipContent",P$=_.forwardRef((e,t)=>{const r=t8(co,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...i}=e,a=sa(co,e.__scopeTooltip);return p.jsx(Br,{present:o||a.open,children:a.disableHoverableContent?p.jsx(j$,{side:n,...i,ref:t}):p.jsx(r8,{side:n,...i,ref:t})})}),r8=_.forwardRef((e,t)=>{const r=sa(co,e.__scopeTooltip),o=pp(co,e.__scopeTooltip),n=_.useRef(null),i=pt(t,n),[a,s]=_.useState(null),{trigger:c,onClose:l}=r,u=n.current,{onPointerInTransitChange:d}=o,f=_.useCallback(()=>{s(null),d(!1)},[d]),m=_.useCallback((h,g)=>{const y=h.currentTarget,b={x:h.clientX,y:h.clientY},w=a8(b,y.getBoundingClientRect()),x=s8(b,w),v=c8(g.getBoundingClientRect()),k=u8([...x,...v]);s(k),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){const h=y=>m(y,u),g=y=>m(y,c);return c.addEventListener("pointerleave",h),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",g)}}},[c,u,m,f]),_.useEffect(()=>{if(a){const h=g=>{const y=g.target,b={x:g.clientX,y:g.clientY},w=c?.contains(y)||u?.contains(y),x=!l8(b,a);w?f():x&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[c,u,a,l,f]),p.jsx(j$,{...e,ref:i})}),[n8,o8]=rl(wi,{isInside:!1}),i8=aq("TooltipContent"),j$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=e,c=sa(co,r),l=nl(r),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(cd,u),()=>document.removeEventListener(cd,u)),[u]),_.useEffect(()=>{if(c.trigger){const d=f=>{f.target?.contains(c.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,u]),p.jsx(Kc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:p.jsxs(I$,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(i8,{children:o}),p.jsx(n8,{scope:r,isInside:!0,children:p.jsx(K9,{id:c.contentId,role:"tooltip",children:n||o})})]})})});P$.displayName=co;var D$="TooltipArrow",z$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=nl(r);return o8(D$,r).isInside?null:p.jsx(T$,{...n,...o,ref:t})});z$.displayName=D$;function a8(e,t){const r=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(r,o,n,i)){case i:return"left";case n:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function s8(e,t,r=5){const o=[];switch(t){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function c8(e){const{top:t,right:r,bottom:o,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:o},{x:n,y:o}]}function l8(e,t){const{x:r,y:o}=e;let n=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const s=t[i],c=t[a],l=s.x,u=s.y,d=c.x,f=c.y;u>o!=f>o&&r<(d-l)*(o-u)/(f-u)+l&&(n=!n)}return n}function u8(e){const t=e.slice();return t.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),d8(t)}function d8(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const n=e[o];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(n.y-a.y)>=(i.y-a.y)*(n.x-a.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let o=e.length-1;o>=0;o--){const n=e[o];for(;r.length>=2;){const i=r[r.length-1],a=r[r.length-2];if((i.x-a.x)*(n.y-a.y)>=(i.y-a.y)*(n.x-a.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var f8=A$,m8=C$,p8=N$,g8=R$,h8=P$,v8=z$;const M$=N.createContext(null);function U$(){return N.useContext(M$)?.current??null}function L$({delayDuration:e=0,...t}){return p.jsx(f8,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function hp({...e}){return p.jsx(L$,{children:p.jsx(m8,{"data-slot":"tooltip",...e})})}function vp({...e}){return p.jsx(p8,{"data-slot":"tooltip-trigger",...e})}function yp({className:e,sideOffset:t=0,children:r,container:o,...n}){const i=U$();return p.jsx(g8,{container:o??i,children:p.jsxs(h8,{"data-slot":"tooltip-content",sideOffset:t,className:$.cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-20 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[r,p.jsx(v8,{className:"bg-foreground fill-foreground z-20 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]"})]})})}var ou="focusScope.autoFocusOnMount",iu="focusScope.autoFocusOnUnmount",Ev={bubbles:!1,cancelable:!0},y8="FocusScope",bp=_.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:i,...a}=e,[s,c]=_.useState(null),l=dn(n),u=dn(i),d=_.useRef(null),f=pt(t,g=>c(g)),m=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(o){let g=function(x){if(m.paused||!s)return;const v=x.target;s.contains(v)?d.current=v:kr(d.current,{select:!0})},y=function(x){if(m.paused||!s)return;const v=x.relatedTarget;v!==null&&(s.contains(v)||kr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const k of x)k.removedNodes.length>0&&kr(s)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const w=new MutationObserver(b);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),w.disconnect()}}},[o,s,m.paused]),_.useEffect(()=>{if(s){Tv.add(m);const g=document.activeElement;if(!s.contains(g)){const b=new CustomEvent(ou,Ev);s.addEventListener(ou,l),s.dispatchEvent(b),b.defaultPrevented||(b8(k8(F$(s)),{select:!0}),document.activeElement===g&&kr(s))}return()=>{s.removeEventListener(ou,l),setTimeout(()=>{const b=new CustomEvent(iu,Ev);s.addEventListener(iu,u),s.dispatchEvent(b),b.defaultPrevented||kr(g??document.body,{select:!0}),s.removeEventListener(iu,u),Tv.remove(m)},0)}}},[s,l,u,m]);const h=_.useCallback(g=>{if(!r&&!o||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(y&&b){const w=g.currentTarget,[x,v]=_8(w);x&&v?!g.shiftKey&&b===v?(g.preventDefault(),r&&kr(x,{select:!0})):g.shiftKey&&b===x&&(g.preventDefault(),r&&kr(v,{select:!0})):b===w&&g.preventDefault()}},[r,o,m.paused]);return p.jsx(Le.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});bp.displayName=y8;function b8(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(kr(o,{select:t}),document.activeElement!==r)return}function _8(e){const t=F$(e),r=Iv(t,e),o=Iv(t.reverse(),e);return[r,o]}function F$(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const n=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||n?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Iv(e,t){for(const r of e)if(!w8(r,{upTo:t}))return r}function w8(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function x8(e){return e instanceof HTMLInputElement&&"select"in e}function kr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&x8(e)&&t&&e.select()}}var Tv=S8();function S8(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=$v(e,t),e.unshift(t)},remove(t){e=$v(e,t),e[0]?.resume()}}}function $v(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function k8(e){return e.filter(t=>t.tagName!=="A")}var au=0;function V$(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ov()),document.body.insertAdjacentElement("beforeend",e[1]??Ov()),au++,()=>{au===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),au--}},[])}function Ov(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Xt=function(){return Xt=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Xt.apply(this,arguments)};function Z$(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function E8(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))}var qa="right-scroll-bar-position",Ga="width-before-scroll-bar",I8="with-scroll-bars-hidden",T8="--removed-body-scroll-bar-size";function su(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function $8(e,t){var r=N.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var n=r.value;n!==o&&(r.value=o,r.callback(o,n))}}}})[0];return r.callback=t,r.facade}var O8=typeof window<"u"?_.useLayoutEffect:_.useEffect,Av=new WeakMap;function A8(e,t){var r=$8(null,function(o){return e.forEach(function(n){return su(n,o)})});return O8(function(){var o=Av.get(r);if(o){var n=new Set(o),i=new Set(e),a=r.current;n.forEach(function(s){i.has(s)||su(s,null)}),i.forEach(function(s){n.has(s)||su(s,a)})}Av.set(r,e)},[e]),r}function C8(e){return e}function N8(e,t){t===void 0&&(t=C8);var r=[],o=!1,n={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(i){var a=t(i,o);return r.push(a),function(){r=r.filter(function(s){return s!==a})}},assignSyncMedium:function(i){for(o=!0;r.length;){var a=r;r=[],a.forEach(i)}r={push:function(s){return i(s)},filter:function(){return r}}},assignMedium:function(i){o=!0;var a=[];if(r.length){var s=r;r=[],s.forEach(i),a=r}var c=function(){var u=a;a=[],u.forEach(i)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(u){a.push(u),l()},filter:function(u){return a=a.filter(u),r}}}};return n}function R8(e){e===void 0&&(e={});var t=N8(null);return t.options=Xt({async:!0,ssr:!1},e),t}var B$=function(e){var t=e.sideCar,r=Z$(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return _.createElement(o,Xt({},r))};B$.isSideCarExport=!0;function P8(e,t){return e.useMedium(t),B$}var q$=R8(),cu=function(){},ol=_.forwardRef(function(e,t){var r=_.useRef(null),o=_.useState({onScrollCapture:cu,onWheelCapture:cu,onTouchMoveCapture:cu}),n=o[0],i=o[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,y=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,x=e.gapMode,v=Z$(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,E=A8([r,t]),I=Xt(Xt({},v),n);return _.createElement(_.Fragment,null,u&&_.createElement(k,{sideCar:q$,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:x}),a?_.cloneElement(_.Children.only(s),Xt(Xt({},I),{ref:E})):_.createElement(w,Xt({},I,{className:c,ref:E}),s))});ol.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ol.classNames={fullWidth:Ga,zeroRight:qa};var j8=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function D8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=j8();return t&&e.setAttribute("nonce",t),e}function z8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function M8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var U8=function(){var e=0,t=null;return{add:function(r){e==0&&(t=D8())&&(z8(t,r),M8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},L8=function(){var e=U8();return function(t,r){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},G$=function(){var e=L8(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},F8={left:0,top:0,right:0,gap:0},lu=function(e){return parseInt(e||"",10)||0},V8=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[lu(r),lu(o),lu(n)]},Z8=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return F8;var t=V8(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}},B8=G$(),qn="data-scroll-locked",q8=function(e,t,r,o){var n=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
|
|
97
|
+
.`.concat(I8,` {
|
|
98
|
+
overflow: hidden `).concat(o,`;
|
|
99
|
+
padding-right: `).concat(s,"px ").concat(o,`;
|
|
100
|
+
}
|
|
101
|
+
body[`).concat(qn,`] {
|
|
102
|
+
overflow: hidden `).concat(o,`;
|
|
103
|
+
overscroll-behavior: contain;
|
|
104
|
+
`).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
|
|
105
|
+
padding-left: `.concat(n,`px;
|
|
106
|
+
padding-top: `).concat(i,`px;
|
|
107
|
+
padding-right: `).concat(a,`px;
|
|
108
|
+
margin-left:0;
|
|
109
|
+
margin-top:0;
|
|
110
|
+
margin-right: `).concat(s,"px ").concat(o,`;
|
|
111
|
+
`),r==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),`
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.`).concat(qa,` {
|
|
115
|
+
right: `).concat(s,"px ").concat(o,`;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.`).concat(Ga,` {
|
|
119
|
+
margin-right: `).concat(s,"px ").concat(o,`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.`).concat(qa," .").concat(qa,` {
|
|
123
|
+
right: 0 `).concat(o,`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.`).concat(Ga," .").concat(Ga,` {
|
|
127
|
+
margin-right: 0 `).concat(o,`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
body[`).concat(qn,`] {
|
|
131
|
+
`).concat(T8,": ").concat(s,`px;
|
|
132
|
+
}
|
|
133
|
+
`)},Cv=function(){var e=parseInt(document.body.getAttribute(qn)||"0",10);return isFinite(e)?e:0},G8=function(){_.useEffect(function(){return document.body.setAttribute(qn,(Cv()+1).toString()),function(){var e=Cv()-1;e<=0?document.body.removeAttribute(qn):document.body.setAttribute(qn,e.toString())}},[])},H8=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;G8();var i=_.useMemo(function(){return Z8(n)},[n]);return _.createElement(B8,{styles:q8(i,!t,n,r?"":"!important")})},ud=!1;if(typeof window<"u")try{var Aa=Object.defineProperty({},"passive",{get:function(){return ud=!0,!0}});window.addEventListener("test",Aa,Aa),window.removeEventListener("test",Aa,Aa)}catch{ud=!1}var Nn=ud?{passive:!1}:!1,W8=function(e){return e.tagName==="TEXTAREA"},H$=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!W8(e)&&r[t]==="visible")},J8=function(e){return H$(e,"overflowY")},K8=function(e){return H$(e,"overflowX")},Nv=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=W$(e,o);if(n){var i=J$(e,o),a=i[1],s=i[2];if(a>s)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},Y8=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},X8=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},W$=function(e,t){return e==="v"?J8(t):K8(t)},J$=function(e,t){return e==="v"?Y8(t):X8(t)},Q8=function(e,t){return e==="h"&&t==="rtl"?-1:1},eG=function(e,t,r,o,n){var i=Q8(e,window.getComputedStyle(t).direction),a=i*o,s=r.target,c=t.contains(s),l=!1,u=a>0,d=0,f=0;do{if(!s)break;var m=J$(e,s),h=m[0],g=m[1],y=m[2],b=g-y-i*h;(h||b)&&W$(e,s)&&(d+=b,f+=h);var w=s.parentNode;s=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(l=!0),l},Ca=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rv=function(e){return[e.deltaX,e.deltaY]},Pv=function(e){return e&&"current"in e?e.current:e},tG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},rG=function(e){return`
|
|
134
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
135
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
136
|
+
`)},nG=0,Rn=[];function oG(e){var t=_.useRef([]),r=_.useRef([0,0]),o=_.useRef(),n=_.useState(nG++)[0],i=_.useState(G$)[0],a=_.useRef(e);_.useEffect(function(){a.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var g=E8([e.lockRef.current],(e.shards||[]).map(Pv),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var b=Ca(g),w=r.current,x="deltaX"in g?g.deltaX:w[0]-b[0],v="deltaY"in g?g.deltaY:w[1]-b[1],k,E=g.target,I=Math.abs(x)>Math.abs(v)?"h":"v";if("touches"in g&&I==="h"&&E.type==="range")return!1;var A=Nv(I,E);if(!A)return!0;if(A?k=I:(k=I==="v"?"h":"v",A=Nv(I,E)),!A)return!1;if(!o.current&&"changedTouches"in g&&(x||v)&&(o.current=k),!k)return!0;var M=o.current||k;return eG(M,y,g,M==="h"?x:v)},[]),c=_.useCallback(function(g){var y=g;if(!(!Rn.length||Rn[Rn.length-1]!==i)){var b="deltaY"in y?Rv(y):Ca(y),w=t.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&tG(k.delta,b)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var x=(a.current.shards||[]).map(Pv).filter(Boolean).filter(function(k){return k.contains(y.target)}),v=x.length>0?s(y,x[0]):!a.current.noIsolation;v&&y.cancelable&&y.preventDefault()}}},[]),l=_.useCallback(function(g,y,b,w){var x={name:g,delta:y,target:b,should:w,shadowParent:iG(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(v){return v!==x})},1)},[]),u=_.useCallback(function(g){r.current=Ca(g),o.current=void 0},[]),d=_.useCallback(function(g){l(g.type,Rv(g),g.target,s(g,e.lockRef.current))},[]),f=_.useCallback(function(g){l(g.type,Ca(g),g.target,s(g,e.lockRef.current))},[]);_.useEffect(function(){return Rn.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Nn),document.addEventListener("touchmove",c,Nn),document.addEventListener("touchstart",u,Nn),function(){Rn=Rn.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,Nn),document.removeEventListener("touchmove",c,Nn),document.removeEventListener("touchstart",u,Nn)}},[]);var m=e.removeScrollBar,h=e.inert;return _.createElement(_.Fragment,null,h?_.createElement(i,{styles:rG(n)}):null,m?_.createElement(H8,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function iG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const aG=P8(q$,oG);var _p=_.forwardRef(function(e,t){return _.createElement(ol,Xt({},e,{ref:t,sideCar:aG}))});_p.classNames=ol.classNames;var sG=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Pn=new WeakMap,Na=new WeakMap,Ra={},uu=0,K$=function(e){return e&&(e.host||K$(e.parentNode))},cG=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=K$(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},lG=function(e,t,r,o){var n=cG(t,Array.isArray(e)?e:[e]);Ra[r]||(Ra[r]=new WeakMap);var i=Ra[r],a=[],s=new Set,c=new Set(n),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};n.forEach(l);var u=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))u(f);else try{var m=f.getAttribute(o),h=m!==null&&m!=="false",g=(Pn.get(f)||0)+1,y=(i.get(f)||0)+1;Pn.set(f,g),i.set(f,y),a.push(f),g===1&&h&&Na.set(f,!0),y===1&&f.setAttribute(r,"true"),h||f.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(t),s.clear(),uu++,function(){a.forEach(function(d){var f=Pn.get(d)-1,m=i.get(d)-1;Pn.set(d,f),i.set(d,m),f||(Na.has(d)||d.removeAttribute(o),Na.delete(d)),m||d.removeAttribute(r)}),uu--,uu||(Pn=new WeakMap,Pn=new WeakMap,Na=new WeakMap,Ra={})}},Y$=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=sG(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),lG(o,n,r,"aria-hidden")):function(){return null}},il="Dialog",[X$]=ia(il),[uG,Wt]=X$(il),Q$=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:n,onOpenChange:i,modal:a=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=tl({prop:o,defaultProp:n??!1,onChange:i,caller:il});return p.jsx(uG,{scope:t,triggerRef:s,contentRef:c,contentId:Zn(),titleId:Zn(),descriptionId:Zn(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(d=>!d),[u]),modal:a,children:r})};Q$.displayName=il;var e1="DialogTrigger",t1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(e1,r),i=pt(t,n.triggerRef);return p.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Sp(n.open),...o,ref:i,onClick:De(e.onClick,n.onOpenToggle)})});t1.displayName=e1;var wp="DialogPortal",[dG,r1]=X$(wp,{forceMount:void 0}),n1=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:n}=e,i=Wt(wp,t);return p.jsx(dG,{scope:t,forceMount:r,children:_.Children.map(o,a=>p.jsx(Br,{present:r||i.open,children:p.jsx(mp,{asChild:!0,container:n,children:a})}))})};n1.displayName=wp;var Ns="DialogOverlay",o1=_.forwardRef((e,t)=>{const r=r1(Ns,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Wt(Ns,e.__scopeDialog);return i.modal?p.jsx(Br,{present:o||i.open,children:p.jsx(mG,{...n,ref:t})}):null});o1.displayName=Ns;var fG=rp("DialogOverlay.RemoveScroll"),mG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(Ns,r);return p.jsx(_p,{as:fG,allowPinchZoom:!0,shards:[n.contentRef],children:p.jsx(Le.div,{"data-state":Sp(n.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),mn="DialogContent",i1=_.forwardRef((e,t)=>{const r=r1(mn,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Wt(mn,e.__scopeDialog);return p.jsx(Br,{present:o||i.open,children:i.modal?p.jsx(pG,{...n,ref:t}):p.jsx(gG,{...n,ref:t})})});i1.displayName=mn;var pG=_.forwardRef((e,t)=>{const r=Wt(mn,e.__scopeDialog),o=_.useRef(null),n=pt(t,r.contentRef,o);return _.useEffect(()=>{const i=o.current;if(i)return Y$(i)},[]),p.jsx(a1,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:De(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:De(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:De(e.onFocusOutside,i=>i.preventDefault())})}),gG=_.forwardRef((e,t)=>{const r=Wt(mn,e.__scopeDialog),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(a1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||r.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&n.current&&i.preventDefault()}})}),a1=_.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:i,...a}=e,s=Wt(mn,r),c=_.useRef(null),l=pt(t,c);return V$(),p.jsxs(p.Fragment,{children:[p.jsx(bp,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:i,children:p.jsx(Kc,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Sp(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(vG,{titleId:s.titleId}),p.jsx(bG,{contentRef:c,descriptionId:s.descriptionId})]})]})}),xp="DialogTitle",s1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(xp,r);return p.jsx(Le.h2,{id:n.titleId,...o,ref:t})});s1.displayName=xp;var c1="DialogDescription",hG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(c1,r);return p.jsx(Le.p,{id:n.descriptionId,...o,ref:t})});hG.displayName=c1;var l1="DialogClose",u1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(l1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:De(e.onClick,()=>n.onOpenChange(!1))})});u1.displayName=l1;function Sp(e){return e?"open":"closed"}var d1="DialogTitleWarning",[LW,f1]=nq(d1,{contentName:mn,titleName:xp,docsSlug:"dialog"}),vG=({titleId:e})=>{const t=f1(d1),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
137
|
+
|
|
138
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
139
|
+
|
|
140
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},yG="DialogDescriptionWarning",bG=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${f1(yG).contentName}}.`;return _.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},_G=Q$,wG=t1,xG=n1,SG=o1,kG=i1,EG=s1,IG=u1;function TG({...e}){return p.jsx(_G,{"data-slot":"dialog",...e})}function $G({...e}){return p.jsx(wG,{"data-slot":"dialog-trigger",...e})}function OG({container:e,...t}){const r=U$();return p.jsx(xG,{"data-slot":"dialog-portal",container:e??r,...t})}function AG({className:e,...t}){return p.jsx(SG,{"data-slot":"dialog-overlay",className:$.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function CG({className:e,children:t,showCloseButton:r=!0,...o}){return p.jsxs(OG,{"data-slot":"dialog-portal",children:[p.jsx(AG,{}),p.jsxs(kG,{"data-slot":"dialog-content",className:$.cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...o,children:[t,r&&p.jsxs(IG,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[p.jsx(xo,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function NG({className:e,...t}){return p.jsx(EG,{"data-slot":"dialog-title",className:$.cn("text-lg leading-none font-semibold",e),...t})}function RG(e,t=[]){let r=[];function o(i,a){const s=_.createContext(a);s.displayName=i+"Context";const c=r.length;r=[...r,a];const l=d=>{const{scope:f,children:m,...h}=d,g=f?.[e]?.[c]||s,y=_.useMemo(()=>h,Object.values(h));return p.jsx(g.Provider,{value:y,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,h=_.useContext(m);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,u]}const n=()=>{const i=r.map(a=>_.createContext(a));return function(s){const c=s?.[e]||i;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,PG(n,...t)]}function PG(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(i){const a=o.reduce((s,{useScope:c,scopeName:l})=>{const d=c(i)[`__scope${l}`];return{...s,...d}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var jG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kp=jG.reduce((e,t)=>{const r=XT(`Primitive.${t}`),o=_.forwardRef((n,i)=>{const{asChild:a,...s}=n,c=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...s,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Pa={exports:{}},du={};var jv;function DG(){if(jv)return du;jv=1;var e=N;function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,n=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function s(d,f){var m=f(),h=o({inst:{value:m,getSnapshot:f}}),g=h[0].inst,y=h[1];return i(function(){g.value=m,g.getSnapshot=f,c(g)&&y({inst:g})},[d,m,f]),n(function(){return c(g)&&y({inst:g}),d(function(){c(g)&&y({inst:g})})},[d]),a(m),m}function c(d){var f=d.getSnapshot;d=d.value;try{var m=f();return!r(d,m)}catch{return!0}}function l(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return du.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,du}var fu={};var Dv;function zG(){return Dv||(Dv=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}function t(m,h){u||n.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=h();if(!d){var y=h();i(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=a({inst:{value:g,getSnapshot:h}});var b=y[0].inst,w=y[1];return c(function(){b.value=g,b.getSnapshot=h,r(b)&&w({inst:b})},[m,g,h]),s(function(){return r(b)&&w({inst:b}),m(function(){r(b)&&w({inst:b})})},[m]),l(g),g}function r(m){var h=m.getSnapshot;m=m.value;try{var g=h();return!i(m,g)}catch{return!0}}function o(m,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=N,i=typeof Object.is=="function"?Object.is:e,a=n.useState,s=n.useEffect,c=n.useLayoutEffect,l=n.useDebugValue,u=!1,d=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;fu.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),fu}var zv;function MG(){return zv||(zv=1,process.env.NODE_ENV==="production"?Pa.exports=DG():Pa.exports=zG()),Pa.exports}var UG=MG();function LG(){return UG.useSyncExternalStore(FG,()=>!0,()=>!1)}function FG(){return()=>{}}var Ep="Avatar",[VG]=RG(Ep),[ZG,m1]=VG(Ep),p1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,...o}=e,[n,i]=_.useState("idle");return p.jsx(ZG,{scope:r,imageLoadingStatus:n,onImageLoadingStatusChange:i,children:p.jsx(kp.span,{...o,ref:t})})});p1.displayName=Ep;var g1="AvatarImage",h1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,src:o,onLoadingStatusChange:n=()=>{},...i}=e,a=m1(g1,r),s=BG(o,i),c=dn(l=>{n(l),a.onImageLoadingStatusChange(l)});return Ct(()=>{s!=="idle"&&c(s)},[s,c]),s==="loaded"?p.jsx(kp.img,{...i,ref:t,src:o}):null});h1.displayName=g1;var v1="AvatarFallback",y1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:o,...n}=e,i=m1(v1,r),[a,s]=_.useState(o===void 0);return _.useEffect(()=>{if(o!==void 0){const c=window.setTimeout(()=>s(!0),o);return()=>window.clearTimeout(c)}},[o]),a&&i.imageLoadingStatus!=="loaded"?p.jsx(kp.span,{...n,ref:t}):null});y1.displayName=v1;function Mv(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function BG(e,{referrerPolicy:t,crossOrigin:r}){const o=LG(),n=_.useRef(null),i=o?(n.current||(n.current=new window.Image),n.current):null,[a,s]=_.useState(()=>Mv(i,e));return Ct(()=>{s(Mv(i,e))},[i,e]),Ct(()=>{const c=d=>()=>{s(d)};if(!i)return;const l=c("loaded"),u=c("error");return i.addEventListener("load",l),i.addEventListener("error",u),t&&(i.referrerPolicy=t),typeof r=="string"&&(i.crossOrigin=r),()=>{i.removeEventListener("load",l),i.removeEventListener("error",u)}},[i,r,t]),a}var qG=p1,GG=h1,HG=y1;function WG({className:e,...t}){return p.jsx(qG,{"data-slot":"avatar",className:$.cn("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function JG({className:e,...t}){return p.jsx(GG,{"data-slot":"avatar-image",className:$.cn("aspect-square size-full",e),...t})}function KG({className:e,...t}){return p.jsx(HG,{"data-slot":"avatar-fallback",className:$.cn("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const Ht=N.forwardRef(({children:e,tooltip:t,side:r="bottom",align:o="center",className:n,...i},a)=>p.jsxs(hp,{children:[p.jsx(vp,{asChild:!0,children:p.jsxs(yt,{variant:"ghost",size:"icon",...i,className:$.cn("aui-button-icon size-6 p-1",n),ref:a,children:[p.jsx(KB,{children:e}),p.jsx("span",{className:"aui-sr-only sr-only",children:t})]})}),p.jsx(yp,{side:r,align:o,children:t})]}));Ht.displayName="TooltipIconButton";const YG=e=>{const[t,r]=N.useState(void 0);return N.useEffect(()=>{if(!e){r(void 0);return}const o=URL.createObjectURL(e);return r(o),()=>{URL.revokeObjectURL(o)}},[e]),t},b1=()=>{const{file:e,src:t}=z.useAssistantState(Y1.useShallow(({attachment:r})=>{if(r.type!=="image")return{};if(r.file)return{file:r.file};const o=r.content?.filter(n=>n.type==="image")[0]?.image;return o?{src:o}:{}}));return YG(e)??t},XG=({src:e})=>{const[t,r]=N.useState(!1);return p.jsx("img",{src:e,alt:"Image Preview",className:t?"aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain":"aui-attachment-preview-image-loading hidden",onLoad:()=>r(!0)})},QG=({children:e})=>{const t=b1();return t?p.jsxs(TG,{children:[p.jsx($G,{className:"aui-attachment-preview-trigger",asChild:!0,children:e}),p.jsxs(CG,{className:"aui-attachment-preview-dialog-content [&_svg]:text-background [&>button]:bg-foreground/60 [&>button]:hover:[&_svg]:text-destructive p-2 sm:max-w-3xl [&>button]:rounded-full [&>button]:p-1 [&>button]:opacity-100 [&>button]:!ring-0",children:[p.jsx(NG,{className:"aui-sr-only sr-only",children:"Image Attachment Preview"}),p.jsx("div",{className:"aui-attachment-preview bg-background relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden",children:p.jsx(XG,{src:t})})]})]}):e},eH=()=>{const e=z.useAssistantState(({attachment:r})=>r.type==="image"),t=b1();return p.jsxs(WG,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[p.jsx(JG,{src:t,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),p.jsx(KG,{delayMs:e?200:0,children:p.jsx($L,{className:"aui-attachment-tile-fallback-icon text-muted-foreground size-8"})})]})},_1=()=>{const t=z.useAssistantApi().attachment.source==="composer",r=z.useAssistantState(({attachment:n})=>n.type==="image"),o=z.useAssistantState(({attachment:n})=>{const i=n.type;switch(i){case"image":return"Image";case"document":return"Document";case"file":return"File";default:{const a=i;throw new Error(`Unknown attachment type: ${a}`)}}});return p.jsxs(hp,{children:[p.jsxs(z.AttachmentPrimitive.Root,{className:$.cn("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[p.jsx(QG,{children:p.jsx(vp,{asChild:!0,children:p.jsx("div",{className:$.cn("aui-attachment-tile bg-muted size-14 cursor-pointer overflow-hidden rounded-[14px] border transition-opacity hover:opacity-75",t&&"aui-attachment-tile-composer border-foreground/20"),role:"button",id:"attachment-tile","aria-label":`${o} attachment`,children:p.jsx(eH,{})})})}),t&&p.jsx(tH,{})]}),p.jsx(yp,{side:"top",children:p.jsx(z.AttachmentPrimitive.Name,{})})]})},tH=()=>p.jsx(z.AttachmentPrimitive.Remove,{asChild:!0,children:p.jsx(Ht,{tooltip:"Remove file",className:"aui-attachment-tile-remove text-muted-foreground hover:[&_svg]:text-destructive absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white opacity-100 shadow-sm hover:!bg-white [&_svg]:text-black",side:"top",children:p.jsx(xo,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),rH=()=>p.jsx("div",{className:"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2",children:p.jsx(z.MessagePrimitive.Attachments,{components:{Attachment:_1}})}),nH=()=>p.jsx("div",{className:"aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden",children:p.jsx(z.ComposerPrimitive.Attachments,{components:{Attachment:_1}})}),oH=()=>p.jsx(z.ComposerPrimitive.AddAttachment,{asChild:!0,children:p.jsx(Ht,{tooltip:"Add Attachment",side:"top",variant:"ghost",size:"icon",align:"start",className:"aui-composer-add-attachment hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-[34px] rounded-full p-1 text-xs font-semibold","aria-label":"Add Attachment",children:p.jsx(zE,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})});function iH(e){return N.useMemo(()=>e.reduce((t,r)=>(t?.[r.language]&&!r.overrideExisting||(t={...t,[r.language]:{CodeHeader:r.Header??(()=>null),SyntaxHighlighter:r.Component??void 0}}),t),{}),[e])}const aH=()=>{const{plugins:e}=$.useElements(),t=iH(e);return p.jsx(gu.MarkdownTextPrimitive,{remarkPlugins:[X1],className:"aui-md",components:lH,componentsByLanguage:t})},w1=N.memo(aH),sH=({language:e,code:t})=>{const o=z.useAssistantState(({message:s})=>s).status?.type==="complete",{isCopied:n,copyToClipboard:i}=cH(),a=()=>{!t||n||i(t)};return o?p.jsxs("div",{className:"aui-code-header-root bg-muted-foreground/15 text-foreground dark:bg-muted-foreground/20 mt-4 flex items-center justify-between gap-4 rounded-t-lg px-4 py-2 text-sm font-semibold",children:[p.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:e}),p.jsxs(Ht,{tooltip:"Copy",onClick:a,children:[!n&&p.jsx(jm,{}),n&&p.jsx(Nr,{})]})]}):null},cH=({copiedDuration:e=3e3}={})=>{const[t,r]=N.useState(!1);return{isCopied:t,copyToClipboard:n=>{n&&navigator.clipboard.writeText(n).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},lH=gu.unstable_memoizeMarkdownComponents({h1:({className:e,...t})=>p.jsx("h1",{className:$.cn("aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t}),h2:({className:e,...t})=>p.jsx("h2",{className:$.cn("aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h3:({className:e,...t})=>p.jsx("h3",{className:$.cn("aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h4:({className:e,...t})=>p.jsx("h4",{className:$.cn("aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h5:({className:e,...t})=>p.jsx("h5",{className:$.cn("aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0",e),...t}),h6:({className:e,...t})=>p.jsx("h6",{className:$.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>p.jsx("p",{className:$.cn("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>p.jsx("a",{className:$.cn("aui-md-a text-primary font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>p.jsx("blockquote",{className:$.cn("aui-md-blockquote border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>p.jsx("ul",{className:$.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>p.jsx("ol",{className:$.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>p.jsx("hr",{className:$.cn("aui-md-hr my-5 border-b",e),...t}),table:({className:e,...t})=>p.jsx("table",{className:$.cn("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>p.jsx("th",{className:$.cn("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",e),...t}),td:({className:e,...t})=>p.jsx("td",{className:$.cn("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>p.jsx("tr",{className:$.cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>p.jsx("sup",{className:$.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>p.jsx("pre",{className:$.cn("aui-md-pre text-foreground bg-muted overflow-x-auto rounded-t-none! rounded-b-lg border border-t-0 p-4",e),...t}),code:function({className:t,...r}){const o=gu.useIsMarkdownCodeBlock();return p.jsx("code",{className:$.cn(!o&&"aui-md-inline-code bg-muted rounded border font-semibold",t),...r})},CodeHeader:sH});var al="Collapsible",[uH]=ia(al),[dH,Ip]=uH(al),x1=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:n,disabled:i,onOpenChange:a,...s}=e,[c,l]=tl({prop:o,defaultProp:n??!1,onChange:a,caller:al});return p.jsx(dH,{scope:r,disabled:i,contentId:Zn(),open:c,onOpenToggle:_.useCallback(()=>l(u=>!u),[l]),children:p.jsx(Le.div,{"data-state":$p(c),"data-disabled":i?"":void 0,...s,ref:t})})});x1.displayName=al;var S1="CollapsibleTrigger",k1=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Ip(S1,r);return p.jsx(Le.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":$p(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:De(e.onClick,n.onOpenToggle)})});k1.displayName=S1;var Tp="CollapsibleContent",E1=_.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Ip(Tp,e.__scopeCollapsible);return p.jsx(Br,{present:r||n.open,children:({present:i})=>p.jsx(fH,{...o,ref:t,present:i})})});E1.displayName=Tp;var fH=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...i}=e,a=Ip(Tp,r),[s,c]=_.useState(o),l=_.useRef(null),u=pt(t,l),d=_.useRef(0),f=d.current,m=_.useRef(0),h=m.current,g=a.open||s,y=_.useRef(g),b=_.useRef(void 0);return _.useEffect(()=>{const w=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(w)},[]),Ct(()=>{const w=l.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const x=w.getBoundingClientRect();d.current=x.height,m.current=x.width,y.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),c(o)}},[a.open,o]),p.jsx(Le.div,{"data-state":$p(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&n})});function $p(e){return e?"open":"closed"}var mH=x1;function pH({...e}){return p.jsx(mH,{"data-slot":"collapsible",...e})}function gH({...e}){return p.jsx(k1,{"data-slot":"collapsible-trigger",...e})}function hH({...e}){return p.jsx(E1,{"data-slot":"collapsible-content",...e})}const Uv=200,I1=({className:e,children:t})=>{const r=N.useRef(null),[o,n]=N.useState(!1),i=z.useScrollLock(r,Uv),a=N.useCallback(s=>{s||i(),n(s)},[i]);return p.jsx(pH,{ref:r,open:o,onOpenChange:a,className:$.cn("aui-reasoning-root mb-4 w-full",e),style:{"--animation-duration":`${Uv}ms`},children:t})};I1.displayName="ReasoningRoot";const vH=({className:e})=>p.jsx("div",{className:$.cn("aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16","bg-[linear-gradient(to_top,var(--color-background),transparent)]","fade-in-0 animate-in","group-data-[state=open]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:delay-[calc(var(--animation-duration)*0.75)]","group-data-[state=open]/collapsible-content:fill-mode-forwards","duration-(--animation-duration)","group-data-[state=open]/collapsible-content:duration-(--animation-duration)",e)}),yH=({active:e,className:t})=>p.jsxs(gH,{className:$.cn("aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground -mb-2 flex max-w-[75%] items-center gap-2 py-2 text-sm transition-colors",t,e&&"shimmer"),children:[p.jsx(_L,{className:"aui-reasoning-trigger-icon size-4 shrink-0"}),p.jsxs("span",{className:"aui-reasoning-trigger-label-wrapper relative inline-block leading-none",children:[p.jsx("span",{children:"Reasoning"}),e?p.jsx("span",{"aria-hidden":!0,className:"aui-reasoning-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",children:"Reasoning"}):null]}),p.jsx(vs,{className:$.cn("aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]}),T1=({className:e,children:t,"aria-busy":r})=>p.jsxs(hH,{className:$.cn("aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-none","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",e),"aria-busy":r,children:[t,p.jsx(vH,{})]});T1.displayName="ReasoningContent";const $1=({className:e,children:t})=>p.jsx("div",{className:$.cn("aui-reasoning-text relative z-0 space-y-4 pt-4 pl-6 leading-relaxed","transform-gpu transition-[transform,opacity]","group-data-[state=open]/collapsible-content:animate-in","group-data-[state=closed]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-in-0","group-data-[state=closed]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:slide-in-from-top-4","group-data-[state=closed]/collapsible-content:slide-out-to-top-4","group-data-[state=open]/collapsible-content:duration-(--animation-duration)","group-data-[state=closed]/collapsible-content:duration-(--animation-duration)","[&_p]:-mb-2",e),children:t});$1.displayName="ReasoningText";const bH=()=>p.jsx(w1,{}),_H=({children:e,startIndex:t,endIndex:r})=>{const o=z.useAssistantState(({message:n})=>{if(n.status?.type!=="running")return!1;const i=n.parts.length-1;return i<0||n.parts[i]?.type!=="reasoning"?!1:i>=t&&i<=r});return p.jsxs(I1,{children:[p.jsx(yH,{active:o}),p.jsx(T1,{"aria-busy":o,children:p.jsx($1,{children:e})})]})},O1=N.memo(bH);O1.displayName="Reasoning";const A1=N.memo(_H);A1.displayName="ReasoningGroup";var sl="Popover",[C1]=ia(sl,[el]),ca=el(),[wH,xn]=C1(sl),N1=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:i,modal:a=!1}=e,s=ca(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=tl({prop:o,defaultProp:n??!1,onChange:i,caller:sl});return p.jsx(E$,{...s,children:p.jsx(wH,{scope:t,contentId:Zn(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(m=>!m),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:a,children:r})})};N1.displayName=sl;var R1="PopoverAnchor",xH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(R1,r),i=ca(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=n;return _.useEffect(()=>(a(),()=>s()),[a,s]),p.jsx(fp,{...i,...o,ref:t})});xH.displayName=R1;var P1="PopoverTrigger",j1=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(P1,r),i=ca(r),a=pt(t,n.triggerRef),s=p.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":U1(n.open),...o,ref:a,onClick:De(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?s:p.jsx(fp,{asChild:!0,...i,children:s})});j1.displayName=P1;var SH="PopoverPortal",[FW,kH]=C1(SH,{forceMount:void 0}),lo="PopoverContent",D1=_.forwardRef((e,t)=>{const r=kH(lo,e.__scopePopover),{forceMount:o=r.forceMount,...n}=e,i=xn(lo,e.__scopePopover);return p.jsx(Br,{present:o||i.open,children:i.modal?p.jsx(IH,{...n,ref:t}):p.jsx(TH,{...n,ref:t})})});D1.displayName=lo;var EH=rp("PopoverContent.RemoveScroll"),IH=_.forwardRef((e,t)=>{const r=xn(lo,e.__scopePopover),o=_.useRef(null),n=pt(t,o),i=_.useRef(!1);return _.useEffect(()=>{const a=o.current;if(a)return Y$(a)},[]),p.jsx(_p,{as:EH,allowPinchZoom:!0,children:p.jsx(z1,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:De(e.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:De(e.onPointerDownOutside,a=>{const s=a.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;i.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:De(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),TH=_.forwardRef((e,t)=>{const r=xn(lo,e.__scopePopover),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(z1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||r.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const a=i.target;r.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&n.current&&i.preventDefault()}})}),z1=_.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=xn(lo,r),m=ca(r);return V$(),p.jsx(bp,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:i,children:p.jsx(Kc,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(I$,{"data-state":U1(f.open),role:"dialog",id:f.contentId,...m,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),M1="PopoverClose",$H=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(M1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:De(e.onClick,()=>n.onOpenChange(!1))})});$H.displayName=M1;var OH="PopoverArrow",AH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=ca(r);return p.jsx(T$,{...n,...o,ref:t})});AH.displayName=OH;function U1(e){return e?"open":"closed"}var CH=N1,NH=j1,RH=D1;function L1({...e}){return p.jsx(CH,{"data-slot":"popover",...e})}function F1({...e}){return p.jsx(NH,{"data-slot":"popover-trigger",...e})}function V1({className:e,align:t="center",sideOffset:r=4,...o}){return p.jsx(RH,{"data-slot":"popover-content",align:t,sideOffset:r,className:$.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-20 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})}const PH=e$("flex size-5 items-center justify-center rounded-full",{variants:{status:{pending:"border border-dashed border-muted-foreground/50",running:"text-primary",complete:"text-green-600 dark:text-green-500",error:"text-destructive",approval:"text-amber-500"}},defaultVariants:{status:"pending"}});function jH(e){switch(e){case"text/markdown":return"markdown";case"text/html":return"html";case"text/css":return"css";case"application/json":return"json";case"text/javascript":return"javascript";case"text/typescript":return"typescript";case"text/python":return"python";default:return}}function DH(e,t){if(t==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return e}function zH(e){return typeof e=="object"&&e!==null&&"content"in e&&Array.isArray(e.content)}function Z1({status:e}){return p.jsxs("div",{className:$.cn(PH({status:e})),children:[e==="pending"&&null,e==="running"&&p.jsx(ys,{className:"size-4 animate-spin"}),e==="complete"&&p.jsx(Nr,{className:"size-4"}),e==="error"&&p.jsx(xo,{className:"size-4"}),e==="approval"&&p.jsx(ys,{className:"text-muted-foreground size-4 animate-spin"})]})}function MH({content:e}){const[t,r]=N.useState(!1),o=async n=>{n.stopPropagation(),await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx("button",{onClick:o,className:"text-muted-foreground hover:bg-accent hover:text-foreground rounded p-1 transition-colors","aria-label":"Copy to clipboard",children:t?p.jsx(Nr,{className:"size-4"}):p.jsx(jm,{className:"size-4"})})}function B1({text:e,language:t,className:r}){const[o,n]=N.useState(null);return N.useEffect(()=>{t&&Q1.codeToHtml(e,{lang:t,theme:"github-dark-default",rootStyle:"background-color: transparent;",transformers:[{pre(i){i.properties.class="w-full py-3 px-4 max-h-[300px] overflow-y-auto whitespace-pre-wrap text-left text-sm"}}]}).then(n)},[e,t]),o?p.jsx("div",{className:$.cn("w-full bg-slate-800/90",r),dangerouslySetInnerHTML:{__html:o}}):p.jsx("pre",{className:$.cn("w-full bg-slate-800/90 px-4 py-3 text-sm whitespace-pre-wrap text-slate-100",r),children:e})}function UH({data:e}){const t=`data:image/png;base64,${e}`;return p.jsx("div",{className:"flex items-center justify-center rounded-lg p-5",style:{backgroundImage:`linear-gradient(45deg, #ccc 25%, transparent 25%),
|
|
141
|
+
linear-gradient(135deg, #ccc 25%, transparent 25%),
|
|
142
|
+
linear-gradient(45deg, transparent 75%, #ccc 75%),
|
|
143
|
+
linear-gradient(135deg, transparent 75%, #ccc 75%)`,backgroundSize:"25px 25px",backgroundPosition:"0 0, 12.5px 0, 12.5px -12.5px, 0px 12.5px"},children:p.jsx("img",{src:t,className:"max-h-[300px] max-w-full object-contain"})})}function LH({content:e}){return p.jsx("div",{className:"w-full",children:e.content.map((t,r)=>{switch(t.type){case"text":{const o=jH(t._meta?.["getgram.ai/mime-type"]??"text/plain"),n=DH(t.text,o);return p.jsx(B1,{text:n,language:o},r)}case"image":return p.jsx(UH,{data:t.data},r);default:return p.jsx("pre",{className:"px-4 py-3 text-sm whitespace-pre-wrap",children:JSON.stringify(t,null,2)},r)}})})}function Lv({title:e,content:t,defaultExpanded:r=!1,highlightSyntax:o=!0,language:n="json"}){const[i,a]=N.useState(r),s=zH(t),c=s?JSON.stringify(t,null,2):typeof t=="string"?t:JSON.stringify(t,null,2);return p.jsxs("div",{"data-slot":"tool-ui-section",className:"border-border border-t",children:[p.jsxs("button",{onClick:()=>a(!i),className:"hover:bg-accent/50 flex w-full cursor-pointer items-center justify-between px-5 py-2.5 text-left transition-colors",children:[p.jsx("span",{className:"text-muted-foreground text-sm",children:e}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(MH,{content:c}),p.jsx(DE,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",i&&"rotate-90")})]})]}),i&&p.jsx("div",{className:"border-border border-t",children:s?p.jsx(LH,{content:t}):o?p.jsx(B1,{text:c,language:n}):p.jsx("pre",{className:"text-foreground overflow-x-auto px-4 py-3 text-sm whitespace-pre-wrap",children:c})})]})}function FH({name:e,icon:t,provider:r,status:o="complete",request:n,result:i,defaultExpanded:a=!1,className:s,onApproveOnce:c,onApproveForSession:l,onDeny:u}){const d=o==="approval"&&c!==void 0&&u!==void 0,[f,m]=N.useState(a),h=n!==void 0||i!==void 0,[g,y]=N.useState("one-time"),[b,w]=N.useState(!1);N.useEffect(()=>{!d&&f&&!a&&m(!1)},[d]);const x=()=>{g==="for-session"&&l?l():c&&c()};return p.jsxs("div",{"data-slot":"tool-ui",className:$.cn("border-border bg-card overflow-hidden rounded-lg border",s),children:[r&&p.jsxs("div",{"data-slot":"tool-ui-provider",className:$.cn("border-border flex items-center gap-2 border-b px-4 py-2.5"),children:[t?p.jsx("span",{className:"flex size-5 items-center justify-center",children:t}):p.jsx("span",{className:"bg-muted flex size-5 items-center justify-center rounded text-xs font-medium",children:r.charAt(0).toUpperCase()}),p.jsx("span",{className:"text-sm font-medium",children:r})]}),p.jsxs("button",{onClick:()=>h&&m(!f),disabled:!h,className:$.cn("flex w-full items-center gap-2 px-4 py-3 text-left",h&&"hover:bg-accent/50 cursor-pointer transition-colors"),children:[p.jsx(Z1,{status:o}),p.jsx("span",{className:$.cn("flex-1 text-sm",!r&&d&&"shimmer"),children:e}),h&&p.jsx(vs,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",f&&"rotate-180")})]}),f&&h&&p.jsxs("div",{"data-slot":"tool-ui-content",children:[n!==void 0&&p.jsx(Lv,{title:"Arguments",content:n,highlightSyntax:!0,language:"json"}),i!==void 0&&p.jsx(Lv,{title:"Output",content:i,highlightSyntax:!0,language:"json"})]}),d&&p.jsxs("div",{"data-slot":"tool-ui-approval-actions",className:"border-border flex items-center justify-end gap-2 border-t px-4 py-3",children:[p.jsx("div",{children:p.jsx("span",{className:"text-muted-foreground text-sm",children:"This tool requires approval"})}),p.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[p.jsxs(yt,{variant:"outline",size:"sm",onClick:u,className:"text-destructive hover:bg-destructive/10",children:[p.jsx(xo,{className:"mr-1 size-3"}),"Deny"]}),p.jsxs("div",{className:"flex items-center",children:[p.jsxs(yt,{variant:"default",size:"sm",onClick:x,className:"flex cursor-pointer justify-between gap-1 rounded-r-none bg-emerald-600 hover:bg-emerald-700",children:[p.jsx(Nr,{className:"mr-1 size-3"}),p.jsx("span",{className:"min-w-[110px]",children:g==="one-time"?"Approve this time":"Approve always"})]}),p.jsxs(L1,{open:b,onOpenChange:w,children:[p.jsx(F1,{asChild:!0,children:p.jsx(yt,{variant:"default",size:"sm",className:"cursor-pointer rounded-l-none border-l border-emerald-700 bg-emerald-600 px-2 hover:bg-emerald-700",children:p.jsx(vs,{className:"size-3"})})}),p.jsxs(V1,{align:"end",className:"w-64 p-1",sideOffset:4,children:[p.jsxs("button",{onClick:()=>{y("one-time"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(Nr,{className:$.cn("relative top-1 mt-0.5 size-3 shrink-0",g!=="one-time"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve only once"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"You'll be asked again next time"})]})]}),l&&p.jsxs("button",{onClick:()=>{y("for-session"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(Nr,{className:$.cn("relative top-1 mt-0.5 size-3 shrink-0",g!=="for-session"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve always"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"Trust this tool for the session"})]})]})]})]})]})]})]})]})}function VH({title:e,icon:t,status:r="complete",defaultExpanded:o=!1,children:n,className:i}){const[a,s]=N.useState(o);return p.jsxs("div",{"data-slot":"tool-ui-group",className:$.cn("border-border bg-card overflow-hidden rounded-lg border",i),children:[p.jsxs("button",{onClick:()=>s(!a),className:"hover:bg-accent/50 flex w-full items-center gap-2 px-4 py-3 text-left transition-colors",children:[t||p.jsx(Z1,{status:r==="running"?"running":"complete"}),p.jsx("span",{className:$.cn("flex-1 text-sm font-medium",r==="running"&&"shimmer"),children:e}),p.jsx(vs,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",a&&"rotate-180")})]}),a&&p.jsx("div",{"data-slot":"tool-ui-group-content",className:"border-border border-t",children:n})]})}const ZH=({toolName:e,toolCallId:t,status:r,result:o,args:n})=>{const{pendingApprovals:i,whitelistTool:a,confirmPendingApproval:s,rejectPendingApproval:c}=$S(),l=i.get(t),d=z.useAssistantState(({message:w})=>w).parts.filter(w=>w.type==="tool-call"),f=d.findIndex(w=>w.toolName===e),m=()=>{s(t)},h=()=>{a(e),s(t)},g=()=>{c(t)},y=()=>l?"approval":r.type==="incomplete"?"error":r.type==="complete"?o&&typeof o=="object"&&"isError"in o&&o.isError?"error":"complete":"running",b=()=>{if(o!==void 0)return typeof o=="object"&&o!==null&&"content"in o&&Array.isArray(o.content)||typeof o=="string",o};return p.jsx("div",{className:$.cn("aui-tool-fallback-root flex w-full flex-col",f!==-1&&f!==d.length-1&&"border-b"),children:p.jsx(FH,{name:e,status:y(),request:n,result:b(),onApproveOnce:l?m:void 0,onApproveForSession:l?h:void 0,onDeny:l?g:void 0,className:"rounded-none border-0"})})},rr=[.23,1,.32,1],Fv=/@(\w+)/g;function BH(e){return e?Object.entries(e).map(([t,r])=>({id:t,name:t,description:typeof r=="object"&&r!==null&&"description"in r?String(r.description??""):void 0})):[]}function qH(e,t){if(!t||!e)return[];const r=Object.keys(t),o=[];let n;for(Fv.lastIndex=0;(n=Fv.exec(e))!==null;)o.push(n[1].toLowerCase());const i=r.filter(a=>o.includes(a.toLowerCase()));return[...new Set(i)]}function GH(e,t){const r=e.slice(0,t),o=r.lastIndexOf("@");if(o===-1)return{isInMention:!1,query:"",atPosition:-1};const n=r.slice(o+1);return n.includes(" ")||n.includes(`
|
|
144
|
+
`)?{isInMention:!1,query:"",atPosition:-1}:{isInMention:!0,query:n.toLowerCase(),atPosition:o}}function HH(e,t){if(!t)return e;const r=t.toLowerCase();return e.filter(o=>{const n=o.name.toLowerCase().includes(r),i=o.description?.toLowerCase().includes(r);return n||i})}function WH(e,t,r,o){const n=e.slice(0,r),i=e.slice(o),a=`${n}@${t} ${i}`,s=r+t.length+2;return{text:a,cursorPosition:s}}function JH(e,t){const r=new RegExp(`@${t}\\s?`,"gi");return e.replace(r,"")}const KH=({tools:e,value:t,cursorPosition:r,onValueChange:o,textareaRef:n,className:i})=>{const[a,s]=N.useState(0),[c,l]=N.useState(!1),[u,d]=N.useState([]),[f,m]=N.useState(null),h=N.useRef(null),g=$.useDensity(),y=$.useRadius();N.useEffect(()=>{const w=GH(t,r);if(w.isInMention&&e.length>0){const x=HH(e,w.query);d(x),l(x.length>0),m({atPosition:w.atPosition,query:w.query}),s(0)}else l(!1),m(null)},[t,r,e]);const b=N.useCallback(w=>{if(!f)return;const x=WH(t,w.name,f.atPosition,r);o(x.text,x.cursorPosition),l(!1)},[f,t,r,o,n]);return N.useEffect(()=>{if(!c)return;const w=v=>{switch(v.key){case"ArrowDown":v.preventDefault(),v.stopPropagation(),s(k=>(k+1)%u.length);break;case"ArrowUp":v.preventDefault(),v.stopPropagation(),s(k=>(k-1+u.length)%u.length);break;case"Enter":case"Tab":v.preventDefault(),v.stopPropagation(),u[a]&&b(u[a]);break;case"Escape":v.preventDefault(),v.stopPropagation(),l(!1);break}},x=n.current;if(x)return x.addEventListener("keydown",w,{capture:!0}),()=>x.removeEventListener("keydown",w,{capture:!0})},[c,u,a,b,n]),N.useEffect(()=>{if(!c)return;const w=h.current;if(!w)return;const x=w.querySelector(`[data-index="${a}"]`);x&&x.scrollIntoView({block:"nearest"})},[a,c]),N.useEffect(()=>{if(!c)return;const w=x=>{h.current&&!h.current.contains(x.target)&&n.current&&!n.current.contains(x.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c,n]),N.useEffect(()=>{const w=n.current;if(!w)return;const x=w.closest(".aui-composer-root");return x?(c?requestAnimationFrame(()=>{const k=h.current;if(k&&c){x.style.borderTopColor="var(--ring)",x.style.borderTopLeftRadius="0",x.style.borderTopRightRadius="0";const E=x.getBoundingClientRect(),I=k.offsetParent;if(I){const A=I.getBoundingClientRect();k.style.left=`${E.left-A.left}px`,k.style.right="auto",k.style.width=`${E.width}px`}}}):(x.style.borderTopColor="",x.style.borderTopLeftRadius="",x.style.borderTopRightRadius=""),()=>{x.style.borderTopColor="",x.style.borderTopLeftRadius="",x.style.borderTopRightRadius=""}):void 0},[c,n]),!c||u.length===0?null:p.jsx(Ut.div,{ref:h,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15,ease:rr},className:$.cn("aui-tool-mention-autocomplete border-ring bg-background absolute bottom-full z-50 max-h-[220px] overflow-clip overflow-y-auto overscroll-contain rounded-br-none! rounded-bl-none! border border-b-0 shadow-xs",y("xl"),i),children:p.jsx("div",{className:"flex flex-col gap-1",children:u.map((w,x)=>p.jsxs("button",{type:"button","data-index":x,className:$.cn("aui-tool-mention-item flex w-full items-center gap-2 text-left transition-colors",g("p-sm"),"hover:bg-accent hover:text-accent-foreground",x===a&&"bg-accent text-accent-foreground"),onClick:v=>{v.preventDefault(),v.stopPropagation(),b(w)},onMouseEnter:()=>s(x),children:[p.jsx(ME,{className:"mt-0.5 size-4 flex-shrink-0 opacity-50"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"text-sm font-medium",children:w.name}),w.description&&p.jsx("div",{className:"text-muted-foreground line-clamp-2 text-xs",children:w.description})]})]},w.id))})})},YH=({mentionedToolIds:e,tools:t,onRemove:r,className:o})=>{const n=$.useDensity(),i=t.filter(a=>e.includes(a.id));return i.length===0?null:p.jsxs("div",{className:$.cn("aui-mentioned-tools-badges flex flex-wrap items-center gap-1",n("px-sm"),n("py-xs"),o),children:[p.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:"Tools:"}),p.jsx(Lt.AnimatePresence,{mode:"popLayout",children:i.map(a=>p.jsx(Ut.div,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.15,ease:rr},children:p.jsx(XH,{tool:a,onRemove:r?()=>r(a.id):void 0})},a.id))})]})},XH=({tool:e,onRemove:t})=>{const r=$.useDensity(),o=$.useRadius();return p.jsxs("div",{className:$.cn("aui-tool-badge bg-primary/10 text-primary inline-flex items-center gap-1",o("md"),r("px-sm"),r("py-xs")),children:[p.jsx(ME,{className:"size-3 flex-shrink-0"}),p.jsx("span",{className:"text-xs font-medium",children:e.name}),t&&p.jsx("button",{type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),t()},className:"hover:opacity-70 focus:outline-none","aria-label":`Remove ${e.name}`,children:p.jsx(xo,{className:"size-3 flex-shrink-0"})})]})};function QH({tools:e,enabled:t=!0}){const[r,o]=N.useState(0),n=N.useRef(null),i=z.useAssistantApi(),a=z.useAssistantState(({composer:m})=>m.text),s=N.useMemo(()=>BH(e),[e]),c=N.useMemo(()=>t?qH(a,e):[],[a,e,t]),l=N.useCallback(()=>{const m=n.current;m&&o(m.selectionStart)},[]),u=N.useCallback((m,h)=>{i.composer().setText(m),o(h),setTimeout(()=>{const g=n.current;g&&(g.focus(),g.setSelectionRange(h,h))},0)},[i]),d=N.useCallback(m=>{const h=s.find(g=>g.id===m);if(h){const g=JH(a,h.name);i.composer().setText(g)}},[a,s,i]),f=t&&s.length>0;return{mentionableTools:s,mentionedToolIds:c,value:a,cursorPosition:r,textareaRef:n,updateCursorPosition:l,handleAutocompleteChange:u,removeMention:d,isActive:f}}const cl=()=>{const{config:e}=$.useElements(),t=e.theme??{};return N.useMemo(()=>{const{colorScheme:r="light"}=t;return{className:r==="dark"||r==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":void 0}},[t])};function eW(e){return e.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const tW=({children:e})=>{const t=z.useAssistantState(({message:s})=>s).parts,r=t.filter(s=>s.type==="tool-call"),o=r.some(s=>s.status?.type==="running"),{config:n}=$.useElements(),i=n.tools?.expandToolGroupsByDefault??!1,a=N.useMemo(()=>{const s=t.filter(c=>c.type==="tool-call");return s.length===0?"No tools called":s.length===1?`Calling ${eW(s[0].toolName)}...`:o?`Calling ${s.length} tools...`:`Executed ${s.length} tools`},[t,o]);return n.tools?.components?.[r[0]?.toolName]?e:r.length===1?p.jsx("div",{className:$.cn("my-4 w-full max-w-xl"),children:p.jsx("div",{className:"border-border bg-card overflow-hidden rounded-lg border",children:e})}):p.jsx("div",{className:"my-4 w-full max-w-xl",children:p.jsx(VH,{title:a,status:o?"running":"complete",defaultExpanded:i,children:e})})},rW=()=>p.jsxs("div",{className:"m-2 rounded-md border border-amber-500 bg-amber-100 px-4 py-3 text-sm text-amber-800 dark:border-amber-600 dark:bg-amber-900/30 dark:text-amber-200",children:[p.jsx("strong",{children:"Warning:"})," You are using a static session token in the client. It will expire shortly. Please"," ",p.jsx("a",{href:"https://github.com/speakeasy-api/gram/tree/main/elements#setting-up-your-backend",target:"_blank",rel:"noopener noreferrer",className:"text-amber-700 underline hover:text-amber-800 dark:text-amber-300 dark:hover:text-amber-200",children:"set up a session endpoint to avoid this warning."})]}),Op=({className:e})=>{const t=cl(),r=$.useDensity(),{config:o}=$.useElements(),n=o.components??{},i=o.api&&"sessionToken"in o.api;return p.jsx(Lt.LazyMotion,{features:Lt.domAnimation,children:p.jsx(Lt.MotionConfig,{reducedMotion:"user",children:p.jsx(z.ThreadPrimitive.Root,{className:$.cn("aui-root aui-thread-root bg-background @container flex h-full flex-col",t.className,e),children:p.jsxs(z.ThreadPrimitive.Viewport,{className:$.cn("aui-thread-viewport relative mx-auto flex w-full flex-1 flex-col overflow-x-auto overflow-y-scroll pb-0!",r("p-lg")),children:[p.jsx(z.ThreadPrimitive.If,{empty:!0,children:n.ThreadWelcome?p.jsx(n.ThreadWelcome,{}):p.jsx(oW,{})}),i&&p.jsx(rW,{}),p.jsx(z.ThreadPrimitive.Messages,{components:{UserMessage:n.UserMessage??pW,EditComposer:n.EditComposer??hW,AssistantMessage:n.AssistantMessage??dW}}),p.jsx(z.ThreadPrimitive.If,{empty:!1,children:p.jsx("div",{className:"aui-thread-viewport-spacer min-h-8 grow"})}),p.jsx(sW,{})]})})})})},nW=()=>p.jsx(z.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:p.jsx(Ht,{tooltip:"Scroll to bottom",variant:"outline",className:"aui-thread-scroll-to-bottom dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible",children:p.jsx(hL,{})})}),oW=()=>{const{config:e}=$.useElements(),t=$.useDensity(),{title:r,subtitle:o}=e.welcome??{},n=e.variant==="standalone";return p.jsxs("div",{className:$.cn("aui-thread-welcome-root my-auto flex w-full grow flex-col",n?"items-center justify-center":"",t("gap-lg")),children:[p.jsx("div",{className:$.cn("aui-thread-welcome-center flex w-full grow flex-col items-center justify-start"),children:p.jsxs("div",{className:$.cn("aui-thread-welcome-message flex flex-col",n?"items-center text-center":"size-full justify-start",t("gap-sm"),!n&&t("py-md")),children:[p.jsx(Ut.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,ease:rr},className:$.cn("aui-thread-welcome-message-motion-1 text-foreground font-semibold",t("text-title")),children:r}),p.jsx(Ut.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,delay:.05,ease:rr},className:$.cn("aui-thread-welcome-message-motion-2 text-muted-foreground/65",t("text-subtitle")),children:o})]})}),p.jsx(iW,{})]})},iW=()=>{const{config:e}=$.useElements(),t=$.useRadius(),r=$.useDensity(),o=e.welcome?.suggestions??[],n=e.variant==="standalone";return o.length===0?null:p.jsx("div",{className:$.cn("aui-thread-welcome-suggestions w-full",r("gap-md"),r("py-lg"),n?"flex flex-wrap items-center justify-center":o.length===1?"flex":"grid max-w-fit @md:grid-cols-2"),children:o.map((i,a)=>p.jsx(Ut.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.25,delay:.03*a,ease:rr},className:$.cn("aui-thread-welcome-suggestion-display",!n&&"nth-[n+3]:hidden @md:nth-[n+3]:block"),children:p.jsx(z.ThreadPrimitive.Suggestion,{prompt:i.action,send:!0,asChild:!0,children:p.jsxs(yt,{variant:"ghost",className:$.cn("aui-thread-welcome-suggestion dark:hover:bg-accent/60 h-auto w-full border text-left whitespace-break-spaces",r("text-base"),n?`flex-row items-center ${r("gap-sm")} ${r("px-md")} ${r("py-sm")} ${t("full")}`:`w-full flex-1 flex-col flex-wrap items-start justify-start ${r("gap-sm")} ${r("px-lg")} ${r("py-md")} ${t("xl")}`),"aria-label":i.action,children:[p.jsx("span",{className:"aui-thread-welcome-suggestion-text-1 text-foreground text-sm font-medium",children:i.title}),p.jsx("span",{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground text-sm",children:i.label})]})})},`suggested-action-${i.title}-${a}`))})},aW=({tools:e})=>{const t=N.useRef(null),{mentionableTools:r,mentionedToolIds:o,value:n,cursorPosition:i,textareaRef:a,updateCursorPosition:s,handleAutocompleteChange:c,removeMention:l,isActive:u}=QH({tools:e});return N.useEffect(()=>{if(!u)return;const d=()=>{const h=document.querySelector(".aui-composer-input");if(h&&a.current!==h){a.current=h;const g=()=>s();return h.addEventListener("click",g),h.addEventListener("keyup",g),h.addEventListener("input",g),()=>{h.removeEventListener("click",g),h.removeEventListener("keyup",g),h.removeEventListener("input",g)}}},f=d(),m=new MutationObserver(()=>{d()});return m.observe(document.body,{childList:!0,subtree:!0}),()=>{f?.(),m.disconnect()}},[u,a,s]),u?p.jsxs("div",{ref:t,className:"aui-composer-tool-mentions relative",children:[p.jsx(YH,{mentionedToolIds:o,tools:r,onRemove:l}),p.jsx(Lt.AnimatePresence,{children:p.jsx(KH,{tools:r,value:n,cursorPosition:i,onValueChange:c,textareaRef:a})})]}):null},sW=()=>{const{config:e,mcpTools:t}=$.useElements(),r=$.useRadius(),o=$.useDensity(),n=e.composer??{placeholder:"Send a message...",attachments:!0},i=e.components??{},a=n.toolMentions===void 0||n.toolMentions===!0||typeof n.toolMentions=="object"&&n.toolMentions.enabled!==!1,s=N.useRef(null);return i.Composer?p.jsx(i.Composer,{}):p.jsxs("div",{className:$.cn("aui-composer-wrapper bg-background sticky bottom-0 flex w-full flex-col overflow-visible",o("gap-md"),o("py-md"),r("xl")),children:[p.jsx(nW,{}),p.jsxs(z.ComposerPrimitive.Root,{ref:s,className:$.cn("aui-composer-root group/input-group border-input bg-background has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-ring/5 dark:bg-background relative flex w-full flex-col border px-1 pt-2 shadow-xs transition-[color,box-shadow] outline-none has-[textarea:focus-visible]:ring-1",r("xl")),children:[n.attachments&&p.jsx(nH,{}),a&&p.jsx(aW,{tools:t}),p.jsx(z.ComposerPrimitive.Input,{placeholder:n.placeholder,className:$.cn("aui-composer-input placeholder:text-muted-foreground mb-1 max-h-32 w-full resize-none bg-transparent px-3.5 pt-1.5 pb-3 outline-none focus-visible:ring-0",o("h-input"),o("text-base")),rows:1,autoFocus:!0,"aria-label":"Message input"}),p.jsx(lW,{})]})]})},cW=()=>{const{model:e,setModel:t}=$.useElements(),[r,o]=N.useState(!1),[n,i]=N.useState(!1),a=N.useRef(null),s=N.useRef(0),c=N.useRef(!1);N.useEffect(()=>{r&&!c.current&&requestAnimationFrame(()=>{const u=a.current;u&&u.scrollHeight>0&&(u.scrollTop=s.current)}),c.current=r},[r]),N.useEffect(()=>{r&&i(!1)},[r]);const l=u=>{s.current=u.currentTarget.scrollTop};return p.jsx(L$,{children:p.jsxs(hp,{open:n&&!r,onOpenChange:i,children:[p.jsxs(L1,{open:r,onOpenChange:o,children:[p.jsx(vp,{asChild:!0,children:p.jsx(F1,{asChild:!0,children:p.jsx(yt,{variant:"ghost",size:"icon","data-state":r?"open":"closed",className:"aui-composer-model-picker data-[state=open]:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 flex w-fit items-center gap-2 rounded-full px-2.5 py-1 text-xs font-semibold","aria-label":"Model Settings",children:p.jsx(BL,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})})}),p.jsx(V1,{side:"top",align:"start",className:"w-min p-0 shadow-none",children:p.jsx("div",{ref:a,className:"max-h-48 overflow-y-auto",onScroll:l,children:Pm.map(u=>p.jsxs(yt,{onClick:()=>{t(u)},variant:"ghost",className:"w-full justify-start gap-2 rounded-none px-2",children:[u===e?p.jsx("div",{children:p.jsx(Nr,{className:"size-4 text-emerald-500"})}):p.jsx("div",{className:"size-4",children:" "}),u]},u))})})]}),p.jsx(yp,{side:"bottom",align:"start",children:"Model Settings"})]})})},lW=()=>{const{config:e}=$.useElements(),t=$.useRadius(),r=e.composer??{attachments:!0};return p.jsxs("div",{className:"aui-composer-action-wrapper relative mx-1 mt-2 mb-2 flex items-center justify-between",children:[p.jsxs("div",{className:"aui-composer-action-wrapper-inner flex items-center",children:[r.attachments?p.jsx(oH,{}):p.jsx("div",{className:"aui-composer-add-attachment-placeholder"}),e.model?.showModelPicker&&!e.languageModel&&p.jsx(cW,{})]}),p.jsx(z.ThreadPrimitive.If,{running:!1,children:p.jsx(z.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(Ht,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:$.cn("aui-composer-send size-[34px] p-1",t("full")),"aria-label":"Send message",children:p.jsx(yL,{className:"aui-composer-send-icon size-5"})})})}),p.jsx(z.ThreadPrimitive.If,{running:!0,children:p.jsx(z.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(yt,{type:"button",variant:"default",size:"icon",className:$.cn("aui-composer-cancel border-muted-foreground/60 hover:bg-primary/75 dark:border-muted-foreground/90 size-[34px] border",t("full")),"aria-label":"Stop generating",children:p.jsx(GL,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})},uW=()=>p.jsx(z.MessagePrimitive.Error,{children:p.jsx(z.ErrorPrimitive.Root,{className:"aui-message-error-root border-destructive bg-destructive/10 text-destructive dark:bg-destructive/5 mt-2 rounded-md border p-3 text-sm dark:text-red-200",children:p.jsx(z.ErrorPrimitive.Message,{className:"aui-message-error-message line-clamp-2"})})}),dW=()=>{const{config:e}=$.useElements(),t=e.tools??{},r=e.components??{};return p.jsx(z.MessagePrimitive.Root,{asChild:!0,children:p.jsxs("div",{className:"aui-assistant-message-root animate-in fade-in slide-in-from-bottom-1 relative mx-auto w-full py-4 duration-150 ease-out last:mb-24","data-role":"assistant",children:[p.jsxs("div",{className:"aui-assistant-message-content text-foreground mx-2 leading-7 wrap-break-word",children:[p.jsx(z.MessagePrimitive.Parts,{components:{Text:r.Text??w1,Image:r.Image??fW,tools:{by_name:t.components,Fallback:r.ToolFallback??ZH},Reasoning:r.Reasoning??O1,ReasoningGroup:r.ReasoningGroup??A1,ToolGroup:r.ToolGroup??tW}}),p.jsx(uW,{})]}),p.jsx("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex",children:p.jsx(mW,{})})]})})},fW=e=>p.jsx("img",{src:e.image}),mW=()=>p.jsx(z.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",autohideFloat:"single-branch",className:"aui-assistant-action-bar-root text-muted-foreground data-floating:bg-background col-start-3 row-start-2 -ml-1 flex gap-1 data-floating:absolute data-floating:rounded-md data-floating:border data-floating:p-1 data-floating:shadow-sm",children:p.jsx(z.ActionBarPrimitive.Copy,{asChild:!0,children:p.jsxs(Ht,{tooltip:"Copy",children:[p.jsx(z.MessagePrimitive.If,{copied:!0,children:p.jsx(Nr,{})}),p.jsx(z.MessagePrimitive.If,{copied:!1,children:p.jsx(jm,{})})]})})}),pW=()=>{const e=$.useRadius();return p.jsx(z.MessagePrimitive.Root,{asChild:!0,children:p.jsxs("div",{className:"aui-user-message-root animate-in fade-in slide-in-from-bottom-1 mx-auto grid w-full auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 px-2 py-4 duration-150 ease-out first:mt-3 last:mb-5 [&:where(>*)]:col-start-2","data-role":"user",children:[p.jsx(rH,{}),p.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[p.jsx("div",{className:$.cn("aui-user-message-content bg-muted text-foreground px-5 py-2.5 wrap-break-word",e("xl")),children:p.jsx(z.MessagePrimitive.Parts,{})}),p.jsx("div",{className:"aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2",children:p.jsx(gW,{})})]}),p.jsx(vW,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]})})},gW=()=>p.jsx(z.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:p.jsx(z.ActionBarPrimitive.Edit,{asChild:!0,children:p.jsx(Ht,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:p.jsx(FL,{})})})}),hW=()=>p.jsx("div",{className:"aui-edit-composer-wrapper mx-auto flex w-full flex-col gap-4 px-2 first:mt-4",children:p.jsxs(z.ComposerPrimitive.Root,{className:"aui-edit-composer-root bg-muted ml-auto flex w-full max-w-7/8 flex-col rounded-xl",children:[p.jsx(z.ComposerPrimitive.Input,{className:"aui-edit-composer-input text-foreground flex min-h-[60px] w-full resize-none bg-transparent p-4 outline-none",autoFocus:!0}),p.jsxs("div",{className:"aui-edit-composer-footer mx-3 mb-3 flex items-center justify-center gap-2 self-end",children:[p.jsx(z.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(yt,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),p.jsx(z.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(yt,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),vW=({className:e,...t})=>p.jsxs(z.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:$.cn("aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs",e),...t,children:[p.jsx(z.BranchPickerPrimitive.Previous,{asChild:!0,children:p.jsx(Ht,{tooltip:"Previous",children:p.jsx(kL,{})})}),p.jsxs("span",{className:"aui-branch-picker-state font-medium",children:[p.jsx(z.BranchPickerPrimitive.Number,{})," / ",p.jsx(z.BranchPickerPrimitive.Count,{})]}),p.jsx(z.BranchPickerPrimitive.Next,{asChild:!0,children:p.jsx(Ht,{tooltip:"Next",children:p.jsx(DE,{})})})]});function yW({className:e,...t}){return p.jsx("div",{"data-slot":"skeleton",className:$.cn("bg-accent animate-pulse rounded-md",e),...t})}const Ap=({className:e})=>{const t=$.useDensity();return p.jsxs(z.ThreadListPrimitive.Root,{className:$.cn("aui-root aui-thread-list-root bg-background flex flex-col items-stretch",t("gap-sm"),e),children:[p.jsx("div",{className:$.cn("aui-thread-list-new-section border-b pb-2",t("py-sm"),t("px-sm")),children:p.jsx(bW,{})}),p.jsx("div",{className:$.cn("aui-thread-list-items-section flex flex-col gap-1",t("py-xs"),t("px-sm")),children:p.jsx(_W,{})})]})},bW=()=>{const e=$.useDensity();return p.jsx(z.ThreadListPrimitive.New,{asChild:!0,children:p.jsxs(yt,{className:$.cn("aui-thread-list-new hover:bg-muted-foreground/10 data-[active=true]:bg-muted-foreground/20! flex w-full cursor-pointer items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start",e("p-sm"),e("py-xs")),variant:"ghost",children:[p.jsx(zE,{}),"New Thread"]})})},_W=()=>z.useAssistantState(({threads:t})=>t.isLoading)?p.jsx(wW,{}):p.jsx(z.ThreadListPrimitive.Items,{components:{ThreadListItem:xW}}),wW=()=>p.jsx(p.Fragment,{children:Array.from({length:5},(e,t)=>p.jsx("div",{role:"status","aria-label":"Loading threads","aria-live":"polite",className:"aui-thread-list-skeleton-wrapper flex items-center gap-2 rounded-md px-3 py-2",children:p.jsx(yW,{className:"aui-thread-list-skeleton h-[22px] grow"})},t))}),xW=()=>{const e=$.useRadius(),t=$.useDensity();return p.jsx(z.ThreadListItemPrimitive.Root,{className:$.cn("aui-thread-list-item group hover:bg-muted focus-visible:bg-muted focus-visible:ring-ring data-[active=true]:bg-muted-foreground/20 flex items-center gap-2 rounded-lg transition-all focus-visible:ring-2 focus-visible:outline-none",e("md")),children:p.jsx(z.ThreadListItemPrimitive.Trigger,{className:$.cn("aui-thread-list-item-trigger flex grow cursor-pointer items-center text-start",t("px-lg"),t("py-sm")),children:p.jsx(SW,{})})})},SW=()=>p.jsx("span",{className:"aui-thread-list-item-title text-sm",children:p.jsx(z.ThreadListItemPrimitive.Title,{fallback:"New Chat"})}),q1=()=>{const{config:e,isExpanded:t,setIsExpanded:r}=$.useElements(),o=e.modal?.defaultExpanded??!1;return{expandable:e.modal?.expandable??!1,isExpanded:t,setIsExpanded:r,defaultExpanded:o}},kW={layout:{duration:.25,ease:rr}},EW=({className:e})=>{const{config:t}=$.useElements(),r=cl(),o=$.useRadius(),n=$.useDensity(),[i,a]=N.useState(t.modal?.defaultOpen??!1),{expandable:s,isExpanded:c,setIsExpanded:l}=q1(),u=t.modal?.title,d=t.modal?.icon,f=t.history?.enabled&&t.history?.showThreadList!==!1,m=t.modal?.position??"bottom-right",h=IW(m),g=N.useMemo(()=>t.modal?.dimensions?.default??{width:"500px",height:"600px",maxHeight:"95vh"},[t.modal?.dimensions?.default]),y=N.useMemo(()=>t.modal?.dimensions?.expanded??{width:"70vw",height:"90vh"},[t.modal?.dimensions?.expanded]),w=z.useAssistantState(({thread:E})=>E).messages.some(E=>E.status?.type==="running"),x=c?y.width:g.width,v=c?y.height:g.height,k=g.maxHeight;return p.jsx(Lt.LazyMotion,{features:Lt.domMax,children:p.jsx(Lt.MotionConfig,{reducedMotion:"user",transition:kW,children:p.jsx("div",{className:$.cn("aui-root aui-modal-anchor fixed z-10",h,r.className,o("lg"),i&&"shadow-xl",e),children:p.jsx(Lt.AnimatePresence,{mode:"wait",children:i?p.jsxs(Ut.div,{layout:!0,layoutId:"chat-container",className:$.cn("aui-modal-content bg-popover text-popover-foreground flex flex-col overflow-hidden border [&>.aui-thread-root]:bg-inherit",o("lg")),initial:!1,style:{originX:m.includes("left")?0:1,originY:m.includes("top")?0:1,width:x,height:v,maxHeight:k},children:[p.jsxs(Ut.div,{className:$.cn("aui-modal-header flex shrink-0 items-center justify-between border-b",n("h-header"),n("px-lg")),initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1,ease:rr},children:[p.jsx("div",{className:$.cn("flex min-w-0 items-center"),children:p.jsxs("span",{className:$.cn("text-md flex items-center gap-2 truncate font-medium",w&&"shimmer"),children:[p.jsx("span",{className:"truncate",children:u}),w&&p.jsx(ys,{className:"text-muted-foreground size-4.5 animate-spin",strokeWidth:1.25})]})}),p.jsxs("div",{className:"flex flex-row items-center justify-end gap-1",children:[s?p.jsx("button",{type:"button",onClick:()=>l(E=>!E),className:$.cn("text-muted-foreground hover:text-foreground hover:bg-accent flex h-8 cursor-pointer items-center rounded-md px-2 text-xs transition-colors"),"aria-pressed":c,"aria-label":c?"Collapse assistant":"Expand assistant",children:c?p.jsx(jL,{strokeWidth:2,className:"size-3.5 rotate-90"}):p.jsx(CL,{strokeWidth:2,className:"size-3.5 rotate-90"})}):null,p.jsx("button",{onClick:()=>{a(!1),l(!1)},className:"text-muted-foreground hover:text-foreground hover:bg-accent -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-md transition-colors","aria-label":`Close ${u}`,children:p.jsx(xo,{className:"size-4.5"})})]})]}),p.jsxs(Ut.div,{className:"aui-modal-body flex flex-1 overflow-hidden",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.05,ease:rr},children:[f&&p.jsx("div",{className:"aui-modal-thread-list w-56 shrink-0 overflow-y-auto border-r",children:p.jsx(Ap,{})}),p.jsx("div",{className:"aui-modal-thread w-full flex-1 overflow-hidden",children:p.jsx(tp,{children:p.jsx(Op,{})})})]})]},"chat"):p.jsx(Ut.button,{layout:!0,layoutId:"chat-container",onClick:()=>a(!0),className:$.cn("aui-modal-button bg-primary text-primary-foreground flex size-12 cursor-pointer items-center justify-center border shadow-lg transition-shadow hover:shadow-xl",o("full")),initial:!1,"aria-label":`Open ${u}`,style:{originX:1,originY:1},children:p.jsx(Ut.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:rr},className:"flex size-full items-center justify-center",children:d?d("closed"):p.jsx(RL,{className:"size-6"})})},"button")})})})})};function IW(e){switch(e){case"bottom-left":return"left-4 bottom-4";case"top-right":return"right-4 top-4";case"top-left":return"left-4 top-4";case"bottom-right":return"right-4 bottom-4";default:$.assertNever(e)}}const TW=({className:e})=>{const{config:t}=$.useElements(),r=cl(),o=t.sidecar??{},{title:n,dimensions:i}=o,{isExpanded:a,setIsExpanded:s}=q1(),l=z.useAssistantState(({thread:d})=>d).messages.some(d=>d.status?.type==="running"),u=t.history?.enabled&&t.history?.showThreadList!==!1;return p.jsx(Lt.LazyMotion,{features:Lt.domMax,children:p.jsxs(Ut.div,{initial:!1,animate:{width:a?i?.expanded?.width??"800px":i?.default?.width??"400px",height:a?i?.expanded?.height??"100%":i?.default?.height??"100vh"},transition:{duration:.3,ease:rr},className:$.cn("aui-root aui-sidecar bg-popover text-popover-foreground fixed top-0 right-0 border-l",r.className,e),children:[p.jsxs("div",{className:"aui-sidecar-header flex h-14 items-center justify-between border-b px-4",children:[p.jsxs("span",{className:$.cn("text-md flex items-center gap-2 font-medium",l&&"shimmer"),children:[n,l&&p.jsx(ys,{className:"text-muted-foreground size-4.5 animate-spin",strokeWidth:1.25})]}),p.jsx("div",{className:"aui-sidecar-header-actions flex items-center gap-1",children:p.jsx(Ht,{tooltip:a?"Collapse":"Pop out",variant:"ghost",className:"aui-sidecar-popout size-8",onClick:()=>s(d=>!d),children:a?p.jsx(zL,{className:"size-4.5"}):p.jsx(UL,{className:"size-4.5"})})})]}),p.jsxs("div",{className:"aui-sidecar-body flex h-[calc(100%-3.5rem)] overflow-hidden",children:[u&&p.jsx("div",{className:"aui-sidecar-thread-list w-56 shrink-0 overflow-y-auto border-r",children:p.jsx(Ap,{})}),p.jsx("div",{className:"aui-sidecar-content flex-1 overflow-hidden",children:p.jsx(tp,{children:p.jsx(Op,{})})})]})]})})};function $W({containerRef:e,children:t}){return p.jsx(M$.Provider,{value:e,children:t})}const mu=`@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){:root,:host{--shimmer-track-height:200px;--shimmer-angle:15deg}*,:before,:after,::backdrop{--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0;--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:"";--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}:root,:host{--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-500:oklch(63.7% .237 25.331);--color-red-900:oklch(39.6% .141 25.723);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-700:oklch(50.8% .118 165.612);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-800:oklch(39.8% .195 277.366);--color-violet-600:oklch(54.1% .281 293.009);--color-purple-600:oklch(55.8% .288 302.321);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--color-background:var(--background)}@property --shimmer-track-height{syntax:"<length>";inherits:true;initial-value:200px}@property --shimmer-angle{syntax:"<angle>";inherits:true;initial-value:15deg}@layer theme;@layer base{.gram-elements .\\@container{container-type:inline-size}.gram-elements .pointer-events-none{pointer-events:none}.gram-elements .collapse{visibility:collapse}.gram-elements .invisible{visibility:hidden}.gram-elements .visible{visibility:visible}.gram-elements .sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.gram-elements .absolute{position:absolute}.gram-elements .fixed{position:fixed}.gram-elements .relative{position:relative}.gram-elements .static{position:static}.gram-elements .sticky{position:sticky}.gram-elements .inset-0{inset:calc(var(--spacing)*0)}.gram-elements .inset-x-0{inset-inline:calc(var(--spacing)*0)}.gram-elements .-top-10{top:calc(var(--spacing)*-10)}.gram-elements .-top-12{top:calc(var(--spacing)*-12)}.gram-elements .top-0{top:calc(var(--spacing)*0)}.gram-elements .top-1{top:calc(var(--spacing)*1)}.gram-elements .top-1\\.5{top:calc(var(--spacing)*1.5)}.gram-elements .top-1\\/2{top:50%}.gram-elements .top-4{top:calc(var(--spacing)*4)}.gram-elements .top-8{top:calc(var(--spacing)*8)}.gram-elements .top-\\[50\\%\\]{top:50%}.gram-elements .-right-10{right:calc(var(--spacing)*-10)}.gram-elements .right-0{right:calc(var(--spacing)*0)}.gram-elements .right-1\\.5{right:calc(var(--spacing)*1.5)}.gram-elements .right-2{right:calc(var(--spacing)*2)}.gram-elements .right-4{right:calc(var(--spacing)*4)}.gram-elements .-bottom-10{bottom:calc(var(--spacing)*-10)}.gram-elements .bottom-0{bottom:calc(var(--spacing)*0)}.gram-elements .bottom-2{bottom:calc(var(--spacing)*2)}.gram-elements .bottom-4{bottom:calc(var(--spacing)*4)}.gram-elements .bottom-full{bottom:100%}.gram-elements .-left-10{left:calc(var(--spacing)*-10)}.gram-elements .left-0{left:calc(var(--spacing)*0)}.gram-elements .left-2{left:calc(var(--spacing)*2)}.gram-elements .left-4{left:calc(var(--spacing)*4)}.gram-elements .left-\\[50\\%\\]{left:50%}.gram-elements .z-0{z-index:0}.gram-elements .z-10{z-index:10}.gram-elements .z-20{z-index:20}.gram-elements .z-50{z-index:50}.gram-elements .col-span-full{grid-column:1/-1}.gram-elements .col-start-1{grid-column-start:1}.gram-elements .col-start-2{grid-column-start:2}.gram-elements .col-start-3{grid-column-start:3}.gram-elements .row-start-1{grid-row-start:1}.gram-elements .row-start-2{grid-row-start:2}.gram-elements .row-start-3{grid-row-start:3}.gram-elements .container{width:100%}@media(min-width:40rem){.gram-elements .container{max-width:40rem}}@media(min-width:48rem){.gram-elements .container{max-width:48rem}}@media(min-width:64rem){.gram-elements .container{max-width:64rem}}@media(min-width:80rem){.gram-elements .container{max-width:80rem}}@media(min-width:96rem){.gram-elements .container{max-width:96rem}}.gram-elements .m-0{margin:calc(var(--spacing)*0)}.gram-elements .m-2{margin:calc(var(--spacing)*2)}.gram-elements .m-auto{margin:auto}.gram-elements .mx-1{margin-inline:calc(var(--spacing)*1)}.gram-elements .mx-2{margin-inline:calc(var(--spacing)*2)}.gram-elements .mx-3{margin-inline:calc(var(--spacing)*3)}.gram-elements .mx-4{margin-inline:calc(var(--spacing)*4)}.gram-elements .mx-auto{margin-inline:auto}.gram-elements .my-4{margin-block:calc(var(--spacing)*4)}.gram-elements .my-5{margin-block:calc(var(--spacing)*5)}.gram-elements .my-auto{margin-block:auto}.gram-elements .mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.gram-elements .mt-2{margin-top:calc(var(--spacing)*2)}.gram-elements .mt-4{margin-top:calc(var(--spacing)*4)}.gram-elements .mt-5{margin-top:calc(var(--spacing)*5)}.gram-elements .mt-6{margin-top:calc(var(--spacing)*6)}.gram-elements .mt-8{margin-top:calc(var(--spacing)*8)}.gram-elements .mt-16{margin-top:calc(var(--spacing)*16)}.gram-elements .-mr-1{margin-right:calc(var(--spacing)*-1)}.gram-elements .mr-1{margin-right:calc(var(--spacing)*1)}.gram-elements .mr-2{margin-right:calc(var(--spacing)*2)}.gram-elements .mr-\\[400px\\]{margin-right:400px}.gram-elements .mr-\\[600px\\]{margin-right:600px}.gram-elements .-mb-2{margin-bottom:calc(var(--spacing)*-2)}.gram-elements .mb-1{margin-bottom:calc(var(--spacing)*1)}.gram-elements .mb-2{margin-bottom:calc(var(--spacing)*2)}.gram-elements .mb-3{margin-bottom:calc(var(--spacing)*3)}.gram-elements .mb-4{margin-bottom:calc(var(--spacing)*4)}.gram-elements .mb-5{margin-bottom:calc(var(--spacing)*5)}.gram-elements .mb-8{margin-bottom:calc(var(--spacing)*8)}.gram-elements .-ml-1{margin-left:calc(var(--spacing)*-1)}.gram-elements .-ml-2{margin-left:calc(var(--spacing)*-2)}.gram-elements .ml-2{margin-left:calc(var(--spacing)*2)}.gram-elements .ml-6{margin-left:calc(var(--spacing)*6)}.gram-elements .ml-auto{margin-left:auto}.gram-elements .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.gram-elements .block{display:block}.gram-elements .flex{display:flex}.gram-elements .grid{display:grid}.gram-elements .hidden{display:none}.gram-elements .inline-block{display:inline-block}.gram-elements .inline-flex{display:inline-flex}.gram-elements .table{display:table}.gram-elements .aspect-square{aspect-ratio:1}.gram-elements .size-2\\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.gram-elements .size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.gram-elements .size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.gram-elements .size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.gram-elements .size-4\\.5{width:calc(var(--spacing)*4.5);height:calc(var(--spacing)*4.5)}.gram-elements .size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.gram-elements .size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.gram-elements .size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.gram-elements .size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.gram-elements .size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.gram-elements .size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.gram-elements .size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.gram-elements .size-\\[34px\\]{width:34px;height:34px}.gram-elements .size-full{width:100%;height:100%}.gram-elements .h-0\\.5{height:calc(var(--spacing)*.5)}.gram-elements .h-3{height:calc(var(--spacing)*3)}.gram-elements .h-4{height:calc(var(--spacing)*4)}.gram-elements .h-8{height:calc(var(--spacing)*8)}.gram-elements .h-9{height:calc(var(--spacing)*9)}.gram-elements .h-10{height:calc(var(--spacing)*10)}.gram-elements .h-10\\/12{height:83.3333%}.gram-elements .h-12{height:calc(var(--spacing)*12)}.gram-elements .h-14{height:calc(var(--spacing)*14)}.gram-elements .h-16{height:calc(var(--spacing)*16)}.gram-elements .h-32{height:calc(var(--spacing)*32)}.gram-elements .h-40{height:calc(var(--spacing)*40)}.gram-elements .h-48{height:calc(var(--spacing)*48)}.gram-elements .h-96{height:calc(var(--spacing)*96)}.gram-elements .h-\\[22px\\]{height:22px}.gram-elements .h-\\[calc\\(100\\%-3\\.5rem\\)\\]{height:calc(100% - 3.5rem)}.gram-elements .h-auto{height:auto}.gram-elements .h-full{height:100%}.gram-elements .h-screen{height:100vh}.gram-elements .max-h-32{max-height:calc(var(--spacing)*32)}.gram-elements .max-h-48{max-height:calc(var(--spacing)*48)}.gram-elements .max-h-\\[80dvh\\]{max-height:80dvh}.gram-elements .max-h-\\[80vh\\]{max-height:80vh}.gram-elements .max-h-\\[220px\\]{max-height:220px}.gram-elements .max-h-\\[300px\\]{max-height:300px}.gram-elements .max-h-\\[800px\\]{max-height:800px}.gram-elements .min-h-8{min-height:calc(var(--spacing)*8)}.gram-elements .min-h-10{min-height:calc(var(--spacing)*10)}.gram-elements .min-h-12{min-height:calc(var(--spacing)*12)}.gram-elements .min-h-16{min-height:calc(var(--spacing)*16)}.gram-elements .min-h-\\[60px\\]{min-height:60px}.gram-elements .min-h-\\[400px\\]{min-height:400px}.gram-elements .w-1\\/2{width:50%}.gram-elements .w-1\\/3{width:33.3333%}.gram-elements .w-3{width:calc(var(--spacing)*3)}.gram-elements .w-4{width:calc(var(--spacing)*4)}.gram-elements .w-12{width:calc(var(--spacing)*12)}.gram-elements .w-16{width:calc(var(--spacing)*16)}.gram-elements .w-32{width:calc(var(--spacing)*32)}.gram-elements .w-40{width:calc(var(--spacing)*40)}.gram-elements .w-56{width:calc(var(--spacing)*56)}.gram-elements .w-64{width:calc(var(--spacing)*64)}.gram-elements .w-72{width:calc(var(--spacing)*72)}.gram-elements .w-80{width:calc(var(--spacing)*80)}.gram-elements .w-\\[400px\\]{width:400px}.gram-elements .w-auto{width:auto}.gram-elements .w-fit{width:fit-content}.gram-elements .w-full{width:100%}.gram-elements .w-min{width:min-content}.gram-elements .max-w-3xl{max-width:var(--container-3xl)}.gram-elements .max-w-7\\/8{max-width:87.5%}.gram-elements .max-w-\\[75\\%\\]{max-width:75%}.gram-elements .max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.gram-elements .max-w-fit{max-width:fit-content}.gram-elements .max-w-full{max-width:100%}.gram-elements .max-w-md{max-width:var(--container-md)}.gram-elements .max-w-xl{max-width:var(--container-xl)}.gram-elements .min-w-0{min-width:calc(var(--spacing)*0)}.gram-elements .min-w-\\[110px\\]{min-width:110px}.gram-elements .min-w-\\[400px\\]{min-width:400px}.gram-elements .flex-1{flex:1}.gram-elements .flex-3{flex:3}.gram-elements .flex-none{flex:none}.gram-elements .flex-shrink-0,.gram-elements .shrink-0{flex-shrink:0}.gram-elements .grow{flex-grow:1}.gram-elements .border-separate{border-collapse:separate}.gram-elements .border-spacing-0{--tw-border-spacing-x:calc(var(--spacing)*0);--tw-border-spacing-y:calc(var(--spacing)*0);border-spacing:var(--tw-border-spacing-x)var(--tw-border-spacing-y)}.gram-elements .origin-\\(--radix-popover-content-transform-origin\\){transform-origin:var(--radix-popover-content-transform-origin)}.gram-elements .origin-\\(--radix-tooltip-content-transform-origin\\){transform-origin:var(--radix-tooltip-content-transform-origin)}.gram-elements .-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.gram-elements .translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.gram-elements .-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.gram-elements .translate-y-\\[-50\\%\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.gram-elements .translate-y-\\[calc\\(-50\\%-2px\\)\\]{--tw-translate-y: calc(-50% - 2px) ;translate:var(--tw-translate-x)var(--tw-translate-y)}.gram-elements .rotate-0{rotate:none}.gram-elements .rotate-45{rotate:45deg}.gram-elements .rotate-90{rotate:90deg}.gram-elements .rotate-180{rotate:180deg}.gram-elements .transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.gram-elements .transform-\\[rotateY\\(180deg\\)\\]{transform:rotateY(180deg)}.gram-elements .transform-gpu{transform:translateZ(0)var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.gram-elements .shimmer{--_gradient-width:calc(var(--_spread) + var(--shimmer-track-height)*tan(var(--shimmer-angle)));--_active-distance:calc(var(--shimmer-track-width,200px) + var(--_gradient-width));--_duration:var(--shimmer-duration,calc(var(--_active-distance)/var(--_speed)/1px*1000));--_repeat-delay:var(--shimmer-repeat-delay,calc(20000/var(--_speed)));--_repeat-delay-px:calc(var(--_repeat-delay)*var(--_active-distance)/var(--_duration));--_xy-offset-px:calc((var(--shimmer-x,0) + var(--shimmer-y,0)*tan(var(--shimmer-angle)))*1px);--_bg-width:calc(100% + var(--shimmer-track-width,100%) + var(--_gradient-width) + var(--_repeat-delay-px));--_position:calc(var(--shimmer-track-width,(100% - var(--_gradient-width) - var(--_repeat-delay-px))/2) + var(--_gradient-width)/2 + var(--_repeat-delay-px) - var(--_xy-offset-px))}.gram-elements .shimmer:not(.shimmer-bg){--_speed:var(--shimmer-speed,200);--_spread:var(--shimmer-spread, calc(4ch + 80px) );--_bg:currentColor;--_fg:var(--shimmer-color,oklch(from currentColor l c h/ calc(alpha/5) ));-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text}.gram-elements .shimmer.shimmer-bg{--_speed:var(--shimmer-speed,1000);--_spread:var(--shimmer-spread,480px);--_bg:transparent;--_fg:var(--shimmer-color,oklch(from currentColor 0 c h/.06))}.gram-elements .shimmer:is(.dark *):not(.shimmer-bg){--_fg:var(--shimmer-color,oklch(from currentColor max(.8, calc(l + .4) )c h/ calc(alpha + .4) ))}.gram-elements .shimmer:is(.dark *).shimmer-bg{--_fg:var(--shimmer-color,oklch(from currentColor 0 c h/.3))}@-moz-document url-prefix(){.gram-elements .shimmer{--_duration:var(--shimmer-duration,calc(375000/var(--_speed)))}}.gram-elements .shimmer{--_mix-96:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-96:color-mix(in oklch,var(--_fg),var(--_bg)96%)}}.gram-elements .shimmer{--_mix-83:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-83:color-mix(in oklch,var(--_fg),var(--_bg)83%)}}.gram-elements .shimmer{--_mix-67:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-67:color-mix(in oklch,var(--_fg),var(--_bg)67%)}}.gram-elements .shimmer{--_mix-50:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-50:color-mix(in oklch,var(--_fg),var(--_bg)50%)}}.gram-elements .shimmer{--_mix-33:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-33:color-mix(in oklch,var(--_fg),var(--_bg)33%)}}.gram-elements .shimmer{--_mix-17:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-17:color-mix(in oklch,var(--_fg),var(--_bg)17%)}}.gram-elements .shimmer{--_mix-4:var(--_fg)}@supports (color:color-mix(in lab,red,red)){.gram-elements .shimmer{--_mix-4:color-mix(in oklch,var(--_fg),var(--_bg)4%)}}.gram-elements .shimmer{background:linear-gradient(calc(90deg + var(--shimmer-angle)),var(--_bg)calc(var(--_position) - var(--_spread)*.5),var(--_mix-96)calc(var(--_position) - var(--_spread)*.44),var(--_mix-83)calc(var(--_position) - var(--_spread)*.37),var(--_mix-67)calc(var(--_position) - var(--_spread)*.31),var(--_mix-50)calc(var(--_position) - var(--_spread)*.25),var(--_mix-33)calc(var(--_position) - var(--_spread)*.19),var(--_mix-17)calc(var(--_position) - var(--_spread)*.12),var(--_mix-4)calc(var(--_position) - var(--_spread)*.06),var(--_fg)var(--_position),var(--_mix-4)calc(var(--_position) + var(--_spread)*.06),var(--_mix-17)calc(var(--_position) + var(--_spread)*.12),var(--_mix-33)calc(var(--_position) + var(--_spread)*.19),var(--_mix-50)calc(var(--_position) + var(--_spread)*.25),var(--_mix-67)calc(var(--_position) + var(--_spread)*.31),var(--_mix-83)calc(var(--_position) + var(--_spread)*.37),var(--_mix-96)calc(var(--_position) + var(--_spread)*.44),var(--_bg)calc(var(--_position) + var(--_spread)*.5))0 0/var(--_bg-width)100% no-repeat;animation:1s linear infinite backwards tw-shimmer;animation-duration:calc((var(--_duration) + var(--_repeat-delay))*1ms)}.gram-elements .animate-in{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .animate-pulse{animation:var(--animate-pulse)}.gram-elements .animate-spin{animation:var(--animate-spin)}.gram-elements .cursor-pointer{cursor:pointer}.gram-elements .resize-none{resize:none}.gram-elements .scroll-m-20{scroll-margin:calc(var(--spacing)*20)}.gram-elements .list-decimal{list-style-type:decimal}.gram-elements .list-disc{list-style-type:disc}.gram-elements .auto-rows-auto{grid-auto-rows:auto}.gram-elements .grid-cols-\\[minmax\\(72px\\,1fr\\)_auto\\]{grid-template-columns:minmax(72px,1fr) auto}.gram-elements .flex-col{flex-direction:column}.gram-elements .flex-col-reverse{flex-direction:column-reverse}.gram-elements .flex-row{flex-direction:row}.gram-elements .flex-wrap{flex-wrap:wrap}.gram-elements .items-center{align-items:center}.gram-elements .items-end{align-items:flex-end}.gram-elements .items-start{align-items:flex-start}.gram-elements .items-stretch{align-items:stretch}.gram-elements .justify-between{justify-content:space-between}.gram-elements .justify-center{justify-content:center}.gram-elements .justify-end{justify-content:flex-end}.gram-elements .justify-start{justify-content:flex-start}.gram-elements .gap-0\\.5{gap:calc(var(--spacing)*.5)}.gram-elements .gap-1{gap:calc(var(--spacing)*1)}.gram-elements .gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gram-elements .gap-2{gap:calc(var(--spacing)*2)}.gram-elements .gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gram-elements .gap-3{gap:calc(var(--spacing)*3)}.gram-elements .gap-4{gap:calc(var(--spacing)*4)}.gram-elements .gap-6{gap:calc(var(--spacing)*6)}:where(.gram-elements .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.gram-elements .space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.gram-elements .gap-y-2{row-gap:calc(var(--spacing)*2)}.gram-elements .self-center{align-self:center}.gram-elements .self-end{align-self:flex-end}.gram-elements .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.gram-elements .overflow-auto{overflow:auto}.gram-elements .overflow-clip{overflow:clip}.gram-elements .overflow-hidden{overflow:hidden}.gram-elements .overflow-visible{overflow:visible}.gram-elements .overflow-x-auto{overflow-x:auto}.gram-elements .overflow-y-auto{overflow-y:auto}.gram-elements .overflow-y-scroll{overflow-y:scroll}.gram-elements .overscroll-contain{overscroll-behavior:contain}.gram-elements .rounded{border-radius:.25rem}.gram-elements .rounded-2xl{border-radius:var(--radius-2xl)}.gram-elements .rounded-3xl{border-radius:var(--radius-3xl)}.gram-elements .rounded-\\[2px\\]{border-radius:2px}.gram-elements .rounded-\\[14px\\]{border-radius:14px}.gram-elements .rounded-full{border-radius:3.40282e38px}.gram-elements .rounded-lg{border-radius:var(--radius)}.gram-elements .rounded-md{border-radius:calc(var(--radius) - 2px)}.gram-elements .rounded-none{border-radius:0}.gram-elements .rounded-sm{border-radius:calc(var(--radius) - 4px)}.gram-elements .rounded-xl{border-radius:calc(var(--radius) + 4px)}.gram-elements .rounded-xs{border-radius:var(--radius-xs)}.gram-elements .rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.gram-elements .rounded-t-none\\!{border-top-left-radius:0!important;border-top-right-radius:0!important}.gram-elements .rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.gram-elements .rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.gram-elements .rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.gram-elements .rounded-br-none\\!{border-bottom-right-radius:0!important}.gram-elements .rounded-bl-none\\!{border-bottom-left-radius:0!important}.gram-elements .border{border-style:var(--tw-border-style);border-width:1px}.gram-elements .border-0{border-style:var(--tw-border-style);border-width:0}.gram-elements .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.gram-elements .border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.gram-elements .border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.gram-elements .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.gram-elements .border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.gram-elements .border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.gram-elements .border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.gram-elements .border-dashed{--tw-border-style:dashed;border-style:dashed}.gram-elements .border-amber-500{border-color:var(--color-amber-500)}.gram-elements .border-border{border-color:var(--border)}.gram-elements .border-destructive{border-color:var(--destructive)}.gram-elements .border-emerald-700{border-color:var(--color-emerald-700)}.gram-elements .border-foreground\\/20{border-color:var(--foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-foreground\\/20{border-color:color-mix(in oklab,var(--foreground)20%,transparent)}}.gram-elements .border-input{border-color:var(--input)}.gram-elements .border-muted-foreground\\/50{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--muted-foreground)50%,transparent)}}.gram-elements .border-muted-foreground\\/60{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-muted-foreground\\/60{border-color:color-mix(in oklab,var(--muted-foreground)60%,transparent)}}.gram-elements .border-ring{border-color:var(--ring)}.gram-elements .bg-accent{background-color:var(--accent)}.gram-elements .bg-amber-100{background-color:var(--color-amber-100)}.gram-elements .bg-background,.gram-elements .bg-background\\/80{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-background\\/80{background-color:color-mix(in oklab,var(--background)80%,transparent)}}.gram-elements .bg-black{background-color:var(--color-black)}.gram-elements .bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.gram-elements .bg-blue-500{background-color:var(--color-blue-500)}.gram-elements .bg-card{background-color:var(--card)}.gram-elements .bg-destructive,.gram-elements .bg-destructive\\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-destructive\\/10{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.gram-elements .bg-emerald-600{background-color:var(--color-emerald-600)}.gram-elements .bg-foreground{background-color:var(--foreground)}.gram-elements .bg-green-500{background-color:var(--color-green-500)}.gram-elements .bg-muted{background-color:var(--muted)}.gram-elements .bg-muted-foreground\\/15{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-muted-foreground\\/15{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .bg-muted\\/50{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-muted\\/50{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.gram-elements .bg-popover{background-color:var(--popover)}.gram-elements .bg-primary,.gram-elements .bg-primary\\/10{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-primary\\/10{background-color:color-mix(in oklab,var(--primary)10%,transparent)}}.gram-elements .bg-red-300{background-color:var(--color-red-300)}.gram-elements .bg-red-500{background-color:var(--color-red-500)}.gram-elements .bg-secondary{background-color:var(--secondary)}.gram-elements .bg-slate-800\\/90{background-color:#1d293de6}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-slate-800\\/90{background-color:color-mix(in oklab,var(--color-slate-800)90%,transparent)}}.gram-elements .bg-transparent{background-color:#0000}.gram-elements .bg-white{background-color:var(--color-white)}.gram-elements .bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.gram-elements .bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-white\\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.gram-elements .bg-yellow-500{background-color:var(--color-yellow-500)}.gram-elements .bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab,red,red)){.gram-elements .bg-linear-to-r{--tw-gradient-position:to right in oklab}}.gram-elements .bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.gram-elements .bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.gram-elements .bg-\\[linear-gradient\\(to_top\\,var\\(--color-background\\)\\,transparent\\)\\]{background-image:linear-gradient(to top,var(--color-background),transparent)}.gram-elements .from-indigo-600{--tw-gradient-from:var(--color-indigo-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .from-slate-800{--tw-gradient-from:var(--color-slate-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .from-violet-600{--tw-gradient-from:var(--color-violet-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .from-yellow-400{--tw-gradient-from:var(--color-yellow-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .via-purple-600{--tw-gradient-via:var(--color-purple-600);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.gram-elements .via-slate-700{--tw-gradient-via:var(--color-slate-700);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.gram-elements .to-indigo-800{--tw-gradient-to:var(--color-indigo-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .to-orange-500{--tw-gradient-to:var(--color-orange-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .to-slate-900{--tw-gradient-to:var(--color-slate-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.gram-elements .fill-foreground{fill:var(--foreground)}.gram-elements .fill-white{fill:var(--color-white)}.gram-elements .stroke-\\[1\\.5px\\]{stroke-width:1.5px}.gram-elements .object-contain{object-fit:contain}.gram-elements .object-cover{object-fit:cover}.gram-elements .p-0{padding:calc(var(--spacing)*0)}.gram-elements .p-1{padding:calc(var(--spacing)*1)}.gram-elements .p-1\\.5{padding:calc(var(--spacing)*1.5)}.gram-elements .p-2{padding:calc(var(--spacing)*2)}.gram-elements .p-2\\.5{padding:calc(var(--spacing)*2.5)}.gram-elements .p-3{padding:calc(var(--spacing)*3)}.gram-elements .p-4{padding:calc(var(--spacing)*4)}.gram-elements .p-5{padding:calc(var(--spacing)*5)}.gram-elements .p-6{padding:calc(var(--spacing)*6)}.gram-elements .p-10{padding:calc(var(--spacing)*10)}.gram-elements .px-1{padding-inline:calc(var(--spacing)*1)}.gram-elements .px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.gram-elements .px-2{padding-inline:calc(var(--spacing)*2)}.gram-elements .px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.gram-elements .px-3{padding-inline:calc(var(--spacing)*3)}.gram-elements .px-3\\.5{padding-inline:calc(var(--spacing)*3.5)}.gram-elements .px-4{padding-inline:calc(var(--spacing)*4)}.gram-elements .px-5{padding-inline:calc(var(--spacing)*5)}.gram-elements .px-6{padding-inline:calc(var(--spacing)*6)}.gram-elements .px-10{padding-inline:calc(var(--spacing)*10)}.gram-elements .py-1{padding-block:calc(var(--spacing)*1)}.gram-elements .py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.gram-elements .py-2{padding-block:calc(var(--spacing)*2)}.gram-elements .py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.gram-elements .py-3{padding-block:calc(var(--spacing)*3)}.gram-elements .py-4{padding-block:calc(var(--spacing)*4)}.gram-elements .py-6{padding-block:calc(var(--spacing)*6)}.gram-elements .py-10{padding-block:calc(var(--spacing)*10)}.gram-elements .pt-0\\.5{padding-top:calc(var(--spacing)*.5)}.gram-elements .pt-1\\.5{padding-top:calc(var(--spacing)*1.5)}.gram-elements .pt-2{padding-top:calc(var(--spacing)*2)}.gram-elements .pt-4{padding-top:calc(var(--spacing)*4)}.gram-elements .pr-2{padding-right:calc(var(--spacing)*2)}.gram-elements .pb-0\\!{padding-bottom:calc(var(--spacing)*0)!important}.gram-elements .pb-1{padding-bottom:calc(var(--spacing)*1)}.gram-elements .pb-2{padding-bottom:calc(var(--spacing)*2)}.gram-elements .pb-3{padding-bottom:calc(var(--spacing)*3)}.gram-elements .pl-6{padding-left:calc(var(--spacing)*6)}.gram-elements .text-center{text-align:center}.gram-elements .text-left{text-align:left}.gram-elements .text-right{text-align:right}.gram-elements .text-start{text-align:start}.gram-elements .font-mono{font-family:var(--font-mono)}.gram-elements .text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.gram-elements .text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.gram-elements .text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.gram-elements .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.gram-elements .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.gram-elements .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.gram-elements .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.gram-elements .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.gram-elements .leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.gram-elements .leading-none{--tw-leading:1;line-height:1}.gram-elements .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.gram-elements .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.gram-elements .font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.gram-elements .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.gram-elements .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.gram-elements .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.gram-elements .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.gram-elements .text-balance{text-wrap:balance}.gram-elements .wrap-break-word{overflow-wrap:break-word}.gram-elements .whitespace-break-spaces{white-space:break-spaces}.gram-elements .whitespace-nowrap{white-space:nowrap}.gram-elements .whitespace-pre-wrap{white-space:pre-wrap}.gram-elements .text-accent-foreground{color:var(--accent-foreground)}.gram-elements .text-amber-500{color:var(--color-amber-500)}.gram-elements .text-amber-700{color:var(--color-amber-700)}.gram-elements .text-amber-800{color:var(--color-amber-800)}.gram-elements .text-background{color:var(--background)}.gram-elements .text-destructive{color:var(--destructive)}.gram-elements .text-emerald-500{color:var(--color-emerald-500)}.gram-elements .text-foreground{color:var(--foreground)}.gram-elements .text-green-600{color:var(--color-green-600)}.gram-elements .text-muted-foreground,.gram-elements .text-muted-foreground\\/60{color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .text-muted-foreground\\/60{color:color-mix(in oklab,var(--muted-foreground)60%,transparent)}}.gram-elements .text-muted-foreground\\/65{color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .text-muted-foreground\\/65{color:color-mix(in oklab,var(--muted-foreground)65%,transparent)}}.gram-elements .text-popover-foreground{color:var(--popover-foreground)}.gram-elements .text-primary{color:var(--primary)}.gram-elements .text-primary-foreground{color:var(--primary-foreground)}.gram-elements .text-red-500{color:var(--color-red-500)}.gram-elements .text-red-900{color:var(--color-red-900)}.gram-elements .text-rose-500{color:var(--color-rose-500)}.gram-elements .text-secondary-foreground{color:var(--secondary-foreground)}.gram-elements .text-slate-100{color:var(--color-slate-100)}.gram-elements .text-white{color:var(--color-white)}.gram-elements .capitalize{text-transform:capitalize}.gram-elements .lowercase{text-transform:lowercase}.gram-elements .italic{font-style:italic}.gram-elements .ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.gram-elements .underline{text-decoration-line:underline}.gram-elements .underline-offset-4{text-underline-offset:4px}.gram-elements .opacity-10{opacity:.1}.gram-elements .opacity-50{opacity:.5}.gram-elements .opacity-60{opacity:.6}.gram-elements .opacity-70{opacity:.7}.gram-elements .opacity-100{opacity:1}.gram-elements .shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .ring-offset-background{--tw-ring-offset-color:var(--background)}.gram-elements .outline-hidden{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.gram-elements .outline-hidden{outline-offset:2px;outline:2px solid #0000}}.gram-elements .outline{outline-style:var(--tw-outline-style);outline-width:1px}.gram-elements .filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.gram-elements .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-\\[color\\,box-shadow\\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.gram-elements .duration-\\(--animation-duration\\){--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .duration-150{--tw-duration:.15s;transition-duration:.15s}.gram-elements .duration-200{--tw-duration:.2s;transition-duration:.2s}.gram-elements .duration-700{--tw-duration:.7s;transition-duration:.7s}.gram-elements .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.gram-elements .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.gram-elements .fade-in-0{--tw-enter-opacity:0}.gram-elements .outline-none{--tw-outline-style:none;outline-style:none}.gram-elements .zoom-in-95{--tw-enter-scale:.95}.gram-elements .\\[transform-style\\:preserve-3d\\]{transform-style:preserve-3d}.gram-elements .backface-hidden{backface-visibility:hidden}.gram-elements .fade-in{--tw-enter-opacity:0}.gram-elements .perspective-\\[1000px\\]{perspective:1000px}.gram-elements .running{animation-play-state:running}.gram-elements .slide-in-from-bottom-1{--tw-enter-translate-y:calc(1*var(--spacing))}.gram-elements .group-data-\\[state\\=closed\\]\\/collapsible-content\\:animate-out:is(:where(.group\\/collapsible-content)[data-state=closed] *){animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .group-data-\\[state\\=closed\\]\\/collapsible-content\\:duration-\\(--animation-duration\\):is(:where(.group\\/collapsible-content)[data-state=closed] *){--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .group-data-\\[state\\=closed\\]\\/collapsible-content\\:fade-out-0:is(:where(.group\\/collapsible-content)[data-state=closed] *){--tw-exit-opacity:0}.gram-elements .group-data-\\[state\\=closed\\]\\/collapsible-content\\:slide-out-to-top-4:is(:where(.group\\/collapsible-content)[data-state=closed] *){--tw-exit-translate-y:calc(4*var(--spacing)*-1)}.gram-elements .group-data-\\[state\\=closed\\]\\/trigger\\:-rotate-90:is(:where(.group\\/trigger)[data-state=closed] *){rotate:-90deg}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:animate-in:is(:where(.group\\/collapsible-content)[data-state=open] *){animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:animate-out:is(:where(.group\\/collapsible-content)[data-state=open] *){animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:delay-\\[calc\\(var\\(--animation-duration\\)\\*0\\.75\\)\\]:is(:where(.group\\/collapsible-content)[data-state=open] *){transition-delay:calc(var(--animation-duration)*.75)}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:duration-\\(--animation-duration\\):is(:where(.group\\/collapsible-content)[data-state=open] *){--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:delay-\\[calc\\(var\\(--animation-duration\\)\\*0\\.75\\)\\]:is(:where(.group\\/collapsible-content)[data-state=open] *){animation-delay:calc(var(--animation-duration)*.75);--tw-animation-delay:calc(var(--animation-duration)*.75)}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:fade-in-0:is(:where(.group\\/collapsible-content)[data-state=open] *){--tw-enter-opacity:0}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:fade-out-0:is(:where(.group\\/collapsible-content)[data-state=open] *){--tw-exit-opacity:0}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:fill-mode-forwards:is(:where(.group\\/collapsible-content)[data-state=open] *){--tw-animation-fill-mode:forwards;animation-fill-mode:forwards}.gram-elements .group-data-\\[state\\=open\\]\\/collapsible-content\\:slide-in-from-top-4:is(:where(.group\\/collapsible-content)[data-state=open] *){--tw-enter-translate-y:calc(4*var(--spacing)*-1)}.gram-elements .group-data-\\[state\\=open\\]\\/trigger\\:rotate-0:is(:where(.group\\/trigger)[data-state=open] *){rotate:none}.gram-elements .placeholder\\:text-muted-foreground::placeholder{color:var(--muted-foreground)}.gram-elements .after\\:hidden:after{content:var(--tw-content);display:none}.gram-elements .first\\:mt-0:first-child{margin-top:calc(var(--spacing)*0)}.gram-elements .first\\:mt-3:first-child{margin-top:calc(var(--spacing)*3)}.gram-elements .first\\:mt-4:first-child{margin-top:calc(var(--spacing)*4)}.gram-elements .first\\:rounded-tl-lg:first-child{border-top-left-radius:var(--radius)}.gram-elements .first\\:border-t:first-child{border-top-style:var(--tw-border-style);border-top-width:1px}.gram-elements .last\\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}.gram-elements .last\\:mb-5:last-child{margin-bottom:calc(var(--spacing)*5)}.gram-elements .last\\:mb-24:last-child{margin-bottom:calc(var(--spacing)*24)}.gram-elements .last\\:rounded-tr-lg:last-child{border-top-right-radius:var(--radius)}.gram-elements .last\\:border-r:last-child{border-right-style:var(--tw-border-style);border-right-width:1px}.gram-elements .empty\\:hidden:empty{display:none}@media(hover:hover){.gram-elements .hover\\:\\!bg-white:hover{background-color:var(--color-white)!important}.gram-elements .hover\\:bg-accent:hover,.gram-elements .hover\\:bg-accent\\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.gram-elements .hover\\:bg-destructive\\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-destructive\\/10:hover{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.gram-elements .hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.gram-elements .hover\\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.gram-elements .hover\\:bg-muted:hover{background-color:var(--muted)}.gram-elements .hover\\:bg-muted-foreground\\/10:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--muted-foreground)10%,transparent)}}.gram-elements .hover\\:bg-muted-foreground\\/15:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-muted-foreground\\/15:hover{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .hover\\:bg-primary\\/75:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-primary\\/75:hover{background-color:color-mix(in oklab,var(--primary)75%,transparent)}}.gram-elements .hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.gram-elements .hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.gram-elements .hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.gram-elements .hover\\:text-amber-800:hover{color:var(--color-amber-800)}.gram-elements .hover\\:text-foreground:hover{color:var(--foreground)}.gram-elements .hover\\:underline:hover{text-decoration-line:underline}.gram-elements .hover\\:opacity-70:hover{opacity:.7}.gram-elements .hover\\:opacity-75:hover{opacity:.75}.gram-elements .hover\\:opacity-100:hover{opacity:1}.gram-elements .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.gram-elements .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus\\:ring-ring:focus{--tw-ring-color:var(--ring)}.gram-elements .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.gram-elements .focus\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.gram-elements .focus\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.gram-elements .focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.gram-elements .focus-visible\\:border-ring:focus-visible{border-color:var(--ring)}.gram-elements .focus-visible\\:bg-muted:focus-visible{background-color:var(--muted)}.gram-elements .focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.gram-elements .focus-visible\\:ring-ring:focus-visible,.gram-elements .focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.gram-elements .focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.gram-elements .focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.gram-elements .disabled\\:pointer-events-none:disabled{pointer-events:none}.gram-elements .disabled\\:invisible:disabled{visibility:hidden}.gram-elements .disabled\\:opacity-50:disabled{opacity:.5}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:border-ring:has(:is(textarea:focus-visible)){border-color:var(--ring)}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-1:has(:is(textarea:focus-visible)){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-ring\\/5:has(:is(textarea:focus-visible)){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-ring\\/5:has(:is(textarea:focus-visible)){--tw-ring-color:color-mix(in oklab,var(--ring)5%,transparent)}}.gram-elements .has-\\[\\>svg\\]\\:px-2\\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.gram-elements .has-\\[\\>svg\\]\\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.gram-elements .has-\\[\\>svg\\]\\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.gram-elements .aria-invalid\\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.gram-elements .aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.gram-elements .data-floating\\:absolute[data-floating]{position:absolute}.gram-elements .data-floating\\:rounded-md[data-floating]{border-radius:calc(var(--radius) - 2px)}.gram-elements .data-floating\\:border[data-floating]{border-style:var(--tw-border-style);border-width:1px}.gram-elements .data-floating\\:bg-background[data-floating]{background-color:var(--background)}.gram-elements .data-floating\\:p-1[data-floating]{padding:calc(var(--spacing)*1)}.gram-elements .data-floating\\:shadow-sm[data-floating]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20[data-active=true]{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20[data-active=true]{background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20\\![data-active=true]{background-color:var(--muted-foreground)!important}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20\\![data-active=true]{background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)!important}}.gram-elements .data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.gram-elements .data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.gram-elements .data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.gram-elements .data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.gram-elements .data-\\[state\\=closed\\]\\:pointer-events-none[data-state=closed]{pointer-events:none}.gram-elements .data-\\[state\\=closed\\]\\:scale-100[data-state=closed]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.gram-elements .data-\\[state\\=closed\\]\\:rotate-0[data-state=closed]{rotate:none}.gram-elements .data-\\[state\\=closed\\]\\:animate-collapsible-up[data-state=closed]{animation:collapsible-up var(--tw-animation-duration,var(--tw-duration,.2s))var(--tw-ease,ease-out)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=closed\\]\\:duration-\\(--animation-duration\\)[data-state=closed]{--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.gram-elements .data-\\[state\\=closed\\]\\:fill-mode-forwards[data-state=closed]{--tw-animation-fill-mode:forwards;animation-fill-mode:forwards}.gram-elements .data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.gram-elements .data-\\[state\\=open\\]\\:scale-0[data-state=open]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.gram-elements .data-\\[state\\=open\\]\\:rotate-90[data-state=open]{rotate:90deg}.gram-elements .data-\\[state\\=open\\]\\:animate-collapsible-down[data-state=open]{animation:collapsible-down var(--tw-animation-duration,var(--tw-duration,.2s))var(--tw-ease,ease-out)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:var(--accent)}.gram-elements .data-\\[state\\=open\\]\\:bg-muted-foreground\\/15[data-state=open]{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[state\\=open\\]\\:bg-muted-foreground\\/15[data-state=open]{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.gram-elements .data-\\[state\\=open\\]\\:duration-\\(--animation-duration\\)[data-state=open]{--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.gram-elements .data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.gram-elements .nth-\\[n\\+3\\]\\:hidden:nth-child(n+3){display:none}@media(prefers-reduced-motion:reduce){.gram-elements .motion-reduce\\:animate-none{animation:none}}@media(min-width:40rem){.gram-elements .sm\\:w-3\\/4{width:75%}.gram-elements .sm\\:max-w-3xl{max-width:var(--container-3xl)}.gram-elements .sm\\:max-w-lg{max-width:var(--container-lg)}.gram-elements .sm\\:flex-row{flex-direction:row}.gram-elements .sm\\:justify-end{justify-content:flex-end}.gram-elements .sm\\:text-left{text-align:left}}@container (min-width:28rem){.gram-elements .\\@md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.gram-elements .\\@md\\:nth-\\[n\\+3\\]\\:block:nth-child(n+3){display:block}}.gram-elements .dark\\:border-amber-600:is(.dark *){border-color:var(--color-amber-600)}.gram-elements .dark\\:border-input:is(.dark *){border-color:var(--input)}.gram-elements .dark\\:border-muted-foreground\\/15:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:border-muted-foreground\\/15:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .dark\\:border-muted-foreground\\/90:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:border-muted-foreground\\/90:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)90%,transparent)}}.gram-elements .dark\\:bg-amber-900\\/30:is(.dark *){background-color:#7b33064d}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-amber-900\\/30:is(.dark *){background-color:color-mix(in oklab,var(--color-amber-900)30%,transparent)}}.gram-elements .dark\\:bg-background:is(.dark *){background-color:var(--background)}.gram-elements .dark\\:bg-destructive\\/5:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-destructive\\/5:is(.dark *){background-color:color-mix(in oklab,var(--destructive)5%,transparent)}}.gram-elements .dark\\:bg-destructive\\/60:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-destructive\\/60:is(.dark *){background-color:color-mix(in oklab,var(--destructive)60%,transparent)}}.gram-elements .dark\\:bg-input\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-input\\/30:is(.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.gram-elements .dark\\:bg-muted-foreground\\/20:is(.dark *){background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-muted-foreground\\/20:is(.dark *){background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.gram-elements .dark\\:fill-black:is(.dark *){fill:var(--color-black)}.gram-elements .dark\\:stroke-\\[2\\.5px\\]:is(.dark *){stroke-width:2.5px}.gram-elements .dark\\:text-amber-200:is(.dark *){color:var(--color-amber-200)}.gram-elements .dark\\:text-amber-300:is(.dark *){color:var(--color-amber-300)}.gram-elements .dark\\:text-green-500:is(.dark *){color:var(--color-green-500)}.gram-elements .dark\\:text-red-200:is(.dark *){color:var(--color-red-200)}@media(hover:hover){.gram-elements .dark\\:hover\\:bg-accent:is(.dark *):hover,.gram-elements .dark\\:hover\\:bg-accent\\/50:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:hover\\:bg-accent\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.gram-elements .dark\\:hover\\:bg-accent\\/60:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:hover\\:bg-accent\\/60:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)60%,transparent)}}.gram-elements .dark\\:hover\\:bg-input\\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:hover\\:bg-input\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--input)50%,transparent)}}.gram-elements .dark\\:hover\\:bg-muted-foreground\\/30:is(.dark *):hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:hover\\:bg-muted-foreground\\/30:is(.dark *):hover{background-color:color-mix(in oklab,var(--muted-foreground)30%,transparent)}}.gram-elements .dark\\:hover\\:text-amber-200:is(.dark *):hover{color:var(--color-amber-200)}}.gram-elements .dark\\:focus-visible\\:ring-destructive\\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:focus-visible\\:ring-destructive\\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.gram-elements .dark\\:aria-invalid\\:ring-destructive\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:aria-invalid\\:ring-destructive\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.gram-elements .\\[\\&_p\\]\\:-mb-2 p{margin-bottom:calc(var(--spacing)*-2)}.gram-elements .\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.gram-elements .\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.gram-elements .\\[\\&_svg\\]\\:text-background svg{color:var(--background)}.gram-elements .\\[\\&_svg\\]\\:text-black svg{color:var(--color-black)}@media(hover:hover){.gram-elements .hover\\:\\[\\&_svg\\]\\:text-destructive:hover svg{color:var(--destructive)}}.gram-elements .\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.gram-elements .\\[\\[align\\=center\\]\\]\\:text-center[align=center]{text-align:center}.gram-elements .\\[\\[align\\=right\\]\\]\\:text-right[align=right]{text-align:right}.gram-elements .\\[\\&\\:last-child\\>td\\:first-child\\]\\:rounded-bl-lg:last-child>td:first-child{border-bottom-left-radius:var(--radius)}.gram-elements .\\[\\&\\:last-child\\>td\\:last-child\\]\\:rounded-br-lg:last-child>td:last-child{border-bottom-right-radius:var(--radius)}.gram-elements .only\\:\\[\\&\\>\\#attachment-tile\\]\\:size-24:only-child>#attachment-tile{width:calc(var(--spacing)*24);height:calc(var(--spacing)*24)}.gram-elements .\\[\\&\\>\\.aui-thread-root\\]\\:bg-inherit>.aui-thread-root{background-color:inherit}.gram-elements .\\[\\&\\>a\\]\\:text-xs>a{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.gram-elements .\\[\\&\\>a\\]\\:no-underline>a{text-decoration-line:none}.gram-elements .\\[\\&\\>button\\]\\:rounded-full>button{border-radius:3.40282e38px}.gram-elements .\\[\\&\\>button\\]\\:bg-foreground\\/60>button{background-color:var(--foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .\\[\\&\\>button\\]\\:bg-foreground\\/60>button{background-color:color-mix(in oklab,var(--foreground)60%,transparent)}}.gram-elements .\\[\\&\\>button\\]\\:p-1>button{padding:calc(var(--spacing)*1)}.gram-elements .\\[\\&\\>button\\]\\:opacity-100>button{opacity:1}.gram-elements .\\[\\&\\>button\\]\\:\\!ring-0>button{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}@media(hover:hover){.gram-elements .\\[\\&\\>button\\]\\:hover\\:\\[\\&_svg\\]\\:text-destructive>button:hover svg{color:var(--destructive)}}.gram-elements .\\[\\&\\>li\\]\\:mt-2>li{margin-top:calc(var(--spacing)*2)}.gram-elements .\\[\\&\\>span\\]\\:text-xs>span{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.gram-elements *,.gram-elements :before,.gram-elements :after{box-sizing:border-box;border-style:solid;border-width:0;border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.gram-elements *,.gram-elements :before,.gram-elements :after{outline-color:color-mix(in oklab,var(--ring)50%,transparent)}}.gram-elements h1,.gram-elements h2,.gram-elements h3,.gram-elements h4,.gram-elements h5,.gram-elements h6,.gram-elements p,.gram-elements blockquote,.gram-elements pre,.gram-elements ul,.gram-elements ol,.gram-elements figure{margin:0;padding:0}.gram-elements ul,.gram-elements ol{list-style:none}.gram-elements img,.gram-elements svg,.gram-elements video,.gram-elements canvas,.gram-elements audio,.gram-elements iframe,.gram-elements embed,.gram-elements object{display:block}.gram-elements img,.gram-elements video{max-width:100%;height:auto}.gram-elements button,.gram-elements input,.gram-elements optgroup,.gram-elements select,.gram-elements textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}.gram-elements button,.gram-elements select{text-transform:none}.gram-elements button,.gram-elements input:where([type=button]),.gram-elements input:where([type=reset]),.gram-elements input:where([type=submit]){appearance:button;background-color:#0000;background-image:none}.gram-elements a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.gram-elements table{text-indent:0;border-color:inherit;border-collapse:collapse}}@layer components,utilities;.gram-elements{font-feature-settings:normal;font-variation-settings:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;tab-size:4;--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.1% .005 285.823);--card:oklch(100% 0 0);--card-foreground:oklch(14.1% .005 285.823);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.1% .005 285.823);--primary:oklch(21% .006 285.885);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(96.7% .001 286.375);--secondary-foreground:oklch(21% .006 285.885);--muted:oklch(96.7% .001 286.375);--muted-foreground:oklch(55.2% .016 285.938);--accent:oklch(96.7% .001 286.375);--accent-foreground:oklch(21% .006 285.885);--destructive:oklch(57.7% .245 27.325);--border:oklch(92% .004 286.32);--input:oklch(92% .004 286.32);--ring:oklch(70.5% .015 286.067);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.1% .005 285.823);--sidebar-primary:oklch(21% .006 285.885);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(96.7% .001 286.375);--sidebar-accent-foreground:oklch(21% .006 285.885);--sidebar-border:oklch(92% .004 286.32);--sidebar-ring:oklch(70.5% .015 286.067);font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}.gram-elements.dark,.dark .gram-elements{--background:oklch(14.1% .005 285.823);--foreground:oklch(98.5% 0 0);--card:oklch(21% .006 285.885);--card-foreground:oklch(98.5% 0 0);--popover:oklch(21% .006 285.885);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92% .004 286.32);--primary-foreground:oklch(21% .006 285.885);--secondary:oklch(27.4% .006 286.033);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27.4% .006 286.033);--muted-foreground:oklch(70.5% .015 286.067);--accent:oklch(27.4% .006 286.033);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.2% .016 285.938);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(21% .006 285.885);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(27.4% .006 286.033);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.2% .016 285.938)}.gram-elements[data-radius=sharp],[data-radius=sharp] .gram-elements{--radius:.25rem}.gram-elements[data-radius=soft],[data-radius=soft] .gram-elements{--radius:.625rem}.gram-elements[data-radius=round],[data-radius=round] .gram-elements{--radius:1rem}.gram-elements[data-radius=pill],[data-radius=pill] .gram-elements{--radius:9999px}@keyframes aui-pulse{50%{opacity:.5}}.gram-elements :where(.aui-md[data-status=running]):empty:after,.gram-elements :where(.aui-md[data-status=running])>:where(:not(ol):not(ul):not(pre)):last-child:after,.gram-elements :where(.aui-md[data-status=running])>pre:last-child code:after,.gram-elements :where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,.gram-elements :where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,.gram-elements :where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child):after{--aui-content:"●";content:var(--aui-content);margin-left:.25rem;margin-right:.25rem;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;animation:2s cubic-bezier(.4,0,.6,1) infinite aui-pulse}@property --tw-border-spacing-x{syntax:"<length>";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:"<length>";inherits:false;initial-value:0}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0));filter:blur(var(--tw-enter-blur,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0));filter:blur(var(--tw-exit-blur,0))}}@keyframes collapsible-down{0%{height:0}to{height:var(--radix-collapsible-content-height,var(--bits-collapsible-content-height,var(--reka-collapsible-content-height,var(--kb-collapsible-content-height,auto))))}}@keyframes collapsible-up{0%{height:var(--radix-collapsible-content-height,var(--bits-collapsible-content-height,var(--reka-collapsible-content-height,var(--kb-collapsible-content-height,auto))))}to{height:0}}@keyframes tw-shimmer{0%{background-position:100% 0}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`,G1=({children:e,hostClassName:t,hostStyle:r})=>{const o=N.useRef(null),n=N.useRef(null),[i,a]=N.useState(null),{config:s}=$.useElements(),c=cl(),l=N.useMemo(()=>$.cn(Qm,c.className),[c.className]);return N.useEffect(()=>{const u=o.current;if(!u)return;const d=u.shadowRoot??u.attachShadow({mode:"open"});a(d)},[]),N.useEffect(()=>{if(!i)return;const u=i.querySelector("style[data-gram-elements]");if(u){u.textContent=mu;return}const d=document.createElement("style");d.setAttribute("data-gram-elements","true"),d.textContent=mu,i.prepend(d)},[i,mu]),p.jsx("div",{ref:o,className:t,style:r,children:i?fd.createPortal(p.jsx("div",{ref:n,className:l,"data-radius":s.theme?.radius,style:{height:"100%",width:"100%"},children:p.jsx($W,{containerRef:n,children:e})}),i):null})};function pu({children:e}){return p.jsx(G1,{hostStyle:{height:"inherit",width:"inherit"},children:e})}const OW=({className:e})=>{const{config:t}=$.useElements();switch(t.variant){case"standalone":return p.jsx(tp,{children:p.jsx(pu,{children:p.jsx(Op,{})})});case"sidecar":return p.jsx(pu,{children:p.jsx(TW,{})});default:return p.jsx(pu,{children:p.jsx(EW,{className:e})})}},AW=({className:e})=>p.jsx(G1,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(Ap,{className:e})});exports.ActionType=Lc;exports.CENSORED_IMG_MARK=BM;exports.CENSORED_STRING_MARK=Ma;exports.Chat=OW;exports.ChatHistory=AW;exports.ElementsProvider=BB;exports.MODELS=Pm;exports.NodePrivacyLevel=ae;exports.ONE_SECOND=Ke;exports.PRIVACY_ATTR_NAME=Cm;exports.PRIVACY_ATTR_VALUE_HIDDEN=VM;exports.RumEventType=te;exports.addEventListener=Oe;exports.addEventListeners=hr;exports.addRecord=P6;exports.addSegment=R6;exports.addTelemetryDebug=_o;exports.addTelemetryMetrics=ea;exports.addWroteData=j6;exports.buildTags=_m;exports.buildUrl=Ki;exports.canUseEventBridge=sn;exports.clearTimeout=vt;exports.clocksNow=Ue;exports.clocksOrigin=mm;exports.createHttpRequest=Sm;exports.currentDrift=DS;exports.defineFrontendTool=mL;exports.display=Q;exports.elapsed=Ne;exports.forEachChildNodes=OM;exports.getEventBridge=yo;exports.getGlobalObject=It;exports.getMutationObserverConstructor=Bk;exports.getNodePrivacyLevel=ra;exports.getNodeSelfPrivacyLevel=cE;exports.getParentNode=tE;exports.getScrollX=gU;exports.getScrollY=IE;exports.getSegmentsCount=N6;exports.getTextContent=HM;exports.getViewportDimension=Zc;exports.hasChildNodes=$M;exports.initViewportObservable=TE;exports.instrumentMethod=Bt;exports.instrumentSetter=g2;exports.isNodeShadowHost=Om;exports.isNodeShadowRoot=eE;exports.isPageExitReason=_k;exports.isSafari=XP;exports.jsonStringify=ho;exports.monitor=ne;exports.monitorError=pr;exports.noop=_e;exports.objectEntries=jc;exports.reducePrivacyLevel=sE;exports.relativeToClocks=Hi;exports.requestIdleCallback=Ck;exports.sanitizeIfLongDataUrl=Jk;exports.sendToExtension=wm;exports.setTimeout=Je;exports.shouldMaskAttribute=lE;exports.shouldMaskNode=Nm;exports.supportPerformanceTimingEvent=Zr;exports.throttle=Ji;exports.timeStampNow=Be;exports.trackError=gs;
|
|
145
|
+
//# sourceMappingURL=index-DSGCuihM.cjs.map
|