@gram-ai/elements 1.21.1 → 1.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/components/Chat/stories/StyleIsolation.stories.d.ts +6 -0
  2. package/dist/components/Chat/stories/Theme.stories.d.ts +8 -0
  3. package/dist/components/ChatHistory.d.ts +5 -0
  4. package/dist/components/ShadowRoot.d.ts +8 -0
  5. package/dist/elements.cjs +1 -1
  6. package/dist/elements.css +1 -1
  7. package/dist/elements.js +1 -1
  8. package/dist/embedded.d.ts +0 -0
  9. package/dist/hooks/useGramThreadListAdapter.d.ts +7 -0
  10. package/dist/hooks/useMCPTools.d.ts +2 -1
  11. package/dist/index-CKBUBkLd.js +37757 -0
  12. package/dist/index-CKBUBkLd.js.map +1 -0
  13. package/dist/index-D5cSC22A.cjs +144 -0
  14. package/dist/index-D5cSC22A.cjs.map +1 -0
  15. package/dist/index.d.ts +1 -1
  16. package/dist/{profiler-j7uDglf5.cjs → profiler-BY6U7KRN.cjs} +2 -2
  17. package/dist/{profiler-j7uDglf5.cjs.map → profiler-BY6U7KRN.cjs.map} +1 -1
  18. package/dist/{profiler-WPgSewiM.js → profiler-CRozVGVC.js} +2 -2
  19. package/dist/{profiler-WPgSewiM.js.map → profiler-CRozVGVC.js.map} +1 -1
  20. package/dist/{startRecording-Cahc4WH4.cjs → startRecording-Bi82O_dZ.cjs} +2 -2
  21. package/dist/{startRecording-Cahc4WH4.cjs.map → startRecording-Bi82O_dZ.cjs.map} +1 -1
  22. package/dist/{startRecording-DpwlHYPJ.js → startRecording-DQXktVbB.js} +2 -2
  23. package/dist/{startRecording-DpwlHYPJ.js.map → startRecording-DQXktVbB.js.map} +1 -1
  24. package/dist/types/index.d.ts +6 -0
  25. package/package.json +13 -4
  26. package/src/components/Chat/index.tsx +4 -13
  27. package/src/components/Chat/stories/StyleIsolation.stories.tsx +41 -0
  28. package/src/components/Chat/stories/Theme.stories.tsx +74 -0
  29. package/src/components/Chat/stories/ToolApproval.stories.tsx +0 -1
  30. package/src/components/ChatHistory.tsx +16 -0
  31. package/src/components/ShadowRoot.tsx +90 -0
  32. package/src/components/assistant-ui/markdown-text.tsx +0 -2
  33. package/src/components/assistant-ui/thread-list.tsx +1 -3
  34. package/src/components/assistant-ui/thread.tsx +3 -4
  35. package/src/contexts/ElementsProvider.tsx +65 -9
  36. package/src/embedded.ts +3 -0
  37. package/src/global.css +45 -0
  38. package/src/hooks/useGramThreadListAdapter.tsx +90 -9
  39. package/src/hooks/useMCPTools.ts +4 -1
  40. package/src/index.ts +1 -1
  41. package/src/types/index.ts +7 -0
  42. package/src/vite-env.d.ts +5 -0
  43. package/dist/index-B48xzOEm.cjs +0 -169
  44. package/dist/index-B48xzOEm.cjs.map +0 -1
  45. package/dist/index-C-iaUGd_.js +0 -54687
  46. package/dist/index-C-iaUGd_.js.map +0 -1
@@ -0,0 +1,144 @@
1
+ "use strict";const p=require("react/jsx-runtime"),T=require("./index-D8g4LkEy.cjs"),P=require("react"),M=require("@assistant-ui/react"),dd=require("@assistant-ui/react-ai-sdk"),ur=require("motion/react"),W1=require("motion/react-m"),J1=require("zustand/shallow"),fd=require("react-dom"),hu=require("@assistant-ui/react-markdown"),K1=require("remark-gfm"),Y1=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(P),sr=md(W1),Fv=md(fd);function Vv({tools:e}){return p.jsx(p.Fragment,{children:Object.entries(e).map(([,t])=>t({}))})}var Zv="vercel.ai.error",X1=Symbol.for(Zv),Bv,Q1=class qv extends Error{constructor({name:t,message:r,cause:o}){super(r),this[Bv]=!0,this.name=t,this.cause=o}static isInstance(t){return qv.hasMarker(t,Zv)}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}};Bv=X1;var ee=Q1,Gv="AI_APICallError",Hv=`vercel.ai.error.${Gv}`,eO=Symbol.for(Hv),Wv,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:Gv,message:t,cause:s}),this[Wv]=!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,Hv)}};Wv=eO;var Jv="AI_EmptyResponseBodyError",Kv=`vercel.ai.error.${Jv}`,tO=Symbol.for(Kv),Yv,rO=class extends ee{constructor({message:t="Empty response body"}={}){super({name:Jv,message:t}),this[Yv]=!0}static isInstance(t){return ee.hasMarker(t,Kv)}};Yv=tO;function uo(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Xv="AI_InvalidArgumentError",Qv=`vercel.ai.error.${Xv}`,nO=Symbol.for(Qv),ey,pd=class extends ee{constructor({message:t,cause:r,argument:o}){super({name:Xv,message:t,cause:r}),this[ey]=!0,this.argument=o}static isInstance(t){return ee.hasMarker(t,Qv)}};ey=nO;var ty="AI_InvalidPromptError",ry=`vercel.ai.error.${ty}`,oO=Symbol.for(ry),ny,In=class extends ee{constructor({prompt:t,message:r,cause:o}){super({name:ty,message:`Invalid prompt: ${r}`,cause:o}),this[ny]=!0,this.prompt=t}static isInstance(t){return ee.hasMarker(t,ry)}};ny=oO;var oy="AI_JSONParseError",iy=`vercel.ai.error.${oy}`,iO=Symbol.for(iy),ay,Ha=class extends ee{constructor({text:t,cause:r}){super({name:oy,message:`JSON parsing failed: Text: ${t}.
2
+ Error message: ${uo(r)}`,cause:r}),this[ay]=!0,this.text=t}static isInstance(t){return ee.hasMarker(t,iy)}};ay=iO;var sy="AI_NoSuchModelError",cy=`vercel.ai.error.${sy}`,aO=Symbol.for(cy),ly,sO=class extends ee{constructor({errorName:e=sy,modelId:t,modelType:r,message:o=`No such ${r}: ${t}`}){super({name:e,message:o}),this[ly]=!0,this.modelId=t,this.modelType=r}static isInstance(e){return ee.hasMarker(e,cy)}};ly=aO;var uy="AI_TypeValidationError",dy=`vercel.ai.error.${uy}`,cO=Symbol.for(dy),fy,lO=class gu extends ee{constructor({value:t,cause:r}){super({name:uy,message:`Type validation failed: Value: ${JSON.stringify(t)}.
3
+ Error message: ${uo(r)}`,cause:r}),this[fy]=!0,this.value=t}static isInstance(t){return ee.hasMarker(t,dy)}static wrap({value:t,cause:r}){return gu.isInstance(r)&&r.value===t?r:new gu({value:t,cause:r})}};fy=cO;var Jo=lO;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 uO(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(h){const v=a?h.replace(/^\xEF\xBB\xBF/,""):h,[b,w]=dO(`${i}${v}`);for(const I of b)d(I);i=w,a=!1}function d(h){if(h===""){m();return}if(h.startsWith(":")){n&&n(h.slice(h.startsWith(": ")?2:1));return}const v=h.indexOf(":");if(v!==-1){const b=h.slice(0,v),w=h[v+1]===" "?2:1,I=h.slice(v+w);f(b,I,h);return}f(h,"",h)}function f(h,v,b){switch(h){case"event":l=v;break;case"data":c=`${c}${v}
4
+ `;break;case"id":s=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?o(parseInt(v,10)):r(new Fp(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:b}));break;default:r(new Fp(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:v,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 g(h={}){i&&h.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:g}}function dO(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=uO({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 hd=Object.freeze({status:"aborted"});function $(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 my=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 fO(e){return e}function mO(e){return e}function pO(e){}function hO(e){throw new Error("Unexpected value in exhaustive check")}function gO(e){}function gd(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 N(e,t="|"){return e.map(r=>J(r)).join(t)}function Ka(e,t){return typeof t=="bigint"?t.toString():t}function wi(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 py(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 vO(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 _r(...e){const t={};for(const r of e){const o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function yO(e){return _r(e._zod.def)}function bO(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function _O(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 wO(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 gy=wi(()=>{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 xO(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const SO=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"]),vy=new Set(["string","number","bigint","boolean","symbol","undefined"]);function dr(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 A(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 kO(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 yy(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const by={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]},_y={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function wy(e,t){const r=e._zod.def,o=_r(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 xy(e,t){const r=e._zod.def,o=_r(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 Sy(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=_r(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Fr(this,"shape",i),i},checks:[]});return Nt(e,n)}function ky(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 Ey(e,t){const r=_r(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 Iy(e,t,r){const o=_r(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=_r(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 Ut(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Lo(e){return typeof e=="string"?e:e?.message}function At(e,t,r){const o={...e,path:e.path??[]};if(!e.message){const n=Lo(e.inst?._zod.def?.error?.(e))??Lo(t?.error?.(e))??Lo(r.customError?.(e))??Lo(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function zs(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ds(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 EO(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ty(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 Oy(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function IO(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Ty(t+r)}function $O(e){return Oy(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function TO(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 OO(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class AO{constructor(...t){}}const Ay=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:_y,Class:AO,NUMBER_FORMAT_RANGES:by,aborted:Kr,allowsEval:gy,assert:gO,assertEqual:fO,assertIs:pO,assertNever:hO,assertNotEqual:mO,assignProp:Fr,base64ToUint8Array:Ty,base64urlToUint8Array:IO,cached:wi,captureStackTrace:vd,cleanEnum:EO,cleanRegex:Ps,clone:Nt,cloneDef:yO,createTransparentProxy:kO,defineLazy:de,esc:vu,escapeRegex:dr,extend:Sy,finalizeIssue:At,floatSafeRemainder:py,getElementAtPath:bO,getEnumValues:gd,getLengthableOrigin:Ds,getParsedType:SO,getSizableOrigin:zs,hexToUint8Array:TO,isObject:Gn,isPlainObject:nn,issue:Hn,joinValues:N,jsonStringifyReplacer:Ka,merge:Ey,mergeDefs:_r,normalizeParams:A,nullish:pn,numKeys:xO,objectClone:vO,omit:xy,optionalKeys:yy,partial:Iy,pick:wy,prefixIssues:Ut,primitiveTypes:vy,promiseAllObject:_O,propertyKeyTypes:Ya,randomString:wO,required:$y,safeExtend:ky,shallowClone:js,slugify:hy,stringifyPrimitive:J,uint8ArrayToBase64:Oy,uint8ArrayToBase64url:$O,uint8ArrayToHex:OO,unwrapMessage:Lo},Symbol.toStringTag,{value:"Module"})),Cy=(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=$("$ZodError",Cy),kt=$("$ZodError",Cy,{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 Ny(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 Ry(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 Py(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 ${Ry(o.path)}`);return t.join(`
8
+ `)}const xi=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=xi(kt),Si=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=Si(kt),ki=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}},jy=ki(kt),Ei=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=Ei(kt),wd=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return xi(e)(t,r,n)},CO=wd(kt),xd=e=>(t,r,o)=>xi(e)(t,r,o),NO=xd(kt),Sd=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Si(e)(t,r,n)},RO=Sd(kt),kd=e=>async(t,r,o)=>Si(e)(t,r,o),PO=kd(kt),Ed=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ki(e)(t,r,n)},jO=Ed(kt),Id=e=>(t,r,o)=>ki(e)(t,r,o),zO=Id(kt),$d=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ei(e)(t,r,n)},DO=$d(kt),Td=e=>async(t,r,o)=>Ei(e)(t,r,o),MO=Td(kt),Dy=/^[cC][^\s-]{8,}$/,My=/^[0-9a-z]+$/,Uy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ly=/^[0-9a-vA-V]{20}$/,Fy=/^[A-Za-z0-9]{27}$/,Vy=/^[a-zA-Z0-9_-]{21}$/,Zy=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,UO=/^[-+]?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)?)??$/,By=/^([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)$/,LO=Wn(4),FO=Wn(6),VO=Wn(7),qy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ZO=/^[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])?)*$/,BO=/^(([^<>()\[\]\\.,;:\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,}))$/,Gy=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qO=Gy,GO=/^[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])?)*$/,HO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Hy(){return new RegExp(HO,"u")}const Wy=/^(?:(?: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])$/,Jy=/^(([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}|:))$/,Ky=e=>{const t=dr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Yy=/^((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])$/,Xy=/^(([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])$/,Qy=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Od=/^[A-Za-z0-9_-]*$/,eb=/^(?=.{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])?)*\.?$/,tb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,rb=/^\+(?:[0-9]){6,14}[0-9]$/,nb="(?:(?:\\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])))",ob=new RegExp(`^${nb}$`);function ib(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 ab(e){return new RegExp(`^${ib(e)}$`)}function sb(e){const t=ib({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(`^${nb}T(?:${o})$`)}const cb=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},lb=/^-?\d+n?$/,ub=/^-?\d+$/,db=/^-?\d+(?:\.\d+)?/,fb=/^(?:true|false)$/i,mb=/^null$/i,pb=/^undefined$/i,hb=/^[^A-Z]*$/,gb=/^[^a-z]*$/,vb=/^[0-9a-fA-F]*$/;function Ii(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function $i(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const WO=/^[0-9a-fA-F]{32}$/,JO=Ii(22,"=="),KO=$i(22),YO=/^[0-9a-fA-F]{40}$/,XO=Ii(27,"="),QO=$i(27),eA=/^[0-9a-fA-F]{64}$/,tA=Ii(43,"="),rA=$i(43),nA=/^[0-9a-fA-F]{96}$/,oA=Ii(64,""),iA=$i(64),aA=/^[0-9a-fA-F]{128}$/,sA=Ii(86,"=="),cA=$i(86),Ad=Object.freeze(Object.defineProperty({__proto__:null,base64:Qy,base64url:Od,bigint:lb,boolean:fb,browserEmail:GO,cidrv4:Yy,cidrv6:Xy,cuid:Dy,cuid2:My,date:ob,datetime:sb,domain:tb,duration:Zy,e164:rb,email:qy,emoji:Hy,extendedDuration:UO,guid:By,hex:vb,hostname:eb,html5Email:ZO,idnEmail:qO,integer:ub,ipv4:Wy,ipv6:Jy,ksuid:Fy,lowercase:hb,mac:Ky,md5_base64:JO,md5_base64url:KO,md5_hex:WO,nanoid:Vy,null:mb,number:db,rfc5322Email:BO,sha1_base64:XO,sha1_base64url:QO,sha1_hex:YO,sha256_base64:tA,sha256_base64url:rA,sha256_hex:eA,sha384_base64:oA,sha384_base64url:iA,sha384_hex:nA,sha512_base64:sA,sha512_base64url:cA,sha512_hex:aA,string:cb,time:ab,ulid:Uy,undefined:pb,unicodeEmail:Gy,uppercase:gb,uuid:Wn,uuid4:LO,uuid6:FO,uuid7:VO,xid:Ly},Symbol.toStringTag,{value:"Module"})),Ae=$("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),yb={number:"number",bigint:"bigint",object:"date"},Cd=$("$ZodCheckLessThan",(e,t)=>{Ae.init(e,t);const r=yb[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=$("$ZodCheckGreaterThan",(e,t)=>{Ae.init(e,t);const r=yb[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})}}),bb=$("$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):py(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})}}),_b=$("$ZodCheckNumberFormat",(e,t)=>{Ae.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),o=r?"int":"number",[n,i]=by[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=ub)}),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})}}),wb=$("$ZodCheckBigIntFormat",(e,t)=>{Ae.init(e,t);const[r,o]=_y[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})}}),xb=$("$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:zs(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Sb=$("$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:zs(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),kb=$("$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:zs(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})}}),Eb=$("$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=Ds(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ib=$("$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=Ds(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),$b=$("$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=Ds(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})}}),Ti=$("$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=()=>{})}),Tb=$("$ZodCheckRegex",(e,t)=>{Ti.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})}}),Ob=$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hb),Ti.init(e,t)}),Ab=$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=gb),Ti.init(e,t)}),Cb=$("$ZodCheckIncludes",(e,t)=>{Ae.init(e,t);const r=dr(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})}}),Nb=$("$ZodCheckStartsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`^${dr(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})}}),Rb=$("$ZodCheckEndsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`.*${dr(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(...Ut(r,e.issues))}const Pb=$("$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)}}),jb=$("$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=$("$ZodCheckOverwrite",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Db{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 Mb={major:4,minor:2,patch:1},Y=$("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mb;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=jy(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}}),Oi=$("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??cb(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=$("$ZodStringFormat",(e,t)=>{Ti.init(e,t),Oi.init(e,t)}),Ub=$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=By),Ee.init(e,t)}),Lb=$("$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)}),Fb=$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=qy),Ee.init(e,t)}),Vb=$("$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})}}}),Zb=$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Hy()),Ee.init(e,t)}),Bb=$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Vy),Ee.init(e,t)}),qb=$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Dy),Ee.init(e,t)}),Gb=$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=My),Ee.init(e,t)}),Hb=$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Uy),Ee.init(e,t)}),Wb=$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ly),Ee.init(e,t)}),Jb=$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Fy),Ee.init(e,t)}),Kb=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=sb(t)),Ee.init(e,t)}),Yb=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ob),Ee.init(e,t)}),Xb=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ab(t)),Ee.init(e,t)}),Qb=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zy),Ee.init(e,t)}),e_=$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Wy),Ee.init(e,t),e._zod.bag.format="ipv4"}),t_=$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Jy),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})}}}),r_=$("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ky(t.delimiter)),Ee.init(e,t),e._zod.bag.format="mac"}),n_=$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Yy),Ee.init(e,t)}),o_=$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xy),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 i_=$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Qy),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 a_(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 s_=$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Od),Ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{a_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),c_=$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=rb),Ee.init(e,t)});function l_(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 u_=$("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{l_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),d_=$("$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=$("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=e._zod.bag.pattern??db,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}}),f_=$("$ZodNumberFormat",(e,t)=>{_b.init(e,t),Pd.init(e,t)}),jd=$("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=fb,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}}),zd=$("$ZodBigInt",(e,t)=>{Y.init(e,t),e._zod.pattern=lb,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}}),m_=$("$ZodBigIntFormat",(e,t)=>{wb.init(e,t),zd.init(e,t)}),p_=$("$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_=$("$ZodUndefined",(e,t)=>{Y.init(e,t),e._zod.pattern=pb,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}}),g_=$("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=mb,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}}),v_=$("$ZodAny",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),y_=$("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),b_=$("$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)}),__=$("$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}}),w_=$("$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(...Ut(r,e.issues)),t.value[r]=e.value}const x_=$("$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(...Ut(r,e.issues)),e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}function S_(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=yy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function k_(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 E_=$("$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=wi(()=>S_(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 g=d[f]._zod.run({value:l[f],issues:[]},c);g instanceof Promise?u.push(g.then(h=>Xa(h,s,f,l))):Xa(g,s,f,l)}return i?k_(u,l,s,c,o.value,e):u.length?Promise.all(u).then(()=>s):s}}),I_=$("$ZodObjectJIT",(e,t)=>{E_.init(e,t);const r=e._zod.parse,o=wi(()=>S_(t)),n=f=>{const m=new Db(["shape","payload","ctx"]),g=o.value,h=I=>{const y=vu(I);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};m.write("const input = payload.value;");const v=Object.create(null);let b=0;for(const I of g.keys)v[I]=`key_${b++}`;m.write("const newResult = {};");for(const I of g.keys){const y=v[I],k=vu(I);m.write(`const ${y} = ${h(I)};`),m.write(`
11
+ if (${y}.issues.length) {
12
+ payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
13
+ ...iss,
14
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
15
+ })));
16
+ }
17
+
18
+
19
+ if (${y}.value === undefined) {
20
+ if (${k} in input) {
21
+ newResult[${k}] = undefined;
22
+ }
23
+ } else {
24
+ newResult[${k}] = ${y}.value;
25
+ }
26
+
27
+ `)}m.write("payload.value = newResult;"),m.write("return payload;");const w=m.compile();return(I,y)=>w(f,I,y)};let i;const a=Gn,s=!Ja.jitless,l=s&&gy.value,u=t.catchall;let d;e._zod.parse=(f,m)=>{d??(d=o.value);const g=f.value;return a(g)?s&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=n(t.shape)),f=i(f,m),u?k_([],g,f,m,d,e):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:g,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=$("$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 $_=$("$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)}}),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=wi(()=>{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)}}),O_=$("$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 Dd=$("$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(...Ut(r,e.issues)),t.value[r]=e.value}const A_=$("$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(...Ut(l,d.issues)),r.value[l]=d.value})):(u.issues.length&&r.issues.push(...Ut(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(...Ut(s,u.issues)),r.value[c.value]=u.value})):(l.issues.length&&r.issues.push(...Ut(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),C_=$("$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(...Ut(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(...Ut(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 N_=$("$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 R_=$("$ZodEnum",(e,t)=>{Y.init(e,t);const r=gd(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"?dr(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}}),P_=$("$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"?dr(o):o?dr(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}}),j_=$("$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_=$("$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 D_=$("$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)}}),M_=$("$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)}),U_=$("$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 L_=$("$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))}),F_=$("$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 V_=$("$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)}}),Z_=$("$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)}}),B_=$("$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)}),q_=$("$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=$("$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=>ha(e,i,t.out,r)):ha(e,n,t.out,r)}else{const n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(i=>ha(e,i,t.in,r)):ha(e,n,t.in,r)}}function ha(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}const G_=$("$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 H_=$("$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||vy.has(typeof o))r.push(dr(`${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)}),W_=$("$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 Dd({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)),J_=$("$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))}),K_=$("$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)}),Y_=$("$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=>eh(i,r,o,e));eh(n,r,o,e)}});function eh(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 lA=()=>{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])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${N(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?"ة":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function uA(){return{localeError:lA()}}const dA=()=>{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: ${N(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":""}: ${N(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 fA(){return{localeError:dA()}}function th(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 mA=()=>{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])}`:`Няправільны варыянт: чакаўся адзін з ${N(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=th(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=th(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?"ключы":"ключ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function pA(){return{localeError:mA()}}const hA=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},gA=()=>{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}, получен ${hA(o.input)}`;case"invalid_value":return o.values.length===1?`Невалиден вход: очакван ${J(o.values[0])}`:`Невалидна опция: очаквано едно от ${N(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?"ове":""}: ${N(o.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${o.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${o.origin}`;default:return"Невалиден вход"}}};function vA(){return{localeError:gA()}}const yA=()=>{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 ${N(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":""}: ${N(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 bA(){return{localeError:yA()}}const _A=()=>{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 ${N(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: ${N(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 wA(){return{localeError:_A()}}const xA=()=>{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 ${N(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"}: ${N(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 SA(){return{localeError:xA()}}const kA=()=>{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 ${N(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"}: ${N(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 EA(){return{localeError:kA()}}const IA=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},$A=()=>{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 ${IA(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${J(o.values[0])}`:`Invalid option: expected one of ${N(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":""}: ${N(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 X_(){return{localeError:$A()}}const TA=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},OA=()=>{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 ${TA(o.input)}`;case"invalid_value":return o.values.length===1?`Nevalida enigo: atendiĝis ${J(o.values[0])}`:`Nevalida opcio: atendiĝis unu el ${N(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":""}: ${N(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 AA(){return{localeError:OA()}}const CA=()=>{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 ${N(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":""}: ${N(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 NA(){return{localeError:CA()}}const RA=()=>{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])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${N(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?"های":""} ناشناس: ${N(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function PA(){return{localeError:RA()}}const jA=()=>{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: ${N(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"}: ${N(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 zA(){return{localeError:jA()}}const DA=()=>{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 ${N(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":""} : ${N(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 MA(){return{localeError:DA()}}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":"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 ${N(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":""} : ${N(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:{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 g=l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`;return`גדול מדי: ${d} צריך להיות ${g}`}if(l.origin==="array"||l.origin==="set"){const g=l.origin==="set"?"צריכה":"צריך",h=l.inclusive?`${l.maximum} ${u?.unit??""} או פחות`:`פחות מ-${l.maximum} ${u?.unit??""}`;return`גדול מדי: ${d} ${g} להכיל ${h}`.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 g=l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`;return`קטן מדי: ${d} צריך להיות ${g}`}if(l.origin==="array"||l.origin==="set"){const g=l.origin==="set"?"צריכה":"צריך";if(l.minimum===1&&l.inclusive){const v=(l.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${g} להכיל ${v}`}const h=l.inclusive?`${l.minimum} ${u?.unit??""} או יותר`:`יותר מ-${l.minimum} ${u?.unit??""}`;return`קטן מדי: ${d} ${g} להכיל ${h}`.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,g=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${f} לא ${g}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${N(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(l.origin??"array")}`;default:return"קלט לא תקין"}}};function VA(){return{localeError:FA()}}const ZA=()=>{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 ${N(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":""}: ${N(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 BA(){return{localeError:ZA()}}const qA=()=>{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 ${N(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":""}: ${N(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 GA(){return{localeError:qA()}}const HA=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},WA=()=>{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 ${HA(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 ${N(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"}: ${N(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 JA(){return{localeError:WA()}}const KA=()=>{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 ${N(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"}: ${N(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 YA(){return{localeError:KA()}}const XA=()=>{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])}が期待されました`:`無効な選択: ${N(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?"群":""}: ${N(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function QA(){return{localeError:XA()}}const eC=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},tC=()=>{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}, მიღებული ${eC(o.input)}`;case"invalid_value":return o.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${J(o.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${N(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?"ები":"ი"}: ${N(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function rC(){return{localeError:tC()}}const nC=()=>{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])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${N(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(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Q_(){return{localeError:nC()}}function oC(){return Q_()}const iC=()=>{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])} 이어야 합니다`:`잘못된 옵션: ${N(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`인식할 수 없는 키: ${N(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function aC(){return{localeError:iC()}}const sC=e=>Fo(typeof e,e),Fo=(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},Co=e=>e.charAt(0).toUpperCase()+e.slice(1);function rh(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 cC=()=>{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 ${sC(o.input)}, o tikėtasi - ${Fo(o.expected)}`;case"invalid_value":return o.values.length===1?`Privalo būti ${J(o.values[0])}`:`Privalo būti vienas iš ${N(o.values,"|")} pasirinkimų`;case"too_big":{const n=Fo(o.origin),i=t(o.origin,rh(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${Co(n??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Co(n??o.origin??"reikšmė")} turi būti ${a} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{const n=Fo(o.origin),i=t(o.origin,rh(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${Co(n??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Co(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"}: ${N(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const n=Fo(o.origin);return`${Co(n??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function lC(){return{localeError:cC()}}const uC=()=>{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])}`:`Грешана опција: се очекува една ${N(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?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${N(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function dC(){return{localeError:uC()}}const fC=()=>{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 ${N(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: ${N(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 mC(){return{localeError:fC()}}const pC=()=>{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 ${N(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":""}: ${N(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 hC(){return{localeError:pC()}}const gC=()=>{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 ${N(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"}: ${N(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 vC(){return{localeError:gC()}}const yC=()=>{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 ${N(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":""}: ${N(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 bC(){return{localeError:yC()}}const _C=()=>{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])} وای`:`ناسم انتخاب: باید یو له ${N(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?"کلیډونه":"کلیډ"}: ${N(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function wC(){return{localeError:_C()}}const xC=()=>{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 ${N(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":""}: ${N(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 SC(){return{localeError:xC()}}const kC=()=>{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 ${N(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":""}: ${N(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 EC(){return{localeError:kC()}}function nh(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 IC=()=>{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])}`:`Неверный вариант: ожидалось одно из ${N(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=nh(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=nh(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?"и":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function $C(){return{localeError:IC()}}const TC=()=>{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 ${N(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č"}: ${N(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 OC(){return{localeError:TC()}}const AC=()=>{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 ${N(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"}: ${N(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 CC(){return{localeError:AC()}}const NC=()=>{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])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${N(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?"கள்":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};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)?"ไม่ใช่ตัวเลข (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])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${N(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(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 zC=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},DC=()=>{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 ${zC(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ı: ${N(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":""}: ${N(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 MC(){return{localeError:DC()}}const UC=()=>{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])}`:`Неправильна опція: очікується одне з ${N(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?"і":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function ew(){return{localeError:UC()}}function LC(){return ew()}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"نل";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])} متوقع تھا`:`غلط آپشن: ${N(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?"ز":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function VC(){return{localeError:FC()}}const ZC=()=>{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ị ${N(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: ${N(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 BC(){return{localeError:ZC()}}const qC=()=>{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])}`:`无效选项:期望以下之一 ${N(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): ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};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":"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])}`:`無效的選項:預期為以下其中之一 ${N(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?"們":""}:${N(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function WC(){return{localeError:HC()}}const JC=()=>{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 ${N(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ọ̀: ${N(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 KC(){return{localeError:JC()}}const tw=Object.freeze(Object.defineProperty({__proto__:null,ar:uA,az:fA,be:pA,bg:vA,ca:bA,cs:wA,da:SA,de:EA,en:X_,eo:AA,es:NA,fa:PA,fi:zA,fr:MA,frCA:LA,he:VA,hu:BA,id:GA,is:JA,it:YA,ja:QA,ka:rC,kh:oC,km:Q_,ko:aC,lt:lC,mk:dC,ms:mC,nl:hC,no:vC,ota:bC,pl:SC,ps:wC,pt:EC,ru:$C,sl:OC,sv:CC,ta:RC,th:jC,tr:MC,ua:LC,uk:ew,ur:VC,vi:BC,yo:KC,zhCN:GC,zhTW:WC},Symbol.toStringTag,{value:"Module"}));var oh;const rw=Symbol("ZodOutput"),nw=Symbol("ZodInput");class ow{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 ow}(oh=globalThis).__zod_globalRegistry??(oh.__zod_globalRegistry=Ud());const Lt=globalThis.__zod_globalRegistry;function iw(e,t){return new e({type:"string",...A(t)})}function aw(e,t){return new e({type:"string",coerce:!0,...A(t)})}function Ld(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...A(t)})}function Qa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...A(t)})}function Fd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...A(t)})}function Vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...A(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...A(t)})}function Bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...A(t)})}function Us(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...A(t)})}function qd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...A(t)})}function Gd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...A(t)})}function Hd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...A(t)})}function Wd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...A(t)})}function Jd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...A(t)})}function Kd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...A(t)})}function Yd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...A(t)})}function Xd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...A(t)})}function Qd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...A(t)})}function sw(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...A(t)})}function ef(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...A(t)})}function tf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...A(t)})}function rf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...A(t)})}function nf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...A(t)})}function of(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...A(t)})}function af(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...A(t)})}const cw={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function lw(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...A(t)})}function uw(e,t){return new e({type:"string",format:"date",check:"string_format",...A(t)})}function dw(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...A(t)})}function fw(e,t){return new e({type:"string",format:"duration",check:"string_format",...A(t)})}function mw(e,t){return new e({type:"number",checks:[],...A(t)})}function pw(e,t){return new e({type:"number",coerce:!0,checks:[],...A(t)})}function hw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...A(t)})}function gw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...A(t)})}function vw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...A(t)})}function yw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...A(t)})}function bw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...A(t)})}function _w(e,t){return new e({type:"boolean",...A(t)})}function ww(e,t){return new e({type:"boolean",coerce:!0,...A(t)})}function xw(e,t){return new e({type:"bigint",...A(t)})}function Sw(e,t){return new e({type:"bigint",coerce:!0,...A(t)})}function kw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...A(t)})}function Ew(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...A(t)})}function Iw(e,t){return new e({type:"symbol",...A(t)})}function $w(e,t){return new e({type:"undefined",...A(t)})}function Tw(e,t){return new e({type:"null",...A(t)})}function Ow(e){return new e({type:"any"})}function Aw(e){return new e({type:"unknown"})}function Cw(e,t){return new e({type:"never",...A(t)})}function Nw(e,t){return new e({type:"void",...A(t)})}function Rw(e,t){return new e({type:"date",...A(t)})}function Pw(e,t){return new e({type:"date",coerce:!0,...A(t)})}function jw(e,t){return new e({type:"nan",...A(t)})}function Rr(e,t){return new Cd({check:"less_than",...A(t),value:e,inclusive:!1})}function Ot(e,t){return new Cd({check:"less_than",...A(t),value:e,inclusive:!0})}function Pr(e,t){return new Nd({check:"greater_than",...A(t),value:e,inclusive:!1})}function dt(e,t){return new Nd({check:"greater_than",...A(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 bb({check:"multiple_of",...A(t),value:e})}function Ai(e,t){return new xb({check:"max_size",...A(t),maximum:e})}function Kn(e,t){return new Sb({check:"min_size",...A(t),minimum:e})}function Ls(e,t){return new kb({check:"size_equals",...A(t),size:e})}function Ci(e,t){return new Eb({check:"max_length",...A(t),maximum:e})}function on(e,t){return new Ib({check:"min_length",...A(t),minimum:e})}function Ni(e,t){return new $b({check:"length_equals",...A(t),length:e})}function Fs(e,t){return new Tb({check:"string_format",format:"regex",...A(t),pattern:e})}function Vs(e){return new Ob({check:"string_format",format:"lowercase",...A(e)})}function Zs(e){return new Ab({check:"string_format",format:"uppercase",...A(e)})}function Bs(e,t){return new Cb({check:"string_format",format:"includes",...A(t),includes:e})}function qs(e,t){return new Nb({check:"string_format",format:"starts_with",...A(t),prefix:e})}function Gs(e,t){return new Rb({check:"string_format",format:"ends_with",...A(t),suffix:e})}function df(e,t,r){return new Pb({check:"property",property:e,schema:t,...A(r)})}function Hs(e,t){return new jb({check:"mime_type",mime:e,...A(t)})}function wr(e){return new zb({check:"overwrite",tx:e})}function Ws(e){return wr(t=>t.normalize(e))}function Js(){return wr(e=>e.trim())}function Ks(){return wr(e=>e.toLowerCase())}function Ys(){return wr(e=>e.toUpperCase())}function Xs(){return wr(e=>hy(e))}function zw(e,t,r){return new e({type:"array",element:t,...A(r)})}function YC(e,t,r){return new e({type:"union",options:t,...A(r)})}function XC(e,t,r){return new e({type:"union",options:t,inclusive:!1,...A(r)})}function QC(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...A(o)})}function eN(e,t,r){return new e({type:"intersection",left:t,right:r})}function tN(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,...A(i)})}function rN(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...A(o)})}function nN(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...A(o)})}function oN(e,t,r){return new e({type:"set",valueType:t,...A(r)})}function iN(e,t,r){const o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...A(r)})}function aN(e,t,r){return new e({type:"enum",entries:t,...A(r)})}function sN(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...A(r)})}function Dw(e,t){return new e({type:"file",...A(t)})}function cN(e,t){return new e({type:"transform",transform:t})}function lN(e,t){return new e({type:"optional",innerType:t})}function uN(e,t){return new e({type:"nullable",innerType:t})}function dN(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():js(r)}})}function fN(e,t,r){return new e({type:"nonoptional",innerType:t,...A(r)})}function mN(e,t){return new e({type:"success",innerType:t})}function pN(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function hN(e,t,r){return new e({type:"pipe",in:t,out:r})}function gN(e,t){return new e({type:"readonly",innerType:t})}function vN(e,t,r){return new e({type:"template_literal",parts:t,...A(r)})}function yN(e,t){return new e({type:"lazy",getter:t})}function bN(e,t){return new e({type:"promise",innerType:t})}function Mw(e,t,r){const o=A(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Uw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...A(r)})}function Lw(e){const t=Fw(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 Fw(e,t){const r=new Ae({check:"custom",...A(t)});return r._zod.check=e,r}function Vw(e){const t=new Ae({check:"describe"});return t._zod.onattach=[r=>{const o=Lt.get(r)??{};Lt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Zw(e){const t=new Ae({check:"meta"});return t._zod.onattach=[r=>{const o=Lt.get(r)??{};Lt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Bw(e,t){const r=A(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??Oi,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,g)=>{let h=m;return r.case!=="sensitive"&&(h=h.toLowerCase()),i.has(h)?!0:a.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:g.value,inst:f,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?o[0]||"true":n[0]||"false"),error:r.error});return f}function Ri(e,t,r,o={}){const n=A(o),i={...A(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??Lt,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:Ko(t,"input"),output:Ko(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 qw=(e,t={})=>r=>{const o=Yn({...r,processors:t});return ke(e,o),Xn(o,e),Qn(o,e)},Ko=(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)},_N={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gw=(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=_N[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}))])}},Hw=(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)},Ww=(e,t,r,o)=>{r.type="boolean"},Jw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Kw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Yw=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Xw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Qw=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},e0=(e,t,r,o)=>{r.not={}},t0=(e,t,r,o)=>{},r0=(e,t,r,o)=>{},n0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},o0=(e,t,r,o)=>{const n=e._zod.def,i=gd(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},i0=(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},a0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},s0=(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},c0=(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)},l0=(e,t,r,o)=>{r.type="boolean"},u0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},d0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},f0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},m0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},p0=(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"]})},g0=(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},v0=(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},y0=(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)},b0=(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"]})},_0=(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"}]},w0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},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,r.default=JSON.parse(JSON.stringify(n.defaultValue))},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,t.io==="input"&&(r._prefault=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;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},E0=(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},I0=(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},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},O0=(e,t,r,o)=>{const n=e._zod.innerType;ke(n,t,o);const i=t.seen.get(e);i.ref=n},wu={string:Gw,number:Hw,boolean:Ww,bigint:Jw,symbol:Kw,null:Yw,undefined:Xw,void:Qw,never:e0,any:t0,unknown:r0,date:n0,enum:o0,literal:i0,nan:a0,template_literal:s0,file:c0,success:l0,custom:u0,function:d0,transform:f0,map:m0,set:p0,array:h0,object:g0,union:ff,intersection:v0,tuple:y0,record:b0,nullable:_0,nonoptional:w0,default:x0,prefault:S0,catch:k0,pipe:E0,readonly:I0,promise:$0,optional:T0,lazy:O0};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 wN{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 xN=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),SN=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:v_,$ZodArray:x_,$ZodAsyncError:tn,$ZodBase64:i_,$ZodBase64URL:s_,$ZodBigInt:zd,$ZodBigIntFormat:m_,$ZodBoolean:jd,$ZodCIDRv4:n_,$ZodCIDRv6:o_,$ZodCUID:qb,$ZodCUID2:Gb,$ZodCatch:Z_,$ZodCheck:Ae,$ZodCheckBigIntFormat:wb,$ZodCheckEndsWith:Rb,$ZodCheckGreaterThan:Nd,$ZodCheckIncludes:Cb,$ZodCheckLengthEquals:$b,$ZodCheckLessThan:Cd,$ZodCheckLowerCase:Ob,$ZodCheckMaxLength:Eb,$ZodCheckMaxSize:xb,$ZodCheckMimeType:jb,$ZodCheckMinLength:Ib,$ZodCheckMinSize:Sb,$ZodCheckMultipleOf:bb,$ZodCheckNumberFormat:_b,$ZodCheckOverwrite:zb,$ZodCheckProperty:Pb,$ZodCheckRegex:Tb,$ZodCheckSizeEquals:kb,$ZodCheckStartsWith:Nb,$ZodCheckStringFormat:Ti,$ZodCheckUpperCase:Ab,$ZodCodec:Md,$ZodCustom:Y_,$ZodCustomStringFormat:d_,$ZodDate:w_,$ZodDefault:U_,$ZodDiscriminatedUnion:T_,$ZodE164:c_,$ZodEmail:Fb,$ZodEmoji:Zb,$ZodEncodeError:Rs,$ZodEnum:R_,$ZodError:yd,$ZodFile:j_,$ZodFunction:W_,$ZodGUID:Ub,$ZodIPv4:e_,$ZodIPv6:t_,$ZodISODate:Yb,$ZodISODateTime:Kb,$ZodISODuration:Qb,$ZodISOTime:Xb,$ZodIntersection:O_,$ZodJWT:u_,$ZodKSUID:Jb,$ZodLazy:K_,$ZodLiteral:P_,$ZodMAC:r_,$ZodMap:C_,$ZodNaN:B_,$ZodNanoID:Bb,$ZodNever:b_,$ZodNonOptional:F_,$ZodNull:g_,$ZodNullable:M_,$ZodNumber:Pd,$ZodNumberFormat:f_,$ZodObject:E_,$ZodObjectJIT:I_,$ZodOptional:D_,$ZodPipe:q_,$ZodPrefault:L_,$ZodPromise:J_,$ZodReadonly:G_,$ZodRealError:kt,$ZodRecord:A_,$ZodRegistry:ow,$ZodSet:N_,$ZodString:Oi,$ZodStringFormat:Ee,$ZodSuccess:V_,$ZodSymbol:p_,$ZodTemplateLiteral:H_,$ZodTransform:z_,$ZodTuple:Dd,$ZodType:Y,$ZodULID:Hb,$ZodURL:Vb,$ZodUUID:Lb,$ZodUndefined:h_,$ZodUnion:Ms,$ZodUnknown:y_,$ZodVoid:__,$ZodXID:Wb,$ZodXor:$_,$brand:my,$constructor:$,$input:nw,$output:rw,Doc:Db,JSONSchema:xN,JSONSchemaGenerator:wN,NEVER:hd,TimePrecision:cw,_any:Ow,_array:zw,_base64:rf,_base64url:nf,_bigint:xw,_boolean:_w,_catch:pN,_check:Fw,_cidrv4:ef,_cidrv6:tf,_coercedBigint:Sw,_coercedBoolean:ww,_coercedDate:Pw,_coercedNumber:pw,_coercedString:aw,_cuid:Hd,_cuid2:Wd,_custom:Mw,_date:Rw,_decode:xd,_decodeAsync:kd,_default:dN,_discriminatedUnion:QC,_e164:of,_email:Ld,_emoji:qd,_encode:wd,_encodeAsync:Sd,_endsWith:Gs,_enum:iN,_file:Dw,_float32:gw,_float64:vw,_gt:Pr,_gte:dt,_guid:Qa,_includes:Bs,_int:hw,_int32:yw,_int64:kw,_intersection:eN,_ipv4:Xd,_ipv6:Qd,_isoDate:uw,_isoDateTime:lw,_isoDuration:fw,_isoTime:dw,_jwt:af,_ksuid:Yd,_lazy:yN,_length:Ni,_literal:sN,_lowercase:Vs,_lt:Rr,_lte:Ot,_mac:sw,_map:nN,_max:Ot,_maxLength:Ci,_maxSize:Ai,_mime:Hs,_min:dt,_minLength:on,_minSize:Kn,_multipleOf:Jn,_nan:jw,_nanoid:Gd,_nativeEnum:aN,_negative:cf,_never:Cw,_nonnegative:uf,_nonoptional:fN,_nonpositive:lf,_normalize:Ws,_null:Tw,_nullable:uN,_number:mw,_optional:lN,_overwrite:wr,_parse:xi,_parseAsync:Si,_pipe:hN,_positive:sf,_promise:bN,_property:df,_readonly:gN,_record:rN,_refine:Uw,_regex:Fs,_safeDecode:Id,_safeDecodeAsync:Td,_safeEncode:Ed,_safeEncodeAsync:$d,_safeParse:ki,_safeParseAsync:Ei,_set:oN,_size:Ls,_slugify:Xs,_startsWith:qs,_string:iw,_stringFormat:Ri,_stringbool:Bw,_success:mN,_superRefine:Lw,_symbol:Iw,_templateLiteral:vN,_toLowerCase:Ks,_toUpperCase:Ys,_transform:cN,_trim:Js,_tuple:tN,_uint32:bw,_uint64:Ew,_ulid:Jd,_undefined:$w,_union:YC,_unknown:Aw,_uppercase:Zs,_url:Us,_uuid:Fd,_uuidv4:Vd,_uuidv6:Zd,_uuidv7:Bd,_void:Nw,_xid:Kd,_xor:XC,clone:Nt,config:Xe,createStandardJSONSchemaMethod:Ko,createToJSONSchemaMethod:qw,decode:NO,decodeAsync:PO,describe:Vw,encode:CO,encodeAsync:RO,extractDefs:Xn,finalize:Qn,flattenError:bd,formatError:_d,globalConfig:Ja,globalRegistry:Lt,initializeContext:Yn,isValidBase64:Rd,isValidBase64URL:a_,isValidJWT:l_,locales:tw,meta:Zw,parse:yu,parseAsync:bu,prettifyError:Py,process:ke,regexes:Ad,registry:Ud,safeDecode:zO,safeDecodeAsync:MO,safeEncode:jO,safeEncodeAsync:DO,safeParse:jy,safeParseAsync:zy,toDotPath:Ry,toJSONSchema:mf,treeifyError:Ny,util:Ay,version:Mb},Symbol.toStringTag,{value:"Module"})),kN=Object.freeze(Object.defineProperty({__proto__:null,endsWith:Gs,gt:Pr,gte:dt,includes:Bs,length:Ni,lowercase:Vs,lt:Rr,lte:Ot,maxLength:Ci,maxSize:Ai,mime:Hs,minLength:on,minSize:Kn,multipleOf:Jn,negative:cf,nonnegative:uf,nonpositive:lf,normalize:Ws,overwrite:wr,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=$("ZodISODateTime",(e,t)=>{Kb.init(e,t),Ie.init(e,t)});function A0(e){return lw(pf,e)}const hf=$("ZodISODate",(e,t)=>{Yb.init(e,t),Ie.init(e,t)});function C0(e){return uw(hf,e)}const gf=$("ZodISOTime",(e,t)=>{Xb.init(e,t),Ie.init(e,t)});function N0(e){return dw(gf,e)}const vf=$("ZodISODuration",(e,t)=>{Qb.init(e,t),Ie.init(e,t)});function R0(e){return fw(vf,e)}const P0=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:hf,ZodISODateTime:pf,ZodISODuration:vf,ZodISOTime:gf,date:C0,datetime:A0,duration:R0,time:N0},Symbol.toStringTag,{value:"Module"})),j0=(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}}})},EN=$("ZodError",j0),Et=$("ZodError",j0,{Parent:Error}),z0=xi(Et),D0=Si(Et),M0=ki(Et),yf=Ei(Et),U0=wd(Et),L0=xd(Et),F0=Sd(Et),V0=kd(Et),Z0=Ed(Et),B0=Id(Et),q0=$d(Et),G0=Td(Et),ie=$("ZodType",(e,t)=>(Y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ko(e,"input"),output:Ko(e,"output")}}),e.toJSONSchema=qw(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_r(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)=>M0(e,r,o),e.parseAsync=async(r,o)=>D0(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>yf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>U0(e,r,o),e.decode=(r,o)=>L0(e,r,o),e.encodeAsync=async(r,o)=>F0(e,r,o),e.decodeAsync=async(r,o)=>V0(e,r,o),e.safeEncode=(r,o)=>Z0(e,r,o),e.safeDecode=(r,o)=>B0(e,r,o),e.safeEncodeAsync=async(r,o)=>q0(e,r,o),e.safeDecodeAsync=async(r,o)=>G0(e,r,o),e.refine=(r,o)=>e.check(nm(r,o)),e.superRefine=r=>e.check(om(r)),e.overwrite=r=>e.check(wr(r)),e.optional=()=>re(e),e.nullable=()=>Xo(e),e.nullish=()=>re(Xo(e)),e.nonoptional=r=>qf(e,r),e.array=()=>z(e),e.or=r=>fe([e,r]),e.and=r=>Nf(e,r),e.transform=r=>Qo(e,wc(r)),e.default=r=>Vf(e,r),e.prefault=r=>Bf(e,r),e.catch=r=>Wf(e,r),e.pipe=r=>Qo(e,r),e.readonly=()=>Yf(e),e.describe=r=>{const o=e.clone();return Lt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Lt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Lt.get(e);const o=e.clone();return Lt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Qs=$("_ZodString",(e,t)=>{Oi.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Gw(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(Ci(...o)),e.length=(...o)=>e.check(Ni(...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())}),Pi=$("ZodString",(e,t)=>{Oi.init(e,t),Qs.init(e,t),e.email=r=>e.check(Ld(ec,r)),e.url=r=>e.check(Us(ji,r)),e.jwt=r=>e.check(af(gc,r)),e.emoji=r=>e.check(qd(tc,r)),e.guid=r=>e.check(Qa(Yo,r)),e.uuid=r=>e.check(Fd(Yt,r)),e.uuidv4=r=>e.check(Vd(Yt,r)),e.uuidv6=r=>e.check(Zd(Yt,r)),e.uuidv7=r=>e.check(Bd(Yt,r)),e.nanoid=r=>e.check(Gd(rc,r)),e.guid=r=>e.check(Qa(Yo,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(hc,r)),e.datetime=r=>e.check(A0(r)),e.date=r=>e.check(C0(r)),e.time=r=>e.check(N0(r)),e.duration=r=>e.check(R0(r))});function x(e){return iw(Pi,e)}const Ie=$("ZodStringFormat",(e,t)=>{Ee.init(e,t),Qs.init(e,t)}),ec=$("ZodEmail",(e,t)=>{Fb.init(e,t),Ie.init(e,t)});function H0(e){return Ld(ec,e)}const Yo=$("ZodGUID",(e,t)=>{Ub.init(e,t),Ie.init(e,t)});function W0(e){return Qa(Yo,e)}const Yt=$("ZodUUID",(e,t)=>{Lb.init(e,t),Ie.init(e,t)});function J0(e){return Fd(Yt,e)}function K0(e){return Vd(Yt,e)}function Y0(e){return Zd(Yt,e)}function X0(e){return Bd(Yt,e)}const ji=$("ZodURL",(e,t)=>{Vb.init(e,t),Ie.init(e,t)});function Q0(e){return Us(ji,e)}function ex(e){return Us(ji,{protocol:/^https?$/,hostname:tb,...A(e)})}const tc=$("ZodEmoji",(e,t)=>{Zb.init(e,t),Ie.init(e,t)});function tx(e){return qd(tc,e)}const rc=$("ZodNanoID",(e,t)=>{Bb.init(e,t),Ie.init(e,t)});function rx(e){return Gd(rc,e)}const nc=$("ZodCUID",(e,t)=>{qb.init(e,t),Ie.init(e,t)});function nx(e){return Hd(nc,e)}const oc=$("ZodCUID2",(e,t)=>{Gb.init(e,t),Ie.init(e,t)});function ox(e){return Wd(oc,e)}const ic=$("ZodULID",(e,t)=>{Hb.init(e,t),Ie.init(e,t)});function ix(e){return Jd(ic,e)}const ac=$("ZodXID",(e,t)=>{Wb.init(e,t),Ie.init(e,t)});function ax(e){return Kd(ac,e)}const sc=$("ZodKSUID",(e,t)=>{Jb.init(e,t),Ie.init(e,t)});function sx(e){return Yd(sc,e)}const cc=$("ZodIPv4",(e,t)=>{e_.init(e,t),Ie.init(e,t)});function cx(e){return Xd(cc,e)}const bf=$("ZodMAC",(e,t)=>{r_.init(e,t),Ie.init(e,t)});function lx(e){return sw(bf,e)}const lc=$("ZodIPv6",(e,t)=>{t_.init(e,t),Ie.init(e,t)});function ux(e){return Qd(lc,e)}const uc=$("ZodCIDRv4",(e,t)=>{n_.init(e,t),Ie.init(e,t)});function dx(e){return ef(uc,e)}const dc=$("ZodCIDRv6",(e,t)=>{o_.init(e,t),Ie.init(e,t)});function fx(e){return tf(dc,e)}const fc=$("ZodBase64",(e,t)=>{i_.init(e,t),Ie.init(e,t)});function mc(e){return rf(fc,e)}const pc=$("ZodBase64URL",(e,t)=>{s_.init(e,t),Ie.init(e,t)});function mx(e){return nf(pc,e)}const hc=$("ZodE164",(e,t)=>{c_.init(e,t),Ie.init(e,t)});function px(e){return of(hc,e)}const gc=$("ZodJWT",(e,t)=>{u_.init(e,t),Ie.init(e,t)});function hx(e){return af(gc,e)}const fo=$("ZodCustomStringFormat",(e,t)=>{d_.init(e,t),Ie.init(e,t)});function gx(e,t,r={}){return Ri(fo,e,t,r)}function vx(e){return Ri(fo,"hostname",eb,e)}function yx(e){return Ri(fo,"hex",vb,e)}function bx(e,t){const r=t?.enc??"hex",o=`${e}_${r}`,n=Ad[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Ri(fo,o,n,t)}const zi=$("ZodNumber",(e,t)=>{Pd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Hw(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 mw(zi,e)}const hn=$("ZodNumberFormat",(e,t)=>{f_.init(e,t),zi.init(e,t)});function es(e){return hw(hn,e)}function _x(e){return gw(hn,e)}function wx(e){return vw(hn,e)}function xx(e){return yw(hn,e)}function Sx(e){return bw(hn,e)}const Di=$("ZodBoolean",(e,t)=>{jd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Ww(e,r,o)});function mt(e){return _w(Di,e)}const Mi=$("ZodBigInt",(e,t)=>{zd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Jw(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 kx(e){return xw(Mi,e)}const vc=$("ZodBigIntFormat",(e,t)=>{m_.init(e,t),Mi.init(e,t)});function Ex(e){return kw(vc,e)}function Ix(e){return Ew(vc,e)}const _f=$("ZodSymbol",(e,t)=>{p_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kw(e,r)});function $x(e){return Iw(_f,e)}const wf=$("ZodUndefined",(e,t)=>{h_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Xw(e,r)});function Tx(e){return $w(wf,e)}const xf=$("ZodNull",(e,t)=>{g_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Yw(e,r,o)});function yc(e){return Tw(xf,e)}const Sf=$("ZodAny",(e,t)=>{v_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>t0()});function Me(){return Ow(Sf)}const kf=$("ZodUnknown",(e,t)=>{y_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>r0()});function Qe(){return Aw(kf)}const Ef=$("ZodNever",(e,t)=>{b_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>e0(e,r,o)});function bc(e){return Cw(Ef,e)}const If=$("ZodVoid",(e,t)=>{__.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Qw(e,r)});function Ox(e){return Nw(If,e)}const _c=$("ZodDate",(e,t)=>{w_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>n0(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 Ax(e){return Rw(_c,e)}const $f=$("ZodArray",(e,t)=>{x_.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(Ci(r,o)),e.length=(r,o)=>e.check(Ni(r,o)),e.unwrap=()=>e.element});function z(e,t){return zw($f,e,t)}function Cx(e){const t=e._zod.def.shape;return gn(Object.keys(t))}const Ui=$("ZodObject",(e,t)=>{I_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>g0(e,r,o,n),de(e,"shape",()=>t.shape),e.keyof=()=>gn(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=>Sy(e,r),e.safeExtend=r=>ky(e,r),e.merge=r=>Ey(e,r),e.pick=r=>wy(e,r),e.omit=r=>xy(e,r),e.partial=(...r)=>Iy(xc,e,r[0]),e.required=(...r)=>$y(Sc,e,r[0])});function O(e,t){const r={type:"object",shape:e??{},...A(t)};return new Ui(r)}function Nx(e,t){return new Ui({type:"object",shape:e,catchall:bc(),...A(t)})}function Er(e,t){return new Ui({type:"object",shape:e,catchall:Qe(),...A(t)})}const Li=$("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 Li({type:"union",options:e,...A(t)})}const Tf=$("ZodXor",(e,t)=>{Li.init(e,t),$_.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ff(e,r,o,n),e.options=t.options});function Rx(e,t){return new Tf({type:"union",options:e,inclusive:!1,...A(t)})}const Of=$("ZodDiscriminatedUnion",(e,t)=>{Li.init(e,t),T_.init(e,t)});function Af(e,t,r){return new Of({type:"union",options:t,discriminator:e,...A(r)})}const Cf=$("ZodIntersection",(e,t)=>{O_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>v0(e,r,o,n)});function Nf(e,t){return new Cf({type:"intersection",left:e,right:t})}const Rf=$("ZodTuple",(e,t)=>{Dd.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>y0(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,...A(n)})}const Fi=$("ZodRecord",(e,t)=>{A_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>b0(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function er(e,t,r){return new Fi({type:"record",keyType:e,valueType:t,...A(r)})}function Px(e,t,r){const o=Nt(e);return o._zod.values=void 0,new Fi({type:"record",keyType:o,valueType:t,...A(r)})}function jx(e,t,r){return new Fi({type:"record",keyType:e,valueType:t,mode:"loose",...A(r)})}const jf=$("ZodMap",(e,t)=>{C_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>m0(e,r),e.keyType=t.keyType,e.valueType=t.valueType});function zx(e,t,r){return new jf({type:"map",keyType:e,valueType:t,...A(r)})}const zf=$("ZodSet",(e,t)=>{N_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>p0(e,r),e.min=(...r)=>e.check(Kn(...r)),e.nonempty=r=>e.check(Kn(1,r)),e.max=(...r)=>e.check(Ai(...r)),e.size=(...r)=>e.check(Ls(...r))});function Dx(e,t){return new zf({type:"set",valueType:e,...A(t)})}const eo=$("ZodEnum",(e,t)=>{R_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(o,n,i)=>o0(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:[],...A(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:[],...A(n),entries:i})}});function gn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new eo({type:"enum",entries:r,...A(t)})}function Mx(e,t){return new eo({type:"enum",entries:e,...A(t)})}const Df=$("ZodLiteral",(e,t)=>{P_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>i0(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 Df({type:"literal",values:Array.isArray(e)?e:[e],...A(t)})}const Mf=$("ZodFile",(e,t)=>{j_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>c0(e,r,o),e.min=(r,o)=>e.check(Kn(r,o)),e.max=(r,o)=>e.check(Ai(r,o)),e.mime=(r,o)=>e.check(Hs(Array.isArray(r)?r:[r],o))});function Ux(e){return Dw(Mf,e)}const Uf=$("ZodTransform",(e,t)=>{z_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>f0(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=$("ZodOptional",(e,t)=>{D_.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 re(e){return new xc({type:"optional",innerType:e})}const Lf=$("ZodNullable",(e,t)=>{M_.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 Xo(e){return new Lf({type:"nullable",innerType:e})}function Lx(e){return re(Xo(e))}const Ff=$("ZodDefault",(e,t)=>{U_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>x0(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=$("ZodPrefault",(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});function Bf(e,t){return new Zf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():js(t)}})}const Sc=$("ZodNonOptional",(e,t)=>{F_.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 qf(e,t){return new Sc({type:"nonoptional",innerType:e,...A(t)})}const Gf=$("ZodSuccess",(e,t)=>{V_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>l0(e,r,o),e.unwrap=()=>e._zod.def.innerType});function Fx(e){return new Gf({type:"success",innerType:e})}const Hf=$("ZodCatch",(e,t)=>{Z_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k0(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=$("ZodNaN",(e,t)=>{B_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>a0(e,r)});function Vx(e){return jw(Jf,e)}const kc=$("ZodPipe",(e,t)=>{q_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E0(e,r,o,n),e.in=t.in,e.out=t.out});function Qo(e,t){return new kc({type:"pipe",in:e,out:t})}const Ec=$("ZodCodec",(e,t)=>{kc.init(e,t),Md.init(e,t)});function Zx(e,t,r){return new Ec({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const Kf=$("ZodReadonly",(e,t)=>{G_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yf(e){return new Kf({type:"readonly",innerType:e})}const Xf=$("ZodTemplateLiteral",(e,t)=>{H_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>s0(e,r,o)});function Bx(e,t){return new Xf({type:"template_literal",parts:e,...A(t)})}const Qf=$("ZodLazy",(e,t)=>{K_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O0(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Ic(e){return new Qf({type:"lazy",getter:e})}const em=$("ZodPromise",(e,t)=>{J_.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 qx(e){return new em({type:"promise",innerType:e})}const tm=$("ZodFunction",(e,t)=>{W_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>d0(e,r)});function ts(e){return new tm({type:"function",input:Array.isArray(e?.input)?Pf(e?.input):e?.input??z(Qe()),output:e?.output??Qe()})}const Vi=$("ZodCustom",(e,t)=>{Y_.init(e,t),ie.init(e,t),e._zod.processJSONSchema=(r,o,n)=>u0(e,r)});function Gx(e){const t=new Ae({check:"custom"});return t._zod.check=e,t}function rm(e,t){return Mw(Vi,e??(()=>!0),t)}function nm(e,t={}){return Uw(Vi,e,t)}function om(e){return Lw(e)}const Hx=Vw,Wx=Zw;function to(e,t={error:`Input not instance of ${e.name}`}){const r=new Vi({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...A(t)});return r._zod.bag.Class=e,r}const Jx=(...e)=>Bw({Codec:Ec,Boolean:Di,String:Pi},...e);function Kx(e){const t=Ic(()=>fe([x(e),Z(),mt(),yc(),z(t),er(x(),t)]));return t}function Yx(e,t){return Qo(wc(e),t)}const IN=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Sf,ZodArray:$f,ZodBase64:fc,ZodBase64URL:pc,ZodBigInt:Mi,ZodBigIntFormat:vc,ZodBoolean:Di,ZodCIDRv4:uc,ZodCIDRv6:dc,ZodCUID:nc,ZodCUID2:oc,ZodCatch:Hf,ZodCodec:Ec,ZodCustom:Vi,ZodCustomStringFormat:fo,ZodDate:_c,ZodDefault:Ff,ZodDiscriminatedUnion:Of,ZodE164:hc,ZodEmail:ec,ZodEmoji:tc,ZodEnum:eo,ZodFile:Mf,ZodFunction:tm,ZodGUID:Yo,ZodIPv4:cc,ZodIPv6:lc,ZodIntersection:Cf,ZodJWT:gc,ZodKSUID:sc,ZodLazy:Qf,ZodLiteral:Df,ZodMAC:bf,ZodMap:jf,ZodNaN:Jf,ZodNanoID:rc,ZodNever:Ef,ZodNonOptional:Sc,ZodNull:xf,ZodNullable:Lf,ZodNumber:zi,ZodNumberFormat:hn,ZodObject:Ui,ZodOptional:xc,ZodPipe:kc,ZodPrefault:Zf,ZodPromise:em,ZodReadonly:Kf,ZodRecord:Fi,ZodSet:zf,ZodString:Pi,ZodStringFormat:Ie,ZodSuccess:Gf,ZodSymbol:_f,ZodTemplateLiteral:Xf,ZodTransform:Uf,ZodTuple:Rf,ZodType:ie,ZodULID:ic,ZodURL:ji,ZodUUID:Yt,ZodUndefined:wf,ZodUnion:Li,ZodUnknown:kf,ZodVoid:If,ZodXID:ac,ZodXor:Tf,_ZodString:Qs,_default:Vf,_function:ts,any:Me,array:z,base64:mc,base64url:mx,bigint:kx,boolean:mt,catch:Wf,check:Gx,cidrv4:dx,cidrv6:fx,codec:Zx,cuid:nx,cuid2:ox,custom:rm,date:Ax,describe:Hx,discriminatedUnion:Af,e164:px,email:H0,emoji:tx,enum:gn,file:Ux,float32:_x,float64:wx,function:ts,guid:W0,hash:bx,hex:yx,hostname:vx,httpUrl:ex,instanceof:to,int:es,int32:xx,int64:Ex,intersection:Nf,ipv4:cx,ipv6:ux,json:Kx,jwt:hx,keyof:Cx,ksuid:sx,lazy:Ic,literal:B,looseObject:Er,looseRecord:jx,mac:lx,map:zx,meta:Wx,nan:Vx,nanoid:rx,nativeEnum:Mx,never:bc,nonoptional:qf,null:yc,nullable:Xo,nullish:Lx,number:Z,object:O,optional:re,partialRecord:Px,pipe:Qo,prefault:Bf,preprocess:Yx,promise:qx,readonly:Yf,record:er,refine:nm,set:Dx,strictObject:Nx,string:x,stringFormat:gx,stringbool:Jx,success:Fx,superRefine:om,symbol:$x,templateLiteral:Bx,transform:wc,tuple:Pf,uint32:Sx,uint64:Ix,ulid:ix,undefined:Tx,union:fe,unknown:Qe,url:Q0,uuid:J0,uuidv4:K0,uuidv6:Y0,uuidv7:X0,void:Ox,xid:ax,xor:Rx},Symbol.toStringTag,{value:"Module"})),Xx={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 $N(e){Xe({customError:e})}function TN(){return Xe().customError}var xu;xu||(xu={});const j={...IN,...kN,iso:P0};function ON(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 AN(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 Qx(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=AN(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 Qx(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),g=j.string().regex(new RegExp(f));u.push(j.looseRecord(g,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=Qx(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 CN(e,t){if(typeof e=="boolean")return e?j.any():j.never();const r=ON(e,t?.defaultTarget),o=e.$defs||e.definitions||{};return Ye(e,{version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e})}function NN(e){return aw(Pi,e)}function RN(e){return pw(zi,e)}function PN(e){return ww(Di,e)}function jN(e){return Sw(Mi,e)}function zN(e){return Pw(_c,e)}const DN=Object.freeze(Object.defineProperty({__proto__:null,bigint:jN,boolean:PN,date:zN,number:RN,string:NN},Symbol.toStringTag,{value:"Module"}));Xe(X_());const ih=Object.freeze(Object.defineProperty({__proto__:null,$brand:my,$input:nw,$output:rw,NEVER:hd,TimePrecision:cw,ZodAny:Sf,ZodArray:$f,ZodBase64:fc,ZodBase64URL:pc,ZodBigInt:Mi,ZodBigIntFormat:vc,ZodBoolean:Di,ZodCIDRv4:uc,ZodCIDRv6:dc,ZodCUID:nc,ZodCUID2:oc,ZodCatch:Hf,ZodCodec:Ec,ZodCustom:Vi,ZodCustomStringFormat:fo,ZodDate:_c,ZodDefault:Ff,ZodDiscriminatedUnion:Of,ZodE164:hc,ZodEmail:ec,ZodEmoji:tc,ZodEnum:eo,ZodError:EN,ZodFile:Mf,get ZodFirstPartyTypeKind(){return xu},ZodFunction:tm,ZodGUID:Yo,ZodIPv4:cc,ZodIPv6:lc,ZodISODate:hf,ZodISODateTime:pf,ZodISODuration:vf,ZodISOTime:gf,ZodIntersection:Cf,ZodIssueCode:Xx,ZodJWT:gc,ZodKSUID:sc,ZodLazy:Qf,ZodLiteral:Df,ZodMAC:bf,ZodMap:jf,ZodNaN:Jf,ZodNanoID:rc,ZodNever:Ef,ZodNonOptional:Sc,ZodNull:xf,ZodNullable:Lf,ZodNumber:zi,ZodNumberFormat:hn,ZodObject:Ui,ZodOptional:xc,ZodPipe:kc,ZodPrefault:Zf,ZodPromise:em,ZodReadonly:Kf,ZodRealError:Et,ZodRecord:Fi,ZodSet:zf,ZodString:Pi,ZodStringFormat:Ie,ZodSuccess:Gf,ZodSymbol:_f,ZodTemplateLiteral:Xf,ZodTransform:Uf,ZodTuple:Rf,ZodType:ie,ZodULID:ic,ZodURL:ji,ZodUUID:Yt,ZodUndefined:wf,ZodUnion:Li,ZodUnknown:kf,ZodVoid:If,ZodXID:ac,ZodXor:Tf,_ZodString:Qs,_default:Vf,_function:ts,any:Me,array:z,base64:mc,base64url:mx,bigint:kx,boolean:mt,catch:Wf,check:Gx,cidrv4:dx,cidrv6:fx,clone:Nt,codec:Zx,coerce:DN,config:Xe,core:SN,cuid:nx,cuid2:ox,custom:rm,date:Ax,decode:L0,decodeAsync:V0,describe:Hx,discriminatedUnion:Af,e164:px,email:H0,emoji:tx,encode:U0,encodeAsync:F0,endsWith:Gs,enum:gn,file:Ux,flattenError:bd,float32:_x,float64:wx,formatError:_d,fromJSONSchema:CN,function:ts,getErrorMap:TN,globalRegistry:Lt,gt:Pr,gte:dt,guid:W0,hash:bx,hex:yx,hostname:vx,httpUrl:ex,includes:Bs,instanceof:to,int:es,int32:xx,int64:Ex,intersection:Nf,ipv4:cx,ipv6:ux,iso:P0,json:Kx,jwt:hx,keyof:Cx,ksuid:sx,lazy:Ic,length:Ni,literal:B,locales:tw,looseObject:Er,looseRecord:jx,lowercase:Vs,lt:Rr,lte:Ot,mac:lx,map:zx,maxLength:Ci,maxSize:Ai,meta:Wx,mime:Hs,minLength:on,minSize:Kn,multipleOf:Jn,nan:Vx,nanoid:rx,nativeEnum:Mx,negative:cf,never:bc,nonnegative:uf,nonoptional:qf,nonpositive:lf,normalize:Ws,null:yc,nullable:Xo,nullish:Lx,number:Z,object:O,optional:re,overwrite:wr,parse:z0,parseAsync:D0,partialRecord:Px,pipe:Qo,positive:sf,prefault:Bf,preprocess:Yx,prettifyError:Py,promise:qx,property:df,readonly:Yf,record:er,refine:nm,regex:Fs,regexes:Ad,registry:Ud,safeDecode:B0,safeDecodeAsync:G0,safeEncode:Z0,safeEncodeAsync:q0,safeParse:M0,safeParseAsync:yf,set:Dx,setErrorMap:$N,size:Ls,slugify:Xs,startsWith:qs,strictObject:Nx,string:x,stringFormat:gx,stringbool:Jx,success:Fx,superRefine:om,symbol:$x,templateLiteral:Bx,toJSONSchema:mf,toLowerCase:Ks,toUpperCase:Ys,transform:wc,treeifyError:Ny,trim:Js,tuple:Pf,uint32:Sx,uint64:Ix,ulid:ix,undefined:Tx,union:fe,unknown:Qe,uppercase:Zs,url:Q0,util:Ay,uuid:J0,uuidv4:K0,uuidv6:Y0,uuidv7:X0,void:Ox,xid:ax,xor:Rx},Symbol.toStringTag,{value:"Module"}));var ei;(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})(ei||(ei={}));var ah;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(ah||(ah={}));ei.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ei.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,ei.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 sh;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(sh||(sh={}));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 MN=({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()}`};MN();function eS(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 UN(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 tS(e,...t){const r=new Headers(UN(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var LN=Symbol.for("vercel.ai.validator");function FN(e){return{...e,type:"dynamic"}}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var VN=Symbol.for("vercel.ai.schema");function ZN(e,{validate:t}={}){return{[VN]:!0,_type:void 0,[LN]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}let im;im=globalThis.crypto;async function BN(e){return(await im).getRandomValues(new Uint8Array(e))}async function qN(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const o=await BN(e);for(let n=0;n<e;n++){const i=o[n]%t.length;r+=t[i]}return r}async function GN(e){return await qN(e)}async function HN(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 WN(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await GN(e),r=await HN(t);return{code_verifier:t,code_challenge:r}}var JN="AI_MCPClientError",rS=`vercel.ai.error.${JN}`,KN=Symbol.for(rS),ch,lh,we=class extends(lh=ee,ch=KN,lh){constructor({name:e="MCPClientError",message:t,cause:r,data:o,code:n}){super({name:e,message:t,cause:r}),this[ch]=!0,this.data=o,this.code=n}static isInstance(e){return ee.hasMarker(e,rS)}},mo="2025-06-18",YN=[mo,"2025-03-26","2024-11-05"],XN=Er({name:x(),version:x()}),$c=Er({_meta:re(O({}).loose())}),fr=$c,nS=O({method:x(),params:re($c)}),oS=O({applyDefaults:re(mt())}).loose(),QN=Er({experimental:re(O({}).loose()),logging:re(O({}).loose()),prompts:re(Er({listChanged:re(mt())})),resources:re(Er({subscribe:re(mt()),listChanged:re(mt())})),tools:re(Er({listChanged:re(mt())})),elicitation:re(oS)});O({elicitation:re(oS)}).loose();var eR=fr.extend({protocolVersion:x(),capabilities:QN,serverInfo:XN,instructions:re(x())}),am=fr.extend({nextCursor:re(x())}),tR=O({name:x(),description:re(x()),inputSchema:O({type:B("object"),properties:re(O({}).loose())}).loose()}).loose(),rR=am.extend({tools:z(tR)}),iS=O({type:B("text"),text:x()}).loose(),aS=O({type:B("image"),data:mc(),mimeType:x()}).loose(),nR=O({uri:x(),name:x(),title:re(x()),description:re(x()),mimeType:re(x()),size:re(Z())}).loose(),oR=am.extend({resources:z(nR)}),sS=O({uri:x(),name:re(x()),title:re(x()),mimeType:re(x())}).loose(),cS=sS.extend({text:x()}),lS=sS.extend({blob:mc()}),uS=O({type:B("resource"),resource:fe([cS,lS])}).loose(),iR=fr.extend({content:z(fe([iS,aS,uS])),isError:mt().default(!1).optional()}).or(fr.extend({toolResult:Qe()})),aR=O({uriTemplate:x(),name:x(),title:re(x()),description:re(x()),mimeType:re(x())}).loose(),sR=fr.extend({resourceTemplates:z(aR)}),cR=fr.extend({contents:z(fe([cS,lS]))}),lR=O({name:x(),description:re(x()),required:re(mt())}).loose(),uR=O({name:x(),title:re(x()),description:re(x()),arguments:re(z(lR))}).loose(),dR=am.extend({prompts:z(uR)}),fR=O({role:fe([B("user"),B("assistant")]),content:fe([iS,aS,uS])}).loose(),mR=fr.extend({description:re(x()),messages:z(fR)}),pR=$c.extend({message:x(),requestedSchema:Qe()}),uh=nS.extend({method:B("elicitation/create"),params:pR}),hR=fr.extend({action:fe([B("accept"),B("decline"),B("cancel")]),content:re(er(x(),Qe()))}),Tc="2.0",gR=O({jsonrpc:B(Tc),id:fe([x(),Z().int()])}).merge(nS).strict(),vR=O({jsonrpc:B(Tc),id:fe([x(),Z().int()]),result:fr}).strict(),yR=O({jsonrpc:B(Tc),id:fe([x(),Z().int()]),error:O({code:Z().int(),message:x(),data:re(Qe())})}).strict(),bR=O({jsonrpc:B(Tc)}).merge(O({method:x(),params:re($c)})).strict(),Vo=fe([gR,bR,vR,yR]),dS=typeof __PACKAGE_VERSION__<"u"?__PACKAGE_VERSION__:"0.0.0-test",fS=O({access_token:x(),id_token:x().optional(),token_type:x(),expires_in:Z().optional(),scope:x().optional(),refresh_token:x().optional()}).strip(),ft=x().url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Xx.custom,message:"URL must be parseable",fatal:!0}),hd}).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"}),_R=O({resource:x().url(),authorization_servers:z(ft).optional(),jwks_uri:x().url().optional(),scopes_supported:z(x()).optional(),bearer_methods_supported:z(x()).optional(),resource_signing_alg_values_supported:z(x()).optional(),resource_name:x().optional(),resource_documentation:x().optional(),resource_policy_uri:x().url().optional(),resource_tos_uri:x().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:z(x()).optional(),dpop_signing_alg_values_supported:z(x()).optional(),dpop_bound_access_tokens_required:mt().optional()}).passthrough(),mS=O({issuer:x(),authorization_endpoint:ft,token_endpoint:ft,registration_endpoint:ft.optional(),scopes_supported:z(x()).optional(),response_types_supported:z(x()),grant_types_supported:z(x()).optional(),code_challenge_methods_supported:z(x()),token_endpoint_auth_methods_supported:z(x()).optional(),token_endpoint_auth_signing_alg_values_supported:z(x()).optional()}).passthrough(),wR=O({issuer:x(),authorization_endpoint:ft,token_endpoint:ft,userinfo_endpoint:ft.optional(),jwks_uri:ft,registration_endpoint:ft.optional(),scopes_supported:z(x()).optional(),response_types_supported:z(x()),grant_types_supported:z(x()).optional(),subject_types_supported:z(x()),id_token_signing_alg_values_supported:z(x()),claims_supported:z(x()).optional(),token_endpoint_auth_methods_supported:z(x()).optional()}).passthrough(),xR=wR.merge(mS.pick({code_challenge_methods_supported:!0})),SR=O({client_id:x(),client_secret:x().optional(),client_id_issued_at:Z().optional(),client_secret_expires_at:Z().optional()}).strip(),kR=O({redirect_uris:z(ft),token_endpoint_auth_method:x().optional(),grant_types:z(x()).optional(),response_types:z(x()).optional(),client_name:x().optional(),client_uri:ft.optional(),logo_uri:ft.optional(),scope:x().optional(),contacts:z(x()).optional(),tos_uri:ft.optional(),policy_uri:x().optional(),jwks_uri:ft.optional(),jwks:Me().optional(),software_id:x().optional(),software_version:x().optional(),software_statement:x().optional()}).strip(),ER=O({error:x(),error_description:x().optional(),error_uri:x().optional()}),IR=kR.merge(SR),$R="AI_MCPClientOAuthError",pS=`vercel.ai.error.${$R}`,TR=Symbol.for(pS),dh,fh,Zi=class extends(fh=ee,dh=TR,fh){constructor({name:e="MCPClientOAuthError",message:t,cause:r}){super({name:e,message:t,cause:r}),this[dh]=!0}static isInstance(e){return ee.hasMarker(e,pS)}},ro=class extends Zi{};ro.errorCode="server_error";var ns=class extends Zi{};ns.errorCode="invalid_client";var os=class extends Zi{};os.errorCode="invalid_grant";var is=class extends Zi{};is.errorCode="unauthorized_client";var OR={[ro.errorCode]:ro,[ns.errorCode]:ns,[os.errorCode]:os,[is.errorCode]:is};function AR(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function CR({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 NR(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 mh(e,t,r=fetch){return await sm(e,{"MCP-Protocol-Version":t},r)}function RR(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function PR(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=NR(t,a.pathname);c=new URL(u,(i=o?.metadataServerUrl)!=null?i:a),c.search=a.search}let l=await mh(c,s,r);if(!o?.metadataUrl&&RR(l,a.pathname)){const u=new URL(`/.well-known/${t}`,a);l=await mh(u,s,r)}return l}async function jR(e,t,r=fetch){const o=await PR(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 _R.parse(await o.json())}function zR(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 DR(e,{fetchFn:t=fetch,protocolVersion:r=mo}={}){var o;const n={"MCP-Protocol-Version":r},i=zR(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 mS.parse(await c.json());{const l=xR.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 MR(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 WN(),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 gS(e,t,r,o){const{client_id:n,client_secret:i}=t;switch(e){case"client_secret_basic":UR(n,i,r);return;case"client_secret_post":LR(n,i,o);return;case"none":FR(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function UR(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 LR(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function FR(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=ER.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:a}=o,s=OR[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 VR(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 h=(l=t?.token_endpoint_auth_methods_supported)!=null?l:[],v=hS(r,h);gS(v,r,f,m)}a&&m.set("resource",a.href);const g=await(c??fetch)(d,{method:"POST",headers:f,body:m});if(!g.ok)throw await cm(g);return fS.parse(await g.json())}async function ZR(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:[],g=hS(r,m);gS(g,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 fS.parse({refresh_token:o,...await f.json()})}async function BR(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 IR.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 qR(e,t,r){const o=AR(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!CR({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 jR(t,{resourceMetadataUrl:n},i),a.authorization_servers&&a.authorization_servers.length>0&&(s=a.authorization_servers[0])}catch{}s||(s=t);const c=await qR(t,e,a),l=await DR(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 h=await BR(s,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(h),u=h}if(r!==void 0){const h=await e.codeVerifier(),v=await VR(s,{metadata:l,clientInformation:u,authorizationCode:r,codeVerifier:h,redirectUri:e.redirectUrl,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(v),"AUTHORIZED"}const d=await e.tokens();if(d?.refresh_token)try{const h=await ZR(s,{metadata:l,clientInformation:u,refreshToken:d.refresh_token,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(h),"AUTHORIZED"}catch(h){if(!(!(h instanceof Zi)||h instanceof ro))throw h}const f=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:g}=await MR(s,{metadata:l,clientInformation:u,state:f,redirectUrl:e.redirectUrl,scope:o||e.clientMetadata.scope,resource:c});return await e.saveCodeVerifier(g),await e.redirectToAuthorization(m),"REDIRECT"}var GR=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 tS(t,`ai-sdk/${dS}`,eS())}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 h=new as;return(i=this.onerror)==null||i.call(this,h),t(h)}}catch(g){return(a=this.onerror)==null||a.call(this,g),t(g)}return r(!0)}if(!u.ok||!u.body){let g=`MCP SSE Transport Error: ${u.status} ${u.statusText}`;u.status===405&&(g+=". This server does not support SSE transport. Try using `http` transport instead");const h=new we({message:g});return(s=this.onerror)==null||s.call(this,h),t(h)}const f=u.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader(),m=async()=>{var g,h,v;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:I,data:y}=w;if(I==="endpoint"){if(this.endpoint=new URL(y,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(I==="message")try{const k=Vo.parse(JSON.parse(y));(g=this.onmessage)==null||g.call(this,k)}catch(k){const S=new we({message:"MCP SSE Transport Error: Failed to parse message",cause:k});(h=this.onerror)==null||h.call(this,S)}}}catch(b){if(b instanceof Error&&b.name==="AbortError")return;(v=this.onerror)==null||v.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()}},HR=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 tS(t,`ai-sdk/${dS}`,eS())}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(v){throw(n=this.onerror)==null||n.call(this,v),v}return t(!0)}if(f.status===202){this.inboundSseConnection||this.openInboundSse();return}if(!f.ok){const v=await f.text().catch(()=>null);let b=`MCP HTTP Transport Error: POSTing to endpoint (HTTP ${f.status}): ${v}`;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 g=f.headers.get("content-type")||"";if(g.includes("application/json")){const v=await f.json(),b=Array.isArray(v)?v.map(w=>Vo.parse(w)):[Vo.parse(v)];for(const w of b)(a=this.onmessage)==null||a.call(this,w);return}if(g.includes("text/event-stream")){if(!f.body){const I=new we({message:"MCP HTTP Transport Error: text/event-stream response without body"});throw(s=this.onerror)==null||s.call(this,I),I}const b=f.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader();(async()=>{var I,y,k;try{for(;;){const{done:S,value:E}=await b.read();if(S)return;const{event:C,data:D}=E;if(C==="message")try{const U=Vo.parse(JSON.parse(D));(I=this.onmessage)==null||I.call(this,U)}catch(U){const K=new we({message:"MCP HTTP Transport Error: Failed to parse message",cause:U});(y=this.onerror)==null||y.call(this,K)}}}catch(S){if(S instanceof Error&&S.name==="AbortError")return;(k=this.onerror)==null||k.call(this,S)}})();return}const h=new we({message:`MCP HTTP Transport Error: Unexpected content type: ${g}`});throw(c=this.onerror)==null||c.call(this,h),h}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 h=new as;(o=this.onerror)==null||o.call(this,h);return}}catch(g){(n=this.onerror)==null||n.call(this,g);return}return this.openInboundSse(!0,t)}if(l.status===405)return;if(!l.ok||!l.body){const g=new we({message:`MCP HTTP Transport Error: GET SSE failed: ${l.status} ${l.statusText}`});(i=this.onerror)==null||i.call(this,g);return}const f=l.body.pipeThrough(new TextDecoderStream).pipeThrough(new Wa).getReader(),m=async()=>{var g,h,v,b;try{for(;;){const{done:w,value:I}=await f.read();if(w)return;const{event:y,data:k,id:S}=I;if(S&&(this.lastInboundEventId=S),y==="message")try{const E=Vo.parse(JSON.parse(k));(g=this.onmessage)==null||g.call(this,E)}catch(E){const C=new we({message:"MCP HTTP Transport Error: Failed to parse message",cause:E});(h=this.onerror)==null||h.call(this,C)}}}catch(w){if(w instanceof Error&&w.name==="AbortError")return;(v=this.onerror)==null||v.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 WR(e){switch(e.type){case"sse":return new GR(e);case"http":return new HR(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 JR(e){return"start"in e&&typeof e.start=="function"&&"send"in e&&typeof e.send=="function"&&"close"in e&&typeof e.close=="function"}var KR="1.0.0";async function YR(e){const t=new XR(e);return await t.init(),t}var XR=class{constructor({transport:e,name:t="ai-sdk-mcp-client",version:r=KR,onUncaughtError:o,capabilities:n}){this.requestMessageId=0,this.responseHandlers=new Map,this.serverCapabilities={},this.isClosed=!0,this.onUncaughtError=o,this.clientCapabilities=n??{},JR(e)?this.transport=e:this.transport=WR(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:eR});if(e===void 0)throw new we({message:"Server sent invalid initialize result"});if(!YN.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:rR,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:iR,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:oR,options:t})}catch(r){throw r}}async readResourceInternal({uri:e,options:t}){try{return this.request({request:{method:"resources/read",params:{uri:e}},resultSchema:cR,options:t})}catch(r){throw r}}async listResourceTemplatesInternal({options:e}={}){try{return this.request({request:{method:"resources/templates/list"},resultSchema:sR,options:e})}catch(t){throw t}}async listPromptsInternal({params:e,options:t}={}){try{return this.request({request:{method:"prompts/list",params:e},resultSchema:dR,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:mR,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"?FN({description:i,inputSchema:ZN({...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!==uh)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=uh.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=hR.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}))}},Bi=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(){}},QR={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},eP=class{#e=QR;#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 eP;function tP(e){setTimeout(e,0)}var an=typeof window>"u"||"Deno"in globalThis;function ut(){}function rP(e,t){return typeof e=="function"?e(t):e}function Su(e){return typeof e=="number"&&e>=0&&e!==1/0}function vS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Tr(e,t){return typeof e=="function"?e(t):e}function $t(e,t){return typeof e=="function"?e(t):e}function ph(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(!ri(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 hh(e,t){const{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(ti(t.options.mutationKey)!==ti(i))return!1}else if(!ri(t.options.mutationKey,i))return!1}return!(o&&t.state.status!==o||n&&!n(t))}function lm(e,t){return(t?.queryKeyHashFn||ti)(e)}function ti(e){return JSON.stringify(e,(t,r)=>Iu(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ri(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ri(e[r],t[r])):!1}var nP=Object.prototype.hasOwnProperty;function ku(e,t){if(e===t)return e;const r=gh(e)&&gh(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:nP.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 gh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Iu(e){if(!vh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!vh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function vh(e){return Object.prototype.toString.call(e)==="[object Object]"}function oP(e){return new Promise(t=>{Yr.setTimeout(t,e)})}function $u(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 iP(e,t,r=0){const o=[...e,t];return r&&o.length>r?o.slice(1):o}function aP(e,t,r=0){const o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var ls=Symbol();function yS(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 sP(e,t){return typeof e=="function"?e(...t):!!e}var cP=class extends Bi{#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 cP;function Tu(){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 lP=tP;function uP(){let e=[],t=0,r=s=>{s()},o=s=>{s()},n=lP;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=uP(),dP=class extends Bi{#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 dP;function fP(e){return Math.min(1e3*2**e,3e4)}function bS(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 _S(e){let t=!1,r=0,o;const n=Tu(),i=()=>n.status!=="pending",a=h=>{if(!i()){const v=new Ou(h);f(v),e.onCancel?.(v)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>um.isFocused()&&(e.networkMode==="always"||us.isOnline())&&e.canRun(),u=()=>bS(e.networkMode)&&e.canRun(),d=h=>{i()||(o?.(),n.resolve(h))},f=h=>{i()||(o?.(),n.reject(h))},m=()=>new Promise(h=>{o=v=>{(i()||l())&&h(v)},e.onPause?.()}).then(()=>{o=void 0,i()||e.onContinue?.()}),g=()=>{if(i())return;let h;const v=r===0?e.initialPromise:void 0;try{h=v??e.fn()}catch(b){h=Promise.reject(b)}Promise.resolve(h).then(d).catch(b=>{if(i())return;const w=e.retry??(an?0:3),I=e.retryDelay??fP,y=typeof I=="function"?I(r,b):I,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),oP(y).then(()=>l()?void 0:m()).then(()=>{t?f(b):g()})})};return{promise:n,status:()=>n.status,cancel:a,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?g():m().then(g),n)}}var wS=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)}},mP=class extends wS{#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=bh(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=bh(this.options);t.data!==void 0&&(this.setState(yh(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=$u(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=>$t(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=>Tr(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:!vS(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=yS(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=_S({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,...xS(r.data,this.options),fetchMeta:e.meta??null};case"success":const o={...r,...yh(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 xS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:bS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function bh(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 pP=class extends Bi{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#a=Tu(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#o=void 0;#n;#s;#a;#i;#h;#f;#m;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),_h(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 $t(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&&wh(this.#t,r,this.options,t)&&this.#d(),this.updateResult(),o&&(this.#t!==r||$t(this.options.enabled,this.#t)!==$t(t.enabled,this.#t)||Tr(this.options.staleTime,this.#t)!==Tr(t.staleTime,this.#t))&&this.#g();const n=this.#v();o&&(this.#t!==r||$t(this.options.enabled,this.#t)!==$t(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 gP(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}#g(){this.#_();const e=Tr(this.options.staleTime,this.#t);if(an||this.#o.isStale||!Su(e))return;const r=vS(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||$t(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.#g(),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 C=this.hasListeners(),D=!C&&_h(e,t),U=C&&wh(e,r,t,o);(D||U)&&(u={...u,...xS(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:m,errorUpdatedAt:g,status:h}=u;f=u.data;let v=!1;if(t.placeholderData!==void 0&&f===void 0&&h==="pending"){let C;n?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=n.data,v=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,C!==void 0&&(h="success",f=$u(n?.data,C,t),d=!0)}if(t.select&&f!==void 0&&!v)if(n&&f===i?.data&&t.select===this.#h)f=this.#f;else try{this.#h=t.select,f=t.select(f),f=$u(n?.data,f,t),this.#f=f,this.#i=null}catch(C){this.#i=C}this.#i&&(m=this.#i,f=this.#f,g=Date.now(),h="error");const b=u.fetchStatus==="fetching",w=h==="pending",I=h==="error",y=w&&b,k=f!==void 0,E={status:h,fetchStatus:u.fetchStatus,isPending:w,isSuccess:h==="success",isError:I,isInitialLoading:y,isLoading:y,data:f,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:g,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:I&&!k,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:I&&k,isStale:dm(e,t),refetch:this.refetch,promise:this.#a,isEnabled:$t(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=K=>{E.status==="error"?K.reject(E.error):E.data!==void 0&&K.resolve(E.data)},D=()=>{const K=this.#a=E.promise=Tu();C(K)},U=this.#a;switch(U.status){case"pending":e.queryHash===r.queryHash&&C(U);break;case"fulfilled":(E.status==="error"||E.data!==U.value)&&D();break;case"rejected":(E.status!=="error"||E.error!==U.reason)&&D();break}}return E}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 hP(e,t){return $t(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _h(e,t){return hP(e,t)||e.state.data!==void 0&&Au(e,t,t.refetchOnMount)}function Au(e,t,r){if($t(t.enabled,e)!==!1&&Tr(t.staleTime,e)!=="static"){const o=typeof r=="function"?r(e):r;return o==="always"||o!==!1&&dm(e,t)}return!1}function wh(e,t,r,o){return(e!==t||$t(o.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&dm(e,r)}function dm(e,t){return $t(t.enabled,e)!==!1&&e.isStaleByTime(Tr(t.staleTime,e))}function gP(e,t){return!Eu(e.getCurrentResult(),t)}function xh(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=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=yS(t.options,t.fetchOptions),m=async(g,h,v)=>{if(u)return Promise.reject();if(h==null&&g.pages.length)return Promise.resolve(g);const w=(()=>{const S={client:t.client,queryKey:t.queryKey,pageParam:h,direction:v?"backward":"forward",meta:t.options.meta};return d(S),S})(),I=await f(w),{maxPages:y}=t.options,k=v?aP:iP;return{pages:k(g.pages,I,y),pageParams:k(g.pageParams,h,y)}};if(n&&i.length){const g=n==="backward",h=g?vP:Sh,v={pages:i,pageParams:a},b=h(o,v);s=await m(v,b,g)}else{const g=e??i.length;do{const h=c===0?a[0]??o.initialPageParam:Sh(o,s);if(c>0&&h==null)break;s=await m(s,h),c++}while(c<g)}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 Sh(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 vP(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var yP=class extends wS{#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||bP(),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=_S({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 bP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var _P=class extends Bi{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 yP({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=ga(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=ga(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=ga(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=ga(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=>hh(t,r))}findAll(e={}){return this.getAll().filter(t=>hh(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 ga(e){return e.options.scope?.id}var wP=class extends Bi{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 mP({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=>ph(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>ph(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()})})}},xP=class{#e;#t;#r;#o;#n;#s;#a;#i;constructor(e={}){this.#e=e.queryCache||new wP,this.#t=e.mutationCache||new _P,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(Tr(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=rP(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(Tr(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=xh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ut).catch(ut)}ensureInfiniteQueryData(e){return e.behavior=xh(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(ti(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#o.values()],r={};return t.forEach(o=>{ri(e,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(ti(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(o=>{ri(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()}},SS=_.createContext(void 0),kS=e=>{const t=_.useContext(SS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},SP=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(SS.Provider,{value:e,children:t})),ES=_.createContext(!1),kP=()=>_.useContext(ES);ES.Provider;function EP(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var IP=_.createContext(EP()),$P=()=>_.useContext(IP),TP=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},OP=e=>{_.useEffect(()=>{e.clearReset()},[e])},AP=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||sP(r,[e.error,o])),CP=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))}},NP=(e,t)=>e.isLoading&&e.isFetching&&!t,RP=(e,t)=>e?.suspense&&t.isPending,kh=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function PP(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=kP(),n=$P(),i=kS(),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",CP(a),TP(a,n),OP(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]),RP(a,l))throw kh(a,c,n);if(AP({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&&NP(l,o)&&(s?kh(a,c,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ut).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?l:c.trackResult(l)}function IS(e,t){return PP(e,pP)}function jP({auth:e,mcp:t,environment:r,gramEnvironment:o}){const n=Object.entries(e.headers??{}).map((a,s)=>`${a}:${s}`);return IS({queryKey:["mcpTools",t,o,...n],queryFn:async()=>(T.assert(!e.isLoading,"No auth found"),T.assert(t,"No MCP URL found"),await(await YR({name:"gram-elements-mcp-client",transport:{type:"http",url:t,headers:{...zP(r??{}),...e.headers,...o&&{"Gram-Environment":o}}}})).tools()),enabled:!e.isLoading&&!!t,staleTime:1/0,gcTime:1/0})}const Eh="MCP-";function zP(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,o])=>{const n=r.replace(/_/g,"-"),i=n.startsWith(Eh)?n:`${Eh}${n}`;return t[i]=o,t},{})}const $S=()=>{const e=P.useContext(T.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function DP(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const Oc={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},cr=console,jn={};Object.keys(Oc).forEach(e=>{jn[e]=cr[e]});const No="Datadog Browser SDK:",Q={debug:jn.debug.bind(cr,No),log:jn.log.bind(cr,No),info:jn.info.bind(cr,No),warn:jn.warn.bind(cr,No),error:jn.error.bind(cr,No)},Ac="https://docs.datadoghq.com",MP=`${Ac}/real_user_monitoring/browser/troubleshooting`,fm="More details:";function TS(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 Zo(e,t){return+e.toFixed(t)}function UP(e){return qi(e)&&e>=0&&e<=100}function qi(e){return typeof e=="number"}function ni(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 OS(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 tr=It(),Cc="WorkerGlobalScope"in tr;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,AS=!1;function LP(e){Cu=e}function FP(e){AS=e}function ne(e){return function(){return Or(e,this,arguments)}}function Or(e,t,r){try{return e.apply(t,r)}catch(o){mr(o)}}function mr(e){if(Nu(e),Cu)try{Cu(e)}catch(t){Nu(t)}}function Nu(...e){AS&&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 Ih(e){var t;const r=(t=tr.queueMicrotask)===null||t===void 0?void 0:t.bind(tr);typeof r=="function"?r(ne(e)):Promise.resolve().then(ne(e))}class he{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 CS(...e){return new he(t=>{const r=e.map(o=>o.subscribe(n=>t.notify(n)));return()=>r.forEach(o=>o.unsubscribe())})}class NS extends he{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 Ih(()=>{for(const n of this.buffer){if(r)return;t(n)}r||this.addObserver(t)}),o}unbuffer(){Ih(()=>{this.maxBufferSize=this.buffer.length=0})}}const Ke=1e3,lt=60*Ke,RS=60*lt,VP=24*RS,PS=365*VP;function Gi(e){return{relative:e,timeStamp:BP(e)}}function ZP(e){return{relative:pm(e),timeStamp:e}}function BP(e){const t=ct()-performance.now();return t>Hi()?Math.round(ho(t,e)):qP(e)}function jS(){return Math.round(ct()-ho(Hi(),performance.now()))}function oe(e){return qi(e)?Zo(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:Hi()}}function Ne(e,t){return t-e}function ho(e,t){return e+t}function pm(e){return e-Hi()}function qP(e){return Math.round(ho(Hi(),e))}function GP(e){return e<PS}let bl;function Hi(){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 Wi(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 oi(e,t){for(no.lastIndex=0;;){const r=no.exec(e);if(r){if(r[1]===t)return r[2]}else break}}function HP(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 WP(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 hm(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 JP(){return zS()===0}function KP(){return zS()===1}let va;function zS(){return va??(va=YP())}function YP(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 gm(e){return Ji(e,location.href).href}function XP(e){try{return!!Ji(e)}catch{return!1}}function QP(e){const t=Ji(e).pathname;return t[0]==="/"?t:`/${t}`}function Ji(e,t){const{URL:r}=ej();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 ej(){if(!_l){let e,t;try{e=document.createElement("iframe"),e.style.display="none",document.body.appendChild(e),t=e.contentWindow}catch{t=tr}_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 oi(document.cookie,e)}function tj(e){return HP(document.cookie).get(e)||[]}let wl;function Ir(e){return wl||(wl=WP(document.cookie)),wl.get(e)}function DS(e,t){Rc(e,"",0,t)}function rj(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 DS(t,e),o}catch(t){return Q.error(t),!1}}let xl;function MS(e=location.hostname,t=document.referrer){if(xl===void 0){const r=nj(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});DS(o,{domain:a}),xl=a}}return xl}function nj(e,t){try{return e||Ji(t).hostname}catch{}}const pr="_dd_s";function US(e,t){for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(t(o,r,e))return o}}function LS(e){return Object.values(e)}function jc(e){return Object.entries(e)}const vn=4*RS,FS=15*lt,oj=PS,VS="0",oo={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},ZS=/^([a-zA-Z]+)=([a-z0-9-]+)$/,vm="&";function ij(e){return!!e&&(e.indexOf(vm)!==-1||ZS.test(e))}const aj="1";function Gr(e,t){const r={isExpired:aj};return t.trackAnonymousUser&&e?.anonymousId&&(r.anonymousId=e?.anonymousId),r}function ja(e){return Vr(e)}function BS(e){return!ja(e)}function Bo(e){return e.isExpired!==void 0||!sj(e)}function sj(e){return(e.created===void 0||ct()-Number(e.created)<vn)&&(e.expire===void 0||ct()<Number(e.expire))}function qS(e){e.expire=String(ct()+FS)}function Ru(e){return jc(e).map(([t,r])=>t==="anonymousId"?`aid=${r}`:`${t}=${r}`).join(vm)}function zc(e){const t={};return ij(e)&&e.split(vm).forEach(r=>{const o=ZS.exec(r);if(o!==null){const[,n,i]=o;n==="aid"?t.anonymousId=i:t[n]=i}}),t}const cj="_dd",lj="_dd_r",uj="_dd_l",dj="rum",fj="logs";function mj(e){if(!Ir(pr)){const r=Ir(cj),o=Ir(lj),n=Ir(uj),i={};r&&(i.id=r),n&&/^[01]$/.test(n)&&(i[fj]=n),o&&/^[012]$/.test(o)&&(i[dj]=o),BS(i)&&(qS(i),e.persistSession(i))}}const pj=0;function $h(e){const t=gj(e);return t&&rj(t)?{type:oo.COOKIE,cookieOptions:t}:void 0}function hj(e,t){const r={isLockEnabled:JP(),persistSession:o=>Th(t,e,o,FS),retrieveSession:()=>GS(t,e),expireSession:o=>Th(t,e,Gr(o,e),vn)};return mj(r),r}function Th(e,t,r,o){let n=Ru(r);t.betaEncodeCookieOptions&&(n=Ru({...r,...Vr(r)?{}:{c:HS(e)}})),Rc(pr,n,t.trackAnonymousUser?oj:o,e)}function GS(e,t){if(t.betaEncodeCookieOptions)return vj(e);const r=Pc(pr);return zc(r)}function gj(e){const t={};if(t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains){const r=MS();if(!r)return;t.domain=r}return t}function HS(e){const t=e.domain?e.domain.split(".").length-1:0;let r=0;return r|=pj<<5,r|=t<<1,r|=e.crossSite?1:0,r.toString(16)}function vj(e){const t=tj(pr),r=HS(e);let o;for(const n of t.reverse())if(o=zc(n),o.c===r)break;return o==null||delete o.c,o??{}}const yj="_dd_test_";function Oh(){try{const e=et(),t=`${yj}${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 bj(e){return{isLockEnabled:!1,persistSession:WS,retrieveSession:JS,expireSession:t=>_j(t,e)}}function WS(e){localStorage.setItem(pr,Ru(e))}function JS(){const e=localStorage.getItem(pr);return zc(e)}function _j(e,t){WS(Gr(e,t))}const wj=10,xj=100,Sj=Ke,KS="--",YS=[];let za;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&&!Ej(f)?f:void 0}};if(za||(za=e),e!==za){YS.push(e);return}if(n&&r>=xj){Ah(t);return}let l,u=c();if(n){if(u.lock){ya(e,t,r);return}if(l=kj(),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&&(Bo(d)?a(d):(qS(d),n?s(d):i(d))),n&&!(d&&Bo(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),Ah(t)}function ya(e,t,r){Je(()=>{Hr(e,t,r+1)},wj)}function Ah(e){za=void 0;const t=YS.shift();t&&Hr(t,e)}function kj(){return et()+KS+Be()}function Ej(e){const[,t]=e.split(KS);return!t||Ne(Number(t),Be())>Sj}const Ch=Ke;function Ij(e){switch(e.sessionPersistence){case oo.COOKIE:return $h(e);case oo.LOCAL_STORAGE:return Oh();case void 0:{let t=$h(e);return!t&&e.allowFallbackToLocalStorage&&(t=Oh()),t}default:Q.error(`Invalid session persistence '${String(e.sessionPersistence)}'`)}}function $j(e,t){return e.type===oo.COOKIE?hj(t,e.cookieOptions):bj(t)}function Tj(e,t,r,o,n=$j(e,t)){const i=new he,a=new he,s=new he,c=po(m,Ch);let l;h();const{throttled:u,cancel:d}=Wi(()=>{Hr({process:S=>{if(ja(S))return;const E=g(S);return v(E),E},after:S=>{BS(S)&&!b()&&y(S),l=S}},n)},Ch);function f(){Hr({process:S=>b()?g(S):void 0},n)}function m(){const S=n.retrieveSession();Bo(S)?Hr({process:E=>Bo(E)?Gr(E,t):void 0,after:g},n):g(S)}function g(S){return Bo(S)&&(S=Gr(S,t)),b()&&(w(S)?I():(s.notify({previousState:l,newState:S}),l=S)),S}function h(){Hr({process:S=>{if(ja(S))return S.anonymousId=et(),Gr(S,t)},after:S=>{l=S}},n)}function v(S){if(ja(S))return!1;const E=o(S[r]);S[r]=E,delete S.isExpired,E!==VS&&!S.id&&(S.id=et(),S.created=String(ct()))}function b(){return l?.[r]!==void 0}function w(S){return l.id!==S.id||l[r]!==S[r]}function I(){l=Gr(l,t),a.notify()}function y(S){l=S,i.notify()}function k(S){Hr({process:E=>({...E,...S}),after:g},n)}return{expandOrRenewSession:u,expandSession:f,getSession:()=>l,renewObservable:i,expireObservable:a,sessionStateUpdateObservable:s,restartSession:h,expire:S=>{d(),S===!1&&l&&delete l.anonymousId,n.expireSession(l),g(Gr(l,t))},stop:()=>{Nc(c)},updateSessionState:k}}const Pu={GRANTED:"granted",NOT_GRANTED:"not-granted"};function Oj(e){const t=new he;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 ii(e){const t=yn(e);return t==="string"||t==="function"||e instanceof RegExp}function Dc(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 Aj=["chrome-extension://","moz-extension://"];function Nh(e){return Aj.some(t=>e.includes(t))}function Cj(e,t=""){if(Nh(e))return!1;const o=t.split(`
30
+ `).filter(n=>{const i=n.trim();return i.length&&/^at\s+|@/.test(i)})[1]||"";return Nh(o)}const Nj="Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.",Rj="SDK initialized on a non-allowed domain.";function Pj(e,t,r=typeof location<"u"?location.origin:""){const o=e.allowedTrackingOrigins;if(!o)return Cj(r,t)?(Q.error(Nj),!1):!0;const n=Dc(o,r);return n||Q.error(Rj),n}const XS="datad0g.com",jj="dd0g-gov.com",Qr="datadoghq.com",zj="datadoghq.eu",Dj="ddog-gov.com",Mj="pci.browser-intake-datadoghq.com",Uj=["ddsource","dd-api-key","dd-request-id"];function Wr(e,t,r){const o=Lj(e,t);return{build(n,i){const a=Fj(e,t,n,i,r);return o(a)},trackType:t}}function Lj(e,t){const r=`/api/v2/${t}`,o=e.proxy;if(typeof o=="string"){const i=gm(o);return a=>`${i}?ddforward=${encodeURIComponent(`${r}?${a}`)}`}if(typeof o=="function")return i=>o({path:r,parameters:i});const n=QS(t,e);return i=>`https://${n}${r}?${i}`}function QS(e,t){const{site:r=Qr,internalAnalyticsSubdomain:o}=t;if(e==="logs"&&t.usePciIntake&&r===Qr)return Mj;if(o&&r===Qr)return`${o}.${Qr}`;if(r===jj)return`http-intake.logs.${r}`;const n=r.split("."),i=n.pop();return`browser-intake-${n.join("-")}.${i}`}function Fj({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 Vj(e){const t=e.site||Qr,r=Zj(e.source),o=Bj({...e,site:t,source:r});return{replica:qj({...e,site:t,source:r}),site:t,source:r,...o}}function Zj(e){return e==="flutter"||e==="unity"?e:"browser"}function Bj(e){return{logsEndpointBuilder:Wr(e,"logs"),rumEndpointBuilder:Wr(e,"rum"),profilingEndpointBuilder:Wr(e,"profile"),sessionReplayEndpointBuilder:Wr(e,"replay"),exposuresEndpointBuilder:Wr(e,"exposures")}}function qj(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 Gj(e){return Uj.every(t=>e.includes(t))}const zn={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 Hj(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 Dn(e,t){return e!==void 0&&!UP(e)?(Q.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function Wj(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(!(!Hj(e.site)||!Dn(e.sessionSampleRate,"Session")||!Dn(e.telemetrySampleRate,"Telemetry")||!Dn(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!Dn(e.telemetryUsageSampleRate,"Telemetry Usage")||!Sl(e.version,"Version")||!Sl(e.env,"Env")||!Sl(e.service,"Service")||!Pj(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&&TS(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Cc?void 0:Ij(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,...Vj(e)}}}function Jj(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 zr;(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"})(zr||(zr={}));const ym=new Set;function Kj(e){Array.isArray(e)&&Yj(e.filter(t=>ds(zr,t)))}function Yj(e){e.forEach(t=>{ym.add(t)})}function Ki(e){return ym.has(e)}function Xj(){return ym}const io="?";function Yi(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=t2(a)||n2(a)||i2(a)||c2(a);s&&(!s.func&&s.line&&(s.func=io),o.push(s))}),o.length>0&&f2()&&e instanceof Error){const a=[];let s=e;for(;(s=Object.getPrototypeOf(s))&&tk(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 ek="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",ao="(?::(\\d+))",Qj=new RegExp(`^\\s*at (.*?) ?\\(${ek}${ao}?${ao}?\\)?\\s*$`,"i"),e2=new RegExp(`\\((\\S*)${ao}${ao}\\)`);function t2(e){const t=Qj.exec(e);if(!t)return;const r=t[2]&&t[2].indexOf("native")===0,o=t[2]&&t[2].indexOf("eval")===0,n=e2.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 r2=new RegExp(`^\\s*at ?${ek}${ao}?${ao}??\\s*$`,"i");function n2(e){const t=r2.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 o2=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function i2(e){const t=o2.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||io,line:+t[3],url:t[2]}}const a2=/^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i,s2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function c2(e){const t=a2.exec(e);if(!t)return;const r=t[3]&&t[3].indexOf(" > eval")>-1,o=s2.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 l2(e,t,r,o){if(t===void 0)return;const{name:n,message:i}=d2(e);return{name:n,message:i,stack:[{url:t,column:o,line:r}]}}const u2=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function d2(e){let t,r;return{}.toString.call(e)==="[object String]"&&([,t,r]=u2.exec(e)),{name:t,message:r}}function tk(e){return String(e.constructor).startsWith("class ")}let ba;function f2(){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=tk(Object.getPrototypeOf(t))&&r.stack!==t.stack,ba}function fs(e){const r=new Error(e);r.name="HandlingStack";let o;return Or(()=>{const n=Yi(r);n.stack=n.stack.slice(2),o=Xi(n)}),o}function Xi(e){let t=rk(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 rk(e){return`${e.name||"Error"}: ${e.message}`}function Vt(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;Or(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&&Or(c,null,[l]),l};return e[t]=a,{stop:()=>{i=!0,e[t]===a&&(e[t]=n)}}}function m2(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,nk=1024*bn,p2=/[^\u0000-\u007F]/;function ok(e){return p2.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function ik(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 go(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 h2=220*bn,g2="$",v2=3;function Te(e,t=h2){const r=Mn(Object.prototype),o=Mn(Array.prototype),n=[],i=new WeakMap,a=El(e,g2,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+v2,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=_2(e);if(!i||typeof i!="object")return y2(i);const a=zu(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 y2(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 zu(e){try{if(e instanceof Event)return b2(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 b2(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?zu(e.currentTarget):null,target:e.target?zu(e.target):null}}function _2(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 ak="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=Yi(t)),{startClocks:n,source:s,handling:c,handlingStack:r,componentStack:o,originalError:t,type:e?e.name:void 0,message:w2(e,l,i,t),stack:e?Xi(e):a?ak:void 0,causes:l?k2(t,s):void 0,fingerprint:x2(t),context:S2(t)}}function w2(e,t,r,o){return e?.message&&e?.name?e.message:t?"Empty message":`${r} ${go(Te(o))}`}function x2(e){return _n(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function S2(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 k2(e,t){let r=e;const o=[];for(;_n(r?.cause)&&o.length<10;){const n=Yi(r.cause);o.push({message:r.cause.message,source:t,type:n?.name,stack:n&&Xi(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 E2(){return new he(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}=I2(t),{stop:o}=$2(t);return()=>{r(),o()}})}function I2(e){return Vt(It(),"onerror",({parameters:[t,r,o,n,i]})=>{let a;_n(i)||(a=l2(t,r,o,n)),e(i??t,a)})}function $2(e){return Vt(It(),"onunhandledrejection",({parameters:[t]})=>{e(t.reason||"Empty reason")})}function T2(e){const t={version:"6.24.1",onReady(r){r()},...e};return Object.defineProperty(t,"_setDebug",{get(){return FP},enumerable:!1}),t}function O2(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=>TS(n,"onReady callback threw an error:")())}function sk(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 ai={intervention:"intervention",cspViolation:"csp_violation"};function A2(e,t){const r=[];t.includes(ai.cspViolation)&&r.push(N2(e));const o=t.filter(n=>n!==ai.cspViolation);return o.length&&r.push(C2(o)),CS(...r)}function C2(e){return new he(t=>{if(!window.ReportingObserver)return;const r=ne((n,i)=>n.forEach(a=>t.notify(R2(a)))),o=new window.ReportingObserver(r,{types:e,buffered:!0});return o.observe(),()=>{o.disconnect()}})}function N2(e){return new he(t=>{const{stop:r}=Oe(e,document,"securitypolicyviolation",o=>{t.notify(P2(o))});return r})}function R2(e){const{type:t,body:r}=e;return ck({type:r.id,message:`${t}: ${r.message}`,originalError:e,stack:lk(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function P2(e){const t=`'${e.blockedURI}' blocked by '${e.effectiveDirective}' directive`;return ck({type:e.effectiveDirective,message:`${ai.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:lk(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${hm(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function ck(e){return{startClocks:Ue(),source:vo.REPORT,handling:"unhandled",...e}}function lk(e,t,r,o,n){return r?Xi({name:e,message:t,stack:[{func:"?",url:r,line:o??void 0,column:n??void 0}]}):void 0}const j2=200;function _m(e){const{env:t,service:r,version:o,datacenter:n,sdkVersion:i,variant:a}=e,s=[$n("sdk_version",i??"6.24.1")];return t&&s.push($n("env",t)),r&&s.push($n("service",r)),o&&s.push($n("version",o)),n&&s.push($n("datacenter",n)),a&&s.push($n("variant",a)),s}function $n(e,t){const r=t?`${e}:${t}`:e;return(r.length>j2||D2(r))&&Q.warn(`Tag ${r} doesn't meet tag requirements and will be sanitized. ${fm} ${Ac}/getting_started/tagging/#defining-tags`),z2(r)}function z2(e){return e.replace(/,/g,"_")}function D2(e){return M2()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(e):!1}function M2(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function wm(e,t){const r=tr.__ddBrowserSdkExtensionCallback;r&&r({type:e,payload:t})}function ms(e,t,r=U2()){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 gr(...e){let t;for(const r of e)r!=null&&(t=ms(t,r));return t}function U2(){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 uk(){var e;const t=tr.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 L2(e){return e>=500}function F2(e){try{return e.clone()}catch{return}}const V2=80*bn,Z2=32,dk=20*nk,B2=lt,fk=Ke;function mk(e,t,r,o,n,i){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?hk(e,t,r,i,{onSuccess:()=>gk(0,t,r,o,n,i),onFailure:()=>{t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e}),pk(t,r,o,n,i)}}):t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e})}function pk(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=fk,gk(1,e,t,r,o,n)},onFailure:()=>{e.currentBackoffTime=Math.min(B2,e.currentBackoffTime*2),pk(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),q2(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 gk(e,t,r,o,n,i){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(n({message:`Reached max ${o} events size queued for upload: ${dk/nk}MiB`,source:vo.AGENT,startClocks:Ue()}),t.queueFullReported=!0);const a=t.queuedPayloads;for(t.queuedPayloads=vk();a.size()>0;)mk(a.dequeue(),t,r,o,n,i)}function q2(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||L2(e.status))}function G2(){return{transportStatus:0,currentBackoffTime:fk,bandwidthMonitor:H2(),queuedPayloads:vk(),queueFullReported:!1}}function vk(){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>=dk}}}function H2(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=V2&&this.ongoingRequestCount<Z2},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 Du=16*bn;function Sm(e,t,r=Du){const o=new he,n=G2();return{observable:o,send:i=>{for(const a of e)mk(i,n,(s,c)=>{Ki(zr.AVOID_FETCH_KEEPALIVE)?ps(a,s,c):K2(a,r,s,c)},a.trackType,t,o)},sendOnExit:i=>{for(const a of e)W2(a,r,i)}}}function W2(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){J2(n)}ps(e,r)}let Rh=!1;function J2(e){Rh||(Rh=!0,mr(e))}function K2(e,t,r,o){if(Y2()&&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 Y2(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function yo(){const e=X2();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 yk(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 X2(){return It().DatadogEventBridge}const Ln={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Q2(e){return new he(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 bk(e){return LS(Ln).includes(e)}const Ph=256*bn;function _k({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=go(u),m=e.estimateEncodedBytesCount(f);if(m>=Ph){Q.warn(`Discarded a message whose size was bigger than the maximum allowed size ${Ph/bn}KiB. ${fm} ${MP}/#technical-limitations`);return}a(d)&&s(d),i(f,m,d)}function l(u){const d=LS(o).join(`
34
+ `);o={};const f=bk(u.reason),m=f?t.sendOnExit:t.send;if(f&&e.isAsync){const g=e.finishSync();g.outputBytesCount&&m(jh(g));const h=[g.pendingData,d].filter(Boolean).join(`
35
+ `);h&&m({data:h,bytesCount:ok(h)})}else d&&e.write(e.isEmpty?d:`
36
+ ${d}`),e.finish(g=>{m(jh(g))})}return{flushController:r,add:c,upsert:c,stop:n.unsubscribe}}function jh(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 ez=30*Ke,tz=Cc?1:50;function wk({pageMayExitObservable:e,sessionExpireObservable:t}){const r=e.subscribe(d=>s(d.reason)),o=t.subscribe(()=>s("session_expire")),n=new he(()=>()=>{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")},ez))}function u(){vt(c),c=void 0}return{flushObservable:n,get messagesCount(){return a},notifyBeforeAddMessage(d){i+d>=Du&&s("bytes_limit"),a+=1,i+=d,l()},notifyAfterAddMessage(d=0){i+=d,a>=tz?s("messages_limit"):i>=Du&&s("bytes_limit")},notifyAfterRemoveMessage(d){i-=d,a-=1,a===0&&u()}}}const Dr="DISCARDED",wt="SKIPPED";function rz(){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===Dr)return Dr;a!==wt&&n.push(a)}return gr(...n)}}}const Ar={LOG:"log",CONFIGURATION:"configuration",USAGE:"usage"},nz=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],oz=1,iz=[Dj],az=15;let $l;function bo(){return $l||($l=new NS(100)),$l}function sz(e,t,r,o,n,i){const a=new he,{stop:s}=lz(t,o,n,i,a),{enabled:c,metricsEnabled:l}=cz(e,t,r,a);return{stop:s,enabled:c,metricsEnabled:l}}function cz(e,t,r,o,n=oz,i=az){const a={},s=!iz.includes(t.site)&&Xr(t.telemetrySampleRate),c={[Ar.LOG]:s,[Ar.CONFIGURATION]:s&&Xr(t.telemetryConfigurationSampleRate),[Ar.USAGE]:s&&Xr(t.telemetryUsageSampleRate),metric:s&&Xr(n)},l=uz(),u=bo();return u.subscribe(({rawEvent:f,metricName:m})=>{if(m&&!c.metric||!c[f.type])return;const g=m||f.status||f.type;let h=a[g];if(h||(h=a[g]=new Set),h.size>=i)return;const v=go(f);if(h.has(v))return;const b=r.triggerHook(1,{startTime:Ue().relative});if(b===Dr)return;const w=d(b,e,f,l);o.notify(w),wm("telemetry",w),h.add(v)}),u.unbuffer(),LP(km),{enabled:s,metricsEnabled:c.metric};function d(f,m,g,h){const b={type:"telemetry",date:Ue().timeStamp,service:m,version:"6.24.1",source:"browser",_dd:{format_version:2},telemetry:gr(g,{runtime_env:h,connectivity:uk(),sdk_setup:"npm"}),ddtags:_m(t).join(","),experimental_features:Array.from(Xj())};return gr(b,f)}}function lz(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&&dz(e)&&a.push(e.replica.rumEndpointBuilder);const s=_k({encoder:o(4),request:Sm(a,t),flushController:wk({pageMayExitObservable:r,sessionExpireObservable:new he})});i.push(s.stop);const c=n.subscribe(s.add);i.push(c.unsubscribe)}return{stop:()=>i.forEach(a=>a())}}function uz(){var e;return{is_local_file:((e=tr.location)===null||e===void 0?void 0:e.protocol)==="file:",is_worker:Cc}}function dz(e){return e.site===XS}function _o(e,t){Nu(Oc.debug,e,t),bo().notify({rawEvent:{type:Ar.LOG,message:e,status:"debug",...t}})}function km(e,t){bo().notify({rawEvent:{type:Ar.LOG,status:"error",...mz(e),...t}})}function fz(e){bo().notify({rawEvent:{type:Ar.CONFIGURATION,configuration:e}})}function Qi(e,t){bo().notify({rawEvent:{type:Ar.LOG,message:e,status:"debug",...t},metricName:e})}function Ve(e){bo().notify({rawEvent:{type:Ar.USAGE,usage:e}})}function mz(e){if(_n(e)){const t=Yi(e);return{error:{kind:t.name,stack:Xi(pz(t))},message:t.message}}return{error:{stack:ak},message:`Uncaught ${go(e)}`}}function pz(e){return e.stack=e.stack.filter(t=>!t.url||nz.some(r=>t.url.startsWith(r))),e}function xk(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,hz=lt;let Ro=null;const Da=new Set;function gz(){Da.forEach(e=>e())}function wo({expireDelay:e,maxEntries:t}){let r=[];Ro||(Ro=po(()=>gz(),hz));const o=()=>{const u=_t()-e;for(;r.length>0&&r[r.length-1].endTime<u;)r.pop()};Da.add(o);function n(u,d){const f={value:u,startTime:d,endTime:_a,remove:()=>{xk(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=ho(u,d);return r.filter(m=>m.startTime<=f&&u<=m.endTime).map(m=>m.value)}function c(){r=[]}function l(){Da.delete(o),Da.size===0&&Ro&&(Nc(Ro),Ro=null)}return{add:n,find:i,closeActive:a,findAll:s,reset:c,stop:l}}const vz="datadog-synthetics-public-id",yz="datadog-synthetics-result-id",bz="datadog-synthetics-injects-rum";function Sk(){return Cc?!1:!!(tr._DATADOG_SYNTHETICS_INJECTS_RUM||Ir(bz))}function kk(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||Ir(vz);return typeof e=="string"?e:void 0}function Ek(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||Ir(yz);return typeof e=="string"?e:void 0}function Ik(){return!!(kk()&&Ek())}const _z=lt,wz=vn;function xz(e,t,r,o){const n=new he,i=new he,a=Tj(e.sessionStoreStrategyType,e,t,r),s=wo({expireDelay:wz});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),Ki(zr.SHORT_SESSION_INVESTIGATION)){const l=a.getSession();l&&$z(e,l)}o.observable.subscribe(()=>{o.isGranted()?a.expandOrRenewSession():a.expire(!1)}),Sz(e,()=>{o.isGranted()&&a.expandOrRenewSession()}),kz(e,()=>a.expandSession()),Ez(e,()=>a.restartSession());function c(){const l=a.getSession();return l?{id:l.id,trackingType:l[t],isReplayForced:!!l.forcedReplay,anonymousId:l.anonymousId}:(Iz(e).catch(()=>{}),{id:"invalid",trackingType:VS,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 Sz(e,t){const{stop:r}=hr(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function kz(e,t){const r=()=>{document.visibilityState==="visible"&&t()},{stop:o}=Oe(e,document,"visibilitychange",r);po(r,_z)}function Ez(e,t){const{stop:r}=Oe(e,window,"resume",t,{capture:!0})}async function Iz(e){const t=e.sessionStoreStrategyType;if(!t)return;let r,o;t.type===oo.COOKIE?(r=GS(t.cookieOptions,e),o={cookie:await $k(),currentDomain:`${window.location.protocol}//${window.location.hostname}`}):r=JS(),_o("Unexpected session state",{sessionStoreStrategyType:t.type,session:r,isSyntheticsTest:Ik(),createdTimestamp:r?.created,expireTimestamp:r?.expire,...o})}function $z(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=US(a.changed,l=>l.name===pr);if(!s)return;const c=ct()-r;if(c>14*lt)n();else{const l=zc(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(mr)}}}}async function $k(){let e;return"cookieStore"in window?e=await window.cookieStore.getAll(pr):e=document.cookie.split(/\s*;\s*/).filter(t=>t.startsWith(pr)),{count:e.length,domain:MS()||"undefined",...e}}function Tz(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(r,o){const n=ok(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 Oz{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 Az=3e3;function Tl(e,t,r=Az){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 Cz(e,t){return new Promise(r=>{Em(e,t,r)})}let Ol;const Im=new WeakMap;function Nz(e){return Ol||(Ol=Rz(e)),Ol}function Rz(e){return new he(t=>{const{stop:r}=Vt(XMLHttpRequest.prototype,"open",Pz),{stop:o}=Vt(XMLHttpRequest.prototype,"send",i=>{jz(i,e,t)},{computeHandlingStack:!0}),{stop:n}=Vt(XMLHttpRequest.prototype,"abort",zz);return()=>{r(),o(),n()}})}function Pz({target:e,parameters:[t,r]}){Im.set(e,{state:"open",method:String(t).toUpperCase(),url:gm(String(r))})}function jz({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}=Vt(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(ni(d))},{stop:u}=Oe(o,e,"loadend",l);n.notify(a)}function zz({target:e}){const t=Im.get(e);t&&(t.isAborted=!0)}async function Dz(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?ik(o):void 0}let Al;const Tk=[];function Ok({responseBodyAction:e}={}){return e&&Tk.push(e),Al||(Al=Mz()),Al}function Mz(){return new he(e=>{if(!tr.fetch)return;const{stop:t}=Vt(tr,"fetch",r=>Uz(r,e),{computeHandlingStack:!0});return t})}function Uz({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:gm(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=>{Lz(o,d,u).catch(mr)})}async function Lz(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=Tk.reduce((c,l)=>Math.max(c,l(i)),0);if(s!==0){const c=F2(a);if(c&&c.body)try{const l=await Dz(c.body,{collectStreamBody:s===2});i.responseBody=l&&new TextDecoder().decode(l)}catch{}}e.notify(i)}function Ak(e,t){if(window.requestIdleCallback&&window.cancelIdleCallback){const r=window.requestIdleCallback(ne(e),t);return()=>window.cancelIdleCallback(r)}return Vz(e)}const Fz=50;function Vz(e){const t=ct(),r=Je(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,Fz-(ct()-t))})},0);return()=>vt(r)}const Zz=Ke,Bz=30;function qz(){const e=[];function t(o){let n;if(o.didTimeout){const i=performance.now();n=()=>Bz-(performance.now()-i)}else n=o.timeRemaining.bind(o);for(;n()>0&&e.length;)e.shift()();e.length&&r()}function r(){Ak(t,{timeout:Zz})}return{push(o){e.push(o)===1&&r()},stop(){e.length=0}}}let Cl={};function Gz(e){const t=e.map(r=>(Cl[r]||(Cl[r]=Hz(r)),Cl[r]));return CS(...t)}function Hz(e){return new he(t=>{const r=cr[e];return cr[e]=(...o)=>{r.apply(console,o);const n=fs("console error");Or(()=>{t.notify(Wz(o,e,n))})},()=>{cr[e]=r}})}function Wz(e,t,r){const o=e.map(n=>Jz(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 Jz(e){return typeof e=="string"?Te(e):_n(e)?rk(Yi(e)):go(Te(e),void 0,2)}const Kz=500;function Yz(){const e=[];return{add:n=>{e.push(n)>Kz&&e.splice(0,1)},remove:n=>{xk(e,n)},drain:n=>{e.forEach(i=>i(n)),e.length=0}}}function Xz(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"&&!zh(o[n])&&(o[n]=String(o[n])),i&&zh(o[n])&&Q.warn(`The property ${n} of ${r} is required; context will not be sent to the intake.`);return o}function zh(e){return e==null||e===""}function Mc(e="",{propertiesConfig:t={}}={}){let r={};const o=new he,n={getContext:()=>xm(r),setContext:i=>{Xz(i)?r=Te(Nl(i,t,e)):n.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=Te(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 Qz="_dd_c",eD=[];function $m(e,t,r,o){const n=tD(r,o);eD.push(Oe(e,window,"storage",({key:l})=>{n===l&&a()})),t.changeObservable.subscribe(s);const i=gr(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 tD(e,t){return`${Qz}_${e}_${t}`}function rD(e,t,r){const o=Ck();return t.storeContextsAcrossPages&&$m(t,o,r,4),e.register(0,()=>{const n=o.getContext();return Vr(n)||!n.id?wt:{account:n}}),o}function Ck(){return Mc("account",{propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}})}function nD(e,t,r,o){const n=Nk();return t.storeContextsAcrossPages&&$m(t,n,r,2),e.register(0,()=>({context:n.getContext()})),n}function Nk(){return Mc("global context")}function oD(e,t,r,o){const n=Rk();return t.storeContextsAcrossPages&&$m(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 Rk(){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},iD=500;function aD(e=E2){const t=new NS(iD),r=e().subscribe(o=>{t.notify({type:0,error:o})});return{observable:t,stop:()=>{r.unsubscribe()}}}function sD(){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"},Pk={LONG_TASK:"long-task",LONG_ANIMATION_FRAME:"long-animation-frame"},lr={INITIAL_LOAD:"initial_load",ROUTE_CHANGE:"route_change",BF_CACHE:"bf_cache"},Lc={CLICK:"click",CUSTOM:"custom"},Po={RAGE_CLICK:"rage_click",ERROR_CLICK:"error_click",DEAD_CLICK:"dead_click"},si={DURATION:"duration",OPERATION_STEP:"operation_step"};function cD(){return{vitalsByName:new Map,vitalsByReference:new WeakMap}}function lD(e,t,r){function o(a){return!t.wasInPageStateDuringPeriod("frozen",a.startClocks.relative,a.duration)}function n(a){o(a)&&e.notify(12,Dh(a))}function i(a,s,c,l){if(!Ki(zr.FEATURE_OPERATION_VITAL))return;const{operationKey:u,context:d,description:f}=c||{},m={name:a,type:si.OPERATION_STEP,operationKey:u,failureReason:l,stepType:s,startClocks:Ue(),context:Te(d),description:f};e.notify(12,Dh(m))}return{addOperationStepVital:i,addDurationVital:n,startDurationVital:(a,s={})=>jk(r,a,s),stopDurationVital:(a,s={})=>{zk(n,r,a,s)}}}function jk({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(uD(i,i.startClocks,n,Ue())),typeof o=="string"?t.delete(o):r.delete(o))}function uD(e,t,r,o){var n;return{name:e.name,type:si.DURATION,startClocks:t,duration:Ne(t.timeStamp,o.timeStamp),context:gr(e.context,r.context),description:(n=r.description)!==null&&n!==void 0?n:e.description}}function Dh(e){const{startClocks:t,type:r,name:o,description:n,context:i}=e,a={id:et(),type:r,name:o,description:n,...r===si.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===si.DURATION?e.duration:void 0,domainContext:{}}}function Dk(e,t,r){if(e)for(const o of e){const n=o[t];n&&n(r)}}const Mh=new Map;function Mk(e,t){if(t===100)return!0;if(t===0)return!1;const r=Mh.get(t);if(r&&e===r.sessionId)return r.decision;let o;return window.BigInt?o=dD(BigInt(`0x${e.split("-")[4]}`),t):o=Xr(t),Mh.set(t,{sessionId:e,decision:o}),o}function dD(e,t){const r=BigInt("1111111111111111111"),o=BigInt("0x10000000000000000"),n=e*r%o;return Number(n)<=t/100*Number(o)}function fD(){return Lk(64)}function Uk(){return Lk(63)}function Lk(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 Tn(e){return e.toString(16).padStart(16,"0")}function mD(e){const t=e;return yn(t)==="object"&&ii(t.match)&&Array.isArray(t.propagatorTypes)}function pD(e){e.status===0&&!e.isAborted&&(e.traceId=void 0,e.spanId=void 0,e.traceSampled=void 0)}function hD(e,t,r,o){return{clearTracingIfNeeded:pD,traceFetch:n=>Uh(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=ni(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)=>Uh(e,n,t,r,o,a=>{Object.keys(a).forEach(s=>{i.setRequestHeader(s,a[s])})})}}function Uh(e,t,r,o,n,i){const a=r.findTrackedSession();if(!a)return;const s=e.allowedTracingUrls.find(u=>Dc([u.match],t.url,!0));if(!s)return;const c=Mk(a.id,e.traceSampleRate);(c||e.traceContextInjection===ju.ALL)&&(t.traceSampled=c,t.traceId=fD(),t.spanId=Uk(),i(gD(t.traceId,t.spanId,t.traceSampled,a.id,s.propagatorTypes,o,n,e)))}function gD(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${Tn(e)}-${Tn(t)}-0${r?"1":"0"}`,tracestate:`dd=s:${r?"1":"0"};o:rum`});break}case"b3":{Object.assign(c,{b3:`${Tn(e)}-${Tn(t)}-${r?"1":"0"}`});break}case"b3multi":{Object.assign(c,{"X-B3-TraceId":Tn(e),"X-B3-SpanId":Tn(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,g])=>`${m}=${encodeURIComponent(g)}`).join(",");f&&(c.baggage=f)}return c}const Fk=["tracecontext","datadog"];function vD(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(!Dn(e.sessionReplaySampleRate,"Session Replay")||!Dn(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=yD(e);if(!l)return;const u=Wj(e,t),d=_D(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:qi(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(zn,e.defaultPrivacyLevel)?e.defaultPrivacyLevel:zn.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 yD(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=>{ii(r)?t.push({match:r,propagatorTypes:Fk}):mD(r)?t.push(r):Q.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",r)}),t}function bD(e){const t=new Set;return rn(e.allowedTracingUrls)&&e.allowedTracingUrls.forEach(r=>{ii(r)?Fk.forEach(o=>t.add(o)):yn(r)==="object"&&Array.isArray(r.propagatorTypes)&&r.propagatorTypes.forEach(o=>t.add(o))}),Array.from(t)}function _D(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=>{ii(r)?t.push({match:r,trackPayload:!1,trackResponseErrors:!1}):r&&typeof r=="object"&&"match"in r&&ii(r.match)&&t.push({match:r.match,trackPayload:!!r.trackPayload,trackResponseErrors:!!r.trackResponseErrors})}),t}function wD(e){return rn(e)&&e.some(t=>typeof t=="object"&&"trackPayload"in t?!!t.trackPayload:!1)}function xD(e){return rn(e)&&e.some(t=>typeof t=="object"&&"trackResponseErrors"in t?!!t.trackResponseErrors:!1)}function SD(e){var t;const r=Jj(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:wD(e.allowedGraphQlUrls),use_track_graph_ql_response_errors:xD(e.allowedGraphQlUrls),selected_tracing_propagators:bD(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 kD(e){const t=[];let r=0,o;const n={quote:void 0,escapeSequence:void 0};let i="";for(const a of e){if(o=Lh[r].find(s=>AD[s](a,n)),!o)return[];if(n.escapeSequence!==void 0&&o!==12){if(!RD(n.escapeSequence))return[];i+=jD(n.escapeSequence),n.escapeSequence=void 0}CD.includes(o)?i+=a:ND.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 Lh[r].includes(1)?(i!==""&&t.push(i),t):[]}const ED=/[a-zA-Z_$]/,ID=/[a-zA-Z0-9_$]/,$D=/[0-9]/,TD=/[a-fA-F0-9]/,OD=`'"`,AD={0:()=>!1,1:()=>!1,2:e=>ED.test(e),3:e=>ID.test(e),4:e=>e===".",5:e=>e==="[",6:e=>e==="]",7:e=>$D.test(e),8:e=>OD.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?TD.test(e):!1},Lh={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]},CD=[2,3,7,10],ND=[4,5,6];function RD(e){return`"'/\\bfnrt`.includes(e)||e.startsWith("u")&&e.length===5}const PD={'"':'"',"'":"'","/":"/","\\":"\\",b:"\b",f:"\f",n:`
37
+ `,r:"\r",t:" "};function jD(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):PD[e]}const zD="v1",DD=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function MD(e,t){let r;const o=LD(),n=await BD(e);return n.ok?(o.increment("fetch","success"),r=UD(e,n.value,t,o)):(o.increment("fetch","failure"),Q.error(n.error)),Qi("remote configuration metrics",{metrics:o.get()}),r}function UD(e,t,r,o){const n={...e};return DD.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(FD(f)){if(VD(f)){const m=f.rcSerializedType;switch(m){case"string":return f.value;case"regex":return Vk(f.value);case"dynamic":return s(f);default:Q.error(`Unsupported remote configuration: "rcSerializedType": "${m}"`);return}}return OS(f,i)}return f}function a(f,m){m.forEach(({key:g,value:h})=>{f.setContextProperty(g,i(h))})}function s(f){const m=f.strategy;let g;switch(m){case"cookie":g=c(f);break;case"dom":g=l(f);break;case"js":g=d(f);break;default:Q.error(`Unsupported remote configuration: "strategy": "${m}"`);return}const h=f.extractor;return h!==void 0&&typeof g=="string"?ZD(h,g):g}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 g;try{g=document.querySelector(f)}catch{Q.error(`Invalid selector in the remote configuration: '${f}'`),o.increment("dom","failure");return}if(!g){o.increment("dom","missing");return}if(u(g,m)){Q.error(`Forbidden element selected by the remote configuration: '${f}'`),o.increment("dom","failure");return}const h=m!==void 0?g.getAttribute(m):g.textContent;if(h===null){o.increment("dom","missing");return}return o.increment("dom","success"),h}function u(f,m){return f.getAttribute("type")==="password"&&m==="value"}function d({path:f}){let m=window;const g=kD(f);if(g.length===0){Q.error(`Invalid JSON path in the remote configuration: '${f}'`),o.increment("js","failure");return}for(const h of g){if(!(h in m)){o.increment("js","missing");return}try{m=m[h]}catch(v){Q.error(`Error accessing: '${f}'`,v),o.increment("js","failure");return}}return o.increment("js","success"),m}}function LD(){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 FD(e){return typeof e=="object"&&e!==null}function VD(e){return"rcSerializedType"in e}function Vk(e){try{return new RegExp(e)}catch{Q.error(`Invalid regex in the remote configuration: '${e}'`)}}function ZD(e,t){const r=Vk(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 BD(e){let t;try{t=await fetch(qD(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 qD(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${QS("rum",e)}/${zD}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function GD({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,o,n){const i=Yz(),a=Nk();Rl(a,Ze.globalContext,i);const s=Rk();Rl(s,Ze.userContext,i);const c=Ck();Rl(c,Ze.accountContext,i);let l,u,d,f;const m=r.observable.subscribe(h),g={};function h(){if(!d||!f||!r.isGranted())return;m.unsubscribe();let y;if(f.trackViewsManually){if(!l)return;i.remove(l.callback),y=l.options}const k=n(f,u,y);i.drain(k)}function v(y,k){const S=sn();if(S&&(y=HD(y)),d=y,fz(SD(y)),f){sk("DD_RUM",y);return}const E=vD(y,k);if(E){if(!S&&!E.sessionStoreStrategyType){Q.warn("No storage available for session. We will not send any data.");return}E.compressIntakeRequests&&!S&&t&&(u=t(E,"Datadog RUM",_e),!u)||(f=E,Ok().subscribe(_e),r.tryToInit(E.trackingConsent),h())}}const b=y=>{i.add(k=>k.addDurationVital(y))};return{init(y,k,S){if(!y){Q.error("Missing configuration");return}Kj(y.enableExperimentalFeatures),d=y,!(e&&Sk())&&(Dk(y.plugins,"onInit",{initConfiguration:y,publicApi:k}),y.remoteConfigurationId?MD(y,{user:s,context:a}).then(E=>{E&&v(E,S)}).catch(mr):v(y,S))},get initConfiguration(){return d},getInternalContext:_e,stopSession:_e,addTiming(y,k=Be()){i.add(S=>S.addTiming(y,k))},startView(y,k=Ue()){const S=E=>{E.startView(y,k)};i.add(S),l||(l={options:y,callback:S},h())},setViewName(y){i.add(k=>k.setViewName(y))},setViewContext(y){i.add(k=>k.setViewContext(y))},setViewContextProperty(y,k){i.add(S=>S.setViewContextProperty(y,k))},getViewContext:()=>g,globalContext:a,userContext:s,accountContext:c,addAction(y){i.add(k=>k.addAction(y))},addError(y){i.add(k=>k.addError(y))},addFeatureFlagEvaluation(y,k){i.add(S=>S.addFeatureFlagEvaluation(y,k))},startDurationVital(y,k){return jk(o,y,k)},stopDurationVital(y,k){zk(b,o,y,k)},addDurationVital:b,addOperationStepVital:(y,k,S,E)=>{i.add(C=>C.addOperationStepVital(Te(y),k,Te(S),Te(E)))}}}function HD(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 WD(e,t,r,o={}){const n=Oj(),i=cD(),a=aD().observable;let s=GD(o,n,i,(d,f,m)=>{const g=f&&o.createDeflateEncoder?v=>o.createDeflateEncoder(d,f,v):Tz,h=e(d,t,r,m,g,n,i,a,o.sdkName);return t.onRumStart(h.lifeCycle,d,h.session,h.viewHistory,f,h.telemetry),r.onRumStart(h.lifeCycle,h.hooks,d,h.session,h.viewHistory,g),s=JD(s,h),Dk(d.plugins,"onRumStart",{strategy:s,addEvent:h.addEvent}),h});const c=()=>s,l=ne(d=>{const f=typeof d=="object"?d:{name:d};s.startView(f),Ve({feature:"start-view"})}),u=T2({init:d=>{const f=new Error().stack;Or(()=>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");Or(()=>{s.addAction({name:Te(d),context:Te(f),startClocks:Ue(),type:Lc.CUSTOM,handlingStack:m}),Ve({feature:"add-action"})})},addError:(d,f)=>{const m=fs("error");Or(()=>{s.addError({error:d,handlingStack:m,context:Te(f),startClocks:Ue()}),Ve({feature:"add-error"})})},addTiming:ne((d,f)=>{s.addTiming(Te(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(Te(d),Te(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:Te(d),type:si.DURATION,startClocks:ZP(f.startTime),duration:f.duration,context:Te(f&&f.context),description:Te(f&&f.description)})}),startDurationVital:ne((d,f)=>(Ve({feature:"start-duration-vital"}),s.startDurationVital(Te(d),{context:Te(f&&f.context),description:Te(f&&f.description)}))),stopDurationVital:ne((d,f)=>{Ve({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?Te(d):d,{context:Te(f&&f.context),description:Te(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 JD(e,t){return{init:r=>{sk("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function KD(){const e=Zk();return new he(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 Zk(){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 YD(){const e=new he,{stop:t}=Vt(window,"open",()=>e.notify());return{observable:e,stop:t}}function XD(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 QD=Oz,e4=vn;function t4(e){const t=wo({expireDelay:e4});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 Bk="initial_document",r4=[[at.DOCUMENT,e=>Bk===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 n4(e){const t=e.name;if(!XP(t))return at.OTHER;const r=QP(t);for(const[o,n]of r4)if(n(e.initiatorType,r))return o;return at.OTHER}function Fh(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function qk(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function o4(e){const{duration:t,startTime:r,responseEnd:o}=e;return t===0&&r<o?Ne(r,o):t}function i4(e){if(!Hk(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,g={download:qr(t,f,m),first_byte:qr(t,d,f)};return 0<o&&o<r&&(g.worker=qr(t,o,r)),r<u&&(g.connect=qr(t,c,u),c<=l&&l<=u&&(g.ssl=qr(t,l,u))),r<s&&(g.dns=qr(t,a,s)),t<i&&(g.redirect=qr(t,n,i)),g}function Gk(e){return e.duration>=0}function Hk(e){const t=Fh(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=a4(e)?Fh(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function a4(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 s4(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function c4(e){return e.deliveryType===""?"other":e.deliveryType}function l4(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 Tm(e){return e&&(!Gj(e)||Ki(zr.TRACK_INTAKE_REQUESTS))}const u4=/data:(.+)?(;base64)?,/g,d4=24e3;function Wk(e,t=d4){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(u4);return r?`${r[0]}[...]`:e}const f4=32*bn;function m4(e,t){const r=h4(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const o=p4(e.responseBody);o&&(r.errors_count=o.length,r.errors=o)}return r}}function p4(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 Jk(e,t){return t.allowedGraphQlUrls.find(r=>Dc([r.match],e))}function h4(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=g4(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?hm(o,f4,"..."):void 0}}function g4(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let Vh=1;function v4(e,t,r,o,n){const i=hD(t,r,o,n);y4(e,t,i),b4(e,t,i)}function y4(e,t,r){const o=Nz(t).subscribe(n=>{const i=n;if(Tm(i.url))switch(i.state){case"start":r.traceXhr(i,i.xhr),i.requestIndex=Kk(),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 b4(e,t,r){const o=Ok({responseBodyAction:n=>{var i;return!((i=Jk(n.url,t))===null||i===void 0)&&i.trackResponseErrors?2:1}}).subscribe(n=>{var i;const a=n;if(Tm(a.url))switch(a.state){case"start":r.traceFetch(a),a.requestIndex=Kk(),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 Kk(){const e=Vh;return Vh+=1,e}function Yk(e){return qi(e)&&e<0?void 0:e}function Xk({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 _4(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 rr(e,t){return new he(r=>{if(!window.PerformanceObserver)return;const o=c=>{const l=S4(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,w4(e);let s;return!Zr(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=_4(e,c=>{o([c])})),()=>{a.disconnect(),s&&s(),vt(n)}})}let jo;function w4(e){return!jo&&x4()&&"addEventListener"in performance&&(jo=Oe(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{jo?.stop()}}function x4(){return window.performance!==void 0&&"getEntries"in performance}function Zr(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function S4(e){return e.filter(t=>!k4(t))}function k4(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!Tm(e.name)||!Gk(e))}function Mu(e){return e.nodeType===Node.TEXT_NODE}function E4(e){return e.nodeType===Node.COMMENT_NODE}function vr(e){return e.nodeType===Node.ELEMENT_NODE}function Om(e){return vr(e)&&!!e.shadowRoot}function Qk(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&vr(t.host)}function I4(e){return e.childNodes.length>0||Om(e)}function $4(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;Om(e)&&t(e.shadowRoot)}function eE(e){return Qk(e)?e.host:e.parentNode}const tE=100,T4=100,Zh="data-dd-excluded-activity-mutations";function Am(e,t,r,o,n,i){const a=A4(e,t,r,o);return O4(a,n,i)}function O4(e,t,r){let o,n=!1;const i=Je(ne(()=>l({hadActivity:!1})),tE),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})),T4))}),c=()=>{n=!0,vt(i),vt(o),vt(a),s.unsubscribe()};function l(u){n||(c(),t(u))}return{stop:c}}function A4(e,t,r,o){return new he(n=>{const i=[];let a,s=0;return i.push(t.subscribe(l=>{l.every(C4)||c()}),r.subscribe(c),rr(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 Dc(e.excludedActivityUrls,t)}function C4(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&vr(t)&&t.matches(`[${Zh}], [${Zh}] *`))}const Fc="data-dd-action-name",rE="Masked Element",nE=[Fc,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],N4=[iE,P4],R4=[iE,j4,z4];function ea(e,t){if(!e.isConnected)return;let r,o=e;for(;o&&o.nodeName!=="HTML";){const n=Bh(o,N4,M4,t,r);if(n)return n;r=Bh(o,R4,U4,t,r)||Vc(D4(o),r),o=o.parentElement}return r}function oE(e){return/[0-9]/.test(e)}function P4(e){if(e.id&&!oE(e.id))return`#${CSS.escape(e.id)}`}function j4(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const o=t[r];if(!oE(o))return`${CSS.escape(e.tagName)}.${CSS.escape(o)}`}}function z4(e){return CSS.escape(e.tagName)}function iE(e,t){if(t){const o=r(t);if(o)return o}for(const o of nE){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 D4(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 Bh(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 M4(e,t,r){return e.ownerDocument.querySelectorAll(Vc(t,r)).length===1}function U4(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:zn.ALLOW,MASK:zn.MASK,MASK_USER_INPUT:zn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:zn.MASK_UNLESS_ALLOWLISTED},Cm="data-dd-privacy",L4="hidden",F4="dd-privacy-",Ma="***",V4="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",Z4={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},B4="x";function Jr(e){return`[${Cm}="${e}"], .${F4}${e}`}function ta(e,t,r){if(r&&r.has(e))return r.get(e);const o=eE(e),n=o?ta(o,t,r):t,i=sE(e),a=aE(i,n);return r&&r.set(e,a),a}function aE(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 sE(e){if(vr(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(G4(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:!uE(e.textContent||""):wa(e);case ae.MASK_USER_INPUT:return Mu(e)?wa(e.parentNode):wa(e);default:return!1}}function cE(e,t,r,o,n){if(o!==ae.MASK&&o!==ae.MASK_UNLESS_ALLOWLISTED||t===Cm||nE.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!!Z4[t.tagName]}const lE=e=>e.replace(/\S/g,B4);function q4(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=dE(n):n=lE(n);return n}function G4(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 uE(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function dE(e,t){return uE(e)?e:t||lE(e)}const fE=Ke,H4=100;function W4(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,fE)}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&&!J4(r[r.length-1].event,c.event)?(s(),!1):(i(c),!0),stop:()=>{s()}}}function J4(e,t){return e.target===t.target&&K4(e,t)<=H4&&e.timeStamp-t.timeStamp<=fE}function K4(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function Y4(e,t,r=ae.ALLOW){const o=new Map,{actionNameAttribute:n}=t,i=qh(e,Fc)||n&&qh(e,n);return i?{name:i,nameSource:"custom_attribute"}:r===ae.MASK?{name:rE,nameSource:"mask_placeholder"}:Gh(e,X4,t,o)||Gh(e,Q4,t,o)||{name:"",nameSource:"blank"}}function qh(e,t){const r=e.closest(`[${t}]`);if(!r)return;const o=r.getAttribute(t);return pE(mE(o.trim()))}const X4=[(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=>tM(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)}],Q4=[(e,t,r)=>Ua(e,t,r)],eM=10;function Gh(e,t,r,o){let n=e,i=0;for(;i<=eM&&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:pE(mE(u)),nameSource:l}}}if(n.nodeName==="FORM")break;n=n.parentElement,i+=1}}function mE(e){return e.replace(/\s+/g," ")}function pE(e){return e.length>100?`${hm(e,100)} [...]`:e}function tM(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=ta(e,i,o);cE(e.tagName,t,a,s,r)&&(a=dE(a,rE))}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(Ki(zr.USE_TREE_WALKER_FOR_ACTION_NAME))return rM(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 rM(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(vr(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=ta(c,o,n);if(r&&l&&Nm(c,l))return NodeFilter.FILTER_REJECT;if(vr(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 nM(e,{onPointerDown:t,onPointerUp:r}){let o,n={selection:!1,input:!1,scroll:!1},i;const a=[Oe(e,window,"pointerdown",s=>{Wh(s)&&(o=Hh(),n={selection:!1,input:!1,scroll:!1},i=t(s))},{capture:!0}),Oe(e,window,"selectionchange",()=>{(!o||!Hh())&&(n.selection=!0)},{capture:!0}),Oe(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),Oe(e,window,"pointerup",s=>{if(Wh(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 Hh(){const e=window.getSelection();return!e||e.isCollapsed}function Wh(e){return e.target instanceof Element&&e.isPrimary!==!1}const Jh=3;function oM(e,t){if(iM(e))return t.addFrustration(Po.RAGE_CLICK),e.some(Kh)&&t.addFrustration(Po.DEAD_CLICK),t.hasError&&t.addFrustration(Po.ERROR_CLICK),{isRage:!0};const r=e.some(o=>o.getUserActivity().selection);return e.forEach(o=>{o.hasError&&o.addFrustration(Po.ERROR_CLICK),Kh(o)&&!r&&o.addFrustration(Po.DEAD_CLICK)}),{isRage:!1}}function iM(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(Jh-1);t+=1)if(e[t+Jh-1].event.timeStamp-e[t].event.timeStamp<=Ke)return!0;return!1}const aM='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 Kh(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(aM)}const gE=10*Ke,qo=new Map;function sM(e){const t=qo.get(e);return qo.delete(e),t}function vE(e,t){qo.set(e,t),qo.forEach((r,o)=>{Ne(o,_t())>gE&&qo.delete(o)})}const cM=5*lt;function lM(e,t,r,o){const n=wo({expireDelay:cM}),i=new he;let a;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===Ln.UNLOADING&&u()});const{stop:s}=nM(o,{onPointerDown:d=>uM(o,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:f},m,g)=>{dM(o,e,t,r,n,i,l,d,m,g,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=W4(d,m=>{mM(m,f)})}}function u(){a&&a.stop()}}function uM(e,t,r,o,n){let i;if(e.enablePrivacyForActionName?i=ta(o.target,e.defaultPrivacyLevel):i=ae.ALLOW,i===ae.HIDDEN)return;const a=fM(o,i,e);let s=!1;return Am(t,r,n,e,c=>{s=c.hadActivity},tE),{clickActionBase:a,hadActivityOnPointerDown:()=>s}}function dM(e,t,r,o,n,i,a,s,c,l,u){var d;const f=yE(t,n,l,s,c);a(f);const m=(d=s?.target)===null||d===void 0?void 0:d.selector;m&&vE(c.timeStamp,m);const{stop:g}=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()},gE),h=t.subscribe(5,({endClocks:b})=>{f.stop(b.timeStamp)}),v=i.subscribe(()=>{f.stop()});f.stopObservable.subscribe(()=>{h.unsubscribe(),g(),v.unsubscribe()})}function fM(e,t,r){const o=e.target.getBoundingClientRect(),n=ea(e.target,r.actionNameAttribute);n&&vE(e.timeStamp,n);const{name:i,nameSource:a}=Y4(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 yE(e,t,r,o,n){const i=et(),a=Ue(),s=t.add(i,a.relative),c=Xk({lifeCycle:e,isChildEvent:g=>g.action!==void 0&&(Array.isArray(g.action.id)?g.action.id.includes(i):g.action.id===i)});let l=0,u;const d=[],f=new he;function m(g){l===0&&(u=g,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:g=>{d.push(g)},startClocks:a,isStopped:()=>l===1||l===2,clone:()=>yE(e,t,r,o,n),validate:g=>{if(m(),l!==1)return;const{resourceCount:h,errorCount:v,longTaskCount:b}=c.eventCounts,w={duration:u&&Ne(a.timeStamp,u),startClocks:a,id:i,frustrationTypes:d,counts:{resourceCount:h,errorCount:v,longTaskCount:b},events:g??[n],event:n,...o};e.notify(0,w),l=2},discard:()=>{m(),l=2}}}function mM(e,t){const{isRage:r}=oM(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 pM(e,t,r,o,n){const{unsubscribe:i}=e.subscribe(0,c=>{e.notify(12,Yh(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}=lM(e,r,o,n)),{addAction:c=>{e.notify(12,Yh(c))},actionContexts:a,stop:()=>{i(),s()}}}function Yh(e){const t=jl(e)?{action:{id:e.id,loading_time:Yk(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=gr({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 hM(e){const t=Gz([Oc.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function gM(e,t){const r=A2(e,[ai.cspViolation,ai.intervention]).subscribe(o=>t.notify(o));return{stop:()=>{r.unsubscribe()}}}function vM(e,t,r){const o=new he;return r.subscribe(n=>{n.type===0&&o.notify(n.error)}),hM(o),gM(t,o),o.subscribe(n=>e.notify(14,{error:n})),yM(e)}function yM(e){return e.subscribe(14,({error:t})=>{e.notify(12,bM(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=gr(a.context,i),e.notify(14,{error:a})}}}function bM(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 Xh=new WeakSet;function _M(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=>!Xh.has(o)).filter(o=>Gk(o)&&Hk(o)).filter(o=>wM(o,e.startClocks.relative,bE({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return Xh.add(r[0]),r[0].toJSON()}function bE(e){return ho(e.startTime,e.duration)}function wM(e,t,r){return e.startTime>=t-1&&bE(e)<=ho(r,1)}const xM=2*lt;function SM(e){const t=kM(e)||EM(e);if(!(!t||t.traceTime<=ct()-xM))return t.traceId}function kM(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return _E(t&&t.content,r&&r.content)}function EM(e){const t=IM(e);if(t)return _E(oi(t,"trace-id"),oi(t,"trace-time"))}function _E(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function IM(e){for(let t=0;t<e.childNodes.length;t+=1){const r=Qh(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=Qh(r);if(o)return o;if(!Mu(r))break}}function Qh(e){if(e&&E4(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function wE(){if(Zr(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=$M(),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 $M(){const e={},t=performance.timing;for(const r in t)if(qi(t[r])){const o=r,n=t[o];e[o]=n===0?0:pm(n)}return e}function TM(e,t,r=wE){Em(e,"interactive",()=>{const o=r(),n=Object.assign(o.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:Bk,duration:o.responseEnd,traceId:SM(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const OM=1e3;function AM(e){const t=new Set,r=e.subscribe(8,o=>{t.add(o),t.size>OM&&(_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 CM(e,t,r,o=qz(),n=TM){let i;const a=t.trackEarlyRequests;a?i=AM(e):e.subscribe(8,l=>{c(()=>NM(l,t,r))});const s=rr(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(l=>{for(const u of l)(a||!qk(u))&&c(()=>eg(u,t,r,i))});n(t,l=>{c(()=>eg(l,t,r,i))});function c(l){o.push(()=>{const u=l();u&&e.notify(12,u)})}return{stop:()=>{o.stop(),s.unsubscribe()}}}function NM(e,t,r){const o=_M(e);return xE(o,e,r,t)}function eg(e,t,r,o){const n=qk(e)&&o?o.getMatchingRequest(e):void 0;return xE(e,n,r,t)}function xE(e,t,r,o){if(!e&&!t)return;const n=t?zM(t,o):DM(e,o);if(!o.trackResources&&!n)return;const i=e?Gi(e.startTime):t.startClocks,a=e?o4(e):MM(r,i,t.duration),s=t&&RM(t,o),c=gr({date:i.timeStamp,resource:{id:et(),duration:oe(a),type:t?t.type===Uc.XHR?at.XHR:at.FETCH:n4(e),method:t?t.method:void 0,status_code:t?t.status:UM(e.responseStatus),url:t?Wk(t.url):e.name,protocol:e&&s4(e),delivery_type:e&&c4(e),graphql:s},type:te.RESOURCE,_dd:{discarded:!o.trackResources}},n,e&&jM(e));return{startTime:i.relative,duration:a,rawRumEvent:c,domainContext:PM(e,t)}}function RM(e,t){const r=Jk(e.url,t);if(r)return m4(e,r)}function PM(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 jM(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...l4(e),...i4(e)}}}function zM(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 DM(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:Uk().toString(),rule_psr:t.rulePsr}}}function MM(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function UM(e){return e===0?void 0:e}function LM(e,t,r){const{stop:o,eventCounts:n}=Xk({lifeCycle:e,isChildEvent:i=>i.view.id===t,onChange:r});return{stop:o,eventCounts:n}}const FM=10*lt;function VM(e,t,r){return{stop:rr(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<FM);i&&r(i.startTime)}).unsubscribe}}function ZM(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(Ne(e,_t()))})})}function BM(e,t,r){const o=rr(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&&vr(i.target)&&(s=ea(i.target,e.actionNameAttribute)),r({delay:a>=0?a:0,time:i.startTime,targetSelector:s})}});return{stop:()=>{o.unsubscribe()}}}function qM(e,t,r=wE){return WM(e,()=>{const o=r();HM(o)||t(GM(o))})}function GM(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 HM(e){return e.loadEventEnd<=0}function WM(e,t){let r;const{stop:o}=Em(e,"complete",()=>{r=Je(()=>t())});return{stop:()=>{o(),vt(r)}}}const JM=10*lt;function KM(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=rr(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(c=>{const l=US(c,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<JM&&u.size>a);if(l){let u;l.element&&(u=ea(l.element,e.actionNameAttribute)),o({value:l.startTime,targetSelector:u,resourceUrl:YM(l)}),a=l.size}});return{stop:()=>{i(),s.unsubscribe()}}}function YM(e){return e.url===""?void 0:e.url}function SE(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 XM(e,t,r,o){const n={},{stop:i}=qM(e,d=>{r(d.loadEvent),n.navigationTimings=d,o()}),a=SE(e,t),{stop:s}=VM(e,a,d=>{n.firstContentfulPaint=d,o()}),{stop:c}=KM(e,a,window,d=>{n.largestContentfulPaint=d,o()}),{stop:l}=BM(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,QM=(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)},tg=e=>{const t=Uu(e.previousRect.width,e.previousRect.height),r=Uu(e.currentRect.width,e.currentRect.height),o=QM(e.previousRect,e.currentRect);return t+r-o};function eU(e,t,r){if(!iU())return{stop:_e};let o=0,n;r({value:0});const i=oU(),a=rr(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=tU(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:Zo(o,4),targetSelector:f&&ea(f,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?rg(n.previousRect):void 0,currentRect:n?.currentRect?rg(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{a.unsubscribe()}}}function tU(e){let t;for(const r of e)if(r.node&&vr(r.node)){const o=tg(r);(!t||tg(t)<o)&&(t=r)}return t}function rg({x:e,y:t,width:r,height:o}){return{x:e,y:t,width:r,height:o}}const rU=5*Ke,nU=Ke;function oU(){let e=0,t,r,o=0;return{update:n=>{const i=t===void 0||n.startTime-r>=nU||n.startTime-t>=rU;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 iU(){return Zr(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let La,kE=0,zl=1/0,Dl=0;function aU(){"interactionCount"in performance||La||(La=new window.PerformanceObserver(ne(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(zl=Math.min(zl,r.interactionId),Dl=Math.max(Dl,r.interactionId),kE=(Dl-zl)/7+1)})})),La.observe({type:"event",buffered:!0,durationThreshold:0}))}const ng=()=>La?kE:window.performance.interactionCount||0,og=10,sU=1*lt;function cU(e,t,r){if(!dU())return{getInteractionToNextPaint:()=>{},setViewEnd:_e,stop:_e};const{getViewInteractionCount:o,stopViewInteractionCount:n}=uU(r);let i=1/0;const a=lU(o);let s=-1,c,l;function u(m){for(const h of m)h.interactionId&&h.startTime>=t&&h.startTime<=i&&a.process(h);const g=a.estimateP98Interaction();g&&g.duration!==s&&(s=g.duration,l=Ne(t,g.startTime),c=sM(g.startTime),!c&&g.target&&vr(g.target)&&(c=ea(g.target,e.actionNameAttribute)))}const d=rr(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),f=rr(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,sU),targetSelector:c,time:l};if(o())return{value:0}},setViewEnd:m=>{i=m,n()},stop:()=>{f.unsubscribe(),d.unsubscribe()}}}function lU(e){const t=[];function r(){t.sort((o,n)=>n.duration-o.duration).splice(og)}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<og||o.duration>i.duration)&&(t.push(o),r())},estimateP98Interaction(){const o=Math.min(t.length-1,Math.floor(e()/50));return t[o]}}}function uU(e){aU();const t=e===lr.INITIAL_LOAD?0:ng();let r={stopped:!1};function o(){return ng()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:o(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:o()}}}}function dU(){return Zr(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function fU(e,t,r,o,n,i,a){let s=n===lr.INITIAL_LOAD,c=!0;const l=[],u=SE(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 mU(){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 EE(){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 IE(e){return Ml||(Ml=pU(e)),Ml}function pU(e){return new he(t=>{const{throttled:r}=Wi(()=>{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 hU=Ke;function gU(e,t,r,o=yU(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 vU(){const e=EE(),{height:t}=Zc(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),o=Math.round(t+e);return{scrollHeight:r,scrollDepth:o,scrollTop:e}}function yU(e,t=hU){return new he(r=>{function o(){r.notify(vU())}if(window.ResizeObserver){const n=Wi(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 bU(e,t,r,o,n,i,a){const s={},{stop:c,setLoadEvent:l}=fU(e,t,r,o,i,a,h=>{s.loadingTime=h,n()}),{stop:u}=gU(o,a,h=>{s.scroll=h}),{stop:d}=eU(o,a.relative,h=>{s.cumulativeLayoutShift=h,n()}),{stop:f,getInteractionToNextPaint:m,setViewEnd:g}=cU(o,a.relative,i);return{stop:()=>{c(),d(),u()},stopINPTracking:f,setLoadEvent:l,setViewEnd:g,getCommonViewMetrics:()=>(s.interactionToNextPaint=m(),s)}}function _U(e,t){const{stop:r}=Oe(e,window,"pageshow",o=>{o.persisted&&t(o)},{capture:!0});return r}function wU(e,t,r){ZM(e.relative,o=>{t.firstContentfulPaint=o,t.largestContentfulPaint={value:o},r()})}const xU=3e3,SU=5*lt,kU=5*lt;function EU(e,t,r,o,n,i,a,s){const c=new Set;let l=f(lr.INITIAL_LOAD,mm(),s),u;m();let d;a&&(d=g(i),n.trackBfcacheViews&&(u=_U(n,h=>{l.end();const v=Gi(h.timeStamp);l=f(lr.BF_CACHE,v,void 0)})));function f(h,v,b){const w=IU(t,r,o,n,e,h,v,b);return c.add(w),w.stopObservable.subscribe(()=>{c.delete(w)}),w}function m(){t.subscribe(10,()=>{l=f(lr.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 g(h){return h.subscribe(({oldLocation:v,newLocation:b})=>{TU(v,b)&&(l.end(),l=f(lr.ROUTE_CHANGE))})}return{addTiming:(h,v=Be())=>{l.addTiming(h,v)},startView:(h,v)=>{l.end({endClocks:v}),l=f(lr.ROUTE_CHANGE,v,h)},setViewContext:h=>{l.contextManager.setContext(h)},setViewContextProperty:(h,v)=>{l.contextManager.setContextProperty(h,v)},setViewName:h=>{l.setViewName(h)},getViewContext:()=>l.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),l.end(),c.forEach(h=>h.stop())}}}function IU(e,t,r,o,n,i,a=Ue(),s){const c=et(),l=new he,u={};let d=0,f;const m=ni(n),g=Mc();let h=!0,v=s?.name;const b=s?.service||o.service,w=s?.version||o.version,I=s?.context;I&&g.setContext(I);const y={id:c,name:v,startClocks:a,service:b,version:w,context:I};e.notify(1,y),e.notify(2,y);const{throttled:k,cancel:S}=Wi(V,xU,{leading:!1}),{setLoadEvent:E,setViewEnd:C,stop:D,stopINPTracking:U,getCommonViewMetrics:K}=bU(e,t,r,o,se,i,a),{stop:ge,initialViewMetrics:q}=i===lr.INITIAL_LOAD?XM(o,a,E,se):{stop:_e,initialViewMetrics:{}};i===lr.BF_CACHE&&wU(a,q,se);const{stop:F,eventCounts:ce}=LM(e,c,se),le=po(V,SU),pe=e.subscribe(11,ye=>{ye.reason===Ln.UNLOADING&&V()});V(),g.changeObservable.subscribe(se);function G(){e.notify(3,{id:c,name:v,context:g.getContext(),startClocks:a,sessionIsActive:h})}function se(){G(),k()}function V(){S(),G(),d+=1;const ye=f===void 0?Be():f.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:c,name:v,service:b,version:w,context:g.getContext(),loadingType:i,location:m,startClocks:a,commonViewMetrics:K(),initialViewMetrics:q,duration:Ne(a.timeStamp,ye),isActive:f===void 0,sessionIsActive:h,eventCounts:ce})}return{get name(){return v},service:b,version:w,contextManager:g,stopObservable:l,end(ye={}){var ue,ve;f||(f=(ue=ye.endClocks)!==null&&ue!==void 0?ue:Ue(),h=(ve=ye.sessionIsActive)!==null&&ve!==void 0?ve:!0,e.notify(5,{endClocks:f}),e.notify(6,{endClocks:f}),Nc(le),C(f.relative),D(),pe.unsubscribe(),V(),Je(()=>{this.stop()},kU))},stop(){ge(),F(),U(),l.notify()},addTiming(ye,ue){if(f)return;const ve=GP(ue)?ue:Ne(a.timeStamp,ue);u[$U(ye)]=ve,se()},setViewName(ye){v=ye,V()}}}function $U(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&Q.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function TU(e,t){return e.pathname!==t.pathname||!OU(t.hash)&&ig(t.hash)!==ig(e.hash)}function OU(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function ig(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function AU(e,t,r,o,n,i,a,s,c,l){return e.subscribe(4,u=>e.notify(12,CU(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}}:Dr}),t.register(1,({startTime:u})=>{var d;return{view:{id:(d=c.findView(u))===null||d===void 0?void 0:d.id}}}),EU(o,e,n,i,r,a,!r.trackViewsManually,l)}function CU(e,t,r){var o,n,i,a,s,c,l,u,d,f,m,g,h,v,b,w,I,y;const k=r.getReplayStats(e.id),S=(n=(o=e.commonViewMetrics)===null||o===void 0?void 0:o.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,E={_dd:{document_version:e.documentVersion,replay_stats:k,cls:S?{device_pixel_ratio:S}: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:(g=e.initialViewMetrics.firstInput)===null||g===void 0?void 0:g.targetSelector,interaction_to_next_paint:oe((h=e.commonViewMetrics.interactionToNextPaint)===null||h===void 0?void 0:h.value),interaction_to_next_paint_time:oe((v=e.commonViewMetrics.interactionToNextPaint)===null||v===void 0?void 0:v.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:(I=e.initialViewMetrics.largestContentfulPaint)===null||I===void 0?void 0:I.targetSelector,load_event:oe((y=e.initialViewMetrics.navigationTimings)===null||y===void 0?void 0:y.loadEvent),loading_time:Yk(oe(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:NU(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:sD()}};return Vr(e.customTimings)||(E.view.custom_timings=OS(e.customTimings,oe)),{rawRumEvent:E,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function NU({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 RU="rum";function PU(e,t,r){const o=xz(e,RU,n=>zU(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 jU(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:yk("records")?1:0};return{findTrackedSession:()=>e,expire:_e,expireObservable:new he,setForcedReplay:_e}}function zU(e,t){return DU(t)?t:Xr(e.sessionSampleRate)?Xr(e.sessionReplaySampleRate)?"1":"2":"0"}function DU(e){return e==="0"||e==="1"||e==="2"}function MU(e,t,r,o,n,i){const a=[e.rumEndpointBuilder];e.replica&&a.push(e.replica.rumEndpointBuilder);const s=_k({encoder:i(2),request:Sm(a,r),flushController:wk({pageMayExitObservable:o,sessionExpireObservable:n})});return t.subscribe(13,c=>{c.type===te.VIEW?s.upsert(c,c.view.id):s.add(c)}),s}function UU(e){const t=yo();e.subscribe(13,r=>{t.send("rum",r)})}const LU=vn;function FU(e,t,r,o){const n=wo({expireDelay:LU});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}}:Dr}),{findUrl:c=>n.find(c),stop:()=>{a.unsubscribe(),n.stop()}}}function VU(e,t){let r=ni(t);return new he(o=>{const{stop:n}=ZU(e,a),{stop:i}=BU(e,a);function a(){if(r.href===t.href)return;const s=ni(t);o.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),i()}})}function ZU(e,t){const{stop:r}=Vt(ag("pushState"),"pushState",({onPostCall:i})=>{i(t)}),{stop:o}=Vt(ag("replaceState"),"replaceState",({onPostCall:i})=>{i(t)}),{stop:n}=Oe(e,window,"popstate",t);return{stop:()=>{r(),o(),n()}}}function BU(e,t){return Oe(e,window,"hashchange",t)}function ag(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const qU=vn;function GU(e,t,r){const o=wo({expireDelay:qU});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 HU=10*Ke;let Fn,xa;function WU(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,cg(Fn.batchBytesCount,o),cg(Fn.batchMessagesCount,n))}),po(JU,HU))}function JU(){Fn.batchCount!==0&&(Qi("Customer data measures",Fn),$E())}function sg(){return{min:1/0,max:0,sum:0}}function cg(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:sg(),batchMessagesCount:sg()}}const KU=4e3,YU=500,XU=vn;function QU(e,t,r=YU){const o=wo({expireDelay:XU,maxEntries:KU});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(TE(),_t());const{stop:i}=hr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],c=>{a(t6(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:e6(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 e6(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 t6(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":TE()}function TE(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function r6(e,t){let r;const o=requestAnimationFrame(ne(()=>{r=Zc()})),n=IE(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 n6(e,t){const r=window.cookieStore?o6(e):a6;return new he(o=>r(t,n=>o.notify(n)))}function o6(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 i6=Ke;function a6(e,t){const r=oi(document.cookie,e),o=po(()=>{const n=oi(document.cookie,e);n!==r&&t(n)},i6);return()=>{Nc(o)}}const lg="datadog-ci-visibility-test-execution-id";function s6(e,t,r=n6(e,lg)){var o;let n=Ir(lg)||((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 c6(e,t){const r=rr(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(o=>{for(const n of o){const i=Gi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:Pk.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 l6(e,t){const r=rr(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=Gi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:Pk.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 u6(e){e.register(0,({eventType:t})=>{if(!Ik())return wt;const r=kk(),o=Ek();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:o,injected:Sk()}}})}function d6(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(!(!ug(e)||!ug(t))){if(i.length>0)return Lu(e[n],t[n],i,o);f6(e,n,t[n],o)}}function f6(e,t,r,o){const n=yn(r);n===o?e[t]=Te(r):o==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function ug(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 OE;function m6(e,t,r,o,n){OE={[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]:Tl(te.ERROR,o,n),[te.ACTION]:Tl(te.ACTION,o,n),[te.VITAL]:Tl(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===Dr)return;const d=gr(u,c,{ddtags:_m(e).join(",")});p6(d,e.beforeSend,l,i)&&(Vr(d.context)&&delete d.context,t.notify(13,d))})}function p6(e,t,r,o){var n;if(t){const a=d6(e,OE[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 h6(e,t,r,o){e.register(0,({eventType:n,startTime:i})=>{const a=t.findTrackedSession(i),s=o.findView(i);if(!a||!s)return Dr;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 g6(e){e.register(0,({eventType:t})=>({type:t,connectivity:uk()}))}function v6(e,t,r){e.register(0,({eventType:o})=>{const n=t.source;return{type:o,_dd:{format_version:2,drift:jS(),configuration:{session_sample_rate:Zo(t.sessionSampleRate,3),session_replay_sample_rate:Zo(t.sessionReplaySampleRate,3),profiling_sample_rate:Zo(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 y6(e,t){e.register(1,()=>t.isGranted()?wt:Dr)}const b6=rz,_6=[te.ACTION,te.ERROR,te.LONG_TASK,te.RESOURCE,te.VITAL];function w6(e){return{addEvent:(t,r,o,n)=>{_6.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:o,duration:n})}}}function x6(e,t){if(!t.metricsEnabled)return{stop:_e};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:o})=>{!o.largestContentfulPaint||!o.navigationTimings||(Qi("Initial view metrics",{metrics:S6(o.largestContentfulPaint,o.navigationTimings)}),r())});return{stop:r}}function S6(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function k6(e,t,r,o,n,i,a,s,c){const l=[],u=new QD,d=b6();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=Q2(e),g=m.subscribe(Fe=>{u.notify(11,Fe)});l.push(()=>g.unsubscribe());const h=sz("browser-rum-sdk",e,d,f,m,n);l.push(h.stop);const v=sn()?jU():PU(e,u,i);if(sn())UU(u);else{const Fe=MU(e,u,f,m,v.expireObservable,n);l.push(()=>Fe.stop()),WU(h,u,Fe.flushController.flushObservable)}const b=KD(),w=VU(e,location),{observable:I,stop:y}=YD();l.push(y),v6(d,e,c);const k=QU(d,e),S=t4(u);l.push(()=>S.stop());const E=FU(u,d,w,location);l.push(()=>E.stop());const C=GU(u,d,e);h6(d,v,t,S),g6(d),y6(d,i);const D=nD(d,e,"rum"),U=oD(d,e,v,"rum"),K=rD(d,e,"rum"),{actionContexts:ge,addAction:q,addEvent:F,stop:ce}=E6(u,d,e,k,b,I,f);l.push(ce);const{addTiming:le,startView:pe,setViewName:G,setViewContext:se,setViewContextProperty:V,getViewContext:ye,stop:ue}=AU(u,d,e,location,b,I,w,t,S,o);l.push(ue);const{stop:ve}=x6(u,h);l.push(ve);const{stop:R}=CM(u,e,k);if(l.push(R),e.trackLongTasks)if(Zr(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:Fe}=c6(u,e);l.push(Fe)}else l6(u,e);const{addError:H}=vM(u,e,s);s.unbuffer(),v4(u,e,v,U,K);const me=lD(u,k,a),$e=XD(e.applicationId,v,S,ge,E);return l.push(()=>r.stop()),{addAction:q,addEvent:F,addError:H,addTiming:le,addFeatureFlagEvaluation:C.addFeatureFlagEvaluation,startView:pe,setViewContext:se,setViewContextProperty:V,getViewContext:ye,setViewName:G,lifeCycle:u,viewHistory:S,session:v,stopSession:()=>v.expire(),getInternalContext:$e.get,startDurationVital:me.startDurationVital,stopDurationVital:me.stopDurationVital,addDurationVital:me.addDurationVital,addOperationStepVital:me.addOperationStepVital,globalContext:D,userContext:U,accountContext:K,telemetry:h,stop:()=>{l.forEach(Fe=>Fe())},hooks:d}}function E6(e,t,r,o,n,i,a){const s=pM(e,t,n,i,r),c=w6(e),l=r6(t,r),u=s6(r,t);return u6(t),m6(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 I6(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=$6(e),s=`/rum/replay/sessions/${n}`;return`${a}${s}?${i.join("&")}`}function $6(e){const t=e.site,r=e.subdomain||T6(e);return`https://${r?`${r}.`:""}${t}`}function T6(e){switch(e.site){case Qr:case zj:return"app";case XS:return"dd";default:return}}const O6=1e3;let Tt;function A6(e){return Bc(e).segments_count}function C6(e){Bc(e).segments_count+=1}function N6(e){Bc(e).records_count+=1}function R6(e,t){Bc(e).segments_total_raw_size+=t}function P6(e){return Tt?.get(e)}function Bc(e){Tt||(Tt=new Map);let t;return Tt.has(e)?t=Tt.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},Tt.set(e,t),Tt.size>O6&&j6()),t}function j6(){if(!Tt)return;const e=Tt.keys().next().value;e&&Tt.delete(e)}function AE(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):ik(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&&z6(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 z6(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const D6=30*Ke;function CE(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 NE(e,t,r,o=CE){switch(Re.status===0&&M6(e,t,o),Re.status){case 1:return Re.initializationFailureCallbacks.push(r),Re.worker;case 3:return Re.worker}}function dg(){return Re.status}function M6(e,t,r=CE){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"&&L6(s.version)});o.postMessage({action:"init"}),Je(()=>U6(t),D6),Re={status:1,worker:o,stop:()=>{n(),i()},initializationFailureCallbacks:[]}}catch(o){Ul(e,t,o)}}function U6(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 L6(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 RE(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function F6(e,t,r,o){const n=t.findTrackedSession(),i=V6(n,o),a=r.findView();return I6(e,{viewContext:a,errorType:i,session:n})}function V6(e,t){if(!RE())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 Z6(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&&Qi("Recorder init metrics",{metrics:B6(r.forced,n,Ne(r.timestamp,Be()),a.type,o)});break}});return{stop:i}}function B6(e,t,r,o,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:o,waitForDocReadyDuration:n}}function q6(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 he;Z6(a,l);const u=async m=>{l.notify({type:"start",forced:m});const[g]=await Promise.all([fg(l,{type:"recorder-settled"},n()),fg(l,{type:"document-ready"},Cz(e,"interactive"))]);if(s!==2){l.notify({type:"aborted"});return}if(!g){s=0,l.notify({type:"recorder-load-failed"});return}const h=i();if(!h){s=0,l.notify({type:"deflate-encoder-load-failed"});return}({stop:c}=g(t,e,r,o,h,a)),s=3,l.notify({type:"succeeded"})};function d(m){const g=r.findTrackedSession();if(G6(g,m)){s=1;return}if(H6(s))return;s=2;const h=W6(g,m)||!1;u(h).catch(mr),h&&r.setForcedReplay()}function f(){s===3&&c?.(),s=0}return{start:d,stop:f,getSessionReplayLink(){return F6(e,r,o,s!==0)},isRecording:()=>s===3}}function G6(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function H6(e){return e===2||e===3}function W6(e,t){return t&&t.force&&e.sessionReplay===0}async function fg(e,t,r){try{return await r}finally{e.notify(t)}}function J6(){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 K6(e,t){if(sn()&&!yk("records")||!RE())return{start:_e,stop:_e,getReplayStats:()=>{},onRumStart:_e,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:o}=J6();return{start:i=>r.start(i),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>dg()===3&&r.isRecording(),getReplayStats:i=>dg()===3?P6(i):void 0};function n(i,a,s,c,l,u){let d;function f(){return d||(l??(l=NE(a,"Datadog Session Replay",()=>{r.stop()},t)),l&&(d=AE(a,l,1))),d}r=q6(a,i,s,c,e,f,u),o(a)&&r.start()}}async function Y6(e=X6){try{return await e()}catch(t){Rm({error:t,source:"Recorder",scriptType:"module"})}}async function X6(){return(await Promise.resolve().then(()=>require("./startRecording-Bi82O_dZ.cjs"))).startRecording}function Q6(){return It().Profiler!==void 0}const eL=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 tL(e=rL){try{return await e()}catch(t){Rm({error:t,source:"Profiler",scriptType:"module"})}}async function rL(){return(await Promise.resolve().then(()=>require("./profiler-BY6U7KRN.cjs"))).createRumProfiler}function nL(){let e;function t(r,o,n,i,a,s){const c=i.findTrackedSession();if(!c||!Mk(c.id,n.profilingSampleRate))return;const l=eL(o);if(!Q6()){l.set({status:"error",error_reason:"not-supported-by-browser"});return}tL().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(mr)}return{onRumStart:t,stop:()=>{e?.stop().catch(mr)}}}const oL=K6(Y6),iL=nL(),Go=WD(k6,oL,iL,{startDeflateWorker:NE,createDeflateEncoder:AE,sdkName:"rum"});O2(It(),"DD_RUM",Go);const Sa={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",service:"gram-elements"};let Fu=!1,Vu=!0;function aL(e={}){if(e.enabled===!1){Vu=!1;return}if(!Fu)try{Go.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&&Go.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&Go.setGlobalContextProperty("variant",e.variant),Fu=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),Vu=!1}}function hs(e,t){if(!Vu||!Fu)return;const r=e instanceof Error?e:new Error(String(e));try{Go.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"],sL=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof ih.ZodType?ih.toJSONSchema(r.parameters):r.parameters}])),cL=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let gs=null;function lL(e,t){const r=PE(t);gs={helpers:e,requiresApproval:r}}function uL(){gs=null}function PE(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 dL=(e,t)=>M.makeAssistantTool({...e,execute:async(r,o)=>{if(gs?.requiresApproval(t)){const{helpers:n}=gs,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 fL(e,t,r){if(!t||Array.isArray(t)&&t.length===0)return e;const o=PE(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 mL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],pL=T.createLucideIcon("arrow-down",mL);const hL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],gL=T.createLucideIcon("arrow-up",hL);const vL=[["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"}]],yL=T.createLucideIcon("brain",vL);const bL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Cr=T.createLucideIcon("check",bL);const _L=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vs=T.createLucideIcon("chevron-down",_L);const wL=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],xL=T.createLucideIcon("chevron-left",wL);const SL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jE=T.createLucideIcon("chevron-right",SL);const kL=[["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=T.createLucideIcon("copy",kL);const EL=[["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"}]],IL=T.createLucideIcon("file-text",EL);const $L=[["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=T.createLucideIcon("loader",$L);const TL=[["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"}]],OL=T.createLucideIcon("maximize",TL);const AL=[["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"}]],CL=T.createLucideIcon("message-circle",AL);const NL=[["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"}]],RL=T.createLucideIcon("minimize",NL);const PL=[["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"}]],jL=T.createLucideIcon("panel-right-close",PL);const zL=[["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"}]],DL=T.createLucideIcon("panel-right-open",zL);const ML=[["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"}]],UL=T.createLucideIcon("pencil",ML);const LL=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],zE=T.createLucideIcon("plus",LL);const FL=[["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"}]],VL=T.createLucideIcon("settings-2",FL);const ZL=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],BL=T.createLucideIcon("square",ZL);const qL=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ra=T.createLucideIcon("x",qL);var GL=Object.defineProperty,HL=Object.defineProperties,WL=Object.getOwnPropertyDescriptors,mg=Object.getOwnPropertySymbols,JL=Object.prototype.hasOwnProperty,KL=Object.prototype.propertyIsEnumerable,pg=(e,t,r)=>t in e?GL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,xe=(e,t)=>{for(var r in t||(t={}))JL.call(t,r)&&pg(e,r,t[r]);if(mg)for(var r of mg(t))KL.call(t,r)&&pg(e,r,t[r]);return e},bs=(e,t)=>HL(e,WL(t)),DE="vercel.ai.error",YL=Symbol.for(DE),ME,XL=class UE extends Error{constructor({name:t,message:r,cause:o}){super(r),this[ME]=!0,this.name=t,this.cause=o}static isInstance(t){return UE.hasMarker(t,DE)}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}};ME=YL;var De=XL,LE="AI_APICallError",FE=`vercel.ai.error.${LE}`,QL=Symbol.for(FE),VE,Ft=class extends De{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:LE,message:e,cause:a}),this[VE]=!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 De.hasMarker(e,FE)}};VE=QL;var ZE="AI_EmptyResponseBodyError",BE=`vercel.ai.error.${ZE}`,e5=Symbol.for(BE),qE,t5=class extends De{constructor({message:e="Empty response body"}={}){super({name:ZE,message:e}),this[qE]=!0}static isInstance(e){return De.hasMarker(e,BE)}};qE=e5;function GE(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var HE="AI_InvalidArgumentError",WE=`vercel.ai.error.${HE}`,r5=Symbol.for(WE),JE,KE=class extends De{constructor({message:t,cause:r,argument:o}){super({name:HE,message:t,cause:r}),this[JE]=!0,this.argument=o}static isInstance(t){return De.hasMarker(t,WE)}};JE=r5;var YE="AI_InvalidPromptError",XE=`vercel.ai.error.${YE}`,n5=Symbol.for(XE),QE,o5=class extends De{constructor({prompt:e,message:t,cause:r}){super({name:YE,message:`Invalid prompt: ${t}`,cause:r}),this[QE]=!0,this.prompt=e}static isInstance(e){return De.hasMarker(e,XE)}};QE=n5;var eI="AI_InvalidResponseDataError",tI=`vercel.ai.error.${eI}`,i5=Symbol.for(tI),rI,Do=class extends De{constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:eI,message:t}),this[rI]=!0,this.data=e}static isInstance(e){return De.hasMarker(e,tI)}};rI=i5;var nI="AI_JSONParseError",oI=`vercel.ai.error.${nI}`,a5=Symbol.for(oI),iI,_s=class extends De{constructor({text:e,cause:t}){super({name:nI,message:`JSON parsing failed: Text: ${e}.
38
+ Error message: ${GE(t)}`,cause:t}),this[iI]=!0,this.text=e}static isInstance(e){return De.hasMarker(e,oI)}};iI=a5;var aI="AI_LoadAPIKeyError",sI=`vercel.ai.error.${aI}`,s5=Symbol.for(sI),cI,ka=class extends De{constructor({message:e}){super({name:aI,message:e}),this[cI]=!0}static isInstance(e){return De.hasMarker(e,sI)}};cI=s5;var lI="AI_NoContentGeneratedError",uI=`vercel.ai.error.${lI}`,c5=Symbol.for(uI),dI,fI=class extends De{constructor({message:e="No content generated."}={}){super({name:lI,message:e}),this[dI]=!0}static isInstance(e){return De.hasMarker(e,uI)}};dI=c5;var mI="AI_TypeValidationError",pI=`vercel.ai.error.${mI}`,l5=Symbol.for(pI),hI,u5=class Zu extends De{constructor({value:t,cause:r}){super({name:mI,message:`Type validation failed: Value: ${JSON.stringify(t)}.
39
+ Error message: ${GE(r)}`,cause:r}),this[hI]=!0,this.value=t}static isInstance(t){return De.hasMarker(t,pI)}static wrap({value:t,cause:r}){return Zu.isInstance(r)&&r.value===t?r:new Zu({value:t,cause:r})}};hI=l5;var ci=u5,gI="AI_UnsupportedFunctionalityError",vI=`vercel.ai.error.${gI}`,d5=Symbol.for(vI),yI,kr=class extends De{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:gI,message:t}),this[yI]=!0,this.functionality=e}static isInstance(e){return De.hasMarker(e,vI)}};yI=d5;var hg=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 f5(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(h){const v=a?h.replace(/^\xEF\xBB\xBF/,""):h,[b,w]=m5(`${i}${v}`);for(const I of b)d(I);i=w,a=!1}function d(h){if(h===""){m();return}if(h.startsWith(":")){n&&n(h.slice(h.startsWith(": ")?2:1));return}const v=h.indexOf(":");if(v!==-1){const b=h.slice(0,v),w=h[v+1]===" "?2:1,I=h.slice(v+w);f(b,I,h);return}f(h,"",h)}function f(h,v,b){switch(h){case"event":l=v;break;case"data":c=`${c}${v}
40
+ `;break;case"id":s=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?o(parseInt(v,10)):r(new hg(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:b}));break;default:r(new hg(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:v,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 g(h={}){i&&h.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:g}}function m5(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 p5=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(n){o=f5({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 li(...e){return e.reduce((t,r)=>xe(xe({},t),r??{}),{})}function qc(e){return Object.fromEntries([...e.headers])}var h5=({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 KE({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},Mt=h5();function Bu(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var g5=["fetch failed","failed to fetch"];function v5({error:e,url:t,requestBodyValues:r}){if(Bu(e))return e;if(e instanceof TypeError&&g5.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new Ft({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function y5(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>r!=null))}function b5({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 _5=/"__proto__"\s*:/,w5=/"constructor"\s*:/;function x5(e){const t=JSON.parse(e);return t===null||typeof t!="object"||_5.test(e)===!1&&w5.test(e)===!1?t:S5(t)}function S5(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 zm(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return x5(e)}finally{Error.stackTraceLimit=t}}var qu=Symbol.for("vercel.ai.validator");function k5(e){return{[qu]:!0,validate:e}}function E5(e){return typeof e=="object"&&e!==null&&qu in e&&e[qu]===!0&&"validate"in e}function I5(e){return E5(e)?e:$5(e)}function $5(e){return k5(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new ci({value:t,cause:r.issues})}})}async function T5({value:e,schema:t}){const r=await bI({value:e,schema:t});if(!r.success)throw ci.wrap({value:e,cause:r.error});return r.value}async function bI({value:e,schema:t}){const r=I5(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:ci.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:ci.wrap({value:e,cause:o}),rawValue:e}}}async function O5({text:e,schema:t}){try{const r=zm(e);return t==null?r:T5({value:r,schema:t})}catch(r){throw _s.isInstance(r)||ci.isInstance(r)?r:new _s({text:e,cause:r})}}async function _I({text:e,schema:t}){try{const r=zm(e);return t==null?{success:!0,value:r,rawValue:r}:await bI({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 zm(e),!0}catch{return!1}}function A5({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new p5).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await _I({text:r,schema:t}))}}))}var C5=()=>globalThis.fetch,ui=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>N5({url:e,headers:xe({"Content-Type":"application/json"},t),body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),N5=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=C5()})=>{try{const s=await a(e,{method:"POST",headers:y5(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)||Ft.isInstance(u)?u:new Ft({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)||Ft.isInstance(l))?l:new Ft({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw v5({error:s,url:e,requestBodyValues:r.values})}},R5=({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 Ft({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})};try{const c=await O5({text:a,schema:e});return{responseHeaders:s,value:new Ft({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 Ft({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})}}},wI=e=>async({response:t})=>{const r=qc(t);if(t.body==null)throw new t5({});return{responseHeaders:r,value:A5({stream:t.body,schema:e})}},Dm=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),i=await _I({text:n,schema:e}),a=qc(t);if(!i.success)throw new Ft({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:P5}=globalThis;function j5(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return P5(t)}function z5(e){return e?.replace(/\/$/,"")}function Vl(e){return e!=null}var xI=(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))(xI||{}),Mm=O({id:x().nullish(),format:gn(xI).nullish(),index:Z().optional()}).loose(),D5=O({type:B("reasoning.summary"),summary:x()}).extend(Mm.shape),M5=O({type:B("reasoning.encrypted"),data:x()}).extend(Mm.shape),U5=O({type:B("reasoning.text"),text:x().nullish(),signature:x().nullish()}).extend(Mm.shape),Um=fe([D5,M5,U5]),Fa=fe([Um,Qe().transform(()=>null)]),Lm=z(Fa).transform(e=>e.filter(t=>!!t));fe([O({delta:O({reasoning_details:z(Fa)})}).transform(e=>e.delta.reasoning_details.filter(Vl)),O({message:O({reasoning_details:z(Fa)})}).transform(e=>e.message.reasoning_details.filter(Vl)),O({text:x(),reasoning_details:z(Fa)}).transform(e=>e.reasoning_details.filter(Vl))]);var Gc=O({error:O({code:fe([x(),Z()]).nullable().optional().default(null),message:x(),type:x().nullable().optional().default(null),param:Me().nullable().optional().default(null)}).passthrough()}).passthrough(),di=R5({errorSchema:Gc,errorToMessage:e=>e.error.message}),SI=O({type:B("file"),file:O({hash:x(),name:x(),content:z(O({type:x(),text:x().optional()}).catchall(Me())).optional()}).catchall(Me())}).catchall(Me()),L5=O({provider:x(),reasoning_details:z(Um).optional(),annotations:z(SI).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()),gg=O({openrouter:O({reasoning_details:z(Um).optional(),annotations:z(SI).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 F5=["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=j5(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 vg(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 V5={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 Z5(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=V5[n];if(i===void 0){const a=F5.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 xr(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 B5(e){var t,r,o,n,i,a,s,c,l,u;const d=[];for(const{role:f,content:m,providerOptions:g}of e)switch(f){case"system":{d.push({role:"system",content:m,cache_control:xr(g)});break}case"user":{if(m.length===1&&((t=m[0])==null?void 0:t.type)==="text"){const b=(r=xr(g))!=null?r:xr(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 h=xr(g),v=m.map(b=>{var w,I,y,k,S,E,C;const D=(w=xr(b.providerOptions))!=null?w:h;switch(b.type){case"text":return{type:"text",text:b.text,cache_control:D};case"file":{if((I=b.mediaType)!=null&&I.startsWith("image/"))return{type:"image_url",image_url:{url:Gu({part:b,defaultMediaType:"image/jpeg"})},cache_control:D};if((y=b.mediaType)!=null&&y.startsWith("audio/"))return{type:"input_audio",input_audio:Z5(b),cache_control:D};const U=String((C=(E=(S=(k=b.providerOptions)==null?void 0:k.openrouter)==null?void 0:S.filename)!=null?E:b.filename)!=null?C:""),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:D}}default:return{type:"text",text:"",cache_control:D}}});d.push({role:"user",content:v});break}case"assistant":{let h="",v="";const b=[],w=[];for(const E of m)switch(E.type){case"text":{h+=E.text;break}case"tool-call":{const C=(o=E.providerOptions)==null?void 0:o.openrouter;C?.reasoning_details&&Array.isArray(C.reasoning_details)&&w.push(...C.reasoning_details),b.push({id:E.toolCallId,type:"function",function:{name:E.toolName,arguments:JSON.stringify(E.input)}});break}case"reasoning":{v+=E.text;const C=gg.safeParse(E.providerOptions);C.success&&((i=(n=C.data)==null?void 0:n.openrouter)!=null&&i.reasoning_details)&&w.push(...C.data.openrouter.reasoning_details);break}}const I=gg.safeParse(g),y=I.success?(s=(a=I.data)==null?void 0:a.openrouter)==null?void 0:s.reasoning_details:void 0,k=I.success?(l=(c=I.data)==null?void 0:c.openrouter)==null?void 0:l.annotations:void 0,S=y&&Array.isArray(y)&&y.length>0?y:w.length>0?w:void 0;d.push({role:"assistant",content:h,tool_calls:b.length>0?b:void 0,reasoning:v||void 0,reasoning_details:S,annotations:k,cache_control:xr(g)});break}case"tool":{for(const h of m){const v=q5(h);d.push({role:"tool",tool_call_id:h.toolCallId,content:v,cache_control:(u=xr(g))!=null?u:xr(h.providerOptions)})}break}}return d}function q5(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:x()})})]);function G5(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 KE({argument:"toolChoice",message:`Invalid tool choice type: ${JSON.stringify(e)}`})}}var H5=O({type:B("image_url"),image_url:O({url:x()}).passthrough()}).passthrough(),W5=fe([H5,Qe().transform(()=>null)]),kI=z(W5).transform(e=>e.filter(t=>!!t)),EI=O({id:x().optional(),model:x().optional(),provider:x().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(),J5=fe([EI.extend({choices:z(O({message:O({role:B("assistant"),content:x().nullable().optional(),reasoning:x().nullable().optional(),reasoning_details:Lm.nullish(),images:kI.nullish(),tool_calls:z(O({id:x().optional().nullable(),type:B("function"),function:O({name:x(),arguments:x()}).passthrough()}).passthrough()).optional(),annotations:z(fe([O({type:B("url_citation"),url_citation:O({end_index:Z(),start_index:Z(),title:x(),url:x(),content:x().optional()}).passthrough()}).passthrough(),O({type:B("file_annotation"),file_annotation:O({file_id:x(),quote:x().optional()}).passthrough()}).passthrough(),O({type:B("file"),file:O({hash:x(),name:x(),content:z(O({type:x(),text:x().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough(),index:Z().nullish(),logprobs:O({content:z(O({token:x(),logprob:Z(),top_logprobs:z(O({token:x(),logprob:Z()}).passthrough())}).passthrough()).nullable()}).passthrough().nullable().optional(),finish_reason:x().optional().nullable()}).passthrough())}),Gc.extend({user_id:x().optional()})]),K5=fe([EI.extend({choices:z(O({delta:O({role:gn(["assistant"]).optional(),content:x().nullish(),reasoning:x().nullish().optional(),reasoning_details:Lm.nullish(),images:kI.nullish(),tool_calls:z(O({index:Z().nullish(),id:x().nullish(),type:B("function").optional(),function:O({name:x().nullish(),arguments:x().nullish()}).passthrough()}).passthrough()).nullish(),annotations:z(fe([O({type:B("url_citation"),url_citation:O({end_index:Z(),start_index:Z(),title:x(),url:x(),content:x().optional()}).passthrough()}).passthrough(),O({type:B("file_annotation"),file_annotation:O({file_id:x(),quote:x().optional()}).passthrough()}).passthrough(),O({type:B("file"),file:O({hash:x(),name:x(),content:z(O({type:x(),text:x().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough().nullish(),logprobs:O({content:z(O({token:x(),logprob:Z(),top_logprobs:z(O({token:x(),logprob:Z()}).passthrough())}).passthrough()).nullable()}).passthrough().nullish(),finish_reason:x().nullable().optional(),index:Z().nullish()}).passthrough())}),Gc]),Y5=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:B5(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 g=u.filter(h=>h.type==="function").map(h=>({type:"function",function:{name:h.name,description:h.description,parameters:h.inputSchema}}));return bs(xe({},m),{tools:g,tool_choice:d?G5(d):void 0})}return m}async doGenerate(e){var t,r,o,n,i,a,s,c,l,u,d,f,m,g,h,v,b,w,I,y,k,S,E;const D=(e.providerOptions||{}).openrouter||{},U=xe(xe({},this.getArgs(e)),D),{value:K,responseHeaders:ge}=await ui({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:li(this.config.headers(),e.headers),body:U,failedResponseHandler:di,successfulResponseHandler:Dm(J5),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in K){const R=K.error;throw new Ft({message:R.message,url:this.config.url({path:"/chat/completions",modelId:this.modelId}),requestBodyValues:U,statusCode:200,responseHeaders:ge,data:R})}const q=K,F=q.choices[0];if(!F)throw new fI({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(R=>{switch(R.type){case"reasoning.text":{if(R.text)return{type:"reasoning",text:R.text,providerMetadata:{openrouter:{reasoning_details:[R]}}};break}case"reasoning.summary":{if(R.summary)return{type:"reasoning",text:R.summary,providerMetadata:{openrouter:{reasoning_details:[R]}}};break}case"reasoning.encrypted":{if(R.data)return{type:"reasoning",text:"[REDACTED]",providerMetadata:{openrouter:{reasoning_details:[R]}}};break}}return null}).filter(R=>R!==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 R of F.message.tool_calls)G.push({type:"tool-call",toolCallId:(u=R.id)!=null?u:Mt(),toolName:R.function.name,input:R.function.arguments,providerMetadata:{openrouter:{reasoning_details:le}}});if(F.message.images)for(const R of F.message.images)G.push({type:"file",mediaType:vg(R.image_url.url,"image/jpeg"),data:Hu(R.image_url.url)});if(F.message.annotations)for(const R of F.message.annotations)R.type==="url_citation"&&G.push({type:"source",sourceType:"url",id:R.url_citation.url,url:R.url_citation.url,title:R.url_citation.title,providerMetadata:{openrouter:{content:R.url_citation.content||""}}});const se=(d=F.message.annotations)==null?void 0:d.filter(R=>R.type==="file"),V=F.message.tool_calls&&F.message.tool_calls.length>0,ye=le.some(R=>R.type==="reasoning.encrypted"&&R.data),ve=V&&ye&&F.finish_reason==="stop"?"tool-calls":ws(F.finish_reason);return{content:G,finishReason:ve,usage:ce,warnings:[],providerMetadata:{openrouter:L5.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:(g=ce.inputTokens)!=null?g:0,completionTokens:(h=ce.outputTokens)!=null?h:0,totalTokens:(v=ce.totalTokens)!=null?v:0,cost:(b=q.usage)==null?void 0:b.cost},((I=(w=q.usage)==null?void 0:w.prompt_tokens_details)==null?void 0:I.cached_tokens)!=null?{promptTokensDetails:{cachedTokens:q.usage.prompt_tokens_details.cached_tokens}}:{}),((k=(y=q.usage)==null?void 0:y.completion_tokens_details)==null?void 0:k.reasoning_tokens)!=null?{completionTokensDetails:{reasoningTokens:q.usage.completion_tokens_details.reasoning_tokens}}:{}),((E=(S=q.usage)==null?void 0:S.cost_details)==null?void 0:E.upstream_inference_cost)!=null?{costDetails:{upstreamInferenceCost:q.usage.cost_details.upstream_inference_cost}}:{})})},request:{body:U},response:{id:q.id,modelId:q.model,headers:ge}}}async doStream(e){var t;const o=(e.providerOptions||{}).openrouter||{},n=xe(xe({},this.getArgs(e)),o),{value:i,responseHeaders:a}=await ui({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:li(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:di,successfulResponseHandler:wI(K5),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,g=!1,h,v,b,w;return{stream:i.pipeThrough(new TransformStream({transform(I,y){var k,S,E,C,D,U,K,ge,q,F,ce,le,pe,G,se;if(!I.success){c="error",y.enqueue({type:"error",error:I.error});return}const V=I.value;if("error"in V){c="error",y.enqueue({type:"error",error:V.error});return}if(V.provider&&(w=V.provider),V.id&&(b=V.id,y.enqueue({type:"response-metadata",id:V.id})),V.model&&y.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=(S=V.usage.completion_tokens_details.reasoning_tokens)!=null?S:0;l.reasoningTokens=H,u.completionTokensDetails={reasoningTokens:H}}u.cost=V.usage.cost,u.totalTokens=V.usage.total_tokens;const R=(E=V.usage.cost_details)==null?void 0:E.upstream_inference_cost;R!=null&&(u.costDetails={upstreamInferenceCost:R})}const ye=V.choices[0];if(ye?.finish_reason!=null&&(c=ws(ye.finish_reason)),ye?.delta==null)return;const ue=ye.delta,ve=(R,H)=>{g||(v=b||Mt(),y.enqueue({providerMetadata:H,type:"reasoning-start",id:v}),g=!0),y.enqueue({providerMetadata:H,type:"reasoning-delta",delta:R,id:v||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 R={openrouter:{reasoning_details:ue.reasoning_details}};for(const H of ue.reasoning_details)switch(H.type){case"reasoning.text":{H.text&&ve(H.text,R);break}case"reasoning.encrypted":{H.data&&ve("[REDACTED]",R);break}case"reasoning.summary":{H.summary&&ve(H.summary,R);break}}}else ue.reasoning&&ve(ue.reasoning);if(ue.content&&(g&&!m&&(y.enqueue({type:"reasoning-end",id:v||Mt()}),g=!1),m||(h=b||Mt(),y.enqueue({type:"text-start",id:h}),m=!0),y.enqueue({type:"text-delta",delta:ue.content,id:h||Mt()})),ue.annotations){for(const R of ue.annotations)if(R.type==="url_citation")y.enqueue({type:"source",sourceType:"url",id:R.url_citation.url,url:R.url_citation.url,title:R.url_citation.title,providerMetadata:{openrouter:{content:R.url_citation.content||""}}});else if(R.type==="file"){const H=R.file;H&&typeof H=="object"&&"hash"in H&&"name"in H&&f.push(R)}}if(ue.tool_calls!=null)for(const R of ue.tool_calls){const H=(C=R.index)!=null?C:s.length-1;if(s[H]==null){if(R.type!=="function")throw new Do({data:R,message:"Expected 'function' type."});if(R.id==null)throw new Do({data:R,message:"Expected 'id' to be a string."});if(((D=R.function)==null?void 0:D.name)==null)throw new Do({data:R,message:"Expected 'function.name' to be a string."});s[H]={id:R.id,type:"function",function:{name:R.function.name,arguments:(U=R.function.arguments)!=null?U:""},inputStarted:!1,sent:!1};const $e=s[H];if($e==null)throw new Do({data:{index:H,toolCallsLength:s.length},message:`Tool call at index ${H} is missing after creation.`});((K=$e.function)==null?void 0:K.name)!=null&&((ge=$e.function)==null?void 0:ge.arguments)!=null&&Fl($e.function.arguments)&&($e.inputStarted=!0,y.enqueue({type:"tool-input-start",id:$e.id,toolName:$e.function.name}),y.enqueue({type:"tool-input-delta",id:$e.id,delta:$e.function.arguments}),y.enqueue({type:"tool-input-end",id:$e.id}),y.enqueue({type:"tool-call",toolCallId:$e.id,toolName:$e.function.name,input:$e.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),$e.sent=!0);continue}const me=s[H];if(me==null)throw new Do({data:{index:H,toolCallsLength:s.length,toolCallDelta:R},message:`Tool call at index ${H} is missing during merge.`});me.inputStarted||(me.inputStarted=!0,y.enqueue({type:"tool-input-start",id:me.id,toolName:me.function.name})),((q=R.function)==null?void 0:q.arguments)!=null&&(me.function.arguments+=(ce=(F=R.function)==null?void 0:F.arguments)!=null?ce:""),y.enqueue({type:"tool-input-delta",id:me.id,delta:(le=R.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)&&(y.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 R of ue.images)y.enqueue({type:"file",mediaType:vg(R.image_url.url,"image/jpeg"),data:Hu(R.image_url.url)})},flush(I){var y;const k=s.length>0,S=d.some(C=>C.type==="reasoning.encrypted"&&C.data);if(k&&S&&c==="stop"&&(c="tool-calls"),c==="tool-calls")for(const C of s)C&&!C.sent&&(I.enqueue({type:"tool-call",toolCallId:(y=C.id)!=null?y:Mt(),toolName:C.function.name,input:Fl(C.function.arguments)?C.function.arguments:"{}",providerMetadata:{openrouter:{reasoning_details:d}}}),C.sent=!0);g&&I.enqueue({type:"reasoning-end",id:v||Mt()}),m&&I.enqueue({type:"text-end",id:h||Mt()});const E={usage:u};w!==void 0&&(E.provider=w),d.length>0&&(E.reasoning_details=d),f.length>0&&(E.annotations=f),I.enqueue({type:"finish",finishReason:c,usage:l,providerMetadata:{openrouter:E}})}})),warnings:[],request:{body:n},response:{headers:a}}}};function X5({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 o5({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 kr({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 kr({functionality:"tool-call messages"});case"tool-result":throw new kr({functionality:"tool-result messages"});case"reasoning":throw new kr({functionality:"reasoning messages"});case"file":throw new kr({functionality:"file attachments"});default:return""}}).join("");n+=`${o}:
62
+ ${s}
63
+
64
+ `;break}case"tool":throw new kr({functionality:"tool messages"})}return n+=`${o}:
65
+ `,{prompt:n}}var yg=fe([O({id:x().optional(),model:x().optional(),choices:z(O({text:x(),reasoning:x().nullish().optional(),reasoning_details:Lm.nullish(),finish_reason:x().nullish(),index:Z().nullish(),logprobs:O({tokens:z(x()),token_logprobs:z(Z()),top_logprobs:z(er(x(),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]),Q5=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}=X5({prompt:e,inputFormat:"prompt"});if(u?.length)throw new kr({functionality:"tools"});if(d)throw new kr({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,g,h;const b=(e.providerOptions||{}).openrouter||{},w=xe(xe({},this.getArgs(e)),b),{value:I,responseHeaders:y}=await ui({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:li(this.config.headers(),e.headers),body:w,failedResponseHandler:di,successfulResponseHandler:Dm(yg),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in I){const S=I.error;throw new Ft({message:S.message,url:this.config.url({path:"/completions",modelId:this.modelId}),requestBodyValues:w,statusCode:200,responseHeaders:y,data:S})}const k=I.choices[0];if(!k)throw new fI({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=I.usage)==null?void 0:r.prompt_tokens)!=null?o:0,outputTokens:(i=(n=I.usage)==null?void 0:n.completion_tokens)!=null?i:0,totalTokens:((s=(a=I.usage)==null?void 0:a.prompt_tokens)!=null?s:0)+((l=(c=I.usage)==null?void 0:c.completion_tokens)!=null?l:0),reasoningTokens:(f=(d=(u=I.usage)==null?void 0:u.completion_tokens_details)==null?void 0:d.reasoning_tokens)!=null?f:0,cachedInputTokens:(h=(g=(m=I.usage)==null?void 0:m.prompt_tokens_details)==null?void 0:g.cached_tokens)!=null?h:0},warnings:[],response:{headers:y}}}async doStream(e){const r=(e.providerOptions||{}).openrouter||{},o=xe(xe({},this.getArgs(e)),r),{value:n,responseHeaders:i}=await ui({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:li(this.config.headers(),e.headers),body:bs(xe({},o),{stream:!0,stream_options:this.config.compatibility==="strict"?{include_usage:!0}:void 0}),failedResponseHandler:di,successfulResponseHandler:wI(yg),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 g=l.value;if("error"in g){a="error",u.enqueue({type:"error",error:g.error});return}if(g.usage!=null){if(s.inputTokens=g.usage.prompt_tokens,s.outputTokens=g.usage.completion_tokens,s.totalTokens=g.usage.prompt_tokens+g.usage.completion_tokens,c.promptTokens=g.usage.prompt_tokens,g.usage.prompt_tokens_details){const b=(d=g.usage.prompt_tokens_details.cached_tokens)!=null?d:0;s.cachedInputTokens=b,c.promptTokensDetails={cachedTokens:b}}if(c.completionTokens=g.usage.completion_tokens,g.usage.completion_tokens_details){const b=(f=g.usage.completion_tokens_details.reasoning_tokens)!=null?f:0;s.reasoningTokens=b,c.completionTokensDetails={reasoningTokens:b}}c.cost=g.usage.cost,c.totalTokens=g.usage.total_tokens;const v=(m=g.usage.cost_details)==null?void 0:m.upstream_inference_cost;v!=null&&(c.costDetails={upstreamInferenceCost:v})}const h=g.choices[0];h?.finish_reason!=null&&(a=ws(h.finish_reason)),h?.text!=null&&u.enqueue({type:"text-delta",delta:h.text,id:Mt()})},flush(l){l.enqueue({type:"finish",finishReason:a,usage:s,providerMetadata:{openrouter:{usage:c}}})}})),response:{headers:i}}}},eF=O({prompt_tokens:Z(),total_tokens:Z(),cost:Z().optional()}),tF=O({object:B("embedding"),embedding:z(Z()),index:Z().optional()}),rF=O({id:x().optional(),object:B("list"),data:z(tF),model:x(),usage:eF.optional()}),nF=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 ui({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:li(this.config.headers(),n),body:i,failedResponseHandler:di,successfulResponseHandler:Dm(rF),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 oF(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==null))}function iF(e,...t){const r=oF(e??{}),n=[r["user-agent"]||"",...t].filter(Boolean).join(" ");return bs(xe({},r),{"user-agent":n})}var aF="1.5.4";function II(e={}){var t,r,o;const n=(r=z5((t=e.baseURL)!=null?t:e.baseUrl))!=null?r:"https://openrouter.ai/api/v1",i=(o=e.compatibility)!=null?o:"compatible",a=()=>iF(xe(xe({Authorization:`Bearer ${b5({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/${aF}`),s=(f,m={})=>new Y5(f,m,{provider:"openrouter.chat",url:({path:g})=>`${n}${g}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),c=(f,m={})=>new Q5(f,m,{provider:"openrouter.completion",url:({path:g})=>`${n}${g}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),l=(f,m={})=>new nF(f,m,{provider:"openrouter.embedding",url:({path:g})=>`${n}${g}`,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}II({compatibility:"strict"});function Wu(...e){return e.reduce((t,r)=>({...t,...r??{}}),{})}async function $I(e,t){if(e==null)return Promise.resolve();const r=t?.abortSignal;return new Promise((o,n)=>{if(r?.aborted){n(bg());return}const i=setTimeout(()=>{a(),o()},e),a=()=>{clearTimeout(i),r?.removeEventListener("abort",s)},s=()=>{a(),n(bg())};r?.addEventListener("abort",s)})}function bg(){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()}`},sF=oa();function TI(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 cF=["fetch failed","failed to fetch"];function OI({error:e,url:t,requestBodyValues:r}){if(cn(e))return e;if(e instanceof TypeError&&cF.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 lF(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(lF(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var AI="3.0.16",uF=()=>globalThis.fetch,_g=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:o,abortSignal:n,fetch:i=uF()})=>{try{const a=await i(e,{method:"GET",headers:Hc(t,`ai-sdk/provider-utils/${AI}`,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 OI({error:a,url:e,requestBodyValues:{}})}};function dF({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 fF=/"__proto__"\s*:/,mF=/"constructor"\s*:/;function pF(e){const t=JSON.parse(e);return t===null||typeof t!="object"||fF.test(e)===!1&&mF.test(e)===!1?t:hF(t)}function hF(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 CI(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return pF(e)}finally{Error.stackTraceLimit=t}}var xs=Symbol.for("vercel.ai.validator");function gF(e){return{[xs]:!0,validate:e}}function vF(e){return typeof e=="object"&&e!==null&&xs in e&&e[xs]===!0&&"validate"in e}function xo(e){let t;return()=>(t==null&&(t=e()),t)}function yF(e){return vF(e)?e:typeof e=="function"?e():bF(e)}function bF(e){return gF(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new Jo({value:t,cause:r.issues})}})}async function Ju({value:e,schema:t}){const r=await Mr({value:e,schema:t});if(!r.success)throw Jo.wrap({value:e,cause:r.error});return r.value}async function Mr({value:e,schema:t}){const r=yF(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:Jo.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:Jo.wrap({value:e,cause:o}),rawValue:e}}}async function _F({text:e,schema:t}){try{const r=CI(e);return t==null?r:Ju({value:r,schema:t})}catch(r){throw Ha.isInstance(r)||Jo.isInstance(r)?r:new Ha({text:e,cause:r})}}async function ln({text:e,schema:t}){try{const r=CI(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 wF({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 xF=()=>globalThis.fetch,Ku=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>SF({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),SF=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=xF()})=>{try{const s=await a(e,{method:"POST",headers:Hc(t,`ai-sdk/provider-utils/${AI}`,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 OI({error:s,url:e,requestBodyValues:r.values})}};async function $r(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var fi=({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 _F({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)})}}},kF=e=>async({response:t})=>{const r=na(t);if(t.body==null)throw new rO({});return{responseHeaders:r,value:wF({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}},EF=(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("/")},IF=Symbol("Let zodToJsonSchema decide on which parser to use"),wg={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"},$F=e=>typeof e=="string"?{...wg,name:e}:{...wg,...e};function xt(){return{}}function TF(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 OF(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 AF(){return{type:"boolean"}}function NI(e,t){return Se(e.type._def,t)}var CF=(e,t)=>Se(e.innerType._def,t);function RI(e,t,r){const o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>RI(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 NF(e)}}var NF=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 RF(e,t){return{...Se(e.innerType._def,t),default:e.defaultValue()}}function PF(e,t){return t.effectStrategy==="input"?Se(e.schema._def,t):xt()}function jF(e){return{type:"string",enum:Array.from(e.values)}}var zF=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function DF(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(zF(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 MF(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,zt={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 PI(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":Dt(r,"email",o.message,t);break;case"format:idn-email":Dt(r,"idn-email",o.message,t);break;case"pattern:zod":ot(r,zt.email,o.message,t);break}break;case"url":Dt(r,"uri",o.message,t);break;case"uuid":Dt(r,"uuid",o.message,t);break;case"regex":ot(r,o.regex,o.message,t);break;case"cuid":ot(r,zt.cuid,o.message,t);break;case"cuid2":ot(r,zt.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":Dt(r,"date-time",o.message,t);break;case"date":Dt(r,"date",o.message,t);break;case"time":Dt(r,"time",o.message,t);break;case"duration":Dt(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"&&Dt(r,"ipv4",o.message,t),o.version!=="v4"&&Dt(r,"ipv6",o.message,t);break}case"base64url":ot(r,zt.base64url,o.message,t);break;case"jwt":ot(r,zt.jwt,o.message,t);break;case"cidr":{o.version!=="v6"&&ot(r,zt.ipv4Cidr,o.message,t),o.version!=="v4"&&ot(r,zt.ipv6Cidr,o.message,t);break}case"emoji":ot(r,zt.emoji(),o.message,t);break;case"ulid":{ot(r,zt.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Dt(r,"binary",o.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{ot(r,zt.base64,o.message,t);break}}break}case"nanoid":ot(r,zt.nanoid,o.message,t)}return r}function Bl(e,t){return t.patternStrategy==="escape"?LF(e):e}var UF=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function LF(e){let t="";for(let r=0;r<e.length;r++)UF.has(e[r])||(t+="\\"),t+=e[r];return t}function Dt(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:xg(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=xg(t,o)}function xg(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 jI(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}=PI(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}=NI(e.keyType._def,t);return{...c,propertyNames:u}}}return c}function FF(e,t){if(t.mapStrategy==="record")return jI(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 VF(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 ZF(){return{not:xt()}}function BF(){return{type:"null"}}var Yu={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function qF(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 GF(e,t)}var GF=(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 HF(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 WF(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 JF(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=YF(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=KF(e,t);return i!==void 0&&(r.additionalProperties=i),r}function KF(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 YF(e){try{return e.isOptional()}catch{return!0}}var XF=(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()},QF=(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 e3(e,t){return Se(e.type._def,t)}function t3(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 r3(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 n3(){return{not:xt()}}function o3(){return xt()}var i3=(e,t)=>Se(e.innerType._def,t),a3=(e,t,r)=>{switch(t){case X.ZodString:return PI(e,r);case X.ZodNumber:return WF(e);case X.ZodObject:return JF(e,r);case X.ZodBigInt:return OF(e);case X.ZodBoolean:return AF();case X.ZodDate:return RI(e,r);case X.ZodUndefined:return n3();case X.ZodNull:return BF();case X.ZodArray:return TF(e,r);case X.ZodUnion:case X.ZodDiscriminatedUnion:return qF(e,r);case X.ZodIntersection:return DF(e,r);case X.ZodTuple:return r3(e,r);case X.ZodRecord:return jI(e,r);case X.ZodLiteral:return MF(e);case X.ZodEnum:return jF(e);case X.ZodNativeEnum:return VF(e);case X.ZodNullable:return HF(e,r);case X.ZodOptional:return XF(e,r);case X.ZodMap:return FF(e,r);case X.ZodSet:return t3(e,r);case X.ZodLazy:return()=>e.getter()._def;case X.ZodPromise:return e3(e,r);case X.ZodNaN:case X.ZodNever:return ZF();case X.ZodEffects:return PF(e,r);case X.ZodAny:return xt();case X.ZodUnknown:return o3();case X.ZodDefault:return RF(e,r);case X.ZodBranded:return NI(e,r);case X.ZodReadonly:return i3(e,r);case X.ZodCatch:return CF(e,r);case X.ZodPipeline:return QF(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!==IF)return c}if(n&&!r){const c=s3(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=a3(e,e.typeName,t),s=typeof a=="function"?Se(a(),t):a;if(s&&c3(e,t,s),t.postProcess){const c=t.postProcess(s,e,t);return i.jsonSchema=s,c}return i.jsonSchema=s,s}var s3=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:EF(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}},c3=(e,t,r)=>(e.description&&(r.description=e.description),r),l3=e=>{const t=$F(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}]))}},u3=(e,t)=>{var r;const o=l3(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},d3=u3;function f3(e,t){var r;const o=(r=void 0)!=null?r:!1;return Zm(()=>d3(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 m3(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 p3(e){return"_zod"in e}function wn(e,t){return p3(e)?m3(e):f3(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 h3(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}):h3(e)?e:typeof e=="function"?e():wn(e)}var{btoa:g3,atob:v3}=globalThis;function Bm(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=v3(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 g3(t)}function y3(e){return e?.replace(/\/$/,"")}function b3(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}async function*_3({execute:e,input:t,options:r}){const o=e(t,r);if(b3(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,Sg;function w3(){if(Sg)return ql;Sg=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 g of r(d))!o.call(u,g)&&g!==f&&e(u,g,{get:()=>d[g],enumerable:!(m=t(d,g))||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,kg;function x3(){if(kg)return Gl;kg=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,g)=>{if(f&&typeof f=="object"||typeof f=="function")for(let h of r(f))!o.call(d,h)&&h!==m&&e(d,h,{get:()=>f[h],enumerable:!(g=t(f,h))||g.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=w3();async function l(){return""}function u(){return""}return Gl}var zI=x3(),S3="vercel.ai.gateway.error",Hl=Symbol.for(S3),Eg,Ig,St=class DI extends(Ig=Error,Eg=Hl,Ig){constructor({message:t,statusCode:r=500,cause:o}){super(t),this[Eg]=!0,this.statusCode=r,this.cause=o}static isInstance(t){return DI.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&Hl in t&&t[Hl]===!0}},MI="GatewayAuthenticationError",k3=`vercel.ai.gateway.error.${MI}`,$g=Symbol.for(k3),Tg,Og,qm=class UI extends(Og=St,Tg=$g,Og){constructor({message:t="Authentication failed",statusCode:r=401,cause:o}={}){super({message:t,statusCode:r,cause:o}),this[Tg]=!0,this.name=MI,this.type="authentication_error"}static isInstance(t){return St.hasMarker(t)&&$g 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 UI({message:a,statusCode:n,cause:i})}},LI="GatewayInvalidRequestError",E3=`vercel.ai.gateway.error.${LI}`,Ag=Symbol.for(E3),Cg,Ng,I3=class extends(Ng=St,Cg=Ag,Ng){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Cg]=!0,this.name=LI,this.type="invalid_request_error"}static isInstance(e){return St.hasMarker(e)&&Ag in e}},FI="GatewayRateLimitError",$3=`vercel.ai.gateway.error.${FI}`,Rg=Symbol.for($3),Pg,jg,T3=class extends(jg=St,Pg=Rg,jg){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Pg]=!0,this.name=FI,this.type="rate_limit_exceeded"}static isInstance(e){return St.hasMarker(e)&&Rg in e}},VI="GatewayModelNotFoundError",O3=`vercel.ai.gateway.error.${VI}`,zg=Symbol.for(O3),A3=xo(()=>wn(O({modelId:x()}))),Dg,Mg,ZI=class extends(Mg=St,Dg=zg,Mg){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:o}={}){super({message:e,statusCode:t,cause:o}),this[Dg]=!0,this.name=VI,this.type="model_not_found",this.modelId=r}static isInstance(e){return St.hasMarker(e)&&zg in e}},BI="GatewayInternalServerError",C3=`vercel.ai.gateway.error.${BI}`,Ug=Symbol.for(C3),Lg,Fg,Vg=class extends(Fg=St,Lg=Ug,Fg){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Lg]=!0,this.name=BI,this.type="internal_server_error"}static isInstance(e){return St.hasMarker(e)&&Ug in e}},qI="GatewayResponseError",N3=`vercel.ai.gateway.error.${qI}`,Zg=Symbol.for(N3),Bg,qg,R3=class extends(qg=St,Bg=Zg,qg){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:o,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[Bg]=!0,this.name=qI,this.type="response_error",this.response=r,this.validationError=o}static isInstance(e){return St.hasMarker(e)&&Zg in e}};async function Gg({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:o,authMethod:n}){const i=await Mr({value:e,schema:P3});if(!i.success)return new R3({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 I3({message:c,statusCode:t,cause:o});case"rate_limit_exceeded":return new T3({message:c,statusCode:t,cause:o});case"model_not_found":{const l=await Mr({value:a.error.param,schema:A3});return new ZI({message:c,statusCode:t,modelId:l.success?l.value.modelId:void 0,cause:o})}case"internal_server_error":return new Vg({message:c,statusCode:t,cause:o});default:return new Vg({message:c,statusCode:t,cause:o})}}var P3=xo(()=>wn(O({error:O({message:x(),type:x().nullish(),param:Qe().nullish(),code:fe([x(),Z()]).nullish()})})));function un(e,t){var r;return St.isInstance(e)?e:st.isInstance(e)?Gg({response:j3(e),statusCode:(r=e.statusCode)!=null?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):Gg({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function j3(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 GI="ai-gateway-auth-method";async function mi(e){const t=await Mr({value:e[GI],schema:z3});return t.success?t.value:void 0}var z3=xo(()=>wn(fe([B("api-key"),B("oidc")]))),Hg=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await _g({url:`${this.config.baseURL}/config`,headers:await $r(this.config.headers()),successfulResponseHandler:Ss(D3),failedResponseHandler:fi({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 _g({url:`${e.origin}/v1/credits`,headers:await $r(this.config.headers()),successfulResponseHandler:Ss(M3),failedResponseHandler:fi({errorSchema:Me(),errorToMessage:r=>r}),fetch:this.config.fetch});return t}catch(e){throw await un(e)}}},D3=xo(()=>wn(O({models:z(O({id:x(),name:x(),description:x().nullish(),pricing:O({input:x(),output:x(),input_cache_read:x().nullish(),input_cache_write:x().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:x(),modelId:x()}),modelType:gn(["language","embedding","image"]).nullish()}))}))),M3=xo(()=>wn(O({balance:x(),total_used:x()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),U3=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:fi({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 mi(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:kF(Me()),failedResponseHandler:fi({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 mi(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)}}},L3=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(F3),failedResponseHandler:fi({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 mi(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"2","ai-model-id":this.modelId}}},F3=xo(()=>wn(O({embeddings:z(z(Z())),usage:O({tokens:Z()}).nullish(),providerMetadata:er(x(),er(x(),Qe())).optional()})));async function V3(){var e;return(e=zI.getContext().headers)==null?void 0:e["x-vercel-id"]}var Z3="2.0.7",B3="0.0.1";function q3(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=y3(e.baseURL))!=null?r:"https://ai-gateway.vercel.sh/v1/ai",c=async()=>{const g=await H3(e);if(g)return Hc({Authorization:`Bearer ${g.token}`,"ai-gateway-protocol-version":B3,[GI]:g.authMethod,...e.headers},`ai-sdk/gateway/${Z3}`);throw qm.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401})},l=()=>{const g=Va({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),h=Va({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),v=Va({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const b=await V3();return{...g&&{"ai-o11y-deployment-id":g},...h&&{"ai-o11y-environment":h},...v&&{"ai-o11y-region":v},...b&&{"ai-o11y-request-id":b}}}},u=g=>new U3(g,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),d=async()=>{var g,h,v;const b=(v=(h=(g=e._internal)==null?void 0:g.currentDate)==null?void 0:h.call(g).getTime())!=null?v:Date.now();return(!o||b-a>i)&&(a=b,o=new Hg({baseURL:s,headers:c,fetch:e.fetch}).getAvailableModels().then(w=>(n=w,w)).catch(async w=>{throw await un(w,await mi(await c()))})),n?Promise.resolve(n):o},f=async()=>new Hg({baseURL:s,headers:c,fetch:e.fetch}).getCredits().catch(async g=>{throw await un(g,await mi(await c()))}),m=function(g){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return u(g)};return m.getAvailableModels=d,m.getCredits=f,m.imageModel=g=>{throw new sO({modelId:g,modelType:"imageModel"})},m.languageModel=u,m.textEmbeddingModel=g=>new L3(g,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),m}var G3=q3();async function H3(e){const t=Va({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(t)return{token:t,authMethod:"api-key"};try{return{token:await zI.getVercelOidcToken(),authMethod:"oidc"}}catch{return null}}var W3=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},en="1.9.0",Wg=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function J3(e){var t=new Set([e]),r=new Set,o=e.match(Wg);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(Wg);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 K3=J3(en),Y3=en.split(".")[0],pi=Symbol.for("opentelemetry.js.api."+Y3),hi=W3;function Gm(e,t,r,o){var n;o===void 0&&(o=!1);var i=hi[pi]=(n=hi[pi])!==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 gi(e){var t,r,o=(t=hi[pi])===null||t===void 0?void 0:t.version;if(!(!o||!K3(o)))return(r=hi[pi])===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[pi];r&&delete r[e]}var X3=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},Q3=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))},eV=(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 Mo("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mo("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mo("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mo("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Mo("verbose",this._namespace,t)},e})();function Mo(e,t,r){var o=gi("diag");if(o)return r.unshift(t),o[e].apply(o,Q3([],X3(r),!1))}var ht;(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"})(ht||(ht={}));function tV(e,t){e<ht.NONE?e=ht.NONE:e>ht.ALL&&(e=ht.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",ht.ERROR),warn:r("warn",ht.WARN),info:r("info",ht.INFO),debug:r("debug",ht.DEBUG),verbose:r("verbose",ht.VERBOSE)}}var rV=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},nV=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))},oV="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=gi("diag");if(s)return s[n].apply(s,nV([],rV(i),!1))}}var r=this,o=function(n,i){var a,s,c;if(i===void 0&&(i={logLevel:ht.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=gi("diag"),d=tV((s=i.logLevel)!==null&&s!==void 0?s:ht.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(oV,r)},r.createComponentLogger=function(n){return new eV(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 iV(e){return Symbol.for(e)}var aV=(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})(),sV=new aV,cV=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},lV=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))},uV=(function(){function e(){}return e.prototype.active=function(){return sV},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,lV([o],cV(n),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),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))},Wl="context",mV=new uV,HI=(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,fV([t,r,o],dV(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return gi(Wl)||mV},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 WI="0000000000000000",JI="00000000000000000000000000000000",pV={traceId:JI,spanId:WI,traceFlags:ed.NONE},Ho=(function(){function e(t){t===void 0&&(t=pV),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=iV("OpenTelemetry Context Key SPAN");function Jm(e){return e.getValue(Wm)||void 0}function hV(){return Jm(HI.getInstance().active())}function Km(e,t){return e.setValue(Wm,t)}function gV(e){return e.deleteValue(Wm)}function vV(e,t){return Km(e,new Ho(t))}function KI(e){var t;return(t=Jm(e))===null||t===void 0?void 0:t.spanContext()}var yV=/^([0-9a-f]{32})$/i,bV=/^[0-9a-f]{16}$/i;function _V(e){return yV.test(e)&&e!==JI}function wV(e){return bV.test(e)&&e!==WI}function YI(e){return _V(e.traceId)&&wV(e.spanId)}function xV(e){return new Ho(e)}var Jl=HI.getInstance(),XI=(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 Ho;var i=o&&KI(o);return SV(i)&&YI(i)?new Ho(i):new Ho},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 SV(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var kV=new XI,EV=(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):kV},e})(),IV=(function(){function e(){}return e.prototype.getTracer=function(t,r,o){return new XI},e})(),$V=new IV,Jg=(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 EV(this,t,r,o)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:$V},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",TV=(function(){function e(){this._proxyTracerProvider=new Jg,this.wrapSpanContext=xV,this.isSpanContextValid=YI,this.deleteSpan=gV,this.getSpan=Jm,this.getActiveSpan=hV,this.getSpanContext=KI,this.setSpan=Km,this.setSpanContext=vV}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 gi(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 Jg},e})(),OV=TV.getInstance(),AV=Object.defineProperty,CV=(e,t)=>{for(var r in t)AV(e,r,{get:t[r],enumerable:!0})},QI="AI_NoOutputSpecifiedError",e$=`vercel.ai.error.${QI}`,NV=Symbol.for(e$),t$,RV=class extends ee{constructor({message:e="No output specified."}={}){super({name:QI,message:e}),this[t$]=!0}static isInstance(e){return ee.hasMarker(e,e$)}};t$=NV;function PV(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 jV="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",Kg=!1,zV=e=>{if(e.length===0)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t=="function"){t(e);return}Kg||(Kg=!0,console.info(jV));for(const r of e)console.warn(PV(r))}},r$="AI_InvalidArgumentError",n$=`vercel.ai.error.${r$}`,DV=Symbol.for(n$),o$,Jt=class extends ee{constructor({parameter:e,value:t,message:r}){super({name:r$,message:`Invalid argument for parameter ${e}: ${r}`}),this[o$]=!0,this.parameter=e,this.value=t}static isInstance(e){return ee.hasMarker(e,n$)}};o$=DV;var i$="AI_InvalidToolInputError",a$=`vercel.ai.error.${i$}`,MV=Symbol.for(a$),s$,c$=class extends ee{constructor({toolInput:e,toolName:t,cause:r,message:o=`Invalid input for tool ${t}: ${uo(r)}`}){super({name:i$,message:o,cause:r}),this[s$]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return ee.hasMarker(e,a$)}};s$=MV;var l$="AI_NoObjectGeneratedError",u$=`vercel.ai.error.${l$}`,UV=Symbol.for(u$),d$,Yg=class extends ee{constructor({message:e="No object generated.",cause:t,text:r,response:o,usage:n,finishReason:i}){super({name:l$,message:e,cause:t}),this[d$]=!0,this.text=r,this.response=o,this.usage=n,this.finishReason=i}static isInstance(e){return ee.hasMarker(e,u$)}};d$=UV;var f$="AI_NoOutputGeneratedError",m$=`vercel.ai.error.${f$}`,LV=Symbol.for(m$),p$,FV=class extends ee{constructor({message:e="No output generated.",cause:t}={}){super({name:f$,message:e,cause:t}),this[p$]=!0}static isInstance(e){return ee.hasMarker(e,m$)}};p$=LV;var h$="AI_NoSuchToolError",g$=`vercel.ai.error.${h$}`,VV=Symbol.for(g$),v$,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:h$,message:r}),this[v$]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return ee.hasMarker(e,g$)}};v$=VV;var y$="AI_ToolCallRepairError",b$=`vercel.ai.error.${y$}`,ZV=Symbol.for(b$),_$,BV=class extends ee{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${uo(e)}`}){super({name:y$,message:r,cause:e}),this[_$]=!0,this.originalError=t}static isInstance(e){return ee.hasMarker(e,b$)}};_$=ZV;var qV=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}},w$="AI_InvalidMessageRoleError",x$=`vercel.ai.error.${w$}`,GV=Symbol.for(x$),S$,HV=class extends ee{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:w$,message:t}),this[S$]=!0,this.role=e}static isInstance(e){return ee.hasMarker(e,x$)}};S$=GV;var k$="AI_MessageConversionError",E$=`vercel.ai.error.${k$}`,WV=Symbol.for(E$),I$,JV=class extends ee{constructor({originalMessage:e,message:t}){super({name:k$,message:t}),this[I$]=!0,this.originalMessage=e}static isInstance(e){return ee.hasMarker(e,E$)}};I$=WV;var $$="AI_DownloadError",T$=`vercel.ai.error.${$$}`,KV=Symbol.for(T$),O$,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:$$,message:n,cause:o}),this[O$]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return ee.hasMarker(e,T$)}};O$=KV;var A$="AI_RetryError",C$=`vercel.ai.error.${A$}`,YV=Symbol.for(C$),N$,Xg=class extends ee{constructor({message:e,reason:t,errors:r}){super({name:A$,message:e}),this[N$]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return ee.hasMarker(e,C$)}};N$=YV;function R$(e){if(typeof e!="string"){if(e.specificationVersion!=="v2")throw new qV({version:e.specificationVersion,provider:e.provider,modelId:e.modelId});return e}return XV().languageModel(e)}function XV(){var e;return(e=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?e:G3}var QV=[{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]}],eZ=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 tZ(e){return typeof e=="string"&&e.startsWith("SUQz")||typeof e!="string"&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?eZ(e):e}function rZ({data:e,signatures:t}){const r=tZ(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 nZ="5.0.90",oZ=async({url:e})=>{var t;const r=e.toString();try{const o=await fetch(r,{headers:Hc({},`ai-sdk/${nZ}`,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})}},iZ=(e=oZ)=>t=>Promise.all(t.map(async r=>r.isUrlSupportedByModel?null:e(r)));function aZ(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 P$=fe([x(),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 j$(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}=aZ(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 sZ(e){return typeof e=="string"?e:e instanceof ArrayBuffer?Qu(new Uint8Array(e)):Qu(e)}async function cZ({prompt:e,supportedUrls:t,download:r=iZ()}){const o=await uZ(e.messages,r,t);return[...e.system!=null?[{role:"system",content:e.system}]:[],...e.messages.map(n=>lZ({message:n,downloadedAssets:o}))]}function lZ({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=>dZ(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}=j$(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 HV({role:o})}}}async function uZ(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&&dF({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 dZ(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}=j$(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=rZ({data:c,signatures:QV}))!=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 fZ({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 Jt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new Jt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(t!=null&&typeof t!="number")throw new Jt({parameter:"temperature",value:t,message:"temperature must be a number"});if(r!=null&&typeof r!="number")throw new Jt({parameter:"topP",value:r,message:"topP must be a number"});if(o!=null&&typeof o!="number")throw new Jt({parameter:"topK",value:o,message:"topK must be a number"});if(n!=null&&typeof n!="number")throw new Jt({parameter:"presencePenalty",value:n,message:"presencePenalty must be a number"});if(i!=null&&typeof i!="number")throw new Jt({parameter:"frequencyPenalty",value:i,message:"frequencyPenalty must be a number"});if(a!=null&&!Number.isInteger(a))throw new Jt({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 mZ(e){return e!=null&&Object.keys(e).length>0}function pZ({tools:e,toolChoice:t,activeTools:r}){return mZ(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 vi=Ic(()=>fe([yc(),x(),Z(),mt(),er(x(),vi),z(vi)])),or=er(x(),er(x(),vi)),z$=O({type:B("text"),text:x(),providerOptions:or.optional()}),hZ=O({type:B("image"),image:fe([P$,to(URL)]),mediaType:x().optional(),providerOptions:or.optional()}),D$=O({type:B("file"),data:fe([P$,to(URL)]),filename:x().optional(),mediaType:x(),providerOptions:or.optional()}),gZ=O({type:B("reasoning"),text:x(),providerOptions:or.optional()}),vZ=O({type:B("tool-call"),toolCallId:x(),toolName:x(),input:Qe(),providerOptions:or.optional(),providerExecuted:mt().optional()}),yZ=Af("type",[O({type:B("text"),value:x()}),O({type:B("json"),value:vi}),O({type:B("error-text"),value:x()}),O({type:B("error-json"),value:vi}),O({type:B("content"),value:z(fe([O({type:B("text"),text:x()}),O({type:B("media"),data:x(),mediaType:x()})]))})]),M$=O({type:B("tool-result"),toolCallId:x(),toolName:x(),output:yZ,providerOptions:or.optional()}),bZ=O({role:B("system"),content:x(),providerOptions:or.optional()}),_Z=O({role:B("user"),content:fe([x(),z(fe([z$,hZ,D$]))]),providerOptions:or.optional()}),wZ=O({role:B("assistant"),content:fe([x(),z(fe([z$,D$,gZ,vZ,M$]))]),providerOptions:or.optional()}),xZ=O({role:B("tool"),content:z(M$),providerOptions:or.optional()}),SZ=fe([bZ,_Z,wZ,xZ]);async function kZ(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:z(SZ)});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 EZ(e){return qm.isInstance(e)||ZI.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 IZ({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 $Z={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 TZ},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}},TZ={traceId:"",spanId:"",traceFlags:0};function OZ({isEnabled:e=!1,tracer:t}={}){return e?t||OV.getTracer("ai"):$Z}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{U$(i,a)}finally{i.end()}throw a}})}function U$(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 AZ(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?sZ(r.data):r.data}:r)})))}function CZ(e,t){return{inputTokens:Uo(e.inputTokens,t.inputTokens),outputTokens:Uo(e.outputTokens,t.outputTokens),totalTokens:Uo(e.totalTokens,t.totalTokens),reasoningTokens:Uo(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:Uo(e.cachedInputTokens,t.cachedInputTokens)}}function Uo(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function Qg(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function NZ({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 RZ=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:o}={})=>async n=>L$(n,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:o});async function L$(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=TI(a),c=[...i,a],l=c.length;if(l>t)throw new Xg({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 $I(NZ({error:a,exponentialBackoffDelay:r}),{abortSignal:n}),L$(e,{maxRetries:t,delayInMs:o*r,backoffFactor:o,abortSignal:n},c);throw l===1?a:new Xg({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:"errorNotRetryable",errors:c})}}function PZ({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new Jt({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new Jt({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=e??2;return{maxRetries:r,retry:RZ({maxRetries:r,abortSignal:t})}}var jZ=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}},zZ=class extends jZ{constructor(e){super(e),this.type="file"}};async function DZ({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)||c$.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 BV({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 c$({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 MZ=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 F$(e){return({steps:t})=>t.length===e}async function UZ({stopConditions:e,steps:t}){return(await Promise.all(e.map(r=>r({steps:t})))).some(r=>r)}function Wo({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:Wo({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:Wo({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:Wo({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 LZ({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 V$({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 FZ({response:e,status:t,statusText:r,headers:o,textStream:n}){V$({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 Z$=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
85
+
86
+ `)},flush(e){e.enqueue(`data: [DONE]
87
+
88
+ `)}})}},B$={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function VZ({status:e,statusText:t,headers:r,stream:o,consumeSseStream:n}){let i=o.pipeThrough(new Z$);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,B$)})}function ZZ({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 BZ(e){return e.type.startsWith("data-")}function q$(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]=q$(i,n):r[o]=n}return r}function qZ(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 G$(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:qZ(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 GZ(e){return Ym(e)?e.toolName:Is(e)}function HZ({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function WZ({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,g;function h(y){const S=l.message.parts.filter(Vn).find(E=>E.toolCallId===y);if(S==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return S}function v(y){const S=l.message.parts.filter(E=>E.type==="dynamic-tool").find(E=>E.toolCallId===y);if(S==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return S}function b(y){var k;const S=l.message.parts.find(D=>Vn(D)&&D.toolCallId===y.toolCallId),E=y,C=S;S!=null?(S.state=y.state,C.input=E.input,C.output=E.output,C.errorText=E.errorText,C.rawInput=E.rawInput,C.preliminary=E.preliminary,C.providerExecuted=(k=E.providerExecuted)!=null?k:S.providerExecuted,E.providerMetadata!=null&&S.state==="input-available"&&(S.callProviderMetadata=E.providerMetadata)):l.message.parts.push({type:`tool-${y.toolName}`,toolCallId:y.toolCallId,state:y.state,input:E.input,output:E.output,rawInput:E.rawInput,errorText:E.errorText,providerExecuted:E.providerExecuted,preliminary:E.preliminary,...E.providerMetadata!=null?{callProviderMetadata:E.providerMetadata}:{}})}function w(y){var k,S;const E=l.message.parts.find(U=>U.type==="dynamic-tool"&&U.toolCallId===y.toolCallId),C=y,D=E;E!=null?(E.state=y.state,D.toolName=y.toolName,D.input=C.input,D.output=C.output,D.errorText=C.errorText,D.rawInput=(k=C.rawInput)!=null?k:D.rawInput,D.preliminary=C.preliminary,D.providerExecuted=(S=C.providerExecuted)!=null?S:E.providerExecuted,C.providerMetadata!=null&&E.state==="input-available"&&(E.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:y.toolName,toolCallId:y.toolCallId,state:y.state,input:C.input,output:C.output,errorText:C.errorText,preliminary:C.preliminary,providerExecuted:C.providerExecuted,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}async function I(y){if(y!=null){const k=l.message.metadata!=null?q$(l.message.metadata,y):y;t!=null&&await Ju({value:k,schema:t}),l.message.metadata=k}}switch(s.type){case"text-start":{const y={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeTextParts[s.id]=y,l.message.parts.push(y),u();break}case"text-delta":{const y=l.activeTextParts[s.id];y.text+=s.delta,y.providerMetadata=(d=s.providerMetadata)!=null?d:y.providerMetadata,u();break}case"text-end":{const y=l.activeTextParts[s.id];y.state="done",y.providerMetadata=(f=s.providerMetadata)!=null?f:y.providerMetadata,delete l.activeTextParts[s.id],u();break}case"reasoning-start":{const y={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeReasoningParts[s.id]=y,l.message.parts.push(y),u();break}case"reasoning-delta":{const y=l.activeReasoningParts[s.id];y.text+=s.delta,y.providerMetadata=(m=s.providerMetadata)!=null?m:y.providerMetadata,u();break}case"reasoning-end":{const y=l.activeReasoningParts[s.id];y.providerMetadata=(g=s.providerMetadata)!=null?g:y.providerMetadata,y.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 y=l.message.parts.filter(Vn);l.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:y.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 y=l.partialToolCalls[s.toolCallId];y.text+=s.inputTextDelta;const{value:k}=await G$(y.text);y.dynamic?w({toolCallId:s.toolCallId,toolName:y.toolName,state:"input-streaming",input:k}):b({toolCallId:s.toolCallId,toolName:y.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 y=v(s.toolCallId);w({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-available",input:y.input,output:s.output,preliminary:s.preliminary})}else{const y=h(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Is(y),state:"output-available",input:y.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary})}u();break}case"tool-output-error":{if(s.dynamic){const y=v(s.toolCallId);w({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-error",input:y.input,errorText:s.errorText,providerExecuted:s.providerExecuted})}else{const y=h(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Is(y),state:"output-error",input:y.input,rawInput:y.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 I(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&u();break}case"finish":{await I(s.messageMetadata),s.messageMetadata!=null&&u();break}case"message-metadata":{await I(s.messageMetadata),s.messageMetadata!=null&&u();break}case"error":{n?.(new Error(s.errorText));break}default:if(BZ(s)){r?.[s.type]!=null&&await Ju({value:s.data,schema:r[s.type]});const y=s;if(y.transient){a?.(y);break}const k=y.id!=null?l.message.parts.find(S=>y.type===S.type&&y.id===S.id):void 0;k!=null?k.data=y.data:l.message.parts.push(y),a?.(y),u()}}c.enqueue(s)})}}))}function JZ({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 g=f;g.messageId==null&&e!=null&&(g.messageId=e)}f.type==="abort"&&(a=!0),m.enqueue(f)}}));if(r==null)return s;const c=HZ({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 WZ({stream:s,runUpdateMessageJob:l,onError:o}).pipeThrough(new TransformStream({transform(f,m){m.enqueue(f)},async cancel(){await d()},async flush(){await d()}}))}function KZ({response:e,status:t,statusText:r,headers:o,stream:n,consumeSseStream:i}){let a=n.pipeThrough(new Z$);if(i){const[s,c]=a.tee();a=s,i({stream:c})}V$({response:e,status:t,statusText:r,headers:Object.fromEntries(Jc(o,B$).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 YZ({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 XZ(){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 $a=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 QZ(){var e,t;return(t=(e=globalThis?.performance)==null?void 0:e.now())!=null?t:Date.now()}function eB({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,g;function h(){m&&d.size===0&&(g!=null&&l.enqueue(g),l.close())}const v=new TransformStream({async transform(b,w){const I=b.type;switch(I){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 zZ({data:b.data,mediaType:b.mediaType})});break}case"finish":{g={type:"finish",finishReason:b.finishReason,usage:b.usage,providerMetadata:b.providerMetadata};break}case"tool-call":{try{const y=await DZ({toolCall:b,tools:e,repairToolCall:s,system:n,messages:i});if(w.enqueue(y),y.invalid){l.enqueue({type:"tool-error",toolCallId:y.toolCallId,toolName:y.toolName,input:y.input,error:TI(y.error),dynamic:!0});break}const k=e[y.toolName];if(f.set(y.toolCallId,y.input),k.onInputAvailable!=null&&await k.onInputAvailable({input:y.input,toolCallId:y.toolCallId,messages:i,abortSignal:a,experimental_context:c}),k.execute!=null&&y.providerExecuted!==!0){const S=sF();d.add(S),nd({name:"ai.toolCall",attributes:Un({telemetry:o,attributes:{...rd({operationId:"ai.toolCall",telemetry:o}),"ai.toolCall.name":y.toolName,"ai.toolCall.id":y.toolCallId,"ai.toolCall.args":{output:()=>JSON.stringify(y.input)}}}),tracer:r,fn:async E=>{let C;try{const D=_3({execute:k.execute.bind(k),input:y.input,options:{toolCallId:y.toolCallId,messages:i,abortSignal:a,experimental_context:c}});for await(const U of D)l.enqueue({...y,type:"tool-result",output:U.output,...U.type==="preliminary"&&{preliminary:!0}}),U.type==="final"&&(C=U.output)}catch(D){U$(E,D),l.enqueue({...y,type:"tool-error",error:D}),d.delete(S),h();return}d.delete(S),h();try{E.setAttributes(Un({telemetry:o,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(C)}}}))}catch{}}})}}catch(y){l.enqueue({type:"error",error:y})}break}case"tool-result":{const y=b.toolName;b.isError?l.enqueue({type:"tool-error",toolCallId:b.toolCallId,toolName:y,input:f.get(b.toolCallId),providerExecuted:b.providerExecuted,error:b.result}):w.enqueue({type:"tool-result",toolCallId:b.toolCallId,toolName:y,input:f.get(b.toolCallId),output:b.result,providerExecuted:b.providerExecuted});break}default:{const y=I;throw new Error(`Unhandled chunk type: ${y}`)}}},flush(){m=!0,h()}});return new ReadableStream({async start(b){return Promise.all([t.pipeThrough(v).pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){}})),u.pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){b.close()}}))])}})}var tB=oa({prefix:"aitxt",size:24});function rB({model:e,tools:t,toolChoice:r,system:o,prompt:n,messages:i,maxRetries:a,abortSignal:s,headers:c,stopWhen:l=F$(1),experimental_output:u,experimental_telemetry:d,prepareStep:f,providerOptions:m,experimental_activeTools:g,activeTools:h=g,experimental_repairToolCall:v,experimental_transform:b,experimental_download:w,includeRawChunks:I=!1,onChunk:y,onError:k=({error:F})=>{console.error(F)},onFinish:S,onAbort:E,onStepFinish:C,experimental_context:D,_internal:{now:U=QZ,generateId:K=tB,currentDate:ge=()=>new Date}={},...q}){return new oB({model:R$(e),telemetry:d,headers:c,settings:q,maxRetries:a,abortSignal:s,system:o,prompt:n,messages:i,tools:t,toolChoice:r,transforms:Qg(b),activeTools:h,repairToolCall:v,stopConditions:Qg(l),output:u,providerOptions:m,prepareStep:f,includeRawChunks:I,onChunk:y,onError:k,onFinish:S,onAbort:E,onStepFinish:C,now:U,currentDate:ge,generateId:K,experimental_context:D,download:w})}function nB(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 oB=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:g,output:h,providerOptions:v,prepareStep:b,includeRawChunks:w,now:I,currentDate:y,generateId:k,onChunk:S,onError:E,onFinish:C,onAbort:D,onStepFinish:U,experimental_context:K,download:ge}){this._totalUsage=new $a,this._finishReason=new $a,this._steps=new $a,this.output=h,this.includeRawChunks=w,this.tools=l;let q,F=[];const ce=[];let le,pe,G={},se=[];const V=[];let ye,ue={},ve={};const R=new TransformStream({async transform(Pe,je){var Ge,be,Pt,Io;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 S?.({chunk:L}),L.type==="error"&&await E({error:EZ(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=(Io=L.providerMetadata)!=null?Io: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 MZ({content:F,finishReason:L.finishReason,usage:L.usage,warnings:se,request:G,response:{...L.response,messages:[...ce,...Ce]},providerMetadata:L.providerMetadata});await U?.($o),zV(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 FV({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 C?.({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=XZ();this.addStream=H.addStream,this.closeStream=H.close;const me=H.stream.getReader();let $e=new ReadableStream({async start(Pe){Pe.enqueue({type:"start"})},async pull(Pe){function je(){D?.({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)$e=$e.pipeThrough(Pe({tools:l,stopStream(){H.terminate()}}));this.baseStream=$e.pipeThrough(nB(h)).pipeThrough(R);const{maxRetries:Fe,retry:ll}=PZ({maxRetries:n,abortSignal:i}),Eo=OZ(t),Rt=fZ(o),la=IZ({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:Eo,endWhenDone:!1,fn:async Pe=>{ye=Pe;async function je({currentStep:Ge,responseMessages:be,usage:Pt}){var Io,L,Ce,$o,Cp;const Np=qe.includeRawChunks;q=new $a;const Rp=await kZ({system:a,prompt:s,messages:c}),To=[...Rp.messages,...be],Ht=await b?.({model:e,steps:V,stepNumber:V.length,messages:To}),Sn=R$((Io=Ht?.model)!=null?Io:e),Pp=await cZ({prompt:{system:(L=Ht?.system)!=null?L:Rp.system,messages:(Ce=Ht?.messages)!=null?Ce:To},supportedUrls:await Sn.supportedUrls,download:ge}),{toolChoice:ul,tools:dl}=pZ({tools:l,toolChoice:($o=Ht?.toolChoice)!=null?$o:u,activeTools:(Cp=Ht?.activeTools)!=null?Cp:f}),{result:{stream:q1,response:jp,request:zp},doStreamSpan:kn,startTimestampMs:Dp}=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:()=>AZ(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:Eo,endWhenDone:!1,fn:async W=>({startTimestampMs:I(),doStreamSpan:W,result:await Sn.doStream({...Rt,tools:dl,toolChoice:ul,responseFormat:h?.responseFormat,prompt:Pp,providerOptions:v,abortSignal:i,headers:r,includeRawChunks:Np})})})),G1=eB({tools:l,generatorStream:q1,tracer:Eo,telemetry:t,system:a,messages:To,repairToolCall:m,abortSignal:i,experimental_context:K}),H1=zp??{},ua=[],fl=[];let ml;const pl={};let En="unknown",jt={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},hl,Mp=!0,Wt={id:k(),timestamp:y(),modelId:e.modelId},Up="";qe.addStream(G1.pipeThrough(new TransformStream({async transform(W,He){var Oo,Ao,da,ar;if(W.type==="stream-start"){ml=W.warnings;return}if(Mp){const tt=I()-Dp;Mp=!1,kn.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":tt}),kn.setAttributes({"ai.response.msToFirstChunk":tt}),He.enqueue({type:"start-step",request:H1,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":{Wt={id:(Oo=W.id)!=null?Oo:Wt.id,timestamp:(Ao=W.timestamp)!=null?Ao:Wt.timestamp,modelId:(da=W.modelId)!=null?da:Wt.modelId};break}case"finish":{jt=W.usage,En=W.finishReason,hl=W.providerMetadata;const tt=I()-Dp;kn.addEvent("ai.stream.finish"),kn.setAttributes({"ai.response.msToFinish":tt,"ai.response.avgOutputTokensPerSecond":1e3*((ar=jt.outputTokens)!=null?ar: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:To,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],gl=l?.[tt];gl?.onInputDelta!=null&&await gl.onInputDelta({inputTextDelta:W.delta,toolCallId:W.id,messages:To,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":Wt.id,"ai.response.model":Wt.modelId,"ai.response.timestamp":Wt.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(hl),"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":Wt.id,"gen_ai.response.model":Wt.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:hl,response:{...Wt,headers:jp?.headers}});const Oo=CZ(Pt,jt);await q.promise;const Ao=ua.filter(ar=>ar.providerExecuted!==!0),da=fl.filter(ar=>ar.providerExecuted!==!0);if(Ao.length>0&&da.length===Ao.length&&!await UZ({stopConditions:g,steps:V})){be.push(...rv({content:V[V.length-1].content,tools:l}));try{await je({currentStep:Ge+1,responseMessages:be,usage:Oo})}catch(ar){W.enqueue({type:"error",error:ar}),qe.closeStream()}}else W.enqueue({type:"finish",finishReason:En,totalUsage:Oo}),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 YZ({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 RV;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?ZZ({originalMessages:e,responseMessageId:t}):void 0,u={},d=m=>{var g,h;const v=u[m];return((h=(g=this.tools)==null?void 0:g[v])==null?void 0:h.type)==="dynamic"?!0:void 0},f=this.fullStream.pipeThrough(new TransformStream({transform:async(m,g)=>{const h=o?.({part:m}),v=m.type;switch(v){case"text-start":{g.enqueue({type:"text-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-delta":{g.enqueue({type:"text-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-end":{g.enqueue({type:"text-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-start":{g.enqueue({type:"reasoning-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-delta":{n&&g.enqueue({type:"reasoning-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-end":{g.enqueue({type:"reasoning-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"file":{g.enqueue({type:"file",mediaType:m.file.mediaType,url:`data:${m.file.mediaType};base64,${m.file.base64}`});break}case"source":{i&&m.sourceType==="url"&&g.enqueue({type:"source-url",sourceId:m.id,url:m.url,title:m.title,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}}),i&&m.sourceType==="document"&&g.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);g.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":{g.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?g.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)}):g.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);g.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);g.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":{g.enqueue({type:"error",errorText:c(m.error)});break}case"start-step":{g.enqueue({type:"start-step"});break}case"finish-step":{g.enqueue({type:"finish-step"});break}case"start":{a&&g.enqueue({type:"start",...h!=null?{messageMetadata:h}:{},...l!=null?{messageId:l}:{}});break}case"finish":{s&&g.enqueue({type:"finish",...h!=null?{messageMetadata:h}:{}});break}case"abort":{g.enqueue(m);break}case"tool-input-end":break;case"raw":break;default:{const b=v;throw new Error(`Unknown chunk type: ${b}`)}}h!=null&&v!=="start"&&v!=="finish"&&g.enqueue({type:"message-metadata",messageMetadata:h})}}));return Ia(JZ({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}={}){KZ({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){FZ({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 VZ({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 LZ({textStream:this.textStream,...e})}};function iB(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:Wo({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=GZ(d);return{type:"tool-result",toolCallId:d.toolCallId,toolName:m,output:Wo({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 JV({originalMessage:o,message:`Unsupported role: ${n}`})}}return r}oa({prefix:"aiobj",size:24});oa({prefix:"aiobj",size:24});var aB={};CV(aB,{object:()=>cB,text:()=>sB});var sB=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),cB=({schema:e})=>{const t=Wc(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const o=await G$(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 Yg({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 Yg({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}}},lB={word:/\S+\s+/m,line:/\n+/m};function uB({delayInMs:e=10,chunking:t="word",_internal:{delay:r=$I}={}}={}){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"?lB[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 dB(e){return e?"sessionFn"in e:!1}const fB=({getSession:e,projectSlug:t})=>{const r=kS(),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}=IS({queryKey:o,queryFn:()=>e({projectSlug:t}),enabled:l&&e!==null,staleTime:1/0,gcTime:1/0});return u??null};async function mB(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug}})).json()).client_token}const pB=({projectSlug:e,auth:t})=>{const r=P.useMemo(()=>av(t)?()=>Promise.resolve(t.sessionToken):!av(t)&&dB(t)?t.sessionFn:mB,[t]),o=fB({getSession:r,projectSlug:e});return o?{headers:{"Gram-Project":e,"Gram-Chat-Session":o},isLoading:!1}:{isLoading:!0}};function hB({children:e}){const[t,r]=P.useState(new Map),[o,n]=P.useState(new Set),i=P.useCallback((d,f,m)=>new Promise(g=>{const h={toolCallId:f,toolName:d,args:m,resolve:g};r(v=>{const b=new Map(v);return b.set(f,h),b})}),[]),a=P.useCallback(d=>{n(f=>{const m=new Set(f);return m.add(d),m})},[]),s=P.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!0);const g=new Map(f);return g.delete(d),g}return f})},[]),c=P.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!1);const g=new Map(f);return g.delete(d),g}return f})},[]),l=P.useCallback(d=>o.has(d),[o]),u=P.useCallback(d=>t.get(d),[t]);return p.jsx(T.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:o,requestApproval:i,whitelistTool:a,confirmPendingApproval:s,rejectPendingApproval:c,isToolApproved:l,getPendingApproval:u},children:e})}const gB=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}},vB=()=>{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=gB(),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 H$=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[H$({start(r){e=r}}),e]};class lv{_controller;_isClosed=!1;_mergeTask;constructor(t){this._controller=t;const r=H$({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 yB=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)}}),bB=()=>{let e;return[yB({start(r){e=r}}),e]};class W${value=-1;up(){return++this.value}}class _B extends TransformStream{constructor(t){super({transform(r,o){o.enqueue({...r,path:[t,...r.path]})}})}}class EW 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 wB extends TransformStream{constructor(t){const r=new W$,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 xB=(e,t=21)=>(r=t)=>{let o="",n=r|0;for(;n--;)o+=e[Math.random()*e.length|0];return o};const SB=xB("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class Xm{_state;_parentId;constructor(t){this._state=t||{merger:vB(),contentCounter:new W$}}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 _B(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new wB(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??SB(),[i,a]=bB();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 kB(e){return e==="user"?"user":e==="assistant"?"assistant":e==="system"?"system":"assistant"}function EB(e){return typeof e=="string"?new Date(e):e}function IB(e){const t=[];return e.content&&t.push({type:"text",text:e.content}),t.length===0&&t.push({type:"text",text:""}),t}function $B(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 TB(e){const t=kB(e.role),r=EB(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:IB(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:$B(e),status:{type:"complete",reason:"stop"},metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],steps:[],submittedFeedback:void 0,custom:{}}}}function OB(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=TB(o);t.push({message:n,parentId:r,runConfig:void 0}),r=o.id}return{messages:t,headId:r}}const AB="__LOCALID_";function Za(e){return!!e?.startsWith(AB)}class CB{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 OB(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 NB(e){const t=M.useAssistantApi(),[r]=P.useState(()=>new CB(e.current.apiUrl,e.current.headers,t));return r}function RB(e){const t=P.useRef(e);P.useEffect(()=>{t.current=e},[e]);const r=P.useCallback(function({children:n}){const i=NB(t),a=P.useMemo(()=>({history:i}),[i]);return p.jsx(M.RuntimeAdapterProvider,{adapters:a,children:n})},[]);return P.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",PB="You are a helpful assistant that can answer questions and help with tasks.";function jB(e,t){return`
89
+ ${PB}
90
+
91
+ User-provided System Prompt:
92
+ ${e??"None provided"}
93
+
94
+ Utilities:
95
+ ${t.map(r=>`- ${r.language}: ${r.prompt}`).join(`
96
+ `)}`}function zB(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 DB=({children:e,config:t})=>{const r=DP(t),o=pB({auth:t.api,projectSlug:t.projectSlug}),n=$S(),[i,a]=P.useState(t.model?.defaultModel??Pm[0]),[s,c]=P.useState(t.modal?.defaultExpanded??!1),[l,u]=P.useState(t.modal?.defaultOpen),d=t.plugins??T.recommended,f=jB(t.systemPrompt,d);P.useEffect(()=>{aL({enabled:t.errorTracking?.enabled,projectSlug:t.projectSlug,variant:t.variant})},[]);const{data:m}=jP({auth:o,mcp:t.mcp,environment:t.environment??{},gramEnvironment:t.gramEnvironment}),g=P.useRef({requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool});g.current={requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool};const h=P.useCallback(()=>({requestApproval:(...E)=>g.current.requestApproval(...E),isToolApproved:(...E)=>g.current.isToolApproved(...E),whitelistTool:(...E)=>g.current.whitelistTool(...E)}),[]);P.useEffect(()=>(t.tools?.toolsRequiringApproval&&lL(h(),t.tools.toolsRequiringApproval),()=>{uL()}),[t.tools?.toolsRequiringApproval,h]);const v=P.useRef(null),b=P.useRef(null),w=P.useRef(new Map),I=P.useMemo(()=>({sendMessages:async({messages:E,abortSignal:C})=>{const D=!!t.languageModel;if(o.isLoading)throw new Error("Session is loading");const U=v.current,K=U?.threadListItem?.getState?.(),ge=U?.threads?.getState?.(),q=K?.remoteId,F=K?.id??ge?.mainThreadId??ge?.threadIds?.[0];let ce=q;if(Za(ce)||!ce&&F){const ve=ce??F;if(ve){const R=w.current.get(ve);if(R)ce=R;else{const H=crypto.randomUUID();w.current.set(ve,H),ce=H}}}ce||(b.current||(b.current=crypto.randomUUID()),ce=b.current);const le=v.current?.thread.getModelContext(),pe=sL(cL(le?.tools??{})),G={...o.headers,"Gram-Chat-ID":ce,...t.gramEnvironment&&{"Gram-Environment":t.gramEnvironment}},se=D?null:II({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=fL(V,t.tools?.toolsRequiringApproval,h()),ue=t.languageModel?t.languageModel:se.chat(i);try{const ve=zB(E),R=iB(ve);return rB({system:f,model:ue,messages:R,tools:ye,stopWhen:F$(10),experimental_transform:uB({delayInMs:15}),abortSignal:C,onError:({error:me})=>{console.error("Stream error in onError callback:",me),hs(me,{source:"streaming"})}}).toUIMessageStream()}catch(ve){throw console.error("Error creating stream:",ve),hs(ve,{source:"stream-creation"}),ve}},reconnectToStream:async()=>{throw new Error("Stream reconnection not supported")}}),[t.languageModel,t.tools?.toolsRequiringApproval,i,f,m,h,r,o.headers,o.isLoading]),y=t.history?.enabled??!1,k=P.useMemo(()=>({config:t,setModel:a,model:i,isExpanded:s,setIsExpanded:c,isOpen:l??!1,setIsOpen:u,plugins:d}),[t,i,s,l,d]),S=t.tools?.frontendTools??{};return y&&!o.isLoading?p.jsx(MB,{transport:I,apiUrl:r,headers:o.headers,contextValue:k,runtimeRef:v,frontendTools:S,localIdToUuidMap:w.current,children:e}):p.jsx(UB,{transport:I,contextValue:k,runtimeRef:v,frontendTools:S,children:e})},MB=({children:e,transport:t,apiUrl:r,headers:o,contextValue:n,runtimeRef:i,frontendTools:a,localIdToUuidMap:s})=>{const c=RB({apiUrl:r,headers:o,localIdToUuidMap:s}),l=P.useCallback(()=>dd.useChatRuntime({transport:t}),[t]),u=M.unstable_useRemoteThreadListRuntime({adapter:c,runtimeHook:l});P.useEffect(()=>{i.current=u},[u,i]);const d=c.unstable_Provider??(({children:f})=>p.jsx(p.Fragment,{children:f}));return p.jsx(M.AssistantRuntimeProvider,{runtime:u,children:p.jsx(d,{children:p.jsxs(T.ElementsContext.Provider,{value:n,children:[p.jsx("div",{className:`${Qm} h-full`,children:e}),p.jsx(Vv,{tools:a})]})})})},UB=({children:e,transport:t,contextValue:r,runtimeRef:o,frontendTools:n})=>{const i=dd.useChatRuntime({transport:t});return P.useEffect(()=>{o.current=i},[i,o]),p.jsx(M.AssistantRuntimeProvider,{runtime:i,children:p.jsxs(T.ElementsContext.Provider,{value:r,children:[p.jsx("div",{className:`${Qm} h-full`,children:e}),p.jsx(Vv,{tools:n})]})})},LB=new xP,FB=e=>p.jsx(SP,{client:LB,children:p.jsx(hB,{children:p.jsx(DB,{...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 VB=Symbol.for("react.lazy"),$s=_[" use ".trim().toString()];function ZB(e){return typeof e=="object"&&e!==null&&"then"in e}function J$(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===VB&&"_payload"in e&&ZB(e._payload)}function K$(e){const t=qB(e),r=_.forwardRef((o,n)=>{let{children:i,...a}=o;J$(i)&&typeof $s=="function"&&(i=$s(i._payload));const s=_.Children.toArray(i),c=s.find(WB);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 BB=K$("Slot");function qB(e){const t=_.forwardRef((r,o)=>{let{children:n,...i}=r;if(J$(n)&&typeof $s=="function"&&(n=$s(n._payload)),_.isValidElement(n)){const a=KB(n),s=JB(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 Y$=Symbol("radix.slottable");function GB(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Y$,t}var HB=GB("Slottable");function WB(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Y$}function JB(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 KB(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=T.clsx,X$=(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(g=>{let[h,v]=g;return Array.isArray(v)?v.includes({...i,...s}[h]):{...i,...s}[h]===v})?[...l,d,f]:l},[]);return fv(e,a,c,r?.class,r?.className)},YB=X$("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?BB:"button";return p.jsx(a,{"data-slot":"button",className:T.cn(YB({variant:t,size:r,className:e})),ref:i,...n})});yt.displayName="Button";const XB=({error:e,onRetry:t})=>p.jsx("div",{className:T.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(T.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"})]})}),QB=({children:e})=>p.jsx(p.Fragment,{children:e});class tp extends P.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){hs(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(XB,{error:this.state.error,onRetry:this.handleRetry}):p.jsx(QB,{children:this.props.children},this.state.resetKey)}}function ze(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}function eq(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,...g}=d,h=f?.[e]?.[c]||s,v=_.useMemo(()=>g,Object.values(g));return p.jsx(h.Provider,{value:v,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,g=_.useContext(m);if(g)return g;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,tq(n,...t)]}function tq(...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=rq(e),r=_.forwardRef((o,n)=>{const{children:i,...a}=o,s=_.Children.toArray(i),c=s.find(oq);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 rq(e){const t=_.forwardRef((r,o)=>{const{children:n,...i}=r;if(_.isValidElement(n)){const a=aq(n),s=iq(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 Q$=Symbol("radix.slottable");function nq(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Q$,t}function oq(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Q$}function iq(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 aq(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 sq=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Le=sq.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 cq(e,t){e&&Fv.flushSync(()=>e.dispatchEvent(t))}function dn(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...r)=>t.current?.(...r),[])}function lq(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 uq="DismissableLayer",od="dismissableLayer.update",dq="dismissableLayer.pointerDownOutside",fq="dismissableLayer.focusOutside",mv,eT=_.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(eT),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,m]=_.useState({}),g=pt(t,E=>d(E)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),w=u?h.indexOf(u):-1,I=l.layersWithOutsidePointerEventsDisabled.size>0,y=w>=b,k=hq(E=>{const C=E.target,D=[...l.branches].some(U=>U.contains(C));!y||D||(n?.(E),a?.(E),E.defaultPrevented||s?.())},f),S=gq(E=>{const C=E.target;[...l.branches].some(U=>U.contains(C))||(i?.(E),a?.(E),E.defaultPrevented||s?.())},f);return lq(E=>{w===l.layers.size-1&&(o?.(E),!E.defaultPrevented&&s&&(E.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 E=()=>m({});return document.addEventListener(od,E),()=>document.removeEventListener(od,E)},[]),p.jsx(Le.div,{...c,ref:g,style:{pointerEvents:I?y?"auto":"none":void 0,...e.style},onFocusCapture:ze(e.onFocusCapture,S.onFocusCapture),onBlurCapture:ze(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:ze(e.onPointerDownCapture,k.onPointerDownCapture)})});Kc.displayName=uq;var mq="DismissableLayerBranch",pq=_.forwardRef((e,t)=>{const r=_.useContext(eT),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})});pq.displayName=mq;function hq(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(){tT(dq,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 gq(e,t=globalThis?.document){const r=dn(e),o=_.useRef(!1);return _.useEffect(()=>{const n=i=>{i.target&&!o.current&&tT(fq,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 tT(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?cq(n,i):n.dispatchEvent(i)}var Ct=globalThis?.document?_.useLayoutEffect:()=>{},vq=_[" useId ".trim().toString()]||(()=>{}),yq=0;function Zn(e){const[t,r]=_.useState(vq());return Ct(()=>{r(o=>o??String(yq++))},[e]),t?`radix-${t}`:""}const bq=["top","right","bottom","left"],Ur=Math.min,gt=Math.max,Ts=Math.round,Ta=Math.floor,Qt=e=>({x:e,y:e}),_q={left:"right",right:"left",bottom:"top",top:"bottom"},wq={start:"end",end:"start"};function id(e,t,r){return gt(e,Ur(t,r))}function yr(e,t){return typeof e=="function"?e(t):e}function br(e){return e.split("-")[0]}function So(e){return e.split("-")[1]}function np(e){return e==="x"?"y":"x"}function op(e){return e==="y"?"height":"width"}const xq=new Set(["top","bottom"]);function Xt(e){return xq.has(br(e))?"y":"x"}function ip(e){return np(Xt(e))}function Sq(e,t,r){r===void 0&&(r=!1);const o=So(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 kq(e){const t=Os(e);return[ad(e),t,ad(t)]}function ad(e){return e.replace(/start|end/g,t=>wq[t])}const hv=["left","right"],gv=["right","left"],Eq=["top","bottom"],Iq=["bottom","top"];function $q(e,t,r){switch(e){case"top":case"bottom":return r?t?gv:hv:t?hv:gv;case"left":case"right":return t?Eq:Iq;default:return[]}}function Tq(e,t,r,o){const n=So(e);let i=$q(br(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=>_q[t])}function Oq(e){return{top:0,right:0,bottom:0,left:0,...e}}function rT(e){return typeof e!="number"?Oq(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=Xt(t),a=ip(t),s=op(a),c=br(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(So(t)){case"start":m[a]-=f*(r&&l?-1:1);break;case"end":m[a]+=f*(r&&l?-1:1);break}return m}const Aq=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={},g=0;for(let h=0;h<s.length;h++){const{name:v,fn:b}=s[h],{x:w,y:I,data:y,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=I??d,m={...m,[v]:{...m[v],...y}},k&&g<=50&&(g++,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)),h=-1)}return{x:u,y:d,placement:f,strategy:n,middlewareData:m}};async function yi(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}=yr(t,e),g=rT(m),v=s[f?d==="floating"?"reference":"floating":d],b=As(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(v)))==null||r?v:v.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,I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),y=await(i.isElement==null?void 0:i.isElement(I))?await(i.getScale==null?void 0:i.getScale(I))||{x:1,y:1}:{x:1,y:1},k=As(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:I,strategy:c}):w);return{top:(b.top-k.top+g.top)/y.y,bottom:(k.bottom-b.bottom+g.bottom)/y.y,left:(b.left-k.left+g.left)/y.x,right:(k.right-b.right+g.right)/y.x}}const Cq=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}=yr(e,t)||{};if(l==null)return{};const d=rT(u),f={x:r,y:o},m=ip(n),g=op(m),h=await a.getDimensions(l),v=m==="y",b=v?"top":"left",w=v?"bottom":"right",I=v?"clientHeight":"clientWidth",y=i.reference[g]+i.reference[m]-f[m]-i.floating[g],k=f[m]-i.reference[m],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let E=S?S[I]:0;(!E||!await(a.isElement==null?void 0:a.isElement(S)))&&(E=s.floating[I]||i.floating[g]);const C=y/2-k/2,D=E/2-h[g]/2-1,U=Ur(d[b],D),K=Ur(d[w],D),ge=U,q=E-h[g]-K,F=E/2-h[g]/2+C,ce=id(ge,F,q),le=!c.arrow&&So(n)!=null&&F!==ce&&i.reference[g]/2-(F<ge?U:K)-h[g]/2<0,pe=le?F<ge?F-ge:F-q:0;return{[m]:f[m]+pe,data:{[m]:ce,centerOffset:F-ce-pe,...le&&{alignmentOffset:pe}},reset:le}}}),Nq=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:g="none",flipAlignment:h=!0,...v}=yr(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const b=br(n),w=Xt(s),I=br(s)===s,y=await(c.isRTL==null?void 0:c.isRTL(l.floating)),k=f||(I||!h?[Os(s)]:kq(s)),S=g!=="none";!f&&S&&k.push(...Tq(s,h,g,y));const E=[s,...k],C=await yi(t,v),D=[];let U=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&D.push(C[b]),d){const F=Sq(n,a,y);D.push(C[F[0]],C[F[1]])}if(U=[...U,{placement:n,overflows:D}],!D.every(F=>F<=0)){var K,ge;const F=(((K=i.flip)==null?void 0:K.index)||0)+1,ce=E[F];if(ce&&(!(d==="alignment"?w!==Xt(ce):!1)||U.every(G=>Xt(G.placement)===w?G.overflows[0]>0:!0)))return{data:{index:F,overflows:U},reset:{placement:ce}};let le=(ge=U.filter(pe=>pe.overflows[0]<=0).sort((pe,G)=>pe.overflows[1]-G.overflows[1])[0])==null?void 0:ge.placement;if(!le)switch(m){case"bestFit":{var q;const pe=(q=U.filter(G=>{if(S){const se=Xt(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 bq.some(t=>e[t]>=0)}const Rq=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:o="referenceHidden",...n}=yr(e,t);switch(o){case"referenceHidden":{const i=await yi(t,{...n,elementContext:"reference"}),a=yv(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:bv(a)}}}case"escaped":{const i=await yi(t,{...n,altBoundary:!0}),a=yv(i,r.floating);return{data:{escapedOffsets:a,escaped:bv(a)}}}default:return{}}}}},nT=new Set(["left","top"]);async function Pq(e,t){const{placement:r,platform:o,elements:n}=e,i=await(o.isRTL==null?void 0:o.isRTL(n.floating)),a=br(r),s=So(r),c=Xt(r)==="y",l=nT.has(a)?-1:1,u=i&&c?-1:1,d=yr(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof g=="number"&&(m=s==="end"?g*-1:g),c?{x:m*u,y:f*l}:{x:f*l,y:m*u}}const jq=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 Pq(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}}}}},zq=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:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=yr(e,t),l={x:r,y:o},u=await yi(t,c),d=Xt(br(n)),f=np(d);let m=l[f],g=l[d];if(i){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+u[v],I=m-u[b];m=id(w,m,I)}if(a){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=g+u[v],I=g-u[b];g=id(w,g,I)}const h=s.fn({...t,[f]:m,[d]:g});return{...h,data:{x:h.x-r,y:h.y-o,enabled:{[f]:i,[d]:a}}}}}},Dq=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}=yr(e,t),u={x:r,y:o},d=Xt(n),f=np(d);let m=u[f],g=u[d];const h=yr(s,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const I=f==="y"?"height":"width",y=i.reference[f]-i.floating[I]+v.mainAxis,k=i.reference[f]+i.reference[I]-v.mainAxis;m<y?m=y:m>k&&(m=k)}if(l){var b,w;const I=f==="y"?"width":"height",y=nT.has(br(n)),k=i.reference[d]-i.floating[I]+(y&&((b=a.offset)==null?void 0:b[d])||0)+(y?0:v.crossAxis),S=i.reference[d]+i.reference[I]+(y?0:((w=a.offset)==null?void 0:w[d])||0)-(y?v.crossAxis:0);g<k?g=k:g>S&&(g=S)}return{[f]:m,[d]:g}}}},Mq=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}=yr(e,t),u=await yi(t,l),d=br(n),f=So(n),m=Xt(n)==="y",{width:g,height:h}=i.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(b=d,v=f==="end"?"top":"bottom");const w=h-u.top-u.bottom,I=g-u.left-u.right,y=Ur(h-u[v],w),k=Ur(g-u[b],I),S=!t.middlewareData.shift;let E=y,C=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=I),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=w),S&&!f){const U=gt(u.left,0),K=gt(u.right,0),ge=gt(u.top,0),q=gt(u.bottom,0);m?C=g-2*(U!==0||K!==0?U+K:gt(u.left,u.right)):E=h-2*(ge!==0||q!==0?ge+q:gt(u.top,u.bottom))}await c({...t,availableWidth:C,availableHeight:E});const D=await a.getDimensions(s.floating);return g!==D.width||h!==D.height?{reset:{rects:!0}}:{}}}};function Yc(){return typeof window<"u"}function ko(e){return oT(e)?(e.nodeName||"").toLowerCase():"#document"}function bt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ir(e){var t;return(t=(oT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oT(e){return Yc()?e instanceof Node||e instanceof bt(e).Node:!1}function Zt(e){return Yc()?e instanceof Element||e instanceof bt(e).Element:!1}function nr(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 Uq=new Set(["inline","contents"]);function aa(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Bt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!Uq.has(n)}const Lq=new Set(["table","td","th"]);function Fq(e){return Lq.has(ko(e))}const Vq=[":popover-open",":modal"];function Xc(e){return Vq.some(t=>{try{return e.matches(t)}catch{return!1}})}const Zq=["transform","translate","scale","rotate","perspective"],Bq=["transform","translate","scale","rotate","perspective","filter"],qq=["paint","layout","strict","content"];function ap(e){const t=sp(),r=Zt(e)?Bt(e):e;return Zq.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)||Bq.some(o=>(r.willChange||"").includes(o))||qq.some(o=>(r.contain||"").includes(o))}function Gq(e){let t=Lr(e);for(;nr(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 Hq=new Set(["html","body","#document"]);function so(e){return Hq.has(ko(e))}function Bt(e){return bt(e).getComputedStyle(e)}function Qc(e){return Zt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Lr(e){if(ko(e)==="html")return e;const t=e.assignedSlot||e.parentNode||_v(e)&&e.host||ir(e);return _v(t)?t.host:t}function iT(e){const t=Lr(e);return so(t)?e.ownerDocument?e.ownerDocument.body:e.body:nr(t)&&aa(t)?t:iT(t)}function bi(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=iT(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?bi(s):[])}return t.concat(n,bi(n,[],r))}function sd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aT(e){const t=Bt(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=nr(e),i=n?e.offsetWidth:r,a=n?e.offsetHeight:o,s=Ts(r)!==i||Ts(o)!==a;return s&&(r=i,o=a),{width:r,height:o,$:s}}function cp(e){return Zt(e)?e:e.contextElement}function Bn(e){const t=cp(e);if(!nr(t))return Qt(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:i}=aT(t);let a=(i?Ts(r.width):r.width)/o,s=(i?Ts(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const Wq=Qt(0);function sT(e){const t=bt(e);return!sp()||!t.visualViewport?Wq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Jq(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=Qt(1);t&&(o?Zt(o)&&(a=Bn(o)):a=Bn(e));const s=Jq(i,r,o)?sT(i):Qt(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&&Zt(o)?bt(o):o;let g=f,h=sd(g);for(;h&&o&&m!==g;){const v=Bn(h),b=h.getBoundingClientRect(),w=Bt(h),I=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*v.x,y=b.top+(h.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,l*=v.y,u*=v.x,d*=v.y,c+=I,l+=y,g=bt(h),h=sd(g)}}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(ir(e)).left+r}function cT(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 Kq(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const i=n==="fixed",a=ir(o),s=t?Xc(t.floating):!1;if(o===a||s&&i)return r;let c={scrollLeft:0,scrollTop:0},l=Qt(1);const u=Qt(0),d=nr(o);if((d||!d&&!i)&&((ko(o)!=="body"||aa(a))&&(c=Qc(o)),nr(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?cT(a,c,!0):Qt(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 Yq(e){return Array.from(e.getClientRects())}function Xq(e){const t=ir(e),r=Qc(e),o=e.ownerDocument.body,n=gt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=gt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+lp(e);const s=-r.scrollTop;return Bt(o).direction==="rtl"&&(a+=gt(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:a,y:s}}function Qq(e,t){const r=bt(e),o=ir(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 e9=new Set(["absolute","fixed"]);function t9(e,t){const r=fn(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,i=nr(e)?Bn(e):Qt(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=Qq(e,r);else if(t==="document")o=Xq(ir(e));else if(Zt(t))o=t9(t,r);else{const n=sT(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return As(o)}function lT(e,t){const r=Lr(e);return r===t||!Zt(r)||so(r)?!1:Bt(r).position==="fixed"||lT(r,t)}function r9(e,t){const r=t.get(e);if(r)return r;let o=bi(e,[],!1).filter(s=>Zt(s)&&ko(s)!=="body"),n=null;const i=Bt(e).position==="fixed";let a=i?Lr(e):e;for(;Zt(a)&&!so(a);){const s=Bt(a),c=ap(a);!c&&s.position==="fixed"&&(n=null),(i?!c&&!n:!c&&s.position==="static"&&!!n&&e9.has(n.position)||aa(a)&&!c&&lT(e,a))?o=o.filter(u=>u!==a):n=s,a=Lr(a)}return t.set(e,o),o}function n9(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const a=[...r==="clippingAncestors"?Xc(t)?[]:r9(t,this._c):[].concat(r),o],s=a[0],c=a.reduce((l,u)=>{const d=wv(t,u,n);return l.top=gt(d.top,l.top),l.right=Ur(d.right,l.right),l.bottom=Ur(d.bottom,l.bottom),l.left=gt(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 o9(e){const{width:t,height:r}=aT(e);return{width:t,height:r}}function i9(e,t,r){const o=nr(t),n=ir(t),i=r==="fixed",a=fn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=Qt(0);function l(){c.x=lp(n)}if(o||!o&&!i)if((ko(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?cT(n,s):Qt(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 Bt(e).position==="static"}function xv(e,t){if(!nr(e)||Bt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return ir(e)===r&&(r=r.ownerDocument.body),r}function uT(e,t){const r=bt(e);if(Xc(e))return r;if(!nr(e)){let n=Lr(e);for(;n&&!so(n);){if(Zt(n)&&!ru(n))return n;n=Lr(n)}return r}let o=xv(e,t);for(;o&&Fq(o)&&ru(o);)o=xv(o,t);return o&&so(o)&&ru(o)&&!ap(o)?r:o||Gq(e)||r}const a9=async function(e){const t=this.getOffsetParent||uT,r=this.getDimensions,o=await r(e.floating);return{reference:i9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function s9(e){return Bt(e).direction==="rtl"}const c9={convertOffsetParentRelativeRectToViewportRelativeRect:Kq,getDocumentElement:ir,getClippingRect:n9,getOffsetParent:uT,getElementRects:a9,getClientRects:Yq,getDimensions:o9,getScale:Bn,isElement:Zt,isRTL:s9};function dT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function l9(e,t){let r=null,o;const n=ir(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 g=Ta(d),h=Ta(n.clientWidth-(u+f)),v=Ta(n.clientHeight-(d+m)),b=Ta(u),I={rootMargin:-g+"px "+-h+"px "+-v+"px "+-b+"px",threshold:gt(0,Ur(1,c))||1};let y=!0;function k(S){const E=S[0].intersectionRatio;if(E!==c){if(!y)return a();E?a(!1,E):o=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!dT(l,e.getBoundingClientRect())&&a(),y=!1}try{r=new IntersectionObserver(k,{...I,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,I)}r.observe(e)}return a(!0),i}function u9(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?bi(l):[],...bi(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const d=l&&s?l9(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 I;(I=m)==null||I.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let g,h=c?fn(e):null;c&&v();function v(){const b=fn(e);h&&!dT(h,b)&&r(),h=b,g=requestAnimationFrame(v)}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(g)}}const d9=jq,f9=zq,m9=Nq,p9=Mq,h9=Rq,Sv=Cq,g9=Dq,v9=(e,t,r)=>{const o=new Map,n={platform:c9,...r},i={...n.platform,_c:o};return Aq(e,t,{...n,platform:i})};var y9=typeof document<"u",b9=function(){},Ba=y9?P.useLayoutEffect:b9;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 fT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function kv(e,t){const r=fT(e);return Math.round(t*r)/r}function nu(e){const t=_.useRef(e);return Ba(()=>{t.current=e}),t}function _9(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[g,h]=_.useState(null),[v,b]=_.useState(null),w=_.useCallback(G=>{G!==S.current&&(S.current=G,h(G))},[]),I=_.useCallback(G=>{G!==E.current&&(E.current=G,b(G))},[]),y=i||g,k=a||v,S=_.useRef(null),E=_.useRef(null),C=_.useRef(u),D=c!=null,U=nu(c),K=nu(n),ge=nu(l),q=_.useCallback(()=>{if(!S.current||!E.current)return;const G={placement:t,strategy:r,middleware:f};K.current&&(G.platform=K.current),v9(S.current,E.current,G).then(se=>{const V={...se,isPositioned:ge.current!==!1};F.current&&!Cs(C.current,V)&&(C.current=V,Fv.flushSync(()=>{d(V)}))})},[f,t,r,K,ge]);Ba(()=>{l===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[l]);const F=_.useRef(!1);Ba(()=>(F.current=!0,()=>{F.current=!1}),[]),Ba(()=>{if(y&&(S.current=y),k&&(E.current=k),y&&k){if(U.current)return U.current(y,k,q);q()}},[y,k,q,U,D]);const ce=_.useMemo(()=>({reference:S,floating:E,setReference:w,setFloating:I}),[w,I]),le=_.useMemo(()=>({reference:y,floating:k}),[y,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)",...fT(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 w9=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):{}}}},x9=(e,t)=>({...d9(e),options:[e,t]}),S9=(e,t)=>({...f9(e),options:[e,t]}),k9=(e,t)=>({...g9(e),options:[e,t]}),E9=(e,t)=>({...m9(e),options:[e,t]}),I9=(e,t)=>({...p9(e),options:[e,t]}),$9=(e,t)=>({...h9(e),options:[e,t]}),T9=(e,t)=>({...w9(e),options:[e,t]});var O9="Arrow",mT=_.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"})})});mT.displayName=O9;var A9=mT;function C9(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",[pT,el]=ia(up),[N9,hT]=pT(up),gT=e=>{const{__scopePopper:t,children:r}=e,[o,n]=_.useState(null);return p.jsx(N9,{scope:t,anchor:o,onAnchorChange:n,children:r})};gT.displayName=up;var vT="PopperAnchor",yT=_.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,i=hT(vT,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})});yT.displayName=vT;var dp="PopperContent",[R9,P9]=pT(dp),bT=_.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:g,...h}=e,v=hT(dp,r),[b,w]=_.useState(null),I=pt(t,$e=>w($e)),[y,k]=_.useState(null),S=C9(y),E=S?.width??0,C=S?.height??0,D=o+(i!=="center"?"-"+i:""),U=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},K=Array.isArray(l)?l:[l],ge=K.length>0,q={padding:U,boundary:K.filter(z9),altBoundary:ge},{refs:F,floatingStyles:ce,placement:le,isPositioned:pe,middlewareData:G}=_9({strategy:"fixed",placement:D,whileElementsMounted:(...$e)=>u9(...$e,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[x9({mainAxis:n+C,alignmentAxis:a}),c&&S9({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?k9():void 0,...q}),c&&E9({...q}),I9({...q,apply:({elements:$e,rects:Fe,availableWidth:ll,availableHeight:Eo})=>{const{width:Rt,height:la}=Fe.reference,qe=$e.floating.style;qe.setProperty("--radix-popper-available-width",`${ll}px`),qe.setProperty("--radix-popper-available-height",`${Eo}px`),qe.setProperty("--radix-popper-anchor-width",`${Rt}px`),qe.setProperty("--radix-popper-anchor-height",`${la}px`)}}),y&&T9({element:y,padding:s}),D9({arrowWidth:E,arrowHeight:C}),f&&$9({strategy:"referenceHidden",...q})]}),[se,V]=xT(le),ye=dn(g);Ct(()=>{pe&&ye?.()},[pe,ye]);const ue=G.arrow?.x,ve=G.arrow?.y,R=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(R9,{scope:r,placedSide:se,onArrowChange:k,arrowX:ue,arrowY:ve,shouldHideArrow:R,children:p.jsx(Le.div,{"data-side":se,"data-align":V,...h,ref:I,style:{...h.style,animation:pe?void 0:"none"}})})})});bT.displayName=dp;var _T="PopperArrow",j9={top:"bottom",right:"left",bottom:"top",left:"right"},wT=_.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,i=P9(_T,o),a=j9[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(A9,{...n,ref:r,style:{...n.style,display:"block"}})})});wT.displayName=_T;function z9(e){return e!==null}var D9=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]=xT(r),d={start:"0%",center:"50%",end:"100%"}[u],f=(n.arrow?.x??0)+s/2,m=(n.arrow?.y??0)+c/2;let g="",h="";return l==="bottom"?(g=a?d:`${f}px`,h=`${-c}px`):l==="top"?(g=a?d:`${f}px`,h=`${o.floating.height+c}px`):l==="right"?(g=`${-c}px`,h=a?d:`${m}px`):l==="left"&&(g=`${o.floating.width+c}px`,h=a?d:`${m}px`),{data:{x:g,y:h}}}});function xT(e){const[t,r="center"]=e.split("-");return[t,r]}var ST=gT,fp=yT,kT=bT,ET=wT,M9="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=M9;function U9(e,t){return _.useReducer((r,o)=>t[r][o]??r,e)}var Br=e=>{const{present:t,children:r}=e,o=L9(t),n=typeof r=="function"?r({present:o.isPresent}):_.Children.only(r),i=pt(o.ref,F9(n));return typeof r=="function"||o.isPresent?_.cloneElement(n,{ref:i}):null};Br.displayName="Presence";function L9(e){const[t,r]=_.useState(),o=_.useRef(null),n=_.useRef(e),i=_.useRef("none"),a=e?"mounted":"unmounted",[s,c]=U9(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 h=Oa(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&h&&(c("ANIMATION_END"),!n.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},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 F9(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 V9=_[" useInsertionEffect ".trim().toString()]||Ct;function tl({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,i,a]=Z9({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=B9(u)?u(e):u;d!==e&&a.current?.(d)}else i(u)},[s,e,i,a]);return[c,l]}function Z9({defaultProp:e,onChange:t}){const[r,o]=_.useState(e),n=_.useRef(r),i=_.useRef(t);return V9(()=>{i.current=t},[t]),_.useEffect(()=>{n.current!==r&&(i.current?.(r),n.current=r)},[r,n]),[r,o,i]}function B9(e){return typeof e=="function"}var q9=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"}),G9="VisuallyHidden",IT=_.forwardRef((e,t)=>p.jsx(Le.span,{...e,ref:t,style:{...q9,...e.style}}));IT.displayName=G9;var H9=IT,[rl]=ia("Tooltip",[el]),nl=el(),$T="TooltipProvider",W9=700,cd="tooltip.open",[J9,pp]=rl($T),TT=e=>{const{__scopeTooltip:t,delayDuration:r=W9,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(J9,{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})};TT.displayName=$T;var _i="Tooltip",[K9,sa]=rl(_i),OT=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=e,c=pp(_i,e.__scopeTooltip),l=nl(t),[u,d]=_.useState(null),f=Zn(),m=_.useRef(0),g=a??c.disableHoverableContent,h=s??c.delayDuration,v=_.useRef(!1),[b,w]=tl({prop:o,defaultProp:n??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(cd))):c.onClose(),i?.(E)},caller:_i}),I=_.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),y=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,w(!0)},[w]),k=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),S=_.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,w(!0),m.current=0},h)},[h,w]);return _.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),p.jsx(ST,{...l,children:p.jsx(K9,{scope:t,contentId:f,open:b,stateAttribute:I,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?S():y()},[c.isOpenDelayedRef,S,y]),onTriggerLeave:_.useCallback(()=>{g?k():(window.clearTimeout(m.current),m.current=0)},[k,g]),onOpen:y,onClose:k,disableHoverableContent:g,children:r})})};OT.displayName=_i;var ld="TooltipTrigger",AT=_.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:ze(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:ze(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:ze(e.onPointerDown,()=>{n.open&&n.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:ze(e.onFocus,()=>{l.current||n.onOpen()}),onBlur:ze(e.onBlur,n.onClose),onClick:ze(e.onClick,n.onClose)})})});AT.displayName=ld;var hp="TooltipPortal",[Y9,X9]=rl(hp,{forceMount:void 0}),CT=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,i=sa(hp,t);return p.jsx(Y9,{scope:t,forceMount:r,children:p.jsx(Br,{present:r||i.open,children:p.jsx(mp,{asChild:!0,container:n,children:o})})})};CT.displayName=hp;var co="TooltipContent",NT=_.forwardRef((e,t)=>{const r=X9(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(RT,{side:n,...i,ref:t}):p.jsx(Q9,{side:n,...i,ref:t})})}),Q9=_.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((g,h)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},w=n8(b,v.getBoundingClientRect()),I=o8(b,w),y=i8(h.getBoundingClientRect()),k=s8([...I,...y]);s(k),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){const g=v=>m(v,u),h=v=>m(v,c);return c.addEventListener("pointerleave",g),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",h)}}},[c,u,m,f]),_.useEffect(()=>{if(a){const g=h=>{const v=h.target,b={x:h.clientX,y:h.clientY},w=c?.contains(v)||u?.contains(v),I=!a8(b,a);w?f():I&&(f(),l())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,u,a,l,f]),p.jsx(RT,{...e,ref:i})}),[e8,t8]=rl(_i,{isInside:!1}),r8=nq("TooltipContent"),RT=_.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(kT,{"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(r8,{children:o}),p.jsx(e8,{scope:r,isInside:!0,children:p.jsx(H9,{id:c.contentId,role:"tooltip",children:n||o})})]})})});NT.displayName=co;var PT="TooltipArrow",jT=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=nl(r);return t8(PT,r).isInside?null:p.jsx(ET,{...n,...o,ref:t})});jT.displayName=PT;function n8(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 o8(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 i8(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 a8(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 s8(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),c8(t)}function c8(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 l8=TT,u8=OT,d8=AT,f8=CT,m8=NT,p8=jT;const zT=P.createContext(null);function DT(){return P.useContext(zT)?.current??null}function MT({delayDuration:e=0,...t}){return p.jsx(l8,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function gp({...e}){return p.jsx(MT,{children:p.jsx(u8,{"data-slot":"tooltip",...e})})}function vp({...e}){return p.jsx(d8,{"data-slot":"tooltip-trigger",...e})}function yp({className:e,sideOffset:t=0,children:r,container:o,...n}){const i=DT();return p.jsx(f8,{container:o??i,children:p.jsxs(m8,{"data-slot":"tooltip-content",sideOffset:t,className:T.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(p8,{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},h8="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,h=>c(h)),m=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(o){let h=function(I){if(m.paused||!s)return;const y=I.target;s.contains(y)?d.current=y:Sr(d.current,{select:!0})},v=function(I){if(m.paused||!s)return;const y=I.relatedTarget;y!==null&&(s.contains(y)||Sr(d.current,{select:!0}))},b=function(I){if(document.activeElement===document.body)for(const k of I)k.removedNodes.length>0&&Sr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const w=new MutationObserver(b);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),w.disconnect()}}},[o,s,m.paused]),_.useEffect(()=>{if(s){$v.add(m);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(ou,Ev);s.addEventListener(ou,l),s.dispatchEvent(b),b.defaultPrevented||(g8(w8(UT(s)),{select:!0}),document.activeElement===h&&Sr(s))}return()=>{s.removeEventListener(ou,l),setTimeout(()=>{const b=new CustomEvent(iu,Ev);s.addEventListener(iu,u),s.dispatchEvent(b),b.defaultPrevented||Sr(h??document.body,{select:!0}),s.removeEventListener(iu,u),$v.remove(m)},0)}}},[s,l,u,m]);const g=_.useCallback(h=>{if(!r&&!o||m.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(v&&b){const w=h.currentTarget,[I,y]=v8(w);I&&y?!h.shiftKey&&b===y?(h.preventDefault(),r&&Sr(I,{select:!0})):h.shiftKey&&b===I&&(h.preventDefault(),r&&Sr(y,{select:!0})):b===w&&h.preventDefault()}},[r,o,m.paused]);return p.jsx(Le.div,{tabIndex:-1,...a,ref:f,onKeyDown:g})});bp.displayName=h8;function g8(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(Sr(o,{select:t}),document.activeElement!==r)return}function v8(e){const t=UT(e),r=Iv(t,e),o=Iv(t.reverse(),e);return[r,o]}function UT(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(!y8(r,{upTo:t}))return r}function y8(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 b8(e){return e instanceof HTMLInputElement&&"select"in e}function Sr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&b8(e)&&t&&e.select()}}var $v=_8();function _8(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Tv(e,t),e.unshift(t)},remove(t){e=Tv(e,t),e[0]?.resume()}}}function Tv(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function w8(e){return e.filter(t=>t.tagName!=="A")}var au=0;function LT(){_.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 Kt=function(){return Kt=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},Kt.apply(this,arguments)};function FT(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 x8(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",S8="with-scroll-bars-hidden",k8="--removed-body-scroll-bar-size";function su(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function E8(e,t){var r=P.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 I8=typeof window<"u"?_.useLayoutEffect:_.useEffect,Av=new WeakMap;function $8(e,t){var r=E8(null,function(o){return e.forEach(function(n){return su(n,o)})});return I8(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 T8(e){return e}function O8(e,t){t===void 0&&(t=T8);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 A8(e){e===void 0&&(e={});var t=O8(null);return t.options=Kt({async:!0,ssr:!1},e),t}var VT=function(e){var t=e.sideCar,r=FT(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,Kt({},r))};VT.isSideCarExport=!0;function C8(e,t){return e.useMedium(t),VT}var ZT=A8(),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,g=e.noIsolation,h=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,I=e.gapMode,y=FT(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,S=$8([r,t]),E=Kt(Kt({},y),n);return _.createElement(_.Fragment,null,u&&_.createElement(k,{sideCar:ZT,removeScrollBar:l,shards:d,noRelative:m,noIsolation:g,inert:h,setCallbacks:i,allowPinchZoom:!!v,lockRef:r,gapMode:I}),a?_.cloneElement(_.Children.only(s),Kt(Kt({},E),{ref:S})):_.createElement(w,Kt({},E,{className:c,ref:S}),s))});ol.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};ol.classNames={fullWidth:Ga,zeroRight:qa};var N8=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function R8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=N8();return t&&e.setAttribute("nonce",t),e}function P8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function j8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var z8=function(){var e=0,t=null;return{add:function(r){e==0&&(t=R8())&&(P8(t,r),j8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},D8=function(){var e=z8();return function(t,r){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},BT=function(){var e=D8(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},M8={left:0,top:0,right:0,gap:0},lu=function(e){return parseInt(e||"",10)||0},U8=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)]},L8=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return M8;var t=U8(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])}},F8=BT(),qn="data-scroll-locked",V8=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(S8,` {
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(k8,": ").concat(s,`px;
132
+ }
133
+ `)},Cv=function(){var e=parseInt(document.body.getAttribute(qn)||"0",10);return isFinite(e)?e:0},Z8=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())}},[])},B8=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;Z8();var i=_.useMemo(function(){return L8(n)},[n]);return _.createElement(F8,{styles:V8(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,q8=function(e){return e.tagName==="TEXTAREA"},qT=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!q8(e)&&r[t]==="visible")},G8=function(e){return qT(e,"overflowY")},H8=function(e){return qT(e,"overflowX")},Nv=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=GT(e,o);if(n){var i=HT(e,o),a=i[1],s=i[2];if(a>s)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},W8=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},J8=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},GT=function(e,t){return e==="v"?G8(t):H8(t)},HT=function(e,t){return e==="v"?W8(t):J8(t)},K8=function(e,t){return e==="h"&&t==="rtl"?-1:1},Y8=function(e,t,r,o,n){var i=K8(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=HT(e,s),g=m[0],h=m[1],v=m[2],b=h-v-i*g;(g||b)&&GT(e,s)&&(d+=b,f+=g);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},X8=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Q8=function(e){return`
134
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
135
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
136
+ `)},eG=0,Rn=[];function tG(e){var t=_.useRef([]),r=_.useRef([0,0]),o=_.useRef(),n=_.useState(eG++)[0],i=_.useState(BT)[0],a=_.useRef(e);_.useEffect(function(){a.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var h=x8([e.lockRef.current],(e.shards||[]).map(Pv),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!a.current.allowPinchZoom;var b=Ca(h),w=r.current,I="deltaX"in h?h.deltaX:w[0]-b[0],y="deltaY"in h?h.deltaY:w[1]-b[1],k,S=h.target,E=Math.abs(I)>Math.abs(y)?"h":"v";if("touches"in h&&E==="h"&&S.type==="range")return!1;var C=Nv(E,S);if(!C)return!0;if(C?k=E:(k=E==="v"?"h":"v",C=Nv(E,S)),!C)return!1;if(!o.current&&"changedTouches"in h&&(I||y)&&(o.current=k),!k)return!0;var D=o.current||k;return Y8(D,v,h,D==="h"?I:y)},[]),c=_.useCallback(function(h){var v=h;if(!(!Rn.length||Rn[Rn.length-1]!==i)){var b="deltaY"in v?Rv(v):Ca(v),w=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&X8(k.delta,b)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var I=(a.current.shards||[]).map(Pv).filter(Boolean).filter(function(k){return k.contains(v.target)}),y=I.length>0?s(v,I[0]):!a.current.noIsolation;y&&v.cancelable&&v.preventDefault()}}},[]),l=_.useCallback(function(h,v,b,w){var I={name:h,delta:v,target:b,should:w,shadowParent:rG(b)};t.current.push(I),setTimeout(function(){t.current=t.current.filter(function(y){return y!==I})},1)},[]),u=_.useCallback(function(h){r.current=Ca(h),o.current=void 0},[]),d=_.useCallback(function(h){l(h.type,Rv(h),h.target,s(h,e.lockRef.current))},[]),f=_.useCallback(function(h){l(h.type,Ca(h),h.target,s(h,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(h){return h!==i}),document.removeEventListener("wheel",c,Nn),document.removeEventListener("touchmove",c,Nn),document.removeEventListener("touchstart",u,Nn)}},[]);var m=e.removeScrollBar,g=e.inert;return _.createElement(_.Fragment,null,g?_.createElement(i,{styles:Q8(n)}):null,m?_.createElement(B8,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nG=C8(ZT,tG);var _p=_.forwardRef(function(e,t){return _.createElement(ol,Kt({},e,{ref:t,sideCar:nG}))});_p.classNames=ol.classNames;var oG=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,WT=function(e){return e&&(e.host||WT(e.parentNode))},iG=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=WT(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})},aG=function(e,t,r,o){var n=iG(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),g=m!==null&&m!=="false",h=(Pn.get(f)||0)+1,v=(i.get(f)||0)+1;Pn.set(f,h),i.set(f,v),a.push(f),h===1&&g&&Na.set(f,!0),v===1&&f.setAttribute(r,"true"),g||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={})}},JT=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=oG(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),aG(o,n,r,"aria-hidden")):function(){return null}},il="Dialog",[KT]=ia(il),[sG,Gt]=KT(il),YT=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(sG,{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})};YT.displayName=il;var XT="DialogTrigger",QT=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Gt(XT,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:ze(e.onClick,n.onOpenToggle)})});QT.displayName=XT;var wp="DialogPortal",[cG,e1]=KT(wp,{forceMount:void 0}),t1=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:n}=e,i=Gt(wp,t);return p.jsx(cG,{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})}))})};t1.displayName=wp;var Ns="DialogOverlay",r1=_.forwardRef((e,t)=>{const r=e1(Ns,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Gt(Ns,e.__scopeDialog);return i.modal?p.jsx(Br,{present:o||i.open,children:p.jsx(uG,{...n,ref:t})}):null});r1.displayName=Ns;var lG=rp("DialogOverlay.RemoveScroll"),uG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Gt(Ns,r);return p.jsx(_p,{as:lG,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",n1=_.forwardRef((e,t)=>{const r=e1(mn,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Gt(mn,e.__scopeDialog);return p.jsx(Br,{present:o||i.open,children:i.modal?p.jsx(dG,{...n,ref:t}):p.jsx(fG,{...n,ref:t})})});n1.displayName=mn;var dG=_.forwardRef((e,t)=>{const r=Gt(mn,e.__scopeDialog),o=_.useRef(null),n=pt(t,r.contentRef,o);return _.useEffect(()=>{const i=o.current;if(i)return JT(i)},[]),p.jsx(o1,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(e.onCloseAutoFocus,i=>{i.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ze(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,s=a.button===0&&a.ctrlKey===!0;(a.button===2||s)&&i.preventDefault()}),onFocusOutside:ze(e.onFocusOutside,i=>i.preventDefault())})}),fG=_.forwardRef((e,t)=>{const r=Gt(mn,e.__scopeDialog),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(o1,{...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()}})}),o1=_.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:i,...a}=e,s=Gt(mn,r),c=_.useRef(null),l=pt(t,c);return LT(),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(pG,{titleId:s.titleId}),p.jsx(gG,{contentRef:c,descriptionId:s.descriptionId})]})]})}),xp="DialogTitle",i1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Gt(xp,r);return p.jsx(Le.h2,{id:n.titleId,...o,ref:t})});i1.displayName=xp;var a1="DialogDescription",mG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Gt(a1,r);return p.jsx(Le.p,{id:n.descriptionId,...o,ref:t})});mG.displayName=a1;var s1="DialogClose",c1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Gt(s1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:ze(e.onClick,()=>n.onOpenChange(!1))})});c1.displayName=s1;function Sp(e){return e?"open":"closed"}var l1="DialogTitleWarning",[IW,u1]=eq(l1,{contentName:mn,titleName:xp,docsSlug:"dialog"}),pG=({titleId:e})=>{const t=u1(l1),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},hG="DialogDescriptionWarning",gG=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${u1(hG).contentName}}.`;return _.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},vG=YT,yG=QT,bG=t1,_G=r1,wG=n1,xG=i1,SG=c1;function kG({...e}){return p.jsx(vG,{"data-slot":"dialog",...e})}function EG({...e}){return p.jsx(yG,{"data-slot":"dialog-trigger",...e})}function IG({container:e,...t}){const r=DT();return p.jsx(bG,{"data-slot":"dialog-portal",container:e??r,...t})}function $G({className:e,...t}){return p.jsx(_G,{"data-slot":"dialog-overlay",className:T.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 TG({className:e,children:t,showCloseButton:r=!0,...o}){return p.jsxs(IG,{"data-slot":"dialog-portal",children:[p.jsx($G,{}),p.jsxs(wG,{"data-slot":"dialog-content",className:T.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(SG,{"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(ra,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function OG({className:e,...t}){return p.jsx(xG,{"data-slot":"dialog-title",className:T.cn("text-lg leading-none font-semibold",e),...t})}function AG(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,...g}=d,h=f?.[e]?.[c]||s,v=_.useMemo(()=>g,Object.values(g));return p.jsx(h.Provider,{value:v,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,g=_.useContext(m);if(g)return g;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,CG(n,...t)]}function CG(...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 NG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],kp=NG.reduce((e,t)=>{const r=K$(`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 RG(){if(jv)return du;jv=1;var e=P;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(),g=o({inst:{value:m,getSnapshot:f}}),h=g[0].inst,v=g[1];return i(function(){h.value=m,h.getSnapshot=f,c(h)&&v({inst:h})},[d,m,f]),n(function(){return c(h)&&v({inst:h}),d(function(){c(h)&&v({inst:h})})},[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 zv;function PG(){return zv||(zv=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,g){return m===g&&(m!==0||1/m===1/g)||m!==m&&g!==g}function t(m,g){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 h=g();if(!d){var v=g();i(h,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=a({inst:{value:h,getSnapshot:g}});var b=v[0].inst,w=v[1];return c(function(){b.value=h,b.getSnapshot=g,r(b)&&w({inst:b})},[m,h,g]),s(function(){return r(b)&&w({inst:b}),m(function(){r(b)&&w({inst:b})})},[m]),l(h),h}function r(m){var g=m.getSnapshot;m=m.value;try{var h=g();return!i(m,h)}catch{return!0}}function o(m,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=P,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 Dv;function jG(){return Dv||(Dv=1,process.env.NODE_ENV==="production"?Pa.exports=RG():Pa.exports=PG()),Pa.exports}var zG=jG();function DG(){return zG.useSyncExternalStore(MG,()=>!0,()=>!1)}function MG(){return()=>{}}var Ep="Avatar",[UG]=AG(Ep),[LG,d1]=UG(Ep),f1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,...o}=e,[n,i]=_.useState("idle");return p.jsx(LG,{scope:r,imageLoadingStatus:n,onImageLoadingStatusChange:i,children:p.jsx(kp.span,{...o,ref:t})})});f1.displayName=Ep;var m1="AvatarImage",p1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,src:o,onLoadingStatusChange:n=()=>{},...i}=e,a=d1(m1,r),s=FG(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});p1.displayName=m1;var h1="AvatarFallback",g1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:o,...n}=e,i=d1(h1,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});g1.displayName=h1;function Mv(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function FG(e,{referrerPolicy:t,crossOrigin:r}){const o=DG(),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 VG=f1,ZG=p1,BG=g1;function qG({className:e,...t}){return p.jsx(VG,{"data-slot":"avatar",className:T.cn("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function GG({className:e,...t}){return p.jsx(ZG,{"data-slot":"avatar-image",className:T.cn("aspect-square size-full",e),...t})}function HG({className:e,...t}){return p.jsx(BG,{"data-slot":"avatar-fallback",className:T.cn("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const qt=P.forwardRef(({children:e,tooltip:t,side:r="bottom",align:o="center",className:n,...i},a)=>p.jsxs(gp,{children:[p.jsx(vp,{asChild:!0,children:p.jsxs(yt,{variant:"ghost",size:"icon",...i,className:T.cn("aui-button-icon size-6 p-1",n),ref:a,children:[p.jsx(HB,{children:e}),p.jsx("span",{className:"aui-sr-only sr-only",children:t})]})}),p.jsx(yp,{side:r,align:o,children:t})]}));qt.displayName="TooltipIconButton";const WG=e=>{const[t,r]=P.useState(void 0);return P.useEffect(()=>{if(!e){r(void 0);return}const o=URL.createObjectURL(e);return r(o),()=>{URL.revokeObjectURL(o)}},[e]),t},v1=()=>{const{file:e,src:t}=M.useAssistantState(J1.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 WG(e)??t},JG=({src:e})=>{const[t,r]=P.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)})},KG=({children:e})=>{const t=v1();return t?p.jsxs(kG,{children:[p.jsx(EG,{className:"aui-attachment-preview-trigger",asChild:!0,children:e}),p.jsxs(TG,{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(OG,{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(JG,{src:t})})]})]}):e},YG=()=>{const e=M.useAssistantState(({attachment:r})=>r.type==="image"),t=v1();return p.jsxs(qG,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[p.jsx(GG,{src:t,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),p.jsx(HG,{delayMs:e?200:0,children:p.jsx(IL,{className:"aui-attachment-tile-fallback-icon text-muted-foreground size-8"})})]})},y1=()=>{const t=M.useAssistantApi().attachment.source==="composer",r=M.useAssistantState(({attachment:n})=>n.type==="image"),o=M.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(gp,{children:[p.jsxs(M.AttachmentPrimitive.Root,{className:T.cn("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[p.jsx(KG,{children:p.jsx(vp,{asChild:!0,children:p.jsx("div",{className:T.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(YG,{})})})}),t&&p.jsx(XG,{})]}),p.jsx(yp,{side:"top",children:p.jsx(M.AttachmentPrimitive.Name,{})})]})},XG=()=>p.jsx(M.AttachmentPrimitive.Remove,{asChild:!0,children:p.jsx(qt,{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(ra,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),QG=()=>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(M.MessagePrimitive.Attachments,{components:{Attachment:y1}})}),eH=()=>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(M.ComposerPrimitive.Attachments,{components:{Attachment:y1}})}),tH=()=>p.jsx(M.ComposerPrimitive.AddAttachment,{asChild:!0,children:p.jsx(qt,{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 rH(e){return P.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 nH=()=>{const{plugins:e}=T.useElements(),t=rH(e);return p.jsx(hu.MarkdownTextPrimitive,{remarkPlugins:[K1],className:"aui-md",components:aH,componentsByLanguage:t})},b1=P.memo(nH),oH=({language:e,code:t})=>{const o=M.useAssistantState(({message:s})=>s).status?.type==="complete",{isCopied:n,copyToClipboard:i}=iH(),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(qt,{tooltip:"Copy",onClick:a,children:[!n&&p.jsx(jm,{}),n&&p.jsx(Cr,{})]})]}):null},iH=({copiedDuration:e=3e3}={})=>{const[t,r]=P.useState(!1);return{isCopied:t,copyToClipboard:n=>{n&&navigator.clipboard.writeText(n).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},aH=hu.unstable_memoizeMarkdownComponents({h1:({className:e,...t})=>p.jsx("h1",{className:T.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:T.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:T.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:T.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:T.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:T.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>p.jsx("p",{className:T.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:T.cn("aui-md-a text-primary font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>p.jsx("blockquote",{className:T.cn("aui-md-blockquote border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>p.jsx("ul",{className:T.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>p.jsx("ol",{className:T.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>p.jsx("hr",{className:T.cn("aui-md-hr my-5 border-b",e),...t}),table:({className:e,...t})=>p.jsx("table",{className:T.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:T.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:T.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:T.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:T.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>p.jsx("pre",{className:T.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=hu.useIsMarkdownCodeBlock();return p.jsx("code",{className:T.cn(!o&&"aui-md-inline-code bg-muted rounded border font-semibold",t),...r})},CodeHeader:oH});var al="Collapsible",[sH]=ia(al),[cH,Ip]=sH(al),_1=_.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(cH,{scope:r,disabled:i,contentId:Zn(),open:c,onOpenToggle:_.useCallback(()=>l(u=>!u),[l]),children:p.jsx(Le.div,{"data-state":Tp(c),"data-disabled":i?"":void 0,...s,ref:t})})});_1.displayName=al;var w1="CollapsibleTrigger",x1=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Ip(w1,r);return p.jsx(Le.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Tp(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:ze(e.onClick,n.onOpenToggle)})});x1.displayName=w1;var $p="CollapsibleContent",S1=_.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Ip($p,e.__scopeCollapsible);return p.jsx(Br,{present:r||n.open,children:({present:i})=>p.jsx(lH,{...o,ref:t,present:i})})});S1.displayName=$p;var lH=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...i}=e,a=Ip($p,r),[s,c]=_.useState(o),l=_.useRef(null),u=pt(t,l),d=_.useRef(0),f=d.current,m=_.useRef(0),g=m.current,h=a.open||s,v=_.useRef(h),b=_.useRef(void 0);return _.useEffect(()=>{const w=requestAnimationFrame(()=>v.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 I=w.getBoundingClientRect();d.current=I.height,m.current=I.width,v.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),c(o)}},[a.open,o]),p.jsx(Le.div,{"data-state":Tp(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!h,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:h&&n})});function Tp(e){return e?"open":"closed"}var uH=_1;function dH({...e}){return p.jsx(uH,{"data-slot":"collapsible",...e})}function fH({...e}){return p.jsx(x1,{"data-slot":"collapsible-trigger",...e})}function mH({...e}){return p.jsx(S1,{"data-slot":"collapsible-content",...e})}const Uv=200,k1=({className:e,children:t})=>{const r=P.useRef(null),[o,n]=P.useState(!1),i=M.useScrollLock(r,Uv),a=P.useCallback(s=>{s||i(),n(s)},[i]);return p.jsx(dH,{ref:r,open:o,onOpenChange:a,className:T.cn("aui-reasoning-root mb-4 w-full",e),style:{"--animation-duration":`${Uv}ms`},children:t})};k1.displayName="ReasoningRoot";const pH=({className:e})=>p.jsx("div",{className:T.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)}),hH=({active:e,className:t})=>p.jsxs(fH,{className:T.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(yL,{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:T.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")})]}),E1=({className:e,children:t,"aria-busy":r})=>p.jsxs(mH,{className:T.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(pH,{})]});E1.displayName="ReasoningContent";const I1=({className:e,children:t})=>p.jsx("div",{className:T.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});I1.displayName="ReasoningText";const gH=()=>p.jsx(b1,{}),vH=({children:e,startIndex:t,endIndex:r})=>{const o=M.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(k1,{children:[p.jsx(hH,{active:o}),p.jsx(E1,{"aria-busy":o,children:p.jsx(I1,{children:e})})]})},$1=P.memo(gH);$1.displayName="Reasoning";const T1=P.memo(vH);T1.displayName="ReasoningGroup";var sl="Popover",[O1]=ia(sl,[el]),ca=el(),[yH,xn]=O1(sl),A1=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(ST,{...s,children:p.jsx(yH,{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})})};A1.displayName=sl;var C1="PopoverAnchor",bH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(C1,r),i=ca(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=n;return _.useEffect(()=>(a(),()=>s()),[a,s]),p.jsx(fp,{...i,...o,ref:t})});bH.displayName=C1;var N1="PopoverTrigger",R1=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(N1,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":D1(n.open),...o,ref:a,onClick:ze(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?s:p.jsx(fp,{asChild:!0,...i,children:s})});R1.displayName=N1;var _H="PopoverPortal",[$W,wH]=O1(_H,{forceMount:void 0}),lo="PopoverContent",P1=_.forwardRef((e,t)=>{const r=wH(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(SH,{...n,ref:t}):p.jsx(kH,{...n,ref:t})})});P1.displayName=lo;var xH=rp("PopoverContent.RemoveScroll"),SH=_.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 JT(a)},[]),p.jsx(_p,{as:xH,allowPinchZoom:!0,children:p.jsx(j1,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ze(e.onCloseAutoFocus,a=>{a.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:ze(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:ze(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),kH=_.forwardRef((e,t)=>{const r=xn(lo,e.__scopePopover),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(j1,{...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()}})}),j1=_.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 LT(),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(kT,{"data-state":D1(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)"}})})})}),z1="PopoverClose",EH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(z1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:ze(e.onClick,()=>n.onOpenChange(!1))})});EH.displayName=z1;var IH="PopoverArrow",$H=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=ca(r);return p.jsx(ET,{...n,...o,ref:t})});$H.displayName=IH;function D1(e){return e?"open":"closed"}var TH=A1,OH=R1,AH=P1;function M1({...e}){return p.jsx(TH,{"data-slot":"popover",...e})}function U1({...e}){return p.jsx(OH,{"data-slot":"popover-trigger",...e})}function L1({className:e,align:t="center",sideOffset:r=4,...o}){return p.jsx(AH,{"data-slot":"popover-content",align:t,sideOffset:r,className:T.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 CH=X$("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 NH(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 RH(e,t){if(t==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return e}function PH(e){return typeof e=="object"&&e!==null&&"content"in e&&Array.isArray(e.content)}function F1({status:e}){return p.jsxs("div",{className:T.cn(CH({status:e})),children:[e==="pending"&&null,e==="running"&&p.jsx(ys,{className:"size-4 animate-spin"}),e==="complete"&&p.jsx(Cr,{className:"size-4"}),e==="error"&&p.jsx(ra,{className:"size-4"}),e==="approval"&&p.jsx(ys,{className:"text-muted-foreground size-4 animate-spin"})]})}function jH({content:e}){const[t,r]=P.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(Cr,{className:"size-4"}):p.jsx(jm,{className:"size-4"})})}function V1({text:e,language:t,className:r}){const[o,n]=P.useState(null);return P.useEffect(()=>{t&&Y1.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:T.cn("w-full bg-slate-800/90",r),dangerouslySetInnerHTML:{__html:o}}):p.jsx("pre",{className:T.cn("w-full bg-slate-800/90 px-4 py-3 text-sm whitespace-pre-wrap text-slate-100",r),children:e})}function zH({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 DH({content:e}){return p.jsx("div",{className:"w-full",children:e.content.map((t,r)=>{switch(t.type){case"text":{const o=NH(t._meta?.["getgram.ai/mime-type"]??"text/plain"),n=RH(t.text,o);return p.jsx(V1,{text:n,language:o},r)}case"image":return p.jsx(zH,{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]=P.useState(r),s=PH(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-4 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(jH,{content:c}),p.jsx(jE,{className:T.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(DH,{content:t}):o?p.jsx(V1,{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 MH({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]=P.useState(a),g=n!==void 0||i!==void 0,[h,v]=P.useState("one-time"),[b,w]=P.useState(!1);P.useEffect(()=>{!d&&f&&!a&&m(!1)},[d]);const I=()=>{h==="for-session"&&l?l():c&&c()};return p.jsxs("div",{"data-slot":"tool-ui",className:T.cn("border-border bg-card overflow-hidden rounded-lg border",s),children:[r&&p.jsxs("div",{"data-slot":"tool-ui-provider",className:T.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:()=>g&&m(!f),disabled:!g,className:T.cn("flex w-full items-center gap-2 px-4 py-3 text-left",g&&"hover:bg-accent/50 cursor-pointer transition-colors"),children:[p.jsx(F1,{status:o}),p.jsx("span",{className:T.cn("flex-1 text-sm",!r&&d&&"shimmer"),children:e}),g&&p.jsx(vs,{className:T.cn("text-muted-foreground size-4 transition-transform duration-200",f&&"rotate-180")})]}),f&&g&&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(ra,{className:"mr-1 size-3"}),"Deny"]}),p.jsxs("div",{className:"flex items-center",children:[p.jsxs(yt,{variant:"default",size:"sm",onClick:I,className:"flex cursor-pointer justify-between gap-1 rounded-r-none bg-emerald-600 hover:bg-emerald-700",children:[p.jsx(Cr,{className:"mr-1 size-3"}),p.jsx("span",{className:"min-w-[110px]",children:h==="one-time"?"Approve this time":"Approve always"})]}),p.jsxs(M1,{open:b,onOpenChange:w,children:[p.jsx(U1,{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(L1,{align:"end",className:"w-64 p-1",sideOffset:4,children:[p.jsxs("button",{onClick:()=>{v("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(Cr,{className:T.cn("relative top-1 mt-0.5 size-3 shrink-0",h!=="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:()=>{v("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(Cr,{className:T.cn("relative top-1 mt-0.5 size-3 shrink-0",h!=="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 UH({title:e,icon:t,status:r="complete",defaultExpanded:o=!1,children:n,className:i}){const[a,s]=P.useState(o);return p.jsxs("div",{"data-slot":"tool-ui-group",className:T.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(F1,{status:r==="running"?"running":"complete"}),p.jsx("span",{className:T.cn("flex-1 text-sm font-medium",r==="running"&&"shimmer"),children:e}),p.jsx(vs,{className:T.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 LH=({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=M.useAssistantState(({message:w})=>w).parts.filter(w=>w.type==="tool-call"),f=d.findIndex(w=>w.toolName===e),m=()=>{s(t)},g=()=>{a(e),s(t)},h=()=>{c(t)},v=()=>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:T.cn("aui-tool-fallback-root flex w-full flex-col",f!==-1&&f!==d.length-1&&"border-b"),children:p.jsx(MH,{name:e,status:v(),request:n,result:b(),onApproveOnce:l?m:void 0,onApproveForSession:l?g:void 0,onDeny:l?h:void 0,className:"rounded-none border-0"})})},cl=()=>{const{config:e}=T.useElements(),t=e.theme??{};return P.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])},Nr=[.23,1,.32,1];function FH(e){return e.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const VH=({children:e})=>{const t=M.useAssistantState(({message:s})=>s).parts,r=t.filter(s=>s.type==="tool-call"),o=r.some(s=>s.status?.type==="running"),{config:n}=T.useElements(),i=n.tools?.expandToolGroupsByDefault??!1,a=P.useMemo(()=>{const s=t.filter(c=>c.type==="tool-call");return s.length===0?"No tools called":s.length===1?`Calling ${FH(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:T.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(UH,{title:a,status:o?"running":"complete",defaultExpanded:i,children:e})})},ZH=()=>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=T.useDensity(),{config:o}=T.useElements(),n=o.components??{},i=o.api&&"sessionToken"in o.api;return p.jsx(ur.LazyMotion,{features:ur.domAnimation,children:p.jsx(ur.MotionConfig,{reducedMotion:"user",children:p.jsx(M.ThreadPrimitive.Root,{className:T.cn("aui-root aui-thread-root bg-background @container flex h-full flex-col",t.className,e),children:p.jsxs(M.ThreadPrimitive.Viewport,{className:T.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(M.ThreadPrimitive.If,{empty:!0,children:n.ThreadWelcome?p.jsx(n.ThreadWelcome,{}):p.jsx(qH,{})}),i&&p.jsx(ZH,{}),p.jsx(M.ThreadPrimitive.Messages,{components:{UserMessage:n.UserMessage??eW,EditComposer:n.EditComposer??rW,AssistantMessage:n.AssistantMessage??YH}}),p.jsx(M.ThreadPrimitive.If,{empty:!1,children:p.jsx("div",{className:"aui-thread-viewport-spacer min-h-8 grow"})}),p.jsx(HH,{})]})})})})},BH=()=>p.jsx(M.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:p.jsx(qt,{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(pL,{})})}),qH=()=>{const{config:e}=T.useElements(),t=T.useDensity(),{title:r,subtitle:o}=e.welcome??{},n=e.variant==="standalone";return p.jsxs("div",{className:T.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:T.cn("aui-thread-welcome-center flex w-full grow flex-col items-center justify-start"),children:p.jsxs("div",{className:T.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(sr.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,ease:Nr},className:T.cn("aui-thread-welcome-message-motion-1 text-foreground font-semibold",t("text-title")),children:r}),p.jsx(sr.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,delay:.05,ease:Nr},className:T.cn("aui-thread-welcome-message-motion-2 text-muted-foreground/65",t("text-subtitle")),children:o})]})}),p.jsx(GH,{})]})},GH=()=>{const{config:e}=T.useElements(),t=T.useRadius(),r=T.useDensity(),o=e.welcome?.suggestions??[],n=e.variant==="standalone";return o.length===0?null:p.jsx("div",{className:T.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(sr.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.25,delay:.03*a,ease:Nr},className:T.cn("aui-thread-welcome-suggestion-display",!n&&"nth-[n+3]:hidden @md:nth-[n+3]:block"),children:p.jsx(M.ThreadPrimitive.Suggestion,{prompt:i.action,send:!0,asChild:!0,children:p.jsxs(yt,{variant:"ghost",className:T.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}`))})},HH=()=>{const{config:e}=T.useElements(),t=T.useRadius(),r=T.useDensity(),o=e.composer??{placeholder:"Send a message...",attachments:!0},n=e.components??{};return n.Composer?p.jsx(n.Composer,{}):p.jsxs("div",{className:T.cn("aui-composer-wrapper bg-background sticky bottom-0 flex w-full flex-col overflow-visible",r("gap-md"),r("py-md"),t("xl")),children:[p.jsx(BH,{}),p.jsxs(M.ComposerPrimitive.Root,{className:T.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",t("xl")),children:[o.attachments&&p.jsx(eH,{}),p.jsx(M.ComposerPrimitive.Input,{placeholder:o.placeholder,className:T.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",r("h-input"),r("text-base")),rows:1,autoFocus:!0,"aria-label":"Message input"}),p.jsx(JH,{})]})]})},WH=()=>{const{model:e,setModel:t}=T.useElements(),[r,o]=P.useState(!1),[n,i]=P.useState(!1),a=P.useRef(null),s=P.useRef(0),c=P.useRef(!1);P.useEffect(()=>{r&&!c.current&&requestAnimationFrame(()=>{const u=a.current;u&&u.scrollHeight>0&&(u.scrollTop=s.current)}),c.current=r},[r]),P.useEffect(()=>{r&&i(!1)},[r]);const l=u=>{s.current=u.currentTarget.scrollTop};return p.jsx(MT,{children:p.jsxs(gp,{open:n&&!r,onOpenChange:i,children:[p.jsxs(M1,{open:r,onOpenChange:o,children:[p.jsx(vp,{asChild:!0,children:p.jsx(U1,{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(VL,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})})}),p.jsx(L1,{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(Cr,{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"})]})})},JH=()=>{const{config:e}=T.useElements(),t=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(tH,{}):p.jsx("div",{className:"aui-composer-add-attachment-placeholder"}),e.model?.showModelPicker&&!e.languageModel&&p.jsx(WH,{})]}),p.jsx(M.ThreadPrimitive.If,{running:!1,children:p.jsx(M.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(qt,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:T.cn("aui-composer-send size-[34px] p-1",t("full")),"aria-label":"Send message",children:p.jsx(gL,{className:"aui-composer-send-icon size-5"})})})}),p.jsx(M.ThreadPrimitive.If,{running:!0,children:p.jsx(M.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(yt,{type:"button",variant:"default",size:"icon",className:T.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(BL,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})},KH=()=>p.jsx(M.MessagePrimitive.Error,{children:p.jsx(M.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(M.ErrorPrimitive.Message,{className:"aui-message-error-message line-clamp-2"})})}),YH=()=>{const{config:e}=T.useElements(),t=e.tools??{},r=e.components??{};return p.jsx(M.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(M.MessagePrimitive.Parts,{components:{Text:r.Text??b1,Image:r.Image??XH,tools:{by_name:t.components,Fallback:r.ToolFallback??LH},Reasoning:r.Reasoning??$1,ReasoningGroup:r.ReasoningGroup??T1,ToolGroup:r.ToolGroup??VH}}),p.jsx(KH,{})]}),p.jsx("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex",children:p.jsx(QH,{})})]})})},XH=e=>p.jsx("img",{src:e.image}),QH=()=>p.jsx(M.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(M.ActionBarPrimitive.Copy,{asChild:!0,children:p.jsxs(qt,{tooltip:"Copy",children:[p.jsx(M.MessagePrimitive.If,{copied:!0,children:p.jsx(Cr,{})}),p.jsx(M.MessagePrimitive.If,{copied:!1,children:p.jsx(jm,{})})]})})}),eW=()=>{const e=T.useRadius();return p.jsx(M.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(QG,{}),p.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[p.jsx("div",{className:T.cn("aui-user-message-content bg-muted text-foreground px-5 py-2.5 wrap-break-word",e("xl")),children:p.jsx(M.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(tW,{})})]}),p.jsx(nW,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]})})},tW=()=>p.jsx(M.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:p.jsx(M.ActionBarPrimitive.Edit,{asChild:!0,children:p.jsx(qt,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:p.jsx(UL,{})})})}),rW=()=>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(M.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(M.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(M.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(yt,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),p.jsx(M.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(yt,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),nW=({className:e,...t})=>p.jsxs(M.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:T.cn("aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs",e),...t,children:[p.jsx(M.BranchPickerPrimitive.Previous,{asChild:!0,children:p.jsx(qt,{tooltip:"Previous",children:p.jsx(xL,{})})}),p.jsxs("span",{className:"aui-branch-picker-state font-medium",children:[p.jsx(M.BranchPickerPrimitive.Number,{})," / ",p.jsx(M.BranchPickerPrimitive.Count,{})]}),p.jsx(M.BranchPickerPrimitive.Next,{asChild:!0,children:p.jsx(qt,{tooltip:"Next",children:p.jsx(jE,{})})})]});function oW({className:e,...t}){return p.jsx("div",{"data-slot":"skeleton",className:T.cn("bg-accent animate-pulse rounded-md",e),...t})}const Ap=({className:e})=>{const t=T.useDensity();return p.jsxs(M.ThreadListPrimitive.Root,{className:T.cn("aui-root aui-thread-list-root bg-background flex flex-col items-stretch",t("gap-sm"),e),children:[p.jsx("div",{className:T.cn("aui-thread-list-new-section border-b pb-2",t("py-sm"),t("px-sm")),children:p.jsx(iW,{})}),p.jsx("div",{className:T.cn("aui-thread-list-items-section flex flex-col gap-1",t("py-xs"),t("px-sm")),children:p.jsx(aW,{})})]})},iW=()=>{const e=T.useDensity();return p.jsx(M.ThreadListPrimitive.New,{asChild:!0,children:p.jsxs(yt,{className:T.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"]})})},aW=()=>M.useAssistantState(({threads:t})=>t.isLoading)?p.jsx(sW,{}):p.jsx(M.ThreadListPrimitive.Items,{components:{ThreadListItem:cW}}),sW=()=>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(oW,{className:"aui-thread-list-skeleton h-[22px] grow"})},t))}),cW=()=>{const e=T.useRadius(),t=T.useDensity();return p.jsx(M.ThreadListItemPrimitive.Root,{className:T.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(M.ThreadListItemPrimitive.Trigger,{className:T.cn("aui-thread-list-item-trigger flex grow cursor-pointer items-center text-start",t("px-lg"),t("py-sm")),children:p.jsx(lW,{})})})},lW=()=>p.jsx("span",{className:"aui-thread-list-item-title text-sm",children:p.jsx(M.ThreadListItemPrimitive.Title,{fallback:"New Chat"})}),Z1=()=>{const{config:e,isExpanded:t,setIsExpanded:r}=T.useElements(),o=e.modal?.defaultExpanded??!1;return{expandable:e.modal?.expandable??!1,isExpanded:t,setIsExpanded:r,defaultExpanded:o}},uW={layout:{duration:.25,ease:Nr}},dW=({className:e})=>{const{config:t}=T.useElements(),r=cl(),o=T.useRadius(),n=T.useDensity(),[i,a]=P.useState(t.modal?.defaultOpen??!1),{expandable:s,isExpanded:c,setIsExpanded:l}=Z1(),u=t.modal?.title,d=t.modal?.icon,f=t.history?.enabled&&t.history?.showThreadList!==!1,m=t.modal?.position??"bottom-right",g=fW(m),h=P.useMemo(()=>t.modal?.dimensions?.default??{width:"500px",height:"600px",maxHeight:"95vh"},[t.modal?.dimensions?.default]),v=P.useMemo(()=>t.modal?.dimensions?.expanded??{width:"70vw",height:"90vh"},[t.modal?.dimensions?.expanded]),w=M.useAssistantState(({thread:S})=>S).messages.some(S=>S.status?.type==="running"),I=c?v.width:h.width,y=c?v.height:h.height,k=h.maxHeight;return p.jsx(ur.LazyMotion,{features:ur.domMax,children:p.jsx(ur.MotionConfig,{reducedMotion:"user",transition:uW,children:p.jsx("div",{className:T.cn("aui-root aui-modal-anchor fixed z-10",g,r.className,o("lg"),i&&"shadow-xl",e),children:p.jsx(ur.AnimatePresence,{mode:"wait",children:i?p.jsxs(sr.div,{layout:!0,layoutId:"chat-container",className:T.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:I,height:y,maxHeight:k},children:[p.jsxs(sr.div,{className:T.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:Nr},children:[p.jsx("div",{className:T.cn("flex min-w-0 items-center"),children:p.jsxs("span",{className:T.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(S=>!S),className:T.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(RL,{strokeWidth:2,className:"size-3.5 rotate-90"}):p.jsx(OL,{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(ra,{className:"size-4.5"})})]})]}),p.jsxs(sr.div,{className:"aui-modal-body flex flex-1 overflow-hidden",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.05,ease:Nr},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(sr.button,{layout:!0,layoutId:"chat-container",onClick:()=>a(!0),className:T.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(sr.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:Nr},className:"flex size-full items-center justify-center",children:d?d("closed"):p.jsx(CL,{className:"size-6"})})},"button")})})})})};function fW(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:T.assertNever(e)}}const mW=({className:e})=>{const{config:t}=T.useElements(),r=cl(),o=t.sidecar??{},{title:n,dimensions:i}=o,{isExpanded:a,setIsExpanded:s}=Z1(),l=M.useAssistantState(({thread:d})=>d).messages.some(d=>d.status?.type==="running"),u=t.history?.enabled&&t.history?.showThreadList!==!1;return p.jsx(ur.LazyMotion,{features:ur.domMax,children:p.jsxs(sr.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:Nr},className:T.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:T.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(qt,{tooltip:a?"Collapse":"Pop out",variant:"ghost",className:"aui-sidecar-popout size-8",onClick:()=>s(d=>!d),children:a?p.jsx(jL,{className:"size-4.5"}):p.jsx(DL,{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 pW({containerRef:e,children:t}){return p.jsx(zT.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 .-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-\\[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 .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-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 .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 .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-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 .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{background-color:var(--primary)}.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-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-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-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}}`,B1=({children:e,hostClassName:t,hostStyle:r})=>{const o=P.useRef(null),n=P.useRef(null),[i,a]=P.useState(null),{config:s}=T.useElements(),c=cl(),l=P.useMemo(()=>T.cn(Qm,c.className),[c.className]);return P.useEffect(()=>{const u=o.current;if(!u)return;const d=u.shadowRoot??u.attachShadow({mode:"open"});a(d)},[]),P.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(pW,{containerRef:n,children:e})}),i):null})};function pu({children:e}){return p.jsx(B1,{hostStyle:{height:"inherit",width:"inherit"},children:e})}const hW=({className:e})=>{const{config:t}=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(mW,{})});default:return p.jsx(pu,{children:p.jsx(dW,{className:e})})}},gW=({className:e})=>p.jsx(B1,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(Ap,{className:e})});exports.ActionType=Lc;exports.CENSORED_IMG_MARK=V4;exports.CENSORED_STRING_MARK=Ma;exports.Chat=hW;exports.ChatHistory=gW;exports.ElementsProvider=FB;exports.MODELS=Pm;exports.NodePrivacyLevel=ae;exports.ONE_SECOND=Ke;exports.PRIVACY_ATTR_NAME=Cm;exports.PRIVACY_ATTR_VALUE_HIDDEN=L4;exports.RumEventType=te;exports.addEventListener=Oe;exports.addEventListeners=hr;exports.addRecord=N6;exports.addSegment=C6;exports.addTelemetryDebug=_o;exports.addTelemetryMetrics=Qi;exports.addWroteData=R6;exports.buildTags=_m;exports.buildUrl=Ji;exports.canUseEventBridge=sn;exports.clearTimeout=vt;exports.clocksNow=Ue;exports.clocksOrigin=mm;exports.createHttpRequest=Sm;exports.currentDrift=jS;exports.defineFrontendTool=dL;exports.display=Q;exports.elapsed=Ne;exports.forEachChildNodes=$4;exports.getEventBridge=yo;exports.getGlobalObject=It;exports.getMutationObserverConstructor=Zk;exports.getNodePrivacyLevel=ta;exports.getNodeSelfPrivacyLevel=sE;exports.getParentNode=eE;exports.getScrollX=mU;exports.getScrollY=EE;exports.getSegmentsCount=A6;exports.getTextContent=q4;exports.getViewportDimension=Zc;exports.hasChildNodes=I4;exports.initViewportObservable=IE;exports.instrumentMethod=Vt;exports.instrumentSetter=m2;exports.isNodeShadowHost=Om;exports.isNodeShadowRoot=Qk;exports.isPageExitReason=bk;exports.isSafari=KP;exports.jsonStringify=go;exports.monitor=ne;exports.monitorError=mr;exports.noop=_e;exports.objectEntries=jc;exports.reducePrivacyLevel=aE;exports.relativeToClocks=Gi;exports.requestIdleCallback=Ak;exports.sanitizeIfLongDataUrl=Wk;exports.sendToExtension=wm;exports.setTimeout=Je;exports.shouldMaskAttribute=cE;exports.shouldMaskNode=Nm;exports.supportPerformanceTimingEvent=Zr;exports.throttle=Wi;exports.timeStampNow=Be;exports.trackError=hs;
144
+ //# sourceMappingURL=index-D5cSC22A.cjs.map