@gram-ai/elements 1.23.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +61 -0
  2. package/dist/components/Chat/stories/MessageFeedback.stories.d.ts +28 -0
  3. package/dist/components/Chat/stories/Thread.stories.d.ts +15 -0
  4. package/dist/components/Replay.d.ts +11 -0
  5. package/dist/components/Replay.stories.d.ts +34 -0
  6. package/dist/components/assistant-ui/follow-on-suggestions.d.ts +6 -0
  7. package/dist/components/assistant-ui/message-feedback.d.ts +9 -0
  8. package/dist/contexts/ReplayContext.d.ts +6 -0
  9. package/dist/elements.cjs +1 -1
  10. package/dist/elements.css +1 -1
  11. package/dist/elements.js +10 -8
  12. package/dist/hooks/useFollowOnSuggestions.d.ts +14 -0
  13. package/dist/hooks/useMCPTools.d.ts +4 -3
  14. package/dist/hooks/useRecordCassette.d.ts +32 -0
  15. package/dist/{index-D-QXb5EF.js → index-B_7BIEfu.js} +11591 -10174
  16. package/dist/index-B_7BIEfu.js.map +1 -0
  17. package/dist/index-Bps9R2k6.cjs +178 -0
  18. package/dist/index-Bps9R2k6.cjs.map +1 -0
  19. package/dist/{index-vM3v0unX.js → index-CtyV0c-T.js} +5477 -5450
  20. package/dist/index-CtyV0c-T.js.map +1 -0
  21. package/dist/{index-Co05S1C8.cjs → index-iUSSoKFz.cjs} +12 -12
  22. package/dist/index-iUSSoKFz.cjs.map +1 -0
  23. package/dist/index.d.ts +3 -0
  24. package/dist/lib/cassette.d.ts +46 -0
  25. package/dist/plugins.cjs +1 -1
  26. package/dist/plugins.js +1 -1
  27. package/dist/{profiler-Dshm-O8k.cjs → profiler-B6MySCOn.cjs} +2 -2
  28. package/dist/{profiler-Dshm-O8k.cjs.map → profiler-B6MySCOn.cjs.map} +1 -1
  29. package/dist/{profiler-D8-vgPGn.js → profiler-BWBC_MF5.js} +2 -2
  30. package/dist/{profiler-D8-vgPGn.js.map → profiler-BWBC_MF5.js.map} +1 -1
  31. package/dist/{startRecording-DnWeZRhl.js → startRecording-52IGlVhJ.js} +2 -2
  32. package/dist/{startRecording-DnWeZRhl.js.map → startRecording-52IGlVhJ.js.map} +1 -1
  33. package/dist/{startRecording-2p7-xVUh.cjs → startRecording-9LKBFNDH.cjs} +2 -2
  34. package/dist/{startRecording-2p7-xVUh.cjs.map → startRecording-9LKBFNDH.cjs.map} +1 -1
  35. package/dist/types/index.d.ts +37 -0
  36. package/package.json +5 -4
  37. package/src/components/Chat/stories/MessageFeedback.stories.tsx +169 -0
  38. package/src/components/Chat/stories/Thread.stories.tsx +78 -0
  39. package/src/components/Replay.stories.tsx +326 -0
  40. package/src/components/Replay.tsx +241 -0
  41. package/src/components/assistant-ui/follow-on-suggestions.tsx +122 -0
  42. package/src/components/assistant-ui/markdown-text.tsx +6 -7
  43. package/src/components/assistant-ui/message-feedback.tsx +177 -0
  44. package/src/components/assistant-ui/thread.tsx +319 -80
  45. package/src/components/assistant-ui/tool-group.tsx +27 -16
  46. package/src/components/ui/tool-ui.tsx +59 -17
  47. package/src/contexts/ElementsProvider.tsx +7 -2
  48. package/src/contexts/ReplayContext.ts +7 -0
  49. package/src/global.css +14 -8
  50. package/src/hooks/useAuth.ts +3 -0
  51. package/src/hooks/useFollowOnSuggestions.ts +237 -0
  52. package/src/hooks/useMCPTools.ts +32 -12
  53. package/src/hooks/useRecordCassette.ts +79 -0
  54. package/src/index.ts +10 -0
  55. package/src/lib/cassette.ts +260 -0
  56. package/src/plugins/chart/component.tsx +48 -11
  57. package/src/plugins/components/PluginLoadingState.tsx +2 -2
  58. package/src/types/index.ts +40 -0
  59. package/src/vite-env.d.ts +1 -0
  60. package/dist/index-CVYyyxfm.cjs +0 -147
  61. package/dist/index-CVYyyxfm.cjs.map +0 -1
  62. package/dist/index-Co05S1C8.cjs.map +0 -1
  63. package/dist/index-D-QXb5EF.js.map +0 -1
  64. package/dist/index-vM3v0unX.js.map +0 -1
@@ -1,147 +0,0 @@
1
- "use strict";const p=require("react/jsx-runtime"),M=require("@assistant-ui/react"),A=require("react"),$=require("./index-Co05S1C8.cjs"),gd=require("@assistant-ui/react-ai-sdk"),bt=require("motion/react"),rO=require("motion/react-m"),nO=require("zustand/shallow"),hd=require("react-dom"),yu=require("@assistant-ui/react-markdown"),oO=require("remark-gfm"),iO=require("shiki");function vd(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 _=vd(A),Lt=vd(rO),Gv=vd(hd);function Hv({tools:e}){return p.jsx(p.Fragment,{children:Object.entries(e).map(([,t])=>t({}))})}const yd="gram-elements",aO=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}},sO=()=>{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=aO(),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 Vp{_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 Wv=e=>new ReadableStream({start(t){return e.start?.(new Vp(t))},pull(t){return e.pull?.(new Vp(t))},cancel(t){return e.cancel?.(t)}}),Zp=()=>{let e;return[Wv({start(r){e=r}}),e]};class Bp{_controller;_isClosed=!1;_mergeTask;constructor(t){this._controller=t;const r=Wv({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 cO=e=>new ReadableStream({start(t){return e.start?.(new Bp(t))},pull(t){return e.pull?.(new Bp(t))},cancel(t){return e.cancel?.(t)}}),lO=()=>{let e;return[cO({start(r){e=r}}),e]};class Jv{value=-1;up(){return++this.value}}class uO extends TransformStream{constructor(t){super({transform(r,o){o.enqueue({...r,path:[t,...r.path]})}})}}class H7 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 dO extends TransformStream{constructor(t){const r=new Jv,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 fO=(e,t=21)=>(r=t)=>{let o="",n=r|0;for(;n--;)o+=e[Math.random()*e.length|0];return o};const mO=fO("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class bd{_state;_parentId;constructor(t){this._state=t||{merger:sO(),contentCounter:new Jv}}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 uO(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new dO(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]=Zp();return this._addPart({type:"text"},t),r}addReasoningPart(){const[t,r]=Zp();return this._addPart({type:"reasoning"},t),r}addToolCallPart(t){const r=typeof t=="string"?{toolName:t}:t,o=r.toolName,n=r.toolCallId??mO(),[i,a]=lO();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 bd(this._state);return r._parentId=t,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}}function wl(e){const t=new bd;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 pO(e){return typeof e=="string"?new Date(e):e}function gO(e){if(e.role!=="user")return[];if(typeof e.content=="string"||!e.content)return[{type:"text",text:e.content??""}];const t=[];for(const r of e.content)switch(r.type){case"text":t.push({type:"text",text:r.text});break;case"image_url":t.push({type:"image",image:r.image_url?.url});break;case"input_audio":{const o=r.input_audio?.format;(o==="mp3"||o==="wav")&&t.push({type:"audio",audio:{data:r.input_audio.data,format:o}});break}default:t.push({type:"text",text:""});break}return t}function hO(e){if(e.role!=="assistant")return[];if(typeof e.content=="string"||!e.content)return[{type:"text",text:e.content??""}];const t=[],r=e.tool_calls;let o=bu(r||"[]");Array.isArray(o)||(console.warn("Invalid tool_calls format, expected an array."),o=[]);for(const n of o){const i=n.function?.arguments??n.args??{},a=typeof i=="string"?i:JSON.stringify(i);t.push({type:"tool-call",toolCallId:n.id??n.toolCallId??"",toolName:n.function?.name??n.toolName??"",args:typeof i=="string"?JSON.parse(i):i,argsText:a,result:void 0})}return t.length===0&&t.push({type:"text",text:""}),t}function vO(e){if(e.role!=="system")return[{type:"text",text:""}];if(typeof e.content=="string"||!e.content)return[{type:"text",text:e.content??""}];const t=[];for(const r of e.content)r.type==="text"&&t.push(r.text);return[{type:"text",text:t.join(`
2
- `)}]}function yO(e){const t=pO(e.created_at),r={unstable_state:void 0,unstable_annotations:void 0,unstable_data:void 0,steps:void 0,submittedFeedback:void 0,custom:{}};return e.role==="user"?{id:e.id,role:"user",createdAt:t,content:gO(e),attachments:[],metadata:r}:e.role==="system"?{id:e.id,role:"system",createdAt:t,content:vO(e),metadata:r}:{id:e.id,role:"assistant",createdAt:t,content:hO(e),status:{type:"complete",reason:"stop"},metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],steps:[],submittedFeedback:void 0,custom:{}}}}function bO(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=yO(o);t.push({message:n,parentId:r,runConfig:void 0}),r=o.id}return{messages:t,headId:r}}function _O(e){if(e.length===0)return{messages:[],headId:null};const t=new Map;for(const n of e){if(n.role!=="tool")continue;const i=n.tool_call_id;typeof i=="string"&&t.set(i,n)}const r=[];let o=null;for(const n of e){switch(n.role){case"developer":case"tool":continue;case"system":{r.push({parentId:o,message:{id:n.id,role:"system",parts:[{type:"text",text:typeof n.content=="string"?n.content:Array.isArray(n.content)?n.content.filter(i=>i.type==="text").map(i=>i.text).join(`
3
- `):""}]}});break}case"user":{r.push({parentId:o,message:{id:n.id,role:"user",parts:qp(n,t)}});break}case"assistant":{const i={parentId:o,message:{id:n.id,role:"assistant",parts:qp(n,t)}};r.push(i);break}}o=n.id}return{messages:r,headId:o}}function qp(e,t){const r=[];typeof e.content=="string"&&e.content&&r.push({type:"text",text:e.content});const o=Array.isArray(e.content)?e.content:[];for(const n of o)switch(n.type){case"text":{r.push({type:"text",text:n.text});break}case"image_url":{const i=n.image_url?.url;if(!i)break;r.push({type:"file",url:i,mediaType:Gp(i)});break}case"input_audio":{const i=n.input_audio?.data;if(!i)break;r.push({type:"file",url:i,mediaType:Gp(i)});break}}if(e.role==="assistant"&&e.reasoning&&r.push({type:"reasoning",text:e.reasoning}),e.role==="assistant"&&e.tool_calls){const n=e.tool_calls;let i=bu(n||"[]");Array.isArray(i)||(console.warn("Invalid tool_calls format, expected an array."),i=[]);for(const a of i){const s=t.get(a.id)?.content;r.push({type:"dynamic-tool",toolCallId:a.id,toolName:a.function?.name??"",state:"output-available",input:a.function?.arguments??{},output:typeof s=="string"?bu(s):""})}}return r}function Gp(e){const t="unknown/unknown";return e.startsWith("data:")&&e.match(/^data:([^;]+);/)?.[1]||t}function bu(e){try{return JSON.parse(e)}catch{return null}}const wO="__LOCALID_";function Bo(e){return!!e?.startsWith(wO)}class xO{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 bO(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};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 n=await o.json();return _O(n.messages)},append:async()=>{}}}}function SO(e){const t=M.useAssistantApi(),[r]=A.useState(()=>new xO(e.current.apiUrl,e.current.headers,t));return r}function kO(e){const t=A.useRef(e);A.useEffect(()=>{t.current=e},[e]);const r=A.useCallback(function({children:n}){const i=SO(t),a=A.useMemo(()=>({history:i}),[i]);return p.jsx(M.RuntimeAdapterProvider,{adapters:a,children:n})},[]);return A.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(Bo(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||Bo(o))return wl(a=>{a.close()});const i=2e3;await new Promise(a=>setTimeout(a,i));try{const a=await fetch(`${t.current.apiUrl}/rpc/chat.generateTitle`,{method:"POST",headers:{...t.current.headers,"Content-Type":"application/json"},body:JSON.stringify({id:o})});if(a.ok){const c=(await a.json()).title;if(c)return wl(l=>{l.appendText(c),l.close()})}}catch(a){console.error("Error fetching title:",a)}return wl(a=>{a.close()})},async fetch(o){if(!o||Bo(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])}var Kv="vercel.ai.error",EO=Symbol.for(Kv),Yv,IO=class Xv extends Error{constructor({name:t,message:r,cause:o}){super(r),this[Yv]=!0,this.name=t,this.cause=o}static isInstance(t){return Xv.hasMarker(t,Kv)}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}};Yv=EO;var te=IO,Qv="AI_APICallError",ey=`vercel.ai.error.${Qv}`,TO=Symbol.for(ey),ty,st=class extends te{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:Qv,message:t,cause:s}),this[ty]=!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 te.hasMarker(t,ey)}};ty=TO;var ry="AI_EmptyResponseBodyError",ny=`vercel.ai.error.${ry}`,$O=Symbol.for(ny),oy,OO=class extends te{constructor({message:t="Empty response body"}={}){super({name:ry,message:t}),this[oy]=!0}static isInstance(t){return te.hasMarker(t,ny)}};oy=$O;function uo(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var iy="AI_InvalidArgumentError",ay=`vercel.ai.error.${iy}`,AO=Symbol.for(ay),sy,_d=class extends te{constructor({message:t,cause:r,argument:o}){super({name:iy,message:t,cause:r}),this[sy]=!0,this.argument=o}static isInstance(t){return te.hasMarker(t,ay)}};sy=AO;var cy="AI_InvalidPromptError",ly=`vercel.ai.error.${cy}`,CO=Symbol.for(ly),uy,In=class extends te{constructor({prompt:t,message:r,cause:o}){super({name:cy,message:`Invalid prompt: ${r}`,cause:o}),this[uy]=!0,this.prompt=t}static isInstance(t){return te.hasMarker(t,ly)}};uy=CO;var dy="AI_JSONParseError",fy=`vercel.ai.error.${dy}`,NO=Symbol.for(fy),my,Wa=class extends te{constructor({text:t,cause:r}){super({name:dy,message:`JSON parsing failed: Text: ${t}.
4
- Error message: ${uo(r)}`,cause:r}),this[my]=!0,this.text=t}static isInstance(t){return te.hasMarker(t,fy)}};my=NO;var py="AI_NoSuchModelError",gy=`vercel.ai.error.${py}`,RO=Symbol.for(gy),hy,PO=class extends te{constructor({errorName:e=py,modelId:t,modelType:r,message:o=`No such ${r}: ${t}`}){super({name:e,message:o}),this[hy]=!0,this.modelId=t,this.modelType=r}static isInstance(e){return te.hasMarker(e,gy)}};hy=RO;var vy="AI_TypeValidationError",yy=`vercel.ai.error.${vy}`,jO=Symbol.for(yy),by,zO=class _u extends te{constructor({value:t,cause:r}){super({name:vy,message:`Type validation failed: Value: ${JSON.stringify(t)}.
5
- Error message: ${uo(r)}`,cause:r}),this[by]=!0,this.value=t}static isInstance(t){return te.hasMarker(t,yy)}static wrap({value:t,cause:r}){return _u.isInstance(r)&&r.value===t?r:new _u({value:t,cause:r})}};by=jO;var Yo=zO;let Hp=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 xl(e){}function DO(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=xl,onError:r=xl,onRetry:o=xl,onComment:n}=e;let i="",a=!0,s,c="",l="";function u(g){const y=a?g.replace(/^\xEF\xBB\xBF/,""):g,[b,w]=MO(`${i}${y}`);for(const x of b)d(x);i=w,a=!1}function d(g){if(g===""){m();return}if(g.startsWith(":")){n&&n(g.slice(g.startsWith(": ")?2:1));return}const y=g.indexOf(":");if(y!==-1){const b=g.slice(0,y),w=g[y+1]===" "?2:1,x=g.slice(y+w);f(b,x,g);return}f(g,"",g)}function f(g,y,b){switch(g){case"event":l=y;break;case"data":c=`${c}${y}
6
- `;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?o(parseInt(y,10)):r(new Hp(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:b}));break;default:r(new Hp(`Unknown field "${g.length>20?`${g.slice(0,20)}…`:g}"`,{type:"unknown-field",field:g,value:y,line:b}));break}}function m(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
7
- `)?c.slice(0,-1):c}),s=void 0,c="",l=""}function h(g={}){i&&g.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:h}}function MO(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),i=e.indexOf(`
8
- `,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]===`
9
- `&&o++}}return[t,r]}let Ja=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o}={}){let n;super({start(i){n=DO({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 wd=Object.freeze({status:"aborted"});function T(e,t,r){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);const l=a.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){const f=u[d];f in s||(s[f]=l[f].bind(s))}}const n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var c;const l=r?.Parent?new i:this;o(l,s),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}const _y=Symbol("zod_brand");class tn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ps extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ka={};function Xe(e){return e&&Object.assign(Ka,e),Ka}function UO(e){return e}function LO(e){return e}function FO(e){}function VO(e){throw new Error("Unexpected value in exhaustive check")}function ZO(e){}function xd(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function R(e,t="|"){return e.map(r=>J(r)).join(t)}function Ya(e,t){return typeof t=="bigint"?t.toString():t}function Si(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function pn(e){return e==null}function js(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function wy(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 Wp=Symbol("evaluating");function de(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==Wp)return o===void 0&&(o=Wp,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function BO(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Fr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function wr(...e){const t={};for(const r of e){const o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function qO(e){return wr(e._zod.def)}function GO(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function HO(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 wu(e){return JSON.stringify(e)}function xy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Sd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Sy=Si(()=>{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 zs(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}function JO(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const KO=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}`)}},Xa=new Set(["string","number","symbol"]),ky=new Set(["string","number","bigint","boolean","symbol","undefined"]);function fr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rt(e,t,r){const o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function N(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 YO(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 Ey(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Iy={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]},Ty={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function $y(e,t){const r=e._zod.def,o=wr(e._zod.def,{get shape(){const n={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(n[i]=r.shape[i])}return Fr(this,"shape",n),n},checks:[]});return Rt(e,o)}function Oy(e,t){const r=e._zod.def,o=wr(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete n[i]}return Fr(this,"shape",n),n},checks:[]});return Rt(e,o)}function Ay(e,t){if(!nn(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const n=wr(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Fr(this,"shape",i),i},checks:[]});return Rt(e,n)}function Cy(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 Rt(e,r)}function Ny(e,t){const r=wr(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Fr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Rt(e,r)}function Ry(e,t,r){const o=wr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const a in r){if(!(a in n))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=e?new e({type:"optional",innerType:n[a]}):n[a])}else for(const a in n)i[a]=e?new e({type:"optional",innerType:n[a]}):n[a];return Fr(this,"shape",i),i},checks:[]});return Rt(t,o)}function Py(e,t,r){const o=wr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const a in r){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(i[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(const a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return Fr(this,"shape",i),i},checks:[]});return Rt(t,o)}function Kr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ft(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Fo(e){return typeof e=="string"?e:e?.message}function Ct(e,t,r){const o={...e,path:e.path??[]};if(!e.message){const n=Fo(e.inst?._zod.def?.error?.(e))??Fo(t?.error?.(e))??Fo(r.customError?.(e))??Fo(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Ds(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ms(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 XO(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function jy(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 zy(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function QO(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return jy(t+r)}function eA(e){return zy(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function tA(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 rA(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class nA{constructor(...t){}}const Dy=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Ty,Class:nA,NUMBER_FORMAT_RANGES:Iy,aborted:Kr,allowsEval:Sy,assert:ZO,assertEqual:UO,assertIs:FO,assertNever:VO,assertNotEqual:LO,assignProp:Fr,base64ToUint8Array:jy,base64urlToUint8Array:QO,cached:Si,captureStackTrace:Sd,cleanEnum:XO,cleanRegex:js,clone:Rt,cloneDef:qO,createTransparentProxy:YO,defineLazy:de,esc:wu,escapeRegex:fr,extend:Ay,finalizeIssue:Ct,floatSafeRemainder:wy,getElementAtPath:GO,getEnumValues:xd,getLengthableOrigin:Ms,getParsedType:KO,getSizableOrigin:Ds,hexToUint8Array:tA,isObject:Gn,isPlainObject:nn,issue:Hn,joinValues:R,jsonStringifyReplacer:Ya,merge:Ny,mergeDefs:wr,normalizeParams:N,nullish:pn,numKeys:JO,objectClone:BO,omit:Oy,optionalKeys:Ey,partial:Ry,pick:$y,prefixIssues:Ft,primitiveTypes:ky,promiseAllObject:HO,propertyKeyTypes:Xa,randomString:WO,required:Py,safeExtend:Cy,shallowClone:zs,slugify:xy,stringifyPrimitive:J,uint8ArrayToBase64:zy,uint8ArrayToBase64url:eA,uint8ArrayToHex:rA,unwrapMessage:Fo},Symbol.toStringTag,{value:"Module"})),My=(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,Ya,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},kd=T("$ZodError",My),Et=T("$ZodError",My,{Parent:Error});function Ed(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 Id(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 Uy(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 Ly(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 Fy(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 ${Ly(o.path)}`);return t.join(`
10
- `)}const ki=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=>Ct(c,i,Xe())));throw Sd(s,n?.callee),s}return a.value},xu=ki(Et),Ei=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=>Ct(c,i,Xe())));throw Sd(s,n?.callee),s}return a.value},Su=Ei(Et),Ii=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??kd)(i.issues.map(a=>Ct(a,n,Xe())))}:{success:!0,data:i.value}},Vy=Ii(Et),Ti=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=>Ct(a,n,Xe())))}:{success:!0,data:i.value}},Zy=Ti(Et),Td=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ki(e)(t,r,n)},oA=Td(Et),$d=e=>(t,r,o)=>ki(e)(t,r,o),iA=$d(Et),Od=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ei(e)(t,r,n)},aA=Od(Et),Ad=e=>async(t,r,o)=>Ei(e)(t,r,o),sA=Ad(Et),Cd=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ii(e)(t,r,n)},cA=Cd(Et),Nd=e=>(t,r,o)=>Ii(e)(t,r,o),lA=Nd(Et),Rd=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ti(e)(t,r,n)},uA=Rd(Et),Pd=e=>async(t,r,o)=>Ti(e)(t,r,o),dA=Pd(Et),By=/^[cC][^\s-]{8,}$/,qy=/^[0-9a-z]+$/,Gy=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hy=/^[0-9a-vA-V]{20}$/,Wy=/^[A-Za-z0-9]{27}$/,Jy=/^[a-zA-Z0-9_-]{21}$/,Ky=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fA=/^[-+]?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)?)??$/,Yy=/^([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)$/,mA=Wn(4),pA=Wn(6),gA=Wn(7),Xy=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hA=/^[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])?)*$/,vA=/^(([^<>()\[\]\\.,;:\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,}))$/,Qy=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yA=Qy,bA=/^[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])?)*$/,_A="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function eb(){return new RegExp(_A,"u")}const tb=/^(?:(?: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])$/,rb=/^(([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}|:))$/,nb=e=>{const t=fr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ob=/^((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])$/,ib=/^(([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])$/,ab=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jd=/^[A-Za-z0-9_-]*$/,sb=/^(?=.{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])?)*\.?$/,cb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,lb=/^\+(?:[0-9]){6,14}[0-9]$/,ub="(?:(?:\\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])))",db=new RegExp(`^${ub}$`);function fb(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 mb(e){return new RegExp(`^${fb(e)}$`)}function pb(e){const t=fb({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(`^${ub}T(?:${o})$`)}const gb=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hb=/^-?\d+n?$/,vb=/^-?\d+$/,yb=/^-?\d+(?:\.\d+)?/,bb=/^(?:true|false)$/i,_b=/^null$/i,wb=/^undefined$/i,xb=/^[^A-Z]*$/,Sb=/^[^a-z]*$/,kb=/^[0-9a-fA-F]*$/;function $i(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Oi(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const wA=/^[0-9a-fA-F]{32}$/,xA=$i(22,"=="),SA=Oi(22),kA=/^[0-9a-fA-F]{40}$/,EA=$i(27,"="),IA=Oi(27),TA=/^[0-9a-fA-F]{64}$/,$A=$i(43,"="),OA=Oi(43),AA=/^[0-9a-fA-F]{96}$/,CA=$i(64,""),NA=Oi(64),RA=/^[0-9a-fA-F]{128}$/,PA=$i(86,"=="),jA=Oi(86),zd=Object.freeze(Object.defineProperty({__proto__:null,base64:ab,base64url:jd,bigint:hb,boolean:bb,browserEmail:bA,cidrv4:ob,cidrv6:ib,cuid:By,cuid2:qy,date:db,datetime:pb,domain:cb,duration:Ky,e164:lb,email:Xy,emoji:eb,extendedDuration:fA,guid:Yy,hex:kb,hostname:sb,html5Email:hA,idnEmail:yA,integer:vb,ipv4:tb,ipv6:rb,ksuid:Wy,lowercase:xb,mac:nb,md5_base64:xA,md5_base64url:SA,md5_hex:wA,nanoid:Jy,null:_b,number:yb,rfc5322Email:vA,sha1_base64:EA,sha1_base64url:IA,sha1_hex:kA,sha256_base64:$A,sha256_base64url:OA,sha256_hex:TA,sha384_base64:CA,sha384_base64url:NA,sha384_hex:AA,sha512_base64:PA,sha512_base64url:jA,sha512_hex:RA,string:gb,time:mb,ulid:Gy,undefined:wb,unicodeEmail:Qy,uppercase:Sb,uuid:Wn,uuid4:mA,uuid6:pA,uuid7:gA,xid:Hy},Symbol.toStringTag,{value:"Module"})),Ae=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Eb={number:"number",bigint:"bigint",object:"date"},Dd=T("$ZodCheckLessThan",(e,t)=>{Ae.init(e,t);const r=Eb[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})}}),Md=T("$ZodCheckGreaterThan",(e,t)=>{Ae.init(e,t);const r=Eb[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})}}),Ib=T("$ZodCheckMultipleOf",(e,t)=>{Ae.init(e,t),e._zod.onattach.push(r=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):wy(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})}}),Tb=T("$ZodCheckNumberFormat",(e,t)=>{Ae.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),o=r?"int":"number",[n,i]=Iy[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=vb)}),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})}}),$b=T("$ZodCheckBigIntFormat",(e,t)=>{Ae.init(e,t);const[r,o]=Ty[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})}}),Ob=T("$ZodCheckMaxSize",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const n=o.value;n.size<=t.maximum||o.issues.push({origin:Ds(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ab=T("$ZodCheckMinSize",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const n=o.value;n.size>=t.minimum||o.issues.push({origin:Ds(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Cb=T("$ZodCheckSizeEquals",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.size!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=o=>{const n=o.value,i=n.size;if(i===t.size)return;const a=i>t.size;o.issues.push({origin:Ds(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Nb=T("$ZodCheckMaxLength",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const n=o.value;if(n.length<=t.maximum)return;const a=Ms(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Rb=T("$ZodCheckMinLength",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const n=o.value;if(n.length>=t.minimum)return;const a=Ms(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Pb=T("$ZodCheckLengthEquals",(e,t)=>{var r;Ae.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!pn(n)&&n.length!==void 0}),e._zod.onattach.push(o=>{const n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=o=>{const n=o.value,i=n.length;if(i===t.length)return;const a=Ms(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})}}),Ai=T("$ZodCheckStringFormat",(e,t)=>{var r,o;Ae.init(e,t),e._zod.onattach.push(n=>{const i=n._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),jb=T("$ZodCheckRegex",(e,t)=>{Ai.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})}}),zb=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=xb),Ai.init(e,t)}),Db=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Sb),Ai.init(e,t)}),Mb=T("$ZodCheckIncludes",(e,t)=>{Ae.init(e,t);const r=fr(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ub=T("$ZodCheckStartsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`^${fr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),Lb=T("$ZodCheckEndsWith",(e,t)=>{Ae.init(e,t);const r=new RegExp(`.*${fr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(o=>{const n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function Jp(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues))}const Fb=T("$ZodCheckProperty",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{const o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then(n=>Jp(n,r,t.property));Jp(o,r,t.property)}}),Vb=T("$ZodCheckMimeType",(e,t)=>{Ae.init(e,t);const r=new Set(t.mime);e._zod.onattach.push(o=>{o._zod.bag.mime=t.mime}),e._zod.check=o=>{r.has(o.value.type)||o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),Zb=T("$ZodCheckOverwrite",(e,t)=>{Ae.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Bb{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(`
11
- `).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(`
12
- `))}}const qb={major:4,minor:2,patch:1},Y=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qb;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=Vy(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}}),Ci=T("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gb(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ee=T("$ZodStringFormat",(e,t)=>{Ai.init(e,t),Ci.init(e,t)}),Gb=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Yy),Ee.init(e,t)}),Hb=T("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Wn(o))}else t.pattern??(t.pattern=Wn());Ee.init(e,t)}),Wb=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Xy),Ee.init(e,t)}),Jb=T("$ZodURL",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{try{const o=r.value.trim(),n=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=n.href:r.value=o;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Kb=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=eb()),Ee.init(e,t)}),Yb=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Jy),Ee.init(e,t)}),Xb=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=By),Ee.init(e,t)}),Qb=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qy),Ee.init(e,t)}),e_=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Gy),Ee.init(e,t)}),t_=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Hy),Ee.init(e,t)}),r_=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Wy),Ee.init(e,t)}),n_=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=pb(t)),Ee.init(e,t)}),o_=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=db),Ee.init(e,t)}),i_=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=mb(t)),Ee.init(e,t)}),a_=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ky),Ee.init(e,t)}),s_=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=tb),Ee.init(e,t),e._zod.bag.format="ipv4"}),c_=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rb),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})}}}),l_=T("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=nb(t.delimiter)),Ee.init(e,t),e._zod.bag.format="mac"}),u_=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ob),Ee.init(e,t)}),d_=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ib),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 Ud(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const f_=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ab),Ee.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Ud(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function m_(e){if(!jd.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ud(r)}const p_=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=jd),Ee.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{m_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),g_=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lb),Ee.init(e,t)});function h_(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 v_=T("$ZodJWT",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{h_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),y_=T("$ZodCustomStringFormat",(e,t)=>{Ee.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),Ld=T("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=e._zod.bag.pattern??yb,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}}),b_=T("$ZodNumberFormat",(e,t)=>{Tb.init(e,t),Ld.init(e,t)}),Fd=T("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=bb,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}}),Vd=T("$ZodBigInt",(e,t)=>{Y.init(e,t),e._zod.pattern=hb,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}}),__=T("$ZodBigIntFormat",(e,t)=>{$b.init(e,t),Vd.init(e,t)}),w_=T("$ZodSymbol",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return typeof n=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),r}}),x_=T("$ZodUndefined",(e,t)=>{Y.init(e,t),e._zod.pattern=wb,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}}),S_=T("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=_b,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}}),k_=T("$ZodAny",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),E_=T("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=r=>r}),I_=T("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),T_=T("$ZodVoid",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return typeof n>"u"||r.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),r}}),$_=T("$ZodDate",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,i=n instanceof Date;return i&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Kp(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}const O_=T("$ZodArray",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const i=[];for(let a=0;a<n.length;a++){const s=n[a],c=t.element._zod.run({value:s,issues:[]},o);c instanceof Promise?i.push(c.then(l=>Kp(l,r,a))):Kp(c,r,a)}return i.length?Promise.all(i).then(()=>r):r}});function Qa(e,t,r,o){e.issues.length&&t.issues.push(...Ft(r,e.issues)),e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}function A_(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=Ey(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function C_(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=>Qa(f,r,u,t))):Qa(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 N_=T("$ZodObject",(e,t)=>{if(Y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const s=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...s};return Object.defineProperty(t,"shape",{value:c}),c}})}const o=Si(()=>A_(t));de(e._zod,"propValues",()=>{const s=t.shape,c={};for(const l in s){const u=s[l]._zod;if(u.values){c[l]??(c[l]=new Set);for(const d of u.values)c[l].add(d)}}return c});const n=Gn,i=t.catchall;let a;e._zod.parse=(s,c)=>{a??(a=o.value);const l=s.value;if(!n(l))return s.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),s;s.value={};const u=[],d=a.shape;for(const f of a.keys){const h=d[f]._zod.run({value:l[f],issues:[]},c);h instanceof Promise?u.push(h.then(g=>Qa(g,s,f,l))):Qa(h,s,f,l)}return i?C_(u,l,s,c,o.value,e):u.length?Promise.all(u).then(()=>s):s}}),R_=T("$ZodObjectJIT",(e,t)=>{N_.init(e,t);const r=e._zod.parse,o=Si(()=>A_(t)),n=f=>{const m=new Bb(["shape","payload","ctx"]),h=o.value,g=x=>{const v=wu(x);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const y=Object.create(null);let b=0;for(const x of h.keys)y[x]=`key_${b++}`;m.write("const newResult = {};");for(const x of h.keys){const v=y[x],k=wu(x);m.write(`const ${v} = ${g(x)};`),m.write(`
13
- if (${v}.issues.length) {
14
- payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
15
- ...iss,
16
- path: iss.path ? [${k}, ...iss.path] : [${k}]
17
- })));
18
- }
19
-
20
-
21
- if (${v}.value === undefined) {
22
- if (${k} in input) {
23
- newResult[${k}] = undefined;
24
- }
25
- } else {
26
- newResult[${k}] = ${v}.value;
27
- }
28
-
29
- `)}m.write("payload.value = newResult;"),m.write("return payload;");const w=m.compile();return(x,v)=>w(f,x,v)};let i;const a=Gn,s=!Ka.jitless,l=s&&Sy.value,u=t.catchall;let d;e._zod.parse=(f,m)=>{d??(d=o.value);const h=f.value;return a(h)?s&&l&&m?.async===!1&&m.jitless!==!0?(i||(i=n(t.shape)),f=i(f,m),u?C_([],h,f,m,d,e):f):r(f,m):(f.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),f)}});function Yp(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=>Ct(a,o,Xe())))}),t)}const Us=T("$ZodUnion",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),de(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),de(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),de(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>js(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=>Yp(c,n,e,i)):Yp(s,n,e,i)}});function Xp(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=>Ct(a,o,Xe())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}const P_=T("$ZodXor",(e,t)=>{Us.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=>Xp(c,n,e,i)):Xp(s,n,e,i)}}),j_=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Us.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=Si(()=>{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)}}),z_=T("$ZodIntersection",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,l])=>Qp(r,c,l)):Qp(r,i,a)}});function ku(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=ku(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=ku(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 Qp(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=ku(t.value,r.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Zd=T("$ZodTuple",(e,t)=>{Y.init(e,t);const r=t.items;e._zod.parse=(o,n)=>{const i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];const a=[],s=[...r].reverse().findIndex(u=>u._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){const u=i.length>r.length,d=i.length<c-1;if(u||d)return o.issues.push({...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:i,inst:e,origin:"array"}),o}let l=-1;for(const u of r){if(l++,l>=i.length&&l>=c)continue;const d=u._zod.run({value:i[l],issues:[]},n);d instanceof Promise?a.push(d.then(f=>ma(f,o,l))):ma(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=>ma(m,o,l))):ma(f,o,l)}}return a.length?Promise.all(a).then(()=>o):o}});function ma(e,t,r){e.issues.length&&t.issues.push(...Ft(r,e.issues)),t.value[r]=e.value}const D_=T("$ZodRecord",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!nn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const i=[],a=t.keyType._zod.values;if(a){r.value={};const s=new Set;for(const l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){s.add(typeof l=="number"?l.toString():l);const u=t.valueType._zod.run({value:n[l],issues:[]},o);u instanceof Promise?i.push(u.then(d=>{d.issues.length&&r.issues.push(...Ft(l,d.issues)),r.value[l]=d.value})):(u.issues.length&&r.issues.push(...Ft(l,u.issues)),r.value[l]=u.value)}let c;for(const l in n)s.has(l)||(c=c??[],c.push(l));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(const s of Reflect.ownKeys(n)){if(s==="__proto__")continue;const c=t.keyType._zod.run({value:s,issues:[]},o);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(c.issues.length){t.mode==="loose"?r.value[s]=n[s]:r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(u=>Ct(u,o,Xe())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:n[s],issues:[]},o);l instanceof Promise?i.push(l.then(u=>{u.issues.length&&r.issues.push(...Ft(s,u.issues)),r.value[c.value]=u.value})):(l.issues.length&&r.issues.push(...Ft(s,l.issues)),r.value[c.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),M_=T("$ZodMap",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;const i=[];r.value=new Map;for(const[a,s]of n){const c=t.keyType._zod.run({value:a,issues:[]},o),l=t.valueType._zod.run({value:s,issues:[]},o);c instanceof Promise||l instanceof Promise?i.push(Promise.all([c,l]).then(([u,d])=>{eg(u,d,r,a,n,e,o)})):eg(c,l,r,a,n,e,o)}return i.length?Promise.all(i).then(()=>r):r}});function eg(e,t,r,o,n,i,a){e.issues.length&&(Xa.has(typeof o)?r.issues.push(...Ft(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map(s=>Ct(s,a,Xe()))})),t.issues.length&&(Xa.has(typeof o)?r.issues.push(...Ft(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map(s=>Ct(s,a,Xe()))})),r.value.set(e.value,t.value)}const U_=T("$ZodSet",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;const i=[];r.value=new Set;for(const a of n){const s=t.valueType._zod.run({value:a,issues:[]},o);s instanceof Promise?i.push(s.then(c=>tg(c,r))):tg(s,r)}return i.length?Promise.all(i).then(()=>r):r}});function tg(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const L_=T("$ZodEnum",(e,t)=>{Y.init(e,t);const r=xd(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>Xa.has(typeof n)).map(n=>typeof n=="string"?fr(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{const a=n.value;return o.has(a)||n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),F_=T("$ZodLiteral",(e,t)=>{if(Y.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?fr(o):o?fr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),V_=T("$ZodFile",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;return n instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Z_=T("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ps(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 rg(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const B_=T("$ZodOptional",(e,t)=>{Y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",de(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${js(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=>rg(i,r.value)):rg(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),q_=T("$ZodNullable",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${js(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)}),G_=T("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>ng(i,t)):ng(n,t)}});function ng(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const H_=T("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>(o.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,o))}),W_=T("$ZodNonOptional",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>og(i,e)):og(n,e)}});function og(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 J_=T("$ZodSuccess",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ps("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)}}),K_=T("$ZodCatch",(e,t)=>{Y.init(e,t),de(e._zod,"optin",()=>t.innerType._zod.optin),de(e._zod,"optout",()=>t.innerType._zod.optout),de(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>Ct(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=>Ct(i,o,Xe()))},input:r.value}),r.issues=[]),r)}}),Y_=T("$ZodNaN",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),X_=T("$ZodPipe",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>pa(a,t.in,o)):pa(i,t.in,o)}const n=t.in._zod.run(r,o);return n instanceof Promise?n.then(i=>pa(i,t.out,o)):pa(n,t.out,o)}});function pa(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Bd=T("$ZodCodec",(e,t)=>{Y.init(e,t),de(e._zod,"values",()=>t.in._zod.values),de(e._zod,"optin",()=>t.in._zod.optin),de(e._zod,"optout",()=>t.out._zod.optout),de(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){const i=t.in._zod.run(r,o);return i instanceof Promise?i.then(a=>ga(a,t,o)):ga(i,t,o)}else{const i=t.out._zod.run(r,o);return i instanceof Promise?i.then(a=>ga(a,t,o)):ga(i,t,o)}}});function ga(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 Q_=T("$ZodReadonly",(e,t)=>{Y.init(e,t),de(e._zod,"propValues",()=>t.innerType._zod.propValues),de(e._zod,"values",()=>t.innerType._zod.values),de(e._zod,"optin",()=>t.innerType?._zod?.optin),de(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(ig):ig(n)}});function ig(e){return e.value=Object.freeze(e.value),e}const ew=T("$ZodTemplateLiteral",(e,t)=>{Y.init(e,t);const r=[];for(const o of t.parts)if(typeof o=="object"&&o!==null){if(!o._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);const n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${o._zod.traits}`);const i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,a))}else if(o===null||ky.has(typeof o))r.push(fr(`${o}`));else throw new Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>typeof o.value!="string"?(o.issues.push({input:o.value,inst:e,expected:"template_literal",code:"invalid_type"}),o):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(o.value)||o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o)}),tw=T("$ZodFunction",(e,t)=>(Y.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...o){const n=e._def.input?xu(e._def.input,o):o,i=Reflect.apply(r,this,n);return e._def.output?xu(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 Su(e._def.input,o):o,i=await Reflect.apply(r,this,n);return e._def.output?await Su(e._def.output,i):i}},e._zod.parse=(r,o)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{const o=e.constructor;return Array.isArray(r[0])?new o({type:"function",input:new Zd({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new o({type:"function",input:r[0],output:e._def.output})},e.output=r=>{const o=e.constructor;return new o({type:"function",input:e._def.input,output:r})},e)),rw=T("$ZodPromise",(e,t)=>{Y.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),nw=T("$ZodLazy",(e,t)=>{Y.init(e,t),de(e._zod,"innerType",()=>t.getter()),de(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),de(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),de(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),de(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),ow=T("$ZodCustom",(e,t)=>{Ae.init(e,t),Y.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{const o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(i=>ag(i,r,o,e));ag(n,r,o,e)}});function ag(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 zA=()=>{const e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"};return n=>{switch(n.code){case"invalid_type":return`مدخلات غير مقبولة: يفترض إدخال ${n.expected}، ولكن تم إدخال ${r(n.input)}`;case"invalid_value":return n.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${J(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${a.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${a.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:i.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`:i.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`:i.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`:`${o[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${R(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function DA(){return{localeError:zA()}}const MA=()=>{const e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Yanlış dəyər: gözlənilən ${n.expected}, daxil olan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Yanlış dəyər: gözlənilən ${J(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${a.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`:i.format==="ends_with"?`Yanlış mətn: "${i.suffix}" ilə bitməlidir`:i.format==="includes"?`Yanlış mətn: "${i.includes}" daxil olmalıdır`:i.format==="regex"?`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${o[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function UA(){return{localeError:MA()}}function sg(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 LA=()=>{const e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"лік";case"object":{if(Array.isArray(n))return"масіў";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"};return n=>{switch(n.code){case"invalid_type":return`Няправільны ўвод: чакаўся ${n.expected}, атрымана ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Няправільны ўвод: чакалася ${J(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=sg(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=sg(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${i.prefix}"`:i.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${i.suffix}"`:i.format==="includes"?`Няправільны радок: павінен змяшчаць "${i.includes}"`:i.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`:`Няправільны ${o[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${R(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function FA(){return{localeError:LA()}}const VA=e=>{const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"число";case"object":{if(Array.isArray(e))return"масив";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},ZA=()=>{const e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(o){return e[o]??null}const r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"};return o=>{switch(o.code){case"invalid_type":return`Невалиден вход: очакван ${o.expected}, получен ${VA(o.input)}`;case"invalid_value":return o.values.length===1?`Невалиден вход: очакван ${J(o.values[0])}`:`Невалидна опция: очаквано едно от ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Твърде голямо: очаква се ${o.origin??"стойност"} да съдържа ${n}${o.maximum.toString()} ${i.unit??"елемента"}`:`Твърде голямо: очаква се ${o.origin??"стойност"} да бъде ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Твърде малко: очаква се ${o.origin} да съдържа ${n}${o.minimum.toString()} ${i.unit}`:`Твърде малко: очаква се ${o.origin} да бъде ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;if(n.format==="starts_with")return`Невалиден низ: трябва да започва с "${n.prefix}"`;if(n.format==="ends_with")return`Невалиден низ: трябва да завършва с "${n.suffix}"`;if(n.format==="includes")return`Невалиден низ: трябва да включва "${n.includes}"`;if(n.format==="regex")return`Невалиден низ: трябва да съвпада с ${n.pattern}`;let i="Невалиден";return n.format==="emoji"&&(i="Невалидно"),n.format==="datetime"&&(i="Невалидно"),n.format==="date"&&(i="Невалидна"),n.format==="time"&&(i="Невалидно"),n.format==="duration"&&(i="Невалидна"),`${i} ${r[n.format]??o.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${o.divisor}`;case"unrecognized_keys":return`Неразпознат${o.keys.length>1?"и":""} ключ${o.keys.length>1?"ове":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${o.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${o.origin}`;default:return"Невалиден вход"}}};function BA(){return{localeError:ZA()}}const qA=()=>{const e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipus invàlid: s'esperava ${n.expected}, s'ha rebut ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Valor invàlid: s'esperava ${J(n.values[0])}`:`Opció invàlida: s'esperava una de ${R(n.values," o ")}`;case"too_big":{const i=n.inclusive?"com a màxim":"menys de",a=t(n.origin);return a?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${a.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"com a mínim":"més de",a=t(n.origin);return a?`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${a.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Format invàlid: ha de començar amb "${i.prefix}"`:i.format==="ends_with"?`Format invàlid: ha d'acabar amb "${i.suffix}"`:i.format==="includes"?`Format invàlid: ha d'incloure "${i.includes}"`:i.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${i.pattern}`:`Format invàlid per a ${o[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function GA(){return{localeError:qA()}}const HA=()=>{const e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"číslo";case"string":return"řetězec";case"boolean":return"boolean";case"bigint":return"bigint";case"function":return"funkce";case"symbol":return"symbol";case"undefined":return"undefined";case"object":{if(Array.isArray(n))return"pole";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"};return n=>{switch(n.code){case"invalid_type":return`Neplatný vstup: očekáváno ${n.expected}, obdrženo ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neplatný vstup: očekáváno ${J(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${a.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Neplatný řetězec: musí začínat na "${i.prefix}"`:i.format==="ends_with"?`Neplatný řetězec: musí končit na "${i.suffix}"`:i.format==="includes"?`Neplatný řetězec: musí obsahovat "${i.includes}"`:i.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`:`Neplatný formát ${o[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${R(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function WA(){return{localeError:HA()}}const JA=()=>{const e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}},t={string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};function r(a){return e[a]??null}function o(a){return t[a]??a}const n=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"tal";case"object":return Array.isArray(a)?"liste":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype&&a.constructor?a.constructor.name:"objekt"}return s},i={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return a=>{switch(a.code){case"invalid_type":return`Ugyldigt input: forventede ${o(a.expected)}, fik ${o(n(a.input))}`;case"invalid_value":return a.values.length===1?`Ugyldig værdi: forventede ${J(a.values[0])}`:`Ugyldigt valg: forventede en af følgende ${R(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",c=r(a.origin),l=o(a.origin);return c?`For stor: forventede ${l??"value"} ${c.verb} ${s} ${a.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${l??"value"} havde ${s} ${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",c=r(a.origin),l=o(a.origin);return c?`For lille: forventede ${l} ${c.verb} ${s} ${a.minimum.toString()} ${c.unit}`:`For lille: forventede ${l} havde ${s} ${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Ugyldig streng: skal starte med "${s.prefix}"`:s.format==="ends_with"?`Ugyldig streng: skal ende med "${s.suffix}"`:s.format==="includes"?`Ugyldig streng: skal indeholde "${s.includes}"`:s.format==="regex"?`Ugyldig streng: skal matche mønsteret ${s.pattern}`:`Ugyldig ${i[s.format]??a.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${a.divisor}`;case"unrecognized_keys":return`${a.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${R(a.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${a.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${a.origin}`;default:return"Ugyldigt input"}}};function KA(){return{localeError:JA()}}const YA=()=>{const e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"Zahl";case"object":{if(Array.isArray(n))return"Array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"};return n=>{switch(n.code){case"invalid_type":return`Ungültige Eingabe: erwartet ${n.expected}, erhalten ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ungültige Eingabe: erwartet ${J(n.values[0])}`:`Ungültige Option: erwartet eine von ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ungültiger String: muss mit "${i.prefix}" beginnen`:i.format==="ends_with"?`Ungültiger String: muss mit "${i.suffix}" enden`:i.format==="includes"?`Ungültiger String: muss "${i.includes}" enthalten`:i.format==="regex"?`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`:`Ungültig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function XA(){return{localeError:YA()}}const QA=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},eC=()=>{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 ${QA(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${J(o.values[0])}`:`Invalid option: expected one of ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${i.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function iw(){return{localeError:eC()}}const tC=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},rC=()=>{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 ${tC(o.input)}`;case"invalid_value":return o.values.length===1?`Nevalida enigo: atendiĝis ${J(o.values[0])}`:`Nevalida opcio: atendiĝis unu el ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${i.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${i.unit}`:`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`:n.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`:n.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${n.includes}"`:n.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`:`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${R(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function nC(){return{localeError:rC()}}const oC=()=>{const e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}},t={string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};function r(a){return e[a]??null}function o(a){return t[a]??a}const n=a=>{const s=typeof a;switch(s){case"number":return Number.isNaN(a)?"NaN":"number";case"object":return Array.isArray(a)?"array":a===null?"null":Object.getPrototypeOf(a)!==Object.prototype?a.constructor.name:"object"}return s},i={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return a=>{switch(a.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(a.expected)}, recibido ${o(n(a.input))}`;case"invalid_value":return a.values.length===1?`Entrada inválida: se esperaba ${J(a.values[0])}`:`Opción inválida: se esperaba una de ${R(a.values,"|")}`;case"too_big":{const s=a.inclusive?"<=":"<",c=r(a.origin),l=o(a.origin);return c?`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${s}${a.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${l??"valor"} fuera ${s}${a.maximum.toString()}`}case"too_small":{const s=a.inclusive?">=":">",c=r(a.origin),l=o(a.origin);return c?`Demasiado pequeño: se esperaba que ${l} tuviera ${s}${a.minimum.toString()} ${c.unit}`:`Demasiado pequeño: se esperaba que ${l} fuera ${s}${a.minimum.toString()}`}case"invalid_format":{const s=a;return s.format==="starts_with"?`Cadena inválida: debe comenzar con "${s.prefix}"`:s.format==="ends_with"?`Cadena inválida: debe terminar en "${s.suffix}"`:s.format==="includes"?`Cadena inválida: debe incluir "${s.includes}"`:s.format==="regex"?`Cadena inválida: debe coincidir con el patrón ${s.pattern}`:`Inválido ${i[s.format]??a.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${a.divisor}`;case"unrecognized_keys":return`Llave${a.keys.length>1?"s":""} desconocida${a.keys.length>1?"s":""}: ${R(a.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(a.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(a.origin)}`;default:return"Entrada inválida"}}};function iC(){return{localeError:oC()}}const aC=()=>{const e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"آرایه";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"};return n=>{switch(n.code){case"invalid_type":return`ورودی نامعتبر: می‌بایست ${n.expected} می‌بود، ${r(n.input)} دریافت شد`;case"invalid_value":return n.values.length===1?`ورودی نامعتبر: می‌بایست ${J(n.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${R(n.values,"|")} می‌بود`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{const i=n;return i.format==="starts_with"?`رشته نامعتبر: باید با "${i.prefix}" شروع شود`:i.format==="ends_with"?`رشته نامعتبر: باید با "${i.suffix}" تمام شود`:i.format==="includes"?`رشته نامعتبر: باید شامل "${i.includes}" باشد`:i.format==="regex"?`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`:`${o[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${R(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function sC(){return{localeError:aC()}}const cC=()=>{const e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"};return n=>{switch(n.code){case"invalid_type":return`Virheellinen tyyppi: odotettiin ${n.expected}, oli ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Virheellinen syöte: täytyy olla ${J(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Liian suuri: ${a.subject} täytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim():`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Liian pieni: ${a.subject} täytyy olla ${i}${n.minimum.toString()} ${a.unit}`.trim():`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${i.prefix}"`:i.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${i.suffix}"`:i.format==="includes"?`Virheellinen syöte: täytyy sisältää "${i.includes}"`:i.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`:`Virheellinen ${o[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${R(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function lC(){return{localeError:cC()}}const uC=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombre";case"object":{if(Array.isArray(n))return"tableau";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : ${n.expected} attendu, ${r(n.input)} reçu`;case"invalid_value":return n.values.length===1?`Entrée invalide : ${J(n.values[0])} attendu`:`Option invalide : une valeur parmi ${R(n.values,"|")} attendue`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Trop grand : ${n.origin??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Trop petit : ${n.origin} doit ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : ${n.origin} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${i.pattern}`:`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function dC(){return{localeError:uC()}}const fC=()=>{const e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"};return n=>{switch(n.code){case"invalid_type":return`Entrée invalide : attendu ${n.expected}, reçu ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrée invalide : attendu ${J(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"≤":"<",a=t(n.origin);return a?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"≥":">",a=t(n.origin);return a?`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.unit}`:`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chaîne invalide : doit commencer par "${i.prefix}"`:i.format==="ends_with"?`Chaîne invalide : doit se terminer par "${i.suffix}"`:i.format==="includes"?`Chaîne invalide : doit inclure "${i.includes}"`:i.format==="regex"?`Chaîne invalide : doit correspondre au motif ${i.pattern}`:`${o[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${R(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function mC(){return{localeError:fC()}}const pC=()=>{const e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=l=>l?e[l]:void 0,o=l=>{const u=r(l);return u?u.label:l??e.unknown.label},n=l=>`ה${o(l)}`,i=l=>(r(l)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=l=>l?t[l]??null:null,s=l=>{const u=typeof l;switch(u){case"number":return Number.isNaN(l)?"NaN":"number";case"object":return Array.isArray(l)?"array":l===null?"null":Object.getPrototypeOf(l)!==Object.prototype&&l.constructor?l.constructor.name:"object";default:return u}},c={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}};return l=>{switch(l.code){case"invalid_type":{const u=l.expected,d=o(u),f=s(l.input),m=e[f]?.label??f;return`קלט לא תקין: צריך להיות ${d}, התקבל ${m}`}case"invalid_value":{if(l.values.length===1)return`ערך לא תקין: הערך חייב להיות ${J(l.values[0])}`;const u=l.values.map(m=>J(m));if(l.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${u[0]} או ${u[1]}`;const d=u[u.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${u.slice(0,-1).join(", ")} או ${d}`}case"too_big":{const u=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"או פחות":"לכל היותר"}`.trim();if(l.origin==="number"){const h=l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`;return`גדול מדי: ${d} צריך להיות ${h}`}if(l.origin==="array"||l.origin==="set"){const h=l.origin==="set"?"צריכה":"צריך",g=l.inclusive?`${l.maximum} ${u?.unit??""} או פחות`:`פחות מ-${l.maximum} ${u?.unit??""}`;return`גדול מדי: ${d} ${h} להכיל ${g}`.trim()}const f=l.inclusive?"<=":"<",m=i(l.origin??"value");return u?.unit?`${u.longLabel} מדי: ${d} ${m} ${f}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"גדול"} מדי: ${d} ${m} ${f}${l.maximum.toString()}`}case"too_small":{const u=a(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"או יותר":"לפחות"}`.trim();if(l.origin==="number"){const h=l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`;return`קטן מדי: ${d} צריך להיות ${h}`}if(l.origin==="array"||l.origin==="set"){const h=l.origin==="set"?"צריכה":"צריך";if(l.minimum===1&&l.inclusive){const y=(l.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${h} להכיל ${y}`}const g=l.inclusive?`${l.minimum} ${u?.unit??""} או יותר`:`יותר מ-${l.minimum} ${u?.unit??""}`;return`קטן מדי: ${d} ${h} להכיל ${g}`.trim()}const f=l.inclusive?">=":">",m=i(l.origin??"value");return u?.unit?`${u.shortLabel} מדי: ${d} ${m} ${f}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"קטן"} מדי: ${d} ${m} ${f}${l.minimum.toString()}`}case"invalid_format":{const u=l;if(u.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${u.prefix}"`;if(u.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${u.suffix}"`;if(u.format==="includes")return`המחרוזת חייבת לכלול "${u.includes}"`;if(u.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${u.pattern}`;const d=c[u.format],f=d?.label??u.format,h=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${f} לא ${h}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${R(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(l.origin??"array")}`;default:return"קלט לא תקין"}}};function gC(){return{localeError:pC()}}const hC=()=>{const e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"szám";case"object":{if(Array.isArray(n))return"tömb";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"};return n=>{switch(n.code){case"invalid_type":return`Érvénytelen bemenet: a várt érték ${n.expected}, a kapott érték ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Érvénytelen bemenet: a várt érték ${J(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${a.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${a.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`:i.format==="ends_with"?`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`:i.format==="includes"?`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`:i.format==="regex"?`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`:`Érvénytelen ${o[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function vC(){return{localeError:hC()}}const yC=()=>{const e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak valid: diharapkan ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak valid: diharapkan ${J(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`String tidak valid: harus dimulai dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak valid: harus berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak valid: harus menyertakan "${i.includes}"`:i.format==="regex"?`String tidak valid: harus sesuai pola ${i.pattern}`:`${o[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function bC(){return{localeError:yC()}}const _C=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},wC=()=>{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 ${_C(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":return o.values.length===1?`Rangt gildi: gert ráð fyrir ${J(o.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${n}${o.maximum.toString()} ${i.unit??"hluti"}`:`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} sé ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${n}${o.minimum.toString()} ${i.unit}`:`Of lítið: gert er ráð fyrir að ${o.origin} sé ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Ógildur strengur: verður að byrja á "${n.prefix}"`:n.format==="ends_with"?`Ógildur strengur: verður að enda á "${n.suffix}"`:n.format==="includes"?`Ógildur strengur: verður að innihalda "${n.includes}"`:n.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${n.pattern}`:`Rangt ${r[n.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${R(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function xC(){return{localeError:wC()}}const SC=()=>{const e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numero";case"object":{if(Array.isArray(n))return"vettore";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input non valido: atteso ${n.expected}, ricevuto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input non valido: atteso ${J(n.values[0])}`:`Opzione non valida: atteso uno tra ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.unit}`:`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Stringa non valida: deve iniziare con "${i.prefix}"`:i.format==="ends_with"?`Stringa non valida: deve terminare con "${i.suffix}"`:i.format==="includes"?`Stringa non valida: deve includere "${i.includes}"`:i.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${i.pattern}`:`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${R(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function kC(){return{localeError:SC()}}const EC=()=>{const e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"数値";case"object":{if(Array.isArray(n))return"配列";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"};return n=>{switch(n.code){case"invalid_type":return`無効な入力: ${n.expected}が期待されましたが、${r(n.input)}が入力されました`;case"invalid_value":return n.values.length===1?`無効な入力: ${J(n.values[0])}が期待されました`:`無効な選択: ${R(n.values,"、")}のいずれかである必要があります`;case"too_big":{const i=n.inclusive?"以下である":"より小さい",a=t(n.origin);return a?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${i}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{const i=n.inclusive?"以上である":"より大きい",a=t(n.origin);return a?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${i}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{const i=n;return i.format==="starts_with"?`無効な文字列: "${i.prefix}"で始まる必要があります`:i.format==="ends_with"?`無効な文字列: "${i.suffix}"で終わる必要があります`:i.format==="includes"?`無効な文字列: "${i.includes}"を含む必要があります`:i.format==="regex"?`無効な文字列: パターン${i.pattern}に一致する必要があります`:`無効な${o[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${R(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function IC(){return{localeError:EC()}}const TC=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},$C=()=>{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}, მიღებული ${TC(o.input)}`;case"invalid_value":return o.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${J(o.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${R(o.values,"|")}-დან`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${i.verb} ${n}${o.maximum.toString()} ${i.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${i.verb} ${n}${o.minimum.toString()} ${i.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${n.prefix}"-ით`:n.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${n.suffix}"-ით`:n.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${n.includes}"-ს`:n.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`:`არასწორი ${r[n.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${R(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function OC(){return{localeError:$C()}}const AC=()=>{const e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"មិនមែនជាលេខ (NaN)":"លេខ";case"object":{if(Array.isArray(n))return"អារេ (Array)";if(n===null)return"គ្មានតម្លៃ (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"};return n=>{switch(n.code){case"invalid_type":return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${n.expected} ប៉ុន្តែទទួលបាន ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${J(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`:i.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`:i.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`:i.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`:`មិនត្រឹមត្រូវ៖ ${o[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${R(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function aw(){return{localeError:AC()}}function CC(){return aw()}const NC=()=>{const e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"};return n=>{switch(n.code){case"invalid_type":return`잘못된 입력: 예상 타입은 ${n.expected}, 받은 타입은 ${r(n.input)}입니다`;case"invalid_value":return n.values.length===1?`잘못된 입력: 값은 ${J(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${R(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const i=n.inclusive?"이하":"미만",a=i==="미만"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${a}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${a}`}case"too_small":{const i=n.inclusive?"이상":"초과",a=i==="이상"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${a}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${a}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`:i.format==="ends_with"?`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`:i.format==="includes"?`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`:i.format==="regex"?`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`:`잘못된 ${o[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${R(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function RC(){return{localeError:NC()}}const PC=e=>Vo(typeof e,e),Vo=(e,t=void 0)=>{switch(e){case"number":return Number.isNaN(t)?"NaN":"skaičius";case"bigint":return"sveikasis skaičius";case"string":return"eilutė";case"boolean":return"loginė reikšmė";case"undefined":case"void":return"neapibrėžta reikšmė";case"function":return"funkcija";case"symbol":return"simbolis";case"object":return t===void 0?"nežinomas objektas":t===null?"nulinė reikšmė":Array.isArray(t)?"masyvas":Object.getPrototypeOf(t)!==Object.prototype&&t.constructor?t.constructor.name:"objektas";case"null":return"nulinė reikšmė"}return e},No=e=>e.charAt(0).toUpperCase()+e.slice(1);function cg(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 jC=()=>{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 ${PC(o.input)}, o tikėtasi - ${Vo(o.expected)}`;case"invalid_value":return o.values.length===1?`Privalo būti ${J(o.values[0])}`:`Privalo būti vienas iš ${R(o.values,"|")} pasirinkimų`;case"too_big":{const n=Vo(o.origin),i=t(o.origin,cg(Number(o.maximum)),o.inclusive??!1,"smaller");if(i?.verb)return`${No(n??o.origin??"reikšmė")} ${i.verb} ${o.maximum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${No(n??o.origin??"reikšmė")} turi būti ${a} ${o.maximum.toString()} ${i?.unit}`}case"too_small":{const n=Vo(o.origin),i=t(o.origin,cg(Number(o.minimum)),o.inclusive??!1,"bigger");if(i?.verb)return`${No(n??o.origin??"reikšmė")} ${i.verb} ${o.minimum.toString()} ${i.unit??"elementų"}`;const a=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${No(n??o.origin??"reikšmė")} turi būti ${a} ${o.minimum.toString()} ${i?.unit}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Eilutė privalo prasidėti "${n.prefix}"`:n.format==="ends_with"?`Eilutė privalo pasibaigti "${n.suffix}"`:n.format==="includes"?`Eilutė privalo įtraukti "${n.includes}"`:n.format==="regex"?`Eilutė privalo atitikti ${n.pattern}`:`Neteisingas ${r[n.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${R(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const n=Vo(o.origin);return`${No(n??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function zC(){return{localeError:jC()}}const DC=()=>{const e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"број";case"object":{if(Array.isArray(n))return"низа";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"};return n=>{switch(n.code){case"invalid_type":return`Грешен внес: се очекува ${n.expected}, примено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${J(n.values[0])}`:`Грешана опција: се очекува една ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${a.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${a.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неважечка низа: мора да започнува со "${i.prefix}"`:i.format==="ends_with"?`Неважечка низа: мора да завршува со "${i.suffix}"`:i.format==="includes"?`Неважечка низа: мора да вклучува "${i.includes}"`:i.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${i.pattern}`:`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${R(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function MC(){return{localeError:DC()}}const UC=()=>{const e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nombor";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Input tidak sah: dijangka ${n.expected}, diterima ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Input tidak sah: dijangka ${J(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`String tidak sah: mesti bermula dengan "${i.prefix}"`:i.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${i.suffix}"`:i.format==="includes"?`String tidak sah: mesti mengandungi "${i.includes}"`:i.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${i.pattern}`:`${o[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${R(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function LC(){return{localeError:UC()}}const FC=()=>{const e={string:{unit:"tekens",verb:"te hebben"},file:{unit:"bytes",verb:"te hebben"},array:{unit:"elementen",verb:"te hebben"},set:{unit:"elementen",verb:"te hebben"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"getal";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"};return n=>{switch(n.code){case"invalid_type":return`Ongeldige invoer: verwacht ${n.expected}, ontving ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ongeldige invoer: verwacht ${J(n.values[0])}`:`Ongeldige optie: verwacht één van ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Te groot: verwacht dat ${n.origin??"waarde"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elementen"}`:`Te groot: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Te klein: verwacht dat ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Te klein: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ongeldige tekst: moet met "${i.prefix}" beginnen`:i.format==="ends_with"?`Ongeldige tekst: moet op "${i.suffix}" eindigen`:i.format==="includes"?`Ongeldige tekst: moet "${i.includes}" bevatten`:i.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`:`Ongeldig: ${o[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function VC(){return{localeError:FC()}}const ZC=()=>{const e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"tall";case"object":{if(Array.isArray(n))return"liste";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Ugyldig input: forventet ${n.expected}, fikk ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ugyldig verdi: forventet ${J(n.values[0])}`:`Ugyldig valg: forventet en av ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${a.unit}`:`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ugyldig streng: må starte med "${i.prefix}"`:i.format==="ends_with"?`Ugyldig streng: må ende med "${i.suffix}"`:i.format==="includes"?`Ugyldig streng: må inneholde "${i.includes}"`:i.format==="regex"?`Ugyldig streng: må matche mønsteret ${i.pattern}`:`Ugyldig ${o[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function BC(){return{localeError:ZC()}}const qC=()=>{const e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"numara";case"object":{if(Array.isArray(n))return"saf";if(n===null)return"gayb";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"};return n=>{switch(n.code){case"invalid_type":return`Fâsit giren: umulan ${n.expected}, alınan ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Fâsit giren: umulan ${J(n.values[0])}`:`Fâsit tercih: mûteberler ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Fâsit metin: "${i.prefix}" ile başlamalı.`:i.format==="ends_with"?`Fâsit metin: "${i.suffix}" ile bitmeli.`:i.format==="includes"?`Fâsit metin: "${i.includes}" ihtivâ etmeli.`:i.format==="regex"?`Fâsit metin: ${i.pattern} nakşına uymalı.`:`Fâsit ${o[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function GC(){return{localeError:qC()}}const HC=()=>{const e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"عدد";case"object":{if(Array.isArray(n))return"ارې";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"};return n=>{switch(n.code){case"invalid_type":return`ناسم ورودي: باید ${n.expected} وای, مګر ${r(n.input)} ترلاسه شو`;case"invalid_value":return n.values.length===1?`ناسم ورودي: باید ${J(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${R(n.values,"|")} څخه وای`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{const i=n;return i.format==="starts_with"?`ناسم متن: باید د "${i.prefix}" سره پیل شي`:i.format==="ends_with"?`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`:i.format==="includes"?`ناسم متن: باید "${i.includes}" ولري`:i.format==="regex"?`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`:`${o[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${R(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function WC(){return{localeError:HC()}}const JC=()=>{const e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"liczba";case"object":{if(Array.isArray(n))return"tablica";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"};return n=>{switch(n.code){case"invalid_type":return`Nieprawidłowe dane wejściowe: oczekiwano ${n.expected}, otrzymano ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${J(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${a.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${a.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`:i.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`:i.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`:i.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`:`Nieprawidłow(y/a/e) ${o[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function KC(){return{localeError:JC()}}const YC=()=>{const e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"número";case"object":{if(Array.isArray(n))return"array";if(n===null)return"nulo";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"};return n=>{switch(n.code){case"invalid_type":return`Tipo inválido: esperado ${n.expected}, recebido ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Entrada inválida: esperado ${J(n.values[0])}`:`Opção inválida: esperada uma das ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${a.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${a.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Texto inválido: deve começar com "${i.prefix}"`:i.format==="ends_with"?`Texto inválido: deve terminar com "${i.suffix}"`:i.format==="includes"?`Texto inválido: deve incluir "${i.includes}"`:i.format==="regex"?`Texto inválido: deve corresponder ao padrão ${i.pattern}`:`${o[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function XC(){return{localeError:YC()}}function lg(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 QC=()=>{const e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"массив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"};return n=>{switch(n.code){case"invalid_type":return`Неверный ввод: ожидалось ${n.expected}, получено ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неверный ввод: ожидалось ${J(n.values[0])}`:`Неверный вариант: ожидалось одно из ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);if(a){const s=Number(n.maximum),c=lg(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=lg(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неверная строка: должна начинаться с "${i.prefix}"`:i.format==="ends_with"?`Неверная строка: должна заканчиваться на "${i.suffix}"`:i.format==="includes"?`Неверная строка: должна содержать "${i.includes}"`:i.format==="regex"?`Неверная строка: должна соответствовать шаблону ${i.pattern}`:`Неверный ${o[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function eN(){return{localeError:QC()}}const tN=()=>{const e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"število";case"object":{if(Array.isArray(n))return"tabela";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"};return n=>{switch(n.code){case"invalid_type":return`Neveljaven vnos: pričakovano ${n.expected}, prejeto ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Neveljaven vnos: pričakovano ${J(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Neveljaven niz: mora se začeti z "${i.prefix}"`:i.format==="ends_with"?`Neveljaven niz: mora se končati z "${i.suffix}"`:i.format==="includes"?`Neveljaven niz: mora vsebovati "${i.includes}"`:i.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`:`Neveljaven ${o[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${R(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function rN(){return{localeError:tN()}}const nN=()=>{const e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"antal";case"object":{if(Array.isArray(n))return"lista";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"};return n=>{switch(n.code){case"invalid_type":return`Ogiltig inmatning: förväntat ${n.expected}, fick ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ogiltig inmatning: förväntat ${J(n.values[0])}`:`Ogiltigt val: förväntade en av ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${a.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${a.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ogiltig sträng: måste börja med "${i.prefix}"`:i.format==="ends_with"?`Ogiltig sträng: måste sluta med "${i.suffix}"`:i.format==="includes"?`Ogiltig sträng: måste innehålla "${i.includes}"`:i.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`:`Ogiltig(t) ${o[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${R(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function oN(){return{localeError:nN()}}const iN=()=>{const e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"எண் அல்லாதது":"எண்";case"object":{if(Array.isArray(n))return"அணி";if(n===null)return"வெறுமை";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${n.expected}, பெறப்பட்டது ${r(n.input)}`;case"invalid_value":return n.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${J(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${R(n.values,"|")} இல் ஒன்று`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const i=n;return i.format==="starts_with"?`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`:i.format==="ends_with"?`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`:i.format==="includes"?`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`:i.format==="regex"?`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${o[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function aN(){return{localeError:iN()}}const sN=()=>{const e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"ไม่ใช่ตัวเลข (NaN)":"ตัวเลข";case"object":{if(Array.isArray(n))return"อาร์เรย์ (Array)";if(n===null)return"ไม่มีค่า (null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"};return n=>{switch(n.code){case"invalid_type":return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${n.expected} แต่ได้รับ ${r(n.input)}`;case"invalid_value":return n.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${J(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=t(n.origin);return a?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${a.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?"อย่างน้อย":"มากกว่า",a=t(n.origin);return a?`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${a.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`:i.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`:i.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`:i.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`:`รูปแบบไม่ถูกต้อง: ${o[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${R(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function cN(){return{localeError:sN()}}const lN=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},uN=()=>{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 ${lN(o.input)}`;case"invalid_value":return o.values.length===1?`Geçersiz değer: beklenen ${J(o.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${R(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",i=t(o.origin);return i?`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${i.unit??"öğe"}`:`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",i=t(o.origin);return i?`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${i.unit}`:`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${R(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function dN(){return{localeError:uN()}}const fN=()=>{const e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"число";case"object":{if(Array.isArray(n))return"масив";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"};return n=>{switch(n.code){case"invalid_type":return`Неправильні вхідні дані: очікується ${n.expected}, отримано ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Неправильні вхідні дані: очікується ${J(n.values[0])}`:`Неправильна опція: очікується одне з ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Занадто мале: очікується, що ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Неправильний рядок: повинен починатися з "${i.prefix}"`:i.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`:i.format==="includes"?`Неправильний рядок: повинен містити "${i.includes}"`:i.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`:`Неправильний ${o[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${R(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function sw(){return{localeError:fN()}}function mN(){return sw()}const pN=()=>{const e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"نمبر";case"object":{if(Array.isArray(n))return"آرے";if(n===null)return"نل";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"};return n=>{switch(n.code){case"invalid_type":return`غلط ان پٹ: ${n.expected} متوقع تھا، ${r(n.input)} موصول ہوا`;case"invalid_value":return n.values.length===1?`غلط ان پٹ: ${J(n.values[0])} متوقع تھا`:`غلط آپشن: ${R(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const i=n;return i.format==="starts_with"?`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`:i.format==="ends_with"?`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`:i.format==="includes"?`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`:i.format==="regex"?`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`:`غلط ${o[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${R(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function gN(){return{localeError:pN()}}const hN=()=>{const e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"số";case"object":{if(Array.isArray(n))return"mảng";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"};return n=>{switch(n.code){case"invalid_type":return`Đầu vào không hợp lệ: mong đợi ${n.expected}, nhận được ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Đầu vào không hợp lệ: mong đợi ${J(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`:i.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`:i.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`:i.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`:`${o[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${R(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function vN(){return{localeError:hN()}}const yN=()=>{const e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"非数字(NaN)":"数字";case"object":{if(Array.isArray(n))return"数组";if(n===null)return"空值(null)";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"};return n=>{switch(n.code){case"invalid_type":return`无效输入:期望 ${n.expected},实际接收 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`无效输入:期望 ${J(n.values[0])}`:`无效选项:期望以下之一 ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${a.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`:`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`无效字符串:必须以 "${i.prefix}" 开头`:i.format==="ends_with"?`无效字符串:必须以 "${i.suffix}" 结尾`:i.format==="includes"?`无效字符串:必须包含 "${i.includes}"`:i.format==="regex"?`无效字符串:必须满足正则表达式 ${i.pattern}`:`无效${o[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${R(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function bN(){return{localeError:yN()}}const _N=()=>{const e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"number";case"object":{if(Array.isArray(n))return"array";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"};return n=>{switch(n.code){case"invalid_type":return`無效的輸入值:預期為 ${n.expected},但收到 ${r(n.input)}`;case"invalid_value":return n.values.length===1?`無效的輸入值:預期為 ${J(n.values[0])}`:`無效的選項:預期為以下其中之一 ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${a.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${a.unit}`:`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`無效的字串:必須以 "${i.prefix}" 開頭`:i.format==="ends_with"?`無效的字串:必須以 "${i.suffix}" 結尾`:i.format==="includes"?`無效的字串:必須包含 "${i.includes}"`:i.format==="regex"?`無效的字串:必須符合格式 ${i.pattern}`:`無效的 ${o[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${R(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function wN(){return{localeError:_N()}}const xN=()=>{const e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(n){return e[n]??null}const r=n=>{const i=typeof n;switch(i){case"number":return Number.isNaN(n)?"NaN":"nọ́mbà";case"object":{if(Array.isArray(n))return"akopọ";if(n===null)return"null";if(Object.getPrototypeOf(n)!==Object.prototype&&n.constructor)return n.constructor.name}}return i},o={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"};return n=>{switch(n.code){case"invalid_type":return`Ìbáwọlé aṣìṣe: a ní láti fi ${n.expected}, àmọ̀ a rí ${r(n.input)}`;case"invalid_value":return n.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${J(n.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${R(n.values,"|")}`;case"too_big":{const i=n.inclusive?"<=":"<",a=t(n.origin);return a?`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${i}${n.maximum}`}case"too_small":{const i=n.inclusive?">=":">",a=t(n.origin);return a?`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${a.verb} ${i}${n.minimum} ${a.unit}`:`Kéré ju: a ní láti jẹ́ ${i}${n.minimum}`}case"invalid_format":{const i=n;return i.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`:i.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`:i.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`:i.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`:`Aṣìṣe: ${o[i.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${R(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function SN(){return{localeError:xN()}}const cw=Object.freeze(Object.defineProperty({__proto__:null,ar:DA,az:UA,be:FA,bg:BA,ca:GA,cs:WA,da:KA,de:XA,en:iw,eo:nC,es:iC,fa:sC,fi:lC,fr:dC,frCA:mC,he:gC,hu:vC,id:bC,is:xC,it:kC,ja:IC,ka:OC,kh:CC,km:aw,ko:RC,lt:zC,mk:MC,ms:LC,nl:VC,no:BC,ota:GC,pl:KC,ps:WC,pt:XC,ru:eN,sl:rN,sv:oN,ta:aN,th:cN,tr:dN,ua:mN,uk:sw,ur:gN,vi:vN,yo:SN,zhCN:bN,zhTW:wN},Symbol.toStringTag,{value:"Module"}));var ug;const lw=Symbol("ZodOutput"),uw=Symbol("ZodInput");class dw{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 qd(){return new dw}(ug=globalThis).__zod_globalRegistry??(ug.__zod_globalRegistry=qd());const Vt=globalThis.__zod_globalRegistry;function fw(e,t){return new e({type:"string",...N(t)})}function mw(e,t){return new e({type:"string",coerce:!0,...N(t)})}function Gd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...N(t)})}function es(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...N(t)})}function Hd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...N(t)})}function Wd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...N(t)})}function Jd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...N(t)})}function Kd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...N(t)})}function Ls(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...N(t)})}function Yd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...N(t)})}function Xd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...N(t)})}function Qd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...N(t)})}function ef(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...N(t)})}function tf(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...N(t)})}function rf(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...N(t)})}function nf(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...N(t)})}function of(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...N(t)})}function af(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...N(t)})}function pw(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...N(t)})}function sf(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...N(t)})}function cf(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...N(t)})}function lf(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...N(t)})}function uf(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...N(t)})}function df(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...N(t)})}function ff(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...N(t)})}const gw={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function hw(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...N(t)})}function vw(e,t){return new e({type:"string",format:"date",check:"string_format",...N(t)})}function yw(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...N(t)})}function bw(e,t){return new e({type:"string",format:"duration",check:"string_format",...N(t)})}function _w(e,t){return new e({type:"number",checks:[],...N(t)})}function ww(e,t){return new e({type:"number",coerce:!0,checks:[],...N(t)})}function xw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...N(t)})}function Sw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...N(t)})}function kw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...N(t)})}function Ew(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...N(t)})}function Iw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...N(t)})}function Tw(e,t){return new e({type:"boolean",...N(t)})}function $w(e,t){return new e({type:"boolean",coerce:!0,...N(t)})}function Ow(e,t){return new e({type:"bigint",...N(t)})}function Aw(e,t){return new e({type:"bigint",coerce:!0,...N(t)})}function Cw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...N(t)})}function Nw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...N(t)})}function Rw(e,t){return new e({type:"symbol",...N(t)})}function Pw(e,t){return new e({type:"undefined",...N(t)})}function jw(e,t){return new e({type:"null",...N(t)})}function zw(e){return new e({type:"any"})}function Dw(e){return new e({type:"unknown"})}function Mw(e,t){return new e({type:"never",...N(t)})}function Uw(e,t){return new e({type:"void",...N(t)})}function Lw(e,t){return new e({type:"date",...N(t)})}function Fw(e,t){return new e({type:"date",coerce:!0,...N(t)})}function Vw(e,t){return new e({type:"nan",...N(t)})}function Rr(e,t){return new Dd({check:"less_than",...N(t),value:e,inclusive:!1})}function At(e,t){return new Dd({check:"less_than",...N(t),value:e,inclusive:!0})}function Pr(e,t){return new Md({check:"greater_than",...N(t),value:e,inclusive:!1})}function dt(e,t){return new Md({check:"greater_than",...N(t),value:e,inclusive:!0})}function mf(e){return Pr(0,e)}function pf(e){return Rr(0,e)}function gf(e){return At(0,e)}function hf(e){return dt(0,e)}function Jn(e,t){return new Ib({check:"multiple_of",...N(t),value:e})}function Ni(e,t){return new Ob({check:"max_size",...N(t),maximum:e})}function Kn(e,t){return new Ab({check:"min_size",...N(t),minimum:e})}function Fs(e,t){return new Cb({check:"size_equals",...N(t),size:e})}function Ri(e,t){return new Nb({check:"max_length",...N(t),maximum:e})}function on(e,t){return new Rb({check:"min_length",...N(t),minimum:e})}function Pi(e,t){return new Pb({check:"length_equals",...N(t),length:e})}function Vs(e,t){return new jb({check:"string_format",format:"regex",...N(t),pattern:e})}function Zs(e){return new zb({check:"string_format",format:"lowercase",...N(e)})}function Bs(e){return new Db({check:"string_format",format:"uppercase",...N(e)})}function qs(e,t){return new Mb({check:"string_format",format:"includes",...N(t),includes:e})}function Gs(e,t){return new Ub({check:"string_format",format:"starts_with",...N(t),prefix:e})}function Hs(e,t){return new Lb({check:"string_format",format:"ends_with",...N(t),suffix:e})}function vf(e,t,r){return new Fb({check:"property",property:e,schema:t,...N(r)})}function Ws(e,t){return new Vb({check:"mime_type",mime:e,...N(t)})}function xr(e){return new Zb({check:"overwrite",tx:e})}function Js(e){return xr(t=>t.normalize(e))}function Ks(){return xr(e=>e.trim())}function Ys(){return xr(e=>e.toLowerCase())}function Xs(){return xr(e=>e.toUpperCase())}function Qs(){return xr(e=>xy(e))}function Zw(e,t,r){return new e({type:"array",element:t,...N(r)})}function kN(e,t,r){return new e({type:"union",options:t,...N(r)})}function EN(e,t,r){return new e({type:"union",options:t,inclusive:!1,...N(r)})}function IN(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...N(o)})}function TN(e,t,r){return new e({type:"intersection",left:t,right:r})}function $N(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,...N(i)})}function ON(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...N(o)})}function AN(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...N(o)})}function CN(e,t,r){return new e({type:"set",valueType:t,...N(r)})}function NN(e,t,r){const o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...N(r)})}function RN(e,t,r){return new e({type:"enum",entries:t,...N(r)})}function PN(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...N(r)})}function Bw(e,t){return new e({type:"file",...N(t)})}function jN(e,t){return new e({type:"transform",transform:t})}function zN(e,t){return new e({type:"optional",innerType:t})}function DN(e,t){return new e({type:"nullable",innerType:t})}function MN(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():zs(r)}})}function UN(e,t,r){return new e({type:"nonoptional",innerType:t,...N(r)})}function LN(e,t){return new e({type:"success",innerType:t})}function FN(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function VN(e,t,r){return new e({type:"pipe",in:t,out:r})}function ZN(e,t){return new e({type:"readonly",innerType:t})}function BN(e,t,r){return new e({type:"template_literal",parts:t,...N(r)})}function qN(e,t){return new e({type:"lazy",getter:t})}function GN(e,t){return new e({type:"promise",innerType:t})}function qw(e,t,r){const o=N(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Gw(e,t,r){return new e({type:"custom",check:"custom",fn:t,...N(r)})}function Hw(e){const t=Ww(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 Ww(e,t){const r=new Ae({check:"custom",...N(t)});return r._zod.check=e,r}function Jw(e){const t=new Ae({check:"describe"});return t._zod.onattach=[r=>{const o=Vt.get(r)??{};Vt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Kw(e){const t=new Ae({check:"meta"});return t._zod.onattach=[r=>{const o=Vt.get(r)??{};Vt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Yw(e,t){const r=N(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??Bd,c=e.Boolean??Fd,l=e.String??Ci,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),f=new s({type:"pipe",in:u,out:d,transform:((m,h)=>{let g=m;return r.case!=="sensitive"&&(g=g.toLowerCase()),i.has(g)?!0:a.has(g)?!1:(h.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:h.value,inst:f,continue:!1}),{})}),reverseTransform:((m,h)=>m===!0?o[0]||"true":n[0]||"false"),error:r.error});return f}function ji(e,t,r,o={}){const n=N(o),i={...N(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(i.pattern=r),new e(i)}function Yn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Vt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function ke(e,t,r={path:[],schemaPath:[]}){var o;const n=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{const u={...r,schemaPath:[...r.schemaPath,e],path:r.path},d=e._zod.parent;if(d)a.ref=d,ke(d,t,u),t.seen.get(d).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,u);else{const f=a.schema,m=t.processors[n.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);m(e,t,f,u)}}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&it(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Xn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(i[0])?.id,d=e.external.uri??(m=>m);if(u)return{ref:d(u)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${d("__shared")}#/${a}/${f}`}}if(i[1]===r)return{ref:"#"};const c=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+l}},n=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:s,defId:c}=o(i);a.def={...a.schema},c&&(a.defId=c);const l=a.schema;for(const u in l)delete l[u];l.$ref=s};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
30
-
31
- 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:Xo(t,"input"),output:Xo(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 Xw=(e,t={})=>r=>{const o=Yn({...r,processors:t});return ke(e,o),Xn(o,e),Qn(o,e)},Xo=(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)},HN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qw=(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=HN[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}))])}},e0=(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)},t0=(e,t,r,o)=>{r.type="boolean"},r0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},n0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},o0=(e,t,r,o)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},i0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},a0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},s0=(e,t,r,o)=>{r.not={}},c0=(e,t,r,o)=>{},l0=(e,t,r,o)=>{},u0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},d0=(e,t,r,o)=>{const n=e._zod.def,i=xd(n.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},f0=(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},m0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},p0=(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},g0=(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)},h0=(e,t,r,o)=>{r.type="boolean"},v0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},y0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},b0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},_0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},w0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},x0=(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"]})},S0=(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)},yf=(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},k0=(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},E0=(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)},I0=(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"]})},T0=(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"}]},$0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},O0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},A0=(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)))},C0=(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},N0=(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},R0=(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},P0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},j0=(e,t,r,o)=>{const n=e._zod.def;ke(n.innerType,t,o);const i=t.seen.get(e);i.ref=n.innerType},z0=(e,t,r,o)=>{const n=e._zod.innerType;ke(n,t,o);const i=t.seen.get(e);i.ref=n},Eu={string:Qw,number:e0,boolean:t0,bigint:r0,symbol:n0,null:o0,undefined:i0,void:a0,never:s0,any:c0,unknown:l0,date:u0,enum:d0,literal:f0,nan:m0,template_literal:p0,file:g0,success:h0,custom:v0,function:y0,transform:b0,map:_0,set:w0,array:x0,object:S0,union:yf,intersection:k0,tuple:E0,record:I0,nullable:T0,nonoptional:$0,default:O0,prefault:A0,catch:C0,pipe:N0,readonly:R0,promise:P0,optional:j0,lazy:z0};function bf(e,t){if("_idmap"in e){const o=e,n=Yn({...t,processors:Eu}),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:Eu});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:Eu,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 JN=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),KN=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:k_,$ZodArray:O_,$ZodAsyncError:tn,$ZodBase64:f_,$ZodBase64URL:p_,$ZodBigInt:Vd,$ZodBigIntFormat:__,$ZodBoolean:Fd,$ZodCIDRv4:u_,$ZodCIDRv6:d_,$ZodCUID:Xb,$ZodCUID2:Qb,$ZodCatch:K_,$ZodCheck:Ae,$ZodCheckBigIntFormat:$b,$ZodCheckEndsWith:Lb,$ZodCheckGreaterThan:Md,$ZodCheckIncludes:Mb,$ZodCheckLengthEquals:Pb,$ZodCheckLessThan:Dd,$ZodCheckLowerCase:zb,$ZodCheckMaxLength:Nb,$ZodCheckMaxSize:Ob,$ZodCheckMimeType:Vb,$ZodCheckMinLength:Rb,$ZodCheckMinSize:Ab,$ZodCheckMultipleOf:Ib,$ZodCheckNumberFormat:Tb,$ZodCheckOverwrite:Zb,$ZodCheckProperty:Fb,$ZodCheckRegex:jb,$ZodCheckSizeEquals:Cb,$ZodCheckStartsWith:Ub,$ZodCheckStringFormat:Ai,$ZodCheckUpperCase:Db,$ZodCodec:Bd,$ZodCustom:ow,$ZodCustomStringFormat:y_,$ZodDate:$_,$ZodDefault:G_,$ZodDiscriminatedUnion:j_,$ZodE164:g_,$ZodEmail:Wb,$ZodEmoji:Kb,$ZodEncodeError:Ps,$ZodEnum:L_,$ZodError:kd,$ZodFile:V_,$ZodFunction:tw,$ZodGUID:Gb,$ZodIPv4:s_,$ZodIPv6:c_,$ZodISODate:o_,$ZodISODateTime:n_,$ZodISODuration:a_,$ZodISOTime:i_,$ZodIntersection:z_,$ZodJWT:v_,$ZodKSUID:r_,$ZodLazy:nw,$ZodLiteral:F_,$ZodMAC:l_,$ZodMap:M_,$ZodNaN:Y_,$ZodNanoID:Yb,$ZodNever:I_,$ZodNonOptional:W_,$ZodNull:S_,$ZodNullable:q_,$ZodNumber:Ld,$ZodNumberFormat:b_,$ZodObject:N_,$ZodObjectJIT:R_,$ZodOptional:B_,$ZodPipe:X_,$ZodPrefault:H_,$ZodPromise:rw,$ZodReadonly:Q_,$ZodRealError:Et,$ZodRecord:D_,$ZodRegistry:dw,$ZodSet:U_,$ZodString:Ci,$ZodStringFormat:Ee,$ZodSuccess:J_,$ZodSymbol:w_,$ZodTemplateLiteral:ew,$ZodTransform:Z_,$ZodTuple:Zd,$ZodType:Y,$ZodULID:e_,$ZodURL:Jb,$ZodUUID:Hb,$ZodUndefined:x_,$ZodUnion:Us,$ZodUnknown:E_,$ZodVoid:T_,$ZodXID:t_,$ZodXor:P_,$brand:_y,$constructor:T,$input:uw,$output:lw,Doc:Bb,JSONSchema:JN,JSONSchemaGenerator:WN,NEVER:wd,TimePrecision:gw,_any:zw,_array:Zw,_base64:lf,_base64url:uf,_bigint:Ow,_boolean:Tw,_catch:FN,_check:Ww,_cidrv4:sf,_cidrv6:cf,_coercedBigint:Aw,_coercedBoolean:$w,_coercedDate:Fw,_coercedNumber:ww,_coercedString:mw,_cuid:Qd,_cuid2:ef,_custom:qw,_date:Lw,_decode:$d,_decodeAsync:Ad,_default:MN,_discriminatedUnion:IN,_e164:df,_email:Gd,_emoji:Yd,_encode:Td,_encodeAsync:Od,_endsWith:Hs,_enum:NN,_file:Bw,_float32:Sw,_float64:kw,_gt:Pr,_gte:dt,_guid:es,_includes:qs,_int:xw,_int32:Ew,_int64:Cw,_intersection:TN,_ipv4:of,_ipv6:af,_isoDate:vw,_isoDateTime:hw,_isoDuration:bw,_isoTime:yw,_jwt:ff,_ksuid:nf,_lazy:qN,_length:Pi,_literal:PN,_lowercase:Zs,_lt:Rr,_lte:At,_mac:pw,_map:AN,_max:At,_maxLength:Ri,_maxSize:Ni,_mime:Ws,_min:dt,_minLength:on,_minSize:Kn,_multipleOf:Jn,_nan:Vw,_nanoid:Xd,_nativeEnum:RN,_negative:pf,_never:Mw,_nonnegative:hf,_nonoptional:UN,_nonpositive:gf,_normalize:Js,_null:jw,_nullable:DN,_number:_w,_optional:zN,_overwrite:xr,_parse:ki,_parseAsync:Ei,_pipe:VN,_positive:mf,_promise:GN,_property:vf,_readonly:ZN,_record:ON,_refine:Gw,_regex:Vs,_safeDecode:Nd,_safeDecodeAsync:Pd,_safeEncode:Cd,_safeEncodeAsync:Rd,_safeParse:Ii,_safeParseAsync:Ti,_set:CN,_size:Fs,_slugify:Qs,_startsWith:Gs,_string:fw,_stringFormat:ji,_stringbool:Yw,_success:LN,_superRefine:Hw,_symbol:Rw,_templateLiteral:BN,_toLowerCase:Ys,_toUpperCase:Xs,_transform:jN,_trim:Ks,_tuple:$N,_uint32:Iw,_uint64:Nw,_ulid:tf,_undefined:Pw,_union:kN,_unknown:Dw,_uppercase:Bs,_url:Ls,_uuid:Hd,_uuidv4:Wd,_uuidv6:Jd,_uuidv7:Kd,_void:Uw,_xid:rf,_xor:EN,clone:Rt,config:Xe,createStandardJSONSchemaMethod:Xo,createToJSONSchemaMethod:Xw,decode:iA,decodeAsync:sA,describe:Jw,encode:oA,encodeAsync:aA,extractDefs:Xn,finalize:Qn,flattenError:Ed,formatError:Id,globalConfig:Ka,globalRegistry:Vt,initializeContext:Yn,isValidBase64:Ud,isValidBase64URL:m_,isValidJWT:h_,locales:cw,meta:Kw,parse:xu,parseAsync:Su,prettifyError:Fy,process:ke,regexes:zd,registry:qd,safeDecode:lA,safeDecodeAsync:dA,safeEncode:cA,safeEncodeAsync:uA,safeParse:Vy,safeParseAsync:Zy,toDotPath:Ly,toJSONSchema:bf,treeifyError:Uy,util:Dy,version:qb},Symbol.toStringTag,{value:"Module"})),YN=Object.freeze(Object.defineProperty({__proto__:null,endsWith:Hs,gt:Pr,gte:dt,includes:qs,length:Pi,lowercase:Zs,lt:Rr,lte:At,maxLength:Ri,maxSize:Ni,mime:Ws,minLength:on,minSize:Kn,multipleOf:Jn,negative:pf,nonnegative:hf,nonpositive:gf,normalize:Js,overwrite:xr,positive:mf,property:vf,regex:Vs,size:Fs,slugify:Qs,startsWith:Gs,toLowerCase:Ys,toUpperCase:Xs,trim:Ks,uppercase:Bs},Symbol.toStringTag,{value:"Module"})),_f=T("ZodISODateTime",(e,t)=>{n_.init(e,t),Ie.init(e,t)});function D0(e){return hw(_f,e)}const wf=T("ZodISODate",(e,t)=>{o_.init(e,t),Ie.init(e,t)});function M0(e){return vw(wf,e)}const xf=T("ZodISOTime",(e,t)=>{i_.init(e,t),Ie.init(e,t)});function U0(e){return yw(xf,e)}const Sf=T("ZodISODuration",(e,t)=>{a_.init(e,t),Ie.init(e,t)});function L0(e){return bw(Sf,e)}const F0=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:wf,ZodISODateTime:_f,ZodISODuration:Sf,ZodISOTime:xf,date:M0,datetime:D0,duration:L0,time:U0},Symbol.toStringTag,{value:"Module"})),V0=(e,t)=>{kd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Id(e,r)},flatten:{value:r=>Ed(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ya,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ya,2)}},isEmpty:{get(){return e.issues.length===0}}})},XN=T("ZodError",V0),It=T("ZodError",V0,{Parent:Error}),Z0=ki(It),B0=Ei(It),q0=Ii(It),kf=Ti(It),G0=Td(It),H0=$d(It),W0=Od(It),J0=Ad(It),K0=Cd(It),Y0=Nd(It),X0=Rd(It),Q0=Pd(It),se=T("ZodType",(e,t)=>(Y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Xo(e,"input"),output:Xo(e,"output")}}),e.toJSONSchema=Xw(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(wr(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})),e.clone=(r,o)=>Rt(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)=>q0(e,r,o),e.parseAsync=async(r,o)=>B0(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>kf(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>G0(e,r,o),e.decode=(r,o)=>H0(e,r,o),e.encodeAsync=async(r,o)=>W0(e,r,o),e.decodeAsync=async(r,o)=>J0(e,r,o),e.safeEncode=(r,o)=>K0(e,r,o),e.safeDecode=(r,o)=>Y0(e,r,o),e.safeEncodeAsync=async(r,o)=>X0(e,r,o),e.safeDecodeAsync=async(r,o)=>Q0(e,r,o),e.refine=(r,o)=>e.check(lm(r,o)),e.superRefine=r=>e.check(um(r)),e.overwrite=r=>e.check(xr(r)),e.optional=()=>ne(e),e.nullable=()=>ei(e),e.nullish=()=>ne(ei(e)),e.nonoptional=r=>Yf(e,r),e.array=()=>z(e),e.or=r=>fe([e,r]),e.and=r=>Mf(e,r),e.transform=r=>ti(e,xc(r)),e.default=r=>Wf(e,r),e.prefault=r=>Kf(e,r),e.catch=r=>em(e,r),e.pipe=r=>ti(e,r),e.readonly=()=>nm(e),e.describe=r=>{const o=e.clone();return Vt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Vt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Vt.get(e);const o=e.clone();return Vt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ec=T("_ZodString",(e,t)=>{Ci.init(e,t),se.init(e,t),e._zod.processJSONSchema=(o,n,i)=>Qw(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(Vs(...o)),e.includes=(...o)=>e.check(qs(...o)),e.startsWith=(...o)=>e.check(Gs(...o)),e.endsWith=(...o)=>e.check(Hs(...o)),e.min=(...o)=>e.check(on(...o)),e.max=(...o)=>e.check(Ri(...o)),e.length=(...o)=>e.check(Pi(...o)),e.nonempty=(...o)=>e.check(on(1,...o)),e.lowercase=o=>e.check(Zs(o)),e.uppercase=o=>e.check(Bs(o)),e.trim=()=>e.check(Ks()),e.normalize=(...o)=>e.check(Js(...o)),e.toLowerCase=()=>e.check(Ys()),e.toUpperCase=()=>e.check(Xs()),e.slugify=()=>e.check(Qs())}),zi=T("ZodString",(e,t)=>{Ci.init(e,t),ec.init(e,t),e.email=r=>e.check(Gd(tc,r)),e.url=r=>e.check(Ls(Di,r)),e.jwt=r=>e.check(ff(vc,r)),e.emoji=r=>e.check(Yd(rc,r)),e.guid=r=>e.check(es(Qo,r)),e.uuid=r=>e.check(Hd(Qt,r)),e.uuidv4=r=>e.check(Wd(Qt,r)),e.uuidv6=r=>e.check(Jd(Qt,r)),e.uuidv7=r=>e.check(Kd(Qt,r)),e.nanoid=r=>e.check(Xd(nc,r)),e.guid=r=>e.check(es(Qo,r)),e.cuid=r=>e.check(Qd(oc,r)),e.cuid2=r=>e.check(ef(ic,r)),e.ulid=r=>e.check(tf(ac,r)),e.base64=r=>e.check(lf(mc,r)),e.base64url=r=>e.check(uf(gc,r)),e.xid=r=>e.check(rf(sc,r)),e.ksuid=r=>e.check(nf(cc,r)),e.ipv4=r=>e.check(of(lc,r)),e.ipv6=r=>e.check(af(uc,r)),e.cidrv4=r=>e.check(sf(dc,r)),e.cidrv6=r=>e.check(cf(fc,r)),e.e164=r=>e.check(df(hc,r)),e.datetime=r=>e.check(D0(r)),e.date=r=>e.check(M0(r)),e.time=r=>e.check(U0(r)),e.duration=r=>e.check(L0(r))});function S(e){return fw(zi,e)}const Ie=T("ZodStringFormat",(e,t)=>{Ee.init(e,t),ec.init(e,t)}),tc=T("ZodEmail",(e,t)=>{Wb.init(e,t),Ie.init(e,t)});function ex(e){return Gd(tc,e)}const Qo=T("ZodGUID",(e,t)=>{Gb.init(e,t),Ie.init(e,t)});function tx(e){return es(Qo,e)}const Qt=T("ZodUUID",(e,t)=>{Hb.init(e,t),Ie.init(e,t)});function rx(e){return Hd(Qt,e)}function nx(e){return Wd(Qt,e)}function ox(e){return Jd(Qt,e)}function ix(e){return Kd(Qt,e)}const Di=T("ZodURL",(e,t)=>{Jb.init(e,t),Ie.init(e,t)});function ax(e){return Ls(Di,e)}function sx(e){return Ls(Di,{protocol:/^https?$/,hostname:cb,...N(e)})}const rc=T("ZodEmoji",(e,t)=>{Kb.init(e,t),Ie.init(e,t)});function cx(e){return Yd(rc,e)}const nc=T("ZodNanoID",(e,t)=>{Yb.init(e,t),Ie.init(e,t)});function lx(e){return Xd(nc,e)}const oc=T("ZodCUID",(e,t)=>{Xb.init(e,t),Ie.init(e,t)});function ux(e){return Qd(oc,e)}const ic=T("ZodCUID2",(e,t)=>{Qb.init(e,t),Ie.init(e,t)});function dx(e){return ef(ic,e)}const ac=T("ZodULID",(e,t)=>{e_.init(e,t),Ie.init(e,t)});function fx(e){return tf(ac,e)}const sc=T("ZodXID",(e,t)=>{t_.init(e,t),Ie.init(e,t)});function mx(e){return rf(sc,e)}const cc=T("ZodKSUID",(e,t)=>{r_.init(e,t),Ie.init(e,t)});function px(e){return nf(cc,e)}const lc=T("ZodIPv4",(e,t)=>{s_.init(e,t),Ie.init(e,t)});function gx(e){return of(lc,e)}const Ef=T("ZodMAC",(e,t)=>{l_.init(e,t),Ie.init(e,t)});function hx(e){return pw(Ef,e)}const uc=T("ZodIPv6",(e,t)=>{c_.init(e,t),Ie.init(e,t)});function vx(e){return af(uc,e)}const dc=T("ZodCIDRv4",(e,t)=>{u_.init(e,t),Ie.init(e,t)});function yx(e){return sf(dc,e)}const fc=T("ZodCIDRv6",(e,t)=>{d_.init(e,t),Ie.init(e,t)});function bx(e){return cf(fc,e)}const mc=T("ZodBase64",(e,t)=>{f_.init(e,t),Ie.init(e,t)});function pc(e){return lf(mc,e)}const gc=T("ZodBase64URL",(e,t)=>{p_.init(e,t),Ie.init(e,t)});function _x(e){return uf(gc,e)}const hc=T("ZodE164",(e,t)=>{g_.init(e,t),Ie.init(e,t)});function wx(e){return df(hc,e)}const vc=T("ZodJWT",(e,t)=>{v_.init(e,t),Ie.init(e,t)});function xx(e){return ff(vc,e)}const fo=T("ZodCustomStringFormat",(e,t)=>{y_.init(e,t),Ie.init(e,t)});function Sx(e,t,r={}){return ji(fo,e,t,r)}function kx(e){return ji(fo,"hostname",sb,e)}function Ex(e){return ji(fo,"hex",kb,e)}function Ix(e,t){const r=t?.enc??"hex",o=`${e}_${r}`,n=zd[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return ji(fo,o,n,t)}const Mi=T("ZodNumber",(e,t)=>{Ld.init(e,t),se.init(e,t),e._zod.processJSONSchema=(o,n,i)=>e0(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(At(o,n)),e.max=(o,n)=>e.check(At(o,n)),e.int=o=>e.check(ts(o)),e.safe=o=>e.check(ts(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(At(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 B(e){return _w(Mi,e)}const gn=T("ZodNumberFormat",(e,t)=>{b_.init(e,t),Mi.init(e,t)});function ts(e){return xw(gn,e)}function Tx(e){return Sw(gn,e)}function $x(e){return kw(gn,e)}function Ox(e){return Ew(gn,e)}function Ax(e){return Iw(gn,e)}const Ui=T("ZodBoolean",(e,t)=>{Fd.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>t0(e,r,o)});function mt(e){return Tw(Ui,e)}const Li=T("ZodBigInt",(e,t)=>{Vd.init(e,t),se.init(e,t),e._zod.processJSONSchema=(o,n,i)=>r0(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(At(o,n)),e.max=(o,n)=>e.check(At(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(At(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 Cx(e){return Ow(Li,e)}const yc=T("ZodBigIntFormat",(e,t)=>{__.init(e,t),Li.init(e,t)});function Nx(e){return Cw(yc,e)}function Rx(e){return Nw(yc,e)}const If=T("ZodSymbol",(e,t)=>{w_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>n0(e,r)});function Px(e){return Rw(If,e)}const Tf=T("ZodUndefined",(e,t)=>{x_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>i0(e,r)});function jx(e){return Pw(Tf,e)}const $f=T("ZodNull",(e,t)=>{S_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>o0(e,r,o)});function bc(e){return jw($f,e)}const Of=T("ZodAny",(e,t)=>{k_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>c0()});function Me(){return zw(Of)}const Af=T("ZodUnknown",(e,t)=>{E_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>l0()});function Qe(){return Dw(Af)}const Cf=T("ZodNever",(e,t)=>{I_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>s0(e,r,o)});function _c(e){return Mw(Cf,e)}const Nf=T("ZodVoid",(e,t)=>{T_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>a0(e,r)});function zx(e){return Uw(Nf,e)}const wc=T("ZodDate",(e,t)=>{$_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(o,n,i)=>u0(e,o),e.min=(o,n)=>e.check(dt(o,n)),e.max=(o,n)=>e.check(At(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 Dx(e){return Lw(wc,e)}const Rf=T("ZodArray",(e,t)=>{O_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>x0(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(Ri(r,o)),e.length=(r,o)=>e.check(Pi(r,o)),e.unwrap=()=>e.element});function z(e,t){return Zw(Rf,e,t)}function Mx(e){const t=e._zod.def.shape;return hn(Object.keys(t))}const Fi=T("ZodObject",(e,t)=>{R_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>S0(e,r,o,n),de(e,"shape",()=>t.shape),e.keyof=()=>hn(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Qe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Qe()}),e.strict=()=>e.clone({...e._zod.def,catchall:_c()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Ay(e,r),e.safeExtend=r=>Cy(e,r),e.merge=r=>Ny(e,r),e.pick=r=>$y(e,r),e.omit=r=>Oy(e,r),e.partial=(...r)=>Ry(Sc,e,r[0]),e.required=(...r)=>Py(kc,e,r[0])});function O(e,t){const r={type:"object",shape:e??{},...N(t)};return new Fi(r)}function Ux(e,t){return new Fi({type:"object",shape:e,catchall:_c(),...N(t)})}function Ir(e,t){return new Fi({type:"object",shape:e,catchall:Qe(),...N(t)})}const Vi=T("ZodUnion",(e,t)=>{Us.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yf(e,r,o,n),e.options=t.options});function fe(e,t){return new Vi({type:"union",options:e,...N(t)})}const Pf=T("ZodXor",(e,t)=>{Vi.init(e,t),P_.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yf(e,r,o,n),e.options=t.options});function Lx(e,t){return new Pf({type:"union",options:e,inclusive:!1,...N(t)})}const jf=T("ZodDiscriminatedUnion",(e,t)=>{Vi.init(e,t),j_.init(e,t)});function zf(e,t,r){return new jf({type:"union",options:t,discriminator:e,...N(r)})}const Df=T("ZodIntersection",(e,t)=>{z_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k0(e,r,o,n)});function Mf(e,t){return new Df({type:"intersection",left:e,right:t})}const Uf=T("ZodTuple",(e,t)=>{Zd.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E0(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Lf(e,t,r){const o=t instanceof Y,n=o?r:t,i=o?t:null;return new Uf({type:"tuple",items:e,rest:i,...N(n)})}const Zi=T("ZodRecord",(e,t)=>{D_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I0(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function nr(e,t,r){return new Zi({type:"record",keyType:e,valueType:t,...N(r)})}function Fx(e,t,r){const o=Rt(e);return o._zod.values=void 0,new Zi({type:"record",keyType:o,valueType:t,...N(r)})}function Vx(e,t,r){return new Zi({type:"record",keyType:e,valueType:t,mode:"loose",...N(r)})}const Ff=T("ZodMap",(e,t)=>{M_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_0(e,r),e.keyType=t.keyType,e.valueType=t.valueType});function Zx(e,t,r){return new Ff({type:"map",keyType:e,valueType:t,...N(r)})}const Vf=T("ZodSet",(e,t)=>{U_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>w0(e,r),e.min=(...r)=>e.check(Kn(...r)),e.nonempty=r=>e.check(Kn(1,r)),e.max=(...r)=>e.check(Ni(...r)),e.size=(...r)=>e.check(Fs(...r))});function Bx(e,t){return new Vf({type:"set",valueType:e,...N(t)})}const eo=T("ZodEnum",(e,t)=>{L_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(o,n,i)=>d0(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:[],...N(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:[],...N(n),entries:i})}});function hn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new eo({type:"enum",entries:r,...N(t)})}function qx(e,t){return new eo({type:"enum",entries:e,...N(t)})}const Zf=T("ZodLiteral",(e,t)=>{F_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>f0(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 q(e,t){return new Zf({type:"literal",values:Array.isArray(e)?e:[e],...N(t)})}const Bf=T("ZodFile",(e,t)=>{V_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>g0(e,r,o),e.min=(r,o)=>e.check(Kn(r,o)),e.max=(r,o)=>e.check(Ni(r,o)),e.mime=(r,o)=>e.check(Ws(Array.isArray(r)?r:[r],o))});function Gx(e){return Bw(Bf,e)}const qf=T("ZodTransform",(e,t)=>{Z_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>b0(e,r),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Ps(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 xc(e){return new qf({type:"transform",transform:e})}const Sc=T("ZodOptional",(e,t)=>{B_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>j0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ne(e){return new Sc({type:"optional",innerType:e})}const Gf=T("ZodNullable",(e,t)=>{q_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>T0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ei(e){return new Gf({type:"nullable",innerType:e})}function Hx(e){return ne(ei(e))}const Hf=T("ZodDefault",(e,t)=>{G_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wf(e,t){return new Hf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():zs(t)}})}const Jf=T("ZodPrefault",(e,t)=>{H_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>A0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Kf(e,t){return new Jf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():zs(t)}})}const kc=T("ZodNonOptional",(e,t)=>{W_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Yf(e,t){return new kc({type:"nonoptional",innerType:e,...N(t)})}const Xf=T("ZodSuccess",(e,t)=>{J_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>h0(e,r,o),e.unwrap=()=>e._zod.def.innerType});function Wx(e){return new Xf({type:"success",innerType:e})}const Qf=T("ZodCatch",(e,t)=>{K_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>C0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function em(e,t){return new Qf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const tm=T("ZodNaN",(e,t)=>{Y_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>m0(e,r)});function Jx(e){return Vw(tm,e)}const Ec=T("ZodPipe",(e,t)=>{X_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>N0(e,r,o,n),e.in=t.in,e.out=t.out});function ti(e,t){return new Ec({type:"pipe",in:e,out:t})}const Ic=T("ZodCodec",(e,t)=>{Ec.init(e,t),Bd.init(e,t)});function Kx(e,t,r){return new Ic({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const rm=T("ZodReadonly",(e,t)=>{Q_.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>R0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nm(e){return new rm({type:"readonly",innerType:e})}const om=T("ZodTemplateLiteral",(e,t)=>{ew.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>p0(e,r,o)});function Yx(e,t){return new om({type:"template_literal",parts:e,...N(t)})}const im=T("ZodLazy",(e,t)=>{nw.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>z0(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Tc(e){return new im({type:"lazy",getter:e})}const am=T("ZodPromise",(e,t)=>{rw.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>P0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Xx(e){return new am({type:"promise",innerType:e})}const sm=T("ZodFunction",(e,t)=>{tw.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>y0(e,r)});function rs(e){return new sm({type:"function",input:Array.isArray(e?.input)?Lf(e?.input):e?.input??z(Qe()),output:e?.output??Qe()})}const Bi=T("ZodCustom",(e,t)=>{ow.init(e,t),se.init(e,t),e._zod.processJSONSchema=(r,o,n)=>v0(e,r)});function Qx(e){const t=new Ae({check:"custom"});return t._zod.check=e,t}function cm(e,t){return qw(Bi,e??(()=>!0),t)}function lm(e,t={}){return Gw(Bi,e,t)}function um(e){return Hw(e)}const eS=Jw,tS=Kw;function to(e,t={error:`Input not instance of ${e.name}`}){const r=new Bi({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...N(t)});return r._zod.bag.Class=e,r}const rS=(...e)=>Yw({Codec:Ic,Boolean:Ui,String:zi},...e);function nS(e){const t=Tc(()=>fe([S(e),B(),mt(),bc(),z(t),nr(S(),t)]));return t}function oS(e,t){return ti(xc(e),t)}const QN=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Of,ZodArray:Rf,ZodBase64:mc,ZodBase64URL:gc,ZodBigInt:Li,ZodBigIntFormat:yc,ZodBoolean:Ui,ZodCIDRv4:dc,ZodCIDRv6:fc,ZodCUID:oc,ZodCUID2:ic,ZodCatch:Qf,ZodCodec:Ic,ZodCustom:Bi,ZodCustomStringFormat:fo,ZodDate:wc,ZodDefault:Hf,ZodDiscriminatedUnion:jf,ZodE164:hc,ZodEmail:tc,ZodEmoji:rc,ZodEnum:eo,ZodFile:Bf,ZodFunction:sm,ZodGUID:Qo,ZodIPv4:lc,ZodIPv6:uc,ZodIntersection:Df,ZodJWT:vc,ZodKSUID:cc,ZodLazy:im,ZodLiteral:Zf,ZodMAC:Ef,ZodMap:Ff,ZodNaN:tm,ZodNanoID:nc,ZodNever:Cf,ZodNonOptional:kc,ZodNull:$f,ZodNullable:Gf,ZodNumber:Mi,ZodNumberFormat:gn,ZodObject:Fi,ZodOptional:Sc,ZodPipe:Ec,ZodPrefault:Jf,ZodPromise:am,ZodReadonly:rm,ZodRecord:Zi,ZodSet:Vf,ZodString:zi,ZodStringFormat:Ie,ZodSuccess:Xf,ZodSymbol:If,ZodTemplateLiteral:om,ZodTransform:qf,ZodTuple:Uf,ZodType:se,ZodULID:ac,ZodURL:Di,ZodUUID:Qt,ZodUndefined:Tf,ZodUnion:Vi,ZodUnknown:Af,ZodVoid:Nf,ZodXID:sc,ZodXor:Pf,_ZodString:ec,_default:Wf,_function:rs,any:Me,array:z,base64:pc,base64url:_x,bigint:Cx,boolean:mt,catch:em,check:Qx,cidrv4:yx,cidrv6:bx,codec:Kx,cuid:ux,cuid2:dx,custom:cm,date:Dx,describe:eS,discriminatedUnion:zf,e164:wx,email:ex,emoji:cx,enum:hn,file:Gx,float32:Tx,float64:$x,function:rs,guid:tx,hash:Ix,hex:Ex,hostname:kx,httpUrl:sx,instanceof:to,int:ts,int32:Ox,int64:Nx,intersection:Mf,ipv4:gx,ipv6:vx,json:nS,jwt:xx,keyof:Mx,ksuid:px,lazy:Tc,literal:q,looseObject:Ir,looseRecord:Vx,mac:hx,map:Zx,meta:tS,nan:Jx,nanoid:lx,nativeEnum:qx,never:_c,nonoptional:Yf,null:bc,nullable:ei,nullish:Hx,number:B,object:O,optional:ne,partialRecord:Fx,pipe:ti,prefault:Kf,preprocess:oS,promise:Xx,readonly:nm,record:nr,refine:lm,set:Bx,strictObject:Ux,string:S,stringFormat:Sx,stringbool:rS,success:Wx,superRefine:um,symbol:Px,templateLiteral:Yx,transform:xc,tuple:Lf,uint32:Ax,uint64:Rx,ulid:fx,undefined:jx,union:fe,unknown:Qe,url:ax,uuid:rx,uuidv4:nx,uuidv6:ox,uuidv7:ix,void:zx,xid:mx,xor:Lx},Symbol.toStringTag,{value:"Module"})),iS={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 eR(e){Xe({customError:e})}function tR(){return Xe().customError}var Iu;Iu||(Iu={});const j={...QN,...YN,iso:F0};function rR(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 nR(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 aS(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=nR(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 aS(a,t)});return n.length===0?j.never():n.length===1?n[0]:j.union(n)}if(!r)return j.any();let o;switch(r){case"string":{let n=j.string();if(e.format){const i=e.format;i==="email"?n=n.check(j.email()):i==="uri"||i==="uri-reference"?n=n.check(j.url()):i==="uuid"||i==="guid"?n=n.check(j.uuid()):i==="date-time"?n=n.check(j.iso.datetime()):i==="date"?n=n.check(j.iso.date()):i==="time"?n=n.check(j.iso.time()):i==="duration"?n=n.check(j.iso.duration()):i==="ipv4"?n=n.check(j.ipv4()):i==="ipv6"?n=n.check(j.ipv6()):i==="mac"?n=n.check(j.mac()):i==="cidr"?n=n.check(j.cidrv4()):i==="cidr-v6"?n=n.check(j.cidrv6()):i==="base64"?n=n.check(j.base64()):i==="base64url"?n=n.check(j.base64url()):i==="e164"?n=n.check(j.e164()):i==="jwt"?n=n.check(j.jwt()):i==="emoji"?n=n.check(j.emoji()):i==="nanoid"?n=n.check(j.nanoid()):i==="cuid"?n=n.check(j.cuid()):i==="cuid2"?n=n.check(j.cuid2()):i==="ulid"?n=n.check(j.ulid()):i==="xid"?n=n.check(j.xid()):i==="ksuid"&&(n=n.check(j.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),o=n;break}case"number":case"integer":{let n=r==="integer"?j.number().int():j.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),o=n;break}case"boolean":{o=j.boolean();break}case"null":{o=j.null();break}case"object":{const n={},i=e.properties||{},a=new Set(e.required||[]);for(const[c,l]of Object.entries(i)){const u=Ye(l,t);n[c]=a.has(c)?u:u.optional()}if(e.propertyNames){const c=Ye(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?Ye(e.additionalProperties,t):j.any();if(Object.keys(n).length===0){o=j.record(c,l);break}const u=j.object(n).passthrough(),d=j.looseRecord(c,l);o=j.intersection(u,d);break}if(e.patternProperties){const c=e.patternProperties,l=Object.keys(c),u=[];for(const f of l){const m=Ye(c[f],t),h=j.string().regex(new RegExp(f));u.push(j.looseRecord(h,m))}const d=[];if(Object.keys(n).length>0&&d.push(j.object(n).passthrough()),d.push(...u),d.length===0)o=j.object({}).passthrough();else if(d.length===1)o=d[0];else{let f=j.intersection(d[0],d[1]);for(let m=2;m<d.length;m++)f=j.intersection(f,d[m]);o=f}break}const s=j.object(n);e.additionalProperties===!1?o=s.strict():typeof e.additionalProperties=="object"?o=s.catchall(Ye(e.additionalProperties,t)):o=s.passthrough();break}case"array":{const n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){const a=n.map(c=>Ye(c,t)),s=i&&typeof i=="object"&&!Array.isArray(i)?Ye(i,t):void 0;s?o=j.tuple(a).rest(s):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(Array.isArray(i)){const a=i.map(c=>Ye(c,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?Ye(e.additionalItems,t):void 0;s?o=j.tuple(a).rest(s):o=j.tuple(a),typeof e.minItems=="number"&&(o=o.check(j.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(j.maxLength(e.maxItems)))}else if(i!==void 0){const a=Ye(i,t);let s=j.array(a);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=j.array(j.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(o=o.describe(e.description)),e.default!==void 0&&(o=o.default(e.default)),o}function Ye(e,t){if(typeof e=="boolean")return e?j.any():j.never();let r=aS(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 oR(e,t){if(typeof e=="boolean")return e?j.any():j.never();const r=rR(e,t?.defaultTarget),o=e.$defs||e.definitions||{};return Ye(e,{version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e})}function iR(e){return mw(zi,e)}function aR(e){return ww(Mi,e)}function sR(e){return $w(Ui,e)}function cR(e){return Aw(Li,e)}function lR(e){return Fw(wc,e)}const uR=Object.freeze(Object.defineProperty({__proto__:null,bigint:cR,boolean:sR,date:lR,number:aR,string:iR},Symbol.toStringTag,{value:"Module"}));Xe(iw());const dg=Object.freeze(Object.defineProperty({__proto__:null,$brand:_y,$input:uw,$output:lw,NEVER:wd,TimePrecision:gw,ZodAny:Of,ZodArray:Rf,ZodBase64:mc,ZodBase64URL:gc,ZodBigInt:Li,ZodBigIntFormat:yc,ZodBoolean:Ui,ZodCIDRv4:dc,ZodCIDRv6:fc,ZodCUID:oc,ZodCUID2:ic,ZodCatch:Qf,ZodCodec:Ic,ZodCustom:Bi,ZodCustomStringFormat:fo,ZodDate:wc,ZodDefault:Hf,ZodDiscriminatedUnion:jf,ZodE164:hc,ZodEmail:tc,ZodEmoji:rc,ZodEnum:eo,ZodError:XN,ZodFile:Bf,get ZodFirstPartyTypeKind(){return Iu},ZodFunction:sm,ZodGUID:Qo,ZodIPv4:lc,ZodIPv6:uc,ZodISODate:wf,ZodISODateTime:_f,ZodISODuration:Sf,ZodISOTime:xf,ZodIntersection:Df,ZodIssueCode:iS,ZodJWT:vc,ZodKSUID:cc,ZodLazy:im,ZodLiteral:Zf,ZodMAC:Ef,ZodMap:Ff,ZodNaN:tm,ZodNanoID:nc,ZodNever:Cf,ZodNonOptional:kc,ZodNull:$f,ZodNullable:Gf,ZodNumber:Mi,ZodNumberFormat:gn,ZodObject:Fi,ZodOptional:Sc,ZodPipe:Ec,ZodPrefault:Jf,ZodPromise:am,ZodReadonly:rm,ZodRealError:It,ZodRecord:Zi,ZodSet:Vf,ZodString:zi,ZodStringFormat:Ie,ZodSuccess:Xf,ZodSymbol:If,ZodTemplateLiteral:om,ZodTransform:qf,ZodTuple:Uf,ZodType:se,ZodULID:ac,ZodURL:Di,ZodUUID:Qt,ZodUndefined:Tf,ZodUnion:Vi,ZodUnknown:Af,ZodVoid:Nf,ZodXID:sc,ZodXor:Pf,_ZodString:ec,_default:Wf,_function:rs,any:Me,array:z,base64:pc,base64url:_x,bigint:Cx,boolean:mt,catch:em,check:Qx,cidrv4:yx,cidrv6:bx,clone:Rt,codec:Kx,coerce:uR,config:Xe,core:KN,cuid:ux,cuid2:dx,custom:cm,date:Dx,decode:H0,decodeAsync:J0,describe:eS,discriminatedUnion:zf,e164:wx,email:ex,emoji:cx,encode:G0,encodeAsync:W0,endsWith:Hs,enum:hn,file:Gx,flattenError:Ed,float32:Tx,float64:$x,formatError:Id,fromJSONSchema:oR,function:rs,getErrorMap:tR,globalRegistry:Vt,gt:Pr,gte:dt,guid:tx,hash:Ix,hex:Ex,hostname:kx,httpUrl:sx,includes:qs,instanceof:to,int:ts,int32:Ox,int64:Nx,intersection:Mf,ipv4:gx,ipv6:vx,iso:F0,json:nS,jwt:xx,keyof:Mx,ksuid:px,lazy:Tc,length:Pi,literal:q,locales:cw,looseObject:Ir,looseRecord:Vx,lowercase:Zs,lt:Rr,lte:At,mac:hx,map:Zx,maxLength:Ri,maxSize:Ni,meta:tS,mime:Ws,minLength:on,minSize:Kn,multipleOf:Jn,nan:Jx,nanoid:lx,nativeEnum:qx,negative:pf,never:_c,nonnegative:hf,nonoptional:Yf,nonpositive:gf,normalize:Js,null:bc,nullable:ei,nullish:Hx,number:B,object:O,optional:ne,overwrite:xr,parse:Z0,parseAsync:B0,partialRecord:Fx,pipe:ti,positive:mf,prefault:Kf,preprocess:oS,prettifyError:Fy,promise:Xx,property:vf,readonly:nm,record:nr,refine:lm,regex:Vs,regexes:zd,registry:qd,safeDecode:Y0,safeDecodeAsync:Q0,safeEncode:K0,safeEncodeAsync:X0,safeParse:q0,safeParseAsync:kf,set:Bx,setErrorMap:eR,size:Fs,slugify:Qs,startsWith:Gs,strictObject:Ux,string:S,stringFormat:Sx,stringbool:rS,success:Wx,superRefine:um,symbol:Px,templateLiteral:Yx,toJSONSchema:bf,toLowerCase:Ys,toUpperCase:Xs,transform:xc,treeifyError:Uy,trim:Ks,tuple:Lf,uint32:Ax,uint64:Rx,ulid:fx,undefined:jx,union:fe,unknown:Qe,uppercase:Bs,url:ax,util:Dy,uuid:rx,uuidv4:nx,uuidv6:ox,uuidv7:ix,void:zx,xid:mx,xor:Lx},Symbol.toStringTag,{value:"Module"}));var ri;(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})(ri||(ri={}));var fg;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(fg||(fg={}));ri.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ri.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 ns 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 ns))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ri.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()}}ns.create=e=>new ns(e);var mg;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(mg||(mg={}));var Q;(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"})(Q||(Q={}));var dR=({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 _d({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`};dR();function sS(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 fR(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 cS(e,...t){const r=new Headers(fR(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var mR=Symbol.for("vercel.ai.validator");function pR(e){return{...e,type:"dynamic"}}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var gR=Symbol.for("vercel.ai.schema");function hR(e,{validate:t}={}){return{[gR]:!0,_type:void 0,[mR]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}let dm;dm=globalThis.crypto;async function vR(e){return(await dm).getRandomValues(new Uint8Array(e))}async function yR(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const o=await vR(e);for(let n=0;n<e;n++){const i=o[n]%t.length;r+=t[i]}return r}async function bR(e){return await yR(e)}async function _R(e){const t=await(await dm).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function wR(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await bR(e),r=await _R(t);return{code_verifier:t,code_challenge:r}}var xR="AI_MCPClientError",lS=`vercel.ai.error.${xR}`,SR=Symbol.for(lS),pg,gg,_e=class extends(gg=te,pg=SR,gg){constructor({name:e="MCPClientError",message:t,cause:r,data:o,code:n}){super({name:e,message:t,cause:r}),this[pg]=!0,this.data=o,this.code=n}static isInstance(e){return te.hasMarker(e,lS)}},mo="2025-06-18",kR=[mo,"2025-03-26","2024-11-05"],ER=Ir({name:S(),version:S()}),$c=Ir({_meta:ne(O({}).loose())}),mr=$c,uS=O({method:S(),params:ne($c)}),dS=O({applyDefaults:ne(mt())}).loose(),IR=Ir({experimental:ne(O({}).loose()),logging:ne(O({}).loose()),prompts:ne(Ir({listChanged:ne(mt())})),resources:ne(Ir({subscribe:ne(mt()),listChanged:ne(mt())})),tools:ne(Ir({listChanged:ne(mt())})),elicitation:ne(dS)});O({elicitation:ne(dS)}).loose();var TR=mr.extend({protocolVersion:S(),capabilities:IR,serverInfo:ER,instructions:ne(S())}),fm=mr.extend({nextCursor:ne(S())}),$R=O({name:S(),description:ne(S()),inputSchema:O({type:q("object"),properties:ne(O({}).loose())}).loose()}).loose(),OR=fm.extend({tools:z($R)}),fS=O({type:q("text"),text:S()}).loose(),mS=O({type:q("image"),data:pc(),mimeType:S()}).loose(),AR=O({uri:S(),name:S(),title:ne(S()),description:ne(S()),mimeType:ne(S()),size:ne(B())}).loose(),CR=fm.extend({resources:z(AR)}),pS=O({uri:S(),name:ne(S()),title:ne(S()),mimeType:ne(S())}).loose(),gS=pS.extend({text:S()}),hS=pS.extend({blob:pc()}),vS=O({type:q("resource"),resource:fe([gS,hS])}).loose(),NR=mr.extend({content:z(fe([fS,mS,vS])),isError:mt().default(!1).optional()}).or(mr.extend({toolResult:Qe()})),RR=O({uriTemplate:S(),name:S(),title:ne(S()),description:ne(S()),mimeType:ne(S())}).loose(),PR=mr.extend({resourceTemplates:z(RR)}),jR=mr.extend({contents:z(fe([gS,hS]))}),zR=O({name:S(),description:ne(S()),required:ne(mt())}).loose(),DR=O({name:S(),title:ne(S()),description:ne(S()),arguments:ne(z(zR))}).loose(),MR=fm.extend({prompts:z(DR)}),UR=O({role:fe([q("user"),q("assistant")]),content:fe([fS,mS,vS])}).loose(),LR=mr.extend({description:ne(S()),messages:z(UR)}),FR=$c.extend({message:S(),requestedSchema:Qe()}),hg=uS.extend({method:q("elicitation/create"),params:FR}),VR=mr.extend({action:fe([q("accept"),q("decline"),q("cancel")]),content:ne(nr(S(),Qe()))}),Oc="2.0",ZR=O({jsonrpc:q(Oc),id:fe([S(),B().int()])}).merge(uS).strict(),BR=O({jsonrpc:q(Oc),id:fe([S(),B().int()]),result:mr}).strict(),qR=O({jsonrpc:q(Oc),id:fe([S(),B().int()]),error:O({code:B().int(),message:S(),data:ne(Qe())})}).strict(),GR=O({jsonrpc:q(Oc)}).merge(O({method:S(),params:ne($c)})).strict(),Zo=fe([ZR,GR,BR,qR]),yS=typeof __PACKAGE_VERSION__<"u"?__PACKAGE_VERSION__:"0.0.0-test",bS=O({access_token:S(),id_token:S().optional(),token_type:S(),expires_in:B().optional(),scope:S().optional(),refresh_token:S().optional()}).strip(),ft=S().url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:iS.custom,message:"URL must be parseable",fatal:!0}),wd}).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"}),HR=O({resource:S().url(),authorization_servers:z(ft).optional(),jwks_uri:S().url().optional(),scopes_supported:z(S()).optional(),bearer_methods_supported:z(S()).optional(),resource_signing_alg_values_supported:z(S()).optional(),resource_name:S().optional(),resource_documentation:S().optional(),resource_policy_uri:S().url().optional(),resource_tos_uri:S().url().optional(),tls_client_certificate_bound_access_tokens:mt().optional(),authorization_details_types_supported:z(S()).optional(),dpop_signing_alg_values_supported:z(S()).optional(),dpop_bound_access_tokens_required:mt().optional()}).passthrough(),_S=O({issuer:S(),authorization_endpoint:ft,token_endpoint:ft,registration_endpoint:ft.optional(),scopes_supported:z(S()).optional(),response_types_supported:z(S()),grant_types_supported:z(S()).optional(),code_challenge_methods_supported:z(S()),token_endpoint_auth_methods_supported:z(S()).optional(),token_endpoint_auth_signing_alg_values_supported:z(S()).optional()}).passthrough(),WR=O({issuer:S(),authorization_endpoint:ft,token_endpoint:ft,userinfo_endpoint:ft.optional(),jwks_uri:ft,registration_endpoint:ft.optional(),scopes_supported:z(S()).optional(),response_types_supported:z(S()),grant_types_supported:z(S()).optional(),subject_types_supported:z(S()),id_token_signing_alg_values_supported:z(S()),claims_supported:z(S()).optional(),token_endpoint_auth_methods_supported:z(S()).optional()}).passthrough(),JR=WR.merge(_S.pick({code_challenge_methods_supported:!0})),KR=O({client_id:S(),client_secret:S().optional(),client_id_issued_at:B().optional(),client_secret_expires_at:B().optional()}).strip(),YR=O({redirect_uris:z(ft),token_endpoint_auth_method:S().optional(),grant_types:z(S()).optional(),response_types:z(S()).optional(),client_name:S().optional(),client_uri:ft.optional(),logo_uri:ft.optional(),scope:S().optional(),contacts:z(S()).optional(),tos_uri:ft.optional(),policy_uri:S().optional(),jwks_uri:ft.optional(),jwks:Me().optional(),software_id:S().optional(),software_version:S().optional(),software_statement:S().optional()}).strip(),XR=O({error:S(),error_description:S().optional(),error_uri:S().optional()}),QR=YR.merge(KR),eP="AI_MCPClientOAuthError",wS=`vercel.ai.error.${eP}`,tP=Symbol.for(wS),vg,yg,qi=class extends(yg=te,vg=tP,yg){constructor({name:e="MCPClientOAuthError",message:t,cause:r}){super({name:e,message:t,cause:r}),this[vg]=!0}static isInstance(e){return te.hasMarker(e,wS)}},ro=class extends qi{};ro.errorCode="server_error";var os=class extends qi{};os.errorCode="invalid_client";var is=class extends qi{};is.errorCode="invalid_grant";var as=class extends qi{};as.errorCode="unauthorized_client";var rP={[ro.errorCode]:ro,[os.errorCode]:os,[is.errorCode]:is,[as.errorCode]:as};function nP(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function oP({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 ss=class extends Error{constructor(e="Unauthorized"){super(e),this.name="UnauthorizedError"}};function cs(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 iP(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function mm(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?mm(e,void 0,r):void 0;throw o}}async function bg(e,t,r=fetch){return await mm(e,{"MCP-Protocol-Version":t},r)}function aP(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function sP(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=iP(t,a.pathname);c=new URL(u,(i=o?.metadataServerUrl)!=null?i:a),c.search=a.search}let l=await bg(c,s,r);if(!o?.metadataUrl&&aP(l,a.pathname)){const u=new URL(`/.well-known/${t}`,a);l=await bg(u,s,r)}return l}async function cP(e,t,r=fetch){const o=await sP(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 HR.parse(await o.json())}function lP(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 uP(e,{fetchFn:t=fetch,protocolVersion:r=mo}={}){var o;const n={"MCP-Protocol-Version":r},i=lP(e);for(const{url:a,type:s}of i){const c=await mm(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 _S.parse(await c.json());{const l=JR.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 dP(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 wR(),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 xS(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 SS(e,t,r,o){const{client_id:n,client_secret:i}=t;switch(e){case"client_secret_basic":fP(n,i,r);return;case"client_secret_post":mP(n,i,o);return;case"none":pP(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function fP(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 mP(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function pP(e,t){t.set("client_id",e)}async function pm(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const o=XR.parse(JSON.parse(r)),{error:n,error_description:i,error_uri:a}=o,s=rP[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 gP(e,{metadata:t,clientInformation:r,authorizationCode:o,codeVerifier:n,redirectUri:i,resource:a,addClientAuthentication:s,fetchFn:c}){var l;const u="authorization_code",d=t?.token_endpoint?new URL(t.token_endpoint):new URL("/token",e);if(t?.grant_types_supported&&!t.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`);const f=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),m=new URLSearchParams({grant_type:u,code:o,code_verifier:n,redirect_uri:String(i)});if(s)s(f,m,e,t);else{const g=(l=t?.token_endpoint_auth_methods_supported)!=null?l:[],y=xS(r,g);SS(y,r,f,m)}a&&m.set("resource",a.href);const h=await(c??fetch)(d,{method:"POST",headers:f,body:m});if(!h.ok)throw await pm(h);return bS.parse(await h.json())}async function hP(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:i,fetchFn:a}){var s;const c="refresh_token";let l;if(t){if(l=new URL(t.token_endpoint),t.grant_types_supported&&!t.grant_types_supported.includes(c))throw new Error(`Incompatible auth server: does not support grant type ${c}`)}else l=new URL("/token",e);const u=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),d=new URLSearchParams({grant_type:c,refresh_token:o});if(i)i(u,d,e,t);else{const m=(s=t?.token_endpoint_auth_methods_supported)!=null?s:[],h=xS(r,m);SS(h,r,u,d)}n&&d.set("resource",n.href);const f=await(a??fetch)(l,{method:"POST",headers:u,body:d});if(!f.ok)throw await pm(f);return bS.parse({refresh_token:o,...await f.json()})}async function vP(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 pm(i);return QR.parse(await i.json())}async function ls(e,t){var r,o;try{return await Sl(e,t)}catch(n){if(n instanceof os||n instanceof as)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await Sl(e,t);if(n instanceof is)return await((o=e.invalidateCredentials)==null?void 0:o.call(e,"tokens")),await Sl(e,t);throw n}}async function yP(e,t,r){const o=nP(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!oP({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 Sl(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:i}){let a,s;try{a=await cP(t,{resourceMetadataUrl:n},i),a.authorization_servers&&a.authorization_servers.length>0&&(s=a.authorization_servers[0])}catch{}s||(s=t);const c=await yP(t,e,a),l=await uP(s,{fetchFn:i});let u=await Promise.resolve(e.clientInformation());if(!u){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const g=await vP(s,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:i});await e.saveClientInformation(g),u=g}if(r!==void 0){const g=await e.codeVerifier(),y=await gP(s,{metadata:l,clientInformation:u,authorizationCode:r,codeVerifier:g,redirectUri:e.redirectUrl,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(y),"AUTHORIZED"}const d=await e.tokens();if(d?.refresh_token)try{const g=await hP(s,{metadata:l,clientInformation:u,refreshToken:d.refresh_token,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:i});return await e.saveTokens(g),"AUTHORIZED"}catch(g){if(!(!(g instanceof qi)||g instanceof ro))throw g}const f=e.state?await e.state():void 0,{authorizationUrl:m,codeVerifier:h}=await dP(s,{metadata:l,clientInformation:u,state:f,redirectUrl:e.redirectUrl,scope:o||e.clientMetadata.scope,resource:c});return await e.saveCodeVerifier(h),await e.redirectToAuthorization(m),"REDIRECT"}var bP=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 cS(t,`ai-sdk/${yS}`,sS())}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=cs(u);try{if(await ls(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const g=new ss;return(i=this.onerror)==null||i.call(this,g),t(g)}}catch(h){return(a=this.onerror)==null||a.call(this,h),t(h)}return r(!0)}if(!u.ok||!u.body){let h=`MCP SSE Transport Error: ${u.status} ${u.statusText}`;u.status===405&&(h+=". This server does not support SSE transport. Try using `http` transport instead");const g=new _e({message:h});return(s=this.onerror)==null||s.call(this,g),t(g)}const f=u.body.pipeThrough(new TextDecoderStream).pipeThrough(new Ja).getReader(),m=async()=>{var h,g,y;try{for(;;){const{done:b,value:w}=await f.read();if(b){if(this.connected)throw this.connected=!1,new _e({message:"MCP SSE Transport Error: Connection closed unexpectedly"});return}const{event:x,data:v}=w;if(x==="endpoint"){if(this.endpoint=new URL(v,this.url),this.endpoint.origin!==this.url.origin)throw new _e({message:`MCP SSE Transport Error: Endpoint origin does not match connection origin: ${this.endpoint.origin}`});this.connected=!0,e()}else if(x==="message")try{const k=Zo.parse(JSON.parse(v));(h=this.onmessage)==null||h.call(this,k)}catch(k){const E=new _e({message:"MCP SSE Transport Error: Failed to parse message",cause:k});(g=this.onerror)==null||g.call(this,E)}}}catch(b){if(b instanceof Error&&b.name==="AbortError")return;(y=this.onerror)==null||y.call(this,b),t(b)}};this.sseConnection={close:()=>f.cancel()},m()}catch(l){if(l instanceof Error&&l.name==="AbortError")return;(c=this.onerror)==null||c.call(this,l),t(l)}};r()})}async close(){var e,t,r;this.connected=!1,(e=this.sseConnection)==null||e.close(),(t=this.abortController)==null||t.abort(),(r=this.onclose)==null||r.call(this)}async send(e){if(!this.endpoint||!this.connected)throw new _e({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=cs(d);try{if(await ls(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const m=new ss;(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 _e({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()}},_P=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 cS(t,`ai-sdk/${yS}`,sS())}async start(){if(this.abortController)throw new _e({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=cs(f);try{if(await ls(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED")throw new ss}catch(y){throw(n=this.onerror)==null||n.call(this,y),y}return t(!0)}if(f.status===202){this.inboundSseConnection||this.openInboundSse();return}if(!f.ok){const y=await f.text().catch(()=>null);let b=`MCP HTTP Transport Error: POSTing to endpoint (HTTP ${f.status}): ${y}`;f.status===404&&(b+=". This server does not support HTTP transport. Try using `sse` transport instead");const w=new _e({message:b});throw(i=this.onerror)==null||i.call(this,w),w}const h=f.headers.get("content-type")||"";if(h.includes("application/json")){const y=await f.json(),b=Array.isArray(y)?y.map(w=>Zo.parse(w)):[Zo.parse(y)];for(const w of b)(a=this.onmessage)==null||a.call(this,w);return}if(h.includes("text/event-stream")){if(!f.body){const x=new _e({message:"MCP HTTP Transport Error: text/event-stream response without body"});throw(s=this.onerror)==null||s.call(this,x),x}const b=f.body.pipeThrough(new TextDecoderStream).pipeThrough(new Ja).getReader();(async()=>{var x,v,k;try{for(;;){const{done:E,value:I}=await b.read();if(E)return;const{event:C,data:U}=I;if(C==="message")try{const D=Zo.parse(JSON.parse(U));(x=this.onmessage)==null||x.call(this,D)}catch(D){const K=new _e({message:"MCP HTTP Transport Error: Failed to parse message",cause:D});(v=this.onerror)==null||v.call(this,K)}}}catch(E){if(E instanceof Error&&E.name==="AbortError")return;(k=this.onerror)==null||k.call(this,E)}})();return}const g=new _e({message:`MCP HTTP Transport Error: Unexpected content type: ${h}`});throw(c=this.onerror)==null||c.call(this,g),g}catch(u){throw(l=this.onerror)==null||l.call(this,u),u}};await t()}getNextReconnectionDelay(e){const{initialReconnectionDelay:t,reconnectionDelayGrowFactor:r,maxReconnectionDelay:o}=this.reconnectionOptions;return Math.min(t*Math.pow(r,e),o)}scheduleInboundSseReconnection(){var e;const{maxRetries:t}=this.reconnectionOptions;if(t>0&&this.inboundReconnectAttempts>=t){(e=this.onerror)==null||e.call(this,new _e({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=cs(l);try{if(await ls(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const g=new ss;(o=this.onerror)==null||o.call(this,g);return}}catch(h){(n=this.onerror)==null||n.call(this,h);return}return this.openInboundSse(!0,t)}if(l.status===405)return;if(!l.ok||!l.body){const h=new _e({message:`MCP HTTP Transport Error: GET SSE failed: ${l.status} ${l.statusText}`});(i=this.onerror)==null||i.call(this,h);return}const f=l.body.pipeThrough(new TextDecoderStream).pipeThrough(new Ja).getReader(),m=async()=>{var h,g,y,b;try{for(;;){const{done:w,value:x}=await f.read();if(w)return;const{event:v,data:k,id:E}=x;if(E&&(this.lastInboundEventId=E),v==="message")try{const I=Zo.parse(JSON.parse(k));(h=this.onmessage)==null||h.call(this,I)}catch(I){const C=new _e({message:"MCP HTTP Transport Error: Failed to parse message",cause:I});(g=this.onerror)==null||g.call(this,C)}}}catch(w){if(w instanceof Error&&w.name==="AbortError")return;(y=this.onerror)==null||y.call(this,w),(b=this.abortController)!=null&&b.signal.aborted||this.scheduleInboundSseReconnection()}};this.inboundSseConnection={close:()=>f.cancel()},this.inboundReconnectAttempts=0,m()}catch(c){if(c instanceof Error&&c.name==="AbortError")return;(a=this.onerror)==null||a.call(this,c),(s=this.abortController)!=null&&s.signal.aborted||this.scheduleInboundSseReconnection()}}};function wP(e){switch(e.type){case"sse":return new bP(e);case"http":return new _P(e);default:throw new _e({message:"Unsupported or invalid transport configuration. If you are using a custom transport, make sure it implements the MCPTransport interface."})}}function xP(e){return"start"in e&&typeof e.start=="function"&&"send"in e&&typeof e.send=="function"&&"close"in e&&typeof e.close=="function"}var SP="1.0.0";async function kP(e){const t=new EP(e);return await t.init(),t}var EP=class{constructor({transport:e,name:t="ai-sdk-mcp-client",version:r=SP,onUncaughtError:o,capabilities:n}){this.requestMessageId=0,this.responseHandlers=new Map,this.serverCapabilities={},this.isClosed=!0,this.onUncaughtError=o,this.clientCapabilities=n??{},xP(e)?this.transport=e:this.transport=wP(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 _e({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:TR});if(e===void 0)throw new _e({message:"Server sent invalid initialize result"});if(!kR.includes(e.protocolVersion))throw new _e({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 _e({message:"Server does not support tools"});break;case"resources/list":case"resources/read":case"resources/templates/list":if(!this.serverCapabilities.resources)throw new _e({message:"Server does not support resources"});break;case"prompts/list":case"prompts/get":if(!this.serverCapabilities.prompts)throw new _e({message:"Server does not support prompts"});break;default:throw new _e({message:`Unsupported method: ${e}`})}}async request({request:e,resultSchema:t,options:r}){return new Promise((o,n)=>{if(this.isClosed)return n(new _e({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 _e({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 _e({message:"Failed to parse server response",cause:u});n(d)}}),this.transport.send(s).catch(l=>{c(),n(l)})})}async listTools({params:e,options:t}={}){try{return this.request({request:{method:"tools/list",params:e},resultSchema:OR,options:t})}catch(r){throw r}}async callTool({name:e,args:t,options:r}){try{return this.request({request:{method:"tools/call",params:{name:e,arguments:t}},resultSchema:NR,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:CR,options:t})}catch(r){throw r}}async readResourceInternal({uri:e,options:t}){try{return this.request({request:{method:"resources/read",params:{uri:e}},resultSchema:jR,options:t})}catch(r){throw r}}async listResourceTemplatesInternal({options:e}={}){try{return this.request({request:{method:"resources/templates/list"},resultSchema:PR,options:e})}catch(t){throw t}}async listPromptsInternal({params:e,options:t}={}){try{return this.request({request:{method:"prompts/list",params:e},resultSchema:MR,options:t})}catch(r){throw r}}async getPromptInternal({name:e,args:t,options:r}){try{return this.request({request:{method:"prompts/get",params:{name:e,arguments:t}},resultSchema:LR,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"?pR({description:i,inputSchema:hR({...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!==hg)throw new _e({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=hg.safeParse({method:e.method,params:e.params});if(!t.success){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32602,message:`Invalid elicitation request: ${t.error.message}`,data:t.error.issues}});return}try{const r=await this.elicitationRequestHandler(t.data),o=VR.parse(r);await this.transport.send({jsonrpc:"2.0",id:e.id,result:o})}catch(r){await this.transport.send({jsonrpc:"2.0",id:e.id,error:{code:-32603,message:r instanceof Error?r.message:"Failed to handle elicitation request"}}),this.onError(r)}}catch(t){this.onError(t)}}onClose(){if(this.isClosed)return;this.isClosed=!0;const e=new _e({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 _e({message:`Protocol error: Received a response for an unknown message ID: ${JSON.stringify(e)}`});this.responseHandlers.delete(t),r("result"in e?e:new _e({message:e.error.message,code:e.error.code,data:e.error.data,cause:e.error}))}},Gi=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(){}},IP={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},TP=class{#e=IP;#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 TP;function $P(e){setTimeout(e,0)}var an=typeof window>"u"||"Deno"in globalThis;function ut(){}function OP(e,t){return typeof e=="function"?e(t):e}function Tu(e){return typeof e=="number"&&e>=0&&e!==1/0}function kS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Or(e,t){return typeof e=="function"?e(t):e}function $t(e,t){return typeof e=="function"?e(t):e}function _g(e,t){const{type:r="all",exact:o,fetchStatus:n,predicate:i,queryKey:a,stale:s}=e;if(a){if(o){if(t.queryHash!==gm(a,t.options))return!1}else if(!oi(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 wg(e,t){const{exact:r,status:o,predicate:n,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(r){if(ni(t.options.mutationKey)!==ni(i))return!1}else if(!oi(t.options.mutationKey,i))return!1}return!(o&&t.state.status!==o||n&&!n(t))}function gm(e,t){return(t?.queryKeyHashFn||ni)(e)}function ni(e){return JSON.stringify(e,(t,r)=>Au(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function oi(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>oi(e[r],t[r])):!1}var AP=Object.prototype.hasOwnProperty;function $u(e,t){if(e===t)return e;const r=xg(e)&&xg(t);if(!r&&!(Au(e)&&Au(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:AP.call(e,u))&&c++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){s[u]=f;continue}const m=$u(d,f);s[u]=m,m===d&&c++}return n===a&&c===n?e:s}function Ou(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 xg(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Au(e){if(!Sg(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Sg(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Sg(e){return Object.prototype.toString.call(e)==="[object Object]"}function CP(e){return new Promise(t=>{Yr.setTimeout(t,e)})}function Cu(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 $u(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 $u(e,t)}return t}function NP(e,t,r=0){const o=[...e,t];return r&&o.length>r?o.slice(1):o}function RP(e,t,r=0){const o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var us=Symbol();function ES(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===us&&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===us?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function PP(e,t){return typeof e=="function"?e(...t):!!e}var jP=class extends Gi{#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"}},hm=new jP;function Nu(){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 zP=$P;function DP(){let e=[],t=0,r=s=>{s()},o=s=>{s()},n=zP;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=DP(),MP=class extends Gi{#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}},ds=new MP;function UP(e){return Math.min(1e3*2**e,3e4)}function IS(e){return(e??"online")==="online"?ds.isOnline():!0}var Ru=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function TS(e){let t=!1,r=0,o;const n=Nu(),i=()=>n.status!=="pending",a=g=>{if(!i()){const y=new Ru(g);f(y),e.onCancel?.(y)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>hm.isFocused()&&(e.networkMode==="always"||ds.isOnline())&&e.canRun(),u=()=>IS(e.networkMode)&&e.canRun(),d=g=>{i()||(o?.(),n.resolve(g))},f=g=>{i()||(o?.(),n.reject(g))},m=()=>new Promise(g=>{o=y=>{(i()||l())&&g(y)},e.onPause?.()}).then(()=>{o=void 0,i()||e.onContinue?.()}),h=()=>{if(i())return;let g;const y=r===0?e.initialPromise:void 0;try{g=y??e.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(d).catch(b=>{if(i())return;const w=e.retry??(an?0:3),x=e.retryDelay??UP,v=typeof x=="function"?x(r,b):x,k=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,b);if(t||!k){f(b);return}r++,e.onFail?.(r,b),CP(v).then(()=>l()?void 0:m()).then(()=>{t?f(b):h()})})};return{promise:n,status:()=>n.status,cancel:a,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?h():m().then(h),n)}}var $S=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Tu(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)}},LP=class extends $S{#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=Eg(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=Eg(this.options);t.data!==void 0&&(this.setState(kg(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=Cu(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===us||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Or(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!kS(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=ES(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=TS({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:s=>{s instanceof Ru&&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 Ru){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,...OS(r.data,this.options),fetchMeta:e.meta??null};case"success":const o={...r,...kg(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 OS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:IS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function kg(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Eg(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 FP=class extends Gi{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#a=Nu(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#o=void 0;#n;#s;#a;#i;#g;#f;#m;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Ig(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Pu(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Pu(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&&!Ou(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&Tg(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)||Or(this.options.staleTime,this.#t)!==Or(t.staleTime,this.#t))&&this.#h();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 ZP(this,r)&&(this.#o=r,this.#s=this.options,this.#n=this.#t.state),r}getCurrentResult(){return this.#o}trackResult(e,t){return new Proxy(e,{get:(r,o)=>(this.trackProp(o),t?.(o),o==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,o))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#o))}#d(e){this.#x();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ut)),t}#h(){this.#_();const e=Or(this.options.staleTime,this.#t);if(an||this.#o.isStale||!Tu(e))return;const r=kS(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||!Tu(this.#c)||this.#c===0)&&(this.#u=Yr.setInterval(()=>{(this.options.refetchIntervalInBackground||hm.isFocused())&&this.#d()},this.#c))}#b(){this.#h(),this.#y(this.#v())}#_(){this.#l&&(Yr.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(Yr.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,o=this.options,n=this.#o,i=this.#n,a=this.#s,c=e!==r?e.state:this.#r,{state:l}=e;let u={...l},d=!1,f;if(t._optimisticResults){const C=this.hasListeners(),U=!C&&Ig(e,t),D=C&&Tg(e,r,t,o);(U||D)&&(u={...u,...OS(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:m,errorUpdatedAt:h,status:g}=u;f=u.data;let y=!1;if(t.placeholderData!==void 0&&f===void 0&&g==="pending"){let C;n?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(C=n.data,y=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,C!==void 0&&(g="success",f=Cu(n?.data,C,t),d=!0)}if(t.select&&f!==void 0&&!y)if(n&&f===i?.data&&t.select===this.#g)f=this.#f;else try{this.#g=t.select,f=t.select(f),f=Cu(n?.data,f,t),this.#f=f,this.#i=null}catch(C){this.#i=C}this.#i&&(m=this.#i,f=this.#f,h=Date.now(),g="error");const b=u.fetchStatus==="fetching",w=g==="pending",x=g==="error",v=w&&b,k=f!==void 0,I={status:g,fetchStatus:u.fetchStatus,isPending:w,isSuccess:g==="success",isError:x,isInitialLoading:v,isLoading:v,data:f,dataUpdatedAt:u.dataUpdatedAt,error:m,errorUpdatedAt:h,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:x&&!k,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:x&&k,isStale:vm(e,t),refetch:this.refetch,promise:this.#a,isEnabled:$t(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=K=>{I.status==="error"?K.reject(I.error):I.data!==void 0&&K.resolve(I.data)},U=()=>{const K=this.#a=I.promise=Nu();C(K)},D=this.#a;switch(D.status){case"pending":e.queryHash===r.queryHash&&C(D);break;case"fulfilled":(I.status==="error"||I.data!==D.value)&&U();break;case"rejected":(I.status!=="error"||I.error!==D.reason)&&U();break}}return I}updateResult(){const e=this.#o,t=this.createResult(this.#t,this.options);if(this.#n=this.#t.state,this.#s=this.options,this.#n.data!==void 0&&(this.#m=this.#t),Ou(t,e))return;this.#o=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:o}=this.options,n=typeof o=="function"?o():o;if(n==="all"||!n&&!this.#p.size)return!0;const i=new Set(n??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#o).some(a=>{const s=a;return this.#o[s]!==e[s]&&i.has(s)})};this.#S({listeners:r()})}#x(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){We.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#o)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function VP(e,t){return $t(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ig(e,t){return VP(e,t)||e.state.data!==void 0&&Pu(e,t,t.refetchOnMount)}function Pu(e,t,r){if($t(t.enabled,e)!==!1&&Or(t.staleTime,e)!=="static"){const o=typeof r=="function"?r(e):r;return o==="always"||o!==!1&&vm(e,t)}return!1}function Tg(e,t,r,o){return(e!==t||$t(o.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&vm(e,r)}function vm(e,t){return $t(t.enabled,e)!==!1&&e.isStaleByTime(Or(t.staleTime,e))}function ZP(e,t){return!Ou(e.getCurrentResult(),t)}function $g(e){return{onFetch:(t,r)=>{const o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},c=0;const l=async()=>{let u=!1;const d=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=ES(t.options,t.fetchOptions),m=async(h,g,y)=>{if(u)return Promise.reject();if(g==null&&h.pages.length)return Promise.resolve(h);const w=(()=>{const E={client:t.client,queryKey:t.queryKey,pageParam:g,direction:y?"backward":"forward",meta:t.options.meta};return d(E),E})(),x=await f(w),{maxPages:v}=t.options,k=y?RP:NP;return{pages:k(h.pages,x,v),pageParams:k(h.pageParams,g,v)}};if(n&&i.length){const h=n==="backward",g=h?BP:Og,y={pages:i,pageParams:a},b=g(o,y);s=await m(y,b,h)}else{const h=e??i.length;do{const g=c===0?a[0]??o.initialPageParam:Og(o,s);if(c>0&&g==null)break;s=await m(s,g),c++}while(c<h)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function Og(e,{pages:t,pageParams:r}){const o=t.length-1;return t.length>0?e.getNextPageParam(t[o],t,r[o],r):void 0}function BP(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var qP=class extends $S{#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||GP(),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=TS({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 GP(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var HP=class extends Gi{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 qP({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=va(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=va(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=va(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=va(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=>wg(t,r))}findAll(e={}){return this.getAll().filter(t=>wg(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 va(e){return e.options.scope?.id}var WP=class extends Gi{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const o=t.queryKey,n=t.queryHash??gm(o,t);let i=this.get(n);return i||(i=new LP({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=>_g(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>_g(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()})})}},JP=class{#e;#t;#r;#o;#n;#s;#a;#i;constructor(e={}){this.#e=e.queryCache||new WP,this.#t=e.mutationCache||new HP,this.#r=e.defaultOptions||{},this.#o=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#a=hm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=ds.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#e.build(this,t),o=r.state.data;return o===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Or(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(o))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const o=r.data;return[t,o]})}setQueryData(e,t,r){const o=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(o.queryHash)?.state.data,a=OP(t,i);if(a!==void 0)return this.#e.build(this,o).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return We.batch(()=>this.#e.findAll(e).map(({queryKey:o})=>[o,this.setQueryData(o,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;We.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return We.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},o=We.batch(()=>this.#e.findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(ut).catch(ut)}invalidateQueries(e,t={}){return We.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},o=We.batch(()=>this.#e.findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let i=n.fetch(void 0,r);return r.throwOnError||(i=i.catch(ut)),n.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(o).then(ut)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(Or(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(ut).catch(ut)}fetchInfiniteQuery(e){return e.behavior=$g(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(ut).catch(ut)}ensureInfiniteQueryData(e){return e.behavior=$g(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ds.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(ni(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#o.values()],r={};return t.forEach(o=>{oi(e,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(ni(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(o=>{oi(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=gm(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===us&&(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()}},AS=_.createContext(void 0),CS=e=>{const t=_.useContext(AS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},KP=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(AS.Provider,{value:e,children:t})),NS=_.createContext(!1),YP=()=>_.useContext(NS);NS.Provider;function XP(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var QP=_.createContext(XP()),ej=()=>_.useContext(QP),tj=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},rj=e=>{_.useEffect(()=>{e.clearReset()},[e])},nj=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||PP(r,[e.error,o])),oj=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))}},ij=(e,t)=>e.isLoading&&e.isFetching&&!t,aj=(e,t)=>e?.suspense&&t.isPending,Ag=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function sj(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=YP(),n=ej(),i=CS(),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",oj(a),tj(a,n),rj(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]),aj(a,l))throw Ag(a,c,n);if(nj({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&&ij(l,o)&&(s?Ag(a,c,n):i.getQueryCache().get(a.queryHash)?.promise)?.catch(ut).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?l:c.trackResult(l)}function RS(e,t){return sj(e,FP)}function cj({auth:e,mcp:t,environment:r,toolsToInclude:o,gramEnvironment:n,chatId:i}){const a=Object.entries(e.headers??{}).map((c,l)=>`${c}:${l}`);return RS({queryKey:["mcpTools",t,n,...a],queryFn:async()=>{$.assert(!e.isLoading,"No auth found"),$.assert(t,"No MCP URL found");const l=await(await kP({name:"gram-elements-mcp-client",transport:{type:"http",url:t,headers:{...lj(r??{}),...e.headers,...n&&{"Gram-Environment":n},...i&&{"Gram-Chat-ID":i}}}})).tools();return o?Object.fromEntries(Object.entries(l).filter(([u])=>typeof o=="function"?o({toolName:u}):o.includes(u))):l},enabled:!e.isLoading&&!!t,staleTime:1/0,gcTime:1/0})}const Cg="MCP-";function lj(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,o])=>{const n=r.replace(/_/g,"-"),i=n.startsWith(Cg)?n:`${Cg}${n}`;return t[i]=o,t},{})}const PS=()=>{const e=A.useContext($.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function uj(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const Ac={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},ur=console,jn={};Object.keys(Ac).forEach(e=>{jn[e]=ur[e]});const Ro="Datadog Browser SDK:",ee={debug:jn.debug.bind(ur,Ro),log:jn.log.bind(ur,Ro),info:jn.info.bind(ur,Ro),warn:jn.warn.bind(ur,Ro),error:jn.error.bind(ur,Ro)},Cc="https://docs.datadoghq.com",dj=`${Cc}/real_user_monitoring/browser/troubleshooting`,ym="More details:";function jS(e,t){return(...r)=>{try{return e(...r)}catch(o){ee.error(t,o)}}}function Xr(e){return e!==0&&Math.random()*100<=e}function qo(e,t){return+e.toFixed(t)}function fj(e){return Hi(e)&&e>=0&&e<=100}function Hi(e){return typeof e=="number"}function ii(e){return{...e}}function fs(e,t){return Object.keys(e).some(r=>e[r]===t)}function Vr(e){return Object.keys(e).length===0}function zS(e,t){const r={};for(const o of Object.keys(e))r[o]=t(e[o]);return r}function Tt(){if(typeof globalThis=="object")return globalThis;Object.defineProperty(Object.prototype,"_dd_temp_",{get(){return this},configurable:!0});let e=_dd_temp_;return delete Object.prototype._dd_temp_,typeof e!="object"&&(typeof self=="object"?e=self:typeof window=="object"?e=window:e={}),e}const or=Tt(),Nc="WorkerGlobalScope"in or;function jr(e,t){const r=Tt();let o;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(o=e[r.Zone.__symbol__(t)]),o||(o=e[t]),o}let ju,DS=!1;function mj(e){ju=e}function pj(e){DS=e}function ie(e){return function(){return Ar(e,this,arguments)}}function Ar(e,t,r){try{return e.apply(t,r)}catch(o){pr(o)}}function pr(e){if(zu(e),ju)try{ju(e)}catch(t){zu(t)}}function zu(...e){DS&&ee.error("[MONITOR]",...e)}function Je(e,t){return jr(Tt(),"setTimeout")(ie(e),t)}function yt(e){jr(Tt(),"clearTimeout")(e)}function po(e,t){return jr(Tt(),"setInterval")(ie(e),t)}function Rc(e){jr(Tt(),"clearInterval")(e)}function Ng(e){var t;const r=(t=or.queueMicrotask)===null||t===void 0?void 0:t.bind(or);typeof r=="function"?r(ie(e)):Promise.resolve().then(ie(e))}class ge{constructor(t){this.onFirstSubscribe=t,this.observers=[]}subscribe(t){return this.addObserver(t),{unsubscribe:()=>this.removeObserver(t)}}notify(t){this.observers.forEach(r=>r(t))}addObserver(t){this.observers.push(t),this.observers.length===1&&this.onFirstSubscribe&&(this.onLastUnsubscribe=this.onFirstSubscribe(this)||void 0)}removeObserver(t){this.observers=this.observers.filter(r=>t!==r),!this.observers.length&&this.onLastUnsubscribe&&this.onLastUnsubscribe()}}function MS(...e){return new ge(t=>{const r=e.map(o=>o.subscribe(n=>t.notify(n)));return()=>r.forEach(o=>o.unsubscribe())})}class US extends ge{constructor(t){super(),this.maxBufferSize=t,this.buffer=[]}notify(t){this.buffer.push(t),this.buffer.length>this.maxBufferSize&&this.buffer.shift(),super.notify(t)}subscribe(t){let r=!1;const o={unsubscribe:()=>{r=!0,this.removeObserver(t)}};return Ng(()=>{for(const n of this.buffer){if(r)return;t(n)}r||this.addObserver(t)}),o}unbuffer(){Ng(()=>{this.maxBufferSize=this.buffer.length=0})}}const Ke=1e3,lt=60*Ke,LS=60*lt,gj=24*LS,FS=365*gj;function Wi(e){return{relative:e,timeStamp:vj(e)}}function hj(e){return{relative:_m(e),timeStamp:e}}function vj(e){const t=ct()-performance.now();return t>Ji()?Math.round(go(t,e)):yj(e)}function VS(){return Math.round(ct()-go(Ji(),performance.now()))}function ae(e){return Hi(e)?qo(e*1e6,0):e}function ct(){return new Date().getTime()}function Be(){return ct()}function wt(){return performance.now()}function Ue(){return{relative:wt(),timeStamp:Be()}}function bm(){return{relative:0,timeStamp:Ji()}}function Ne(e,t){return t-e}function go(e,t){return e+t}function _m(e){return e-Ji()}function yj(e){return Math.round(go(Ji(),e))}function bj(e){return e<FS}let kl;function Ji(){var e,t;return kl===void 0&&(kl=(t=(e=performance.timing)===null||e===void 0?void 0:e.navigationStart)!==null&&t!==void 0?t:performance.timeOrigin),kl}function Ki(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:()=>{yt(s),i=!1,a=void 0}}}function be(){}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 ai(e,t){for(no.lastIndex=0;;){const r=no.exec(e);if(r){if(r[1]===t)return r[2]}else break}}function _j(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 wj(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 wm(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 xj(){return ZS()===0}function Sj(){return ZS()===1}let ya;function ZS(){return ya??(ya=kj())}function kj(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 xm(e){return Yi(e,location.href).href}function Ej(e){try{return!!Yi(e)}catch{return!1}}function Ij(e){const t=Yi(e).pathname;return t[0]==="/"?t:`/${t}`}function Yi(e,t){const{URL:r}=Tj();try{return t!==void 0?new r(e,t):new r(e)}catch(o){throw new Error(`Failed to construct URL: ${String(o)}`)}}let El;function Tj(){if(!El){let e,t;try{e=document.createElement("iframe"),e.style.display="none",document.body.appendChild(e),t=e.contentWindow}catch{t=or}El={URL:t.URL},e?.remove()}return El}function Pc(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 jc(e){return ai(document.cookie,e)}function $j(e){return _j(document.cookie).get(e)||[]}let Il;function Tr(e){return Il||(Il=wj(document.cookie)),Il.get(e)}function BS(e,t){Pc(e,"",0,t)}function Oj(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${et()}`,r="test";Pc(t,r,lt,e);const o=jc(t)===r;return BS(t,e),o}catch(t){return ee.error(t),!1}}let Tl;function qS(e=location.hostname,t=document.referrer){if(Tl===void 0){const r=Aj(e,t);if(r){const o=`dd_site_test_${et()}`,n="test",i=r.split(".");let a=i.pop();for(;i.length&&!jc(o);)a=`${i.pop()}.${a}`,Pc(o,n,Ke,{domain:a});BS(o,{domain:a}),Tl=a}}return Tl}function Aj(e,t){try{return e||Yi(t).hostname}catch{}}const gr="_dd_s";function GS(e,t){for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(t(o,r,e))return o}}function HS(e){return Object.values(e)}function zc(e){return Object.entries(e)}const vn=4*LS,WS=15*lt,Cj=FS,JS="0",oo={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},KS=/^([a-zA-Z]+)=([a-z0-9-]+)$/,Sm="&";function Nj(e){return!!e&&(e.indexOf(Sm)!==-1||KS.test(e))}const Rj="1";function Gr(e,t){const r={isExpired:Rj};return t.trackAnonymousUser&&e?.anonymousId&&(r.anonymousId=e?.anonymousId),r}function za(e){return Vr(e)}function YS(e){return!za(e)}function Go(e){return e.isExpired!==void 0||!Pj(e)}function Pj(e){return(e.created===void 0||ct()-Number(e.created)<vn)&&(e.expire===void 0||ct()<Number(e.expire))}function XS(e){e.expire=String(ct()+WS)}function Du(e){return zc(e).map(([t,r])=>t==="anonymousId"?`aid=${r}`:`${t}=${r}`).join(Sm)}function Dc(e){const t={};return Nj(e)&&e.split(Sm).forEach(r=>{const o=KS.exec(r);if(o!==null){const[,n,i]=o;n==="aid"?t.anonymousId=i:t[n]=i}}),t}const jj="_dd",zj="_dd_r",Dj="_dd_l",Mj="rum",Uj="logs";function Lj(e){if(!Tr(gr)){const r=Tr(jj),o=Tr(zj),n=Tr(Dj),i={};r&&(i.id=r),n&&/^[01]$/.test(n)&&(i[Uj]=n),o&&/^[012]$/.test(o)&&(i[Mj]=o),YS(i)&&(XS(i),e.persistSession(i))}}const Fj=0;function Rg(e){const t=Zj(e);return t&&Oj(t)?{type:oo.COOKIE,cookieOptions:t}:void 0}function Vj(e,t){const r={isLockEnabled:xj(),persistSession:o=>Pg(t,e,o,WS),retrieveSession:()=>QS(t,e),expireSession:o=>Pg(t,e,Gr(o,e),vn)};return Lj(r),r}function Pg(e,t,r,o){let n=Du(r);t.betaEncodeCookieOptions&&(n=Du({...r,...Vr(r)?{}:{c:ek(e)}})),Pc(gr,n,t.trackAnonymousUser?Cj:o,e)}function QS(e,t){if(t.betaEncodeCookieOptions)return Bj(e);const r=jc(gr);return Dc(r)}function Zj(e){const t={};if(t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains){const r=qS();if(!r)return;t.domain=r}return t}function ek(e){const t=e.domain?e.domain.split(".").length-1:0;let r=0;return r|=Fj<<5,r|=t<<1,r|=e.crossSite?1:0,r.toString(16)}function Bj(e){const t=$j(gr),r=ek(e);let o;for(const n of t.reverse())if(o=Dc(n),o.c===r)break;return o==null||delete o.c,o??{}}const qj="_dd_test_";function jg(){try{const e=et(),t=`${qj}${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 Gj(e){return{isLockEnabled:!1,persistSession:tk,retrieveSession:rk,expireSession:t=>Hj(t,e)}}function tk(e){localStorage.setItem(gr,Du(e))}function rk(){const e=localStorage.getItem(gr);return Dc(e)}function Hj(e,t){tk(Gr(e,t))}const Wj=10,Jj=100,Kj=Ke,nk="--",ok=[];let Da;function Hr(e,t,r=0){var o;const{isLockEnabled:n,persistSession:i,expireSession:a}=t,s=f=>i({...f,lock:l}),c=()=>{const{lock:f,...m}=t.retrieveSession();return{session:m,lock:f&&!Xj(f)?f:void 0}};if(Da||(Da=e),e!==Da){ok.push(e);return}if(n&&r>=Jj){zg(t);return}let l,u=c();if(n){if(u.lock){ba(e,t,r);return}if(l=Yj(),s(u.session),u=c(),u.lock!==l){ba(e,t,r);return}}let d=e.process(u.session);if(n&&(u=c(),u.lock!==l)){ba(e,t,r);return}if(d&&(Go(d)?a(d):(XS(d),n?s(d):i(d))),n&&!(d&&Go(d))){if(u=c(),u.lock!==l){ba(e,t,r);return}i(u.session),d=u.session}(o=e.after)===null||o===void 0||o.call(e,d||u.session),zg(t)}function ba(e,t,r){Je(()=>{Hr(e,t,r+1)},Wj)}function zg(e){Da=void 0;const t=ok.shift();t&&Hr(t,e)}function Yj(){return et()+nk+Be()}function Xj(e){const[,t]=e.split(nk);return!t||Ne(Number(t),Be())>Kj}const Dg=Ke;function Qj(e){switch(e.sessionPersistence){case oo.COOKIE:return Rg(e);case oo.LOCAL_STORAGE:return jg();case void 0:{let t=Rg(e);return!t&&e.allowFallbackToLocalStorage&&(t=jg()),t}default:ee.error(`Invalid session persistence '${String(e.sessionPersistence)}'`)}}function e2(e,t){return e.type===oo.COOKIE?Vj(t,e.cookieOptions):Gj(t)}function t2(e,t,r,o,n=e2(e,t)){const i=new ge,a=new ge,s=new ge,c=po(m,Dg);let l;g();const{throttled:u,cancel:d}=Ki(()=>{Hr({process:E=>{if(za(E))return;const I=h(E);return y(I),I},after:E=>{YS(E)&&!b()&&v(E),l=E}},n)},Dg);function f(){Hr({process:E=>b()?h(E):void 0},n)}function m(){const E=n.retrieveSession();Go(E)?Hr({process:I=>Go(I)?Gr(I,t):void 0,after:h},n):h(E)}function h(E){return Go(E)&&(E=Gr(E,t)),b()&&(w(E)?x():(s.notify({previousState:l,newState:E}),l=E)),E}function g(){Hr({process:E=>{if(za(E))return E.anonymousId=et(),Gr(E,t)},after:E=>{l=E}},n)}function y(E){if(za(E))return!1;const I=o(E[r]);E[r]=I,delete E.isExpired,I!==JS&&!E.id&&(E.id=et(),E.created=String(ct()))}function b(){return l?.[r]!==void 0}function w(E){return l.id!==E.id||l[r]!==E[r]}function x(){l=Gr(l,t),a.notify()}function v(E){l=E,i.notify()}function k(E){Hr({process:I=>({...I,...E}),after:h},n)}return{expandOrRenewSession:u,expandSession:f,getSession:()=>l,renewObservable:i,expireObservable:a,sessionStateUpdateObservable:s,restartSession:g,expire:E=>{d(),E===!1&&l&&delete l.anonymousId,n.expireSession(l),h(Gr(l,t))},stop:()=>{Rc(c)},updateSessionState:k}}const Mu={GRANTED:"granted",NOT_GRANTED:"not-granted"};function r2(e){const t=new ge;return{tryToInit(r){e||(e=r)},update(r){e=r,t.notify()},isGranted(){return e===Mu.GRANTED},observable:t}}function yn(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function si(e){const t=yn(e);return t==="string"||t==="function"||e instanceof RegExp}function Mc(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){ee.error(n)}return!1})}const n2=["chrome-extension://","moz-extension://"];function Mg(e){return n2.some(t=>e.includes(t))}function o2(e,t=""){if(Mg(e))return!1;const o=t.split(`
32
- `).filter(n=>{const i=n.trim();return i.length&&/^at\s+|@/.test(i)})[1]||"";return Mg(o)}const i2="Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.",a2="SDK initialized on a non-allowed domain.";function s2(e,t,r=typeof location<"u"?location.origin:""){const o=e.allowedTrackingOrigins;if(!o)return o2(r,t)?(ee.error(i2),!1):!0;const n=Mc(o,r);return n||ee.error(a2),n}const ik="datad0g.com",c2="dd0g-gov.com",Qr="datadoghq.com",l2="datadoghq.eu",u2="ddog-gov.com",d2="pci.browser-intake-datadoghq.com",f2=["ddsource","dd-api-key","dd-request-id"];function Wr(e,t,r){const o=m2(e,t);return{build(n,i){const a=p2(e,t,n,i,r);return o(a)},trackType:t}}function m2(e,t){const r=`/api/v2/${t}`,o=e.proxy;if(typeof o=="string"){const i=xm(o);return a=>`${i}?ddforward=${encodeURIComponent(`${r}?${a}`)}`}if(typeof o=="function")return i=>o({path:r,parameters:i});const n=ak(t,e);return i=>`https://${n}${r}?${i}`}function ak(e,t){const{site:r=Qr,internalAnalyticsSubdomain:o}=t;if(e==="logs"&&t.usePciIntake&&r===Qr)return d2;if(o&&r===Qr)return`${o}.${Qr}`;if(r===c2)return`http-intake.logs.${r}`;const n=r.split("."),i=n.pop();return`browser-intake-${n.join("-")}.${i}`}function p2({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 g2(e){const t=e.site||Qr,r=h2(e.source),o=v2({...e,site:t,source:r});return{replica:y2({...e,site:t,source:r}),site:t,source:r,...o}}function h2(e){return e==="flutter"||e==="unity"?e:"browser"}function v2(e){return{logsEndpointBuilder:Wr(e,"logs"),rumEndpointBuilder:Wr(e,"rum"),profilingEndpointBuilder:Wr(e,"profile"),sessionReplayEndpointBuilder:Wr(e,"replay"),exposuresEndpointBuilder:Wr(e,"exposures")}}function y2(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 b2(e){return f2.every(t=>e.includes(t))}const zn={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input",MASK_UNLESS_ALLOWLISTED:"mask-unless-allowlisted"},Uu={ALL:"all",SAMPLED:"sampled"};function $l(e,t){return e!=null&&typeof e!="string"?(ee.error(`${t} must be defined as a string`),!1):!0}function _2(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(ee.error(`Site should be a valid Datadog site. ${ym} ${Cc}/getting_started/site/.`),!1):!0}function Dn(e,t){return e!==void 0&&!fj(e)?(ee.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function w2(e,t){var r,o,n,i,a,s,c,l,u,d;if(!e||!e.clientToken){ee.error("Client Token is not configured, we will not send any data.");return}if(e.allowedTrackingOrigins!==void 0&&!Array.isArray(e.allowedTrackingOrigins)){ee.error("Allowed Tracking Origins must be an array");return}if(!(!_2(e.site)||!Dn(e.sessionSampleRate,"Session")||!Dn(e.telemetrySampleRate,"Telemetry")||!Dn(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!Dn(e.telemetryUsageSampleRate,"Telemetry Usage")||!$l(e.version,"Version")||!$l(e.env,"Env")||!$l(e.service,"Service")||!s2(e,t??""))){if(e.trackingConsent!==void 0&&!fs(Mu,e.trackingConsent)){ee.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:e.beforeSend&&jS(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Nc?void 0:Qj(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:Mu.GRANTED,trackAnonymousUser:(d=e.trackAnonymousUser)!==null&&d!==void 0?d:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,betaEncodeCookieOptions:!!e.betaEncodeCookieOptions,variant:e.variant,sdkVersion:e.sdkVersion,...g2(e)}}}function x2(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 km=new Set;function S2(e){Array.isArray(e)&&k2(e.filter(t=>fs(zr,t)))}function k2(e){e.forEach(t=>{km.add(t)})}function Xi(e){return km.has(e)}function E2(){return km}const io="?";function Qi(e){var t,r;const o=[];let n=Ol(e,"stack");const i=String(e);if(n&&n.startsWith(i)&&(n=n.slice(i.length)),n&&n.split(`
33
- `).forEach(a=>{const s=$2(a)||A2(a)||N2(a)||j2(a);s&&(!s.func&&s.line&&(s.func=io),o.push(s))}),o.length>0&&U2()&&e instanceof Error){const a=[];let s=e;for(;(s=Object.getPrototypeOf(s))&&ck(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:Ol(e,"message"),name:Ol(e,"name"),stack:o}}const sk="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",ao="(?::(\\d+))",I2=new RegExp(`^\\s*at (.*?) ?\\(${sk}${ao}?${ao}?\\)?\\s*$`,"i"),T2=new RegExp(`\\((\\S*)${ao}${ao}\\)`);function $2(e){const t=I2.exec(e);if(!t)return;const r=t[2]&&t[2].indexOf("native")===0,o=t[2]&&t[2].indexOf("eval")===0,n=T2.exec(t[2]);return o&&n&&(t[2]=n[1],t[3]=n[2],t[4]=n[3]),{args:r?[t[2]]:[],column:t[4]?+t[4]:void 0,func:t[1]||io,line:t[3]?+t[3]:void 0,url:r?void 0:t[2]}}const O2=new RegExp(`^\\s*at ?${sk}${ao}?${ao}??\\s*$`,"i");function A2(e){const t=O2.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:io,line:t[2]?+t[2]:void 0,url:t[1]}}const C2=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function N2(e){const t=C2.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||io,line:+t[3],url:t[2]}}const R2=/^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i,P2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function j2(e){const t=R2.exec(e);if(!t)return;const r=t[3]&&t[3].indexOf(" > eval")>-1,o=P2.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 Ol(e,t){if(typeof e!="object"||!e||!(t in e))return;const r=e[t];return typeof r=="string"?r:void 0}function z2(e,t,r,o){if(t===void 0)return;const{name:n,message:i}=M2(e);return{name:n,message:i,stack:[{url:t,column:o,line:r}]}}const D2=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function M2(e){let t,r;return{}.toString.call(e)==="[object String]"&&([,t,r]=D2.exec(e)),{name:t,message:r}}function ck(e){return String(e.constructor).startsWith("class ")}let _a;function U2(){if(_a!==void 0)return _a;class e extends Error{constructor(){super(),this.name="Error"}}const[t,r]=[e,Error].map(o=>new o);return _a=ck(Object.getPrototypeOf(t))&&r.stack!==t.stack,_a}function ms(e){const r=new Error(e);r.name="HandlingStack";let o;return Ar(()=>{const n=Qi(r);n.stack=n.stack.slice(2),o=ea(n)}),o}function ea(e){let t=lk(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+=`
34
- at ${o}${n} @ ${r.url}${i}${a}`}),t}function lk(e){return`${e.name||"Error"}: ${e.message}`}function Bt(e,t,r,{computeHandlingStack:o}={}){let n=e[t];if(typeof n!="function")if(t in e&&t.startsWith("on"))n=be;else return{stop:be};let i=!1;const a=function(){if(i)return n.apply(this,arguments);const s=Array.from(arguments);let c;Ar(r,null,[{target:this,parameters:s,onPostCall:u=>{c=u},handlingStack:o?ms("instrumented method"):void 0}]);const l=n.apply(this,s);return c&&Ar(c,null,[l]),l};return e[t]=a,{stop:()=>{i=!0,e[t]===a&&(e[t]=n)}}}function L2(e,t,r){const o=Object.getOwnPropertyDescriptor(e,t);if(!o||!o.set||!o.configurable)return{stop:be};const n=be;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,uk=1024*bn,F2=/[^\u0000-\u007F]/;function dk(e){return F2.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function fk(e){if(e.length===1)return e[0];const t=e.reduce((n,i)=>n+i.length,0),r=new Uint8Array(t);let o=0;for(const n of e)r.set(n,o),o+=n.length;return r}function ho(e,t,r){if(typeof e!="object"||e===null)return JSON.stringify(e);const o=Mn(Object.prototype),n=Mn(Array.prototype),i=Mn(Object.getPrototypeOf(e)),a=Mn(e);try{return JSON.stringify(e,t,r)}catch{return"<error: unable to serialize object>"}finally{o(),n(),i(),a()}}function Mn(e){const t=e,r=t.toJSON;return r?(delete t.toJSON,()=>{t.toJSON=r}):be}const V2=220*bn,Z2="$",B2=3;function $e(e,t=V2){const r=Mn(Object.prototype),o=Mn(Array.prototype),n=[],i=new WeakMap,a=Al(e,Z2,void 0,n,i),s=JSON.stringify(a);let c=s?s.length:0;if(c>t){Cl(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=Al(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){Cl(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=Al(l.source[d],l.path,d,n,i);if(f!==void 0&&(c+=JSON.stringify(f).length+u+d.length+B2,u=1),c>t){Cl(t,"truncated",e);break}l.target[d]=f}}return r(),o(),a}function Al(e,t,r,o,n){const i=H2(e);if(!i||typeof i!="object")return q2(i);const a=Lu(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 q2(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 Lu(e){try{if(e instanceof Event)return G2(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 G2(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?Lu(e.currentTarget):null,target:e.target?Lu(e.target):null}}function H2(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function Cl(e,t,r){ee.warn(`The data provided has been ${t} as it is over the limit of ${e} characters:`,r)}const mk="No stack, consider using an instance of Error";function Em({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=Qi(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?ea(e):a?mk:void 0,causes:l?Y2(t,s):void 0,fingerprint:J2(t),context:K2(t)}}function W2(e,t,r,o){return e?.message&&e?.name?e.message:t?"Empty message":`${r} ${ho($e(o))}`}function J2(e){return _n(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function K2(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 Y2(e,t){let r=e;const o=[];for(;_n(r?.cause)&&o.length<10;){const n=Qi(r.cause);o.push({message:r.cause.message,source:t,type:n?.name,stack:n&&ea(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 X2(){return new ge(e=>{const t=(n,i)=>{const a=Em({stackTrace:i,originalError:n,startClocks:Ue(),nonErrorPrefix:"Uncaught",source:vo.SOURCE,handling:"unhandled"});e.notify(a)},{stop:r}=Q2(t),{stop:o}=ez(t);return()=>{r(),o()}})}function Q2(e){return Bt(Tt(),"onerror",({parameters:[t,r,o,n,i]})=>{let a;_n(i)||(a=z2(t,r,o,n)),e(i??t,a)})}function ez(e){return Bt(Tt(),"onunhandledrejection",({parameters:[t]})=>{e(t.reason||"Empty reason")})}function tz(e){const t={version:"6.24.1",onReady(r){r()},...e};return Object.defineProperty(t,"_setDebug",{get(){return pj},enumerable:!1}),t}function rz(e,t,r){const o=e[t];o&&!o.q&&o.version&&ee.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=>jS(n,"onReady callback threw an error:")())}function pk(e,t){t.silentMultipleInit||ee.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=ie(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 ci={intervention:"intervention",cspViolation:"csp_violation"};function nz(e,t){const r=[];t.includes(ci.cspViolation)&&r.push(iz(e));const o=t.filter(n=>n!==ci.cspViolation);return o.length&&r.push(oz(o)),MS(...r)}function oz(e){return new ge(t=>{if(!window.ReportingObserver)return;const r=ie((n,i)=>n.forEach(a=>t.notify(az(a)))),o=new window.ReportingObserver(r,{types:e,buffered:!0});return o.observe(),()=>{o.disconnect()}})}function iz(e){return new ge(t=>{const{stop:r}=Oe(e,document,"securitypolicyviolation",o=>{t.notify(sz(o))});return r})}function az(e){const{type:t,body:r}=e;return gk({type:r.id,message:`${t}: ${r.message}`,originalError:e,stack:hk(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function sz(e){const t=`'${e.blockedURI}' blocked by '${e.effectiveDirective}' directive`;return gk({type:e.effectiveDirective,message:`${ci.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:hk(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${wm(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function gk(e){return{startClocks:Ue(),source:vo.REPORT,handling:"unhandled",...e}}function hk(e,t,r,o,n){return r?ea({name:e,message:t,stack:[{func:"?",url:r,line:o??void 0,column:n??void 0}]}):void 0}const cz=200;function Im(e){const{env:t,service:r,version:o,datacenter:n,sdkVersion:i,variant:a}=e,s=[Tn("sdk_version",i??"6.24.1")];return t&&s.push(Tn("env",t)),r&&s.push(Tn("service",r)),o&&s.push(Tn("version",o)),n&&s.push(Tn("datacenter",n)),a&&s.push(Tn("variant",a)),s}function Tn(e,t){const r=t?`${e}:${t}`:e;return(r.length>cz||uz(r))&&ee.warn(`Tag ${r} doesn't meet tag requirements and will be sanitized. ${ym} ${Cc}/getting_started/tagging/#defining-tags`),lz(r)}function lz(e){return e.replace(/,/g,"_")}function uz(e){return dz()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(e):!1}function dz(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function Tm(e,t){const r=or.__ddBrowserSdkExtensionCallback;r&&r({type:e,payload:t})}function ps(e,t,r=fz()){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]=ps(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]=ps(o[n],t[n],r));return o}function $m(e){return ps(void 0,e)}function vr(...e){let t;for(const r of e)r!=null&&(t=ps(t,r));return t}function fz(){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 vk(){var e;const t=or.navigator;return{status:t.onLine?"connected":"not_connected",interfaces:t.connection&&t.connection.type?[t.connection.type]:void 0,effective_type:(e=t.connection)===null||e===void 0?void 0:e.effectiveType}}function mz(e){return e>=500}function pz(e){try{return e.clone()}catch{return}}const gz=80*bn,hz=32,yk=20*uk,vz=lt,bk=Ke;function _k(e,t,r,o,n,i){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?xk(e,t,r,i,{onSuccess:()=>Sk(0,t,r,o,n,i),onFailure:()=>{t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e}),wk(t,r,o,n,i)}}):t.queuedPayloads.enqueue(e)||i.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e})}function wk(e,t,r,o,n){e.transportStatus===2&&Je(()=>{const i=e.queuedPayloads.first();xk(i,e,t,n,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=bk,Sk(1,e,t,r,o,n)},onFailure:()=>{e.currentBackoffTime=Math.min(vz,e.currentBackoffTime*2),wk(e,t,r,o,n)}})},e.currentBackoffTime)}function xk(e,t,r,o,{onSuccess:n,onFailure:i}){t.bandwidthMonitor.add(e),r(e,a=>{t.bandwidthMonitor.remove(e),yz(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 Sk(e,t,r,o,n,i){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(n({message:`Reached max ${o} events size queued for upload: ${yk/uk}MiB`,source:vo.AGENT,startClocks:Ue()}),t.queueFullReported=!0);const a=t.queuedPayloads;for(t.queuedPayloads=kk();a.size()>0;)_k(a.dequeue(),t,r,o,n,i)}function yz(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||mz(e.status))}function bz(){return{transportStatus:0,currentBackoffTime:bk,bandwidthMonitor:_z(),queuedPayloads:kk(),queueFullReported:!1}}function kk(){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>=yk}}}function _z(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=gz&&this.ongoingRequestCount<hz},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 Fu=16*bn;function Om(e,t,r=Fu){const o=new ge,n=bz();return{observable:o,send:i=>{for(const a of e)_k(i,n,(s,c)=>{Xi(zr.AVOID_FETCH_KEEPALIVE)?gs(a,s,c):Sz(a,r,s,c)},a.trackType,t,o)},sendOnExit:i=>{for(const a of e)wz(a,r,i)}}}function wz(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){xz(n)}gs(e,r)}let Ug=!1;function xz(e){Ug||(Ug=!0,pr(e))}function Sz(e,t,r,o){if(kz()&&r.bytesCount<t){const i=e.build("fetch-keepalive",r);fetch(i,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(ie(a=>o?.({status:a.status,type:a.type}))).catch(ie(()=>gs(e,r,o)))}else gs(e,r,o)}function gs(e,t,r){const o=e.build("fetch",t);fetch(o,{method:"POST",body:t.data,mode:"cors"}).then(ie(n=>r?.({status:n.status,type:n.type}))).catch(ie(()=>r?.({status:0})))}function kz(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function yo(){const e=Ez();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 Ek(e){const t=yo();return!!t&&t.getCapabilities().includes(e)}function sn(e){var t;e===void 0&&(e=(t=Tt().location)===null||t===void 0?void 0:t.hostname);const r=yo();return!!r&&r.getAllowedWebViewHosts().some(o=>e===o||e.endsWith(`.${o}`))}function Ez(){return Tt().DatadogEventBridge}const Ln={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function Iz(e){return new ge(t=>{const{stop:r}=hr(e,window,["visibilitychange","freeze"],n=>{n.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:Ln.HIDDEN}):n.type==="freeze"&&t.notify({reason:Ln.FROZEN})},{capture:!0}),o=Oe(e,window,"beforeunload",()=>{t.notify({reason:Ln.UNLOADING})}).stop;return()=>{r(),o()}})}function Ik(e){return HS(Ln).includes(e)}const Lg=256*bn;function Tk({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:`
35
- ${u}`,m=>{r.notifyAfterAddMessage(m-d)})}function a(u){return u!==void 0&&o[u]!==void 0}function s(u){const d=o[u];delete o[u];const f=e.estimateEncodedBytesCount(d);r.notifyAfterRemoveMessage(f)}function c(u,d){const f=ho(u),m=e.estimateEncodedBytesCount(f);if(m>=Lg){ee.warn(`Discarded a message whose size was bigger than the maximum allowed size ${Lg/bn}KiB. ${ym} ${dj}/#technical-limitations`);return}a(d)&&s(d),i(f,m,d)}function l(u){const d=HS(o).join(`
36
- `);o={};const f=Ik(u.reason),m=f?t.sendOnExit:t.send;if(f&&e.isAsync){const h=e.finishSync();h.outputBytesCount&&m(Fg(h));const g=[h.pendingData,d].filter(Boolean).join(`
37
- `);g&&m({data:g,bytesCount:dk(g)})}else d&&e.write(e.isEmpty?d:`
38
- ${d}`),e.finish(h=>{m(Fg(h))})}return{flushController:r,add:c,upsert:c,stop:n.unsubscribe}}function Fg(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 Tz=30*Ke,$z=Nc?1:50;function $k({pageMayExitObservable:e,sessionExpireObservable:t}){const r=e.subscribe(d=>s(d.reason)),o=t.subscribe(()=>s("session_expire")),n=new ge(()=>()=>{r.unsubscribe(),o.unsubscribe()});let i=0,a=0;function s(d){if(a===0)return;const f=a,m=i;a=0,i=0,u(),n.notify({reason:d,messagesCount:f,bytesCount:m})}let c;function l(){c===void 0&&(c=Je(()=>{s("duration_limit")},Tz))}function u(){yt(c),c=void 0}return{flushObservable:n,get messagesCount(){return a},notifyBeforeAddMessage(d){i+d>=Fu&&s("bytes_limit"),a+=1,i+=d,l()},notifyAfterAddMessage(d=0){i+=d,a>=$z?s("messages_limit"):i>=Fu&&s("bytes_limit")},notifyAfterRemoveMessage(d){i-=d,a-=1,a===0&&u()}}}const Dr="DISCARDED",xt="SKIPPED";function Oz(){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!==xt&&n.push(a)}return vr(...n)}}}const Cr={LOG:"log",CONFIGURATION:"configuration",USAGE:"usage"},Az=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],Cz=1,Nz=[u2],Rz=15;let Nl;function bo(){return Nl||(Nl=new US(100)),Nl}function Pz(e,t,r,o,n,i){const a=new ge,{stop:s}=zz(t,o,n,i,a),{enabled:c,metricsEnabled:l}=jz(e,t,r,a);return{stop:s,enabled:c,metricsEnabled:l}}function jz(e,t,r,o,n=Cz,i=Rz){const a={},s=!Nz.includes(t.site)&&Xr(t.telemetrySampleRate),c={[Cr.LOG]:s,[Cr.CONFIGURATION]:s&&Xr(t.telemetryConfigurationSampleRate),[Cr.USAGE]:s&&Xr(t.telemetryUsageSampleRate),metric:s&&Xr(n)},l=Dz(),u=bo();return u.subscribe(({rawEvent:f,metricName:m})=>{if(m&&!c.metric||!c[f.type])return;const h=m||f.status||f.type;let g=a[h];if(g||(g=a[h]=new Set),g.size>=i)return;const y=ho(f);if(g.has(y))return;const b=r.triggerHook(1,{startTime:Ue().relative});if(b===Dr)return;const w=d(b,e,f,l);o.notify(w),Tm("telemetry",w),g.add(y)}),u.unbuffer(),mj(Am),{enabled:s,metricsEnabled:c.metric};function d(f,m,h,g){const b={type:"telemetry",date:Ue().timeStamp,service:m,version:"6.24.1",source:"browser",_dd:{format_version:2},telemetry:vr(h,{runtime_env:g,connectivity:vk(),sdk_setup:"npm"}),ddtags:Im(t).join(","),experimental_features:Array.from(E2())};return vr(b,f)}}function zz(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&&Mz(e)&&a.push(e.replica.rumEndpointBuilder);const s=Tk({encoder:o(4),request:Om(a,t),flushController:$k({pageMayExitObservable:r,sessionExpireObservable:new ge})});i.push(s.stop);const c=n.subscribe(s.add);i.push(c.unsubscribe)}return{stop:()=>i.forEach(a=>a())}}function Dz(){var e;return{is_local_file:((e=or.location)===null||e===void 0?void 0:e.protocol)==="file:",is_worker:Nc}}function Mz(e){return e.site===ik}function _o(e,t){zu(Ac.debug,e,t),bo().notify({rawEvent:{type:Cr.LOG,message:e,status:"debug",...t}})}function Am(e,t){bo().notify({rawEvent:{type:Cr.LOG,status:"error",...Lz(e),...t}})}function Uz(e){bo().notify({rawEvent:{type:Cr.CONFIGURATION,configuration:e}})}function ta(e,t){bo().notify({rawEvent:{type:Cr.LOG,message:e,status:"debug",...t},metricName:e})}function Ve(e){bo().notify({rawEvent:{type:Cr.USAGE,usage:e}})}function Lz(e){if(_n(e)){const t=Qi(e);return{error:{kind:t.name,stack:ea(Fz(t))},message:t.message}}return{error:{stack:mk},message:`Uncaught ${ho(e)}`}}function Fz(e){return e.stack=e.stack.filter(t=>!t.url||Az.some(r=>t.url.startsWith(r))),e}function Ok(e,t){const r=e.indexOf(t);r>=0&&e.splice(r,1)}function rn(e){return Array.isArray(e)&&e.length>0}const wa=1/0,Vz=lt;let Po=null;const Ma=new Set;function Zz(){Ma.forEach(e=>e())}function wo({expireDelay:e,maxEntries:t}){let r=[];Po||(Po=po(()=>Zz(),Vz));const o=()=>{const u=wt()-e;for(;r.length>0&&r[r.length-1].endTime<u;)r.pop()};Ma.add(o);function n(u,d){const f={value:u,startTime:d,endTime:wa,remove:()=>{Ok(r,f)},close:m=>{f.endTime=m}};return t&&r.length>=t&&r.pop(),r.unshift(f),f}function i(u=wa,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===wa&&d.close(u)}function s(u=wa,d=0){const f=go(u,d);return r.filter(m=>m.startTime<=f&&u<=m.endTime).map(m=>m.value)}function c(){r=[]}function l(){Ma.delete(o),Ma.size===0&&Po&&(Rc(Po),Po=null)}return{add:n,find:i,closeActive:a,findAll:s,reset:c,stop:l}}const Bz="datadog-synthetics-public-id",qz="datadog-synthetics-result-id",Gz="datadog-synthetics-injects-rum";function Ak(){return Nc?!1:!!(or._DATADOG_SYNTHETICS_INJECTS_RUM||Tr(Gz))}function Ck(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||Tr(Bz);return typeof e=="string"?e:void 0}function Nk(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||Tr(qz);return typeof e=="string"?e:void 0}function Rk(){return!!(Ck()&&Nk())}const Hz=lt,Wz=vn;function Jz(e,t,r,o){const n=new ge,i=new ge,a=t2(e.sessionStoreStrategyType,e,t,r),s=wo({expireDelay:Wz});if(a.renewObservable.subscribe(()=>{s.add(c(),wt()),n.notify()}),a.expireObservable.subscribe(()=>{i.notify(),s.closeActive(wt())}),a.expandOrRenewSession(),s.add(c(),bm().relative),Xi(zr.SHORT_SESSION_INVESTIGATION)){const l=a.getSession();l&&eD(e,l)}o.observable.subscribe(()=>{o.isGranted()?a.expandOrRenewSession():a.expire(!1)}),Kz(e,()=>{o.isGranted()&&a.expandOrRenewSession()}),Yz(e,()=>a.expandSession()),Xz(e,()=>a.restartSession());function c(){const l=a.getSession();return l?{id:l.id,trackingType:l[t],isReplayForced:!!l.forcedReplay,anonymousId:l.anonymousId}:(Qz(e).catch(()=>{}),{id:"invalid",trackingType:JS,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 Kz(e,t){const{stop:r}=hr(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function Yz(e,t){const r=()=>{document.visibilityState==="visible"&&t()},{stop:o}=Oe(e,document,"visibilitychange",r);po(r,Hz)}function Xz(e,t){const{stop:r}=Oe(e,window,"resume",t,{capture:!0})}async function Qz(e){const t=e.sessionStoreStrategyType;if(!t)return;let r,o;t.type===oo.COOKIE?(r=QS(t.cookieOptions,e),o={cookie:await Pk(),currentDomain:`${window.location.protocol}//${window.location.hostname}`}):r=rk(),_o("Unexpected session state",{sessionStoreStrategyType:t.type,session:r,isSyntheticsTest:Rk(),createdTimestamp:r?.created,expireTimestamp:r?.expire,...o})}function eD(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=GS(a.changed,l=>l.name===gr);if(!s)return;const c=ct()-r;if(c>14*lt)n();else{const l=Dc(s.value);if(l.id&&l.id!==t.id){n();const u=ct()-o;Pk().then(d=>{_o("Session cookie changed",{time:u,session_age:c,old:t,new:l,cookie:d})}).catch(pr)}}}}async function Pk(){let e;return"cookieStore"in window?e=await window.cookieStore.getAll(gr):e=document.cookie.split(/\s*;\s*/).filter(t=>t.startsWith(gr)),{count:e.length,domain:qS()||"undefined",...e}}function tD(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(r,o){const n=dk(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 rD{constructor(){this.callbacks={}}notify(t,r){const o=this.callbacks[t];o&&o.forEach(n=>n(r))}subscribe(t,r){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(r),{unsubscribe:()=>{this.callbacks[t]=this.callbacks[t].filter(o=>r!==o)}}}}const nD=3e3;function Rl(e,t,r=nD){let o=0,n=!1;return{isLimitReached(){if(o===0&&Je(()=>{o=0},lt),o+=1,o<=r||n)return n=!1,!1;if(o===r+1){n=!0;try{t({message:`Reached max number of ${e}s by minute: ${r}`,source:vo.AGENT,startClocks:Ue()})}finally{n=!1}}return!0}}}function Cm(e,t,r){return document.readyState===t||document.readyState==="complete"?(r(),{stop:be}):Oe(e,window,t==="complete"?"load":"DOMContentLoaded",r,{once:!0})}function oD(e,t){return new Promise(r=>{Cm(e,t,r)})}let Pl;const Nm=new WeakMap;function iD(e){return Pl||(Pl=aD(e)),Pl}function aD(e){return new ge(t=>{const{stop:r}=Bt(XMLHttpRequest.prototype,"open",sD),{stop:o}=Bt(XMLHttpRequest.prototype,"send",i=>{cD(i,e,t)},{computeHandlingStack:!0}),{stop:n}=Bt(XMLHttpRequest.prototype,"abort",lD);return()=>{r(),o(),n()}})}function sD({target:e,parameters:[t,r]}){Nm.set(e,{state:"open",method:String(t).toUpperCase(),url:xm(String(r))})}function cD({target:e,parameters:[t],handlingStack:r},o,n){const i=Nm.get(e);if(!i)return;const a=i;a.state="start",a.startClocks=Ue(),a.isAborted=!1,a.xhr=e,a.handlingStack=r,a.requestBody=t;let s=!1;const{stop:c}=Bt(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&l()}),l=()=>{if(u(),c(),s)return;s=!0;const d=i;d.state="complete",d.duration=Ne(a.startClocks.timeStamp,Be()),d.status=e.status,typeof e.response=="string"&&(d.responseBody=e.response),n.notify(ii(d))},{stop:u}=Oe(o,e,"loadend",l);n.notify(a)}function lD({target:e}){const t=Nm.get(e);t&&(t.isAborted=!0)}async function uD(e,t){const r=e.getReader(),o=[];for(;;){const n=await r.read();if(n.done)break;t.collectStreamBody&&o.push(n.value)}return r.cancel().catch(be),t.collectStreamBody?fk(o):void 0}let jl;const jk=[];function zk({responseBodyAction:e}={}){return e&&jk.push(e),jl||(jl=dD()),jl}function dD(){return new ge(e=>{if(!or.fetch)return;const{stop:t}=Bt(or,"fetch",r=>fD(r,e),{computeHandlingStack:!0});return t})}function fD({parameters:e,onPostCall:t,handlingStack:r},o){const[n,i]=e;let a=i&&i.method;a===void 0&&n instanceof Request&&(a=n.method);const s=a!==void 0?String(a).toUpperCase():"GET",c=n instanceof Request?n.url:xm(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=>{mD(o,d,u).catch(pr)})}async function mD(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=jk.reduce((c,l)=>Math.max(c,l(i)),0);if(s!==0){const c=pz(a);if(c&&c.body)try{const l=await uD(c.body,{collectStreamBody:s===2});i.responseBody=l&&new TextDecoder().decode(l)}catch{}}e.notify(i)}function Dk(e,t){if(window.requestIdleCallback&&window.cancelIdleCallback){const r=window.requestIdleCallback(ie(e),t);return()=>window.cancelIdleCallback(r)}return gD(e)}const pD=50;function gD(e){const t=ct(),r=Je(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,pD-(ct()-t))})},0);return()=>yt(r)}const hD=Ke,vD=30;function yD(){const e=[];function t(o){let n;if(o.didTimeout){const i=performance.now();n=()=>vD-(performance.now()-i)}else n=o.timeRemaining.bind(o);for(;n()>0&&e.length;)e.shift()();e.length&&r()}function r(){Dk(t,{timeout:hD})}return{push(o){e.push(o)===1&&r()},stop(){e.length=0}}}let zl={};function bD(e){const t=e.map(r=>(zl[r]||(zl[r]=_D(r)),zl[r]));return MS(...t)}function _D(e){return new ge(t=>{const r=ur[e];return ur[e]=(...o)=>{r.apply(console,o);const n=ms("console error");Ar(()=>{t.notify(wD(o,e,n))})},()=>{ur[e]=r}})}function wD(e,t,r){const o=e.map(n=>xD(n)).join(" ");if(t===Ac.error){const n=e.find(_n),i=Em({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 xD(e){return typeof e=="string"?$e(e):_n(e)?lk(Qi(e)):ho($e(e),void 0,2)}const SD=500;function kD(){const e=[];return{add:n=>{e.push(n)>SD&&e.splice(0,1)},remove:n=>{Ok(e,n)},drain:n=>{e.forEach(i=>i(n)),e.length=0}}}function ED(e){const t=yn(e)==="object";return t||ee.error("Unsupported context:",e),t}function Dl(e,t,r){const o={...e};for(const[n,{required:i,type:a}]of Object.entries(t))a==="string"&&!Vg(o[n])&&(o[n]=String(o[n])),i&&Vg(o[n])&&ee.warn(`The property ${n} of ${r} is required; context will not be sent to the intake.`);return o}function Vg(e){return e==null||e===""}function Uc(e="",{propertiesConfig:t={}}={}){let r={};const o=new ge,n={getContext:()=>$m(r),setContext:i=>{ED(i)?r=$e(Dl(i,t,e)):n.clearContext(),o.notify()},setContextProperty:(i,a)=>{r=$e(Dl({...r,[i]:a},t,e)),o.notify()},removeContextProperty:i=>{delete r[i],Dl(r,t,e),o.notify()},clearContext:()=>{r={},o.notify()},changeObservable:o};return n}function rt(e,t,r,o){return ie((...n)=>(o&&Ve({feature:o}),e()[t][r](...n)))}const ID="_dd_c",TD=[];function Rm(e,t,r,o){const n=$D(r,o);TD.push(Oe(e,window,"storage",({key:l})=>{n===l&&a()})),t.changeObservable.subscribe(s);const i=vr(c(),t.getContext());Vr(i)||t.setContext(i);function a(){t.setContext(c())}function s(){localStorage.setItem(n,JSON.stringify(t.getContext()))}function c(){const l=localStorage.getItem(n);return l?JSON.parse(l):{}}}function $D(e,t){return`${ID}_${e}_${t}`}function OD(e,t,r){const o=Mk();return t.storeContextsAcrossPages&&Rm(t,o,r,4),e.register(0,()=>{const n=o.getContext();return Vr(n)||!n.id?xt:{account:n}}),o}function Mk(){return Uc("account",{propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}})}function AD(e,t,r,o){const n=Uk();return t.storeContextsAcrossPages&&Rm(t,n,r,2),e.register(0,()=>({context:n.getContext()})),n}function Uk(){return Uc("global context")}function CD(e,t,r,o){const n=Lk();return t.storeContextsAcrossPages&&Rm(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)?xt:{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 Lk(){return Uc("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"},Lc={FETCH:at.FETCH,XHR:at.XHR},ND=500;function RD(e=X2){const t=new US(ND),r=e().subscribe(o=>{t.notify({type:0,error:o})});return{observable:t,stop:()=>{r.unsubscribe()}}}function PD(){try{return new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const re={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",VITAL:"vital"},Fk={LONG_TASK:"long-task",LONG_ANIMATION_FRAME:"long-animation-frame"},dr={INITIAL_LOAD:"initial_load",ROUTE_CHANGE:"route_change",BF_CACHE:"bf_cache"},Fc={CLICK:"click",CUSTOM:"custom"},jo={RAGE_CLICK:"rage_click",ERROR_CLICK:"error_click",DEAD_CLICK:"dead_click"},li={DURATION:"duration",OPERATION_STEP:"operation_step"};function jD(){return{vitalsByName:new Map,vitalsByReference:new WeakMap}}function zD(e,t,r){function o(a){return!t.wasInPageStateDuringPeriod("frozen",a.startClocks.relative,a.duration)}function n(a){o(a)&&e.notify(12,Zg(a))}function i(a,s,c,l){if(!Xi(zr.FEATURE_OPERATION_VITAL))return;const{operationKey:u,context:d,description:f}=c||{},m={name:a,type:li.OPERATION_STEP,operationKey:u,failureReason:l,stepType:s,startClocks:Ue(),context:$e(d),description:f};e.notify(12,Zg(m))}return{addOperationStepVital:i,addDurationVital:n,startDurationVital:(a,s={})=>Vk(r,a,s),stopDurationVital:(a,s={})=>{Zk(n,r,a,s)}}}function Vk({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(DD(i,i.startClocks,n,Ue())),typeof o=="string"?t.delete(o):r.delete(o))}function DD(e,t,r,o){var n;return{name:e.name,type:li.DURATION,startClocks:t,duration:Ne(t.timeStamp,o.timeStamp),context:vr(e.context,r.context),description:(n=r.description)!==null&&n!==void 0?n:e.description}}function Zg(e){const{startClocks:t,type:r,name:o,description:n,context:i}=e,a={id:et(),type:r,name:o,description:n,...r===li.DURATION?{duration:ae(e.duration)}:{step_type:e.stepType,operation_key:e.operationKey,failure_reason:e.failureReason}};return{rawRumEvent:{date:t.timeStamp,vital:a,type:re.VITAL,context:i},startTime:t.relative,duration:r===li.DURATION?e.duration:void 0,domainContext:{}}}function Bk(e,t,r){if(e)for(const o of e){const n=o[t];n&&n(r)}}const Bg=new Map;function qk(e,t){if(t===100)return!0;if(t===0)return!1;const r=Bg.get(t);if(r&&e===r.sessionId)return r.decision;let o;return window.BigInt?o=MD(BigInt(`0x${e.split("-")[4]}`),t):o=Xr(t),Bg.set(t,{sessionId:e,decision:o}),o}function MD(e,t){const r=BigInt("1111111111111111111"),o=BigInt("0x10000000000000000"),n=e*r%o;return Number(n)<=t/100*Number(o)}function UD(){return Hk(64)}function Gk(){return Hk(63)}function Hk(e){const t=crypto.getRandomValues(new Uint32Array(2));return e===63&&(t[t.length-1]>>>=1),{toString(r=10){let o=t[1],n=t[0],i="";do{const a=o%r*4294967296+n;o=Math.floor(o/r),n=Math.floor(a/r),i=(a%r).toString(r)+i}while(o||n);return i}}}function $n(e){return e.toString(16).padStart(16,"0")}function LD(e){const t=e;return yn(t)==="object"&&si(t.match)&&Array.isArray(t.propagatorTypes)}function FD(e){e.status===0&&!e.isAborted&&(e.traceId=void 0,e.spanId=void 0,e.traceSampled=void 0)}function VD(e,t,r,o){return{clearTracingIfNeeded:FD,traceFetch:n=>qg(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=ii(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(zc(i))}}),traceXhr:(n,i)=>qg(e,n,t,r,o,a=>{Object.keys(a).forEach(s=>{i.setRequestHeader(s,a[s])})})}}function qg(e,t,r,o,n,i){const a=r.findTrackedSession();if(!a)return;const s=e.allowedTracingUrls.find(u=>Mc([u.match],t.url,!0));if(!s)return;const c=qk(a.id,e.traceSampleRate);(c||e.traceContextInjection===Uu.ALL)&&(t.traceSampled=c,t.traceId=UD(),t.spanId=Gk(),i(ZD(t.traceId,t.spanId,t.traceSampled,a.id,s.propagatorTypes,o,n,e)))}function ZD(e,t,r,o,n,i,a,s){const c={};if(n.forEach(l=>{switch(l){case"datadog":{Object.assign(c,{"x-datadog-origin":"rum","x-datadog-parent-id":t.toString(),"x-datadog-sampling-priority":r?"1":"0","x-datadog-trace-id":e.toString()});break}case"tracecontext":{Object.assign(c,{traceparent:`00-0000000000000000${$n(e)}-${$n(t)}-0${r?"1":"0"}`,tracestate:`dd=s:${r?"1":"0"};o:rum`});break}case"b3":{Object.assign(c,{b3:`${$n(e)}-${$n(t)}-${r?"1":"0"}`});break}case"b3multi":{Object.assign(c,{"X-B3-TraceId":$n(e),"X-B3-SpanId":$n(t),"X-B3-Sampled":r?"1":"0"});break}}}),s.propagateTraceBaggage){const l={"session.id":o},u=i.getContext().id;typeof u=="string"&&(l["user.id"]=u);const d=a.getContext().id;typeof d=="string"&&(l["account.id"]=d);const f=Object.entries(l).map(([m,h])=>`${m}=${encodeURIComponent(h)}`).join(",");f&&(c.baggage=f)}return c}const Wk=["tracecontext","datadog"];function BD(e,t){var r,o,n,i,a,s,c;if(e.trackFeatureFlagsForEvents!==void 0&&!Array.isArray(e.trackFeatureFlagsForEvents)&&ee.warn("trackFeatureFlagsForEvents should be an array"),!e.applicationId){ee.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)){ee.error("Excluded Activity Urls should be an array");return}const l=qD(e);if(!l)return;const u=w2(e,t),d=HD(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:Hi(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:fs(zn,e.defaultPrivacyLevel)?e.defaultPrivacyLevel:zn.MASK,enablePrivacyForActionName:!!e.enablePrivacyForActionName,traceContextInjection:fs(Uu,e.traceContextInjection)?e.traceContextInjection:Uu.SAMPLED,plugins:e.plugins||[],trackFeatureFlagsForEvents:e.trackFeatureFlagsForEvents||[],profilingSampleRate:(c=e.profilingSampleRate)!==null&&c!==void 0?c:0,propagateTraceBaggage:!!e.propagateTraceBaggage,allowedGraphQlUrls:d,...u}}function qD(e){if(e.allowedTracingUrls===void 0)return[];if(!Array.isArray(e.allowedTracingUrls)){ee.error("Allowed Tracing URLs should be an array");return}if(e.allowedTracingUrls.length!==0&&e.service===void 0){ee.error("Service needs to be configured when tracing is enabled");return}const t=[];return e.allowedTracingUrls.forEach(r=>{si(r)?t.push({match:r,propagatorTypes:Wk}):LD(r)?t.push(r):ee.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",r)}),t}function GD(e){const t=new Set;return rn(e.allowedTracingUrls)&&e.allowedTracingUrls.forEach(r=>{si(r)?Wk.forEach(o=>t.add(o)):yn(r)==="object"&&Array.isArray(r.propagatorTypes)&&r.propagatorTypes.forEach(o=>t.add(o))}),Array.from(t)}function HD(e){if(!e.allowedGraphQlUrls)return[];if(!Array.isArray(e.allowedGraphQlUrls))return ee.warn("allowedGraphQlUrls should be an array"),[];const t=[];return e.allowedGraphQlUrls.forEach(r=>{si(r)?t.push({match:r,trackPayload:!1,trackResponseErrors:!1}):r&&typeof r=="object"&&"match"in r&&si(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 JD(e){return rn(e)&&e.some(t=>typeof t=="object"&&"trackResponseErrors"in t?!!t.trackResponseErrors:!1)}function KD(e){var t;const r=x2(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:JD(e.allowedGraphQlUrls),selected_tracing_propagators:GD(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 YD(e){const t=[];let r=0,o;const n={quote:void 0,escapeSequence:void 0};let i="";for(const a of e){if(o=Gg[r].find(s=>nM[s](a,n)),!o)return[];if(n.escapeSequence!==void 0&&o!==12){if(!aM(n.escapeSequence))return[];i+=cM(n.escapeSequence),n.escapeSequence=void 0}oM.includes(o)?i+=a:iM.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 Gg[r].includes(1)?(i!==""&&t.push(i),t):[]}const XD=/[a-zA-Z_$]/,QD=/[a-zA-Z0-9_$]/,eM=/[0-9]/,tM=/[a-fA-F0-9]/,rM=`'"`,nM={0:()=>!1,1:()=>!1,2:e=>XD.test(e),3:e=>QD.test(e),4:e=>e===".",5:e=>e==="[",6:e=>e==="]",7:e=>eM.test(e),8:e=>rM.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?tM.test(e):!1},Gg={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]},oM=[2,3,7,10],iM=[4,5,6];function aM(e){return`"'/\\bfnrt`.includes(e)||e.startsWith("u")&&e.length===5}const sM={'"':'"',"'":"'","/":"/","\\":"\\",b:"\b",f:"\f",n:`
39
- `,r:"\r",t:" "};function cM(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):sM[e]}const lM="v1",uM=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function dM(e,t){let r;const o=mM(),n=await vM(e);return n.ok?(o.increment("fetch","success"),r=fM(e,n.value,t,o)):(o.increment("fetch","failure"),ee.error(n.error)),ta("remote configuration metrics",{metrics:o.get()}),r}function fM(e,t,r,o){const n={...e};return uM.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(pM(f)){if(gM(f)){const m=f.rcSerializedType;switch(m){case"string":return f.value;case"regex":return Jk(f.value);case"dynamic":return s(f);default:ee.error(`Unsupported remote configuration: "rcSerializedType": "${m}"`);return}}return zS(f,i)}return f}function a(f,m){m.forEach(({key:h,value:g})=>{f.setContextProperty(h,i(g))})}function s(f){const m=f.strategy;let h;switch(m){case"cookie":h=c(f);break;case"dom":h=l(f);break;case"js":h=d(f);break;default:ee.error(`Unsupported remote configuration: "strategy": "${m}"`);return}const g=f.extractor;return g!==void 0&&typeof h=="string"?hM(g,h):h}function c({name:f}){const m=jc(f);return o.increment("cookie",m!==void 0?"success":"missing"),m}function l({selector:f,attribute:m}){let h;try{h=document.querySelector(f)}catch{ee.error(`Invalid selector in the remote configuration: '${f}'`),o.increment("dom","failure");return}if(!h){o.increment("dom","missing");return}if(u(h,m)){ee.error(`Forbidden element selected by the remote configuration: '${f}'`),o.increment("dom","failure");return}const g=m!==void 0?h.getAttribute(m):h.textContent;if(g===null){o.increment("dom","missing");return}return o.increment("dom","success"),g}function u(f,m){return f.getAttribute("type")==="password"&&m==="value"}function d({path:f}){let m=window;const h=YD(f);if(h.length===0){ee.error(`Invalid JSON path in the remote configuration: '${f}'`),o.increment("js","failure");return}for(const g of h){if(!(g in m)){o.increment("js","missing");return}try{m=m[g]}catch(y){ee.error(`Error accessing: '${f}'`,y),o.increment("js","failure");return}}return o.increment("js","success"),m}}function mM(){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 pM(e){return typeof e=="object"&&e!==null}function gM(e){return"rcSerializedType"in e}function Jk(e){try{return new RegExp(e)}catch{ee.error(`Invalid regex in the remote configuration: '${e}'`)}}function hM(e,t){const r=Jk(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 vM(e){let t;try{t=await fetch(yM(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 yM(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${ak("rum",e)}/${lM}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function bM({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,o,n){const i=kD(),a=Uk();Ml(a,Ze.globalContext,i);const s=Lk();Ml(s,Ze.userContext,i);const c=Mk();Ml(c,Ze.accountContext,i);let l,u,d,f;const m=r.observable.subscribe(g),h={};function g(){if(!d||!f||!r.isGranted())return;m.unsubscribe();let v;if(f.trackViewsManually){if(!l)return;i.remove(l.callback),v=l.options}const k=n(f,u,v);i.drain(k)}function y(v,k){const E=sn();if(E&&(v=_M(v)),d=v,Uz(KD(v)),f){pk("DD_RUM",v);return}const I=BD(v,k);if(I){if(!E&&!I.sessionStoreStrategyType){ee.warn("No storage available for session. We will not send any data.");return}I.compressIntakeRequests&&!E&&t&&(u=t(I,"Datadog RUM",be),!u)||(f=I,zk().subscribe(be),r.tryToInit(I.trackingConsent),g())}}const b=v=>{i.add(k=>k.addDurationVital(v))};return{init(v,k,E){if(!v){ee.error("Missing configuration");return}S2(v.enableExperimentalFeatures),d=v,!(e&&Ak())&&(Bk(v.plugins,"onInit",{initConfiguration:v,publicApi:k}),v.remoteConfigurationId?dM(v,{user:s,context:a}).then(I=>{I&&y(I,E)}).catch(pr):y(v,E))},get initConfiguration(){return d},getInternalContext:be,stopSession:be,addTiming(v,k=Be()){i.add(E=>E.addTiming(v,k))},startView(v,k=Ue()){const E=I=>{I.startView(v,k)};i.add(E),l||(l={options:v,callback:E},g())},setViewName(v){i.add(k=>k.setViewName(v))},setViewContext(v){i.add(k=>k.setViewContext(v))},setViewContextProperty(v,k){i.add(E=>E.setViewContextProperty(v,k))},getViewContext:()=>h,globalContext:a,userContext:s,accountContext:c,addAction(v){i.add(k=>k.addAction(v))},addError(v){i.add(k=>k.addError(v))},addFeatureFlagEvaluation(v,k){i.add(E=>E.addFeatureFlagEvaluation(v,k))},startDurationVital(v,k){return Vk(o,v,k)},stopDurationVital(v,k){Zk(b,o,v,k)},addDurationVital:b,addOperationStepVital:(v,k,E,I)=>{i.add(C=>C.addOperationStepVital($e(v),k,$e(E),$e(I)))}}}function _M(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 Ml(e,t,r){e.changeObservable.subscribe(()=>{const o=e.getContext();r.add(n=>n[t].setContext(o))})}function wM(e,t,r,o={}){const n=r2(),i=jD(),a=RD().observable;let s=bM(o,n,i,(d,f,m)=>{const h=f&&o.createDeflateEncoder?y=>o.createDeflateEncoder(d,f,y):tD,g=e(d,t,r,m,h,n,i,a,o.sdkName);return t.onRumStart(g.lifeCycle,d,g.session,g.viewHistory,f,g.telemetry),r.onRumStart(g.lifeCycle,g.hooks,d,g.session,g.viewHistory,h),s=xM(s,g),Bk(d.plugins,"onRumStart",{strategy:s,addEvent:g.addEvent}),g});const c=()=>s,l=ie(d=>{const f=typeof d=="object"?d:{name:d};s.startView(f),Ve({feature:"start-view"})}),u=tz({init:d=>{const f=new Error().stack;Ar(()=>s.init(d,u,f))},setTrackingConsent:ie(d=>{n.update(d),Ve({feature:"set-tracking-consent",tracking_consent:d})}),setViewName:ie(d=>{s.setViewName(d),Ve({feature:"set-view-name"})}),setViewContext:ie(d=>{s.setViewContext(d),Ve({feature:"set-view-context"})}),setViewContextProperty:ie((d,f)=>{s.setViewContextProperty(d,f),Ve({feature:"set-view-context-property"})}),getViewContext:ie(()=>(Ve({feature:"set-view-context-property"}),s.getViewContext())),getInternalContext:ie(d=>s.getInternalContext(d)),getInitConfiguration:ie(()=>$m(s.initConfiguration)),addAction:(d,f)=>{const m=ms("action");Ar(()=>{s.addAction({name:$e(d),context:$e(f),startClocks:Ue(),type:Fc.CUSTOM,handlingStack:m}),Ve({feature:"add-action"})})},addError:(d,f)=>{const m=ms("error");Ar(()=>{s.addError({error:d,handlingStack:m,context:$e(f),startClocks:Ue()}),Ve({feature:"add-error"})})},addTiming:ie((d,f)=>{s.addTiming($e(d),f)}),setGlobalContext:rt(c,Ze.globalContext,nt.setContext,"set-global-context"),getGlobalContext:rt(c,Ze.globalContext,nt.getContext,"get-global-context"),setGlobalContextProperty:rt(c,Ze.globalContext,nt.setContextProperty,"set-global-context-property"),removeGlobalContextProperty:rt(c,Ze.globalContext,nt.removeContextProperty,"remove-global-context-property"),clearGlobalContext:rt(c,Ze.globalContext,nt.clearContext,"clear-global-context"),setUser:rt(c,Ze.userContext,nt.setContext,"set-user"),getUser:rt(c,Ze.userContext,nt.getContext,"get-user"),setUserProperty:rt(c,Ze.userContext,nt.setContextProperty,"set-user-property"),removeUserProperty:rt(c,Ze.userContext,nt.removeContextProperty,"remove-user-property"),clearUser:rt(c,Ze.userContext,nt.clearContext,"clear-user"),setAccount:rt(c,Ze.accountContext,nt.setContext,"set-account"),getAccount:rt(c,Ze.accountContext,nt.getContext,"get-account"),setAccountProperty:rt(c,Ze.accountContext,nt.setContextProperty,"set-account-property"),removeAccountProperty:rt(c,Ze.accountContext,nt.removeContextProperty,"remove-account-property"),clearAccount:rt(c,Ze.accountContext,nt.clearContext,"clear-account"),startView:l,stopSession:ie(()=>{s.stopSession(),Ve({feature:"stop-session"})}),addFeatureFlagEvaluation:ie((d,f)=>{s.addFeatureFlagEvaluation($e(d),$e(f)),Ve({feature:"add-feature-flag-evaluation"})}),getSessionReplayLink:ie(()=>t.getSessionReplayLink()),startSessionReplayRecording:ie(d=>{t.start(d),Ve({feature:"start-session-replay-recording",force:d&&d.force})}),stopSessionReplayRecording:ie(()=>t.stop()),addDurationVital:ie((d,f)=>{Ve({feature:"add-duration-vital"}),s.addDurationVital({name:$e(d),type:li.DURATION,startClocks:hj(f.startTime),duration:f.duration,context:$e(f&&f.context),description:$e(f&&f.description)})}),startDurationVital:ie((d,f)=>(Ve({feature:"start-duration-vital"}),s.startDurationVital($e(d),{context:$e(f&&f.context),description:$e(f&&f.description)}))),stopDurationVital:ie((d,f)=>{Ve({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?$e(d):d,{context:$e(f&&f.context),description:$e(f&&f.description)})}),startFeatureOperation:ie((d,f)=>{Ve({feature:"add-operation-step-vital",action_type:"start"}),s.addOperationStepVital(d,"start",f)}),succeedFeatureOperation:ie((d,f)=>{Ve({feature:"add-operation-step-vital",action_type:"succeed"}),s.addOperationStepVital(d,"end",f)}),failFeatureOperation:ie((d,f,m)=>{Ve({feature:"add-operation-step-vital",action_type:"fail"}),s.addOperationStepVital(d,"end",m,f)})});return u}function xM(e,t){return{init:r=>{pk("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function SM(){const e=Kk();return new ge(t=>{if(!e)return;const r=new e(ie(o=>t.notify(o)));return r.observe(document,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),()=>r.disconnect()})}function Kk(){let e;const t=window;if(t.Zone&&(e=jr(t,"MutationObserver"),t.MutationObserver&&e===t.MutationObserver)){const r=new t.MutationObserver(be),o=jr(r,"originalInstance");e=o&&o.constructor}return e||(e=t.MutationObserver),e}function kM(){const e=new ge,{stop:t}=Bt(window,"open",()=>e.notify());return{observable:e,stop:t}}function EM(e,t,r,o,n){return{get:i=>{const a=r.findView(i),s=n.findUrl(i),c=t.findTrackedSession(i);if(c&&a&&s){const l=o.findActionId(i);return{application_id:e,session_id:c.id,user_action:l?{id:l}:void 0,view:{id:a.id,name:a.name,referrer:s.referrer,url:s.url}}}}}}const IM=rD,TM=vn;function $M(e){const t=wo({expireDelay:TM});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 Yk="initial_document",OM=[[at.DOCUMENT,e=>Yk===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 AM(e){const t=e.name;if(!Ej(t))return at.OTHER;const r=Ij(t);for(const[o,n]of OM)if(n(e.initiatorType,r))return o;return at.OTHER}function Hg(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function Xk(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function CM(e){const{duration:t,startTime:r,responseEnd:o}=e;return t===0&&r<o?Ne(r,o):t}function NM(e){if(!eE(e))return;const{startTime:t,fetchStart:r,workerStart:o,redirectStart:n,redirectEnd:i,domainLookupStart:a,domainLookupEnd:s,connectStart:c,secureConnectionStart:l,connectEnd:u,requestStart:d,responseStart:f,responseEnd:m}=e,h={download:qr(t,f,m),first_byte:qr(t,d,f)};return 0<o&&o<r&&(h.worker=qr(t,o,r)),r<u&&(h.connect=qr(t,c,u),c<=l&&l<=u&&(h.ssl=qr(t,l,u))),r<s&&(h.dns=qr(t,a,s)),t<i&&(h.redirect=qr(t,n,i)),h}function Qk(e){return e.duration>=0}function eE(e){const t=Hg(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=RM(e)?Hg(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function RM(e){return e.redirectEnd>e.startTime}function qr(e,t,r){if(e<=t&&t<=r)return{duration:ae(Ne(t,r)),start:ae(Ne(e,t))}}function PM(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function jM(e){return e.deliveryType===""?"other":e.deliveryType}function zM(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 Pm(e){return e&&(!b2(e)||Xi(zr.TRACK_INTAKE_REQUESTS))}const DM=/data:(.+)?(;base64)?,/g,MM=24e3;function tE(e,t=MM){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(DM);return r?`${r[0]}[...]`:e}const UM=32*bn;function LM(e,t){const r=VM(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const o=FM(e.responseBody);o&&(r.errors_count=o.length,r.errors=o)}return r}}function FM(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 rE(e,t){return t.allowedGraphQlUrls.find(r=>Mc([r.match],e))}function VM(e,t=!1){if(!e||typeof e!="string")return;let r;try{r=JSON.parse(e)}catch{return}if(!r||!r.query)return;const o=r.query.trim(),n=ZM(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?wm(o,UM,"..."):void 0}}function ZM(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let Wg=1;function BM(e,t,r,o,n){const i=VD(t,r,o,n);qM(e,t,i),GM(e,t,i)}function qM(e,t,r){const o=iD(t).subscribe(n=>{const i=n;if(Pm(i.url))switch(i.state){case"start":r.traceXhr(i,i.xhr),i.requestIndex=nE(),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:Lc.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 GM(e,t,r){const o=zk({responseBodyAction:n=>{var i;return!((i=rE(n.url,t))===null||i===void 0)&&i.trackResponseErrors?2:1}}).subscribe(n=>{var i;const a=n;if(Pm(a.url))switch(a.state){case"start":r.traceFetch(a),a.requestIndex=nE(),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:Lc.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 nE(){const e=Wg;return Wg+=1,e}function oE(e){return Hi(e)&&e<0?void 0:e}function iE({lifeCycle:e,isChildEvent:t,onChange:r=be}){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 re.ERROR:o.errorCount+=1,r();break;case re.ACTION:o.actionCount+=1,i.action.frustration&&(o.frustrationCount+=i.action.frustration.type.length),r();break;case re.LONG_TASK:o.longTaskCount+=1,r();break;case re.RESOURCE:!((a=i._dd)===null||a===void 0)&&a.discarded||(o.resourceCount+=1,r());break}});return{stop:()=>{n.unsubscribe()},eventCounts:o}}function HM(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:wt(),processingEnd:wt(),startTime:s.timeStamp,duration:0,name:"",cancelable:!1,target:null,toJSON:()=>({})};s.type==="pointerdown"?i(e,c):a(c)},{passive:!0,capture:!0});return{stop:n};function i(s,c){hr(s,window,["pointerup","pointercancel"],l=>{l.type==="pointerup"&&a(c)},{once:!0})}function a(s){if(!o){o=!0,n();const c=s.processingStart-s.startTime;c>=0&&c<ct()-r&&t(s)}}}exports.RumPerformanceEntryType=void 0;(function(e){e.EVENT="event",e.FIRST_INPUT="first-input",e.LARGEST_CONTENTFUL_PAINT="largest-contentful-paint",e.LAYOUT_SHIFT="layout-shift",e.LONG_TASK="longtask",e.LONG_ANIMATION_FRAME="long-animation-frame",e.NAVIGATION="navigation",e.PAINT="paint",e.RESOURCE="resource",e.VISIBILITY_STATE="visibility-state"})(exports.RumPerformanceEntryType||(exports.RumPerformanceEntryType={}));function ir(e,t){return new ge(r=>{if(!window.PerformanceObserver)return;const o=c=>{const l=KM(c);l.length>0&&r.notify(l)};let n,i=!0;const a=new PerformanceObserver(ie(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,WM(e);let s;return!Zr(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=HM(e,c=>{o([c])})),()=>{a.disconnect(),s&&s(),yt(n)}})}let zo;function WM(e){return!zo&&JM()&&"addEventListener"in performance&&(zo=Oe(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{zo?.stop()}}function JM(){return window.performance!==void 0&&"getEntries"in performance}function Zr(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function KM(e){return e.filter(t=>!YM(t))}function YM(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!Pm(e.name)||!Qk(e))}function Vu(e){return e.nodeType===Node.TEXT_NODE}function XM(e){return e.nodeType===Node.COMMENT_NODE}function yr(e){return e.nodeType===Node.ELEMENT_NODE}function jm(e){return yr(e)&&!!e.shadowRoot}function aE(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&yr(t.host)}function QM(e){return e.childNodes.length>0||jm(e)}function e4(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;jm(e)&&t(e.shadowRoot)}function sE(e){return aE(e)?e.host:e.parentNode}const cE=100,t4=100,Jg="data-dd-excluded-activity-mutations";function zm(e,t,r,o,n,i){const a=n4(e,t,r,o);return r4(a,n,i)}function r4(e,t,r){let o,n=!1;const i=Je(ie(()=>l({hadActivity:!1})),cE),a=r!==void 0?Je(ie(()=>l({hadActivity:!0,end:Be()})),r):void 0,s=e.subscribe(({isBusy:u})=>{yt(i),yt(o);const d=Be();u||(o=Je(ie(()=>l({hadActivity:!0,end:d})),t4))}),c=()=>{n=!0,yt(i),yt(o),yt(a),s.unsubscribe()};function l(u){n||(c(),t(u))}return{stop:c}}function n4(e,t,r,o){return new ge(n=>{const i=[];let a,s=0;return i.push(t.subscribe(l=>{l.every(o4)||c()}),r.subscribe(c),ir(o,{type:exports.RumPerformanceEntryType.RESOURCE}).subscribe(l=>{l.some(u=>!Ul(o,u.name))&&c()}),e.subscribe(7,l=>{Ul(o,l.url)||(a===void 0&&(a=l.requestIndex),s+=1,c())}),e.subscribe(8,l=>{Ul(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 Ul(e,t){return Mc(e.excludedActivityUrls,t)}function o4(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&yr(t)&&t.matches(`[${Jg}], [${Jg}] *`))}const Vc="data-dd-action-name",lE="Masked Element",uE=[Vc,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],i4=[fE,s4],a4=[fE,c4,l4];function ra(e,t){if(!e.isConnected)return;let r,o=e;for(;o&&o.nodeName!=="HTML";){const n=Kg(o,i4,d4,t,r);if(n)return n;r=Kg(o,a4,f4,t,r)||Zc(u4(o),r),o=o.parentElement}return r}function dE(e){return/[0-9]/.test(e)}function s4(e){if(e.id&&!dE(e.id))return`#${CSS.escape(e.id)}`}function c4(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const o=t[r];if(!dE(o))return`${CSS.escape(e.tagName)}.${CSS.escape(o)}`}}function l4(e){return CSS.escape(e.tagName)}function fE(e,t){if(t){const o=r(t);if(o)return o}for(const o of uE){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 u4(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 Kg(e,t,r,o,n){for(const i of t){const a=i(e,o);if(a&&r(e,a,n))return Zc(a,n)}}function d4(e,t,r){return e.ownerDocument.querySelectorAll(Zc(t,r)).length===1}function f4(e,t,r){let o;if(r===void 0)o=a=>a.matches(t);else{const a=Zc(`${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 Zc(e,t){return t?`${e}>${t}`:e}const ce={IGNORE:"ignore",HIDDEN:"hidden",ALLOW:zn.ALLOW,MASK:zn.MASK,MASK_USER_INPUT:zn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:zn.MASK_UNLESS_ALLOWLISTED},Dm="data-dd-privacy",m4="hidden",p4="dd-privacy-",Ua="***",g4="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",h4={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},v4="x";function Jr(e){return`[${Dm}="${e}"], .${p4}${e}`}function na(e,t,r){if(r&&r.has(e))return r.get(e);const o=sE(e),n=o?na(o,t,r):t,i=pE(e),a=mE(i,n);return r&&r.set(e,a),a}function mE(e,t){switch(t){case ce.HIDDEN:case ce.IGNORE:return t}switch(e){case ce.ALLOW:case ce.MASK:case ce.MASK_USER_INPUT:case ce.MASK_UNLESS_ALLOWLISTED:case ce.HIDDEN:case ce.IGNORE:return e;default:return t}}function pE(e){if(yr(e)){if(e.tagName==="BASE")return ce.ALLOW;if(e.tagName==="INPUT"){const t=e;if(t.type==="password"||t.type==="email"||t.type==="tel"||t.type==="hidden")return ce.MASK;const r=t.getAttribute("autocomplete");if(r&&(r.startsWith("cc-")||r.endsWith("-password")))return ce.MASK}if(e.matches(Jr(ce.HIDDEN)))return ce.HIDDEN;if(e.matches(Jr(ce.MASK)))return ce.MASK;if(e.matches(Jr(ce.MASK_UNLESS_ALLOWLISTED)))return ce.MASK_UNLESS_ALLOWLISTED;if(e.matches(Jr(ce.MASK_USER_INPUT)))return ce.MASK_USER_INPUT;if(e.matches(Jr(ce.ALLOW)))return ce.ALLOW;if(b4(e))return ce.IGNORE}}function Mm(e,t){switch(t){case ce.MASK:case ce.HIDDEN:case ce.IGNORE:return!0;case ce.MASK_UNLESS_ALLOWLISTED:return Vu(e)?xa(e.parentNode)?!0:!vE(e.textContent||""):xa(e);case ce.MASK_USER_INPUT:return Vu(e)?xa(e.parentNode):xa(e);default:return!1}}function gE(e,t,r,o,n){if(o!==ce.MASK&&o!==ce.MASK_UNLESS_ALLOWLISTED||t===Dm||uE.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 xa(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!!h4[t.tagName]}const hE=e=>e.replace(/\S/g,v4);function y4(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=Ua;else if(a===ce.HIDDEN)n=Ua;else if(Mm(e,a))if(o==="DATALIST"||o==="SELECT"||o==="OPTGROUP"){if(!n.trim())return}else o==="OPTION"?n=Ua:a===ce.MASK_UNLESS_ALLOWLISTED?n=yE(n):n=hE(n);return n}function b4(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 vE(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function yE(e,t){return vE(e)?e:t||hE(e)}const bE=Ke,_4=100;function w4(e,t){const r=[];let o=0,n;i(e);function i(c){c.stopObservable.subscribe(a),r.push(c),yt(n),n=Je(s,bE)}function a(){o===1&&r.every(c=>c.isStopped())&&(o=2,t(r))}function s(){yt(n),o===0&&(o=1,a())}return{tryAppend:c=>o!==0?!1:r.length>0&&!x4(r[r.length-1].event,c.event)?(s(),!1):(i(c),!0),stop:()=>{s()}}}function x4(e,t){return e.target===t.target&&S4(e,t)<=_4&&e.timeStamp-t.timeStamp<=bE}function S4(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function k4(e,t,r=ce.ALLOW){const o=new Map,{actionNameAttribute:n}=t,i=Yg(e,Vc)||n&&Yg(e,n);return i?{name:i,nameSource:"custom_attribute"}:r===ce.MASK?{name:lE,nameSource:"mask_placeholder"}:Xg(e,E4,t,o)||Xg(e,I4,t,o)||{name:"",nameSource:"blank"}}function Yg(e,t){const r=e.closest(`[${t}]`);if(!r)return;const o=r.getAttribute(t);return wE(_E(o.trim()))}const E4=[(e,t,r)=>{if("labels"in e&&e.labels&&e.labels.length>0)return La(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 La(e,t,r)},(e,t,r)=>Do(e,"aria-label",t,r),(e,t,r)=>{const o=e.getAttribute("aria-labelledby");if(o)return{name:o.split(/\s+/).map(n=>$4(e,n)).filter(n=>!!n).map(n=>xE(n,t,r)).join(" "),nameSource:"text_content"}},(e,t,r)=>Do(e,"alt",t,r),(e,t,r)=>Do(e,"name",t,r),(e,t,r)=>Do(e,"title",t,r),(e,t,r)=>Do(e,"placeholder",t,r),(e,t,r)=>{if("options"in e&&e.options.length>0)return La(e.options[0],t,r)}],I4=[(e,t,r)=>La(e,t,r)],T4=10;function Xg(e,t,r,o){let n=e,i=0;for(;i<=T4&&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:wE(_E(u)),nameSource:l}}}if(n.nodeName==="FORM")break;n=n.parentElement,i+=1}}function _E(e){return e.replace(/\s+/g," ")}function wE(e){return e.length>100?`${wm(e,100)} [...]`:e}function $4(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}function Do(e,t,r,o){const{enablePrivacyForActionName:n,defaultPrivacyLevel:i}=r;let a=e.getAttribute(t);if(a&&n){const s=na(e,i,o);gE(e.tagName,t,a,s,r)&&(a=yE(a,lE))}else a||(a="");return{name:a,nameSource:"standard_attribute"}}function La(e,t,r){return{name:xE(e,t,r)||"",nameSource:"text_content"}}function xE(e,t,r){if(e.isContentEditable)return;const{enablePrivacyForActionName:o,actionNameAttribute:n,defaultPrivacyLevel:i}=t;if(Xi(zr.USE_TREE_WALKER_FOR_ACTION_NAME))return O4(e,n,o,i,r);if("innerText"in e){let a=e.innerText;const s=c=>{const l=e.querySelectorAll(c);for(let u=0;u<l.length;u+=1){const d=l[u];if("innerText"in d){const f=d.innerText;f&&f.trim().length>0&&(a=a.replace(f,""))}}};return s(`[${Vc}]`),n&&s(`[${n}]`),o&&s(`${Jr(ce.HIDDEN)}, ${Jr(ce.MASK)}`),a}return e.textContent}function O4(e,t,r,o,n){const i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,s);let a="";for(;i.nextNode();){const c=i.currentNode;if(yr(c)){(c.nodeName==="BR"||c.nodeName==="P"||["block","flex","grid","list-item","table","table-caption"].includes(getComputedStyle(c).display))&&(a+=" ");continue}a+=c.textContent||""}return a.replace(/\s+/g," ").trim();function s(c){const l=na(c,o,n);if(r&&l&&Mm(c,l))return NodeFilter.FILTER_REJECT;if(yr(c)){if(c.hasAttribute(Vc)||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 A4(e,{onPointerDown:t,onPointerUp:r}){let o,n={selection:!1,input:!1,scroll:!1},i;const a=[Oe(e,window,"pointerdown",s=>{eh(s)&&(o=Qg(),n={selection:!1,input:!1,scroll:!1},i=t(s))},{capture:!0}),Oe(e,window,"selectionchange",()=>{(!o||!Qg())&&(n.selection=!0)},{capture:!0}),Oe(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),Oe(e,window,"pointerup",s=>{if(eh(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 Qg(){const e=window.getSelection();return!e||e.isCollapsed}function eh(e){return e.target instanceof Element&&e.isPrimary!==!1}const th=3;function C4(e,t){if(N4(e))return t.addFrustration(jo.RAGE_CLICK),e.some(rh)&&t.addFrustration(jo.DEAD_CLICK),t.hasError&&t.addFrustration(jo.ERROR_CLICK),{isRage:!0};const r=e.some(o=>o.getUserActivity().selection);return e.forEach(o=>{o.hasError&&o.addFrustration(jo.ERROR_CLICK),rh(o)&&!r&&o.addFrustration(jo.DEAD_CLICK)}),{isRage:!1}}function N4(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(th-1);t+=1)if(e[t+th-1].event.timeStamp-e[t].event.timeStamp<=Ke)return!0;return!1}const R4='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 rh(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(R4)}const SE=10*Ke,Ho=new Map;function P4(e){const t=Ho.get(e);return Ho.delete(e),t}function kE(e,t){Ho.set(e,t),Ho.forEach((r,o)=>{Ne(o,wt())>SE&&Ho.delete(o)})}const j4=5*lt;function z4(e,t,r,o){const n=wo({expireDelay:j4}),i=new ge;let a;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===Ln.UNLOADING&&u()});const{stop:s}=A4(o,{onPointerDown:d=>D4(o,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:f},m,h)=>{M4(o,e,t,r,n,i,l,d,m,h,f)}});return{stop:()=>{u(),i.notify(),s()},actionContexts:{findActionId:d=>n.findAll(d)}};function l(d){if(!a||!a.tryAppend(d)){const f=d.clone();a=w4(d,m=>{L4(m,f)})}}function u(){a&&a.stop()}}function D4(e,t,r,o,n){let i;if(e.enablePrivacyForActionName?i=na(o.target,e.defaultPrivacyLevel):i=ce.ALLOW,i===ce.HIDDEN)return;const a=U4(o,i,e);let s=!1;return zm(t,r,n,e,c=>{s=c.hadActivity},cE),{clickActionBase:a,hadActivityOnPointerDown:()=>s}}function M4(e,t,r,o,n,i,a,s,c,l,u){var d;const f=EE(t,n,l,s,c);a(f);const m=(d=s?.target)===null||d===void 0?void 0:d.selector;m&&kE(c.timeStamp,m);const{stop:h}=zm(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()},SE),g=t.subscribe(5,({endClocks:b})=>{f.stop(b.timeStamp)}),y=i.subscribe(()=>{f.stop()});f.stopObservable.subscribe(()=>{g.unsubscribe(),h(),y.unsubscribe()})}function U4(e,t,r){const o=e.target.getBoundingClientRect(),n=ra(e.target,r.actionNameAttribute);n&&kE(e.timeStamp,n);const{name:i,nameSource:a}=k4(e.target,r,t);return{type:Fc.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 EE(e,t,r,o,n){const i=et(),a=Ue(),s=t.add(i,a.relative),c=iE({lifeCycle:e,isChildEvent:h=>h.action!==void 0&&(Array.isArray(h.action.id)?h.action.id.includes(i):h.action.id===i)});let l=0,u;const d=[],f=new ge;function m(h){l===0&&(u=h,l=1,u?s.close(_m(u)):s.remove(),c.stop(),f.notify())}return{event:n,stop:m,stopObservable:f,get hasError(){return c.eventCounts.errorCount>0},get hasPageActivity(){return u!==void 0},getUserActivity:r,addFrustration:h=>{d.push(h)},startClocks:a,isStopped:()=>l===1||l===2,clone:()=>EE(e,t,r,o,n),validate:h=>{if(m(),l!==1)return;const{resourceCount:g,errorCount:y,longTaskCount:b}=c.eventCounts,w={duration:u&&Ne(a.timeStamp,u),startClocks:a,id:i,frustrationTypes:d,counts:{resourceCount:g,errorCount:y,longTaskCount:b},events:h??[n],event:n,...o};e.notify(0,w),l=2},discard:()=>{m(),l=2}}}function L4(e,t){const{isRage:r}=C4(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 F4(e,t,r,o,n){const{unsubscribe:i}=e.subscribe(0,c=>{e.notify(12,nh(c))});t.register(0,({startTime:c,eventType:l})=>{if(l!==re.ERROR&&l!==re.RESOURCE&&l!==re.LONG_TASK)return xt;const u=a.findActionId(c);return u?{type:l,action:{id:u}}:xt}),t.register(1,({startTime:c})=>({action:{id:a.findActionId(c)}}));let a={findActionId:be},s=be;return n.trackUserInteractions&&({actionContexts:a,stop:s}=z4(e,r,o,n)),{addAction:c=>{e.notify(12,nh(c))},actionContexts:a,stop:()=>{i(),s()}}}function nh(e){const t=Ll(e)?{action:{id:e.id,loading_time:oE(ae(e.duration)),frustration:{type:e.frustrationTypes},error:{count:e.counts.errorCount},long_task:{count:e.counts.longTaskCount},resource:{count:e.counts.resourceCount}},_dd:{action:{target:e.target,position:e.position,name_source:e.nameSource}}}:{context:e.context},r=vr({action:{id:et(),target:{name:e.name},type:e.type},date:e.startClocks.timeStamp,type:re.ACTION},t),o=Ll(e)?e.duration:void 0,n=Ll(e)?{events:e.events}:{handlingStack:e.handlingStack};return{rawRumEvent:r,duration:o,startTime:e.startClocks.relative,domainContext:n}}function Ll(e){return e.type!==Fc.CUSTOM}function V4(e){const t=bD([Ac.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function Z4(e,t){const r=nz(e,[ci.cspViolation,ci.intervention]).subscribe(o=>t.notify(o));return{stop:()=>{r.unsubscribe()}}}function B4(e,t,r){const o=new ge;return r.subscribe(n=>{n.type===0&&o.notify(n.error)}),V4(o),Z4(t,o),o.subscribe(n=>e.notify(14,{error:n})),q4(e)}function q4(e){return e.subscribe(14,({error:t})=>{e.notify(12,G4(t))}),{addError:({error:t,handlingStack:r,componentStack:o,startClocks:n,context:i})=>{const a=Em({originalError:t,handlingStack:r,componentStack:o,startClocks:n,nonErrorPrefix:"Provided",source:vo.CUSTOM,handling:"handled"});a.context=vr(a.context,i),e.notify(14,{error:a})}}}function G4(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:re.ERROR,context:e.context},r={error:e.originalError,handlingStack:e.handlingStack};return{rawRumEvent:t,startTime:e.startClocks.relative,domainContext:r}}const oh=new WeakSet;function H4(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=>!oh.has(o)).filter(o=>Qk(o)&&eE(o)).filter(o=>W4(o,e.startClocks.relative,IE({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return oh.add(r[0]),r[0].toJSON()}function IE(e){return go(e.startTime,e.duration)}function W4(e,t,r){return e.startTime>=t-1&&IE(e)<=go(r,1)}const J4=2*lt;function K4(e){const t=Y4(e)||X4(e);if(!(!t||t.traceTime<=ct()-J4))return t.traceId}function Y4(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return TE(t&&t.content,r&&r.content)}function X4(e){const t=Q4(e);if(t)return TE(ai(t,"trace-id"),ai(t,"trace-time"))}function TE(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function Q4(e){for(let t=0;t<e.childNodes.length;t+=1){const r=ih(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=ih(r);if(o)return o;if(!Vu(r))break}}function ih(e){if(e&&XM(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function $E(){if(Zr(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=eU(),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 eU(){const e={},t=performance.timing;for(const r in t)if(Hi(t[r])){const o=r,n=t[o];e[o]=n===0?0:_m(n)}return e}function tU(e,t,r=$E){Cm(e,"interactive",()=>{const o=r(),n=Object.assign(o.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:Yk,duration:o.responseEnd,traceId:K4(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const rU=1e3;function nU(e){const t=new Set,r=e.subscribe(8,o=>{t.add(o),t.size>rU&&(_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 oU(e,t,r,o=yD(),n=tU){let i;const a=t.trackEarlyRequests;a?i=nU(e):e.subscribe(8,l=>{c(()=>iU(l,t,r))});const s=ir(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(l=>{for(const u of l)(a||!Xk(u))&&c(()=>ah(u,t,r,i))});n(t,l=>{c(()=>ah(l,t,r,i))});function c(l){o.push(()=>{const u=l();u&&e.notify(12,u)})}return{stop:()=>{o.stop(),s.unsubscribe()}}}function iU(e,t,r){const o=H4(e);return OE(o,e,r,t)}function ah(e,t,r,o){const n=Xk(e)&&o?o.getMatchingRequest(e):void 0;return OE(e,n,r,t)}function OE(e,t,r,o){if(!e&&!t)return;const n=t?lU(t,o):uU(e,o);if(!o.trackResources&&!n)return;const i=e?Wi(e.startTime):t.startClocks,a=e?CM(e):dU(r,i,t.duration),s=t&&aU(t,o),c=vr({date:i.timeStamp,resource:{id:et(),duration:ae(a),type:t?t.type===Lc.XHR?at.XHR:at.FETCH:AM(e),method:t?t.method:void 0,status_code:t?t.status:fU(e.responseStatus),url:t?tE(t.url):e.name,protocol:e&&PM(e),delivery_type:e&&jM(e),graphql:s},type:re.RESOURCE,_dd:{discarded:!o.trackResources}},n,e&&cU(e));return{startTime:i.relative,duration:a,rawRumEvent:c,domainContext:sU(e,t)}}function aU(e,t){const r=rE(e.url,t);if(r)return LM(e,r)}function sU(e,t){if(t){const r={performanceEntry:e,isAborted:t.isAborted,handlingStack:t.handlingStack};return t.type===Lc.XHR?{xhr:t.xhr,...r}:{requestInput:t.input,requestInit:t.init,response:t.response,error:t.error,...r}}return{performanceEntry:e}}function cU(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...zM(e),...NM(e)}}}function lU(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 uU(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:Gk().toString(),rule_psr:t.rulePsr}}}function dU(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function fU(e){return e===0?void 0:e}function mU(e,t,r){const{stop:o,eventCounts:n}=iE({lifeCycle:e,isChildEvent:i=>i.view.id===t,onChange:r});return{stop:o,eventCounts:n}}const pU=10*lt;function gU(e,t,r){return{stop:ir(e,{type:exports.RumPerformanceEntryType.PAINT,buffered:!0}).subscribe(n=>{const i=n.find(a=>a.name==="first-contentful-paint"&&a.startTime<t.timeStamp&&a.startTime<pU);i&&r(i.startTime)}).unsubscribe}}function hU(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(Ne(e,wt()))})})}function vU(e,t,r){const o=ir(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(n=>{const i=n.find(a=>a.startTime<t.timeStamp);if(i){const a=Ne(i.startTime,i.processingStart);let s;i.target&&yr(i.target)&&(s=ra(i.target,e.actionNameAttribute)),r({delay:a>=0?a:0,time:i.startTime,targetSelector:s})}});return{stop:()=>{o.unsubscribe()}}}function yU(e,t,r=$E){return wU(e,()=>{const o=r();_U(o)||t(bU(o))})}function bU(e){return{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEvent:e.loadEventEnd,firstByte:e.responseStart>=0&&e.responseStart<=wt()?e.responseStart:void 0}}function _U(e){return e.loadEventEnd<=0}function wU(e,t){let r;const{stop:o}=Cm(e,"complete",()=>{r=Je(()=>t())});return{stop:()=>{o(),yt(r)}}}const xU=10*lt;function SU(e,t,r,o){let n=1/0;const{stop:i}=hr(e,r,["pointerdown","keydown"],c=>{n=c.timeStamp},{capture:!0,once:!0});let a=0;const s=ir(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(c=>{const l=GS(c,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<xU&&u.size>a);if(l){let u;l.element&&(u=ra(l.element,e.actionNameAttribute)),o({value:l.startTime,targetSelector:u,resourceUrl:kU(l)}),a=l.size}});return{stop:()=>{i(),s.unsubscribe()}}}function kU(e){return e.url===""?void 0:e.url}function AE(e,t,r=window){if(document.visibilityState==="hidden")return{timeStamp:0,stop:be};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:be}}let o=1/0;const{stop:n}=hr(e,r,["pagehide","visibilitychange"],i=>{(i.type==="pagehide"||document.visibilityState==="hidden")&&(o=i.timeStamp,n())},{capture:!0});return{get timeStamp(){return o},stop:n}}function EU(e,t,r,o){const n={},{stop:i}=yU(e,d=>{r(d.loadEvent),n.navigationTimings=d,o()}),a=AE(e,t),{stop:s}=gU(e,a,d=>{n.firstContentfulPaint=d,o()}),{stop:c}=SU(e,a,window,d=>{n.largestContentfulPaint=d,o()}),{stop:l}=vU(e,a,d=>{n.firstInput=d,o()});function u(){i(),s(),c(),l(),a.stop()}return{stop:u,initialViewMetrics:n}}const Zu=(e,t)=>e*t,IU=(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:Zu(n-r,i-o)},sh=e=>{const t=Zu(e.previousRect.width,e.previousRect.height),r=Zu(e.currentRect.width,e.currentRect.height),o=IU(e.previousRect,e.currentRect);return t+r-o};function TU(e,t,r){if(!NU())return{stop:be};let o=0,n;r({value:0});const i=CU(),a=ir(e,{type:exports.RumPerformanceEntryType.LAYOUT_SHIFT,buffered:!0}).subscribe(s=>{var c;for(const l of s){if(l.hadRecentInput||l.startTime<t)continue;const{cumulatedValue:u,isMaxValue:d}=i.update(l);if(d){const f=$U(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:qo(o,4),targetSelector:f&&ra(f,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?ch(n.previousRect):void 0,currentRect:n?.currentRect?ch(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{a.unsubscribe()}}}function $U(e){let t;for(const r of e)if(r.node&&yr(r.node)){const o=sh(r);(!t||sh(t)<o)&&(t=r)}return t}function ch({x:e,y:t,width:r,height:o}){return{x:e,y:t,width:r,height:o}}const OU=5*Ke,AU=Ke;function CU(){let e=0,t,r,o=0;return{update:n=>{const i=t===void 0||n.startTime-r>=AU||n.startTime-t>=OU;let a;return i?(t=r=n.startTime,o=e=n.value,a=!0):(e+=n.value,r=n.startTime,a=n.value>o,a&&(o=n.value)),{cumulatedValue:e,isMaxValue:a}}}}function NU(){return Zr(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let Fa,CE=0,Fl=1/0,Vl=0;function RU(){"interactionCount"in performance||Fa||(Fa=new window.PerformanceObserver(ie(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(Fl=Math.min(Fl,r.interactionId),Vl=Math.max(Vl,r.interactionId),CE=(Vl-Fl)/7+1)})})),Fa.observe({type:"event",buffered:!0,durationThreshold:0}))}const lh=()=>Fa?CE:window.performance.interactionCount||0,uh=10,PU=1*lt;function jU(e,t,r){if(!MU())return{getInteractionToNextPaint:()=>{},setViewEnd:be,stop:be};const{getViewInteractionCount:o,stopViewInteractionCount:n}=DU(r);let i=1/0;const a=zU(o);let s=-1,c,l;function u(m){for(const g of m)g.interactionId&&g.startTime>=t&&g.startTime<=i&&a.process(g);const h=a.estimateP98Interaction();h&&h.duration!==s&&(s=h.duration,l=Ne(t,h.startTime),c=P4(h.startTime),!c&&h.target&&yr(h.target)&&(c=ra(h.target,e.actionNameAttribute)))}const d=ir(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),f=ir(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,PU),targetSelector:c,time:l};if(o())return{value:0}},setViewEnd:m=>{i=m,n()},stop:()=>{f.unsubscribe(),d.unsubscribe()}}}function zU(e){const t=[];function r(){t.sort((o,n)=>n.duration-o.duration).splice(uh)}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<uh||o.duration>i.duration)&&(t.push(o),r())},estimateP98Interaction(){const o=Math.min(t.length-1,Math.floor(e()/50));return t[o]}}}function DU(e){RU();const t=e===dr.INITIAL_LOAD?0:lh();let r={stopped:!1};function o(){return lh()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:o(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:o()}}}}function MU(){return Zr(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function UU(e,t,r,o,n,i,a){let s=n===dr.INITIAL_LOAD,c=!0;const l=[],u=AE(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}=zm(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 LU(){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 NE(){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 Zl;function RE(e){return Zl||(Zl=FU(e)),Zl}function FU(e){return new ge(t=>{const{throttled:r}=Ki(()=>{t.notify(Bc())},200);return Oe(e,window,"resize",r,{capture:!0,passive:!0}).stop})}function Bc(){const e=window.visualViewport;return e?{width:Number(e.width*e.scale),height:Number(e.height*e.scale)}:{width:Number(window.innerWidth||0),height:Number(window.innerHeight||0)}}const VU=Ke;function ZU(e,t,r,o=qU(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=wt();a=Ne(t.relative,f),d=!0}d&&r({maxDepth:Math.min(n,i),maxDepthScrollTop:l,maxScrollHeight:i,maxScrollHeightTime:a})});return{stop:()=>s.unsubscribe()}}function BU(){const e=NE(),{height:t}=Bc(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),o=Math.round(t+e);return{scrollHeight:r,scrollDepth:o,scrollTop:e}}function qU(e,t=VU){return new ge(r=>{function o(){r.notify(BU())}if(window.ResizeObserver){const n=Ki(o,t,{leading:!1,trailing:!0}),i=document.scrollingElement||document.documentElement,a=new ResizeObserver(ie(n.throttled));i&&a.observe(i);const s=Oe(e,window,"scroll",n.throttled,{passive:!0});return()=>{n.cancel(),a.disconnect(),s.stop()}}})}function GU(e,t,r,o,n,i,a){const s={},{stop:c,setLoadEvent:l}=UU(e,t,r,o,i,a,g=>{s.loadingTime=g,n()}),{stop:u}=ZU(o,a,g=>{s.scroll=g}),{stop:d}=TU(o,a.relative,g=>{s.cumulativeLayoutShift=g,n()}),{stop:f,getInteractionToNextPaint:m,setViewEnd:h}=jU(o,a.relative,i);return{stop:()=>{c(),d(),u()},stopINPTracking:f,setLoadEvent:l,setViewEnd:h,getCommonViewMetrics:()=>(s.interactionToNextPaint=m(),s)}}function HU(e,t){const{stop:r}=Oe(e,window,"pageshow",o=>{o.persisted&&t(o)},{capture:!0});return r}function WU(e,t,r){hU(e.relative,o=>{t.firstContentfulPaint=o,t.largestContentfulPaint={value:o},r()})}const JU=3e3,KU=5*lt,YU=5*lt;function XU(e,t,r,o,n,i,a,s){const c=new Set;let l=f(dr.INITIAL_LOAD,bm(),s),u;m();let d;a&&(d=h(i),n.trackBfcacheViews&&(u=HU(n,g=>{l.end();const y=Wi(g.timeStamp);l=f(dr.BF_CACHE,y,void 0)})));function f(g,y,b){const w=QU(t,r,o,n,e,g,y,b);return c.add(w),w.stopObservable.subscribe(()=>{c.delete(w)}),w}function m(){t.subscribe(10,()=>{l=f(dr.ROUTE_CHANGE,void 0,{name:l.name,service:l.service,version:l.version,context:l.contextManager.getContext()})}),t.subscribe(9,()=>{l.end({sessionIsActive:!1})})}function h(g){return g.subscribe(({oldLocation:y,newLocation:b})=>{t6(y,b)&&(l.end(),l=f(dr.ROUTE_CHANGE))})}return{addTiming:(g,y=Be())=>{l.addTiming(g,y)},startView:(g,y)=>{l.end({endClocks:y}),l=f(dr.ROUTE_CHANGE,y,g)},setViewContext:g=>{l.contextManager.setContext(g)},setViewContextProperty:(g,y)=>{l.contextManager.setContextProperty(g,y)},setViewName:g=>{l.setViewName(g)},getViewContext:()=>l.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),l.end(),c.forEach(g=>g.stop())}}}function QU(e,t,r,o,n,i,a=Ue(),s){const c=et(),l=new ge,u={};let d=0,f;const m=ii(n),h=Uc();let g=!0,y=s?.name;const b=s?.service||o.service,w=s?.version||o.version,x=s?.context;x&&h.setContext(x);const v={id:c,name:y,startClocks:a,service:b,version:w,context:x};e.notify(1,v),e.notify(2,v);const{throttled:k,cancel:E}=Ki(Z,JU,{leading:!1}),{setLoadEvent:I,setViewEnd:C,stop:U,stopINPTracking:D,getCommonViewMetrics:K}=GU(e,t,r,o,le,i,a),{stop:he,initialViewMetrics:F}=i===dr.INITIAL_LOAD?EU(o,a,I,le):{stop:be,initialViewMetrics:{}};i===dr.BF_CACHE&&WU(a,F,le);const{stop:V,eventCounts:ve}=mU(e,c,le),ue=po(Z,KU),pe=e.subscribe(11,X=>{X.reason===Ln.UNLOADING&&Z()});Z(),h.changeObservable.subscribe(le);function G(){e.notify(3,{id:c,name:y,context:h.getContext(),startClocks:a,sessionIsActive:g})}function le(){G(),k()}function Z(){E(),G(),d+=1;const X=f===void 0?Be():f.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:c,name:y,service:b,version:w,context:h.getContext(),loadingType:i,location:m,startClocks:a,commonViewMetrics:K(),initialViewMetrics:F,duration:Ne(a.timeStamp,X),isActive:f===void 0,sessionIsActive:g,eventCounts:ve})}return{get name(){return y},service:b,version:w,contextManager:h,stopObservable:l,end(X={}){var oe,Se;f||(f=(oe=X.endClocks)!==null&&oe!==void 0?oe:Ue(),g=(Se=X.sessionIsActive)!==null&&Se!==void 0?Se:!0,e.notify(5,{endClocks:f}),e.notify(6,{endClocks:f}),Rc(ue),C(f.relative),U(),pe.unsubscribe(),Z(),Je(()=>{this.stop()},YU))},stop(){he(),V(),D(),l.notify()},addTiming(X,oe){if(f)return;const Se=bj(oe)?oe:Ne(a.timeStamp,oe);u[e6(X)]=Se,le()},setViewName(X){y=X,Z()}}}function e6(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&ee.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function t6(e,t){return e.pathname!==t.pathname||!r6(t.hash)&&dh(t.hash)!==dh(e.hash)}function r6(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function dh(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function n6(e,t,r,o,n,i,a,s,c,l){return e.subscribe(4,u=>e.notify(12,o6(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}}}),XU(o,e,n,i,r,a,!r.trackViewsManually,l)}function o6(e,t,r){var o,n,i,a,s,c,l,u,d,f,m,h,g,y,b,w,x,v;const k=r.getReplayStats(e.id),E=(n=(o=e.commonViewMetrics)===null||o===void 0?void 0:o.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,I={_dd:{document_version:e.documentVersion,replay_stats:k,cls:E?{device_pixel_ratio:E}:void 0,configuration:{start_session_replay_recording_manually:t.startSessionReplayRecordingManually}},date:e.startClocks.timeStamp,type:re.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:ae((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:ae((c=e.initialViewMetrics.navigationTimings)===null||c===void 0?void 0:c.firstByte),dom_complete:ae((l=e.initialViewMetrics.navigationTimings)===null||l===void 0?void 0:l.domComplete),dom_content_loaded:ae((u=e.initialViewMetrics.navigationTimings)===null||u===void 0?void 0:u.domContentLoaded),dom_interactive:ae((d=e.initialViewMetrics.navigationTimings)===null||d===void 0?void 0:d.domInteractive),error:{count:e.eventCounts.errorCount},first_contentful_paint:ae(e.initialViewMetrics.firstContentfulPaint),first_input_delay:ae((f=e.initialViewMetrics.firstInput)===null||f===void 0?void 0:f.delay),first_input_time:ae((m=e.initialViewMetrics.firstInput)===null||m===void 0?void 0:m.time),first_input_target_selector:(h=e.initialViewMetrics.firstInput)===null||h===void 0?void 0:h.targetSelector,interaction_to_next_paint:ae((g=e.commonViewMetrics.interactionToNextPaint)===null||g===void 0?void 0:g.value),interaction_to_next_paint_time:ae((y=e.commonViewMetrics.interactionToNextPaint)===null||y===void 0?void 0:y.time),interaction_to_next_paint_target_selector:(b=e.commonViewMetrics.interactionToNextPaint)===null||b===void 0?void 0:b.targetSelector,is_active:e.isActive,name:e.name,largest_contentful_paint:ae((w=e.initialViewMetrics.largestContentfulPaint)===null||w===void 0?void 0:w.value),largest_contentful_paint_target_selector:(x=e.initialViewMetrics.largestContentfulPaint)===null||x===void 0?void 0:x.targetSelector,load_event:ae((v=e.initialViewMetrics.navigationTimings)===null||v===void 0?void 0:v.loadEvent),loading_time:oE(ae(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:i6(e.commonViewMetrics,e.initialViewMetrics),resource:{count:e.eventCounts.resourceCount},time_spent:ae(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:ae(e.commonViewMetrics.scroll.maxScrollHeightTime)}}:void 0,privacy:{replay_level:t.defaultPrivacyLevel},device:{locale:navigator.language,locales:navigator.languages,time_zone:PD()}};return Vr(e.customTimings)||(I.view.custom_timings=zS(e.customTimings,ae)),{rawRumEvent:I,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function i6({cumulativeLayoutShift:e,interactionToNextPaint:t},{firstContentfulPaint:r,firstInput:o,largestContentfulPaint:n}){return{cls:e&&{score:e.value,timestamp:ae(e.time),target_selector:e.targetSelector,previous_rect:e.previousRect,current_rect:e.currentRect},fcp:r&&{timestamp:ae(r)},fid:o&&{duration:ae(o.delay),timestamp:ae(o.time),target_selector:o.targetSelector},inp:t&&{duration:ae(t.value),timestamp:ae(t.time),target_selector:t.targetSelector},lcp:n&&{timestamp:ae(n.value),target_selector:n.targetSelector,resource_url:n.resourceUrl}}}const a6="rum";function s6(e,t,r){const o=Jz(e,a6,n=>l6(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 c6(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:Ek("records")?1:0};return{findTrackedSession:()=>e,expire:be,expireObservable:new ge,setForcedReplay:be}}function l6(e,t){return u6(t)?t:Xr(e.sessionSampleRate)?Xr(e.sessionReplaySampleRate)?"1":"2":"0"}function u6(e){return e==="0"||e==="1"||e==="2"}function d6(e,t,r,o,n,i){const a=[e.rumEndpointBuilder];e.replica&&a.push(e.replica.rumEndpointBuilder);const s=Tk({encoder:i(2),request:Om(a,r),flushController:$k({pageMayExitObservable:o,sessionExpireObservable:n})});return t.subscribe(13,c=>{c.type===re.VIEW?s.upsert(c,c.view.id):s.add(c)}),s}function f6(e){const t=yo();e.subscribe(13,r=>{t.send("rum",r)})}const m6=vn;function p6(e,t,r,o){const n=wo({expireDelay:m6});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=wt();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 g6(e,t){let r=ii(t);return new ge(o=>{const{stop:n}=h6(e,a),{stop:i}=v6(e,a);function a(){if(r.href===t.href)return;const s=ii(t);o.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),i()}})}function h6(e,t){const{stop:r}=Bt(fh("pushState"),"pushState",({onPostCall:i})=>{i(t)}),{stop:o}=Bt(fh("replaceState"),"replaceState",({onPostCall:i})=>{i(t)}),{stop:n}=Oe(e,window,"popstate",t);return{stop:()=>{r(),o(),n()}}}function v6(e,t){return Oe(e,window,"hashchange",t)}function fh(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const y6=vn;function b6(e,t,r){const o=wo({expireDelay:y6});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([re.VIEW,re.ERROR]).includes(i))return xt;const s=o.find(n);return!s||Vr(s)?xt:{type:i,feature_flags:s}}),{addFeatureFlagEvaluation:(n,i)=>{const a=o.find();a&&(a[n]=i)}}}const _6=10*Ke;let Fn,Sa;function w6(e,t,r){e.metricsEnabled&&(PE(),Sa=!1,t.subscribe(13,()=>{Sa=!0}),r.subscribe(({bytesCount:o,messagesCount:n})=>{Sa&&(Sa=!1,Fn.batchCount+=1,ph(Fn.batchBytesCount,o),ph(Fn.batchMessagesCount,n))}),po(x6,_6))}function x6(){Fn.batchCount!==0&&(ta("Customer data measures",Fn),PE())}function mh(){return{min:1/0,max:0,sum:0}}function ph(e,t){e.sum+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t)}function PE(){Fn={batchCount:0,batchBytesCount:mh(),batchMessagesCount:mh()}}const S6=4e3,k6=500,E6=vn;function I6(e,t,r=k6){const o=wo({expireDelay:E6,maxEntries:S6});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(jE(),wt());const{stop:i}=hr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],c=>{a($6(c),c.timeStamp)},{capture:!0});function a(c,l=wt()){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===re.VIEW){const d=o.findAll(c,l);return{type:u,_dd:{page_states:T6(d,c,r)}}}return u===re.ACTION||u===re.ERROR?{type:u,view:{in_foreground:s("active",c,0)}}:xt}),{wasInPageStateDuringPeriod:s,addPageState:a,stop:()=>{i(),o.stop()}}}function T6(e,t,r){if(e.length!==0)return e.slice(-r).reverse().map(({state:o,startTime:n})=>({state:o,start:ae(Ne(t,n))}))}function $6(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":jE()}function jE(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function O6(e,t){let r;const o=requestAnimationFrame(ie(()=>{r=Bc()})),n=RE(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 A6(e,t){const r=window.cookieStore?C6(e):R6;return new ge(o=>r(t,n=>o.notify(n)))}function C6(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 N6=Ke;function R6(e,t){const r=ai(document.cookie,e),o=po(()=>{const n=ai(document.cookie,e);n!==r&&t(n)},N6);return()=>{Rc(o)}}const gh="datadog-ci-visibility-test-execution-id";function P6(e,t,r=A6(e,gh)){var o;let n=Tr(gh)||((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"?xt:{type:a,session:{type:"ci_test"},ci_test:{test_execution_id:n}}),{stop:()=>{i.unsubscribe()}}}function j6(e,t){const r=ir(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(o=>{for(const n of o){const i=Wi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:Fk.LONG_ANIMATION_FRAME,duration:ae(n.duration),blocking_duration:ae(n.blockingDuration),first_ui_event_timestamp:ae(n.firstUIEventTimestamp),render_start:ae(n.renderStart),style_and_layout_start:ae(n.styleAndLayoutStart),start_time:ae(n.startTime),scripts:n.scripts.map(s=>({duration:ae(s.duration),pause_duration:ae(s.pauseDuration),forced_style_and_layout_duration:ae(s.forcedStyleAndLayoutDuration),start_time:ae(s.startTime),execution_start:ae(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:re.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:a,startTime:i.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop:()=>r.unsubscribe()}}function z6(e,t){const r=ir(t,{type:exports.RumPerformanceEntryType.LONG_TASK,buffered:!0}).subscribe(o=>{for(const n of o){if(n.entryType!==exports.RumPerformanceEntryType.LONG_TASK||!t.trackLongTasks)break;const i=Wi(n.startTime),a={date:i.timeStamp,long_task:{id:et(),entry_type:Fk.LONG_TASK,duration:ae(n.duration)},type:re.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:a,startTime:i.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop(){r.unsubscribe()}}}function D6(e){e.register(0,({eventType:t})=>{if(!Rk())return xt;const r=Ck(),o=Nk();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:o,injected:Ak()}}})}function M6(e,t,r){const o=$m(e),n=r(o);return zc(t).forEach(([i,a])=>Bu(e,o,i.split(/\.|(?=\[\])/),a)),n}function Bu(e,t,r,o){const[n,...i]=r;if(n==="[]"){Array.isArray(e)&&Array.isArray(t)&&e.forEach((a,s)=>Bu(a,t[s],i,o));return}if(!(!hh(e)||!hh(t))){if(i.length>0)return Bu(e[n],t[n],i,o);U6(e,n,t[n],o)}}function U6(e,t,r,o){const n=yn(r);n===o?e[t]=$e(r):o==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function hh(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 zE;function L6(e,t,r,o,n){zE={[re.VIEW]:{"view.performance.lcp.resource_url":"string",...An,...On,...Cn},[re.ERROR]:{"error.message":"string","error.stack":"string","error.resource.url":"string","error.fingerprint":"string",...An,...On,...Cn},[re.RESOURCE]:{"resource.url":"string","resource.graphql.variables":"string",...An,...On,...Cn},[re.ACTION]:{"action.target.name":"string",...An,...On,...Cn},[re.LONG_TASK]:{"long_task.scripts[].source_url":"string","long_task.scripts[].invoker":"string",...An,...On,...Cn},[re.VITAL]:{...An,...On,...Cn}};const i={[re.ERROR]:Rl(re.ERROR,o,n),[re.ACTION]:Rl(re.ACTION,o,n),[re.VITAL]:Rl(re.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=vr(u,c,{ddtags:Im(e).join(",")});F6(d,e.beforeSend,l,i)&&(Vr(d.context)&&delete d.context,t.notify(13,d))})}function F6(e,t,r,o){var n;if(t){const a=M6(e,zE[e.type],s=>t(s,r));if(a===!1&&e.type!==re.VIEW)return!1;a===!1&&ee.warn("Can't dismiss view events using beforeSend!")}return!((n=o[e.type])===null||n===void 0?void 0:n.isLimitReached())}function V6(e,t,r,o){e.register(0,({eventType:n,startTime:i})=>{const a=t.findTrackedSession(i),s=o.findView(i);if(!a||!s)return Dr;let c,l,u;return n===re.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}}:xt})}function Z6(e){e.register(0,({eventType:t})=>({type:t,connectivity:vk()}))}function B6(e,t,r){e.register(0,({eventType:o})=>{const n=t.source;return{type:o,_dd:{format_version:2,drift:VS(),configuration:{session_sample_rate:qo(t.sessionSampleRate,3),session_replay_sample_rate:qo(t.sessionReplaySampleRate,3),profiling_sample_rate:qo(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 q6(e,t){e.register(1,()=>t.isGranted()?xt:Dr)}const G6=Oz,H6=[re.ACTION,re.ERROR,re.LONG_TASK,re.RESOURCE,re.VITAL];function W6(e){return{addEvent:(t,r,o,n)=>{H6.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:o,duration:n})}}}function J6(e,t){if(!t.metricsEnabled)return{stop:be};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:o})=>{!o.largestContentfulPaint||!o.navigationTimings||(ta("Initial view metrics",{metrics:K6(o.largestContentfulPaint,o.navigationTimings)}),r())});return{stop:r}}function K6(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function Y6(e,t,r,o,n,i,a,s,c){const l=[],u=new IM,d=G6();u.subscribe(13,Fe=>Tm("rum",Fe));const f=Fe=>{u.notify(14,{error:Fe}),_o("Error reported to customer",{"error.message":Fe.message})},m=Iz(e),h=m.subscribe(Fe=>{u.notify(11,Fe)});l.push(()=>h.unsubscribe());const g=Pz("browser-rum-sdk",e,d,f,m,n);l.push(g.stop);const y=sn()?c6():s6(e,u,i);if(sn())f6(u);else{const Fe=d6(e,u,f,m,y.expireObservable,n);l.push(()=>Fe.stop()),w6(g,u,Fe.flushController.flushObservable)}const b=SM(),w=g6(e,location),{observable:x,stop:v}=kM();l.push(v),B6(d,e,c);const k=I6(d,e),E=$M(u);l.push(()=>E.stop());const I=p6(u,d,w,location);l.push(()=>I.stop());const C=b6(u,d,e);V6(d,y,t,E),Z6(d),q6(d,i);const U=AD(d,e,"rum"),D=CD(d,e,y,"rum"),K=OD(d,e,"rum"),{actionContexts:he,addAction:F,addEvent:V,stop:ve}=X6(u,d,e,k,b,x,f);l.push(ve);const{addTiming:ue,startView:pe,setViewName:G,setViewContext:le,setViewContextProperty:Z,getViewContext:X,stop:oe}=n6(u,d,e,location,b,x,w,t,E,o);l.push(oe);const{stop:Se}=J6(u,g);l.push(Se);const{stop:P}=oU(u,e,k);if(l.push(P),e.trackLongTasks)if(Zr(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:Fe}=j6(u,e);l.push(Fe)}else z6(u,e);const{addError:H}=B4(u,e,s);s.unbuffer(),BM(u,e,y,D,K);const me=zD(u,k,a),Te=EM(e.applicationId,y,E,he,I);return l.push(()=>r.stop()),{addAction:F,addEvent:V,addError:H,addTiming:ue,addFeatureFlagEvaluation:C.addFeatureFlagEvaluation,startView:pe,setViewContext:le,setViewContextProperty:Z,getViewContext:X,setViewName:G,lifeCycle:u,viewHistory:E,session:y,stopSession:()=>y.expire(),getInternalContext:Te.get,startDurationVital:me.startDurationVital,stopDurationVital:me.stopDurationVital,addDurationVital:me.addDurationVital,addOperationStepVital:me.addOperationStepVital,globalContext:U,userContext:D,accountContext:K,telemetry:g,stop:()=>{l.forEach(Fe=>Fe())},hooks:d}}function X6(e,t,r,o,n,i,a){const s=F4(e,t,n,i,r),c=W6(e),l=O6(t,r),u=P6(r,t);return D6(t),L6(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 Q6(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=eL(e),s=`/rum/replay/sessions/${n}`;return`${a}${s}?${i.join("&")}`}function eL(e){const t=e.site,r=e.subdomain||tL(e);return`https://${r?`${r}.`:""}${t}`}function tL(e){switch(e.site){case Qr:case l2:return"app";case ik:return"dd";default:return}}const rL=1e3;let Ot;function nL(e){return qc(e).segments_count}function oL(e){qc(e).segments_count+=1}function iL(e){qc(e).records_count+=1}function aL(e,t){qc(e).segments_total_raw_size+=t}function sL(e){return Ot?.get(e)}function qc(e){Ot||(Ot=new Map);let t;return Ot.has(e)?t=Ot.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},Ot.set(e,t),Ot.size>rL&&cL()),t}function cL(){if(!Ot)return;const e=Ot.keys().next().value;e&&Ot.delete(e)}function DE(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):fk(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 Um({configuredUrl:e,error:t,source:r,scriptType:o}){if(ee.error(`${r} failed to start: an error occurred while initializing the ${o}:`,t),t instanceof Event||t instanceof Error&&lL(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.",ee.error(`${n} See documentation at ${Cc}/integrations/content_security_policy_logs/#use-csp-with-real-user-monitoring-and-session-replay`)}else o==="worker"&&Am(t)}function lL(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const uL=30*Ke;function ME(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 UE(e,t,r,o=ME){switch(Re.status===0&&dL(e,t,o),Re.status){case 1:return Re.initializationFailureCallbacks.push(r),Re.worker;case 3:return Re.worker}}function vh(){return Re.status}function dL(e,t,r=ME){try{const o=r(e),{stop:n}=Oe(e,o,"error",s=>{Bl(e,t,s)}),{stop:i}=Oe(e,o,"message",({data:s})=>{s.type==="errored"?Bl(e,t,s.error,s.streamId):s.type==="initialized"&&mL(s.version)});o.postMessage({action:"init"}),Je(()=>fL(t),uL),Re={status:1,worker:o,stop:()=>{n(),i()},initializationFailureCallbacks:[]}}catch(o){Bl(e,t,o)}}function fL(e){Re.status===1&&(ee.error(`${e} failed to start: a timeout occurred while initializing the Worker`),Re.initializationFailureCallbacks.forEach(t=>t()),Re={status:2})}function mL(e){Re.status===1&&(Re={status:3,worker:Re.worker,stop:Re.stop,version:e})}function Bl(e,t,r,o){Re.status===1||Re.status===0?(Um({configuredUrl:e.workerUrl,error:r,source:t,scriptType:"worker"}),Re.status===1&&Re.initializationFailureCallbacks.forEach(n=>n()),Re={status:2}):Am(r,{worker_version:Re.status===3&&Re.version,stream_id:o})}function LE(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function pL(e,t,r,o){const n=t.findTrackedSession(),i=gL(n,o),a=r.findView();return Q6(e,{viewContext:a,errorType:i,session:n})}function gL(e,t){if(!LE())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 hL(e,t){if(!e.metricsEnabled)return{stop:be};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&&ta("Recorder init metrics",{metrics:vL(r.forced,n,Ne(r.timestamp,Be()),a.type,o)});break}});return{stop:i}}function vL(e,t,r,o,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:o,waitForDocReadyDuration:n}}function yL(e,t,r,o,n,i,a){let s=0,c;t.subscribe(9,()=>{(s===2||s===3)&&(f(),s=1)}),t.subscribe(10,()=>{s===1&&d()});const l=new ge;hL(a,l);const u=async m=>{l.notify({type:"start",forced:m});const[h]=await Promise.all([yh(l,{type:"recorder-settled"},n()),yh(l,{type:"document-ready"},oD(e,"interactive"))]);if(s!==2){l.notify({type:"aborted"});return}if(!h){s=0,l.notify({type:"recorder-load-failed"});return}const g=i();if(!g){s=0,l.notify({type:"deflate-encoder-load-failed"});return}({stop:c}=h(t,e,r,o,g,a)),s=3,l.notify({type:"succeeded"})};function d(m){const h=r.findTrackedSession();if(bL(h,m)){s=1;return}if(_L(s))return;s=2;const g=wL(h,m)||!1;u(g).catch(pr),g&&r.setForcedReplay()}function f(){s===3&&c?.(),s=0}return{start:d,stop:f,getSessionReplayLink(){return pL(e,r,o,s!==0)},isRecording:()=>s===3}}function bL(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function _L(e){return e===2||e===3}function wL(e,t){return t&&t.force&&e.sessionReplay===0}async function yh(e,t,r){try{return await r}finally{e.notify(t)}}function xL(){let e=0;return{strategy:{start(){e=1},stop(){e=2},isRecording:()=>!1,getSessionReplayLink:be},shouldStartImmediately(t){return e===1||e===0&&!t.startSessionReplayRecordingManually}}}function SL(e,t){if(sn()&&!Ek("records")||!LE())return{start:be,stop:be,getReplayStats:()=>{},onRumStart:be,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:o}=xL();return{start:i=>r.start(i),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>vh()===3&&r.isRecording(),getReplayStats:i=>vh()===3?sL(i):void 0};function n(i,a,s,c,l,u){let d;function f(){return d||(l??(l=UE(a,"Datadog Session Replay",()=>{r.stop()},t)),l&&(d=DE(a,l,1))),d}r=yL(a,i,s,c,e,f,u),o(a)&&r.start()}}async function kL(e=EL){try{return await e()}catch(t){Um({error:t,source:"Recorder",scriptType:"module"})}}async function EL(){return(await Promise.resolve().then(()=>require("./startRecording-2p7-xVUh.cjs"))).startRecording}function IL(){return Tt().Profiler!==void 0}const TL=e=>{let t={status:"starting"};return e.register(0,({eventType:r})=>r!==re.VIEW&&r!==re.LONG_TASK?xt:{type:r,_dd:{profiling:t}}),{get:()=>t,set:r=>{t=r}}};async function $L(e=OL){try{return await e()}catch(t){Um({error:t,source:"Profiler",scriptType:"module"})}}async function OL(){return(await Promise.resolve().then(()=>require("./profiler-Dshm-O8k.cjs"))).createRumProfiler}function AL(){let e;function t(r,o,n,i,a,s){const c=i.findTrackedSession();if(!c||!qk(c.id,n.profilingSampleRate))return;const l=TL(o);if(!IL()){l.set({status:"error",error_reason:"not-supported-by-browser"});return}$L().then(u=>{if(!u){_o("[DD_RUM] Failed to lazy load the RUM Profiler"),l.set({status:"error",error_reason:"failed-to-lazy-load"});return}e=u(n,r,i,l,s),e.start(a.findView())}).catch(pr)}return{onRumStart:t,stop:()=>{e?.stop().catch(pr)}}}const CL=SL(kL),NL=AL(),Wo=wM(Y6,CL,NL,{startDeflateWorker:UE,createDeflateEncoder:DE,sdkName:"rum"});rz(Tt(),"DD_RUM",Wo);const ka={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",service:"gram-elements"};let qu=!1,Gu=!0;function RL(e={}){if(e.enabled===!1){Gu=!1;return}if(!qu)try{Wo.init({applicationId:ka.applicationId,clientToken:ka.clientToken,site:ka.site,service:ka.service,env:process.env.NODE_ENV||"production",sessionSampleRate:100,sessionReplaySampleRate:100,trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0,defaultPrivacyLevel:"mask"}),e.projectSlug&&Wo.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&Wo.setGlobalContextProperty("variant",e.variant),qu=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),Gu=!1}}function hs(e,t){if(!Gu||!qu)return;const r=e instanceof Error?e:new Error(String(e));try{Wo.addError(r,{...t,timestamp:new Date().toISOString()})}catch(o){console.warn("[Elements] Failed to track error:",o)}}const Lm=["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"],PL=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof dg.ZodType?dg.toJSONSchema(r.parameters):r.parameters}])),jL=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let vs=null;function zL(e,t){const r=FE(t);vs={helpers:e,requiresApproval:r}}function DL(){vs=null}function FE(e){if(!e)return()=>!1;if(typeof e=="function")return r=>e({toolName:r});const t=new Set(e);return r=>t.has(r)}const ML=(e,t)=>M.makeAssistantTool({...e,execute:async(r,o)=>{if(vs?.requiresApproval(t)){const{helpers:n}=vs,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 UL(e,t,r){if(!t||Array.isArray(t)&&t.length===0)return e;const o=FE(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 LL=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],FL=$.createLucideIcon("arrow-down",LL);const VL=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ZL=$.createLucideIcon("arrow-up",VL);const BL=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],qL=$.createLucideIcon("brain",BL);const GL=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Nr=$.createLucideIcon("check",GL);const HL=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ys=$.createLucideIcon("chevron-down",HL);const WL=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],JL=$.createLucideIcon("chevron-left",WL);const KL=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],VE=$.createLucideIcon("chevron-right",KL);const YL=[["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"}]],Fm=$.createLucideIcon("copy",YL);const XL=[["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"}]],QL=$.createLucideIcon("file-text",XL);const e5=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],t5=$.createLucideIcon("link",e5);const r5=[["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"}]],bs=$.createLucideIcon("loader",r5);const n5=[["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"}]],o5=$.createLucideIcon("maximize",n5);const i5=[["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"}]],a5=$.createLucideIcon("message-circle",i5);const s5=[["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"}]],c5=$.createLucideIcon("minimize",s5);const l5=[["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"}]],u5=$.createLucideIcon("panel-right-close",l5);const d5=[["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"}]],f5=$.createLucideIcon("panel-right-open",d5);const m5=[["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"}]],p5=$.createLucideIcon("pencil",m5);const g5=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ZE=$.createLucideIcon("plus",g5);const h5=[["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"}]],v5=$.createLucideIcon("settings-2",h5);const y5=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],b5=$.createLucideIcon("square",y5);const _5=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],bh=$.createLucideIcon("wifi-off",_5);const w5=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],BE=$.createLucideIcon("wrench",w5);const x5=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],xo=$.createLucideIcon("x",x5);var S5=Object.defineProperty,k5=Object.defineProperties,E5=Object.getOwnPropertyDescriptors,_h=Object.getOwnPropertySymbols,I5=Object.prototype.hasOwnProperty,T5=Object.prototype.propertyIsEnumerable,wh=(e,t,r)=>t in e?S5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,we=(e,t)=>{for(var r in t||(t={}))I5.call(t,r)&&wh(e,r,t[r]);if(_h)for(var r of _h(t))T5.call(t,r)&&wh(e,r,t[r]);return e},_s=(e,t)=>k5(e,E5(t)),qE="vercel.ai.error",$5=Symbol.for(qE),GE,O5=class HE extends Error{constructor({name:t,message:r,cause:o}){super(r),this[GE]=!0,this.name=t,this.cause=o}static isInstance(t){return HE.hasMarker(t,qE)}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}};GE=$5;var De=O5,WE="AI_APICallError",JE=`vercel.ai.error.${WE}`,A5=Symbol.for(JE),KE,Zt=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:WE,message:e,cause:a}),this[KE]=!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,JE)}};KE=A5;var YE="AI_EmptyResponseBodyError",XE=`vercel.ai.error.${YE}`,C5=Symbol.for(XE),QE,N5=class extends De{constructor({message:e="Empty response body"}={}){super({name:YE,message:e}),this[QE]=!0}static isInstance(e){return De.hasMarker(e,XE)}};QE=C5;function eI(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var tI="AI_InvalidArgumentError",rI=`vercel.ai.error.${tI}`,R5=Symbol.for(rI),nI,oI=class extends De{constructor({message:t,cause:r,argument:o}){super({name:tI,message:t,cause:r}),this[nI]=!0,this.argument=o}static isInstance(t){return De.hasMarker(t,rI)}};nI=R5;var iI="AI_InvalidPromptError",aI=`vercel.ai.error.${iI}`,P5=Symbol.for(aI),sI,j5=class extends De{constructor({prompt:e,message:t,cause:r}){super({name:iI,message:`Invalid prompt: ${t}`,cause:r}),this[sI]=!0,this.prompt=e}static isInstance(e){return De.hasMarker(e,aI)}};sI=P5;var cI="AI_InvalidResponseDataError",lI=`vercel.ai.error.${cI}`,z5=Symbol.for(lI),uI,Mo=class extends De{constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:cI,message:t}),this[uI]=!0,this.data=e}static isInstance(e){return De.hasMarker(e,lI)}};uI=z5;var dI="AI_JSONParseError",fI=`vercel.ai.error.${dI}`,D5=Symbol.for(fI),mI,ws=class extends De{constructor({text:e,cause:t}){super({name:dI,message:`JSON parsing failed: Text: ${e}.
40
- Error message: ${eI(t)}`,cause:t}),this[mI]=!0,this.text=e}static isInstance(e){return De.hasMarker(e,fI)}};mI=D5;var pI="AI_LoadAPIKeyError",gI=`vercel.ai.error.${pI}`,M5=Symbol.for(gI),hI,Ea=class extends De{constructor({message:e}){super({name:pI,message:e}),this[hI]=!0}static isInstance(e){return De.hasMarker(e,gI)}};hI=M5;var vI="AI_NoContentGeneratedError",yI=`vercel.ai.error.${vI}`,U5=Symbol.for(yI),bI,_I=class extends De{constructor({message:e="No content generated."}={}){super({name:vI,message:e}),this[bI]=!0}static isInstance(e){return De.hasMarker(e,yI)}};bI=U5;var wI="AI_TypeValidationError",xI=`vercel.ai.error.${wI}`,L5=Symbol.for(xI),SI,F5=class Hu extends De{constructor({value:t,cause:r}){super({name:wI,message:`Type validation failed: Value: ${JSON.stringify(t)}.
41
- Error message: ${eI(r)}`,cause:r}),this[SI]=!0,this.value=t}static isInstance(t){return De.hasMarker(t,xI)}static wrap({value:t,cause:r}){return Hu.isInstance(r)&&r.value===t?r:new Hu({value:t,cause:r})}};SI=L5;var ui=F5,kI="AI_UnsupportedFunctionalityError",EI=`vercel.ai.error.${kI}`,V5=Symbol.for(EI),II,Er=class extends De{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:kI,message:t}),this[II]=!0,this.functionality=e}static isInstance(e){return De.hasMarker(e,EI)}};II=V5;var xh=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 ql(e){}function Z5(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=ql,onError:r=ql,onRetry:o=ql,onComment:n}=e;let i="",a=!0,s,c="",l="";function u(g){const y=a?g.replace(/^\xEF\xBB\xBF/,""):g,[b,w]=B5(`${i}${y}`);for(const x of b)d(x);i=w,a=!1}function d(g){if(g===""){m();return}if(g.startsWith(":")){n&&n(g.slice(g.startsWith(": ")?2:1));return}const y=g.indexOf(":");if(y!==-1){const b=g.slice(0,y),w=g[y+1]===" "?2:1,x=g.slice(y+w);f(b,x,g);return}f(g,"",g)}function f(g,y,b){switch(g){case"event":l=y;break;case"data":c=`${c}${y}
42
- `;break;case"id":s=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?o(parseInt(y,10)):r(new xh(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:b}));break;default:r(new xh(`Unknown field "${g.length>20?`${g.slice(0,20)}…`:g}"`,{type:"unknown-field",field:g,value:y,line:b}));break}}function m(){c.length>0&&t({id:s,event:l||void 0,data:c.endsWith(`
43
- `)?c.slice(0,-1):c}),s=void 0,c="",l=""}function h(g={}){i&&g.consume&&d(i),a=!0,s=void 0,c="",l="",i=""}return{feed:u,reset:h}}function B5(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),i=e.indexOf(`
44
- `,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]===`
45
- `&&o++}}return[t,r]}var q5=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(n){o=Z5({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 di(...e){return e.reduce((t,r)=>we(we({},t),r??{}),{})}function Gc(e){return Object.fromEntries([...e.headers])}var G5=({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 oI({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},Ut=G5();function Wu(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var H5=["fetch failed","failed to fetch"];function W5({error:e,url:t,requestBodyValues:r}){if(Wu(e))return e;if(e instanceof TypeError&&H5.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new Zt({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function J5(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>r!=null))}function K5({apiKey:e,environmentVariableName:t,apiKeyParameterName:r="apiKey",description:o}){if(typeof e=="string")return e;if(e!=null)throw new Ea({message:`${o} API key must be a string.`});if(typeof process>"u")throw new Ea({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 Ea({message:`${o} API key is missing. Pass it using the '${r}' parameter or the ${t} environment variable.`});if(typeof e!="string")throw new Ea({message:`${o} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}var Y5=/"__proto__"\s*:/,X5=/"constructor"\s*:/;function Q5(e){const t=JSON.parse(e);return t===null||typeof t!="object"||Y5.test(e)===!1&&X5.test(e)===!1?t:eF(t)}function eF(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 Vm(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return Q5(e)}finally{Error.stackTraceLimit=t}}var Ju=Symbol.for("vercel.ai.validator");function tF(e){return{[Ju]:!0,validate:e}}function rF(e){return typeof e=="object"&&e!==null&&Ju in e&&e[Ju]===!0&&"validate"in e}function nF(e){return rF(e)?e:oF(e)}function oF(e){return tF(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new ui({value:t,cause:r.issues})}})}async function iF({value:e,schema:t}){const r=await TI({value:e,schema:t});if(!r.success)throw ui.wrap({value:e,cause:r.error});return r.value}async function TI({value:e,schema:t}){const r=nF(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:ui.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:ui.wrap({value:e,cause:o}),rawValue:e}}}async function aF({text:e,schema:t}){try{const r=Vm(e);return t==null?r:iF({value:r,schema:t})}catch(r){throw ws.isInstance(r)||ui.isInstance(r)?r:new ws({text:e,cause:r})}}async function $I({text:e,schema:t}){try{const r=Vm(e);return t==null?{success:!0,value:r,rawValue:r}:await TI({value:r,schema:t})}catch(r){return{success:!1,error:ws.isInstance(r)?r:new ws({text:e,cause:r}),rawValue:void 0}}}function Gl(e){try{return Vm(e),!0}catch{return!1}}function sF({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new q5).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await $I({text:r,schema:t}))}}))}var cF=()=>globalThis.fetch,fi=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>lF({url:e,headers:we({"Content-Type":"application/json"},t),body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),lF=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=cF()})=>{try{const s=await a(e,{method:"POST",headers:J5(t),body:r.content,signal:i}),c=Gc(s);if(!s.ok){let l;try{l=await n({response:s,url:e,requestBodyValues:r.values})}catch(u){throw Wu(u)||Zt.isInstance(u)?u:new Zt({message:"Failed to process error response",cause:u,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw l.value}try{return await o({response:s,url:e,requestBodyValues:r.values})}catch(l){throw l instanceof Error&&(Wu(l)||Zt.isInstance(l))?l:new Zt({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw W5({error:s,url:e,requestBodyValues:r.values})}},uF=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:i})=>{const a=await o.text(),s=Gc(o);if(a.trim()==="")return{responseHeaders:s,value:new Zt({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})};try{const c=await aF({text:a,schema:e});return{responseHeaders:s,value:new Zt({message:t(c),url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,data:c,isRetryable:r?.(o,c)})}}catch{return{responseHeaders:s,value:new Zt({message:o.statusText,url:n,requestBodyValues:i,statusCode:o.status,responseHeaders:s,responseBody:a,isRetryable:r?.(o)})}}},OI=e=>async({response:t})=>{const r=Gc(t);if(t.body==null)throw new N5({});return{responseHeaders:r,value:sF({stream:t.body,schema:e})}},Zm=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),i=await $I({text:n,schema:e}),a=Gc(t);if(!i.success)throw new Zt({message:"Invalid JSON response",cause:i.error,statusCode:t.status,responseHeaders:a,responseBody:n,url:r,requestBodyValues:o});return{responseHeaders:a,value:i.value,rawValue:i.rawValue}},{btoa:dF}=globalThis;function fF(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return dF(t)}function mF(e){return e?.replace(/\/$/,"")}function Hl(e){return e!=null}var AI=(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))(AI||{}),Bm=O({id:S().nullish(),format:hn(AI).nullish(),index:B().optional()}).loose(),pF=O({type:q("reasoning.summary"),summary:S()}).extend(Bm.shape),gF=O({type:q("reasoning.encrypted"),data:S()}).extend(Bm.shape),hF=O({type:q("reasoning.text"),text:S().nullish(),signature:S().nullish()}).extend(Bm.shape),qm=fe([pF,gF,hF]),Va=fe([qm,Qe().transform(()=>null)]),Gm=z(Va).transform(e=>e.filter(t=>!!t));fe([O({delta:O({reasoning_details:z(Va)})}).transform(e=>e.delta.reasoning_details.filter(Hl)),O({message:O({reasoning_details:z(Va)})}).transform(e=>e.message.reasoning_details.filter(Hl)),O({text:S(),reasoning_details:z(Va)}).transform(e=>e.reasoning_details.filter(Hl))]);var Hc=O({error:O({code:fe([S(),B()]).nullable().optional().default(null),message:S(),type:S().nullable().optional().default(null),param:Me().nullable().optional().default(null)}).passthrough()}).passthrough(),mi=uF({errorSchema:Hc,errorToMessage:e=>e.error.message}),CI=O({type:q("file"),file:O({hash:S(),name:S(),content:z(O({type:S(),text:S().optional()}).catchall(Me())).optional()}).catchall(Me())}).catchall(Me()),vF=O({provider:S(),reasoning_details:z(qm).optional(),annotations:z(CI).optional(),usage:O({promptTokens:B(),promptTokensDetails:O({cachedTokens:B()}).catchall(Me()).optional(),completionTokens:B(),completionTokensDetails:O({reasoningTokens:B()}).catchall(Me()).optional(),totalTokens:B(),cost:B().optional(),costDetails:O({upstreamInferenceCost:B()}).catchall(Me()).optional()}).catchall(Me())}).catchall(Me()),Sh=O({openrouter:O({reasoning_details:z(qm).optional(),annotations:z(CI).optional()}).optional()}).optional();function xs(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 yF=["wav","mp3","aiff","aac","ogg","flac","m4a","pcm16","pcm24"];function Hm({url:e,protocols:t}){try{const r=new URL(e);return t.has(r.protocol)}catch{return!1}}function Ku({part:e,defaultMediaType:t}){var r,o;if(e.data instanceof Uint8Array){const i=fF(e.data);return`data:${(r=e.mediaType)!=null?r:t};base64,${i}`}const n=e.data.toString();return Hm({url:n,protocols:new Set(["http:","https:"])})||n.startsWith("data:")?n:`data:${(o=e.mediaType)!=null?o:t};base64,${n}`}function kh(e,t){var r;const o=e.match(/^data:([^;]+)/);return o&&(r=o[1])!=null?r:t}function Yu(e){const t=e.match(/^data:[^;]*;base64,(.+)$/);return t?t[1]:e}var bF={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 _F(e){const t=Ku({part:e,defaultMediaType:"audio/mpeg"});if(Hm({url:t,protocols:new Set(["http:","https:"])}))throw new Error(`Audio files cannot be provided as URLs.
46
-
47
- OpenRouter requires audio to be base64-encoded. Please:
48
- 1. Download the audio file locally
49
- 2. Read it as a Buffer or Uint8Array
50
- 3. Pass it as the data parameter
51
-
52
- The AI SDK will automatically handle base64 encoding.
53
-
54
- Learn more: https://openrouter.ai/docs/features/multimodal/audio`);const r=Yu(t),o=e.mediaType||"audio/mpeg",n=o.replace("audio/",""),i=bF[n];if(i===void 0){const a=yF.join(", ");throw new Error(`Unsupported audio format: "${o}"
55
-
56
- OpenRouter supports the following audio formats: ${a}
57
-
58
- Learn more: https://openrouter.ai/docs/features/multimodal/audio`)}return{data:r,format:i}}function Sr(e){var t,r,o;const n=e?.anthropic,i=e?.openrouter;return(o=(r=(t=i?.cacheControl)!=null?t:i?.cache_control)!=null?r:n?.cacheControl)!=null?o:n?.cache_control}function wF(e){var t,r,o,n,i,a,s,c,l,u;const d=[];for(const{role:f,content:m,providerOptions:h}of e)switch(f){case"system":{d.push({role:"system",content:m,cache_control:Sr(h)});break}case"user":{if(m.length===1&&((t=m[0])==null?void 0:t.type)==="text"){const b=(r=Sr(h))!=null?r:Sr(m[0].providerOptions),w=b?[{type:"text",text:m[0].text,cache_control:b}]:m[0].text;d.push({role:"user",content:w});break}const g=Sr(h),y=m.map(b=>{var w,x,v,k,E,I,C;const U=(w=Sr(b.providerOptions))!=null?w:g;switch(b.type){case"text":return{type:"text",text:b.text,cache_control:U};case"file":{if((x=b.mediaType)!=null&&x.startsWith("image/"))return{type:"image_url",image_url:{url:Ku({part:b,defaultMediaType:"image/jpeg"})},cache_control:U};if((v=b.mediaType)!=null&&v.startsWith("audio/"))return{type:"input_audio",input_audio:_F(b),cache_control:U};const D=String((C=(I=(E=(k=b.providerOptions)==null?void 0:k.openrouter)==null?void 0:E.filename)!=null?I:b.filename)!=null?C:""),K=Ku({part:b,defaultMediaType:"application/pdf"});return Hm({url:K,protocols:new Set(["http:","https:"])})?{type:"file",file:{filename:D,file_data:K}}:{type:"file",file:{filename:D,file_data:K},cache_control:U}}default:return{type:"text",text:"",cache_control:U}}});d.push({role:"user",content:y});break}case"assistant":{let g="",y="";const b=[],w=[];for(const I of m)switch(I.type){case"text":{g+=I.text;break}case"tool-call":{const C=(o=I.providerOptions)==null?void 0:o.openrouter;C?.reasoning_details&&Array.isArray(C.reasoning_details)&&w.push(...C.reasoning_details),b.push({id:I.toolCallId,type:"function",function:{name:I.toolName,arguments:JSON.stringify(I.input)}});break}case"reasoning":{y+=I.text;const C=Sh.safeParse(I.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 x=Sh.safeParse(h),v=x.success?(s=(a=x.data)==null?void 0:a.openrouter)==null?void 0:s.reasoning_details:void 0,k=x.success?(l=(c=x.data)==null?void 0:c.openrouter)==null?void 0:l.annotations:void 0,E=v&&Array.isArray(v)&&v.length>0?v:w.length>0?w:void 0;d.push({role:"assistant",content:g,tool_calls:b.length>0?b:void 0,reasoning:y||void 0,reasoning_details:E,annotations:k,cache_control:Sr(h)});break}case"tool":{for(const g of m){const y=xF(g);d.push({role:"tool",tool_call_id:g.toolCallId,content:y,cache_control:(u=Sr(h))!=null?u:Sr(g.providerOptions)})}break}}return d}function xF(e){return e.output.type==="text"?e.output.value:JSON.stringify(e.output.value)}fe([q("auto"),q("none"),q("required"),O({type:q("function"),function:O({name:S()})})]);function SF(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 oI({argument:"toolChoice",message:`Invalid tool choice type: ${JSON.stringify(e)}`})}}var kF=O({type:q("image_url"),image_url:O({url:S()}).passthrough()}).passthrough(),EF=fe([kF,Qe().transform(()=>null)]),NI=z(EF).transform(e=>e.filter(t=>!!t)),RI=O({id:S().optional(),model:S().optional(),provider:S().optional(),usage:O({prompt_tokens:B(),prompt_tokens_details:O({cached_tokens:B()}).passthrough().nullish(),completion_tokens:B(),completion_tokens_details:O({reasoning_tokens:B()}).passthrough().nullish(),total_tokens:B(),cost:B().optional(),cost_details:O({upstream_inference_cost:B().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),IF=fe([RI.extend({choices:z(O({message:O({role:q("assistant"),content:S().nullable().optional(),reasoning:S().nullable().optional(),reasoning_details:Gm.nullish(),images:NI.nullish(),tool_calls:z(O({id:S().optional().nullable(),type:q("function"),function:O({name:S(),arguments:S()}).passthrough()}).passthrough()).optional(),annotations:z(fe([O({type:q("url_citation"),url_citation:O({end_index:B(),start_index:B(),title:S(),url:S(),content:S().optional()}).passthrough()}).passthrough(),O({type:q("file_annotation"),file_annotation:O({file_id:S(),quote:S().optional()}).passthrough()}).passthrough(),O({type:q("file"),file:O({hash:S(),name:S(),content:z(O({type:S(),text:S().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough(),index:B().nullish(),logprobs:O({content:z(O({token:S(),logprob:B(),top_logprobs:z(O({token:S(),logprob:B()}).passthrough())}).passthrough()).nullable()}).passthrough().nullable().optional(),finish_reason:S().optional().nullable()}).passthrough())}),Hc.extend({user_id:S().optional()})]),TF=fe([RI.extend({choices:z(O({delta:O({role:hn(["assistant"]).optional(),content:S().nullish(),reasoning:S().nullish().optional(),reasoning_details:Gm.nullish(),images:NI.nullish(),tool_calls:z(O({index:B().nullish(),id:S().nullish(),type:q("function").optional(),function:O({name:S().nullish(),arguments:S().nullish()}).passthrough()}).passthrough()).nullish(),annotations:z(fe([O({type:q("url_citation"),url_citation:O({end_index:B(),start_index:B(),title:S(),url:S(),content:S().optional()}).passthrough()}).passthrough(),O({type:q("file_annotation"),file_annotation:O({file_id:S(),quote:S().optional()}).passthrough()}).passthrough(),O({type:q("file"),file:O({hash:S(),name:S(),content:z(O({type:S(),text:S().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough().nullish(),logprobs:O({content:z(O({token:S(),logprob:B(),top_logprobs:z(O({token:S(),logprob:B()}).passthrough())}).passthrough()).nullable()}).passthrough().nullish(),finish_reason:S().nullable().optional(),index:B().nullish()}).passthrough())}),Hc]),$F=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=we(we({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:we({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:wF(e),include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning,usage:this.settings.usage,plugins:this.settings.plugins,web_search_options:this.settings.web_search_options,provider:this.settings.provider,debug:this.settings.debug},this.config.extraBody),this.settings.extraBody);if(u&&u.length>0){const h=u.filter(g=>g.type==="function").map(g=>({type:"function",function:{name:g.name,description:g.description,parameters:g.inputSchema}}));return _s(we({},m),{tools:h,tool_choice:d?SF(d):void 0})}return m}async doGenerate(e){var t,r,o,n,i,a,s,c,l,u,d,f,m,h,g,y,b,w,x,v,k,E,I;const U=(e.providerOptions||{}).openrouter||{},D=we(we({},this.getArgs(e)),U),{value:K,responseHeaders:he}=await fi({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:di(this.config.headers(),e.headers),body:D,failedResponseHandler:mi,successfulResponseHandler:Zm(IF),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in K){const P=K.error;throw new Zt({message:P.message,url:this.config.url({path:"/chat/completions",modelId:this.modelId}),requestBodyValues:D,statusCode:200,responseHeaders:he,data:P})}const F=K,V=F.choices[0];if(!V)throw new _I({message:"No choice in response"});const ve=F.usage?{inputTokens:(t=F.usage.prompt_tokens)!=null?t:0,outputTokens:(r=F.usage.completion_tokens)!=null?r:0,totalTokens:((o=F.usage.prompt_tokens)!=null?o:0)+((n=F.usage.completion_tokens)!=null?n:0),reasoningTokens:(a=(i=F.usage.completion_tokens_details)==null?void 0:i.reasoning_tokens)!=null?a:0,cachedInputTokens:(c=(s=F.usage.prompt_tokens_details)==null?void 0:s.cached_tokens)!=null?c:0}:{inputTokens:0,outputTokens:0,totalTokens:0,reasoningTokens:0,cachedInputTokens:0},ue=(l=V.message.reasoning_details)!=null?l:[],pe=ue.length>0?ue.map(P=>{switch(P.type){case"reasoning.text":{if(P.text)return{type:"reasoning",text:P.text,providerMetadata:{openrouter:{reasoning_details:[P]}}};break}case"reasoning.summary":{if(P.summary)return{type:"reasoning",text:P.summary,providerMetadata:{openrouter:{reasoning_details:[P]}}};break}case"reasoning.encrypted":{if(P.data)return{type:"reasoning",text:"[REDACTED]",providerMetadata:{openrouter:{reasoning_details:[P]}}};break}}return null}).filter(P=>P!==null):V.message.reasoning?[{type:"reasoning",text:V.message.reasoning}]:[],G=[];if(G.push(...pe),V.message.content&&G.push({type:"text",text:V.message.content}),V.message.tool_calls)for(const P of V.message.tool_calls)G.push({type:"tool-call",toolCallId:(u=P.id)!=null?u:Ut(),toolName:P.function.name,input:P.function.arguments,providerMetadata:{openrouter:{reasoning_details:ue}}});if(V.message.images)for(const P of V.message.images)G.push({type:"file",mediaType:kh(P.image_url.url,"image/jpeg"),data:Yu(P.image_url.url)});if(V.message.annotations)for(const P of V.message.annotations)P.type==="url_citation"&&G.push({type:"source",sourceType:"url",id:P.url_citation.url,url:P.url_citation.url,title:P.url_citation.title,providerMetadata:{openrouter:{content:P.url_citation.content||""}}});const le=(d=V.message.annotations)==null?void 0:d.filter(P=>P.type==="file"),Z=V.message.tool_calls&&V.message.tool_calls.length>0,X=ue.some(P=>P.type==="reasoning.encrypted"&&P.data),Se=Z&&X&&V.finish_reason==="stop"?"tool-calls":xs(V.finish_reason);return{content:G,finishReason:Se,usage:ve,warnings:[],providerMetadata:{openrouter:vF.parse({provider:(f=F.provider)!=null?f:"",reasoning_details:(m=V.message.reasoning_details)!=null?m:[],annotations:le&&le.length>0?le:void 0,usage:we(we(we({promptTokens:(h=ve.inputTokens)!=null?h:0,completionTokens:(g=ve.outputTokens)!=null?g:0,totalTokens:(y=ve.totalTokens)!=null?y:0,cost:(b=F.usage)==null?void 0:b.cost},((x=(w=F.usage)==null?void 0:w.prompt_tokens_details)==null?void 0:x.cached_tokens)!=null?{promptTokensDetails:{cachedTokens:F.usage.prompt_tokens_details.cached_tokens}}:{}),((k=(v=F.usage)==null?void 0:v.completion_tokens_details)==null?void 0:k.reasoning_tokens)!=null?{completionTokensDetails:{reasoningTokens:F.usage.completion_tokens_details.reasoning_tokens}}:{}),((I=(E=F.usage)==null?void 0:E.cost_details)==null?void 0:I.upstream_inference_cost)!=null?{costDetails:{upstreamInferenceCost:F.usage.cost_details.upstream_inference_cost}}:{})})},request:{body:D},response:{id:F.id,modelId:F.model,headers:he}}}async doStream(e){var t;const o=(e.providerOptions||{}).openrouter||{},n=we(we({},this.getArgs(e)),o),{value:i,responseHeaders:a}=await fi({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:di(this.config.headers(),e.headers),body:_s(we({},n),{stream:!0,stream_options:this.config.compatibility==="strict"?we({include_usage:!0},(t=this.settings.usage)!=null&&t.include?{include_usage:!0}:{}):void 0}),failedResponseHandler:mi,successfulResponseHandler:OI(TF),abortSignal:e.abortSignal,fetch:this.config.fetch}),s=[];let c="other";const l={inputTokens:Number.NaN,outputTokens:Number.NaN,totalTokens:Number.NaN,reasoningTokens:Number.NaN,cachedInputTokens:Number.NaN},u={},d=[],f=[];let m=!1,h=!1,g,y,b,w;return{stream:i.pipeThrough(new TransformStream({transform(x,v){var k,E,I,C,U,D,K,he,F,V,ve,ue,pe,G,le;if(!x.success){c="error",v.enqueue({type:"error",error:x.error});return}const Z=x.value;if("error"in Z){c="error",v.enqueue({type:"error",error:Z.error});return}if(Z.provider&&(w=Z.provider),Z.id&&(b=Z.id,v.enqueue({type:"response-metadata",id:Z.id})),Z.model&&v.enqueue({type:"response-metadata",modelId:Z.model}),Z.usage!=null){if(l.inputTokens=Z.usage.prompt_tokens,l.outputTokens=Z.usage.completion_tokens,l.totalTokens=Z.usage.prompt_tokens+Z.usage.completion_tokens,u.promptTokens=Z.usage.prompt_tokens,Z.usage.prompt_tokens_details){const H=(k=Z.usage.prompt_tokens_details.cached_tokens)!=null?k:0;l.cachedInputTokens=H,u.promptTokensDetails={cachedTokens:H}}if(u.completionTokens=Z.usage.completion_tokens,Z.usage.completion_tokens_details){const H=(E=Z.usage.completion_tokens_details.reasoning_tokens)!=null?E:0;l.reasoningTokens=H,u.completionTokensDetails={reasoningTokens:H}}u.cost=Z.usage.cost,u.totalTokens=Z.usage.total_tokens;const P=(I=Z.usage.cost_details)==null?void 0:I.upstream_inference_cost;P!=null&&(u.costDetails={upstreamInferenceCost:P})}const X=Z.choices[0];if(X?.finish_reason!=null&&(c=xs(X.finish_reason)),X?.delta==null)return;const oe=X.delta,Se=(P,H)=>{h||(y=b||Ut(),v.enqueue({providerMetadata:H,type:"reasoning-start",id:y}),h=!0),v.enqueue({providerMetadata:H,type:"reasoning-delta",delta:P,id:y||Ut()})};if(oe.reasoning_details&&oe.reasoning_details.length>0){for(const H of oe.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(we({},H))}else d.push(H);const P={openrouter:{reasoning_details:oe.reasoning_details}};for(const H of oe.reasoning_details)switch(H.type){case"reasoning.text":{H.text&&Se(H.text,P);break}case"reasoning.encrypted":{H.data&&Se("[REDACTED]",P);break}case"reasoning.summary":{H.summary&&Se(H.summary,P);break}}}else oe.reasoning&&Se(oe.reasoning);if(oe.content&&(h&&!m&&(v.enqueue({type:"reasoning-end",id:y||Ut()}),h=!1),m||(g=b||Ut(),v.enqueue({type:"text-start",id:g}),m=!0),v.enqueue({type:"text-delta",delta:oe.content,id:g||Ut()})),oe.annotations){for(const P of oe.annotations)if(P.type==="url_citation")v.enqueue({type:"source",sourceType:"url",id:P.url_citation.url,url:P.url_citation.url,title:P.url_citation.title,providerMetadata:{openrouter:{content:P.url_citation.content||""}}});else if(P.type==="file"){const H=P.file;H&&typeof H=="object"&&"hash"in H&&"name"in H&&f.push(P)}}if(oe.tool_calls!=null)for(const P of oe.tool_calls){const H=(C=P.index)!=null?C:s.length-1;if(s[H]==null){if(P.type!=="function")throw new Mo({data:P,message:"Expected 'function' type."});if(P.id==null)throw new Mo({data:P,message:"Expected 'id' to be a string."});if(((U=P.function)==null?void 0:U.name)==null)throw new Mo({data:P,message:"Expected 'function.name' to be a string."});s[H]={id:P.id,type:"function",function:{name:P.function.name,arguments:(D=P.function.arguments)!=null?D:""},inputStarted:!1,sent:!1};const Te=s[H];if(Te==null)throw new Mo({data:{index:H,toolCallsLength:s.length},message:`Tool call at index ${H} is missing after creation.`});((K=Te.function)==null?void 0:K.name)!=null&&((he=Te.function)==null?void 0:he.arguments)!=null&&Gl(Te.function.arguments)&&(Te.inputStarted=!0,v.enqueue({type:"tool-input-start",id:Te.id,toolName:Te.function.name}),v.enqueue({type:"tool-input-delta",id:Te.id,delta:Te.function.arguments}),v.enqueue({type:"tool-input-end",id:Te.id}),v.enqueue({type:"tool-call",toolCallId:Te.id,toolName:Te.function.name,input:Te.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),Te.sent=!0);continue}const me=s[H];if(me==null)throw new Mo({data:{index:H,toolCallsLength:s.length,toolCallDelta:P},message:`Tool call at index ${H} is missing during merge.`});me.inputStarted||(me.inputStarted=!0,v.enqueue({type:"tool-input-start",id:me.id,toolName:me.function.name})),((F=P.function)==null?void 0:F.arguments)!=null&&(me.function.arguments+=(ve=(V=P.function)==null?void 0:V.arguments)!=null?ve:""),v.enqueue({type:"tool-input-delta",id:me.id,delta:(ue=P.function.arguments)!=null?ue:""}),((pe=me.function)==null?void 0:pe.name)!=null&&((G=me.function)==null?void 0:G.arguments)!=null&&Gl(me.function.arguments)&&(v.enqueue({type:"tool-call",toolCallId:(le=me.id)!=null?le:Ut(),toolName:me.function.name,input:me.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),me.sent=!0)}if(oe.images!=null)for(const P of oe.images)v.enqueue({type:"file",mediaType:kh(P.image_url.url,"image/jpeg"),data:Yu(P.image_url.url)})},flush(x){var v;const k=s.length>0,E=d.some(C=>C.type==="reasoning.encrypted"&&C.data);if(k&&E&&c==="stop"&&(c="tool-calls"),c==="tool-calls")for(const C of s)C&&!C.sent&&(x.enqueue({type:"tool-call",toolCallId:(v=C.id)!=null?v:Ut(),toolName:C.function.name,input:Gl(C.function.arguments)?C.function.arguments:"{}",providerMetadata:{openrouter:{reasoning_details:d}}}),C.sent=!0);h&&x.enqueue({type:"reasoning-end",id:y||Ut()}),m&&x.enqueue({type:"text-end",id:g||Ut()});const I={usage:u};w!==void 0&&(I.provider=w),d.length>0&&(I.reasoning_details=d),f.length>0&&(I.annotations=f),x.enqueue({type:"finish",finishReason:c,usage:l,providerMetadata:{openrouter:I}})}})),warnings:[],request:{body:n},response:{headers:a}}}};function OF({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}
59
-
60
- `,e=e.slice(1));for(const{role:i,content:a}of e)switch(i){case"system":throw new j5({message:`Unexpected system message in prompt: ${a}`,prompt:e});case"user":{const s=a.map(c=>{switch(c.type){case"text":return c.text;case"file":throw new Er({functionality:"file attachments"});default:return""}}).join("");n+=`${r}:
61
- ${s}
62
-
63
- `;break}case"assistant":{const s=a.map(c=>{switch(c.type){case"text":return c.text;case"tool-call":throw new Er({functionality:"tool-call messages"});case"tool-result":throw new Er({functionality:"tool-result messages"});case"reasoning":throw new Er({functionality:"reasoning messages"});case"file":throw new Er({functionality:"file attachments"});default:return""}}).join("");n+=`${o}:
64
- ${s}
65
-
66
- `;break}case"tool":throw new Er({functionality:"tool messages"})}return n+=`${o}:
67
- `,{prompt:n}}var Eh=fe([O({id:S().optional(),model:S().optional(),choices:z(O({text:S(),reasoning:S().nullish().optional(),reasoning_details:Gm.nullish(),finish_reason:S().nullish(),index:B().nullish(),logprobs:O({tokens:z(S()),token_logprobs:z(B()),top_logprobs:z(nr(S(),B())).nullable()}).passthrough().nullable().optional()}).passthrough()),usage:O({prompt_tokens:B(),prompt_tokens_details:O({cached_tokens:B()}).passthrough().nullish(),completion_tokens:B(),completion_tokens_details:O({reasoning_tokens:B()}).passthrough().nullish(),total_tokens:B(),cost:B().optional(),cost_details:O({upstream_inference_cost:B().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),Hc]),AF=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}=OF({prompt:e,inputFormat:"prompt"});if(u?.length)throw new Er({functionality:"tools"});if(d)throw new Er({functionality:"toolChoice"});return we(we({model:this.modelId,models:this.settings.models,logit_bias:this.settings.logitBias,logprobs:typeof this.settings.logprobs=="number"?this.settings.logprobs:typeof this.settings.logprobs=="boolean"&&this.settings.logprobs?0:void 0,suffix:this.settings.suffix,user:this.settings.user,max_tokens:t,temperature:r,top_p:o,frequency_penalty:n,presence_penalty:i,seed:a,stop:l,response_format:s,top_k:c,prompt:f,include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning},this.config.extraBody),this.settings.extraBody)}async doGenerate(e){var t,r,o,n,i,a,s,c,l,u,d,f,m,h,g;const b=(e.providerOptions||{}).openrouter||{},w=we(we({},this.getArgs(e)),b),{value:x,responseHeaders:v}=await fi({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:di(this.config.headers(),e.headers),body:w,failedResponseHandler:mi,successfulResponseHandler:Zm(Eh),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in x){const E=x.error;throw new Zt({message:E.message,url:this.config.url({path:"/completions",modelId:this.modelId}),requestBodyValues:w,statusCode:200,responseHeaders:v,data:E})}const k=x.choices[0];if(!k)throw new _I({message:"No choice in OpenRouter completion response"});return{content:[{type:"text",text:(t=k.text)!=null?t:""}],finishReason:xs(k.finish_reason),usage:{inputTokens:(o=(r=x.usage)==null?void 0:r.prompt_tokens)!=null?o:0,outputTokens:(i=(n=x.usage)==null?void 0:n.completion_tokens)!=null?i:0,totalTokens:((s=(a=x.usage)==null?void 0:a.prompt_tokens)!=null?s:0)+((l=(c=x.usage)==null?void 0:c.completion_tokens)!=null?l:0),reasoningTokens:(f=(d=(u=x.usage)==null?void 0:u.completion_tokens_details)==null?void 0:d.reasoning_tokens)!=null?f:0,cachedInputTokens:(g=(h=(m=x.usage)==null?void 0:m.prompt_tokens_details)==null?void 0:h.cached_tokens)!=null?g:0},warnings:[],response:{headers:v}}}async doStream(e){const r=(e.providerOptions||{}).openrouter||{},o=we(we({},this.getArgs(e)),r),{value:n,responseHeaders:i}=await fi({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:di(this.config.headers(),e.headers),body:_s(we({},o),{stream:!0,stream_options:this.config.compatibility==="strict"?{include_usage:!0}:void 0}),failedResponseHandler:mi,successfulResponseHandler:OI(Eh),abortSignal:e.abortSignal,fetch:this.config.fetch});let a="other";const s={inputTokens:Number.NaN,outputTokens:Number.NaN,totalTokens:Number.NaN,reasoningTokens:Number.NaN,cachedInputTokens:Number.NaN},c={};return{stream:n.pipeThrough(new TransformStream({transform(l,u){var d,f,m;if(!l.success){a="error",u.enqueue({type:"error",error:l.error});return}const h=l.value;if("error"in h){a="error",u.enqueue({type:"error",error:h.error});return}if(h.usage!=null){if(s.inputTokens=h.usage.prompt_tokens,s.outputTokens=h.usage.completion_tokens,s.totalTokens=h.usage.prompt_tokens+h.usage.completion_tokens,c.promptTokens=h.usage.prompt_tokens,h.usage.prompt_tokens_details){const b=(d=h.usage.prompt_tokens_details.cached_tokens)!=null?d:0;s.cachedInputTokens=b,c.promptTokensDetails={cachedTokens:b}}if(c.completionTokens=h.usage.completion_tokens,h.usage.completion_tokens_details){const b=(f=h.usage.completion_tokens_details.reasoning_tokens)!=null?f:0;s.reasoningTokens=b,c.completionTokensDetails={reasoningTokens:b}}c.cost=h.usage.cost,c.totalTokens=h.usage.total_tokens;const y=(m=h.usage.cost_details)==null?void 0:m.upstream_inference_cost;y!=null&&(c.costDetails={upstreamInferenceCost:y})}const g=h.choices[0];g?.finish_reason!=null&&(a=xs(g.finish_reason)),g?.text!=null&&u.enqueue({type:"text-delta",delta:g.text,id:Ut()})},flush(l){l.enqueue({type:"finish",finishReason:a,usage:s,providerMetadata:{openrouter:{usage:c}}})}})),response:{headers:i}}}},CF=O({prompt_tokens:B(),total_tokens:B(),cost:B().optional()}),NF=O({object:q("embedding"),embedding:z(B()),index:B().optional()}),RF=O({id:S().optional(),object:q("list"),data:z(NF),model:S(),usage:CF.optional()}),PF=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=we(we({model:this.modelId,input:r,user:this.settings.user,provider:this.settings.provider},this.config.extraBody),this.settings.extraBody),{value:a,responseHeaders:s}=await fi({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:di(this.config.headers(),n),body:i,failedResponseHandler:mi,successfulResponseHandler:Zm(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 jF(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==null))}function zF(e,...t){const r=jF(e??{}),n=[r["user-agent"]||"",...t].filter(Boolean).join(" ");return _s(we({},r),{"user-agent":n})}var DF="1.5.4";function PI(e={}){var t,r,o;const n=(r=mF((t=e.baseURL)!=null?t:e.baseUrl))!=null?r:"https://openrouter.ai/api/v1",i=(o=e.compatibility)!=null?o:"compatible",a=()=>zF(we(we({Authorization:`Bearer ${K5({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/${DF}`),s=(f,m={})=>new $F(f,m,{provider:"openrouter.chat",url:({path:h})=>`${n}${h}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),c=(f,m={})=>new AF(f,m,{provider:"openrouter.completion",url:({path:h})=>`${n}${h}`,headers:a,compatibility:i,fetch:e.fetch,extraBody:e.extraBody}),l=(f,m={})=>new PF(f,m,{provider:"openrouter.embedding",url:({path:h})=>`${n}${h}`,headers:a,fetch:e.fetch,extraBody:e.extraBody}),u=(f,m)=>{if(new.target)throw new Error("The OpenRouter model function cannot be called with the new keyword.");return f==="openai/gpt-3.5-turbo-instruct"?c(f,m):s(f,m)},d=(f,m)=>u(f,m);return d.languageModel=u,d.chat=s,d.completion=c,d.textEmbeddingModel=l,d.embedding=l,d}PI({compatibility:"strict"});function Xu(...e){return e.reduce((t,r)=>({...t,...r??{}}),{})}async function jI(e,t){if(e==null)return Promise.resolve();const r=t?.abortSignal;return new Promise((o,n)=>{if(r?.aborted){n(Ih());return}const i=setTimeout(()=>{a(),o()},e),a=()=>{clearTimeout(i),r?.removeEventListener("abort",s)},s=()=>{a(),n(Ih())};r?.addEventListener("abort",s)})}function Ih(){return new DOMException("Delay was aborted","AbortError")}function oa(e){return Object.fromEntries([...e.headers])}var ia=({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 _d({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},MF=ia();function zI(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 UF=["fetch failed","failed to fetch"];function DI({error:e,url:t,requestBodyValues:r}){if(cn(e))return e;if(e instanceof TypeError&&UF.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 Wm(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 Wc(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 MI="3.0.16",FF=()=>globalThis.fetch,Th=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:o,abortSignal:n,fetch:i=FF()})=>{try{const a=await i(e,{method:"GET",headers:Wc(t,`ai-sdk/provider-utils/${MI}`,Wm()),signal:n}),s=oa(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 DI({error:a,url:e,requestBodyValues:{}})}};function VF({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 Za({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 ZF=/"__proto__"\s*:/,BF=/"constructor"\s*:/;function qF(e){const t=JSON.parse(e);return t===null||typeof t!="object"||ZF.test(e)===!1&&BF.test(e)===!1?t:GF(t)}function GF(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 UI(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return qF(e)}finally{Error.stackTraceLimit=t}}var Ss=Symbol.for("vercel.ai.validator");function HF(e){return{[Ss]:!0,validate:e}}function WF(e){return typeof e=="object"&&e!==null&&Ss in e&&e[Ss]===!0&&"validate"in e}function So(e){let t;return()=>(t==null&&(t=e()),t)}function JF(e){return WF(e)?e:typeof e=="function"?e():KF(e)}function KF(e){return HF(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new Yo({value:t,cause:r.issues})}})}async function Qu({value:e,schema:t}){const r=await Mr({value:e,schema:t});if(!r.success)throw Yo.wrap({value:e,cause:r.error});return r.value}async function Mr({value:e,schema:t}){const r=JF(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:Yo.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:Yo.wrap({value:e,cause:o}),rawValue:e}}}async function YF({text:e,schema:t}){try{const r=UI(e);return t==null?r:Qu({value:r,schema:t})}catch(r){throw Wa.isInstance(r)||Yo.isInstance(r)?r:new Wa({text:e,cause:r})}}async function ln({text:e,schema:t}){try{const r=UI(e);return t==null?{success:!0,value:r,rawValue:r}:await Mr({value:r,schema:t})}catch(r){return{success:!1,error:Wa.isInstance(r)?r:new Wa({text:e,cause:r}),rawValue:void 0}}}function XF({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ja).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await ln({text:r,schema:t}))}}))}var QF=()=>globalThis.fetch,ed=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a})=>e3({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:i,fetch:a}),e3=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:i,fetch:a=QF()})=>{try{const s=await a(e,{method:"POST",headers:Wc(t,`ai-sdk/provider-utils/${MI}`,Wm()),body:r.content,signal:i}),c=oa(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 DI({error:s,url:e,requestBodyValues:r.values})}};async function $r(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var pi=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:i})=>{const a=await o.text(),s=oa(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 YF({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)})}}},t3=e=>async({response:t})=>{const r=oa(t);if(t.body==null)throw new OO({});return{responseHeaders:r,value:XF({stream:t.body,schema:e})}},ks=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),i=await ln({text:n,schema:e}),a=oa(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}},r3=(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("/")},n3=Symbol("Let zodToJsonSchema decide on which parser to use"),$h={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"},o3=e=>typeof e=="string"?{...$h,name:e}:{...$h,...e};function St(){return{}}function i3(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)!==Q.ZodAny&&(i.items=xe(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 a3(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 s3(){return{type:"boolean"}}function LI(e,t){return xe(e.type._def,t)}var c3=(e,t)=>xe(e.innerType._def,t);function FI(e,t,r){const o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>FI(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 l3(e)}}var l3=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 u3(e,t){return{...xe(e.innerType._def,t),default:e.defaultValue()}}function d3(e,t){return t.effectStrategy==="input"?xe(e.schema._def,t):St()}function f3(e){return{type:"string",enum:Array.from(e.values)}}var m3=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function p3(e,t){const r=[xe(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),xe(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(n=>!!n),o=[];return r.forEach(n=>{if(m3(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 g3(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 Wl=void 0,Dt={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Wl===void 0&&(Wl=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Wl),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 VI(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":Mt(r,"email",o.message,t);break;case"format:idn-email":Mt(r,"idn-email",o.message,t);break;case"pattern:zod":ot(r,Dt.email,o.message,t);break}break;case"url":Mt(r,"uri",o.message,t);break;case"uuid":Mt(r,"uuid",o.message,t);break;case"regex":ot(r,o.regex,o.message,t);break;case"cuid":ot(r,Dt.cuid,o.message,t);break;case"cuid2":ot(r,Dt.cuid2,o.message,t);break;case"startsWith":ot(r,RegExp(`^${Jl(o.value,t)}`),o.message,t);break;case"endsWith":ot(r,RegExp(`${Jl(o.value,t)}$`),o.message,t);break;case"datetime":Mt(r,"date-time",o.message,t);break;case"date":Mt(r,"date",o.message,t);break;case"time":Mt(r,"time",o.message,t);break;case"duration":Mt(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(Jl(o.value,t)),o.message,t);break}case"ip":{o.version!=="v6"&&Mt(r,"ipv4",o.message,t),o.version!=="v4"&&Mt(r,"ipv6",o.message,t);break}case"base64url":ot(r,Dt.base64url,o.message,t);break;case"jwt":ot(r,Dt.jwt,o.message,t);break;case"cidr":{o.version!=="v6"&&ot(r,Dt.ipv4Cidr,o.message,t),o.version!=="v4"&&ot(r,Dt.ipv6Cidr,o.message,t);break}case"emoji":ot(r,Dt.emoji(),o.message,t);break;case"ulid":{ot(r,Dt.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Mt(r,"binary",o.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{ot(r,Dt.base64,o.message,t);break}}break}case"nanoid":ot(r,Dt.nanoid,o.message,t)}return r}function Jl(e,t){return t.patternStrategy==="escape"?v3(e):e}var h3=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function v3(e){let t="";for(let r=0;r<e.length;r++)h3.has(e[r])||(t+="\\"),t+=e[r];return t}function Mt(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:Oh(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=Oh(t,o)}function Oh(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
68
- ]))`;continue}else if(n[l]==="$"){i+=`($|(?=[\r
69
- ]))`;continue}}if(o.s&&n[l]==="."){i+=s?`${n[l]}\r
70
- `:`[${n[l]}\r
71
- ]`;continue}i+=n[l],n[l]==="\\"?a=!0:s&&n[l]==="]"?s=!1:!s&&n[l]==="["&&(s=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function ZI(e,t){var r,o,n,i,a,s;const c={type:"object",additionalProperties:(r=xe(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((o=e.keyType)==null?void 0:o._def.typeName)===Q.ZodString&&((n=e.keyType._def.checks)!=null&&n.length)){const{type:l,...u}=VI(e.keyType._def,t);return{...c,propertyNames:u}}else{if(((i=e.keyType)==null?void 0:i._def.typeName)===Q.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((a=e.keyType)==null?void 0:a._def.typeName)===Q.ZodBranded&&e.keyType._def.type._def.typeName===Q.ZodString&&((s=e.keyType._def.type._def.checks)!=null&&s.length)){const{type:l,...u}=LI(e.keyType._def,t);return{...c,propertyNames:u}}}return c}function y3(e,t){if(t.mapStrategy==="record")return ZI(e,t);const r=xe(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||St(),o=xe(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||St();return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function b3(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 _3(){return{not:St()}}function w3(){return{type:"null"}}var td={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function x3(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(o=>o._def.typeName in td&&(!o._def.checks||!o._def.checks.length))){const o=r.reduce((n,i)=>{const a=td[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 S3(e,t)}var S3=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>xe(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 k3(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[td[e.innerType._def.typeName],"null"]};const r=xe(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function E3(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 I3(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=$3(s),l=xe(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=T3(e,t);return i!==void 0&&(r.additionalProperties=i),r}function T3(e,t){if(e.catchall._def.typeName!=="ZodNever")return xe(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 $3(e){try{return e.isOptional()}catch{return!0}}var O3=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return xe(e.innerType._def,t);const o=xe(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return o?{anyOf:[{not:St()},o]}:St()},A3=(e,t)=>{if(t.pipeStrategy==="input")return xe(e.in._def,t);if(t.pipeStrategy==="output")return xe(e.out._def,t);const r=xe(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=xe(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter(n=>n!==void 0)}};function C3(e,t){return xe(e.type._def,t)}function N3(e,t){const o={type:"array",uniqueItems:!0,items:xe(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)=>xe(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:xe(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>xe(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function P3(){return{not:St()}}function j3(){return St()}var z3=(e,t)=>xe(e.innerType._def,t),D3=(e,t,r)=>{switch(t){case Q.ZodString:return VI(e,r);case Q.ZodNumber:return E3(e);case Q.ZodObject:return I3(e,r);case Q.ZodBigInt:return a3(e);case Q.ZodBoolean:return s3();case Q.ZodDate:return FI(e,r);case Q.ZodUndefined:return P3();case Q.ZodNull:return w3();case Q.ZodArray:return i3(e,r);case Q.ZodUnion:case Q.ZodDiscriminatedUnion:return x3(e,r);case Q.ZodIntersection:return p3(e,r);case Q.ZodTuple:return R3(e,r);case Q.ZodRecord:return ZI(e,r);case Q.ZodLiteral:return g3(e);case Q.ZodEnum:return f3(e);case Q.ZodNativeEnum:return b3(e);case Q.ZodNullable:return k3(e,r);case Q.ZodOptional:return O3(e,r);case Q.ZodMap:return y3(e,r);case Q.ZodSet:return N3(e,r);case Q.ZodLazy:return()=>e.getter()._def;case Q.ZodPromise:return C3(e,r);case Q.ZodNaN:case Q.ZodNever:return _3();case Q.ZodEffects:return d3(e,r);case Q.ZodAny:return St();case Q.ZodUnknown:return j3();case Q.ZodDefault:return u3(e,r);case Q.ZodBranded:return LI(e,r);case Q.ZodReadonly:return z3(e,r);case Q.ZodCatch:return c3(e,r);case Q.ZodPipeline:return A3(e,r);case Q.ZodFunction:case Q.ZodVoid:case Q.ZodSymbol:return;default:return(o=>{})()}};function xe(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!==n3)return c}if(n&&!r){const c=M3(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=D3(e,e.typeName,t),s=typeof a=="function"?xe(a(),t):a;if(s&&U3(e,t,s),t.postProcess){const c=t.postProcess(s,e,t);return i.jsonSchema=s,c}return i.jsonSchema=s,s}var M3=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:r3(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`),St()):t.$refStrategy==="seen"?St():void 0}},U3=(e,t,r)=>(e.description&&(r.description=e.description),r),L3=e=>{const t=o3(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}]))}},F3=(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=xe(d._def,{...o,currentPath:[...o.basePath,o.definitionPath,u]},!0))!=null?f:St()}},{}):void 0;const i=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,a=(r=xe(e._def,i===void 0?o:{...o,currentPath:[...o.basePath,o.definitionPath,i]},!1))!=null?r:St(),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},V3=F3;function Z3(e,t){var r;const o=(r=void 0)!=null?r:!1;return Jm(()=>V3(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 B3(e,t){var r;const o=(r=void 0)!=null?r:!1;return Jm(()=>bf(e,{target:"draft-7",io:"output",reused:o?"ref":"inline"}),{validate:async n=>{const i=await kf(e,n);return i.success?{success:!0,value:i.data}:{success:!1,error:i.error}}})}function q3(e){return"_zod"in e}function wn(e,t){return q3(e)?B3(e):Z3(e)}var rd=Symbol.for("vercel.ai.schema");function Jm(e,{validate:t}={}){return{[rd]:!0,_type:void 0,[Ss]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function G3(e){return typeof e=="object"&&e!==null&&rd in e&&e[rd]===!0&&"jsonSchema"in e&&"validate"in e}function Jc(e){return e==null?Jm({properties:{},additionalProperties:!1}):G3(e)?e:typeof e=="function"?e():wn(e)}var{btoa:H3,atob:W3}=globalThis;function Km(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=W3(t);return Uint8Array.from(r,o=>o.codePointAt(0))}function nd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return H3(t)}function J3(e){return e?.replace(/\/$/,"")}function K3(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}async function*Y3({execute:e,input:t,options:r}){const o=e(t,r);if(K3(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 Kl,Ah;function X3(){if(Ah)return Kl;Ah=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(u,d)=>{for(var f in d)e(u,f,{get:d[f],enumerable:!0})},i=(u,d,f,m)=>{if(d&&typeof d=="object"||typeof d=="function")for(let h of r(d))!o.call(u,h)&&h!==f&&e(u,h,{get:()=>d[h],enumerable:!(m=t(d,h))||m.enumerable});return u},a=u=>i(e({},"__esModule",{value:!0}),u),s={};n(s,{SYMBOL_FOR_REQ_CONTEXT:()=>c,getContext:()=>l}),Kl=a(s);const c=Symbol.for("@vercel/request-context");function l(){return globalThis[c]?.get?.()??{}}return Kl}var Yl,Ch;function Q3(){if(Ch)return Yl;Ch=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(d,f)=>{for(var m in f)e(d,m,{get:f[m],enumerable:!0})},i=(d,f,m,h)=>{if(f&&typeof f=="object"||typeof f=="function")for(let g of r(f))!o.call(d,g)&&g!==m&&e(d,g,{get:()=>f[g],enumerable:!(h=t(f,g))||h.enumerable});return d},a=d=>i(e({},"__esModule",{value:!0}),d),s={};n(s,{getContext:()=>c.getContext,getVercelOidcToken:()=>l,getVercelOidcTokenSync:()=>u}),Yl=a(s);var c=X3();async function l(){return""}function u(){return""}return Yl}var BI=Q3(),eV="vercel.ai.gateway.error",Xl=Symbol.for(eV),Nh,Rh,kt=class qI extends(Rh=Error,Nh=Xl,Rh){constructor({message:t,statusCode:r=500,cause:o}){super(t),this[Nh]=!0,this.statusCode=r,this.cause=o}static isInstance(t){return qI.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&Xl in t&&t[Xl]===!0}},GI="GatewayAuthenticationError",tV=`vercel.ai.gateway.error.${GI}`,Ph=Symbol.for(tV),jh,zh,Ym=class HI extends(zh=kt,jh=Ph,zh){constructor({message:t="Authentication failed",statusCode:r=401,cause:o}={}){super({message:t,statusCode:r,cause:o}),this[jh]=!0,this.name=GI,this.type="authentication_error"}static isInstance(t){return kt.hasMarker(t)&&Ph 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.
72
-
73
- Create a new API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
74
-
75
- Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.`:r?a=`AI Gateway authentication failed: Invalid OIDC token.
76
-
77
- Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.
78
-
79
- 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.
80
-
81
- Option 1 - API key:
82
- Create an API key: https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys
83
- Provide via 'apiKey' option or 'AI_GATEWAY_API_KEY' environment variable.
84
-
85
- Option 2 - OIDC token:
86
- Run 'npx vercel link' to link your project, then 'vc env pull' to fetch the token.`,new HI({message:a,statusCode:n,cause:i})}},WI="GatewayInvalidRequestError",rV=`vercel.ai.gateway.error.${WI}`,Dh=Symbol.for(rV),Mh,Uh,nV=class extends(Uh=kt,Mh=Dh,Uh){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Mh]=!0,this.name=WI,this.type="invalid_request_error"}static isInstance(e){return kt.hasMarker(e)&&Dh in e}},JI="GatewayRateLimitError",oV=`vercel.ai.gateway.error.${JI}`,Lh=Symbol.for(oV),Fh,Vh,iV=class extends(Vh=kt,Fh=Lh,Vh){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Fh]=!0,this.name=JI,this.type="rate_limit_exceeded"}static isInstance(e){return kt.hasMarker(e)&&Lh in e}},KI="GatewayModelNotFoundError",aV=`vercel.ai.gateway.error.${KI}`,Zh=Symbol.for(aV),sV=So(()=>wn(O({modelId:S()}))),Bh,qh,YI=class extends(qh=kt,Bh=Zh,qh){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:o}={}){super({message:e,statusCode:t,cause:o}),this[Bh]=!0,this.name=KI,this.type="model_not_found",this.modelId=r}static isInstance(e){return kt.hasMarker(e)&&Zh in e}},XI="GatewayInternalServerError",cV=`vercel.ai.gateway.error.${XI}`,Gh=Symbol.for(cV),Hh,Wh,Jh=class extends(Wh=kt,Hh=Gh,Wh){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[Hh]=!0,this.name=XI,this.type="internal_server_error"}static isInstance(e){return kt.hasMarker(e)&&Gh in e}},QI="GatewayResponseError",lV=`vercel.ai.gateway.error.${QI}`,Kh=Symbol.for(lV),Yh,Xh,uV=class extends(Xh=kt,Yh=Kh,Xh){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:o,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[Yh]=!0,this.name=QI,this.type="response_error",this.response=r,this.validationError=o}static isInstance(e){return kt.hasMarker(e)&&Kh in e}};async function Qh({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:o,authMethod:n}){const i=await Mr({value:e,schema:dV});if(!i.success)return new uV({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 Ym.createContextualError({apiKeyProvided:n==="api-key",oidcTokenProvided:n==="oidc",statusCode:t,cause:o});case"invalid_request_error":return new nV({message:c,statusCode:t,cause:o});case"rate_limit_exceeded":return new iV({message:c,statusCode:t,cause:o});case"model_not_found":{const l=await Mr({value:a.error.param,schema:sV});return new YI({message:c,statusCode:t,modelId:l.success?l.value.modelId:void 0,cause:o})}case"internal_server_error":return new Jh({message:c,statusCode:t,cause:o});default:return new Jh({message:c,statusCode:t,cause:o})}}var dV=So(()=>wn(O({error:O({message:S(),type:S().nullish(),param:Qe().nullish(),code:fe([S(),B()]).nullish()})})));function un(e,t){var r;return kt.isInstance(e)?e:st.isInstance(e)?Qh({response:fV(e),statusCode:(r=e.statusCode)!=null?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):Qh({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function fV(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 eT="ai-gateway-auth-method";async function gi(e){const t=await Mr({value:e[eT],schema:mV});return t.success?t.value:void 0}var mV=So(()=>wn(fe([q("api-key"),q("oidc")]))),ev=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await Th({url:`${this.config.baseURL}/config`,headers:await $r(this.config.headers()),successfulResponseHandler:ks(pV),failedResponseHandler:pi({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 Th({url:`${e.origin}/v1/credits`,headers:await $r(this.config.headers()),successfulResponseHandler:ks(gV),failedResponseHandler:pi({errorSchema:Me(),errorToMessage:r=>r}),fetch:this.config.fetch});return t}catch(e){throw await un(e)}}},pV=So(()=>wn(O({models:z(O({id:S(),name:S(),description:S().nullish(),pricing:O({input:S(),output:S(),input_cache_read:S().nullish(),input_cache_write:S().nullish()}).transform(({input:e,output:t,input_cache_read:r,input_cache_write:o})=>({input:e,output:t,...r?{cachedInputTokens:r}:{},...o?{cacheCreationInputTokens:o}:{}})).nullish(),specification:O({specificationVersion:q("v2"),provider:S(),modelId:S()}),modelType:hn(["language","embedding","image"]).nullish()}))}))),gV=So(()=>wn(O({balance:S(),total_used:S()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),hV=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 ed({url:this.getUrl(),headers:Xu(n,e.headers,this.getModelConfigHeaders(this.modelId,!1),await $r(this.config.o11yHeaders)),body:t,successfulResponseHandler:ks(Me()),failedResponseHandler:pi({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 gi(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 ed({url:this.getUrl(),headers:Xu(n,e.headers,this.getModelConfigHeaders(this.modelId,!0),await $r(this.config.o11yHeaders)),body:t,successfulResponseHandler:t3(Me()),failedResponseHandler:pi({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 gi(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)}}},vV=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 ed({url:this.getUrl(),headers:Xu(i,t??{},this.getModelConfigHeaders(),await $r(this.config.o11yHeaders)),body:{input:e.length===1?e[0]:e,...o?{providerOptions:o}:{}},successfulResponseHandler:ks(yV),failedResponseHandler:pi({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 gi(i))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"2","ai-model-id":this.modelId}}},yV=So(()=>wn(O({embeddings:z(z(B())),usage:O({tokens:B()}).nullish(),providerMetadata:nr(S(),nr(S(),Qe())).optional()})));async function bV(){var e;return(e=BI.getContext().headers)==null?void 0:e["x-vercel-id"]}var _V="2.0.7",wV="0.0.1";function xV(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=J3(e.baseURL))!=null?r:"https://ai-gateway.vercel.sh/v1/ai",c=async()=>{const h=await kV(e);if(h)return Wc({Authorization:`Bearer ${h.token}`,"ai-gateway-protocol-version":wV,[eT]:h.authMethod,...e.headers},`ai-sdk/gateway/${_V}`);throw Ym.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401})},l=()=>{const h=Za({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),g=Za({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),y=Za({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const b=await bV();return{...h&&{"ai-o11y-deployment-id":h},...g&&{"ai-o11y-environment":g},...y&&{"ai-o11y-region":y},...b&&{"ai-o11y-request-id":b}}}},u=h=>new hV(h,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),d=async()=>{var h,g,y;const b=(y=(g=(h=e._internal)==null?void 0:h.currentDate)==null?void 0:g.call(h).getTime())!=null?y:Date.now();return(!o||b-a>i)&&(a=b,o=new ev({baseURL:s,headers:c,fetch:e.fetch}).getAvailableModels().then(w=>(n=w,w)).catch(async w=>{throw await un(w,await gi(await c()))})),n?Promise.resolve(n):o},f=async()=>new ev({baseURL:s,headers:c,fetch:e.fetch}).getCredits().catch(async h=>{throw await un(h,await gi(await c()))}),m=function(h){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return u(h)};return m.getAvailableModels=d,m.getCredits=f,m.imageModel=h=>{throw new PO({modelId:h,modelType:"imageModel"})},m.languageModel=u,m.textEmbeddingModel=h=>new vV(h,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),m}var SV=xV();async function kV(e){const t=Za({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(t)return{token:t,authMethod:"api-key"};try{return{token:await BI.getVercelOidcToken(),authMethod:"oidc"}}catch{return null}}var EV=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},en="1.9.0",tv=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function IV(e){var t=new Set([e]),r=new Set,o=e.match(tv);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(tv);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 TV=IV(en),$V=en.split(".")[0],hi=Symbol.for("opentelemetry.js.api."+$V),vi=EV;function Xm(e,t,r,o){var n;o===void 0&&(o=!1);var i=vi[hi]=(n=vi[hi])!==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 yi(e){var t,r,o=(t=vi[hi])===null||t===void 0?void 0:t.version;if(!(!o||!TV(o)))return(r=vi[hi])===null||r===void 0?void 0:r[e]}function Qm(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+en+".");var r=vi[hi];r&&delete r[e]}var OV=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],a;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return i},AV=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return e.concat(i||Array.prototype.slice.call(t))},CV=(function(){function e(t){this._namespace=t.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Uo("verbose",this._namespace,t)},e})();function Uo(e,t,r){var o=yi("diag");if(o)return r.unshift(t),o[e].apply(o,AV([],OV(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 NV(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},PV=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))},jV="diag",Es=(function(){function e(){function t(n){return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];var s=yi("diag");if(s)return s[n].apply(s,PV([],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=yi("diag"),d=NV((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 Xm("diag",d,r,!0)};r.setLogger=o,r.disable=function(){Qm(jV,r)},r.createComponentLogger=function(n){return new CV(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 zV(e){return Symbol.for(e)}var DV=(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})(),MV=new DV,UV=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))},FV=(function(){function e(){}return e.prototype.active=function(){return MV},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],UV(n),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),VV=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},ZV=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))},Ql="context",BV=new FV,tT=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return Xm(Ql,t,Es.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,ZV([t,r,o],VV(i),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return yi(Ql)||BV},e.prototype.disable=function(){this._getContextManager().disable(),Qm(Ql,Es.instance())},e})(),od;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(od||(od={}));var rT="0000000000000000",nT="00000000000000000000000000000000",qV={traceId:nT,spanId:rT,traceFlags:od.NONE},Jo=(function(){function e(t){t===void 0&&(t=qV),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})(),ep=zV("OpenTelemetry Context Key SPAN");function tp(e){return e.getValue(ep)||void 0}function GV(){return tp(tT.getInstance().active())}function rp(e,t){return e.setValue(ep,t)}function HV(e){return e.deleteValue(ep)}function WV(e,t){return rp(e,new Jo(t))}function oT(e){var t;return(t=tp(e))===null||t===void 0?void 0:t.spanContext()}var JV=/^([0-9a-f]{32})$/i,KV=/^[0-9a-f]{16}$/i;function YV(e){return JV.test(e)&&e!==nT}function XV(e){return KV.test(e)&&e!==rT}function iT(e){return YV(e.traceId)&&XV(e.spanId)}function QV(e){return new Jo(e)}var eu=tT.getInstance(),aT=(function(){function e(){}return e.prototype.startSpan=function(t,r,o){o===void 0&&(o=eu.active());var n=!!r?.root;if(n)return new Jo;var i=o&&oT(o);return eZ(i)&&iT(i)?new Jo(i):new Jo},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??eu.active(),l=this.startSpan(t,i,c),u=rp(c,l);return eu.with(u,s,void 0,l)}},e})();function eZ(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var tZ=new aT,rZ=(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):tZ},e})(),nZ=(function(){function e(){}return e.prototype.getTracer=function(t,r,o){return new aT},e})(),oZ=new nZ,rv=(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 rZ(this,t,r,o)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:oZ},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})(),Is;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Is||(Is={}));var tu="trace",iZ=(function(){function e(){this._proxyTracerProvider=new rv,this.wrapSpanContext=QV,this.isSpanContextValid=iT,this.deleteSpan=HV,this.getSpan=tp,this.getActiveSpan=GV,this.getSpanContext=oT,this.setSpan=rp,this.setSpanContext=WV}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=Xm(tu,this._proxyTracerProvider,Es.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return yi(tu)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){Qm(tu,Es.instance()),this._proxyTracerProvider=new rv},e})(),aZ=iZ.getInstance(),sZ=Object.defineProperty,cZ=(e,t)=>{for(var r in t)sZ(e,r,{get:t[r],enumerable:!0})},sT="AI_NoOutputSpecifiedError",cT=`vercel.ai.error.${sT}`,lZ=Symbol.for(cT),lT,uZ=class extends te{constructor({message:e="No output specified."}={}){super({name:sT,message:e}),this[lT]=!0}static isInstance(e){return te.hasMarker(e,cT)}};lT=lZ;function dZ(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 fZ="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",nv=!1,mZ=e=>{if(e.length===0)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t=="function"){t(e);return}nv||(nv=!0,console.info(fZ));for(const r of e)console.warn(dZ(r))}},uT="AI_InvalidArgumentError",dT=`vercel.ai.error.${uT}`,pZ=Symbol.for(dT),fT,Yt=class extends te{constructor({parameter:e,value:t,message:r}){super({name:uT,message:`Invalid argument for parameter ${e}: ${r}`}),this[fT]=!0,this.parameter=e,this.value=t}static isInstance(e){return te.hasMarker(e,dT)}};fT=pZ;var mT="AI_InvalidToolInputError",pT=`vercel.ai.error.${mT}`,gZ=Symbol.for(pT),gT,hT=class extends te{constructor({toolInput:e,toolName:t,cause:r,message:o=`Invalid input for tool ${t}: ${uo(r)}`}){super({name:mT,message:o,cause:r}),this[gT]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return te.hasMarker(e,pT)}};gT=gZ;var vT="AI_NoObjectGeneratedError",yT=`vercel.ai.error.${vT}`,hZ=Symbol.for(yT),bT,ov=class extends te{constructor({message:e="No object generated.",cause:t,text:r,response:o,usage:n,finishReason:i}){super({name:vT,message:e,cause:t}),this[bT]=!0,this.text=r,this.response=o,this.usage=n,this.finishReason=i}static isInstance(e){return te.hasMarker(e,yT)}};bT=hZ;var _T="AI_NoOutputGeneratedError",wT=`vercel.ai.error.${_T}`,vZ=Symbol.for(wT),xT,yZ=class extends te{constructor({message:e="No output generated.",cause:t}={}){super({name:_T,message:e,cause:t}),this[xT]=!0}static isInstance(e){return te.hasMarker(e,wT)}};xT=vZ;var ST="AI_NoSuchToolError",kT=`vercel.ai.error.${ST}`,bZ=Symbol.for(kT),ET,id=class extends te{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:ST,message:r}),this[ET]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return te.hasMarker(e,kT)}};ET=bZ;var IT="AI_ToolCallRepairError",TT=`vercel.ai.error.${IT}`,_Z=Symbol.for(TT),$T,wZ=class extends te{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${uo(e)}`}){super({name:IT,message:r,cause:e}),this[$T]=!0,this.originalError=t}static isInstance(e){return te.hasMarker(e,TT)}};$T=_Z;var xZ=class extends te{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}},OT="AI_InvalidMessageRoleError",AT=`vercel.ai.error.${OT}`,SZ=Symbol.for(AT),CT,kZ=class extends te{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:OT,message:t}),this[CT]=!0,this.role=e}static isInstance(e){return te.hasMarker(e,AT)}};CT=SZ;var NT="AI_MessageConversionError",RT=`vercel.ai.error.${NT}`,EZ=Symbol.for(RT),PT,IZ=class extends te{constructor({originalMessage:e,message:t}){super({name:NT,message:t}),this[PT]=!0,this.originalMessage=e}static isInstance(e){return te.hasMarker(e,RT)}};PT=EZ;var jT="AI_DownloadError",zT=`vercel.ai.error.${jT}`,TZ=Symbol.for(zT),DT,ru=class extends te{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:jT,message:n,cause:o}),this[DT]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return te.hasMarker(e,zT)}};DT=TZ;var MT="AI_RetryError",UT=`vercel.ai.error.${MT}`,$Z=Symbol.for(UT),LT,iv=class extends te{constructor({message:e,reason:t,errors:r}){super({name:MT,message:e}),this[LT]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return te.hasMarker(e,UT)}};LT=$Z;function FT(e){if(typeof e!="string"){if(e.specificationVersion!=="v2")throw new xZ({version:e.specificationVersion,provider:e.provider,modelId:e.modelId});return e}return OZ().languageModel(e)}function OZ(){var e;return(e=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?e:SV}var AZ=[{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]}],CZ=e=>{const t=typeof e=="string"?Km(e):e,r=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(r+10)};function NZ(e){return typeof e=="string"&&e.startsWith("SUQz")||typeof e!="string"&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?CZ(e):e}function RZ({data:e,signatures:t}){const r=NZ(e),o=typeof r=="string"?Km(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 PZ="5.0.90",jZ=async({url:e})=>{var t;const r=e.toString();try{const o=await fetch(r,{headers:Wc({},`ai-sdk/${PZ}`,Wm())});if(!o.ok)throw new ru({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 ru.isInstance(o)?o:new ru({url:r,cause:o})}},zZ=(e=jZ)=>t=>Promise.all(t.map(async r=>r.isUrlSupportedByModel?null:e(r)));function DZ(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 VT=fe([S(),to(Uint8Array),to(ArrayBuffer),cm(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]);function ZT(e){if(e instanceof Uint8Array)return{data:e,mediaType:void 0};if(e instanceof ArrayBuffer)return{data:new Uint8Array(e),mediaType:void 0};if(typeof e=="string")try{e=new URL(e)}catch{}if(e instanceof URL&&e.protocol==="data:"){const{mediaType:t,base64Content:r}=DZ(e.toString());if(t==null||r==null)throw new te({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}function MZ(e){return typeof e=="string"?e:e instanceof ArrayBuffer?nd(new Uint8Array(e)):nd(e)}async function UZ({prompt:e,supportedUrls:t,download:r=zZ()}){const o=await FZ(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=>VZ(o,t)).filter(o=>o.type!=="text"||o.text!==""),providerOptions:e.providerOptions};case"assistant":return typeof e.content=="string"?{role:"assistant",content:[{type:"text",text:e.content}],providerOptions:e.providerOptions}:{role:"assistant",content:e.content.filter(o=>o.type!=="text"||o.text!==""||o.providerOptions!=null).map(o=>{const n=o.providerOptions;switch(o.type){case"file":{const{data:i,mediaType:a}=ZT(o.data);return{type:"file",data:i,filename:o.filename,mediaType:a??o.mediaType,providerOptions:n}}case"reasoning":return{type:"reasoning",text:o.text,providerOptions:n};case"text":return{type:"text",text:o.text,providerOptions:n};case"tool-call":return{type:"tool-call",toolCallId:o.toolCallId,toolName:o.toolName,input:o.input,providerExecuted:o.providerExecuted,providerOptions:n};case"tool-result":return{type:"tool-result",toolCallId:o.toolCallId,toolName:o.toolName,output:o.output,providerOptions:n}}}),providerOptions:e.providerOptions};case"tool":return{role:"tool",content:e.content.map(o=>({type:"tool-result",toolCallId:o.toolCallId,toolName:o.toolName,output:o.output,providerOptions:o.providerOptions})),providerOptions:e.providerOptions};default:{const o=r;throw new kZ({role:o})}}}async function FZ(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&&VF({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 VZ(e,t){var r;if(e.type==="text")return{type:"text",text:e.text,providerOptions:e.providerOptions};let o;const n=e.type;switch(n){case"image":o=e.image;break;case"file":o=e.data;break;default:throw new Error(`Unsupported part type: ${n}`)}const{data:i,mediaType:a}=ZT(o);let s=a??e.mediaType,c=i;if(c instanceof URL){const l=t[c.toString()];l&&(c=l.data,s??(s=l.mediaType))}switch(n){case"image":return(c instanceof Uint8Array||typeof c=="string")&&(s=(r=RZ({data:c,signatures:AZ}))!=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 ZZ({maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:i,seed:a,stopSequences:s}){if(e!=null){if(!Number.isInteger(e))throw new Yt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new Yt({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(t!=null&&typeof t!="number")throw new Yt({parameter:"temperature",value:t,message:"temperature must be a number"});if(r!=null&&typeof r!="number")throw new Yt({parameter:"topP",value:r,message:"topP must be a number"});if(o!=null&&typeof o!="number")throw new Yt({parameter:"topK",value:o,message:"topK must be a number"});if(n!=null&&typeof n!="number")throw new Yt({parameter:"presencePenalty",value:n,message:"presencePenalty must be a number"});if(i!=null&&typeof i!="number")throw new Yt({parameter:"frequencyPenalty",value:i,message:"frequencyPenalty must be a number"});if(a!=null&&!Number.isInteger(a))throw new Yt({parameter:"seed",value:a,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:i,stopSequences:s,seed:a}}function BZ(e){return e!=null&&Object.keys(e).length>0}function qZ({tools:e,toolChoice:t,activeTools:r}){return BZ(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:Jc(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 bi=Tc(()=>fe([bc(),S(),B(),mt(),nr(S(),bi),z(bi)])),sr=nr(S(),nr(S(),bi)),BT=O({type:q("text"),text:S(),providerOptions:sr.optional()}),GZ=O({type:q("image"),image:fe([VT,to(URL)]),mediaType:S().optional(),providerOptions:sr.optional()}),qT=O({type:q("file"),data:fe([VT,to(URL)]),filename:S().optional(),mediaType:S(),providerOptions:sr.optional()}),HZ=O({type:q("reasoning"),text:S(),providerOptions:sr.optional()}),WZ=O({type:q("tool-call"),toolCallId:S(),toolName:S(),input:Qe(),providerOptions:sr.optional(),providerExecuted:mt().optional()}),JZ=zf("type",[O({type:q("text"),value:S()}),O({type:q("json"),value:bi}),O({type:q("error-text"),value:S()}),O({type:q("error-json"),value:bi}),O({type:q("content"),value:z(fe([O({type:q("text"),text:S()}),O({type:q("media"),data:S(),mediaType:S()})]))})]),GT=O({type:q("tool-result"),toolCallId:S(),toolName:S(),output:JZ,providerOptions:sr.optional()}),KZ=O({role:q("system"),content:S(),providerOptions:sr.optional()}),YZ=O({role:q("user"),content:fe([S(),z(fe([BT,GZ,qT]))]),providerOptions:sr.optional()}),XZ=O({role:q("assistant"),content:fe([S(),z(fe([BT,qT,HZ,WZ,GT]))]),providerOptions:sr.optional()}),QZ=O({role:q("tool"),content:z(GT),providerOptions:sr.optional()}),e9=fe([KZ,YZ,XZ,QZ]);async function t9(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(e9)});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 r9(e){return Ym.isInstance(e)||YI.isInstance(e)?new te({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 ad({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 n9({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 o9={startSpan(){return Ia},startActiveSpan(e,t,r,o){if(typeof t=="function")return t(Ia);if(typeof r=="function")return r(Ia);if(typeof o=="function")return o(Ia)}},Ia={spanContext(){return i9},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}},i9={traceId:"",spanId:"",traceFlags:0};function a9({isEnabled:e=!1,tracer:t}={}){return e?t||aZ.getTracer("ai"):o9}function sd({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{HT(i,a)}finally{i.end()}throw a}})}function HT(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Is.ERROR,message:t.message})):e.setStatus({code:Is.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 s9(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?MZ(r.data):r.data}:r)})))}function c9(e,t){return{inputTokens:Lo(e.inputTokens,t.inputTokens),outputTokens:Lo(e.outputTokens,t.outputTokens),totalTokens:Lo(e.totalTokens,t.totalTokens),reasoningTokens:Lo(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:Lo(e.cachedInputTokens,t.cachedInputTokens)}}function Lo(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function av(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function l9({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 u9=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:o}={})=>async n=>WT(n,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:o});async function WT(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=zI(a),c=[...i,a],l=c.length;if(l>t)throw new iv({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 jI(l9({error:a,exponentialBackoffDelay:r}),{abortSignal:n}),WT(e,{maxRetries:t,delayInMs:o*r,backoffFactor:o,abortSignal:n},c);throw l===1?a:new iv({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:"errorNotRetryable",errors:c})}}function d9({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new Yt({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new Yt({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=e??2;return{maxRetries:r,retry:u9({maxRetries:r,abortSignal:t})}}var f9=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=nd(this.uint8ArrayData)),this.base64Data}get uint8Array(){return this.uint8ArrayData==null&&(this.uint8ArrayData=Km(this.base64Data)),this.uint8ArrayData}},m9=class extends f9{constructor(e){super(e),this.type="file"}};async function p9({toolCall:e,tools:t,repairToolCall:r,system:o,messages:n}){try{if(t==null)throw new id({toolName:e.toolName});try{return await sv({toolCall:e,tools:t})}catch(i){if(r==null||!(id.isInstance(i)||hT.isInstance(i)))throw i;let a=null;try{a=await r({toolCall:e,tools:t,inputSchema:({toolName:s})=>{const{inputSchema:c}=t[s];return Jc(c).jsonSchema},system:o,messages:n,error:i})}catch(s){throw new wZ({cause:s,originalError:i})}if(a==null)throw i;return await sv({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 sv({toolCall:e,tools:t}){const r=e.toolName,o=t[r];if(o==null)throw new id({toolName:e.toolName,availableTools:Object.keys(t)});const n=Jc(o.inputSchema),i=e.input.trim()===""?await Mr({value:{},schema:n}):await ln({text:e.input,schema:n});if(i.success===!1)throw new hT({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 g9=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 JT(e){return({steps:t})=>t.length===e}async function h9({stopConditions:e,steps:t}){return(await Promise.all(e.map(r=>r({steps:t})))).some(r=>r)}function Ko({output:e,tool:t,errorMode:r}){return r==="text"?{type:"error-text",value:uo(e)}:r==="json"?{type:"error-json",value:cv(e)}:t?.toModelOutput?t.toModelOutput(e):typeof e=="string"?{type:"text",value:e}:{type:"json",value:cv(e)}}function cv(e){return e===void 0?null:e}function lv({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:Ko({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:Ko({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:Ko({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}ia({prefix:"aitxt",size:24});function Kc(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 v9({status:e,statusText:t,headers:r,textStream:o}){return new Response(o.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:Kc(r,{"content-type":"text/plain; charset=utf-8"})})}function KT({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 y9({response:e,status:t,statusText:r,headers:o,textStream:n}){KT({response:e,status:t,statusText:r,headers:Object.fromEntries(Kc(o,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:n.pipeThrough(new TextEncoderStream)})}var YT=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
87
-
88
- `)},flush(e){e.enqueue(`data: [DONE]
89
-
90
- `)}})}},XT={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function b9({status:e,statusText:t,headers:r,stream:o,consumeSseStream:n}){let i=o.pipeThrough(new YT);if(n){const[a,s]=i.tee();i=a,n({stream:s})}return new Response(i.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:Kc(r,XT)})}function _9({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 w9(e){return e.type.startsWith("data-")}function QT(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]=QT(i,n):r[o]=n}return r}function x9(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 e$(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:x9(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}function nu(e){return e.type.startsWith("data-")}function ou(e){return e.type==="text"}function iu(e){return e.type==="file"}function uv(e){return e.type==="reasoning"}function Vn(e){return e.type.startsWith("tool-")}function np(e){return e.type==="dynamic-tool"}function dv(e){return Vn(e)||np(e)}function Ts(e){return e.type.split("-").slice(1).join("-")}function S9(e){return np(e)?e.toolName:Ts(e)}function k9({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function E9({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:o,onError:n,onToolCall:i,onData:a}){return e.pipeThrough(new TransformStream({async transform(s,c){await o(async({state:l,write:u})=>{var d,f,m,h;function g(v){const E=l.message.parts.filter(Vn).find(I=>I.toolCallId===v);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function y(v){const E=l.message.parts.filter(I=>I.type==="dynamic-tool").find(I=>I.toolCallId===v);if(E==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return E}function b(v){var k;const E=l.message.parts.find(U=>Vn(U)&&U.toolCallId===v.toolCallId),I=v,C=E;E!=null?(E.state=v.state,C.input=I.input,C.output=I.output,C.errorText=I.errorText,C.rawInput=I.rawInput,C.preliminary=I.preliminary,C.providerExecuted=(k=I.providerExecuted)!=null?k:E.providerExecuted,I.providerMetadata!=null&&E.state==="input-available"&&(E.callProviderMetadata=I.providerMetadata)):l.message.parts.push({type:`tool-${v.toolName}`,toolCallId:v.toolCallId,state:v.state,input:I.input,output:I.output,rawInput:I.rawInput,errorText:I.errorText,providerExecuted:I.providerExecuted,preliminary:I.preliminary,...I.providerMetadata!=null?{callProviderMetadata:I.providerMetadata}:{}})}function w(v){var k,E;const I=l.message.parts.find(D=>D.type==="dynamic-tool"&&D.toolCallId===v.toolCallId),C=v,U=I;I!=null?(I.state=v.state,U.toolName=v.toolName,U.input=C.input,U.output=C.output,U.errorText=C.errorText,U.rawInput=(k=C.rawInput)!=null?k:U.rawInput,U.preliminary=C.preliminary,U.providerExecuted=(E=C.providerExecuted)!=null?E:I.providerExecuted,C.providerMetadata!=null&&I.state==="input-available"&&(I.callProviderMetadata=C.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:v.toolName,toolCallId:v.toolCallId,state:v.state,input:C.input,output:C.output,errorText:C.errorText,preliminary:C.preliminary,providerExecuted:C.providerExecuted,...C.providerMetadata!=null?{callProviderMetadata:C.providerMetadata}:{}})}async function x(v){if(v!=null){const k=l.message.metadata!=null?QT(l.message.metadata,v):v;t!=null&&await Qu({value:k,schema:t}),l.message.metadata=k}}switch(s.type){case"text-start":{const v={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeTextParts[s.id]=v,l.message.parts.push(v),u();break}case"text-delta":{const v=l.activeTextParts[s.id];v.text+=s.delta,v.providerMetadata=(d=s.providerMetadata)!=null?d:v.providerMetadata,u();break}case"text-end":{const v=l.activeTextParts[s.id];v.state="done",v.providerMetadata=(f=s.providerMetadata)!=null?f:v.providerMetadata,delete l.activeTextParts[s.id],u();break}case"reasoning-start":{const v={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeReasoningParts[s.id]=v,l.message.parts.push(v),u();break}case"reasoning-delta":{const v=l.activeReasoningParts[s.id];v.text+=s.delta,v.providerMetadata=(m=s.providerMetadata)!=null?m:v.providerMetadata,u();break}case"reasoning-end":{const v=l.activeReasoningParts[s.id];v.providerMetadata=(h=s.providerMetadata)!=null?h:v.providerMetadata,v.state="done",delete l.activeReasoningParts[s.id],u();break}case"file":{l.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url}),u();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),u();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),u();break}case"tool-input-start":{const v=l.message.parts.filter(Vn);l.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:v.length,dynamic:s.dynamic},s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}),u();break}case"tool-input-delta":{const v=l.partialToolCalls[s.toolCallId];v.text+=s.inputTextDelta;const{value:k}=await e$(v.text);v.dynamic?w({toolCallId:s.toolCallId,toolName:v.toolName,state:"input-streaming",input:k}):b({toolCallId:s.toolCallId,toolName:v.toolName,state:"input-streaming",input:k}),u();break}case"tool-input-available":{s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-available",input:s.input,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u(),i&&!s.providerExecuted&&await i({toolCall:s});break}case"tool-input-error":{s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u();break}case"tool-output-available":{if(s.dynamic){const v=y(s.toolCallId);w({toolCallId:s.toolCallId,toolName:v.toolName,state:"output-available",input:v.input,output:s.output,preliminary:s.preliminary})}else{const v=g(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Ts(v),state:"output-available",input:v.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary})}u();break}case"tool-output-error":{if(s.dynamic){const v=y(s.toolCallId);w({toolCallId:s.toolCallId,toolName:v.toolName,state:"output-error",input:v.input,errorText:s.errorText,providerExecuted:s.providerExecuted})}else{const v=g(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Ts(v),state:"output-error",input:v.input,rawInput:v.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted})}u();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{s.messageId!=null&&(l.message.id=s.messageId),await x(s.messageMetadata),(s.messageId!=null||s.messageMetadata!=null)&&u();break}case"finish":{await x(s.messageMetadata),s.messageMetadata!=null&&u();break}case"message-metadata":{await x(s.messageMetadata),s.messageMetadata!=null&&u();break}case"error":{n?.(new Error(s.errorText));break}default:if(w9(s)){r?.[s.type]!=null&&await Qu({value:s.data,schema:r[s.type]});const v=s;if(v.transient){a?.(v);break}const k=v.id!=null?l.message.parts.find(E=>v.type===E.type&&v.id===E.id):void 0;k!=null?k.data=v.data:l.message.parts.push(v),a?.(v),u()}}c.enqueue(s)})}}))}function I9({messageId:e,originalMessages:t=[],onFinish:r,onError:o,stream:n}){let i=t?.[t.length-1];i?.role!=="assistant"?i=void 0:e=i.id;let a=!1;const s=n.pipeThrough(new TransformStream({transform(f,m){if(f.type==="start"){const h=f;h.messageId==null&&e!=null&&(h.messageId=e)}f.type==="abort"&&(a=!0),m.enqueue(f)}}));if(r==null)return s;const c=k9({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 E9({stream:s,runUpdateMessageJob:l,onError:o}).pipeThrough(new TransformStream({transform(f,m){m.enqueue(f)},async cancel(){await d()},async flush(){await d()}}))}function T9({response:e,status:t,statusText:r,headers:o,stream:n,consumeSseStream:i}){let a=n.pipeThrough(new YT);if(i){const[s,c]=a.tee();a=s,i({stream:c})}KT({response:e,status:t,statusText:r,headers:Object.fromEntries(Kc(o,XT).entries()),stream:a.pipeThrough(new TextEncoderStream)})}function Ta(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 $9({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 fv(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function O9(){let e=[],t=null,r=!1,o=fv();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=fv(),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 A9(){var e,t;return(t=(e=globalThis?.performance)==null?void 0:e.now())!=null?t:Date.now()}function C9({tools:e,generatorStream:t,tracer:r,telemetry:o,system:n,messages:i,abortSignal:a,repairToolCall:s,experimental_context:c}){let l=null;const u=new ReadableStream({start(b){l=b}}),d=new Set,f=new Map;let m=!1,h;function g(){m&&d.size===0&&(h!=null&&l.enqueue(h),l.close())}const y=new TransformStream({async transform(b,w){const x=b.type;switch(x){case"stream-start":case"text-start":case"text-delta":case"text-end":case"reasoning-start":case"reasoning-delta":case"reasoning-end":case"tool-input-start":case"tool-input-delta":case"tool-input-end":case"source":case"response-metadata":case"error":case"raw":{w.enqueue(b);break}case"file":{w.enqueue({type:"file",file:new m9({data:b.data,mediaType:b.mediaType})});break}case"finish":{h={type:"finish",finishReason:b.finishReason,usage:b.usage,providerMetadata:b.providerMetadata};break}case"tool-call":{try{const v=await p9({toolCall:b,tools:e,repairToolCall:s,system:n,messages:i});if(w.enqueue(v),v.invalid){l.enqueue({type:"tool-error",toolCallId:v.toolCallId,toolName:v.toolName,input:v.input,error:zI(v.error),dynamic:!0});break}const k=e[v.toolName];if(f.set(v.toolCallId,v.input),k.onInputAvailable!=null&&await k.onInputAvailable({input:v.input,toolCallId:v.toolCallId,messages:i,abortSignal:a,experimental_context:c}),k.execute!=null&&v.providerExecuted!==!0){const E=MF();d.add(E),sd({name:"ai.toolCall",attributes:Un({telemetry:o,attributes:{...ad({operationId:"ai.toolCall",telemetry:o}),"ai.toolCall.name":v.toolName,"ai.toolCall.id":v.toolCallId,"ai.toolCall.args":{output:()=>JSON.stringify(v.input)}}}),tracer:r,fn:async I=>{let C;try{const U=Y3({execute:k.execute.bind(k),input:v.input,options:{toolCallId:v.toolCallId,messages:i,abortSignal:a,experimental_context:c}});for await(const D of U)l.enqueue({...v,type:"tool-result",output:D.output,...D.type==="preliminary"&&{preliminary:!0}}),D.type==="final"&&(C=D.output)}catch(U){HT(I,U),l.enqueue({...v,type:"tool-error",error:U}),d.delete(E),g();return}d.delete(E),g();try{I.setAttributes(Un({telemetry:o,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(C)}}}))}catch{}}})}}catch(v){l.enqueue({type:"error",error:v})}break}case"tool-result":{const v=b.toolName;b.isError?l.enqueue({type:"tool-error",toolCallId:b.toolCallId,toolName:v,input:f.get(b.toolCallId),providerExecuted:b.providerExecuted,error:b.result}):w.enqueue({type:"tool-result",toolCallId:b.toolCallId,toolName:v,input:f.get(b.toolCallId),output:b.result,providerExecuted:b.providerExecuted});break}default:{const v=x;throw new Error(`Unhandled chunk type: ${v}`)}}},flush(){m=!0,g()}});return new ReadableStream({async start(b){return Promise.all([t.pipeThrough(y).pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){}})),u.pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){b.close()}}))])}})}var N9=ia({prefix:"aitxt",size:24});function R9({model:e,tools:t,toolChoice:r,system:o,prompt:n,messages:i,maxRetries:a,abortSignal:s,headers:c,stopWhen:l=JT(1),experimental_output:u,experimental_telemetry:d,prepareStep:f,providerOptions:m,experimental_activeTools:h,activeTools:g=h,experimental_repairToolCall:y,experimental_transform:b,experimental_download:w,includeRawChunks:x=!1,onChunk:v,onError:k=({error:V})=>{console.error(V)},onFinish:E,onAbort:I,onStepFinish:C,experimental_context:U,_internal:{now:D=A9,generateId:K=N9,currentDate:he=()=>new Date}={},...F}){return new j9({model:FT(e),telemetry:d,headers:c,settings:F,maxRetries:a,abortSignal:s,system:o,prompt:n,messages:i,tools:t,toolChoice:r,transforms:av(b),activeTools:g,repairToolCall:y,stopConditions:av(l),output:u,providerOptions:m,prepareStep:f,includeRawChunks:x,onChunk:v,onError:k,onFinish:E,onAbort:I,onStepFinish:C,now:D,currentDate:he,generateId:K,experimental_context:U,download:w})}function P9(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 j9=class{constructor({model:e,telemetry:t,headers:r,settings:o,maxRetries:n,abortSignal:i,system:a,prompt:s,messages:c,tools:l,toolChoice:u,transforms:d,activeTools:f,repairToolCall:m,stopConditions:h,output:g,providerOptions:y,prepareStep:b,includeRawChunks:w,now:x,currentDate:v,generateId:k,onChunk:E,onError:I,onFinish:C,onAbort:U,onStepFinish:D,experimental_context:K,download:he}){this._totalUsage=new $a,this._finishReason=new $a,this._steps=new $a,this.output=g,this.includeRawChunks=w,this.tools=l;let F,V=[];const ve=[];let ue,pe,G={},le=[];const Z=[];let X,oe={},Se={};const P=new TransformStream({async transform(Pe,je){var Ge,ye,jt,To;je.enqueue(Pe);const{part:L}=Pe;if((L.type==="text-delta"||L.type==="reasoning-delta"||L.type==="source"||L.type==="tool-call"||L.type==="tool-result"||L.type==="tool-input-start"||L.type==="tool-input-delta"||L.type==="raw")&&await E?.({chunk:L}),L.type==="error"&&await I({error:r9(L.error)}),L.type==="text-start"&&(oe[L.id]={type:"text",text:"",providerMetadata:L.providerMetadata},V.push(oe[L.id])),L.type==="text-delta"){const Ce=oe[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=oe[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`text part ${L.id} not found`},partialOutput:void 0});return}Ce.providerMetadata=(ye=L.providerMetadata)!=null?ye:Ce.providerMetadata,delete oe[L.id]}if(L.type==="reasoning-start"&&(Se[L.id]={type:"reasoning",text:"",providerMetadata:L.providerMetadata},V.push(Se[L.id])),L.type==="reasoning-delta"){const Ce=Se[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=(jt=L.providerMetadata)!=null?jt:Ce.providerMetadata}if(L.type==="reasoning-end"){const Ce=Se[L.id];if(Ce==null){je.enqueue({part:{type:"error",error:`reasoning part ${L.id} not found`},partialOutput:void 0});return}Ce.providerMetadata=(To=L.providerMetadata)!=null?To:Ce.providerMetadata,delete Se[L.id]}if(L.type==="file"&&V.push({type:"file",file:L.file}),L.type==="source"&&V.push(L),L.type==="tool-call"&&V.push(L),L.type==="tool-result"&&!L.preliminary&&V.push(L),L.type==="tool-error"&&V.push(L),L.type==="start-step"&&(G=L.request,le=L.warnings),L.type==="finish-step"){const Ce=lv({content:V,tools:l}),$o=new g9({content:V,finishReason:L.finishReason,usage:L.usage,warnings:le,request:G,response:{...L.response,messages:[...ve,...Ce]},providerMetadata:L.providerMetadata});await D?.($o),mZ(le),Z.push($o),V=[],Se={},oe={},ve.push(...Ce),F.resolve()}L.type==="finish"&&(pe=L.totalUsage,ue=L.finishReason)},async flush(Pe){try{if(Z.length===0){const jt=new yZ({message:"No output generated. Check the stream for errors."});qe._finishReason.reject(jt),qe._totalUsage.reject(jt),qe._steps.reject(jt);return}const je=ue??"unknown",Ge=pe??{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};qe._finishReason.resolve(je),qe._totalUsage.resolve(Ge),qe._steps.resolve(Z);const ye=Z[Z.length-1];await C?.({finishReason:je,totalUsage:Ge,usage:ye.usage,content:ye.content,text:ye.text,reasoningText:ye.reasoningText,reasoning:ye.reasoning,files:ye.files,sources:ye.sources,toolCalls:ye.toolCalls,staticToolCalls:ye.staticToolCalls,dynamicToolCalls:ye.dynamicToolCalls,toolResults:ye.toolResults,staticToolResults:ye.staticToolResults,dynamicToolResults:ye.dynamicToolResults,request:ye.request,response:ye.response,warnings:ye.warnings,providerMetadata:ye.providerMetadata,steps:Z}),X.setAttributes(Un({telemetry:t,attributes:{"ai.response.finishReason":je,"ai.response.text":{output:()=>ye.text},"ai.response.toolCalls":{output:()=>{var jt;return(jt=ye.toolCalls)!=null&&jt.length?JSON.stringify(ye.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(ye.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{X.end()}}}),H=O9();this.addStream=H.addStream,this.closeStream=H.close;const me=H.stream.getReader();let Te=new ReadableStream({async start(Pe){Pe.enqueue({type:"start"})},async pull(Pe){function je(){U?.({steps:Z}),Pe.enqueue({type:"abort"}),Pe.close()}try{const{done:Ge,value:ye}=await me.read();if(Ge){Pe.close();return}if(i?.aborted){je();return}Pe.enqueue(ye)}catch(Ge){cn(Ge)&&i?.aborted?je():Pe.error(Ge)}},cancel(Pe){return H.stream.cancel(Pe)}});for(const Pe of d)Te=Te.pipeThrough(Pe({tools:l,stopStream(){H.terminate()}}));this.baseStream=Te.pipeThrough(P9(g)).pipeThrough(P);const{maxRetries:Fe,retry:ml}=d9({maxRetries:n,abortSignal:i}),Io=a9(t),Pt=ZZ(o),ua=n9({model:e,telemetry:t,headers:r,settings:{...Pt,maxRetries:Fe}}),qe=this;sd({name:"ai.streamText",attributes:Un({telemetry:t,attributes:{...ad({operationId:"ai.streamText",telemetry:t}),...ua,"ai.prompt":{input:()=>JSON.stringify({system:a,prompt:s,messages:c})}}}),tracer:Io,endWhenDone:!1,fn:async Pe=>{X=Pe;async function je({currentStep:Ge,responseMessages:ye,usage:jt}){var To,L,Ce,$o,Np;const Rp=qe.includeRawChunks;F=new $a;const Pp=await t9({system:a,prompt:s,messages:c}),Oo=[...Pp.messages,...ye],Jt=await b?.({model:e,steps:Z,stepNumber:Z.length,messages:Oo}),Sn=FT((To=Jt?.model)!=null?To:e),jp=await UZ({prompt:{system:(L=Jt?.system)!=null?L:Pp.system,messages:(Ce=Jt?.messages)!=null?Ce:Oo},supportedUrls:await Sn.supportedUrls,download:he}),{toolChoice:pl,tools:gl}=qZ({tools:l,toolChoice:($o=Jt?.toolChoice)!=null?$o:u,activeTools:(Np=Jt?.activeTools)!=null?Np:f}),{result:{stream:Q1,response:zp,request:Dp},doStreamSpan:kn,startTimestampMs:Mp}=await ml(()=>sd({name:"ai.streamText.doStream",attributes:Un({telemetry:t,attributes:{...ad({operationId:"ai.streamText.doStream",telemetry:t}),...ua,"ai.model.provider":Sn.provider,"ai.model.id":Sn.modelId,"ai.prompt.messages":{input:()=>s9(jp)},"ai.prompt.tools":{input:()=>gl?.map(W=>JSON.stringify(W))},"ai.prompt.toolChoice":{input:()=>pl!=null?JSON.stringify(pl):void 0},"gen_ai.system":Sn.provider,"gen_ai.request.model":Sn.modelId,"gen_ai.request.frequency_penalty":Pt.frequencyPenalty,"gen_ai.request.max_tokens":Pt.maxOutputTokens,"gen_ai.request.presence_penalty":Pt.presencePenalty,"gen_ai.request.stop_sequences":Pt.stopSequences,"gen_ai.request.temperature":Pt.temperature,"gen_ai.request.top_k":Pt.topK,"gen_ai.request.top_p":Pt.topP}}),tracer:Io,endWhenDone:!1,fn:async W=>({startTimestampMs:x(),doStreamSpan:W,result:await Sn.doStream({...Pt,tools:gl,toolChoice:pl,responseFormat:g?.responseFormat,prompt:jp,providerOptions:y,abortSignal:i,headers:r,includeRawChunks:Rp})})})),eO=C9({tools:l,generatorStream:Q1,tracer:Io,telemetry:t,system:a,messages:Oo,repairToolCall:m,abortSignal:i,experimental_context:K}),tO=Dp??{},da=[],hl=[];let vl;const yl={};let En="unknown",zt={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},bl,Up=!0,Kt={id:k(),timestamp:v(),modelId:e.modelId},Lp="";qe.addStream(eO.pipeThrough(new TransformStream({async transform(W,He){var Ao,Co,fa,lr;if(W.type==="stream-start"){vl=W.warnings;return}if(Up){const tt=x()-Mp;Up=!1,kn.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":tt}),kn.setAttributes({"ai.response.msToFirstChunk":tt}),He.enqueue({type:"start-step",request:tO,warnings:vl??[]})}const Fp=W.type;switch(Fp){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}),Lp+=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),da.push(W);break}case"tool-result":{He.enqueue(W),W.preliminary||hl.push(W);break}case"tool-error":{He.enqueue(W),hl.push(W);break}case"response-metadata":{Kt={id:(Ao=W.id)!=null?Ao:Kt.id,timestamp:(Co=W.timestamp)!=null?Co:Kt.timestamp,modelId:(fa=W.modelId)!=null?fa:Kt.modelId};break}case"finish":{zt=W.usage,En=W.finishReason,bl=W.providerMetadata;const tt=x()-Mp;kn.addEvent("ai.stream.finish"),kn.setAttributes({"ai.response.msToFinish":tt,"ai.response.avgOutputTokensPerSecond":1e3*((lr=zt.outputTokens)!=null?lr:0)/tt});break}case"file":{He.enqueue(W);break}case"source":{He.enqueue(W);break}case"tool-input-start":{yl[W.id]=W.toolName;const tt=l?.[W.toolName];tt?.onInputStart!=null&&await tt.onInputStart({toolCallId:W.id,messages:Oo,abortSignal:i,experimental_context:K}),He.enqueue({...W,dynamic:tt?.type==="dynamic"});break}case"tool-input-end":{delete yl[W.id],He.enqueue(W);break}case"tool-input-delta":{const tt=yl[W.id],_l=l?.[tt];_l?.onInputDelta!=null&&await _l.onInputDelta({inputTextDelta:W.delta,toolCallId:W.id,messages:Oo,abortSignal:i,experimental_context:K}),He.enqueue(W);break}case"error":{He.enqueue(W),En="error";break}case"raw":{Rp&&He.enqueue(W);break}default:{const tt=Fp;throw new Error(`Unknown chunk type: ${tt}`)}}},async flush(W){const He=da.length>0?JSON.stringify(da):void 0;try{kn.setAttributes(Un({telemetry:t,attributes:{"ai.response.finishReason":En,"ai.response.text":{output:()=>Lp},"ai.response.toolCalls":{output:()=>He},"ai.response.id":Kt.id,"ai.response.model":Kt.modelId,"ai.response.timestamp":Kt.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(bl),"ai.usage.inputTokens":zt.inputTokens,"ai.usage.outputTokens":zt.outputTokens,"ai.usage.totalTokens":zt.totalTokens,"ai.usage.reasoningTokens":zt.reasoningTokens,"ai.usage.cachedInputTokens":zt.cachedInputTokens,"gen_ai.response.finish_reasons":[En],"gen_ai.response.id":Kt.id,"gen_ai.response.model":Kt.modelId,"gen_ai.usage.input_tokens":zt.inputTokens,"gen_ai.usage.output_tokens":zt.outputTokens}}))}catch{}finally{kn.end()}W.enqueue({type:"finish-step",finishReason:En,usage:zt,providerMetadata:bl,response:{...Kt,headers:zp?.headers}});const Ao=c9(jt,zt);await F.promise;const Co=da.filter(lr=>lr.providerExecuted!==!0),fa=hl.filter(lr=>lr.providerExecuted!==!0);if(Co.length>0&&fa.length===Co.length&&!await h9({stopConditions:h,steps:Z})){ye.push(...lv({content:Z[Z.length-1].content,tools:l}));try{await je({currentStep:Ge+1,responseMessages:ye,usage:Ao})}catch(lr){W.enqueue({type:"error",error:lr}),qe.closeStream()}}else W.enqueue({type:"finish",finishReason:En,totalUsage:Ao}),qe.closeStream()}})))}await je({currentStep:0,responseMessages:[],usage:{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0}})}}).catch(Pe=>{qe.addStream(new ReadableStream({start(je){je.enqueue({type:"error",error:Pe}),je.close()}})),qe.closeStream()})}get steps(){return this.consumeStream(),this._steps.promise}get finalStep(){return this.steps.then(e=>e[e.length-1])}get content(){return this.finalStep.then(e=>e.content)}get warnings(){return this.finalStep.then(e=>e.warnings)}get providerMetadata(){return this.finalStep.then(e=>e.providerMetadata)}get text(){return this.finalStep.then(e=>e.text)}get reasoningText(){return this.finalStep.then(e=>e.reasoningText)}get reasoning(){return this.finalStep.then(e=>e.reasoning)}get sources(){return this.finalStep.then(e=>e.sources)}get files(){return this.finalStep.then(e=>e.files)}get toolCalls(){return this.finalStep.then(e=>e.toolCalls)}get staticToolCalls(){return this.finalStep.then(e=>e.staticToolCalls)}get dynamicToolCalls(){return this.finalStep.then(e=>e.dynamicToolCalls)}get toolResults(){return this.finalStep.then(e=>e.toolResults)}get staticToolResults(){return this.finalStep.then(e=>e.staticToolResults)}get dynamicToolResults(){return this.finalStep.then(e=>e.dynamicToolResults)}get usage(){return this.finalStep.then(e=>e.usage)}get request(){return this.finalStep.then(e=>e.request)}get response(){return this.finalStep.then(e=>e.response)}get totalUsage(){return this.consumeStream(),this._totalUsage.promise}get finishReason(){return this.consumeStream(),this._finishReason.promise}teeStream(){const[e,t]=this.baseStream.tee();return this.baseStream=t,e}get textStream(){return Ta(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type==="text-delta"&&t.enqueue(e.text)}})))}get fullStream(){return Ta(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await $9({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 uZ;return Ta(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?_9({originalMessages:e,responseMessageId:t}):void 0,u={},d=m=>{var h,g;const y=u[m];return((g=(h=this.tools)==null?void 0:h[y])==null?void 0:g.type)==="dynamic"?!0:void 0},f=this.fullStream.pipeThrough(new TransformStream({transform:async(m,h)=>{const g=o?.({part:m}),y=m.type;switch(y){case"text-start":{h.enqueue({type:"text-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-delta":{h.enqueue({type:"text-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"text-end":{h.enqueue({type:"text-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-start":{h.enqueue({type:"reasoning-start",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-delta":{n&&h.enqueue({type:"reasoning-delta",id:m.id,delta:m.text,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"reasoning-end":{h.enqueue({type:"reasoning-end",id:m.id,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"file":{h.enqueue({type:"file",mediaType:m.file.mediaType,url:`data:${m.file.mediaType};base64,${m.file.base64}`});break}case"source":{i&&m.sourceType==="url"&&h.enqueue({type:"source-url",sourceId:m.id,url:m.url,title:m.title,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}}),i&&m.sourceType==="document"&&h.enqueue({type:"source-document",sourceId:m.id,mediaType:m.mediaType,title:m.title,filename:m.filename,...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{}});break}case"tool-input-start":{u[m.id]=m.toolName;const b=d(m.id);h.enqueue({type:"tool-input-start",toolCallId:m.id,toolName:m.toolName,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"tool-input-delta":{h.enqueue({type:"tool-input-delta",toolCallId:m.id,inputTextDelta:m.delta});break}case"tool-call":{u[m.toolCallId]=m.toolName;const b=d(m.toolCallId);m.invalid?h.enqueue({type:"tool-input-error",toolCallId:m.toolCallId,toolName:m.toolName,input:m.input,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{},...b!=null?{dynamic:b}:{},errorText:c(m.error)}):h.enqueue({type:"tool-input-available",toolCallId:m.toolCallId,toolName:m.toolName,input:m.input,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.providerMetadata!=null?{providerMetadata:m.providerMetadata}:{},...b!=null?{dynamic:b}:{}});break}case"tool-result":{const b=d(m.toolCallId);h.enqueue({type:"tool-output-available",toolCallId:m.toolCallId,output:m.output,...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...m.preliminary!=null?{preliminary:m.preliminary}:{},...b!=null?{dynamic:b}:{}});break}case"tool-error":{const b=d(m.toolCallId);h.enqueue({type:"tool-output-error",toolCallId:m.toolCallId,errorText:c(m.error),...m.providerExecuted!=null?{providerExecuted:m.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"error":{h.enqueue({type:"error",errorText:c(m.error)});break}case"start-step":{h.enqueue({type:"start-step"});break}case"finish-step":{h.enqueue({type:"finish-step"});break}case"start":{a&&h.enqueue({type:"start",...g!=null?{messageMetadata:g}:{},...l!=null?{messageId:l}:{}});break}case"finish":{s&&h.enqueue({type:"finish",...g!=null?{messageMetadata:g}:{}});break}case"abort":{h.enqueue(m);break}case"tool-input-end":break;case"raw":break;default:{const b=y;throw new Error(`Unknown chunk type: ${b}`)}}g!=null&&y!=="start"&&y!=="finish"&&h.enqueue({type:"message-metadata",messageMetadata:g})}}));return Ta(I9({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}={}){T9({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){y9({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 b9({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 v9({textStream:this.textStream,...e})}};function z9(e,t){const r=[];t?.ignoreIncompleteToolCalls&&(e=e.map(o=>({...o,parts:o.parts.filter(n=>!dv(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(ou(n))return{type:"text",text:n.text,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(iu(n))return{type:"file",mediaType:n.mediaType,filename:n.filename,data:n.url,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(nu(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(ou(d))l.push({type:"text",text:d.text,...d.providerMetadata!=null?{providerOptions:d.providerMetadata}:{}});else if(iu(d))l.push({type:"file",mediaType:d.mediaType,filename:d.filename,data:d.url});else if(uv(d))l.push({type:"reasoning",text:d.text,providerOptions:d.providerMetadata});else if(np(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=Ts(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:Ko({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(nu(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=S9(d);return{type:"tool-result",toolCallId:d.toolCallId,toolName:m,output:Ko({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)ou(a)||uv(a)||iu(a)||dv(a)||nu(a)?i.push(a):a.type==="step-start"&&n();n();break}break}default:{const n=o.role;throw new IZ({originalMessage:o,message:`Unsupported role: ${n}`})}}return r}ia({prefix:"aiobj",size:24});ia({prefix:"aiobj",size:24});var D9={};cZ(D9,{object:()=>U9,text:()=>M9});var M9=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),U9=({schema:e})=>{const t=Jc(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const o=await e$(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 ov({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 ov({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}}},L9={word:/\S+\s+/m,line:/\n+/m};function F9({delayInMs:e=10,chunking:t="word",_internal:{delay:r=jI}={}}={}){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"?L9[t]:t;if(n==null)throw new _d({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 mv(e){return!!e&&"sessionToken"in e}function V9(e){return e?"sessionFn"in e:!1}const Z9=({getSession:e,projectSlug:t})=>{const r=CS(),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}=RS({queryKey:o,queryFn:()=>e({projectSlug:t}),enabled:l&&e!==null,staleTime:1/0,gcTime:1/0});return u??null};async function B9(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug}})).json()).client_token}const q9=({projectSlug:e,auth:t})=>{const r=A.useMemo(()=>mv(t)?()=>Promise.resolve(t.sessionToken):!mv(t)&&V9(t)?t.sessionFn:B9,[t]),o=Z9({getSession:r,projectSlug:e});return o?{headers:{"Gram-Project":e,"Gram-Chat-Session":o},isLoading:!1}:{isLoading:!0}};function G9({children:e}){const[t,r]=A.useState(new Map),[o,n]=A.useState(new Set),i=A.useCallback((d,f,m)=>new Promise(h=>{const g={toolCallId:f,toolName:d,args:m,resolve:h};r(y=>{const b=new Map(y);return b.set(f,g),b})}),[]),a=A.useCallback(d=>{n(f=>{const m=new Set(f);return m.add(d),m})},[]),s=A.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!0);const h=new Map(f);return h.delete(d),h}return f})},[]),c=A.useCallback(d=>{r(f=>{const m=f.get(d);if(m){m.resolve(!1);const h=new Map(f);return h.delete(d),h}return f})},[]),l=A.useCallback(d=>o.has(d),[o]),u=A.useCallback(d=>t.get(d),[t]);return p.jsx($.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:o,requestApproval:i,whitelistTool:a,confirmPendingApproval:s,rejectPendingApproval:c,isToolApproved:l,getPendingApproval:u},children:e})}const t$=A.createContext(null),H9=({children:e})=>{const[t,r]=A.useState("connected"),[o,n]=A.useState(0),[i,a]=A.useState(typeof navigator<"u"?navigator.onLine:!0),s=A.useRef(null);A.useEffect(()=>{if(typeof window>"u")return;const d=()=>{a(!0),s.current&&(clearTimeout(s.current),s.current=null),r("reconnecting"),s.current=setTimeout(()=>{r("connected"),n(0)},1500)},f=()=>{a(!1),r("disconnected"),s.current&&(clearTimeout(s.current),s.current=null)};return window.addEventListener("online",d),window.addEventListener("offline",f),()=>{window.removeEventListener("online",d),window.removeEventListener("offline",f),s.current&&(clearTimeout(s.current),s.current=null)}},[]);const c=A.useCallback(()=>{r("reconnecting"),n(d=>d+1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(d=>d==="reconnecting"?"disconnected":d)},1e4)},[]),l=A.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]),u=A.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]);return p.jsx(t$.Provider,{value:{state:t,retryCount:o,isOnline:i,markDisconnected:c,markConnected:l,reset:u},children:e})},r$=()=>A.useContext(t$);function W9(e){return e?Object.fromEntries(Object.entries(e).map(([t,r])=>{const o=r.unstable_tool;return[t,{execute:o?.execute}]})):{}}const J9="You are a helpful assistant that can answer questions and help with tasks.";function K9(e,t){return`
91
- ${J9}
92
-
93
- User-provided System Prompt:
94
- ${e??"None provided"}
95
-
96
- Utilities:
97
- ${t.map(r=>`- ${r.language}: ${r.prompt}`).join(`
98
- `)}`}function Y9(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 X9=({children:e,config:t})=>{const r=uj(t),o=q9({auth:t.api,projectSlug:t.projectSlug}),n=PS(),[i,a]=A.useState(t.model?.defaultModel??Lm[0]),[s,c]=A.useState(t.modal?.defaultExpanded??!1),[l,u]=A.useState(t.modal?.defaultOpen),d=t.plugins??$.recommended,f=K9(t.systemPrompt,d);A.useEffect(()=>{RL({enabled:t.errorTracking?.enabled,projectSlug:t.projectSlug,variant:t.variant})},[]);const m=A.useRef(null),{data:h}=cj({auth:o,mcp:t.mcp,environment:t.environment??{},toolsToInclude:t.tools?.toolsToInclude,gramEnvironment:t.gramEnvironment,chatId:m.current??void 0}),g=A.useRef({requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool}),y=r$();g.current={requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool};const b=A.useCallback(()=>({requestApproval:(...D)=>g.current.requestApproval(...D),isToolApproved:(...D)=>g.current.isToolApproved(...D),whitelistTool:(...D)=>g.current.whitelistTool(...D)}),[]);A.useEffect(()=>(t.tools?.toolsRequiringApproval&&zL(b(),t.tools.toolsRequiringApproval),()=>{DL()}),[t.tools?.toolsRequiringApproval,b]);const w=A.useRef(null),x=A.useRef(new Map),v=A.useRef(null),k=A.useMemo(()=>({sendMessages:async({messages:D,abortSignal:K})=>{const he=!!t.languageModel;if(o.isLoading)throw new Error("Session is loading");let F=v.current;if(!(F&&!Bo(F))){if(Bo(F)||!F){const oe=w.current?.threads?.getState?.(),Se=oe?.mainThreadId??oe?.threadIds?.[0],P=F??Se;if(P){const H=x.current.get(P);if(H)F=H;else{const me=crypto.randomUUID();x.current.set(P,me),F=me}}}}F||(m.current||(m.current=crypto.randomUUID()),F=m.current);const V=w.current?.thread.getModelContext(),ve=PL(jL(V?.tools??{})),ue={...o.headers,"Gram-Chat-ID":F,"X-Gram-Source":"elements",...t.api?.headers,...t.gramEnvironment&&{"Gram-Environment":t.gramEnvironment}},pe=he?null:PI({baseURL:r,apiKey:"unused, but must be set",headers:ue});t.languageModel&&console.log("Using custom language model",t.languageModel);const G={...h,...gd.frontendTools(ve)},le=UL(G,t.tools?.toolsRequiringApproval,b()),Z=t.languageModel?t.languageModel:pe.chat(i);try{const X=Y9(D),oe=z9(X),Se=R9({system:f,model:Z,messages:oe,tools:le,stopWhen:JT(10),experimental_transform:F9({delayInMs:15}),abortSignal:K,onError:({error:P})=>{console.error("Stream error in onError callback:",P),hs(P,{source:"streaming"}),(P instanceof TypeError||P instanceof Error&&(P.message.includes("fetch")||P.message.includes("network")||P.message.includes("Failed to fetch")||P.message.includes("NetworkError")||P.message.includes("ECONNREFUSED")||P.message.includes("ETIMEDOUT")))&&y?.markDisconnected()}});return y?.markConnected(),Se.toUIMessageStream()}catch(X){throw console.error("Error creating stream:",X),hs(X,{source:"stream-creation"}),(X instanceof TypeError||X instanceof Error&&(X.message.includes("fetch")||X.message.includes("network")||X.message.includes("Failed to fetch")||X.message.includes("NetworkError")||X.message.includes("ECONNREFUSED")||X.message.includes("ETIMEDOUT")))&&y?.markDisconnected(),X}},reconnectToStream:async()=>{throw new Error("Stream reconnection not supported")}}),[t.languageModel,t.tools?.toolsRequiringApproval,i,f,h,b,r,o.headers,o.isLoading,y]),E=t.history?.enabled??!1,I=A.useMemo(()=>({config:t,setModel:a,model:i,isExpanded:s,setIsExpanded:c,isOpen:l??!1,setIsOpen:u,plugins:d,mcpTools:h}),[t,i,s,l,d,h]),C=t.tools?.frontendTools??{},U=A.useMemo(()=>{const D=W9(t.tools?.frontendTools);return{...h,...D}},[h,t.tools?.frontendTools]);return E&&!o.isLoading?p.jsx(eB,{transport:k,apiUrl:r,headers:o.headers,contextValue:I,runtimeRef:w,frontendTools:C,localIdToUuidMap:x.current,currentRemoteIdRef:v,executableTools:U,children:e}):p.jsx(tB,{transport:k,contextValue:I,runtimeRef:w,frontendTools:C,executableTools:U,children:e})},Q9=({remoteIdRef:e})=>{const t=M.useAssistantState(({threadListItem:r})=>r.remoteId??null);return A.useEffect(()=>{e.current=t},[t,e]),null},eB=({children:e,transport:t,apiUrl:r,headers:o,contextValue:n,runtimeRef:i,frontendTools:a,localIdToUuidMap:s,currentRemoteIdRef:c,executableTools:l})=>{const u=kO({apiUrl:r,headers:o,localIdToUuidMap:s}),d=n?.config.history?.initialThreadId,f=A.useCallback(()=>gd.useChatRuntime({transport:t}),[t]),m=M.unstable_useRemoteThreadListRuntime({adapter:u,runtimeHook:f});A.useEffect(()=>{i.current=m},[m,i]);const h=A.useRef(!1);A.useEffect(()=>{if(d&&!h.current){h.current=!0;const y=setTimeout(()=>{m.threads.switchToThread(d).catch(b=>{console.error("Failed to switch to initial thread:",b)})},100);return()=>clearTimeout(y)}},[d,m]);const g=u.unstable_Provider??(({children:y})=>p.jsx(p.Fragment,{children:y}));return p.jsxs(M.AssistantRuntimeProvider,{runtime:m,children:[p.jsx(Q9,{remoteIdRef:c}),p.jsx(g,{children:p.jsx($.ElementsContext.Provider,{value:n,children:p.jsxs($.ToolExecutionProvider,{tools:l,children:[p.jsx("div",{className:$.cn(yd,(n?.config.variant==="standalone"||n?.config.variant==="sidecar")&&"h-full"),children:e}),p.jsx(Hv,{tools:a})]})})})]})},tB=({children:e,transport:t,contextValue:r,runtimeRef:o,frontendTools:n,executableTools:i})=>{const a=gd.useChatRuntime({transport:t});return A.useEffect(()=>{o.current=a},[a,o]),p.jsx(M.AssistantRuntimeProvider,{runtime:a,children:p.jsx($.ElementsContext.Provider,{value:r,children:p.jsxs($.ToolExecutionProvider,{tools:i,children:[p.jsx("div",{className:$.cn(yd,(r?.config.variant==="standalone"||r?.config.variant==="sidecar")&&"h-full"),children:e}),p.jsx(Hv,{tools:n})]})})})},rB=new JP,nB=e=>p.jsx(KP,{client:rB,children:p.jsx(H9,{children:p.jsx(G9,{children:p.jsx(X9,{...e})})})});function n$(){return{threadId:M.useAssistantState(({threadListItem:t})=>t.remoteId??null)}}function pv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function op(...e){return t=>{let r=!1;const o=e.map(n=>{const i=pv(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():pv(e[n],null)}}}}function gt(...e){return _.useCallback(op(...e),e)}var oB=Symbol.for("react.lazy"),$s=_[" use ".trim().toString()];function iB(e){return typeof e=="object"&&e!==null&&"then"in e}function o$(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===oB&&"_payload"in e&&iB(e._payload)}function i$(e){const t=sB(e),r=_.forwardRef((o,n)=>{let{children:i,...a}=o;o$(i)&&typeof $s=="function"&&(i=$s(i._payload));const s=_.Children.toArray(i),c=s.find(uB);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 aB=i$("Slot");function sB(e){const t=_.forwardRef((r,o)=>{let{children:n,...i}=r;if(o$(n)&&typeof $s=="function"&&(n=$s(n._payload)),_.isValidElement(n)){const a=fB(n),s=dB(i,n.props);return n.type!==_.Fragment&&(s.ref=o?op(o,a):a),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var a$=Symbol("radix.slottable");function cB(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=a$,t}var lB=cB("Slottable");function uB(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===a$}function dB(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 fB(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 gv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,hv=$.clsx,s$=(e,t)=>r=>{var o;if(t?.variants==null)return hv(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=gv(u)||gv(d);return n[l][f]}),s=r&&Object.entries(r).reduce((l,u)=>{let[d,f]=u;return f===void 0||(l[d]=f),l},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:d,className:f,...m}=u;return Object.entries(m).every(h=>{let[g,y]=h;return Array.isArray(y)?y.includes({...i,...s}[g]):{...i,...s}[g]===y})?[...l,d,f]:l},[]);return hv(e,a,c,r?.class,r?.className)},mB=s$("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"}}),pt=_.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},i)=>{const a=o?aB:"button";return p.jsx(a,{"data-slot":"button",className:$.cn(mB({variant:t,size:r,className:e})),ref:i,...n})});pt.displayName="Button";const pB=({error:e,onRetry:t})=>p.jsx("div",{className:$.cn("aui-root aui-error-boundary bg-background flex h-full w-full flex-col items-center justify-center p-6"),children:p.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[p.jsx("div",{className:"text-destructive",children:p.jsx($.CircleAlert,{className:"size-12 stroke-[1.5px]"})}),p.jsxs("div",{className:"flex flex-col gap-2",children:[p.jsx("h3",{className:"text-foreground text-xl font-semibold",children:"Something went wrong"}),p.jsx("p",{className:"text-muted-foreground text-base",children:"An error occurred while loading the chat."}),e&&p.jsx("p",{className:"text-muted-foreground/60 max-w-md truncate text-sm",children:e.message})]}),p.jsx(pt,{onClick:t,variant:"default",className:"mt-2",children:"Try again"})]})}),gB=({children:e})=>p.jsx(p.Fragment,{children:e});class ip extends A.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(pB,{error:this.state.error,onRetry:this.handleRetry}):p.jsx(gB,{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 hB(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 aa(e,t=[]){let r=[];function o(i,a){const s=_.createContext(a),c=r.length;r=[...r,a];const l=d=>{const{scope:f,children:m,...h}=d,g=f?.[e]?.[c]||s,y=_.useMemo(()=>h,Object.values(h));return p.jsx(g.Provider,{value:y,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,h=_.useContext(m);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,u]}const n=()=>{const i=r.map(a=>_.createContext(a));return function(s){const c=s?.[e]||i;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,vB(n,...t)]}function vB(...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 ap(e){const t=yB(e),r=_.forwardRef((o,n)=>{const{children:i,...a}=o,s=_.Children.toArray(i),c=s.find(_B);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 yB(e){const t=_.forwardRef((r,o)=>{const{children:n,...i}=r;if(_.isValidElement(n)){const a=xB(n),s=wB(i,n.props);return n.type!==_.Fragment&&(s.ref=o?op(o,a):a),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var c$=Symbol("radix.slottable");function bB(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=c$,t}function _B(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===c$}function wB(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 xB(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 SB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Le=SB.reduce((e,t)=>{const r=ap(`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 kB(e,t){e&&Gv.flushSync(()=>e.dispatchEvent(t))}function dn(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...r)=>t.current?.(...r),[])}function EB(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 IB="DismissableLayer",cd="dismissableLayer.update",TB="dismissableLayer.pointerDownOutside",$B="dismissableLayer.focusOutside",vv,l$=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Yc=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:i,onInteractOutside:a,onDismiss:s,...c}=e,l=_.useContext(l$),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,m]=_.useState({}),h=gt(t,I=>d(I)),g=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(y),w=u?g.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,v=w>=b,k=CB(I=>{const C=I.target,U=[...l.branches].some(D=>D.contains(C));!v||U||(n?.(I),a?.(I),I.defaultPrevented||s?.())},f),E=NB(I=>{const C=I.target;[...l.branches].some(D=>D.contains(C))||(i?.(I),a?.(I),I.defaultPrevented||s?.())},f);return EB(I=>{w===l.layers.size-1&&(o?.(I),!I.defaultPrevented&&s&&(I.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(vv=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),yv(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=vv)}},[u,f,r,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),yv())},[u,l]),_.useEffect(()=>{const I=()=>m({});return document.addEventListener(cd,I),()=>document.removeEventListener(cd,I)},[]),p.jsx(Le.div,{...c,ref:h,style:{pointerEvents:x?v?"auto":"none":void 0,...e.style},onFocusCapture:ze(e.onFocusCapture,E.onFocusCapture),onBlurCapture:ze(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:ze(e.onPointerDownCapture,k.onPointerDownCapture)})});Yc.displayName=IB;var OB="DismissableLayerBranch",AB=_.forwardRef((e,t)=>{const r=_.useContext(l$),o=_.useRef(null),n=gt(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})});AB.displayName=OB;function CB(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(){u$(TB,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 NB(e,t=globalThis?.document){const r=dn(e),o=_.useRef(!1);return _.useEffect(()=>{const n=i=>{i.target&&!o.current&&u$($B,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 yv(){const e=new CustomEvent(cd);document.dispatchEvent(e)}function u$(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?kB(n,i):n.dispatchEvent(i)}var Nt=globalThis?.document?_.useLayoutEffect:()=>{},RB=_[" useId ".trim().toString()]||(()=>{}),PB=0;function Zn(e){const[t,r]=_.useState(RB());return Nt(()=>{r(o=>o??String(PB++))},[e]),t?`radix-${t}`:""}const jB=["top","right","bottom","left"],Ur=Math.min,vt=Math.max,Os=Math.round,Oa=Math.floor,tr=e=>({x:e,y:e}),zB={left:"right",right:"left",bottom:"top",top:"bottom"},DB={start:"end",end:"start"};function ld(e,t,r){return vt(e,Ur(t,r))}function br(e,t){return typeof e=="function"?e(t):e}function _r(e){return e.split("-")[0]}function ko(e){return e.split("-")[1]}function sp(e){return e==="x"?"y":"x"}function cp(e){return e==="y"?"height":"width"}const MB=new Set(["top","bottom"]);function er(e){return MB.has(_r(e))?"y":"x"}function lp(e){return sp(er(e))}function UB(e,t,r){r===void 0&&(r=!1);const o=ko(e),n=lp(e),i=cp(n);let a=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=As(a)),[a,As(a)]}function LB(e){const t=As(e);return[ud(e),t,ud(t)]}function ud(e){return e.replace(/start|end/g,t=>DB[t])}const bv=["left","right"],_v=["right","left"],FB=["top","bottom"],VB=["bottom","top"];function ZB(e,t,r){switch(e){case"top":case"bottom":return r?t?_v:bv:t?bv:_v;case"left":case"right":return t?FB:VB;default:return[]}}function BB(e,t,r,o){const n=ko(e);let i=ZB(_r(e),r==="start",o);return n&&(i=i.map(a=>a+"-"+n),t&&(i=i.concat(i.map(ud)))),i}function As(e){return e.replace(/left|right|bottom|top/g,t=>zB[t])}function qB(e){return{top:0,right:0,bottom:0,left:0,...e}}function d$(e){return typeof e!="number"?qB(e):{top:e,right:e,bottom:e,left:e}}function Cs(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 wv(e,t,r){let{reference:o,floating:n}=e;const i=er(t),a=lp(t),s=cp(a),c=_r(t),l=i==="y",u=o.x+o.width/2-n.width/2,d=o.y+o.height/2-n.height/2,f=o[s]/2-n[s]/2;let m;switch(c){case"top":m={x:u,y:o.y-n.height};break;case"bottom":m={x:u,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:d};break;case"left":m={x:o.x-n.width,y:d};break;default:m={x:o.x,y:o.y}}switch(ko(t)){case"start":m[a]-=f*(r&&l?-1:1);break;case"end":m[a]+=f*(r&&l?-1:1);break}return m}const GB=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}=wv(l,o,c),f=o,m={},h=0;for(let g=0;g<s.length;g++){const{name:y,fn:b}=s[g],{x:w,y:x,data:v,reset:k}=await b({x:u,y:d,initialPlacement:o,placement:f,strategy:n,middlewareData:m,rects:l,platform:a,elements:{reference:e,floating:t}});u=w??u,d=x??d,m={...m,[y]:{...m[y],...v}},k&&h<=50&&(h++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(l=k.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:d}=wv(l,f,c)),g=-1)}return{x:u,y:d,placement:f,strategy:n,middlewareData:m}};async function _i(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:i,rects:a,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:m=0}=br(t,e),h=d$(m),y=s[f?d==="floating"?"reference":"floating":d],b=Cs(await i.getClippingRect({element:(r=await(i.isElement==null?void 0:i.isElement(y)))==null||r?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),w=d==="floating"?{x:o,y:n,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(s.floating)),v=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},k=Cs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:c}):w);return{top:(b.top-k.top+h.top)/v.y,bottom:(k.bottom-b.bottom+h.bottom)/v.y,left:(b.left-k.left+h.left)/v.x,right:(k.right-b.right+h.right)/v.x}}const HB=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:i,platform:a,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=br(e,t)||{};if(l==null)return{};const d=d$(u),f={x:r,y:o},m=lp(n),h=cp(m),g=await a.getDimensions(l),y=m==="y",b=y?"top":"left",w=y?"bottom":"right",x=y?"clientHeight":"clientWidth",v=i.reference[h]+i.reference[m]-f[m]-i.floating[h],k=f[m]-i.reference[m],E=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let I=E?E[x]:0;(!I||!await(a.isElement==null?void 0:a.isElement(E)))&&(I=s.floating[x]||i.floating[h]);const C=v/2-k/2,U=I/2-g[h]/2-1,D=Ur(d[b],U),K=Ur(d[w],U),he=D,F=I-g[h]-K,V=I/2-g[h]/2+C,ve=ld(he,V,F),ue=!c.arrow&&ko(n)!=null&&V!==ve&&i.reference[h]/2-(V<he?D:K)-g[h]/2<0,pe=ue?V<he?V-he:V-F:0;return{[m]:f[m]+pe,data:{[m]:ve,centerOffset:V-ve-pe,...ue&&{alignmentOffset:pe}},reset:ue}}}),WB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:i,rects:a,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...y}=br(e,t);if((r=i.arrow)!=null&&r.alignmentOffset)return{};const b=_r(n),w=er(s),x=_r(s)===s,v=await(c.isRTL==null?void 0:c.isRTL(l.floating)),k=f||(x||!g?[As(s)]:LB(s)),E=h!=="none";!f&&E&&k.push(...BB(s,g,h,v));const I=[s,...k],C=await _i(t,y),U=[];let D=((o=i.flip)==null?void 0:o.overflows)||[];if(u&&U.push(C[b]),d){const V=UB(n,a,v);U.push(C[V[0]],C[V[1]])}if(D=[...D,{placement:n,overflows:U}],!U.every(V=>V<=0)){var K,he;const V=(((K=i.flip)==null?void 0:K.index)||0)+1,ve=I[V];if(ve&&(!(d==="alignment"?w!==er(ve):!1)||D.every(G=>er(G.placement)===w?G.overflows[0]>0:!0)))return{data:{index:V,overflows:D},reset:{placement:ve}};let ue=(he=D.filter(pe=>pe.overflows[0]<=0).sort((pe,G)=>pe.overflows[1]-G.overflows[1])[0])==null?void 0:he.placement;if(!ue)switch(m){case"bestFit":{var F;const pe=(F=D.filter(G=>{if(E){const le=er(G.placement);return le===w||le==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(le=>le>0).reduce((le,Z)=>le+Z,0)]).sort((G,le)=>G[1]-le[1])[0])==null?void 0:F[0];pe&&(ue=pe);break}case"initialPlacement":ue=s;break}if(n!==ue)return{reset:{placement:ue}}}return{}}}};function xv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Sv(e){return jB.some(t=>e[t]>=0)}const JB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:o="referenceHidden",...n}=br(e,t);switch(o){case"referenceHidden":{const i=await _i(t,{...n,elementContext:"reference"}),a=xv(i,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Sv(a)}}}case"escaped":{const i=await _i(t,{...n,altBoundary:!0}),a=xv(i,r.floating);return{data:{escapedOffsets:a,escaped:Sv(a)}}}default:return{}}}}},f$=new Set(["left","top"]);async function KB(e,t){const{placement:r,platform:o,elements:n}=e,i=await(o.isRTL==null?void 0:o.isRTL(n.floating)),a=_r(r),s=ko(r),c=er(r)==="y",l=f$.has(a)?-1:1,u=i&&c?-1:1,d=br(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof h=="number"&&(m=s==="end"?h*-1:h),c?{x:m*u,y:f*l}:{x:f*l,y:m*u}}const YB=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 KB(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}}}}},XB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:n}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:s={fn:y=>{let{x:b,y:w}=y;return{x:b,y:w}}},...c}=br(e,t),l={x:r,y:o},u=await _i(t,c),d=er(_r(n)),f=sp(d);let m=l[f],h=l[d];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=m+u[y],x=m-u[b];m=ld(w,m,x)}if(a){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=h+u[y],x=h-u[b];h=ld(w,h,x)}const g=s.fn({...t,[f]:m,[d]:h});return{...g,data:{x:g.x-r,y:g.y-o,enabled:{[f]:i,[d]:a}}}}}},QB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:n,rects:i,middlewareData:a}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=br(e,t),u={x:r,y:o},d=er(n),f=sp(d);let m=u[f],h=u[d];const g=br(s,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const x=f==="y"?"height":"width",v=i.reference[f]-i.floating[x]+y.mainAxis,k=i.reference[f]+i.reference[x]-y.mainAxis;m<v?m=v:m>k&&(m=k)}if(l){var b,w;const x=f==="y"?"width":"height",v=f$.has(_r(n)),k=i.reference[d]-i.floating[x]+(v&&((b=a.offset)==null?void 0:b[d])||0)+(v?0:y.crossAxis),E=i.reference[d]+i.reference[x]+(v?0:((w=a.offset)==null?void 0:w[d])||0)-(v?y.crossAxis:0);h<k?h=k:h>E&&(h=E)}return{[f]:m,[d]:h}}}},eq=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:n,rects:i,platform:a,elements:s}=t,{apply:c=()=>{},...l}=br(e,t),u=await _i(t,l),d=_r(n),f=ko(n),m=er(n)==="y",{width:h,height:g}=i.floating;let y,b;d==="top"||d==="bottom"?(y=d,b=f===(await(a.isRTL==null?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(b=d,y=f==="end"?"top":"bottom");const w=g-u.top-u.bottom,x=h-u.left-u.right,v=Ur(g-u[y],w),k=Ur(h-u[b],x),E=!t.middlewareData.shift;let I=v,C=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=x),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(I=w),E&&!f){const D=vt(u.left,0),K=vt(u.right,0),he=vt(u.top,0),F=vt(u.bottom,0);m?C=h-2*(D!==0||K!==0?D+K:vt(u.left,u.right)):I=g-2*(he!==0||F!==0?he+F:vt(u.top,u.bottom))}await c({...t,availableWidth:C,availableHeight:I});const U=await a.getDimensions(s.floating);return h!==U.width||g!==U.height?{reset:{rects:!0}}:{}}}};function Xc(){return typeof window<"u"}function Eo(e){return m$(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cr(e){var t;return(t=(m$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function m$(e){return Xc()?e instanceof Node||e instanceof _t(e).Node:!1}function qt(e){return Xc()?e instanceof Element||e instanceof _t(e).Element:!1}function ar(e){return Xc()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function kv(e){return!Xc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}const tq=new Set(["inline","contents"]);function sa(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Gt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!tq.has(n)}const rq=new Set(["table","td","th"]);function nq(e){return rq.has(Eo(e))}const oq=[":popover-open",":modal"];function Qc(e){return oq.some(t=>{try{return e.matches(t)}catch{return!1}})}const iq=["transform","translate","scale","rotate","perspective"],aq=["transform","translate","scale","rotate","perspective","filter"],sq=["paint","layout","strict","content"];function up(e){const t=dp(),r=qt(e)?Gt(e):e;return iq.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)||aq.some(o=>(r.willChange||"").includes(o))||sq.some(o=>(r.contain||"").includes(o))}function cq(e){let t=Lr(e);for(;ar(t)&&!so(t);){if(up(t))return t;if(Qc(t))return null;t=Lr(t)}return null}function dp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const lq=new Set(["html","body","#document"]);function so(e){return lq.has(Eo(e))}function Gt(e){return _t(e).getComputedStyle(e)}function el(e){return qt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Lr(e){if(Eo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kv(e)&&e.host||cr(e);return kv(t)?t.host:t}function p$(e){const t=Lr(e);return so(t)?e.ownerDocument?e.ownerDocument.body:e.body:ar(t)&&sa(t)?t:p$(t)}function wi(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=p$(e),i=n===((o=e.ownerDocument)==null?void 0:o.body),a=_t(n);if(i){const s=dd(a);return t.concat(a,a.visualViewport||[],sa(n)?n:[],s&&r?wi(s):[])}return t.concat(n,wi(n,[],r))}function dd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function g$(e){const t=Gt(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=ar(e),i=n?e.offsetWidth:r,a=n?e.offsetHeight:o,s=Os(r)!==i||Os(o)!==a;return s&&(r=i,o=a),{width:r,height:o,$:s}}function fp(e){return qt(e)?e:e.contextElement}function Bn(e){const t=fp(e);if(!ar(t))return tr(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:i}=g$(t);let a=(i?Os(r.width):r.width)/o,s=(i?Os(r.height):r.height)/n;return(!a||!Number.isFinite(a))&&(a=1),(!s||!Number.isFinite(s))&&(s=1),{x:a,y:s}}const uq=tr(0);function h$(e){const t=_t(e);return!dp()||!t.visualViewport?uq:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dq(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==_t(e)?!1:t}function fn(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),i=fp(e);let a=tr(1);t&&(o?qt(o)&&(a=Bn(o)):a=Bn(e));const s=dq(i,r,o)?h$(i):tr(0);let c=(n.left+s.x)/a.x,l=(n.top+s.y)/a.y,u=n.width/a.x,d=n.height/a.y;if(i){const f=_t(i),m=o&&qt(o)?_t(o):o;let h=f,g=dd(h);for(;g&&o&&m!==h;){const y=Bn(g),b=g.getBoundingClientRect(),w=Gt(g),x=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*y.x,v=b.top+(g.clientTop+parseFloat(w.paddingTop))*y.y;c*=y.x,l*=y.y,u*=y.x,d*=y.y,c+=x,l+=v,h=_t(g),g=dd(h)}}return Cs({width:u,height:d,x:c,y:l})}function mp(e,t){const r=el(e).scrollLeft;return t?t.left+r:fn(cr(e)).left+r}function v$(e,t,r){r===void 0&&(r=!1);const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-(r?0:mp(e,o)),i=o.top+t.scrollTop;return{x:n,y:i}}function fq(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const i=n==="fixed",a=cr(o),s=t?Qc(t.floating):!1;if(o===a||s&&i)return r;let c={scrollLeft:0,scrollTop:0},l=tr(1);const u=tr(0),d=ar(o);if((d||!d&&!i)&&((Eo(o)!=="body"||sa(a))&&(c=el(o)),ar(o))){const m=fn(o);l=Bn(o),u.x=m.x+o.clientLeft,u.y=m.y+o.clientTop}const f=a&&!d&&!i?v$(a,c,!0):tr(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:r.y*l.y-c.scrollTop*l.y+u.y+f.y}}function mq(e){return Array.from(e.getClientRects())}function pq(e){const t=cr(e),r=el(e),o=e.ownerDocument.body,n=vt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),i=vt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let a=-r.scrollLeft+mp(e);const s=-r.scrollTop;return Gt(o).direction==="rtl"&&(a+=vt(t.clientWidth,o.clientWidth)-n),{width:n,height:i,x:a,y:s}}function gq(e,t){const r=_t(e),o=cr(e),n=r.visualViewport;let i=o.clientWidth,a=o.clientHeight,s=0,c=0;if(n){i=n.width,a=n.height;const l=dp();(!l||l&&t==="fixed")&&(s=n.offsetLeft,c=n.offsetTop)}return{width:i,height:a,x:s,y:c}}const hq=new Set(["absolute","fixed"]);function vq(e,t){const r=fn(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,i=ar(e)?Bn(e):tr(1),a=e.clientWidth*i.x,s=e.clientHeight*i.y,c=n*i.x,l=o*i.y;return{width:a,height:s,x:c,y:l}}function Ev(e,t,r){let o;if(t==="viewport")o=gq(e,r);else if(t==="document")o=pq(cr(e));else if(qt(t))o=vq(t,r);else{const n=h$(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Cs(o)}function y$(e,t){const r=Lr(e);return r===t||!qt(r)||so(r)?!1:Gt(r).position==="fixed"||y$(r,t)}function yq(e,t){const r=t.get(e);if(r)return r;let o=wi(e,[],!1).filter(s=>qt(s)&&Eo(s)!=="body"),n=null;const i=Gt(e).position==="fixed";let a=i?Lr(e):e;for(;qt(a)&&!so(a);){const s=Gt(a),c=up(a);!c&&s.position==="fixed"&&(n=null),(i?!c&&!n:!c&&s.position==="static"&&!!n&&hq.has(n.position)||sa(a)&&!c&&y$(e,a))?o=o.filter(u=>u!==a):n=s,a=Lr(a)}return t.set(e,o),o}function bq(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const a=[...r==="clippingAncestors"?Qc(t)?[]:yq(t,this._c):[].concat(r),o],s=a[0],c=a.reduce((l,u)=>{const d=Ev(t,u,n);return l.top=vt(d.top,l.top),l.right=Ur(d.right,l.right),l.bottom=Ur(d.bottom,l.bottom),l.left=vt(d.left,l.left),l},Ev(t,s,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function _q(e){const{width:t,height:r}=g$(e);return{width:t,height:r}}function wq(e,t,r){const o=ar(t),n=cr(t),i=r==="fixed",a=fn(e,!0,i,t);let s={scrollLeft:0,scrollTop:0};const c=tr(0);function l(){c.x=mp(n)}if(o||!o&&!i)if((Eo(t)!=="body"||sa(n))&&(s=el(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?v$(n,s):tr(0),d=a.left+s.scrollLeft-c.x-u.x,f=a.top+s.scrollTop-c.y-u.y;return{x:d,y:f,width:a.width,height:a.height}}function au(e){return Gt(e).position==="static"}function Iv(e,t){if(!ar(e)||Gt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return cr(e)===r&&(r=r.ownerDocument.body),r}function b$(e,t){const r=_t(e);if(Qc(e))return r;if(!ar(e)){let n=Lr(e);for(;n&&!so(n);){if(qt(n)&&!au(n))return n;n=Lr(n)}return r}let o=Iv(e,t);for(;o&&nq(o)&&au(o);)o=Iv(o,t);return o&&so(o)&&au(o)&&!up(o)?r:o||cq(e)||r}const xq=async function(e){const t=this.getOffsetParent||b$,r=this.getDimensions,o=await r(e.floating);return{reference:wq(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Sq(e){return Gt(e).direction==="rtl"}const kq={convertOffsetParentRelativeRectToViewportRelativeRect:fq,getDocumentElement:cr,getClippingRect:bq,getOffsetParent:b$,getElementRects:xq,getClientRects:mq,getDimensions:_q,getScale:Bn,isElement:qt,isRTL:Sq};function _$(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eq(e,t){let r=null,o;const n=cr(e);function i(){var s;clearTimeout(o),(s=r)==null||s.disconnect(),r=null}function a(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),i();const l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:m}=l;if(s||t(),!f||!m)return;const h=Oa(d),g=Oa(n.clientWidth-(u+f)),y=Oa(n.clientHeight-(d+m)),b=Oa(u),x={rootMargin:-h+"px "+-g+"px "+-y+"px "+-b+"px",threshold:vt(0,Ur(1,c))||1};let v=!0;function k(E){const I=E[0].intersectionRatio;if(I!==c){if(!v)return a();I?a(!1,I):o=setTimeout(()=>{a(!1,1e-7)},1e3)}I===1&&!_$(l,e.getBoundingClientRect())&&a(),v=!1}try{r=new IntersectionObserver(k,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,x)}r.observe(e)}return a(!0),i}function Iq(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=fp(e),u=n||i?[...l?wi(l):[],...wi(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),i&&b.addEventListener("resize",r)});const d=l&&s?Eq(l,r):null;let f=-1,m=null;a&&(m=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),r()}),l&&!c&&m.observe(l),m.observe(t));let h,g=c?fn(e):null;c&&y();function y(){const b=fn(e);g&&!_$(g,b)&&r(),g=b,h=requestAnimationFrame(y)}return r(),()=>{var b;u.forEach(w=>{n&&w.removeEventListener("scroll",r),i&&w.removeEventListener("resize",r)}),d?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(h)}}const Tq=YB,$q=XB,Oq=WB,Aq=eq,Cq=JB,Tv=HB,Nq=QB,Rq=(e,t,r)=>{const o=new Map,n={platform:kq,...r},i={...n.platform,_c:o};return GB(e,t,{...n,platform:i})};var Pq=typeof document<"u",jq=function(){},Ba=Pq?A.useLayoutEffect:jq;function Ns(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(!Ns(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)&&!Ns(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function w$(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function $v(e,t){const r=w$(e);return Math.round(t*r)/r}function su(e){const t=_.useRef(e);return Ba(()=>{t.current=e}),t}function zq(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);Ns(f,o)||m(o);const[h,g]=_.useState(null),[y,b]=_.useState(null),w=_.useCallback(G=>{G!==E.current&&(E.current=G,g(G))},[]),x=_.useCallback(G=>{G!==I.current&&(I.current=G,b(G))},[]),v=i||h,k=a||y,E=_.useRef(null),I=_.useRef(null),C=_.useRef(u),U=c!=null,D=su(c),K=su(n),he=su(l),F=_.useCallback(()=>{if(!E.current||!I.current)return;const G={placement:t,strategy:r,middleware:f};K.current&&(G.platform=K.current),Rq(E.current,I.current,G).then(le=>{const Z={...le,isPositioned:he.current!==!1};V.current&&!Ns(C.current,Z)&&(C.current=Z,Gv.flushSync(()=>{d(Z)}))})},[f,t,r,K,he]);Ba(()=>{l===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,d(G=>({...G,isPositioned:!1})))},[l]);const V=_.useRef(!1);Ba(()=>(V.current=!0,()=>{V.current=!1}),[]),Ba(()=>{if(v&&(E.current=v),k&&(I.current=k),v&&k){if(D.current)return D.current(v,k,F);F()}},[v,k,F,D,U]);const ve=_.useMemo(()=>({reference:E,floating:I,setReference:w,setFloating:x}),[w,x]),ue=_.useMemo(()=>({reference:v,floating:k}),[v,k]),pe=_.useMemo(()=>{const G={position:r,left:0,top:0};if(!ue.floating)return G;const le=$v(ue.floating,u.x),Z=$v(ue.floating,u.y);return s?{...G,transform:"translate("+le+"px, "+Z+"px)",...w$(ue.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:le,top:Z}},[r,s,ue.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:F,refs:ve,elements:ue,floatingStyles:pe}),[u,F,ve,ue,pe])}const Dq=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?Tv({element:o.current,padding:n}).fn(r):{}:o?Tv({element:o,padding:n}).fn(r):{}}}},Mq=(e,t)=>({...Tq(e),options:[e,t]}),Uq=(e,t)=>({...$q(e),options:[e,t]}),Lq=(e,t)=>({...Nq(e),options:[e,t]}),Fq=(e,t)=>({...Oq(e),options:[e,t]}),Vq=(e,t)=>({...Aq(e),options:[e,t]}),Zq=(e,t)=>({...Cq(e),options:[e,t]}),Bq=(e,t)=>({...Dq(e),options:[e,t]});var qq="Arrow",x$=_.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"})})});x$.displayName=qq;var Gq=x$;function Hq(e){const[t,r]=_.useState(void 0);return Nt(()=>{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 pp="Popper",[S$,tl]=aa(pp),[Wq,k$]=S$(pp),E$=e=>{const{__scopePopper:t,children:r}=e,[o,n]=_.useState(null);return p.jsx(Wq,{scope:t,anchor:o,onAnchorChange:n,children:r})};E$.displayName=pp;var I$="PopperAnchor",T$=_.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,i=k$(I$,r),a=_.useRef(null),s=gt(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})});T$.displayName=I$;var gp="PopperContent",[Jq,Kq]=S$(gp),$$=_.forwardRef((e,t)=>{const{__scopePopper:r,side:o="bottom",sideOffset:n=0,align:i="center",alignOffset:a=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:h,...g}=e,y=k$(gp,r),[b,w]=_.useState(null),x=gt(t,Te=>w(Te)),[v,k]=_.useState(null),E=Hq(v),I=E?.width??0,C=E?.height??0,U=o+(i!=="center"?"-"+i:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},K=Array.isArray(l)?l:[l],he=K.length>0,F={padding:D,boundary:K.filter(Xq),altBoundary:he},{refs:V,floatingStyles:ve,placement:ue,isPositioned:pe,middlewareData:G}=zq({strategy:"fixed",placement:U,whileElementsMounted:(...Te)=>Iq(...Te,{animationFrame:m==="always"}),elements:{reference:y.anchor},middleware:[Mq({mainAxis:n+C,alignmentAxis:a}),c&&Uq({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Lq():void 0,...F}),c&&Fq({...F}),Vq({...F,apply:({elements:Te,rects:Fe,availableWidth:ml,availableHeight:Io})=>{const{width:Pt,height:ua}=Fe.reference,qe=Te.floating.style;qe.setProperty("--radix-popper-available-width",`${ml}px`),qe.setProperty("--radix-popper-available-height",`${Io}px`),qe.setProperty("--radix-popper-anchor-width",`${Pt}px`),qe.setProperty("--radix-popper-anchor-height",`${ua}px`)}}),v&&Bq({element:v,padding:s}),Qq({arrowWidth:I,arrowHeight:C}),f&&Zq({strategy:"referenceHidden",...F})]}),[le,Z]=C$(ue),X=dn(h);Nt(()=>{pe&&X?.()},[pe,X]);const oe=G.arrow?.x,Se=G.arrow?.y,P=G.arrow?.centerOffset!==0,[H,me]=_.useState();return Nt(()=>{b&&me(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...ve,transform:pe?ve.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(Jq,{scope:r,placedSide:le,onArrowChange:k,arrowX:oe,arrowY:Se,shouldHideArrow:P,children:p.jsx(Le.div,{"data-side":le,"data-align":Z,...g,ref:x,style:{...g.style,animation:pe?void 0:"none"}})})})});$$.displayName=gp;var O$="PopperArrow",Yq={top:"bottom",right:"left",bottom:"top",left:"right"},A$=_.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,i=Kq(O$,o),a=Yq[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(Gq,{...n,ref:r,style:{...n.style,display:"block"}})})});A$.displayName=O$;function Xq(e){return e!==null}var Qq=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]=C$(r),d={start:"0%",center:"50%",end:"100%"}[u],f=(n.arrow?.x??0)+s/2,m=(n.arrow?.y??0)+c/2;let h="",g="";return l==="bottom"?(h=a?d:`${f}px`,g=`${-c}px`):l==="top"?(h=a?d:`${f}px`,g=`${o.floating.height+c}px`):l==="right"?(h=`${-c}px`,g=a?d:`${m}px`):l==="left"&&(h=`${o.floating.width+c}px`,g=a?d:`${m}px`),{data:{x:h,y:g}}}});function C$(e){const[t,r="center"]=e.split("-");return[t,r]}var N$=E$,hp=T$,R$=$$,P$=A$,e8="Portal",vp=_.forwardRef((e,t)=>{const{container:r,...o}=e,[n,i]=_.useState(!1);Nt(()=>i(!0),[]);const a=r||n&&globalThis?.document?.body;return a?hd.createPortal(p.jsx(Le.div,{...o,ref:t}),a):null});vp.displayName=e8;function t8(e,t){return _.useReducer((r,o)=>t[r][o]??r,e)}var Br=e=>{const{present:t,children:r}=e,o=r8(t),n=typeof r=="function"?r({present:o.isPresent}):_.Children.only(r),i=gt(o.ref,n8(n));return typeof r=="function"||o.isPresent?_.cloneElement(n,{ref:i}):null};Br.displayName="Presence";function r8(e){const[t,r]=_.useState(),o=_.useRef(null),n=_.useRef(e),i=_.useRef("none"),a=e?"mounted":"unmounted",[s,c]=t8(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const l=Aa(o.current);i.current=s==="mounted"?l:"none"},[s]),Nt(()=>{const l=o.current,u=n.current;if(u!==e){const f=i.current,m=Aa(l);e?c("MOUNT"):m==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&f!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Nt(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,d=m=>{const g=Aa(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(c("ANIMATION_END"),!n.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=m=>{m.target===t&&(i.current=Aa(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 Aa(e){return e?.animationName||"none"}function n8(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 o8=_[" useInsertionEffect ".trim().toString()]||Nt;function rl({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,i,a]=i8({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=a8(u)?u(e):u;d!==e&&a.current?.(d)}else i(u)},[s,e,i,a]);return[c,l]}function i8({defaultProp:e,onChange:t}){const[r,o]=_.useState(e),n=_.useRef(r),i=_.useRef(t);return o8(()=>{i.current=t},[t]),_.useEffect(()=>{n.current!==r&&(i.current?.(r),n.current=r)},[r,n]),[r,o,i]}function a8(e){return typeof e=="function"}var s8=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"}),c8="VisuallyHidden",j$=_.forwardRef((e,t)=>p.jsx(Le.span,{...e,ref:t,style:{...s8,...e.style}}));j$.displayName=c8;var l8=j$,[nl]=aa("Tooltip",[tl]),ol=tl(),z$="TooltipProvider",u8=700,fd="tooltip.open",[d8,yp]=nl(z$),D$=e=>{const{__scopeTooltip:t,delayDuration:r=u8,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(d8,{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})};D$.displayName=z$;var xi="Tooltip",[f8,ca]=nl(xi),M$=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:i,disableHoverableContent:a,delayDuration:s}=e,c=yp(xi,e.__scopeTooltip),l=ol(t),[u,d]=_.useState(null),f=Zn(),m=_.useRef(0),h=a??c.disableHoverableContent,g=s??c.delayDuration,y=_.useRef(!1),[b,w]=rl({prop:o,defaultProp:n??!1,onChange:I=>{I?(c.onOpen(),document.dispatchEvent(new CustomEvent(fd))):c.onClose(),i?.(I)},caller:xi}),x=_.useMemo(()=>b?y.current?"delayed-open":"instant-open":"closed",[b]),v=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y.current=!1,w(!0)},[w]),k=_.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=_.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{y.current=!0,w(!0),m.current=0},g)},[g,w]);return _.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),p.jsx(N$,{...l,children:p.jsx(f8,{scope:t,contentId:f,open:b,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?E():v()},[c.isOpenDelayedRef,E,v]),onTriggerLeave:_.useCallback(()=>{h?k():(window.clearTimeout(m.current),m.current=0)},[k,h]),onOpen:v,onClose:k,disableHoverableContent:h,children:r})})};M$.displayName=xi;var md="TooltipTrigger",U$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=ca(md,r),i=yp(md,r),a=ol(r),s=_.useRef(null),c=gt(t,s,n.onTriggerChange),l=_.useRef(!1),u=_.useRef(!1),d=_.useCallback(()=>l.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx(hp,{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)})})});U$.displayName=md;var bp="TooltipPortal",[m8,p8]=nl(bp,{forceMount:void 0}),L$=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,i=ca(bp,t);return p.jsx(m8,{scope:t,forceMount:r,children:p.jsx(Br,{present:r||i.open,children:p.jsx(vp,{asChild:!0,container:n,children:o})})})};L$.displayName=bp;var co="TooltipContent",F$=_.forwardRef((e,t)=>{const r=p8(co,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...i}=e,a=ca(co,e.__scopeTooltip);return p.jsx(Br,{present:o||a.open,children:a.disableHoverableContent?p.jsx(V$,{side:n,...i,ref:t}):p.jsx(g8,{side:n,...i,ref:t})})}),g8=_.forwardRef((e,t)=>{const r=ca(co,e.__scopeTooltip),o=yp(co,e.__scopeTooltip),n=_.useRef(null),i=gt(t,n),[a,s]=_.useState(null),{trigger:c,onClose:l}=r,u=n.current,{onPointerInTransitChange:d}=o,f=_.useCallback(()=>{s(null),d(!1)},[d]),m=_.useCallback((h,g)=>{const y=h.currentTarget,b={x:h.clientX,y:h.clientY},w=b8(b,y.getBoundingClientRect()),x=_8(b,w),v=w8(g.getBoundingClientRect()),k=S8([...x,...v]);s(k),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){const h=y=>m(y,u),g=y=>m(y,c);return c.addEventListener("pointerleave",h),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",h),u.removeEventListener("pointerleave",g)}}},[c,u,m,f]),_.useEffect(()=>{if(a){const h=g=>{const y=g.target,b={x:g.clientX,y:g.clientY},w=c?.contains(y)||u?.contains(y),x=!x8(b,a);w?f():x&&(f(),l())};return document.addEventListener("pointermove",h),()=>document.removeEventListener("pointermove",h)}},[c,u,a,l,f]),p.jsx(V$,{...e,ref:i})}),[h8,v8]=nl(xi,{isInside:!1}),y8=bB("TooltipContent"),V$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:i,onPointerDownOutside:a,...s}=e,c=ca(co,r),l=ol(r),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(fd,u),()=>document.removeEventListener(fd,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(Yc,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:p.jsxs(R$,{"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(y8,{children:o}),p.jsx(h8,{scope:r,isInside:!0,children:p.jsx(l8,{id:c.contentId,role:"tooltip",children:n||o})})]})})});F$.displayName=co;var Z$="TooltipArrow",B$=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=ol(r);return v8(Z$,r).isInside?null:p.jsx(P$,{...n,...o,ref:t})});B$.displayName=Z$;function b8(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 _8(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 w8(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 x8(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),k8(t)}function k8(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 E8=D$,I8=M$,T8=U$,$8=L$,O8=F$,A8=B$;const q$=A.createContext(null);function G$(){return A.useContext(q$)?.current??null}function H$({delayDuration:e=0,...t}){return p.jsx(E8,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function il({...e}){return p.jsx(H$,{children:p.jsx(I8,{"data-slot":"tooltip",...e})})}function al({...e}){return p.jsx(T8,{"data-slot":"tooltip-trigger",...e})}function sl({className:e,sideOffset:t=0,children:r,container:o,...n}){const i=G$();return p.jsx($8,{container:o??i,children:p.jsxs(O8,{"data-slot":"tooltip-content",sideOffset:t,className:$.cn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-20 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...n,children:[r,p.jsx(A8,{className:"bg-foreground fill-foreground z-20 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]"})]})})}var cu="focusScope.autoFocusOnMount",lu="focusScope.autoFocusOnUnmount",Ov={bubbles:!1,cancelable:!0},C8="FocusScope",_p=_.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=gt(t,g=>c(g)),m=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(o){let g=function(x){if(m.paused||!s)return;const v=x.target;s.contains(v)?d.current=v:kr(d.current,{select:!0})},y=function(x){if(m.paused||!s)return;const v=x.relatedTarget;v!==null&&(s.contains(v)||kr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const k of x)k.removedNodes.length>0&&kr(s)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const w=new MutationObserver(b);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),w.disconnect()}}},[o,s,m.paused]),_.useEffect(()=>{if(s){Cv.add(m);const g=document.activeElement;if(!s.contains(g)){const b=new CustomEvent(cu,Ov);s.addEventListener(cu,l),s.dispatchEvent(b),b.defaultPrevented||(N8(D8(W$(s)),{select:!0}),document.activeElement===g&&kr(s))}return()=>{s.removeEventListener(cu,l),setTimeout(()=>{const b=new CustomEvent(lu,Ov);s.addEventListener(lu,u),s.dispatchEvent(b),b.defaultPrevented||kr(g??document.body,{select:!0}),s.removeEventListener(lu,u),Cv.remove(m)},0)}}},[s,l,u,m]);const h=_.useCallback(g=>{if(!r&&!o||m.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(y&&b){const w=g.currentTarget,[x,v]=R8(w);x&&v?!g.shiftKey&&b===v?(g.preventDefault(),r&&kr(x,{select:!0})):g.shiftKey&&b===x&&(g.preventDefault(),r&&kr(v,{select:!0})):b===w&&g.preventDefault()}},[r,o,m.paused]);return p.jsx(Le.div,{tabIndex:-1,...a,ref:f,onKeyDown:h})});_p.displayName=C8;function N8(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(kr(o,{select:t}),document.activeElement!==r)return}function R8(e){const t=W$(e),r=Av(t,e),o=Av(t.reverse(),e);return[r,o]}function W$(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 Av(e,t){for(const r of e)if(!P8(r,{upTo:t}))return r}function P8(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 j8(e){return e instanceof HTMLInputElement&&"select"in e}function kr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&j8(e)&&t&&e.select()}}var Cv=z8();function z8(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Nv(e,t),e.unshift(t)},remove(t){e=Nv(e,t),e[0]?.resume()}}}function Nv(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function D8(e){return e.filter(t=>t.tagName!=="A")}var uu=0;function J$(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Rv()),document.body.insertAdjacentElement("beforeend",e[1]??Rv()),uu++,()=>{uu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),uu--}},[])}function Rv(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Xt=function(){return Xt=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Xt.apply(this,arguments)};function K$(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 M8(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",U8="with-scroll-bars-hidden",L8="--removed-body-scroll-bar-size";function du(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function F8(e,t){var r=A.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 V8=typeof window<"u"?_.useLayoutEffect:_.useEffect,Pv=new WeakMap;function Z8(e,t){var r=F8(null,function(o){return e.forEach(function(n){return du(n,o)})});return V8(function(){var o=Pv.get(r);if(o){var n=new Set(o),i=new Set(e),a=r.current;n.forEach(function(s){i.has(s)||du(s,null)}),i.forEach(function(s){n.has(s)||du(s,a)})}Pv.set(r,e)},[e]),r}function B8(e){return e}function q8(e,t){t===void 0&&(t=B8);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 G8(e){e===void 0&&(e={});var t=q8(null);return t.options=Xt({async:!0,ssr:!1},e),t}var Y$=function(e){var t=e.sideCar,r=K$(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return _.createElement(o,Xt({},r))};Y$.isSideCarExport=!0;function H8(e,t){return e.useMedium(t),Y$}var X$=G8(),fu=function(){},cl=_.forwardRef(function(e,t){var r=_.useRef(null),o=_.useState({onScrollCapture:fu,onWheelCapture:fu,onTouchMoveCapture:fu}),n=o[0],i=o[1],a=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,m=e.noRelative,h=e.noIsolation,g=e.inert,y=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,x=e.gapMode,v=K$(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=f,E=Z8([r,t]),I=Xt(Xt({},v),n);return _.createElement(_.Fragment,null,u&&_.createElement(k,{sideCar:X$,removeScrollBar:l,shards:d,noRelative:m,noIsolation:h,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:r,gapMode:x}),a?_.cloneElement(_.Children.only(s),Xt(Xt({},I),{ref:E})):_.createElement(w,Xt({},I,{className:c,ref:E}),s))});cl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};cl.classNames={fullWidth:Ga,zeroRight:qa};var W8=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function J8(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=W8();return t&&e.setAttribute("nonce",t),e}function K8(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Y8(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var X8=function(){var e=0,t=null;return{add:function(r){e==0&&(t=J8())&&(K8(t,r),Y8(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Q8=function(){var e=X8();return function(t,r){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Q$=function(){var e=Q8(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},eG={left:0,top:0,right:0,gap:0},mu=function(e){return parseInt(e||"",10)||0},tG=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[mu(r),mu(o),mu(n)]},rG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return eG;var t=tG(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])}},nG=Q$(),qn="data-scroll-locked",oG=function(e,t,r,o){var n=e.left,i=e.top,a=e.right,s=e.gap;return r===void 0&&(r="margin"),`
99
- .`.concat(U8,` {
100
- overflow: hidden `).concat(o,`;
101
- padding-right: `).concat(s,"px ").concat(o,`;
102
- }
103
- body[`).concat(qn,`] {
104
- overflow: hidden `).concat(o,`;
105
- overscroll-behavior: contain;
106
- `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
107
- padding-left: `.concat(n,`px;
108
- padding-top: `).concat(i,`px;
109
- padding-right: `).concat(a,`px;
110
- margin-left:0;
111
- margin-top:0;
112
- margin-right: `).concat(s,"px ").concat(o,`;
113
- `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),`
114
- }
115
-
116
- .`).concat(qa,` {
117
- right: `).concat(s,"px ").concat(o,`;
118
- }
119
-
120
- .`).concat(Ga,` {
121
- margin-right: `).concat(s,"px ").concat(o,`;
122
- }
123
-
124
- .`).concat(qa," .").concat(qa,` {
125
- right: 0 `).concat(o,`;
126
- }
127
-
128
- .`).concat(Ga," .").concat(Ga,` {
129
- margin-right: 0 `).concat(o,`;
130
- }
131
-
132
- body[`).concat(qn,`] {
133
- `).concat(L8,": ").concat(s,`px;
134
- }
135
- `)},jv=function(){var e=parseInt(document.body.getAttribute(qn)||"0",10);return isFinite(e)?e:0},iG=function(){_.useEffect(function(){return document.body.setAttribute(qn,(jv()+1).toString()),function(){var e=jv()-1;e<=0?document.body.removeAttribute(qn):document.body.setAttribute(qn,e.toString())}},[])},aG=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;iG();var i=_.useMemo(function(){return rG(n)},[n]);return _.createElement(nG,{styles:oG(i,!t,n,r?"":"!important")})},pd=!1;if(typeof window<"u")try{var Ca=Object.defineProperty({},"passive",{get:function(){return pd=!0,!0}});window.addEventListener("test",Ca,Ca),window.removeEventListener("test",Ca,Ca)}catch{pd=!1}var Nn=pd?{passive:!1}:!1,sG=function(e){return e.tagName==="TEXTAREA"},e1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!sG(e)&&r[t]==="visible")},cG=function(e){return e1(e,"overflowY")},lG=function(e){return e1(e,"overflowX")},zv=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=t1(e,o);if(n){var i=r1(e,o),a=i[1],s=i[2];if(a>s)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},uG=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},dG=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},t1=function(e,t){return e==="v"?cG(t):lG(t)},r1=function(e,t){return e==="v"?uG(t):dG(t)},fG=function(e,t){return e==="h"&&t==="rtl"?-1:1},mG=function(e,t,r,o,n){var i=fG(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=r1(e,s),h=m[0],g=m[1],y=m[2],b=g-y-i*h;(h||b)&&t1(e,s)&&(d+=b,f+=h);var w=s.parentNode;s=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&Math.abs(d)<1||!u&&Math.abs(f)<1)&&(l=!0),l},Na=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Dv=function(e){return[e.deltaX,e.deltaY]},Mv=function(e){return e&&"current"in e?e.current:e},pG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},gG=function(e){return`
136
- .block-interactivity-`.concat(e,` {pointer-events: none;}
137
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
138
- `)},hG=0,Rn=[];function vG(e){var t=_.useRef([]),r=_.useRef([0,0]),o=_.useRef(),n=_.useState(hG++)[0],i=_.useState(Q$)[0],a=_.useRef(e);_.useEffect(function(){a.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var g=M8([e.lockRef.current],(e.shards||[]).map(Mv),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var b=Na(g),w=r.current,x="deltaX"in g?g.deltaX:w[0]-b[0],v="deltaY"in g?g.deltaY:w[1]-b[1],k,E=g.target,I=Math.abs(x)>Math.abs(v)?"h":"v";if("touches"in g&&I==="h"&&E.type==="range")return!1;var C=zv(I,E);if(!C)return!0;if(C?k=I:(k=I==="v"?"h":"v",C=zv(I,E)),!C)return!1;if(!o.current&&"changedTouches"in g&&(x||v)&&(o.current=k),!k)return!0;var U=o.current||k;return mG(U,y,g,U==="h"?x:v)},[]),c=_.useCallback(function(g){var y=g;if(!(!Rn.length||Rn[Rn.length-1]!==i)){var b="deltaY"in y?Dv(y):Na(y),w=t.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&pG(k.delta,b)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var x=(a.current.shards||[]).map(Mv).filter(Boolean).filter(function(k){return k.contains(y.target)}),v=x.length>0?s(y,x[0]):!a.current.noIsolation;v&&y.cancelable&&y.preventDefault()}}},[]),l=_.useCallback(function(g,y,b,w){var x={name:g,delta:y,target:b,should:w,shadowParent:yG(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(v){return v!==x})},1)},[]),u=_.useCallback(function(g){r.current=Na(g),o.current=void 0},[]),d=_.useCallback(function(g){l(g.type,Dv(g),g.target,s(g,e.lockRef.current))},[]),f=_.useCallback(function(g){l(g.type,Na(g),g.target,s(g,e.lockRef.current))},[]);_.useEffect(function(){return Rn.push(i),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",c,Nn),document.addEventListener("touchmove",c,Nn),document.addEventListener("touchstart",u,Nn),function(){Rn=Rn.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,Nn),document.removeEventListener("touchmove",c,Nn),document.removeEventListener("touchstart",u,Nn)}},[]);var m=e.removeScrollBar,h=e.inert;return _.createElement(_.Fragment,null,h?_.createElement(i,{styles:gG(n)}):null,m?_.createElement(aG,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function yG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const bG=H8(X$,vG);var wp=_.forwardRef(function(e,t){return _.createElement(cl,Xt({},e,{ref:t,sideCar:bG}))});wp.classNames=cl.classNames;var _G=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Pn=new WeakMap,Ra=new WeakMap,Pa={},pu=0,n1=function(e){return e&&(e.host||n1(e.parentNode))},wG=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=n1(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})},xG=function(e,t,r,o){var n=wG(t,Array.isArray(e)?e:[e]);Pa[r]||(Pa[r]=new WeakMap);var i=Pa[r],a=[],s=new Set,c=new Set(n),l=function(d){!d||s.has(d)||(s.add(d),l(d.parentNode))};n.forEach(l);var u=function(d){!d||c.has(d)||Array.prototype.forEach.call(d.children,function(f){if(s.has(f))u(f);else try{var m=f.getAttribute(o),h=m!==null&&m!=="false",g=(Pn.get(f)||0)+1,y=(i.get(f)||0)+1;Pn.set(f,g),i.set(f,y),a.push(f),g===1&&h&&Ra.set(f,!0),y===1&&f.setAttribute(r,"true"),h||f.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",f,b)}})};return u(t),s.clear(),pu++,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||(Ra.has(d)||d.removeAttribute(o),Ra.delete(d)),m||d.removeAttribute(r)}),pu--,pu||(Pn=new WeakMap,Pn=new WeakMap,Ra=new WeakMap,Pa={})}},o1=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=_G(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),xG(o,n,r,"aria-hidden")):function(){return null}},ll="Dialog",[i1]=aa(ll),[SG,Wt]=i1(ll),a1=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:n,onOpenChange:i,modal:a=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=rl({prop:o,defaultProp:n??!1,onChange:i,caller:ll});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})};a1.displayName=ll;var s1="DialogTrigger",c1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(s1,r),i=gt(t,n.triggerRef);return p.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":kp(n.open),...o,ref:i,onClick:ze(e.onClick,n.onOpenToggle)})});c1.displayName=s1;var xp="DialogPortal",[kG,l1]=i1(xp,{forceMount:void 0}),u1=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:n}=e,i=Wt(xp,t);return p.jsx(kG,{scope:t,forceMount:r,children:_.Children.map(o,a=>p.jsx(Br,{present:r||i.open,children:p.jsx(vp,{asChild:!0,container:n,children:a})}))})};u1.displayName=xp;var Rs="DialogOverlay",d1=_.forwardRef((e,t)=>{const r=l1(Rs,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Wt(Rs,e.__scopeDialog);return i.modal?p.jsx(Br,{present:o||i.open,children:p.jsx(IG,{...n,ref:t})}):null});d1.displayName=Rs;var EG=ap("DialogOverlay.RemoveScroll"),IG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(Rs,r);return p.jsx(wp,{as:EG,allowPinchZoom:!0,shards:[n.contentRef],children:p.jsx(Le.div,{"data-state":kp(n.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),mn="DialogContent",f1=_.forwardRef((e,t)=>{const r=l1(mn,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,i=Wt(mn,e.__scopeDialog);return p.jsx(Br,{present:o||i.open,children:i.modal?p.jsx(TG,{...n,ref:t}):p.jsx($G,{...n,ref:t})})});f1.displayName=mn;var TG=_.forwardRef((e,t)=>{const r=Wt(mn,e.__scopeDialog),o=_.useRef(null),n=gt(t,r.contentRef,o);return _.useEffect(()=>{const i=o.current;if(i)return o1(i)},[]),p.jsx(m1,{...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())})}),$G=_.forwardRef((e,t)=>{const r=Wt(mn,e.__scopeDialog),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(m1,{...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()}})}),m1=_.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:i,...a}=e,s=Wt(mn,r),c=_.useRef(null),l=gt(t,c);return J$(),p.jsxs(p.Fragment,{children:[p.jsx(_p,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:i,children:p.jsx(Yc,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":kp(s.open),...a,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(AG,{titleId:s.titleId}),p.jsx(NG,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Sp="DialogTitle",p1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(Sp,r);return p.jsx(Le.h2,{id:n.titleId,...o,ref:t})});p1.displayName=Sp;var g1="DialogDescription",OG=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(g1,r);return p.jsx(Le.p,{id:n.descriptionId,...o,ref:t})});OG.displayName=g1;var h1="DialogClose",v1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Wt(h1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:ze(e.onClick,()=>n.onOpenChange(!1))})});v1.displayName=h1;function kp(e){return e?"open":"closed"}var y1="DialogTitleWarning",[rW,b1]=hB(y1,{contentName:mn,titleName:Sp,docsSlug:"dialog"}),AG=({titleId:e})=>{const t=b1(y1),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
139
-
140
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
141
-
142
- 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},CG="DialogDescriptionWarning",NG=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${b1(CG).contentName}}.`;return _.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},RG=a1,PG=c1,jG=u1,zG=d1,DG=f1,MG=p1,UG=v1;function LG({...e}){return p.jsx(RG,{"data-slot":"dialog",...e})}function FG({...e}){return p.jsx(PG,{"data-slot":"dialog-trigger",...e})}function VG({container:e,...t}){const r=G$();return p.jsx(jG,{"data-slot":"dialog-portal",container:e??r,...t})}function ZG({className:e,...t}){return p.jsx(zG,{"data-slot":"dialog-overlay",className:$.cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function BG({className:e,children:t,showCloseButton:r=!0,...o}){return p.jsxs(VG,{"data-slot":"dialog-portal",children:[p.jsx(ZG,{}),p.jsxs(DG,{"data-slot":"dialog-content",className:$.cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",e),...o,children:[t,r&&p.jsxs(UG,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[p.jsx(xo,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function qG({className:e,...t}){return p.jsx(MG,{"data-slot":"dialog-title",className:$.cn("text-lg leading-none font-semibold",e),...t})}function GG(e,t=[]){let r=[];function o(i,a){const s=_.createContext(a);s.displayName=i+"Context";const c=r.length;r=[...r,a];const l=d=>{const{scope:f,children:m,...h}=d,g=f?.[e]?.[c]||s,y=_.useMemo(()=>h,Object.values(h));return p.jsx(g.Provider,{value:y,children:m})};l.displayName=i+"Provider";function u(d,f){const m=f?.[e]?.[c]||s,h=_.useContext(m);if(h)return h;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${i}\``)}return[l,u]}const n=()=>{const i=r.map(a=>_.createContext(a));return function(s){const c=s?.[e]||i;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,HG(n,...t)]}function HG(...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 WG=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ep=WG.reduce((e,t)=>{const r=i$(`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}},{}),ja={exports:{}},gu={};var Uv;function JG(){if(Uv)return gu;Uv=1;var e=A;function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,n=e.useEffect,i=e.useLayoutEffect,a=e.useDebugValue;function s(d,f){var m=f(),h=o({inst:{value:m,getSnapshot:f}}),g=h[0].inst,y=h[1];return i(function(){g.value=m,g.getSnapshot=f,c(g)&&y({inst:g})},[d,m,f]),n(function(){return c(g)&&y({inst:g}),d(function(){c(g)&&y({inst:g})})},[d]),a(m),m}function c(d){var f=d.getSnapshot;d=d.value;try{var m=f();return!r(d,m)}catch{return!0}}function l(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return gu.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,gu}var hu={};var Lv;function KG(){return Lv||(Lv=1,process.env.NODE_ENV!=="production"&&(function(){function e(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}function t(m,h){u||n.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var g=h();if(!d){var y=h();i(g,y)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}y=a({inst:{value:g,getSnapshot:h}});var b=y[0].inst,w=y[1];return c(function(){b.value=g,b.getSnapshot=h,r(b)&&w({inst:b})},[m,g,h]),s(function(){return r(b)&&w({inst:b}),m(function(){r(b)&&w({inst:b})})},[m]),l(g),g}function r(m){var h=m.getSnapshot;m=m.value;try{var g=h();return!i(m,g)}catch{return!0}}function o(m,h){return h()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=A,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;hu.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())})()),hu}var Fv;function YG(){return Fv||(Fv=1,process.env.NODE_ENV==="production"?ja.exports=JG():ja.exports=KG()),ja.exports}var XG=YG();function QG(){return XG.useSyncExternalStore(eH,()=>!0,()=>!1)}function eH(){return()=>{}}var Ip="Avatar",[tH]=GG(Ip),[rH,_1]=tH(Ip),w1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,...o}=e,[n,i]=_.useState("idle");return p.jsx(rH,{scope:r,imageLoadingStatus:n,onImageLoadingStatusChange:i,children:p.jsx(Ep.span,{...o,ref:t})})});w1.displayName=Ip;var x1="AvatarImage",S1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,src:o,onLoadingStatusChange:n=()=>{},...i}=e,a=_1(x1,r),s=nH(o,i),c=dn(l=>{n(l),a.onImageLoadingStatusChange(l)});return Nt(()=>{s!=="idle"&&c(s)},[s,c]),s==="loaded"?p.jsx(Ep.img,{...i,ref:t,src:o}):null});S1.displayName=x1;var k1="AvatarFallback",E1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:o,...n}=e,i=_1(k1,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(Ep.span,{...n,ref:t}):null});E1.displayName=k1;function Vv(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function nH(e,{referrerPolicy:t,crossOrigin:r}){const o=QG(),n=_.useRef(null),i=o?(n.current||(n.current=new window.Image),n.current):null,[a,s]=_.useState(()=>Vv(i,e));return Nt(()=>{s(Vv(i,e))},[i,e]),Nt(()=>{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 oH=w1,iH=S1,aH=E1;function sH({className:e,...t}){return p.jsx(oH,{"data-slot":"avatar",className:$.cn("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function cH({className:e,...t}){return p.jsx(iH,{"data-slot":"avatar-image",className:$.cn("aspect-square size-full",e),...t})}function lH({className:e,...t}){return p.jsx(aH,{"data-slot":"avatar-fallback",className:$.cn("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const Ht=A.forwardRef(({children:e,tooltip:t,side:r="bottom",align:o="center",className:n,...i},a)=>p.jsxs(il,{children:[p.jsx(al,{asChild:!0,children:p.jsxs(pt,{variant:"ghost",size:"icon",...i,className:$.cn("aui-button-icon size-6 p-1",n),ref:a,children:[p.jsx(lB,{children:e}),p.jsx("span",{className:"aui-sr-only sr-only",children:t})]})}),p.jsx(sl,{side:r,align:o,children:t})]}));Ht.displayName="TooltipIconButton";const uH=e=>{const[t,r]=A.useState(void 0);return A.useEffect(()=>{if(!e){r(void 0);return}const o=URL.createObjectURL(e);return r(o),()=>{URL.revokeObjectURL(o)}},[e]),t},I1=()=>{const{file:e,src:t}=M.useAssistantState(nO.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 uH(e)??t},dH=({src:e})=>{const[t,r]=A.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)})},fH=({children:e})=>{const t=I1();return t?p.jsxs(LG,{children:[p.jsx(FG,{className:"aui-attachment-preview-trigger",asChild:!0,children:e}),p.jsxs(BG,{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(qG,{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(dH,{src:t})})]})]}):e},mH=()=>{const e=M.useAssistantState(({attachment:r})=>r.type==="image"),t=I1();return p.jsxs(sH,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[p.jsx(cH,{src:t,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),p.jsx(lH,{delayMs:e?200:0,children:p.jsx(QL,{className:"aui-attachment-tile-fallback-icon text-muted-foreground size-8"})})]})},T1=()=>{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(il,{children:[p.jsxs(M.AttachmentPrimitive.Root,{className:$.cn("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[p.jsx(fH,{children:p.jsx(al,{asChild:!0,children:p.jsx("div",{className:$.cn("aui-attachment-tile bg-muted size-14 cursor-pointer overflow-hidden rounded-[14px] border transition-opacity hover:opacity-75",t&&"aui-attachment-tile-composer border-foreground/20"),role:"button",id:"attachment-tile","aria-label":`${o} attachment`,children:p.jsx(mH,{})})})}),t&&p.jsx(pH,{})]}),p.jsx(sl,{side:"top",children:p.jsx(M.AttachmentPrimitive.Name,{})})]})},pH=()=>p.jsx(M.AttachmentPrimitive.Remove,{asChild:!0,children:p.jsx(Ht,{tooltip:"Remove file",className:"aui-attachment-tile-remove text-muted-foreground hover:[&_svg]:text-destructive absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white opacity-100 shadow-sm hover:!bg-white [&_svg]:text-black",side:"top",children:p.jsx(xo,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),gH=()=>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:T1}})}),hH=()=>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:T1}})}),vH=()=>p.jsx(M.ComposerPrimitive.AddAttachment,{asChild:!0,children:p.jsx(Ht,{tooltip:"Add Attachment",side:"top",variant:"ghost",size:"icon",align:"start",className:"aui-composer-add-attachment hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30 size-[34px] rounded-full p-1 text-xs font-semibold","aria-label":"Add Attachment",children:p.jsx(ZE,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})});function yH(e){return A.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 bH=()=>{const{plugins:e}=$.useElements(),t=yH(e);return p.jsx(yu.MarkdownTextPrimitive,{remarkPlugins:[oO],className:"aui-md",components:xH,componentsByLanguage:t})},$1=A.memo(bH),_H=({language:e,code:t})=>{const o=M.useAssistantState(({message:s})=>s).status?.type==="complete",{isCopied:n,copyToClipboard:i}=wH(),a=()=>{!t||n||i(t)};return o?p.jsxs("div",{className:"aui-code-header-root bg-muted-foreground/15 text-foreground dark:bg-muted-foreground/20 mt-4 flex items-center justify-between gap-4 rounded-t-lg px-4 py-2 text-sm font-semibold",children:[p.jsx("span",{className:"aui-code-header-language lowercase [&>span]:text-xs",children:e}),p.jsxs(Ht,{tooltip:"Copy",onClick:a,children:[!n&&p.jsx(Fm,{}),n&&p.jsx(Nr,{})]})]}):null},wH=({copiedDuration:e=3e3}={})=>{const[t,r]=A.useState(!1);return{isCopied:t,copyToClipboard:n=>{n&&navigator.clipboard.writeText(n).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},xH=yu.unstable_memoizeMarkdownComponents({h1:({className:e,...t})=>p.jsx("h1",{className:$.cn("aui-md-h1 mb-8 scroll-m-20 text-4xl font-extrabold tracking-tight last:mb-0",e),...t}),h2:({className:e,...t})=>p.jsx("h2",{className:$.cn("aui-md-h2 mt-8 mb-4 scroll-m-20 text-3xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h3:({className:e,...t})=>p.jsx("h3",{className:$.cn("aui-md-h3 mt-6 mb-4 scroll-m-20 text-2xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h4:({className:e,...t})=>p.jsx("h4",{className:$.cn("aui-md-h4 mt-6 mb-4 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0 last:mb-0",e),...t}),h5:({className:e,...t})=>p.jsx("h5",{className:$.cn("aui-md-h5 my-4 text-lg font-semibold first:mt-0 last:mb-0",e),...t}),h6:({className:e,...t})=>p.jsx("h6",{className:$.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>p.jsx("p",{className:$.cn("aui-md-p mt-5 mb-5 leading-7 first:mt-0 last:mb-0",e),...t}),a:({className:e,...t})=>p.jsx("a",{className:$.cn("aui-md-a text-primary font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>p.jsx("blockquote",{className:$.cn("aui-md-blockquote border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>p.jsx("ul",{className:$.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>p.jsx("ol",{className:$.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>p.jsx("hr",{className:$.cn("aui-md-hr my-5 border-b",e),...t}),table:({className:e,...t})=>p.jsx("table",{className:$.cn("aui-md-table my-5 w-full border-separate border-spacing-0 overflow-y-auto",e),...t}),th:({className:e,...t})=>p.jsx("th",{className:$.cn("aui-md-th bg-muted px-4 py-2 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [[align=center]]:text-center [[align=right]]:text-right",e),...t}),td:({className:e,...t})=>p.jsx("td",{className:$.cn("aui-md-td border-b border-l px-4 py-2 text-left last:border-r [[align=center]]:text-center [[align=right]]:text-right",e),...t}),tr:({className:e,...t})=>p.jsx("tr",{className:$.cn("aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg",e),...t}),sup:({className:e,...t})=>p.jsx("sup",{className:$.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>p.jsx("pre",{className:$.cn("aui-md-pre text-foreground bg-muted overflow-x-auto rounded-t-none! rounded-b-lg border border-t-0 p-4",e),...t}),code:function({className:t,...r}){const o=yu.useIsMarkdownCodeBlock();return p.jsx("code",{className:$.cn(!o&&"aui-md-inline-code bg-muted rounded border font-semibold",t),...r})},CodeHeader:_H});var ul="Collapsible",[SH]=aa(ul),[kH,Tp]=SH(ul),O1=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:n,disabled:i,onOpenChange:a,...s}=e,[c,l]=rl({prop:o,defaultProp:n??!1,onChange:a,caller:ul});return p.jsx(kH,{scope:r,disabled:i,contentId:Zn(),open:c,onOpenToggle:_.useCallback(()=>l(u=>!u),[l]),children:p.jsx(Le.div,{"data-state":Op(c),"data-disabled":i?"":void 0,...s,ref:t})})});O1.displayName=ul;var A1="CollapsibleTrigger",C1=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Tp(A1,r);return p.jsx(Le.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Op(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:ze(e.onClick,n.onOpenToggle)})});C1.displayName=A1;var $p="CollapsibleContent",N1=_.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Tp($p,e.__scopeCollapsible);return p.jsx(Br,{present:r||n.open,children:({present:i})=>p.jsx(EH,{...o,ref:t,present:i})})});N1.displayName=$p;var EH=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...i}=e,a=Tp($p,r),[s,c]=_.useState(o),l=_.useRef(null),u=gt(t,l),d=_.useRef(0),f=d.current,m=_.useRef(0),h=m.current,g=a.open||s,y=_.useRef(g),b=_.useRef(void 0);return _.useEffect(()=>{const w=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(w)},[]),Nt(()=>{const w=l.current;if(w){b.current=b.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const x=w.getBoundingClientRect();d.current=x.height,m.current=x.width,y.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),c(o)}},[a.open,o]),p.jsx(Le.div,{"data-state":Op(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,...e.style},children:g&&n})});function Op(e){return e?"open":"closed"}var IH=O1;function TH({...e}){return p.jsx(IH,{"data-slot":"collapsible",...e})}function $H({...e}){return p.jsx(C1,{"data-slot":"collapsible-trigger",...e})}function OH({...e}){return p.jsx(N1,{"data-slot":"collapsible-content",...e})}const Zv=200,R1=({className:e,children:t})=>{const r=A.useRef(null),[o,n]=A.useState(!1),i=M.useScrollLock(r,Zv),a=A.useCallback(s=>{s||i(),n(s)},[i]);return p.jsx(TH,{ref:r,open:o,onOpenChange:a,className:$.cn("aui-reasoning-root mb-4 w-full",e),style:{"--animation-duration":`${Zv}ms`},children:t})};R1.displayName="ReasoningRoot";const AH=({className:e})=>p.jsx("div",{className:$.cn("aui-reasoning-fade pointer-events-none absolute inset-x-0 bottom-0 z-10 h-16","bg-[linear-gradient(to_top,var(--color-background),transparent)]","fade-in-0 animate-in","group-data-[state=open]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:delay-[calc(var(--animation-duration)*0.75)]","group-data-[state=open]/collapsible-content:fill-mode-forwards","duration-(--animation-duration)","group-data-[state=open]/collapsible-content:duration-(--animation-duration)",e)}),CH=({active:e,className:t})=>p.jsxs($H,{className:$.cn("aui-reasoning-trigger group/trigger text-muted-foreground hover:text-foreground -mb-2 flex max-w-[75%] items-center gap-2 py-2 text-sm transition-colors",t,e&&"shimmer"),children:[p.jsx(qL,{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(ys,{className:$.cn("aui-reasoning-trigger-chevron mt-0.5 size-4 shrink-0","transition-transform duration-(--animation-duration) ease-out","group-data-[state=closed]/trigger:-rotate-90","group-data-[state=open]/trigger:rotate-0")})]}),P1=({className:e,children:t,"aria-busy":r})=>p.jsxs(OH,{className:$.cn("aui-reasoning-content text-muted-foreground relative overflow-hidden text-sm outline-none","group/collapsible-content ease-out","data-[state=closed]:animate-collapsible-up","data-[state=open]:animate-collapsible-down","data-[state=closed]:fill-mode-forwards","data-[state=closed]:pointer-events-none","data-[state=open]:duration-(--animation-duration)","data-[state=closed]:duration-(--animation-duration)",e),"aria-busy":r,children:[t,p.jsx(AH,{})]});P1.displayName="ReasoningContent";const j1=({className:e,children:t})=>p.jsx("div",{className:$.cn("aui-reasoning-text relative z-0 space-y-4 pt-4 pl-6 leading-relaxed","transform-gpu transition-[transform,opacity]","group-data-[state=open]/collapsible-content:animate-in","group-data-[state=closed]/collapsible-content:animate-out","group-data-[state=open]/collapsible-content:fade-in-0","group-data-[state=closed]/collapsible-content:fade-out-0","group-data-[state=open]/collapsible-content:slide-in-from-top-4","group-data-[state=closed]/collapsible-content:slide-out-to-top-4","group-data-[state=open]/collapsible-content:duration-(--animation-duration)","group-data-[state=closed]/collapsible-content:duration-(--animation-duration)","[&_p]:-mb-2",e),children:t});j1.displayName="ReasoningText";const NH=()=>p.jsx($1,{}),RH=({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(R1,{children:[p.jsx(CH,{active:o}),p.jsx(P1,{"aria-busy":o,children:p.jsx(j1,{children:e})})]})},z1=A.memo(NH);z1.displayName="Reasoning";const D1=A.memo(RH);D1.displayName="ReasoningGroup";var dl="Popover",[M1]=aa(dl,[tl]),la=tl(),[PH,xn]=M1(dl),U1=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:i,modal:a=!1}=e,s=la(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=rl({prop:o,defaultProp:n??!1,onChange:i,caller:dl});return p.jsx(N$,{...s,children:p.jsx(PH,{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})})};U1.displayName=dl;var L1="PopoverAnchor",jH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(L1,r),i=la(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=n;return _.useEffect(()=>(a(),()=>s()),[a,s]),p.jsx(hp,{...i,...o,ref:t})});jH.displayName=L1;var F1="PopoverTrigger",V1=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(F1,r),i=la(r),a=gt(t,n.triggerRef),s=p.jsx(Le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":G1(n.open),...o,ref:a,onClick:ze(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?s:p.jsx(hp,{asChild:!0,...i,children:s})});V1.displayName=F1;var zH="PopoverPortal",[nW,DH]=M1(zH,{forceMount:void 0}),lo="PopoverContent",Z1=_.forwardRef((e,t)=>{const r=DH(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(UH,{...n,ref:t}):p.jsx(LH,{...n,ref:t})})});Z1.displayName=lo;var MH=ap("PopoverContent.RemoveScroll"),UH=_.forwardRef((e,t)=>{const r=xn(lo,e.__scopePopover),o=_.useRef(null),n=gt(t,o),i=_.useRef(!1);return _.useEffect(()=>{const a=o.current;if(a)return o1(a)},[]),p.jsx(wp,{as:MH,allowPinchZoom:!0,children:p.jsx(B1,{...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})})})}),LH=_.forwardRef((e,t)=>{const r=xn(lo,e.__scopePopover),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(B1,{...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()}})}),B1=_.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=la(r);return J$(),p.jsx(_p,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:i,children:p.jsx(Yc,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:p.jsx(R$,{"data-state":G1(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)"}})})})}),q1="PopoverClose",FH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xn(q1,r);return p.jsx(Le.button,{type:"button",...o,ref:t,onClick:ze(e.onClick,()=>n.onOpenChange(!1))})});FH.displayName=q1;var VH="PopoverArrow",ZH=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=la(r);return p.jsx(P$,{...n,...o,ref:t})});ZH.displayName=VH;function G1(e){return e?"open":"closed"}var BH=U1,qH=V1,GH=Z1;function H1({...e}){return p.jsx(BH,{"data-slot":"popover",...e})}function W1({...e}){return p.jsx(qH,{"data-slot":"popover-trigger",...e})}function J1({className:e,align:t="center",sideOffset:r=4,...o}){return p.jsx(GH,{"data-slot":"popover-content",align:t,sideOffset:r,className:$.cn("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-20 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...o})}const HH=s$("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 WH(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 JH(e,t){if(t==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return e}function KH(e){return typeof e=="object"&&e!==null&&"content"in e&&Array.isArray(e.content)}function K1({status:e}){return p.jsxs("div",{className:$.cn(HH({status:e})),children:[e==="pending"&&null,e==="running"&&p.jsx(bs,{className:"size-4 animate-spin"}),e==="complete"&&p.jsx(Nr,{className:"size-4"}),e==="error"&&p.jsx(xo,{className:"size-4"}),e==="approval"&&p.jsx(bs,{className:"text-muted-foreground size-4 animate-spin"})]})}function YH({content:e}){const[t,r]=A.useState(!1),o=async n=>{n.stopPropagation(),await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),2e3)};return p.jsx("button",{onClick:o,className:"text-muted-foreground hover:bg-accent hover:text-foreground rounded p-1 transition-colors","aria-label":"Copy to clipboard",children:t?p.jsx(Nr,{className:"size-4"}):p.jsx(Fm,{className:"size-4"})})}function Y1({text:e,language:t,className:r}){const[o,n]=A.useState(null);return A.useEffect(()=>{t&&iO.codeToHtml(e,{lang:t,theme:"github-dark-default",rootStyle:"background-color: transparent;",transformers:[{pre(i){i.properties.class="w-full py-3 px-4 max-h-[300px] overflow-y-auto whitespace-pre-wrap text-left text-sm"}}]}).then(n)},[e,t]),o?p.jsx("div",{className:$.cn("w-full bg-slate-800/90",r),dangerouslySetInnerHTML:{__html:o}}):p.jsx("pre",{className:$.cn("w-full bg-slate-800/90 px-4 py-3 text-sm whitespace-pre-wrap text-slate-100",r),children:e})}function XH({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%),
143
- linear-gradient(135deg, #ccc 25%, transparent 25%),
144
- linear-gradient(45deg, transparent 75%, #ccc 75%),
145
- 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 QH({content:e}){return p.jsx("div",{className:"w-full",children:e.content.map((t,r)=>{switch(t.type){case"text":{const o=WH(t._meta?.["getgram.ai/mime-type"]??"text/plain"),n=JH(t.text,o);return p.jsx(Y1,{text:n,language:o},r)}case"image":return p.jsx(XH,{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 Bv({title:e,content:t,defaultExpanded:r=!1,highlightSyntax:o=!0,language:n="json"}){const[i,a]=A.useState(r),s=KH(t),c=s?JSON.stringify(t,null,2):typeof t=="string"?t:JSON.stringify(t,null,2);return p.jsxs("div",{"data-slot":"tool-ui-section",className:"border-border border-t",children:[p.jsxs("button",{onClick:()=>a(!i),className:"hover:bg-accent/50 flex w-full cursor-pointer items-center justify-between px-5 py-2.5 text-left transition-colors",children:[p.jsx("span",{className:"text-muted-foreground text-sm",children:e}),p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx(YH,{content:c}),p.jsx(VE,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",i&&"rotate-90")})]})]}),i&&p.jsx("div",{className:"border-border border-t",children:s?p.jsx(QH,{content:t}):o?p.jsx(Y1,{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 e7({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]=A.useState(a),h=n!==void 0||i!==void 0,[g,y]=A.useState("one-time"),[b,w]=A.useState(!1);A.useEffect(()=>{!d&&f&&!a&&m(!1)},[d]);const x=()=>{g==="for-session"&&l?l():c&&c()};return p.jsxs("div",{"data-slot":"tool-ui",className:$.cn("border-border bg-card overflow-hidden rounded-lg border",s),children:[r&&p.jsxs("div",{"data-slot":"tool-ui-provider",className:$.cn("border-border flex items-center gap-2 border-b px-4 py-2.5"),children:[t?p.jsx("span",{className:"flex size-5 items-center justify-center",children:t}):p.jsx("span",{className:"bg-muted flex size-5 items-center justify-center rounded text-xs font-medium",children:r.charAt(0).toUpperCase()}),p.jsx("span",{className:"text-sm font-medium",children:r})]}),p.jsxs("button",{onClick:()=>h&&m(!f),disabled:!h,className:$.cn("flex w-full items-center gap-2 px-4 py-3 text-left",h&&"hover:bg-accent/50 cursor-pointer transition-colors"),children:[p.jsx(K1,{status:o}),p.jsx("span",{className:$.cn("flex-1 text-sm",!r&&d&&"shimmer"),children:e}),h&&p.jsx(ys,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",f&&"rotate-180")})]}),f&&h&&p.jsxs("div",{"data-slot":"tool-ui-content",children:[n!==void 0&&p.jsx(Bv,{title:"Arguments",content:n,highlightSyntax:!0,language:"json"}),i!==void 0&&p.jsx(Bv,{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(pt,{variant:"outline",size:"sm",onClick:u,className:"text-destructive hover:bg-destructive/10",children:[p.jsx(xo,{className:"mr-1 size-3"}),"Deny"]}),p.jsxs("div",{className:"flex items-center",children:[p.jsxs(pt,{variant:"default",size:"sm",onClick:x,className:"flex cursor-pointer justify-between gap-1 rounded-r-none bg-emerald-600 hover:bg-emerald-700",children:[p.jsx(Nr,{className:"mr-1 size-3"}),p.jsx("span",{className:"min-w-[110px]",children:g==="one-time"?"Approve this time":"Approve always"})]}),p.jsxs(H1,{open:b,onOpenChange:w,children:[p.jsx(W1,{asChild:!0,children:p.jsx(pt,{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(ys,{className:"size-3"})})}),p.jsxs(J1,{align:"end",className:"w-64 p-1",sideOffset:4,children:[p.jsxs("button",{onClick:()=>{y("one-time"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(Nr,{className:$.cn("relative top-1 mt-0.5 size-3 shrink-0",g!=="one-time"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve only once"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"You'll be asked again next time"})]})]}),l&&p.jsxs("button",{onClick:()=>{y("for-session"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(Nr,{className:$.cn("relative top-1 mt-0.5 size-3 shrink-0",g!=="for-session"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve always"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"Trust this tool for the session"})]})]})]})]})]})]})]})]})}function t7({title:e,icon:t,status:r="complete",defaultExpanded:o=!1,children:n,className:i}){const[a,s]=A.useState(o);return p.jsxs("div",{"data-slot":"tool-ui-group",className:$.cn("border-border bg-card overflow-hidden rounded-lg border",i),children:[p.jsxs("button",{onClick:()=>s(!a),className:"hover:bg-accent/50 flex w-full items-center gap-2 px-4 py-3 text-left transition-colors",children:[t||p.jsx(K1,{status:r==="running"?"running":"complete"}),p.jsx("span",{className:$.cn("flex-1 text-sm font-medium",r==="running"&&"shimmer"),children:e}),p.jsx(ys,{className:$.cn("text-muted-foreground size-4 transition-transform duration-200",a&&"rotate-180")})]}),a&&p.jsx("div",{"data-slot":"tool-ui-group-content",className:"border-border border-t",children:n})]})}const r7=({toolName:e,toolCallId:t,status:r,result:o,args:n})=>{const{pendingApprovals:i,whitelistTool:a,confirmPendingApproval:s,rejectPendingApproval:c}=PS(),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)},h=()=>{a(e),s(t)},g=()=>{c(t)},y=()=>l?"approval":r.type==="incomplete"?"error":r.type==="complete"?o&&typeof o=="object"&&"isError"in o&&o.isError?"error":"complete":"running",b=()=>{if(o!==void 0)return typeof o=="object"&&o!==null&&"content"in o&&Array.isArray(o.content)||typeof o=="string",o};return p.jsx("div",{className:$.cn("aui-tool-fallback-root flex w-full flex-col",f!==-1&&f!==d.length-1&&"border-b"),children:p.jsx(e7,{name:e,status:y(),request:n,result:b(),onApproveOnce:l?m:void 0,onApproveForSession:l?h:void 0,onDeny:l?g:void 0,className:"rounded-none border-0"})})},rr=[.23,1,.32,1],qv=/@(\w+)/g;function n7(e){return e?Object.entries(e).map(([t,r])=>({id:t,name:t,description:typeof r=="object"&&r!==null&&"description"in r?String(r.description??""):void 0})):[]}function o7(e,t){if(!t||!e)return[];const r=Object.keys(t),o=[];let n;for(qv.lastIndex=0;(n=qv.exec(e))!==null;)o.push(n[1].toLowerCase());const i=r.filter(a=>o.includes(a.toLowerCase()));return[...new Set(i)]}function i7(e,t){const r=e.slice(0,t),o=r.lastIndexOf("@");if(o===-1)return{isInMention:!1,query:"",atPosition:-1};const n=r.slice(o+1);return n.includes(" ")||n.includes(`
146
- `)?{isInMention:!1,query:"",atPosition:-1}:{isInMention:!0,query:n.toLowerCase(),atPosition:o}}function a7(e,t){if(!t)return e;const r=t.toLowerCase();return e.filter(o=>{const n=o.name.toLowerCase().includes(r),i=o.description?.toLowerCase().includes(r);return n||i})}function s7(e,t,r,o){const n=e.slice(0,r),i=e.slice(o),a=`${n}@${t} ${i}`,s=r+t.length+2;return{text:a,cursorPosition:s}}function c7(e,t){const r=new RegExp(`@${t}\\s?`,"gi");return e.replace(r,"")}const l7=({tools:e,value:t,cursorPosition:r,onValueChange:o,textareaRef:n,className:i})=>{const[a,s]=A.useState(0),[c,l]=A.useState(!1),[u,d]=A.useState([]),[f,m]=A.useState(null),h=A.useRef(null),g=$.useDensity(),y=$.useRadius();A.useEffect(()=>{const w=i7(t,r);if(w.isInMention&&e.length>0){const x=a7(e,w.query);d(x),l(x.length>0),m({atPosition:w.atPosition,query:w.query}),s(0)}else l(!1),m(null)},[t,r,e]);const b=A.useCallback(w=>{if(!f)return;const x=s7(t,w.name,f.atPosition,r);o(x.text,x.cursorPosition),l(!1)},[f,t,r,o,n]);return A.useEffect(()=>{if(!c)return;const w=v=>{switch(v.key){case"ArrowDown":v.preventDefault(),v.stopPropagation(),s(k=>(k+1)%u.length);break;case"ArrowUp":v.preventDefault(),v.stopPropagation(),s(k=>(k-1+u.length)%u.length);break;case"Enter":case"Tab":v.preventDefault(),v.stopPropagation(),u[a]&&b(u[a]);break;case"Escape":v.preventDefault(),v.stopPropagation(),l(!1);break}},x=n.current;if(x)return x.addEventListener("keydown",w,{capture:!0}),()=>x.removeEventListener("keydown",w,{capture:!0})},[c,u,a,b,n]),A.useEffect(()=>{if(!c)return;const w=h.current;if(!w)return;const x=w.querySelector(`[data-index="${a}"]`);x&&x.scrollIntoView({block:"nearest"})},[a,c]),A.useEffect(()=>{if(!c)return;const w=x=>{h.current&&!h.current.contains(x.target)&&n.current&&!n.current.contains(x.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c,n]),A.useEffect(()=>{const w=n.current;if(!w)return;const x=w.closest(".aui-composer-root");return x?(c?requestAnimationFrame(()=>{const k=h.current;if(k&&c){x.style.borderTopColor="var(--ring)",x.style.borderTopLeftRadius="0",x.style.borderTopRightRadius="0";const E=x.getBoundingClientRect(),I=k.offsetParent;if(I){const C=I.getBoundingClientRect();k.style.left=`${E.left-C.left}px`,k.style.right="auto",k.style.width=`${E.width}px`}}}):(x.style.borderTopColor="",x.style.borderTopLeftRadius="",x.style.borderTopRightRadius=""),()=>{x.style.borderTopColor="",x.style.borderTopLeftRadius="",x.style.borderTopRightRadius=""}):void 0},[c,n]),!c||u.length===0?null:p.jsx(Lt.div,{ref:h,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15,ease:rr},className:$.cn("aui-tool-mention-autocomplete border-ring bg-background absolute bottom-full z-50 max-h-[220px] overflow-clip overflow-y-auto overscroll-contain rounded-br-none! rounded-bl-none! border border-b-0 shadow-xs",y("xl"),i),children:p.jsx("div",{className:"flex flex-col gap-1",children:u.map((w,x)=>p.jsxs("button",{type:"button","data-index":x,className:$.cn("aui-tool-mention-item flex w-full items-center gap-2 text-left transition-colors",g("p-sm"),"hover:bg-accent hover:text-accent-foreground",x===a&&"bg-accent text-accent-foreground"),onClick:v=>{v.preventDefault(),v.stopPropagation(),b(w)},onMouseEnter:()=>s(x),children:[p.jsx(BE,{className:"mt-0.5 size-4 flex-shrink-0 opacity-50"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"text-sm font-medium",children:w.name}),w.description&&p.jsx("div",{className:"text-muted-foreground line-clamp-2 text-xs",children:w.description})]})]},w.id))})})},u7=({mentionedToolIds:e,tools:t,onRemove:r,className:o})=>{const n=$.useDensity(),i=t.filter(a=>e.includes(a.id));return i.length===0?null:p.jsxs("div",{className:$.cn("aui-mentioned-tools-badges flex flex-wrap items-center gap-1",n("px-sm"),n("py-xs"),o),children:[p.jsx("span",{className:"text-muted-foreground flex-shrink-0 text-xs",children:"Tools:"}),p.jsx(bt.AnimatePresence,{mode:"popLayout",children:i.map(a=>p.jsx(Lt.div,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.15,ease:rr},children:p.jsx(d7,{tool:a,onRemove:r?()=>r(a.id):void 0})},a.id))})]})},d7=({tool:e,onRemove:t})=>{const r=$.useDensity(),o=$.useRadius();return p.jsxs("div",{className:$.cn("aui-tool-badge bg-primary/10 text-primary inline-flex items-center gap-1",o("md"),r("px-sm"),r("py-xs")),children:[p.jsx(BE,{className:"size-3 flex-shrink-0"}),p.jsx("span",{className:"text-xs font-medium",children:e.name}),t&&p.jsx("button",{type:"button",onClick:n=>{n.preventDefault(),n.stopPropagation(),t()},className:"hover:opacity-70 focus:outline-none","aria-label":`Remove ${e.name}`,children:p.jsx(xo,{className:"size-3 flex-shrink-0"})})]})};function f7({tools:e,enabled:t=!0}){const[r,o]=A.useState(0),n=A.useRef(null),i=M.useAssistantApi(),a=M.useAssistantState(({composer:m})=>m.text),s=A.useMemo(()=>n7(e),[e]),c=A.useMemo(()=>t?o7(a,e):[],[a,e,t]),l=A.useCallback(()=>{const m=n.current;m&&o(m.selectionStart)},[]),u=A.useCallback((m,h)=>{i.composer().setText(m),o(h),setTimeout(()=>{const g=n.current;g&&(g.focus(),g.setSelectionRange(h,h))},0)},[i]),d=A.useCallback(m=>{const h=s.find(g=>g.id===m);if(h){const g=c7(a,h.name);i.composer().setText(g)}},[a,s,i]),f=t&&s.length>0;return{mentionableTools:s,mentionedToolIds:c,value:a,cursorPosition:r,textareaRef:n,updateCursorPosition:l,handleAutocompleteChange:u,removeMention:d,isActive:f}}const fl=()=>{const{config:e}=$.useElements(),t=e.theme??{};return A.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])},m7=({state:e,isOnline:t})=>{const r=e==="reconnecting",o=!t,n=o&&e==="disconnected",i=r||o&&e!=="connected";return p.jsx("div",{className:$.cn("pointer-events-auto flex items-center gap-2 rounded-full px-4 py-2 shadow-lg backdrop-blur-md","border",n||i?"border-zinc-200 bg-white text-zinc-900 dark:border-zinc-700 dark:bg-zinc-900 dark:text-white":"border-red-200 bg-red-500/90 text-white dark:border-red-800 dark:bg-red-600/90"),children:n?p.jsxs(p.Fragment,{children:[p.jsx(bh,{className:"size-4"}),p.jsx("span",{className:"text-sm font-medium",children:"Offline"})]}):i?p.jsxs(p.Fragment,{children:[p.jsx($.LoaderCircle,{className:"size-4 animate-spin"}),p.jsx("span",{className:"text-sm font-medium",children:"Reconnecting..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(bh,{className:"size-4"}),p.jsx("span",{className:"text-sm font-medium",children:"Connection Lost"})]})})},p7=({className:e})=>{const t=r$();if(!t)return null;const{state:r,isOnline:o}=t,n=r==="reconnecting"||r==="disconnected";return p.jsx(bt.AnimatePresence,{children:n&&p.jsx(bt.motion.div,{initial:{opacity:0,y:-20,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-20,scale:.95},transition:{type:"spring",stiffness:500,damping:30},className:$.cn("pointer-events-none absolute top-4 right-0 left-0 z-50 flex justify-center",e),children:p.jsx(m7,{state:r,isOnline:o})})})};function g7(e){return e.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const h7=({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}=$.useElements(),i=n.tools?.expandToolGroupsByDefault??!1,a=A.useMemo(()=>{const s=t.filter(c=>c.type==="tool-call");return s.length===0?"No tools called":s.length===1?`Calling ${g7(s[0].toolName)}...`:o?`Calling ${s.length} tools...`:`Executed ${s.length} tools`},[t,o]);return n.tools?.components?.[r[0]?.toolName]?e:r.length===1?p.jsx("div",{className:$.cn("my-4 w-full max-w-xl"),children:p.jsx("div",{className:"border-border bg-card overflow-hidden rounded-lg border",children:e})}):p.jsx("div",{className:"my-4 w-full max-w-xl",children:p.jsx(t7,{title:a,status:o?"running":"complete",defaultExpanded:i,children:e})})},v7=()=>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."})]}),Ap=({className:e})=>{const t=fl(),r=$.useDensity(),{config:o}=$.useElements(),n=o.components??{},i=o.api&&"sessionToken"in o.api;return p.jsx(bt.LazyMotion,{features:bt.domAnimation,children:p.jsx(bt.MotionConfig,{reducedMotion:"user",children:p.jsxs(M.ThreadPrimitive.Root,{className:$.cn("aui-root aui-thread-root bg-background @container relative flex h-full flex-col",t.className,e),children:[p.jsx(p7,{}),p.jsxs(M.ThreadPrimitive.Viewport,{className:$.cn("aui-thread-viewport relative mx-auto flex w-full flex-1 flex-col overflow-x-auto overflow-y-scroll pb-0!",r("p-lg")),children:[p.jsx(M.ThreadPrimitive.If,{empty:!0,children:n.ThreadWelcome?p.jsx(n.ThreadWelcome,{}):p.jsx(b7,{})}),i&&p.jsx(v7,{}),p.jsx(M.ThreadPrimitive.Messages,{components:{UserMessage:n.UserMessage??O7,EditComposer:n.EditComposer??C7,AssistantMessage:n.AssistantMessage??I7}}),p.jsx(M.ThreadPrimitive.If,{empty:!1,children:p.jsx("div",{className:"aui-thread-viewport-spacer min-h-8 grow"})}),p.jsx(x7,{})]})]})})})},y7=()=>p.jsx(M.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:p.jsx(Ht,{tooltip:"Scroll to bottom",variant:"outline",className:"aui-thread-scroll-to-bottom dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible",children:p.jsx(FL,{})})}),b7=()=>{const{config:e}=$.useElements(),t=$.useDensity(),{title:r,subtitle:o}=e.welcome??{},n=e.variant==="standalone";return p.jsxs("div",{className:$.cn("aui-thread-welcome-root my-auto flex w-full grow flex-col",n?"items-center justify-center":"",t("gap-lg")),children:[p.jsx("div",{className:$.cn("aui-thread-welcome-center flex w-full grow flex-col items-center justify-start"),children:p.jsxs("div",{className:$.cn("aui-thread-welcome-message flex flex-col",n?"items-center text-center":"size-full justify-start",t("gap-sm"),!n&&t("py-md")),children:[p.jsx(Lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,ease:rr},className:$.cn("aui-thread-welcome-message-motion-1 text-foreground font-semibold",t("text-title")),children:r}),p.jsx(Lt.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,delay:.05,ease:rr},className:$.cn("aui-thread-welcome-message-motion-2 text-muted-foreground/65",t("text-subtitle")),children:o})]})}),p.jsx(_7,{})]})},_7=()=>{const{config:e}=$.useElements(),t=$.useRadius(),r=$.useDensity(),o=e.welcome?.suggestions??[],n=e.variant==="standalone";return o.length===0?null:p.jsx("div",{className:$.cn("aui-thread-welcome-suggestions w-full",r("gap-md"),r("py-lg"),n?"flex flex-wrap items-center justify-center":o.length===1?"flex":"grid max-w-fit @md:grid-cols-2"),children:o.map((i,a)=>p.jsx(Lt.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.25,delay:.03*a,ease:rr},className:$.cn("aui-thread-welcome-suggestion-display",!n&&"nth-[n+3]:hidden @md:nth-[n+3]:block"),children:p.jsx(M.ThreadPrimitive.Suggestion,{prompt:i.prompt,send:!0,asChild:!0,children:p.jsxs(pt,{variant:"ghost",className:$.cn("aui-thread-welcome-suggestion dark:hover:bg-accent/60 h-auto w-full border text-left whitespace-break-spaces",r("text-base"),n?`flex-row items-center ${r("gap-sm")} ${r("px-md")} ${r("py-sm")} ${t("full")}`:`w-full flex-1 flex-col flex-wrap items-start justify-start ${r("gap-sm")} ${r("px-lg")} ${r("py-md")} ${t("xl")}`),"aria-label":i.prompt,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}`))})},w7=({tools:e})=>{const t=A.useRef(null),{mentionableTools:r,mentionedToolIds:o,value:n,cursorPosition:i,textareaRef:a,updateCursorPosition:s,handleAutocompleteChange:c,removeMention:l,isActive:u}=f7({tools:e});return A.useEffect(()=>{if(!u)return;const d=()=>{const h=document.querySelector(".aui-composer-input");if(h&&a.current!==h){a.current=h;const g=()=>s();return h.addEventListener("click",g),h.addEventListener("keyup",g),h.addEventListener("input",g),()=>{h.removeEventListener("click",g),h.removeEventListener("keyup",g),h.removeEventListener("input",g)}}},f=d(),m=new MutationObserver(()=>{d()});return m.observe(document.body,{childList:!0,subtree:!0}),()=>{f?.(),m.disconnect()}},[u,a,s]),u?p.jsxs("div",{ref:t,className:"aui-composer-tool-mentions relative",children:[p.jsx(u7,{mentionedToolIds:o,tools:r,onRemove:l}),p.jsx(bt.AnimatePresence,{children:p.jsx(l7,{tools:r,value:n,cursorPosition:i,onValueChange:c,textareaRef:a})})]}):null},x7=()=>{const{config:e,mcpTools:t}=$.useElements(),r=$.useRadius(),o=$.useDensity(),n=e.composer??{placeholder:"Send a message...",attachments:!0},i=e.components??{},a=n.toolMentions===void 0||n.toolMentions===!0||typeof n.toolMentions=="object"&&n.toolMentions.enabled!==!1,s=A.useRef(null);return i.Composer?p.jsx(i.Composer,{}):p.jsxs("div",{className:$.cn("aui-composer-wrapper bg-background sticky bottom-0 flex w-full flex-col overflow-visible",o("gap-md"),o("py-md"),r("xl")),children:[p.jsx(y7,{}),p.jsxs(M.ComposerPrimitive.Root,{ref:s,className:$.cn("aui-composer-root group/input-group border-input bg-background has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-ring/5 dark:bg-background relative flex w-full flex-col border px-1 pt-2 shadow-xs transition-[color,box-shadow] outline-none has-[textarea:focus-visible]:ring-1",r("xl")),children:[n.attachments&&p.jsx(hH,{}),a&&p.jsx(w7,{tools:t}),p.jsx(M.ComposerPrimitive.Input,{placeholder:n.placeholder,className:$.cn("aui-composer-input placeholder:text-muted-foreground mb-1 max-h-32 w-full resize-none bg-transparent px-3.5 pt-1.5 pb-3 outline-none focus-visible:ring-0",o("h-input"),o("text-base")),rows:1,autoFocus:!0,"aria-label":"Message input"}),p.jsx(k7,{})]})]})},S7=()=>{const{model:e,setModel:t}=$.useElements(),[r,o]=A.useState(!1),[n,i]=A.useState(!1),a=A.useRef(null),s=A.useRef(0),c=A.useRef(!1);A.useEffect(()=>{r&&!c.current&&requestAnimationFrame(()=>{const u=a.current;u&&u.scrollHeight>0&&(u.scrollTop=s.current)}),c.current=r},[r]),A.useEffect(()=>{r&&i(!1)},[r]);const l=u=>{s.current=u.currentTarget.scrollTop};return p.jsx(H$,{children:p.jsxs(il,{open:n&&!r,onOpenChange:i,children:[p.jsxs(H1,{open:r,onOpenChange:o,children:[p.jsx(al,{asChild:!0,children:p.jsx(W1,{asChild:!0,children:p.jsx(pt,{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(v5,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})})}),p.jsx(J1,{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:Lm.map(u=>p.jsxs(pt,{onClick:()=>{t(u)},variant:"ghost",className:"w-full justify-start gap-2 rounded-none px-2",children:[u===e?p.jsx("div",{children:p.jsx(Nr,{className:"size-4 text-emerald-500"})}):p.jsx("div",{className:"size-4",children:" "}),u]},u))})})]}),p.jsx(sl,{side:"bottom",align:"start",children:"Model Settings"})]})})},k7=()=>{const{config:e}=$.useElements(),t=$.useRadius(),r=e.composer??{attachments:!0};return p.jsxs("div",{className:"aui-composer-action-wrapper relative mx-1 mt-2 mb-2 flex items-center justify-between",children:[p.jsxs("div",{className:"aui-composer-action-wrapper-inner flex items-center",children:[r.attachments?p.jsx(vH,{}):p.jsx("div",{className:"aui-composer-add-attachment-placeholder"}),e.model?.showModelPicker&&!e.languageModel&&p.jsx(S7,{})]}),p.jsx(M.ThreadPrimitive.If,{running:!1,children:p.jsx(M.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(Ht,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:$.cn("aui-composer-send size-[34px] p-1",t("full")),"aria-label":"Send message",children:p.jsx(ZL,{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(pt,{type:"button",variant:"default",size:"icon",className:$.cn("aui-composer-cancel border-muted-foreground/60 hover:bg-primary/75 dark:border-muted-foreground/90 size-[34px] border",t("full")),"aria-label":"Stop generating",children:p.jsx(b5,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})},E7=()=>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"})})}),I7=()=>{const{config:e}=$.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??$1,Image:r.Image??T7,tools:{by_name:t.components,Fallback:r.ToolFallback??r7},Reasoning:r.Reasoning??z1,ReasoningGroup:r.ReasoningGroup??D1,ToolGroup:r.ToolGroup??h7}}),p.jsx(E7,{})]}),p.jsx("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex",children:p.jsx($7,{})})]})})},T7=e=>p.jsx("img",{src:e.image}),$7=()=>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(Ht,{tooltip:"Copy",children:[p.jsx(M.MessagePrimitive.If,{copied:!0,children:p.jsx(Nr,{})}),p.jsx(M.MessagePrimitive.If,{copied:!1,children:p.jsx(Fm,{})})]})})}),O7=()=>{const e=$.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(gH,{}),p.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[p.jsx("div",{className:$.cn("aui-user-message-content bg-muted text-foreground px-5 py-2.5 wrap-break-word",e("xl")),children:p.jsx(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(A7,{})})]}),p.jsx(N7,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]})})},A7=()=>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(Ht,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:p.jsx(p5,{})})})}),C7=()=>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(pt,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),p.jsx(M.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(pt,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),N7=({className:e,...t})=>p.jsxs(M.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:$.cn("aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs",e),...t,children:[p.jsx(M.BranchPickerPrimitive.Previous,{asChild:!0,children:p.jsx(Ht,{tooltip:"Previous",children:p.jsx(JL,{})})}),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(Ht,{tooltip:"Next",children:p.jsx(VE,{})})})]});function R7({className:e,...t}){return p.jsx("div",{"data-slot":"skeleton",className:$.cn("bg-accent animate-pulse rounded-md",e),...t})}const Cp=({className:e})=>{const t=$.useDensity();return p.jsxs(M.ThreadListPrimitive.Root,{className:$.cn("aui-root aui-thread-list-root bg-background flex flex-col items-stretch",t("gap-sm"),e),children:[p.jsx("div",{className:$.cn("aui-thread-list-new-section border-b pb-2",t("py-sm"),t("px-sm")),children:p.jsx(P7,{})}),p.jsx("div",{className:$.cn("aui-thread-list-items-section flex flex-col gap-1",t("py-xs"),t("px-sm")),children:p.jsx(j7,{})})]})},P7=()=>{const e=$.useDensity();return p.jsx(M.ThreadListPrimitive.New,{asChild:!0,children:p.jsxs(pt,{className:$.cn("aui-thread-list-new hover:bg-muted-foreground/10 data-[active=true]:bg-muted-foreground/20! flex w-full cursor-pointer items-center justify-start gap-1 rounded-lg px-2.5 py-2 text-start",e("p-sm"),e("py-xs")),variant:"ghost",children:[p.jsx(ZE,{}),"New Thread"]})})},j7=()=>M.useAssistantState(({threads:t})=>t.isLoading)?p.jsx(z7,{}):p.jsx(M.ThreadListPrimitive.Items,{components:{ThreadListItem:D7}}),z7=()=>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(R7,{className:"aui-thread-list-skeleton h-[22px] grow"})},t))}),D7=()=>{const e=$.useRadius(),t=$.useDensity();return p.jsx(M.ThreadListItemPrimitive.Root,{className:$.cn("aui-thread-list-item group hover:bg-muted focus-visible:bg-muted focus-visible:ring-ring data-[active=true]:bg-muted-foreground/20 flex items-center gap-2 rounded-lg transition-all focus-visible:ring-2 focus-visible:outline-none",e("md")),children:p.jsx(M.ThreadListItemPrimitive.Trigger,{className:$.cn("aui-thread-list-item-trigger flex grow cursor-pointer items-center text-start",t("px-lg"),t("py-sm")),children:p.jsx(M7,{})})})},M7=()=>p.jsx("span",{className:"aui-thread-list-item-title text-sm",children:p.jsx(M.ThreadListItemPrimitive.Title,{fallback:"New Chat"})}),X1=()=>{const{config:e,isExpanded:t,setIsExpanded:r}=$.useElements(),o=e.variant==="sidecar"?e.sidecar:e.modal,n=o?.expandable??!1,i=o?.defaultExpanded??!1;return{expandable:n,isExpanded:t,setIsExpanded:r,defaultExpanded:i}},U7={layout:{duration:.25,ease:rr}},L7=({className:e})=>{const{config:t}=$.useElements(),r=fl(),o=$.useRadius(),n=$.useDensity(),[i,a]=A.useState(t.modal?.defaultOpen??!1),{expandable:s,isExpanded:c,setIsExpanded:l}=X1(),u=t.modal?.title,d=t.modal?.icon,f=t.history?.enabled&&t.history?.showThreadList!==!1,m=t.modal?.position??"bottom-right",h=F7(m),g=A.useMemo(()=>t.modal?.dimensions?.default??{width:"500px",height:"600px",maxHeight:"95vh"},[t.modal?.dimensions?.default]),y=A.useMemo(()=>t.modal?.dimensions?.expanded??{width:"70vw",height:"90vh"},[t.modal?.dimensions?.expanded]),w=M.useAssistantState(({thread:E})=>E)?.messages?.some(E=>E.status?.type==="running")??!1,x=c?y.width:g.width,v=c?y.height:g.height,k=g.maxHeight;return p.jsx(bt.LazyMotion,{features:bt.domMax,children:p.jsx(bt.MotionConfig,{reducedMotion:"user",transition:U7,children:p.jsx("div",{className:$.cn("aui-root aui-modal-anchor fixed z-10",h,r.className,o("lg"),i&&"shadow-xl",e),children:p.jsx(bt.AnimatePresence,{mode:"wait",children:i?p.jsxs(Lt.div,{layout:!0,layoutId:"chat-container",className:$.cn("aui-modal-content bg-popover text-popover-foreground flex flex-col overflow-hidden border [&>.aui-thread-root]:bg-inherit",o("lg")),initial:!1,style:{originX:m.includes("left")?0:1,originY:m.includes("top")?0:1,width:x,height:v,maxHeight:k},children:[p.jsxs(Lt.div,{className:$.cn("aui-modal-header flex shrink-0 items-center justify-between border-b",n("h-header"),n("px-lg")),initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1,ease:rr},children:[p.jsx("div",{className:$.cn("flex min-w-0 items-center"),children:p.jsxs("span",{className:$.cn("text-foreground text-md flex items-center gap-2 truncate font-medium",w&&"title-shimmer"),children:[p.jsx("span",{className:"truncate",children:u}),w&&p.jsx(bs,{className:"text-muted-foreground size-4.5 animate-spin",strokeWidth:1.25})]})}),p.jsxs("div",{className:"flex flex-row items-center justify-end gap-1",children:[s?p.jsx("button",{type:"button",onClick:()=>l(E=>!E),className:$.cn("text-muted-foreground hover:text-foreground hover:bg-accent flex h-8 cursor-pointer items-center rounded-md px-2 text-xs transition-colors"),"aria-pressed":c,"aria-label":c?"Collapse assistant":"Expand assistant",children:c?p.jsx(c5,{strokeWidth:2,className:"size-3.5 rotate-90"}):p.jsx(o5,{strokeWidth:2,className:"size-3.5 rotate-90"})}):null,p.jsx("button",{onClick:()=>{a(!1),l(!1)},className:"text-muted-foreground hover:text-foreground hover:bg-accent -mr-1 flex size-8 cursor-pointer items-center justify-center rounded-md transition-colors","aria-label":`Close ${u}`,children:p.jsx(xo,{className:"size-4.5"})})]})]}),p.jsxs(Lt.div,{className:"aui-modal-body flex flex-1 overflow-hidden",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.05,ease:rr},children:[f&&p.jsx("div",{className:"aui-modal-thread-list w-56 shrink-0 overflow-y-auto border-r",children:p.jsx(Cp,{})}),p.jsx("div",{className:"aui-modal-thread w-full flex-1 overflow-hidden",children:p.jsx(ip,{children:p.jsx(Ap,{})})})]})]},"chat"):p.jsx(Lt.button,{layout:!0,layoutId:"chat-container",onClick:()=>a(!0),className:$.cn("aui-modal-button bg-primary text-primary-foreground flex size-12 cursor-pointer items-center justify-center border shadow-lg transition-shadow hover:shadow-xl",o("full")),initial:!1,"aria-label":`Open ${u}`,style:{originX:1,originY:1},children:p.jsx(Lt.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:rr},className:"flex size-full items-center justify-center",children:d?d("closed"):p.jsx(a5,{className:"size-6"})})},"button")})})})})};function F7(e){switch(e){case"bottom-left":return"left-4 bottom-4";case"top-right":return"right-4 top-4";case"top-left":return"left-4 top-4";case"bottom-right":return"right-4 bottom-4";default:$.assertNever(e)}}const V7=({className:e})=>{const{config:t}=$.useElements(),r=fl(),o=t.sidecar??{},{title:n,dimensions:i}=o,{expandable:a,isExpanded:s,setIsExpanded:c}=X1(),u=M.useAssistantState(({thread:f})=>f).messages.some(f=>f.status?.type==="running"),d=t.history?.enabled&&t.history?.showThreadList!==!1;return p.jsx(bt.LazyMotion,{features:bt.domMax,children:p.jsxs(Lt.div,{initial:!1,animate:{width:s?i?.expanded?.width??"800px":i?.default?.width??"400px"},transition:{duration:.3,ease:rr},className:$.cn("aui-root aui-sidecar bg-popover text-popover-foreground fixed top-0 right-0 bottom-0 flex flex-col border-l",r.className,e),children:[p.jsxs("div",{className:"aui-sidecar-header flex h-14 shrink-0 items-center justify-between border-b px-4",children:[p.jsxs("span",{className:$.cn("text-foreground text-md flex items-center gap-2 font-medium",u&&"title-shimmer"),children:[n,u&&p.jsx(bs,{className:"text-muted-foreground size-4.5 animate-spin",strokeWidth:1.25})]}),a&&p.jsx("div",{className:"aui-sidecar-header-actions flex items-center gap-1",children:p.jsx(Ht,{tooltip:s?"Collapse":"Pop out",variant:"ghost",className:"aui-sidecar-popout size-8",onClick:()=>c(f=>!f),children:s?p.jsx(u5,{className:"size-4.5"}):p.jsx(f5,{className:"size-4.5"})})})]}),p.jsxs("div",{className:"aui-sidecar-body flex min-h-0 flex-1 overflow-hidden",children:[d&&p.jsx("div",{className:"aui-sidecar-thread-list w-56 shrink-0 overflow-y-auto border-r",children:p.jsx(Cp,{})}),p.jsx("div",{className:"aui-sidecar-content flex-1 overflow-hidden",children:p.jsx(ip,{children:p.jsx(Ap,{})})})]})]})})};function Z7({containerRef:e,children:t}){return p.jsx(q$.Provider,{value:e,children:t})}const vu=`@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-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia: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-100:oklch(93.6% .032 17.717);--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-600:oklch(57.7% .245 27.325);--color-red-800:oklch(44.4% .177 26.899);--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-100:oklch(96.2% .044 156.743);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--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-zinc-200:oklch(92% .004 286.32);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-900:oklch(21% .006 285.885);--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;--blur-md:12px;--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-auto{pointer-events:auto}.gram-elements .pointer-events-none{pointer-events:none}.gram-elements .collapse{visibility:collapse}.gram-elements .invisible{visibility:hidden}.gram-elements .visible{visibility:visible}.gram-elements .sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.gram-elements .absolute{position:absolute}.gram-elements .fixed{position:fixed}.gram-elements .relative{position:relative}.gram-elements .static{position:static}.gram-elements .sticky{position:sticky}.gram-elements .inset-0{inset:calc(var(--spacing)*0)}.gram-elements .inset-x-0{inset-inline:calc(var(--spacing)*0)}.gram-elements .-top-10{top:calc(var(--spacing)*-10)}.gram-elements .-top-12{top:calc(var(--spacing)*-12)}.gram-elements .top-0{top:calc(var(--spacing)*0)}.gram-elements .top-1{top:calc(var(--spacing)*1)}.gram-elements .top-1\\.5{top:calc(var(--spacing)*1.5)}.gram-elements .top-1\\/2{top:50%}.gram-elements .top-4{top:calc(var(--spacing)*4)}.gram-elements .top-8{top:calc(var(--spacing)*8)}.gram-elements .top-\\[50\\%\\]{top:50%}.gram-elements .-right-10{right:calc(var(--spacing)*-10)}.gram-elements .right-0{right:calc(var(--spacing)*0)}.gram-elements .right-1\\.5{right:calc(var(--spacing)*1.5)}.gram-elements .right-2{right:calc(var(--spacing)*2)}.gram-elements .right-4{right:calc(var(--spacing)*4)}.gram-elements .-bottom-10{bottom:calc(var(--spacing)*-10)}.gram-elements .bottom-0{bottom:calc(var(--spacing)*0)}.gram-elements .bottom-2{bottom:calc(var(--spacing)*2)}.gram-elements .bottom-4{bottom:calc(var(--spacing)*4)}.gram-elements .bottom-full{bottom:100%}.gram-elements .-left-10{left:calc(var(--spacing)*-10)}.gram-elements .left-0{left:calc(var(--spacing)*0)}.gram-elements .left-2{left:calc(var(--spacing)*2)}.gram-elements .left-4{left:calc(var(--spacing)*4)}.gram-elements .left-\\[50\\%\\]{left:50%}.gram-elements .z-0{z-index:0}.gram-elements .z-10{z-index:10}.gram-elements .z-20{z-index:20}.gram-elements .z-50{z-index:50}.gram-elements .col-span-full{grid-column:1/-1}.gram-elements .col-start-1{grid-column-start:1}.gram-elements .col-start-2{grid-column-start:2}.gram-elements .col-start-3{grid-column-start:3}.gram-elements .row-start-1{grid-row-start:1}.gram-elements .row-start-2{grid-row-start:2}.gram-elements .row-start-3{grid-row-start:3}.gram-elements .container{width:100%}@media(min-width:40rem){.gram-elements .container{max-width:40rem}}@media(min-width:48rem){.gram-elements .container{max-width:48rem}}@media(min-width:64rem){.gram-elements .container{max-width:64rem}}@media(min-width:80rem){.gram-elements .container{max-width:80rem}}@media(min-width:96rem){.gram-elements .container{max-width:96rem}}.gram-elements .m-0{margin:calc(var(--spacing)*0)}.gram-elements .m-2{margin:calc(var(--spacing)*2)}.gram-elements .m-auto{margin:auto}.gram-elements .mx-1{margin-inline:calc(var(--spacing)*1)}.gram-elements .mx-2{margin-inline:calc(var(--spacing)*2)}.gram-elements .mx-3{margin-inline:calc(var(--spacing)*3)}.gram-elements .mx-4{margin-inline:calc(var(--spacing)*4)}.gram-elements .mx-auto{margin-inline:auto}.gram-elements .my-4{margin-block:calc(var(--spacing)*4)}.gram-elements .my-5{margin-block:calc(var(--spacing)*5)}.gram-elements .my-auto{margin-block:auto}.gram-elements .mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.gram-elements .mt-2{margin-top:calc(var(--spacing)*2)}.gram-elements .mt-4{margin-top:calc(var(--spacing)*4)}.gram-elements .mt-5{margin-top:calc(var(--spacing)*5)}.gram-elements .mt-6{margin-top:calc(var(--spacing)*6)}.gram-elements .mt-8{margin-top:calc(var(--spacing)*8)}.gram-elements .mt-16{margin-top:calc(var(--spacing)*16)}.gram-elements .-mr-1{margin-right:calc(var(--spacing)*-1)}.gram-elements .mr-1{margin-right:calc(var(--spacing)*1)}.gram-elements .mr-2{margin-right:calc(var(--spacing)*2)}.gram-elements .mr-\\[400px\\]{margin-right:400px}.gram-elements .mr-\\[600px\\]{margin-right:600px}.gram-elements .-mb-2{margin-bottom:calc(var(--spacing)*-2)}.gram-elements .mb-1{margin-bottom:calc(var(--spacing)*1)}.gram-elements .mb-2{margin-bottom:calc(var(--spacing)*2)}.gram-elements .mb-3{margin-bottom:calc(var(--spacing)*3)}.gram-elements .mb-4{margin-bottom:calc(var(--spacing)*4)}.gram-elements .mb-5{margin-bottom:calc(var(--spacing)*5)}.gram-elements .mb-8{margin-bottom:calc(var(--spacing)*8)}.gram-elements .-ml-1{margin-left:calc(var(--spacing)*-1)}.gram-elements .-ml-2{margin-left:calc(var(--spacing)*-2)}.gram-elements .ml-2{margin-left:calc(var(--spacing)*2)}.gram-elements .ml-6{margin-left:calc(var(--spacing)*6)}.gram-elements .ml-auto{margin-left:auto}.gram-elements .line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.gram-elements .block{display:block}.gram-elements .flex{display:flex}.gram-elements .grid{display:grid}.gram-elements .hidden{display:none}.gram-elements .inline-block{display:inline-block}.gram-elements .inline-flex{display:inline-flex}.gram-elements .table{display:table}.gram-elements .aspect-square{aspect-ratio:1}.gram-elements .size-2\\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.gram-elements .size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.gram-elements .size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.gram-elements .size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.gram-elements .size-4\\.5{width:calc(var(--spacing)*4.5);height:calc(var(--spacing)*4.5)}.gram-elements .size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.gram-elements .size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.gram-elements .size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.gram-elements .size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.gram-elements .size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.gram-elements .size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.gram-elements .size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.gram-elements .size-\\[34px\\]{width:34px;height:34px}.gram-elements .size-full{width:100%;height:100%}.gram-elements .h-0\\.5{height:calc(var(--spacing)*.5)}.gram-elements .h-3{height:calc(var(--spacing)*3)}.gram-elements .h-4{height:calc(var(--spacing)*4)}.gram-elements .h-8{height:calc(var(--spacing)*8)}.gram-elements .h-9{height:calc(var(--spacing)*9)}.gram-elements .h-10{height:calc(var(--spacing)*10)}.gram-elements .h-10\\/12{height:83.3333%}.gram-elements .h-12{height:calc(var(--spacing)*12)}.gram-elements .h-14{height:calc(var(--spacing)*14)}.gram-elements .h-16{height:calc(var(--spacing)*16)}.gram-elements .h-32{height:calc(var(--spacing)*32)}.gram-elements .h-40{height:calc(var(--spacing)*40)}.gram-elements .h-48{height:calc(var(--spacing)*48)}.gram-elements .h-96{height:calc(var(--spacing)*96)}.gram-elements .h-\\[22px\\]{height:22px}.gram-elements .h-auto{height:auto}.gram-elements .h-full{height:100%}.gram-elements .h-screen{height:100vh}.gram-elements .max-h-32{max-height:calc(var(--spacing)*32)}.gram-elements .max-h-48{max-height:calc(var(--spacing)*48)}.gram-elements .max-h-\\[80dvh\\]{max-height:80dvh}.gram-elements .max-h-\\[80vh\\]{max-height:80vh}.gram-elements .max-h-\\[220px\\]{max-height:220px}.gram-elements .max-h-\\[300px\\]{max-height:300px}.gram-elements .max-h-\\[800px\\]{max-height:800px}.gram-elements .min-h-0{min-height:calc(var(--spacing)*0)}.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-\\[200px\\]{max-width:200px}.gram-elements .max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.gram-elements .max-w-fit{max-width:fit-content}.gram-elements .max-w-full{max-width:100%}.gram-elements .max-w-md{max-width:var(--container-md)}.gram-elements .max-w-xl{max-width:var(--container-xl)}.gram-elements .min-w-0{min-width:calc(var(--spacing)*0)}.gram-elements .min-w-\\[110px\\]{min-width:110px}.gram-elements .min-w-\\[400px\\]{min-width:400px}.gram-elements .flex-1{flex:1}.gram-elements .flex-3{flex:3}.gram-elements .flex-none{flex:none}.gram-elements .flex-shrink-0,.gram-elements .shrink-0{flex-shrink:0}.gram-elements .grow{flex-grow:1}.gram-elements .border-collapse{border-collapse:collapse}.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-inside{list-style-position:inside}.gram-elements .list-decimal{list-style-type:decimal}.gram-elements .list-disc{list-style-type:disc}.gram-elements .auto-rows-auto{grid-auto-rows:auto}.gram-elements .grid-cols-\\[minmax\\(72px\\,1fr\\)_auto\\]{grid-template-columns:minmax(72px,1fr) auto}.gram-elements .flex-col{flex-direction:column}.gram-elements .flex-col-reverse{flex-direction:column-reverse}.gram-elements .flex-row{flex-direction:row}.gram-elements .flex-wrap{flex-wrap:wrap}.gram-elements .items-center{align-items:center}.gram-elements .items-end{align-items:flex-end}.gram-elements .items-start{align-items:flex-start}.gram-elements .items-stretch{align-items:stretch}.gram-elements .justify-between{justify-content:space-between}.gram-elements .justify-center{justify-content:center}.gram-elements .justify-end{justify-content:flex-end}.gram-elements .justify-start{justify-content:flex-start}.gram-elements .gap-0\\.5{gap:calc(var(--spacing)*.5)}.gram-elements .gap-1{gap:calc(var(--spacing)*1)}.gram-elements .gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gram-elements .gap-2{gap:calc(var(--spacing)*2)}.gram-elements .gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gram-elements .gap-3{gap:calc(var(--spacing)*3)}.gram-elements .gap-4{gap:calc(var(--spacing)*4)}.gram-elements .gap-6{gap:calc(var(--spacing)*6)}:where(.gram-elements .space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.gram-elements .space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.gram-elements .gap-y-2{row-gap:calc(var(--spacing)*2)}.gram-elements .self-center{align-self:center}.gram-elements .self-end{align-self:flex-end}.gram-elements .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.gram-elements .overflow-auto{overflow:auto}.gram-elements .overflow-clip{overflow:clip}.gram-elements .overflow-hidden{overflow:hidden}.gram-elements .overflow-visible{overflow:visible}.gram-elements .overflow-x-auto{overflow-x:auto}.gram-elements .overflow-y-auto{overflow-y:auto}.gram-elements .overflow-y-scroll{overflow-y:scroll}.gram-elements .overscroll-contain{overscroll-behavior:contain}.gram-elements .rounded{border-radius:.25rem}.gram-elements .rounded-2xl{border-radius:var(--radius-2xl)}.gram-elements .rounded-3xl{border-radius:var(--radius-3xl)}.gram-elements .rounded-\\[2px\\]{border-radius:2px}.gram-elements .rounded-\\[14px\\]{border-radius:14px}.gram-elements .rounded-full{border-radius:3.40282e38px}.gram-elements .rounded-lg{border-radius:var(--radius)}.gram-elements .rounded-md{border-radius:calc(var(--radius) - 2px)}.gram-elements .rounded-none{border-radius:0}.gram-elements .rounded-sm{border-radius:calc(var(--radius) - 4px)}.gram-elements .rounded-xl{border-radius:calc(var(--radius) + 4px)}.gram-elements .rounded-xs{border-radius:var(--radius-xs)}.gram-elements .rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.gram-elements .rounded-t-none\\!{border-top-left-radius:0!important;border-top-right-radius:0!important}.gram-elements .rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.gram-elements .rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.gram-elements .rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.gram-elements .rounded-br-none\\!{border-bottom-right-radius:0!important}.gram-elements .rounded-bl-none\\!{border-bottom-left-radius:0!important}.gram-elements .border{border-style:var(--tw-border-style);border-width:1px}.gram-elements .border-0{border-style:var(--tw-border-style);border-width:0}.gram-elements .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.gram-elements .border-t-0{border-top-style:var(--tw-border-style);border-top-width:0}.gram-elements .border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.gram-elements .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.gram-elements .border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.gram-elements .border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.gram-elements .border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.gram-elements .border-dashed{--tw-border-style:dashed;border-style:dashed}.gram-elements .border-amber-500{border-color:var(--color-amber-500)}.gram-elements .border-border{border-color:var(--border)}.gram-elements .border-destructive{border-color:var(--destructive)}.gram-elements .border-emerald-700{border-color:var(--color-emerald-700)}.gram-elements .border-foreground\\/20{border-color:var(--foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-foreground\\/20{border-color:color-mix(in oklab,var(--foreground)20%,transparent)}}.gram-elements .border-input{border-color:var(--input)}.gram-elements .border-muted-foreground\\/50{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-muted-foreground\\/50{border-color:color-mix(in oklab,var(--muted-foreground)50%,transparent)}}.gram-elements .border-muted-foreground\\/60{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-muted-foreground\\/60{border-color:color-mix(in oklab,var(--muted-foreground)60%,transparent)}}.gram-elements .border-red-200{border-color:var(--color-red-200)}.gram-elements .border-ring{border-color:var(--ring)}.gram-elements .border-zinc-200{border-color:var(--color-zinc-200)}.gram-elements .bg-accent{background-color:var(--accent)}.gram-elements .bg-amber-100{background-color:var(--color-amber-100)}.gram-elements .bg-background{background-color:var(--background)}.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-100{background-color:var(--color-green-100)}.gram-elements .bg-green-500{background-color:var(--color-green-500)}.gram-elements .bg-muted{background-color:var(--muted)}.gram-elements .bg-muted-foreground\\/15{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-muted-foreground\\/15{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .bg-muted\\/50{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-muted\\/50{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.gram-elements .bg-popover{background-color:var(--popover)}.gram-elements .bg-primary,.gram-elements .bg-primary\\/10{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-primary\\/10{background-color:color-mix(in oklab,var(--primary)10%,transparent)}}.gram-elements .bg-red-100{background-color:var(--color-red-100)}.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-red-500\\/90{background-color:#fb2c36e6}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-red-500\\/90{background-color:color-mix(in oklab,var(--color-red-500)90%,transparent)}}.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-0\\.5{padding-block:calc(var(--spacing)*.5)}.gram-elements .py-1{padding-block:calc(var(--spacing)*1)}.gram-elements .py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.gram-elements .py-2{padding-block:calc(var(--spacing)*2)}.gram-elements .py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.gram-elements .py-3{padding-block:calc(var(--spacing)*3)}.gram-elements .py-4{padding-block:calc(var(--spacing)*4)}.gram-elements .py-6{padding-block:calc(var(--spacing)*6)}.gram-elements .py-10{padding-block:calc(var(--spacing)*10)}.gram-elements .pt-0\\.5{padding-top:calc(var(--spacing)*.5)}.gram-elements .pt-1\\.5{padding-top:calc(var(--spacing)*1.5)}.gram-elements .pt-2{padding-top:calc(var(--spacing)*2)}.gram-elements .pt-4{padding-top:calc(var(--spacing)*4)}.gram-elements .pr-2{padding-right:calc(var(--spacing)*2)}.gram-elements .pb-0\\!{padding-bottom:calc(var(--spacing)*0)!important}.gram-elements .pb-1{padding-bottom:calc(var(--spacing)*1)}.gram-elements .pb-2{padding-bottom:calc(var(--spacing)*2)}.gram-elements .pb-3{padding-bottom:calc(var(--spacing)*3)}.gram-elements .pl-6{padding-left:calc(var(--spacing)*6)}.gram-elements .text-center{text-align:center}.gram-elements .text-left{text-align:left}.gram-elements .text-right{text-align:right}.gram-elements .text-start{text-align:start}.gram-elements .font-mono{font-family:var(--font-mono)}.gram-elements .text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.gram-elements .text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.gram-elements .text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.gram-elements .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.gram-elements .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.gram-elements .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.gram-elements .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.gram-elements .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.gram-elements .leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.gram-elements .leading-none{--tw-leading:1;line-height:1}.gram-elements .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.gram-elements .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.gram-elements .font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.gram-elements .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.gram-elements .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.gram-elements .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.gram-elements .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.gram-elements .text-balance{text-wrap:balance}.gram-elements .wrap-break-word{overflow-wrap:break-word}.gram-elements .whitespace-break-spaces{white-space:break-spaces}.gram-elements .whitespace-nowrap{white-space:nowrap}.gram-elements .whitespace-pre-wrap{white-space:pre-wrap}.gram-elements .text-accent-foreground{color:var(--accent-foreground)}.gram-elements .text-amber-500{color:var(--color-amber-500)}.gram-elements .text-amber-700{color:var(--color-amber-700)}.gram-elements .text-amber-800{color:var(--color-amber-800)}.gram-elements .text-background{color:var(--background)}.gram-elements .text-destructive{color:var(--destructive)}.gram-elements .text-emerald-500{color:var(--color-emerald-500)}.gram-elements .text-foreground{color:var(--foreground)}.gram-elements .text-green-600{color:var(--color-green-600)}.gram-elements .text-green-800{color:var(--color-green-800)}.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-800{color:var(--color-red-800)}.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 .text-zinc-900{color:var(--color-zinc-900)}.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 .backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.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-0:last-child{border-style:var(--tw-border-style);border-width:0}.gram-elements .last\\:border-r:last-child{border-right-style:var(--tw-border-style);border-right-width:1px}.gram-elements .empty\\:hidden:empty{display:none}@media(hover:hover){.gram-elements .hover\\:\\!bg-white:hover{background-color:var(--color-white)!important}.gram-elements .hover\\:bg-accent:hover,.gram-elements .hover\\:bg-accent\\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-accent\\/50:hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.gram-elements .hover\\:bg-destructive\\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-destructive\\/10:hover{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.gram-elements .hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.gram-elements .hover\\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.gram-elements .hover\\:bg-muted:hover{background-color:var(--muted)}.gram-elements .hover\\:bg-muted-foreground\\/10:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-muted-foreground\\/10:hover{background-color:color-mix(in oklab,var(--muted-foreground)10%,transparent)}}.gram-elements .hover\\:bg-muted-foreground\\/15:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-muted-foreground\\/15:hover{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .hover\\:bg-primary\\/75:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-primary\\/75:hover{background-color:color-mix(in oklab,var(--primary)75%,transparent)}}.gram-elements .hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.gram-elements .hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.gram-elements .hover\\:text-accent-foreground:hover{color:var(--accent-foreground)}.gram-elements .hover\\:text-amber-800:hover{color:var(--color-amber-800)}.gram-elements .hover\\:text-foreground:hover{color:var(--foreground)}.gram-elements .hover\\:underline:hover{text-decoration-line:underline}.gram-elements .hover\\:opacity-70:hover{opacity:.7}.gram-elements .hover\\:opacity-75:hover{opacity:.75}.gram-elements .hover\\:opacity-100:hover{opacity:1}.gram-elements .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.gram-elements .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus\\:ring-ring:focus{--tw-ring-color:var(--ring)}.gram-elements .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.gram-elements .focus\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media(forced-colors:active){.gram-elements .focus\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.gram-elements .focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.gram-elements .focus-visible\\:border-ring:focus-visible{border-color:var(--ring)}.gram-elements .focus-visible\\:bg-muted:focus-visible{background-color:var(--muted)}.gram-elements .focus-visible\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .focus-visible\\:ring-destructive\\/20:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.gram-elements .focus-visible\\:ring-ring:focus-visible,.gram-elements .focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.gram-elements .focus-visible\\:ring-ring\\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.gram-elements .focus-visible\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.gram-elements .disabled\\:pointer-events-none:disabled{pointer-events:none}.gram-elements .disabled\\:invisible:disabled{visibility:hidden}.gram-elements .disabled\\:opacity-50:disabled{opacity:.5}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:border-ring:has(:is(textarea:focus-visible)){border-color:var(--ring)}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-1:has(:is(textarea:focus-visible)){--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-ring\\/5:has(:is(textarea:focus-visible)){--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){.gram-elements .has-\\[textarea\\:focus-visible\\]\\:ring-ring\\/5:has(:is(textarea:focus-visible)){--tw-ring-color:color-mix(in oklab,var(--ring)5%,transparent)}}.gram-elements .has-\\[\\>svg\\]\\:px-2\\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.gram-elements .has-\\[\\>svg\\]\\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.gram-elements .has-\\[\\>svg\\]\\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.gram-elements .aria-invalid\\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.gram-elements .aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab,red,red)){.gram-elements .aria-invalid\\:ring-destructive\\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.gram-elements .data-floating\\:absolute[data-floating]{position:absolute}.gram-elements .data-floating\\:rounded-md[data-floating]{border-radius:calc(var(--radius) - 2px)}.gram-elements .data-floating\\:border[data-floating]{border-style:var(--tw-border-style);border-width:1px}.gram-elements .data-floating\\:bg-background[data-floating]{background-color:var(--background)}.gram-elements .data-floating\\:p-1[data-floating]{padding:calc(var(--spacing)*1)}.gram-elements .data-floating\\:shadow-sm[data-floating]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20[data-active=true]{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20[data-active=true]{background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20\\![data-active=true]{background-color:var(--muted-foreground)!important}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[active\\=true\\]\\:bg-muted-foreground\\/20\\![data-active=true]{background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)!important}}.gram-elements .data-\\[side\\=bottom\\]\\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:calc(2*var(--spacing)*-1)}.gram-elements .data-\\[side\\=left\\]\\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:calc(2*var(--spacing))}.gram-elements .data-\\[side\\=right\\]\\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:calc(2*var(--spacing)*-1)}.gram-elements .data-\\[side\\=top\\]\\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:calc(2*var(--spacing))}.gram-elements .data-\\[state\\=closed\\]\\:pointer-events-none[data-state=closed]{pointer-events:none}.gram-elements .data-\\[state\\=closed\\]\\:scale-100[data-state=closed]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.gram-elements .data-\\[state\\=closed\\]\\:rotate-0[data-state=closed]{rotate:none}.gram-elements .data-\\[state\\=closed\\]\\:animate-collapsible-up[data-state=closed]{animation:collapsible-up var(--tw-animation-duration,var(--tw-duration,.2s))var(--tw-ease,ease-out)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=closed\\]\\:animate-out[data-state=closed]{animation:exit var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=closed\\]\\:duration-\\(--animation-duration\\)[data-state=closed]{--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .data-\\[state\\=closed\\]\\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.gram-elements .data-\\[state\\=closed\\]\\:fill-mode-forwards[data-state=closed]{--tw-animation-fill-mode:forwards;animation-fill-mode:forwards}.gram-elements .data-\\[state\\=closed\\]\\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.gram-elements .data-\\[state\\=open\\]\\:scale-0[data-state=open]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.gram-elements .data-\\[state\\=open\\]\\:rotate-90[data-state=open]{rotate:90deg}.gram-elements .data-\\[state\\=open\\]\\:animate-collapsible-down[data-state=open]{animation:collapsible-down var(--tw-animation-duration,var(--tw-duration,.2s))var(--tw-ease,ease-out)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=open\\]\\:animate-in[data-state=open]{animation:enter var(--tw-animation-duration,var(--tw-duration,.15s))var(--tw-ease,ease)var(--tw-animation-delay,0s)var(--tw-animation-iteration-count,1)var(--tw-animation-direction,normal)var(--tw-animation-fill-mode,none)}.gram-elements .data-\\[state\\=open\\]\\:bg-accent[data-state=open]{background-color:var(--accent)}.gram-elements .data-\\[state\\=open\\]\\:bg-muted-foreground\\/15[data-state=open]{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[state\\=open\\]\\:bg-muted-foreground\\/15[data-state=open]{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .data-\\[state\\=open\\]\\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}.gram-elements .data-\\[state\\=open\\]\\:duration-\\(--animation-duration\\)[data-state=open]{--tw-duration:var(--animation-duration);transition-duration:var(--animation-duration)}.gram-elements .data-\\[state\\=open\\]\\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.gram-elements .data-\\[state\\=open\\]\\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.gram-elements .nth-\\[n\\+3\\]\\:hidden:nth-child(n+3){display:none}@media(prefers-reduced-motion:reduce){.gram-elements .motion-reduce\\:animate-none{animation:none}}@media(min-width:40rem){.gram-elements .sm\\:w-3\\/4{width:75%}.gram-elements .sm\\:max-w-3xl{max-width:var(--container-3xl)}.gram-elements .sm\\:max-w-lg{max-width:var(--container-lg)}.gram-elements .sm\\:flex-row{flex-direction:row}.gram-elements .sm\\:justify-end{justify-content:flex-end}.gram-elements .sm\\:text-left{text-align:left}}@container (min-width:28rem){.gram-elements .\\@md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.gram-elements .\\@md\\:nth-\\[n\\+3\\]\\:block:nth-child(n+3){display:block}}.gram-elements .dark\\:border-amber-600:is(.dark *){border-color:var(--color-amber-600)}.gram-elements .dark\\:border-input:is(.dark *){border-color:var(--input)}.gram-elements .dark\\:border-muted-foreground\\/15:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:border-muted-foreground\\/15:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.gram-elements .dark\\:border-muted-foreground\\/90:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:border-muted-foreground\\/90:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)90%,transparent)}}.gram-elements .dark\\:border-red-800:is(.dark *){border-color:var(--color-red-800)}.gram-elements .dark\\:border-zinc-700:is(.dark *){border-color:var(--color-zinc-700)}.gram-elements .dark\\:bg-amber-900:is(.dark *){background-color:var(--color-amber-900)}.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-green-900:is(.dark *){background-color:var(--color-green-900)}.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\\:bg-red-600\\/90:is(.dark *){background-color:#e40014e6}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:bg-red-600\\/90:is(.dark *){background-color:color-mix(in oklab,var(--color-red-600)90%,transparent)}}.gram-elements .dark\\:bg-red-900:is(.dark *){background-color:var(--color-red-900)}.gram-elements .dark\\:bg-zinc-900:is(.dark *){background-color:var(--color-zinc-900)}.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-100:is(.dark *){color:var(--color-amber-100)}.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-100:is(.dark *){color:var(--color-green-100)}.gram-elements .dark\\:text-green-500:is(.dark *){color:var(--color-green-500)}.gram-elements .dark\\:text-red-100:is(.dark *){color:var(--color-red-100)}.gram-elements .dark\\:text-red-200:is(.dark *){color:var(--color-red-200)}.gram-elements .dark\\:text-white:is(.dark *){color:var(--color-white)}@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}@keyframes title-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.gram-elements .title-shimmer{background:linear-gradient(90deg,var(--foreground)0%,var(--muted-foreground)50%,var(--foreground)100%);-webkit-text-fill-color:transparent;background-size:200% 100%;-webkit-background-clip:text;background-clip:text;animation:1.5s ease-in-out infinite title-shimmer}@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-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{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}}`,Ha=({children:e,hostClassName:t,hostStyle:r})=>{const o=A.useRef(null),n=A.useRef(null),[i,a]=A.useState(null),{config:s}=$.useElements(),c=fl(),l=A.useMemo(()=>$.cn(yd,c.className),[c.className]);return A.useEffect(()=>{const u=o.current;if(!u)return;const d=u.shadowRoot??u.attachShadow({mode:"open"});a(d)},[]),A.useEffect(()=>{if(!i)return;const u=i.querySelector("style[data-gram-elements]");if(u){u.textContent=vu;return}const d=document.createElement("style");d.setAttribute("data-gram-elements","true"),d.textContent=vu,i.prepend(d)},[i,vu]),p.jsx("div",{ref:o,className:t,style:r,children:i?hd.createPortal(p.jsx("div",{ref:n,className:l,"data-radius":s.theme?.radius,style:s.variant==="standalone"?{height:"100%",width:"100%"}:void 0,children:p.jsx(Z7,{containerRef:n,children:e})}),i):null})},B7=({className:e})=>{const{config:t}=$.useElements();switch(t.variant){case"standalone":return p.jsx(ip,{children:p.jsx(Ha,{hostStyle:{height:"100%",width:"100%"},children:p.jsx(Ap,{})})});case"sidecar":return p.jsx(Ha,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(V7,{})});default:return p.jsx(Ha,{children:p.jsx(L7,{className:e})})}},q7=({className:e})=>p.jsx(Ha,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(Cp,{className:e})});function G7({onShare:e,buildShareUrl:t,variant:r="ghost",size:o="sm",className:n,children:i}){const{threadId:a}=n$(),s=A.useCallback(async()=>{if(!a){e?.({error:new Error("No chat to share yet. Send a message first.")});return}try{const c=t?t(a):(()=>{const l=new URL(window.location.href);return l.searchParams.set("threadId",a),l.toString()})();await navigator.clipboard.writeText(c),e?.({url:c})}catch(c){e?.({error:c instanceof Error?c:new Error("Failed to copy link")})}},[a,t,e]);return p.jsxs(il,{children:[p.jsx(al,{asChild:!0,children:p.jsx(pt,{variant:r,size:o,onClick:s,disabled:!a,className:$.cn("aui-share-button",n),"aria-label":"Share chat",children:i??p.jsxs(p.Fragment,{children:[p.jsx(t5,{className:"mr-2 size-4"}),"Share chat"]})})}),p.jsx(sl,{children:a?"Copy chat link to clipboard":"Send a message first to share"})]})}exports.ActionType=Fc;exports.CENSORED_IMG_MARK=g4;exports.CENSORED_STRING_MARK=Ua;exports.Chat=B7;exports.ChatHistory=q7;exports.ElementsProvider=nB;exports.MODELS=Lm;exports.NodePrivacyLevel=ce;exports.ONE_SECOND=Ke;exports.PRIVACY_ATTR_NAME=Dm;exports.PRIVACY_ATTR_VALUE_HIDDEN=m4;exports.RumEventType=re;exports.ShareButton=G7;exports.addEventListener=Oe;exports.addEventListeners=hr;exports.addRecord=iL;exports.addSegment=oL;exports.addTelemetryDebug=_o;exports.addTelemetryMetrics=ta;exports.addWroteData=aL;exports.buildTags=Im;exports.buildUrl=Yi;exports.canUseEventBridge=sn;exports.clearTimeout=yt;exports.clocksNow=Ue;exports.clocksOrigin=bm;exports.createHttpRequest=Om;exports.currentDrift=VS;exports.defineFrontendTool=ML;exports.display=ee;exports.elapsed=Ne;exports.forEachChildNodes=e4;exports.getEventBridge=yo;exports.getGlobalObject=Tt;exports.getMutationObserverConstructor=Kk;exports.getNodePrivacyLevel=na;exports.getNodeSelfPrivacyLevel=pE;exports.getParentNode=sE;exports.getScrollX=LU;exports.getScrollY=NE;exports.getSegmentsCount=nL;exports.getTextContent=y4;exports.getViewportDimension=Bc;exports.hasChildNodes=QM;exports.initViewportObservable=RE;exports.instrumentMethod=Bt;exports.instrumentSetter=L2;exports.isNodeShadowHost=jm;exports.isNodeShadowRoot=aE;exports.isPageExitReason=Ik;exports.isSafari=Sj;exports.jsonStringify=ho;exports.monitor=ie;exports.monitorError=pr;exports.noop=be;exports.objectEntries=zc;exports.reducePrivacyLevel=mE;exports.relativeToClocks=Wi;exports.requestIdleCallback=Dk;exports.sanitizeIfLongDataUrl=tE;exports.sendToExtension=Tm;exports.setTimeout=Je;exports.shouldMaskAttribute=gE;exports.shouldMaskNode=Mm;exports.supportPerformanceTimingEvent=Zr;exports.throttle=Ki;exports.timeStampNow=Be;exports.trackError=hs;exports.useThreadId=n$;
147
- //# sourceMappingURL=index-CVYyyxfm.cjs.map