@gram-ai/elements 1.25.2 → 1.26.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 (160) hide show
  1. package/dist/components/Chat/stories/Charts.stories.d.ts +37 -0
  2. package/dist/components/Chat/stories/GenerativeUI.stories.d.ts +17 -0
  3. package/dist/components/ui/button.d.ts +1 -1
  4. package/dist/components/ui/buttonVariants.d.ts +1 -1
  5. package/dist/components/ui/charts.stories.d.ts +43 -0
  6. package/dist/components/ui/generative-ui.stories.d.ts +53 -0
  7. package/dist/elements.cjs +1 -1
  8. package/dist/elements.css +1 -1
  9. package/dist/elements.js +6 -6
  10. package/dist/index-BJnv49-A.js +37057 -0
  11. package/dist/index-BJnv49-A.js.map +1 -0
  12. package/dist/index-BpJstUh1.cjs +280 -0
  13. package/dist/index-BpJstUh1.cjs.map +1 -0
  14. package/dist/index-CUitXazZ.js +30426 -0
  15. package/dist/index-CUitXazZ.js.map +1 -0
  16. package/dist/index-ChW-CSuu.cjs +147 -0
  17. package/dist/index-ChW-CSuu.cjs.map +1 -0
  18. package/dist/plugins/chart/catalog.d.ts +123 -0
  19. package/dist/plugins/chart/index.d.ts +1 -1
  20. package/dist/plugins/chart/ui/area-chart.d.ts +16 -0
  21. package/dist/plugins/chart/ui/bar-chart.d.ts +16 -0
  22. package/dist/plugins/chart/ui/donut-chart.d.ts +17 -0
  23. package/dist/plugins/chart/ui/index.d.ts +7 -0
  24. package/dist/plugins/chart/ui/line-chart.d.ts +17 -0
  25. package/dist/plugins/chart/ui/pie-chart.d.ts +15 -0
  26. package/dist/plugins/chart/ui/radar-chart.d.ts +14 -0
  27. package/dist/plugins/chart/ui/scatter-chart.d.ts +18 -0
  28. package/dist/plugins/components/MacOSWindowFrame.d.ts +13 -0
  29. package/dist/plugins/components/PluginLoadingState.d.ts +1 -1
  30. package/dist/plugins/generative-ui/catalog.d.ts +293 -0
  31. package/dist/plugins/generative-ui/ui/accordion-wrapper.d.ts +18 -0
  32. package/dist/plugins/generative-ui/ui/accordion.d.ts +7 -0
  33. package/dist/plugins/generative-ui/ui/action-button.d.ts +10 -0
  34. package/dist/plugins/generative-ui/ui/alert-wrapper.d.ts +9 -0
  35. package/dist/plugins/generative-ui/ui/alert.d.ts +9 -0
  36. package/dist/plugins/generative-ui/ui/avatar-wrapper.d.ts +9 -0
  37. package/dist/plugins/generative-ui/ui/avatar.d.ts +11 -0
  38. package/dist/plugins/generative-ui/ui/badge.d.ts +12 -0
  39. package/dist/plugins/generative-ui/ui/button-wrapper.d.ts +15 -0
  40. package/dist/plugins/generative-ui/ui/button.d.ts +10 -0
  41. package/dist/plugins/generative-ui/ui/card-wrapper.d.ts +10 -0
  42. package/dist/plugins/generative-ui/ui/card.d.ts +9 -0
  43. package/dist/plugins/generative-ui/ui/checkbox-wrapper.d.ts +10 -0
  44. package/dist/plugins/generative-ui/ui/checkbox.d.ts +4 -0
  45. package/dist/plugins/generative-ui/ui/data-table.d.ts +10 -0
  46. package/dist/plugins/generative-ui/ui/dialog.d.ts +17 -0
  47. package/dist/plugins/generative-ui/ui/dropdown-menu.d.ts +25 -0
  48. package/dist/plugins/generative-ui/ui/grid.d.ts +6 -0
  49. package/dist/plugins/generative-ui/ui/index.d.ts +40 -0
  50. package/dist/plugins/generative-ui/ui/input-wrapper.d.ts +11 -0
  51. package/dist/plugins/generative-ui/ui/input.d.ts +3 -0
  52. package/dist/plugins/generative-ui/ui/label.d.ts +4 -0
  53. package/dist/plugins/generative-ui/ui/list.d.ts +6 -0
  54. package/dist/plugins/generative-ui/ui/metric.d.ts +7 -0
  55. package/dist/plugins/generative-ui/ui/pagination.d.ts +13 -0
  56. package/dist/plugins/generative-ui/ui/popover.d.ts +10 -0
  57. package/dist/plugins/generative-ui/ui/progress.d.ts +10 -0
  58. package/dist/plugins/generative-ui/ui/radio-group.d.ts +5 -0
  59. package/dist/plugins/generative-ui/ui/select-wrapper.d.ts +13 -0
  60. package/dist/plugins/generative-ui/ui/select.d.ts +15 -0
  61. package/dist/plugins/generative-ui/ui/separator.d.ts +4 -0
  62. package/dist/plugins/generative-ui/ui/skeleton-wrapper.d.ts +9 -0
  63. package/dist/plugins/generative-ui/ui/skeleton.d.ts +2 -0
  64. package/dist/plugins/generative-ui/ui/stack.d.ts +8 -0
  65. package/dist/plugins/generative-ui/ui/switch.d.ts +6 -0
  66. package/dist/plugins/generative-ui/ui/table.d.ts +10 -0
  67. package/dist/plugins/generative-ui/ui/tabs-wrapper.d.ts +21 -0
  68. package/dist/plugins/generative-ui/ui/tabs.d.ts +11 -0
  69. package/dist/plugins/generative-ui/ui/text.d.ts +7 -0
  70. package/dist/plugins/generative-ui/ui/textarea.d.ts +3 -0
  71. package/dist/plugins/generative-ui/ui/tooltip.d.ts +7 -0
  72. package/dist/plugins.cjs +1 -1
  73. package/dist/plugins.js +1 -1
  74. package/dist/{profiler-BaG0scxd.js → profiler-D4Tw5ecI.js} +2 -2
  75. package/dist/{profiler-BaG0scxd.js.map → profiler-D4Tw5ecI.js.map} +1 -1
  76. package/dist/{profiler-CuqENACf.cjs → profiler-DCWYDZ1F.cjs} +2 -2
  77. package/dist/{profiler-CuqENACf.cjs.map → profiler-DCWYDZ1F.cjs.map} +1 -1
  78. package/dist/{startRecording-BiLmoqZa.cjs → startRecording-3sTskM3H.cjs} +2 -2
  79. package/dist/{startRecording-BiLmoqZa.cjs.map → startRecording-3sTskM3H.cjs.map} +1 -1
  80. package/dist/{startRecording-86bHmd-l.js → startRecording-BHhcCWQE.js} +2 -2
  81. package/dist/{startRecording-86bHmd-l.js.map → startRecording-BHhcCWQE.js.map} +1 -1
  82. package/package.json +4 -1
  83. package/src/components/Chat/stories/Charts.stories.tsx +260 -0
  84. package/src/components/Chat/stories/ConnectionConfiguration.stories.tsx +6 -6
  85. package/src/components/Chat/stories/GenerativeUI.stories.tsx +113 -0
  86. package/src/components/Replay.stories.tsx +1 -1
  87. package/src/components/Replay.tsx +18 -13
  88. package/src/components/ui/charts.stories.tsx +246 -0
  89. package/src/components/ui/generative-ui.stories.tsx +557 -0
  90. package/src/components/ui/generative-ui.tsx +60 -360
  91. package/src/components/ui/tool-ui.stories.tsx +6 -3
  92. package/src/hooks/useAuth.ts +17 -1
  93. package/src/hooks/useFollowOnSuggestions.ts +6 -1
  94. package/src/plugins/chart/catalog.ts +141 -0
  95. package/src/plugins/chart/component.tsx +79 -125
  96. package/src/plugins/chart/index.ts +141 -89
  97. package/src/plugins/chart/ui/area-chart.tsx +133 -0
  98. package/src/plugins/chart/ui/bar-chart.tsx +137 -0
  99. package/src/plugins/chart/ui/donut-chart.tsx +167 -0
  100. package/src/plugins/chart/ui/index.ts +7 -0
  101. package/src/plugins/chart/ui/line-chart.tsx +135 -0
  102. package/src/plugins/chart/ui/pie-chart.tsx +148 -0
  103. package/src/plugins/chart/ui/radar-chart.tsx +105 -0
  104. package/src/plugins/chart/ui/scatter-chart.tsx +132 -0
  105. package/src/plugins/components/MacOSWindowFrame.tsx +55 -0
  106. package/src/plugins/components/PluginLoadingState.tsx +9 -13
  107. package/src/plugins/generative-ui/catalog.ts +277 -0
  108. package/src/plugins/generative-ui/component.tsx +112 -21
  109. package/src/plugins/generative-ui/index.ts +20 -141
  110. package/src/plugins/generative-ui/ui/accordion-wrapper.tsx +57 -0
  111. package/src/plugins/generative-ui/ui/accordion.tsx +66 -0
  112. package/src/plugins/generative-ui/ui/action-button.tsx +68 -0
  113. package/src/plugins/generative-ui/ui/alert-wrapper.tsx +26 -0
  114. package/src/plugins/generative-ui/ui/alert.tsx +66 -0
  115. package/src/plugins/generative-ui/ui/avatar-wrapper.tsx +22 -0
  116. package/src/plugins/generative-ui/ui/avatar.tsx +109 -0
  117. package/src/plugins/generative-ui/ui/badge.tsx +65 -0
  118. package/src/plugins/generative-ui/ui/button-wrapper.tsx +32 -0
  119. package/src/plugins/generative-ui/ui/button.tsx +65 -0
  120. package/src/plugins/generative-ui/ui/card-wrapper.tsx +36 -0
  121. package/src/plugins/generative-ui/ui/card.tsx +92 -0
  122. package/src/plugins/generative-ui/ui/checkbox-wrapper.tsx +39 -0
  123. package/src/plugins/generative-ui/ui/checkbox.tsx +32 -0
  124. package/src/plugins/generative-ui/ui/data-table.tsx +53 -0
  125. package/src/plugins/generative-ui/ui/dialog.tsx +158 -0
  126. package/src/plugins/generative-ui/ui/dropdown-menu.tsx +257 -0
  127. package/src/plugins/generative-ui/ui/grid.tsx +29 -0
  128. package/src/plugins/generative-ui/ui/index.ts +43 -0
  129. package/src/plugins/generative-ui/ui/input-wrapper.tsx +38 -0
  130. package/src/plugins/generative-ui/ui/input.tsx +21 -0
  131. package/src/plugins/generative-ui/ui/label.tsx +24 -0
  132. package/src/plugins/generative-ui/ui/list.tsx +34 -0
  133. package/src/plugins/generative-ui/ui/metric.tsx +53 -0
  134. package/src/plugins/generative-ui/ui/pagination.tsx +127 -0
  135. package/src/plugins/generative-ui/ui/popover.tsx +89 -0
  136. package/src/plugins/generative-ui/ui/progress.tsx +57 -0
  137. package/src/plugins/generative-ui/ui/radio-group.tsx +45 -0
  138. package/src/plugins/generative-ui/ui/select-wrapper.tsx +41 -0
  139. package/src/plugins/generative-ui/ui/select.tsx +190 -0
  140. package/src/plugins/generative-ui/ui/separator.tsx +28 -0
  141. package/src/plugins/generative-ui/ui/skeleton-wrapper.tsx +30 -0
  142. package/src/plugins/generative-ui/ui/skeleton.tsx +13 -0
  143. package/src/plugins/generative-ui/ui/stack.tsx +54 -0
  144. package/src/plugins/generative-ui/ui/switch.tsx +35 -0
  145. package/src/plugins/generative-ui/ui/table.tsx +116 -0
  146. package/src/plugins/generative-ui/ui/tabs-wrapper.tsx +51 -0
  147. package/src/plugins/generative-ui/ui/tabs.tsx +92 -0
  148. package/src/plugins/generative-ui/ui/text.tsx +33 -0
  149. package/src/plugins/generative-ui/ui/textarea.tsx +18 -0
  150. package/src/plugins/generative-ui/ui/tooltip.tsx +57 -0
  151. package/dist/components/Chat/stories/Plugins.stories.d.ts +0 -12
  152. package/dist/index-B8nSCdu4.cjs +0 -251
  153. package/dist/index-B8nSCdu4.cjs.map +0 -1
  154. package/dist/index-CAtaLV1E.cjs +0 -187
  155. package/dist/index-CAtaLV1E.cjs.map +0 -1
  156. package/dist/index-CJrwma08.js +0 -27232
  157. package/dist/index-CJrwma08.js.map +0 -1
  158. package/dist/index-DLWQ91ow.js +0 -40049
  159. package/dist/index-DLWQ91ow.js.map +0 -1
  160. package/src/components/Chat/stories/Plugins.stories.tsx +0 -158
@@ -1,187 +0,0 @@
1
- "use strict";const O=require("react"),jO=require("./compat-shims-CO9JXXV4.cjs"),p=require("react/jsx-runtime"),j=require("@assistant-ui/react"),I=require("./index-B8nSCdu4.cjs"),Hs=require("@assistant-ui/react-ai-sdk"),Ye=require("motion/react"),MO=require("motion/react-m"),DO=require("zustand/shallow"),kd=require("react-dom"),$u=require("@assistant-ui/react-markdown"),zO=require("remark-gfm"),UO=require("shiki");function Ed(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 _=Ed(O),Ve=Ed(MO),uy=Ed(kd),nh=_,LO=jO.createShims(_);for(const[e,t]of Object.entries(LO))typeof nh[e]!="function"&&(nh[e]=t);function dy({tools:e}){return p.jsx(p.Fragment,{children:Object.entries(e).map(([,t])=>t({}))})}const Ws="gram-elements",FO=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}},VO=()=>{const e=[];let t=!1,r,o;const n=i=>{i.promise||(i.promise=i.reader.read().then(({done:s,value:c})=>{i.promise=void 0,s?(e.splice(e.indexOf(i),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(i){r=i},pull(){return o=FO(),e.forEach(i=>{n(i)}),o.promise},cancel(){e.forEach(i=>{i.reader.cancel()}),e.length=0}}),isSealed(){return t},seal(){t=!0,e.length===0&&r.close()},addStream(i){if(t)throw new Error("Cannot add streams after the run callback has settled.");const s={reader:i.getReader()};e.push(s),n(s)},enqueue(i){this.addStream(new ReadableStream({start(s){s.enqueue(i),s.close()}}))}}};class oh{_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 my=e=>new ReadableStream({start(t){return e.start?.(new oh(t))},pull(t){return e.pull?.(new oh(t))},cancel(t){return e.cancel?.(t)}}),ah=()=>{let e;return[my({start(r){e=r}}),e]};class ih{_controller;_isClosed=!1;_mergeTask;constructor(t){this._controller=t;const r=my({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 ZO=e=>new ReadableStream({start(t){return e.start?.(new ih(t))},pull(t){return e.pull?.(new ih(t))},cancel(t){return e.cancel?.(t)}}),qO=()=>{let e;return[ZO({start(r){e=r}}),e]};class fy{value=-1;up(){return++this.value}}class BO extends TransformStream{constructor(t){super({transform(r,o){o.enqueue({...r,path:[t,...r.path]})}})}}class oJ extends TransformStream{constructor(t){super({transform(r,o){const{path:[n,...a]}=r;if(t!==n)throw new Error(`Path mismatch: expected ${t}, got ${n}`);o.enqueue({...r,path:a})}})}}class GO extends TransformStream{constructor(t){const r=new fy,o=new Map;super({transform(n,a){n.type==="part-start"&&n.path.length===0&&o.set(r.up(),t.up());const[i,...s]=n.path;if(i===void 0){a.enqueue(n);return}const c=o.get(i);if(c===void 0)throw new Error("Path not found");a.enqueue({...n,path:[c,...s]})}})}}let HO=(e,t=21)=>(r=t)=>{let o="",n=r|0;for(;n--;)o+=e[Math.random()*e.length|0];return o};const WO=HO("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",7);class Id{_state;_parentId;constructor(t){this._state=t||{merger:VO(),contentCounter:new fy}}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 BO(this._state.contentCounter.value)))}merge(t){this._state.merger.addStream(t.pipeThrough(new GO(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]=ah();return this._addPart({type:"text"},t),r}addReasoningPart(){const[t,r]=ah();return this._addPart({type:"reasoning"},t),r}addToolCallPart(t){const r=typeof t=="string"?{toolName:t}:t,o=r.toolName,n=r.toolCallId??WO(),[a,i]=qO();return this._addPart({type:"tool-call",toolName:o,toolCallId:n,...this._parentId&&{parentId:this._parentId}},a),r.argsText!==void 0&&(i.argsText.append(r.argsText),i.argsText.close()),r.args!==void 0&&(i.argsText.append(JSON.stringify(r.args)),i.argsText.close()),r.response!==void 0&&i.setResponse(r.response),i}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 Id(this._state);return r._parentId=t,r}close(){this._state.append?.controller?.close(),this._state.merger.seal(),this._state.closeSubscriber?.()}}function Al(e){const t=new Id;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 JO(e){return typeof e=="string"?new Date(e):e}function KO(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 YO(e){if(e.role!=="assistant")return[];const t=[];(typeof e.content=="string"||!e.content)&&t.push({type:"text",text:e.content??""});const r=e.tool_calls;let o=Ou(r||"[]");Array.isArray(o)||(console.warn("Invalid tool_calls format, expected an array."),o=[]);for(const n of o){const a=n.function?.arguments??n.args??{},i=typeof a=="string"?a:JSON.stringify(a);t.push({type:"tool-call",toolCallId:n.id??n.toolCallId??"",toolName:n.function?.name??n.toolName??"",args:typeof a=="string"?JSON.parse(a):a,argsText:i,result:void 0})}return t.length===0&&t.push({type:"text",text:""}),t}function XO(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 QO(e){const t=JO(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:KO(e),attachments:[],metadata:r}:e.role==="system"?{id:e.id,role:"system",createdAt:t,content:XO(e),metadata:r}:{id:e.id,role:"assistant",createdAt:t,content:YO(e),status:{type:"complete",reason:"stop"},metadata:{unstable_state:null,unstable_annotations:[],unstable_data:[],steps:[],submittedFeedback:void 0,custom:{}}}}function eC(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=QO(o);t.push({message:n,parentId:r,runConfig:void 0}),r=o.id}return{messages:t,headId:r}}function tC(e){if(e.length===0)return{messages:[],headId:null};const t=new Map;for(const a of e){if(a.role!=="tool")continue;const i=a.tool_call_id;typeof i=="string"&&t.set(i,a)}const r=[];let o=null;const n=new Set;for(const a of e){switch(a.role){case"developer":case"tool":continue;case"system":{r.push({parentId:o,message:{id:a.id,role:"system",parts:[{type:"text",text:typeof a.content=="string"?a.content:Array.isArray(a.content)?a.content.filter(i=>i.type==="text").map(i=>i.text).join(`
3
- `):""}]}});break}case"user":{n.clear(),r.push({parentId:o,message:{id:a.id,role:"user",parts:sh(a,t)}});break}case"assistant":{const i={parentId:o,message:{id:a.id,role:"assistant",parts:sh(a,t,n)}};r.push(i);break}}o=a.id}return{messages:r,headId:o}}function sh(e,t,r){const o=[];typeof e.content=="string"&&e.content&&o.push({type:"text",text:e.content});const n=Array.isArray(e.content)?e.content:[];for(const a of n)switch(a.type){case"text":{o.push({type:"text",text:a.text});break}case"image_url":{const i=a.image_url?.url;if(!i)break;o.push({type:"file",url:i,mediaType:ch(i)});break}case"input_audio":{const i=a.input_audio?.data;if(!i)break;o.push({type:"file",url:i,mediaType:ch(i)});break}}if(e.role==="assistant"&&e.reasoning&&o.push({type:"reasoning",text:e.reasoning}),e.role==="assistant"&&e.tool_calls){const a=e.tool_calls;let i=Ou(a||"[]");Array.isArray(i)||(console.warn("Invalid tool_calls format, expected an array."),i=[]);for(const s of i){if(r?.has(s.id))continue;r?.add(s.id);const c=t.get(s.id)?.content;o.push({type:"dynamic-tool",toolCallId:s.id,toolName:s.function?.name??"",state:"output-available",input:s.function?.arguments??{},output:typeof c=="string"?Ou(c):""})}}return o}function ch(e){const t="unknown/unknown";return e.startsWith("data:")&&e.match(/^data:([^;]+);/)?.[1]||t}function Ou(e){try{return JSON.parse(e)}catch{return null}}const rC="__LOCALID_";function Gn(e){return!!e?.startsWith(rC)}class nC{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 eC(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 tC(n.messages)},append:async()=>{}}}}function oC(e){const t=j.useAssistantApi(),[r]=O.useState(()=>new nC(e.current.apiUrl,e.current.headers,t));return r}function aC(e){const t=O.useRef(e);O.useEffect(()=>{t.current=e},[e]);const r=O.useCallback(function({children:n}){const a=oC(t),i=O.useMemo(()=>({history:a}),[a]);return p.jsx(j.RuntimeAdapterProvider,{adapters:i,children:n})},[]);return O.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(a=>({remoteId:a.id,externalId:a.id,status:"regular",title:a.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(Gn(o)){const n=t.current.localIdToUuidMap?.get(o);if(n)return{remoteId:n,externalId:n};const a=crypto.randomUUID();return t.current.localIdToUuidMap?.set(o,a),{remoteId:a,externalId:a}}return{remoteId:o,externalId:o}},async rename(){},async archive(){},async unarchive(){},async delete(){},async generateTitle(o,n){if(!o||Gn(o))return Al(i=>{i.close()});const a=2e3;await new Promise(i=>setTimeout(i,a));try{const i=await fetch(`${t.current.apiUrl}/rpc/chat.generateTitle`,{method:"POST",headers:{...t.current.headers,"Content-Type":"application/json"},body:JSON.stringify({id:o})});if(i.ok){const c=(await i.json()).title;if(c)return Al(l=>{l.appendText(c),l.close()})}}catch(i){console.error("Error fetching title:",i)}return Al(i=>{i.close()})},async fetch(o){if(!o||Gn(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 a=await n.json();return{remoteId:a.id,externalId:a.id,status:"regular",title:a.title||"New Chat"}}catch(n){return console.error("Error fetching thread:",n),{remoteId:o,status:"regular"}}}}),[r])}var py="vercel.ai.error",iC=Symbol.for(py),hy,sC=class gy extends Error{constructor({name:t,message:r,cause:o}){super(r),this[hy]=!0,this.name=t,this.cause=o}static isInstance(t){return gy.hasMarker(t,py)}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}};hy=iC;var X=sC,vy="AI_APICallError",yy=`vercel.ai.error.${vy}`,cC=Symbol.for(yy),by,mt=class extends X{constructor({message:t,url:r,requestBodyValues:o,statusCode:n,responseHeaders:a,responseBody:i,cause:s,isRetryable:c=n!=null&&(n===408||n===409||n===429||n>=500),data:l}){super({name:vy,message:t,cause:s}),this[by]=!0,this.url=r,this.requestBodyValues=o,this.statusCode=n,this.responseHeaders=a,this.responseBody=i,this.isRetryable=c,this.data=l}static isInstance(t){return X.hasMarker(t,yy)}};by=cC;var _y="AI_EmptyResponseBodyError",wy=`vercel.ai.error.${_y}`,lC=Symbol.for(wy),xy,uC=class extends X{constructor({message:t="Empty response body"}={}){super({name:_y,message:t}),this[xy]=!0}static isInstance(t){return X.hasMarker(t,wy)}};xy=lC;function bo(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var Sy="AI_InvalidArgumentError",ky=`vercel.ai.error.${Sy}`,dC=Symbol.for(ky),Ey,Td=class extends X{constructor({message:t,cause:r,argument:o}){super({name:Sy,message:t,cause:r}),this[Ey]=!0,this.argument=o}static isInstance(t){return X.hasMarker(t,ky)}};Ey=dC;var Iy="AI_InvalidPromptError",Ty=`vercel.ai.error.${Iy}`,mC=Symbol.for(Ty),$y,Nn=class extends X{constructor({prompt:t,message:r,cause:o}){super({name:Iy,message:`Invalid prompt: ${r}`,cause:o}),this[$y]=!0,this.prompt=t}static isInstance(t){return X.hasMarker(t,Ty)}};$y=mC;var Oy="AI_JSONParseError",Cy=`vercel.ai.error.${Oy}`,fC=Symbol.for(Cy),Ay,na=class extends X{constructor({text:t,cause:r}){super({name:Oy,message:`JSON parsing failed: Text: ${t}.
4
- Error message: ${bo(r)}`,cause:r}),this[Ay]=!0,this.text=t}static isInstance(t){return X.hasMarker(t,Cy)}};Ay=fC;var Ry="AI_NoSuchModelError",Ny=`vercel.ai.error.${Ry}`,pC=Symbol.for(Ny),Py,hC=class extends X{constructor({errorName:e=Ry,modelId:t,modelType:r,message:o=`No such ${r}: ${t}`}){super({name:e,message:o}),this[Py]=!0,this.modelId=t,this.modelType=r}static isInstance(e){return X.hasMarker(e,Ny)}};Py=pC;var jy="AI_TypeValidationError",My=`vercel.ai.error.${jy}`,gC=Symbol.for(My),Dy,vC=class Cu extends X{constructor({value:t,cause:r}){super({name:jy,message:`Type validation failed: Value: ${JSON.stringify(t)}.
5
- Error message: ${bo(r)}`,cause:r}),this[Dy]=!0,this.value=t}static isInstance(t){return X.hasMarker(t,My)}static wrap({value:t,cause:r}){return Cu.isInstance(r)&&r.value===t?r:new Cu({value:t,cause:r})}};Dy=gC;var jt=vC,zy="AI_UnsupportedFunctionalityError",Uy=`vercel.ai.error.${zy}`,yC=Symbol.for(Uy),Ly,$d=class extends X{constructor({functionality:t,message:r=`'${t}' functionality not supported.`}){super({name:zy,message:r}),this[Ly]=!0,this.functionality=t}static isInstance(t){return X.hasMarker(t,Uy)}};Ly=yC;function is(e){return e===null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"?!0:Array.isArray(e)?e.every(is):typeof e=="object"?Object.entries(e).every(([t,r])=>typeof t=="string"&&is(r)):!1}function lh(e){return Array.isArray(e)&&e.every(is)}function ss(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,r])=>typeof t=="string"&&is(r))}let uh=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 Rl(e){}function bC(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=Rl,onError:r=Rl,onRetry:o=Rl,onComment:n}=e;let a="",i=!0,s,c="",l="";function u(h){const v=i?h.replace(/^\xEF\xBB\xBF/,""):h,[b,w]=_C(`${a}${v}`);for(const x of b)d(x);a=w,i=!1}function d(h){if(h===""){f();return}if(h.startsWith(":")){n&&n(h.slice(h.startsWith(": ")?2:1));return}const v=h.indexOf(":");if(v!==-1){const b=h.slice(0,v),w=h[v+1]===" "?2:1,x=h.slice(v+w);m(b,x,h);return}m(h,"",h)}function m(h,v,b){switch(h){case"event":l=v;break;case"data":c=`${c}${v}
6
- `;break;case"id":s=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?o(parseInt(v,10)):r(new uh(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:b}));break;default:r(new uh(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:v,line:b}));break}}function f(){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 g(h={}){a&&h.consume&&d(a),i=!0,s=void 0,c="",l="",a=""}return{feed:u,reset:g}}function _C(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),a=e.indexOf(`
8
- `,o);let i=-1;if(n!==-1&&a!==-1?i=Math.min(n,a):n!==-1?n===e.length-1?i=-1:i=n:a!==-1&&(i=a),i===-1){r=e.slice(o);break}else{const s=e.slice(o,i);t.push(s),o=i+1,e[o-1]==="\r"&&e[o]===`
9
- `&&o++}}return[t,r]}let cs=class extends TransformStream{constructor({onError:t,onRetry:r,onComment:o}={}){let n;super({start(a){n=bC({onEvent:i=>{a.enqueue(i)},onError(i){t==="terminate"?a.error(i):typeof t=="function"&&t(i)},onRetry:r,onComment:o})},transform(a){n.feed(a)}})}};const Od=Object.freeze({status:"aborted"});function $(e,t,r){function o(s,c){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);const l=i.prototype,u=Object.keys(l);for(let d=0;d<u.length;d++){const m=u[d];m in s||(s[m]=l[m].bind(s))}}const n=r?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:e});function i(s){var c;const l=r?.Parent?new a:this;o(l,s),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}const Fy=Symbol("zod_brand");class ln extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Js extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ls={};function nt(e){return e&&Object.assign(ls,e),ls}function wC(e){return e}function xC(e){return e}function SC(e){}function kC(e){throw new Error("Unexpected value in exhaustive check")}function EC(e){}function Cd(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function N(e,t="|"){return e.map(r=>Y(r)).join(t)}function us(e,t){return typeof t=="bigint"?t.toString():t}function Aa(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function wn(e){return e==null}function Ks(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Vy(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 a=r>n?r:n,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/10**a}const dh=Symbol("evaluating");function pe(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==dh)return o===void 0&&(o=dh,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function IC(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function Hr(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ir(...e){const t={};for(const r of e){const o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function TC(e){return Ir(e._zod.def)}function $C(e,t){return t?t.reduce((r,o)=>r?.[o],e):e}function OC(e){const t=Object.keys(e),r=t.map(o=>e[o]);return Promise.all(r).then(o=>{const n={};for(let a=0;a<t.length;a++)n[t[a]]=o[a];return n})}function CC(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 Au(e){return JSON.stringify(e)}function Zy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ad="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Qn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qy=Aa(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function dn(e){if(Qn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Qn(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ys(e){return dn(e)?{...e}:Array.isArray(e)?[...e]:e}function AC(e){let t=0;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}const RC=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}`)}},ds=new Set(["string","number","symbol"]),By=new Set(["string","number","bigint","boolean","symbol","undefined"]);function vr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ut(e,t,r){const o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function R(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 NC(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,a){return t??(t=e()),Reflect.set(t,o,n,a)},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 Y(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Gy(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Hy={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Wy={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Jy(e,t){const r=e._zod.def,o=Ir(e._zod.def,{get shape(){const n={};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(n[a]=r.shape[a])}return Hr(this,"shape",n),n},checks:[]});return Ut(e,o)}function Ky(e,t){const r=e._zod.def,o=Ir(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete n[a]}return Hr(this,"shape",n),n},checks:[]});return Ut(e,o)}function Yy(e,t){if(!dn(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=Ir(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return Hr(this,"shape",a),a},checks:[]});return Ut(e,n)}function Xy(e,t){if(!dn(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 Hr(this,"shape",o),o},checks:e._zod.def.checks};return Ut(e,r)}function Qy(e,t){const r=Ir(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Hr(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return Ut(e,r)}function eb(e,t,r){const o=Ir(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const i in r){if(!(i in n))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(a[i]=e?new e({type:"optional",innerType:n[i]}):n[i])}else for(const i in n)a[i]=e?new e({type:"optional",innerType:n[i]}):n[i];return Hr(this,"shape",a),a},checks:[]});return Ut(t,o)}function tb(e,t,r){const o=Ir(t._zod.def,{get shape(){const n=t._zod.def.shape,a={...n};if(r)for(const i in r){if(!(i in a))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(a[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(const i in n)a[i]=new e({type:"nonoptional",innerType:n[i]});return Hr(this,"shape",a),a},checks:[]});return Ut(t,o)}function nn(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 Bt(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Ho(e){return typeof e=="string"?e:e?.message}function Dt(e,t,r){const o={...e,path:e.path??[]};if(!e.message){const n=Ho(e.inst?._zod.def?.error?.(e))??Ho(t?.error?.(e))??Ho(r.customError?.(e))??Ho(r.localeError?.(e))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function Xs(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Qs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function eo(...e){const[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}function PC(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function rb(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 nb(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function jC(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return rb(t+r)}function MC(e){return nb(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function DC(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 zC(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}class UC{constructor(...t){}}const ob=Object.freeze(Object.defineProperty({__proto__:null,BIGINT_FORMAT_RANGES:Wy,Class:UC,NUMBER_FORMAT_RANGES:Hy,aborted:nn,allowsEval:qy,assert:EC,assertEqual:wC,assertIs:SC,assertNever:kC,assertNotEqual:xC,assignProp:Hr,base64ToUint8Array:rb,base64urlToUint8Array:jC,cached:Aa,captureStackTrace:Ad,cleanEnum:PC,cleanRegex:Ks,clone:Ut,cloneDef:TC,createTransparentProxy:NC,defineLazy:pe,esc:Au,escapeRegex:vr,extend:Yy,finalizeIssue:Dt,floatSafeRemainder:Vy,getElementAtPath:$C,getEnumValues:Cd,getLengthableOrigin:Qs,getParsedType:RC,getSizableOrigin:Xs,hexToUint8Array:DC,isObject:Qn,isPlainObject:dn,issue:eo,joinValues:N,jsonStringifyReplacer:us,merge:Qy,mergeDefs:Ir,normalizeParams:R,nullish:wn,numKeys:AC,objectClone:IC,omit:Ky,optionalKeys:Gy,partial:eb,pick:Jy,prefixIssues:Bt,primitiveTypes:By,promiseAllObject:OC,propertyKeyTypes:ds,randomString:CC,required:tb,safeExtend:Xy,shallowClone:Ys,slugify:Zy,stringifyPrimitive:Y,uint8ArrayToBase64:nb,uint8ArrayToBase64url:MC,uint8ArrayToHex:zC,unwrapMessage:Ho},Symbol.toStringTag,{value:"Module"})),ab=(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,us,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Rd=$("$ZodError",ab),Ct=$("$ZodError",ab,{Parent:Error});function Nd(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 Pd(e,t=r=>r.message){const r={_errors:[]},o=n=>{for(const a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(i=>o({issues:i}));else if(a.code==="invalid_key")o({issues:a.issues});else if(a.code==="invalid_element")o({issues:a.issues});else if(a.path.length===0)r._errors.push(t(a));else{let i=r,s=0;for(;s<a.path.length;){const c=a.path[s];s===a.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(a))):i[c]=i[c]||{_errors:[]},i=i[c],s++}}};return o(e),r}function ib(e,t=r=>r.message){const r={errors:[]},o=(n,a=[])=>{var i,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=[...a,...c.path];if(l.length===0){r.errors.push(t(c));continue}let u=r,d=0;for(;d<l.length;){const m=l[d],f=d===l.length-1;typeof m=="string"?(u.properties??(u.properties={}),(i=u.properties)[m]??(i[m]={errors:[]}),u=u.properties[m]):(u.items??(u.items=[]),(s=u.items)[m]??(s[m]={errors:[]}),u=u.items[m]),f&&u.errors.push(t(c)),d++}}};return o(e),r}function sb(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 cb(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 ${sb(o.path)}`);return t.join(`
10
- `)}const Ra=e=>(t,r,o,n)=>{const a=o?Object.assign(o,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},a);if(i instanceof Promise)throw new ln;if(i.issues.length){const s=new(n?.Err??e)(i.issues.map(c=>Dt(c,a,nt())));throw Ad(s,n?.callee),s}return i.value},Ru=Ra(Ct),Na=e=>async(t,r,o,n)=>{const a=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const s=new(n?.Err??e)(i.issues.map(c=>Dt(c,a,nt())));throw Ad(s,n?.callee),s}return i.value},Nu=Na(Ct),Pa=e=>(t,r,o)=>{const n=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},n);if(a instanceof Promise)throw new ln;return a.issues.length?{success:!1,error:new(e??Rd)(a.issues.map(i=>Dt(i,n,nt())))}:{success:!0,data:a.value}},lb=Pa(Ct),ja=e=>async(t,r,o)=>{const n=o?Object.assign(o,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(i=>Dt(i,n,nt())))}:{success:!0,data:a.value}},ub=ja(Ct),jd=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Ra(e)(t,r,n)},LC=jd(Ct),Md=e=>(t,r,o)=>Ra(e)(t,r,o),FC=Md(Ct),Dd=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Na(e)(t,r,n)},VC=Dd(Ct),zd=e=>async(t,r,o)=>Na(e)(t,r,o),ZC=zd(Ct),Ud=e=>(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return Pa(e)(t,r,n)},qC=Ud(Ct),Ld=e=>(t,r,o)=>Pa(e)(t,r,o),BC=Ld(Ct),Fd=e=>async(t,r,o)=>{const n=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return ja(e)(t,r,n)},GC=Fd(Ct),Vd=e=>async(t,r,o)=>ja(e)(t,r,o),HC=Vd(Ct),db=/^[cC][^\s-]{8,}$/,mb=/^[0-9a-z]+$/,fb=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,pb=/^[0-9a-vA-V]{20}$/,hb=/^[A-Za-z0-9]{27}$/,gb=/^[a-zA-Z0-9_-]{21}$/,vb=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,WC=/^[-+]?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)?)??$/,yb=/^([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})$/,to=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)$/,JC=to(4),KC=to(6),YC=to(7),bb=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,XC=/^[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])?)*$/,QC=/^(([^<>()\[\]\\.,;:\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,}))$/,_b=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,eA=_b,tA=/^[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])?)*$/,rA="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wb(){return new RegExp(rA,"u")}const xb=/^(?:(?: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])$/,Sb=/^(([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}|:))$/,kb=e=>{const t=vr(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Eb=/^((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])$/,Tb=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zd=/^[A-Za-z0-9_-]*$/,$b=/^(?=.{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])?)*\.?$/,Ob=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Cb=/^\+(?:[0-9]){6,14}[0-9]$/,Ab="(?:(?:\\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])))",Rb=new RegExp(`^${Ab}$`);function Nb(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 Pb(e){return new RegExp(`^${Nb(e)}$`)}function jb(e){const t=Nb({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(`^${Ab}T(?:${o})$`)}const Mb=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Db=/^-?\d+n?$/,zb=/^-?\d+$/,Ub=/^-?\d+(?:\.\d+)?/,Lb=/^(?:true|false)$/i,Fb=/^null$/i,Vb=/^undefined$/i,Zb=/^[^A-Z]*$/,qb=/^[^a-z]*$/,Bb=/^[0-9a-fA-F]*$/;function Ma(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Da(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const nA=/^[0-9a-fA-F]{32}$/,oA=Ma(22,"=="),aA=Da(22),iA=/^[0-9a-fA-F]{40}$/,sA=Ma(27,"="),cA=Da(27),lA=/^[0-9a-fA-F]{64}$/,uA=Ma(43,"="),dA=Da(43),mA=/^[0-9a-fA-F]{96}$/,fA=Ma(64,""),pA=Da(64),hA=/^[0-9a-fA-F]{128}$/,gA=Ma(86,"=="),vA=Da(86),qd=Object.freeze(Object.defineProperty({__proto__:null,base64:Tb,base64url:Zd,bigint:Db,boolean:Lb,browserEmail:tA,cidrv4:Eb,cidrv6:Ib,cuid:db,cuid2:mb,date:Rb,datetime:jb,domain:Ob,duration:vb,e164:Cb,email:bb,emoji:wb,extendedDuration:WC,guid:yb,hex:Bb,hostname:$b,html5Email:XC,idnEmail:eA,integer:zb,ipv4:xb,ipv6:Sb,ksuid:hb,lowercase:Zb,mac:kb,md5_base64:oA,md5_base64url:aA,md5_hex:nA,nanoid:gb,null:Fb,number:Ub,rfc5322Email:QC,sha1_base64:sA,sha1_base64url:cA,sha1_hex:iA,sha256_base64:uA,sha256_base64url:dA,sha256_hex:lA,sha384_base64:fA,sha384_base64url:pA,sha384_hex:mA,sha512_base64:gA,sha512_base64url:vA,sha512_hex:hA,string:Mb,time:Pb,ulid:fb,undefined:Vb,unicodeEmail:_b,uppercase:qb,uuid:to,uuid4:JC,uuid6:KC,uuid7:YC,xid:pb},Symbol.toStringTag,{value:"Module"})),Pe=$("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Gb={number:"number",bigint:"bigint",object:"date"},Bd=$("$ZodCheckLessThan",(e,t)=>{Pe.init(e,t);const r=Gb[typeof t.value];e._zod.onattach.push(o=>{const n=o._zod.bag,a=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(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})}}),Gd=$("$ZodCheckGreaterThan",(e,t)=>{Pe.init(e,t);const r=Gb[typeof t.value];e._zod.onattach.push(o=>{const n=o._zod.bag,a=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(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})}}),Hb=$("$ZodCheckMultipleOf",(e,t)=>{Pe.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):Vy(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Wb=$("$ZodCheckNumberFormat",(e,t)=>{Pe.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),o=r?"int":"number",[n,a]=Hy[t.format];e._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,s.minimum=n,s.maximum=a,r&&(s.pattern=zb)}),e._zod.check=i=>{const s=i.value;if(r){if(!Number.isInteger(s)){i.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?i.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}):i.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&&i.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>a&&i.issues.push({origin:"number",input:s,code:"too_big",maximum:a,inst:e})}}),Jb=$("$ZodCheckBigIntFormat",(e,t)=>{Pe.init(e,t);const[r,o]=Wy[t.format];e._zod.onattach.push(n=>{const a=n._zod.bag;a.format=t.format,a.minimum=r,a.maximum=o}),e._zod.check=n=>{const a=n.value;a<r&&n.issues.push({origin:"bigint",input:a,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),a>o&&n.issues.push({origin:"bigint",input:a,code:"too_big",maximum:o,inst:e})}}),Kb=$("$ZodCheckMaxSize",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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:Xs(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Yb=$("$ZodCheckMinSize",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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:Xs(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xb=$("$ZodCheckSizeEquals",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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,a=n.size;if(a===t.size)return;const i=a>t.size;o.issues.push({origin:Xs(n),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Qb=$("$ZodCheckMaxLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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 i=Qs(n);o.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),e_=$("$ZodCheckMinLength",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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 i=Qs(n);o.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),t_=$("$ZodCheckLengthEquals",(e,t)=>{var r;Pe.init(e,t),(r=e._zod.def).when??(r.when=o=>{const n=o.value;return!wn(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,a=n.length;if(a===t.length)return;const i=Qs(n),s=a>t.length;o.issues.push({origin:i,...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})}}),za=$("$ZodCheckStringFormat",(e,t)=>{var r,o;Pe.init(e,t),e._zod.onattach.push(n=>{const a=n._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=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=()=>{})}),r_=$("$ZodCheckRegex",(e,t)=>{za.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})}}),n_=$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Zb),za.init(e,t)}),o_=$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qb),za.init(e,t)}),a_=$("$ZodCheckIncludes",(e,t)=>{Pe.init(e,t);const r=vr(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.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})}}),i_=$("$ZodCheckStartsWith",(e,t)=>{Pe.init(e,t);const r=new RegExp(`^${vr(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})}}),s_=$("$ZodCheckEndsWith",(e,t)=>{Pe.init(e,t);const r=new RegExp(`.*${vr(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 mh(e,t,r){e.issues.length&&t.issues.push(...Bt(r,e.issues))}const c_=$("$ZodCheckProperty",(e,t)=>{Pe.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=>mh(n,r,t.property));mh(o,r,t.property)}}),l_=$("$ZodCheckMimeType",(e,t)=>{Pe.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})}}),u_=$("$ZodCheckOverwrite",(e,t)=>{Pe.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class d_{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(i=>i),n=Math.min(...o.map(i=>i.length-i.trimStart().length)),a=o.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(const i of a)this.content.push(i)}compile(){const t=Function,r=this?.args,n=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,n.join(`
12
- `))}}const m_={major:4,minor:2,patch:1},Q=$("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=m_;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const n of o)for(const a of n._zod.onattach)a(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const n=(i,s,c)=>{let l=nn(i),u;for(const d of s){if(d._zod.def.when){if(!d._zod.def.when(i))continue}else if(l)continue;const m=i.issues.length,f=d._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new ln;if(u||f instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await f,i.issues.length!==m&&(l||(l=nn(i,m)))});else{if(i.issues.length===m)continue;l||(l=nn(i,m))}}return u?u.then(()=>i):i},a=(i,s,c)=>{if(nn(i))return i.aborted=!0,i;const l=n(s,o,c);if(l instanceof Promise){if(c.async===!1)throw new ln;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(i,s)=>{if(s.skipChecks)return e._zod.parse(i,s);if(s.direction==="backward"){const l=e._zod.parse({value:i.value,issues:[]},{...s,skipChecks:!0});return l instanceof Promise?l.then(u=>a(u,i,s)):a(l,i,s)}const c=e._zod.parse(i,s);if(c instanceof Promise){if(s.async===!1)throw new ln;return c.then(l=>n(l,o,s))}return n(c,o,s)}}e["~standard"]={validate:n=>{try{const a=lb(e,n);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return ub(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Ua=$("$ZodString",(e,t)=>{Q.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Mb(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}}),$e=$("$ZodStringFormat",(e,t)=>{za.init(e,t),Ua.init(e,t)}),f_=$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yb),$e.init(e,t)}),p_=$("$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=to(o))}else t.pattern??(t.pattern=to());$e.init(e,t)}),h_=$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bb),$e.init(e,t)}),g_=$("$ZodURL",(e,t)=>{$e.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})}}}),v_=$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wb()),$e.init(e,t)}),y_=$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=gb),$e.init(e,t)}),b_=$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=db),$e.init(e,t)}),__=$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=mb),$e.init(e,t)}),w_=$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fb),$e.init(e,t)}),x_=$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=pb),$e.init(e,t)}),S_=$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=hb),$e.init(e,t)}),k_=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jb(t)),$e.init(e,t)}),E_=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rb),$e.init(e,t)}),I_=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Pb(t)),$e.init(e,t)}),T_=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vb),$e.init(e,t)}),$_=$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=xb),$e.init(e,t),e._zod.bag.format="ipv4"}),O_=$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Sb),$e.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})}}}),C_=$("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=kb(t.delimiter)),$e.init(e,t),e._zod.bag.format="mac"}),A_=$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Eb),$e.init(e,t)}),R_=$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ib),$e.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[n,a]=o;if(!a)throw new Error;const i=Number(a);if(`${i}`!==a)throw new Error;if(i<0||i>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 Hd(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const N_=$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Tb),$e.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Hd(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function P_(e){if(!Zd.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Hd(r)}const j_=$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Zd),$e.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{P_(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),M_=$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cb),$e.init(e,t)});function D_(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 z_=$("$ZodJWT",(e,t)=>{$e.init(e,t),e._zod.check=r=>{D_(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),U_=$("$ZodCustomStringFormat",(e,t)=>{$e.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})}}),Wd=$("$ZodNumber",(e,t)=>{Q.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ub,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 a=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,...a?{received:a}:{}}),r}}),L_=$("$ZodNumberFormat",(e,t)=>{Wb.init(e,t),Wd.init(e,t)}),Jd=$("$ZodBoolean",(e,t)=>{Q.init(e,t),e._zod.pattern=Lb,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}}),Kd=$("$ZodBigInt",(e,t)=>{Q.init(e,t),e._zod.pattern=Db,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}}),F_=$("$ZodBigIntFormat",(e,t)=>{Jb.init(e,t),Kd.init(e,t)}),V_=$("$ZodSymbol",(e,t)=>{Q.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}}),Z_=$("$ZodUndefined",(e,t)=>{Q.init(e,t),e._zod.pattern=Vb,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}}),q_=$("$ZodNull",(e,t)=>{Q.init(e,t),e._zod.pattern=Fb,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}}),B_=$("$ZodAny",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),G_=$("$ZodUnknown",(e,t)=>{Q.init(e,t),e._zod.parse=r=>r}),H_=$("$ZodNever",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),W_=$("$ZodVoid",(e,t)=>{Q.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}}),J_=$("$ZodDate",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}const n=r.value,a=n instanceof Date;return a&&!Number.isNaN(n.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:n,...a?{received:"Invalid Date"}:{},inst:e}),r}});function fh(e,t,r){e.issues.length&&t.issues.push(...Bt(r,e.issues)),t.value[r]=e.value}const K_=$("$ZodArray",(e,t)=>{Q.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 a=[];for(let i=0;i<n.length;i++){const s=n[i],c=t.element._zod.run({value:s,issues:[]},o);c instanceof Promise?a.push(c.then(l=>fh(l,r,i))):fh(c,r,i)}return a.length?Promise.all(a).then(()=>r):r}});function ms(e,t,r,o){e.issues.length&&t.issues.push(...Bt(r,e.issues)),e.value===void 0?r in o&&(t.value[r]=void 0):t.value[r]=e.value}function Y_(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=Gy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function X_(e,t,r,o,n,a){const i=[],s=n.keySet,c=n.catchall._zod,l=c.def.type;for(const u in t){if(s.has(u))continue;if(l==="never"){i.push(u);continue}const d=c.run({value:t[u],issues:[]},o);d instanceof Promise?e.push(d.then(m=>ms(m,r,u,t))):ms(d,r,u,t)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>r):r}const Q_=$("$ZodObject",(e,t)=>{if(Q.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=Aa(()=>Y_(t));pe(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=Qn,a=t.catchall;let i;e._zod.parse=(s,c)=>{i??(i=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=i.shape;for(const m of i.keys){const g=d[m]._zod.run({value:l[m],issues:[]},c);g instanceof Promise?u.push(g.then(h=>ms(h,s,m,l))):ms(g,s,m,l)}return a?X_(u,l,s,c,o.value,e):u.length?Promise.all(u).then(()=>s):s}}),ew=$("$ZodObjectJIT",(e,t)=>{Q_.init(e,t);const r=e._zod.parse,o=Aa(()=>Y_(t)),n=m=>{const f=new d_(["shape","payload","ctx"]),g=o.value,h=x=>{const y=Au(x);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};f.write("const input = payload.value;");const v=Object.create(null);let b=0;for(const x of g.keys)v[x]=`key_${b++}`;f.write("const newResult = {};");for(const x of g.keys){const y=v[x],S=Au(x);f.write(`const ${y} = ${h(x)};`),f.write(`
13
- if (${y}.issues.length) {
14
- payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
15
- ...iss,
16
- path: iss.path ? [${S}, ...iss.path] : [${S}]
17
- })));
18
- }
19
-
20
-
21
- if (${y}.value === undefined) {
22
- if (${S} in input) {
23
- newResult[${S}] = undefined;
24
- }
25
- } else {
26
- newResult[${S}] = ${y}.value;
27
- }
28
-
29
- `)}f.write("payload.value = newResult;"),f.write("return payload;");const w=f.compile();return(x,y)=>w(m,x,y)};let a;const i=Qn,s=!ls.jitless,l=s&&qy.value,u=t.catchall;let d;e._zod.parse=(m,f)=>{d??(d=o.value);const g=m.value;return i(g)?s&&l&&f?.async===!1&&f.jitless!==!0?(a||(a=n(t.shape)),m=a(m,f),u?X_([],g,m,f,d,e):m):r(m,f):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function ph(e,t,r,o){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const n=e.filter(a=>!nn(a));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(a=>a.issues.map(i=>Dt(i,o,nt())))}),t)}const ec=$("$ZodUnion",(e,t)=>{Q.init(e,t),pe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),pe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),pe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),pe(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(a=>a._zod.pattern);return new RegExp(`^(${n.map(a=>Ks(a.source)).join("|")})$`)}});const r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,a)=>{if(r)return o(n,a);let i=!1;const s=[];for(const c of t.options){const l=c._zod.run({value:n.value,issues:[]},a);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}return i?Promise.all(s).then(c=>ph(c,n,e,a)):ph(s,n,e,a)}});function hh(e,t,r,o){const n=e.filter(a=>a.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(a=>a.issues.map(i=>Dt(i,o,nt())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}const tw=$("$ZodXor",(e,t)=>{ec.init(e,t),t.inclusive=!1;const r=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(n,a)=>{if(r)return o(n,a);let i=!1;const s=[];for(const c of t.options){const l=c._zod.run({value:n.value,issues:[]},a);l instanceof Promise?(s.push(l),i=!0):s.push(l)}return i?Promise.all(s).then(c=>hh(c,n,e,a)):hh(s,n,e,a)}}),rw=$("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ec.init(e,t);const r=e._zod.parse;pe(e._zod,"propValues",()=>{const n={};for(const a of t.options){const i=a._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[s,c]of Object.entries(i)){n[s]||(n[s]=new Set);for(const l of c)n[s].add(l)}}return n});const o=Aa(()=>{const n=t.options,a=new Map;for(const i of n){const s=i._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of s){if(a.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);a.set(c,i)}}return a});e._zod.parse=(n,a)=>{const i=n.value;if(!Qn(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;const s=o.value.get(i?.[t.discriminator]);return s?s._zod.run(n,a):t.unionFallback?r(n,a):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),n)}}),nw=$("$ZodIntersection",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{const n=r.value,a=t.left._zod.run({value:n,issues:[]},o),i=t.right._zod.run({value:n,issues:[]},o);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([c,l])=>gh(r,c,l)):gh(r,a,i)}});function Pu(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(dn(e)&&dn(t)){const r=Object.keys(t),o=Object.keys(e).filter(a=>r.indexOf(a)!==-1),n={...e,...t};for(const a of o){const i=Pu(e[a],t[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};n[a]=i.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],a=t[o],i=Pu(n,a);if(!i.valid)return{valid:!1,mergeErrorPath:[o,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function gh(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),nn(e))return e;const o=Pu(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 Yd=$("$ZodTuple",(e,t)=>{Q.init(e,t);const r=t.items;e._zod.parse=(o,n)=>{const a=o.value;if(!Array.isArray(a))return o.issues.push({input:a,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];const i=[],s=[...r].reverse().findIndex(u=>u._zod.optin!=="optional"),c=s===-1?0:r.length-s;if(!t.rest){const u=a.length>r.length,d=a.length<c-1;if(u||d)return o.issues.push({...u?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},input:a,inst:e,origin:"array"}),o}let l=-1;for(const u of r){if(l++,l>=a.length&&l>=c)continue;const d=u._zod.run({value:a[l],issues:[]},n);d instanceof Promise?i.push(d.then(m=>Ei(m,o,l))):Ei(d,o,l)}if(t.rest){const u=a.slice(r.length);for(const d of u){l++;const m=t.rest._zod.run({value:d,issues:[]},n);m instanceof Promise?i.push(m.then(f=>Ei(f,o,l))):Ei(m,o,l)}}return i.length?Promise.all(i).then(()=>o):o}});function Ei(e,t,r){e.issues.length&&t.issues.push(...Bt(r,e.issues)),t.value[r]=e.value}const ow=$("$ZodRecord",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{const n=r.value;if(!dn(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const a=[],i=t.keyType._zod.values;if(i){r.value={};const s=new Set;for(const l of i)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?a.push(u.then(d=>{d.issues.length&&r.issues.push(...Bt(l,d.issues)),r.value[l]=d.value})):(u.issues.length&&r.issues.push(...Bt(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=>Dt(u,o,nt())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:n[s],issues:[]},o);l instanceof Promise?a.push(l.then(u=>{u.issues.length&&r.issues.push(...Bt(s,u.issues)),r.value[c.value]=u.value})):(l.issues.length&&r.issues.push(...Bt(s,l.issues)),r.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>r):r}}),aw=$("$ZodMap",(e,t)=>{Q.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 a=[];r.value=new Map;for(const[i,s]of n){const c=t.keyType._zod.run({value:i,issues:[]},o),l=t.valueType._zod.run({value:s,issues:[]},o);c instanceof Promise||l instanceof Promise?a.push(Promise.all([c,l]).then(([u,d])=>{vh(u,d,r,i,n,e,o)})):vh(c,l,r,i,n,e,o)}return a.length?Promise.all(a).then(()=>r):r}});function vh(e,t,r,o,n,a,i){e.issues.length&&(ds.has(typeof o)?r.issues.push(...Bt(o,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:n,inst:a,issues:e.issues.map(s=>Dt(s,i,nt()))})),t.issues.length&&(ds.has(typeof o)?r.issues.push(...Bt(o,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:n,inst:a,key:o,issues:t.issues.map(s=>Dt(s,i,nt()))})),r.value.set(e.value,t.value)}const iw=$("$ZodSet",(e,t)=>{Q.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 a=[];r.value=new Set;for(const i of n){const s=t.valueType._zod.run({value:i,issues:[]},o);s instanceof Promise?a.push(s.then(c=>yh(c,r))):yh(s,r)}return a.length?Promise.all(a).then(()=>r):r}});function yh(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}const sw=$("$ZodEnum",(e,t)=>{Q.init(e,t);const r=Cd(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>ds.has(typeof n)).map(n=>typeof n=="string"?vr(n):n.toString()).join("|")})$`),e._zod.parse=(n,a)=>{const i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}}),cw=$("$ZodLiteral",(e,t)=>{if(Q.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"?vr(o):o?vr(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),o}}),lw=$("$ZodFile",(e,t)=>{Q.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}}),uw=$("$ZodTransform",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Js(e.constructor.name);const n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(r.value=i,r));if(n instanceof Promise)throw new ln;return r.value=n,r}});function bh(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const dw=$("$ZodOptional",(e,t)=>{Q.init(e,t),e._zod.optin="optional",e._zod.optout="optional",pe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),pe(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ks(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(a=>bh(a,r.value)):bh(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,o)}}),mw=$("$ZodNullable",(e,t)=>{Q.init(e,t),pe(e._zod,"optin",()=>t.innerType._zod.optin),pe(e._zod,"optout",()=>t.innerType._zod.optout),pe(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Ks(r.source)}|null)$`):void 0}),pe(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)}),fw=$("$ZodDefault",(e,t)=>{Q.init(e,t),e._zod.optin="optional",pe(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(a=>_h(a,t)):_h(n,t)}});function _h(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const pw=$("$ZodPrefault",(e,t)=>{Q.init(e,t),e._zod.optin="optional",pe(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))}),hw=$("$ZodNonOptional",(e,t)=>{Q.init(e,t),pe(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(a=>wh(a,e)):wh(n,e)}});function wh(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 gw=$("$ZodSuccess",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Js("ZodSuccess");const n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(a=>(r.value=a.issues.length===0,r)):(r.value=n.issues.length===0,r)}}),vw=$("$ZodCatch",(e,t)=>{Q.init(e,t),pe(e._zod,"optin",()=>t.innerType._zod.optin),pe(e._zod,"optout",()=>t.innerType._zod.optout),pe(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(a=>(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(i=>Dt(i,o,nt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(a=>Dt(a,o,nt()))},input:r.value}),r.issues=[]),r)}}),yw=$("$ZodNaN",(e,t)=>{Q.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)}),bw=$("$ZodPipe",(e,t)=>{Q.init(e,t),pe(e._zod,"values",()=>t.in._zod.values),pe(e._zod,"optin",()=>t.in._zod.optin),pe(e._zod,"optout",()=>t.out._zod.optout),pe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){const a=t.out._zod.run(r,o);return a instanceof Promise?a.then(i=>Ii(i,t.in,o)):Ii(a,t.in,o)}const n=t.in._zod.run(r,o);return n instanceof Promise?n.then(a=>Ii(a,t.out,o)):Ii(n,t.out,o)}});function Ii(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Xd=$("$ZodCodec",(e,t)=>{Q.init(e,t),pe(e._zod,"values",()=>t.in._zod.values),pe(e._zod,"optin",()=>t.in._zod.optin),pe(e._zod,"optout",()=>t.out._zod.optout),pe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){const a=t.in._zod.run(r,o);return a instanceof Promise?a.then(i=>Ti(i,t,o)):Ti(a,t,o)}else{const a=t.out._zod.run(r,o);return a instanceof Promise?a.then(i=>Ti(i,t,o)):Ti(a,t,o)}}});function Ti(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(a=>$i(e,a,t.out,r)):$i(e,n,t.out,r)}else{const n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(a=>$i(e,a,t.in,r)):$i(e,n,t.in,r)}}function $i(e,t,r,o){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},o)}const _w=$("$ZodReadonly",(e,t)=>{Q.init(e,t),pe(e._zod,"propValues",()=>t.innerType._zod.propValues),pe(e._zod,"values",()=>t.innerType._zod.values),pe(e._zod,"optin",()=>t.innerType?._zod?.optin),pe(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(xh):xh(n)}});function xh(e){return e.value=Object.freeze(e.value),e}const ww=$("$ZodTemplateLiteral",(e,t)=>{Q.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 a=n.startsWith("^")?1:0,i=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(a,i))}else if(o===null||By.has(typeof o))r.push(vr(`${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)}),xw=$("$ZodFunction",(e,t)=>(Q.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?Ru(e._def.input,o):o,a=Reflect.apply(r,this,n);return e._def.output?Ru(e._def.output,a):a}},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 Nu(e._def.input,o):o,a=await Reflect.apply(r,this,n);return e._def.output?await Nu(e._def.output,a):a}},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 Yd({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)),Sw=$("$ZodPromise",(e,t)=>{Q.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then(n=>t.innerType._zod.run({value:n,issues:[]},o))}),kw=$("$ZodLazy",(e,t)=>{Q.init(e,t),pe(e._zod,"innerType",()=>t.getter()),pe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),pe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),pe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),pe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),Ew=$("$ZodCustom",(e,t)=>{Pe.init(e,t),Q.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(a=>Sh(a,r,o,e));Sh(n,r,o,e)}});function Sh(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(eo(n))}}const yA=()=>{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 a=typeof n;switch(a){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 a},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?`مدخلات غير مقبولة: يفترض إدخال ${Y(n.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${a} ${n.maximum.toString()} ${i.unit??"عنصر"}`:`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${a} ${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${a} ${n.minimum.toString()} ${i.unit}`:`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${a} ${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`:a.format==="ends_with"?`نَص غير مقبول: يجب أن ينتهي بـ "${a.suffix}"`:a.format==="includes"?`نَص غير مقبول: يجب أن يتضمَّن "${a.includes}"`:a.format==="regex"?`نَص غير مقبول: يجب أن يطابق النمط ${a.pattern}`:`${o[a.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function bA(){return{localeError:yA()}}const _A=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${a}${n.maximum.toString()} ${i.unit??"element"}`:`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Çox kiçik: gözlənilən ${n.origin} ${a}${n.minimum.toString()} ${i.unit}`:`Çox kiçik: gözlənilən ${n.origin} ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Yanlış mətn: "${a.prefix}" ilə başlamalıdır`:a.format==="ends_with"?`Yanlış mətn: "${a.suffix}" ilə bitməlidir`:a.format==="includes"?`Yanlış mətn: "${a.includes}" daxil olmalıdır`:a.format==="regex"?`Yanlış mətn: ${a.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${o[a.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function wA(){return{localeError:_A()}}function kh(e,t,r,o){const n=Math.abs(e),a=n%10,i=n%100;return i>=11&&i<=19?o:a===1?t:a>=2&&a<=4?r:o}const xA=()=>{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 a=typeof n;switch(a){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 a},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?`Няправільны ўвод: чакалася ${Y(n.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);if(i){const s=Number(n.maximum),c=kh(s,i.unit.one,i.unit.few,i.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${i.verb} ${a}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);if(i){const s=Number(n.minimum),c=kh(s,i.unit.one,i.unit.few,i.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${i.verb} ${a}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Няправільны радок: павінен пачынацца з "${a.prefix}"`:a.format==="ends_with"?`Няправільны радок: павінен заканчвацца на "${a.suffix}"`:a.format==="includes"?`Няправільны радок: павінен змяшчаць "${a.includes}"`:a.format==="regex"?`Няправільны радок: павінен адпавядаць шаблону ${a.pattern}`:`Няправільны ${o[a.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function SA(){return{localeError:xA()}}const kA=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},EA=()=>{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}, получен ${kA(o.input)}`;case"invalid_value":return o.values.length===1?`Невалиден вход: очакван ${Y(o.values[0])}`:`Невалидна опция: очаквано едно от ${N(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`Твърде голямо: очаква се ${o.origin??"стойност"} да съдържа ${n}${o.maximum.toString()} ${a.unit??"елемента"}`:`Твърде голямо: очаква се ${o.origin??"стойност"} да бъде ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",a=t(o.origin);return a?`Твърде малко: очаква се ${o.origin} да съдържа ${n}${o.minimum.toString()} ${a.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 a="Невалиден";return n.format==="emoji"&&(a="Невалидно"),n.format==="datetime"&&(a="Невалидно"),n.format==="date"&&(a="Невалидна"),n.format==="time"&&(a="Невалидно"),n.format==="duration"&&(a="Невалидна"),`${a} ${r[n.format]??o.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${o.divisor}`;case"unrecognized_keys":return`Неразпознат${o.keys.length>1?"и":""} ключ${o.keys.length>1?"ове":""}: ${N(o.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${o.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${o.origin}`;default:return"Невалиден вход"}}};function IA(){return{localeError:EA()}}const TA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Opció invàlida: s'esperava una de ${N(n.values," o ")}`;case"too_big":{const a=n.inclusive?"com a màxim":"menys de",i=t(n.origin);return i?`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${a} ${n.maximum.toString()} ${i.unit??"elements"}`:`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${a} ${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?"com a mínim":"més de",i=t(n.origin);return i?`Massa petit: s'esperava que ${n.origin} contingués ${a} ${n.minimum.toString()} ${i.unit}`:`Massa petit: s'esperava que ${n.origin} fos ${a} ${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Format invàlid: ha de començar amb "${a.prefix}"`:a.format==="ends_with"?`Format invàlid: ha d'acabar amb "${a.suffix}"`:a.format==="includes"?`Format invàlid: ha d'incloure "${a.includes}"`:a.format==="regex"?`Format invàlid: ha de coincidir amb el patró ${a.pattern}`:`Format invàlid per a ${o[a.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function $A(){return{localeError:TA()}}const OA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${a}${n.maximum.toString()} ${i.unit??"prvků"}`:`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${a}${n.minimum.toString()} ${i.unit??"prvků"}`:`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Neplatný řetězec: musí začínat na "${a.prefix}"`:a.format==="ends_with"?`Neplatný řetězec: musí končit na "${a.suffix}"`:a.format==="includes"?`Neplatný řetězec: musí obsahovat "${a.includes}"`:a.format==="regex"?`Neplatný řetězec: musí odpovídat vzoru ${a.pattern}`:`Neplatný formát ${o[a.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${N(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function CA(){return{localeError:OA()}}const AA=()=>{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(i){return e[i]??null}function o(i){return t[i]??i}const n=i=>{const s=typeof i;switch(s){case"number":return Number.isNaN(i)?"NaN":"tal";case"object":return Array.isArray(i)?"liste":i===null?"null":Object.getPrototypeOf(i)!==Object.prototype&&i.constructor?i.constructor.name:"objekt"}return s},a={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 i=>{switch(i.code){case"invalid_type":return`Ugyldigt input: forventede ${o(i.expected)}, fik ${o(n(i.input))}`;case"invalid_value":return i.values.length===1?`Ugyldig værdi: forventede ${Y(i.values[0])}`:`Ugyldigt valg: forventede en af følgende ${N(i.values,"|")}`;case"too_big":{const s=i.inclusive?"<=":"<",c=r(i.origin),l=o(i.origin);return c?`For stor: forventede ${l??"value"} ${c.verb} ${s} ${i.maximum.toString()} ${c.unit??"elementer"}`:`For stor: forventede ${l??"value"} havde ${s} ${i.maximum.toString()}`}case"too_small":{const s=i.inclusive?">=":">",c=r(i.origin),l=o(i.origin);return c?`For lille: forventede ${l} ${c.verb} ${s} ${i.minimum.toString()} ${c.unit}`:`For lille: forventede ${l} havde ${s} ${i.minimum.toString()}`}case"invalid_format":{const s=i;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 ${a[s.format]??i.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${i.divisor}`;case"unrecognized_keys":return`${i.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${N(i.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${i.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${i.origin}`;default:return"Ugyldigt input"}}};function RA(){return{localeError:AA()}}const NA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Ungültige Option: erwartet eine von ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Zu groß: erwartet, dass ${n.origin??"Wert"} ${a}${n.maximum.toString()} ${i.unit??"Elemente"} hat`:`Zu groß: erwartet, dass ${n.origin??"Wert"} ${a}${n.maximum.toString()} ist`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Zu klein: erwartet, dass ${n.origin} ${a}${n.minimum.toString()} ${i.unit} hat`:`Zu klein: erwartet, dass ${n.origin} ${a}${n.minimum.toString()} ist`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Ungültiger String: muss mit "${a.prefix}" beginnen`:a.format==="ends_with"?`Ungültiger String: muss mit "${a.suffix}" enden`:a.format==="includes"?`Ungültiger String: muss "${a.includes}" enthalten`:a.format==="regex"?`Ungültiger String: muss dem Muster ${a.pattern} entsprechen`:`Ungültig: ${o[a.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function PA(){return{localeError:NA()}}const jA=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},MA=()=>{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 ${jA(o.input)}`;case"invalid_value":return o.values.length===1?`Invalid input: expected ${Y(o.values[0])}`:`Invalid option: expected one of ${N(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${n}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${n}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Invalid string: must start with "${n.prefix}"`:n.format==="ends_with"?`Invalid string: must end with "${n.suffix}"`:n.format==="includes"?`Invalid string: must include "${n.includes}"`:n.format==="regex"?`Invalid string: must match pattern ${n.pattern}`:`Invalid ${r[n.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${N(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function Iw(){return{localeError:MA()}}const DA=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},zA=()=>{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 ${DA(o.input)}`;case"invalid_value":return o.values.length===1?`Nevalida enigo: atendiĝis ${Y(o.values[0])}`:`Nevalida opcio: atendiĝis unu el ${N(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()} ${a.unit??"elementojn"}`:`Tro granda: atendiĝis ke ${o.origin??"valoro"} havu ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",a=t(o.origin);return a?`Tro malgranda: atendiĝis ke ${o.origin} havu ${n}${o.minimum.toString()} ${a.unit}`:`Tro malgranda: atendiĝis ke ${o.origin} estu ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Nevalida karaktraro: devas komenciĝi per "${n.prefix}"`:n.format==="ends_with"?`Nevalida karaktraro: devas finiĝi per "${n.suffix}"`:n.format==="includes"?`Nevalida karaktraro: devas inkluzivi "${n.includes}"`:n.format==="regex"?`Nevalida karaktraro: devas kongrui kun la modelo ${n.pattern}`:`Nevalida ${r[n.format]??o.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${o.divisor}`;case"unrecognized_keys":return`Nekonata${o.keys.length>1?"j":""} ŝlosilo${o.keys.length>1?"j":""}: ${N(o.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${o.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${o.origin}`;default:return"Nevalida enigo"}}};function UA(){return{localeError:zA()}}const LA=()=>{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(i){return e[i]??null}function o(i){return t[i]??i}const n=i=>{const s=typeof i;switch(s){case"number":return Number.isNaN(i)?"NaN":"number";case"object":return Array.isArray(i)?"array":i===null?"null":Object.getPrototypeOf(i)!==Object.prototype?i.constructor.name:"object"}return s},a={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 i=>{switch(i.code){case"invalid_type":return`Entrada inválida: se esperaba ${o(i.expected)}, recibido ${o(n(i.input))}`;case"invalid_value":return i.values.length===1?`Entrada inválida: se esperaba ${Y(i.values[0])}`:`Opción inválida: se esperaba una de ${N(i.values,"|")}`;case"too_big":{const s=i.inclusive?"<=":"<",c=r(i.origin),l=o(i.origin);return c?`Demasiado grande: se esperaba que ${l??"valor"} tuviera ${s}${i.maximum.toString()} ${c.unit??"elementos"}`:`Demasiado grande: se esperaba que ${l??"valor"} fuera ${s}${i.maximum.toString()}`}case"too_small":{const s=i.inclusive?">=":">",c=r(i.origin),l=o(i.origin);return c?`Demasiado pequeño: se esperaba que ${l} tuviera ${s}${i.minimum.toString()} ${c.unit}`:`Demasiado pequeño: se esperaba que ${l} fuera ${s}${i.minimum.toString()}`}case"invalid_format":{const s=i;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 ${a[s.format]??i.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${i.divisor}`;case"unrecognized_keys":return`Llave${i.keys.length>1?"s":""} desconocida${i.keys.length>1?"s":""}: ${N(i.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o(i.origin)}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o(i.origin)}`;default:return"Entrada inválida"}}};function FA(){return{localeError:LA()}}const VA=()=>{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 a=typeof n;switch(a){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 a},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?`ورودی نامعتبر: می‌بایست ${Y(n.values[0])} می‌بود`:`گزینه نامعتبر: می‌بایست یکی از ${N(n.values,"|")} می‌بود`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`خیلی بزرگ: ${n.origin??"مقدار"} باید ${a}${n.maximum.toString()} ${i.unit??"عنصر"} باشد`:`خیلی بزرگ: ${n.origin??"مقدار"} باید ${a}${n.maximum.toString()} باشد`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`خیلی کوچک: ${n.origin} باید ${a}${n.minimum.toString()} ${i.unit} باشد`:`خیلی کوچک: ${n.origin} باید ${a}${n.minimum.toString()} باشد`}case"invalid_format":{const a=n;return a.format==="starts_with"?`رشته نامعتبر: باید با "${a.prefix}" شروع شود`:a.format==="ends_with"?`رشته نامعتبر: باید با "${a.suffix}" تمام شود`:a.format==="includes"?`رشته نامعتبر: باید شامل "${a.includes}" باشد`:a.format==="regex"?`رشته نامعتبر: باید با الگوی ${a.pattern} مطابقت داشته باشد`:`${o[a.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${N(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function ZA(){return{localeError:VA()}}const qA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Liian suuri: ${i.subject} täytyy olla ${a}${n.maximum.toString()} ${i.unit}`.trim():`Liian suuri: arvon täytyy olla ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Liian pieni: ${i.subject} täytyy olla ${a}${n.minimum.toString()} ${i.unit}`.trim():`Liian pieni: arvon täytyy olla ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Virheellinen syöte: täytyy alkaa "${a.prefix}"`:a.format==="ends_with"?`Virheellinen syöte: täytyy loppua "${a.suffix}"`:a.format==="includes"?`Virheellinen syöte: täytyy sisältää "${a.includes}"`:a.format==="regex"?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${a.pattern}`:`Virheellinen ${o[a.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${N(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function BA(){return{localeError:qA()}}const GA=()=>{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 a=typeof n;switch(a){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 a},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 : ${Y(n.values[0])} attendu`:`Option invalide : une valeur parmi ${N(n.values,"|")} attendue`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Trop grand : ${n.origin??"valeur"} doit ${i.verb} ${a}${n.maximum.toString()} ${i.unit??"élément(s)"}`:`Trop grand : ${n.origin??"valeur"} doit être ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Trop petit : ${n.origin} doit ${i.verb} ${a}${n.minimum.toString()} ${i.unit}`:`Trop petit : ${n.origin} doit être ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Chaîne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Chaîne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Chaîne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Chaîne invalide : doit correspondre au modèle ${a.pattern}`:`${o[a.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${N(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function HA(){return{localeError:GA()}}const WA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"≤":"<",i=t(n.origin);return i?`Trop grand : attendu que ${n.origin??"la valeur"} ait ${a}${n.maximum.toString()} ${i.unit}`:`Trop grand : attendu que ${n.origin??"la valeur"} soit ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?"≥":">",i=t(n.origin);return i?`Trop petit : attendu que ${n.origin} ait ${a}${n.minimum.toString()} ${i.unit}`:`Trop petit : attendu que ${n.origin} soit ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Chaîne invalide : doit commencer par "${a.prefix}"`:a.format==="ends_with"?`Chaîne invalide : doit se terminer par "${a.suffix}"`:a.format==="includes"?`Chaîne invalide : doit inclure "${a.includes}"`:a.format==="regex"?`Chaîne invalide : doit correspondre au motif ${a.pattern}`:`${o[a.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${N(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function JA(){return{localeError:WA()}}const KA=()=>{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)}`,a=l=>(r(l)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",i=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),m=s(l.input),f=e[m]?.label??m;return`קלט לא תקין: צריך להיות ${d}, התקבל ${f}`}case"invalid_value":{if(l.values.length===1)return`ערך לא תקין: הערך חייב להיות ${Y(l.values[0])}`;const u=l.values.map(f=>Y(f));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=i(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.longLabel??"ארוך"} מדי: ${d} צריכה להכיל ${l.maximum.toString()} ${u?.unit??""} ${l.inclusive?"או פחות":"לכל היותר"}`.trim();if(l.origin==="number"){const g=l.inclusive?`קטן או שווה ל-${l.maximum}`:`קטן מ-${l.maximum}`;return`גדול מדי: ${d} צריך להיות ${g}`}if(l.origin==="array"||l.origin==="set"){const g=l.origin==="set"?"צריכה":"צריך",h=l.inclusive?`${l.maximum} ${u?.unit??""} או פחות`:`פחות מ-${l.maximum} ${u?.unit??""}`;return`גדול מדי: ${d} ${g} להכיל ${h}`.trim()}const m=l.inclusive?"<=":"<",f=a(l.origin??"value");return u?.unit?`${u.longLabel} מדי: ${d} ${f} ${m}${l.maximum.toString()} ${u.unit}`:`${u?.longLabel??"גדול"} מדי: ${d} ${f} ${m}${l.maximum.toString()}`}case"too_small":{const u=i(l.origin),d=n(l.origin??"value");if(l.origin==="string")return`${u?.shortLabel??"קצר"} מדי: ${d} צריכה להכיל ${l.minimum.toString()} ${u?.unit??""} ${l.inclusive?"או יותר":"לפחות"}`.trim();if(l.origin==="number"){const g=l.inclusive?`גדול או שווה ל-${l.minimum}`:`גדול מ-${l.minimum}`;return`קטן מדי: ${d} צריך להיות ${g}`}if(l.origin==="array"||l.origin==="set"){const g=l.origin==="set"?"צריכה":"צריך";if(l.minimum===1&&l.inclusive){const v=(l.origin==="set","לפחות פריט אחד");return`קטן מדי: ${d} ${g} להכיל ${v}`}const h=l.inclusive?`${l.minimum} ${u?.unit??""} או יותר`:`יותר מ-${l.minimum} ${u?.unit??""}`;return`קטן מדי: ${d} ${g} להכיל ${h}`.trim()}const m=l.inclusive?">=":">",f=a(l.origin??"value");return u?.unit?`${u.shortLabel} מדי: ${d} ${f} ${m}${l.minimum.toString()} ${u.unit}`:`${u?.shortLabel??"קטן"} מדי: ${d} ${f} ${m}${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],m=d?.label??u.format,g=(d?.gender??"m")==="f"?"תקינה":"תקין";return`${m} לא ${g}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${l.divisor}`;case"unrecognized_keys":return`מפתח${l.keys.length>1?"ות":""} לא מזוה${l.keys.length>1?"ים":"ה"}: ${N(l.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(l.origin??"array")}`;default:return"קלט לא תקין"}}};function YA(){return{localeError:KA()}}const XA=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${a}${n.maximum.toString()} ${i.unit??"elem"}`:`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${a}${n.minimum.toString()} ${i.unit}`:`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Érvénytelen string: "${a.prefix}" értékkel kell kezdődnie`:a.format==="ends_with"?`Érvénytelen string: "${a.suffix}" értékkel kell végződnie`:a.format==="includes"?`Érvénytelen string: "${a.includes}" értéket kell tartalmaznia`:a.format==="regex"?`Érvénytelen string: ${a.pattern} mintának kell megfelelnie`:`Érvénytelen ${o[a.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function QA(){return{localeError:XA()}}const eR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${a}${n.maximum.toString()} ${i.unit??"elemen"}`:`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Terlalu kecil: diharapkan ${n.origin} memiliki ${a}${n.minimum.toString()} ${i.unit}`:`Terlalu kecil: diharapkan ${n.origin} menjadi ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`String tidak valid: harus dimulai dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak valid: harus berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak valid: harus menyertakan "${a.includes}"`:a.format==="regex"?`String tidak valid: harus sesuai pola ${a.pattern}`:`${o[a.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function tR(){return{localeError:eR()}}const rR=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},nR=()=>{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 ${rR(o.input)} þar sem á að vera ${o.expected}`;case"invalid_value":return o.values.length===1?`Rangt gildi: gert ráð fyrir ${Y(o.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${N(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`Of stórt: gert er ráð fyrir að ${o.origin??"gildi"} hafi ${n}${o.maximum.toString()} ${a.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?">=":">",a=t(o.origin);return a?`Of lítið: gert er ráð fyrir að ${o.origin} hafi ${n}${o.minimum.toString()} ${a.unit}`:`Of lítið: gert er ráð fyrir að ${o.origin} sé ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Ógildur strengur: verður að byrja á "${n.prefix}"`:n.format==="ends_with"?`Ógildur strengur: verður að enda á "${n.suffix}"`:n.format==="includes"?`Ógildur strengur: verður að innihalda "${n.includes}"`:n.format==="regex"?`Ógildur strengur: verður að fylgja mynstri ${n.pattern}`:`Rangt ${r[n.format]??o.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${o.divisor}`;case"unrecognized_keys":return`Óþekkt ${o.keys.length>1?"ir lyklar":"ur lykill"}: ${N(o.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${o.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${o.origin}`;default:return"Rangt gildi"}}};function oR(){return{localeError:nR()}}const aR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Opzione non valida: atteso uno tra ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Troppo grande: ${n.origin??"valore"} deve avere ${a}${n.maximum.toString()} ${i.unit??"elementi"}`:`Troppo grande: ${n.origin??"valore"} deve essere ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Troppo piccolo: ${n.origin} deve avere ${a}${n.minimum.toString()} ${i.unit}`:`Troppo piccolo: ${n.origin} deve essere ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Stringa non valida: deve iniziare con "${a.prefix}"`:a.format==="ends_with"?`Stringa non valida: deve terminare con "${a.suffix}"`:a.format==="includes"?`Stringa non valida: deve includere "${a.includes}"`:a.format==="regex"?`Stringa non valida: deve corrispondere al pattern ${a.pattern}`:`Invalid ${o[a.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${N(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function iR(){return{localeError:aR()}}const sR=()=>{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 a=typeof n;switch(a){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 a},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?`無効な入力: ${Y(n.values[0])}が期待されました`:`無効な選択: ${N(n.values,"、")}のいずれかである必要があります`;case"too_big":{const a=n.inclusive?"以下である":"より小さい",i=t(n.origin);return i?`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i.unit??"要素"}${a}必要があります`:`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a}必要があります`}case"too_small":{const a=n.inclusive?"以上である":"より大きい",i=t(n.origin);return i?`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i.unit}${a}必要があります`:`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a}必要があります`}case"invalid_format":{const a=n;return a.format==="starts_with"?`無効な文字列: "${a.prefix}"で始まる必要があります`:a.format==="ends_with"?`無効な文字列: "${a.suffix}"で終わる必要があります`:a.format==="includes"?`無効な文字列: "${a.includes}"を含む必要があります`:a.format==="regex"?`無効な文字列: パターン${a.pattern}に一致する必要があります`:`無効な${o[a.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${N(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function cR(){return{localeError:sR()}}const lR=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},uR=()=>{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}, მიღებული ${lR(o.input)}`;case"invalid_value":return o.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${Y(o.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${N(o.values,"|")}-დან`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} ${a.verb} ${n}${o.maximum.toString()} ${a.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${o.origin??"მნიშვნელობა"} იყოს ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",a=t(o.origin);return a?`ზედმეტად პატარა: მოსალოდნელი ${o.origin} ${a.verb} ${n}${o.minimum.toString()} ${a.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${o.origin} იყოს ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`არასწორი სტრინგი: უნდა იწყებოდეს "${n.prefix}"-ით`:n.format==="ends_with"?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${n.suffix}"-ით`:n.format==="includes"?`არასწორი სტრინგი: უნდა შეიცავდეს "${n.includes}"-ს`:n.format==="regex"?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${n.pattern}`:`არასწორი ${r[n.format]??o.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${o.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${o.keys.length>1?"ები":"ი"}: ${N(o.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${o.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${o.origin}-ში`;default:return"არასწორი შეყვანა"}}};function dR(){return{localeError:uR()}}const mR=()=>{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 a=typeof n;switch(a){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 a},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?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${Y(n.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${a} ${n.maximum.toString()} ${i.unit??"ធាតុ"}`:`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${a} ${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`តូចពេក៖ ត្រូវការ ${n.origin} ${a} ${n.minimum.toString()} ${i.unit}`:`តូចពេក៖ ត្រូវការ ${n.origin} ${a} ${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${a.prefix}"`:a.format==="ends_with"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${a.suffix}"`:a.format==="includes"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${a.includes}"`:a.format==="regex"?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${a.pattern}`:`មិនត្រឹមត្រូវ៖ ${o[a.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${N(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function Tw(){return{localeError:mR()}}function fR(){return Tw()}const pR=()=>{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 a=typeof n;switch(a){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 a},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?`잘못된 입력: 값은 ${Y(n.values[0])} 이어야 합니다`:`잘못된 옵션: ${N(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{const a=n.inclusive?"이하":"미만",i=a==="미만"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${a}${i}`:`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${a}${i}`}case"too_small":{const a=n.inclusive?"이상":"초과",i=a==="이상"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";return s?`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${a}${i}`:`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${a}${i}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`잘못된 문자열: "${a.prefix}"(으)로 시작해야 합니다`:a.format==="ends_with"?`잘못된 문자열: "${a.suffix}"(으)로 끝나야 합니다`:a.format==="includes"?`잘못된 문자열: "${a.includes}"을(를) 포함해야 합니다`:a.format==="regex"?`잘못된 문자열: 정규식 ${a.pattern} 패턴과 일치해야 합니다`:`잘못된 ${o[a.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${N(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function hR(){return{localeError:pR()}}const gR=e=>Wo(typeof e,e),Wo=(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},zo=e=>e.charAt(0).toUpperCase()+e.slice(1);function Eh(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 vR=()=>{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,a,i){const s=e[o]??null;return s===null?s:{unit:s.unit[n],verb:s.verb[i][a?"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 ${gR(o.input)}, o tikėtasi - ${Wo(o.expected)}`;case"invalid_value":return o.values.length===1?`Privalo būti ${Y(o.values[0])}`:`Privalo būti vienas iš ${N(o.values,"|")} pasirinkimų`;case"too_big":{const n=Wo(o.origin),a=t(o.origin,Eh(Number(o.maximum)),o.inclusive??!1,"smaller");if(a?.verb)return`${zo(n??o.origin??"reikšmė")} ${a.verb} ${o.maximum.toString()} ${a.unit??"elementų"}`;const i=o.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${zo(n??o.origin??"reikšmė")} turi būti ${i} ${o.maximum.toString()} ${a?.unit}`}case"too_small":{const n=Wo(o.origin),a=t(o.origin,Eh(Number(o.minimum)),o.inclusive??!1,"bigger");if(a?.verb)return`${zo(n??o.origin??"reikšmė")} ${a.verb} ${o.minimum.toString()} ${a.unit??"elementų"}`;const i=o.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${zo(n??o.origin??"reikšmė")} turi būti ${i} ${o.minimum.toString()} ${a?.unit}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Eilutė privalo prasidėti "${n.prefix}"`:n.format==="ends_with"?`Eilutė privalo pasibaigti "${n.suffix}"`:n.format==="includes"?`Eilutė privalo įtraukti "${n.includes}"`:n.format==="regex"?`Eilutė privalo atitikti ${n.pattern}`:`Neteisingas ${r[n.format]??o.format}`}case"not_multiple_of":return`Skaičius privalo būti ${o.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${o.keys.length>1?"i":"as"} rakt${o.keys.length>1?"ai":"as"}: ${N(o.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{const n=Wo(o.origin);return`${zo(n??o.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function yR(){return{localeError:vR()}}const bR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Грешана опција: се очекува една ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${a}${n.maximum.toString()} ${i.unit??"елементи"}`:`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Премногу мал: се очекува ${n.origin} да има ${a}${n.minimum.toString()} ${i.unit}`:`Премногу мал: се очекува ${n.origin} да биде ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Неважечка низа: мора да започнува со "${a.prefix}"`:a.format==="ends_with"?`Неважечка низа: мора да завршува со "${a.suffix}"`:a.format==="includes"?`Неважечка низа: мора да вклучува "${a.includes}"`:a.format==="regex"?`Неважечка низа: мора да одгоара на патернот ${a.pattern}`:`Invalid ${o[a.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${N(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function _R(){return{localeError:bR()}}const wR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Terlalu besar: dijangka ${n.origin??"nilai"} ${i.verb} ${a}${n.maximum.toString()} ${i.unit??"elemen"}`:`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Terlalu kecil: dijangka ${n.origin} ${i.verb} ${a}${n.minimum.toString()} ${i.unit}`:`Terlalu kecil: dijangka ${n.origin} adalah ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`String tidak sah: mesti bermula dengan "${a.prefix}"`:a.format==="ends_with"?`String tidak sah: mesti berakhir dengan "${a.suffix}"`:a.format==="includes"?`String tidak sah: mesti mengandungi "${a.includes}"`:a.format==="regex"?`String tidak sah: mesti sepadan dengan corak ${a.pattern}`:`${o[a.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${N(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function xR(){return{localeError:wR()}}const SR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Ongeldige optie: verwacht één van ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Te groot: verwacht dat ${n.origin??"waarde"} ${i.verb} ${a}${n.maximum.toString()} ${i.unit??"elementen"}`:`Te groot: verwacht dat ${n.origin??"waarde"} ${a}${n.maximum.toString()} is`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Te klein: verwacht dat ${n.origin} ${i.verb} ${a}${n.minimum.toString()} ${i.unit}`:`Te klein: verwacht dat ${n.origin} ${a}${n.minimum.toString()} is`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Ongeldige tekst: moet met "${a.prefix}" beginnen`:a.format==="ends_with"?`Ongeldige tekst: moet op "${a.suffix}" eindigen`:a.format==="includes"?`Ongeldige tekst: moet "${a.includes}" bevatten`:a.format==="regex"?`Ongeldige tekst: moet overeenkomen met patroon ${a.pattern}`:`Ongeldig: ${o[a.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function kR(){return{localeError:SR()}}const ER=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Ugyldig valg: forventet en av ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`For stor(t): forventet ${n.origin??"value"} til å ha ${a}${n.maximum.toString()} ${i.unit??"elementer"}`:`For stor(t): forventet ${n.origin??"value"} til å ha ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`For lite(n): forventet ${n.origin} til å ha ${a}${n.minimum.toString()} ${i.unit}`:`For lite(n): forventet ${n.origin} til å ha ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Ugyldig streng: må starte med "${a.prefix}"`:a.format==="ends_with"?`Ugyldig streng: må ende med "${a.suffix}"`:a.format==="includes"?`Ugyldig streng: må inneholde "${a.includes}"`:a.format==="regex"?`Ugyldig streng: må matche mønsteret ${a.pattern}`:`Ugyldig ${o[a.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function IR(){return{localeError:ER()}}const TR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Fâsit tercih: mûteberler ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Fazla büyük: ${n.origin??"value"}, ${a}${n.maximum.toString()} ${i.unit??"elements"} sahip olmalıydı.`:`Fazla büyük: ${n.origin??"value"}, ${a}${n.maximum.toString()} olmalıydı.`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Fazla küçük: ${n.origin}, ${a}${n.minimum.toString()} ${i.unit} sahip olmalıydı.`:`Fazla küçük: ${n.origin}, ${a}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Fâsit metin: "${a.prefix}" ile başlamalı.`:a.format==="ends_with"?`Fâsit metin: "${a.suffix}" ile bitmeli.`:a.format==="includes"?`Fâsit metin: "${a.includes}" ihtivâ etmeli.`:a.format==="regex"?`Fâsit metin: ${a.pattern} nakşına uymalı.`:`Fâsit ${o[a.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function $R(){return{localeError:TR()}}const OR=()=>{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 a=typeof n;switch(a){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 a},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?`ناسم ورودي: باید ${Y(n.values[0])} وای`:`ناسم انتخاب: باید یو له ${N(n.values,"|")} څخه وای`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`ډیر لوی: ${n.origin??"ارزښت"} باید ${a}${n.maximum.toString()} ${i.unit??"عنصرونه"} ولري`:`ډیر لوی: ${n.origin??"ارزښت"} باید ${a}${n.maximum.toString()} وي`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`ډیر کوچنی: ${n.origin} باید ${a}${n.minimum.toString()} ${i.unit} ولري`:`ډیر کوچنی: ${n.origin} باید ${a}${n.minimum.toString()} وي`}case"invalid_format":{const a=n;return a.format==="starts_with"?`ناسم متن: باید د "${a.prefix}" سره پیل شي`:a.format==="ends_with"?`ناسم متن: باید د "${a.suffix}" سره پای ته ورسيږي`:a.format==="includes"?`ناسم متن: باید "${a.includes}" ولري`:a.format==="regex"?`ناسم متن: باید د ${a.pattern} سره مطابقت ولري`:`${o[a.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${N(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function CR(){return{localeError:OR()}}const AR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${a}${n.maximum.toString()} ${i.unit??"elementów"}`:`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${a}${n.minimum.toString()} ${i.unit??"elementów"}`:`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${a.prefix}"`:a.format==="ends_with"?`Nieprawidłowy ciąg znaków: musi kończyć się na "${a.suffix}"`:a.format==="includes"?`Nieprawidłowy ciąg znaków: musi zawierać "${a.includes}"`:a.format==="regex"?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${a.pattern}`:`Nieprawidłow(y/a/e) ${o[a.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function RR(){return{localeError:AR()}}const NR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Opção inválida: esperada uma das ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Muito grande: esperado que ${n.origin??"valor"} tivesse ${a}${n.maximum.toString()} ${i.unit??"elementos"}`:`Muito grande: esperado que ${n.origin??"valor"} fosse ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Muito pequeno: esperado que ${n.origin} tivesse ${a}${n.minimum.toString()} ${i.unit}`:`Muito pequeno: esperado que ${n.origin} fosse ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Texto inválido: deve começar com "${a.prefix}"`:a.format==="ends_with"?`Texto inválido: deve terminar com "${a.suffix}"`:a.format==="includes"?`Texto inválido: deve incluir "${a.includes}"`:a.format==="regex"?`Texto inválido: deve corresponder ao padrão ${a.pattern}`:`${o[a.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function PR(){return{localeError:NR()}}function Ih(e,t,r,o){const n=Math.abs(e),a=n%10,i=n%100;return i>=11&&i<=19?o:a===1?t:a>=2&&a<=4?r:o}const jR=()=>{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 a=typeof n;switch(a){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 a},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?`Неверный ввод: ожидалось ${Y(n.values[0])}`:`Неверный вариант: ожидалось одно из ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);if(i){const s=Number(n.maximum),c=Ih(s,i.unit.one,i.unit.few,i.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${a}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);if(i){const s=Number(n.minimum),c=Ih(s,i.unit.one,i.unit.few,i.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${a}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Неверная строка: должна начинаться с "${a.prefix}"`:a.format==="ends_with"?`Неверная строка: должна заканчиваться на "${a.suffix}"`:a.format==="includes"?`Неверная строка: должна содержать "${a.includes}"`:a.format==="regex"?`Неверная строка: должна соответствовать шаблону ${a.pattern}`:`Неверный ${o[a.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function MR(){return{localeError:jR()}}const DR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${a}${n.maximum.toString()} ${i.unit??"elementov"}`:`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Premajhno: pričakovano, da bo ${n.origin} imelo ${a}${n.minimum.toString()} ${i.unit}`:`Premajhno: pričakovano, da bo ${n.origin} ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Neveljaven niz: mora se začeti z "${a.prefix}"`:a.format==="ends_with"?`Neveljaven niz: mora se končati z "${a.suffix}"`:a.format==="includes"?`Neveljaven niz: mora vsebovati "${a.includes}"`:a.format==="regex"?`Neveljaven niz: mora ustrezati vzorcu ${a.pattern}`:`Neveljaven ${o[a.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function zR(){return{localeError:DR()}}const UR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Ogiltigt val: förväntade en av ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`För stor(t): förväntade ${n.origin??"värdet"} att ha ${a}${n.maximum.toString()} ${i.unit??"element"}`:`För stor(t): förväntat ${n.origin??"värdet"} att ha ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`För lite(t): förväntade ${n.origin??"värdet"} att ha ${a}${n.minimum.toString()} ${i.unit}`:`För lite(t): förväntade ${n.origin??"värdet"} att ha ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Ogiltig sträng: måste börja med "${a.prefix}"`:a.format==="ends_with"?`Ogiltig sträng: måste sluta med "${a.suffix}"`:a.format==="includes"?`Ogiltig sträng: måste innehålla "${a.includes}"`:a.format==="regex"?`Ogiltig sträng: måste matcha mönstret "${a.pattern}"`:`Ogiltig(t) ${o[a.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function LR(){return{localeError:UR()}}const FR=()=>{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 a=typeof n;switch(a){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 a},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?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${Y(n.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${N(n.values,"|")} இல் ஒன்று`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${a}${n.maximum.toString()} ${i.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${a}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${a}${n.minimum.toString()} ${i.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${a}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{const a=n;return a.format==="starts_with"?`தவறான சரம்: "${a.prefix}" இல் தொடங்க வேண்டும்`:a.format==="ends_with"?`தவறான சரம்: "${a.suffix}" இல் முடிவடைய வேண்டும்`:a.format==="includes"?`தவறான சரம்: "${a.includes}" ஐ உள்ளடக்க வேண்டும்`:a.format==="regex"?`தவறான சரம்: ${a.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${o[a.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function VR(){return{localeError:FR()}}const ZR=()=>{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 a=typeof n;switch(a){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 a},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?`ค่าไม่ถูกต้อง: ควรเป็น ${Y(n.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"ไม่เกิน":"น้อยกว่า",i=t(n.origin);return i?`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${a} ${n.maximum.toString()} ${i.unit??"รายการ"}`:`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${a} ${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?"อย่างน้อย":"มากกว่า",i=t(n.origin);return i?`น้อยกว่ากำหนด: ${n.origin} ควรมี${a} ${n.minimum.toString()} ${i.unit}`:`น้อยกว่ากำหนด: ${n.origin} ควรมี${a} ${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${a.prefix}"`:a.format==="ends_with"?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${a.suffix}"`:a.format==="includes"?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${a.includes}" อยู่ในข้อความ`:a.format==="regex"?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${a.pattern}`:`รูปแบบไม่ถูกต้อง: ${o[a.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${N(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function qR(){return{localeError:ZR()}}const BR=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},GR=()=>{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 ${BR(o.input)}`;case"invalid_value":return o.values.length===1?`Geçersiz değer: beklenen ${Y(o.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${N(o.values,"|")}`;case"too_big":{const n=o.inclusive?"<=":"<",a=t(o.origin);return a?`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()} ${a.unit??"öğe"}`:`Çok büyük: beklenen ${o.origin??"değer"} ${n}${o.maximum.toString()}`}case"too_small":{const n=o.inclusive?">=":">",a=t(o.origin);return a?`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()} ${a.unit}`:`Çok küçük: beklenen ${o.origin} ${n}${o.minimum.toString()}`}case"invalid_format":{const n=o;return n.format==="starts_with"?`Geçersiz metin: "${n.prefix}" ile başlamalı`:n.format==="ends_with"?`Geçersiz metin: "${n.suffix}" ile bitmeli`:n.format==="includes"?`Geçersiz metin: "${n.includes}" içermeli`:n.format==="regex"?`Geçersiz metin: ${n.pattern} desenine uymalı`:`Geçersiz ${r[n.format]??o.format}`}case"not_multiple_of":return`Geçersiz sayı: ${o.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${o.keys.length>1?"lar":""}: ${N(o.keys,", ")}`;case"invalid_key":return`${o.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${o.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function HR(){return{localeError:GR()}}const WR=()=>{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 a=typeof n;switch(a){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 a},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?`Неправильні вхідні дані: очікується ${Y(n.values[0])}`:`Неправильна опція: очікується одне з ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Занадто велике: очікується, що ${n.origin??"значення"} ${i.verb} ${a}${n.maximum.toString()} ${i.unit??"елементів"}`:`Занадто велике: очікується, що ${n.origin??"значення"} буде ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Занадто мале: очікується, що ${n.origin} ${i.verb} ${a}${n.minimum.toString()} ${i.unit}`:`Занадто мале: очікується, що ${n.origin} буде ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Неправильний рядок: повинен починатися з "${a.prefix}"`:a.format==="ends_with"?`Неправильний рядок: повинен закінчуватися на "${a.suffix}"`:a.format==="includes"?`Неправильний рядок: повинен містити "${a.includes}"`:a.format==="regex"?`Неправильний рядок: повинен відповідати шаблону ${a.pattern}`:`Неправильний ${o[a.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function $w(){return{localeError:WR()}}function JR(){return $w()}const KR=()=>{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 a=typeof n;switch(a){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 a},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?`غلط ان پٹ: ${Y(n.values[0])} متوقع تھا`:`غلط آپشن: ${N(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`بہت بڑا: ${n.origin??"ویلیو"} کے ${a}${n.maximum.toString()} ${i.unit??"عناصر"} ہونے متوقع تھے`:`بہت بڑا: ${n.origin??"ویلیو"} کا ${a}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`بہت چھوٹا: ${n.origin} کے ${a}${n.minimum.toString()} ${i.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${n.origin} کا ${a}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{const a=n;return a.format==="starts_with"?`غلط سٹرنگ: "${a.prefix}" سے شروع ہونا چاہیے`:a.format==="ends_with"?`غلط سٹرنگ: "${a.suffix}" پر ختم ہونا چاہیے`:a.format==="includes"?`غلط سٹرنگ: "${a.includes}" شامل ہونا چاہیے`:a.format==="regex"?`غلط سٹرنگ: پیٹرن ${a.pattern} سے میچ ہونا چاہیے`:`غلط ${o[a.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function YR(){return{localeError:KR()}}const XR=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i.verb} ${a}${n.maximum.toString()} ${i.unit??"phần tử"}`:`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Quá nhỏ: mong đợi ${n.origin} ${i.verb} ${a}${n.minimum.toString()} ${i.unit}`:`Quá nhỏ: mong đợi ${n.origin} ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Chuỗi không hợp lệ: phải bắt đầu bằng "${a.prefix}"`:a.format==="ends_with"?`Chuỗi không hợp lệ: phải kết thúc bằng "${a.suffix}"`:a.format==="includes"?`Chuỗi không hợp lệ: phải bao gồm "${a.includes}"`:a.format==="regex"?`Chuỗi không hợp lệ: phải khớp với mẫu ${a.pattern}`:`${o[a.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${N(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function QR(){return{localeError:XR()}}const eN=()=>{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 a=typeof n;switch(a){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 a},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?`无效输入:期望 ${Y(n.values[0])}`:`无效选项:期望以下之一 ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`数值过大:期望 ${n.origin??"值"} ${a}${n.maximum.toString()} ${i.unit??"个元素"}`:`数值过大:期望 ${n.origin??"值"} ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`数值过小:期望 ${n.origin} ${a}${n.minimum.toString()} ${i.unit}`:`数值过小:期望 ${n.origin} ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`无效字符串:必须以 "${a.prefix}" 开头`:a.format==="ends_with"?`无效字符串:必须以 "${a.suffix}" 结尾`:a.format==="includes"?`无效字符串:必须包含 "${a.includes}"`:a.format==="regex"?`无效字符串:必须满足正则表达式 ${a.pattern}`:`无效${o[a.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function tN(){return{localeError:eN()}}const rN=()=>{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 a=typeof n;switch(a){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 a},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?`無效的輸入值:預期為 ${Y(n.values[0])}`:`無效的選項:預期為以下其中之一 ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`數值過大:預期 ${n.origin??"值"} 應為 ${a}${n.maximum.toString()} ${i.unit??"個元素"}`:`數值過大:預期 ${n.origin??"值"} 應為 ${a}${n.maximum.toString()}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`數值過小:預期 ${n.origin} 應為 ${a}${n.minimum.toString()} ${i.unit}`:`數值過小:預期 ${n.origin} 應為 ${a}${n.minimum.toString()}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`無效的字串:必須以 "${a.prefix}" 開頭`:a.format==="ends_with"?`無效的字串:必須以 "${a.suffix}" 結尾`:a.format==="includes"?`無效的字串:必須包含 "${a.includes}"`:a.format==="regex"?`無效的字串:必須符合格式 ${a.pattern}`:`無效的 ${o[a.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${N(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function nN(){return{localeError:rN()}}const oN=()=>{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 a=typeof n;switch(a){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 a},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 ${Y(n.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${N(n.values,"|")}`;case"too_big":{const a=n.inclusive?"<=":"<",i=t(n.origin);return i?`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${i.verb} ${a}${n.maximum} ${i.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${a}${n.maximum}`}case"too_small":{const a=n.inclusive?">=":">",i=t(n.origin);return i?`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${i.verb} ${a}${n.minimum} ${i.unit}`:`Kéré ju: a ní láti jẹ́ ${a}${n.minimum}`}case"invalid_format":{const a=n;return a.format==="starts_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${a.prefix}"`:a.format==="ends_with"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${a.suffix}"`:a.format==="includes"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${a.includes}"`:a.format==="regex"?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${a.pattern}`:`Aṣìṣe: ${o[a.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${N(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function aN(){return{localeError:oN()}}const Ow=Object.freeze(Object.defineProperty({__proto__:null,ar:bA,az:wA,be:SA,bg:IA,ca:$A,cs:CA,da:RA,de:PA,en:Iw,eo:UA,es:FA,fa:ZA,fi:BA,fr:HA,frCA:JA,he:YA,hu:QA,id:tR,is:oR,it:iR,ja:cR,ka:dR,kh:fR,km:Tw,ko:hR,lt:yR,mk:_R,ms:xR,nl:kR,no:IR,ota:$R,pl:RR,ps:CR,pt:PR,ru:MR,sl:zR,sv:LR,ta:VR,th:qR,tr:HR,ua:JR,uk:$w,ur:YR,vi:QR,yo:aN,zhCN:tN,zhTW:nN},Symbol.toStringTag,{value:"Module"}));var Th;const Cw=Symbol("ZodOutput"),Aw=Symbol("ZodInput");class Rw{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 Rw}(Th=globalThis).__zod_globalRegistry??(Th.__zod_globalRegistry=Qd());const Gt=globalThis.__zod_globalRegistry;function Nw(e,t){return new e({type:"string",...R(t)})}function Pw(e,t){return new e({type:"string",coerce:!0,...R(t)})}function em(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...R(t)})}function fs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...R(t)})}function tm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...R(t)})}function rm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...R(t)})}function nm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...R(t)})}function om(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...R(t)})}function tc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...R(t)})}function am(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...R(t)})}function im(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...R(t)})}function sm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...R(t)})}function cm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...R(t)})}function lm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...R(t)})}function um(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...R(t)})}function dm(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...R(t)})}function mm(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...R(t)})}function fm(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...R(t)})}function jw(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...R(t)})}function pm(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...R(t)})}function hm(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...R(t)})}function gm(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...R(t)})}function vm(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...R(t)})}function ym(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...R(t)})}function bm(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...R(t)})}const Mw={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Dw(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...R(t)})}function zw(e,t){return new e({type:"string",format:"date",check:"string_format",...R(t)})}function Uw(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...R(t)})}function Lw(e,t){return new e({type:"string",format:"duration",check:"string_format",...R(t)})}function Fw(e,t){return new e({type:"number",checks:[],...R(t)})}function Vw(e,t){return new e({type:"number",coerce:!0,checks:[],...R(t)})}function Zw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...R(t)})}function qw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...R(t)})}function Bw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...R(t)})}function Gw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...R(t)})}function Hw(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...R(t)})}function Ww(e,t){return new e({type:"boolean",...R(t)})}function Jw(e,t){return new e({type:"boolean",coerce:!0,...R(t)})}function Kw(e,t){return new e({type:"bigint",...R(t)})}function Yw(e,t){return new e({type:"bigint",coerce:!0,...R(t)})}function Xw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...R(t)})}function Qw(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...R(t)})}function e0(e,t){return new e({type:"symbol",...R(t)})}function t0(e,t){return new e({type:"undefined",...R(t)})}function r0(e,t){return new e({type:"null",...R(t)})}function n0(e){return new e({type:"any"})}function o0(e){return new e({type:"unknown"})}function a0(e,t){return new e({type:"never",...R(t)})}function i0(e,t){return new e({type:"void",...R(t)})}function s0(e,t){return new e({type:"date",...R(t)})}function c0(e,t){return new e({type:"date",coerce:!0,...R(t)})}function l0(e,t){return new e({type:"nan",...R(t)})}function Ur(e,t){return new Bd({check:"less_than",...R(t),value:e,inclusive:!1})}function Mt(e,t){return new Bd({check:"less_than",...R(t),value:e,inclusive:!0})}function Lr(e,t){return new Gd({check:"greater_than",...R(t),value:e,inclusive:!1})}function yt(e,t){return new Gd({check:"greater_than",...R(t),value:e,inclusive:!0})}function _m(e){return Lr(0,e)}function wm(e){return Ur(0,e)}function xm(e){return Mt(0,e)}function Sm(e){return yt(0,e)}function ro(e,t){return new Hb({check:"multiple_of",...R(t),value:e})}function La(e,t){return new Kb({check:"max_size",...R(t),maximum:e})}function no(e,t){return new Yb({check:"min_size",...R(t),minimum:e})}function rc(e,t){return new Xb({check:"size_equals",...R(t),size:e})}function Fa(e,t){return new Qb({check:"max_length",...R(t),maximum:e})}function mn(e,t){return new e_({check:"min_length",...R(t),minimum:e})}function Va(e,t){return new t_({check:"length_equals",...R(t),length:e})}function nc(e,t){return new r_({check:"string_format",format:"regex",...R(t),pattern:e})}function oc(e){return new n_({check:"string_format",format:"lowercase",...R(e)})}function ac(e){return new o_({check:"string_format",format:"uppercase",...R(e)})}function ic(e,t){return new a_({check:"string_format",format:"includes",...R(t),includes:e})}function sc(e,t){return new i_({check:"string_format",format:"starts_with",...R(t),prefix:e})}function cc(e,t){return new s_({check:"string_format",format:"ends_with",...R(t),suffix:e})}function km(e,t,r){return new c_({check:"property",property:e,schema:t,...R(r)})}function lc(e,t){return new l_({check:"mime_type",mime:e,...R(t)})}function Tr(e){return new u_({check:"overwrite",tx:e})}function uc(e){return Tr(t=>t.normalize(e))}function dc(){return Tr(e=>e.trim())}function mc(){return Tr(e=>e.toLowerCase())}function fc(){return Tr(e=>e.toUpperCase())}function pc(){return Tr(e=>Zy(e))}function u0(e,t,r){return new e({type:"array",element:t,...R(r)})}function iN(e,t,r){return new e({type:"union",options:t,...R(r)})}function sN(e,t,r){return new e({type:"union",options:t,inclusive:!1,...R(r)})}function cN(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...R(o)})}function lN(e,t,r){return new e({type:"intersection",left:t,right:r})}function uN(e,t,r,o){const n=r instanceof Q,a=n?o:r,i=n?r:null;return new e({type:"tuple",items:t,rest:i,...R(a)})}function dN(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...R(o)})}function mN(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...R(o)})}function fN(e,t,r){return new e({type:"set",valueType:t,...R(r)})}function pN(e,t,r){const o=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:o,...R(r)})}function hN(e,t,r){return new e({type:"enum",entries:t,...R(r)})}function gN(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...R(r)})}function d0(e,t){return new e({type:"file",...R(t)})}function vN(e,t){return new e({type:"transform",transform:t})}function yN(e,t){return new e({type:"optional",innerType:t})}function bN(e,t){return new e({type:"nullable",innerType:t})}function _N(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Ys(r)}})}function wN(e,t,r){return new e({type:"nonoptional",innerType:t,...R(r)})}function xN(e,t){return new e({type:"success",innerType:t})}function SN(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:()=>r})}function kN(e,t,r){return new e({type:"pipe",in:t,out:r})}function EN(e,t){return new e({type:"readonly",innerType:t})}function IN(e,t,r){return new e({type:"template_literal",parts:t,...R(r)})}function TN(e,t){return new e({type:"lazy",getter:t})}function $N(e,t){return new e({type:"promise",innerType:t})}function m0(e,t,r){const o=R(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function f0(e,t,r){return new e({type:"custom",check:"custom",fn:t,...R(r)})}function p0(e){const t=h0(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(eo(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(eo(n))}},e(r.value,r)));return t}function h0(e,t){const r=new Pe({check:"custom",...R(t)});return r._zod.check=e,r}function g0(e){const t=new Pe({check:"describe"});return t._zod.onattach=[r=>{const o=Gt.get(r)??{};Gt.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function v0(e){const t=new Pe({check:"meta"});return t._zod.onattach=[r=>{const o=Gt.get(r)??{};Gt.add(r,{...o,...e})}],t._zod.check=()=>{},t}function y0(e,t){const r=R(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(f=>typeof f=="string"?f.toLowerCase():f),n=n.map(f=>typeof f=="string"?f.toLowerCase():f));const a=new Set(o),i=new Set(n),s=e.Codec??Xd,c=e.Boolean??Jd,l=e.String??Ua,u=new l({type:"string",error:r.error}),d=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:u,out:d,transform:((f,g)=>{let h=f;return r.case!=="sensitive"&&(h=h.toLowerCase()),a.has(h)?!0:i.has(h)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...a,...i],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((f,g)=>f===!0?o[0]||"true":n[0]||"false"),error:r.error});return m}function Za(e,t,r,o={}){const n=R(o),a={...R(o),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:s=>r.test(s),...n};return r instanceof RegExp&&(a.pattern=r),new e(a)}function oo(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??Gt,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 Te(e,t,r={path:[],schemaPath:[]}){var o;const n=e._zod.def,a=t.seen.get(e);if(a)return a.count++,r.schemaPath.includes(e)&&(a.cycle=r.path),a.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const s=e._zod.toJSONSchema?.();if(s)i.schema=s;else{const u={...r,schemaPath:[...r.schemaPath,e],path:r.path},d=e._zod.parent;if(d)i.ref=d,Te(d,t,u),t.seen.get(d).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{const m=i.schema,f=t.processors[n.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);f(e,t,m,u)}}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ut(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((o=i.schema).default??(o.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function ao(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 i=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const u=e.external.registry.get(a[0])?.id,d=e.external.uri??(f=>f);if(u)return{ref:d(u)};const m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${d("__shared")}#/${i}/${m}`}}if(a[1]===r)return{ref:"#"};const c=`#/${i}/`,l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+l}},n=a=>{if(a[1].schema.$ref)return;const i=a[1],{ref:s,defId:c}=o(a);i.def={...i.schema},c&&(i.defId=c);const l=i.schema;for(const u in l)delete l[u];l.$ref=s};if(e.cycles==="throw")for(const a of e.seen.entries()){const i=a[1];if(i.cycle)throw new Error(`Cycle detected: #/${i.cycle?.join("/")}/<root>
30
-
31
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const i=a[1];if(t===a[0]){n(a);continue}if(e.external){const c=e.external.registry.get(a[0])?.id;if(t!==a[0]&&c){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(i.cycle){n(a);continue}if(i.count>1&&e.reused==="ref"){n(a);continue}}}function io(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 s=e.seen.get(i),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:i,jsonSchema:c,path:s.path??[]})};for(const i of[...e.seen.entries()].reverse())o(i[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 i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(i)}Object.assign(n,r.def??r.schema);const a=e.external?.defs??{};for(const i of e.seen.entries()){const s=i[1];s.def&&s.defId&&(a[s.defId]=s.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{const i=JSON.parse(JSON.stringify(n));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:oa(t,"input"),output:oa(t,"output")}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ut(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 ut(o.element,r);if(o.type==="set")return ut(o.valueType,r);if(o.type==="lazy")return ut(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 ut(o.innerType,r);if(o.type==="intersection")return ut(o.left,r)||ut(o.right,r);if(o.type==="record"||o.type==="map")return ut(o.keyType,r)||ut(o.valueType,r);if(o.type==="pipe")return ut(o.in,r)||ut(o.out,r);if(o.type==="object"){for(const n in o.shape)if(ut(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(const n of o.options)if(ut(n,r))return!0;return!1}if(o.type==="tuple"){for(const n of o.items)if(ut(n,r))return!0;return!!(o.rest&&ut(o.rest,r))}return!1}const b0=(e,t={})=>r=>{const o=oo({...r,processors:t});return Te(e,o),ao(o,e),io(o,e)},oa=(e,t)=>r=>{const{libraryOptions:o,target:n}=r??{},a=oo({...o??{},target:n,io:t,processors:{}});return Te(e,a),ao(a,e),io(a,e)},ON={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},_0=(e,t,r,o)=>{const n=r;n.type="string";const{minimum:a,maximum:i,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a=="number"&&(n.minLength=a),typeof i=="number"&&(n.maxLength=i),s&&(n.format=ON[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}))])}},w0=(e,t,r,o)=>{const n=r,{minimum:a,maximum:i,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 a=="number"&&(n.minimum=a,typeof u=="number"&&t.target!=="draft-04"&&(u>=a?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 i=="number"&&(n.maximum=i,typeof l=="number"&&t.target!=="draft-04"&&(l<=i?delete n.maximum:delete n.exclusiveMaximum)),typeof c=="number"&&(n.multipleOf=c)},x0=(e,t,r,o)=>{r.type="boolean"},S0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},k0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},E0=(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")},T0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},$0=(e,t,r,o)=>{r.not={}},O0=(e,t,r,o)=>{},C0=(e,t,r,o)=>{},A0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},R0=(e,t,r,o)=>{const n=e._zod.def,a=Cd(n.entries);a.every(i=>typeof i=="number")&&(r.type="number"),a.every(i=>typeof i=="string")&&(r.type="string"),r.enum=a},N0=(e,t,r,o)=>{const n=e._zod.def,a=[];for(const i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(i))}else a.push(i);if(a.length!==0)if(a.length===1){const i=a[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else a.every(i=>typeof i=="number")&&(r.type="number"),a.every(i=>typeof i=="string")&&(r.type="string"),a.every(i=>typeof i=="boolean")&&(r.type="boolean"),a.every(i=>i===null)&&(r.type="null"),r.enum=a},P0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},j0=(e,t,r,o)=>{const n=r,a=e._zod.pattern;if(!a)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=a.source},M0=(e,t,r,o)=>{const n=r,a={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:s,mime:c}=e._zod.bag;i!==void 0&&(a.minLength=i),s!==void 0&&(a.maxLength=s),c?c.length===1?(a.contentMediaType=c[0],Object.assign(n,a)):n.anyOf=c.map(l=>({...a,contentMediaType:l})):Object.assign(n,a)},D0=(e,t,r,o)=>{r.type="boolean"},z0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},U0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},L0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},F0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},V0=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Z0=(e,t,r,o)=>{const n=r,a=e._zod.def,{minimum:i,maximum:s}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof s=="number"&&(n.maxItems=s),n.type="array",n.items=Te(a.element,t,{...o,path:[...o.path,"items"]})},q0=(e,t,r,o)=>{const n=r,a=e._zod.def;n.type="object",n.properties={};const i=a.shape;for(const l in i)n.properties[l]=Te(i[l],t,{...o,path:[...o.path,"properties",l]});const s=new Set(Object.keys(i)),c=new Set([...s].filter(l=>{const u=a.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(n.required=Array.from(c)),a.catchall?._zod.def.type==="never"?n.additionalProperties=!1:a.catchall?a.catchall&&(n.additionalProperties=Te(a.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},Em=(e,t,r,o)=>{const n=e._zod.def,a=n.inclusive===!1,i=n.options.map((s,c)=>Te(s,t,{...o,path:[...o.path,a?"oneOf":"anyOf",c]}));a?r.oneOf=i:r.anyOf=i},B0=(e,t,r,o)=>{const n=e._zod.def,a=Te(n.left,t,{...o,path:[...o.path,"allOf",0]}),i=Te(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=l=>"allOf"in l&&Object.keys(l).length===1,c=[...s(a)?a.allOf:[a],...s(i)?i.allOf:[i]];r.allOf=c},G0=(e,t,r,o)=>{const n=r,a=e._zod.def;n.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=a.items.map((m,f)=>Te(m,t,{...o,path:[...o.path,i,f]})),l=a.rest?Te(a.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[a.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)},H0=(e,t,r,o)=>{const n=r,a=e._zod.def;n.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=Te(a.keyType,t,{...o,path:[...o.path,"propertyNames"]})),n.additionalProperties=Te(a.valueType,t,{...o,path:[...o.path,"additionalProperties"]})},W0=(e,t,r,o)=>{const n=e._zod.def,a=Te(n.innerType,t,o),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[a,{type:"null"}]},J0=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType},K0=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Y0=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},X0=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Q0=(e,t,r,o)=>{const n=e._zod.def,a=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Te(a,t,o);const i=t.seen.get(e);i.ref=a},ex=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType,r.readOnly=!0},tx=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType},rx=(e,t,r,o)=>{const n=e._zod.def;Te(n.innerType,t,o);const a=t.seen.get(e);a.ref=n.innerType},nx=(e,t,r,o)=>{const n=e._zod.innerType;Te(n,t,o);const a=t.seen.get(e);a.ref=n},ju={string:_0,number:w0,boolean:x0,bigint:S0,symbol:k0,null:E0,undefined:I0,void:T0,never:$0,any:O0,unknown:C0,date:A0,enum:R0,literal:N0,nan:P0,template_literal:j0,file:M0,success:D0,custom:z0,function:U0,transform:L0,map:F0,set:V0,array:Z0,object:q0,union:Em,intersection:B0,tuple:G0,record:H0,nullable:W0,nonoptional:J0,default:K0,prefault:Y0,catch:X0,pipe:Q0,readonly:ex,promise:tx,optional:rx,lazy:nx};function Im(e,t){if("_idmap"in e){const o=e,n=oo({...t,processors:ju}),a={};for(const c of o._idmap.entries()){const[l,u]=c;Te(u,n)}const i={},s={registry:o,uri:t?.uri,defs:a};n.external=s;for(const c of o._idmap.entries()){const[l,u]=c;ao(n,u),i[l]=io(n,u)}if(Object.keys(a).length>0){const c=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[c]:a}}return{schemas:i}}const r=oo({...t,processors:ju});return Te(e,r),ao(r,e),io(r,e)}class CN{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=oo({processors:ju,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 Te(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)),ao(this.ctx,t);const o=io(this.ctx,t),{"~standard":n,...a}=o;return a}}const AN=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),RN=Object.freeze(Object.defineProperty({__proto__:null,$ZodAny:B_,$ZodArray:K_,$ZodAsyncError:ln,$ZodBase64:N_,$ZodBase64URL:j_,$ZodBigInt:Kd,$ZodBigIntFormat:F_,$ZodBoolean:Jd,$ZodCIDRv4:A_,$ZodCIDRv6:R_,$ZodCUID:b_,$ZodCUID2:__,$ZodCatch:vw,$ZodCheck:Pe,$ZodCheckBigIntFormat:Jb,$ZodCheckEndsWith:s_,$ZodCheckGreaterThan:Gd,$ZodCheckIncludes:a_,$ZodCheckLengthEquals:t_,$ZodCheckLessThan:Bd,$ZodCheckLowerCase:n_,$ZodCheckMaxLength:Qb,$ZodCheckMaxSize:Kb,$ZodCheckMimeType:l_,$ZodCheckMinLength:e_,$ZodCheckMinSize:Yb,$ZodCheckMultipleOf:Hb,$ZodCheckNumberFormat:Wb,$ZodCheckOverwrite:u_,$ZodCheckProperty:c_,$ZodCheckRegex:r_,$ZodCheckSizeEquals:Xb,$ZodCheckStartsWith:i_,$ZodCheckStringFormat:za,$ZodCheckUpperCase:o_,$ZodCodec:Xd,$ZodCustom:Ew,$ZodCustomStringFormat:U_,$ZodDate:J_,$ZodDefault:fw,$ZodDiscriminatedUnion:rw,$ZodE164:M_,$ZodEmail:h_,$ZodEmoji:v_,$ZodEncodeError:Js,$ZodEnum:sw,$ZodError:Rd,$ZodFile:lw,$ZodFunction:xw,$ZodGUID:f_,$ZodIPv4:$_,$ZodIPv6:O_,$ZodISODate:E_,$ZodISODateTime:k_,$ZodISODuration:T_,$ZodISOTime:I_,$ZodIntersection:nw,$ZodJWT:z_,$ZodKSUID:S_,$ZodLazy:kw,$ZodLiteral:cw,$ZodMAC:C_,$ZodMap:aw,$ZodNaN:yw,$ZodNanoID:y_,$ZodNever:H_,$ZodNonOptional:hw,$ZodNull:q_,$ZodNullable:mw,$ZodNumber:Wd,$ZodNumberFormat:L_,$ZodObject:Q_,$ZodObjectJIT:ew,$ZodOptional:dw,$ZodPipe:bw,$ZodPrefault:pw,$ZodPromise:Sw,$ZodReadonly:_w,$ZodRealError:Ct,$ZodRecord:ow,$ZodRegistry:Rw,$ZodSet:iw,$ZodString:Ua,$ZodStringFormat:$e,$ZodSuccess:gw,$ZodSymbol:V_,$ZodTemplateLiteral:ww,$ZodTransform:uw,$ZodTuple:Yd,$ZodType:Q,$ZodULID:w_,$ZodURL:g_,$ZodUUID:p_,$ZodUndefined:Z_,$ZodUnion:ec,$ZodUnknown:G_,$ZodVoid:W_,$ZodXID:x_,$ZodXor:tw,$brand:Fy,$constructor:$,$input:Aw,$output:Cw,Doc:d_,JSONSchema:AN,JSONSchemaGenerator:CN,NEVER:Od,TimePrecision:Mw,_any:n0,_array:u0,_base64:gm,_base64url:vm,_bigint:Kw,_boolean:Ww,_catch:SN,_check:h0,_cidrv4:pm,_cidrv6:hm,_coercedBigint:Yw,_coercedBoolean:Jw,_coercedDate:c0,_coercedNumber:Vw,_coercedString:Pw,_cuid:sm,_cuid2:cm,_custom:m0,_date:s0,_decode:Md,_decodeAsync:zd,_default:_N,_discriminatedUnion:cN,_e164:ym,_email:em,_emoji:am,_encode:jd,_encodeAsync:Dd,_endsWith:cc,_enum:pN,_file:d0,_float32:qw,_float64:Bw,_gt:Lr,_gte:yt,_guid:fs,_includes:ic,_int:Zw,_int32:Gw,_int64:Xw,_intersection:lN,_ipv4:mm,_ipv6:fm,_isoDate:zw,_isoDateTime:Dw,_isoDuration:Lw,_isoTime:Uw,_jwt:bm,_ksuid:dm,_lazy:TN,_length:Va,_literal:gN,_lowercase:oc,_lt:Ur,_lte:Mt,_mac:jw,_map:mN,_max:Mt,_maxLength:Fa,_maxSize:La,_mime:lc,_min:yt,_minLength:mn,_minSize:no,_multipleOf:ro,_nan:l0,_nanoid:im,_nativeEnum:hN,_negative:wm,_never:a0,_nonnegative:Sm,_nonoptional:wN,_nonpositive:xm,_normalize:uc,_null:r0,_nullable:bN,_number:Fw,_optional:yN,_overwrite:Tr,_parse:Ra,_parseAsync:Na,_pipe:kN,_positive:_m,_promise:$N,_property:km,_readonly:EN,_record:dN,_refine:f0,_regex:nc,_safeDecode:Ld,_safeDecodeAsync:Vd,_safeEncode:Ud,_safeEncodeAsync:Fd,_safeParse:Pa,_safeParseAsync:ja,_set:fN,_size:rc,_slugify:pc,_startsWith:sc,_string:Nw,_stringFormat:Za,_stringbool:y0,_success:xN,_superRefine:p0,_symbol:e0,_templateLiteral:IN,_toLowerCase:mc,_toUpperCase:fc,_transform:vN,_trim:dc,_tuple:uN,_uint32:Hw,_uint64:Qw,_ulid:lm,_undefined:t0,_union:iN,_unknown:o0,_uppercase:ac,_url:tc,_uuid:tm,_uuidv4:rm,_uuidv6:nm,_uuidv7:om,_void:i0,_xid:um,_xor:sN,clone:Ut,config:nt,createStandardJSONSchemaMethod:oa,createToJSONSchemaMethod:b0,decode:FC,decodeAsync:ZC,describe:g0,encode:LC,encodeAsync:VC,extractDefs:ao,finalize:io,flattenError:Nd,formatError:Pd,globalConfig:ls,globalRegistry:Gt,initializeContext:oo,isValidBase64:Hd,isValidBase64URL:P_,isValidJWT:D_,locales:Ow,meta:v0,parse:Ru,parseAsync:Nu,prettifyError:cb,process:Te,regexes:qd,registry:Qd,safeDecode:BC,safeDecodeAsync:HC,safeEncode:qC,safeEncodeAsync:GC,safeParse:lb,safeParseAsync:ub,toDotPath:sb,toJSONSchema:Im,treeifyError:ib,util:ob,version:m_},Symbol.toStringTag,{value:"Module"})),NN=Object.freeze(Object.defineProperty({__proto__:null,endsWith:cc,gt:Lr,gte:yt,includes:ic,length:Va,lowercase:oc,lt:Ur,lte:Mt,maxLength:Fa,maxSize:La,mime:lc,minLength:mn,minSize:no,multipleOf:ro,negative:wm,nonnegative:Sm,nonpositive:xm,normalize:uc,overwrite:Tr,positive:_m,property:km,regex:nc,size:rc,slugify:pc,startsWith:sc,toLowerCase:mc,toUpperCase:fc,trim:dc,uppercase:ac},Symbol.toStringTag,{value:"Module"})),Tm=$("ZodISODateTime",(e,t)=>{k_.init(e,t),Oe.init(e,t)});function ox(e){return Dw(Tm,e)}const $m=$("ZodISODate",(e,t)=>{E_.init(e,t),Oe.init(e,t)});function ax(e){return zw($m,e)}const Om=$("ZodISOTime",(e,t)=>{I_.init(e,t),Oe.init(e,t)});function ix(e){return Uw(Om,e)}const Cm=$("ZodISODuration",(e,t)=>{T_.init(e,t),Oe.init(e,t)});function sx(e){return Lw(Cm,e)}const cx=Object.freeze(Object.defineProperty({__proto__:null,ZodISODate:$m,ZodISODateTime:Tm,ZodISODuration:Cm,ZodISOTime:Om,date:ax,datetime:ox,duration:sx,time:ix},Symbol.toStringTag,{value:"Module"})),lx=(e,t)=>{Rd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Pd(e,r)},flatten:{value:r=>Nd(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,us,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,us,2)}},isEmpty:{get(){return e.issues.length===0}}})},PN=$("ZodError",lx),At=$("ZodError",lx,{Parent:Error}),ux=Ra(At),dx=Na(At),mx=Pa(At),Am=ja(At),fx=jd(At),px=Md(At),hx=Dd(At),gx=zd(At),vx=Ud(At),yx=Ld(At),bx=Fd(At),_x=Vd(At),ce=$("ZodType",(e,t)=>(Q.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:oa(e,"input"),output:oa(e,"output")}}),e.toJSONSchema=b0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Ir(t,{checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]})),e.clone=(r,o)=>Ut(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.parse=(r,o)=>ux(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>mx(e,r,o),e.parseAsync=async(r,o)=>dx(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Am(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>fx(e,r,o),e.decode=(r,o)=>px(e,r,o),e.encodeAsync=async(r,o)=>hx(e,r,o),e.decodeAsync=async(r,o)=>gx(e,r,o),e.safeEncode=(r,o)=>vx(e,r,o),e.safeDecode=(r,o)=>yx(e,r,o),e.safeEncodeAsync=async(r,o)=>bx(e,r,o),e.safeDecodeAsync=async(r,o)=>_x(e,r,o),e.refine=(r,o)=>e.check(vf(r,o)),e.superRefine=r=>e.check(yf(r)),e.overwrite=r=>e.check(Tr(r)),e.optional=()=>oe(e),e.nullable=()=>ia(e),e.nullish=()=>oe(ia(e)),e.nonoptional=r=>of(e,r),e.array=()=>D(e),e.or=r=>he([e,r]),e.and=r=>Bm(e,r),e.transform=r=>sa(e,Dc(r)),e.default=r=>tf(e,r),e.prefault=r=>nf(e,r),e.catch=r=>cf(e,r),e.pipe=r=>sa(e,r),e.readonly=()=>df(e),e.describe=r=>{const o=e.clone();return Gt.add(o,{description:r}),o},Object.defineProperty(e,"description",{get(){return Gt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Gt.get(e);const o=e.clone();return Gt.add(o,r[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),hc=$("_ZodString",(e,t)=>{Ua.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(o,n,a)=>_0(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(nc(...o)),e.includes=(...o)=>e.check(ic(...o)),e.startsWith=(...o)=>e.check(sc(...o)),e.endsWith=(...o)=>e.check(cc(...o)),e.min=(...o)=>e.check(mn(...o)),e.max=(...o)=>e.check(Fa(...o)),e.length=(...o)=>e.check(Va(...o)),e.nonempty=(...o)=>e.check(mn(1,...o)),e.lowercase=o=>e.check(oc(o)),e.uppercase=o=>e.check(ac(o)),e.trim=()=>e.check(dc()),e.normalize=(...o)=>e.check(uc(...o)),e.toLowerCase=()=>e.check(mc()),e.toUpperCase=()=>e.check(fc()),e.slugify=()=>e.check(pc())}),qa=$("ZodString",(e,t)=>{Ua.init(e,t),hc.init(e,t),e.email=r=>e.check(em(gc,r)),e.url=r=>e.check(tc(Ba,r)),e.jwt=r=>e.check(bm(Rc,r)),e.emoji=r=>e.check(am(vc,r)),e.guid=r=>e.check(fs(aa,r)),e.uuid=r=>e.check(tm(or,r)),e.uuidv4=r=>e.check(rm(or,r)),e.uuidv6=r=>e.check(nm(or,r)),e.uuidv7=r=>e.check(om(or,r)),e.nanoid=r=>e.check(im(yc,r)),e.guid=r=>e.check(fs(aa,r)),e.cuid=r=>e.check(sm(bc,r)),e.cuid2=r=>e.check(cm(_c,r)),e.ulid=r=>e.check(lm(wc,r)),e.base64=r=>e.check(gm($c,r)),e.base64url=r=>e.check(vm(Cc,r)),e.xid=r=>e.check(um(xc,r)),e.ksuid=r=>e.check(dm(Sc,r)),e.ipv4=r=>e.check(mm(kc,r)),e.ipv6=r=>e.check(fm(Ec,r)),e.cidrv4=r=>e.check(pm(Ic,r)),e.cidrv6=r=>e.check(hm(Tc,r)),e.e164=r=>e.check(ym(Ac,r)),e.datetime=r=>e.check(ox(r)),e.date=r=>e.check(ax(r)),e.time=r=>e.check(ix(r)),e.duration=r=>e.check(sx(r))});function E(e){return Nw(qa,e)}const Oe=$("ZodStringFormat",(e,t)=>{$e.init(e,t),hc.init(e,t)}),gc=$("ZodEmail",(e,t)=>{h_.init(e,t),Oe.init(e,t)});function wx(e){return em(gc,e)}const aa=$("ZodGUID",(e,t)=>{f_.init(e,t),Oe.init(e,t)});function xx(e){return fs(aa,e)}const or=$("ZodUUID",(e,t)=>{p_.init(e,t),Oe.init(e,t)});function Sx(e){return tm(or,e)}function kx(e){return rm(or,e)}function Ex(e){return nm(or,e)}function Ix(e){return om(or,e)}const Ba=$("ZodURL",(e,t)=>{g_.init(e,t),Oe.init(e,t)});function Tx(e){return tc(Ba,e)}function $x(e){return tc(Ba,{protocol:/^https?$/,hostname:Ob,...R(e)})}const vc=$("ZodEmoji",(e,t)=>{v_.init(e,t),Oe.init(e,t)});function Ox(e){return am(vc,e)}const yc=$("ZodNanoID",(e,t)=>{y_.init(e,t),Oe.init(e,t)});function Cx(e){return im(yc,e)}const bc=$("ZodCUID",(e,t)=>{b_.init(e,t),Oe.init(e,t)});function Ax(e){return sm(bc,e)}const _c=$("ZodCUID2",(e,t)=>{__.init(e,t),Oe.init(e,t)});function Rx(e){return cm(_c,e)}const wc=$("ZodULID",(e,t)=>{w_.init(e,t),Oe.init(e,t)});function Nx(e){return lm(wc,e)}const xc=$("ZodXID",(e,t)=>{x_.init(e,t),Oe.init(e,t)});function Px(e){return um(xc,e)}const Sc=$("ZodKSUID",(e,t)=>{S_.init(e,t),Oe.init(e,t)});function jx(e){return dm(Sc,e)}const kc=$("ZodIPv4",(e,t)=>{$_.init(e,t),Oe.init(e,t)});function Mx(e){return mm(kc,e)}const Rm=$("ZodMAC",(e,t)=>{C_.init(e,t),Oe.init(e,t)});function Dx(e){return jw(Rm,e)}const Ec=$("ZodIPv6",(e,t)=>{O_.init(e,t),Oe.init(e,t)});function zx(e){return fm(Ec,e)}const Ic=$("ZodCIDRv4",(e,t)=>{A_.init(e,t),Oe.init(e,t)});function Ux(e){return pm(Ic,e)}const Tc=$("ZodCIDRv6",(e,t)=>{R_.init(e,t),Oe.init(e,t)});function Lx(e){return hm(Tc,e)}const $c=$("ZodBase64",(e,t)=>{N_.init(e,t),Oe.init(e,t)});function Oc(e){return gm($c,e)}const Cc=$("ZodBase64URL",(e,t)=>{j_.init(e,t),Oe.init(e,t)});function Fx(e){return vm(Cc,e)}const Ac=$("ZodE164",(e,t)=>{M_.init(e,t),Oe.init(e,t)});function Vx(e){return ym(Ac,e)}const Rc=$("ZodJWT",(e,t)=>{z_.init(e,t),Oe.init(e,t)});function Zx(e){return bm(Rc,e)}const _o=$("ZodCustomStringFormat",(e,t)=>{U_.init(e,t),Oe.init(e,t)});function qx(e,t,r={}){return Za(_o,e,t,r)}function Bx(e){return Za(_o,"hostname",$b,e)}function Gx(e){return Za(_o,"hex",Bb,e)}function Hx(e,t){const r=t?.enc??"hex",o=`${e}_${r}`,n=qd[o];if(!n)throw new Error(`Unrecognized hash format: ${o}`);return Za(_o,o,n,t)}const Ga=$("ZodNumber",(e,t)=>{Wd.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(o,n,a)=>w0(e,o,n),e.gt=(o,n)=>e.check(Lr(o,n)),e.gte=(o,n)=>e.check(yt(o,n)),e.min=(o,n)=>e.check(yt(o,n)),e.lt=(o,n)=>e.check(Ur(o,n)),e.lte=(o,n)=>e.check(Mt(o,n)),e.max=(o,n)=>e.check(Mt(o,n)),e.int=o=>e.check(ps(o)),e.safe=o=>e.check(ps(o)),e.positive=o=>e.check(Lr(0,o)),e.nonnegative=o=>e.check(yt(0,o)),e.negative=o=>e.check(Ur(0,o)),e.nonpositive=o=>e.check(Mt(0,o)),e.multipleOf=(o,n)=>e.check(ro(o,n)),e.step=(o,n)=>e.check(ro(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 G(e){return Fw(Ga,e)}const xn=$("ZodNumberFormat",(e,t)=>{L_.init(e,t),Ga.init(e,t)});function ps(e){return Zw(xn,e)}function Wx(e){return qw(xn,e)}function Jx(e){return Bw(xn,e)}function Kx(e){return Gw(xn,e)}function Yx(e){return Hw(xn,e)}const Ha=$("ZodBoolean",(e,t)=>{Jd.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>x0(e,r,o)});function ft(e){return Ww(Ha,e)}const Wa=$("ZodBigInt",(e,t)=>{Kd.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(o,n,a)=>S0(e,o),e.gte=(o,n)=>e.check(yt(o,n)),e.min=(o,n)=>e.check(yt(o,n)),e.gt=(o,n)=>e.check(Lr(o,n)),e.gte=(o,n)=>e.check(yt(o,n)),e.min=(o,n)=>e.check(yt(o,n)),e.lt=(o,n)=>e.check(Ur(o,n)),e.lte=(o,n)=>e.check(Mt(o,n)),e.max=(o,n)=>e.check(Mt(o,n)),e.positive=o=>e.check(Lr(BigInt(0),o)),e.negative=o=>e.check(Ur(BigInt(0),o)),e.nonpositive=o=>e.check(Mt(BigInt(0),o)),e.nonnegative=o=>e.check(yt(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(ro(o,n));const r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function Xx(e){return Kw(Wa,e)}const Nc=$("ZodBigIntFormat",(e,t)=>{F_.init(e,t),Wa.init(e,t)});function Qx(e){return Xw(Nc,e)}function eS(e){return Qw(Nc,e)}const Nm=$("ZodSymbol",(e,t)=>{V_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>k0(e,r)});function tS(e){return e0(Nm,e)}const Pm=$("ZodUndefined",(e,t)=>{Z_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>I0(e,r)});function rS(e){return t0(Pm,e)}const jm=$("ZodNull",(e,t)=>{q_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>E0(e,r,o)});function Pc(e){return r0(jm,e)}const Mm=$("ZodAny",(e,t)=>{B_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>O0()});function Ze(){return n0(Mm)}const Dm=$("ZodUnknown",(e,t)=>{G_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>C0()});function ot(){return o0(Dm)}const zm=$("ZodNever",(e,t)=>{H_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>$0(e,r,o)});function jc(e){return a0(zm,e)}const Um=$("ZodVoid",(e,t)=>{W_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>T0(e,r)});function nS(e){return i0(Um,e)}const Mc=$("ZodDate",(e,t)=>{J_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(o,n,a)=>A0(e,o),e.min=(o,n)=>e.check(yt(o,n)),e.max=(o,n)=>e.check(Mt(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 oS(e){return s0(Mc,e)}const Lm=$("ZodArray",(e,t)=>{K_.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Z0(e,r,o,n),e.element=t.element,e.min=(r,o)=>e.check(mn(r,o)),e.nonempty=r=>e.check(mn(1,r)),e.max=(r,o)=>e.check(Fa(r,o)),e.length=(r,o)=>e.check(Va(r,o)),e.unwrap=()=>e.element});function D(e,t){return u0(Lm,e,t)}function aS(e){const t=e._zod.def.shape;return Sn(Object.keys(t))}const Ja=$("ZodObject",(e,t)=>{ew.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>q0(e,r,o,n),pe(e,"shape",()=>t.shape),e.keyof=()=>Sn(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ot()}),e.loose=()=>e.clone({...e._zod.def,catchall:ot()}),e.strict=()=>e.clone({...e._zod.def,catchall:jc()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Yy(e,r),e.safeExtend=r=>Xy(e,r),e.merge=r=>Qy(e,r),e.pick=r=>Jy(e,r),e.omit=r=>Ky(e,r),e.partial=(...r)=>eb(zc,e,r[0]),e.required=(...r)=>tb(Uc,e,r[0])});function C(e,t){const r={type:"object",shape:e??{},...R(t)};return new Ja(r)}function iS(e,t){return new Ja({type:"object",shape:e,catchall:jc(),...R(t)})}function Rr(e,t){return new Ja({type:"object",shape:e,catchall:ot(),...R(t)})}const Ka=$("ZodUnion",(e,t)=>{ec.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Em(e,r,o,n),e.options=t.options});function he(e,t){return new Ka({type:"union",options:e,...R(t)})}const Fm=$("ZodXor",(e,t)=>{Ka.init(e,t),tw.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Em(e,r,o,n),e.options=t.options});function sS(e,t){return new Fm({type:"union",options:e,inclusive:!1,...R(t)})}const Vm=$("ZodDiscriminatedUnion",(e,t)=>{Ka.init(e,t),rw.init(e,t)});function Zm(e,t,r){return new Vm({type:"union",options:t,discriminator:e,...R(r)})}const qm=$("ZodIntersection",(e,t)=>{nw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>B0(e,r,o,n)});function Bm(e,t){return new qm({type:"intersection",left:e,right:t})}const Gm=$("ZodTuple",(e,t)=>{Yd.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>G0(e,r,o,n),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Hm(e,t,r){const o=t instanceof Q,n=o?r:t,a=o?t:null;return new Gm({type:"tuple",items:e,rest:a,...R(n)})}const Ya=$("ZodRecord",(e,t)=>{ow.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>H0(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function cr(e,t,r){return new Ya({type:"record",keyType:e,valueType:t,...R(r)})}function cS(e,t,r){const o=Ut(e);return o._zod.values=void 0,new Ya({type:"record",keyType:o,valueType:t,...R(r)})}function lS(e,t,r){return new Ya({type:"record",keyType:e,valueType:t,mode:"loose",...R(r)})}const Wm=$("ZodMap",(e,t)=>{aw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>F0(e,r),e.keyType=t.keyType,e.valueType=t.valueType});function uS(e,t,r){return new Wm({type:"map",keyType:e,valueType:t,...R(r)})}const Jm=$("ZodSet",(e,t)=>{iw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>V0(e,r),e.min=(...r)=>e.check(no(...r)),e.nonempty=r=>e.check(no(1,r)),e.max=(...r)=>e.check(La(...r)),e.size=(...r)=>e.check(rc(...r))});function dS(e,t){return new Jm({type:"set",valueType:e,...R(t)})}const so=$("ZodEnum",(e,t)=>{sw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(o,n,a)=>R0(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 a={};for(const i of o)if(r.has(i))a[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new so({...t,checks:[],...R(n),entries:a})},e.exclude=(o,n)=>{const a={...t.entries};for(const i of o)if(r.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new so({...t,checks:[],...R(n),entries:a})}});function Sn(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new so({type:"enum",entries:r,...R(t)})}function mS(e,t){return new so({type:"enum",entries:e,...R(t)})}const Km=$("ZodLiteral",(e,t)=>{cw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>N0(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 H(e,t){return new Km({type:"literal",values:Array.isArray(e)?e:[e],...R(t)})}const Ym=$("ZodFile",(e,t)=>{lw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>M0(e,r,o),e.min=(r,o)=>e.check(no(r,o)),e.max=(r,o)=>e.check(La(r,o)),e.mime=(r,o)=>e.check(lc(Array.isArray(r)?r:[r],o))});function fS(e){return d0(Ym,e)}const Xm=$("ZodTransform",(e,t)=>{uw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>L0(e,r),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Js(e.constructor.name);r.addIssue=a=>{if(typeof a=="string")r.issues.push(eo(a,r.value,t));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(eo(i))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(a=>(r.value=a,r)):(r.value=n,r)}});function Dc(e){return new Xm({type:"transform",transform:e})}const zc=$("ZodOptional",(e,t)=>{dw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function oe(e){return new zc({type:"optional",innerType:e})}const Qm=$("ZodNullable",(e,t)=>{mw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>W0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ia(e){return new Qm({type:"nullable",innerType:e})}function pS(e){return oe(ia(e))}const ef=$("ZodDefault",(e,t)=>{fw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>K0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function tf(e,t){return new ef({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ys(t)}})}const rf=$("ZodPrefault",(e,t)=>{pw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Y0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function nf(e,t){return new rf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ys(t)}})}const Uc=$("ZodNonOptional",(e,t)=>{hw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>J0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function of(e,t){return new Uc({type:"nonoptional",innerType:e,...R(t)})}const af=$("ZodSuccess",(e,t)=>{gw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>D0(e,r,o),e.unwrap=()=>e._zod.def.innerType});function hS(e){return new af({type:"success",innerType:e})}const sf=$("ZodCatch",(e,t)=>{vw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>X0(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cf(e,t){return new sf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lf=$("ZodNaN",(e,t)=>{yw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>P0(e,r)});function gS(e){return l0(lf,e)}const Lc=$("ZodPipe",(e,t)=>{bw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Q0(e,r,o,n),e.in=t.in,e.out=t.out});function sa(e,t){return new Lc({type:"pipe",in:e,out:t})}const Fc=$("ZodCodec",(e,t)=>{Lc.init(e,t),Xd.init(e,t)});function vS(e,t,r){return new Fc({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}const uf=$("ZodReadonly",(e,t)=>{_w.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ex(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function df(e){return new uf({type:"readonly",innerType:e})}const mf=$("ZodTemplateLiteral",(e,t)=>{ww.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>j0(e,r,o)});function yS(e,t){return new mf({type:"template_literal",parts:e,...R(t)})}const ff=$("ZodLazy",(e,t)=>{kw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nx(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function Vc(e){return new ff({type:"lazy",getter:e})}const pf=$("ZodPromise",(e,t)=>{Sw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function bS(e){return new pf({type:"promise",innerType:e})}const hf=$("ZodFunction",(e,t)=>{xw.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>U0(e,r)});function hs(e){return new hf({type:"function",input:Array.isArray(e?.input)?Hm(e?.input):e?.input??D(ot()),output:e?.output??ot()})}const Xa=$("ZodCustom",(e,t)=>{Ew.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,o,n)=>z0(e,r)});function _S(e){const t=new Pe({check:"custom"});return t._zod.check=e,t}function gf(e,t){return m0(Xa,e??(()=>!0),t)}function vf(e,t={}){return f0(Xa,e,t)}function yf(e){return p0(e)}const wS=g0,xS=v0;function co(e,t={error:`Input not instance of ${e.name}`}){const r=new Xa({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...R(t)});return r._zod.bag.Class=e,r}const SS=(...e)=>y0({Codec:Fc,Boolean:Ha,String:qa},...e);function kS(e){const t=Vc(()=>he([E(e),G(),ft(),Pc(),D(t),cr(E(),t)]));return t}function ES(e,t){return sa(Dc(e),t)}const jN=Object.freeze(Object.defineProperty({__proto__:null,ZodAny:Mm,ZodArray:Lm,ZodBase64:$c,ZodBase64URL:Cc,ZodBigInt:Wa,ZodBigIntFormat:Nc,ZodBoolean:Ha,ZodCIDRv4:Ic,ZodCIDRv6:Tc,ZodCUID:bc,ZodCUID2:_c,ZodCatch:sf,ZodCodec:Fc,ZodCustom:Xa,ZodCustomStringFormat:_o,ZodDate:Mc,ZodDefault:ef,ZodDiscriminatedUnion:Vm,ZodE164:Ac,ZodEmail:gc,ZodEmoji:vc,ZodEnum:so,ZodFile:Ym,ZodFunction:hf,ZodGUID:aa,ZodIPv4:kc,ZodIPv6:Ec,ZodIntersection:qm,ZodJWT:Rc,ZodKSUID:Sc,ZodLazy:ff,ZodLiteral:Km,ZodMAC:Rm,ZodMap:Wm,ZodNaN:lf,ZodNanoID:yc,ZodNever:zm,ZodNonOptional:Uc,ZodNull:jm,ZodNullable:Qm,ZodNumber:Ga,ZodNumberFormat:xn,ZodObject:Ja,ZodOptional:zc,ZodPipe:Lc,ZodPrefault:rf,ZodPromise:pf,ZodReadonly:uf,ZodRecord:Ya,ZodSet:Jm,ZodString:qa,ZodStringFormat:Oe,ZodSuccess:af,ZodSymbol:Nm,ZodTemplateLiteral:mf,ZodTransform:Xm,ZodTuple:Gm,ZodType:ce,ZodULID:wc,ZodURL:Ba,ZodUUID:or,ZodUndefined:Pm,ZodUnion:Ka,ZodUnknown:Dm,ZodVoid:Um,ZodXID:xc,ZodXor:Fm,_ZodString:hc,_default:tf,_function:hs,any:Ze,array:D,base64:Oc,base64url:Fx,bigint:Xx,boolean:ft,catch:cf,check:_S,cidrv4:Ux,cidrv6:Lx,codec:vS,cuid:Ax,cuid2:Rx,custom:gf,date:oS,describe:wS,discriminatedUnion:Zm,e164:Vx,email:wx,emoji:Ox,enum:Sn,file:fS,float32:Wx,float64:Jx,function:hs,guid:xx,hash:Hx,hex:Gx,hostname:Bx,httpUrl:$x,instanceof:co,int:ps,int32:Kx,int64:Qx,intersection:Bm,ipv4:Mx,ipv6:zx,json:kS,jwt:Zx,keyof:aS,ksuid:jx,lazy:Vc,literal:H,looseObject:Rr,looseRecord:lS,mac:Dx,map:uS,meta:xS,nan:gS,nanoid:Cx,nativeEnum:mS,never:jc,nonoptional:of,null:Pc,nullable:ia,nullish:pS,number:G,object:C,optional:oe,partialRecord:cS,pipe:sa,prefault:nf,preprocess:ES,promise:bS,readonly:df,record:cr,refine:vf,set:dS,strictObject:iS,string:E,stringFormat:qx,stringbool:SS,success:hS,superRefine:yf,symbol:tS,templateLiteral:yS,transform:Dc,tuple:Hm,uint32:Yx,uint64:eS,ulid:Nx,undefined:rS,union:he,unknown:ot,url:Tx,uuid:Sx,uuidv4:kx,uuidv6:Ex,uuidv7:Ix,void:nS,xid:Px,xor:sS},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 MN(e){nt({customError:e})}function DN(){return nt().customError}var Mu;Mu||(Mu={});const M={...jN,...NN,iso:cx};function zN(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 UN(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 TS(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return M.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 M.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);const a=UN(n,t),i=tt(a,t);return t.refs.set(n,i),t.processing.delete(n),i}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 M.null();if(n.length===0)return M.never();if(n.length===1)return M.literal(n[0]);if(n.every(i=>typeof i=="string"))return M.enum(n);const a=n.map(i=>M.literal(i));return a.length<2?a[0]:M.union([a[0],a[1],...a.slice(2)])}if(e.const!==void 0)return M.literal(e.const);const r=e.type;if(Array.isArray(r)){const n=r.map(a=>{const i={...e,type:a};return TS(i,t)});return n.length===0?M.never():n.length===1?n[0]:M.union(n)}if(!r)return M.any();let o;switch(r){case"string":{let n=M.string();if(e.format){const a=e.format;a==="email"?n=n.check(M.email()):a==="uri"||a==="uri-reference"?n=n.check(M.url()):a==="uuid"||a==="guid"?n=n.check(M.uuid()):a==="date-time"?n=n.check(M.iso.datetime()):a==="date"?n=n.check(M.iso.date()):a==="time"?n=n.check(M.iso.time()):a==="duration"?n=n.check(M.iso.duration()):a==="ipv4"?n=n.check(M.ipv4()):a==="ipv6"?n=n.check(M.ipv6()):a==="mac"?n=n.check(M.mac()):a==="cidr"?n=n.check(M.cidrv4()):a==="cidr-v6"?n=n.check(M.cidrv6()):a==="base64"?n=n.check(M.base64()):a==="base64url"?n=n.check(M.base64url()):a==="e164"?n=n.check(M.e164()):a==="jwt"?n=n.check(M.jwt()):a==="emoji"?n=n.check(M.emoji()):a==="nanoid"?n=n.check(M.nanoid()):a==="cuid"?n=n.check(M.cuid()):a==="cuid2"?n=n.check(M.cuid2()):a==="ulid"?n=n.check(M.ulid()):a==="xid"?n=n.check(M.xid()):a==="ksuid"&&(n=n.check(M.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"?M.number().int():M.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=M.boolean();break}case"null":{o=M.null();break}case"object":{const n={},a=e.properties||{},i=new Set(e.required||[]);for(const[c,l]of Object.entries(a)){const u=tt(l,t);n[c]=i.has(c)?u:u.optional()}if(e.propertyNames){const c=tt(e.propertyNames,t),l=e.additionalProperties&&typeof e.additionalProperties=="object"?tt(e.additionalProperties,t):M.any();if(Object.keys(n).length===0){o=M.record(c,l);break}const u=M.object(n).passthrough(),d=M.looseRecord(c,l);o=M.intersection(u,d);break}if(e.patternProperties){const c=e.patternProperties,l=Object.keys(c),u=[];for(const m of l){const f=tt(c[m],t),g=M.string().regex(new RegExp(m));u.push(M.looseRecord(g,f))}const d=[];if(Object.keys(n).length>0&&d.push(M.object(n).passthrough()),d.push(...u),d.length===0)o=M.object({}).passthrough();else if(d.length===1)o=d[0];else{let m=M.intersection(d[0],d[1]);for(let f=2;f<d.length;f++)m=M.intersection(m,d[f]);o=m}break}const s=M.object(n);e.additionalProperties===!1?o=s.strict():typeof e.additionalProperties=="object"?o=s.catchall(tt(e.additionalProperties,t)):o=s.passthrough();break}case"array":{const n=e.prefixItems,a=e.items;if(n&&Array.isArray(n)){const i=n.map(c=>tt(c,t)),s=a&&typeof a=="object"&&!Array.isArray(a)?tt(a,t):void 0;s?o=M.tuple(i).rest(s):o=M.tuple(i),typeof e.minItems=="number"&&(o=o.check(M.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(M.maxLength(e.maxItems)))}else if(Array.isArray(a)){const i=a.map(c=>tt(c,t)),s=e.additionalItems&&typeof e.additionalItems=="object"?tt(e.additionalItems,t):void 0;s?o=M.tuple(i).rest(s):o=M.tuple(i),typeof e.minItems=="number"&&(o=o.check(M.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(M.maxLength(e.maxItems)))}else if(a!==void 0){const i=tt(a,t);let s=M.array(i);typeof e.minItems=="number"&&(s=s.min(e.minItems)),typeof e.maxItems=="number"&&(s=s.max(e.maxItems)),o=s}else o=M.array(M.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 tt(e,t){if(typeof e=="boolean")return e?M.any():M.never();let r=TS(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(i=>tt(i,t)),a=M.union(n);r=o?M.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){const n=e.oneOf.map(i=>tt(i,t)),a=M.xor(n);r=o?M.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:M.any();else{let n=o?r:tt(e.allOf[0],t);const a=o?0:1;for(let i=a;i<e.allOf.length;i++)n=M.intersection(n,tt(e.allOf[i],t));r=n}return e.nullable===!0&&t.version==="openapi-3.0"&&(r=M.nullable(r)),e.readOnly===!0&&(r=M.readonly(r)),r}function LN(e,t){if(typeof e=="boolean")return e?M.any():M.never();const r=zN(e,t?.defaultTarget),o=e.$defs||e.definitions||{};return tt(e,{version:r,defs:o,refs:new Map,processing:new Set,rootSchema:e})}function FN(e){return Pw(qa,e)}function VN(e){return Vw(Ga,e)}function ZN(e){return Jw(Ha,e)}function qN(e){return Yw(Wa,e)}function BN(e){return c0(Mc,e)}const GN=Object.freeze(Object.defineProperty({__proto__:null,bigint:qN,boolean:ZN,date:BN,number:VN,string:FN},Symbol.toStringTag,{value:"Module"}));nt(Iw());const $h=Object.freeze(Object.defineProperty({__proto__:null,$brand:Fy,$input:Aw,$output:Cw,NEVER:Od,TimePrecision:Mw,ZodAny:Mm,ZodArray:Lm,ZodBase64:$c,ZodBase64URL:Cc,ZodBigInt:Wa,ZodBigIntFormat:Nc,ZodBoolean:Ha,ZodCIDRv4:Ic,ZodCIDRv6:Tc,ZodCUID:bc,ZodCUID2:_c,ZodCatch:sf,ZodCodec:Fc,ZodCustom:Xa,ZodCustomStringFormat:_o,ZodDate:Mc,ZodDefault:ef,ZodDiscriminatedUnion:Vm,ZodE164:Ac,ZodEmail:gc,ZodEmoji:vc,ZodEnum:so,ZodError:PN,ZodFile:Ym,get ZodFirstPartyTypeKind(){return Mu},ZodFunction:hf,ZodGUID:aa,ZodIPv4:kc,ZodIPv6:Ec,ZodISODate:$m,ZodISODateTime:Tm,ZodISODuration:Cm,ZodISOTime:Om,ZodIntersection:qm,ZodIssueCode:IS,ZodJWT:Rc,ZodKSUID:Sc,ZodLazy:ff,ZodLiteral:Km,ZodMAC:Rm,ZodMap:Wm,ZodNaN:lf,ZodNanoID:yc,ZodNever:zm,ZodNonOptional:Uc,ZodNull:jm,ZodNullable:Qm,ZodNumber:Ga,ZodNumberFormat:xn,ZodObject:Ja,ZodOptional:zc,ZodPipe:Lc,ZodPrefault:rf,ZodPromise:pf,ZodReadonly:uf,ZodRealError:At,ZodRecord:Ya,ZodSet:Jm,ZodString:qa,ZodStringFormat:Oe,ZodSuccess:af,ZodSymbol:Nm,ZodTemplateLiteral:mf,ZodTransform:Xm,ZodTuple:Gm,ZodType:ce,ZodULID:wc,ZodURL:Ba,ZodUUID:or,ZodUndefined:Pm,ZodUnion:Ka,ZodUnknown:Dm,ZodVoid:Um,ZodXID:xc,ZodXor:Fm,_ZodString:hc,_default:tf,_function:hs,any:Ze,array:D,base64:Oc,base64url:Fx,bigint:Xx,boolean:ft,catch:cf,check:_S,cidrv4:Ux,cidrv6:Lx,clone:Ut,codec:vS,coerce:GN,config:nt,core:RN,cuid:Ax,cuid2:Rx,custom:gf,date:oS,decode:px,decodeAsync:gx,describe:wS,discriminatedUnion:Zm,e164:Vx,email:wx,emoji:Ox,encode:fx,encodeAsync:hx,endsWith:cc,enum:Sn,file:fS,flattenError:Nd,float32:Wx,float64:Jx,formatError:Pd,fromJSONSchema:LN,function:hs,getErrorMap:DN,globalRegistry:Gt,gt:Lr,gte:yt,guid:xx,hash:Hx,hex:Gx,hostname:Bx,httpUrl:$x,includes:ic,instanceof:co,int:ps,int32:Kx,int64:Qx,intersection:Bm,ipv4:Mx,ipv6:zx,iso:cx,json:kS,jwt:Zx,keyof:aS,ksuid:jx,lazy:Vc,length:Va,literal:H,locales:Ow,looseObject:Rr,looseRecord:lS,lowercase:oc,lt:Ur,lte:Mt,mac:Dx,map:uS,maxLength:Fa,maxSize:La,meta:xS,mime:lc,minLength:mn,minSize:no,multipleOf:ro,nan:gS,nanoid:Cx,nativeEnum:mS,negative:wm,never:jc,nonnegative:Sm,nonoptional:of,nonpositive:xm,normalize:uc,null:Pc,nullable:ia,nullish:pS,number:G,object:C,optional:oe,overwrite:Tr,parse:ux,parseAsync:dx,partialRecord:cS,pipe:sa,positive:_m,prefault:nf,preprocess:ES,prettifyError:cb,promise:bS,property:km,readonly:df,record:cr,refine:vf,regex:nc,regexes:qd,registry:Qd,safeDecode:yx,safeDecodeAsync:_x,safeEncode:vx,safeEncodeAsync:bx,safeParse:mx,safeParseAsync:Am,set:dS,setErrorMap:MN,size:rc,slugify:pc,startsWith:sc,strictObject:iS,string:E,stringFormat:qx,stringbool:SS,success:hS,superRefine:yf,symbol:tS,templateLiteral:yS,toJSONSchema:Im,toLowerCase:mc,toUpperCase:fc,transform:Dc,treeifyError:ib,trim:dc,tuple:Hm,uint32:Yx,uint64:eS,ulid:Nx,undefined:rS,union:he,unknown:ot,uppercase:ac,url:Tx,util:ob,uuid:Sx,uuidv4:kx,uuidv6:Ex,uuidv7:Ix,void:nS,xid:Px,xor:sS},Symbol.toStringTag,{value:"Module"}));var ca;(function(e){e.assertEqual=n=>{};function t(n){}e.assertIs=t;function r(n){throw new Error}e.assertNever=r,e.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},e.getValidEnumValues=n=>{const a=e.objectKeys(n).filter(s=>typeof n[n[s]]!="number"),i={};for(const s of a)i[s]=n[s];return e.objectValues(i)},e.objectValues=n=>e.objectKeys(n).map(function(a){return n[a]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},e.find=(n,a)=>{for(const i of n)if(a(i))return i},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}e.joinValues=o,e.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(ca||(ca={}));var Oh;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Oh||(Oh={}));ca.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);ca.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 gs 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(a){return a.message},o={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)o._errors.push(r(i));else{let s=o,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(r(i))):s[l]=s[l]||{_errors:[]},s=s[l],c++}}};return n(this),o}static assert(t){if(!(t instanceof gs))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ca.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 a=n.path[0];r[a]=r[a]||[],r[a].push(t(n))}else o.push(t(n));return{formErrors:o,fieldErrors:r}}get formErrors(){return this.flatten()}}gs.create=e=>new gs(e);var Ch;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Ch||(Ch={}));var te;(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"})(te||(te={}));var HN=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const a=r.length,i=new Array(t);for(let s=0;s<t;s++)i[s]=r[Math.random()*a|0];return i.join("")};if(e==null)return n;if(r.includes(o))throw new Td({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`};HN();function $S(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 WN(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 OS(e,...t){const r=new Headers(WN(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var JN=Symbol.for("vercel.ai.validator");function KN(e){return{...e,type:"dynamic"}}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var YN=Symbol.for("vercel.ai.schema");function XN(e,{validate:t}={}){return{[YN]:!0,_type:void 0,[JN]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}let bf;bf=globalThis.crypto;async function QN(e){return(await bf).getRandomValues(new Uint8Array(e))}async function eP(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";let r="";const o=await QN(e);for(let n=0;n<e;n++){const a=o[n]%t.length;r+=t[a]}return r}async function tP(e){return await eP(e)}async function rP(e){const t=await(await bf).subtle.digest("SHA-256",new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function nP(e){if(e||(e=43),e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;const t=await tP(e),r=await rP(t);return{code_verifier:t,code_challenge:r}}var oP="AI_MCPClientError",CS=`vercel.ai.error.${oP}`,aP=Symbol.for(CS),Ah,Rh,Se=class extends(Rh=X,Ah=aP,Rh){constructor({name:e="MCPClientError",message:t,cause:r,data:o,code:n}){super({name:e,message:t,cause:r}),this[Ah]=!0,this.data=o,this.code=n}static isInstance(e){return X.hasMarker(e,CS)}},wo="2025-06-18",iP=[wo,"2025-03-26","2024-11-05"],sP=Rr({name:E(),version:E()}),Zc=Rr({_meta:oe(C({}).loose())}),yr=Zc,AS=C({method:E(),params:oe(Zc)}),RS=C({applyDefaults:oe(ft())}).loose(),cP=Rr({experimental:oe(C({}).loose()),logging:oe(C({}).loose()),prompts:oe(Rr({listChanged:oe(ft())})),resources:oe(Rr({subscribe:oe(ft()),listChanged:oe(ft())})),tools:oe(Rr({listChanged:oe(ft())})),elicitation:oe(RS)});C({elicitation:oe(RS)}).loose();var lP=yr.extend({protocolVersion:E(),capabilities:cP,serverInfo:sP,instructions:oe(E())}),_f=yr.extend({nextCursor:oe(E())}),uP=C({name:E(),description:oe(E()),inputSchema:C({type:H("object"),properties:oe(C({}).loose())}).loose()}).loose(),dP=_f.extend({tools:D(uP)}),NS=C({type:H("text"),text:E()}).loose(),PS=C({type:H("image"),data:Oc(),mimeType:E()}).loose(),mP=C({uri:E(),name:E(),title:oe(E()),description:oe(E()),mimeType:oe(E()),size:oe(G())}).loose(),fP=_f.extend({resources:D(mP)}),jS=C({uri:E(),name:oe(E()),title:oe(E()),mimeType:oe(E())}).loose(),MS=jS.extend({text:E()}),DS=jS.extend({blob:Oc()}),zS=C({type:H("resource"),resource:he([MS,DS])}).loose(),pP=yr.extend({content:D(he([NS,PS,zS])),isError:ft().default(!1).optional()}).or(yr.extend({toolResult:ot()})),hP=C({uriTemplate:E(),name:E(),title:oe(E()),description:oe(E()),mimeType:oe(E())}).loose(),gP=yr.extend({resourceTemplates:D(hP)}),vP=yr.extend({contents:D(he([MS,DS]))}),yP=C({name:E(),description:oe(E()),required:oe(ft())}).loose(),bP=C({name:E(),title:oe(E()),description:oe(E()),arguments:oe(D(yP))}).loose(),_P=_f.extend({prompts:D(bP)}),wP=C({role:he([H("user"),H("assistant")]),content:he([NS,PS,zS])}).loose(),xP=yr.extend({description:oe(E()),messages:D(wP)}),SP=Zc.extend({message:E(),requestedSchema:ot()}),Nh=AS.extend({method:H("elicitation/create"),params:SP}),kP=yr.extend({action:he([H("accept"),H("decline"),H("cancel")]),content:oe(cr(E(),ot()))}),qc="2.0",EP=C({jsonrpc:H(qc),id:he([E(),G().int()])}).merge(AS).strict(),IP=C({jsonrpc:H(qc),id:he([E(),G().int()]),result:yr}).strict(),TP=C({jsonrpc:H(qc),id:he([E(),G().int()]),error:C({code:G().int(),message:E(),data:oe(ot())})}).strict(),$P=C({jsonrpc:H(qc)}).merge(C({method:E(),params:oe(Zc)})).strict(),Jo=he([EP,$P,IP,TP]),US=typeof __PACKAGE_VERSION__<"u"?__PACKAGE_VERSION__:"0.0.0-test",LS=C({access_token:E(),id_token:E().optional(),token_type:E(),expires_in:G().optional(),scope:E().optional(),refresh_token:E().optional()}).strip(),bt=E().url().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:IS.custom,message:"URL must be parseable",fatal:!0}),Od}).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"}),OP=C({resource:E().url(),authorization_servers:D(bt).optional(),jwks_uri:E().url().optional(),scopes_supported:D(E()).optional(),bearer_methods_supported:D(E()).optional(),resource_signing_alg_values_supported:D(E()).optional(),resource_name:E().optional(),resource_documentation:E().optional(),resource_policy_uri:E().url().optional(),resource_tos_uri:E().url().optional(),tls_client_certificate_bound_access_tokens:ft().optional(),authorization_details_types_supported:D(E()).optional(),dpop_signing_alg_values_supported:D(E()).optional(),dpop_bound_access_tokens_required:ft().optional()}).passthrough(),FS=C({issuer:E(),authorization_endpoint:bt,token_endpoint:bt,registration_endpoint:bt.optional(),scopes_supported:D(E()).optional(),response_types_supported:D(E()),grant_types_supported:D(E()).optional(),code_challenge_methods_supported:D(E()),token_endpoint_auth_methods_supported:D(E()).optional(),token_endpoint_auth_signing_alg_values_supported:D(E()).optional()}).passthrough(),CP=C({issuer:E(),authorization_endpoint:bt,token_endpoint:bt,userinfo_endpoint:bt.optional(),jwks_uri:bt,registration_endpoint:bt.optional(),scopes_supported:D(E()).optional(),response_types_supported:D(E()),grant_types_supported:D(E()).optional(),subject_types_supported:D(E()),id_token_signing_alg_values_supported:D(E()),claims_supported:D(E()).optional(),token_endpoint_auth_methods_supported:D(E()).optional()}).passthrough(),AP=CP.merge(FS.pick({code_challenge_methods_supported:!0})),RP=C({client_id:E(),client_secret:E().optional(),client_id_issued_at:G().optional(),client_secret_expires_at:G().optional()}).strip(),NP=C({redirect_uris:D(bt),token_endpoint_auth_method:E().optional(),grant_types:D(E()).optional(),response_types:D(E()).optional(),client_name:E().optional(),client_uri:bt.optional(),logo_uri:bt.optional(),scope:E().optional(),contacts:D(E()).optional(),tos_uri:bt.optional(),policy_uri:E().optional(),jwks_uri:bt.optional(),jwks:Ze().optional(),software_id:E().optional(),software_version:E().optional(),software_statement:E().optional()}).strip(),PP=C({error:E(),error_description:E().optional(),error_uri:E().optional()}),jP=NP.merge(RP),MP="AI_MCPClientOAuthError",VS=`vercel.ai.error.${MP}`,DP=Symbol.for(VS),Ph,jh,Qa=class extends(jh=X,Ph=DP,jh){constructor({name:e="MCPClientOAuthError",message:t,cause:r}){super({name:e,message:t,cause:r}),this[Ph]=!0}static isInstance(e){return X.hasMarker(e,VS)}},lo=class extends Qa{};lo.errorCode="server_error";var vs=class extends Qa{};vs.errorCode="invalid_client";var ys=class extends Qa{};ys.errorCode="invalid_grant";var bs=class extends Qa{};bs.errorCode="unauthorized_client";var zP={[lo.errorCode]:lo,[vs.errorCode]:vs,[ys.errorCode]:ys,[bs.errorCode]:bs};function UP(e){const t=typeof e=="string"?new URL(e):new URL(e.href);return t.hash="",t}function LP({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+"/",a=o.pathname.endsWith("/")?o.pathname:o.pathname+"/";return n.startsWith(a)}var _s=class extends Error{constructor(e="Unauthorized"){super(e),this.name="UnauthorizedError"}};function ws(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 a=/resource_metadata="([^"]*)"/,i=r.match(a);if(i)try{return new URL(i[1])}catch{return}}function FP(e,t="",r={}){return t.endsWith("/")&&(t=t.slice(0,-1)),r.prependPathname?`${t}/.well-known/${e}`:`/.well-known/${e}${t}`}async function wf(e,t,r=fetch){try{return await r(e,{headers:t})}catch(o){if(o instanceof TypeError)return t?wf(e,void 0,r):void 0;throw o}}async function Mh(e,t,r=fetch){return await wf(e,{"MCP-Protocol-Version":t},r)}function VP(e,t){return!e||e.status>=400&&e.status<500&&t!=="/"}async function ZP(e,t,r,o){var n,a;const i=new URL(e),s=(n=o?.protocolVersion)!=null?n:wo;let c;if(o?.metadataUrl)c=new URL(o.metadataUrl);else{const u=FP(t,i.pathname);c=new URL(u,(a=o?.metadataServerUrl)!=null?a:i),c.search=i.search}let l=await Mh(c,s,r);if(!o?.metadataUrl&&VP(l,i.pathname)){const u=new URL(`/.well-known/${t}`,i);l=await Mh(u,s,r)}return l}async function qP(e,t,r=fetch){const o=await ZP(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 OP.parse(await o.json())}function BP(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 GP(e,{fetchFn:t=fetch,protocolVersion:r=wo}={}){var o;const n={"MCP-Protocol-Version":r},a=BP(e);for(const{url:i,type:s}of a){const c=await wf(i,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 ${i}`)}if(s==="oauth")return FS.parse(await c.json());{const l=AP.parse(await c.json());if(!((o=l.code_challenge_methods_supported)!=null&&o.includes("S256")))throw new Error(`Incompatible OIDC provider at ${i}: does not support S256 code challenge method required by MCP specification`);return l}}}}async function HP(e,{metadata:t,clientInformation:r,redirectUrl:o,scope:n,state:a,resource:i}){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 nP(),d=u.code_verifier,m=u.code_challenge;return l.searchParams.set("response_type",s),l.searchParams.set("client_id",r.client_id),l.searchParams.set("code_challenge",m),l.searchParams.set("code_challenge_method",c),l.searchParams.set("redirect_uri",String(o)),a&&l.searchParams.set("state",a),n&&l.searchParams.set("scope",n),n?.includes("offline_access")&&l.searchParams.append("prompt","consent"),i&&l.searchParams.set("resource",i.href),{authorizationUrl:l,codeVerifier:d}}function ZS(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 qS(e,t,r,o){const{client_id:n,client_secret:a}=t;switch(e){case"client_secret_basic":WP(n,a,r);return;case"client_secret_post":JP(n,a,o);return;case"none":KP(n,o);return;default:throw new Error(`Unsupported client authentication method: ${e}`)}}function WP(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 JP(e,t,r){r.set("client_id",e),t&&r.set("client_secret",t)}function KP(e,t){t.set("client_id",e)}async function xf(e){const t=e instanceof Response?e.status:void 0,r=e instanceof Response?await e.text():e;try{const o=PP.parse(JSON.parse(r)),{error:n,error_description:a,error_uri:i}=o,s=zP[n]||lo;return new s({message:a||"",cause:i})}catch(o){const n=`${t?`HTTP ${t}: `:""}Invalid OAuth error response: ${o}. Raw body: ${r}`;return new lo({message:n})}}async function YP(e,{metadata:t,clientInformation:r,authorizationCode:o,codeVerifier:n,redirectUri:a,resource:i,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 m=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),f=new URLSearchParams({grant_type:u,code:o,code_verifier:n,redirect_uri:String(a)});if(s)s(m,f,e,t);else{const h=(l=t?.token_endpoint_auth_methods_supported)!=null?l:[],v=ZS(r,h);qS(v,r,m,f)}i&&f.set("resource",i.href);const g=await(c??fetch)(d,{method:"POST",headers:m,body:f});if(!g.ok)throw await xf(g);return LS.parse(await g.json())}async function XP(e,{metadata:t,clientInformation:r,refreshToken:o,resource:n,addClientAuthentication:a,fetchFn:i}){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(a)a(u,d,e,t);else{const f=(s=t?.token_endpoint_auth_methods_supported)!=null?s:[],g=ZS(r,f);qS(g,r,u,d)}n&&d.set("resource",n.href);const m=await(i??fetch)(l,{method:"POST",headers:u,body:d});if(!m.ok)throw await xf(m);return LS.parse({refresh_token:o,...await m.json()})}async function QP(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 a=await(o??fetch)(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!a.ok)throw await xf(a);return jP.parse(await a.json())}async function xs(e,t){var r,o;try{return await Nl(e,t)}catch(n){if(n instanceof vs||n instanceof bs)return await((r=e.invalidateCredentials)==null?void 0:r.call(e,"all")),await Nl(e,t);if(n instanceof ys)return await((o=e.invalidateCredentials)==null?void 0:o.call(e,"tokens")),await Nl(e,t);throw n}}async function ej(e,t,r){const o=UP(e);if(t.validateResourceURL)return await t.validateResourceURL(o,r?.resource);if(r){if(!LP({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 Nl(e,{serverUrl:t,authorizationCode:r,scope:o,resourceMetadataUrl:n,fetchFn:a}){let i,s;try{i=await qP(t,{resourceMetadataUrl:n},a),i.authorization_servers&&i.authorization_servers.length>0&&(s=i.authorization_servers[0])}catch{}s||(s=t);const c=await ej(t,e,i),l=await GP(s,{fetchFn:a});let u=await Promise.resolve(e.clientInformation());if(!u){if(r!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!e.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");const h=await QP(s,{metadata:l,clientMetadata:e.clientMetadata,fetchFn:a});await e.saveClientInformation(h),u=h}if(r!==void 0){const h=await e.codeVerifier(),v=await YP(s,{metadata:l,clientInformation:u,authorizationCode:r,codeVerifier:h,redirectUri:e.redirectUrl,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(v),"AUTHORIZED"}const d=await e.tokens();if(d?.refresh_token)try{const h=await XP(s,{metadata:l,clientInformation:u,refreshToken:d.refresh_token,resource:c,addClientAuthentication:e.addClientAuthentication,fetchFn:a});return await e.saveTokens(h),"AUTHORIZED"}catch(h){if(!(!(h instanceof Qa)||h instanceof lo))throw h}const m=e.state?await e.state():void 0,{authorizationUrl:f,codeVerifier:g}=await HP(s,{metadata:l,clientInformation:u,state:m,redirectUrl:e.redirectUrl,scope:o||e.clientMetadata.scope,resource:c});return await e.saveCodeVerifier(g),await e.redirectToAuthorization(f),"REDIRECT"}var tj=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":wo};if(this.authProvider){const r=await this.authProvider.tokens();r?.access_token&&(t.Authorization=`Bearer ${r.access_token}`)}return OS(t,`ai-sdk/${US}`,$S())}async start(){return new Promise((e,t)=>{if(this.connected)return e();this.abortController=new AbortController;const r=async(o=!1)=>{var n,a,i,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=ws(u);try{if(await xs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const h=new _s;return(a=this.onerror)==null||a.call(this,h),t(h)}}catch(g){return(i=this.onerror)==null||i.call(this,g),t(g)}return r(!0)}if(!u.ok||!u.body){let g=`MCP SSE Transport Error: ${u.status} ${u.statusText}`;u.status===405&&(g+=". This server does not support SSE transport. Try using `http` transport instead");const h=new Se({message:g});return(s=this.onerror)==null||s.call(this,h),t(h)}const m=u.body.pipeThrough(new TextDecoderStream).pipeThrough(new cs).getReader(),f=async()=>{var g,h,v;try{for(;;){const{done:b,value:w}=await m.read();if(b){if(this.connected)throw this.connected=!1,new Se({message:"MCP SSE Transport Error: Connection closed unexpectedly"});return}const{event:x,data:y}=w;if(x==="endpoint"){if(this.endpoint=new URL(y,this.url),this.endpoint.origin!==this.url.origin)throw new Se({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 S=Jo.parse(JSON.parse(y));(g=this.onmessage)==null||g.call(this,S)}catch(S){const k=new Se({message:"MCP SSE Transport Error: Failed to parse message",cause:S});(h=this.onerror)==null||h.call(this,k)}}}catch(b){if(b instanceof Error&&b.name==="AbortError")return;(v=this.onerror)==null||v.call(this,b),t(b)}};this.sseConnection={close:()=>m.cancel()},f()}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 Se({message:"MCP SSE Transport Error: Not connected"});const t=this.endpoint,r=async(o=!1)=>{var n,a,i,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=ws(d);try{if(await xs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const f=new _s;(a=this.onerror)==null||a.call(this,f);return}}catch(m){(i=this.onerror)==null||i.call(this,m);return}return r(!0)}if(!d.ok){const m=await d.text().catch(()=>null),f=new Se({message:`MCP SSE Transport Error: POSTing to endpoint (HTTP ${d.status}): ${m}`});(s=this.onerror)==null||s.call(this,f);return}}catch(l){(c=this.onerror)==null||c.call(this,l);return}};await r()}},rj=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":wo};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 OS(t,`ai-sdk/${US}`,$S())}async start(){if(this.abortController)throw new Se({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,a,i,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},m=await fetch(this.url,d),f=m.headers.get("mcp-session-id");if(f&&(this.sessionId=f),m.status===401&&this.authProvider&&!r){this.resourceMetadataUrl=ws(m);try{if(await xs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED")throw new _s}catch(v){throw(n=this.onerror)==null||n.call(this,v),v}return t(!0)}if(m.status===202){this.inboundSseConnection||this.openInboundSse();return}if(!m.ok){const v=await m.text().catch(()=>null);let b=`MCP HTTP Transport Error: POSTing to endpoint (HTTP ${m.status}): ${v}`;m.status===404&&(b+=". This server does not support HTTP transport. Try using `sse` transport instead");const w=new Se({message:b});throw(a=this.onerror)==null||a.call(this,w),w}const g=m.headers.get("content-type")||"";if(g.includes("application/json")){const v=await m.json(),b=Array.isArray(v)?v.map(w=>Jo.parse(w)):[Jo.parse(v)];for(const w of b)(i=this.onmessage)==null||i.call(this,w);return}if(g.includes("text/event-stream")){if(!m.body){const x=new Se({message:"MCP HTTP Transport Error: text/event-stream response without body"});throw(s=this.onerror)==null||s.call(this,x),x}const b=m.body.pipeThrough(new TextDecoderStream).pipeThrough(new cs).getReader();(async()=>{var x,y,S;try{for(;;){const{done:k,value:T}=await b.read();if(k)return;const{event:A,data:U}=T;if(A==="message")try{const L=Jo.parse(JSON.parse(U));(x=this.onmessage)==null||x.call(this,L)}catch(L){const W=new Se({message:"MCP HTTP Transport Error: Failed to parse message",cause:L});(y=this.onerror)==null||y.call(this,W)}}}catch(k){if(k instanceof Error&&k.name==="AbortError")return;(S=this.onerror)==null||S.call(this,k)}})();return}const h=new Se({message:`MCP HTTP Transport Error: Unexpected content type: ${g}`});throw(c=this.onerror)==null||c.call(this,h),h}catch(u){throw(l=this.onerror)==null||l.call(this,u),u}};await t()}getNextReconnectionDelay(e){const{initialReconnectionDelay:t,reconnectionDelayGrowFactor:r,maxReconnectionDelay:o}=this.reconnectionOptions;return Math.min(t*Math.pow(r,e),o)}scheduleInboundSseReconnection(){var e;const{maxRetries:t}=this.reconnectionOptions;if(t>0&&this.inboundReconnectAttempts>=t){(e=this.onerror)==null||e.call(this,new Se({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,a,i,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=ws(l);try{if(await xs(this.authProvider,{serverUrl:this.url,resourceMetadataUrl:this.resourceMetadataUrl})!=="AUTHORIZED"){const h=new _s;(o=this.onerror)==null||o.call(this,h);return}}catch(g){(n=this.onerror)==null||n.call(this,g);return}return this.openInboundSse(!0,t)}if(l.status===405)return;if(!l.ok||!l.body){const g=new Se({message:`MCP HTTP Transport Error: GET SSE failed: ${l.status} ${l.statusText}`});(a=this.onerror)==null||a.call(this,g);return}const m=l.body.pipeThrough(new TextDecoderStream).pipeThrough(new cs).getReader(),f=async()=>{var g,h,v,b;try{for(;;){const{done:w,value:x}=await m.read();if(w)return;const{event:y,data:S,id:k}=x;if(k&&(this.lastInboundEventId=k),y==="message")try{const T=Jo.parse(JSON.parse(S));(g=this.onmessage)==null||g.call(this,T)}catch(T){const A=new Se({message:"MCP HTTP Transport Error: Failed to parse message",cause:T});(h=this.onerror)==null||h.call(this,A)}}}catch(w){if(w instanceof Error&&w.name==="AbortError")return;(v=this.onerror)==null||v.call(this,w),(b=this.abortController)!=null&&b.signal.aborted||this.scheduleInboundSseReconnection()}};this.inboundSseConnection={close:()=>m.cancel()},this.inboundReconnectAttempts=0,f()}catch(c){if(c instanceof Error&&c.name==="AbortError")return;(i=this.onerror)==null||i.call(this,c),(s=this.abortController)!=null&&s.signal.aborted||this.scheduleInboundSseReconnection()}}};function nj(e){switch(e.type){case"sse":return new tj(e);case"http":return new rj(e);default:throw new Se({message:"Unsupported or invalid transport configuration. If you are using a custom transport, make sure it implements the MCPTransport interface."})}}function oj(e){return"start"in e&&typeof e.start=="function"&&"send"in e&&typeof e.send=="function"&&"close"in e&&typeof e.close=="function"}var aj="1.0.0";async function ij(e){const t=new sj(e);return await t.init(),t}var sj=class{constructor({transport:e,name:t="ai-sdk-mcp-client",version:r=aj,onUncaughtError:o,capabilities:n}){this.requestMessageId=0,this.responseHandlers=new Map,this.serverCapabilities={},this.isClosed=!0,this.onUncaughtError=o,this.clientCapabilities=n??{},oj(e)?this.transport=e:this.transport=nj(e),this.transport.onclose=()=>this.onClose(),this.transport.onerror=a=>this.onError(a),this.transport.onmessage=a=>{if("method"in a){"id"in a?this.onRequestMessage(a):this.onError(new Se({message:"Unsupported message type"}));return}this.onResponse(a)},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:wo,capabilities:this.clientCapabilities,clientInfo:this.clientInfo}},resultSchema:lP});if(e===void 0)throw new Se({message:"Server sent invalid initialize result"});if(!iP.includes(e.protocolVersion))throw new Se({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 Se({message:"Server does not support tools"});break;case"resources/list":case"resources/read":case"resources/templates/list":if(!this.serverCapabilities.resources)throw new Se({message:"Server does not support resources"});break;case"prompts/list":case"prompts/get":if(!this.serverCapabilities.prompts)throw new Se({message:"Server does not support prompts"});break;default:throw new Se({message:`Unsupported method: ${e}`})}}async request({request:e,resultSchema:t,options:r}){return new Promise((o,n)=>{if(this.isClosed)return n(new Se({message:"Attempted to send a request from a closed client"}));this.assertCapability(e.method);const a=r?.signal;a?.throwIfAborted();const i=this.requestMessageId++,s={...e,jsonrpc:"2.0",id:i},c=()=>{this.responseHandlers.delete(i)};this.responseHandlers.set(i,l=>{if(a?.aborted)return n(new Se({message:"Request was aborted",cause:a.reason}));if(l instanceof Error)return n(l);try{const u=t.parse(l.result);o(u)}catch(u){const d=new Se({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:dP,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:pP,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:fP,options:t})}catch(r){throw r}}async readResourceInternal({uri:e,options:t}){try{return this.request({request:{method:"resources/read",params:{uri:e}},resultSchema:vP,options:t})}catch(r){throw r}}async listResourceTemplatesInternal({options:e}={}){try{return this.request({request:{method:"resources/templates/list"},resultSchema:gP,options:e})}catch(t){throw t}}async listPromptsInternal({params:e,options:t}={}){try{return this.request({request:{method:"prompts/list",params:e},resultSchema:_P,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:xP,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:a,inputSchema:i}of o.tools){if(e!=="automatic"&&!(n in e))continue;const s=this,c=async(u,d)=>{var m;return(m=d?.abortSignal)==null||m.throwIfAborted(),s.callTool({name:n,args:u,options:d})},l=e==="automatic"?KN({description:a,inputSchema:XN({...i,properties:(t=i.properties)!=null?t:{},additionalProperties:!1}),execute:c}):{description:a,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!==Nh)throw new Se({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=Nh.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=kP.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 Se({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 Se({message:`Protocol error: Received a response for an unknown message ID: ${JSON.stringify(e)}`});this.responseHandlers.delete(t),r("result"in e?e:new Se({message:e.error.message,code:e.error.code,data:e.error.data,cause:e.error}))}},ei=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(){}},cj={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},lj=class{#e=cj;#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)}},on=new lj;function uj(e){setTimeout(e,0)}var fn=typeof window>"u"||"Deno"in globalThis;function vt(){}function dj(e,t){return typeof e=="function"?e(t):e}function Du(e){return typeof e=="number"&&e>=0&&e!==1/0}function BS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function jr(e,t){return typeof e=="function"?e(t):e}function Nt(e,t){return typeof e=="function"?e(t):e}function Dh(e,t){const{type:r="all",exact:o,fetchStatus:n,predicate:a,queryKey:i,stale:s}=e;if(i){if(o){if(t.queryHash!==Sf(i,t.options))return!1}else if(!ua(t.queryKey,i))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||a&&!a(t))}function zh(e,t){const{exact:r,status:o,predicate:n,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(r){if(la(t.options.mutationKey)!==la(a))return!1}else if(!ua(t.options.mutationKey,a))return!1}return!(o&&t.state.status!==o||n&&!n(t))}function Sf(e,t){return(t?.queryKeyHashFn||la)(e)}function la(e){return JSON.stringify(e,(t,r)=>Lu(r)?Object.keys(r).sort().reduce((o,n)=>(o[n]=r[n],o),{}):r)}function ua(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>ua(e[r],t[r])):!1}var mj=Object.prototype.hasOwnProperty;function zu(e,t){if(e===t)return e;const r=Uh(e)&&Uh(t);if(!r&&!(Lu(e)&&Lu(t)))return t;const n=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),i=a.length,s=r?new Array(i):{};let c=0;for(let l=0;l<i;l++){const u=r?l:a[l],d=e[u],m=t[u];if(d===m){s[u]=d,(r?l<n:mj.call(e,u))&&c++;continue}if(d===null||m===null||typeof d!="object"||typeof m!="object"){s[u]=m;continue}const f=zu(d,m);s[u]=f,f===d&&c++}return n===i&&c===n?e:s}function Uu(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 Uh(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Lu(e){if(!Lh(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Lh(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Lh(e){return Object.prototype.toString.call(e)==="[object Object]"}function fj(e){return new Promise(t=>{on.setTimeout(t,e)})}function Fu(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 zu(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 zu(e,t)}return t}function pj(e,t,r=0){const o=[...e,t];return r&&o.length>r?o.slice(1):o}function hj(e,t,r=0){const o=[t,...e];return r&&o.length>r?o.slice(0,-1):o}var Ss=Symbol();function GS(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Ss&&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===Ss?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function gj(e,t){return typeof e=="function"?e(...t):!!e}var vj=class extends ei{#e;#t;#r;constructor(){super(),this.#r=e=>{if(!fn&&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"}},kf=new vj;function Vu(){let e,t;const r=new Promise((n,a)=>{e=n,t=a});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 yj=uj;function bj(){let e=[],t=0,r=s=>{s()},o=s=>{s()},n=yj;const a=s=>{t?e.push(s):n(()=>{r(s)})},i=()=>{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||i()}return c},batchCalls:s=>(...c)=>{a(()=>{s(...c)})},schedule:a,setNotifyFunction:s=>{r=s},setBatchNotifyFunction:s=>{o=s},setScheduler:s=>{n=s}}}var Ke=bj(),_j=class extends ei{#e=!0;#t;#r;constructor(){super(),this.#r=e=>{if(!fn&&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}},ks=new _j;function wj(e){return Math.min(1e3*2**e,3e4)}function HS(e){return(e??"online")==="online"?ks.isOnline():!0}var Zu=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function WS(e){let t=!1,r=0,o;const n=Vu(),a=()=>n.status!=="pending",i=h=>{if(!a()){const v=new Zu(h);m(v),e.onCancel?.(v)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>kf.isFocused()&&(e.networkMode==="always"||ks.isOnline())&&e.canRun(),u=()=>HS(e.networkMode)&&e.canRun(),d=h=>{a()||(o?.(),n.resolve(h))},m=h=>{a()||(o?.(),n.reject(h))},f=()=>new Promise(h=>{o=v=>{(a()||l())&&h(v)},e.onPause?.()}).then(()=>{o=void 0,a()||e.onContinue?.()}),g=()=>{if(a())return;let h;const v=r===0?e.initialPromise:void 0;try{h=v??e.fn()}catch(b){h=Promise.reject(b)}Promise.resolve(h).then(d).catch(b=>{if(a())return;const w=e.retry??(fn?0:3),x=e.retryDelay??wj,y=typeof x=="function"?x(r,b):x,S=w===!0||typeof w=="number"&&r<w||typeof w=="function"&&w(r,b);if(t||!S){m(b);return}r++,e.onFail?.(r,b),fj(y).then(()=>l()?void 0:f()).then(()=>{t?m(b):g()})})};return{promise:n,status:()=>n.status,cancel:i,continue:()=>(o?.(),n),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?g():f().then(g),n)}}var JS=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Du(this.gcTime)&&(this.#e=on.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fn?1/0:300*1e3))}clearGcTimeout(){this.#e&&(on.clearTimeout(this.#e),this.#e=void 0)}},xj=class extends JS{#e;#t;#r;#o;#n;#s;#i;constructor(e){super(),this.#i=!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=Vh(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=Vh(this.options);t.data!==void 0&&(this.setState(Fh(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=Fu(this.state.data,e,this.options);return this.#a({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#a({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#n?.promise;return this.#n?.cancel(e),t?t.then(vt).catch(vt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Nt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Ss||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>jr(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:!BS(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.#i?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.#a({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.#i=!0,r.signal)})},n=()=>{const s=GS(this.options,t),l=(()=>{const u={client:this.#o,queryKey:this.queryKey,meta:this.meta};return o(u),u})();return this.#i=!1,this.options.persister?this.options.persister(s,l,this):s(l)},i=(()=>{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(i,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==i.fetchOptions?.meta)&&this.#a({type:"fetch",meta:i.fetchOptions?.meta}),this.#n=WS({initialPromise:t?.initialPromise,fn:i.fetchFn,onCancel:s=>{s instanceof Zu&&s.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(s,c)=>{this.#a({type:"failed",failureCount:s,error:c})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.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 Zu){if(s.silent)return this.#n.promise;if(s.revert){if(this.state.data===void 0)throw s;return this.state.data}}throw this.#a({type:"error",error:s}),this.#r.config.onError?.(s,this),this.#r.config.onSettled?.(this.state.data,s,this),s}finally{this.scheduleGc()}}#a(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,...KS(r.data,this.options),fetchMeta:e.meta??null};case"success":const o={...r,...Fh(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),Ke.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function KS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:HS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Fh(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Vh(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 Sj=class extends ei{constructor(e,t){super(),this.options=t,this.#e=e,this.#a=null,this.#i=Vu(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#r=void 0;#o=void 0;#n;#s;#i;#a;#h;#m;#f;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Zh(this.#t,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return qu(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return qu(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 Nt(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&&!Uu(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const o=this.hasListeners();o&&qh(this.#t,r,this.options,t)&&this.#d(),this.updateResult(),o&&(this.#t!==r||Nt(this.options.enabled,this.#t)!==Nt(t.enabled,this.#t)||jr(this.options.staleTime,this.#t)!==jr(t.staleTime,this.#t))&&this.#g();const n=this.#v();o&&(this.#t!==r||Nt(this.options.enabled,this.#t)!==Nt(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 Ej(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.#i.status==="pending"&&this.#i.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(vt)),t}#g(){this.#_();const e=jr(this.options.staleTime,this.#t);if(fn||this.#o.isStale||!Du(e))return;const r=BS(this.#o.dataUpdatedAt,e)+1;this.#l=on.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,!(fn||Nt(this.options.enabled,this.#t)===!1||!Du(this.#c)||this.#c===0)&&(this.#u=on.setInterval(()=>{(this.options.refetchIntervalInBackground||kf.isFocused())&&this.#d()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#_(){this.#l&&(on.clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(on.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,o=this.options,n=this.#o,a=this.#n,i=this.#s,c=e!==r?e.state:this.#r,{state:l}=e;let u={...l},d=!1,m;if(t._optimisticResults){const A=this.hasListeners(),U=!A&&Zh(e,t),L=A&&qh(e,r,t,o);(U||L)&&(u={...u,...KS(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:g,status:h}=u;m=u.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&h==="pending"){let A;n?.isPlaceholderData&&t.placeholderData===i?.placeholderData?(A=n.data,v=!0):A=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,A!==void 0&&(h="success",m=Fu(n?.data,A,t),d=!0)}if(t.select&&m!==void 0&&!v)if(n&&m===a?.data&&t.select===this.#h)m=this.#m;else try{this.#h=t.select,m=t.select(m),m=Fu(n?.data,m,t),this.#m=m,this.#a=null}catch(A){this.#a=A}this.#a&&(f=this.#a,m=this.#m,g=Date.now(),h="error");const b=u.fetchStatus==="fetching",w=h==="pending",x=h==="error",y=w&&b,S=m!==void 0,T={status:h,fetchStatus:u.fetchStatus,isPending:w,isSuccess:h==="success",isError:x,isInitialLoading:y,isLoading:y,data:m,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:g,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>c.dataUpdateCount||u.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!w,isLoadingError:x&&!S,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:x&&S,isStale:Ef(e,t),refetch:this.refetch,promise:this.#i,isEnabled:Nt(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const A=W=>{T.status==="error"?W.reject(T.error):T.data!==void 0&&W.resolve(T.data)},U=()=>{const W=this.#i=T.promise=Vu();A(W)},L=this.#i;switch(L.status){case"pending":e.queryHash===r.queryHash&&A(L);break;case"fulfilled":(T.status==="error"||T.data!==L.value)&&U();break;case"rejected":(T.status!=="error"||T.error!==L.reason)&&U();break}}return T}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.#f=this.#t),Uu(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 a=new Set(n??this.#p);return this.options.throwOnError&&a.add("error"),Object.keys(this.#o).some(i=>{const s=i;return this.#o[s]!==e[s]&&a.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){Ke.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#o)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function kj(e,t){return Nt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Zh(e,t){return kj(e,t)||e.state.data!==void 0&&qu(e,t,t.refetchOnMount)}function qu(e,t,r){if(Nt(t.enabled,e)!==!1&&jr(t.staleTime,e)!=="static"){const o=typeof r=="function"?r(e):r;return o==="always"||o!==!1&&Ef(e,t)}return!1}function qh(e,t,r,o){return(e!==t||Nt(o.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Ef(e,r)}function Ef(e,t){return Nt(t.enabled,e)!==!1&&e.isStaleByTime(jr(t.staleTime,e))}function Ej(e,t){return!Uu(e.getCurrentResult(),t)}function Bh(e){return{onFetch:(t,r)=>{const o=t.options,n=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],i=t.state.data?.pageParams||[];let s={pages:[],pageParams:[]},c=0;const l=async()=>{let u=!1;const d=g=>{Object.defineProperty(g,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},m=GS(t.options,t.fetchOptions),f=async(g,h,v)=>{if(u)return Promise.reject();if(h==null&&g.pages.length)return Promise.resolve(g);const w=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:h,direction:v?"backward":"forward",meta:t.options.meta};return d(k),k})(),x=await m(w),{maxPages:y}=t.options,S=v?hj:pj;return{pages:S(g.pages,x,y),pageParams:S(g.pageParams,h,y)}};if(n&&a.length){const g=n==="backward",h=g?Ij:Gh,v={pages:a,pageParams:i},b=h(o,v);s=await f(v,b,g)}else{const g=e??a.length;do{const h=c===0?i[0]??o.initialPageParam:Gh(o,s);if(c>0&&h==null)break;s=await f(s,h),c++}while(c<g)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function Gh(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 Ij(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Tj=class extends JS{#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||$j(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#o?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#o=WS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(a,i)=>{this.#n({type:"failed",failureCount:a,error:i})},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 i=await this.options.onMutate?.(e,r);i!==this.state.context&&this.#n({type:"pending",context:i,variables:e,isPaused:n})}const a=await this.#o.start();return await this.#r.config.onSuccess?.(a,e,this.state.context,this,r),await this.options.onSuccess?.(a,e,this.state.context,r),await this.#r.config.onSettled?.(a,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(a,null,e,this.state.context,r),this.#n({type:"success",data:a}),a}catch(a){try{throw await this.#r.config.onError?.(a,e,this.state.context,this,r),await this.options.onError?.(a,e,this.state.context,r),await this.#r.config.onSettled?.(void 0,a,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,a,e,this.state.context,r),a}finally{this.#n({type:"error",error:a})}}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),Ke.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#r.notify({mutation:this,type:"updated",action:e})})}};function $j(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Oj=class extends ei{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 Tj({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=Oi(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=Oi(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=Oi(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=Oi(e);return typeof t=="string"?this.#t.get(t)?.find(o=>o!==e&&o.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ke.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=>zh(t,r))}findAll(e={}){return this.getAll().filter(t=>zh(e,t))}notify(e){Ke.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Ke.batch(()=>Promise.all(e.map(t=>t.continue().catch(vt))))}};function Oi(e){return e.options.scope?.id}var Cj=class extends ei{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const o=t.queryKey,n=t.queryHash??Sf(o,t);let a=this.get(n);return a||(a=new xj({client:e,queryKey:o,queryHash:n,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(o)}),this.add(a)),a}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(){Ke.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=>Dh(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Dh(e,r)):t}notify(e){Ke.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ke.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ke.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},YS=class{#e;#t;#r;#o;#n;#s;#i;#a;constructor(e={}){this.#e=e.queryCache||new Cj,this.#t=e.mutationCache||new Oj,this.#r=e.defaultOptions||{},this.#o=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#i=kf.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#a=ks.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#i?.(),this.#i=void 0,this.#a?.(),this.#a=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(jr(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}),a=this.#e.get(o.queryHash)?.state.data,i=dj(t,a);if(i!==void 0)return this.#e.build(this,o).setData(i,{...r,manual:!0})}setQueriesData(e,t,r){return Ke.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;Ke.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return Ke.batch(()=>(r.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},o=Ke.batch(()=>this.#e.findAll(e).map(n=>n.cancel(r)));return Promise.all(o).then(vt).catch(vt)}invalidateQueries(e,t={}){return Ke.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=Ke.batch(()=>this.#e.findAll(e).filter(n=>!n.isDisabled()&&!n.isStatic()).map(n=>{let a=n.fetch(void 0,r);return r.throwOnError||(a=a.catch(vt)),n.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(o).then(vt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(jr(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(vt).catch(vt)}fetchInfiniteQuery(e){return e.behavior=Bh(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(vt).catch(vt)}ensureInfiniteQueryData(e){return e.behavior=Bh(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ks.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(la(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#o.values()],r={};return t.forEach(o=>{ua(e,o.queryKey)&&Object.assign(r,o.defaultOptions)}),r}setMutationDefaults(e,t){this.#n.set(la(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(o=>{ua(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=Sf(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===Ss&&(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()}},XS=_.createContext(void 0),QS=e=>{const t=_.useContext(XS);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ek=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(XS.Provider,{value:e,children:t})),tk=_.createContext(!1),Aj=()=>_.useContext(tk);tk.Provider;function Rj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Nj=_.createContext(Rj()),Pj=()=>_.useContext(Nj),jj=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Mj=e=>{_.useEffect(()=>{e.clearReset()},[e])},Dj=({result:e,errorResetBoundary:t,throwOnError:r,query:o,suspense:n})=>e.isError&&!t.isReset()&&!e.isFetching&&o&&(n&&e.data===void 0||gj(r,[e.error,o])),zj=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))}},Uj=(e,t)=>e.isLoading&&e.isFetching&&!t,Lj=(e,t)=>e?.suspense&&t.isPending,Hh=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Fj(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=Aj(),n=Pj(),a=QS(),i=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(i),process.env.NODE_ENV!=="production"&&(i.queryFn||console.error(`[${i.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`)),i._optimisticResults=o?"isRestoring":"optimistic",zj(i),jj(i,n),Mj(n);const s=!a.getQueryCache().get(i.queryHash),[c]=_.useState(()=>new t(a,i)),l=c.getOptimisticResult(i),u=!o&&e.subscribed!==!1;if(_.useSyncExternalStore(_.useCallback(d=>{const m=u?c.subscribe(Ke.batchCalls(d)):vt;return c.updateResult(),m},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),_.useEffect(()=>{c.setOptions(i)},[i,c]),Lj(i,l))throw Hh(i,c,n);if(Dj({result:l,errorResetBoundary:n,throwOnError:i.throwOnError,query:a.getQueryCache().get(i.queryHash),suspense:i.suspense}))throw l.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(i,l),i.experimental_prefetchInRender&&!fn&&Uj(l,o)&&(s?Hh(i,c,n):a.getQueryCache().get(i.queryHash)?.promise)?.catch(vt).finally(()=>{c.updateResult()}),i.notifyOnChangeProps?l:c.trackResult(l)}function rk(e,t){return Fj(e,Sj)}function Vj({auth:e,mcp:t,environment:r,toolsToInclude:o,gramEnvironment:n}){const a=Object.entries(r??{}).map(([l,u])=>`${l}:${u}`),i=Object.entries(e.headers??{}).map(([l,u])=>`${l}:${u}`),s=O.useRef({}).current;return{...rk({queryKey:["mcpTools",t,n,...a,...i],queryFn:async()=>{I.assert(!e.isLoading,"No auth found"),I.assert(t,"No MCP URL found"),Object.keys(s).forEach(d=>delete s[d]),Object.assign(s,{...Zj(r??{}),...e.headers,...n&&{"Gram-Environment":n}});const u=await(await ij({name:"gram-elements-mcp-client",transport:{type:"http",url:t,headers:s}})).tools();return o?Object.fromEntries(Object.entries(u).filter(([d])=>typeof o=="function"?o({toolName:d}):o.includes(d))):u},enabled:!e.isLoading&&!!t,staleTime:1/0,gcTime:1/0}),mcpHeaders:s}}const Wh="MCP-";function Zj(e){return typeof e!="object"||e===null?{}:Object.entries(e).reduce((t,[r,o])=>{const n=r.replace(/_/g,"-"),a=n.startsWith(Wh)?n:`${Wh}${n}`;return t[a]=o,t},{})}const nk=()=>{const e=O.useContext(I.ToolApprovalContext);if(!e)throw new Error("useToolApproval must be used within a ToolApprovalProvider");return e};function If(e){return(e.api?.url||""||"https://app.getgram.ai").replace(/\/+$/,"")}const Bc={log:"log",debug:"debug",info:"info",warn:"warn",error:"error"},hr=console,Vn={};Object.keys(Bc).forEach(e=>{Vn[e]=hr[e]});const Uo="Datadog Browser SDK:",re={debug:Vn.debug.bind(hr,Uo),log:Vn.log.bind(hr,Uo),info:Vn.info.bind(hr,Uo),warn:Vn.warn.bind(hr,Uo),error:Vn.error.bind(hr,Uo)},Gc="https://docs.datadoghq.com",qj=`${Gc}/real_user_monitoring/browser/troubleshooting`,Tf="More details:";function ok(e,t){return(...r)=>{try{return e(...r)}catch(o){re.error(t,o)}}}function an(e){return e!==0&&Math.random()*100<=e}function Yo(e,t){return+e.toFixed(t)}function Bj(e){return ti(e)&&e>=0&&e<=100}function ti(e){return typeof e=="number"}function da(e){return{...e}}function Es(e,t){return Object.keys(e).some(r=>e[r]===t)}function Wr(e){return Object.keys(e).length===0}function ak(e,t){const r={};for(const o of Object.keys(e))r[o]=t(e[o]);return r}function Rt(){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 lr=Rt(),Hc="WorkerGlobalScope"in lr;function Fr(e,t){const r=Rt();let o;return r.Zone&&typeof r.Zone.__symbol__=="function"&&(o=e[r.Zone.__symbol__(t)]),o||(o=e[t]),o}let Bu,ik=!1;function Gj(e){Bu=e}function Hj(e){ik=e}function ie(e){return function(){return Mr(e,this,arguments)}}function Mr(e,t,r){try{return e.apply(t,r)}catch(o){br(o)}}function br(e){if(Gu(e),Bu)try{Bu(e)}catch(t){Gu(t)}}function Gu(...e){ik&&re.error("[MONITOR]",...e)}function Xe(e,t){return Fr(Rt(),"setTimeout")(ie(e),t)}function kt(e){Fr(Rt(),"clearTimeout")(e)}function xo(e,t){return Fr(Rt(),"setInterval")(ie(e),t)}function Wc(e){Fr(Rt(),"clearInterval")(e)}function Jh(e){var t;const r=(t=lr.queueMicrotask)===null||t===void 0?void 0:t.bind(lr);typeof r=="function"?r(ie(e)):Promise.resolve().then(ie(e))}class be{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 sk(...e){return new be(t=>{const r=e.map(o=>o.subscribe(n=>t.notify(n)));return()=>r.forEach(o=>o.unsubscribe())})}class ck extends be{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 Jh(()=>{for(const n of this.buffer){if(r)return;t(n)}r||this.addObserver(t)}),o}unbuffer(){Jh(()=>{this.maxBufferSize=this.buffer.length=0})}}const et=1e3,ht=60*et,lk=60*ht,Wj=24*lk,uk=365*Wj;function ri(e){return{relative:e,timeStamp:Kj(e)}}function Jj(e){return{relative:Of(e),timeStamp:e}}function Kj(e){const t=pt()-performance.now();return t>ni()?Math.round(So(t,e)):Yj(e)}function dk(){return Math.round(pt()-So(ni(),performance.now()))}function se(e){return ti(e)?Yo(e*1e6,0):e}function pt(){return new Date().getTime()}function We(){return pt()}function It(){return performance.now()}function qe(){return{relative:It(),timeStamp:We()}}function $f(){return{relative:0,timeStamp:ni()}}function De(e,t){return t-e}function So(e,t){return e+t}function Of(e){return e-ni()}function Yj(e){return Math.round(So(ni(),e))}function Xj(e){return e<uk}let Pl;function ni(){var e,t;return Pl===void 0&&(Pl=(t=(e=performance.timing)===null||e===void 0?void 0:e.navigationStart)!==null&&t!==void 0?t:performance.timeOrigin),Pl}function oi(e,t,r){const o=r&&r.leading!==void 0?r.leading:!0,n=r&&r.trailing!==void 0?r.trailing:!0;let a=!1,i,s;return{throttled:(...c)=>{if(a){i=c;return}o?e(...c):i=c,a=!0,s=Xe(()=>{n&&i&&e(...i),a=!1,i=void 0},t)},cancel:()=>{kt(s),a=!1,i=void 0}}}function xe(){}function at(e){return e?(parseInt(e,10)^Math.random()*16>>parseInt(e,10)/4).toString(16):`10000000-1000-4000-8000-${1e11}`.replace(/[018]/g,at)}const uo=/([\w-]+)\s*=\s*([^;]+)/g;function ma(e,t){for(uo.lastIndex=0;;){const r=uo.exec(e);if(r){if(r[1]===t)return r[2]}else break}}function Qj(e){const t=new Map;for(uo.lastIndex=0;;){const r=uo.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 e2(e){const t=new Map;for(uo.lastIndex=0;;){const r=uo.exec(e);if(r)t.set(r[1],r[2]);else break}return t}function Cf(e,t,r=""){const o=e.charCodeAt(t-1),a=o>=55296&&o<=56319?t+1:t;return e.length<=a?e:`${e.slice(0,a)}${r}`}function t2(){return mk()===0}function r2(){return mk()===1}let Ci;function mk(){return Ci??(Ci=n2())}function n2(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 Af(e){return ai(e,location.href).href}function o2(e){try{return!!ai(e)}catch{return!1}}function a2(e){const t=ai(e).pathname;return t[0]==="/"?t:`/${t}`}function ai(e,t){const{URL:r}=i2();try{return t!==void 0?new r(e,t):new r(e)}catch(o){throw new Error(`Failed to construct URL: ${String(o)}`)}}let jl;function i2(){if(!jl){let e,t;try{e=document.createElement("iframe"),e.style.display="none",document.body.appendChild(e),t=e.contentWindow}catch{t=lr}jl={URL:t.URL},e?.remove()}return jl}function Jc(e,t,r=0,o){const n=new Date;n.setTime(n.getTime()+r);const a=`expires=${n.toUTCString()}`,i=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};${a};path=/;samesite=${i}${s}${c}${l}`}function Kc(e){return ma(document.cookie,e)}function s2(e){return Qj(document.cookie).get(e)||[]}let Ml;function Nr(e){return Ml||(Ml=e2(document.cookie)),Ml.get(e)}function fk(e,t){Jc(e,"",0,t)}function c2(e){if(document.cookie===void 0||document.cookie===null)return!1;try{const t=`dd_cookie_test_${at()}`,r="test";Jc(t,r,ht,e);const o=Kc(t)===r;return fk(t,e),o}catch(t){return re.error(t),!1}}let Dl;function pk(e=location.hostname,t=document.referrer){if(Dl===void 0){const r=l2(e,t);if(r){const o=`dd_site_test_${at()}`,n="test",a=r.split(".");let i=a.pop();for(;a.length&&!Kc(o);)i=`${a.pop()}.${i}`,Jc(o,n,et,{domain:i});fk(o,{domain:i}),Dl=i}}return Dl}function l2(e,t){try{return e||ai(t).hostname}catch{}}const _r="_dd_s";function hk(e,t){for(let r=e.length-1;r>=0;r-=1){const o=e[r];if(t(o,r,e))return o}}function gk(e){return Object.values(e)}function Yc(e){return Object.entries(e)}const kn=4*lk,vk=15*ht,u2=uk,yk="0",mo={COOKIE:"cookie",LOCAL_STORAGE:"local-storage"},bk=/^([a-zA-Z]+)=([a-z0-9-]+)$/,Rf="&";function d2(e){return!!e&&(e.indexOf(Rf)!==-1||bk.test(e))}const m2="1";function Qr(e,t){const r={isExpired:m2};return t.trackAnonymousUser&&e?.anonymousId&&(r.anonymousId=e?.anonymousId),r}function Hi(e){return Wr(e)}function _k(e){return!Hi(e)}function Xo(e){return e.isExpired!==void 0||!f2(e)}function f2(e){return(e.created===void 0||pt()-Number(e.created)<kn)&&(e.expire===void 0||pt()<Number(e.expire))}function wk(e){e.expire=String(pt()+vk)}function Hu(e){return Yc(e).map(([t,r])=>t==="anonymousId"?`aid=${r}`:`${t}=${r}`).join(Rf)}function Xc(e){const t={};return d2(e)&&e.split(Rf).forEach(r=>{const o=bk.exec(r);if(o!==null){const[,n,a]=o;n==="aid"?t.anonymousId=a:t[n]=a}}),t}const p2="_dd",h2="_dd_r",g2="_dd_l",v2="rum",y2="logs";function b2(e){if(!Nr(_r)){const r=Nr(p2),o=Nr(h2),n=Nr(g2),a={};r&&(a.id=r),n&&/^[01]$/.test(n)&&(a[y2]=n),o&&/^[012]$/.test(o)&&(a[v2]=o),_k(a)&&(wk(a),e.persistSession(a))}}const _2=0;function Kh(e){const t=x2(e);return t&&c2(t)?{type:mo.COOKIE,cookieOptions:t}:void 0}function w2(e,t){const r={isLockEnabled:t2(),persistSession:o=>Yh(t,e,o,vk),retrieveSession:()=>xk(t,e),expireSession:o=>Yh(t,e,Qr(o,e),kn)};return b2(r),r}function Yh(e,t,r,o){let n=Hu(r);t.betaEncodeCookieOptions&&(n=Hu({...r,...Wr(r)?{}:{c:Sk(e)}})),Jc(_r,n,t.trackAnonymousUser?u2:o,e)}function xk(e,t){if(t.betaEncodeCookieOptions)return S2(e);const r=Kc(_r);return Xc(r)}function x2(e){const t={};if(t.secure=!!e.useSecureSessionCookie||!!e.usePartitionedCrossSiteSessionCookie,t.crossSite=!!e.usePartitionedCrossSiteSessionCookie,t.partitioned=!!e.usePartitionedCrossSiteSessionCookie,e.trackSessionAcrossSubdomains){const r=pk();if(!r)return;t.domain=r}return t}function Sk(e){const t=e.domain?e.domain.split(".").length-1:0;let r=0;return r|=_2<<5,r|=t<<1,r|=e.crossSite?1:0,r.toString(16)}function S2(e){const t=s2(_r),r=Sk(e);let o;for(const n of t.reverse())if(o=Xc(n),o.c===r)break;return o==null||delete o.c,o??{}}const k2="_dd_test_";function Xh(){try{const e=at(),t=`${k2}${e}`;localStorage.setItem(t,e);const r=localStorage.getItem(t);return localStorage.removeItem(t),e===r?{type:mo.LOCAL_STORAGE}:void 0}catch{return}}function E2(e){return{isLockEnabled:!1,persistSession:kk,retrieveSession:Ek,expireSession:t=>I2(t,e)}}function kk(e){localStorage.setItem(_r,Hu(e))}function Ek(){const e=localStorage.getItem(_r);return Xc(e)}function I2(e,t){kk(Qr(e,t))}const T2=10,$2=100,O2=et,Ik="--",Tk=[];let Wi;function en(e,t,r=0){var o;const{isLockEnabled:n,persistSession:a,expireSession:i}=t,s=m=>a({...m,lock:l}),c=()=>{const{lock:m,...f}=t.retrieveSession();return{session:f,lock:m&&!A2(m)?m:void 0}};if(Wi||(Wi=e),e!==Wi){Tk.push(e);return}if(n&&r>=$2){Qh(t);return}let l,u=c();if(n){if(u.lock){Ai(e,t,r);return}if(l=C2(),s(u.session),u=c(),u.lock!==l){Ai(e,t,r);return}}let d=e.process(u.session);if(n&&(u=c(),u.lock!==l)){Ai(e,t,r);return}if(d&&(Xo(d)?i(d):(wk(d),n?s(d):a(d))),n&&!(d&&Xo(d))){if(u=c(),u.lock!==l){Ai(e,t,r);return}a(u.session),d=u.session}(o=e.after)===null||o===void 0||o.call(e,d||u.session),Qh(t)}function Ai(e,t,r){Xe(()=>{en(e,t,r+1)},T2)}function Qh(e){Wi=void 0;const t=Tk.shift();t&&en(t,e)}function C2(){return at()+Ik+We()}function A2(e){const[,t]=e.split(Ik);return!t||De(Number(t),We())>O2}const eg=et;function R2(e){switch(e.sessionPersistence){case mo.COOKIE:return Kh(e);case mo.LOCAL_STORAGE:return Xh();case void 0:{let t=Kh(e);return!t&&e.allowFallbackToLocalStorage&&(t=Xh()),t}default:re.error(`Invalid session persistence '${String(e.sessionPersistence)}'`)}}function N2(e,t){return e.type===mo.COOKIE?w2(t,e.cookieOptions):E2(t)}function P2(e,t,r,o,n=N2(e,t)){const a=new be,i=new be,s=new be,c=xo(f,eg);let l;h();const{throttled:u,cancel:d}=oi(()=>{en({process:k=>{if(Hi(k))return;const T=g(k);return v(T),T},after:k=>{_k(k)&&!b()&&y(k),l=k}},n)},eg);function m(){en({process:k=>b()?g(k):void 0},n)}function f(){const k=n.retrieveSession();Xo(k)?en({process:T=>Xo(T)?Qr(T,t):void 0,after:g},n):g(k)}function g(k){return Xo(k)&&(k=Qr(k,t)),b()&&(w(k)?x():(s.notify({previousState:l,newState:k}),l=k)),k}function h(){en({process:k=>{if(Hi(k))return k.anonymousId=at(),Qr(k,t)},after:k=>{l=k}},n)}function v(k){if(Hi(k))return!1;const T=o(k[r]);k[r]=T,delete k.isExpired,T!==yk&&!k.id&&(k.id=at(),k.created=String(pt()))}function b(){return l?.[r]!==void 0}function w(k){return l.id!==k.id||l[r]!==k[r]}function x(){l=Qr(l,t),i.notify()}function y(k){l=k,a.notify()}function S(k){en({process:T=>({...T,...k}),after:g},n)}return{expandOrRenewSession:u,expandSession:m,getSession:()=>l,renewObservable:a,expireObservable:i,sessionStateUpdateObservable:s,restartSession:h,expire:k=>{d(),k===!1&&l&&delete l.anonymousId,n.expireSession(l),g(Qr(l,t))},stop:()=>{Wc(c)},updateSessionState:S}}const Wu={GRANTED:"granted",NOT_GRANTED:"not-granted"};function j2(e){const t=new be;return{tryToInit(r){e||(e=r)},update(r){e=r,t.notify()},isGranted(){return e===Wu.GRANTED},observable:t}}function En(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function fa(e){const t=En(e);return t==="string"||t==="function"||e instanceof RegExp}function Qc(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){re.error(n)}return!1})}const M2=["chrome-extension://","moz-extension://"];function tg(e){return M2.some(t=>e.includes(t))}function D2(e,t=""){if(tg(e))return!1;const o=t.split(`
32
- `).filter(n=>{const a=n.trim();return a.length&&/^at\s+|@/.test(a)})[1]||"";return tg(o)}const z2="Running the Browser SDK in a Web extension content script is forbidden unless the `allowedTrackingOrigins` option is provided.",U2="SDK initialized on a non-allowed domain.";function L2(e,t,r=typeof location<"u"?location.origin:""){const o=e.allowedTrackingOrigins;if(!o)return D2(r,t)?(re.error(z2),!1):!0;const n=Qc(o,r);return n||re.error(U2),n}const $k="datad0g.com",F2="dd0g-gov.com",sn="datadoghq.com",V2="datadoghq.eu",Z2="ddog-gov.com",q2="pci.browser-intake-datadoghq.com",B2=["ddsource","dd-api-key","dd-request-id"];function tn(e,t,r){const o=G2(e,t);return{build(n,a){const i=H2(e,t,n,a,r);return o(i)},trackType:t}}function G2(e,t){const r=`/api/v2/${t}`,o=e.proxy;if(typeof o=="string"){const a=Af(o);return i=>`${a}?ddforward=${encodeURIComponent(`${r}?${i}`)}`}if(typeof o=="function")return a=>o({path:r,parameters:a});const n=Ok(t,e);return a=>`https://${n}${r}?${a}`}function Ok(e,t){const{site:r=sn,internalAnalyticsSubdomain:o}=t;if(e==="logs"&&t.usePciIntake&&r===sn)return q2;if(o&&r===sn)return`${o}.${sn}`;if(r===F2)return`http-intake.logs.${r}`;const n=r.split("."),a=n.pop();return`browser-intake-${n.join("-")}.${a}`}function H2({clientToken:e,internalAnalyticsSubdomain:t,source:r="browser"},o,n,{retry:a,encoding:i},s=[]){const c=[`ddsource=${r}`,`dd-api-key=${e}`,`dd-evp-origin-version=${encodeURIComponent("6.24.1")}`,"dd-evp-origin=browser",`dd-request-id=${at()}`].concat(s);return i&&c.push(`dd-evp-encoding=${i}`),o==="rum"&&(c.push(`batch_time=${We()}`,`_dd.api=${n}`),a&&c.push(`_dd.retry_count=${a.count}`,`_dd.retry_after=${a.lastFailureStatus}`)),t&&c.reverse(),c.join("&")}function W2(e){const t=e.site||sn,r=J2(e.source),o=K2({...e,site:t,source:r});return{replica:Y2({...e,site:t,source:r}),site:t,source:r,...o}}function J2(e){return e==="flutter"||e==="unity"?e:"browser"}function K2(e){return{logsEndpointBuilder:tn(e,"logs"),rumEndpointBuilder:tn(e,"rum"),profilingEndpointBuilder:tn(e,"profile"),sessionReplayEndpointBuilder:tn(e,"replay"),exposuresEndpointBuilder:tn(e,"exposures")}}function Y2(e){if(!e.replica)return;const t={...e,site:sn,clientToken:e.replica.clientToken};return{logsEndpointBuilder:tn(t,"logs"),rumEndpointBuilder:tn(t,"rum",[`application.id=${e.replica.applicationId}`])}}function X2(e){return B2.every(t=>e.includes(t))}const Zn={ALLOW:"allow",MASK:"mask",MASK_USER_INPUT:"mask-user-input",MASK_UNLESS_ALLOWLISTED:"mask-unless-allowlisted"},Ju={ALL:"all",SAMPLED:"sampled"};function zl(e,t){return e!=null&&typeof e!="string"?(re.error(`${t} must be defined as a string`),!1):!0}function Q2(e){return e&&typeof e=="string"&&!/(datadog|ddog|datad0g|dd0g)/.test(e)?(re.error(`Site should be a valid Datadog site. ${Tf} ${Gc}/getting_started/site/.`),!1):!0}function qn(e,t){return e!==void 0&&!Bj(e)?(re.error(`${t} Sample Rate should be a number between 0 and 100`),!1):!0}function eM(e,t){var r,o,n,a,i,s,c,l,u,d;if(!e||!e.clientToken){re.error("Client Token is not configured, we will not send any data.");return}if(e.allowedTrackingOrigins!==void 0&&!Array.isArray(e.allowedTrackingOrigins)){re.error("Allowed Tracking Origins must be an array");return}if(!(!Q2(e.site)||!qn(e.sessionSampleRate,"Session")||!qn(e.telemetrySampleRate,"Telemetry")||!qn(e.telemetryConfigurationSampleRate,"Telemetry Configuration")||!qn(e.telemetryUsageSampleRate,"Telemetry Usage")||!zl(e.version,"Version")||!zl(e.env,"Env")||!zl(e.service,"Service")||!L2(e,t??""))){if(e.trackingConsent!==void 0&&!Es(Wu,e.trackingConsent)){re.error('Tracking Consent should be either "granted" or "not-granted"');return}return{beforeSend:e.beforeSend&&ok(e.beforeSend,"beforeSend threw an error:"),sessionStoreStrategyType:Hc?void 0:R2(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:(a=e.telemetryUsageSampleRate)!==null&&a!==void 0?a:5,service:(i=e.service)!==null&&i!==void 0?i: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:Wu.GRANTED,trackAnonymousUser:(d=e.trackAnonymousUser)!==null&&d!==void 0?d:!0,storeContextsAcrossPages:!!e.storeContextsAcrossPages,betaEncodeCookieOptions:!!e.betaEncodeCookieOptions,variant:e.variant,sdkVersion:e.sdkVersion,...W2(e)}}}function tM(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 Vr;(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"})(Vr||(Vr={}));const Nf=new Set;function rM(e){Array.isArray(e)&&nM(e.filter(t=>Es(Vr,t)))}function nM(e){e.forEach(t=>{Nf.add(t)})}function ii(e){return Nf.has(e)}function oM(){return Nf}const fo="?";function si(e){var t,r;const o=[];let n=Ul(e,"stack");const a=String(e);if(n&&n.startsWith(a)&&(n=n.slice(a.length)),n&&n.split(`
33
- `).forEach(i=>{const s=sM(i)||lM(i)||dM(i)||pM(i);s&&(!s.func&&s.line&&(s.func=fo),o.push(s))}),o.length>0&&yM()&&e instanceof Error){const i=[];let s=e;for(;(s=Object.getPrototypeOf(s))&&Ak(s);){const c=((t=s.constructor)===null||t===void 0?void 0:t.name)||fo;i.push(c)}for(let c=i.length-1;c>=0&&((r=o[0])===null||r===void 0?void 0:r.func)===i[c];c--)o.shift()}return{message:Ul(e,"message"),name:Ul(e,"name"),stack:o}}const Ck="((?:file|https?|blob|chrome-extension|electron|native|eval|webpack|snippet|<anonymous>|\\w+\\.|\\/).*?)",po="(?::(\\d+))",aM=new RegExp(`^\\s*at (.*?) ?\\(${Ck}${po}?${po}?\\)?\\s*$`,"i"),iM=new RegExp(`\\((\\S*)${po}${po}\\)`);function sM(e){const t=aM.exec(e);if(!t)return;const r=t[2]&&t[2].indexOf("native")===0,o=t[2]&&t[2].indexOf("eval")===0,n=iM.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]||fo,line:t[3]?+t[3]:void 0,url:r?void 0:t[2]}}const cM=new RegExp(`^\\s*at ?${Ck}${po}?${po}??\\s*$`,"i");function lM(e){const t=cM.exec(e);if(t)return{args:[],column:t[3]?+t[3]:void 0,func:fo,line:t[2]?+t[2]:void 0,url:t[1]}}const uM=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;function dM(e){const t=uM.exec(e);if(t)return{args:[],column:t[4]?+t[4]:void 0,func:t[1]||fo,line:+t[3],url:t[2]}}const mM=/^\s*(.*?)(?:\((.*?)\))?(?:(?:(?:^|@)((?:file|https?|blob|chrome|webpack|resource|capacitor|\[native).*?|[^@]*bundle|\[wasm code\])(?::(\d+))?(?::(\d+))?)|@)\s*$/i,fM=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i;function pM(e){const t=mM.exec(e);if(!t)return;const r=t[3]&&t[3].indexOf(" > eval")>-1,o=fM.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]||fo,line:t[4]?+t[4]:void 0,url:t[3]}}function Ul(e,t){if(typeof e!="object"||!e||!(t in e))return;const r=e[t];return typeof r=="string"?r:void 0}function hM(e,t,r,o){if(t===void 0)return;const{name:n,message:a}=vM(e);return{name:n,message:a,stack:[{url:t,column:o,line:r}]}}const gM=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?([\s\S]*)$/;function vM(e){let t,r;return{}.toString.call(e)==="[object String]"&&([,t,r]=gM.exec(e)),{name:t,message:r}}function Ak(e){return String(e.constructor).startsWith("class ")}let Ri;function yM(){if(Ri!==void 0)return Ri;class e extends Error{constructor(){super(),this.name="Error"}}const[t,r]=[e,Error].map(o=>new o);return Ri=Ak(Object.getPrototypeOf(t))&&r.stack!==t.stack,Ri}function Is(e){const r=new Error(e);r.name="HandlingStack";let o;return Mr(()=>{const n=si(r);n.stack=n.stack.slice(2),o=ci(n)}),o}function ci(e){let t=Rk(e);return e.stack.forEach(r=>{const o=r.func==="?"?"<anonymous>":r.func,n=r.args&&r.args.length>0?`(${r.args.join(", ")})`:"",a=r.line?`:${r.line}`:"",i=r.line&&r.column?`:${r.column}`:"";t+=`
34
- at ${o}${n} @ ${r.url}${a}${i}`}),t}function Rk(e){return`${e.name||"Error"}: ${e.message}`}function Wt(e,t,r,{computeHandlingStack:o}={}){let n=e[t];if(typeof n!="function")if(t in e&&t.startsWith("on"))n=xe;else return{stop:xe};let a=!1;const i=function(){if(a)return n.apply(this,arguments);const s=Array.from(arguments);let c;Mr(r,null,[{target:this,parameters:s,onPostCall:u=>{c=u},handlingStack:o?Is("instrumented method"):void 0}]);const l=n.apply(this,s);return c&&Mr(c,null,[l]),l};return e[t]=i,{stop:()=>{a=!0,e[t]===i&&(e[t]=n)}}}function bM(e,t,r){const o=Object.getOwnPropertyDescriptor(e,t);if(!o||!o.set||!o.configurable)return{stop:xe};const n=xe;let a=(s,c)=>{Xe(()=>{a!==n&&r(s,c)},0)};const i=function(s){o.set.call(this,s),a(this,s)};return Object.defineProperty(e,t,{set:i}),{stop:()=>{var s;((s=Object.getOwnPropertyDescriptor(e,t))===null||s===void 0?void 0:s.set)===i&&Object.defineProperty(e,t,o),a=n}}}const In=1024,Nk=1024*In,_M=/[^\u0000-\u007F]/;function Pk(e){return _M.test(e)?window.TextEncoder!==void 0?new TextEncoder().encode(e).length:new Blob([e]).size:e.length}function jk(e){if(e.length===1)return e[0];const t=e.reduce((n,a)=>n+a.length,0),r=new Uint8Array(t);let o=0;for(const n of e)r.set(n,o),o+=n.length;return r}function ko(e,t,r){if(typeof e!="object"||e===null)return JSON.stringify(e);const o=Bn(Object.prototype),n=Bn(Array.prototype),a=Bn(Object.getPrototypeOf(e)),i=Bn(e);try{return JSON.stringify(e,t,r)}catch{return"<error: unable to serialize object>"}finally{o(),n(),a(),i()}}function Bn(e){const t=e,r=t.toJSON;return r?(delete t.toJSON,()=>{t.toJSON=r}):xe}const wM=220*In,xM="$",SM=3;function Ae(e,t=wM){const r=Bn(Object.prototype),o=Bn(Array.prototype),n=[],a=new WeakMap,i=Ll(e,xM,void 0,n,a),s=JSON.stringify(i);let c=s?s.length:0;if(c>t){Fl(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 m=Ll(l.source[d],l.path,d,n,a);if(m!==void 0?c+=JSON.stringify(m).length:c+=4,c+=u,u=1,c>t){Fl(t,"truncated",e);break}l.target[d]=m}else for(const d in l.source)if(Object.prototype.hasOwnProperty.call(l.source,d)){const m=Ll(l.source[d],l.path,d,n,a);if(m!==void 0&&(c+=JSON.stringify(m).length+u+d.length+SM,u=1),c>t){Fl(t,"truncated",e);break}l.target[d]=m}}return r(),o(),i}function Ll(e,t,r,o,n){const a=IM(e);if(!a||typeof a!="object")return kM(a);const i=Ku(a);if(i!=="[Object]"&&i!=="[Array]"&&i!=="[Error]")return i;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(a)?[]:{};return n.set(s,c),o.push({source:a,target:l,path:c}),l}function kM(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 Ku(e){try{if(e instanceof Event)return EM(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 EM(e){return{type:e.type,isTrusted:e.isTrusted,currentTarget:e.currentTarget?Ku(e.currentTarget):null,target:e.target?Ku(e.target):null}}function IM(e){const t=e;if(t&&typeof t.toJSON=="function")try{return t.toJSON()}catch{}return e}function Fl(e,t,r){re.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 Pf({stackTrace:e,originalError:t,handlingStack:r,componentStack:o,startClocks:n,nonErrorPrefix:a,useFallbackStack:i=!0,source:s,handling:c}){const l=Tn(t);return!e&&l&&(e=si(t)),{startClocks:n,source:s,handling:c,handlingStack:r,componentStack:o,originalError:t,type:e?e.name:void 0,message:TM(e,l,a,t),stack:e?ci(e):i?Mk:void 0,causes:l?CM(t,s):void 0,fingerprint:$M(t),context:OM(t)}}function TM(e,t,r,o){return e?.message&&e?.name?e.message:t?"Empty message":`${r} ${ko(Ae(o))}`}function $M(e){return Tn(e)&&"dd_fingerprint"in e?String(e.dd_fingerprint):void 0}function OM(e){if(e!==null&&typeof e=="object"&&"dd_context"in e)return e.dd_context}function Tn(e){return e instanceof Error||Object.prototype.toString.call(e)==="[object Error]"}function CM(e,t){let r=e;const o=[];for(;Tn(r?.cause)&&o.length<10;){const n=si(r.cause);o.push({message:r.cause.message,source:t,type:n?.name,stack:n&&ci(n)}),r=r.cause}return o.length?o:void 0}const Eo={AGENT:"agent",CONSOLE:"console",CUSTOM:"custom",LOGGER:"logger",NETWORK:"network",SOURCE:"source",REPORT:"report"};function AM(){return new be(e=>{const t=(n,a)=>{const i=Pf({stackTrace:a,originalError:n,startClocks:qe(),nonErrorPrefix:"Uncaught",source:Eo.SOURCE,handling:"unhandled"});e.notify(i)},{stop:r}=RM(t),{stop:o}=NM(t);return()=>{r(),o()}})}function RM(e){return Wt(Rt(),"onerror",({parameters:[t,r,o,n,a]})=>{let i;Tn(a)||(i=hM(t,r,o,n)),e(a??t,i)})}function NM(e){return Wt(Rt(),"onunhandledrejection",({parameters:[t]})=>{e(t.reason||"Empty reason")})}function PM(e){const t={version:"6.24.1",onReady(r){r()},...e};return Object.defineProperty(t,"_setDebug",{get(){return Hj},enumerable:!1}),t}function jM(e,t,r){const o=e[t];o&&!o.q&&o.version&&re.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=>ok(n,"onReady callback threw an error:")())}function Dk(e,t){t.silentMultipleInit||re.error(`${e} is already initialized.`)}function Ne(e,t,r,o,n){return wr(e,t,[r],o,n)}function wr(e,t,r,o,{once:n,capture:a,passive:i}={}){const s=ie(m=>{!m.isTrusted&&!m.__ddIsTrusted&&!e.allowUntrustedEvents||(n&&d(),o(m))}),c=i?{capture:a,passive:i}:a,l=window.EventTarget&&t instanceof EventTarget?window.EventTarget.prototype:t,u=Fr(l,"addEventListener");r.forEach(m=>u.call(t,m,s,c));function d(){const m=Fr(l,"removeEventListener");r.forEach(f=>m.call(t,f,s,c))}return{stop:d}}const pa={intervention:"intervention",cspViolation:"csp_violation"};function MM(e,t){const r=[];t.includes(pa.cspViolation)&&r.push(zM(e));const o=t.filter(n=>n!==pa.cspViolation);return o.length&&r.push(DM(o)),sk(...r)}function DM(e){return new be(t=>{if(!window.ReportingObserver)return;const r=ie((n,a)=>n.forEach(i=>t.notify(UM(i)))),o=new window.ReportingObserver(r,{types:e,buffered:!0});return o.observe(),()=>{o.disconnect()}})}function zM(e){return new be(t=>{const{stop:r}=Ne(e,document,"securitypolicyviolation",o=>{t.notify(LM(o))});return r})}function UM(e){const{type:t,body:r}=e;return zk({type:r.id,message:`${t}: ${r.message}`,originalError:e,stack:Uk(r.id,r.message,r.sourceFile,r.lineNumber,r.columnNumber)})}function LM(e){const t=`'${e.blockedURI}' blocked by '${e.effectiveDirective}' directive`;return zk({type:e.effectiveDirective,message:`${pa.cspViolation}: ${t}`,originalError:e,csp:{disposition:e.disposition},stack:Uk(e.effectiveDirective,e.originalPolicy?`${t} of the policy "${Cf(e.originalPolicy,100,"...")}"`:"no policy",e.sourceFile,e.lineNumber,e.columnNumber)})}function zk(e){return{startClocks:qe(),source:Eo.REPORT,handling:"unhandled",...e}}function Uk(e,t,r,o,n){return r?ci({name:e,message:t,stack:[{func:"?",url:r,line:o??void 0,column:n??void 0}]}):void 0}const FM=200;function jf(e){const{env:t,service:r,version:o,datacenter:n,sdkVersion:a,variant:i}=e,s=[Pn("sdk_version",a??"6.24.1")];return t&&s.push(Pn("env",t)),r&&s.push(Pn("service",r)),o&&s.push(Pn("version",o)),n&&s.push(Pn("datacenter",n)),i&&s.push(Pn("variant",i)),s}function Pn(e,t){const r=t?`${e}:${t}`:e;return(r.length>FM||ZM(r))&&re.warn(`Tag ${r} doesn't meet tag requirements and will be sanitized. ${Tf} ${Gc}/getting_started/tagging/#defining-tags`),VM(r)}function VM(e){return e.replace(/,/g,"_")}function ZM(e){return qM()?new RegExp("[^\\p{Ll}\\p{Lo}0-9_:./-]","u").test(e):!1}function qM(){try{return new RegExp("[\\p{Ll}]","u"),!0}catch{return!1}}function Mf(e,t){const r=lr.__ddBrowserSdkExtensionCallback;r&&r({type:e,payload:t})}function Ts(e,t,r=BM()){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 a=0;a<t.length;++a)n[a]=Ts(n[a],t[a],r);return n}const o=En(e)==="object"?e:{};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(o[n]=Ts(o[n],t[n],r));return o}function Df(e){return Ts(void 0,e)}function xr(...e){let t;for(const r of e)r!=null&&(t=Ts(t,r));return t}function BM(){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 Lk(){var e;const t=lr.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 GM(e){return e>=500}function HM(e){try{return e.clone()}catch{return}}const WM=80*In,JM=32,Fk=20*Nk,KM=ht,Vk=et;function Zk(e,t,r,o,n,a){t.transportStatus===0&&t.queuedPayloads.size()===0&&t.bandwidthMonitor.canHandle(e)?Bk(e,t,r,a,{onSuccess:()=>Gk(0,t,r,o,n,a),onFailure:()=>{t.queuedPayloads.enqueue(e)||a.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e}),qk(t,r,o,n,a)}}):t.queuedPayloads.enqueue(e)||a.notify({type:"queue-full",bandwidth:t.bandwidthMonitor.stats(),payload:e})}function qk(e,t,r,o,n){e.transportStatus===2&&Xe(()=>{const a=e.queuedPayloads.first();Bk(a,e,t,n,{onSuccess:()=>{e.queuedPayloads.dequeue(),e.currentBackoffTime=Vk,Gk(1,e,t,r,o,n)},onFailure:()=>{e.currentBackoffTime=Math.min(KM,e.currentBackoffTime*2),qk(e,t,r,o,n)}})},e.currentBackoffTime)}function Bk(e,t,r,o,{onSuccess:n,onFailure:a}){t.bandwidthMonitor.add(e),r(e,i=>{t.bandwidthMonitor.remove(e),YM(i)?(t.transportStatus=t.bandwidthMonitor.ongoingRequestCount>0?1:2,e.retry={count:e.retry?e.retry.count+1:1,lastFailureStatus:i.status},o.notify({type:"failure",bandwidth:t.bandwidthMonitor.stats(),payload:e}),a()):(t.transportStatus=0,o.notify({type:"success",bandwidth:t.bandwidthMonitor.stats(),payload:e}),n())})}function Gk(e,t,r,o,n,a){e===0&&t.queuedPayloads.isFull()&&!t.queueFullReported&&(n({message:`Reached max ${o} events size queued for upload: ${Fk/Nk}MiB`,source:Eo.AGENT,startClocks:qe()}),t.queueFullReported=!0);const i=t.queuedPayloads;for(t.queuedPayloads=Hk();i.size()>0;)Zk(i.dequeue(),t,r,o,n,a)}function YM(e){return e.type!=="opaque"&&(e.status===0&&!navigator.onLine||e.status===408||e.status===429||GM(e.status))}function XM(){return{transportStatus:0,currentBackoffTime:Vk,bandwidthMonitor:QM(),queuedPayloads:Hk(),queueFullReported:!1}}function Hk(){const e=[];return{bytesCount:0,enqueue(t){return this.isFull()?!1:(e.push(t),this.bytesCount+=t.bytesCount,!0)},first(){return e[0]},dequeue(){const t=e.shift();return t&&(this.bytesCount-=t.bytesCount),t},size(){return e.length},isFull(){return this.bytesCount>=Fk}}}function QM(){return{ongoingRequestCount:0,ongoingByteCount:0,canHandle(e){return this.ongoingRequestCount===0||this.ongoingByteCount+e.bytesCount<=WM&&this.ongoingRequestCount<JM},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 Yu=16*In;function zf(e,t,r=Yu){const o=new be,n=XM();return{observable:o,send:a=>{for(const i of e)Zk(a,n,(s,c)=>{ii(Vr.AVOID_FETCH_KEEPALIVE)?$s(i,s,c):r4(i,r,s,c)},i.trackType,t,o)},sendOnExit:a=>{for(const i of e)e4(i,r,a)}}}function e4(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){t4(n)}$s(e,r)}let rg=!1;function t4(e){rg||(rg=!0,br(e))}function r4(e,t,r,o){if(n4()&&r.bytesCount<t){const a=e.build("fetch-keepalive",r);fetch(a,{method:"POST",body:r.data,keepalive:!0,mode:"cors"}).then(ie(i=>o?.({status:i.status,type:i.type}))).catch(ie(()=>$s(e,r,o)))}else $s(e,r,o)}function $s(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 n4(){try{return window.Request&&"keepalive"in new Request("http://a")}catch{return!1}}function Io(){const e=o4();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 Wk(e){const t=Io();return!!t&&t.getCapabilities().includes(e)}function pn(e){var t;e===void 0&&(e=(t=Rt().location)===null||t===void 0?void 0:t.hostname);const r=Io();return!!r&&r.getAllowedWebViewHosts().some(o=>e===o||e.endsWith(`.${o}`))}function o4(){return Rt().DatadogEventBridge}const Hn={HIDDEN:"visibility_hidden",UNLOADING:"before_unload",PAGEHIDE:"page_hide",FROZEN:"page_frozen"};function a4(e){return new be(t=>{const{stop:r}=wr(e,window,["visibilitychange","freeze"],n=>{n.type==="visibilitychange"&&document.visibilityState==="hidden"?t.notify({reason:Hn.HIDDEN}):n.type==="freeze"&&t.notify({reason:Hn.FROZEN})},{capture:!0}),o=Ne(e,window,"beforeunload",()=>{t.notify({reason:Hn.UNLOADING})}).stop;return()=>{r(),o()}})}function Jk(e){return gk(Hn).includes(e)}const ng=256*In;function Kk({encoder:e,request:t,flushController:r}){let o={};const n=r.flushObservable.subscribe(u=>l(u));function a(u,d,m){r.notifyBeforeAddMessage(d),m!==void 0?(o[m]=u,r.notifyAfterAddMessage()):e.write(e.isEmpty?u:`
35
- ${u}`,f=>{r.notifyAfterAddMessage(f-d)})}function i(u){return u!==void 0&&o[u]!==void 0}function s(u){const d=o[u];delete o[u];const m=e.estimateEncodedBytesCount(d);r.notifyAfterRemoveMessage(m)}function c(u,d){const m=ko(u),f=e.estimateEncodedBytesCount(m);if(f>=ng){re.warn(`Discarded a message whose size was bigger than the maximum allowed size ${ng/In}KiB. ${Tf} ${qj}/#technical-limitations`);return}i(d)&&s(d),a(m,f,d)}function l(u){const d=gk(o).join(`
36
- `);o={};const m=Jk(u.reason),f=m?t.sendOnExit:t.send;if(m&&e.isAsync){const g=e.finishSync();g.outputBytesCount&&f(og(g));const h=[g.pendingData,d].filter(Boolean).join(`
37
- `);h&&f({data:h,bytesCount:Pk(h)})}else d&&e.write(e.isEmpty?d:`
38
- ${d}`),e.finish(g=>{f(og(g))})}return{flushController:r,add:c,upsert:c,stop:n.unsubscribe}}function og(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 i4=30*et,s4=Hc?1:50;function Yk({pageMayExitObservable:e,sessionExpireObservable:t}){const r=e.subscribe(d=>s(d.reason)),o=t.subscribe(()=>s("session_expire")),n=new be(()=>()=>{r.unsubscribe(),o.unsubscribe()});let a=0,i=0;function s(d){if(i===0)return;const m=i,f=a;i=0,a=0,u(),n.notify({reason:d,messagesCount:m,bytesCount:f})}let c;function l(){c===void 0&&(c=Xe(()=>{s("duration_limit")},i4))}function u(){kt(c),c=void 0}return{flushObservable:n,get messagesCount(){return i},notifyBeforeAddMessage(d){a+d>=Yu&&s("bytes_limit"),i+=1,a+=d,l()},notifyAfterAddMessage(d=0){a+=d,i>=s4?s("messages_limit"):a>=Yu&&s("bytes_limit")},notifyAfterRemoveMessage(d){a-=d,i-=1,i===0&&u()}}}const Zr="DISCARDED",Tt="SKIPPED";function c4(){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 a of o){const i=a(r);if(i===Zr)return Zr;i!==Tt&&n.push(i)}return xr(...n)}}}const Dr={LOG:"log",CONFIGURATION:"configuration",USAGE:"usage"},l4=["https://www.datadoghq-browser-agent.com","https://www.datad0g-browser-agent.com","https://d3uc069fcn7uxw.cloudfront.net","https://d20xtzwzcl0ceb.cloudfront.net","http://localhost","<anonymous>"],u4=1,d4=[Z2],m4=15;let Vl;function To(){return Vl||(Vl=new ck(100)),Vl}function f4(e,t,r,o,n,a){const i=new be,{stop:s}=h4(t,o,n,a,i),{enabled:c,metricsEnabled:l}=p4(e,t,r,i);return{stop:s,enabled:c,metricsEnabled:l}}function p4(e,t,r,o,n=u4,a=m4){const i={},s=!d4.includes(t.site)&&an(t.telemetrySampleRate),c={[Dr.LOG]:s,[Dr.CONFIGURATION]:s&&an(t.telemetryConfigurationSampleRate),[Dr.USAGE]:s&&an(t.telemetryUsageSampleRate),metric:s&&an(n)},l=g4(),u=To();return u.subscribe(({rawEvent:m,metricName:f})=>{if(f&&!c.metric||!c[m.type])return;const g=f||m.status||m.type;let h=i[g];if(h||(h=i[g]=new Set),h.size>=a)return;const v=ko(m);if(h.has(v))return;const b=r.triggerHook(1,{startTime:qe().relative});if(b===Zr)return;const w=d(b,e,m,l);o.notify(w),Mf("telemetry",w),h.add(v)}),u.unbuffer(),Gj(Uf),{enabled:s,metricsEnabled:c.metric};function d(m,f,g,h){const b={type:"telemetry",date:qe().timeStamp,service:f,version:"6.24.1",source:"browser",_dd:{format_version:2},telemetry:xr(g,{runtime_env:h,connectivity:Lk(),sdk_setup:"npm"}),ddtags:jf(t).join(","),experimental_features:Array.from(oM())};return xr(b,m)}}function h4(e,t,r,o,n){const a=[];if(pn()){const i=Io(),s=n.subscribe(c=>i.send("internal_telemetry",c));a.push(s.unsubscribe)}else{const i=[e.rumEndpointBuilder];e.replica&&v4(e)&&i.push(e.replica.rumEndpointBuilder);const s=Kk({encoder:o(4),request:zf(i,t),flushController:Yk({pageMayExitObservable:r,sessionExpireObservable:new be})});a.push(s.stop);const c=n.subscribe(s.add);a.push(c.unsubscribe)}return{stop:()=>a.forEach(i=>i())}}function g4(){var e;return{is_local_file:((e=lr.location)===null||e===void 0?void 0:e.protocol)==="file:",is_worker:Hc}}function v4(e){return e.site===$k}function $o(e,t){Gu(Bc.debug,e,t),To().notify({rawEvent:{type:Dr.LOG,message:e,status:"debug",...t}})}function Uf(e,t){To().notify({rawEvent:{type:Dr.LOG,status:"error",...b4(e),...t}})}function y4(e){To().notify({rawEvent:{type:Dr.CONFIGURATION,configuration:e}})}function li(e,t){To().notify({rawEvent:{type:Dr.LOG,message:e,status:"debug",...t},metricName:e})}function Ge(e){To().notify({rawEvent:{type:Dr.USAGE,usage:e}})}function b4(e){if(Tn(e)){const t=si(e);return{error:{kind:t.name,stack:ci(_4(t))},message:t.message}}return{error:{stack:Mk},message:`Uncaught ${ko(e)}`}}function _4(e){return e.stack=e.stack.filter(t=>!t.url||l4.some(r=>t.url.startsWith(r))),e}function Xk(e,t){const r=e.indexOf(t);r>=0&&e.splice(r,1)}function un(e){return Array.isArray(e)&&e.length>0}const Ni=1/0,w4=ht;let Lo=null;const Ji=new Set;function x4(){Ji.forEach(e=>e())}function Oo({expireDelay:e,maxEntries:t}){let r=[];Lo||(Lo=xo(()=>x4(),w4));const o=()=>{const u=It()-e;for(;r.length>0&&r[r.length-1].endTime<u;)r.pop()};Ji.add(o);function n(u,d){const m={value:u,startTime:d,endTime:Ni,remove:()=>{Xk(r,m)},close:f=>{m.endTime=f}};return t&&r.length>=t&&r.pop(),r.unshift(m),m}function a(u=Ni,d={returnInactive:!1}){for(const m of r)if(m.startTime<=u){if(d.returnInactive||u<=m.endTime)return m.value;break}}function i(u){const d=r[0];d&&d.endTime===Ni&&d.close(u)}function s(u=Ni,d=0){const m=So(u,d);return r.filter(f=>f.startTime<=m&&u<=f.endTime).map(f=>f.value)}function c(){r=[]}function l(){Ji.delete(o),Ji.size===0&&Lo&&(Wc(Lo),Lo=null)}return{add:n,find:a,closeActive:i,findAll:s,reset:c,stop:l}}const S4="datadog-synthetics-public-id",k4="datadog-synthetics-result-id",E4="datadog-synthetics-injects-rum";function Qk(){return Hc?!1:!!(lr._DATADOG_SYNTHETICS_INJECTS_RUM||Nr(E4))}function eE(){const e=window._DATADOG_SYNTHETICS_PUBLIC_ID||Nr(S4);return typeof e=="string"?e:void 0}function tE(){const e=window._DATADOG_SYNTHETICS_RESULT_ID||Nr(k4);return typeof e=="string"?e:void 0}function rE(){return!!(eE()&&tE())}const I4=ht,T4=kn;function $4(e,t,r,o){const n=new be,a=new be,i=P2(e.sessionStoreStrategyType,e,t,r),s=Oo({expireDelay:T4});if(i.renewObservable.subscribe(()=>{s.add(c(),It()),n.notify()}),i.expireObservable.subscribe(()=>{a.notify(),s.closeActive(It())}),i.expandOrRenewSession(),s.add(c(),$f().relative),ii(Vr.SHORT_SESSION_INVESTIGATION)){const l=i.getSession();l&&N4(e,l)}o.observable.subscribe(()=>{o.isGranted()?i.expandOrRenewSession():i.expire(!1)}),O4(e,()=>{o.isGranted()&&i.expandOrRenewSession()}),C4(e,()=>i.expandSession()),A4(e,()=>i.restartSession());function c(){const l=i.getSession();return l?{id:l.id,trackingType:l[t],isReplayForced:!!l.forcedReplay,anonymousId:l.anonymousId}:(R4(e).catch(()=>{}),{id:"invalid",trackingType:yk,isReplayForced:!1,anonymousId:void 0})}return{findSession:(l,u)=>s.find(l,u),renewObservable:n,expireObservable:a,sessionStateUpdateObservable:i.sessionStateUpdateObservable,expire:i.expire,updateSessionState:i.updateSessionState}}function O4(e,t){const{stop:r}=wr(e,window,["click","touchstart","keydown","scroll"],t,{capture:!0,passive:!0})}function C4(e,t){const r=()=>{document.visibilityState==="visible"&&t()},{stop:o}=Ne(e,document,"visibilitychange",r);xo(r,I4)}function A4(e,t){const{stop:r}=Ne(e,window,"resume",t,{capture:!0})}async function R4(e){const t=e.sessionStoreStrategyType;if(!t)return;let r,o;t.type===mo.COOKIE?(r=xk(t.cookieOptions,e),o={cookie:await nE(),currentDomain:`${window.location.protocol}//${window.location.hostname}`}):r=Ek(),$o("Unexpected session state",{sessionStoreStrategyType:t.type,session:r,isSyntheticsTest:rE(),createdTimestamp:r?.created,expireTimestamp:r?.expire,...o})}function N4(e,t){if(!window.cookieStore||!t.created)return;const r=Number(t.created),o=pt(),{stop:n}=Ne(e,cookieStore,"change",a);function a(i){const s=hk(i.changed,l=>l.name===_r);if(!s)return;const c=pt()-r;if(c>14*ht)n();else{const l=Xc(s.value);if(l.id&&l.id!==t.id){n();const u=pt()-o;nE().then(d=>{$o("Session cookie changed",{time:u,session_age:c,old:t,new:l,cookie:d})}).catch(br)}}}}async function nE(){let e;return"cookieStore"in window?e=await window.cookieStore.getAll(_r):e=document.cookie.split(/\s*;\s*/).filter(t=>t.startsWith(_r)),{count:e.length,domain:pk()||"undefined",...e}}function P4(){let e="",t=0;return{isAsync:!1,get isEmpty(){return!e},write(r,o){const n=Pk(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 j4{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 M4=3e3;function Zl(e,t,r=M4){let o=0,n=!1;return{isLimitReached(){if(o===0&&Xe(()=>{o=0},ht),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:Eo.AGENT,startClocks:qe()})}finally{n=!1}}return!0}}}function Lf(e,t,r){return document.readyState===t||document.readyState==="complete"?(r(),{stop:xe}):Ne(e,window,t==="complete"?"load":"DOMContentLoaded",r,{once:!0})}function D4(e,t){return new Promise(r=>{Lf(e,t,r)})}let ql;const Ff=new WeakMap;function z4(e){return ql||(ql=U4(e)),ql}function U4(e){return new be(t=>{const{stop:r}=Wt(XMLHttpRequest.prototype,"open",L4),{stop:o}=Wt(XMLHttpRequest.prototype,"send",a=>{F4(a,e,t)},{computeHandlingStack:!0}),{stop:n}=Wt(XMLHttpRequest.prototype,"abort",V4);return()=>{r(),o(),n()}})}function L4({target:e,parameters:[t,r]}){Ff.set(e,{state:"open",method:String(t).toUpperCase(),url:Af(String(r))})}function F4({target:e,parameters:[t],handlingStack:r},o,n){const a=Ff.get(e);if(!a)return;const i=a;i.state="start",i.startClocks=qe(),i.isAborted=!1,i.xhr=e,i.handlingStack=r,i.requestBody=t;let s=!1;const{stop:c}=Wt(e,"onreadystatechange",()=>{e.readyState===XMLHttpRequest.DONE&&l()}),l=()=>{if(u(),c(),s)return;s=!0;const d=a;d.state="complete",d.duration=De(i.startClocks.timeStamp,We()),d.status=e.status,typeof e.response=="string"&&(d.responseBody=e.response),n.notify(da(d))},{stop:u}=Ne(o,e,"loadend",l);n.notify(i)}function V4({target:e}){const t=Ff.get(e);t&&(t.isAborted=!0)}async function Z4(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(xe),t.collectStreamBody?jk(o):void 0}let Bl;const oE=[];function aE({responseBodyAction:e}={}){return e&&oE.push(e),Bl||(Bl=q4()),Bl}function q4(){return new be(e=>{if(!lr.fetch)return;const{stop:t}=Wt(lr,"fetch",r=>B4(r,e),{computeHandlingStack:!0});return t})}function B4({parameters:e,onPostCall:t,handlingStack:r},o){const[n,a]=e;let i=a&&a.method;i===void 0&&n instanceof Request&&(i=n.method);const s=i!==void 0?String(i).toUpperCase():"GET",c=n instanceof Request?n.url:Af(String(n)),l=qe(),u={state:"start",init:a,input:n,method:s,startClocks:l,url:c,handlingStack:r};o.notify(u),e[0]=u.input,e[1]=u.init,t(d=>{G4(o,d,u).catch(br)})}async function G4(e,t,r){var o,n;const a=r;a.state="resolve";let i;try{i=await t}catch(c){a.status=0,a.isAborted=((n=(o=a.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,a.error=c,e.notify(a);return}a.response=i,a.status=i.status,a.responseType=i.type,a.isAborted=!1;const s=oE.reduce((c,l)=>Math.max(c,l(a)),0);if(s!==0){const c=HM(i);if(c&&c.body)try{const l=await Z4(c.body,{collectStreamBody:s===2});a.responseBody=l&&new TextDecoder().decode(l)}catch{}}e.notify(a)}function iE(e,t){if(window.requestIdleCallback&&window.cancelIdleCallback){const r=window.requestIdleCallback(ie(e),t);return()=>window.cancelIdleCallback(r)}return W4(e)}const H4=50;function W4(e){const t=pt(),r=Xe(()=>{e({didTimeout:!1,timeRemaining:()=>Math.max(0,H4-(pt()-t))})},0);return()=>kt(r)}const J4=et,K4=30;function Y4(){const e=[];function t(o){let n;if(o.didTimeout){const a=performance.now();n=()=>K4-(performance.now()-a)}else n=o.timeRemaining.bind(o);for(;n()>0&&e.length;)e.shift()();e.length&&r()}function r(){iE(t,{timeout:J4})}return{push(o){e.push(o)===1&&r()},stop(){e.length=0}}}let Gl={};function X4(e){const t=e.map(r=>(Gl[r]||(Gl[r]=Q4(r)),Gl[r]));return sk(...t)}function Q4(e){return new be(t=>{const r=hr[e];return hr[e]=(...o)=>{r.apply(console,o);const n=Is("console error");Mr(()=>{t.notify(eD(o,e,n))})},()=>{hr[e]=r}})}function eD(e,t,r){const o=e.map(n=>tD(n)).join(" ");if(t===Bc.error){const n=e.find(Tn),a=Pf({originalError:n,handlingStack:r,startClocks:qe(),source:Eo.CONSOLE,handling:"handled",nonErrorPrefix:"Provided",useFallbackStack:!1});return a.message=o,{api:t,message:o,handlingStack:r,error:a}}return{api:t,message:o,error:void 0,handlingStack:r}}function tD(e){return typeof e=="string"?Ae(e):Tn(e)?Rk(si(e)):ko(Ae(e),void 0,2)}const rD=500;function nD(){const e=[];return{add:n=>{e.push(n)>rD&&e.splice(0,1)},remove:n=>{Xk(e,n)},drain:n=>{e.forEach(a=>a(n)),e.length=0}}}function oD(e){const t=En(e)==="object";return t||re.error("Unsupported context:",e),t}function Hl(e,t,r){const o={...e};for(const[n,{required:a,type:i}]of Object.entries(t))i==="string"&&!ag(o[n])&&(o[n]=String(o[n])),a&&ag(o[n])&&re.warn(`The property ${n} of ${r} is required; context will not be sent to the intake.`);return o}function ag(e){return e==null||e===""}function el(e="",{propertiesConfig:t={}}={}){let r={};const o=new be,n={getContext:()=>Df(r),setContext:a=>{oD(a)?r=Ae(Hl(a,t,e)):n.clearContext(),o.notify()},setContextProperty:(a,i)=>{r=Ae(Hl({...r,[a]:i},t,e)),o.notify()},removeContextProperty:a=>{delete r[a],Hl(r,t,e),o.notify()},clearContext:()=>{r={},o.notify()},changeObservable:o};return n}function st(e,t,r,o){return ie((...n)=>(o&&Ge({feature:o}),e()[t][r](...n)))}const aD="_dd_c",iD=[];function Vf(e,t,r,o){const n=sD(r,o);iD.push(Ne(e,window,"storage",({key:l})=>{n===l&&i()})),t.changeObservable.subscribe(s);const a=xr(c(),t.getContext());Wr(a)||t.setContext(a);function i(){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 sD(e,t){return`${aD}_${e}_${t}`}function cD(e,t,r){const o=sE();return t.storeContextsAcrossPages&&Vf(t,o,r,4),e.register(0,()=>{const n=o.getContext();return Wr(n)||!n.id?Tt:{account:n}}),o}function sE(){return el("account",{propertiesConfig:{id:{type:"string",required:!0},name:{type:"string"}}})}function lD(e,t,r,o){const n=cE();return t.storeContextsAcrossPages&&Vf(t,n,r,2),e.register(0,()=>({context:n.getContext()})),n}function cE(){return el("global context")}function uD(e,t,r,o){const n=lE();return t.storeContextsAcrossPages&&Vf(t,n,o,1),e.register(0,({eventType:a,startTime:i})=>{const s=n.getContext(),c=r.findTrackedSession(i);return c&&c.anonymousId&&!s.anonymous_id&&t.trackAnonymousUser&&(s.anonymous_id=c.anonymousId),Wr(s)?Tt:{type:a,usr:s}}),e.register(1,({startTime:a})=>{var i;return{anonymous_id:(i=r.findTrackedSession(a))===null||i===void 0?void 0:i.anonymousId}}),n}function lE(){return el("user",{propertiesConfig:{id:{type:"string"},name:{type:"string"},email:{type:"string"}}})}const He={userContext:"userContext",globalContext:"globalContext",accountContext:"accountContext"},ct={getContext:"getContext",setContext:"setContext",setContextProperty:"setContextProperty",removeContextProperty:"removeContextProperty",clearContext:"clearContext"},dt={DOCUMENT:"document",XHR:"xhr",BEACON:"beacon",FETCH:"fetch",CSS:"css",JS:"js",IMAGE:"image",FONT:"font",MEDIA:"media",OTHER:"other"},tl={FETCH:dt.FETCH,XHR:dt.XHR},dD=500;function mD(e=AM){const t=new ck(dD),r=e().subscribe(o=>{t.notify({type:0,error:o})});return{observable:t,stop:()=>{r.unsubscribe()}}}function fD(){try{return new Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}const ne={ACTION:"action",ERROR:"error",LONG_TASK:"long_task",VIEW:"view",RESOURCE:"resource",VITAL:"vital"},uE={LONG_TASK:"long-task",LONG_ANIMATION_FRAME:"long-animation-frame"},gr={INITIAL_LOAD:"initial_load",ROUTE_CHANGE:"route_change",BF_CACHE:"bf_cache"},rl={CLICK:"click",CUSTOM:"custom"},Fo={RAGE_CLICK:"rage_click",ERROR_CLICK:"error_click",DEAD_CLICK:"dead_click"},ha={DURATION:"duration",OPERATION_STEP:"operation_step"};function pD(){return{vitalsByName:new Map,vitalsByReference:new WeakMap}}function hD(e,t,r){function o(i){return!t.wasInPageStateDuringPeriod("frozen",i.startClocks.relative,i.duration)}function n(i){o(i)&&e.notify(12,ig(i))}function a(i,s,c,l){if(!ii(Vr.FEATURE_OPERATION_VITAL))return;const{operationKey:u,context:d,description:m}=c||{},f={name:i,type:ha.OPERATION_STEP,operationKey:u,failureReason:l,stepType:s,startClocks:qe(),context:Ae(d),description:m};e.notify(12,ig(f))}return{addOperationStepVital:a,addDurationVital:n,startDurationVital:(i,s={})=>dE(r,i,s),stopDurationVital:(i,s={})=>{mE(n,r,i,s)}}}function dE({vitalsByName:e,vitalsByReference:t},r,o={}){const n={name:r,startClocks:qe(),...o},a={__dd_vital_reference:!0};return e.set(r,n),t.set(a,n),a}function mE(e,{vitalsByName:t,vitalsByReference:r},o,n={}){const a=typeof o=="string"?t.get(o):r.get(o);a&&(e(gD(a,a.startClocks,n,qe())),typeof o=="string"?t.delete(o):r.delete(o))}function gD(e,t,r,o){var n;return{name:e.name,type:ha.DURATION,startClocks:t,duration:De(t.timeStamp,o.timeStamp),context:xr(e.context,r.context),description:(n=r.description)!==null&&n!==void 0?n:e.description}}function ig(e){const{startClocks:t,type:r,name:o,description:n,context:a}=e,i={id:at(),type:r,name:o,description:n,...r===ha.DURATION?{duration:se(e.duration)}:{step_type:e.stepType,operation_key:e.operationKey,failure_reason:e.failureReason}};return{rawRumEvent:{date:t.timeStamp,vital:i,type:ne.VITAL,context:a},startTime:t.relative,duration:r===ha.DURATION?e.duration:void 0,domainContext:{}}}function fE(e,t,r){if(e)for(const o of e){const n=o[t];n&&n(r)}}const sg=new Map;function pE(e,t){if(t===100)return!0;if(t===0)return!1;const r=sg.get(t);if(r&&e===r.sessionId)return r.decision;let o;return window.BigInt?o=vD(BigInt(`0x${e.split("-")[4]}`),t):o=an(t),sg.set(t,{sessionId:e,decision:o}),o}function vD(e,t){const r=BigInt("1111111111111111111"),o=BigInt("0x10000000000000000"),n=e*r%o;return Number(n)<=t/100*Number(o)}function yD(){return gE(64)}function hE(){return gE(63)}function gE(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],a="";do{const i=o%r*4294967296+n;o=Math.floor(o/r),n=Math.floor(i/r),a=(i%r).toString(r)+a}while(o||n);return a}}}function jn(e){return e.toString(16).padStart(16,"0")}function bD(e){const t=e;return En(t)==="object"&&fa(t.match)&&Array.isArray(t.propagatorTypes)}function _D(e){e.status===0&&!e.isAborted&&(e.traceId=void 0,e.spanId=void 0,e.traceSampled=void 0)}function wD(e,t,r,o){return{clearTracingIfNeeded:_D,traceFetch:n=>cg(e,n,t,r,o,a=>{var i;if(n.input instanceof Request&&!(!((i=n.init)===null||i===void 0)&&i.headers))n.input=new Request(n.input),Object.keys(a).forEach(s=>{n.input.headers.append(s,a[s])});else{n.init=da(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(Yc(a))}}),traceXhr:(n,a)=>cg(e,n,t,r,o,i=>{Object.keys(i).forEach(s=>{a.setRequestHeader(s,i[s])})})}}function cg(e,t,r,o,n,a){const i=r.findTrackedSession();if(!i)return;const s=e.allowedTracingUrls.find(u=>Qc([u.match],t.url,!0));if(!s)return;const c=pE(i.id,e.traceSampleRate);(c||e.traceContextInjection===Ju.ALL)&&(t.traceSampled=c,t.traceId=yD(),t.spanId=hE(),a(xD(t.traceId,t.spanId,t.traceSampled,i.id,s.propagatorTypes,o,n,e)))}function xD(e,t,r,o,n,a,i,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${jn(e)}-${jn(t)}-0${r?"1":"0"}`,tracestate:`dd=s:${r?"1":"0"};o:rum`});break}case"b3":{Object.assign(c,{b3:`${jn(e)}-${jn(t)}-${r?"1":"0"}`});break}case"b3multi":{Object.assign(c,{"X-B3-TraceId":jn(e),"X-B3-SpanId":jn(t),"X-B3-Sampled":r?"1":"0"});break}}}),s.propagateTraceBaggage){const l={"session.id":o},u=a.getContext().id;typeof u=="string"&&(l["user.id"]=u);const d=i.getContext().id;typeof d=="string"&&(l["account.id"]=d);const m=Object.entries(l).map(([f,g])=>`${f}=${encodeURIComponent(g)}`).join(",");m&&(c.baggage=m)}return c}const vE=["tracecontext","datadog"];function SD(e,t){var r,o,n,a,i,s,c;if(e.trackFeatureFlagsForEvents!==void 0&&!Array.isArray(e.trackFeatureFlagsForEvents)&&re.warn("trackFeatureFlagsForEvents should be an array"),!e.applicationId){re.error("Application ID is not configured, no RUM data will be collected.");return}if(!qn(e.sessionReplaySampleRate,"Session Replay")||!qn(e.traceSampleRate,"Trace"))return;if(e.excludedActivityUrls!==void 0&&!Array.isArray(e.excludedActivityUrls)){re.error("Excluded Activity Urls should be an array");return}const l=kD(e);if(!l)return;const u=eM(e,t),d=ID(e);if(!u)return;const m=(r=e.sessionReplaySampleRate)!==null&&r!==void 0?r:0;return{applicationId:e.applicationId,actionNameAttribute:e.actionNameAttribute,sessionReplaySampleRate:m,startSessionReplayRecordingManually:e.startSessionReplayRecordingManually!==void 0?!!e.startSessionReplayRecordingManually:m===0,traceSampleRate:(o=e.traceSampleRate)!==null&&o!==void 0?o:100,rulePsr:ti(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:!!(!((a=e.trackUserInteractions)!==null&&a!==void 0)||a),trackViewsManually:!!e.trackViewsManually,trackResources:!!(!((i=e.trackResources)!==null&&i!==void 0)||i),trackLongTasks:!!(!((s=e.trackLongTasks)!==null&&s!==void 0)||s),trackBfcacheViews:!!e.trackBfcacheViews,trackEarlyRequests:!!e.trackEarlyRequests,subdomain:e.subdomain,defaultPrivacyLevel:Es(Zn,e.defaultPrivacyLevel)?e.defaultPrivacyLevel:Zn.MASK,enablePrivacyForActionName:!!e.enablePrivacyForActionName,traceContextInjection:Es(Ju,e.traceContextInjection)?e.traceContextInjection:Ju.SAMPLED,plugins:e.plugins||[],trackFeatureFlagsForEvents:e.trackFeatureFlagsForEvents||[],profilingSampleRate:(c=e.profilingSampleRate)!==null&&c!==void 0?c:0,propagateTraceBaggage:!!e.propagateTraceBaggage,allowedGraphQlUrls:d,...u}}function kD(e){if(e.allowedTracingUrls===void 0)return[];if(!Array.isArray(e.allowedTracingUrls)){re.error("Allowed Tracing URLs should be an array");return}if(e.allowedTracingUrls.length!==0&&e.service===void 0){re.error("Service needs to be configured when tracing is enabled");return}const t=[];return e.allowedTracingUrls.forEach(r=>{fa(r)?t.push({match:r,propagatorTypes:vE}):bD(r)?t.push(r):re.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",r)}),t}function ED(e){const t=new Set;return un(e.allowedTracingUrls)&&e.allowedTracingUrls.forEach(r=>{fa(r)?vE.forEach(o=>t.add(o)):En(r)==="object"&&Array.isArray(r.propagatorTypes)&&r.propagatorTypes.forEach(o=>t.add(o))}),Array.from(t)}function ID(e){if(!e.allowedGraphQlUrls)return[];if(!Array.isArray(e.allowedGraphQlUrls))return re.warn("allowedGraphQlUrls should be an array"),[];const t=[];return e.allowedGraphQlUrls.forEach(r=>{fa(r)?t.push({match:r,trackPayload:!1,trackResponseErrors:!1}):r&&typeof r=="object"&&"match"in r&&fa(r.match)&&t.push({match:r.match,trackPayload:!!r.trackPayload,trackResponseErrors:!!r.trackResponseErrors})}),t}function TD(e){return un(e)&&e.some(t=>typeof t=="object"&&"trackPayload"in t?!!t.trackPayload:!1)}function $D(e){return un(e)&&e.some(t=>typeof t=="object"&&"trackResponseErrors"in t?!!t.trackResponseErrors:!1)}function OD(e){var t;const r=tM(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:un(e.allowedTracingUrls),use_allowed_graph_ql_urls:un(e.allowedGraphQlUrls),use_track_graph_ql_payload:TD(e.allowedGraphQlUrls),use_track_graph_ql_response_errors:$D(e.allowedGraphQlUrls),selected_tracing_propagators:ED(e),default_privacy_level:e.defaultPrivacyLevel,enable_privacy_for_action_name:e.enablePrivacyForActionName,use_excluded_activity_urls:un(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 CD(e){const t=[];let r=0,o;const n={quote:void 0,escapeSequence:void 0};let a="";for(const i of e){if(o=lg[r].find(s=>MD[s](i,n)),!o)return[];if(n.escapeSequence!==void 0&&o!==12){if(!UD(n.escapeSequence))return[];a+=FD(n.escapeSequence),n.escapeSequence=void 0}DD.includes(o)?a+=i:zD.includes(o)&&a!==""?(t.push(a),a=""):o===12?n.escapeSequence=n.escapeSequence?`${n.escapeSequence}${i}`:i:o===8?n.quote=i:o===9&&(n.quote=void 0),r=o}return lg[r].includes(1)?(a!==""&&t.push(a),t):[]}const AD=/[a-zA-Z_$]/,RD=/[a-zA-Z0-9_$]/,ND=/[0-9]/,PD=/[a-fA-F0-9]/,jD=`'"`,MD={0:()=>!1,1:()=>!1,2:e=>AD.test(e),3:e=>RD.test(e),4:e=>e===".",5:e=>e==="[",6:e=>e==="]",7:e=>ND.test(e),8:e=>jD.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?PD.test(e):!1},lg={0:[2,5],1:[],2:[3,4,5,1],3:[3,4,5,1],4:[2],5:[8,7],6:[4,5,1],7:[7,6],8:[11,9,10],9:[6],10:[11,9,10],11:[12],12:[12,11,9,10]},DD=[2,3,7,10],zD=[4,5,6];function UD(e){return`"'/\\bfnrt`.includes(e)||e.startsWith("u")&&e.length===5}const LD={'"':'"',"'":"'","/":"/","\\":"\\",b:"\b",f:"\f",n:`
39
- `,r:"\r",t:" "};function FD(e){return e.startsWith("u")?String.fromCharCode(parseInt(e.slice(1),16)):LD[e]}const VD="v1",ZD=["applicationId","service","env","version","sessionSampleRate","sessionReplaySampleRate","defaultPrivacyLevel","enablePrivacyForActionName","traceSampleRate","trackSessionAcrossSubdomains","allowedTracingUrls","allowedTrackingOrigins"];async function qD(e,t){let r;const o=GD(),n=await KD(e);return n.ok?(o.increment("fetch","success"),r=BD(e,n.value,t,o)):(o.increment("fetch","failure"),re.error(n.error)),li("remote configuration metrics",{metrics:o.get()}),r}function BD(e,t,r,o){const n={...e};return ZD.forEach(m=>{m in t&&(n[m]=a(t[m]))}),Object.keys(r).forEach(m=>{t[m]!==void 0&&i(r[m],t[m])}),n;function a(m){if(Array.isArray(m))return m.map(a);if(HD(m)){if(WD(m)){const f=m.rcSerializedType;switch(f){case"string":return m.value;case"regex":return yE(m.value);case"dynamic":return s(m);default:re.error(`Unsupported remote configuration: "rcSerializedType": "${f}"`);return}}return ak(m,a)}return m}function i(m,f){f.forEach(({key:g,value:h})=>{m.setContextProperty(g,a(h))})}function s(m){const f=m.strategy;let g;switch(f){case"cookie":g=c(m);break;case"dom":g=l(m);break;case"js":g=d(m);break;default:re.error(`Unsupported remote configuration: "strategy": "${f}"`);return}const h=m.extractor;return h!==void 0&&typeof g=="string"?JD(h,g):g}function c({name:m}){const f=Kc(m);return o.increment("cookie",f!==void 0?"success":"missing"),f}function l({selector:m,attribute:f}){let g;try{g=document.querySelector(m)}catch{re.error(`Invalid selector in the remote configuration: '${m}'`),o.increment("dom","failure");return}if(!g){o.increment("dom","missing");return}if(u(g,f)){re.error(`Forbidden element selected by the remote configuration: '${m}'`),o.increment("dom","failure");return}const h=f!==void 0?g.getAttribute(f):g.textContent;if(h===null){o.increment("dom","missing");return}return o.increment("dom","success"),h}function u(m,f){return m.getAttribute("type")==="password"&&f==="value"}function d({path:m}){let f=window;const g=CD(m);if(g.length===0){re.error(`Invalid JSON path in the remote configuration: '${m}'`),o.increment("js","failure");return}for(const h of g){if(!(h in f)){o.increment("js","missing");return}try{f=f[h]}catch(v){re.error(`Error accessing: '${m}'`,v),o.increment("js","failure");return}}return o.increment("js","success"),f}}function GD(){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 HD(e){return typeof e=="object"&&e!==null}function WD(e){return"rcSerializedType"in e}function yE(e){try{return new RegExp(e)}catch{re.error(`Invalid regex in the remote configuration: '${e}'`)}}function JD(e,t){const r=yE(e.value);if(r===void 0)return;const o=r.exec(t);if(o===null)return;const[n,a]=o;return a||n}async function KD(e){let t;try{t=await fetch(YD(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 YD(e){return e.remoteConfigurationProxy?e.remoteConfigurationProxy:`https://sdk-configuration.${Ok("rum",e)}/${VD}/${encodeURIComponent(e.remoteConfigurationId)}.json`}function XD({ignoreInitIfSyntheticsWillInjectRum:e=!0,startDeflateWorker:t},r,o,n){const a=nD(),i=cE();Wl(i,He.globalContext,a);const s=lE();Wl(s,He.userContext,a);const c=sE();Wl(c,He.accountContext,a);let l,u,d,m;const f=r.observable.subscribe(h),g={};function h(){if(!d||!m||!r.isGranted())return;f.unsubscribe();let y;if(m.trackViewsManually){if(!l)return;a.remove(l.callback),y=l.options}const S=n(m,u,y);a.drain(S)}function v(y,S){const k=pn();if(k&&(y=QD(y)),d=y,y4(OD(y)),m){Dk("DD_RUM",y);return}const T=SD(y,S);if(T){if(!k&&!T.sessionStoreStrategyType){re.warn("No storage available for session. We will not send any data.");return}T.compressIntakeRequests&&!k&&t&&(u=t(T,"Datadog RUM",xe),!u)||(m=T,aE().subscribe(xe),r.tryToInit(T.trackingConsent),h())}}const b=y=>{a.add(S=>S.addDurationVital(y))};return{init(y,S,k){if(!y){re.error("Missing configuration");return}rM(y.enableExperimentalFeatures),d=y,!(e&&Qk())&&(fE(y.plugins,"onInit",{initConfiguration:y,publicApi:S}),y.remoteConfigurationId?qD(y,{user:s,context:i}).then(T=>{T&&v(T,k)}).catch(br):v(y,k))},get initConfiguration(){return d},getInternalContext:xe,stopSession:xe,addTiming(y,S=We()){a.add(k=>k.addTiming(y,S))},startView(y,S=qe()){const k=T=>{T.startView(y,S)};a.add(k),l||(l={options:y,callback:k},h())},setViewName(y){a.add(S=>S.setViewName(y))},setViewContext(y){a.add(S=>S.setViewContext(y))},setViewContextProperty(y,S){a.add(k=>k.setViewContextProperty(y,S))},getViewContext:()=>g,globalContext:i,userContext:s,accountContext:c,addAction(y){a.add(S=>S.addAction(y))},addError(y){a.add(S=>S.addError(y))},addFeatureFlagEvaluation(y,S){a.add(k=>k.addFeatureFlagEvaluation(y,S))},startDurationVital(y,S){return dE(o,y,S)},stopDurationVital(y,S){mE(b,o,y,S)},addDurationVital:b,addOperationStepVital:(y,S,k,T)=>{a.add(A=>A.addOperationStepVital(Ae(y),S,Ae(k),Ae(T)))}}}function QD(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=Io())===null||r===void 0?void 0:r.getPrivacyLevel()}}function Wl(e,t,r){e.changeObservable.subscribe(()=>{const o=e.getContext();r.add(n=>n[t].setContext(o))})}function ez(e,t,r,o={}){const n=j2(),a=pD(),i=mD().observable;let s=XD(o,n,a,(d,m,f)=>{const g=m&&o.createDeflateEncoder?v=>o.createDeflateEncoder(d,m,v):P4,h=e(d,t,r,f,g,n,a,i,o.sdkName);return t.onRumStart(h.lifeCycle,d,h.session,h.viewHistory,m,h.telemetry),r.onRumStart(h.lifeCycle,h.hooks,d,h.session,h.viewHistory,g),s=tz(s,h),fE(d.plugins,"onRumStart",{strategy:s,addEvent:h.addEvent}),h});const c=()=>s,l=ie(d=>{const m=typeof d=="object"?d:{name:d};s.startView(m),Ge({feature:"start-view"})}),u=PM({init:d=>{const m=new Error().stack;Mr(()=>s.init(d,u,m))},setTrackingConsent:ie(d=>{n.update(d),Ge({feature:"set-tracking-consent",tracking_consent:d})}),setViewName:ie(d=>{s.setViewName(d),Ge({feature:"set-view-name"})}),setViewContext:ie(d=>{s.setViewContext(d),Ge({feature:"set-view-context"})}),setViewContextProperty:ie((d,m)=>{s.setViewContextProperty(d,m),Ge({feature:"set-view-context-property"})}),getViewContext:ie(()=>(Ge({feature:"set-view-context-property"}),s.getViewContext())),getInternalContext:ie(d=>s.getInternalContext(d)),getInitConfiguration:ie(()=>Df(s.initConfiguration)),addAction:(d,m)=>{const f=Is("action");Mr(()=>{s.addAction({name:Ae(d),context:Ae(m),startClocks:qe(),type:rl.CUSTOM,handlingStack:f}),Ge({feature:"add-action"})})},addError:(d,m)=>{const f=Is("error");Mr(()=>{s.addError({error:d,handlingStack:f,context:Ae(m),startClocks:qe()}),Ge({feature:"add-error"})})},addTiming:ie((d,m)=>{s.addTiming(Ae(d),m)}),setGlobalContext:st(c,He.globalContext,ct.setContext,"set-global-context"),getGlobalContext:st(c,He.globalContext,ct.getContext,"get-global-context"),setGlobalContextProperty:st(c,He.globalContext,ct.setContextProperty,"set-global-context-property"),removeGlobalContextProperty:st(c,He.globalContext,ct.removeContextProperty,"remove-global-context-property"),clearGlobalContext:st(c,He.globalContext,ct.clearContext,"clear-global-context"),setUser:st(c,He.userContext,ct.setContext,"set-user"),getUser:st(c,He.userContext,ct.getContext,"get-user"),setUserProperty:st(c,He.userContext,ct.setContextProperty,"set-user-property"),removeUserProperty:st(c,He.userContext,ct.removeContextProperty,"remove-user-property"),clearUser:st(c,He.userContext,ct.clearContext,"clear-user"),setAccount:st(c,He.accountContext,ct.setContext,"set-account"),getAccount:st(c,He.accountContext,ct.getContext,"get-account"),setAccountProperty:st(c,He.accountContext,ct.setContextProperty,"set-account-property"),removeAccountProperty:st(c,He.accountContext,ct.removeContextProperty,"remove-account-property"),clearAccount:st(c,He.accountContext,ct.clearContext,"clear-account"),startView:l,stopSession:ie(()=>{s.stopSession(),Ge({feature:"stop-session"})}),addFeatureFlagEvaluation:ie((d,m)=>{s.addFeatureFlagEvaluation(Ae(d),Ae(m)),Ge({feature:"add-feature-flag-evaluation"})}),getSessionReplayLink:ie(()=>t.getSessionReplayLink()),startSessionReplayRecording:ie(d=>{t.start(d),Ge({feature:"start-session-replay-recording",force:d&&d.force})}),stopSessionReplayRecording:ie(()=>t.stop()),addDurationVital:ie((d,m)=>{Ge({feature:"add-duration-vital"}),s.addDurationVital({name:Ae(d),type:ha.DURATION,startClocks:Jj(m.startTime),duration:m.duration,context:Ae(m&&m.context),description:Ae(m&&m.description)})}),startDurationVital:ie((d,m)=>(Ge({feature:"start-duration-vital"}),s.startDurationVital(Ae(d),{context:Ae(m&&m.context),description:Ae(m&&m.description)}))),stopDurationVital:ie((d,m)=>{Ge({feature:"stop-duration-vital"}),s.stopDurationVital(typeof d=="string"?Ae(d):d,{context:Ae(m&&m.context),description:Ae(m&&m.description)})}),startFeatureOperation:ie((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"start"}),s.addOperationStepVital(d,"start",m)}),succeedFeatureOperation:ie((d,m)=>{Ge({feature:"add-operation-step-vital",action_type:"succeed"}),s.addOperationStepVital(d,"end",m)}),failFeatureOperation:ie((d,m,f)=>{Ge({feature:"add-operation-step-vital",action_type:"fail"}),s.addOperationStepVital(d,"end",f,m)})});return u}function tz(e,t){return{init:r=>{Dk("DD_RUM",r)},initConfiguration:e.initConfiguration,...t}}function rz(){const e=bE();return new be(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 bE(){let e;const t=window;if(t.Zone&&(e=Fr(t,"MutationObserver"),t.MutationObserver&&e===t.MutationObserver)){const r=new t.MutationObserver(xe),o=Fr(r,"originalInstance");e=o&&o.constructor}return e||(e=t.MutationObserver),e}function nz(){const e=new be,{stop:t}=Wt(window,"open",()=>e.notify());return{observable:e,stop:t}}function oz(e,t,r,o,n){return{get:a=>{const i=r.findView(a),s=n.findUrl(a),c=t.findTrackedSession(a);if(c&&i&&s){const l=o.findActionId(a);return{application_id:e,session_id:c.id,user_action:l?{id:l}:void 0,view:{id:i.id,name:i.name,referrer:s.referrer,url:s.url}}}}}}const az=j4,iz=kn;function sz(e){const t=Oo({expireDelay:iz});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 _E="initial_document",cz=[[dt.DOCUMENT,e=>_E===e],[dt.XHR,e=>e==="xmlhttprequest"],[dt.FETCH,e=>e==="fetch"],[dt.BEACON,e=>e==="beacon"],[dt.CSS,(e,t)=>/\.css$/i.test(t)],[dt.JS,(e,t)=>/\.js$/i.test(t)],[dt.IMAGE,(e,t)=>["image","img","icon"].includes(e)||/\.(gif|jpg|jpeg|tiff|png|svg|ico)$/i.exec(t)!==null],[dt.FONT,(e,t)=>/\.(woff|eot|woff2|ttf)$/i.exec(t)!==null],[dt.MEDIA,(e,t)=>["audio","video"].includes(e)||/\.(mp3|mp4)$/i.exec(t)!==null]];function lz(e){const t=e.name;if(!o2(t))return dt.OTHER;const r=a2(t);for(const[o,n]of cz)if(n(e.initiatorType,r))return o;return dt.OTHER}function ug(...e){for(let t=1;t<e.length;t+=1)if(e[t-1]>e[t])return!1;return!0}function wE(e){return e.initiatorType==="xmlhttprequest"||e.initiatorType==="fetch"}function uz(e){const{duration:t,startTime:r,responseEnd:o}=e;return t===0&&r<o?De(r,o):t}function dz(e){if(!SE(e))return;const{startTime:t,fetchStart:r,workerStart:o,redirectStart:n,redirectEnd:a,domainLookupStart:i,domainLookupEnd:s,connectStart:c,secureConnectionStart:l,connectEnd:u,requestStart:d,responseStart:m,responseEnd:f}=e,g={download:Xr(t,m,f),first_byte:Xr(t,d,m)};return 0<o&&o<r&&(g.worker=Xr(t,o,r)),r<u&&(g.connect=Xr(t,c,u),c<=l&&l<=u&&(g.ssl=Xr(t,l,u))),r<s&&(g.dns=Xr(t,i,s)),t<a&&(g.redirect=Xr(t,n,a)),g}function xE(e){return e.duration>=0}function SE(e){const t=ug(e.startTime,e.fetchStart,e.domainLookupStart,e.domainLookupEnd,e.connectStart,e.connectEnd,e.requestStart,e.responseStart,e.responseEnd),r=mz(e)?ug(e.startTime,e.redirectStart,e.redirectEnd,e.fetchStart):!0;return t&&r}function mz(e){return e.redirectEnd>e.startTime}function Xr(e,t,r){if(e<=t&&t<=r)return{duration:se(De(t,r)),start:se(De(e,t))}}function fz(e){return e.nextHopProtocol===""?void 0:e.nextHopProtocol}function pz(e){return e.deliveryType===""?"other":e.deliveryType}function hz(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 Zf(e){return e&&(!X2(e)||ii(Vr.TRACK_INTAKE_REQUESTS))}const gz=/data:(.+)?(;base64)?,/g,vz=24e3;function kE(e,t=vz){if(e.length<=t||!e.startsWith("data:"))return e;const r=e.substring(0,100).match(gz);return r?`${r[0]}[...]`:e}const yz=32*In;function bz(e,t){const r=wz(e.requestBody,t.trackPayload);if(r){if(t.trackResponseErrors&&e.responseBody){const o=_z(e.responseBody);o&&(r.errors_count=o.length,r.errors=o)}return r}}function _z(e){let t;try{t=JSON.parse(e)}catch{return}if(!t||typeof t!="object")return;const r=t;return un(r.errors)?r.errors.map(n=>{var a;return{message:n.message,path:n.path,locations:n.locations,code:(a=n.extensions)===null||a===void 0?void 0:a.code}}):void 0}function EE(e,t){return t.allowedGraphQlUrls.find(r=>Qc([r.match],e))}function wz(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=xz(o),a=r.operationName;if(!n)return;let i;return r.variables&&(i=JSON.stringify(r.variables)),{operationType:n,operationName:a,variables:i,payload:t?Cf(o,yz,"..."):void 0}}function xz(e){var t;return(t=e.match(/^\s*(query|mutation|subscription)\b/i))===null||t===void 0?void 0:t[1]}let dg=1;function Sz(e,t,r,o,n){const a=wD(t,r,o,n);kz(e,t,a),Ez(e,t,a)}function kz(e,t,r){const o=z4(t).subscribe(n=>{const a=n;if(Zf(a.url))switch(a.state){case"start":r.traceXhr(a,a.xhr),a.requestIndex=IE(),e.notify(7,{requestIndex:a.requestIndex,url:a.url});break;case"complete":r.clearTracingIfNeeded(a),e.notify(8,{duration:a.duration,method:a.method,requestIndex:a.requestIndex,spanId:a.spanId,startClocks:a.startClocks,status:a.status,traceId:a.traceId,traceSampled:a.traceSampled,type:tl.XHR,url:a.url,xhr:a.xhr,isAborted:a.isAborted,handlingStack:a.handlingStack,requestBody:a.requestBody,responseBody:a.responseBody});break}});return{stop:()=>o.unsubscribe()}}function Ez(e,t,r){const o=aE({responseBodyAction:n=>{var a;return!((a=EE(n.url,t))===null||a===void 0)&&a.trackResponseErrors?2:1}}).subscribe(n=>{var a;const i=n;if(Zf(i.url))switch(i.state){case"start":r.traceFetch(i),i.requestIndex=IE(),e.notify(7,{requestIndex:i.requestIndex,url:i.url});break;case"resolve":r.clearTracingIfNeeded(i),e.notify(8,{duration:De(i.startClocks.timeStamp,We()),method:i.method,requestIndex:i.requestIndex,responseType:i.responseType,spanId:i.spanId,startClocks:i.startClocks,status:i.status,traceId:i.traceId,traceSampled:i.traceSampled,type:tl.FETCH,url:i.url,response:i.response,init:i.init,input:i.input,isAborted:i.isAborted,handlingStack:i.handlingStack,requestBody:(a=i.init)===null||a===void 0?void 0:a.body,responseBody:i.responseBody});break}});return{stop:()=>o.unsubscribe()}}function IE(){const e=dg;return dg+=1,e}function TE(e){return ti(e)&&e<0?void 0:e}function $E({lifeCycle:e,isChildEvent:t,onChange:r=xe}){const o={errorCount:0,longTaskCount:0,resourceCount:0,actionCount:0,frustrationCount:0},n=e.subscribe(13,a=>{var i;if(!(a.type==="view"||a.type==="vital"||!t(a)))switch(a.type){case ne.ERROR:o.errorCount+=1,r();break;case ne.ACTION:o.actionCount+=1,a.action.frustration&&(o.frustrationCount+=a.action.frustration.type.length),r();break;case ne.LONG_TASK:o.longTaskCount+=1,r();break;case ne.RESOURCE:!((i=a._dd)===null||i===void 0)&&i.discarded||(o.resourceCount+=1,r());break}});return{stop:()=>{n.unsubscribe()},eventCounts:o}}function Iz(e,t){const r=pt();let o=!1;const{stop:n}=wr(e,window,["click","mousedown","keydown","touchstart","pointerdown"],s=>{if(!s.cancelable)return;const c={entryType:"first-input",processingStart:It(),processingEnd:It(),startTime:s.timeStamp,duration:0,name:"",cancelable:!1,target:null,toJSON:()=>({})};s.type==="pointerdown"?a(e,c):i(c)},{passive:!0,capture:!0});return{stop:n};function a(s,c){wr(s,window,["pointerup","pointercancel"],l=>{l.type==="pointerup"&&i(c)},{once:!0})}function i(s){if(!o){o=!0,n();const c=s.processingStart-s.startTime;c>=0&&c<pt()-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 ur(e,t){return new be(r=>{if(!window.PerformanceObserver)return;const o=c=>{const l=Oz(c);l.length>0&&r.notify(l)};let n,a=!0;const i=new PerformanceObserver(ie(c=>{a?n=Xe(()=>o(c.getEntries())):o(c.getEntries())}));try{i.observe(t)}catch{if([exports.RumPerformanceEntryType.RESOURCE,exports.RumPerformanceEntryType.NAVIGATION,exports.RumPerformanceEntryType.LONG_TASK,exports.RumPerformanceEntryType.PAINT].includes(t.type)){t.buffered&&(n=Xe(()=>o(performance.getEntriesByType(t.type))));try{i.observe({entryTypes:[t.type]})}catch{return}}}a=!1,Tz(e);let s;return!Jr(exports.RumPerformanceEntryType.FIRST_INPUT)&&t.type===exports.RumPerformanceEntryType.FIRST_INPUT&&({stop:s}=Iz(e,c=>{o([c])})),()=>{i.disconnect(),s&&s(),kt(n)}})}let Vo;function Tz(e){return!Vo&&$z()&&"addEventListener"in performance&&(Vo=Ne(e,performance,"resourcetimingbufferfull",()=>{performance.clearResourceTimings()})),()=>{Vo?.stop()}}function $z(){return window.performance!==void 0&&"getEntries"in performance}function Jr(e){return window.PerformanceObserver&&PerformanceObserver.supportedEntryTypes!==void 0&&PerformanceObserver.supportedEntryTypes.includes(e)}function Oz(e){return e.filter(t=>!Cz(t))}function Cz(e){return e.entryType===exports.RumPerformanceEntryType.RESOURCE&&(!Zf(e.name)||!xE(e))}function Xu(e){return e.nodeType===Node.TEXT_NODE}function Az(e){return e.nodeType===Node.COMMENT_NODE}function Sr(e){return e.nodeType===Node.ELEMENT_NODE}function qf(e){return Sr(e)&&!!e.shadowRoot}function OE(e){const t=e;return!!t.host&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&Sr(t.host)}function Rz(e){return e.childNodes.length>0||qf(e)}function Nz(e,t){let r=e.firstChild;for(;r;)t(r),r=r.nextSibling;qf(e)&&t(e.shadowRoot)}function CE(e){return OE(e)?e.host:e.parentNode}const AE=100,Pz=100,mg="data-dd-excluded-activity-mutations";function Bf(e,t,r,o,n,a){const i=Mz(e,t,r,o);return jz(i,n,a)}function jz(e,t,r){let o,n=!1;const a=Xe(ie(()=>l({hadActivity:!1})),AE),i=r!==void 0?Xe(ie(()=>l({hadActivity:!0,end:We()})),r):void 0,s=e.subscribe(({isBusy:u})=>{kt(a),kt(o);const d=We();u||(o=Xe(ie(()=>l({hadActivity:!0,end:d})),Pz))}),c=()=>{n=!0,kt(a),kt(o),kt(i),s.unsubscribe()};function l(u){n||(c(),t(u))}return{stop:c}}function Mz(e,t,r,o){return new be(n=>{const a=[];let i,s=0;return a.push(t.subscribe(l=>{l.every(Dz)||c()}),r.subscribe(c),ur(o,{type:exports.RumPerformanceEntryType.RESOURCE}).subscribe(l=>{l.some(u=>!Jl(o,u.name))&&c()}),e.subscribe(7,l=>{Jl(o,l.url)||(i===void 0&&(i=l.requestIndex),s+=1,c())}),e.subscribe(8,l=>{Jl(o,l.url)||i===void 0||l.requestIndex<i||(s-=1,c())})),()=>{a.forEach(l=>l.unsubscribe())};function c(){n.notify({isBusy:s>0})}})}function Jl(e,t){return Qc(e.excludedActivityUrls,t)}function Dz(e){const t=e.type==="characterData"?e.target.parentElement:e.target;return!!(t&&Sr(t)&&t.matches(`[${mg}], [${mg}] *`))}const nl="data-dd-action-name",RE="Masked Element",NE=[nl,"data-testid","data-test","data-qa","data-cy","data-test-id","data-qa-id","data-testing","data-component","data-element","data-source-file"],zz=[jE,Lz],Uz=[jE,Fz,Vz];function ui(e,t){if(!e.isConnected)return;let r,o=e;for(;o&&o.nodeName!=="HTML";){const n=fg(o,zz,qz,t,r);if(n)return n;r=fg(o,Uz,Bz,t,r)||ol(Zz(o),r),o=o.parentElement}return r}function PE(e){return/[0-9]/.test(e)}function Lz(e){if(e.id&&!PE(e.id))return`#${CSS.escape(e.id)}`}function Fz(e){if(e.tagName==="BODY")return;const t=e.classList;for(let r=0;r<t.length;r+=1){const o=t[r];if(!PE(o))return`${CSS.escape(e.tagName)}.${CSS.escape(o)}`}}function Vz(e){return CSS.escape(e.tagName)}function jE(e,t){if(t){const o=r(t);if(o)return o}for(const o of NE){const n=r(o);if(n)return n}function r(o){if(e.hasAttribute(o))return`${CSS.escape(e.tagName)}[${o}="${CSS.escape(e.getAttribute(o))}"]`}}function Zz(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 fg(e,t,r,o,n){for(const a of t){const i=a(e,o);if(i&&r(e,i,n))return ol(i,n)}}function qz(e,t,r){return e.ownerDocument.querySelectorAll(ol(t,r)).length===1}function Bz(e,t,r){let o;if(r===void 0)o=i=>i.matches(t);else{const i=ol(`${t}:scope`,r);o=s=>s.querySelector(i)!==null}let a=e.parentElement.firstElementChild;for(;a;){if(a!==e&&o(a))return!1;a=a.nextElementSibling}return!0}function ol(e,t){return t?`${e}>${t}`:e}const de={IGNORE:"ignore",HIDDEN:"hidden",ALLOW:Zn.ALLOW,MASK:Zn.MASK,MASK_USER_INPUT:Zn.MASK_USER_INPUT,MASK_UNLESS_ALLOWLISTED:Zn.MASK_UNLESS_ALLOWLISTED},Gf="data-dd-privacy",Gz="hidden",Hz="dd-privacy-",Ki="***",Wz="data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==",Jz={INPUT:!0,OUTPUT:!0,TEXTAREA:!0,SELECT:!0,OPTION:!0,DATALIST:!0,OPTGROUP:!0},Kz="x";function rn(e){return`[${Gf}="${e}"], .${Hz}${e}`}function di(e,t,r){if(r&&r.has(e))return r.get(e);const o=CE(e),n=o?di(o,t,r):t,a=DE(e),i=ME(a,n);return r&&r.set(e,i),i}function ME(e,t){switch(t){case de.HIDDEN:case de.IGNORE:return t}switch(e){case de.ALLOW:case de.MASK:case de.MASK_USER_INPUT:case de.MASK_UNLESS_ALLOWLISTED:case de.HIDDEN:case de.IGNORE:return e;default:return t}}function DE(e){if(Sr(e)){if(e.tagName==="BASE")return de.ALLOW;if(e.tagName==="INPUT"){const t=e;if(t.type==="password"||t.type==="email"||t.type==="tel"||t.type==="hidden")return de.MASK;const r=t.getAttribute("autocomplete");if(r&&(r.startsWith("cc-")||r.endsWith("-password")))return de.MASK}if(e.matches(rn(de.HIDDEN)))return de.HIDDEN;if(e.matches(rn(de.MASK)))return de.MASK;if(e.matches(rn(de.MASK_UNLESS_ALLOWLISTED)))return de.MASK_UNLESS_ALLOWLISTED;if(e.matches(rn(de.MASK_USER_INPUT)))return de.MASK_USER_INPUT;if(e.matches(rn(de.ALLOW)))return de.ALLOW;if(Xz(e))return de.IGNORE}}function Hf(e,t){switch(t){case de.MASK:case de.HIDDEN:case de.IGNORE:return!0;case de.MASK_UNLESS_ALLOWLISTED:return Xu(e)?Pi(e.parentNode)?!0:!LE(e.textContent||""):Pi(e);case de.MASK_USER_INPUT:return Xu(e)?Pi(e.parentNode):Pi(e);default:return!1}}function zE(e,t,r,o,n){if(o!==de.MASK&&o!==de.MASK_UNLESS_ALLOWLISTED||t===Gf||NE.includes(t)||t===n.actionNameAttribute)return!1;switch(t){case"title":case"alt":case"placeholder":return!0}return!!(e==="A"&&t==="href"||e==="IFRAME"&&t==="srcdoc"||r&&t.startsWith("data-")||(e==="IMG"||e==="SOURCE")&&(t==="src"||t==="srcset"))}function Pi(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!!Jz[t.tagName]}const UE=e=>e.replace(/\S/g,Kz);function Yz(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 i=t;if(o==="SCRIPT")n=Ki;else if(i===de.HIDDEN)n=Ki;else if(Hf(e,i))if(o==="DATALIST"||o==="SELECT"||o==="OPTGROUP"){if(!n.trim())return}else o==="OPTION"?n=Ki:i===de.MASK_UNLESS_ALLOWLISTED?n=FE(n):n=UE(n);return n}function Xz(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 LE(e){var t;return!e||!e.trim()?!0:((t=window.$DD_ALLOW)===null||t===void 0?void 0:t.has(e.toLocaleLowerCase()))||!1}function FE(e,t){return LE(e)?e:t||UE(e)}const VE=et,Qz=100;function eU(e,t){const r=[];let o=0,n;a(e);function a(c){c.stopObservable.subscribe(i),r.push(c),kt(n),n=Xe(s,VE)}function i(){o===1&&r.every(c=>c.isStopped())&&(o=2,t(r))}function s(){kt(n),o===0&&(o=1,i())}return{tryAppend:c=>o!==0?!1:r.length>0&&!tU(r[r.length-1].event,c.event)?(s(),!1):(a(c),!0),stop:()=>{s()}}}function tU(e,t){return e.target===t.target&&rU(e,t)<=Qz&&e.timeStamp-t.timeStamp<=VE}function rU(e,t){return Math.sqrt(Math.pow(e.clientX-t.clientX,2)+Math.pow(e.clientY-t.clientY,2))}function nU(e,t,r=de.ALLOW){const o=new Map,{actionNameAttribute:n}=t,a=pg(e,nl)||n&&pg(e,n);return a?{name:a,nameSource:"custom_attribute"}:r===de.MASK?{name:RE,nameSource:"mask_placeholder"}:hg(e,oU,t,o)||hg(e,aU,t,o)||{name:"",nameSource:"blank"}}function pg(e,t){const r=e.closest(`[${t}]`);if(!r)return;const o=r.getAttribute(t);return qE(ZE(o.trim()))}const oU=[(e,t,r)=>{if("labels"in e&&e.labels&&e.labels.length>0)return Yi(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 Yi(e,t,r)},(e,t,r)=>Zo(e,"aria-label",t,r),(e,t,r)=>{const o=e.getAttribute("aria-labelledby");if(o)return{name:o.split(/\s+/).map(n=>sU(e,n)).filter(n=>!!n).map(n=>BE(n,t,r)).join(" "),nameSource:"text_content"}},(e,t,r)=>Zo(e,"alt",t,r),(e,t,r)=>Zo(e,"name",t,r),(e,t,r)=>Zo(e,"title",t,r),(e,t,r)=>Zo(e,"placeholder",t,r),(e,t,r)=>{if("options"in e&&e.options.length>0)return Yi(e.options[0],t,r)}],aU=[(e,t,r)=>Yi(e,t,r)],iU=10;function hg(e,t,r,o){let n=e,a=0;for(;a<=iU&&n&&n.nodeName!=="BODY"&&n.nodeName!=="HTML"&&n.nodeName!=="HEAD";){for(const i of t){const s=i(n,r,o);if(s){const{name:c,nameSource:l}=s,u=c&&c.trim();if(u)return{name:qE(ZE(u)),nameSource:l}}}if(n.nodeName==="FORM")break;n=n.parentElement,a+=1}}function ZE(e){return e.replace(/\s+/g," ")}function qE(e){return e.length>100?`${Cf(e,100)} [...]`:e}function sU(e,t){return e.ownerDocument?e.ownerDocument.getElementById(t):null}function Zo(e,t,r,o){const{enablePrivacyForActionName:n,defaultPrivacyLevel:a}=r;let i=e.getAttribute(t);if(i&&n){const s=di(e,a,o);zE(e.tagName,t,i,s,r)&&(i=FE(i,RE))}else i||(i="");return{name:i,nameSource:"standard_attribute"}}function Yi(e,t,r){return{name:BE(e,t,r)||"",nameSource:"text_content"}}function BE(e,t,r){if(e.isContentEditable)return;const{enablePrivacyForActionName:o,actionNameAttribute:n,defaultPrivacyLevel:a}=t;if(ii(Vr.USE_TREE_WALKER_FOR_ACTION_NAME))return cU(e,n,o,a,r);if("innerText"in e){let i=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 m=d.innerText;m&&m.trim().length>0&&(i=i.replace(m,""))}}};return s(`[${nl}]`),n&&s(`[${n}]`),o&&s(`${rn(de.HIDDEN)}, ${rn(de.MASK)}`),i}return e.textContent}function cU(e,t,r,o,n){const a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,s);let i="";for(;a.nextNode();){const c=a.currentNode;if(Sr(c)){(c.nodeName==="BR"||c.nodeName==="P"||["block","flex","grid","list-item","table","table-caption"].includes(getComputedStyle(c).display))&&(i+=" ");continue}i+=c.textContent||""}return i.replace(/\s+/g," ").trim();function s(c){const l=di(c,o,n);if(r&&l&&Hf(c,l))return NodeFilter.FILTER_REJECT;if(Sr(c)){if(c.hasAttribute(nl)||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 lU(e,{onPointerDown:t,onPointerUp:r}){let o,n={selection:!1,input:!1,scroll:!1},a;const i=[Ne(e,window,"pointerdown",s=>{vg(s)&&(o=gg(),n={selection:!1,input:!1,scroll:!1},a=t(s))},{capture:!0}),Ne(e,window,"selectionchange",()=>{(!o||!gg())&&(n.selection=!0)},{capture:!0}),Ne(e,window,"scroll",()=>{n.scroll=!0},{capture:!0,passive:!0}),Ne(e,window,"pointerup",s=>{if(vg(s)&&a){const c=n;r(a,s,()=>c),a=void 0}},{capture:!0}),Ne(e,window,"input",()=>{n.input=!0},{capture:!0})];return{stop:()=>{i.forEach(s=>s.stop())}}}function gg(){const e=window.getSelection();return!e||e.isCollapsed}function vg(e){return e.target instanceof Element&&e.isPrimary!==!1}const yg=3;function uU(e,t){if(dU(e))return t.addFrustration(Fo.RAGE_CLICK),e.some(bg)&&t.addFrustration(Fo.DEAD_CLICK),t.hasError&&t.addFrustration(Fo.ERROR_CLICK),{isRage:!0};const r=e.some(o=>o.getUserActivity().selection);return e.forEach(o=>{o.hasError&&o.addFrustration(Fo.ERROR_CLICK),bg(o)&&!r&&o.addFrustration(Fo.DEAD_CLICK)}),{isRage:!1}}function dU(e){if(e.some(t=>t.getUserActivity().selection||t.getUserActivity().scroll))return!1;for(let t=0;t<e.length-(yg-1);t+=1)if(e[t+yg-1].event.timeStamp-e[t].event.timeStamp<=et)return!0;return!1}const mU='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 bg(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(mU)}const GE=10*et,Qo=new Map;function fU(e){const t=Qo.get(e);return Qo.delete(e),t}function HE(e,t){Qo.set(e,t),Qo.forEach((r,o)=>{De(o,It())>GE&&Qo.delete(o)})}const pU=5*ht;function hU(e,t,r,o){const n=Oo({expireDelay:pU}),a=new be;let i;e.subscribe(10,()=>{n.reset()}),e.subscribe(5,u),e.subscribe(11,d=>{d.reason===Hn.UNLOADING&&u()});const{stop:s}=lU(o,{onPointerDown:d=>gU(o,e,t,d,r),onPointerUp:({clickActionBase:d,hadActivityOnPointerDown:m},f,g)=>{vU(o,e,t,r,n,a,l,d,f,g,m)}});return{stop:()=>{u(),a.notify(),s()},actionContexts:{findActionId:d=>n.findAll(d)}};function l(d){if(!i||!i.tryAppend(d)){const m=d.clone();i=eU(d,f=>{bU(f,m)})}}function u(){i&&i.stop()}}function gU(e,t,r,o,n){let a;if(e.enablePrivacyForActionName?a=di(o.target,e.defaultPrivacyLevel):a=de.ALLOW,a===de.HIDDEN)return;const i=yU(o,a,e);let s=!1;return Bf(t,r,n,e,c=>{s=c.hadActivity},AE),{clickActionBase:i,hadActivityOnPointerDown:()=>s}}function vU(e,t,r,o,n,a,i,s,c,l,u){var d;const m=WE(t,n,l,s,c);i(m);const f=(d=s?.target)===null||d===void 0?void 0:d.selector;f&&HE(c.timeStamp,f);const{stop:g}=Bf(t,r,o,e,b=>{b.hadActivity&&b.end<m.startClocks.timeStamp?m.discard():b.hadActivity?m.stop(b.end):u()?m.stop(m.startClocks.timeStamp):m.stop()},GE),h=t.subscribe(5,({endClocks:b})=>{m.stop(b.timeStamp)}),v=a.subscribe(()=>{m.stop()});m.stopObservable.subscribe(()=>{h.unsubscribe(),g(),v.unsubscribe()})}function yU(e,t,r){const o=e.target.getBoundingClientRect(),n=ui(e.target,r.actionNameAttribute);n&&HE(e.timeStamp,n);const{name:a,nameSource:i}=nU(e.target,r,t);return{type:rl.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:a,nameSource:i}}function WE(e,t,r,o,n){const a=at(),i=qe(),s=t.add(a,i.relative),c=$E({lifeCycle:e,isChildEvent:g=>g.action!==void 0&&(Array.isArray(g.action.id)?g.action.id.includes(a):g.action.id===a)});let l=0,u;const d=[],m=new be;function f(g){l===0&&(u=g,l=1,u?s.close(Of(u)):s.remove(),c.stop(),m.notify())}return{event:n,stop:f,stopObservable:m,get hasError(){return c.eventCounts.errorCount>0},get hasPageActivity(){return u!==void 0},getUserActivity:r,addFrustration:g=>{d.push(g)},startClocks:i,isStopped:()=>l===1||l===2,clone:()=>WE(e,t,r,o,n),validate:g=>{if(f(),l!==1)return;const{resourceCount:h,errorCount:v,longTaskCount:b}=c.eventCounts,w={duration:u&&De(i.timeStamp,u),startClocks:i,id:a,frustrationTypes:d,counts:{resourceCount:h,errorCount:v,longTaskCount:b},events:g??[n],event:n,...o};e.notify(0,w),l=2},discard:()=>{f(),l=2}}}function bU(e,t){const{isRage:r}=uU(e,t);r?(e.forEach(o=>o.discard()),t.stop(We()),t.validate(e.map(o=>o.event))):(t.discard(),e.forEach(o=>o.validate()))}function _U(e,t,r,o,n){const{unsubscribe:a}=e.subscribe(0,c=>{e.notify(12,_g(c))});t.register(0,({startTime:c,eventType:l})=>{if(l!==ne.ERROR&&l!==ne.RESOURCE&&l!==ne.LONG_TASK)return Tt;const u=i.findActionId(c);return u?{type:l,action:{id:u}}:Tt}),t.register(1,({startTime:c})=>({action:{id:i.findActionId(c)}}));let i={findActionId:xe},s=xe;return n.trackUserInteractions&&({actionContexts:i,stop:s}=hU(e,r,o,n)),{addAction:c=>{e.notify(12,_g(c))},actionContexts:i,stop:()=>{a(),s()}}}function _g(e){const t=Kl(e)?{action:{id:e.id,loading_time:TE(se(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=xr({action:{id:at(),target:{name:e.name},type:e.type},date:e.startClocks.timeStamp,type:ne.ACTION},t),o=Kl(e)?e.duration:void 0,n=Kl(e)?{events:e.events}:{handlingStack:e.handlingStack};return{rawRumEvent:r,duration:o,startTime:e.startClocks.relative,domainContext:n}}function Kl(e){return e.type!==rl.CUSTOM}function wU(e){const t=X4([Bc.error]).subscribe(r=>e.notify(r.error));return{stop:()=>{t.unsubscribe()}}}function xU(e,t){const r=MM(e,[pa.cspViolation,pa.intervention]).subscribe(o=>t.notify(o));return{stop:()=>{r.unsubscribe()}}}function SU(e,t,r){const o=new be;return r.subscribe(n=>{n.type===0&&o.notify(n.error)}),wU(o),xU(t,o),o.subscribe(n=>e.notify(14,{error:n})),kU(e)}function kU(e){return e.subscribe(14,({error:t})=>{e.notify(12,EU(t))}),{addError:({error:t,handlingStack:r,componentStack:o,startClocks:n,context:a})=>{const i=Pf({originalError:t,handlingStack:r,componentStack:o,startClocks:n,nonErrorPrefix:"Provided",source:Eo.CUSTOM,handling:"handled"});i.context=xr(i.context,a),e.notify(14,{error:i})}}}function EU(e){const t={date:e.startClocks.timeStamp,error:{id:at(),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:ne.ERROR,context:e.context},r={error:e.originalError,handlingStack:e.handlingStack};return{rawRumEvent:t,startTime:e.startClocks.relative,domainContext:r}}const wg=new WeakSet;function IU(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=>!wg.has(o)).filter(o=>xE(o)&&SE(o)).filter(o=>TU(o,e.startClocks.relative,JE({startTime:e.startClocks.relative,duration:e.duration})));if(r.length===1)return wg.add(r[0]),r[0].toJSON()}function JE(e){return So(e.startTime,e.duration)}function TU(e,t,r){return e.startTime>=t-1&&JE(e)<=So(r,1)}const $U=2*ht;function OU(e){const t=CU(e)||AU(e);if(!(!t||t.traceTime<=pt()-$U))return t.traceId}function CU(e){const t=e.querySelector("meta[name=dd-trace-id]"),r=e.querySelector("meta[name=dd-trace-time]");return KE(t&&t.content,r&&r.content)}function AU(e){const t=RU(e);if(t)return KE(ma(t,"trace-id"),ma(t,"trace-time"))}function KE(e,t){const r=t&&Number(t);if(!(!e||!r))return{traceId:e,traceTime:r}}function RU(e){for(let t=0;t<e.childNodes.length;t+=1){const r=xg(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=xg(r);if(o)return o;if(!Xu(r))break}}function xg(e){if(e&&Az(e)){const t=/^\s*DATADOG;(.*?)\s*$/.exec(e.data);if(t)return t[1]}}function YE(){if(Jr(exports.RumPerformanceEntryType.NAVIGATION)){const r=performance.getEntriesByType(exports.RumPerformanceEntryType.NAVIGATION)[0];if(r)return r}const e=NU(),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 NU(){const e={},t=performance.timing;for(const r in t)if(ti(t[r])){const o=r,n=t[o];e[o]=n===0?0:Of(n)}return e}function PU(e,t,r=YE){Lf(e,"interactive",()=>{const o=r(),n=Object.assign(o.toJSON(),{entryType:exports.RumPerformanceEntryType.RESOURCE,initiatorType:_E,duration:o.responseEnd,traceId:OU(document),toJSON:()=>({...n,toJSON:void 0})});t(n)})}const jU=1e3;function MU(e){const t=new Set,r=e.subscribe(8,o=>{t.add(o),t.size>jU&&($o("Too many requests"),t.delete(t.values().next().value))});return{getMatchingRequest(o){let n=1/0,a;for(const i of t){const s=o.startTime-i.startClocks.relative;0<=s&&s<n&&i.url===o.name&&(n=Math.abs(s),a=i)}return a&&t.delete(a),a},stop(){r.unsubscribe()}}}function DU(e,t,r,o=Y4(),n=PU){let a;const i=t.trackEarlyRequests;i?a=MU(e):e.subscribe(8,l=>{c(()=>zU(l,t,r))});const s=ur(t,{type:exports.RumPerformanceEntryType.RESOURCE,buffered:!0}).subscribe(l=>{for(const u of l)(i||!wE(u))&&c(()=>Sg(u,t,r,a))});n(t,l=>{c(()=>Sg(l,t,r,a))});function c(l){o.push(()=>{const u=l();u&&e.notify(12,u)})}return{stop:()=>{o.stop(),s.unsubscribe()}}}function zU(e,t,r){const o=IU(e);return XE(o,e,r,t)}function Sg(e,t,r,o){const n=wE(e)&&o?o.getMatchingRequest(e):void 0;return XE(e,n,r,t)}function XE(e,t,r,o){if(!e&&!t)return;const n=t?VU(t,o):ZU(e,o);if(!o.trackResources&&!n)return;const a=e?ri(e.startTime):t.startClocks,i=e?uz(e):qU(r,a,t.duration),s=t&&UU(t,o),c=xr({date:a.timeStamp,resource:{id:at(),duration:se(i),type:t?t.type===tl.XHR?dt.XHR:dt.FETCH:lz(e),method:t?t.method:void 0,status_code:t?t.status:BU(e.responseStatus),url:t?kE(t.url):e.name,protocol:e&&fz(e),delivery_type:e&&pz(e),graphql:s},type:ne.RESOURCE,_dd:{discarded:!o.trackResources}},n,e&&FU(e));return{startTime:a.relative,duration:i,rawRumEvent:c,domainContext:LU(e,t)}}function UU(e,t){const r=EE(e.url,t);if(r)return bz(e,r)}function LU(e,t){if(t){const r={performanceEntry:e,isAborted:t.isAborted,handlingStack:t.handlingStack};return t.type===tl.XHR?{xhr:t.xhr,...r}:{requestInput:t.input,requestInit:t.init,response:t.response,error:t.error,...r}}return{performanceEntry:e}}function FU(e){const{renderBlockingStatus:t}=e;return{resource:{render_blocking_status:t,...hz(e),...dz(e)}}}function VU(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 ZU(e,t){if(e.traceId)return{_dd:{trace_id:e.traceId,span_id:hE().toString(),rule_psr:t.rulePsr}}}function qU(e,t,r){return e.wasInPageStateDuringPeriod("frozen",t.relative,r)?void 0:r}function BU(e){return e===0?void 0:e}function GU(e,t,r){const{stop:o,eventCounts:n}=$E({lifeCycle:e,isChildEvent:a=>a.view.id===t,onChange:r});return{stop:o,eventCounts:n}}const HU=10*ht;function WU(e,t,r){return{stop:ur(e,{type:exports.RumPerformanceEntryType.PAINT,buffered:!0}).subscribe(n=>{const a=n.find(i=>i.name==="first-contentful-paint"&&i.startTime<t.timeStamp&&i.startTime<HU);a&&r(a.startTime)}).unsubscribe}}function JU(e,t){requestAnimationFrame(()=>{requestAnimationFrame(()=>{t(De(e,It()))})})}function KU(e,t,r){const o=ur(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(n=>{const a=n.find(i=>i.startTime<t.timeStamp);if(a){const i=De(a.startTime,a.processingStart);let s;a.target&&Sr(a.target)&&(s=ui(a.target,e.actionNameAttribute)),r({delay:i>=0?i:0,time:a.startTime,targetSelector:s})}});return{stop:()=>{o.unsubscribe()}}}function YU(e,t,r=YE){return e6(e,()=>{const o=r();QU(o)||t(XU(o))})}function XU(e){return{domComplete:e.domComplete,domContentLoaded:e.domContentLoadedEventEnd,domInteractive:e.domInteractive,loadEvent:e.loadEventEnd,firstByte:e.responseStart>=0&&e.responseStart<=It()?e.responseStart:void 0}}function QU(e){return e.loadEventEnd<=0}function e6(e,t){let r;const{stop:o}=Lf(e,"complete",()=>{r=Xe(()=>t())});return{stop:()=>{o(),kt(r)}}}const t6=10*ht;function r6(e,t,r,o){let n=1/0;const{stop:a}=wr(e,r,["pointerdown","keydown"],c=>{n=c.timeStamp},{capture:!0,once:!0});let i=0;const s=ur(e,{type:exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT,buffered:!0}).subscribe(c=>{const l=hk(c,u=>u.entryType===exports.RumPerformanceEntryType.LARGEST_CONTENTFUL_PAINT&&u.startTime<n&&u.startTime<t.timeStamp&&u.startTime<t6&&u.size>i);if(l){let u;l.element&&(u=ui(l.element,e.actionNameAttribute)),o({value:l.startTime,targetSelector:u,resourceUrl:n6(l)}),i=l.size}});return{stop:()=>{a(),s.unsubscribe()}}}function n6(e){return e.url===""?void 0:e.url}function QE(e,t,r=window){if(document.visibilityState==="hidden")return{timeStamp:0,stop:xe};if(Jr(exports.RumPerformanceEntryType.VISIBILITY_STATE)){const a=performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).filter(i=>i.name==="hidden").find(i=>i.startTime>=t.relative);if(a)return{timeStamp:a.startTime,stop:xe}}let o=1/0;const{stop:n}=wr(e,r,["pagehide","visibilitychange"],a=>{(a.type==="pagehide"||document.visibilityState==="hidden")&&(o=a.timeStamp,n())},{capture:!0});return{get timeStamp(){return o},stop:n}}function o6(e,t,r,o){const n={},{stop:a}=YU(e,d=>{r(d.loadEvent),n.navigationTimings=d,o()}),i=QE(e,t),{stop:s}=WU(e,i,d=>{n.firstContentfulPaint=d,o()}),{stop:c}=r6(e,i,window,d=>{n.largestContentfulPaint=d,o()}),{stop:l}=KU(e,i,d=>{n.firstInput=d,o()});function u(){a(),s(),c(),l(),i.stop()}return{stop:u,initialViewMetrics:n}}const Qu=(e,t)=>e*t,a6=(e,t)=>{const r=Math.max(e.left,t.left),o=Math.max(e.top,t.top),n=Math.min(e.right,t.right),a=Math.min(e.bottom,t.bottom);return r>=n||o>=a?0:Qu(n-r,a-o)},kg=e=>{const t=Qu(e.previousRect.width,e.previousRect.height),r=Qu(e.currentRect.width,e.currentRect.height),o=a6(e.previousRect,e.currentRect);return t+r-o};function i6(e,t,r){if(!d6())return{stop:xe};let o=0,n;r({value:0});const a=u6(),i=ur(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}=a.update(l);if(d){const m=s6(l.sources);n={target:m?.node?new WeakRef(m.node):void 0,time:De(t,l.startTime),previousRect:m?.previousRect,currentRect:m?.currentRect,devicePixelRatio:window.devicePixelRatio}}if(u>o){o=u;const m=(c=n?.target)===null||c===void 0?void 0:c.deref();r({value:Yo(o,4),targetSelector:m&&ui(m,e.actionNameAttribute),time:n?.time,previousRect:n?.previousRect?Eg(n.previousRect):void 0,currentRect:n?.currentRect?Eg(n.currentRect):void 0,devicePixelRatio:n?.devicePixelRatio})}}});return{stop:()=>{i.unsubscribe()}}}function s6(e){let t;for(const r of e)if(r.node&&Sr(r.node)){const o=kg(r);(!t||kg(t)<o)&&(t=r)}return t}function Eg({x:e,y:t,width:r,height:o}){return{x:e,y:t,width:r,height:o}}const c6=5*et,l6=et;function u6(){let e=0,t,r,o=0;return{update:n=>{const a=t===void 0||n.startTime-r>=l6||n.startTime-t>=c6;let i;return a?(t=r=n.startTime,o=e=n.value,i=!0):(e+=n.value,r=n.startTime,i=n.value>o,i&&(o=n.value)),{cumulatedValue:e,isMaxValue:i}}}}function d6(){return Jr(exports.RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}let Xi,eI=0,Yl=1/0,Xl=0;function m6(){"interactionCount"in performance||Xi||(Xi=new window.PerformanceObserver(ie(e=>{e.getEntries().forEach(t=>{const r=t;r.interactionId&&(Yl=Math.min(Yl,r.interactionId),Xl=Math.max(Xl,r.interactionId),eI=(Xl-Yl)/7+1)})})),Xi.observe({type:"event",buffered:!0,durationThreshold:0}))}const Ig=()=>Xi?eI:window.performance.interactionCount||0,Tg=10,f6=1*ht;function p6(e,t,r){if(!v6())return{getInteractionToNextPaint:()=>{},setViewEnd:xe,stop:xe};const{getViewInteractionCount:o,stopViewInteractionCount:n}=g6(r);let a=1/0;const i=h6(o);let s=-1,c,l;function u(f){for(const h of f)h.interactionId&&h.startTime>=t&&h.startTime<=a&&i.process(h);const g=i.estimateP98Interaction();g&&g.duration!==s&&(s=g.duration,l=De(t,g.startTime),c=fU(g.startTime),!c&&g.target&&Sr(g.target)&&(c=ui(g.target,e.actionNameAttribute)))}const d=ur(e,{type:exports.RumPerformanceEntryType.FIRST_INPUT,buffered:!0}).subscribe(u),m=ur(e,{type:exports.RumPerformanceEntryType.EVENT,durationThreshold:40,buffered:!0}).subscribe(u);return{getInteractionToNextPaint:()=>{if(s>=0)return{value:Math.min(s,f6),targetSelector:c,time:l};if(o())return{value:0}},setViewEnd:f=>{a=f,n()},stop:()=>{m.unsubscribe(),d.unsubscribe()}}}function h6(e){const t=[];function r(){t.sort((o,n)=>n.duration-o.duration).splice(Tg)}return{process(o){const n=t.findIndex(i=>o.interactionId===i.interactionId),a=t[t.length-1];n!==-1?o.duration>t[n].duration&&(t[n]=o,r()):(t.length<Tg||o.duration>a.duration)&&(t.push(o),r())},estimateP98Interaction(){const o=Math.min(t.length-1,Math.floor(e()/50));return t[o]}}}function g6(e){m6();const t=e===gr.INITIAL_LOAD?0:Ig();let r={stopped:!1};function o(){return Ig()-t}return{getViewInteractionCount:()=>r.stopped?r.interactionCount:o(),stopViewInteractionCount:()=>{r={stopped:!0,interactionCount:o()}}}}function v6(){return Jr(exports.RumPerformanceEntryType.EVENT)&&window.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype}function y6(e,t,r,o,n,a,i){let s=n===gr.INITIAL_LOAD,c=!0;const l=[],u=QE(o,a);function d(){if(!c&&!s&&l.length>0){const f=Math.max(...l);f<u.timeStamp-a.relative&&i(f)}}const{stop:m}=Bf(e,t,r,o,f=>{c&&(c=!1,f.hadActivity&&l.push(De(a.timeStamp,f.end)),d())});return{stop:()=>{m(),u.stop()},setLoadEvent:f=>{s&&(s=!1,l.push(f),d())}}}function b6(){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 tI(){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 Ql;function rI(e){return Ql||(Ql=_6(e)),Ql}function _6(e){return new be(t=>{const{throttled:r}=oi(()=>{t.notify(al())},200);return Ne(e,window,"resize",r,{capture:!0,passive:!0}).stop})}function al(){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 w6=et;function x6(e,t,r,o=k6(e)){let n=0,a=0,i=0;const s=o.subscribe(({scrollDepth:c,scrollTop:l,scrollHeight:u})=>{let d=!1;if(c>n&&(n=c,d=!0),u>a){a=u;const m=It();i=De(t.relative,m),d=!0}d&&r({maxDepth:Math.min(n,a),maxDepthScrollTop:l,maxScrollHeight:a,maxScrollHeightTime:i})});return{stop:()=>s.unsubscribe()}}function S6(){const e=tI(),{height:t}=al(),r=Math.round((document.scrollingElement||document.documentElement).scrollHeight),o=Math.round(t+e);return{scrollHeight:r,scrollDepth:o,scrollTop:e}}function k6(e,t=w6){return new be(r=>{function o(){r.notify(S6())}if(window.ResizeObserver){const n=oi(o,t,{leading:!1,trailing:!0}),a=document.scrollingElement||document.documentElement,i=new ResizeObserver(ie(n.throttled));a&&i.observe(a);const s=Ne(e,window,"scroll",n.throttled,{passive:!0});return()=>{n.cancel(),i.disconnect(),s.stop()}}})}function E6(e,t,r,o,n,a,i){const s={},{stop:c,setLoadEvent:l}=y6(e,t,r,o,a,i,h=>{s.loadingTime=h,n()}),{stop:u}=x6(o,i,h=>{s.scroll=h}),{stop:d}=i6(o,i.relative,h=>{s.cumulativeLayoutShift=h,n()}),{stop:m,getInteractionToNextPaint:f,setViewEnd:g}=p6(o,i.relative,a);return{stop:()=>{c(),d(),u()},stopINPTracking:m,setLoadEvent:l,setViewEnd:g,getCommonViewMetrics:()=>(s.interactionToNextPaint=f(),s)}}function I6(e,t){const{stop:r}=Ne(e,window,"pageshow",o=>{o.persisted&&t(o)},{capture:!0});return r}function T6(e,t,r){JU(e.relative,o=>{t.firstContentfulPaint=o,t.largestContentfulPaint={value:o},r()})}const $6=3e3,O6=5*ht,C6=5*ht;function A6(e,t,r,o,n,a,i,s){const c=new Set;let l=m(gr.INITIAL_LOAD,$f(),s),u;f();let d;i&&(d=g(a),n.trackBfcacheViews&&(u=I6(n,h=>{l.end();const v=ri(h.timeStamp);l=m(gr.BF_CACHE,v,void 0)})));function m(h,v,b){const w=R6(t,r,o,n,e,h,v,b);return c.add(w),w.stopObservable.subscribe(()=>{c.delete(w)}),w}function f(){t.subscribe(10,()=>{l=m(gr.ROUTE_CHANGE,void 0,{name:l.name,service:l.service,version:l.version,context:l.contextManager.getContext()})}),t.subscribe(9,()=>{l.end({sessionIsActive:!1})})}function g(h){return h.subscribe(({oldLocation:v,newLocation:b})=>{P6(v,b)&&(l.end(),l=m(gr.ROUTE_CHANGE))})}return{addTiming:(h,v=We())=>{l.addTiming(h,v)},startView:(h,v)=>{l.end({endClocks:v}),l=m(gr.ROUTE_CHANGE,v,h)},setViewContext:h=>{l.contextManager.setContext(h)},setViewContextProperty:(h,v)=>{l.contextManager.setContextProperty(h,v)},setViewName:h=>{l.setViewName(h)},getViewContext:()=>l.contextManager.getContext(),stop:()=>{d&&d.unsubscribe(),u&&u(),l.end(),c.forEach(h=>h.stop())}}}function R6(e,t,r,o,n,a,i=qe(),s){const c=at(),l=new be,u={};let d=0,m;const f=da(n),g=el();let h=!0,v=s?.name;const b=s?.service||o.service,w=s?.version||o.version,x=s?.context;x&&g.setContext(x);const y={id:c,name:v,startClocks:i,service:b,version:w,context:x};e.notify(1,y),e.notify(2,y);const{throttled:S,cancel:k}=oi(F,$6,{leading:!1}),{setLoadEvent:T,setViewEnd:A,stop:U,stopINPTracking:L,getCommonViewMetrics:W}=E6(e,t,r,o,ae,a,i),{stop:fe,initialViewMetrics:q}=a===gr.INITIAL_LOAD?o6(o,i,T,ae):{stop:xe,initialViewMetrics:{}};a===gr.BF_CACHE&&T6(i,q,ae);const{stop:z,eventCounts:ve}=GU(e,c,ae),ee=xo(F,O6),J=e.subscribe(11,_e=>{_e.reason===Hn.UNLOADING&&F()});F(),g.changeObservable.subscribe(ae);function B(){e.notify(3,{id:c,name:v,context:g.getContext(),startClocks:i,sessionIsActive:h})}function ae(){B(),S()}function F(){k(),B(),d+=1;const _e=m===void 0?We():m.timeStamp;e.notify(4,{customTimings:u,documentVersion:d,id:c,name:v,service:b,version:w,context:g.getContext(),loadingType:a,location:f,startClocks:i,commonViewMetrics:W(),initialViewMetrics:q,duration:De(i.timeStamp,_e),isActive:m===void 0,sessionIsActive:h,eventCounts:ve})}return{get name(){return v},service:b,version:w,contextManager:g,stopObservable:l,end(_e={}){var ue,Ie;m||(m=(ue=_e.endClocks)!==null&&ue!==void 0?ue:qe(),h=(Ie=_e.sessionIsActive)!==null&&Ie!==void 0?Ie:!0,e.notify(5,{endClocks:m}),e.notify(6,{endClocks:m}),Wc(ee),A(m.relative),U(),J.unsubscribe(),F(),Xe(()=>{this.stop()},C6))},stop(){fe(),z(),L(),l.notify()},addTiming(_e,ue){if(m)return;const Ie=Xj(ue)?ue:De(i.timeStamp,ue);u[N6(_e)]=Ie,ae()},setViewName(_e){v=_e,F()}}}function N6(e){const t=e.replace(/[^a-zA-Z0-9-_.@$]/g,"_");return t!==e&&re.warn(`Invalid timing name: ${e}, sanitized to: ${t}`),t}function P6(e,t){return e.pathname!==t.pathname||!j6(t.hash)&&$g(t.hash)!==$g(e.hash)}function j6(e){const t=e.substring(1);return t!==""&&!!document.getElementById(t)}function $g(e){const t=e.indexOf("?");return t<0?e:e.slice(0,t)}function M6(e,t,r,o,n,a,i,s,c,l){return e.subscribe(4,u=>e.notify(12,D6(u,r,s))),t.register(0,({startTime:u,eventType:d})=>{const m=c.findView(u);return m?{type:d,service:m.service,version:m.version,context:m.context,view:{id:m.id,name:m.name}}:Zr}),t.register(1,({startTime:u})=>{var d;return{view:{id:(d=c.findView(u))===null||d===void 0?void 0:d.id}}}),A6(o,e,n,a,r,i,!r.trackViewsManually,l)}function D6(e,t,r){var o,n,a,i,s,c,l,u,d,m,f,g,h,v,b,w,x,y;const S=r.getReplayStats(e.id),k=(n=(o=e.commonViewMetrics)===null||o===void 0?void 0:o.cumulativeLayoutShift)===null||n===void 0?void 0:n.devicePixelRatio,T={_dd:{document_version:e.documentVersion,replay_stats:S,cls:k?{device_pixel_ratio:k}:void 0,configuration:{start_session_replay_recording_manually:t.startSessionReplayRecordingManually}},date:e.startClocks.timeStamp,type:ne.VIEW,view:{action:{count:e.eventCounts.actionCount},frustration:{count:e.eventCounts.frustrationCount},cumulative_layout_shift:(a=e.commonViewMetrics.cumulativeLayoutShift)===null||a===void 0?void 0:a.value,cumulative_layout_shift_time:se((i=e.commonViewMetrics.cumulativeLayoutShift)===null||i===void 0?void 0:i.time),cumulative_layout_shift_target_selector:(s=e.commonViewMetrics.cumulativeLayoutShift)===null||s===void 0?void 0:s.targetSelector,first_byte:se((c=e.initialViewMetrics.navigationTimings)===null||c===void 0?void 0:c.firstByte),dom_complete:se((l=e.initialViewMetrics.navigationTimings)===null||l===void 0?void 0:l.domComplete),dom_content_loaded:se((u=e.initialViewMetrics.navigationTimings)===null||u===void 0?void 0:u.domContentLoaded),dom_interactive:se((d=e.initialViewMetrics.navigationTimings)===null||d===void 0?void 0:d.domInteractive),error:{count:e.eventCounts.errorCount},first_contentful_paint:se(e.initialViewMetrics.firstContentfulPaint),first_input_delay:se((m=e.initialViewMetrics.firstInput)===null||m===void 0?void 0:m.delay),first_input_time:se((f=e.initialViewMetrics.firstInput)===null||f===void 0?void 0:f.time),first_input_target_selector:(g=e.initialViewMetrics.firstInput)===null||g===void 0?void 0:g.targetSelector,interaction_to_next_paint:se((h=e.commonViewMetrics.interactionToNextPaint)===null||h===void 0?void 0:h.value),interaction_to_next_paint_time:se((v=e.commonViewMetrics.interactionToNextPaint)===null||v===void 0?void 0:v.time),interaction_to_next_paint_target_selector:(b=e.commonViewMetrics.interactionToNextPaint)===null||b===void 0?void 0:b.targetSelector,is_active:e.isActive,name:e.name,largest_contentful_paint:se((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:se((y=e.initialViewMetrics.navigationTimings)===null||y===void 0?void 0:y.loadEvent),loading_time:TE(se(e.commonViewMetrics.loadingTime)),loading_type:e.loadingType,long_task:{count:e.eventCounts.longTaskCount},performance:z6(e.commonViewMetrics,e.initialViewMetrics),resource:{count:e.eventCounts.resourceCount},time_spent:se(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:se(e.commonViewMetrics.scroll.maxScrollHeightTime)}}:void 0,privacy:{replay_level:t.defaultPrivacyLevel},device:{locale:navigator.language,locales:navigator.languages,time_zone:fD()}};return Wr(e.customTimings)||(T.view.custom_timings=ak(e.customTimings,se)),{rawRumEvent:T,startTime:e.startClocks.relative,duration:e.duration,domainContext:{location:e.location}}}function z6({cumulativeLayoutShift:e,interactionToNextPaint:t},{firstContentfulPaint:r,firstInput:o,largestContentfulPaint:n}){return{cls:e&&{score:e.value,timestamp:se(e.time),target_selector:e.targetSelector,previous_rect:e.previousRect,current_rect:e.currentRect},fcp:r&&{timestamp:se(r)},fid:o&&{duration:se(o.delay),timestamp:se(o.time),target_selector:o.targetSelector},inp:t&&{duration:se(t.value),timestamp:se(t.time),target_selector:t.targetSelector},lcp:n&&{timestamp:se(n.value),target_selector:n.targetSelector,resource_url:n.resourceUrl}}}const U6="rum";function L6(e,t,r){const o=$4(e,U6,n=>V6(e,n),r);return o.expireObservable.subscribe(()=>{t.notify(9)}),o.renewObservable.subscribe(()=>{t.notify(10)}),o.sessionStateUpdateObservable.subscribe(({previousState:n,newState:a})=>{if(!n.forcedReplay&&a.forcedReplay){const i=o.findSession();i&&(i.isReplayForced=!0)}}),{findTrackedSession:n=>{const a=o.findSession(n);if(!(!a||a.trackingType==="0"))return{id:a.id,sessionReplay:a.trackingType==="1"?1:a.isReplayForced?2:0,anonymousId:a.anonymousId}},expire:o.expire,expireObservable:o.expireObservable,setForcedReplay:()=>o.updateSessionState({forcedReplay:"1"})}}function F6(){const e={id:"00000000-aaaa-0000-aaaa-000000000000",sessionReplay:Wk("records")?1:0};return{findTrackedSession:()=>e,expire:xe,expireObservable:new be,setForcedReplay:xe}}function V6(e,t){return Z6(t)?t:an(e.sessionSampleRate)?an(e.sessionReplaySampleRate)?"1":"2":"0"}function Z6(e){return e==="0"||e==="1"||e==="2"}function q6(e,t,r,o,n,a){const i=[e.rumEndpointBuilder];e.replica&&i.push(e.replica.rumEndpointBuilder);const s=Kk({encoder:a(2),request:zf(i,r),flushController:Yk({pageMayExitObservable:o,sessionExpireObservable:n})});return t.subscribe(13,c=>{c.type===ne.VIEW?s.upsert(c,c.view.id):s.add(c)}),s}function B6(e){const t=Io();e.subscribe(13,r=>{t.send("rum",r)})}const G6=kn;function H6(e,t,r,o){const n=Oo({expireDelay:G6});let a;e.subscribe(1,({startClocks:c})=>{const l=o.href;n.add(s({url:l,referrer:a||document.referrer}),c.relative),a=l}),e.subscribe(6,({endClocks:c})=>{n.closeActive(c.relative)});const i=r.subscribe(({newLocation:c})=>{const l=n.find();if(l){const u=It();n.closeActive(u),n.add(s({url:c.href,referrer:l.referrer}),u)}});function s({url:c,referrer:l}){return{url:c,referrer:l}}return t.register(0,({startTime:c,eventType:l})=>{const u=n.find(c);return u?{type:l,view:{url:u.url,referrer:u.referrer}}:Zr}),{findUrl:c=>n.find(c),stop:()=>{i.unsubscribe(),n.stop()}}}function W6(e,t){let r=da(t);return new be(o=>{const{stop:n}=J6(e,i),{stop:a}=K6(e,i);function i(){if(r.href===t.href)return;const s=da(t);o.notify({newLocation:s,oldLocation:r}),r=s}return()=>{n(),a()}})}function J6(e,t){const{stop:r}=Wt(Og("pushState"),"pushState",({onPostCall:a})=>{a(t)}),{stop:o}=Wt(Og("replaceState"),"replaceState",({onPostCall:a})=>{a(t)}),{stop:n}=Ne(e,window,"popstate",t);return{stop:()=>{r(),o(),n()}}}function K6(e,t){return Ne(e,window,"hashchange",t)}function Og(e){return Object.prototype.hasOwnProperty.call(history,e)?history:History.prototype}const Y6=kn;function X6(e,t,r){const o=Oo({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:a})=>{if(!r.trackFeatureFlagsForEvents.concat([ne.VIEW,ne.ERROR]).includes(a))return Tt;const s=o.find(n);return!s||Wr(s)?Tt:{type:a,feature_flags:s}}),{addFeatureFlagEvaluation:(n,a)=>{const i=o.find();i&&(i[n]=a)}}}const Q6=10*et;let Wn,ji;function eL(e,t,r){e.metricsEnabled&&(nI(),ji=!1,t.subscribe(13,()=>{ji=!0}),r.subscribe(({bytesCount:o,messagesCount:n})=>{ji&&(ji=!1,Wn.batchCount+=1,Ag(Wn.batchBytesCount,o),Ag(Wn.batchMessagesCount,n))}),xo(tL,Q6))}function tL(){Wn.batchCount!==0&&(li("Customer data measures",Wn),nI())}function Cg(){return{min:1/0,max:0,sum:0}}function Ag(e,t){e.sum+=t,e.min=Math.min(e.min,t),e.max=Math.max(e.max,t)}function nI(){Wn={batchCount:0,batchBytesCount:Cg(),batchMessagesCount:Cg()}}const rL=4e3,nL=500,oL=kn;function aL(e,t,r=nL){const o=Oo({expireDelay:oL,maxEntries:rL});let n;Jr(exports.RumPerformanceEntryType.VISIBILITY_STATE)&&performance.getEntriesByType(exports.RumPerformanceEntryType.VISIBILITY_STATE).forEach(l=>{const u=l.name==="hidden"?"hidden":"active";i(u,l.startTime)}),i(oI(),It());const{stop:a}=wr(t,window,["pageshow","focus","blur","visibilitychange","resume","freeze","pagehide"],c=>{i(sL(c),c.timeStamp)},{capture:!0});function i(c,l=It()){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===ne.VIEW){const d=o.findAll(c,l);return{type:u,_dd:{page_states:iL(d,c,r)}}}return u===ne.ACTION||u===ne.ERROR?{type:u,view:{in_foreground:s("active",c,0)}}:Tt}),{wasInPageStateDuringPeriod:s,addPageState:i,stop:()=>{a(),o.stop()}}}function iL(e,t,r){if(e.length!==0)return e.slice(-r).reverse().map(({state:o,startTime:n})=>({state:o,start:se(De(t,n))}))}function sL(e){return e.type==="freeze"?"frozen":e.type==="pagehide"?e.persisted?"frozen":"terminated":oI()}function oI(){return document.visibilityState==="hidden"?"hidden":document.hasFocus()?"active":"passive"}function cL(e,t){let r;const o=requestAnimationFrame(ie(()=>{r=al()})),n=rI(t).subscribe(a=>{r=a}).unsubscribe;return e.register(0,({eventType:a})=>({type:a,display:r?{viewport:r}:void 0})),{stop:()=>{n(),o&&cancelAnimationFrame(o)}}}function lL(e,t){const r=window.cookieStore?uL(e):mL;return new be(o=>r(t,n=>o.notify(n)))}function uL(e){return(t,r)=>Ne(e,window.cookieStore,"change",n=>{const a=n.changed.find(i=>i.name===t)||n.deleted.find(i=>i.name===t);a&&r(a.value)}).stop}const dL=et;function mL(e,t){const r=ma(document.cookie,e),o=xo(()=>{const n=ma(document.cookie,e);n!==r&&t(n)},dL);return()=>{Wc(o)}}const Rg="datadog-ci-visibility-test-execution-id";function fL(e,t,r=lL(e,Rg)){var o;let n=Nr(Rg)||((o=window.Cypress)===null||o===void 0?void 0:o.env("traceId"));const a=r.subscribe(i=>{n=i});return t.register(0,({eventType:i})=>typeof n!="string"?Tt:{type:i,session:{type:"ci_test"},ci_test:{test_execution_id:n}}),{stop:()=>{a.unsubscribe()}}}function pL(e,t){const r=ur(t,{type:exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME,buffered:!0}).subscribe(o=>{for(const n of o){const a=ri(n.startTime),i={date:a.timeStamp,long_task:{id:at(),entry_type:uE.LONG_ANIMATION_FRAME,duration:se(n.duration),blocking_duration:se(n.blockingDuration),first_ui_event_timestamp:se(n.firstUIEventTimestamp),render_start:se(n.renderStart),style_and_layout_start:se(n.styleAndLayoutStart),start_time:se(n.startTime),scripts:n.scripts.map(s=>({duration:se(s.duration),pause_duration:se(s.pauseDuration),forced_style_and_layout_duration:se(s.forcedStyleAndLayoutDuration),start_time:se(s.startTime),execution_start:se(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:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:a.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop:()=>r.unsubscribe()}}function hL(e,t){const r=ur(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 a=ri(n.startTime),i={date:a.timeStamp,long_task:{id:at(),entry_type:uE.LONG_TASK,duration:se(n.duration)},type:ne.LONG_TASK,_dd:{discarded:!1}};e.notify(12,{rawRumEvent:i,startTime:a.relative,duration:n.duration,domainContext:{performanceEntry:n}})}});return{stop(){r.unsubscribe()}}}function gL(e){e.register(0,({eventType:t})=>{if(!rE())return Tt;const r=eE(),o=tE();return{type:t,session:{type:"synthetics"},synthetics:{test_id:r,result_id:o,injected:Qk()}}})}function vL(e,t,r){const o=Df(e),n=r(o);return Yc(t).forEach(([a,i])=>ed(e,o,a.split(/\.|(?=\[\])/),i)),n}function ed(e,t,r,o){const[n,...a]=r;if(n==="[]"){Array.isArray(e)&&Array.isArray(t)&&e.forEach((i,s)=>ed(i,t[s],a,o));return}if(!(!Ng(e)||!Ng(t))){if(a.length>0)return ed(e[n],t[n],a,o);yL(e,n,t[n],o)}}function yL(e,t,r,o){const n=En(r);n===o?e[t]=Ae(r):o==="object"&&(n==="undefined"||n==="null")&&(e[t]={})}function Ng(e){return En(e)==="object"}const Mn={"view.name":"string","view.url":"string","view.referrer":"string"},Dn={context:"object"},zn={service:"string",version:"string"};let aI;function bL(e,t,r,o,n){aI={[ne.VIEW]:{"view.performance.lcp.resource_url":"string",...Dn,...Mn,...zn},[ne.ERROR]:{"error.message":"string","error.stack":"string","error.resource.url":"string","error.fingerprint":"string",...Dn,...Mn,...zn},[ne.RESOURCE]:{"resource.url":"string","resource.graphql.variables":"string",...Dn,...Mn,...zn},[ne.ACTION]:{"action.target.name":"string",...Dn,...Mn,...zn},[ne.LONG_TASK]:{"long_task.scripts[].source_url":"string","long_task.scripts[].invoker":"string",...Dn,...Mn,...zn},[ne.VITAL]:{...Dn,...Mn,...zn}};const a={[ne.ERROR]:Zl(ne.ERROR,o,n),[ne.ACTION]:Zl(ne.ACTION,o,n),[ne.VITAL]:Zl(ne.VITAL,o,n)};t.subscribe(12,({startTime:i,duration:s,rawRumEvent:c,domainContext:l})=>{const u=r.triggerHook(0,{eventType:c.type,startTime:i,duration:s});if(u===Zr)return;const d=xr(u,c,{ddtags:jf(e).join(",")});_L(d,e.beforeSend,l,a)&&(Wr(d.context)&&delete d.context,t.notify(13,d))})}function _L(e,t,r,o){var n;if(t){const i=vL(e,aI[e.type],s=>t(s,r));if(i===!1&&e.type!==ne.VIEW)return!1;i===!1&&re.warn("Can't dismiss view events using beforeSend!")}return!((n=o[e.type])===null||n===void 0?void 0:n.isLimitReached())}function wL(e,t,r,o){e.register(0,({eventType:n,startTime:a})=>{const i=t.findTrackedSession(a),s=o.findView(a);if(!i||!s)return Zr;let c,l,u;return n===ne.VIEW?(c=r.getReplayStats(s.id)?!0:void 0,l=i.sessionReplay===1,u=s.sessionIsActive?void 0:!1):c=r.isRecording()?!0:void 0,{type:n,session:{id:i.id,type:"user",has_replay:c,sampled_for_replay:l,is_active:u}}}),e.register(1,({startTime:n})=>{const a=t.findTrackedSession(n);return a?{session:{id:a.id}}:Tt})}function xL(e){e.register(0,({eventType:t})=>({type:t,connectivity:Lk()}))}function SL(e,t,r){e.register(0,({eventType:o})=>{const n=t.source;return{type:o,_dd:{format_version:2,drift:dk(),configuration:{session_sample_rate:Yo(t.sessionSampleRate,3),session_replay_sample_rate:Yo(t.sessionReplaySampleRate,3),profiling_sample_rate:Yo(t.profilingSampleRate,3),beta_encode_cookie_options:t.betaEncodeCookieOptions},browser_sdk_version:pn()?"6.24.1":void 0,sdk_name:r},application:{id:t.applicationId},date:We(),source:n}}),e.register(1,()=>({application:{id:t.applicationId}}))}function kL(e,t){e.register(1,()=>t.isGranted()?Tt:Zr)}const EL=c4,IL=[ne.ACTION,ne.ERROR,ne.LONG_TASK,ne.RESOURCE,ne.VITAL];function TL(e){return{addEvent:(t,r,o,n)=>{IL.includes(r.type)&&e.notify(12,{startTime:t,rawRumEvent:r,domainContext:o,duration:n})}}}function $L(e,t){if(!t.metricsEnabled)return{stop:xe};const{unsubscribe:r}=e.subscribe(4,({initialViewMetrics:o})=>{!o.largestContentfulPaint||!o.navigationTimings||(li("Initial view metrics",{metrics:OL(o.largestContentfulPaint,o.navigationTimings)}),r())});return{stop:r}}function OL(e,t){return{lcp:{value:e.value},navigation:{domComplete:t.domComplete,domContentLoaded:t.domContentLoaded,domInteractive:t.domInteractive,firstByte:t.firstByte,loadEvent:t.loadEvent}}}function CL(e,t,r,o,n,a,i,s,c){const l=[],u=new az,d=EL();u.subscribe(13,ge=>Mf("rum",ge));const m=ge=>{u.notify(14,{error:ge}),$o("Error reported to customer",{"error.message":ge.message})},f=a4(e),g=f.subscribe(ge=>{u.notify(11,ge)});l.push(()=>g.unsubscribe());const h=f4("browser-rum-sdk",e,d,m,f,n);l.push(h.stop);const v=pn()?F6():L6(e,u,a);if(pn())B6(u);else{const ge=q6(e,u,m,f,v.expireObservable,n);l.push(()=>ge.stop()),eL(h,u,ge.flushController.flushObservable)}const b=rz(),w=W6(e,location),{observable:x,stop:y}=nz();l.push(y),SL(d,e,c);const S=aL(d,e),k=sz(u);l.push(()=>k.stop());const T=H6(u,d,w,location);l.push(()=>T.stop());const A=X6(u,d,e);wL(d,v,t,k),xL(d),kL(d,a);const U=lD(d,e,"rum"),L=uD(d,e,v,"rum"),W=cD(d,e,"rum"),{actionContexts:fe,addAction:q,addEvent:z,stop:ve}=AL(u,d,e,S,b,x,m);l.push(ve);const{addTiming:ee,startView:J,setViewName:B,setViewContext:ae,setViewContextProperty:F,getViewContext:_e,stop:ue}=M6(u,d,e,location,b,x,w,t,k,o);l.push(ue);const{stop:Ie}=$L(u,h);l.push(Ie);const{stop:P}=DU(u,e,S);if(l.push(P),e.trackLongTasks)if(Jr(exports.RumPerformanceEntryType.LONG_ANIMATION_FRAME)){const{stop:ge}=pL(u,e);l.push(ge)}else hL(u,e);const{addError:V}=SU(u,e,s);s.unbuffer(),Sz(u,e,v,L,W);const le=hD(u,S,i),we=oz(e.applicationId,v,k,fe,T);return l.push(()=>r.stop()),{addAction:q,addEvent:z,addError:V,addTiming:ee,addFeatureFlagEvaluation:A.addFeatureFlagEvaluation,startView:J,setViewContext:ae,setViewContextProperty:F,getViewContext:_e,setViewName:B,lifeCycle:u,viewHistory:k,session:v,stopSession:()=>v.expire(),getInternalContext:we.get,startDurationVital:le.startDurationVital,stopDurationVital:le.stopDurationVital,addDurationVital:le.addDurationVital,addOperationStepVital:le.addOperationStepVital,globalContext:U,userContext:L,accountContext:W,telemetry:h,stop:()=>{l.forEach(ge=>ge())},hooks:d}}function AL(e,t,r,o,n,a,i){const s=_U(e,t,n,a,r),c=TL(e),l=cL(t,r),u=fL(r,t);return gL(t),bL(r,e,t,i),{pageStateHistory:o,addAction:s.addAction,addEvent:c.addEvent,actionContexts:s.actionContexts,stop:()=>{s.stop(),u.stop(),l.stop(),o.stop()}}}function RL(e,{session:t,viewContext:r,errorType:o}){const n=t?t.id:"no-session-id",a=[];o!==void 0&&a.push(`error-type=${o}`),r&&(a.push(`seed=${r.id}`),a.push(`from=${r.startClocks.timeStamp}`));const i=NL(e),s=`/rum/replay/sessions/${n}`;return`${i}${s}?${a.join("&")}`}function NL(e){const t=e.site,r=e.subdomain||PL(e);return`https://${r?`${r}.`:""}${t}`}function PL(e){switch(e.site){case sn:case V2:return"app";case $k:return"dd";default:return}}const jL=1e3;let Pt;function ML(e){return il(e).segments_count}function DL(e){il(e).segments_count+=1}function zL(e){il(e).records_count+=1}function UL(e,t){il(e).segments_total_raw_size+=t}function LL(e){return Pt?.get(e)}function il(e){Pt||(Pt=new Map);let t;return Pt.has(e)?t=Pt.get(e):(t={records_count:0,segments_count:0,segments_total_raw_size:0},Pt.set(e,t),Pt.size>jL&&FL()),t}function FL(){if(!Pt)return;const e=Pt.keys().next().value;e&&Pt.delete(e)}function iI(e,t,r){let o=0,n=[],a,i=!0,s=0;const c=[],{stop:l}=Ne(e,t,"message",({data:m})=>{if(m.type!=="wrote"||m.streamId!==r)return;const f=c[0];f&&(f.id===m.id?(c.shift(),o+=m.additionalBytesCount,n.push(m.result),a=m.trailer,f.writeCallback?f.writeCallback(m.result.byteLength):f.finishCallback&&f.finishCallback()):f.id<m.id&&l())});function u(){const m=n.length===0?new Uint8Array(0):jk(n.concat(a)),f={rawBytesCount:o,output:m,outputBytesCount:m.byteLength,encoding:"deflate"};return o=0,n=[],f}function d(){i||(t.postMessage({action:"reset",streamId:r}),i=!0)}return{isAsync:!0,get isEmpty(){return i},write(m,f){t.postMessage({action:"write",id:s,data:m,streamId:r}),c.push({id:s,writeCallback:f,data:m}),i=!1,s+=1},finish(m){d(),c.length?(c.forEach(f=>{delete f.writeCallback}),c[c.length-1].finishCallback=()=>m(u())):m(u())},finishSync(){d();const m=c.map(f=>f.data).join("");return c.length=0,{...u(),pendingData:m}},estimateEncodedBytesCount(m){return m.length/8},stop(){l()}}}function Wf({configuredUrl:e,error:t,source:r,scriptType:o}){if(re.error(`${r} failed to start: an error occurred while initializing the ${o}:`,t),t instanceof Event||t instanceof Error&&VL(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.",re.error(`${n} See documentation at ${Gc}/integrations/content_security_policy_logs/#use-csp-with-real-user-monitoring-and-session-replay`)}else o==="worker"&&Uf(t)}function VL(e){return e.includes("Content Security Policy")||e.includes("requires 'TrustedScriptURL'")}const ZL=30*et;function sI(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 ze={status:0};function cI(e,t,r,o=sI){switch(ze.status===0&&qL(e,t,o),ze.status){case 1:return ze.initializationFailureCallbacks.push(r),ze.worker;case 3:return ze.worker}}function Pg(){return ze.status}function qL(e,t,r=sI){try{const o=r(e),{stop:n}=Ne(e,o,"error",s=>{eu(e,t,s)}),{stop:a}=Ne(e,o,"message",({data:s})=>{s.type==="errored"?eu(e,t,s.error,s.streamId):s.type==="initialized"&&GL(s.version)});o.postMessage({action:"init"}),Xe(()=>BL(t),ZL),ze={status:1,worker:o,stop:()=>{n(),a()},initializationFailureCallbacks:[]}}catch(o){eu(e,t,o)}}function BL(e){ze.status===1&&(re.error(`${e} failed to start: a timeout occurred while initializing the Worker`),ze.initializationFailureCallbacks.forEach(t=>t()),ze={status:2})}function GL(e){ze.status===1&&(ze={status:3,worker:ze.worker,stop:ze.stop,version:e})}function eu(e,t,r,o){ze.status===1||ze.status===0?(Wf({configuredUrl:e.workerUrl,error:r,source:t,scriptType:"worker"}),ze.status===1&&ze.initializationFailureCallbacks.forEach(n=>n()),ze={status:2}):Uf(r,{worker_version:ze.status===3&&ze.version,stream_id:o})}function lI(){return typeof Array.from=="function"&&typeof CSSSupportsRule=="function"&&typeof URL.createObjectURL=="function"&&"forEach"in NodeList.prototype}function HL(e,t,r,o){const n=t.findTrackedSession(),a=WL(n,o),i=r.findView();return RL(e,{viewContext:i,errorType:a,session:n})}function WL(e,t){if(!lI())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 JL(e,t){if(!e.metricsEnabled)return{stop:xe};let r,o,n;const{unsubscribe:a}=t.subscribe(i=>{switch(i.type){case"start":r={forced:i.forced,timestamp:We()},o=void 0,n=void 0;break;case"document-ready":r&&(o=De(r.timestamp,We()));break;case"recorder-settled":r&&(n=De(r.timestamp,We()));break;case"aborted":case"deflate-encoder-load-failed":case"recorder-load-failed":case"succeeded":a(),r&&li("Recorder init metrics",{metrics:KL(r.forced,n,De(r.timestamp,We()),i.type,o)});break}});return{stop:a}}function KL(e,t,r,o,n){return{forced:e,loadRecorderModuleDuration:t,recorderInitDuration:r,result:o,waitForDocReadyDuration:n}}function YL(e,t,r,o,n,a,i){let s=0,c;t.subscribe(9,()=>{(s===2||s===3)&&(m(),s=1)}),t.subscribe(10,()=>{s===1&&d()});const l=new be;JL(i,l);const u=async f=>{l.notify({type:"start",forced:f});const[g]=await Promise.all([jg(l,{type:"recorder-settled"},n()),jg(l,{type:"document-ready"},D4(e,"interactive"))]);if(s!==2){l.notify({type:"aborted"});return}if(!g){s=0,l.notify({type:"recorder-load-failed"});return}const h=a();if(!h){s=0,l.notify({type:"deflate-encoder-load-failed"});return}({stop:c}=g(t,e,r,o,h,i)),s=3,l.notify({type:"succeeded"})};function d(f){const g=r.findTrackedSession();if(XL(g,f)){s=1;return}if(QL(s))return;s=2;const h=e5(g,f)||!1;u(h).catch(br),h&&r.setForcedReplay()}function m(){s===3&&c?.(),s=0}return{start:d,stop:m,getSessionReplayLink(){return HL(e,r,o,s!==0)},isRecording:()=>s===3}}function XL(e,t){return!e||e.sessionReplay===0&&(!t||!t.force)}function QL(e){return e===2||e===3}function e5(e,t){return t&&t.force&&e.sessionReplay===0}async function jg(e,t,r){try{return await r}finally{e.notify(t)}}function t5(){let e=0;return{strategy:{start(){e=1},stop(){e=2},isRecording:()=>!1,getSessionReplayLink:xe},shouldStartImmediately(t){return e===1||e===0&&!t.startSessionReplayRecordingManually}}}function r5(e,t){if(pn()&&!Wk("records")||!lI())return{start:xe,stop:xe,getReplayStats:()=>{},onRumStart:xe,isRecording:()=>!1,getSessionReplayLink:()=>{}};let{strategy:r,shouldStartImmediately:o}=t5();return{start:a=>r.start(a),stop:()=>r.stop(),getSessionReplayLink:()=>r.getSessionReplayLink(),onRumStart:n,isRecording:()=>Pg()===3&&r.isRecording(),getReplayStats:a=>Pg()===3?LL(a):void 0};function n(a,i,s,c,l,u){let d;function m(){return d||(l??(l=cI(i,"Datadog Session Replay",()=>{r.stop()},t)),l&&(d=iI(i,l,1))),d}r=YL(i,a,s,c,e,m,u),o(i)&&r.start()}}async function n5(e=o5){try{return await e()}catch(t){Wf({error:t,source:"Recorder",scriptType:"module"})}}async function o5(){return(await Promise.resolve().then(()=>require("./startRecording-BiLmoqZa.cjs"))).startRecording}function a5(){return Rt().Profiler!==void 0}const i5=e=>{let t={status:"starting"};return e.register(0,({eventType:r})=>r!==ne.VIEW&&r!==ne.LONG_TASK?Tt:{type:r,_dd:{profiling:t}}),{get:()=>t,set:r=>{t=r}}};async function s5(e=c5){try{return await e()}catch(t){Wf({error:t,source:"Profiler",scriptType:"module"})}}async function c5(){return(await Promise.resolve().then(()=>require("./profiler-CuqENACf.cjs"))).createRumProfiler}function l5(){let e;function t(r,o,n,a,i,s){const c=a.findTrackedSession();if(!c||!pE(c.id,n.profilingSampleRate))return;const l=i5(o);if(!a5()){l.set({status:"error",error_reason:"not-supported-by-browser"});return}s5().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,a,l,s),e.start(i.findView())}).catch(br)}return{onRumStart:t,stop:()=>{e?.stop().catch(br)}}}const u5=r5(n5),d5=l5(),ea=ez(CL,u5,d5,{startDeflateWorker:cI,createDeflateEncoder:iI,sdkName:"rum"});jM(Rt(),"DD_RUM",ea);const Mi={applicationId:"0b0a19b9-099b-4812-b342-930518330975",clientToken:"puba92c09799d321f572535176e9fe08256",site:"datadoghq.com",service:"gram-elements"};let td=!1,rd=!0;function m5(e={}){if(e.enabled===!1){rd=!1;return}if(!td)try{ea.init({applicationId:Mi.applicationId,clientToken:Mi.clientToken,site:Mi.site,service:Mi.service,env:process.env.NODE_ENV||"production",sessionSampleRate:100,sessionReplaySampleRate:100,trackUserInteractions:!0,trackResources:!0,trackLongTasks:!0,defaultPrivacyLevel:"mask"}),e.projectSlug&&ea.setGlobalContextProperty("projectSlug",e.projectSlug),e.variant&&ea.setGlobalContextProperty("variant",e.variant),td=!0}catch(t){console.warn("[Elements] Failed to initialize Datadog RUM:",t),rd=!1}}function Os(e,t){if(!rd||!td)return;const r=e instanceof Error?e:new Error(String(e));try{ea.addError(r,{...t,timestamp:new Date().toISOString()})}catch(o){console.warn("[Elements] Failed to track error:",o)}}const sl=["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"],f5=e=>Object.fromEntries(Object.entries(e).map(([t,r])=>[t,{...r.description?{description:r.description}:void 0,parameters:r.parameters instanceof $h.ZodType?$h.toJSONSchema(r.parameters):r.parameters}])),p5=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>!t.disabled&&t.type!=="backend"));let Cs=null;function h5(e,t){const r=uI(t);Cs={helpers:e,requiresApproval:r}}function g5(){Cs=null}function uI(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 v5=(e,t)=>j.makeAssistantTool({...e,execute:async(r,o)=>{if(Cs?.requiresApproval(t)){const{helpers:n}=Cs,a=o.toolCallId??"";if(!n.isToolApproved(t)&&!await n.requestApproval(t,a,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 y5(e,t,r){if(!t||Array.isArray(t)&&t.length===0)return e;const o=uI(t);return Object.fromEntries(Object.entries(e).map(([n,a])=>{if(!o(n))return[n,a];const i=a.execute;return i?[n,{...a,execute:async(s,c)=>{const l=c??{},u=l.toolCallId??"";return r.isToolApproved(n)||await r.requestApproval(n,u,s)?i(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,a]}))}const b5=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_5=I.createLucideIcon("arrow-down",b5);const w5=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],x5=I.createLucideIcon("arrow-up",w5);const S5=[["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"}]],k5=I.createLucideIcon("brain",S5);const E5=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],zr=I.createLucideIcon("check",E5);const I5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],As=I.createLucideIcon("chevron-down",I5);const T5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],$5=I.createLucideIcon("chevron-left",T5);const O5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dI=I.createLucideIcon("chevron-right",O5);const C5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],A5=I.createLucideIcon("chevron-up",C5);const R5=[["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"}]],Jf=I.createLucideIcon("copy",R5);const N5=[["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"}]],P5=I.createLucideIcon("file-text",N5);const j5=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],M5=I.createLucideIcon("heart",j5);const D5=[["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"}]],z5=I.createLucideIcon("link",D5);const U5=[["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"}]],Rs=I.createLucideIcon("loader",U5);const L5=[["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"}]],F5=I.createLucideIcon("maximize",L5);const V5=[["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"}]],Z5=I.createLucideIcon("message-circle",V5);const q5=[["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"}]],B5=I.createLucideIcon("minimize",q5);const G5=[["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"}]],H5=I.createLucideIcon("panel-right-close",G5);const W5=[["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"}]],J5=I.createLucideIcon("panel-right-open",W5);const K5=[["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"}]],Y5=I.createLucideIcon("pencil",K5);const X5=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],mI=I.createLucideIcon("plus",X5);const Q5=[["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"}]],eF=I.createLucideIcon("settings-2",Q5);const tF=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],rF=I.createLucideIcon("square",tF);const nF=[["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"}]],Mg=I.createLucideIcon("wifi-off",nF);const oF=[["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"}]],fI=I.createLucideIcon("wrench",oF);const aF=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$n=I.createLucideIcon("x",aF);var iF=Object.defineProperty,sF=Object.defineProperties,cF=Object.getOwnPropertyDescriptors,Dg=Object.getOwnPropertySymbols,lF=Object.prototype.hasOwnProperty,uF=Object.prototype.propertyIsEnumerable,zg=(e,t,r)=>t in e?iF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ke=(e,t)=>{for(var r in t||(t={}))lF.call(t,r)&&zg(e,r,t[r]);if(Dg)for(var r of Dg(t))uF.call(t,r)&&zg(e,r,t[r]);return e},Ns=(e,t)=>sF(e,cF(t)),pI="vercel.ai.error",dF=Symbol.for(pI),hI,mF=class gI extends Error{constructor({name:t,message:r,cause:o}){super(r),this[hI]=!0,this.name=t,this.cause=o}static isInstance(t){return gI.hasMarker(t,pI)}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}};hI=dF;var Fe=mF,vI="AI_APICallError",yI=`vercel.ai.error.${vI}`,fF=Symbol.for(yI),bI,Ht=class extends Fe{constructor({message:e,url:t,requestBodyValues:r,statusCode:o,responseHeaders:n,responseBody:a,cause:i,isRetryable:s=o!=null&&(o===408||o===409||o===429||o>=500),data:c}){super({name:vI,message:e,cause:i}),this[bI]=!0,this.url=t,this.requestBodyValues=r,this.statusCode=o,this.responseHeaders=n,this.responseBody=a,this.isRetryable=s,this.data=c}static isInstance(e){return Fe.hasMarker(e,yI)}};bI=fF;var _I="AI_EmptyResponseBodyError",wI=`vercel.ai.error.${_I}`,pF=Symbol.for(wI),xI,hF=class extends Fe{constructor({message:e="Empty response body"}={}){super({name:_I,message:e}),this[xI]=!0}static isInstance(e){return Fe.hasMarker(e,wI)}};xI=pF;function SI(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var kI="AI_InvalidArgumentError",EI=`vercel.ai.error.${kI}`,gF=Symbol.for(EI),II,TI=class extends Fe{constructor({message:t,cause:r,argument:o}){super({name:kI,message:t,cause:r}),this[II]=!0,this.argument=o}static isInstance(t){return Fe.hasMarker(t,EI)}};II=gF;var $I="AI_InvalidPromptError",OI=`vercel.ai.error.${$I}`,vF=Symbol.for(OI),CI,yF=class extends Fe{constructor({prompt:e,message:t,cause:r}){super({name:$I,message:`Invalid prompt: ${t}`,cause:r}),this[CI]=!0,this.prompt=e}static isInstance(e){return Fe.hasMarker(e,OI)}};CI=vF;var AI="AI_InvalidResponseDataError",RI=`vercel.ai.error.${AI}`,bF=Symbol.for(RI),NI,qo=class extends Fe{constructor({data:e,message:t=`Invalid response data: ${JSON.stringify(e)}.`}){super({name:AI,message:t}),this[NI]=!0,this.data=e}static isInstance(e){return Fe.hasMarker(e,RI)}};NI=bF;var PI="AI_JSONParseError",jI=`vercel.ai.error.${PI}`,_F=Symbol.for(jI),MI,Ps=class extends Fe{constructor({text:e,cause:t}){super({name:PI,message:`JSON parsing failed: Text: ${e}.
40
- Error message: ${SI(t)}`,cause:t}),this[MI]=!0,this.text=e}static isInstance(e){return Fe.hasMarker(e,jI)}};MI=_F;var DI="AI_LoadAPIKeyError",zI=`vercel.ai.error.${DI}`,wF=Symbol.for(zI),UI,Di=class extends Fe{constructor({message:e}){super({name:DI,message:e}),this[UI]=!0}static isInstance(e){return Fe.hasMarker(e,zI)}};UI=wF;var LI="AI_NoContentGeneratedError",FI=`vercel.ai.error.${LI}`,xF=Symbol.for(FI),VI,ZI=class extends Fe{constructor({message:e="No content generated."}={}){super({name:LI,message:e}),this[VI]=!0}static isInstance(e){return Fe.hasMarker(e,FI)}};VI=xF;var qI="AI_TypeValidationError",BI=`vercel.ai.error.${qI}`,SF=Symbol.for(BI),GI,kF=class nd extends Fe{constructor({value:t,cause:r}){super({name:qI,message:`Type validation failed: Value: ${JSON.stringify(t)}.
41
- Error message: ${SI(r)}`,cause:r}),this[GI]=!0,this.value=t}static isInstance(t){return Fe.hasMarker(t,BI)}static wrap({value:t,cause:r}){return nd.isInstance(r)&&r.value===t?r:new nd({value:t,cause:r})}};GI=SF;var ga=kF,HI="AI_UnsupportedFunctionalityError",WI=`vercel.ai.error.${HI}`,EF=Symbol.for(WI),JI,Ar=class extends Fe{constructor({functionality:e,message:t=`'${e}' functionality not supported.`}){super({name:HI,message:t}),this[JI]=!0,this.functionality=e}static isInstance(e){return Fe.hasMarker(e,WI)}};JI=EF;var Ug=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 tu(e){}function IF(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=tu,onError:r=tu,onRetry:o=tu,onComment:n}=e;let a="",i=!0,s,c="",l="";function u(h){const v=i?h.replace(/^\xEF\xBB\xBF/,""):h,[b,w]=TF(`${a}${v}`);for(const x of b)d(x);a=w,i=!1}function d(h){if(h===""){f();return}if(h.startsWith(":")){n&&n(h.slice(h.startsWith(": ")?2:1));return}const v=h.indexOf(":");if(v!==-1){const b=h.slice(0,v),w=h[v+1]===" "?2:1,x=h.slice(v+w);m(b,x,h);return}m(h,"",h)}function m(h,v,b){switch(h){case"event":l=v;break;case"data":c=`${c}${v}
42
- `;break;case"id":s=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?o(parseInt(v,10)):r(new Ug(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:b}));break;default:r(new Ug(`Unknown field "${h.length>20?`${h.slice(0,20)}…`:h}"`,{type:"unknown-field",field:h,value:v,line:b}));break}}function f(){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 g(h={}){a&&h.consume&&d(a),i=!0,s=void 0,c="",l="",a=""}return{feed:u,reset:g}}function TF(e){const t=[];let r="",o=0;for(;o<e.length;){const n=e.indexOf("\r",o),a=e.indexOf(`
44
- `,o);let i=-1;if(n!==-1&&a!==-1?i=Math.min(n,a):n!==-1?i=n:a!==-1&&(i=a),i===-1){r=e.slice(o);break}else{const s=e.slice(o,i);t.push(s),o=i+1,e[o-1]==="\r"&&e[o]===`
45
- `&&o++}}return[t,r]}var $F=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:r}={}){let o;super({start(n){o=IF({onEvent:a=>{n.enqueue(a)},onError(a){e==="terminate"?n.error(a):typeof e=="function"&&e(a)},onRetry:t,onComment:r})},transform(n){o.feed(n)}})}};new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function va(...e){return e.reduce((t,r)=>ke(ke({},t),r??{}),{})}function cl(e){return Object.fromEntries([...e.headers])}var OF=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const a=r.length,i=new Array(t);for(let s=0;s<t;s++)i[s]=r[Math.random()*a|0];return i.join("")};if(e==null)return n;if(r.includes(o))throw new TI({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},qt=OF();function od(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var CF=["fetch failed","failed to fetch"];function AF({error:e,url:t,requestBodyValues:r}){if(od(e))return e;if(e instanceof TypeError&&CF.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new Ht({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function RF(e){return Object.fromEntries(Object.entries(e).filter(([t,r])=>r!=null))}function NF({apiKey:e,environmentVariableName:t,apiKeyParameterName:r="apiKey",description:o}){if(typeof e=="string")return e;if(e!=null)throw new Di({message:`${o} API key must be a string.`});if(typeof process>"u")throw new Di({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 Di({message:`${o} API key is missing. Pass it using the '${r}' parameter or the ${t} environment variable.`});if(typeof e!="string")throw new Di({message:`${o} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}var PF=/"__proto__"\s*:/,jF=/"constructor"\s*:/;function MF(e){const t=JSON.parse(e);return t===null||typeof t!="object"||PF.test(e)===!1&&jF.test(e)===!1?t:DF(t)}function DF(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 a=o[n];a&&typeof a=="object"&&t.push(a)}}}return e}function Kf(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return MF(e)}finally{Error.stackTraceLimit=t}}var ad=Symbol.for("vercel.ai.validator");function zF(e){return{[ad]:!0,validate:e}}function UF(e){return typeof e=="object"&&e!==null&&ad in e&&e[ad]===!0&&"validate"in e}function LF(e){return UF(e)?e:FF(e)}function FF(e){return zF(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new ga({value:t,cause:r.issues})}})}async function VF({value:e,schema:t}){const r=await KI({value:e,schema:t});if(!r.success)throw ga.wrap({value:e,cause:r.error});return r.value}async function KI({value:e,schema:t}){const r=LF(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:ga.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:ga.wrap({value:e,cause:o}),rawValue:e}}}async function ZF({text:e,schema:t}){try{const r=Kf(e);return t==null?r:VF({value:r,schema:t})}catch(r){throw Ps.isInstance(r)||ga.isInstance(r)?r:new Ps({text:e,cause:r})}}async function YI({text:e,schema:t}){try{const r=Kf(e);return t==null?{success:!0,value:r,rawValue:r}:await KI({value:r,schema:t})}catch(r){return{success:!1,error:Ps.isInstance(r)?r:new Ps({text:e,cause:r}),rawValue:void 0}}}function ru(e){try{return Kf(e),!0}catch{return!1}}function qF({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new $F).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await YI({text:r,schema:t}))}}))}var BF=()=>globalThis.fetch,ya=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:a,fetch:i})=>GF({url:e,headers:ke({"Content-Type":"application/json"},t),body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:a,fetch:i}),GF=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:a,fetch:i=BF()})=>{try{const s=await i(e,{method:"POST",headers:RF(t),body:r.content,signal:a}),c=cl(s);if(!s.ok){let l;try{l=await n({response:s,url:e,requestBodyValues:r.values})}catch(u){throw od(u)||Ht.isInstance(u)?u:new Ht({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&&(od(l)||Ht.isInstance(l))?l:new Ht({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw AF({error:s,url:e,requestBodyValues:r.values})}},HF=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:a})=>{const i=await o.text(),s=cl(o);if(i.trim()==="")return{responseHeaders:s,value:new Ht({message:o.statusText,url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,isRetryable:r?.(o)})};try{const c=await ZF({text:i,schema:e});return{responseHeaders:s,value:new Ht({message:t(c),url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,data:c,isRetryable:r?.(o,c)})}}catch{return{responseHeaders:s,value:new Ht({message:o.statusText,url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,isRetryable:r?.(o)})}}},XI=e=>async({response:t})=>{const r=cl(t);if(t.body==null)throw new hF({});return{responseHeaders:r,value:qF({stream:t.body,schema:e})}},Yf=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),a=await YI({text:n,schema:e}),i=cl(t);if(!a.success)throw new Ht({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:i,responseBody:n,url:r,requestBodyValues:o});return{responseHeaders:i,value:a.value,rawValue:a.rawValue}},{btoa:WF}=globalThis;function JF(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return WF(t)}function KF(e){return e?.replace(/\/$/,"")}function nu(e){return e!=null}var QI=(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))(QI||{}),Xf=C({id:E().nullish(),format:Sn(QI).nullish(),index:G().optional()}).loose(),YF=C({type:H("reasoning.summary"),summary:E()}).extend(Xf.shape),XF=C({type:H("reasoning.encrypted"),data:E()}).extend(Xf.shape),QF=C({type:H("reasoning.text"),text:E().nullish(),signature:E().nullish()}).extend(Xf.shape),Qf=he([YF,XF,QF]),Qi=he([Qf,ot().transform(()=>null)]),ep=D(Qi).transform(e=>e.filter(t=>!!t));he([C({delta:C({reasoning_details:D(Qi)})}).transform(e=>e.delta.reasoning_details.filter(nu)),C({message:C({reasoning_details:D(Qi)})}).transform(e=>e.message.reasoning_details.filter(nu)),C({text:E(),reasoning_details:D(Qi)}).transform(e=>e.reasoning_details.filter(nu))]);var ll=C({error:C({code:he([E(),G()]).nullable().optional().default(null),message:E(),type:E().nullable().optional().default(null),param:Ze().nullable().optional().default(null)}).passthrough()}).passthrough(),ba=HF({errorSchema:ll,errorToMessage:e=>e.error.message}),eT=C({type:H("file"),file:C({hash:E(),name:E(),content:D(C({type:E(),text:E().optional()}).catchall(Ze())).optional()}).catchall(Ze())}).catchall(Ze()),e3=C({provider:E(),reasoning_details:D(Qf).optional(),annotations:D(eT).optional(),usage:C({promptTokens:G(),promptTokensDetails:C({cachedTokens:G()}).catchall(Ze()).optional(),completionTokens:G(),completionTokensDetails:C({reasoningTokens:G()}).catchall(Ze()).optional(),totalTokens:G(),cost:G().optional(),costDetails:C({upstreamInferenceCost:G()}).catchall(Ze()).optional()}).catchall(Ze())}).catchall(Ze()),Lg=C({openrouter:C({reasoning_details:D(Qf).optional(),annotations:D(eT).optional()}).optional()}).optional();function js(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 t3=["wav","mp3","aiff","aac","ogg","flac","m4a","pcm16","pcm24"];function tp({url:e,protocols:t}){try{const r=new URL(e);return t.has(r.protocol)}catch{return!1}}function id({part:e,defaultMediaType:t}){var r,o;if(e.data instanceof Uint8Array){const a=JF(e.data);return`data:${(r=e.mediaType)!=null?r:t};base64,${a}`}const n=e.data.toString();return tp({url:n,protocols:new Set(["http:","https:"])})||n.startsWith("data:")?n:`data:${(o=e.mediaType)!=null?o:t};base64,${n}`}function Fg(e,t){var r;const o=e.match(/^data:([^;]+)/);return o&&(r=o[1])!=null?r:t}function sd(e){const t=e.match(/^data:[^;]*;base64,(.+)$/);return t?t[1]:e}var r3={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 n3(e){const t=id({part:e,defaultMediaType:"audio/mpeg"});if(tp({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=sd(t),o=e.mediaType||"audio/mpeg",n=o.replace("audio/",""),a=r3[n];if(a===void 0){const i=t3.join(", ");throw new Error(`Unsupported audio format: "${o}"
55
-
56
- OpenRouter supports the following audio formats: ${i}
57
-
58
- Learn more: https://openrouter.ai/docs/features/multimodal/audio`)}return{data:r,format:a}}function Or(e){var t,r,o;const n=e?.anthropic,a=e?.openrouter;return(o=(r=(t=a?.cacheControl)!=null?t:a?.cache_control)!=null?r:n?.cacheControl)!=null?o:n?.cache_control}function o3(e){var t,r,o,n,a,i,s,c,l,u;const d=[];for(const{role:m,content:f,providerOptions:g}of e)switch(m){case"system":{d.push({role:"system",content:f,cache_control:Or(g)});break}case"user":{if(f.length===1&&((t=f[0])==null?void 0:t.type)==="text"){const b=(r=Or(g))!=null?r:Or(f[0].providerOptions),w=b?[{type:"text",text:f[0].text,cache_control:b}]:f[0].text;d.push({role:"user",content:w});break}const h=Or(g),v=f.map(b=>{var w,x,y,S,k,T,A;const U=(w=Or(b.providerOptions))!=null?w:h;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:id({part:b,defaultMediaType:"image/jpeg"})},cache_control:U};if((y=b.mediaType)!=null&&y.startsWith("audio/"))return{type:"input_audio",input_audio:n3(b),cache_control:U};const L=String((A=(T=(k=(S=b.providerOptions)==null?void 0:S.openrouter)==null?void 0:k.filename)!=null?T:b.filename)!=null?A:""),W=id({part:b,defaultMediaType:"application/pdf"});return tp({url:W,protocols:new Set(["http:","https:"])})?{type:"file",file:{filename:L,file_data:W}}:{type:"file",file:{filename:L,file_data:W},cache_control:U}}default:return{type:"text",text:"",cache_control:U}}});d.push({role:"user",content:v});break}case"assistant":{let h="",v="";const b=[],w=[];for(const T of f)switch(T.type){case"text":{h+=T.text;break}case"tool-call":{const A=(o=T.providerOptions)==null?void 0:o.openrouter;A?.reasoning_details&&Array.isArray(A.reasoning_details)&&w.push(...A.reasoning_details),b.push({id:T.toolCallId,type:"function",function:{name:T.toolName,arguments:JSON.stringify(T.input)}});break}case"reasoning":{v+=T.text;const A=Lg.safeParse(T.providerOptions);A.success&&((a=(n=A.data)==null?void 0:n.openrouter)!=null&&a.reasoning_details)&&w.push(...A.data.openrouter.reasoning_details);break}}const x=Lg.safeParse(g),y=x.success?(s=(i=x.data)==null?void 0:i.openrouter)==null?void 0:s.reasoning_details:void 0,S=x.success?(l=(c=x.data)==null?void 0:c.openrouter)==null?void 0:l.annotations:void 0,k=y&&Array.isArray(y)&&y.length>0?y:w.length>0?w:void 0;d.push({role:"assistant",content:h,tool_calls:b.length>0?b:void 0,reasoning:v||void 0,reasoning_details:k,annotations:S,cache_control:Or(g)});break}case"tool":{for(const h of f){const v=a3(h);d.push({role:"tool",tool_call_id:h.toolCallId,content:v,cache_control:(u=Or(g))!=null?u:Or(h.providerOptions)})}break}}return d}function a3(e){return e.output.type==="text"?e.output.value:JSON.stringify(e.output.value)}he([H("auto"),H("none"),H("required"),C({type:H("function"),function:C({name:E()})})]);function i3(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 TI({argument:"toolChoice",message:`Invalid tool choice type: ${JSON.stringify(e)}`})}}var s3=C({type:H("image_url"),image_url:C({url:E()}).passthrough()}).passthrough(),c3=he([s3,ot().transform(()=>null)]),tT=D(c3).transform(e=>e.filter(t=>!!t)),rT=C({id:E().optional(),model:E().optional(),provider:E().optional(),usage:C({prompt_tokens:G(),prompt_tokens_details:C({cached_tokens:G()}).passthrough().nullish(),completion_tokens:G(),completion_tokens_details:C({reasoning_tokens:G()}).passthrough().nullish(),total_tokens:G(),cost:G().optional(),cost_details:C({upstream_inference_cost:G().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),l3=he([rT.extend({choices:D(C({message:C({role:H("assistant"),content:E().nullable().optional(),reasoning:E().nullable().optional(),reasoning_details:ep.nullish(),images:tT.nullish(),tool_calls:D(C({id:E().optional().nullable(),type:H("function"),function:C({name:E(),arguments:E()}).passthrough()}).passthrough()).optional(),annotations:D(he([C({type:H("url_citation"),url_citation:C({end_index:G(),start_index:G(),title:E(),url:E(),content:E().optional()}).passthrough()}).passthrough(),C({type:H("file_annotation"),file_annotation:C({file_id:E(),quote:E().optional()}).passthrough()}).passthrough(),C({type:H("file"),file:C({hash:E(),name:E(),content:D(C({type:E(),text:E().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough(),index:G().nullish(),logprobs:C({content:D(C({token:E(),logprob:G(),top_logprobs:D(C({token:E(),logprob:G()}).passthrough())}).passthrough()).nullable()}).passthrough().nullable().optional(),finish_reason:E().optional().nullable()}).passthrough())}),ll.extend({user_id:E().optional()})]),u3=he([rT.extend({choices:D(C({delta:C({role:Sn(["assistant"]).optional(),content:E().nullish(),reasoning:E().nullish().optional(),reasoning_details:ep.nullish(),images:tT.nullish(),tool_calls:D(C({index:G().nullish(),id:E().nullish(),type:H("function").optional(),function:C({name:E().nullish(),arguments:E().nullish()}).passthrough()}).passthrough()).nullish(),annotations:D(he([C({type:H("url_citation"),url_citation:C({end_index:G(),start_index:G(),title:E(),url:E(),content:E().optional()}).passthrough()}).passthrough(),C({type:H("file_annotation"),file_annotation:C({file_id:E(),quote:E().optional()}).passthrough()}).passthrough(),C({type:H("file"),file:C({hash:E(),name:E(),content:D(C({type:E(),text:E().optional()}).passthrough()).optional()}).passthrough()}).passthrough()])).nullish()}).passthrough().nullish(),logprobs:C({content:D(C({token:E(),logprob:G(),top_logprobs:D(C({token:E(),logprob:G()}).passthrough())}).passthrough()).nullable()}).passthrough().nullish(),finish_reason:E().nullable().optional(),index:G().nullish()}).passthrough())}),ll]),d3=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:a,seed:i,stopSequences:s,responseFormat:c,topK:l,tools:u,toolChoice:d}){var m;const f=ke(ke({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:a,seed:i,stop:s,response_format:c?.type==="json"?c.schema!=null?{type:"json_schema",json_schema:ke({schema:c.schema,strict:!0,name:(m=c.name)!=null?m:"response"},c.description&&{description:c.description})}:{type:"json_object"}:void 0,top_k:l,messages:o3(e),include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning,usage:this.settings.usage,plugins:this.settings.plugins,web_search_options:this.settings.web_search_options,provider:this.settings.provider,debug:this.settings.debug},this.config.extraBody),this.settings.extraBody);if(u&&u.length>0){const g=u.filter(h=>h.type==="function").map(h=>({type:"function",function:{name:h.name,description:h.description,parameters:h.inputSchema}}));return Ns(ke({},f),{tools:g,tool_choice:d?i3(d):void 0})}return f}async doGenerate(e){var t,r,o,n,a,i,s,c,l,u,d,m,f,g,h,v,b,w,x,y,S,k,T;const U=(e.providerOptions||{}).openrouter||{},L=ke(ke({},this.getArgs(e)),U),{value:W,responseHeaders:fe}=await ya({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:va(this.config.headers(),e.headers),body:L,failedResponseHandler:ba,successfulResponseHandler:Yf(l3),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in W){const P=W.error;throw new Ht({message:P.message,url:this.config.url({path:"/chat/completions",modelId:this.modelId}),requestBodyValues:L,statusCode:200,responseHeaders:fe,data:P})}const q=W,z=q.choices[0];if(!z)throw new ZI({message:"No choice in response"});const ve=q.usage?{inputTokens:(t=q.usage.prompt_tokens)!=null?t:0,outputTokens:(r=q.usage.completion_tokens)!=null?r:0,totalTokens:((o=q.usage.prompt_tokens)!=null?o:0)+((n=q.usage.completion_tokens)!=null?n:0),reasoningTokens:(i=(a=q.usage.completion_tokens_details)==null?void 0:a.reasoning_tokens)!=null?i:0,cachedInputTokens:(c=(s=q.usage.prompt_tokens_details)==null?void 0:s.cached_tokens)!=null?c:0}:{inputTokens:0,outputTokens:0,totalTokens:0,reasoningTokens:0,cachedInputTokens:0},ee=(l=z.message.reasoning_details)!=null?l:[],J=ee.length>0?ee.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):z.message.reasoning?[{type:"reasoning",text:z.message.reasoning}]:[],B=[];if(B.push(...J),z.message.content&&B.push({type:"text",text:z.message.content}),z.message.tool_calls)for(const P of z.message.tool_calls)B.push({type:"tool-call",toolCallId:(u=P.id)!=null?u:qt(),toolName:P.function.name,input:P.function.arguments,providerMetadata:{openrouter:{reasoning_details:ee}}});if(z.message.images)for(const P of z.message.images)B.push({type:"file",mediaType:Fg(P.image_url.url,"image/jpeg"),data:sd(P.image_url.url)});if(z.message.annotations)for(const P of z.message.annotations)P.type==="url_citation"&&B.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 ae=(d=z.message.annotations)==null?void 0:d.filter(P=>P.type==="file"),F=z.message.tool_calls&&z.message.tool_calls.length>0,_e=ee.some(P=>P.type==="reasoning.encrypted"&&P.data),Ie=F&&_e&&z.finish_reason==="stop"?"tool-calls":js(z.finish_reason);return{content:B,finishReason:Ie,usage:ve,warnings:[],providerMetadata:{openrouter:e3.parse({provider:(m=q.provider)!=null?m:"",reasoning_details:(f=z.message.reasoning_details)!=null?f:[],annotations:ae&&ae.length>0?ae:void 0,usage:ke(ke(ke({promptTokens:(g=ve.inputTokens)!=null?g:0,completionTokens:(h=ve.outputTokens)!=null?h:0,totalTokens:(v=ve.totalTokens)!=null?v:0,cost:(b=q.usage)==null?void 0:b.cost},((x=(w=q.usage)==null?void 0:w.prompt_tokens_details)==null?void 0:x.cached_tokens)!=null?{promptTokensDetails:{cachedTokens:q.usage.prompt_tokens_details.cached_tokens}}:{}),((S=(y=q.usage)==null?void 0:y.completion_tokens_details)==null?void 0:S.reasoning_tokens)!=null?{completionTokensDetails:{reasoningTokens:q.usage.completion_tokens_details.reasoning_tokens}}:{}),((T=(k=q.usage)==null?void 0:k.cost_details)==null?void 0:T.upstream_inference_cost)!=null?{costDetails:{upstreamInferenceCost:q.usage.cost_details.upstream_inference_cost}}:{})})},request:{body:L},response:{id:q.id,modelId:q.model,headers:fe}}}async doStream(e){var t;const o=(e.providerOptions||{}).openrouter||{},n=ke(ke({},this.getArgs(e)),o),{value:a,responseHeaders:i}=await ya({url:this.config.url({path:"/chat/completions",modelId:this.modelId}),headers:va(this.config.headers(),e.headers),body:Ns(ke({},n),{stream:!0,stream_options:this.config.compatibility==="strict"?ke({include_usage:!0},(t=this.settings.usage)!=null&&t.include?{include_usage:!0}:{}):void 0}),failedResponseHandler:ba,successfulResponseHandler:XI(u3),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=[],m=[];let f=!1,g=!1,h,v,b,w;return{stream:a.pipeThrough(new TransformStream({transform(x,y){var S,k,T,A,U,L,W,fe,q,z,ve,ee,J,B,ae;if(!x.success){c="error",y.enqueue({type:"error",error:x.error});return}const F=x.value;if("error"in F){c="error",y.enqueue({type:"error",error:F.error});return}if(F.provider&&(w=F.provider),F.id&&(b=F.id,y.enqueue({type:"response-metadata",id:F.id})),F.model&&y.enqueue({type:"response-metadata",modelId:F.model}),F.usage!=null){if(l.inputTokens=F.usage.prompt_tokens,l.outputTokens=F.usage.completion_tokens,l.totalTokens=F.usage.prompt_tokens+F.usage.completion_tokens,u.promptTokens=F.usage.prompt_tokens,F.usage.prompt_tokens_details){const V=(S=F.usage.prompt_tokens_details.cached_tokens)!=null?S:0;l.cachedInputTokens=V,u.promptTokensDetails={cachedTokens:V}}if(u.completionTokens=F.usage.completion_tokens,F.usage.completion_tokens_details){const V=(k=F.usage.completion_tokens_details.reasoning_tokens)!=null?k:0;l.reasoningTokens=V,u.completionTokensDetails={reasoningTokens:V}}u.cost=F.usage.cost,u.totalTokens=F.usage.total_tokens;const P=(T=F.usage.cost_details)==null?void 0:T.upstream_inference_cost;P!=null&&(u.costDetails={upstreamInferenceCost:P})}const _e=F.choices[0];if(_e?.finish_reason!=null&&(c=js(_e.finish_reason)),_e?.delta==null)return;const ue=_e.delta,Ie=(P,V)=>{g||(v=b||qt(),y.enqueue({providerMetadata:V,type:"reasoning-start",id:v}),g=!0),y.enqueue({providerMetadata:V,type:"reasoning-delta",delta:P,id:v||qt()})};if(ue.reasoning_details&&ue.reasoning_details.length>0){for(const V of ue.reasoning_details)if(V.type==="reasoning.text"){const le=d[d.length-1];le?.type==="reasoning.text"?(le.text=(le.text||"")+(V.text||""),le.signature=le.signature||V.signature,le.format=le.format||V.format):d.push(ke({},V))}else d.push(V);const P={openrouter:{reasoning_details:ue.reasoning_details}};for(const V of ue.reasoning_details)switch(V.type){case"reasoning.text":{V.text&&Ie(V.text,P);break}case"reasoning.encrypted":{V.data&&Ie("[REDACTED]",P);break}case"reasoning.summary":{V.summary&&Ie(V.summary,P);break}}}else ue.reasoning&&Ie(ue.reasoning);if(ue.content&&(g&&!f&&(y.enqueue({type:"reasoning-end",id:v||qt()}),g=!1),f||(h=b||qt(),y.enqueue({type:"text-start",id:h}),f=!0),y.enqueue({type:"text-delta",delta:ue.content,id:h||qt()})),ue.annotations){for(const P of ue.annotations)if(P.type==="url_citation")y.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 V=P.file;V&&typeof V=="object"&&"hash"in V&&"name"in V&&m.push(P)}}if(ue.tool_calls!=null)for(const P of ue.tool_calls){const V=(A=P.index)!=null?A:s.length-1;if(s[V]==null){if(P.type!=="function")throw new qo({data:P,message:"Expected 'function' type."});if(P.id==null)throw new qo({data:P,message:"Expected 'id' to be a string."});if(((U=P.function)==null?void 0:U.name)==null)throw new qo({data:P,message:"Expected 'function.name' to be a string."});s[V]={id:P.id,type:"function",function:{name:P.function.name,arguments:(L=P.function.arguments)!=null?L:""},inputStarted:!1,sent:!1};const we=s[V];if(we==null)throw new qo({data:{index:V,toolCallsLength:s.length},message:`Tool call at index ${V} is missing after creation.`});((W=we.function)==null?void 0:W.name)!=null&&((fe=we.function)==null?void 0:fe.arguments)!=null&&ru(we.function.arguments)&&(we.inputStarted=!0,y.enqueue({type:"tool-input-start",id:we.id,toolName:we.function.name}),y.enqueue({type:"tool-input-delta",id:we.id,delta:we.function.arguments}),y.enqueue({type:"tool-input-end",id:we.id}),y.enqueue({type:"tool-call",toolCallId:we.id,toolName:we.function.name,input:we.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),we.sent=!0);continue}const le=s[V];if(le==null)throw new qo({data:{index:V,toolCallsLength:s.length,toolCallDelta:P},message:`Tool call at index ${V} is missing during merge.`});le.inputStarted||(le.inputStarted=!0,y.enqueue({type:"tool-input-start",id:le.id,toolName:le.function.name})),((q=P.function)==null?void 0:q.arguments)!=null&&(le.function.arguments+=(ve=(z=P.function)==null?void 0:z.arguments)!=null?ve:""),y.enqueue({type:"tool-input-delta",id:le.id,delta:(ee=P.function.arguments)!=null?ee:""}),((J=le.function)==null?void 0:J.name)!=null&&((B=le.function)==null?void 0:B.arguments)!=null&&ru(le.function.arguments)&&(y.enqueue({type:"tool-call",toolCallId:(ae=le.id)!=null?ae:qt(),toolName:le.function.name,input:le.function.arguments,providerMetadata:{openrouter:{reasoning_details:d}}}),le.sent=!0)}if(ue.images!=null)for(const P of ue.images)y.enqueue({type:"file",mediaType:Fg(P.image_url.url,"image/jpeg"),data:sd(P.image_url.url)})},flush(x){var y;const S=s.length>0,k=d.some(A=>A.type==="reasoning.encrypted"&&A.data);if(S&&k&&c==="stop"&&(c="tool-calls"),c==="tool-calls")for(const A of s)A&&!A.sent&&(x.enqueue({type:"tool-call",toolCallId:(y=A.id)!=null?y:qt(),toolName:A.function.name,input:ru(A.function.arguments)?A.function.arguments:"{}",providerMetadata:{openrouter:{reasoning_details:d}}}),A.sent=!0);g&&x.enqueue({type:"reasoning-end",id:v||qt()}),f&&x.enqueue({type:"text-end",id:h||qt()});const T={usage:u};w!==void 0&&(T.provider=w),d.length>0&&(T.reasoning_details=d),m.length>0&&(T.annotations=m),x.enqueue({type:"finish",finishReason:c,usage:l,providerMetadata:{openrouter:T}})}})),warnings:[],request:{body:n},response:{headers:i}}}};function m3({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:a,content:i}of e)switch(a){case"system":throw new yF({message:`Unexpected system message in prompt: ${i}`,prompt:e});case"user":{const s=i.map(c=>{switch(c.type){case"text":return c.text;case"file":throw new Ar({functionality:"file attachments"});default:return""}}).join("");n+=`${r}:
61
- ${s}
62
-
63
- `;break}case"assistant":{const s=i.map(c=>{switch(c.type){case"text":return c.text;case"tool-call":throw new Ar({functionality:"tool-call messages"});case"tool-result":throw new Ar({functionality:"tool-result messages"});case"reasoning":throw new Ar({functionality:"reasoning messages"});case"file":throw new Ar({functionality:"file attachments"});default:return""}}).join("");n+=`${o}:
64
- ${s}
65
-
66
- `;break}case"tool":throw new Ar({functionality:"tool messages"})}return n+=`${o}:
67
- `,{prompt:n}}var Vg=he([C({id:E().optional(),model:E().optional(),choices:D(C({text:E(),reasoning:E().nullish().optional(),reasoning_details:ep.nullish(),finish_reason:E().nullish(),index:G().nullish(),logprobs:C({tokens:D(E()),token_logprobs:D(G()),top_logprobs:D(cr(E(),G())).nullable()}).passthrough().nullable().optional()}).passthrough()),usage:C({prompt_tokens:G(),prompt_tokens_details:C({cached_tokens:G()}).passthrough().nullish(),completion_tokens:G(),completion_tokens_details:C({reasoning_tokens:G()}).passthrough().nullish(),total_tokens:G(),cost:G().optional(),cost_details:C({upstream_inference_cost:G().nullish()}).passthrough().nullish()}).passthrough().nullish()}).passthrough(),ll]),f3=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:a,seed:i,responseFormat:s,topK:c,stopSequences:l,tools:u,toolChoice:d}){const{prompt:m}=m3({prompt:e,inputFormat:"prompt"});if(u?.length)throw new Ar({functionality:"tools"});if(d)throw new Ar({functionality:"toolChoice"});return ke(ke({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:a,seed:i,stop:l,response_format:s,top_k:c,prompt:m,include_reasoning:this.settings.includeReasoning,reasoning:this.settings.reasoning},this.config.extraBody),this.settings.extraBody)}async doGenerate(e){var t,r,o,n,a,i,s,c,l,u,d,m,f,g,h;const b=(e.providerOptions||{}).openrouter||{},w=ke(ke({},this.getArgs(e)),b),{value:x,responseHeaders:y}=await ya({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:va(this.config.headers(),e.headers),body:w,failedResponseHandler:ba,successfulResponseHandler:Yf(Vg),abortSignal:e.abortSignal,fetch:this.config.fetch});if("error"in x){const k=x.error;throw new Ht({message:k.message,url:this.config.url({path:"/completions",modelId:this.modelId}),requestBodyValues:w,statusCode:200,responseHeaders:y,data:k})}const S=x.choices[0];if(!S)throw new ZI({message:"No choice in OpenRouter completion response"});return{content:[{type:"text",text:(t=S.text)!=null?t:""}],finishReason:js(S.finish_reason),usage:{inputTokens:(o=(r=x.usage)==null?void 0:r.prompt_tokens)!=null?o:0,outputTokens:(a=(n=x.usage)==null?void 0:n.completion_tokens)!=null?a:0,totalTokens:((s=(i=x.usage)==null?void 0:i.prompt_tokens)!=null?s:0)+((l=(c=x.usage)==null?void 0:c.completion_tokens)!=null?l:0),reasoningTokens:(m=(d=(u=x.usage)==null?void 0:u.completion_tokens_details)==null?void 0:d.reasoning_tokens)!=null?m:0,cachedInputTokens:(h=(g=(f=x.usage)==null?void 0:f.prompt_tokens_details)==null?void 0:g.cached_tokens)!=null?h:0},warnings:[],response:{headers:y}}}async doStream(e){const r=(e.providerOptions||{}).openrouter||{},o=ke(ke({},this.getArgs(e)),r),{value:n,responseHeaders:a}=await ya({url:this.config.url({path:"/completions",modelId:this.modelId}),headers:va(this.config.headers(),e.headers),body:Ns(ke({},o),{stream:!0,stream_options:this.config.compatibility==="strict"?{include_usage:!0}:void 0}),failedResponseHandler:ba,successfulResponseHandler:XI(Vg),abortSignal:e.abortSignal,fetch:this.config.fetch});let i="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,m,f;if(!l.success){i="error",u.enqueue({type:"error",error:l.error});return}const g=l.value;if("error"in g){i="error",u.enqueue({type:"error",error:g.error});return}if(g.usage!=null){if(s.inputTokens=g.usage.prompt_tokens,s.outputTokens=g.usage.completion_tokens,s.totalTokens=g.usage.prompt_tokens+g.usage.completion_tokens,c.promptTokens=g.usage.prompt_tokens,g.usage.prompt_tokens_details){const b=(d=g.usage.prompt_tokens_details.cached_tokens)!=null?d:0;s.cachedInputTokens=b,c.promptTokensDetails={cachedTokens:b}}if(c.completionTokens=g.usage.completion_tokens,g.usage.completion_tokens_details){const b=(m=g.usage.completion_tokens_details.reasoning_tokens)!=null?m:0;s.reasoningTokens=b,c.completionTokensDetails={reasoningTokens:b}}c.cost=g.usage.cost,c.totalTokens=g.usage.total_tokens;const v=(f=g.usage.cost_details)==null?void 0:f.upstream_inference_cost;v!=null&&(c.costDetails={upstreamInferenceCost:v})}const h=g.choices[0];h?.finish_reason!=null&&(i=js(h.finish_reason)),h?.text!=null&&u.enqueue({type:"text-delta",delta:h.text,id:qt()})},flush(l){l.enqueue({type:"finish",finishReason:i,usage:s,providerMetadata:{openrouter:{usage:c}}})}})),response:{headers:a}}}},p3=C({prompt_tokens:G(),total_tokens:G(),cost:G().optional()}),h3=C({object:H("embedding"),embedding:D(G()),index:G().optional()}),g3=C({id:E().optional(),object:H("list"),data:D(h3),model:E(),usage:p3.optional()}),v3=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,a=ke(ke({model:this.modelId,input:r,user:this.settings.user,provider:this.settings.provider},this.config.extraBody),this.settings.extraBody),{value:i,responseHeaders:s}=await ya({url:this.config.url({path:"/embeddings",modelId:this.modelId}),headers:va(this.config.headers(),n),body:a,failedResponseHandler:ba,successfulResponseHandler:Yf(g3),abortSignal:o,fetch:this.config.fetch});return{embeddings:i.data.map(c=>c.embedding),usage:i.usage?{tokens:i.usage.prompt_tokens}:void 0,providerMetadata:(t=i.usage)!=null&&t.cost?{openrouter:{usage:{cost:i.usage.cost}}}:void 0,response:{headers:s,body:i}}}};function y3(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t!==null))}function b3(e,...t){const r=y3(e??{}),n=[r["user-agent"]||"",...t].filter(Boolean).join(" ");return Ns(ke({},r),{"user-agent":n})}var _3="1.5.4";function rp(e={}){var t,r,o;const n=(r=KF((t=e.baseURL)!=null?t:e.baseUrl))!=null?r:"https://openrouter.ai/api/v1",a=(o=e.compatibility)!=null?o:"compatible",i=()=>b3(ke(ke({Authorization:`Bearer ${NF({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/${_3}`),s=(m,f={})=>new d3(m,f,{provider:"openrouter.chat",url:({path:g})=>`${n}${g}`,headers:i,compatibility:a,fetch:e.fetch,extraBody:e.extraBody}),c=(m,f={})=>new f3(m,f,{provider:"openrouter.completion",url:({path:g})=>`${n}${g}`,headers:i,compatibility:a,fetch:e.fetch,extraBody:e.extraBody}),l=(m,f={})=>new v3(m,f,{provider:"openrouter.embedding",url:({path:g})=>`${n}${g}`,headers:i,fetch:e.fetch,extraBody:e.extraBody}),u=(m,f)=>{if(new.target)throw new Error("The OpenRouter model function cannot be called with the new keyword.");return m==="openai/gpt-3.5-turbo-instruct"?c(m,f):s(m,f)},d=(m,f)=>u(m,f);return d.languageModel=u,d.chat=s,d.completion=c,d.textEmbeddingModel=l,d.embedding=l,d}rp({compatibility:"strict"});function cd(...e){return e.reduce((t,r)=>({...t,...r??{}}),{})}async function nT(e,t){if(e==null)return Promise.resolve();const r=t?.abortSignal;return new Promise((o,n)=>{if(r?.aborted){n(Zg());return}const a=setTimeout(()=>{i(),o()},e),i=()=>{clearTimeout(a),r?.removeEventListener("abort",s)},s=()=>{i(),n(Zg())};r?.addEventListener("abort",s)})}function Zg(){return new DOMException("Delay was aborted","AbortError")}function mi(e){return Object.fromEntries([...e.headers])}var fi=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:o="-"}={})=>{const n=()=>{const a=r.length,i=new Array(t);for(let s=0;s<t;s++)i[s]=r[Math.random()*a|0];return i.join("")};if(e==null)return n;if(r.includes(o))throw new Td({argument:"separator",message:`The separator "${o}" must not be part of the alphabet "${r}".`});return()=>`${e}${o}${n()}`},oT=fi();function np(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}function hn(e){return(e instanceof Error||e instanceof DOMException)&&(e.name==="AbortError"||e.name==="ResponseAborted"||e.name==="TimeoutError")}var w3=["fetch failed","failed to fetch"];function aT({error:e,url:t,requestBodyValues:r}){if(hn(e))return e;if(e instanceof TypeError&&w3.includes(e.message.toLowerCase())){const o=e.cause;if(o!=null)return new mt({message:`Cannot connect to API: ${o.message}`,cause:o,url:t,requestBodyValues:r,isRetryable:!0})}return e}function op(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 x3(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 pi(e,...t){const r=new Headers(x3(e)),o=r.get("user-agent")||"";return r.set("user-agent",[o,...t].filter(Boolean).join(" ")),Object.fromEntries(r.entries())}var iT="3.0.16",S3=()=>globalThis.fetch,qg=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:o,abortSignal:n,fetch:a=S3()})=>{try{const i=await a(e,{method:"GET",headers:pi(t,`ai-sdk/provider-utils/${iT}`,op()),signal:n}),s=mi(i);if(!i.ok){let c;try{c=await o({response:i,url:e,requestBodyValues:{}})}catch(l){throw hn(l)||mt.isInstance(l)?l:new mt({message:"Failed to process error response",cause:l,statusCode:i.status,url:e,responseHeaders:s,requestBodyValues:{}})}throw c.value}try{return await r({response:i,url:e,requestBodyValues:{}})}catch(c){throw c instanceof Error&&(hn(c)||mt.isInstance(c))?c:new mt({message:"Failed to process successful response",cause:c,statusCode:i.status,url:e,responseHeaders:s,requestBodyValues:{}})}}catch(i){throw aT({error:i,url:e,requestBodyValues:{}})}};function k3({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map(([o,n])=>{const a=o.toLowerCase();return a==="*"||a==="*/*"?{mediaTypePrefix:"",regexes:n}:{mediaTypePrefix:a.replace(/\*/,""),regexes:n}}).filter(({mediaTypePrefix:o})=>e.startsWith(o)).flatMap(({regexes:o})=>o).some(o=>o.test(t))}function es({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 E3=/"__proto__"\s*:/,I3=/"constructor"\s*:/;function T3(e){const t=JSON.parse(e);return t===null||typeof t!="object"||E3.test(e)===!1&&I3.test(e)===!1?t:$3(t)}function $3(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 a=o[n];a&&typeof a=="object"&&t.push(a)}}}return e}function sT(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return T3(e)}finally{Error.stackTraceLimit=t}}var Ms=Symbol.for("vercel.ai.validator");function O3(e){return{[Ms]:!0,validate:e}}function C3(e){return typeof e=="object"&&e!==null&&Ms in e&&e[Ms]===!0&&"validate"in e}function Co(e){let t;return()=>(t==null&&(t=e()),t)}function A3(e){return C3(e)?e:typeof e=="function"?e():R3(e)}function R3(e){return O3(async t=>{const r=await e["~standard"].validate(t);return r.issues==null?{success:!0,value:r.value}:{success:!1,error:new jt({value:t,cause:r.issues})}})}async function ld({value:e,schema:t}){const r=await Jt({value:e,schema:t});if(!r.success)throw jt.wrap({value:e,cause:r.error});return r.value}async function Jt({value:e,schema:t}){const r=A3(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:jt.wrap({value:e,cause:o.error}),rawValue:e}}catch(o){return{success:!1,error:jt.wrap({value:e,cause:o}),rawValue:e}}}async function N3({text:e,schema:t}){try{const r=sT(e);return t==null?r:ld({value:r,schema:t})}catch(r){throw na.isInstance(r)||jt.isInstance(r)?r:new na({text:e,cause:r})}}async function qr({text:e,schema:t}){try{const r=sT(e);return t==null?{success:!0,value:r,rawValue:r}:await Jt({value:r,schema:t})}catch(r){return{success:!1,error:na.isInstance(r)?r:new na({text:e,cause:r}),rawValue:void 0}}}function P3({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new cs).pipeThrough(new TransformStream({async transform({data:r},o){r!=="[DONE]"&&o.enqueue(await qr({text:r,schema:t}))}}))}var j3=()=>globalThis.fetch,ud=async({url:e,headers:t,body:r,failedResponseHandler:o,successfulResponseHandler:n,abortSignal:a,fetch:i})=>M3({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:o,successfulResponseHandler:n,abortSignal:a,fetch:i}),M3=async({url:e,headers:t={},body:r,successfulResponseHandler:o,failedResponseHandler:n,abortSignal:a,fetch:i=j3()})=>{try{const s=await i(e,{method:"POST",headers:pi(t,`ai-sdk/provider-utils/${iT}`,op()),body:r.content,signal:a}),c=mi(s);if(!s.ok){let l;try{l=await n({response:s,url:e,requestBodyValues:r.values})}catch(u){throw hn(u)||mt.isInstance(u)?u:new mt({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&&(hn(l)||mt.isInstance(l))?l:new mt({message:"Failed to process successful response",cause:l,statusCode:s.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(s){throw aT({error:s,url:e,requestBodyValues:r.values})}};async function Pr(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var _a=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:o,url:n,requestBodyValues:a})=>{const i=await o.text(),s=mi(o);if(i.trim()==="")return{responseHeaders:s,value:new mt({message:o.statusText,url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,isRetryable:r?.(o)})};try{const c=await N3({text:i,schema:e});return{responseHeaders:s,value:new mt({message:t(c),url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,data:c,isRetryable:r?.(o,c)})}}catch{return{responseHeaders:s,value:new mt({message:o.statusText,url:n,requestBodyValues:a,statusCode:o.status,responseHeaders:s,responseBody:i,isRetryable:r?.(o)})}}},D3=e=>async({response:t})=>{const r=mi(t);if(t.body==null)throw new uC({});return{responseHeaders:r,value:P3({stream:t.body,schema:e})}},Ds=e=>async({response:t,url:r,requestBodyValues:o})=>{const n=await t.text(),a=await qr({text:n,schema:e}),i=mi(t);if(!a.success)throw new mt({message:"Invalid JSON response",cause:a.error,statusCode:t.status,responseHeaders:i,responseBody:n,url:r,requestBodyValues:o});return{responseHeaders:i,value:a.value,rawValue:a.rawValue}},z3=(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("/")},U3=Symbol("Let zodToJsonSchema decide on which parser to use"),Bg={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"},L3=e=>typeof e=="string"?{...Bg,name:e}:{...Bg,...e};function $t(){return{}}function F3(e,t){var r,o,n;const a={type:"array"};return(r=e.type)!=null&&r._def&&((n=(o=e.type)==null?void 0:o._def)==null?void 0:n.typeName)!==te.ZodAny&&(a.items=Ee(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(a.minItems=e.minLength.value),e.maxLength&&(a.maxItems=e.maxLength.value),e.exactLength&&(a.minItems=e.exactLength.value,a.maxItems=e.exactLength.value),a}function V3(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 Z3(){return{type:"boolean"}}function cT(e,t){return Ee(e.type._def,t)}var q3=(e,t)=>Ee(e.innerType._def,t);function lT(e,t,r){const o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,a)=>lT(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 B3(e)}}var B3=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 G3(e,t){return{...Ee(e.innerType._def,t),default:e.defaultValue()}}function H3(e,t){return t.effectStrategy==="input"?Ee(e.schema._def,t):$t()}function W3(e){return{type:"string",enum:Array.from(e.values)}}var J3=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function K3(e,t){const r=[Ee(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ee(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(n=>!!n),o=[];return r.forEach(n=>{if(J3(n))o.push(...n.allOf);else{let a=n;if("additionalProperties"in n&&n.additionalProperties===!1){const{additionalProperties:i,...s}=n;a=s}o.push(a)}}),o.length?{allOf:o}:void 0}function Y3(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 ou=void 0,Vt={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:()=>(ou===void 0&&(ou=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ou),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 uT(e,t){const r={type:"string"};if(e.checks)for(const o of e.checks)switch(o.kind){case"min":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value;break;case"max":r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value;break;case"email":switch(t.emailStrategy){case"format:email":Zt(r,"email",o.message,t);break;case"format:idn-email":Zt(r,"idn-email",o.message,t);break;case"pattern:zod":lt(r,Vt.email,o.message,t);break}break;case"url":Zt(r,"uri",o.message,t);break;case"uuid":Zt(r,"uuid",o.message,t);break;case"regex":lt(r,o.regex,o.message,t);break;case"cuid":lt(r,Vt.cuid,o.message,t);break;case"cuid2":lt(r,Vt.cuid2,o.message,t);break;case"startsWith":lt(r,RegExp(`^${au(o.value,t)}`),o.message,t);break;case"endsWith":lt(r,RegExp(`${au(o.value,t)}$`),o.message,t);break;case"datetime":Zt(r,"date-time",o.message,t);break;case"date":Zt(r,"date",o.message,t);break;case"time":Zt(r,"time",o.message,t);break;case"duration":Zt(r,"duration",o.message,t);break;case"length":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,o.value):o.value,r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,o.value):o.value;break;case"includes":{lt(r,RegExp(au(o.value,t)),o.message,t);break}case"ip":{o.version!=="v6"&&Zt(r,"ipv4",o.message,t),o.version!=="v4"&&Zt(r,"ipv6",o.message,t);break}case"base64url":lt(r,Vt.base64url,o.message,t);break;case"jwt":lt(r,Vt.jwt,o.message,t);break;case"cidr":{o.version!=="v6"&&lt(r,Vt.ipv4Cidr,o.message,t),o.version!=="v4"&&lt(r,Vt.ipv6Cidr,o.message,t);break}case"emoji":lt(r,Vt.emoji(),o.message,t);break;case"ulid":{lt(r,Vt.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Zt(r,"binary",o.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{lt(r,Vt.base64,o.message,t);break}}break}case"nanoid":lt(r,Vt.nanoid,o.message,t)}return r}function au(e,t){return t.patternStrategy==="escape"?Q3(e):e}var X3=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Q3(e){let t="";for(let r=0;r<e.length;r++)X3.has(e[r])||(t+="\\"),t+=e[r];return t}function Zt(e,t,r,o){var n;e.format||(n=e.anyOf)!=null&&n.some(a=>a.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 lt(e,t,r,o){var n;e.pattern||(n=e.allOf)!=null&&n.some(a=>a.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Gg(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=Gg(t,o)}function Gg(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 a="",i=!1,s=!1,c=!1;for(let l=0;l<n.length;l++){if(i){a+=n[l],i=!1;continue}if(o.i){if(s){if(n[l].match(/[a-z]/)){c?(a+=n[l],a+=`${n[l-2]}-${n[l]}`.toUpperCase(),c=!1):n[l+1]==="-"&&((r=n[l+2])!=null&&r.match(/[a-z]/))?(a+=n[l],c=!0):a+=`${n[l]}${n[l].toUpperCase()}`;continue}}else if(n[l].match(/[a-z]/)){a+=`[${n[l]}${n[l].toUpperCase()}]`;continue}}if(o.m){if(n[l]==="^"){a+=`(^|(?<=[\r
68
- ]))`;continue}else if(n[l]==="$"){a+=`($|(?=[\r
69
- ]))`;continue}}if(o.s&&n[l]==="."){a+=s?`${n[l]}\r
70
- `:`[${n[l]}\r
71
- ]`;continue}a+=n[l],n[l]==="\\"?i=!0:s&&n[l]==="]"?s=!1:!s&&n[l]==="["&&(s=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return a}function dT(e,t){var r,o,n,a,i,s;const c={type:"object",additionalProperties:(r=Ee(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((o=e.keyType)==null?void 0:o._def.typeName)===te.ZodString&&((n=e.keyType._def.checks)!=null&&n.length)){const{type:l,...u}=uT(e.keyType._def,t);return{...c,propertyNames:u}}else{if(((a=e.keyType)==null?void 0:a._def.typeName)===te.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===te.ZodBranded&&e.keyType._def.type._def.typeName===te.ZodString&&((s=e.keyType._def.type._def.checks)!=null&&s.length)){const{type:l,...u}=cT(e.keyType._def,t);return{...c,propertyNames:u}}}return c}function eV(e,t){if(t.mapStrategy==="record")return dT(e,t);const r=Ee(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||$t(),o=Ee(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||$t();return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function tV(e){const t=e.values,o=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),n=Array.from(new Set(o.map(a=>typeof a)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function rV(){return{not:$t()}}function nV(){return{type:"null"}}var dd={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function oV(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(o=>o._def.typeName in dd&&(!o._def.checks||!o._def.checks.length))){const o=r.reduce((n,a)=>{const i=dd[a._def.typeName];return i&&!n.includes(i)?[...n,i]: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,a)=>{const i=typeof a._def.value;switch(i){case"string":case"number":case"boolean":return[...n,i];case"bigint":return[...n,"integer"];case"object":if(a._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){const n=o.filter((a,i,s)=>s.indexOf(a)===i);return{type:n.length>1?n:n[0],enum:r.reduce((a,i)=>a.includes(i._def.value)?a:[...a,i._def.value],[])}}}else if(r.every(o=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter(a=>!o.includes(a))],[])};return aV(e,t)}var aV=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>Ee(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 iV(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[dd[e.innerType._def.typeName],"null"]};const r=Ee(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function sV(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 cV(e,t){const r={type:"object",properties:{}},o=[],n=e.shape();for(const i in n){let s=n[i];if(s===void 0||s._def===void 0)continue;const c=uV(s),l=Ee(s._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});l!==void 0&&(r.properties[i]=l,c||o.push(i))}o.length&&(r.required=o);const a=lV(e,t);return a!==void 0&&(r.additionalProperties=a),r}function lV(e,t){if(e.catchall._def.typeName!=="ZodNever")return Ee(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 uV(e){try{return e.isOptional()}catch{return!0}}var dV=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return Ee(e.innerType._def,t);const o=Ee(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return o?{anyOf:[{not:$t()},o]}:$t()},mV=(e,t)=>{if(t.pipeStrategy==="input")return Ee(e.in._def,t);if(t.pipeStrategy==="output")return Ee(e.out._def,t);const r=Ee(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=Ee(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter(n=>n!==void 0)}};function fV(e,t){return Ee(e.type._def,t)}function pV(e,t){const o={type:"array",uniqueItems:!0,items:Ee(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 hV(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>Ee(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:Ee(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>Ee(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function gV(){return{not:$t()}}function vV(){return $t()}var yV=(e,t)=>Ee(e.innerType._def,t),bV=(e,t,r)=>{switch(t){case te.ZodString:return uT(e,r);case te.ZodNumber:return sV(e);case te.ZodObject:return cV(e,r);case te.ZodBigInt:return V3(e);case te.ZodBoolean:return Z3();case te.ZodDate:return lT(e,r);case te.ZodUndefined:return gV();case te.ZodNull:return nV();case te.ZodArray:return F3(e,r);case te.ZodUnion:case te.ZodDiscriminatedUnion:return oV(e,r);case te.ZodIntersection:return K3(e,r);case te.ZodTuple:return hV(e,r);case te.ZodRecord:return dT(e,r);case te.ZodLiteral:return Y3(e);case te.ZodEnum:return W3(e);case te.ZodNativeEnum:return tV(e);case te.ZodNullable:return iV(e,r);case te.ZodOptional:return dV(e,r);case te.ZodMap:return eV(e,r);case te.ZodSet:return pV(e,r);case te.ZodLazy:return()=>e.getter()._def;case te.ZodPromise:return fV(e,r);case te.ZodNaN:case te.ZodNever:return rV();case te.ZodEffects:return H3(e,r);case te.ZodAny:return $t();case te.ZodUnknown:return vV();case te.ZodDefault:return G3(e,r);case te.ZodBranded:return cT(e,r);case te.ZodReadonly:return yV(e,r);case te.ZodCatch:return q3(e,r);case te.ZodPipeline:return mV(e,r);case te.ZodFunction:case te.ZodVoid:case te.ZodSymbol:return;default:return(o=>{})()}};function Ee(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!==U3)return c}if(n&&!r){const c=_V(n,t);if(c!==void 0)return c}const a={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,a);const i=bV(e,e.typeName,t),s=typeof i=="function"?Ee(i(),t):i;if(s&&wV(e,t,s),t.postProcess){const c=t.postProcess(s,e,t);return a.jsonSchema=s,c}return a.jsonSchema=s,s}var _V=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:z3(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`),$t()):t.$refStrategy==="seen"?$t():void 0}},wV=(e,t,r)=>(e.description&&(r.description=e.description),r),xV=e=>{const t=L3(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}]))}},SV=(e,t)=>{var r;const o=xV(t);let n=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((l,[u,d])=>{var m;return{...l,[u]:(m=Ee(d._def,{...o,currentPath:[...o.basePath,o.definitionPath,u]},!0))!=null?m:$t()}},{}):void 0;const a=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=Ee(e._def,a===void 0?o:{...o,currentPath:[...o.basePath,o.definitionPath,a]},!1))!=null?r:$t(),s=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;s!==void 0&&(i.title=s);const c=a===void 0?n?{...i,[o.definitionPath]:n}:i:{$ref:[...o.$refStrategy==="relative"?[]:o.basePath,o.definitionPath,a].join("/"),[o.definitionPath]:{...n,[a]:i}};return c.$schema="http://json-schema.org/draft-07/schema#",c},kV=SV;function EV(e,t){var r;const o=(r=void 0)!=null?r:!1;return ap(()=>kV(e,{$refStrategy:o?"root":"none"}),{validate:async n=>{const a=await e.safeParseAsync(n);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function IV(e,t){var r;const o=(r=void 0)!=null?r:!1;return ap(()=>Im(e,{target:"draft-7",io:"output",reused:o?"ref":"inline"}),{validate:async n=>{const a=await Am(e,n);return a.success?{success:!0,value:a.data}:{success:!1,error:a.error}}})}function TV(e){return"_zod"in e}function On(e,t){return TV(e)?IV(e):EV(e)}var md=Symbol.for("vercel.ai.schema");function ap(e,{validate:t}={}){return{[md]:!0,_type:void 0,[Ms]:!0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function $V(e){return typeof e=="object"&&e!==null&&md in e&&e[md]===!0&&"jsonSchema"in e&&"validate"in e}function ho(e){return e==null?ap({properties:{},additionalProperties:!1}):$V(e)?e:typeof e=="function"?e():On(e)}var{btoa:OV,atob:CV}=globalThis;function ip(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=CV(t);return Uint8Array.from(r,o=>o.codePointAt(0))}function fd(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return OV(t)}function AV(e){return e?.replace(/\/$/,"")}function RV(e){return e!=null&&typeof e[Symbol.asyncIterator]=="function"}async function*NV({execute:e,input:t,options:r}){const o=e(t,r);if(RV(o)){let n;for await(const a of o)n=a,yield{type:"preliminary",output:a};yield{type:"final",output:n}}else yield{type:"final",output:await o}}var iu,Hg;function PV(){if(Hg)return iu;Hg=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(u,d)=>{for(var m in d)e(u,m,{get:d[m],enumerable:!0})},a=(u,d,m,f)=>{if(d&&typeof d=="object"||typeof d=="function")for(let g of r(d))!o.call(u,g)&&g!==m&&e(u,g,{get:()=>d[g],enumerable:!(f=t(d,g))||f.enumerable});return u},i=u=>a(e({},"__esModule",{value:!0}),u),s={};n(s,{SYMBOL_FOR_REQ_CONTEXT:()=>c,getContext:()=>l}),iu=i(s);const c=Symbol.for("@vercel/request-context");function l(){return globalThis[c]?.get?.()??{}}return iu}var su,Wg;function jV(){if(Wg)return su;Wg=1;var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,n=(d,m)=>{for(var f in m)e(d,f,{get:m[f],enumerable:!0})},a=(d,m,f,g)=>{if(m&&typeof m=="object"||typeof m=="function")for(let h of r(m))!o.call(d,h)&&h!==f&&e(d,h,{get:()=>m[h],enumerable:!(g=t(m,h))||g.enumerable});return d},i=d=>a(e({},"__esModule",{value:!0}),d),s={};n(s,{getContext:()=>c.getContext,getVercelOidcToken:()=>l,getVercelOidcTokenSync:()=>u}),su=i(s);var c=PV();async function l(){return""}function u(){return""}return su}var mT=jV(),MV="vercel.ai.gateway.error",cu=Symbol.for(MV),Jg,Kg,Ot=class fT extends(Kg=Error,Jg=cu,Kg){constructor({message:t,statusCode:r=500,cause:o}){super(t),this[Jg]=!0,this.statusCode=r,this.cause=o}static isInstance(t){return fT.hasMarker(t)}static hasMarker(t){return typeof t=="object"&&t!==null&&cu in t&&t[cu]===!0}},pT="GatewayAuthenticationError",DV=`vercel.ai.gateway.error.${pT}`,Yg=Symbol.for(DV),Xg,Qg,sp=class hT extends(Qg=Ot,Xg=Yg,Qg){constructor({message:t="Authentication failed",statusCode:r=401,cause:o}={}){super({message:t,statusCode:r,cause:o}),this[Xg]=!0,this.name=pT,this.type="authentication_error"}static isInstance(t){return Ot.hasMarker(t)&&Yg in t}static createContextualError({apiKeyProvided:t,oidcTokenProvided:r,message:o="Authentication failed",statusCode:n=401,cause:a}){let i;return t?i=`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?i=`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`:i=`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 hT({message:i,statusCode:n,cause:a})}},gT="GatewayInvalidRequestError",zV=`vercel.ai.gateway.error.${gT}`,ev=Symbol.for(zV),tv,rv,UV=class extends(rv=Ot,tv=ev,rv){constructor({message:e="Invalid request",statusCode:t=400,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[tv]=!0,this.name=gT,this.type="invalid_request_error"}static isInstance(e){return Ot.hasMarker(e)&&ev in e}},vT="GatewayRateLimitError",LV=`vercel.ai.gateway.error.${vT}`,nv=Symbol.for(LV),ov,av,FV=class extends(av=Ot,ov=nv,av){constructor({message:e="Rate limit exceeded",statusCode:t=429,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[ov]=!0,this.name=vT,this.type="rate_limit_exceeded"}static isInstance(e){return Ot.hasMarker(e)&&nv in e}},yT="GatewayModelNotFoundError",VV=`vercel.ai.gateway.error.${yT}`,iv=Symbol.for(VV),ZV=Co(()=>On(C({modelId:E()}))),sv,cv,bT=class extends(cv=Ot,sv=iv,cv){constructor({message:e="Model not found",statusCode:t=404,modelId:r,cause:o}={}){super({message:e,statusCode:t,cause:o}),this[sv]=!0,this.name=yT,this.type="model_not_found",this.modelId=r}static isInstance(e){return Ot.hasMarker(e)&&iv in e}},_T="GatewayInternalServerError",qV=`vercel.ai.gateway.error.${_T}`,lv=Symbol.for(qV),uv,dv,mv=class extends(dv=Ot,uv=lv,dv){constructor({message:e="Internal server error",statusCode:t=500,cause:r}={}){super({message:e,statusCode:t,cause:r}),this[uv]=!0,this.name=_T,this.type="internal_server_error"}static isInstance(e){return Ot.hasMarker(e)&&lv in e}},wT="GatewayResponseError",BV=`vercel.ai.gateway.error.${wT}`,fv=Symbol.for(BV),pv,hv,GV=class extends(hv=Ot,pv=fv,hv){constructor({message:e="Invalid response from Gateway",statusCode:t=502,response:r,validationError:o,cause:n}={}){super({message:e,statusCode:t,cause:n}),this[pv]=!0,this.name=wT,this.type="response_error",this.response=r,this.validationError=o}static isInstance(e){return Ot.hasMarker(e)&&fv in e}};async function gv({response:e,statusCode:t,defaultMessage:r="Gateway request failed",cause:o,authMethod:n}){const a=await Jt({value:e,schema:HV});if(!a.success)return new GV({message:`Invalid error response format: ${r}`,statusCode:t,response:e,validationError:a.error,cause:o});const i=a.value,s=i.error.type,c=i.error.message;switch(s){case"authentication_error":return sp.createContextualError({apiKeyProvided:n==="api-key",oidcTokenProvided:n==="oidc",statusCode:t,cause:o});case"invalid_request_error":return new UV({message:c,statusCode:t,cause:o});case"rate_limit_exceeded":return new FV({message:c,statusCode:t,cause:o});case"model_not_found":{const l=await Jt({value:i.error.param,schema:ZV});return new bT({message:c,statusCode:t,modelId:l.success?l.value.modelId:void 0,cause:o})}case"internal_server_error":return new mv({message:c,statusCode:t,cause:o});default:return new mv({message:c,statusCode:t,cause:o})}}var HV=Co(()=>On(C({error:C({message:E(),type:E().nullish(),param:ot().nullish(),code:he([E(),G()]).nullish()})})));function gn(e,t){var r;return Ot.isInstance(e)?e:mt.isInstance(e)?gv({response:WV(e),statusCode:(r=e.statusCode)!=null?r:500,defaultMessage:"Gateway request failed",cause:e,authMethod:t}):gv({response:{},statusCode:500,defaultMessage:e instanceof Error?`Gateway request failed: ${e.message}`:"Unknown Gateway error",cause:e,authMethod:t})}function WV(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 xT="ai-gateway-auth-method";async function wa(e){const t=await Jt({value:e[xT],schema:JV});return t.success?t.value:void 0}var JV=Co(()=>On(he([H("api-key"),H("oidc")]))),vv=class{constructor(e){this.config=e}async getAvailableModels(){try{const{value:e}=await qg({url:`${this.config.baseURL}/config`,headers:await Pr(this.config.headers()),successfulResponseHandler:Ds(KV),failedResponseHandler:_a({errorSchema:Ze(),errorToMessage:t=>t}),fetch:this.config.fetch});return e}catch(e){throw await gn(e)}}async getCredits(){try{const e=new URL(this.config.baseURL),{value:t}=await qg({url:`${e.origin}/v1/credits`,headers:await Pr(this.config.headers()),successfulResponseHandler:Ds(YV),failedResponseHandler:_a({errorSchema:Ze(),errorToMessage:r=>r}),fetch:this.config.fetch});return t}catch(e){throw await gn(e)}}},KV=Co(()=>On(C({models:D(C({id:E(),name:E(),description:E().nullish(),pricing:C({input:E(),output:E(),input_cache_read:E().nullish(),input_cache_write:E().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:C({specificationVersion:H("v2"),provider:E(),modelId:E()}),modelType:Sn(["language","embedding","image"]).nullish()}))}))),YV=Co(()=>On(C({balance:E(),total_used:E()}).transform(({balance:e,total_used:t})=>({balance:e,totalUsed:t})))),XV=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 Pr(this.config.headers());try{const{responseHeaders:a,value:i,rawValue:s}=await ud({url:this.getUrl(),headers:cd(n,e.headers,this.getModelConfigHeaders(this.modelId,!1),await Pr(this.config.o11yHeaders)),body:t,successfulResponseHandler:Ds(Ze()),failedResponseHandler:_a({errorSchema:Ze(),errorToMessage:c=>c}),...o&&{abortSignal:o},fetch:this.config.fetch});return{...i,request:{body:t},response:{headers:a,body:s},warnings:r}}catch(a){throw await gn(a,await wa(n))}}async doStream(e){const{args:t,warnings:r}=await this.getArgs(e),{abortSignal:o}=e,n=await Pr(this.config.headers());try{const{value:a,responseHeaders:i}=await ud({url:this.getUrl(),headers:cd(n,e.headers,this.getModelConfigHeaders(this.modelId,!0),await Pr(this.config.o11yHeaders)),body:t,successfulResponseHandler:D3(Ze()),failedResponseHandler:_a({errorSchema:Ze(),errorToMessage:s=>s}),...o&&{abortSignal:o},fetch:this.config.fetch});return{stream:a.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:i}}}catch(a){throw await gn(a,await wa(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),a=Buffer.from(n).toString("base64");o.data=new URL(`data:${o.mediaType||"application/octet-stream"};base64,${a}`)}}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)}}},QV=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 a=await Pr(this.config.headers());try{const{responseHeaders:i,value:s,rawValue:c}=await ud({url:this.getUrl(),headers:cd(a,t??{},this.getModelConfigHeaders(),await Pr(this.config.o11yHeaders)),body:{input:e.length===1?e[0]:e,...o?{providerOptions:o}:{}},successfulResponseHandler:Ds(e9),failedResponseHandler:_a({errorSchema:Ze(),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:i,body:c}}}catch(i){throw await gn(i,await wa(a))}}getUrl(){return`${this.config.baseURL}/embedding-model`}getModelConfigHeaders(){return{"ai-embedding-model-specification-version":"2","ai-model-id":this.modelId}}},e9=Co(()=>On(C({embeddings:D(D(G())),usage:C({tokens:G()}).nullish(),providerMetadata:cr(E(),cr(E(),ot())).optional()})));async function t9(){var e;return(e=mT.getContext().headers)==null?void 0:e["x-vercel-id"]}var r9="2.0.7",n9="0.0.1";function o9(e={}){var t,r;let o=null,n=null;const a=(t=e.metadataCacheRefreshMillis)!=null?t:1e3*60*5;let i=0;const s=(r=AV(e.baseURL))!=null?r:"https://ai-gateway.vercel.sh/v1/ai",c=async()=>{const g=await i9(e);if(g)return pi({Authorization:`Bearer ${g.token}`,"ai-gateway-protocol-version":n9,[xT]:g.authMethod,...e.headers},`ai-sdk/gateway/${r9}`);throw sp.createContextualError({apiKeyProvided:!1,oidcTokenProvided:!1,statusCode:401})},l=()=>{const g=es({settingValue:void 0,environmentVariableName:"VERCEL_DEPLOYMENT_ID"}),h=es({settingValue:void 0,environmentVariableName:"VERCEL_ENV"}),v=es({settingValue:void 0,environmentVariableName:"VERCEL_REGION"});return async()=>{const b=await t9();return{...g&&{"ai-o11y-deployment-id":g},...h&&{"ai-o11y-environment":h},...v&&{"ai-o11y-region":v},...b&&{"ai-o11y-request-id":b}}}},u=g=>new XV(g,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),d=async()=>{var g,h,v;const b=(v=(h=(g=e._internal)==null?void 0:g.currentDate)==null?void 0:h.call(g).getTime())!=null?v:Date.now();return(!o||b-i>a)&&(i=b,o=new vv({baseURL:s,headers:c,fetch:e.fetch}).getAvailableModels().then(w=>(n=w,w)).catch(async w=>{throw await gn(w,await wa(await c()))})),n?Promise.resolve(n):o},m=async()=>new vv({baseURL:s,headers:c,fetch:e.fetch}).getCredits().catch(async g=>{throw await gn(g,await wa(await c()))}),f=function(g){if(new.target)throw new Error("The Gateway Provider model function cannot be called with the new keyword.");return u(g)};return f.getAvailableModels=d,f.getCredits=m,f.imageModel=g=>{throw new hC({modelId:g,modelType:"imageModel"})},f.languageModel=u,f.textEmbeddingModel=g=>new QV(g,{provider:"gateway",baseURL:s,headers:c,fetch:e.fetch,o11yHeaders:l()}),f}var a9=o9();async function i9(e){const t=es({settingValue:e.apiKey,environmentVariableName:"AI_GATEWAY_API_KEY"});if(t)return{token:t,authMethod:"api-key"};try{return{token:await mT.getVercelOidcToken(),authMethod:"oidc"}}catch{return null}}var s9=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},cn="1.9.0",yv=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function c9(e){var t=new Set([e]),r=new Set,o=e.match(yv);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 a(s){return r.add(s),!1}function i(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(yv);if(!l)return a(c);var u={major:+l[1],minor:+l[2],patch:+l[3],prerelease:l[4]};return u.prerelease!=null||n.major!==u.major?a(c):n.major===0?n.minor===u.minor&&n.patch<=u.patch?i(c):a(c):n.minor<=u.minor?i(c):a(c)}}var l9=c9(cn),u9=cn.split(".")[0],xa=Symbol.for("opentelemetry.js.api."+u9),Sa=s9;function cp(e,t,r,o){var n;o===void 0&&(o=!1);var a=Sa[xa]=(n=Sa[xa])!==null&&n!==void 0?n:{version:cn};if(!o&&a[e]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(i.stack||i.message),!1}if(a.version!==cn){var i=new Error("@opentelemetry/api: Registration of version v"+a.version+" for "+e+" does not match previously registered API v"+cn);return r.error(i.stack||i.message),!1}return a[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+cn+"."),!0}function ka(e){var t,r,o=(t=Sa[xa])===null||t===void 0?void 0:t.version;if(!(!o||!l9(o)))return(r=Sa[xa])===null||r===void 0?void 0:r[e]}function lp(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+cn+".");var r=Sa[xa];r&&delete r[e]}var d9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},m9=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))},f9=(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 Bo("debug",this._namespace,t)},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Bo("error",this._namespace,t)},e.prototype.info=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Bo("info",this._namespace,t)},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Bo("warn",this._namespace,t)},e.prototype.verbose=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Bo("verbose",this._namespace,t)},e})();function Bo(e,t,r){var o=ka("diag");if(o)return r.unshift(t),o[e].apply(o,m9([],d9(r),!1))}var xt;(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"})(xt||(xt={}));function p9(e,t){e<xt.NONE?e=xt.NONE:e>xt.ALL&&(e=xt.ALL),t=t||{};function r(o,n){var a=t[o];return typeof a=="function"&&e>=n?a.bind(t):function(){}}return{error:r("error",xt.ERROR),warn:r("warn",xt.WARN),info:r("info",xt.INFO),debug:r("debug",xt.DEBUG),verbose:r("verbose",xt.VERBOSE)}}var h9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},g9=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))},v9="diag",zs=(function(){function e(){function t(n){return function(){for(var a=[],i=0;i<arguments.length;i++)a[i]=arguments[i];var s=ka("diag");if(s)return s[n].apply(s,g9([],h9(a),!1))}}var r=this,o=function(n,a){var i,s,c;if(a===void 0&&(a={logLevel:xt.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((i=l.stack)!==null&&i!==void 0?i:l.message),!1}typeof a=="number"&&(a={logLevel:a});var u=ka("diag"),d=p9((s=a.logLevel)!==null&&s!==void 0?s:xt.INFO,n);if(u&&!a.suppressOverrideMessage){var m=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+m),d.warn("Current logger will overwrite one already registered from "+m)}return cp("diag",d,r,!0)};r.setLogger=o,r.disable=function(){lp(v9,r)},r.createComponentLogger=function(n){return new f9(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 y9(e){return Symbol.for(e)}var b9=(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 a=new e(r._currentContext);return a._currentContext.set(o,n),a},r.deleteValue=function(o){var n=new e(r._currentContext);return n._currentContext.delete(o),n}}return e})(),_9=new b9,w9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},x9=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))},S9=(function(){function e(){}return e.prototype.active=function(){return _9},e.prototype.with=function(t,r,o){for(var n=[],a=3;a<arguments.length;a++)n[a-3]=arguments[a];return r.call.apply(r,x9([o],w9(n),!1))},e.prototype.bind=function(t,r){return r},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),k9=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,a=[],i;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},E9=function(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))},lu="context",I9=new S9,ST=(function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(t){return cp(lu,t,zs.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(t,r,o){for(var n,a=[],i=3;i<arguments.length;i++)a[i-3]=arguments[i];return(n=this._getContextManager()).with.apply(n,E9([t,r,o],k9(a),!1))},e.prototype.bind=function(t,r){return this._getContextManager().bind(t,r)},e.prototype._getContextManager=function(){return ka(lu)||I9},e.prototype.disable=function(){this._getContextManager().disable(),lp(lu,zs.instance())},e})(),pd;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(pd||(pd={}));var kT="0000000000000000",ET="00000000000000000000000000000000",T9={traceId:ET,spanId:kT,traceFlags:pd.NONE},ta=(function(){function e(t){t===void 0&&(t=T9),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})(),up=y9("OpenTelemetry Context Key SPAN");function dp(e){return e.getValue(up)||void 0}function $9(){return dp(ST.getInstance().active())}function mp(e,t){return e.setValue(up,t)}function O9(e){return e.deleteValue(up)}function C9(e,t){return mp(e,new ta(t))}function IT(e){var t;return(t=dp(e))===null||t===void 0?void 0:t.spanContext()}var A9=/^([0-9a-f]{32})$/i,R9=/^[0-9a-f]{16}$/i;function N9(e){return A9.test(e)&&e!==ET}function P9(e){return R9.test(e)&&e!==kT}function TT(e){return N9(e.traceId)&&P9(e.spanId)}function j9(e){return new ta(e)}var uu=ST.getInstance(),$T=(function(){function e(){}return e.prototype.startSpan=function(t,r,o){o===void 0&&(o=uu.active());var n=!!r?.root;if(n)return new ta;var a=o&&IT(o);return M9(a)&&TT(a)?new ta(a):new ta},e.prototype.startActiveSpan=function(t,r,o,n){var a,i,s;if(!(arguments.length<2)){arguments.length===2?s=r:arguments.length===3?(a=r,s=o):(a=r,i=o,s=n);var c=i??uu.active(),l=this.startSpan(t,a,c),u=mp(c,l);return uu.with(u,s,void 0,l)}},e})();function M9(e){return typeof e=="object"&&typeof e.spanId=="string"&&typeof e.traceId=="string"&&typeof e.traceFlags=="number"}var D9=new $T,z9=(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 a=this._getTracer();return Reflect.apply(a.startActiveSpan,a,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):D9},e})(),U9=(function(){function e(){}return e.prototype.getTracer=function(t,r,o){return new $T},e})(),L9=new U9,bv=(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 z9(this,t,r,o)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:L9},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})(),Us;(function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Us||(Us={}));var du="trace",F9=(function(){function e(){this._proxyTracerProvider=new bv,this.wrapSpanContext=j9,this.isSpanContextValid=TT,this.deleteSpan=O9,this.getSpan=dp,this.getActiveSpan=$9,this.getSpanContext=IT,this.setSpan=mp,this.setSpanContext=C9}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(t){var r=cp(du,this._proxyTracerProvider,zs.instance());return r&&this._proxyTracerProvider.setDelegate(t),r},e.prototype.getTracerProvider=function(){return ka(du)||this._proxyTracerProvider},e.prototype.getTracer=function(t,r){return this.getTracerProvider().getTracer(t,r)},e.prototype.disable=function(){lp(du,zs.instance()),this._proxyTracerProvider=new bv},e})(),V9=F9.getInstance(),Z9=Object.defineProperty,q9=(e,t)=>{for(var r in t)Z9(e,r,{get:t[r],enumerable:!0})},OT="AI_NoOutputSpecifiedError",CT=`vercel.ai.error.${OT}`,B9=Symbol.for(CT),AT,G9=class extends X{constructor({message:e="No output specified."}={}){super({name:OT,message:e}),this[AT]=!0}static isInstance(e){return X.hasMarker(e,CT)}};AT=B9;function H9(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 W9="AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.",_v=!1,RT=e=>{if(e.length===0)return;const t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t=="function"){t(e);return}_v||(_v=!0,console.info(W9));for(const r of e)console.warn(H9(r))}},NT="AI_InvalidArgumentError",PT=`vercel.ai.error.${NT}`,J9=Symbol.for(PT),jT,Re=class extends X{constructor({parameter:e,value:t,message:r}){super({name:NT,message:`Invalid argument for parameter ${e}: ${r}`}),this[jT]=!0,this.parameter=e,this.value=t}static isInstance(e){return X.hasMarker(e,PT)}};jT=J9;var MT="AI_InvalidToolInputError",DT=`vercel.ai.error.${MT}`,K9=Symbol.for(DT),zT,UT=class extends X{constructor({toolInput:e,toolName:t,cause:r,message:o=`Invalid input for tool ${t}: ${bo(r)}`}){super({name:MT,message:o,cause:r}),this[zT]=!0,this.toolInput=e,this.toolName=t}static isInstance(e){return X.hasMarker(e,DT)}};zT=K9;var LT="AI_NoObjectGeneratedError",FT=`vercel.ai.error.${LT}`,Y9=Symbol.for(FT),VT,vn=class extends X{constructor({message:e="No object generated.",cause:t,text:r,response:o,usage:n,finishReason:a}){super({name:LT,message:e,cause:t}),this[VT]=!0,this.text=r,this.response=o,this.usage=n,this.finishReason=a}static isInstance(e){return X.hasMarker(e,FT)}};VT=Y9;var ZT="AI_NoOutputGeneratedError",qT=`vercel.ai.error.${ZT}`,X9=Symbol.for(qT),BT,Q9=class extends X{constructor({message:e="No output generated.",cause:t}={}){super({name:ZT,message:e,cause:t}),this[BT]=!0}static isInstance(e){return X.hasMarker(e,qT)}};BT=X9;var GT="AI_NoSuchToolError",HT=`vercel.ai.error.${GT}`,eZ=Symbol.for(HT),WT,hd=class extends X{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:GT,message:r}),this[WT]=!0,this.toolName=e,this.availableTools=t}static isInstance(e){return X.hasMarker(e,HT)}};WT=eZ;var JT="AI_ToolCallRepairError",KT=`vercel.ai.error.${JT}`,tZ=Symbol.for(KT),YT,rZ=class extends X{constructor({cause:e,originalError:t,message:r=`Error repairing tool call: ${bo(e)}`}){super({name:JT,message:r,cause:e}),this[YT]=!0,this.originalError=t}static isInstance(e){return X.hasMarker(e,KT)}};YT=tZ;var nZ=class extends X{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}},XT="AI_InvalidMessageRoleError",QT=`vercel.ai.error.${XT}`,oZ=Symbol.for(QT),e$,aZ=class extends X{constructor({role:e,message:t=`Invalid message role: '${e}'. Must be one of: "system", "user", "assistant", "tool".`}){super({name:XT,message:t}),this[e$]=!0,this.role=e}static isInstance(e){return X.hasMarker(e,QT)}};e$=oZ;var t$="AI_MessageConversionError",r$=`vercel.ai.error.${t$}`,iZ=Symbol.for(r$),n$,sZ=class extends X{constructor({originalMessage:e,message:t}){super({name:t$,message:t}),this[n$]=!0,this.originalMessage=e}static isInstance(e){return X.hasMarker(e,r$)}};n$=iZ;var o$="AI_DownloadError",a$=`vercel.ai.error.${o$}`,cZ=Symbol.for(a$),i$,mu=class extends X{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:o$,message:n,cause:o}),this[i$]=!0,this.url=e,this.statusCode=t,this.statusText=r}static isInstance(e){return X.hasMarker(e,a$)}};i$=cZ;var s$="AI_RetryError",c$=`vercel.ai.error.${s$}`,lZ=Symbol.for(c$),l$,wv=class extends X{constructor({message:e,reason:t,errors:r}){super({name:s$,message:e}),this[l$]=!0,this.reason=t,this.errors=r,this.lastError=r[r.length-1]}static isInstance(e){return X.hasMarker(e,c$)}};l$=lZ;function fp(e){if(typeof e!="string"){if(e.specificationVersion!=="v2")throw new nZ({version:e.specificationVersion,provider:e.provider,modelId:e.modelId});return e}return uZ().languageModel(e)}function uZ(){var e;return(e=globalThis.AI_SDK_DEFAULT_PROVIDER)!=null?e:a9}var dZ=[{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]}],mZ=e=>{const t=typeof e=="string"?ip(e):e,r=(t[6]&127)<<21|(t[7]&127)<<14|(t[8]&127)<<7|t[9]&127;return t.slice(r+10)};function fZ(e){return typeof e=="string"&&e.startsWith("SUQz")||typeof e!="string"&&e.length>10&&e[0]===73&&e[1]===68&&e[2]===51?mZ(e):e}function pZ({data:e,signatures:t}){const r=fZ(e),o=typeof r=="string"?ip(r.substring(0,Math.min(r.length,24))):r;for(const n of t)if(o.length>=n.bytesPrefix.length&&n.bytesPrefix.every((a,i)=>a===null||o[i]===a))return n.mediaType}var u$="5.0.90",hZ=async({url:e})=>{var t;const r=e.toString();try{const o=await fetch(r,{headers:pi({},`ai-sdk/${u$}`,op())});if(!o.ok)throw new mu({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 mu.isInstance(o)?o:new mu({url:r,cause:o})}},gZ=(e=hZ)=>t=>Promise.all(t.map(async r=>r.isUrlSupportedByModel?null:e(r)));function vZ(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 d$=he([E(),co(Uint8Array),co(ArrayBuffer),gf(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]);function m$(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}=vZ(e.toString());if(t==null||r==null)throw new X({name:"InvalidDataContentError",message:`Invalid data URL format in content ${e.toString()}`});return{data:r,mediaType:t}}return{data:e,mediaType:void 0}}function yZ(e){return typeof e=="string"?e:e instanceof ArrayBuffer?fd(new Uint8Array(e)):fd(e)}async function f$({prompt:e,supportedUrls:t,download:r=gZ()}){const o=await _Z(e.messages,r,t);return[...e.system!=null?[{role:"system",content:e.system}]:[],...e.messages.map(n=>bZ({message:n,downloadedAssets:o}))]}function bZ({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=>wZ(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:a,mediaType:i}=m$(o.data);return{type:"file",data:a,filename:o.filename,mediaType:i??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 aZ({role:o})}}}async function _Z(e,t,r){const o=e.filter(a=>a.role==="user").map(a=>a.content).filter(a=>Array.isArray(a)).flat().filter(a=>a.type==="image"||a.type==="file").map(a=>{var i;const s=(i=a.mediaType)!=null?i:a.type==="image"?"image/*":void 0;let c=a.type==="image"?a.image:a.data;if(typeof c=="string")try{c=new URL(c)}catch{}return{mediaType:s,data:c}}).filter(a=>a.data instanceof URL).map(a=>({url:a.data,isUrlSupportedByModel:a.mediaType!=null&&k3({url:a.data.toString(),mediaType:a.mediaType,supportedUrls:r})})),n=await t(o);return Object.fromEntries(n.map((a,i)=>a==null?null:[o[i].url.toString(),{data:a.data,mediaType:a.mediaType}]).filter(a=>a!=null))}function wZ(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:a,mediaType:i}=m$(o);let s=i??e.mediaType,c=a;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=pZ({data:c,signatures:dZ}))!=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 gd({maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:a,seed:i,stopSequences:s}){if(e!=null){if(!Number.isInteger(e))throw new Re({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be an integer"});if(e<1)throw new Re({parameter:"maxOutputTokens",value:e,message:"maxOutputTokens must be >= 1"})}if(t!=null&&typeof t!="number")throw new Re({parameter:"temperature",value:t,message:"temperature must be a number"});if(r!=null&&typeof r!="number")throw new Re({parameter:"topP",value:r,message:"topP must be a number"});if(o!=null&&typeof o!="number")throw new Re({parameter:"topK",value:o,message:"topK must be a number"});if(n!=null&&typeof n!="number")throw new Re({parameter:"presencePenalty",value:n,message:"presencePenalty must be a number"});if(a!=null&&typeof a!="number")throw new Re({parameter:"frequencyPenalty",value:a,message:"frequencyPenalty must be a number"});if(i!=null&&!Number.isInteger(i))throw new Re({parameter:"seed",value:i,message:"seed must be an integer"});return{maxOutputTokens:e,temperature:t,topP:r,topK:o,presencePenalty:n,frequencyPenalty:a,stopSequences:s,seed:i}}function xZ(e){return e!=null&&Object.keys(e).length>0}function SZ({tools:e,toolChoice:t,activeTools:r}){return xZ(e)?{tools:(r!=null?Object.entries(e).filter(([n])=>r.includes(n)):Object.entries(e)).map(([n,a])=>{const i=a.type;switch(i){case void 0:case"dynamic":case"function":return{type:"function",name:n,description:a.description,inputSchema:ho(a.inputSchema).jsonSchema,providerOptions:a.providerOptions};case"provider-defined":return{type:"provider-defined",name:n,id:a.id,args:a.args};default:{const s=i;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 Ea=Vc(()=>he([Pc(),E(),G(),ft(),cr(E(),Ea),D(Ea)])),mr=cr(E(),cr(E(),Ea)),p$=C({type:H("text"),text:E(),providerOptions:mr.optional()}),kZ=C({type:H("image"),image:he([d$,co(URL)]),mediaType:E().optional(),providerOptions:mr.optional()}),h$=C({type:H("file"),data:he([d$,co(URL)]),filename:E().optional(),mediaType:E(),providerOptions:mr.optional()}),EZ=C({type:H("reasoning"),text:E(),providerOptions:mr.optional()}),IZ=C({type:H("tool-call"),toolCallId:E(),toolName:E(),input:ot(),providerOptions:mr.optional(),providerExecuted:ft().optional()}),TZ=Zm("type",[C({type:H("text"),value:E()}),C({type:H("json"),value:Ea}),C({type:H("error-text"),value:E()}),C({type:H("error-json"),value:Ea}),C({type:H("content"),value:D(he([C({type:H("text"),text:E()}),C({type:H("media"),data:E(),mediaType:E()})]))})]),g$=C({type:H("tool-result"),toolCallId:E(),toolName:E(),output:TZ,providerOptions:mr.optional()}),$Z=C({role:H("system"),content:E(),providerOptions:mr.optional()}),OZ=C({role:H("user"),content:he([E(),D(he([p$,kZ,h$]))]),providerOptions:mr.optional()}),CZ=C({role:H("assistant"),content:he([E(),D(he([p$,h$,EZ,IZ,g$]))]),providerOptions:mr.optional()}),AZ=C({role:H("tool"),content:D(g$),providerOptions:mr.optional()}),RZ=he([$Z,OZ,CZ,AZ]);async function v$(e){if(e.prompt==null&&e.messages==null)throw new Nn({prompt:e,message:"prompt or messages must be defined"});if(e.prompt!=null&&e.messages!=null)throw new Nn({prompt:e,message:"prompt and messages cannot be defined at the same time"});if(e.system!=null&&typeof e.system!="string")throw new Nn({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 Nn({prompt:e,message:"prompt or messages must be defined"});if(t.length===0)throw new Nn({prompt:e,message:"messages must not be empty"});const r=await Jt({value:t,schema:D(RZ)});if(!r.success)throw new Nn({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 y$(e){return sp.isInstance(e)||bT.isInstance(e)?new X({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 Ia({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 b$({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((a,[i,s])=>(a[`ai.settings.${i}`]=s,a),{}),...Object.entries((n=r?.metadata)!=null?n:{}).reduce((a,[i,s])=>(a[`ai.telemetry.metadata.${i}`]=s,a),{}),...Object.entries(o??{}).reduce((a,[i,s])=>(s!==void 0&&(a[`ai.request.headers.${i}`]=s),a),{})}}var NZ={startSpan(){return zi},startActiveSpan(e,t,r,o){if(typeof t=="function")return t(zi);if(typeof r=="function")return r(zi);if(typeof o=="function")return o(zi)}},zi={spanContext(){return PZ},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}},PZ={traceId:"",spanId:"",traceFlags:0};function _$({isEnabled:e=!1,tracer:t}={}){return e?t||V9.getTracer("ai"):NZ}function Ta({name:e,tracer:t,attributes:r,fn:o,endWhenDone:n=!0}){return t.startActiveSpan(e,{attributes:r},async a=>{try{const i=await o(a);return n&&a.end(),i}catch(i){try{w$(a,i)}finally{a.end()}throw i}})}function w$(e,t){t instanceof Error?(e.recordException({name:t.name,message:t.message,stack:t.stack}),e.setStatus({code:Us.ERROR,message:t.message})):e.setStatus({code:Us.ERROR})}function ar({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 a=n.input();return a==null?r:{...r,[o]:a}}if(typeof n=="object"&&"output"in n&&typeof n.output=="function"){if(e?.recordOutputs===!1)return r;const a=n.output();return a==null?r:{...r,[o]:a}}return{...r,[o]:n}},{})}function x$(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?yZ(r.data):r.data}:r)})))}function jZ(e,t){return{inputTokens:Go(e.inputTokens,t.inputTokens),outputTokens:Go(e.outputTokens,t.outputTokens),totalTokens:Go(e.totalTokens,t.totalTokens),reasoningTokens:Go(e.reasoningTokens,t.reasoningTokens),cachedInputTokens:Go(e.cachedInputTokens,t.cachedInputTokens)}}function Go(e,t){return e==null&&t==null?void 0:(e??0)+(t??0)}function xv(e){return e===void 0?[]:Array.isArray(e)?e:[e]}function MZ({error:e,exponentialBackoffDelay:t}){const r=e.responseHeaders;if(!r)return t;let o;const n=r["retry-after-ms"];if(n){const i=parseFloat(n);Number.isNaN(i)||(o=i)}const a=r["retry-after"];if(a&&o===void 0){const i=parseFloat(a);Number.isNaN(i)?o=Date.parse(a)-Date.now():o=i*1e3}return o!=null&&!Number.isNaN(o)&&0<=o&&(o<60*1e3||o<t)?o:t}var DZ=({maxRetries:e=2,initialDelayInMs:t=2e3,backoffFactor:r=2,abortSignal:o}={})=>async n=>S$(n,{maxRetries:e,delayInMs:t,backoffFactor:r,abortSignal:o});async function S$(e,{maxRetries:t,delayInMs:r,backoffFactor:o,abortSignal:n},a=[]){try{return await e()}catch(i){if(hn(i)||t===0)throw i;const s=np(i),c=[...a,i],l=c.length;if(l>t)throw new wv({message:`Failed after ${l} attempts. Last error: ${s}`,reason:"maxRetriesExceeded",errors:c});if(i instanceof Error&&mt.isInstance(i)&&i.isRetryable===!0&&l<=t)return await nT(MZ({error:i,exponentialBackoffDelay:r}),{abortSignal:n}),S$(e,{maxRetries:t,delayInMs:o*r,backoffFactor:o,abortSignal:n},c);throw l===1?i:new wv({message:`Failed after ${l} attempts with non-retryable error: '${s}'`,reason:"errorNotRetryable",errors:c})}}function k$({maxRetries:e,abortSignal:t}){if(e!=null){if(!Number.isInteger(e))throw new Re({parameter:"maxRetries",value:e,message:"maxRetries must be an integer"});if(e<0)throw new Re({parameter:"maxRetries",value:e,message:"maxRetries must be >= 0"})}const r=e??2;return{maxRetries:r,retry:DZ({maxRetries:r,abortSignal:t})}}function zZ(e){const t=e.filter(r=>r.type==="text");if(t.length!==0)return t.map(r=>r.text).join("")}var UZ=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=fd(this.uint8ArrayData)),this.base64Data}get uint8Array(){return this.uint8ArrayData==null&&(this.uint8ArrayData=ip(this.base64Data)),this.uint8ArrayData}},LZ=class extends UZ{constructor(e){super(e),this.type="file"}};async function FZ({toolCall:e,tools:t,repairToolCall:r,system:o,messages:n}){try{if(t==null)throw new hd({toolName:e.toolName});try{return await Sv({toolCall:e,tools:t})}catch(a){if(r==null||!(hd.isInstance(a)||UT.isInstance(a)))throw a;let i=null;try{i=await r({toolCall:e,tools:t,inputSchema:({toolName:s})=>{const{inputSchema:c}=t[s];return ho(c).jsonSchema},system:o,messages:n,error:a})}catch(s){throw new rZ({cause:s,originalError:a})}if(i==null)throw a;return await Sv({toolCall:i,tools:t})}}catch(a){const i=await qr({text:e.input}),s=i.success?i.value:e.input;return{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:s,dynamic:!0,invalid:!0,error:a}}}async function Sv({toolCall:e,tools:t}){const r=e.toolName,o=t[r];if(o==null)throw new hd({toolName:e.toolName,availableTools:Object.keys(t)});const n=ho(o.inputSchema),a=e.input.trim()===""?await Jt({value:{},schema:n}):await qr({text:e.input,schema:n});if(a.success===!1)throw new UT({toolName:r,toolInput:e.input,cause:a.error});return o.type==="dynamic"?{type:"tool-call",toolCallId:e.toolCallId,toolName:e.toolName,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,dynamic:!0}:{type:"tool-call",toolCallId:e.toolCallId,toolName:r,input:a.value,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata}}var VZ=class{constructor({content:e,finishReason:t,usage:r,warnings:o,request:n,response:a,providerMetadata:i}){this.content=e,this.finishReason=t,this.usage=r,this.warnings=o,this.request=n,this.response=a,this.providerMetadata=i}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 E$(e){return({steps:t})=>t.length===e}async function ZZ({stopConditions:e,steps:t}){return(await Promise.all(e.map(r=>r({steps:t})))).some(r=>r)}function ra({output:e,tool:t,errorMode:r}){return r==="text"?{type:"error-text",value:bo(e)}:r==="json"?{type:"error-json",value:kv(e)}:t?.toModelOutput?t.toModelOutput(e):typeof e=="string"?{type:"text",value:e}:{type:"json",value:kv(e)}}function kv(e){return e===void 0?null:e}function Ev({content:e,tools:t}){const r=[],o=e.filter(a=>a.type!=="source").filter(a=>(a.type!=="tool-result"||a.providerExecuted)&&(a.type!=="tool-error"||a.providerExecuted)).filter(a=>a.type!=="text"||a.text.length>0).map(a=>{switch(a.type){case"text":return{type:"text",text:a.text,providerOptions:a.providerMetadata};case"reasoning":return{type:"reasoning",text:a.text,providerOptions:a.providerMetadata};case"file":return{type:"file",data:a.file.base64,mediaType:a.file.mediaType,providerOptions:a.providerMetadata};case"tool-call":return{type:"tool-call",toolCallId:a.toolCallId,toolName:a.toolName,input:a.input,providerExecuted:a.providerExecuted,providerOptions:a.providerMetadata};case"tool-result":return{type:"tool-result",toolCallId:a.toolCallId,toolName:a.toolName,output:ra({tool:t?.[a.toolName],output:a.output,errorMode:"none"}),providerExecuted:!0,providerOptions:a.providerMetadata};case"tool-error":return{type:"tool-result",toolCallId:a.toolCallId,toolName:a.toolName,output:ra({tool:t?.[a.toolName],output:a.error,errorMode:"json"}),providerOptions:a.providerMetadata}}});o.length>0&&r.push({role:"assistant",content:o});const n=e.filter(a=>a.type==="tool-result"||a.type==="tool-error").filter(a=>!a.providerExecuted).map(a=>({type:"tool-result",toolCallId:a.toolCallId,toolName:a.toolName,output:ra({tool:t?.[a.toolName],output:a.type==="tool-result"?a.output:a.error,errorMode:a.type==="tool-error"?"text":"none"})}));return n.length>0&&r.push({role:"tool",content:n}),r}fi({prefix:"aitxt",size:24});function hi(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 qZ({status:e,statusText:t,headers:r,textStream:o}){return new Response(o.pipeThrough(new TextEncoderStream),{status:e??200,statusText:t,headers:hi(r,{"content-type":"text/plain; charset=utf-8"})})}function I$({response:e,status:t,statusText:r,headers:o,stream:n}){e.writeHead(t??200,r,o);const a=n.getReader();(async()=>{try{for(;;){const{done:s,value:c}=await a.read();if(s)break;e.write(c)||await new Promise(u=>{e.once("drain",u)})}}catch(s){throw s}finally{e.end()}})()}function BZ({response:e,status:t,statusText:r,headers:o,textStream:n}){I$({response:e,status:t,statusText:r,headers:Object.fromEntries(hi(o,{"content-type":"text/plain; charset=utf-8"}).entries()),stream:n.pipeThrough(new TextEncoderStream)})}var T$=class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
87
-
88
- `)},flush(e){e.enqueue(`data: [DONE]
89
-
90
- `)}})}},$$={"content-type":"text/event-stream","cache-control":"no-cache",connection:"keep-alive","x-vercel-ai-ui-message-stream":"v1","x-accel-buffering":"no"};function GZ({status:e,statusText:t,headers:r,stream:o,consumeSseStream:n}){let a=o.pipeThrough(new T$);if(n){const[i,s]=a.tee();a=i,n({stream:s})}return new Response(a.pipeThrough(new TextEncoderStream),{status:e,statusText:t,headers:hi(r,$$)})}function HZ({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 WZ(e){return e.type.startsWith("data-")}function O$(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 a=o in e?e[o]:void 0,i=n!==null&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof RegExp),s=a!=null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);i&&s?r[o]=O$(a,n):r[o]=n}return r}function JZ(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 a(c,l){switch(c){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=l,t.pop();break}}}function i(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":{a(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"&&i(l,c),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,c);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(l,c);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(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"?a(l,c):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(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 C$(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await qr({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await qr({text:JZ(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}function fu(e){return e.type.startsWith("data-")}function pu(e){return e.type==="text"}function hu(e){return e.type==="file"}function Iv(e){return e.type==="reasoning"}function Jn(e){return e.type.startsWith("tool-")}function pp(e){return e.type==="dynamic-tool"}function Tv(e){return Jn(e)||pp(e)}function Ls(e){return e.type.split("-").slice(1).join("-")}function KZ(e){return pp(e)?e.toolName:Ls(e)}function YZ({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function XZ({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:o,onError:n,onToolCall:a,onData:i}){return e.pipeThrough(new TransformStream({async transform(s,c){await o(async({state:l,write:u})=>{var d,m,f,g;function h(y){const k=l.message.parts.filter(Jn).find(T=>T.toolCallId===y);if(k==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return k}function v(y){const k=l.message.parts.filter(T=>T.type==="dynamic-tool").find(T=>T.toolCallId===y);if(k==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return k}function b(y){var S;const k=l.message.parts.find(U=>Jn(U)&&U.toolCallId===y.toolCallId),T=y,A=k;k!=null?(k.state=y.state,A.input=T.input,A.output=T.output,A.errorText=T.errorText,A.rawInput=T.rawInput,A.preliminary=T.preliminary,A.providerExecuted=(S=T.providerExecuted)!=null?S:k.providerExecuted,T.providerMetadata!=null&&k.state==="input-available"&&(k.callProviderMetadata=T.providerMetadata)):l.message.parts.push({type:`tool-${y.toolName}`,toolCallId:y.toolCallId,state:y.state,input:T.input,output:T.output,rawInput:T.rawInput,errorText:T.errorText,providerExecuted:T.providerExecuted,preliminary:T.preliminary,...T.providerMetadata!=null?{callProviderMetadata:T.providerMetadata}:{}})}function w(y){var S,k;const T=l.message.parts.find(L=>L.type==="dynamic-tool"&&L.toolCallId===y.toolCallId),A=y,U=T;T!=null?(T.state=y.state,U.toolName=y.toolName,U.input=A.input,U.output=A.output,U.errorText=A.errorText,U.rawInput=(S=A.rawInput)!=null?S:U.rawInput,U.preliminary=A.preliminary,U.providerExecuted=(k=A.providerExecuted)!=null?k:T.providerExecuted,A.providerMetadata!=null&&T.state==="input-available"&&(T.callProviderMetadata=A.providerMetadata)):l.message.parts.push({type:"dynamic-tool",toolName:y.toolName,toolCallId:y.toolCallId,state:y.state,input:A.input,output:A.output,errorText:A.errorText,preliminary:A.preliminary,providerExecuted:A.providerExecuted,...A.providerMetadata!=null?{callProviderMetadata:A.providerMetadata}:{}})}async function x(y){if(y!=null){const S=l.message.metadata!=null?O$(l.message.metadata,y):y;t!=null&&await ld({value:S,schema:t}),l.message.metadata=S}}switch(s.type){case"text-start":{const y={type:"text",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeTextParts[s.id]=y,l.message.parts.push(y),u();break}case"text-delta":{const y=l.activeTextParts[s.id];y.text+=s.delta,y.providerMetadata=(d=s.providerMetadata)!=null?d:y.providerMetadata,u();break}case"text-end":{const y=l.activeTextParts[s.id];y.state="done",y.providerMetadata=(m=s.providerMetadata)!=null?m:y.providerMetadata,delete l.activeTextParts[s.id],u();break}case"reasoning-start":{const y={type:"reasoning",text:"",providerMetadata:s.providerMetadata,state:"streaming"};l.activeReasoningParts[s.id]=y,l.message.parts.push(y),u();break}case"reasoning-delta":{const y=l.activeReasoningParts[s.id];y.text+=s.delta,y.providerMetadata=(f=s.providerMetadata)!=null?f:y.providerMetadata,u();break}case"reasoning-end":{const y=l.activeReasoningParts[s.id];y.providerMetadata=(g=s.providerMetadata)!=null?g:y.providerMetadata,y.state="done",delete l.activeReasoningParts[s.id],u();break}case"file":{l.message.parts.push({type:"file",mediaType:s.mediaType,url:s.url}),u();break}case"source-url":{l.message.parts.push({type:"source-url",sourceId:s.sourceId,url:s.url,title:s.title,providerMetadata:s.providerMetadata}),u();break}case"source-document":{l.message.parts.push({type:"source-document",sourceId:s.sourceId,mediaType:s.mediaType,title:s.title,filename:s.filename,providerMetadata:s.providerMetadata}),u();break}case"tool-input-start":{const y=l.message.parts.filter(Jn);l.partialToolCalls[s.toolCallId]={text:"",toolName:s.toolName,index:y.length,dynamic:s.dynamic},s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"input-streaming",input:void 0,providerExecuted:s.providerExecuted}),u();break}case"tool-input-delta":{const y=l.partialToolCalls[s.toolCallId];y.text+=s.inputTextDelta;const{value:S}=await C$(y.text);y.dynamic?w({toolCallId:s.toolCallId,toolName:y.toolName,state:"input-streaming",input:S}):b({toolCallId:s.toolCallId,toolName:y.toolName,state:"input-streaming",input:S}),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(),a&&!s.providerExecuted&&await a({toolCall:s});break}case"tool-input-error":{s.dynamic?w({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}):b({toolCallId:s.toolCallId,toolName:s.toolName,state:"output-error",input:void 0,rawInput:s.input,errorText:s.errorText,providerExecuted:s.providerExecuted,providerMetadata:s.providerMetadata}),u();break}case"tool-output-available":{if(s.dynamic){const y=v(s.toolCallId);w({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-available",input:y.input,output:s.output,preliminary:s.preliminary})}else{const y=h(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Ls(y),state:"output-available",input:y.input,output:s.output,providerExecuted:s.providerExecuted,preliminary:s.preliminary})}u();break}case"tool-output-error":{if(s.dynamic){const y=v(s.toolCallId);w({toolCallId:s.toolCallId,toolName:y.toolName,state:"output-error",input:y.input,errorText:s.errorText,providerExecuted:s.providerExecuted})}else{const y=h(s.toolCallId);b({toolCallId:s.toolCallId,toolName:Ls(y),state:"output-error",input:y.input,rawInput:y.rawInput,errorText:s.errorText,providerExecuted:s.providerExecuted})}u();break}case"start-step":{l.message.parts.push({type:"step-start"});break}case"finish-step":{l.activeTextParts={},l.activeReasoningParts={};break}case"start":{s.messageId!=null&&(l.message.id=s.messageId),await 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(WZ(s)){r?.[s.type]!=null&&await ld({value:s.data,schema:r[s.type]});const y=s;if(y.transient){i?.(y);break}const S=y.id!=null?l.message.parts.find(k=>y.type===k.type&&y.id===k.id):void 0;S!=null?S.data=y.data:l.message.parts.push(y),i?.(y),u()}}c.enqueue(s)})}}))}function A$({messageId:e,originalMessages:t=[],onFinish:r,onError:o,stream:n}){let a=t?.[t.length-1];a?.role!=="assistant"?a=void 0:e=a.id;let i=!1;const s=n.pipeThrough(new TransformStream({transform(m,f){if(m.type==="start"){const g=m;g.messageId==null&&e!=null&&(g.messageId=e)}m.type==="abort"&&(i=!0),f.enqueue(m)}}));if(r==null)return s;const c=YZ({lastMessage:a?structuredClone(a):void 0,messageId:e??""}),l=async m=>{await m({state:c,write:()=>{}})};let u=!1;const d=async()=>{if(u||!r)return;u=!0;const m=c.message.id===a?.id;await r({isAborted:i,isContinuation:m,responseMessage:c.message,messages:[...m?t.slice(0,-1):t,c.message]})};return XZ({stream:s,runUpdateMessageJob:l,onError:o}).pipeThrough(new TransformStream({transform(m,f){f.enqueue(m)},async cancel(){await d()},async flush(){await d()}}))}function QZ({response:e,status:t,statusText:r,headers:o,stream:n,consumeSseStream:a}){let i=n.pipeThrough(new T$);if(a){const[s,c]=i.tee();i=s,a({stream:c})}I$({response:e,status:t,statusText:r,headers:Object.fromEntries(hi(o,$$).entries()),stream:i.pipeThrough(new TextEncoderStream)})}function Ko(e){const t=e.pipeThrough(new TransformStream);return t[Symbol.asyncIterator]=function(){const r=this.getReader();let o=!1;async function n(a){var i;o=!0;try{a&&await((i=r.cancel)==null?void 0:i.call(r))}finally{try{r.releaseLock()}catch{}}}return{async next(){if(o)return{done:!0,value:void 0};const{done:a,value:i}=await r.read();return a?(await n(!0),{done:!0,value:void 0}):{done:!1,value:i}},async return(){return await n(!0),{done:!0,value:void 0}},async throw(a){throw await n(!0),a}}},t}async function eq({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 $v(){let e,t;return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function tq(){let e=[],t=null,r=!1,o=$v();const n=()=>{r=!0,o.resolve(),e.forEach(i=>i.cancel()),e=[],t?.close()},a=async()=>{if(r&&e.length===0){t?.close();return}if(e.length===0)return o=$v(),await o.promise,a();try{const{value:i,done:s}=await e[0].read();s?(e.shift(),e.length>0?await a():r&&t?.close()):t?.enqueue(i)}catch(i){t?.error(i),e.shift(),n()}};return{stream:new ReadableStream({start(i){t=i},pull:a,async cancel(){for(const i of e)await i.cancel();e=[],r=!0}}),addStream:i=>{if(r)throw new Error("Cannot add inner stream: outer stream is closed");e.push(i.getReader()),o.resolve()},close:()=>{r=!0,o.resolve(),e.length===0&&t?.close()},terminate:n}}var Ui=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 rq(){var e,t;return(t=(e=globalThis?.performance)==null?void 0:e.now())!=null?t:Date.now()}function nq({tools:e,generatorStream:t,tracer:r,telemetry:o,system:n,messages:a,abortSignal:i,repairToolCall:s,experimental_context:c}){let l=null;const u=new ReadableStream({start(b){l=b}}),d=new Set,m=new Map;let f=!1,g;function h(){f&&d.size===0&&(g!=null&&l.enqueue(g),l.close())}const v=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 LZ({data:b.data,mediaType:b.mediaType})});break}case"finish":{g={type:"finish",finishReason:b.finishReason,usage:b.usage,providerMetadata:b.providerMetadata};break}case"tool-call":{try{const y=await FZ({toolCall:b,tools:e,repairToolCall:s,system:n,messages:a});if(w.enqueue(y),y.invalid){l.enqueue({type:"tool-error",toolCallId:y.toolCallId,toolName:y.toolName,input:y.input,error:np(y.error),dynamic:!0});break}const S=e[y.toolName];if(m.set(y.toolCallId,y.input),S.onInputAvailable!=null&&await S.onInputAvailable({input:y.input,toolCallId:y.toolCallId,messages:a,abortSignal:i,experimental_context:c}),S.execute!=null&&y.providerExecuted!==!0){const k=oT();d.add(k),Ta({name:"ai.toolCall",attributes:ar({telemetry:o,attributes:{...Ia({operationId:"ai.toolCall",telemetry:o}),"ai.toolCall.name":y.toolName,"ai.toolCall.id":y.toolCallId,"ai.toolCall.args":{output:()=>JSON.stringify(y.input)}}}),tracer:r,fn:async T=>{let A;try{const U=NV({execute:S.execute.bind(S),input:y.input,options:{toolCallId:y.toolCallId,messages:a,abortSignal:i,experimental_context:c}});for await(const L of U)l.enqueue({...y,type:"tool-result",output:L.output,...L.type==="preliminary"&&{preliminary:!0}}),L.type==="final"&&(A=L.output)}catch(U){w$(T,U),l.enqueue({...y,type:"tool-error",error:U}),d.delete(k),h();return}d.delete(k),h();try{T.setAttributes(ar({telemetry:o,attributes:{"ai.toolCall.result":{output:()=>JSON.stringify(A)}}}))}catch{}}})}}catch(y){l.enqueue({type:"error",error:y})}break}case"tool-result":{const y=b.toolName;b.isError?l.enqueue({type:"tool-error",toolCallId:b.toolCallId,toolName:y,input:m.get(b.toolCallId),providerExecuted:b.providerExecuted,error:b.result}):w.enqueue({type:"tool-result",toolCallId:b.toolCallId,toolName:y,input:m.get(b.toolCallId),output:b.result,providerExecuted:b.providerExecuted});break}default:{const y=x;throw new Error(`Unhandled chunk type: ${y}`)}}},flush(){f=!0,h()}});return new ReadableStream({async start(b){return Promise.all([t.pipeThrough(v).pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){}})),u.pipeTo(new WritableStream({write(w){b.enqueue(w)},close(){b.close()}}))])}})}var oq=fi({prefix:"aitxt",size:24});function aq({model:e,tools:t,toolChoice:r,system:o,prompt:n,messages:a,maxRetries:i,abortSignal:s,headers:c,stopWhen:l=E$(1),experimental_output:u,experimental_telemetry:d,prepareStep:m,providerOptions:f,experimental_activeTools:g,activeTools:h=g,experimental_repairToolCall:v,experimental_transform:b,experimental_download:w,includeRawChunks:x=!1,onChunk:y,onError:S=({error:z})=>{console.error(z)},onFinish:k,onAbort:T,onStepFinish:A,experimental_context:U,_internal:{now:L=rq,generateId:W=oq,currentDate:fe=()=>new Date}={},...q}){return new sq({model:fp(e),telemetry:d,headers:c,settings:q,maxRetries:i,abortSignal:s,system:o,prompt:n,messages:a,tools:t,toolChoice:r,transforms:xv(b),activeTools:h,repairToolCall:v,stopConditions:xv(l),output:u,providerOptions:f,prepareStep:m,includeRawChunks:x,onChunk:y,onError:S,onFinish:k,onAbort:T,onStepFinish:A,now:L,currentDate:fe,generateId:W,experimental_context:U,download:w})}function iq(e){if(!e)return new TransformStream({transform(i,s){s.enqueue({part:i,partialOutput:void 0})}});let t,r="",o="",n="";function a({controller:i,partialOutput:s=void 0}){i.enqueue({part:{type:"text-delta",id:t,text:o},partialOutput:s}),o=""}return new TransformStream({async transform(i,s){if(i.type==="finish-step"&&o.length>0&&a({controller:s}),i.type!=="text-delta"&&i.type!=="text-start"&&i.type!=="text-end"){s.enqueue({part:i,partialOutput:void 0});return}if(t==null)t=i.id;else if(i.id!==t){s.enqueue({part:i,partialOutput:void 0});return}if(i.type==="text-start"){s.enqueue({part:i,partialOutput:void 0});return}if(i.type==="text-end"){o.length>0&&a({controller:s}),s.enqueue({part:i,partialOutput:void 0});return}r+=i.text,o+=i.text;const c=await e.parsePartial({text:r});if(c!=null){const l=JSON.stringify(c.partial);l!==n&&(a({controller:s,partialOutput:c.partial}),n=l)}}})}var sq=class{constructor({model:e,telemetry:t,headers:r,settings:o,maxRetries:n,abortSignal:a,system:i,prompt:s,messages:c,tools:l,toolChoice:u,transforms:d,activeTools:m,repairToolCall:f,stopConditions:g,output:h,providerOptions:v,prepareStep:b,includeRawChunks:w,now:x,currentDate:y,generateId:S,onChunk:k,onError:T,onFinish:A,onAbort:U,onStepFinish:L,experimental_context:W,download:fe}){this._totalUsage=new Ui,this._finishReason=new Ui,this._steps=new Ui,this.output=h,this.includeRawChunks=w,this.tools=l;let q,z=[];const ve=[];let ee,J,B={},ae=[];const F=[];let _e,ue={},Ie={};const P=new TransformStream({async transform(je,me){var Ce,ye,wt,No;me.enqueue(je);const{part:Z}=je;if((Z.type==="text-delta"||Z.type==="reasoning-delta"||Z.type==="source"||Z.type==="tool-call"||Z.type==="tool-result"||Z.type==="tool-input-start"||Z.type==="tool-input-delta"||Z.type==="raw")&&await k?.({chunk:Z}),Z.type==="error"&&await T({error:y$(Z.error)}),Z.type==="text-start"&&(ue[Z.id]={type:"text",text:"",providerMetadata:Z.providerMetadata},z.push(ue[Z.id])),Z.type==="text-delta"){const Me=ue[Z.id];if(Me==null){me.enqueue({part:{type:"error",error:`text part ${Z.id} not found`},partialOutput:void 0});return}Me.text+=Z.text,Me.providerMetadata=(Ce=Z.providerMetadata)!=null?Ce:Me.providerMetadata}if(Z.type==="text-end"){const Me=ue[Z.id];if(Me==null){me.enqueue({part:{type:"error",error:`text part ${Z.id} not found`},partialOutput:void 0});return}Me.providerMetadata=(ye=Z.providerMetadata)!=null?ye:Me.providerMetadata,delete ue[Z.id]}if(Z.type==="reasoning-start"&&(Ie[Z.id]={type:"reasoning",text:"",providerMetadata:Z.providerMetadata},z.push(Ie[Z.id])),Z.type==="reasoning-delta"){const Me=Ie[Z.id];if(Me==null){me.enqueue({part:{type:"error",error:`reasoning part ${Z.id} not found`},partialOutput:void 0});return}Me.text+=Z.text,Me.providerMetadata=(wt=Z.providerMetadata)!=null?wt:Me.providerMetadata}if(Z.type==="reasoning-end"){const Me=Ie[Z.id];if(Me==null){me.enqueue({part:{type:"error",error:`reasoning part ${Z.id} not found`},partialOutput:void 0});return}Me.providerMetadata=(No=Z.providerMetadata)!=null?No:Me.providerMetadata,delete Ie[Z.id]}if(Z.type==="file"&&z.push({type:"file",file:Z.file}),Z.type==="source"&&z.push(Z),Z.type==="tool-call"&&z.push(Z),Z.type==="tool-result"&&!Z.preliminary&&z.push(Z),Z.type==="tool-error"&&z.push(Z),Z.type==="start-step"&&(B=Z.request,ae=Z.warnings),Z.type==="finish-step"){const Me=Ev({content:z,tools:l}),Po=new VZ({content:z,finishReason:Z.finishReason,usage:Z.usage,warnings:ae,request:B,response:{...Z.response,messages:[...ve,...Me]},providerMetadata:Z.providerMetadata});await L?.(Po),RT(ae),F.push(Po),z=[],Ie={},ue={},ve.push(...Me),q.resolve()}Z.type==="finish"&&(J=Z.totalUsage,ee=Z.finishReason)},async flush(je){try{if(F.length===0){const wt=new Q9({message:"No output generated. Check the stream for errors."});Ue._finishReason.reject(wt),Ue._totalUsage.reject(wt),Ue._steps.reject(wt);return}const me=ee??"unknown",Ce=J??{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};Ue._finishReason.resolve(me),Ue._totalUsage.resolve(Ce),Ue._steps.resolve(F);const ye=F[F.length-1];await A?.({finishReason:me,totalUsage:Ce,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:F}),_e.setAttributes(ar({telemetry:t,attributes:{"ai.response.finishReason":me,"ai.response.text":{output:()=>ye.text},"ai.response.toolCalls":{output:()=>{var wt;return(wt=ye.toolCalls)!=null&&wt.length?JSON.stringify(ye.toolCalls):void 0}},"ai.response.providerMetadata":JSON.stringify(ye.providerMetadata),"ai.usage.inputTokens":Ce.inputTokens,"ai.usage.outputTokens":Ce.outputTokens,"ai.usage.totalTokens":Ce.totalTokens,"ai.usage.reasoningTokens":Ce.reasoningTokens,"ai.usage.cachedInputTokens":Ce.cachedInputTokens}}))}catch(me){je.error(me)}finally{_e.end()}}}),V=tq();this.addStream=V.addStream,this.closeStream=V.close;const le=V.stream.getReader();let we=new ReadableStream({async start(je){je.enqueue({type:"start"})},async pull(je){function me(){U?.({steps:F}),je.enqueue({type:"abort"}),je.close()}try{const{done:Ce,value:ye}=await le.read();if(Ce){je.close();return}if(a?.aborted){me();return}je.enqueue(ye)}catch(Ce){hn(Ce)&&a?.aborted?me():je.error(Ce)}},cancel(je){return V.stream.cancel(je)}});for(const je of d)we=we.pipeThrough(je({tools:l,stopStream(){V.terminate()}}));this.baseStream=we.pipeThrough(iq(h)).pipeThrough(P);const{maxRetries:ge,retry:er}=k$({maxRetries:n,abortSignal:a}),Lt=_$(t),gt=gd(o),Yr=b$({model:e,telemetry:t,headers:r,settings:{...gt,maxRetries:ge}}),Ue=this;Ta({name:"ai.streamText",attributes:ar({telemetry:t,attributes:{...Ia({operationId:"ai.streamText",telemetry:t}),...Yr,"ai.prompt":{input:()=>JSON.stringify({system:i,prompt:s,messages:c})}}}),tracer:Lt,endWhenDone:!1,fn:async je=>{_e=je;async function me({currentStep:Ce,responseMessages:ye,usage:wt}){var No,Z,Me,Po,Hp;const Wp=Ue.includeRawChunks;q=new Ui;const Jp=await v$({system:i,prompt:s,messages:c}),jo=[...Jp.messages,...ye],tr=await b?.({model:e,steps:F,stepNumber:F.length,messages:jo}),Cn=fp((No=tr?.model)!=null?No:e),Kp=await f$({prompt:{system:(Z=tr?.system)!=null?Z:Jp.system,messages:(Me=tr?.messages)!=null?Me:jo},supportedUrls:await Cn.supportedUrls,download:fe}),{toolChoice:kl,tools:El}=SZ({tools:l,toolChoice:(Po=tr?.toolChoice)!=null?Po:u,activeTools:(Hp=tr?.activeTools)!=null?Hp:m}),{result:{stream:RO,response:Yp,request:Xp},doStreamSpan:An,startTimestampMs:Qp}=await er(()=>Ta({name:"ai.streamText.doStream",attributes:ar({telemetry:t,attributes:{...Ia({operationId:"ai.streamText.doStream",telemetry:t}),...Yr,"ai.model.provider":Cn.provider,"ai.model.id":Cn.modelId,"ai.prompt.messages":{input:()=>x$(Kp)},"ai.prompt.tools":{input:()=>El?.map(K=>JSON.stringify(K))},"ai.prompt.toolChoice":{input:()=>kl!=null?JSON.stringify(kl):void 0},"gen_ai.system":Cn.provider,"gen_ai.request.model":Cn.modelId,"gen_ai.request.frequency_penalty":gt.frequencyPenalty,"gen_ai.request.max_tokens":gt.maxOutputTokens,"gen_ai.request.presence_penalty":gt.presencePenalty,"gen_ai.request.stop_sequences":gt.stopSequences,"gen_ai.request.temperature":gt.temperature,"gen_ai.request.top_k":gt.topK,"gen_ai.request.top_p":gt.topP}}),tracer:Lt,endWhenDone:!1,fn:async K=>({startTimestampMs:x(),doStreamSpan:K,result:await Cn.doStream({...gt,tools:El,toolChoice:kl,responseFormat:h?.responseFormat,prompt:Kp,providerOptions:v,abortSignal:a,headers:r,includeRawChunks:Wp})})})),NO=nq({tools:l,generatorStream:RO,tracer:Lt,telemetry:t,system:i,messages:jo,repairToolCall:f,abortSignal:a,experimental_context:W}),PO=Xp??{},Si=[],Il=[];let Tl;const $l={};let Rn="unknown",Ft={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0},Ol,eh=!0,rr={id:S(),timestamp:y(),modelId:e.modelId},th="";Ue.addStream(NO.pipeThrough(new TransformStream({async transform(K,Je){var Mo,Do,ki,pr;if(K.type==="stream-start"){Tl=K.warnings;return}if(eh){const it=x()-Qp;eh=!1,An.addEvent("ai.stream.firstChunk",{"ai.response.msToFirstChunk":it}),An.setAttributes({"ai.response.msToFirstChunk":it}),Je.enqueue({type:"start-step",request:PO,warnings:Tl??[]})}const rh=K.type;switch(rh){case"text-start":case"text-end":{Je.enqueue(K);break}case"text-delta":{K.delta.length>0&&(Je.enqueue({type:"text-delta",id:K.id,text:K.delta,providerMetadata:K.providerMetadata}),th+=K.delta);break}case"reasoning-start":case"reasoning-end":{Je.enqueue(K);break}case"reasoning-delta":{Je.enqueue({type:"reasoning-delta",id:K.id,text:K.delta,providerMetadata:K.providerMetadata});break}case"tool-call":{Je.enqueue(K),Si.push(K);break}case"tool-result":{Je.enqueue(K),K.preliminary||Il.push(K);break}case"tool-error":{Je.enqueue(K),Il.push(K);break}case"response-metadata":{rr={id:(Mo=K.id)!=null?Mo:rr.id,timestamp:(Do=K.timestamp)!=null?Do:rr.timestamp,modelId:(ki=K.modelId)!=null?ki:rr.modelId};break}case"finish":{Ft=K.usage,Rn=K.finishReason,Ol=K.providerMetadata;const it=x()-Qp;An.addEvent("ai.stream.finish"),An.setAttributes({"ai.response.msToFinish":it,"ai.response.avgOutputTokensPerSecond":1e3*((pr=Ft.outputTokens)!=null?pr:0)/it});break}case"file":{Je.enqueue(K);break}case"source":{Je.enqueue(K);break}case"tool-input-start":{$l[K.id]=K.toolName;const it=l?.[K.toolName];it?.onInputStart!=null&&await it.onInputStart({toolCallId:K.id,messages:jo,abortSignal:a,experimental_context:W}),Je.enqueue({...K,dynamic:it?.type==="dynamic"});break}case"tool-input-end":{delete $l[K.id],Je.enqueue(K);break}case"tool-input-delta":{const it=$l[K.id],Cl=l?.[it];Cl?.onInputDelta!=null&&await Cl.onInputDelta({inputTextDelta:K.delta,toolCallId:K.id,messages:jo,abortSignal:a,experimental_context:W}),Je.enqueue(K);break}case"error":{Je.enqueue(K),Rn="error";break}case"raw":{Wp&&Je.enqueue(K);break}default:{const it=rh;throw new Error(`Unknown chunk type: ${it}`)}}},async flush(K){const Je=Si.length>0?JSON.stringify(Si):void 0;try{An.setAttributes(ar({telemetry:t,attributes:{"ai.response.finishReason":Rn,"ai.response.text":{output:()=>th},"ai.response.toolCalls":{output:()=>Je},"ai.response.id":rr.id,"ai.response.model":rr.modelId,"ai.response.timestamp":rr.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(Ol),"ai.usage.inputTokens":Ft.inputTokens,"ai.usage.outputTokens":Ft.outputTokens,"ai.usage.totalTokens":Ft.totalTokens,"ai.usage.reasoningTokens":Ft.reasoningTokens,"ai.usage.cachedInputTokens":Ft.cachedInputTokens,"gen_ai.response.finish_reasons":[Rn],"gen_ai.response.id":rr.id,"gen_ai.response.model":rr.modelId,"gen_ai.usage.input_tokens":Ft.inputTokens,"gen_ai.usage.output_tokens":Ft.outputTokens}}))}catch{}finally{An.end()}K.enqueue({type:"finish-step",finishReason:Rn,usage:Ft,providerMetadata:Ol,response:{...rr,headers:Yp?.headers}});const Mo=jZ(wt,Ft);await q.promise;const Do=Si.filter(pr=>pr.providerExecuted!==!0),ki=Il.filter(pr=>pr.providerExecuted!==!0);if(Do.length>0&&ki.length===Do.length&&!await ZZ({stopConditions:g,steps:F})){ye.push(...Ev({content:F[F.length-1].content,tools:l}));try{await me({currentStep:Ce+1,responseMessages:ye,usage:Mo})}catch(pr){K.enqueue({type:"error",error:pr}),Ue.closeStream()}}else K.enqueue({type:"finish",finishReason:Rn,totalUsage:Mo}),Ue.closeStream()}})))}await me({currentStep:0,responseMessages:[],usage:{inputTokens:void 0,outputTokens:void 0,totalTokens:void 0}})}}).catch(je=>{Ue.addStream(new ReadableStream({start(me){me.enqueue({type:"error",error:je}),me.close()}})),Ue.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 Ko(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){e.type==="text-delta"&&t.enqueue(e.text)}})))}get fullStream(){return Ko(this.teeStream().pipeThrough(new TransformStream({transform({part:e},t){t.enqueue(e)}})))}async consumeStream(e){var t;try{await eq({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 G9;return Ko(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:a=!1,sendStart:i=!0,sendFinish:s=!0,onError:c=bo}={}){const l=t!=null?HZ({originalMessages:e,responseMessageId:t}):void 0,u={},d=f=>{var g,h;const v=u[f];return((h=(g=this.tools)==null?void 0:g[v])==null?void 0:h.type)==="dynamic"?!0:void 0},m=this.fullStream.pipeThrough(new TransformStream({transform:async(f,g)=>{const h=o?.({part:f}),v=f.type;switch(v){case"text-start":{g.enqueue({type:"text-start",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"text-delta":{g.enqueue({type:"text-delta",id:f.id,delta:f.text,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"text-end":{g.enqueue({type:"text-end",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-start":{g.enqueue({type:"reasoning-start",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-delta":{n&&g.enqueue({type:"reasoning-delta",id:f.id,delta:f.text,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"reasoning-end":{g.enqueue({type:"reasoning-end",id:f.id,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"file":{g.enqueue({type:"file",mediaType:f.file.mediaType,url:`data:${f.file.mediaType};base64,${f.file.base64}`});break}case"source":{a&&f.sourceType==="url"&&g.enqueue({type:"source-url",sourceId:f.id,url:f.url,title:f.title,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}}),a&&f.sourceType==="document"&&g.enqueue({type:"source-document",sourceId:f.id,mediaType:f.mediaType,title:f.title,filename:f.filename,...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{}});break}case"tool-input-start":{u[f.id]=f.toolName;const b=d(f.id);g.enqueue({type:"tool-input-start",toolCallId:f.id,toolName:f.toolName,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"tool-input-delta":{g.enqueue({type:"tool-input-delta",toolCallId:f.id,inputTextDelta:f.delta});break}case"tool-call":{u[f.toolCallId]=f.toolName;const b=d(f.toolCallId);f.invalid?g.enqueue({type:"tool-input-error",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{},...b!=null?{dynamic:b}:{},errorText:c(f.error)}):g.enqueue({type:"tool-input-available",toolCallId:f.toolCallId,toolName:f.toolName,input:f.input,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.providerMetadata!=null?{providerMetadata:f.providerMetadata}:{},...b!=null?{dynamic:b}:{}});break}case"tool-result":{const b=d(f.toolCallId);g.enqueue({type:"tool-output-available",toolCallId:f.toolCallId,output:f.output,...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...f.preliminary!=null?{preliminary:f.preliminary}:{},...b!=null?{dynamic:b}:{}});break}case"tool-error":{const b=d(f.toolCallId);g.enqueue({type:"tool-output-error",toolCallId:f.toolCallId,errorText:c(f.error),...f.providerExecuted!=null?{providerExecuted:f.providerExecuted}:{},...b!=null?{dynamic:b}:{}});break}case"error":{g.enqueue({type:"error",errorText:c(f.error)});break}case"start-step":{g.enqueue({type:"start-step"});break}case"finish-step":{g.enqueue({type:"finish-step"});break}case"start":{i&&g.enqueue({type:"start",...h!=null?{messageMetadata:h}:{},...l!=null?{messageId:l}:{}});break}case"finish":{s&&g.enqueue({type:"finish",...h!=null?{messageMetadata:h}:{}});break}case"abort":{g.enqueue(f);break}case"tool-input-end":break;case"raw":break;default:{const b=v;throw new Error(`Unknown chunk type: ${b}`)}}h!=null&&v!=="start"&&v!=="finish"&&g.enqueue({type:"message-metadata",messageMetadata:h})}}));return Ko(A$({stream:m,messageId:l??t?.(),originalMessages:e,onFinish:r,onError:c}))}pipeUIMessageStreamToResponse(e,{originalMessages:t,generateMessageId:r,onFinish:o,messageMetadata:n,sendReasoning:a,sendSources:i,sendFinish:s,sendStart:c,onError:l,...u}={}){QZ({response:e,stream:this.toUIMessageStream({originalMessages:t,generateMessageId:r,onFinish:o,messageMetadata:n,sendReasoning:a,sendSources:i,sendFinish:s,sendStart:c,onError:l}),...u})}pipeTextStreamToResponse(e,t){BZ({response:e,textStream:this.textStream,...t})}toUIMessageStreamResponse({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:o,sendReasoning:n,sendSources:a,sendFinish:i,sendStart:s,onError:c,...l}={}){return GZ({stream:this.toUIMessageStream({originalMessages:e,generateMessageId:t,onFinish:r,messageMetadata:o,sendReasoning:n,sendSources:a,sendFinish:i,sendStart:s,onError:c}),...l})}toTextStreamResponse(e){return qZ({textStream:this.textStream,...e})}};function cq(e,t){const r=[];t?.ignoreIncompleteToolCalls&&(e=e.map(o=>({...o,parts:o.parts.filter(n=>!Tv(n)||n.state!=="input-streaming"&&n.state!=="input-available")})));for(const o of e)switch(o.role){case"system":{const n=o.parts.filter(i=>i.type==="text"),a=n.reduce((i,s)=>s.providerMetadata!=null?{...i,...s.providerMetadata}:i,{});r.push({role:"system",content:n.map(i=>i.text).join(""),...Object.keys(a).length>0?{providerOptions:a}:{}});break}case"user":{r.push({role:"user",content:o.parts.map(n=>{var a;if(pu(n))return{type:"text",text:n.text,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(hu(n))return{type:"file",mediaType:n.mediaType,filename:n.filename,data:n.url,...n.providerMetadata!=null?{providerOptions:n.providerMetadata}:{}};if(fu(n))return(a=t?.convertDataPart)==null?void 0:a.call(t,n)}).filter(n=>n!=null)});break}case"assistant":{if(o.parts!=null){let n=function(){var i,s,c;if(a.length===0)return;const l=[];for(const d of a)if(pu(d))l.push({type:"text",text:d.text,...d.providerMetadata!=null?{providerOptions:d.providerMetadata}:{}});else if(hu(d))l.push({type:"file",mediaType:d.mediaType,filename:d.filename,data:d.url});else if(Iv(d))l.push({type:"reasoning",text:d.text,providerOptions:d.providerMetadata});else if(pp(d)){const m=d.toolName;d.state!=="input-streaming"&&l.push({type:"tool-call",toolCallId:d.toolCallId,toolName:m,input:d.input,...d.callProviderMetadata!=null?{providerOptions:d.callProviderMetadata}:{}})}else if(Jn(d)){const m=Ls(d);d.state!=="input-streaming"&&(l.push({type:"tool-call",toolCallId:d.toolCallId,toolName:m,input:d.state==="output-error"?(i=d.input)!=null?i: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:m,output:ra({output:d.state==="output-error"?d.errorText:d.output,tool:(s=t?.tools)==null?void 0:s[m],errorMode:d.state==="output-error"?"json":"none"})}))}else if(fu(d)){const m=(c=t?.convertDataPart)==null?void 0:c.call(t,d);m!=null&&l.push(m)}else{const m=d;throw new Error(`Unsupported part: ${m}`)}r.push({role:"assistant",content:l});const u=a.filter(d=>Jn(d)&&d.providerExecuted!==!0||d.type==="dynamic-tool");u.length>0&&r.push({role:"tool",content:u.map(d=>{var m;switch(d.state){case"output-error":case"output-available":{const f=KZ(d);return{type:"tool-result",toolCallId:d.toolCallId,toolName:f,output:ra({output:d.state==="output-error"?d.errorText:d.output,tool:(m=t?.tools)==null?void 0:m[f],errorMode:d.state==="output-error"?"text":"none"})}}default:return null}}).filter(d=>d!=null)}),a=[]},a=[];for(const i of o.parts)pu(i)||Iv(i)||hu(i)||Tv(i)||fu(i)?a.push(i):i.type==="step-start"&&n();n();break}break}default:{const n=o.role;throw new sZ({originalMessage:o,message:`Unsupported role: ${n}`})}}return r}function lq(e){const t=e.filter(r=>r.type==="reasoning");return t.length===0?void 0:t.map(r=>r.text).join(`
91
- `)}var uq={type:"no-schema",jsonSchema:void 0,async validatePartialResult({value:e,textDelta:t}){return{success:!0,value:{partial:e,textDelta:t}}},async validateFinalResult(e,t){return e===void 0?{success:!1,error:new vn({message:"No object generated: response did not match schema.",text:t.text,response:t.response,usage:t.usage,finishReason:t.finishReason})}:{success:!0,value:e}},createElementStream(){throw new $d({functionality:"element streams in no-schema mode"})}},dq=e=>({type:"object",jsonSchema:e.jsonSchema,async validatePartialResult({value:t,textDelta:r}){return{success:!0,value:{partial:t,textDelta:r}}},async validateFinalResult(t){return Jt({value:t,schema:e})},createElementStream(){throw new $d({functionality:"element streams in object mode"})}}),mq=e=>{const{$schema:t,...r}=e.jsonSchema;return{type:"array",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:r}},required:["elements"],additionalProperties:!1},async validatePartialResult({value:o,latestObject:n,isFirstDelta:a,isFinalDelta:i}){var s;if(!ss(o)||!lh(o.elements))return{success:!1,error:new jt({value:o,cause:"value must be an object that contains an array of elements"})};const c=o.elements,l=[];for(let m=0;m<c.length;m++){const f=c[m],g=await Jt({value:f,schema:e});if(!(m===c.length-1&&!i)){if(!g.success)return g;l.push(g.value)}}const u=(s=n?.length)!=null?s:0;let d="";return a&&(d+="["),u>0&&(d+=","),d+=l.slice(u).map(m=>JSON.stringify(m)).join(","),i&&(d+="]"),{success:!0,value:{partial:l,textDelta:d}}},async validateFinalResult(o){if(!ss(o)||!lh(o.elements))return{success:!1,error:new jt({value:o,cause:"value must be an object that contains an array of elements"})};const n=o.elements;for(const a of n){const i=await Jt({value:a,schema:e});if(!i.success)return i}return{success:!0,value:n}},createElementStream(o){let n=0;return Ko(o.pipeThrough(new TransformStream({transform(a,i){switch(a.type){case"object":{const s=a.object;for(;n<s.length;n++)i.enqueue(s[n]);break}case"text-delta":case"finish":case"error":break;default:{const s=a;throw new Error(`Unsupported chunk type: ${s}`)}}}})))}}},fq=e=>({type:"enum",jsonSchema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},async validateFinalResult(t){if(!ss(t)||typeof t.result!="string")return{success:!1,error:new jt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const r=t.result;return e.includes(r)?{success:!0,value:r}:{success:!1,error:new jt({value:t,cause:"value must be a string in the enum"})}},async validatePartialResult({value:t,textDelta:r}){if(!ss(t)||typeof t.result!="string")return{success:!1,error:new jt({value:t,cause:'value must be an object that contains a string in the "result" property.'})};const o=t.result,n=e.filter(a=>a.startsWith(o));return t.result.length===0||n.length===0?{success:!1,error:new jt({value:t,cause:"value must be a string in the enum"})}:{success:!0,value:{partial:n.length>1?o:n[0],textDelta:r}}},createElementStream(){throw new $d({functionality:"element streams in enum mode"})}});function pq({output:e,schema:t,enumValues:r}){switch(e){case"object":return dq(ho(t));case"array":return mq(ho(t));case"enum":return fq(r);case"no-schema":return uq;default:{const o=e;throw new Error(`Unsupported output: ${o}`)}}}async function Ov(e,t,r){const o=await qr({text:e});if(!o.success)throw new vn({message:"No object generated: could not parse the response.",cause:o.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});const n=await t.validateFinalResult(o.value,{text:e,response:r.response,usage:r.usage});if(!n.success)throw new vn({message:"No object generated: response did not match schema.",cause:n.error,text:e,response:r.response,usage:r.usage,finishReason:r.finishReason});return n.value}async function hq(e,t,r,o){try{return await Ov(e,t,o)}catch(n){if(r!=null&&vn.isInstance(n)&&(na.isInstance(n.cause)||jt.isInstance(n.cause))){const a=await r({text:e,error:n.cause});if(a===null)throw n;return await Ov(a,t,o)}throw n}}function gq({output:e,schema:t,schemaName:r,schemaDescription:o,enumValues:n}){if(e!=null&&e!=="object"&&e!=="array"&&e!=="enum"&&e!=="no-schema")throw new Re({parameter:"output",value:e,message:"Invalid output type."});if(e==="no-schema"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for no-schema output."});if(o!=null)throw new Re({parameter:"schemaDescription",value:o,message:"Schema description is not supported for no-schema output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for no-schema output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for no-schema output."})}if(e==="object"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Schema is required for object output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for object output."})}if(e==="array"){if(t==null)throw new Re({parameter:"schema",value:t,message:"Element schema is required for array output."});if(n!=null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are not supported for array output."})}if(e==="enum"){if(t!=null)throw new Re({parameter:"schema",value:t,message:"Schema is not supported for enum output."});if(o!=null)throw new Re({parameter:"schemaDescription",value:o,message:"Schema description is not supported for enum output."});if(r!=null)throw new Re({parameter:"schemaName",value:r,message:"Schema name is not supported for enum output."});if(n==null)throw new Re({parameter:"enumValues",value:n,message:"Enum values are required for enum output."});for(const a of n)if(typeof a!="string")throw new Re({parameter:"enumValues",value:a,message:"Enum values must be strings."})}}var vq=fi({prefix:"aiobj",size:24});async function Cv(e){const{model:t,output:r="object",system:o,prompt:n,messages:a,maxRetries:i,abortSignal:s,headers:c,experimental_repairText:l,experimental_telemetry:u,experimental_download:d,providerOptions:m,_internal:{generateId:f=vq,currentDate:g=()=>new Date}={},...h}=e,v=fp(t),b="enum"in e?e.enum:void 0,{schema:w,schemaDescription:x,schemaName:y}="schema"in e?e:{};gq({output:r,schema:w,schemaName:y,schemaDescription:x,enumValues:b});const{maxRetries:S,retry:k}=k$({maxRetries:i,abortSignal:s}),T=pq({output:r,schema:w,enumValues:b}),A=gd(h),U=pi(c??{},`ai/${u$}`),L=b$({model:v,telemetry:u,headers:U,settings:{...A,maxRetries:S}}),W=_$(u);try{return await Ta({name:"ai.generateObject",attributes:ar({telemetry:u,attributes:{...Ia({operationId:"ai.generateObject",telemetry:u}),...L,"ai.prompt":{input:()=>JSON.stringify({system:o,prompt:n,messages:a})},"ai.schema":T.jsonSchema!=null?{input:()=>JSON.stringify(T.jsonSchema)}:void 0,"ai.schema.name":y,"ai.schema.description":x,"ai.settings.output":T.type}}),tracer:W,fn:async fe=>{var q;let z,ve,ee,J,B,ae,F,_e;const ue=await v$({system:o,prompt:n,messages:a}),Ie=await f$({prompt:ue,supportedUrls:await v.supportedUrls,download:d}),P=await k(()=>Ta({name:"ai.generateObject.doGenerate",attributes:ar({telemetry:u,attributes:{...Ia({operationId:"ai.generateObject.doGenerate",telemetry:u}),...L,"ai.prompt.messages":{input:()=>x$(Ie)},"gen_ai.system":v.provider,"gen_ai.request.model":v.modelId,"gen_ai.request.frequency_penalty":A.frequencyPenalty,"gen_ai.request.max_tokens":A.maxOutputTokens,"gen_ai.request.presence_penalty":A.presencePenalty,"gen_ai.request.temperature":A.temperature,"gen_ai.request.top_k":A.topK,"gen_ai.request.top_p":A.topP}}),tracer:W,fn:async le=>{var we,ge,er,Lt,gt,Yr,Ue,je;const me=await v.doGenerate({responseFormat:{type:"json",schema:T.jsonSchema,name:y,description:x},...gd(h),prompt:Ie,providerOptions:m,abortSignal:s,headers:U}),Ce={id:(ge=(we=me.response)==null?void 0:we.id)!=null?ge:f(),timestamp:(Lt=(er=me.response)==null?void 0:er.timestamp)!=null?Lt:g(),modelId:(Yr=(gt=me.response)==null?void 0:gt.modelId)!=null?Yr:v.modelId,headers:(Ue=me.response)==null?void 0:Ue.headers,body:(je=me.response)==null?void 0:je.body},ye=zZ(me.content),wt=lq(me.content);if(ye===void 0)throw new vn({message:"No object generated: the model did not return a response.",response:Ce,usage:me.usage,finishReason:me.finishReason});return le.setAttributes(ar({telemetry:u,attributes:{"ai.response.finishReason":me.finishReason,"ai.response.object":{output:()=>ye},"ai.response.id":Ce.id,"ai.response.model":Ce.modelId,"ai.response.timestamp":Ce.timestamp.toISOString(),"ai.response.providerMetadata":JSON.stringify(me.providerMetadata),"ai.usage.promptTokens":me.usage.inputTokens,"ai.usage.completionTokens":me.usage.outputTokens,"gen_ai.response.finish_reasons":[me.finishReason],"gen_ai.response.id":Ce.id,"gen_ai.response.model":Ce.modelId,"gen_ai.usage.input_tokens":me.usage.inputTokens,"gen_ai.usage.output_tokens":me.usage.outputTokens}})),{...me,objectText:ye,reasoning:wt,responseData:Ce}}}));z=P.objectText,ve=P.finishReason,ee=P.usage,J=P.warnings,F=P.providerMetadata,ae=(q=P.request)!=null?q:{},B=P.responseData,_e=P.reasoning,RT(J);const V=await hq(z,T,l,{response:B,usage:ee,finishReason:ve});return fe.setAttributes(ar({telemetry:u,attributes:{"ai.response.finishReason":ve,"ai.response.object":{output:()=>JSON.stringify(V)},"ai.response.providerMetadata":JSON.stringify(F),"ai.usage.promptTokens":ee.inputTokens,"ai.usage.completionTokens":ee.outputTokens}})),new yq({object:V,reasoning:_e,finishReason:ve,usage:ee,warnings:J,request:ae,response:B,providerMetadata:F})}})}catch(fe){throw y$(fe)}}var yq=class{constructor(e){this.object=e.object,this.finishReason=e.finishReason,this.usage=e.usage,this.warnings=e.warnings,this.providerMetadata=e.providerMetadata,this.response=e.response,this.request=e.request,this.reasoning=e.reasoning}toJsonResponse(e){var t;return new Response(JSON.stringify(this.object),{status:(t=e?.status)!=null?t:200,headers:hi(e?.headers,{"content-type":"application/json; charset=utf-8"})})}};fi({prefix:"aiobj",size:24});var bq={};q9(bq,{object:()=>wq,text:()=>_q});var _q=()=>({type:"text",responseFormat:{type:"text"},async parsePartial({text:e}){return{partial:e}},async parseOutput({text:e}){return e}}),wq=({schema:e})=>{const t=ho(e);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},async parsePartial({text:r}){const o=await C$(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 qr({text:r});if(!n.success)throw new vn({message:"No object generated: could not parse the response.",cause:n.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const a=await Jt({value:n.value,schema:t});if(!a.success)throw new vn({message:"No object generated: response did not match schema.",cause:a.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return a.value}}},xq={word:/\S+\s+/m,line:/\n+/m};function Sq({delayInMs:e=10,chunking:t="word",_internal:{delay:r=nT}={}}={}){let o;if(typeof t=="function")o=n=>{const a=t(n);if(a==null)return null;if(!a.length)throw new Error("Chunking function must return a non-empty string.");if(!n.startsWith(a))throw new Error(`Chunking function must return a match that is a prefix of the buffer. Received: "${a}" expected to start with "${n}"`);return a};else{const n=typeof t=="string"?xq[t]:t;if(n==null)throw new Td({argument:"chunking",message:`Chunking must be "word" or "line" or a RegExp. Received: ${t}`});o=a=>{const i=n.exec(a);return i?a.slice(0,i.index)+i?.[0]:null}}return()=>{let n="",a="";return new TransformStream({async transform(i,s){if(i.type!=="text-delta"){n.length>0&&(s.enqueue({type:"text-delta",text:n,id:a}),n=""),s.enqueue(i);return}i.id!==a&&n.length>0&&(s.enqueue({type:"text-delta",text:n,id:a}),n=""),n+=i.text,a=i.id;let c;for(;(c=o(n))!=null;)s.enqueue({type:"text-delta",text:c,id:a}),n=n.slice(c.length),await r(e)}})}}function kq({execute:e,onError:t=np,originalMessages:r,onFinish:o,generateId:n=oT}){let a;const i=[],s=new ReadableStream({start(u){a=u}});function c(u){try{a.enqueue(u)}catch{}}try{const u=e({writer:{write(d){c(d)},merge(d){i.push((async()=>{const m=d.getReader();for(;;){const{done:f,value:g}=await m.read();if(f)break;c(g)}})().catch(m=>{c({type:"error",errorText:t(m)})}))},onError:t}});u&&i.push(u.catch(d=>{c({type:"error",errorText:t(d)})}))}catch(u){c({type:"error",errorText:t(u)})}return new Promise(async u=>{for(;i.length>0;)await i.shift();u()}).finally(()=>{try{a.close()}catch{}}),A$({stream:s,messageId:n(),originalMessages:r,onFinish:o,onError:t})}function Av(e){return!!e&&"sessionToken"in e}function Eq(e){return e?"sessionFn"in e:!1}const Iq=({getSession:e,projectSlug:t})=>{const r=QS(),o=["chatSession",t],n=r.getQueryState(o),a=n?.data!==void 0,i=n?.dataUpdatedAt??0,c=a&&Date.now()-i>1/0,l=!a||c,{data:u}=rk({queryKey:o,queryFn:()=>e({projectSlug:t}),enabled:l&&e!==null,staleTime:1/0,gcTime:1/0});return u??null};async function Tq(e){return(await(await fetch("/chat/session",{method:"POST",headers:{"Gram-Project":e.projectSlug},body:JSON.stringify({embedOrigin:window.location.origin})})).json()).client_token}const hp=({projectSlug:e,auth:t})=>{const r=O.useMemo(()=>Av(t)?()=>Promise.resolve(t.sessionToken):!Av(t)&&Eq(t)?t.sessionFn:Tq,[t]),o=Iq({getSession:r,projectSlug:e});return o?{headers:{"Gram-Project":e,"Gram-Chat-Session":o},isLoading:!1}:{isLoading:!0}};function R$({children:e}){const[t,r]=O.useState(new Map),[o,n]=O.useState(new Set),a=O.useCallback((d,m,f)=>new Promise(g=>{const h={toolCallId:m,toolName:d,args:f,resolve:g};r(v=>{const b=new Map(v);return b.set(m,h),b})}),[]),i=O.useCallback(d=>{n(m=>{const f=new Set(m);return f.add(d),f})},[]),s=O.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!0);const g=new Map(m);return g.delete(d),g}return m})},[]),c=O.useCallback(d=>{r(m=>{const f=m.get(d);if(f){f.resolve(!1);const g=new Map(m);return g.delete(d),g}return m})},[]),l=O.useCallback(d=>o.has(d),[o]),u=O.useCallback(d=>t.get(d),[t]);return p.jsx(I.ToolApprovalContext.Provider,{value:{pendingApprovals:t,approvedTools:o,requestApproval:a,whitelistTool:i,confirmPendingApproval:s,rejectPendingApproval:c,isToolApproved:l,getPendingApproval:u},children:e})}const N$=O.createContext(null),$q=({children:e})=>{const[t,r]=O.useState("connected"),[o,n]=O.useState(0),[a,i]=O.useState(typeof navigator<"u"?navigator.onLine:!0),s=O.useRef(null);O.useEffect(()=>{if(typeof window>"u")return;const d=()=>{i(!0),s.current&&(clearTimeout(s.current),s.current=null),r("reconnecting"),s.current=setTimeout(()=>{r("connected"),n(0)},1500)},m=()=>{i(!1),r("disconnected"),s.current&&(clearTimeout(s.current),s.current=null)};return window.addEventListener("online",d),window.addEventListener("offline",m),()=>{window.removeEventListener("online",d),window.removeEventListener("offline",m),s.current&&(clearTimeout(s.current),s.current=null)}},[]);const c=O.useCallback(()=>{r("reconnecting"),n(d=>d+1),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{r(d=>d==="reconnecting"?"disconnected":d)},1e4)},[]),l=O.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]),u=O.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=null),r("connected"),n(0)},[]);return p.jsx(N$.Provider,{value:{state:t,retryCount:o,isOnline:a,markDisconnected:c,markConnected:l,reset:u},children:e})},P$=()=>O.useContext(N$);function Oq(e){return e?Object.fromEntries(Object.entries(e).map(([t,r])=>{const o=r.unstable_tool;return[t,{execute:o?.execute}]})):{}}const Cq=`You are a helpful assistant that can answer questions and help with tasks.
92
-
93
- Tool Result Display:
94
- Some tools have custom visual components that automatically render their results (you'll see a rich card/widget appear). For these, do not repeat the data - just add brief context or a follow-up question if needed.
95
-
96
- For tools WITHOUT custom components, you should present the data clearly - either as plain text for simple results, or using the UI code block format for structured data like lists of items, categories, or dashboards.`;function Aq(e,t,r){const o=r.length>0?`
97
-
98
- Tools with custom visual components (DO NOT render UI widgets for these - they already display rich visuals):
99
- ${r.map(n=>`- ${n}`).join(`
100
- `)}`:"";return`
101
- ${Cq}${o}
102
-
103
- User-provided System Prompt:
104
- ${e??"None provided"}
105
-
106
- Utilities:
107
- ${t.map(n=>`- ${n.language}: ${n.prompt}`).join(`
108
- `)}`}function Rq(e){return e.map(t=>{const r=t.parts;if(!Array.isArray(r))return t;const o=r.map(n=>{const{callProviderMetadata:a,...i}=n;return i});return{...t,parts:o}})}const Nq=({children:e,config:t})=>{const r=If(t),o=hp({auth:t.api,projectSlug:t.projectSlug}),n=nk(),[a,i]=O.useState(t.model?.defaultModel??sl[0]),[s,c]=O.useState(t.modal?.defaultExpanded??!1),[l,u]=O.useState(t.modal?.defaultOpen),d=t.plugins??I.recommended,m=Object.keys(t.tools?.components??{}),f=Aq(t.systemPrompt,d,m);O.useEffect(()=>{m5({enabled:t.errorTracking?.enabled,projectSlug:t.projectSlug,variant:t.variant})},[]);const g=O.useRef(null),[h,v]=O.useState(null),{data:b,mcpHeaders:w}=Vj({auth:o,mcp:t.mcp,environment:t.environment??{},toolsToInclude:t.tools?.toolsToInclude,gramEnvironment:t.gramEnvironment}),x=O.useRef({requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool}),y=P$();x.current={requestApproval:n.requestApproval,isToolApproved:n.isToolApproved,whitelistTool:n.whitelistTool};const S=O.useCallback(()=>({requestApproval:(...z)=>x.current.requestApproval(...z),isToolApproved:(...z)=>x.current.isToolApproved(...z),whitelistTool:(...z)=>x.current.whitelistTool(...z)}),[]);O.useEffect(()=>(t.tools?.toolsRequiringApproval&&h5(S(),t.tools.toolsRequiringApproval),()=>{g5()}),[t.tools?.toolsRequiringApproval,S]);const k=O.useRef(null),T=O.useRef(new Map),A=O.useRef(null),U=O.useMemo(()=>({sendMessages:async({messages:z,abortSignal:ve})=>{const ee=!!t.languageModel;if(o.isLoading)throw new Error("Session is loading");let J=A.current;if(!(J&&!Gn(J))){if(Gn(J)||!J){const le=k.current?.threads?.getState?.(),we=le?.mainThreadId??le?.threadIds?.[0],ge=J??we;if(ge){const er=T.current.get(ge);if(er)J=er;else{const Lt=crypto.randomUUID();T.current.set(ge,Lt),J=Lt}}}}J||(g.current||(g.current=crypto.randomUUID()),J=g.current),J&&(w["Gram-Chat-ID"]=J,v(J));const B=k.current?.thread.getModelContext(),ae=f5(p5(B?.tools??{})),F={...o.headers,"Gram-Chat-ID":J,"X-Gram-Source":"elements",...t.api?.headers,...t.gramEnvironment&&{"Gram-Environment":t.gramEnvironment}},_e=ee?null:rp({baseURL:r,apiKey:"unused, but must be set",headers:F});t.languageModel&&console.log("Using custom language model",t.languageModel);const ue={...b,...Hs.frontendTools(ae)},Ie=y5(ue,t.tools?.toolsRequiringApproval,S()),P=t.languageModel?t.languageModel:_e.chat(a);try{const V=Rq(z),le=cq(V),we=aq({system:f,model:P,messages:le,tools:Ie,stopWhen:E$(10),experimental_transform:Sq({delayInMs:15}),abortSignal:ve,onError:({error:ge})=>{console.error("Stream error in onError callback:",ge),Os(ge,{source:"streaming"}),(ge instanceof TypeError||ge instanceof Error&&(ge.message.includes("fetch")||ge.message.includes("network")||ge.message.includes("Failed to fetch")||ge.message.includes("NetworkError")||ge.message.includes("ECONNREFUSED")||ge.message.includes("ETIMEDOUT")))&&y?.markDisconnected()}});return y?.markConnected(),we.toUIMessageStream()}catch(V){throw console.error("Error creating stream:",V),Os(V,{source:"stream-creation"}),(V instanceof TypeError||V instanceof Error&&(V.message.includes("fetch")||V.message.includes("network")||V.message.includes("Failed to fetch")||V.message.includes("NetworkError")||V.message.includes("ECONNREFUSED")||V.message.includes("ETIMEDOUT")))&&y?.markDisconnected(),V}},reconnectToStream:async()=>{throw new Error("Stream reconnection not supported")}}),[t.languageModel,t.tools?.toolsRequiringApproval,a,f,b,S,r,o.headers,o.isLoading,y]),L=t.history?.enabled??!1,W=O.useMemo(()=>({config:t,setModel:i,model:a,isExpanded:s,setIsExpanded:c,isOpen:l??!1,setIsOpen:u,plugins:d,mcpTools:b}),[t,a,s,l,d,b]),fe=t.tools?.frontendTools??{},q=O.useMemo(()=>{const z=Oq(t.tools?.frontendTools);return{...b,...z}},[b,t.tools?.frontendTools]);return L&&!o.isLoading?p.jsx(jq,{transport:U,apiUrl:r,headers:o.headers,contextValue:W,runtimeRef:k,frontendTools:fe,localIdToUuidMap:T.current,currentRemoteIdRef:A,executableTools:q,currentChatId:h,setCurrentChatId:v,children:e}):p.jsx(Mq,{transport:U,contextValue:W,runtimeRef:k,frontendTools:fe,executableTools:q,currentChatId:h,children:e})},Pq=({remoteIdRef:e,onChatIdChange:t})=>{const r=j.useAssistantState(({threadListItem:o})=>o.remoteId??null);return O.useEffect(()=>{e.current=r,t(r)},[r,e,t]),null},jq=({children:e,transport:t,apiUrl:r,headers:o,contextValue:n,runtimeRef:a,frontendTools:i,localIdToUuidMap:s,currentRemoteIdRef:c,executableTools:l,currentChatId:u,setCurrentChatId:d})=>{const m=aC({apiUrl:r,headers:o,localIdToUuidMap:s}),f=n?.config.history?.initialThreadId,g=O.useCallback(()=>Hs.useChatRuntime({transport:t}),[t]),h=j.unstable_useRemoteThreadListRuntime({adapter:m,runtimeHook:g});O.useEffect(()=>{a.current=h},[h,a]);const v=O.useRef(!1);O.useEffect(()=>{if(f&&!v.current){v.current=!0;const w=setTimeout(()=>{h.threads.switchToThread(f).catch(x=>{console.error("Failed to switch to initial thread:",x)})},100);return()=>clearTimeout(w)}},[f,h]);const b=m.unstable_Provider??(({children:w})=>p.jsx(p.Fragment,{children:w}));return p.jsxs(j.AssistantRuntimeProvider,{runtime:h,children:[p.jsx(Pq,{remoteIdRef:c,onChatIdChange:d}),p.jsx(b,{children:p.jsx(I.ChatIdContext.Provider,{value:{chatId:u},children:p.jsx(I.ElementsContext.Provider,{value:n,children:p.jsxs(I.ToolExecutionProvider,{tools:l,children:[p.jsx("div",{className:I.cn(Ws,(n?.config.variant==="standalone"||n?.config.variant==="sidecar")&&"h-full"),children:e}),p.jsx(dy,{tools:i})]})})})})]})},Mq=({children:e,transport:t,contextValue:r,runtimeRef:o,frontendTools:n,executableTools:a,currentChatId:i})=>{const s=Hs.useChatRuntime({transport:t});return O.useEffect(()=>{o.current=s},[s,o]),p.jsx(j.AssistantRuntimeProvider,{runtime:s,children:p.jsx(I.ChatIdContext.Provider,{value:{chatId:i},children:p.jsx(I.ElementsContext.Provider,{value:r,children:p.jsxs(I.ToolExecutionProvider,{tools:a,children:[p.jsx("div",{className:I.cn(Ws,(r?.config.variant==="standalone"||r?.config.variant==="sidecar")&&"h-full"),children:e}),p.jsx(dy,{tools:n})]})})})})},Dq=new YS,zq=e=>p.jsx(ek,{client:Dq,children:p.jsx($q,{children:p.jsx(R$,{children:p.jsx(Nq,{...e})})})});function j$(){return{threadId:j.useAssistantState(({threadListItem:t})=>t.remoteId??null)}}function Rv(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function gp(...e){return t=>{let r=!1;const o=e.map(n=>{const a=Rv(n,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let n=0;n<o.length;n++){const a=o[n];typeof a=="function"?a():Rv(e[n],null)}}}}function _t(...e){return _.useCallback(gp(...e),e)}var Uq=Symbol.for("react.lazy"),Fs=_[" use ".trim().toString()];function Lq(e){return typeof e=="object"&&e!==null&&"then"in e}function M$(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Uq&&"_payload"in e&&Lq(e._payload)}function D$(e){const t=Vq(e),r=_.forwardRef((o,n)=>{let{children:a,...i}=o;M$(a)&&typeof Fs=="function"&&(a=Fs(a._payload));const s=_.Children.toArray(a),c=s.find(Bq);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,{...i,ref:n,children:_.isValidElement(l)?_.cloneElement(l,void 0,u):null})}return p.jsx(t,{...i,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}var Fq=D$("Slot");function Vq(e){const t=_.forwardRef((r,o)=>{let{children:n,...a}=r;if(M$(n)&&typeof Fs=="function"&&(n=Fs(n._payload)),_.isValidElement(n)){const i=Hq(n),s=Gq(a,n.props);return n.type!==_.Fragment&&(s.ref=o?gp(o,i):i),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var z$=Symbol("radix.slottable");function Zq(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=z$,t}var qq=Zq("Slottable");function Bq(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===z$}function Gq(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...s)=>{const c=a(...s);return n(...s),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function Hq(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 Nv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Pv=I.clsx,U$=(e,t)=>r=>{var o;if(t?.variants==null)return Pv(e,r?.class,r?.className);const{variants:n,defaultVariants:a}=t,i=Object.keys(n).map(l=>{const u=r?.[l],d=a?.[l];if(u===null)return null;const m=Nv(u)||Nv(d);return n[l][m]}),s=r&&Object.entries(r).reduce((l,u)=>{let[d,m]=u;return m===void 0||(l[d]=m),l},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:d,className:m,...f}=u;return Object.entries(f).every(g=>{let[h,v]=g;return Array.isArray(v)?v.includes({...a,...s}[h]):{...a,...s}[h]===v})?[...l,d,m]:l},[]);return Pv(e,i,c,r?.class,r?.className)},Wq=U$("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"}}),rt=_.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},a)=>{const i=o?Fq:"button";return p.jsx(i,{"data-slot":"button",className:I.cn(Wq({variant:t,size:r,className:e})),ref:a,...n})});rt.displayName="Button";const Jq=({error:e,onRetry:t})=>p.jsx("div",{className:I.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(I.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(rt,{onClick:t,variant:"default",className:"mt-2",children:"Try again"})]})}),Kq=({children:e})=>p.jsx(p.Fragment,{children:e});class vp extends O.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){Os(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(Jq,{error:this.state.error,onRetry:this.handleRetry}):p.jsx(Kq,{children:this.props.children},this.state.resetKey)}}function Le(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),r===!1||!n.defaultPrevented)return t?.(n)}}function Yq(e,t){const r=_.createContext(t),o=a=>{const{children:i,...s}=a,c=_.useMemo(()=>s,Object.values(s));return p.jsx(r.Provider,{value:c,children:i})};o.displayName=e+"Provider";function n(a){const i=_.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[o,n]}function gi(e,t=[]){let r=[];function o(a,i){const s=_.createContext(i),c=r.length;r=[...r,i];const l=d=>{const{scope:m,children:f,...g}=d,h=m?.[e]?.[c]||s,v=_.useMemo(()=>g,Object.values(g));return p.jsx(h.Provider,{value:v,children:f})};l.displayName=a+"Provider";function u(d,m){const f=m?.[e]?.[c]||s,g=_.useContext(f);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[l,u]}const n=()=>{const a=r.map(i=>_.createContext(i));return function(s){const c=s?.[e]||a;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,Xq(n,...t)]}function Xq(...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(a){const i=o.reduce((s,{useScope:c,scopeName:l})=>{const d=c(a)[`__scope${l}`];return{...s,...d}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}function yp(e){const t=Qq(e),r=_.forwardRef((o,n)=>{const{children:a,...i}=o,s=_.Children.toArray(a),c=s.find(tB);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,{...i,ref:n,children:_.isValidElement(l)?_.cloneElement(l,void 0,u):null})}return p.jsx(t,{...i,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function Qq(e){const t=_.forwardRef((r,o)=>{const{children:n,...a}=r;if(_.isValidElement(n)){const i=nB(n),s=rB(a,n.props);return n.type!==_.Fragment&&(s.ref=o?gp(o,i):i),_.cloneElement(n,s)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var L$=Symbol("radix.slottable");function eB(e){const t=({children:r})=>p.jsx(p.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=L$,t}function tB(e){return _.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===L$}function rB(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...s)=>{const c=a(...s);return n(...s),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function nB(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 oB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Be=oB.reduce((e,t)=>{const r=yp(`Primitive.${t}`),o=_.forwardRef((n,a)=>{const{asChild:i,...s}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...s,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function aB(e,t){e&&uy.flushSync(()=>e.dispatchEvent(t))}function yn(e){const t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...r)=>t.current?.(...r),[])}function iB(e,t=globalThis?.document){const r=yn(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 sB="DismissableLayer",vd="dismissableLayer.update",cB="dismissableLayer.pointerDownOutside",lB="dismissableLayer.focusOutside",jv,F$=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ul=_.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...c}=e,l=_.useContext(F$),[u,d]=_.useState(null),m=u?.ownerDocument??globalThis?.document,[,f]=_.useState({}),g=_t(t,T=>d(T)),h=Array.from(l.layers),[v]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),b=h.indexOf(v),w=u?h.indexOf(u):-1,x=l.layersWithOutsidePointerEventsDisabled.size>0,y=w>=b,S=mB(T=>{const A=T.target,U=[...l.branches].some(L=>L.contains(A));!y||U||(n?.(T),i?.(T),T.defaultPrevented||s?.())},m),k=fB(T=>{const A=T.target;[...l.branches].some(L=>L.contains(A))||(a?.(T),i?.(T),T.defaultPrevented||s?.())},m);return iB(T=>{w===l.layers.size-1&&(o?.(T),!T.defaultPrevented&&s&&(T.preventDefault(),s()))},m),_.useEffect(()=>{if(u)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(jv=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Mv(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=jv)}},[u,m,r,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Mv())},[u,l]),_.useEffect(()=>{const T=()=>f({});return document.addEventListener(vd,T),()=>document.removeEventListener(vd,T)},[]),p.jsx(Be.div,{...c,ref:g,style:{pointerEvents:x?y?"auto":"none":void 0,...e.style},onFocusCapture:Le(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Le(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Le(e.onPointerDownCapture,S.onPointerDownCapture)})});ul.displayName=sB;var uB="DismissableLayerBranch",dB=_.forwardRef((e,t)=>{const r=_.useContext(F$),o=_.useRef(null),n=_t(t,o);return _.useEffect(()=>{const a=o.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),p.jsx(Be.div,{...e,ref:n})});dB.displayName=uB;function mB(e,t=globalThis?.document){const r=yn(e),o=_.useRef(!1),n=_.useRef(()=>{});return _.useEffect(()=>{const a=s=>{if(s.target&&!o.current){let c=function(){V$(cB,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},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function fB(e,t=globalThis?.document){const r=yn(e),o=_.useRef(!1);return _.useEffect(()=>{const n=a=>{a.target&&!o.current&&V$(lB,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Mv(){const e=new CustomEvent(vd);document.dispatchEvent(e)}function V$(e,t,r,{discrete:o}){const n=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?aB(n,a):n.dispatchEvent(a)}var zt=globalThis?.document?_.useLayoutEffect:()=>{},pB=_[" useId ".trim().toString()]||(()=>{}),hB=0;function Kn(e){const[t,r]=_.useState(pB());return zt(()=>{r(o=>o??String(hB++))},[e]),t?`radix-${t}`:""}const gB=["top","right","bottom","left"],Br=Math.min,St=Math.max,Vs=Math.round,Li=Math.floor,sr=e=>({x:e,y:e}),vB={left:"right",right:"left",bottom:"top",top:"bottom"},yB={start:"end",end:"start"};function yd(e,t,r){return St(e,Br(t,r))}function kr(e,t){return typeof e=="function"?e(t):e}function Er(e){return e.split("-")[0]}function Ao(e){return e.split("-")[1]}function bp(e){return e==="x"?"y":"x"}function _p(e){return e==="y"?"height":"width"}const bB=new Set(["top","bottom"]);function ir(e){return bB.has(Er(e))?"y":"x"}function wp(e){return bp(ir(e))}function _B(e,t,r){r===void 0&&(r=!1);const o=Ao(e),n=wp(e),a=_p(n);let i=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=Zs(i)),[i,Zs(i)]}function wB(e){const t=Zs(e);return[bd(e),t,bd(t)]}function bd(e){return e.replace(/start|end/g,t=>yB[t])}const Dv=["left","right"],zv=["right","left"],xB=["top","bottom"],SB=["bottom","top"];function kB(e,t,r){switch(e){case"top":case"bottom":return r?t?zv:Dv:t?Dv:zv;case"left":case"right":return t?xB:SB;default:return[]}}function EB(e,t,r,o){const n=Ao(e);let a=kB(Er(e),r==="start",o);return n&&(a=a.map(i=>i+"-"+n),t&&(a=a.concat(a.map(bd)))),a}function Zs(e){return e.replace(/left|right|bottom|top/g,t=>vB[t])}function IB(e){return{top:0,right:0,bottom:0,left:0,...e}}function Z$(e){return typeof e!="number"?IB(e):{top:e,right:e,bottom:e,left:e}}function qs(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 Uv(e,t,r){let{reference:o,floating:n}=e;const a=ir(t),i=wp(t),s=_p(i),c=Er(t),l=a==="y",u=o.x+o.width/2-n.width/2,d=o.y+o.height/2-n.height/2,m=o[s]/2-n[s]/2;let f;switch(c){case"top":f={x:u,y:o.y-n.height};break;case"bottom":f={x:u,y:o.y+o.height};break;case"right":f={x:o.x+o.width,y:d};break;case"left":f={x:o.x-n.width,y:d};break;default:f={x:o.x,y:o.y}}switch(Ao(t)){case"start":f[i]-=m*(r&&l?-1:1);break;case"end":f[i]+=m*(r&&l?-1:1);break}return f}const TB=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:a=[],platform:i}=r,s=a.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:d}=Uv(l,o,c),m=o,f={},g=0;for(let h=0;h<s.length;h++){const{name:v,fn:b}=s[h],{x:w,y:x,data:y,reset:S}=await b({x:u,y:d,initialPlacement:o,placement:m,strategy:n,middlewareData:f,rects:l,platform:i,elements:{reference:e,floating:t}});u=w??u,d=x??d,f={...f,[v]:{...f[v],...y}},S&&g<=50&&(g++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(l=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:n}):S.rects),{x:u,y:d}=Uv(l,m,c)),h=-1)}return{x:u,y:d,placement:m,strategy:n,middlewareData:f}};async function $a(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:a,rects:i,elements:s,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:m=!1,padding:f=0}=kr(t,e),g=Z$(f),v=s[m?d==="floating"?"reference":"floating":d],b=qs(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),w=d==="floating"?{x:o,y:n,width:i.floating.width,height:i.floating.height}:i.reference,x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(x))?await(a.getScale==null?void 0:a.getScale(x))||{x:1,y:1}:{x:1,y:1},S=qs(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:c}):w);return{top:(b.top-S.top+g.top)/y.y,bottom:(S.bottom-b.bottom+g.bottom)/y.y,left:(b.left-S.left+g.left)/y.x,right:(S.right-b.right+g.right)/y.x}}const $B=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:a,platform:i,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=kr(e,t)||{};if(l==null)return{};const d=Z$(u),m={x:r,y:o},f=wp(n),g=_p(f),h=await i.getDimensions(l),v=f==="y",b=v?"top":"left",w=v?"bottom":"right",x=v?"clientHeight":"clientWidth",y=a.reference[g]+a.reference[f]-m[f]-a.floating[g],S=m[f]-a.reference[f],k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let T=k?k[x]:0;(!T||!await(i.isElement==null?void 0:i.isElement(k)))&&(T=s.floating[x]||a.floating[g]);const A=y/2-S/2,U=T/2-h[g]/2-1,L=Br(d[b],U),W=Br(d[w],U),fe=L,q=T-h[g]-W,z=T/2-h[g]/2+A,ve=yd(fe,z,q),ee=!c.arrow&&Ao(n)!=null&&z!==ve&&a.reference[g]/2-(z<fe?L:W)-h[g]/2<0,J=ee?z<fe?z-fe:z-q:0;return{[f]:m[f]+J,data:{[f]:ve,centerOffset:z-ve-J,...ee&&{alignmentOffset:J}},reset:ee}}}),OB=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:a,rects:i,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...v}=kr(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const b=Er(n),w=ir(s),x=Er(s)===s,y=await(c.isRTL==null?void 0:c.isRTL(l.floating)),S=m||(x||!h?[Zs(s)]:wB(s)),k=g!=="none";!m&&k&&S.push(...EB(s,h,g,y));const T=[s,...S],A=await $a(t,v),U=[];let L=((o=a.flip)==null?void 0:o.overflows)||[];if(u&&U.push(A[b]),d){const z=_B(n,i,y);U.push(A[z[0]],A[z[1]])}if(L=[...L,{placement:n,overflows:U}],!U.every(z=>z<=0)){var W,fe;const z=(((W=a.flip)==null?void 0:W.index)||0)+1,ve=T[z];if(ve&&(!(d==="alignment"?w!==ir(ve):!1)||L.every(B=>ir(B.placement)===w?B.overflows[0]>0:!0)))return{data:{index:z,overflows:L},reset:{placement:ve}};let ee=(fe=L.filter(J=>J.overflows[0]<=0).sort((J,B)=>J.overflows[1]-B.overflows[1])[0])==null?void 0:fe.placement;if(!ee)switch(f){case"bestFit":{var q;const J=(q=L.filter(B=>{if(k){const ae=ir(B.placement);return ae===w||ae==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(ae=>ae>0).reduce((ae,F)=>ae+F,0)]).sort((B,ae)=>B[1]-ae[1])[0])==null?void 0:q[0];J&&(ee=J);break}case"initialPlacement":ee=s;break}if(n!==ee)return{reset:{placement:ee}}}return{}}}};function Lv(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Fv(e){return gB.some(t=>e[t]>=0)}const CB=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:o="referenceHidden",...n}=kr(e,t);switch(o){case"referenceHidden":{const a=await $a(t,{...n,elementContext:"reference"}),i=Lv(a,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Fv(i)}}}case"escaped":{const a=await $a(t,{...n,altBoundary:!0}),i=Lv(a,r.floating);return{data:{escapedOffsets:i,escaped:Fv(i)}}}default:return{}}}}},q$=new Set(["left","top"]);async function AB(e,t){const{placement:r,platform:o,elements:n}=e,a=await(o.isRTL==null?void 0:o.isRTL(n.floating)),i=Er(r),s=Ao(r),c=ir(r)==="y",l=q$.has(i)?-1:1,u=a&&c?-1:1,d=kr(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof g=="number"&&(f=s==="end"?g*-1:g),c?{x:f*u,y:m*l}:{x:m*l,y:f*u}}const RB=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:a,placement:i,middlewareData:s}=t,c=await AB(t,e);return i===((r=s.offset)==null?void 0:r.placement)&&(o=s.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:a+c.y,data:{...c,placement:i}}}}},NB=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:n}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=kr(e,t),l={x:r,y:o},u=await $a(t,c),d=ir(Er(n)),m=bp(d);let f=l[m],g=l[d];if(a){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=f+u[v],x=f-u[b];f=yd(w,f,x)}if(i){const v=d==="y"?"top":"left",b=d==="y"?"bottom":"right",w=g+u[v],x=g-u[b];g=yd(w,g,x)}const h=s.fn({...t,[m]:f,[d]:g});return{...h,data:{x:h.x-r,y:h.y-o,enabled:{[m]:a,[d]:i}}}}}},PB=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:n,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=kr(e,t),u={x:r,y:o},d=ir(n),m=bp(d);let f=u[m],g=u[d];const h=kr(s,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const x=m==="y"?"height":"width",y=a.reference[m]-a.floating[x]+v.mainAxis,S=a.reference[m]+a.reference[x]-v.mainAxis;f<y?f=y:f>S&&(f=S)}if(l){var b,w;const x=m==="y"?"width":"height",y=q$.has(Er(n)),S=a.reference[d]-a.floating[x]+(y&&((b=i.offset)==null?void 0:b[d])||0)+(y?0:v.crossAxis),k=a.reference[d]+a.reference[x]+(y?0:((w=i.offset)==null?void 0:w[d])||0)-(y?v.crossAxis:0);g<S?g=S:g>k&&(g=k)}return{[m]:f,[d]:g}}}},jB=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:n,rects:a,platform:i,elements:s}=t,{apply:c=()=>{},...l}=kr(e,t),u=await $a(t,l),d=Er(n),m=Ao(n),f=ir(n)==="y",{width:g,height:h}=a.floating;let v,b;d==="top"||d==="bottom"?(v=d,b=m===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(b=d,v=m==="end"?"top":"bottom");const w=h-u.top-u.bottom,x=g-u.left-u.right,y=Br(h-u[v],w),S=Br(g-u[b],x),k=!t.middlewareData.shift;let T=y,A=S;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(A=x),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=w),k&&!m){const L=St(u.left,0),W=St(u.right,0),fe=St(u.top,0),q=St(u.bottom,0);f?A=g-2*(L!==0||W!==0?L+W:St(u.left,u.right)):T=h-2*(fe!==0||q!==0?fe+q:St(u.top,u.bottom))}await c({...t,availableWidth:A,availableHeight:T});const U=await i.getDimensions(s.floating);return g!==U.width||h!==U.height?{reset:{rects:!0}}:{}}}};function dl(){return typeof window<"u"}function Ro(e){return B$(e)?(e.nodeName||"").toLowerCase():"#document"}function Et(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fr(e){var t;return(t=(B$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function B$(e){return dl()?e instanceof Node||e instanceof Et(e).Node:!1}function Kt(e){return dl()?e instanceof Element||e instanceof Et(e).Element:!1}function dr(e){return dl()?e instanceof HTMLElement||e instanceof Et(e).HTMLElement:!1}function Vv(e){return!dl()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Et(e).ShadowRoot}const MB=new Set(["inline","contents"]);function vi(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Yt(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!MB.has(n)}const DB=new Set(["table","td","th"]);function zB(e){return DB.has(Ro(e))}const UB=[":popover-open",":modal"];function ml(e){return UB.some(t=>{try{return e.matches(t)}catch{return!1}})}const LB=["transform","translate","scale","rotate","perspective"],FB=["transform","translate","scale","rotate","perspective","filter"],VB=["paint","layout","strict","content"];function xp(e){const t=Sp(),r=Kt(e)?Yt(e):e;return LB.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)||FB.some(o=>(r.willChange||"").includes(o))||VB.some(o=>(r.contain||"").includes(o))}function ZB(e){let t=Gr(e);for(;dr(t)&&!go(t);){if(xp(t))return t;if(ml(t))return null;t=Gr(t)}return null}function Sp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qB=new Set(["html","body","#document"]);function go(e){return qB.has(Ro(e))}function Yt(e){return Et(e).getComputedStyle(e)}function fl(e){return Kt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Gr(e){if(Ro(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Vv(e)&&e.host||fr(e);return Vv(t)?t.host:t}function G$(e){const t=Gr(e);return go(t)?e.ownerDocument?e.ownerDocument.body:e.body:dr(t)&&vi(t)?t:G$(t)}function Oa(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=G$(e),a=n===((o=e.ownerDocument)==null?void 0:o.body),i=Et(n);if(a){const s=_d(i);return t.concat(i,i.visualViewport||[],vi(n)?n:[],s&&r?Oa(s):[])}return t.concat(n,Oa(n,[],r))}function _d(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function H$(e){const t=Yt(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=dr(e),a=n?e.offsetWidth:r,i=n?e.offsetHeight:o,s=Vs(r)!==a||Vs(o)!==i;return s&&(r=a,o=i),{width:r,height:o,$:s}}function kp(e){return Kt(e)?e:e.contextElement}function Yn(e){const t=kp(e);if(!dr(t))return sr(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:a}=H$(t);let i=(a?Vs(r.width):r.width)/o,s=(a?Vs(r.height):r.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const BB=sr(0);function W$(e){const t=Et(e);return!Sp()||!t.visualViewport?BB:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GB(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Et(e)?!1:t}function bn(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=kp(e);let i=sr(1);t&&(o?Kt(o)&&(i=Yn(o)):i=Yn(e));const s=GB(a,r,o)?W$(a):sr(0);let c=(n.left+s.x)/i.x,l=(n.top+s.y)/i.y,u=n.width/i.x,d=n.height/i.y;if(a){const m=Et(a),f=o&&Kt(o)?Et(o):o;let g=m,h=_d(g);for(;h&&o&&f!==g;){const v=Yn(h),b=h.getBoundingClientRect(),w=Yt(h),x=b.left+(h.clientLeft+parseFloat(w.paddingLeft))*v.x,y=b.top+(h.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,l*=v.y,u*=v.x,d*=v.y,c+=x,l+=y,g=Et(h),h=_d(g)}}return qs({width:u,height:d,x:c,y:l})}function Ep(e,t){const r=fl(e).scrollLeft;return t?t.left+r:bn(fr(e)).left+r}function J$(e,t,r){r===void 0&&(r=!1);const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-(r?0:Ep(e,o)),a=o.top+t.scrollTop;return{x:n,y:a}}function HB(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const a=n==="fixed",i=fr(o),s=t?ml(t.floating):!1;if(o===i||s&&a)return r;let c={scrollLeft:0,scrollTop:0},l=sr(1);const u=sr(0),d=dr(o);if((d||!d&&!a)&&((Ro(o)!=="body"||vi(i))&&(c=fl(o)),dr(o))){const f=bn(o);l=Yn(o),u.x=f.x+o.clientLeft,u.y=f.y+o.clientTop}const m=i&&!d&&!a?J$(i,c,!0):sr(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+u.x+m.x,y:r.y*l.y-c.scrollTop*l.y+u.y+m.y}}function WB(e){return Array.from(e.getClientRects())}function JB(e){const t=fr(e),r=fl(e),o=e.ownerDocument.body,n=St(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=St(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-r.scrollLeft+Ep(e);const s=-r.scrollTop;return Yt(o).direction==="rtl"&&(i+=St(t.clientWidth,o.clientWidth)-n),{width:n,height:a,x:i,y:s}}function KB(e,t){const r=Et(e),o=fr(e),n=r.visualViewport;let a=o.clientWidth,i=o.clientHeight,s=0,c=0;if(n){a=n.width,i=n.height;const l=Sp();(!l||l&&t==="fixed")&&(s=n.offsetLeft,c=n.offsetTop)}return{width:a,height:i,x:s,y:c}}const YB=new Set(["absolute","fixed"]);function XB(e,t){const r=bn(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,a=dr(e)?Yn(e):sr(1),i=e.clientWidth*a.x,s=e.clientHeight*a.y,c=n*a.x,l=o*a.y;return{width:i,height:s,x:c,y:l}}function Zv(e,t,r){let o;if(t==="viewport")o=KB(e,r);else if(t==="document")o=JB(fr(e));else if(Kt(t))o=XB(t,r);else{const n=W$(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return qs(o)}function K$(e,t){const r=Gr(e);return r===t||!Kt(r)||go(r)?!1:Yt(r).position==="fixed"||K$(r,t)}function QB(e,t){const r=t.get(e);if(r)return r;let o=Oa(e,[],!1).filter(s=>Kt(s)&&Ro(s)!=="body"),n=null;const a=Yt(e).position==="fixed";let i=a?Gr(e):e;for(;Kt(i)&&!go(i);){const s=Yt(i),c=xp(i);!c&&s.position==="fixed"&&(n=null),(a?!c&&!n:!c&&s.position==="static"&&!!n&&YB.has(n.position)||vi(i)&&!c&&K$(e,i))?o=o.filter(u=>u!==i):n=s,i=Gr(i)}return t.set(e,o),o}function e8(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const i=[...r==="clippingAncestors"?ml(t)?[]:QB(t,this._c):[].concat(r),o],s=i[0],c=i.reduce((l,u)=>{const d=Zv(t,u,n);return l.top=St(d.top,l.top),l.right=Br(d.right,l.right),l.bottom=Br(d.bottom,l.bottom),l.left=St(d.left,l.left),l},Zv(t,s,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function t8(e){const{width:t,height:r}=H$(e);return{width:t,height:r}}function r8(e,t,r){const o=dr(t),n=fr(t),a=r==="fixed",i=bn(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const c=sr(0);function l(){c.x=Ep(n)}if(o||!o&&!a)if((Ro(t)!=="body"||vi(n))&&(s=fl(t)),o){const f=bn(t,!0,a,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else n&&l();a&&!o&&n&&l();const u=n&&!o&&!a?J$(n,s):sr(0),d=i.left+s.scrollLeft-c.x-u.x,m=i.top+s.scrollTop-c.y-u.y;return{x:d,y:m,width:i.width,height:i.height}}function gu(e){return Yt(e).position==="static"}function qv(e,t){if(!dr(e)||Yt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return fr(e)===r&&(r=r.ownerDocument.body),r}function Y$(e,t){const r=Et(e);if(ml(e))return r;if(!dr(e)){let n=Gr(e);for(;n&&!go(n);){if(Kt(n)&&!gu(n))return n;n=Gr(n)}return r}let o=qv(e,t);for(;o&&zB(o)&&gu(o);)o=qv(o,t);return o&&go(o)&&gu(o)&&!xp(o)?r:o||ZB(e)||r}const n8=async function(e){const t=this.getOffsetParent||Y$,r=this.getDimensions,o=await r(e.floating);return{reference:r8(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function o8(e){return Yt(e).direction==="rtl"}const a8={convertOffsetParentRelativeRectToViewportRelativeRect:HB,getDocumentElement:fr,getClippingRect:e8,getOffsetParent:Y$,getElementRects:n8,getClientRects:WB,getDimensions:t8,getScale:Yn,isElement:Kt,isRTL:o8};function X$(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function i8(e,t){let r=null,o;const n=fr(e);function a(){var s;clearTimeout(o),(s=r)==null||s.disconnect(),r=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();const l=e.getBoundingClientRect(),{left:u,top:d,width:m,height:f}=l;if(s||t(),!m||!f)return;const g=Li(d),h=Li(n.clientWidth-(u+m)),v=Li(n.clientHeight-(d+f)),b=Li(u),x={rootMargin:-g+"px "+-h+"px "+-v+"px "+-b+"px",threshold:St(0,Br(1,c))||1};let y=!0;function S(k){const T=k[0].intersectionRatio;if(T!==c){if(!y)return i();T?i(!1,T):o=setTimeout(()=>{i(!1,1e-7)},1e3)}T===1&&!X$(l,e.getBoundingClientRect())&&i(),y=!1}try{r=new IntersectionObserver(S,{...x,root:n.ownerDocument})}catch{r=new IntersectionObserver(S,x)}r.observe(e)}return i(!0),a}function s8(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=kp(e),u=n||a?[...l?Oa(l):[],...Oa(t)]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),a&&b.addEventListener("resize",r)});const d=l&&s?i8(l,r):null;let m=-1,f=null;i&&(f=new ResizeObserver(b=>{let[w]=b;w&&w.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=f)==null||x.observe(t)})),r()}),l&&!c&&f.observe(l),f.observe(t));let g,h=c?bn(e):null;c&&v();function v(){const b=bn(e);h&&!X$(h,b)&&r(),h=b,g=requestAnimationFrame(v)}return r(),()=>{var b;u.forEach(w=>{n&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),d?.(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const c8=RB,l8=NB,u8=OB,d8=jB,m8=CB,Bv=$B,f8=PB,p8=(e,t,r)=>{const o=new Map,n={platform:a8,...r},a={...n.platform,_c:o};return TB(e,t,{...n,platform:a})};var h8=typeof document<"u",g8=function(){},ts=h8?O.useLayoutEffect:g8;function Bs(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(!Bs(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 a=n[o];if(!(a==="_owner"&&e.$$typeof)&&!Bs(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Q$(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Gv(e,t){const r=Q$(e);return Math.round(t*r)/r}function vu(e){const t=_.useRef(e);return ts(()=>{t.current=e}),t}function v8(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:n,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=_.useState(o);Bs(m,o)||f(o);const[g,h]=_.useState(null),[v,b]=_.useState(null),w=_.useCallback(B=>{B!==k.current&&(k.current=B,h(B))},[]),x=_.useCallback(B=>{B!==T.current&&(T.current=B,b(B))},[]),y=a||g,S=i||v,k=_.useRef(null),T=_.useRef(null),A=_.useRef(u),U=c!=null,L=vu(c),W=vu(n),fe=vu(l),q=_.useCallback(()=>{if(!k.current||!T.current)return;const B={placement:t,strategy:r,middleware:m};W.current&&(B.platform=W.current),p8(k.current,T.current,B).then(ae=>{const F={...ae,isPositioned:fe.current!==!1};z.current&&!Bs(A.current,F)&&(A.current=F,uy.flushSync(()=>{d(F)}))})},[m,t,r,W,fe]);ts(()=>{l===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,d(B=>({...B,isPositioned:!1})))},[l]);const z=_.useRef(!1);ts(()=>(z.current=!0,()=>{z.current=!1}),[]),ts(()=>{if(y&&(k.current=y),S&&(T.current=S),y&&S){if(L.current)return L.current(y,S,q);q()}},[y,S,q,L,U]);const ve=_.useMemo(()=>({reference:k,floating:T,setReference:w,setFloating:x}),[w,x]),ee=_.useMemo(()=>({reference:y,floating:S}),[y,S]),J=_.useMemo(()=>{const B={position:r,left:0,top:0};if(!ee.floating)return B;const ae=Gv(ee.floating,u.x),F=Gv(ee.floating,u.y);return s?{...B,transform:"translate("+ae+"px, "+F+"px)",...Q$(ee.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ae,top:F}},[r,s,ee.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:q,refs:ve,elements:ee,floatingStyles:J}),[u,q,ve,ee,J])}const y8=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?Bv({element:o.current,padding:n}).fn(r):{}:o?Bv({element:o,padding:n}).fn(r):{}}}},b8=(e,t)=>({...c8(e),options:[e,t]}),_8=(e,t)=>({...l8(e),options:[e,t]}),w8=(e,t)=>({...f8(e),options:[e,t]}),x8=(e,t)=>({...u8(e),options:[e,t]}),S8=(e,t)=>({...d8(e),options:[e,t]}),k8=(e,t)=>({...m8(e),options:[e,t]}),E8=(e,t)=>({...y8(e),options:[e,t]});var I8="Arrow",e1=_.forwardRef((e,t)=>{const{children:r,width:o=10,height:n=5,...a}=e;return p.jsx(Be.svg,{...a,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"})})});e1.displayName=I8;var T8=e1;function $8(e){const[t,r]=_.useState(void 0);return zt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const a=n[0];let i,s;if("borderBoxSize"in a){const c=a.borderBoxSize,l=Array.isArray(c)?c[0]:c;i=l.inlineSize,s=l.blockSize}else i=e.offsetWidth,s=e.offsetHeight;r({width:i,height:s})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}var Ip="Popper",[t1,pl]=gi(Ip),[O8,r1]=t1(Ip),n1=e=>{const{__scopePopper:t,children:r}=e,[o,n]=_.useState(null);return p.jsx(O8,{scope:t,anchor:o,onAnchorChange:n,children:r})};n1.displayName=Ip;var o1="PopperAnchor",a1=_.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,a=r1(o1,r),i=_.useRef(null),s=_t(t,i),c=_.useRef(null);return _.useEffect(()=>{const l=c.current;c.current=o?.current||i.current,l!==c.current&&a.onAnchorChange(c.current)}),o?null:p.jsx(Be.div,{...n,ref:s})});a1.displayName=o1;var Tp="PopperContent",[C8,A8]=t1(Tp),i1=_.forwardRef((e,t)=>{const{__scopePopper:r,side:o="bottom",sideOffset:n=0,align:a="center",alignOffset:i=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:g,...h}=e,v=r1(Tp,r),[b,w]=_.useState(null),x=_t(t,we=>w(we)),[y,S]=_.useState(null),k=$8(y),T=k?.width??0,A=k?.height??0,U=o+(a!=="center"?"-"+a:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},W=Array.isArray(l)?l:[l],fe=W.length>0,q={padding:L,boundary:W.filter(N8),altBoundary:fe},{refs:z,floatingStyles:ve,placement:ee,isPositioned:J,middlewareData:B}=v8({strategy:"fixed",placement:U,whileElementsMounted:(...we)=>s8(...we,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[b8({mainAxis:n+A,alignmentAxis:i}),c&&_8({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?w8():void 0,...q}),c&&x8({...q}),S8({...q,apply:({elements:we,rects:ge,availableWidth:er,availableHeight:Lt})=>{const{width:gt,height:Yr}=ge.reference,Ue=we.floating.style;Ue.setProperty("--radix-popper-available-width",`${er}px`),Ue.setProperty("--radix-popper-available-height",`${Lt}px`),Ue.setProperty("--radix-popper-anchor-width",`${gt}px`),Ue.setProperty("--radix-popper-anchor-height",`${Yr}px`)}}),y&&E8({element:y,padding:s}),P8({arrowWidth:T,arrowHeight:A}),m&&k8({strategy:"referenceHidden",...q})]}),[ae,F]=l1(ee),_e=yn(g);zt(()=>{J&&_e?.()},[J,_e]);const ue=B.arrow?.x,Ie=B.arrow?.y,P=B.arrow?.centerOffset!==0,[V,le]=_.useState();return zt(()=>{b&&le(window.getComputedStyle(b).zIndex)},[b]),p.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...ve,transform:J?ve.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(C8,{scope:r,placedSide:ae,onArrowChange:S,arrowX:ue,arrowY:Ie,shouldHideArrow:P,children:p.jsx(Be.div,{"data-side":ae,"data-align":F,...h,ref:x,style:{...h.style,animation:J?void 0:"none"}})})})});i1.displayName=Tp;var s1="PopperArrow",R8={top:"bottom",right:"left",bottom:"top",left:"right"},c1=_.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,a=A8(s1,o),i=R8[a.placedSide];return p.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:p.jsx(T8,{...n,ref:r,style:{...n.style,display:"block"}})})});c1.displayName=s1;function N8(e){return e!==null}var P8=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:o,middlewareData:n}=t,i=n.arrow?.centerOffset!==0,s=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[l,u]=l1(r),d={start:"0%",center:"50%",end:"100%"}[u],m=(n.arrow?.x??0)+s/2,f=(n.arrow?.y??0)+c/2;let g="",h="";return l==="bottom"?(g=i?d:`${m}px`,h=`${-c}px`):l==="top"?(g=i?d:`${m}px`,h=`${o.floating.height+c}px`):l==="right"?(g=`${-c}px`,h=i?d:`${f}px`):l==="left"&&(g=`${o.floating.width+c}px`,h=i?d:`${f}px`),{data:{x:g,y:h}}}});function l1(e){const[t,r="center"]=e.split("-");return[t,r]}var u1=n1,$p=a1,d1=i1,m1=c1,j8="Portal",hl=_.forwardRef((e,t)=>{const{container:r,...o}=e,[n,a]=_.useState(!1);zt(()=>a(!0),[]);const i=r||n&&globalThis?.document?.body;return i?kd.createPortal(p.jsx(Be.div,{...o,ref:t}),i):null});hl.displayName=j8;function M8(e,t){return _.useReducer((r,o)=>t[r][o]??r,e)}var $r=e=>{const{present:t,children:r}=e,o=D8(t),n=typeof r=="function"?r({present:o.isPresent}):_.Children.only(r),a=_t(o.ref,z8(n));return typeof r=="function"||o.isPresent?_.cloneElement(n,{ref:a}):null};$r.displayName="Presence";function D8(e){const[t,r]=_.useState(),o=_.useRef(null),n=_.useRef(e),a=_.useRef("none"),i=e?"mounted":"unmounted",[s,c]=M8(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return _.useEffect(()=>{const l=Fi(o.current);a.current=s==="mounted"?l:"none"},[s]),zt(()=>{const l=o.current,u=n.current;if(u!==e){const m=a.current,f=Fi(l);e?c("MOUNT"):f==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&m!==f?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),zt(()=>{if(t){let l;const u=t.ownerDocument.defaultView??window,d=f=>{const h=Fi(o.current).includes(CSS.escape(f.animationName));if(f.target===t&&h&&(c("ANIMATION_END"),!n.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",l=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=f=>{f.target===t&&(a.current=Fi(o.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{u.clearTimeout(l),t.removeEventListener("animationstart",m),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 Fi(e){return e?.animationName||"none"}function z8(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 U8=_[" useInsertionEffect ".trim().toString()]||zt;function gl({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,a,i]=L8({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=F8(u)?u(e):u;d!==e&&i.current?.(d)}else a(u)},[s,e,a,i]);return[c,l]}function L8({defaultProp:e,onChange:t}){const[r,o]=_.useState(e),n=_.useRef(r),a=_.useRef(t);return U8(()=>{a.current=t},[t]),_.useEffect(()=>{n.current!==r&&(a.current?.(r),n.current=r)},[r,n]),[r,o,a]}function F8(e){return typeof e=="function"}var V8=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"}),Z8="VisuallyHidden",f1=_.forwardRef((e,t)=>p.jsx(Be.span,{...e,ref:t,style:{...V8,...e.style}}));f1.displayName=Z8;var q8=f1,[vl]=gi("Tooltip",[pl]),yl=pl(),p1="TooltipProvider",B8=700,wd="tooltip.open",[G8,Op]=vl(p1),h1=e=>{const{__scopeTooltip:t,delayDuration:r=B8,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:a}=e,i=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{const l=c.current;return()=>window.clearTimeout(l)},[]),p.jsx(G8,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,o)},[o]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(l=>{s.current=l},[]),disableHoverableContent:n,children:a})};h1.displayName=p1;var Ca="Tooltip",[H8,yi]=vl(Ca),g1=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:a,disableHoverableContent:i,delayDuration:s}=e,c=Op(Ca,e.__scopeTooltip),l=yl(t),[u,d]=_.useState(null),m=Kn(),f=_.useRef(0),g=i??c.disableHoverableContent,h=s??c.delayDuration,v=_.useRef(!1),[b,w]=gl({prop:o,defaultProp:n??!1,onChange:T=>{T?(c.onOpen(),document.dispatchEvent(new CustomEvent(wd))):c.onClose(),a?.(T)},caller:Ca}),x=_.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),y=_.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v.current=!1,w(!0)},[w]),S=_.useCallback(()=>{window.clearTimeout(f.current),f.current=0,w(!1)},[w]),k=_.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{v.current=!0,w(!0),f.current=0},h)},[h,w]);return _.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),p.jsx(u1,{...l,children:p.jsx(H8,{scope:t,contentId:m,open:b,stateAttribute:x,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?k():y()},[c.isOpenDelayedRef,k,y]),onTriggerLeave:_.useCallback(()=>{g?S():(window.clearTimeout(f.current),f.current=0)},[S,g]),onOpen:y,onClose:S,disableHoverableContent:g,children:r})})};g1.displayName=Ca;var xd="TooltipTrigger",v1=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=yi(xd,r),a=Op(xd,r),i=yl(r),s=_.useRef(null),c=_t(t,s,n.onTriggerChange),l=_.useRef(!1),u=_.useRef(!1),d=_.useCallback(()=>l.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),p.jsx($p,{asChild:!0,...i,children:p.jsx(Be.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...o,ref:c,onPointerMove:Le(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!a.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:Le(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:Le(e.onPointerDown,()=>{n.open&&n.onClose(),l.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Le(e.onFocus,()=>{l.current||n.onOpen()}),onBlur:Le(e.onBlur,n.onClose),onClick:Le(e.onClick,n.onClose)})})});v1.displayName=xd;var Cp="TooltipPortal",[W8,J8]=vl(Cp,{forceMount:void 0}),y1=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,a=yi(Cp,t);return p.jsx(W8,{scope:t,forceMount:r,children:p.jsx($r,{present:r||a.open,children:p.jsx(hl,{asChild:!0,container:n,children:o})})})};y1.displayName=Cp;var vo="TooltipContent",b1=_.forwardRef((e,t)=>{const r=J8(vo,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...a}=e,i=yi(vo,e.__scopeTooltip);return p.jsx($r,{present:o||i.open,children:i.disableHoverableContent?p.jsx(_1,{side:n,...a,ref:t}):p.jsx(K8,{side:n,...a,ref:t})})}),K8=_.forwardRef((e,t)=>{const r=yi(vo,e.__scopeTooltip),o=Op(vo,e.__scopeTooltip),n=_.useRef(null),a=_t(t,n),[i,s]=_.useState(null),{trigger:c,onClose:l}=r,u=n.current,{onPointerInTransitChange:d}=o,m=_.useCallback(()=>{s(null),d(!1)},[d]),f=_.useCallback((g,h)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},w=eG(b,v.getBoundingClientRect()),x=tG(b,w),y=rG(h.getBoundingClientRect()),S=oG([...x,...y]);s(S),d(!0)},[d]);return _.useEffect(()=>()=>m(),[m]),_.useEffect(()=>{if(c&&u){const g=v=>f(v,u),h=v=>f(v,c);return c.addEventListener("pointerleave",g),u.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",h)}}},[c,u,f,m]),_.useEffect(()=>{if(i){const g=h=>{const v=h.target,b={x:h.clientX,y:h.clientY},w=c?.contains(v)||u?.contains(v),x=!nG(b,i);w?m():x&&(m(),l())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,u,i,l,m]),p.jsx(_1,{...e,ref:a})}),[Y8,X8]=vl(Ca,{isInside:!1}),Q8=eB("TooltipContent"),_1=_.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:i,...s}=e,c=yi(vo,r),l=yl(r),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(wd,u),()=>document.removeEventListener(wd,u)),[u]),_.useEffect(()=>{if(c.trigger){const d=m=>{m.target?.contains(c.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[c.trigger,u]),p.jsx(ul,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:p.jsxs(d1,{"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(Q8,{children:o}),p.jsx(Y8,{scope:r,isInside:!0,children:p.jsx(q8,{id:c.contentId,role:"tooltip",children:n||o})})]})})});b1.displayName=vo;var w1="TooltipArrow",x1=_.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=yl(r);return X8(w1,r).isInside?null:p.jsx(m1,{...n,...o,ref:t})});x1.displayName=w1;function eG(e,t){const r=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,o,n,a)){case a:return"left";case n:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function tG(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 rG(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 nG(e,t){const{x:r,y:o}=e;let n=!1;for(let a=0,i=t.length-1;a<t.length;i=a++){const s=t[a],c=t[i],l=s.x,u=s.y,d=c.x,m=c.y;u>o!=m>o&&r<(d-l)*(o-u)/(m-u)+l&&(n=!n)}return n}function oG(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),aG(t)}function aG(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 a=t[t.length-1],i=t[t.length-2];if((a.x-i.x)*(n.y-i.y)>=(a.y-i.y)*(n.x-i.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 a=r[r.length-1],i=r[r.length-2];if((a.x-i.x)*(n.y-i.y)>=(a.y-i.y)*(n.x-i.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 iG=h1,sG=g1,cG=v1,lG=y1,uG=b1,dG=x1;const S1=O.createContext(null);function Ap(){return O.useContext(S1)?.current??null}function Rp({delayDuration:e=0,...t}){return p.jsx(iG,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function bi({...e}){return p.jsx(Rp,{children:p.jsx(sG,{"data-slot":"tooltip",...e})})}function _i({...e}){return p.jsx(cG,{"data-slot":"tooltip-trigger",...e})}function wi({className:e,sideOffset:t=0,children:r,container:o,...n}){const a=Ap();return p.jsx(lG,{container:o??a,children:p.jsxs(uG,{"data-slot":"tooltip-content",sideOffset:t,className:I.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-[70] 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(dG,{className:"bg-foreground fill-foreground z-[70] size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px]"})]})})}var yu="focusScope.autoFocusOnMount",bu="focusScope.autoFocusOnUnmount",Hv={bubbles:!1,cancelable:!0},mG="FocusScope",Np=_.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:a,...i}=e,[s,c]=_.useState(null),l=yn(n),u=yn(a),d=_.useRef(null),m=_t(t,h=>c(h)),f=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(o){let h=function(x){if(f.paused||!s)return;const y=x.target;s.contains(y)?d.current=y:Cr(d.current,{select:!0})},v=function(x){if(f.paused||!s)return;const y=x.relatedTarget;y!==null&&(s.contains(y)||Cr(d.current,{select:!0}))},b=function(x){if(document.activeElement===document.body)for(const S of x)S.removedNodes.length>0&&Cr(s)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const w=new MutationObserver(b);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),w.disconnect()}}},[o,s,f.paused]),_.useEffect(()=>{if(s){Jv.add(f);const h=document.activeElement;if(!s.contains(h)){const b=new CustomEvent(yu,Hv);s.addEventListener(yu,l),s.dispatchEvent(b),b.defaultPrevented||(fG(yG(k1(s)),{select:!0}),document.activeElement===h&&Cr(s))}return()=>{s.removeEventListener(yu,l),setTimeout(()=>{const b=new CustomEvent(bu,Hv);s.addEventListener(bu,u),s.dispatchEvent(b),b.defaultPrevented||Cr(h??document.body,{select:!0}),s.removeEventListener(bu,u),Jv.remove(f)},0)}}},[s,l,u,f]);const g=_.useCallback(h=>{if(!r&&!o||f.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,b=document.activeElement;if(v&&b){const w=h.currentTarget,[x,y]=pG(w);x&&y?!h.shiftKey&&b===y?(h.preventDefault(),r&&Cr(x,{select:!0})):h.shiftKey&&b===x&&(h.preventDefault(),r&&Cr(y,{select:!0})):b===w&&h.preventDefault()}},[r,o,f.paused]);return p.jsx(Be.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});Np.displayName=mG;function fG(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(Cr(o,{select:t}),document.activeElement!==r)return}function pG(e){const t=k1(e),r=Wv(t,e),o=Wv(t.reverse(),e);return[r,o]}function k1(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 Wv(e,t){for(const r of e)if(!hG(r,{upTo:t}))return r}function hG(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 gG(e){return e instanceof HTMLInputElement&&"select"in e}function Cr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&gG(e)&&t&&e.select()}}var Jv=vG();function vG(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Kv(e,t),e.unshift(t)},remove(t){e=Kv(e,t),e[0]?.resume()}}}function Kv(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function yG(e){return e.filter(t=>t.tagName!=="A")}var _u=0;function E1(){_.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Yv()),document.body.insertAdjacentElement("beforeend",e[1]??Yv()),_u++,()=>{_u===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_u--}},[])}function Yv(){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 nr=function(){return nr=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},nr.apply(this,arguments)};function I1(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 bG(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}var rs="right-scroll-bar-position",ns="width-before-scroll-bar",_G="with-scroll-bars-hidden",wG="--removed-body-scroll-bar-size";function wu(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function xG(e,t){var r=O.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 SG=typeof window<"u"?_.useLayoutEffect:_.useEffect,Xv=new WeakMap;function kG(e,t){var r=xG(null,function(o){return e.forEach(function(n){return wu(n,o)})});return SG(function(){var o=Xv.get(r);if(o){var n=new Set(o),a=new Set(e),i=r.current;n.forEach(function(s){a.has(s)||wu(s,null)}),a.forEach(function(s){n.has(s)||wu(s,i)})}Xv.set(r,e)},[e]),r}function EG(e){return e}function IG(e,t){t===void 0&&(t=EG);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(a){var i=t(a,o);return r.push(i),function(){r=r.filter(function(s){return s!==i})}},assignSyncMedium:function(a){for(o=!0;r.length;){var i=r;r=[],i.forEach(a)}r={push:function(s){return a(s)},filter:function(){return r}}},assignMedium:function(a){o=!0;var i=[];if(r.length){var s=r;r=[],s.forEach(a),i=r}var c=function(){var u=i;i=[],u.forEach(a)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(u){i.push(u),l()},filter:function(u){return i=i.filter(u),r}}}};return n}function TG(e){e===void 0&&(e={});var t=IG(null);return t.options=nr({async:!0,ssr:!1},e),t}var T1=function(e){var t=e.sideCar,r=I1(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,nr({},r))};T1.isSideCarExport=!0;function $G(e,t){return e.useMedium(t),T1}var $1=TG(),xu=function(){},bl=_.forwardRef(function(e,t){var r=_.useRef(null),o=_.useState({onScrollCapture:xu,onWheelCapture:xu,onTouchMoveCapture:xu}),n=o[0],a=o[1],i=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,m=e.sideCar,f=e.noRelative,g=e.noIsolation,h=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,x=e.gapMode,y=I1(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,k=kG([r,t]),T=nr(nr({},y),n);return _.createElement(_.Fragment,null,u&&_.createElement(S,{sideCar:$1,removeScrollBar:l,shards:d,noRelative:f,noIsolation:g,inert:h,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:x}),i?_.cloneElement(_.Children.only(s),nr(nr({},T),{ref:k})):_.createElement(w,nr({},T,{className:c,ref:k}),s))});bl.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};bl.classNames={fullWidth:ns,zeroRight:rs};var OG=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function CG(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=OG();return t&&e.setAttribute("nonce",t),e}function AG(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function RG(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var NG=function(){var e=0,t=null;return{add:function(r){e==0&&(t=CG())&&(AG(t,r),RG(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},PG=function(){var e=NG();return function(t,r){_.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},O1=function(){var e=PG(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},jG={left:0,top:0,right:0,gap:0},Su=function(e){return parseInt(e||"",10)||0},MG=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[Su(r),Su(o),Su(n)]},DG=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jG;var t=MG(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])}},zG=O1(),Xn="data-scroll-locked",UG=function(e,t,r,o){var n=e.left,a=e.top,i=e.right,s=e.gap;return r===void 0&&(r="margin"),`
109
- .`.concat(_G,` {
110
- overflow: hidden `).concat(o,`;
111
- padding-right: `).concat(s,"px ").concat(o,`;
112
- }
113
- body[`).concat(Xn,`] {
114
- overflow: hidden `).concat(o,`;
115
- overscroll-behavior: contain;
116
- `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
117
- padding-left: `.concat(n,`px;
118
- padding-top: `).concat(a,`px;
119
- padding-right: `).concat(i,`px;
120
- margin-left:0;
121
- margin-top:0;
122
- margin-right: `).concat(s,"px ").concat(o,`;
123
- `),r==="padding"&&"padding-right: ".concat(s,"px ").concat(o,";")].filter(Boolean).join(""),`
124
- }
125
-
126
- .`).concat(rs,` {
127
- right: `).concat(s,"px ").concat(o,`;
128
- }
129
-
130
- .`).concat(ns,` {
131
- margin-right: `).concat(s,"px ").concat(o,`;
132
- }
133
-
134
- .`).concat(rs," .").concat(rs,` {
135
- right: 0 `).concat(o,`;
136
- }
137
-
138
- .`).concat(ns," .").concat(ns,` {
139
- margin-right: 0 `).concat(o,`;
140
- }
141
-
142
- body[`).concat(Xn,`] {
143
- `).concat(wG,": ").concat(s,`px;
144
- }
145
- `)},Qv=function(){var e=parseInt(document.body.getAttribute(Xn)||"0",10);return isFinite(e)?e:0},LG=function(){_.useEffect(function(){return document.body.setAttribute(Xn,(Qv()+1).toString()),function(){var e=Qv()-1;e<=0?document.body.removeAttribute(Xn):document.body.setAttribute(Xn,e.toString())}},[])},FG=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;LG();var a=_.useMemo(function(){return DG(n)},[n]);return _.createElement(zG,{styles:UG(a,!t,n,r?"":"!important")})},Sd=!1;if(typeof window<"u")try{var Vi=Object.defineProperty({},"passive",{get:function(){return Sd=!0,!0}});window.addEventListener("test",Vi,Vi),window.removeEventListener("test",Vi,Vi)}catch{Sd=!1}var Un=Sd?{passive:!1}:!1,VG=function(e){return e.tagName==="TEXTAREA"},C1=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!VG(e)&&r[t]==="visible")},ZG=function(e){return C1(e,"overflowY")},qG=function(e){return C1(e,"overflowX")},ey=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=A1(e,o);if(n){var a=R1(e,o),i=a[1],s=a[2];if(i>s)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},BG=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},GG=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},A1=function(e,t){return e==="v"?ZG(t):qG(t)},R1=function(e,t){return e==="v"?BG(t):GG(t)},HG=function(e,t){return e==="h"&&t==="rtl"?-1:1},WG=function(e,t,r,o,n){var a=HG(e,window.getComputedStyle(t).direction),i=a*o,s=r.target,c=t.contains(s),l=!1,u=i>0,d=0,m=0;do{if(!s)break;var f=R1(e,s),g=f[0],h=f[1],v=f[2],b=h-v-a*g;(g||b)&&A1(e,s)&&(d+=b,m+=g);var w=s.parentNode;s=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&Math.abs(d)<1||!u&&Math.abs(m)<1)&&(l=!0),l},Zi=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ty=function(e){return[e.deltaX,e.deltaY]},ry=function(e){return e&&"current"in e?e.current:e},JG=function(e,t){return e[0]===t[0]&&e[1]===t[1]},KG=function(e){return`
146
- .block-interactivity-`.concat(e,` {pointer-events: none;}
147
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
148
- `)},YG=0,Ln=[];function XG(e){var t=_.useRef([]),r=_.useRef([0,0]),o=_.useRef(),n=_.useState(YG++)[0],a=_.useState(O1)[0],i=_.useRef(e);_.useEffect(function(){i.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var h=bG([e.lockRef.current],(e.shards||[]).map(ry),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var b=Zi(h),w=r.current,x="deltaX"in h?h.deltaX:w[0]-b[0],y="deltaY"in h?h.deltaY:w[1]-b[1],S,k=h.target,T=Math.abs(x)>Math.abs(y)?"h":"v";if("touches"in h&&T==="h"&&k.type==="range")return!1;var A=ey(T,k);if(!A)return!0;if(A?S=T:(S=T==="v"?"h":"v",A=ey(T,k)),!A)return!1;if(!o.current&&"changedTouches"in h&&(x||y)&&(o.current=S),!S)return!0;var U=o.current||S;return WG(U,v,h,U==="h"?x:y)},[]),c=_.useCallback(function(h){var v=h;if(!(!Ln.length||Ln[Ln.length-1]!==a)){var b="deltaY"in v?ty(v):Zi(v),w=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&JG(S.delta,b)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var x=(i.current.shards||[]).map(ry).filter(Boolean).filter(function(S){return S.contains(v.target)}),y=x.length>0?s(v,x[0]):!i.current.noIsolation;y&&v.cancelable&&v.preventDefault()}}},[]),l=_.useCallback(function(h,v,b,w){var x={name:h,delta:v,target:b,should:w,shadowParent:QG(b)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(y){return y!==x})},1)},[]),u=_.useCallback(function(h){r.current=Zi(h),o.current=void 0},[]),d=_.useCallback(function(h){l(h.type,ty(h),h.target,s(h,e.lockRef.current))},[]),m=_.useCallback(function(h){l(h.type,Zi(h),h.target,s(h,e.lockRef.current))},[]);_.useEffect(function(){return Ln.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Un),document.addEventListener("touchmove",c,Un),document.addEventListener("touchstart",u,Un),function(){Ln=Ln.filter(function(h){return h!==a}),document.removeEventListener("wheel",c,Un),document.removeEventListener("touchmove",c,Un),document.removeEventListener("touchstart",u,Un)}},[]);var f=e.removeScrollBar,g=e.inert;return _.createElement(_.Fragment,null,g?_.createElement(a,{styles:KG(n)}):null,f?_.createElement(FG,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function QG(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const eH=$G($1,XG);var Pp=_.forwardRef(function(e,t){return _.createElement(bl,nr({},e,{ref:t,sideCar:eH}))});Pp.classNames=bl.classNames;var tH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Fn=new WeakMap,qi=new WeakMap,Bi={},ku=0,N1=function(e){return e&&(e.host||N1(e.parentNode))},rH=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})},nH=function(e,t,r,o){var n=rH(t,Array.isArray(e)?e:[e]);Bi[r]||(Bi[r]=new WeakMap);var a=Bi[r],i=[],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(m){if(s.has(m))u(m);else try{var f=m.getAttribute(o),g=f!==null&&f!=="false",h=(Fn.get(m)||0)+1,v=(a.get(m)||0)+1;Fn.set(m,h),a.set(m,v),i.push(m),h===1&&g&&qi.set(m,!0),v===1&&m.setAttribute(r,"true"),g||m.setAttribute(o,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),s.clear(),ku++,function(){i.forEach(function(d){var m=Fn.get(d)-1,f=a.get(d)-1;Fn.set(d,m),a.set(d,f),m||(qi.has(d)||d.removeAttribute(o),qi.delete(d)),f||d.removeAttribute(r)}),ku--,ku||(Fn=new WeakMap,Fn=new WeakMap,qi=new WeakMap,Bi={})}},P1=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=tH(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),nH(o,n,r,"aria-hidden")):function(){return null}},_l="Dialog",[j1]=gi(_l),[oH,Qt]=j1(_l),M1=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:n,onOpenChange:a,modal:i=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=gl({prop:o,defaultProp:n??!1,onChange:a,caller:_l});return p.jsx(oH,{scope:t,triggerRef:s,contentRef:c,contentId:Kn(),titleId:Kn(),descriptionId:Kn(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(d=>!d),[u]),modal:i,children:r})};M1.displayName=_l;var D1="DialogTrigger",z1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Qt(D1,r),a=_t(t,n.triggerRef);return p.jsx(Be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Dp(n.open),...o,ref:a,onClick:Le(e.onClick,n.onOpenToggle)})});z1.displayName=D1;var jp="DialogPortal",[aH,U1]=j1(jp,{forceMount:void 0}),L1=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:n}=e,a=Qt(jp,t);return p.jsx(aH,{scope:t,forceMount:r,children:_.Children.map(o,i=>p.jsx($r,{present:r||a.open,children:p.jsx(hl,{asChild:!0,container:n,children:i})}))})};L1.displayName=jp;var Gs="DialogOverlay",F1=_.forwardRef((e,t)=>{const r=U1(Gs,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,a=Qt(Gs,e.__scopeDialog);return a.modal?p.jsx($r,{present:o||a.open,children:p.jsx(sH,{...n,ref:t})}):null});F1.displayName=Gs;var iH=yp("DialogOverlay.RemoveScroll"),sH=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Qt(Gs,r);return p.jsx(Pp,{as:iH,allowPinchZoom:!0,shards:[n.contentRef],children:p.jsx(Be.div,{"data-state":Dp(n.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),_n="DialogContent",V1=_.forwardRef((e,t)=>{const r=U1(_n,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,a=Qt(_n,e.__scopeDialog);return p.jsx($r,{present:o||a.open,children:a.modal?p.jsx(cH,{...n,ref:t}):p.jsx(lH,{...n,ref:t})})});V1.displayName=_n;var cH=_.forwardRef((e,t)=>{const r=Qt(_n,e.__scopeDialog),o=_.useRef(null),n=_t(t,r.contentRef,o);return _.useEffect(()=>{const a=o.current;if(a)return P1(a)},[]),p.jsx(Z1,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(e.onCloseAutoFocus,a=>{a.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Le(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&a.preventDefault()}),onFocusOutside:Le(e.onFocusOutside,a=>a.preventDefault())})}),lH=_.forwardRef((e,t)=>{const r=Qt(_n,e.__scopeDialog),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(Z1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(o.current||r.triggerRef.current?.focus(),a.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),Z1=_.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:a,...i}=e,s=Qt(_n,r),c=_.useRef(null),l=_t(t,c);return E1(),p.jsxs(p.Fragment,{children:[p.jsx(Np,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:a,children:p.jsx(ul,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":Dp(s.open),...i,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(dH,{titleId:s.titleId}),p.jsx(fH,{contentRef:c,descriptionId:s.descriptionId})]})]})}),Mp="DialogTitle",q1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Qt(Mp,r);return p.jsx(Be.h2,{id:n.titleId,...o,ref:t})});q1.displayName=Mp;var B1="DialogDescription",uH=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Qt(B1,r);return p.jsx(Be.p,{id:n.descriptionId,...o,ref:t})});uH.displayName=B1;var G1="DialogClose",H1=_.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Qt(G1,r);return p.jsx(Be.button,{type:"button",...o,ref:t,onClick:Le(e.onClick,()=>n.onOpenChange(!1))})});H1.displayName=G1;function Dp(e){return e?"open":"closed"}var W1="DialogTitleWarning",[pJ,J1]=Yq(W1,{contentName:_n,titleName:Mp,docsSlug:"dialog"}),dH=({titleId:e})=>{const t=J1(W1),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
149
-
150
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
151
-
152
- 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},mH="DialogDescriptionWarning",fH=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${J1(mH).contentName}}.`;return _.useEffect(()=>{const n=e.current?.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},pH=M1,hH=z1,gH=L1,vH=F1,yH=V1,bH=q1,_H=H1;function wH({...e}){return p.jsx(pH,{"data-slot":"dialog",...e})}function xH({...e}){return p.jsx(hH,{"data-slot":"dialog-trigger",...e})}function SH({container:e,...t}){const r=Ap();return p.jsx(gH,{"data-slot":"dialog-portal",container:e??r,...t})}function kH({className:e,...t}){return p.jsx(vH,{"data-slot":"dialog-overlay",className:I.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 EH({className:e,children:t,showCloseButton:r=!0,...o}){return p.jsxs(SH,{"data-slot":"dialog-portal",children:[p.jsx(kH,{}),p.jsxs(yH,{"data-slot":"dialog-content",className:I.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(_H,{"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($n,{}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function IH({className:e,...t}){return p.jsx(bH,{"data-slot":"dialog-title",className:I.cn("text-lg leading-none font-semibold",e),...t})}function TH(e,t=[]){let r=[];function o(a,i){const s=_.createContext(i);s.displayName=a+"Context";const c=r.length;r=[...r,i];const l=d=>{const{scope:m,children:f,...g}=d,h=m?.[e]?.[c]||s,v=_.useMemo(()=>g,Object.values(g));return p.jsx(h.Provider,{value:v,children:f})};l.displayName=a+"Provider";function u(d,m){const f=m?.[e]?.[c]||s,g=_.useContext(f);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[l,u]}const n=()=>{const a=r.map(i=>_.createContext(i));return function(s){const c=s?.[e]||a;return _.useMemo(()=>({[`__scope${e}`]:{...s,[e]:c}}),[s,c])}};return n.scopeName=e,[o,$H(n,...t)]}function $H(...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(a){const i=o.reduce((s,{useScope:c,scopeName:l})=>{const d=c(a)[`__scope${l}`];return{...s,...d}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return r.scopeName=t.scopeName,r}var OH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zp=OH.reduce((e,t)=>{const r=D$(`Primitive.${t}`),o=_.forwardRef((n,a)=>{const{asChild:i,...s}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(c,{...s,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),Gi={exports:{}},Eu={};var ny;function CH(){if(ny)return Eu;ny=1;var e=O;function t(d,m){return d===m&&(d!==0||1/d===1/m)||d!==d&&m!==m}var r=typeof Object.is=="function"?Object.is:t,o=e.useState,n=e.useEffect,a=e.useLayoutEffect,i=e.useDebugValue;function s(d,m){var f=m(),g=o({inst:{value:f,getSnapshot:m}}),h=g[0].inst,v=g[1];return a(function(){h.value=f,h.getSnapshot=m,c(h)&&v({inst:h})},[d,f,m]),n(function(){return c(h)&&v({inst:h}),d(function(){c(h)&&v({inst:h})})},[d]),i(f),f}function c(d){var m=d.getSnapshot;d=d.value;try{var f=m();return!r(d,f)}catch{return!0}}function l(d,m){return m()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:s;return Eu.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Eu}var Iu={};var oy;function AH(){return oy||(oy=1,process.env.NODE_ENV!=="production"&&(function(){function e(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}function t(f,g){u||n.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=g();if(!d){var v=g();a(h,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}v=i({inst:{value:h,getSnapshot:g}});var b=v[0].inst,w=v[1];return c(function(){b.value=h,b.getSnapshot=g,r(b)&&w({inst:b})},[f,h,g]),s(function(){return r(b)&&w({inst:b}),f(function(){r(b)&&w({inst:b})})},[f]),l(h),h}function r(f){var g=f.getSnapshot;f=f.value;try{var h=g();return!a(f,h)}catch{return!0}}function o(f,g){return g()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var n=O,a=typeof Object.is=="function"?Object.is:e,i=n.useState,s=n.useEffect,c=n.useLayoutEffect,l=n.useDebugValue,u=!1,d=!1,m=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o:t;Iu.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Iu}var ay;function RH(){return ay||(ay=1,process.env.NODE_ENV==="production"?Gi.exports=CH():Gi.exports=AH()),Gi.exports}var NH=RH();function PH(){return NH.useSyncExternalStore(jH,()=>!0,()=>!1)}function jH(){return()=>{}}var Up="Avatar",[MH]=TH(Up),[DH,K1]=MH(Up),Y1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,...o}=e,[n,a]=_.useState("idle");return p.jsx(DH,{scope:r,imageLoadingStatus:n,onImageLoadingStatusChange:a,children:p.jsx(zp.span,{...o,ref:t})})});Y1.displayName=Up;var X1="AvatarImage",Q1=_.forwardRef((e,t)=>{const{__scopeAvatar:r,src:o,onLoadingStatusChange:n=()=>{},...a}=e,i=K1(X1,r),s=zH(o,a),c=yn(l=>{n(l),i.onImageLoadingStatusChange(l)});return zt(()=>{s!=="idle"&&c(s)},[s,c]),s==="loaded"?p.jsx(zp.img,{...a,ref:t,src:o}):null});Q1.displayName=X1;var eO="AvatarFallback",tO=_.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:o,...n}=e,a=K1(eO,r),[i,s]=_.useState(o===void 0);return _.useEffect(()=>{if(o!==void 0){const c=window.setTimeout(()=>s(!0),o);return()=>window.clearTimeout(c)}},[o]),i&&a.imageLoadingStatus!=="loaded"?p.jsx(zp.span,{...n,ref:t}):null});tO.displayName=eO;function iy(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function zH(e,{referrerPolicy:t,crossOrigin:r}){const o=PH(),n=_.useRef(null),a=o?(n.current||(n.current=new window.Image),n.current):null,[i,s]=_.useState(()=>iy(a,e));return zt(()=>{s(iy(a,e))},[a,e]),zt(()=>{const c=d=>()=>{s(d)};if(!a)return;const l=c("loaded"),u=c("error");return a.addEventListener("load",l),a.addEventListener("error",u),t&&(a.referrerPolicy=t),typeof r=="string"&&(a.crossOrigin=r),()=>{a.removeEventListener("load",l),a.removeEventListener("error",u)}},[a,r,t]),i}var UH=Y1,LH=Q1,FH=tO;function VH({className:e,...t}){return p.jsx(UH,{"data-slot":"avatar",className:I.cn("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function ZH({className:e,...t}){return p.jsx(LH,{"data-slot":"avatar-image",className:I.cn("aspect-square size-full",e),...t})}function qH({className:e,...t}){return p.jsx(FH,{"data-slot":"avatar-fallback",className:I.cn("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}const Xt=O.forwardRef(({children:e,tooltip:t,side:r="bottom",align:o="center",className:n,...a},i)=>p.jsxs(bi,{children:[p.jsx(_i,{asChild:!0,children:p.jsxs(rt,{variant:"ghost",size:"icon",...a,className:I.cn("aui-button-icon size-6 p-1",n),ref:i,children:[p.jsx(qq,{children:e}),p.jsx("span",{className:"aui-sr-only sr-only",children:t})]})}),p.jsx(wi,{side:r,align:o,children:t})]}));Xt.displayName="TooltipIconButton";const BH=e=>{const[t,r]=O.useState(void 0);return O.useEffect(()=>{if(!e){r(void 0);return}const o=URL.createObjectURL(e);return r(o),()=>{URL.revokeObjectURL(o)}},[e]),t},rO=()=>{const{file:e,src:t}=j.useAssistantState(DO.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 BH(e)??t},GH=({src:e})=>{const[t,r]=O.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)})},HH=({children:e})=>{const t=rO();return t?p.jsxs(wH,{children:[p.jsx(xH,{className:"aui-attachment-preview-trigger",asChild:!0,children:e}),p.jsxs(EH,{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(IH,{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(GH,{src:t})})]})]}):e},WH=()=>{const e=j.useAssistantState(({attachment:r})=>r.type==="image"),t=rO();return p.jsxs(VH,{className:"aui-attachment-tile-avatar h-full w-full rounded-none",children:[p.jsx(ZH,{src:t,alt:"Attachment preview",className:"aui-attachment-tile-image object-cover"}),p.jsx(qH,{delayMs:e?200:0,children:p.jsx(P5,{className:"aui-attachment-tile-fallback-icon text-muted-foreground size-8"})})]})},nO=()=>{const t=j.useAssistantApi().attachment.source==="composer",r=j.useAssistantState(({attachment:n})=>n.type==="image"),o=j.useAssistantState(({attachment:n})=>{const a=n.type;switch(a){case"image":return"Image";case"document":return"Document";case"file":return"File";default:{const i=a;throw new Error(`Unknown attachment type: ${i}`)}}});return p.jsxs(bi,{children:[p.jsxs(j.AttachmentPrimitive.Root,{className:I.cn("aui-attachment-root relative",r&&"aui-attachment-root-composer only:[&>#attachment-tile]:size-24"),children:[p.jsx(HH,{children:p.jsx(_i,{asChild:!0,children:p.jsx("div",{className:I.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(WH,{})})})}),t&&p.jsx(JH,{})]}),p.jsx(wi,{side:"top",children:p.jsx(j.AttachmentPrimitive.Name,{})})]})},JH=()=>p.jsx(j.AttachmentPrimitive.Remove,{asChild:!0,children:p.jsx(Xt,{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($n,{className:"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]"})})}),KH=()=>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(j.MessagePrimitive.Attachments,{components:{Attachment:nO}})}),YH=()=>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(j.ComposerPrimitive.Attachments,{components:{Attachment:nO}})}),XH=()=>p.jsx(j.ComposerPrimitive.AddAttachment,{asChild:!0,children:p.jsx(Xt,{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(mI,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})}),QH=C({suggestions:D(E()).describe("Array of follow-up questions")}),e7=C({isQuestion:ft().describe("Whether the message ends by asking the user a question that requires their input or response")}),t7="openai/gpt-4o-mini";function r7(){const{config:e}=I.useElements(),t=hp({auth:e.api,projectSlug:e.projectSlug}),r=e.thread?.followUpSuggestions!==!1,[o,n]=O.useState([]),[a,i]=O.useState(!1),s=O.useRef(null),c=O.useRef(null),l=j.useAssistantState(({thread:f})=>f.isRunning),u=j.useAssistantState(({thread:f})=>f.messages),d=If(e),m=O.useCallback(async()=>{if(!r||t.isLoading||!t.headers)return;const f=u.slice(-10).map(v=>{const b=v.parts.filter(w=>w.type==="text").map(w=>"text"in w?w.text:"").join(`
153
- `);return{role:v.role,content:b}});if(f.length===0)return;let g="";for(let v=f.length-1;v>=0;v--){const b=f[v];if(b.role==="assistant"){g=b.content;break}}c.current&&c.current.abort();const h=new AbortController;c.current=h,i(!0);try{const b=rp({baseURL:d,apiKey:"unused, but must be set",headers:t.headers}).chat(t7);if(g)try{if((await Cv({model:b,schema:e7,prompt:`Does this message end by asking the user a question that requires their input or response?
154
-
155
- Message:
156
- ${g}`,abortSignal:h.signal})).object.isQuestion){c.current===h&&(n([]),i(!1),c.current=null);return}}catch(k){console.warn("Failed to check if message is a question:",k)}const w=f.map(k=>`${k.role}: ${k.content}`).join(`
157
- `),x=3,y=`Generate exactly ${x} follow-up questions the user could ask to learn MORE from the assistant.
158
-
159
- The user wants to dig deeper into what the assistant just explained. Generate questions that ask the assistant to elaborate, compare, or provide more details.
160
-
161
- Good examples:
162
- - "How does X compare to Y?"
163
- - "Can you explain more about Z?"
164
- - "What are the pros and cons of X?"
165
-
166
- Rules:
167
- - Focus on the informational content the assistant provided
168
- - Ask for elaboration, comparisons, or deeper explanations
169
- - Keep each question concise (under 12 words)
170
- - No numbering or bullet points
171
- - One question per line, nothing else`,S=await Cv({model:b,schema:QH,prompt:`${y}
172
-
173
- Conversation:
174
- ${w}`,abortSignal:h.signal});c.current===h&&n(S.object.suggestions.slice(0,x).map(k=>({id:crypto.randomUUID(),prompt:k})))}catch(v){if(v instanceof Error&&v.name==="AbortError")return;console.error("Error generating follow-on suggestions:",v),c.current===h&&n([])}finally{c.current===h&&(i(!1),c.current=null)}},[r,d,t.headers,t.isLoading,u]);return O.useEffect(()=>{if(l){c.current&&(c.current.abort(),c.current=null),n([]),i(!1);return}if(u.length===0)return;const f=u[u.length-1];!f||f.role!=="assistant"||s.current!==f.id&&(s.current=f.id,m())},[l,u,m]),O.useEffect(()=>()=>{c.current&&c.current.abort()},[]),{suggestions:o,isLoading:a}}const Qe=[.23,1,.32,1],n7={hidden:{opacity:0,y:8,scale:.95},visible:e=>({opacity:1,y:0,scale:1,transition:{duration:.3,delay:.1*e,ease:Qe}}),exit:{opacity:0,y:-4,scale:.98,transition:{duration:.15,ease:Qe}}},o7={hidden:{opacity:0},visible:{opacity:1,transition:{staggerChildren:.08,delayChildren:.1}},exit:{opacity:0,transition:{staggerChildren:.03,staggerDirection:-1}}},a7=()=>{const{suggestions:e,isLoading:t}=r7(),r=I.useRadius(),o=I.useDensity(),n=!t&&e.length>0;return p.jsx("div",{className:I.cn("aui-follow-on-suggestions w-full",o("gap-sm"),o("py-sm"),o("px-md")),children:p.jsx(Ye.AnimatePresence,{mode:"wait",children:n&&p.jsx(Ve.div,{variants:o7,initial:"hidden",animate:"visible",exit:"exit",className:"flex flex-wrap gap-2",children:e.map((a,i)=>p.jsx(Ve.div,{variants:n7,custom:i,initial:"hidden",animate:"visible",exit:"exit",children:p.jsx(j.ThreadPrimitive.Suggestion,{prompt:a.prompt,send:!0,asChild:!0,children:p.jsx(rt,{variant:"outline",size:"sm",className:I.cn("aui-follow-on-suggestion text-muted-foreground hover:text-foreground h-auto cursor-pointer text-left text-sm whitespace-normal transition-colors",o("px-md"),o("py-sm"),r("lg")),children:a.prompt})})},a.id))},"suggestions-container")})})};function i7(e){return O.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 s7=()=>{const{plugins:e}=I.useElements(),t=i7(e);return p.jsx($u.MarkdownTextPrimitive,{remarkPlugins:[zO],className:"aui-md",components:u7,componentsByLanguage:t})},oO=O.memo(s7),c7=({language:e,code:t})=>{const o=j.useAssistantState(({message:s})=>s).status?.type==="complete",{isCopied:n,copyToClipboard:a}=l7(),i=()=>{!t||n||a(t)};return 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}),o&&p.jsxs(Xt,{tooltip:"Copy",onClick:i,children:[!n&&p.jsx(Jf,{}),n&&p.jsx(zr,{})]})]})},l7=({copiedDuration:e=3e3}={})=>{const[t,r]=O.useState(!1);return{isCopied:t,copyToClipboard:n=>{n&&navigator.clipboard.writeText(n).then(()=>{r(!0),setTimeout(()=>r(!1),e)})}}},u7=$u.unstable_memoizeMarkdownComponents({h1:({className:e,...t})=>p.jsx("h1",{className:I.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:I.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:I.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:I.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:I.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:I.cn("aui-md-h6 my-4 font-semibold first:mt-0 last:mb-0",e),...t}),p:({className:e,...t})=>p.jsx("p",{className:I.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:I.cn("aui-md-a text-primary font-medium underline underline-offset-4",e),...t}),blockquote:({className:e,...t})=>p.jsx("blockquote",{className:I.cn("aui-md-blockquote border-l-2 pl-6 italic",e),...t}),ul:({className:e,...t})=>p.jsx("ul",{className:I.cn("aui-md-ul my-5 ml-6 list-disc [&>li]:mt-2",e),...t}),ol:({className:e,...t})=>p.jsx("ol",{className:I.cn("aui-md-ol my-5 ml-6 list-decimal [&>li]:mt-2",e),...t}),hr:({className:e,...t})=>p.jsx("hr",{className:I.cn("aui-md-hr my-5 border-b",e),...t}),table:({className:e,...t})=>p.jsx("table",{className:I.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:I.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:I.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:I.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:I.cn("aui-md-sup [&>a]:text-xs [&>a]:no-underline",e),...t}),pre:({className:e,...t})=>p.jsx("pre",{className:I.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=$u.useIsMarkdownCodeBlock();return p.jsx("code",{className:I.cn(!o&&"aui-md-inline-code bg-muted rounded border font-semibold",t),...r})},CodeHeader:c7}),d7=({mentionedToolIds:e,tools:t,onRemove:r,className:o})=>{const n=I.useDensity(),a=t.filter(i=>e.includes(i.id));return a.length===0?null:p.jsxs("div",{className:I.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(Ye.AnimatePresence,{mode:"popLayout",children:a.map(i=>p.jsx(Ve.div,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.15,ease:Qe},children:p.jsx(m7,{tool:i,onRemove:r?()=>r(i.id):void 0})},i.id))})]})},m7=({tool:e,onRemove:t})=>{const r=I.useDensity(),o=I.useRadius();return p.jsxs("div",{className:I.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(fI,{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($n,{className:"size-3 flex-shrink-0"})})]})},f7=[{type:"like",icon:M5,label:"This resolved my question",color:"text-emerald-500",hoverBg:"hover:bg-emerald-500/10",activeBg:"bg-emerald-500/20"},{type:"dislike",icon:$n,label:"This didn't help",color:"text-rose-500",hoverBg:"hover:bg-rose-500/10",activeBg:"bg-rose-500/20"}],p7=`
175
- @keyframes subtle-bounce {
176
- 0%, 100% { transform: translateY(0); }
177
- 50% { transform: translateY(-2px); }
178
- }
179
- `,h7=({onFeedback:e,onResolved:t,className:r})=>{const[o,n]=O.useState(null),[a,i]=O.useState(!1),s=c=>{n(c),e?.(c),c==="like"?t?.():i(!0)};return p.jsxs("div",{className:I.cn("aui-message-feedback flex items-center justify-center",r),children:[p.jsx("style",{children:p7}),p.jsx(Ye.AnimatePresence,{mode:"wait",children:a?p.jsx(Ve.div,{className:"text-muted-foreground rounded-full border border-black/[0.08] bg-gradient-to-b from-white/80 to-white/60 px-4 py-2 text-sm shadow-lg backdrop-blur-2xl dark:border-white/[0.08] dark:from-white/15 dark:to-white/10",initial:{opacity:0,y:5},animate:{opacity:1,y:0},transition:{duration:.25,ease:Qe},style:{boxShadow:"0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6)"},children:"Feedback received, thank you"},"thank-you"):p.jsx(Ve.div,{className:"relative flex items-center gap-1.5 rounded-full border border-black/[0.08] bg-gradient-to-b from-white/80 to-white/60 px-3 py-1 shadow-lg backdrop-blur-2xl dark:border-white/[0.08] dark:from-white/15 dark:to-white/10",initial:{opacity:0,scale:.8,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:5},transition:{duration:.4,delay:.75,ease:Qe},style:{boxShadow:"0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(0, 0, 0, 0.02)"},children:p.jsx(Rp,{delayDuration:300,children:f7.map((c,l)=>{const u=c.icon;return p.jsxs(bi,{children:[p.jsx(_i,{asChild:!0,children:p.jsx(Ve.button,{type:"button",onClick:()=>s(c.type),className:I.cn("group/btn relative flex size-8 items-center justify-center rounded-full transition-[background-color] duration-200 ease-out",c.hoverBg,o===c.type&&c.activeBg),initial:"initial",animate:"animate",whileHover:"hover",whileTap:{scale:1.3},variants:{initial:{opacity:0,scale:0,rotate:-180},animate:{opacity:1,scale:1,rotate:0},hover:{scale:1.2}},transition:{duration:.8,delay:.75+l*.15,type:"spring",stiffness:150,damping:10},"aria-label":c.label,children:p.jsx("span",{className:"flex",style:{animation:"none"},onMouseEnter:d=>{d.currentTarget.style.animation="subtle-bounce 0.6s ease-in-out infinite"},onMouseLeave:d=>{d.currentTarget.style.animation="none"},children:p.jsx(u,{className:I.cn("size-5 transition-[fill] duration-200",c.color,c.type==="like"&&"group-hover/btn:fill-emerald-500",o===c.type&&c.type==="like"&&"fill-emerald-500"),strokeWidth:2})})})}),p.jsx(wi,{side:"top",sideOffset:8,children:c.label})]},c.type)})})},"feedback-buttons")})]})};var wl="Collapsible",[g7]=gi(wl),[v7,Lp]=g7(wl),aO=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:n,disabled:a,onOpenChange:i,...s}=e,[c,l]=gl({prop:o,defaultProp:n??!1,onChange:i,caller:wl});return p.jsx(v7,{scope:r,disabled:a,contentId:Kn(),open:c,onOpenToggle:_.useCallback(()=>l(u=>!u),[l]),children:p.jsx(Be.div,{"data-state":Vp(c),"data-disabled":a?"":void 0,...s,ref:t})})});aO.displayName=wl;var iO="CollapsibleTrigger",sO=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Lp(iO,r);return p.jsx(Be.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Vp(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:Le(e.onClick,n.onOpenToggle)})});sO.displayName=iO;var Fp="CollapsibleContent",cO=_.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Lp(Fp,e.__scopeCollapsible);return p.jsx($r,{present:r||n.open,children:({present:a})=>p.jsx(y7,{...o,ref:t,present:a})})});cO.displayName=Fp;var y7=_.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...a}=e,i=Lp(Fp,r),[s,c]=_.useState(o),l=_.useRef(null),u=_t(t,l),d=_.useRef(0),m=d.current,f=_.useRef(0),g=f.current,h=i.open||s,v=_.useRef(h),b=_.useRef(void 0);return _.useEffect(()=>{const w=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(w)},[]),zt(()=>{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,f.current=x.width,v.current||(w.style.transitionDuration=b.current.transitionDuration,w.style.animationName=b.current.animationName),c(o)}},[i.open,o]),p.jsx(Be.div,{"data-state":Vp(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:h&&n})});function Vp(e){return e?"open":"closed"}var b7=aO;function _7({...e}){return p.jsx(b7,{"data-slot":"collapsible",...e})}function w7({...e}){return p.jsx(sO,{"data-slot":"collapsible-trigger",...e})}function x7({...e}){return p.jsx(cO,{"data-slot":"collapsible-content",...e})}const sy=200,lO=({className:e,children:t})=>{const r=O.useRef(null),[o,n]=O.useState(!1),a=j.useScrollLock(r,sy),i=O.useCallback(s=>{s||a(),n(s)},[a]);return p.jsx(_7,{ref:r,open:o,onOpenChange:i,className:I.cn("aui-reasoning-root mb-4 w-full",e),style:{"--animation-duration":`${sy}ms`},children:t})};lO.displayName="ReasoningRoot";const S7=({className:e})=>p.jsx("div",{className:I.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)}),k7=({active:e,className:t})=>p.jsxs(w7,{className:I.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(k5,{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(As,{className:I.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")})]}),uO=({className:e,children:t,"aria-busy":r})=>p.jsxs(x7,{className:I.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(S7,{})]});uO.displayName="ReasoningContent";const dO=({className:e,children:t})=>p.jsx("div",{className:I.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});dO.displayName="ReasoningText";const E7=()=>p.jsx(oO,{}),I7=({children:e,startIndex:t,endIndex:r})=>{const o=j.useAssistantState(({message:n})=>{if(n.status?.type!=="running")return!1;const a=n.parts.length-1;return a<0||n.parts[a]?.type!=="reasoning"?!1:a>=t&&a<=r});return p.jsxs(lO,{children:[p.jsx(k7,{active:o}),p.jsx(uO,{"aria-busy":o,children:p.jsx(dO,{children:e})})]})},mO=O.memo(E7);mO.displayName="Reasoning";const fO=O.memo(I7);fO.displayName="ReasoningGroup";var xl="Popover",[pO]=gi(xl,[pl]),xi=pl(),[T7,Kr]=pO(xl),hO=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:a,modal:i=!1}=e,s=xi(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,m]=gl({prop:o,defaultProp:n??!1,onChange:a,caller:xl});return p.jsx(u1,{...s,children:p.jsx(T7,{scope:t,contentId:Kn(),triggerRef:c,open:d,onOpenChange:m,onOpenToggle:_.useCallback(()=>m(f=>!f),[m]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:i,children:r})})};hO.displayName=xl;var gO="PopoverAnchor",vO=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=Kr(gO,r),a=xi(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:s}=n;return _.useEffect(()=>(i(),()=>s()),[i,s]),p.jsx($p,{...a,...o,ref:t})});vO.displayName=gO;var yO="PopoverTrigger",bO=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=Kr(yO,r),a=xi(r),i=_t(t,n.triggerRef),s=p.jsx(Be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":kO(n.open),...o,ref:i,onClick:Le(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?s:p.jsx($p,{asChild:!0,...a,children:s})});bO.displayName=yO;var Zp="PopoverPortal",[$7,O7]=pO(Zp,{forceMount:void 0}),_O=e=>{const{__scopePopover:t,forceMount:r,children:o,container:n}=e,a=Kr(Zp,t);return p.jsx($7,{scope:t,forceMount:r,children:p.jsx($r,{present:r||a.open,children:p.jsx(hl,{asChild:!0,container:n,children:o})})})};_O.displayName=Zp;var yo="PopoverContent",wO=_.forwardRef((e,t)=>{const r=O7(yo,e.__scopePopover),{forceMount:o=r.forceMount,...n}=e,a=Kr(yo,e.__scopePopover);return p.jsx($r,{present:o||a.open,children:a.modal?p.jsx(A7,{...n,ref:t}):p.jsx(R7,{...n,ref:t})})});wO.displayName=yo;var C7=yp("PopoverContent.RemoveScroll"),A7=_.forwardRef((e,t)=>{const r=Kr(yo,e.__scopePopover),o=_.useRef(null),n=_t(t,o),a=_.useRef(!1);return _.useEffect(()=>{const i=o.current;if(i)return P1(i)},[]),p.jsx(Pp,{as:C7,allowPinchZoom:!0,children:p.jsx(xO,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(e.onCloseAutoFocus,i=>{i.preventDefault(),a.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Le(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0,l=s.button===2||c;a.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:Le(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),R7=_.forwardRef((e,t)=>{const r=Kr(yo,e.__scopePopover),o=_.useRef(!1),n=_.useRef(!1);return p.jsx(xO,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(o.current||r.triggerRef.current?.focus(),a.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(o.current=!0,a.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const i=a.target;r.triggerRef.current?.contains(i)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&n.current&&a.preventDefault()}})}),xO=_.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,m=Kr(yo,r),f=xi(r);return E1(),p.jsx(Np,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:a,children:p.jsx(ul,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>m.onOpenChange(!1),children:p.jsx(d1,{"data-state":kO(m.open),role:"dialog",id:m.contentId,...f,...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)"}})})})}),SO="PopoverClose",N7=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=Kr(SO,r);return p.jsx(Be.button,{type:"button",...o,ref:t,onClick:Le(e.onClick,()=>n.onOpenChange(!1))})});N7.displayName=SO;var P7="PopoverArrow",j7=_.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xi(r);return p.jsx(m1,{...n,...o,ref:t})});j7.displayName=P7;function kO(e){return e?"open":"closed"}var M7=hO,D7=vO,z7=bO,U7=_O,L7=wO;function EO({...e}){return p.jsx(M7,{"data-slot":"popover",...e})}function F7({...e}){return p.jsx(z7,{"data-slot":"popover-trigger",...e})}function IO({className:e,align:t="center",sideOffset:r=4,container:o,...n}){const a=Ap();return p.jsx(U7,{container:o??a,children:p.jsx(L7,{"data-slot":"popover-content",align:t,sideOffset:r,className:I.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-[70] w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}function V7({...e}){return p.jsx(D7,{"data-slot":"popover-anchor",...e})}const Z7=U$("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 q7(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 B7(e,t){if(t==="json")try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}return e}function G7(e){return typeof e=="object"&&e!==null&&"content"in e&&Array.isArray(e.content)}function TO({status:e}){return p.jsxs("div",{className:I.cn(Z7({status:e})),children:[e==="pending"&&null,e==="running"&&p.jsx(Rs,{className:"size-4 animate-spin"}),e==="complete"&&p.jsx(zr,{className:"size-4"}),e==="error"&&p.jsx($n,{className:"size-4"}),e==="approval"&&p.jsx(Rs,{className:"text-muted-foreground size-4 animate-spin"})]})}function H7({content:e}){const[t,r]=O.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(zr,{className:"size-4"}):p.jsx(Jf,{className:"size-4"})})}const W7=8e3,J7=50;function K7(e,t){let r=0;for(let n=0;n<t;n++){const a=e.indexOf(`
180
- `,r);if(a===-1)return{text:e,truncated:!1,totalLines:n+1};r=a+1}const o=e.split(`
181
- `).length;return{text:e.slice(0,r),truncated:!0,totalLines:o}}function $O({text:e,language:t,className:r}){const[o,n]=O.useState(null),[a,i]=O.useState(!1),s=_.useMemo(()=>K7(e,J7),[e]),c=a?e:s.text,l=c.length<=W7;O.useEffect(()=>{if(n(null),!t||!l)return;let d=!1;return UO.codeToHtml(c,{lang:t,theme:"github-dark-default",rootStyle:"background-color: transparent;",transformers:[{pre(m){m.properties.class="w-full py-3 px-4 max-h-[300px] overflow-y-auto whitespace-pre-wrap text-left text-sm"}}]}).then(m=>{d||n(m)}),()=>{d=!0}},[c,t,l]);const u=s.truncated&&!a&&p.jsxs("button",{type:"button",onClick:()=>i(!0),className:"w-full bg-slate-800/90 px-4 py-2 text-left text-xs text-slate-400 transition-colors hover:text-slate-200",children:["Show all ",s.totalLines," lines…"]});return!l||!o?p.jsxs("div",{className:I.cn("w-full",r),children:[p.jsx("pre",{className:"max-h-[300px] w-full overflow-y-auto bg-slate-800/90 px-4 py-3 text-sm whitespace-pre-wrap text-slate-100",children:c}),u]}):p.jsxs("div",{className:I.cn("w-full",r),children:[p.jsx("div",{className:"w-full bg-slate-800/90",dangerouslySetInnerHTML:{__html:o}}),u]})}function Y7({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%),
182
- linear-gradient(135deg, #ccc 25%, transparent 25%),
183
- linear-gradient(45deg, transparent 75%, #ccc 75%),
184
- 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 X7({content:e}){return p.jsx("div",{className:"w-full",children:e.content.map((t,r)=>{switch(t.type){case"text":{const o=q7(t._meta?.["getgram.ai/mime-type"]??"text/plain"),n=B7(t.text,o);return p.jsx($O,{text:n,language:o},r)}case"image":return p.jsx(Y7,{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 cy({title:e,content:t,defaultExpanded:r=!1,highlightSyntax:o=!0,language:n="json"}){const[a,i]=O.useState(r),s=G7(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:()=>i(!a),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(H7,{content:c}),p.jsx(dI,{className:I.cn("text-muted-foreground size-4 transition-transform duration-200",a&&"rotate-90")})]})]}),a&&p.jsx("div",{className:"border-border border-t",children:s?p.jsx(X7,{content:t}):o?p.jsx($O,{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 Q7({name:e,icon:t,provider:r,status:o="complete",request:n,result:a,defaultExpanded:i=!1,className:s,onApproveOnce:c,onApproveForSession:l,onDeny:u}){const d=o==="approval"&&c!==void 0&&u!==void 0,[m,f]=O.useState(i),g=n!==void 0||a!==void 0,[h,v]=O.useState("one-time"),[b,w]=O.useState(!1),x=_.useRef(null);O.useEffect(()=>{!d&&m&&!i&&f(!1)},[d]);const y=()=>{h==="for-session"&&l?l():c&&c()};return p.jsxs("div",{"data-slot":"tool-ui",className:I.cn("border-border bg-card @container overflow-hidden rounded-lg border",s),children:[r&&p.jsxs("div",{"data-slot":"tool-ui-provider",className:I.cn("border-border flex items-center gap-2 border-b px-4 py-2.5"),children:[t?p.jsx("span",{className:"flex size-5 items-center justify-center",children:t}):p.jsx("span",{className:"bg-muted flex size-5 items-center justify-center rounded text-xs font-medium",children:r.charAt(0).toUpperCase()}),p.jsx("span",{className:"text-sm font-medium",children:r})]}),p.jsxs("button",{onClick:()=>g&&f(!m),disabled:!g,className:I.cn("flex w-full items-center gap-2 px-4 py-3 text-left",g&&"hover:bg-accent/50 cursor-pointer transition-colors"),children:[p.jsx(TO,{status:o}),p.jsx("span",{className:I.cn("flex-1 text-sm",!r&&d&&"shimmer"),children:e}),g&&p.jsx(As,{className:I.cn("text-muted-foreground size-4 transition-transform duration-200",m&&"rotate-180")})]}),m&&g&&p.jsxs("div",{"data-slot":"tool-ui-content",children:[n!==void 0&&p.jsx(cy,{title:"Arguments",content:n,highlightSyntax:!0,language:"json"}),a!==void 0&&p.jsx(cy,{title:"Output",content:a,highlightSyntax:!0,language:"json"})]}),d&&p.jsxs("div",{"data-slot":"tool-ui-approval-actions",className:"border-border flex flex-col gap-2 border-t px-4 py-3 @[320px]:flex-row @[320px]:items-center @[320px]:justify-end",children:[p.jsx("div",{className:"@[320px]:mr-auto",children:p.jsx("span",{className:"text-muted-foreground text-sm",children:"This tool requires approval"})}),p.jsxs("div",{className:"flex items-center gap-2 self-end",children:[p.jsxs(rt,{variant:"outline",size:"sm",onClick:u,className:"text-destructive hover:bg-destructive/10 dark:text-rose-400",children:[p.jsx($n,{className:"size-3 @[320px]:mr-1"}),p.jsx("span",{className:"hidden @[320px]:inline",children:"Deny"})]}),p.jsxs("div",{className:"flex items-center",children:[p.jsxs(rt,{variant:"default",size:"sm",onClick:y,className:"flex cursor-pointer justify-between gap-1 rounded-r-none bg-emerald-600 hover:bg-emerald-700",children:[p.jsx(zr,{className:"dark:text-foreground mr-1 size-3"}),p.jsx("span",{className:"dark:text-foreground @[320px]:hidden",children:"Approve"}),p.jsx("span",{className:"dark:text-foreground hidden min-w-[110px] @[320px]:inline",children:h==="one-time"?"Approve this time":"Approve always"})]}),p.jsxs(EO,{open:b,children:[p.jsx(V7,{asChild:!0,children:p.jsx(rt,{ref:x,variant:"default",size:"sm",className:"cursor-pointer rounded-l-none border-l border-emerald-700 bg-emerald-600 px-2 hover:bg-emerald-700",onClick:()=>w(S=>!S),children:b?p.jsx(A5,{className:"dark:text-foreground size-3"}):p.jsx(As,{className:"dark:text-foreground size-3"})})}),p.jsxs(IO,{align:"end",className:"w-fit p-1",sideOffset:4,onInteractOutside:S=>{S.preventDefault(),(S.detail?.originalEvent?.composedPath?.()??[]).includes(x.current)||w(!1)},onEscapeKeyDown:()=>w(!1),children:[p.jsxs("button",{onClick:()=>{v("one-time"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(zr,{className:I.cn("relative top-1 mt-0.5 size-3 shrink-0",h!=="one-time"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve only once"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"You'll be asked again next time"})]})]}),l&&p.jsxs("button",{onClick:()=>{v("for-session"),w(!1)},className:"hover:bg-accent relative flex w-full items-start gap-2 rounded-sm px-2 py-2 text-left",children:[p.jsx(zr,{className:I.cn("relative top-1 mt-0.5 size-3 shrink-0",h!=="for-session"&&"invisible")}),p.jsxs("div",{className:"flex flex-col gap-0.5",children:[p.jsx("span",{className:"text-sm",children:"Approve always"}),p.jsx("span",{className:"text-muted-foreground text-xs",children:"Trust this tool for the session"})]})]})]})]})]})]})]})]})}function eW({title:e,icon:t,status:r="complete",defaultExpanded:o=!1,children:n,className:a}){const[i,s]=O.useState(o);return p.jsxs("div",{"data-slot":"tool-ui-group",className:I.cn("border-border bg-card overflow-hidden rounded-lg border",a),children:[p.jsxs("button",{onClick:()=>s(!i),className:"hover:bg-accent/50 flex w-full items-center gap-2 px-4 py-3 text-left transition-colors",children:[t||p.jsx(TO,{status:r==="running"?"running":"complete"}),p.jsx("span",{className:I.cn("flex-1 text-sm font-medium",r==="running"&&"shimmer"),children:e}),p.jsx(As,{className:I.cn("text-muted-foreground size-4 transition-transform duration-200",i&&"rotate-180")})]}),i&&p.jsx("div",{"data-slot":"tool-ui-group-content",className:"border-border border-t",children:n})]})}const tW=({toolName:e,toolCallId:t,status:r,result:o,args:n})=>{const{pendingApprovals:a,whitelistTool:i,confirmPendingApproval:s,rejectPendingApproval:c}=nk(),l=a.get(t),d=j.useAssistantState(({message:w})=>w).parts.filter(w=>w.type==="tool-call"),m=d.findIndex(w=>w.toolCallId===t),f=()=>{s(t)},g=()=>{i(e),s(t)},h=()=>{c(t)},v=()=>l?"approval":r.type==="incomplete"?"error":r.type==="complete"?o&&typeof o=="object"&&"isError"in o&&o.isError?"error":"complete":"running",b=()=>{if(o!==void 0)return typeof o=="object"&&o!==null&&"content"in o&&Array.isArray(o.content)||typeof o=="string",o};return p.jsx("div",{className:I.cn("aui-tool-fallback-root flex w-full flex-col",m!==-1&&m!==d.length-1&&"border-b"),children:p.jsx(Q7,{name:e,status:v(),request:n,result:b(),onApproveOnce:l?f:void 0,onApproveForSession:l?g:void 0,onDeny:l?h:void 0,className:"rounded-none border-0"})})},ly=/@(\w+)/g;function rW(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 nW(e,t){if(!t||!e)return[];const r=Object.keys(t),o=[];let n;for(ly.lastIndex=0;(n=ly.exec(e))!==null;)o.push(n[1].toLowerCase());const a=r.filter(i=>o.includes(i.toLowerCase()));return[...new Set(a)]}function oW(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(`
185
- `)?{isInMention:!1,query:"",atPosition:-1}:{isInMention:!0,query:n.toLowerCase(),atPosition:o}}function aW(e,t){if(!t)return e;const r=t.toLowerCase();return e.filter(o=>{const n=o.name.toLowerCase().includes(r),a=o.description?.toLowerCase().includes(r);return n||a})}function iW(e,t,r,o){const n=e.slice(0,r),a=e.slice(o),i=`${n}@${t} ${a}`,s=r+t.length+2;return{text:i,cursorPosition:s}}function sW(e,t){const r=new RegExp(`@${t}\\s?`,"gi");return e.replace(r,"")}const cW=({tools:e,value:t,cursorPosition:r,onValueChange:o,textareaRef:n,className:a})=>{const[i,s]=O.useState(0),[c,l]=O.useState(!1),[u,d]=O.useState([]),[m,f]=O.useState(null),g=O.useRef(null),h=I.useDensity(),v=I.useRadius();O.useEffect(()=>{const w=oW(t,r);if(w.isInMention&&e.length>0){const x=aW(e,w.query);d(x),l(x.length>0),f({atPosition:w.atPosition,query:w.query}),s(0)}else l(!1),f(null)},[t,r,e]);const b=O.useCallback(w=>{if(!m)return;const x=iW(t,w.name,m.atPosition,r);o(x.text,x.cursorPosition),l(!1)},[m,t,r,o,n]);return O.useEffect(()=>{if(!c)return;const w=y=>{switch(y.key){case"ArrowDown":y.preventDefault(),y.stopPropagation(),s(S=>(S+1)%u.length);break;case"ArrowUp":y.preventDefault(),y.stopPropagation(),s(S=>(S-1+u.length)%u.length);break;case"Enter":case"Tab":y.preventDefault(),y.stopPropagation(),u[i]&&b(u[i]);break;case"Escape":y.preventDefault(),y.stopPropagation(),l(!1);break}},x=n.current;if(x)return x.addEventListener("keydown",w,{capture:!0}),()=>x.removeEventListener("keydown",w,{capture:!0})},[c,u,i,b,n]),O.useEffect(()=>{if(!c)return;const w=g.current;if(!w)return;const x=w.querySelector(`[data-index="${i}"]`);x&&x.scrollIntoView({block:"nearest"})},[i,c]),O.useEffect(()=>{if(!c)return;const w=x=>{g.current&&!g.current.contains(x.target)&&n.current&&!n.current.contains(x.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c,n]),O.useEffect(()=>{const w=n.current;if(!w)return;const x=w.closest(".aui-composer-root");return x?(c?requestAnimationFrame(()=>{const S=g.current;if(S&&c){x.style.borderTopColor="var(--ring)",x.style.borderTopLeftRadius="0",x.style.borderTopRightRadius="0";const k=x.getBoundingClientRect(),T=S.offsetParent;if(T){const A=T.getBoundingClientRect();S.style.left=`${k.left-A.left}px`,S.style.right="auto",S.style.width=`${k.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(Ve.div,{ref:g,initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.15,ease:Qe},className:I.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",v("xl"),a),children:p.jsx("div",{className:"flex flex-col gap-1",children:u.map((w,x)=>p.jsxs("button",{type:"button","data-index":x,className:I.cn("aui-tool-mention-item flex w-full items-center gap-2 text-left transition-colors",h("p-sm"),"hover:bg-accent hover:text-accent-foreground",x===i&&"bg-accent text-accent-foreground"),onClick:y=>{y.preventDefault(),y.stopPropagation(),b(w)},onMouseEnter:()=>s(x),children:[p.jsx(fI,{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))})})},OO=O.createContext(null);function lW(){return O.useContext(OO)}function uW(e){const t=[];for(const r of e){if(r.role==="system")continue;const o=[];for(const n of r.content)switch(n.type){case"text":n.text&&o.push({type:"text",text:n.text});break;case"reasoning":n.text&&o.push({type:"reasoning",text:n.text});break;case"tool-call":o.push({type:"tool-call",toolCallId:n.toolCallId,toolName:n.toolName,args:n.args,result:n.result});break}o.length>0&&t.push({role:r.role,content:o})}return{messages:t}}function os(e,t){return new Promise((r,o)=>{if(t?.aborted){o(new DOMException("Aborted","AbortError"));return}const n=setTimeout(r,e);t?.addEventListener("abort",()=>{clearTimeout(n),o(new DOMException("Aborted","AbortError"))},{once:!0})})}function dW(e,t){const r=t?.typingSpeed??15,o=t?.assistantStartDelay??400;let n=0;return{sendMessages:async({abortSignal:a})=>{n<e.messages.length&&e.messages[n].role==="user"&&n++;const i=[];for(;n<e.messages.length&&e.messages[n].role==="assistant";)i.push(e.messages[n]),n++;return kq({execute:async({writer:s})=>{if(i.length!==0){try{await os(o,a)}catch{return}for(const c of i)for(const l of c.content)try{await mW(s,l,r,a)}catch{return}}}})},reconnectToStream:async()=>null}}async function mW(e,t,r,o){switch(t.type){case"text":{const n=crypto.randomUUID();e.write({type:"text-start",id:n});for(const a of t.text)e.write({type:"text-delta",id:n,delta:a}),await os(r,o);e.write({type:"text-end",id:n});break}case"reasoning":{const n=crypto.randomUUID();e.write({type:"reasoning-start",id:n});for(const a of t.text)e.write({type:"reasoning-delta",id:n,delta:a}),await os(r,o);e.write({type:"reasoning-end",id:n});break}case"tool-call":{e.write({type:"tool-input-available",toolCallId:t.toolCallId,toolName:t.toolName,input:t.args}),t.result!==void 0&&(await os(300,o),e.write({type:"tool-output-available",toolCallId:t.toolCallId,output:t.result}));break}}}function fW(){const e=j.useThreadRuntime(),[t,r]=O.useState(!1),o=O.useRef(0),n=O.useSyncExternalStore(c=>e.subscribe(c),()=>e.getState().messages.length),a=O.useCallback(()=>{o.current=e.getState().messages.length,r(!0)},[e]),i=O.useCallback(()=>{r(!1)},[]),s=O.useCallback(c=>{const u=e.getState().messages.slice(o.current),d=uW(u),m=JSON.stringify(d,null,2),f=new Blob([m],{type:"application/json"}),g=URL.createObjectURL(f),h=document.createElement("a");h.href=g,h.download=`${c??"cassette"}.cassette.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(g)},[e]);return{isRecording:t,messageCount:n,startRecording:a,stopRecording:i,download:s}}const Sl=()=>{const{config:e}=I.useElements(),t=e.theme??{};return O.useMemo(()=>{const{colorScheme:r="light"}=t;return{className:r==="dark"||r==="system"&&typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":void 0}},[t])};function pW({tools:e,enabled:t=!0}){const[r,o]=O.useState(0),n=O.useRef(null),a=j.useAssistantApi(),i=j.useAssistantState(({composer:f})=>f.text),s=O.useMemo(()=>rW(e),[e]),c=O.useMemo(()=>t?nW(i,e):[],[i,e,t]),l=O.useCallback(()=>{const f=n.current;f&&o(f.selectionStart)},[]),u=O.useCallback((f,g)=>{a.composer().setText(f),o(g),setTimeout(()=>{const h=n.current;h&&(h.focus(),h.setSelectionRange(g,g))},0)},[a]),d=O.useCallback(f=>{const g=s.find(h=>h.id===f);if(g){const h=sW(i,g.name);a.composer().setText(h)}},[i,s,a]),m=t&&s.length>0;return{mentionableTools:s,mentionedToolIds:c,value:i,cursorPosition:r,textareaRef:n,updateCursorPosition:l,handleAutocompleteChange:u,removeMention:d,isActive:m}}const hW=({state:e,isOnline:t})=>{const r=e==="reconnecting",o=!t,n=o&&e==="disconnected",a=r||o&&e!=="connected";return p.jsx("div",{className:I.cn("pointer-events-auto flex items-center gap-2 rounded-full px-4 py-2 shadow-lg backdrop-blur-md","border",n||a?"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(Mg,{className:"size-4"}),p.jsx("span",{className:"text-sm font-medium",children:"Offline"})]}):a?p.jsxs(p.Fragment,{children:[p.jsx(I.LoaderCircle,{className:"size-4 animate-spin"}),p.jsx("span",{className:"text-sm font-medium",children:"Reconnecting..."})]}):p.jsxs(p.Fragment,{children:[p.jsx(Mg,{className:"size-4"}),p.jsx("span",{className:"text-sm font-medium",children:"Connection Lost"})]})})},gW=({className:e})=>{const t=P$();if(!t)return null;const{state:r,isOnline:o}=t,n=r==="reconnecting"||r==="disconnected";return p.jsx(Ye.AnimatePresence,{children:n&&p.jsx(Ye.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:I.cn("pointer-events-none absolute top-4 right-0 left-0 z-50 flex justify-center",e),children:p.jsx(hW,{state:r,isOnline:o})})})};function vW(e){return e.replace(/[-_]/g," ").split(/(?=[A-Z])/).join(" ").split(/\s+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const yW=({children:e,startIndex:t,endIndex:r})=>{const o=r-t+1,n=j.useAssistantState(({message:l})=>{const u=l.parts[t];return u?.type==="tool-call"?u.toolName:void 0}),a=j.useAssistantState(({message:l})=>{for(let u=t;u<=r;u++)if(l.parts[u]?.status?.type==="running")return!0;return!1}),{config:i}=I.useElements(),s=i.tools?.expandToolGroupsByDefault??!1,c=O.useMemo(()=>o===0?"No tools called":o===1?n?`Calling ${vW(n)}...`:"Calling tool...":a?`Calling ${o} tools...`:`Executed ${o} tools`,[o,n,a]);return n&&i.tools?.components?.[n]?e:o===1?p.jsx("div",{className:I.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(eW,{title:c,status:a?"running":"complete",defaultExpanded:s,children:e})})},CO=O.createContext({isResolved:!1,feedbackHidden:!1,setResolved:()=>{},setUnresolved:()=>{},resetFeedbackHidden:()=>{},submitFeedback:async()=>{}}),qp=()=>O.useContext(CO),bW=()=>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."})]}),Bp=({className:e})=>{const t=Sl(),r=I.useDensity(),{config:o}=I.useElements(),n=o.components??{},a=o.api&&"sessionToken"in o.api,i=o.thread?.showFeedback??!1,[s,c]=O.useState(!1),[l,u]=O.useState(!1),d=I.useChatId(),m=If(o),f=hp({auth:o.api,projectSlug:o.projectSlug}),g=()=>c(!0),h=()=>{c(!1),u(!0)},v=()=>u(!1),b=O.useCallback(async w=>{if(d){if(Gn(d)){console.error("Local thread ID, can't submit feedback");return}try{const x=await fetch(`${m}/rpc/chat.submitFeedback`,{method:"POST",headers:{"Content-Type":"application/json",...f.headers},body:JSON.stringify({id:d,feedback:w})});x.ok||console.error("Failed to submit feedback:",x.statusText)}catch(x){console.error("Failed to submit feedback:",x)}}},[d,m,f.headers]);return p.jsx(CO.Provider,{value:{isResolved:i&&s,feedbackHidden:l,setResolved:g,setUnresolved:h,resetFeedbackHidden:v,submitFeedback:b},children:p.jsx(Ye.LazyMotion,{features:Ye.domAnimation,children:p.jsx(Ye.MotionConfig,{reducedMotion:"user",children:p.jsxs(j.ThreadPrimitive.Root,{className:I.cn("aui-root aui-thread-root bg-background @container relative flex h-full flex-col",t.className,e),children:[p.jsx(gW,{}),p.jsxs(j.ThreadPrimitive.Viewport,{className:I.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(j.ThreadPrimitive.If,{empty:!0,children:n.ThreadWelcome?p.jsx(n.ThreadWelcome,{}):p.jsx(wW,{})}),a&&p.jsx(bW,{}),p.jsx(j.ThreadPrimitive.Messages,{components:{UserMessage:n.UserMessage??jW,EditComposer:n.EditComposer??DW,AssistantMessage:n.AssistantMessage??RW}}),p.jsx(j.ThreadPrimitive.If,{empty:!1,running:!1,children:p.jsx(a7,{})}),p.jsx(j.ThreadPrimitive.If,{empty:!1,children:p.jsx("div",{className:"aui-thread-viewport-spacer min-h-8 grow"})}),p.jsx(IW,{showFeedback:i})]}),p.jsx(Ye.AnimatePresence,{children:i&&s&&p.jsx(Ve.div,{className:"bg-background/40 pointer-events-none absolute inset-0 z-50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3,ease:Qe}})})]})})})})},_W=()=>p.jsx(j.ThreadPrimitive.ScrollToBottom,{asChild:!0,children:p.jsx(Xt,{tooltip:"Scroll to bottom",variant:"outline",className:"aui-thread-scroll-to-bottom dark:bg-background dark:text-foreground dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible",children:p.jsx(_5,{})})}),wW=()=>{const{config:e}=I.useElements(),t=I.useDensity(),{title:r,subtitle:o}=e.welcome??{},n=e.variant==="standalone";return p.jsxs("div",{className:I.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:I.cn("aui-thread-welcome-center flex w-full grow flex-col items-center justify-start"),children:p.jsxs("div",{className:I.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(Ve.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,ease:Qe},className:I.cn("aui-thread-welcome-message-motion-1 text-foreground font-semibold",t("text-title")),children:r}),p.jsx(Ve.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.25,delay:.05,ease:Qe},className:I.cn("aui-thread-welcome-message-motion-2 text-muted-foreground/65",t("text-subtitle")),children:o})]})}),p.jsx(xW,{})]})},xW=()=>{const{config:e}=I.useElements(),t=I.useRadius(),r=I.useDensity(),o=e.welcome?.suggestions??[],n=e.variant==="standalone";return o.length===0?null:p.jsx("div",{className:I.cn("aui-thread-welcome-suggestions w-full",r("gap-md"),r("py-lg"),n?"flex flex-col @sm:flex-row @sm:flex-wrap @sm:items-center @sm:justify-center":o.length===1?"flex":"grid max-w-fit @md:grid-cols-2"),children:o.map((a,i)=>p.jsx(Ve.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},exit:{opacity:0,y:20},transition:{duration:.25,delay:.03*i,ease:Qe},className:I.cn("aui-thread-welcome-suggestion-display",!n&&"nth-[n+3]:hidden @md:nth-[n+3]:block"),children:p.jsx(j.ThreadPrimitive.Suggestion,{prompt:a.prompt,send:!0,asChild:!0,children:p.jsxs(rt,{variant:"ghost",className:I.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-col items-start @sm:flex-row @sm:items-center ${r("gap-sm")} ${r("px-lg")} ${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":a.prompt,children:[p.jsx("span",{className:"aui-thread-welcome-suggestion-text-1 text-foreground text-sm font-medium",children:a.title}),p.jsx("span",{className:"aui-thread-welcome-suggestion-text-2 text-muted-foreground text-sm",children:a.label})]})})},`suggested-action-${a.title}-${i}`))})},SW=({tools:e})=>{const t=O.useRef(null),{mentionableTools:r,mentionedToolIds:o,value:n,cursorPosition:a,textareaRef:i,updateCursorPosition:s,handleAutocompleteChange:c,removeMention:l,isActive:u}=pW({tools:e});return O.useEffect(()=>{if(!u)return;const d=t.current?.getRootNode();if(!d)return;const m=d instanceof ShadowRoot?d:document.body,f=()=>{const v=d.querySelector(".aui-composer-input");if(v&&i.current!==v){i.current=v;const b=()=>s();return v.addEventListener("click",b),v.addEventListener("keyup",b),v.addEventListener("input",b),()=>{v.removeEventListener("click",b),v.removeEventListener("keyup",b),v.removeEventListener("input",b)}}},g=f(),h=new MutationObserver(()=>{f()});return h.observe(m,{childList:!0,subtree:!0}),()=>{g?.(),h.disconnect()}},[u,i,s]),u?p.jsxs("div",{ref:t,className:"aui-composer-tool-mentions relative",children:[p.jsx(d7,{mentionedToolIds:o,tools:r,onRemove:l}),p.jsx(Ye.AnimatePresence,{children:p.jsx(cW,{tools:r,value:n,cursorPosition:a,onValueChange:c,textareaRef:i})})]}):null},kW=()=>{const{resetFeedbackHidden:e}=qp();return O.useEffect(()=>{e()},[e]),null},EW=()=>{const{isResolved:e,feedbackHidden:t,setResolved:r,submitFeedback:o}=qp(),n=O.useCallback(async a=>{await o(a==="like"?"success":"failure")},[o]);return p.jsxs(j.ThreadPrimitive.If,{empty:!1,children:[p.jsx(j.ThreadPrimitive.If,{running:!0,children:p.jsx(kW,{})}),p.jsx(j.ThreadPrimitive.If,{running:!1,children:p.jsx(Ye.AnimatePresence,{children:!e&&!t&&p.jsx(Ve.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2,ease:Qe},className:"mb-3",children:p.jsx(h7,{className:"mx-auto",onResolved:r,onFeedback:n})})})})]})},IW=({showFeedback:e=!1})=>{const{config:t,mcpTools:r}=I.useElements(),{isResolved:o,setUnresolved:n}=qp(),a=I.useRadius(),i=I.useDensity(),c=lW()?.isReplay??!1,l=t.composer??{placeholder:"Send a message...",attachments:!0},u=t.components??{},d=l.toolMentions===void 0||l.toolMentions===!0||typeof l.toolMentions=="object"&&l.toolMentions.enabled!==!1,m=O.useRef(null);return u.Composer?p.jsx(u.Composer,{}):p.jsxs("div",{className:I.cn("aui-composer-wrapper bg-background sticky bottom-0 z-[60] flex w-full flex-col overflow-visible",i("gap-md"),i("py-md"),a("xl")),children:[e&&p.jsx(EW,{}),p.jsx(_W,{}),e&&o?p.jsxs(Ve.div,{className:"aui-composer-resolved border-input flex min-h-[118px] flex-col items-center justify-center gap-2 border-t px-1",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,ease:Qe},children:[p.jsx("span",{className:"text-muted-foreground text-sm",children:"This conversation has been resolved"}),p.jsx(rt,{variant:"outline",size:"sm",className:"text-foreground",onClick:n,children:"Reopen conversation"})]}):p.jsxs(j.ComposerPrimitive.Root,{ref:m,className:I.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 min-h-[118px] w-full flex-col border px-1 pt-2 shadow-xs transition-[color,box-shadow] outline-none has-[textarea:focus-visible]:ring-1",a("xl"),c&&"pointer-events-none opacity-50"),children:[l.attachments&&p.jsx(YH,{}),d&&p.jsx(SW,{tools:r}),p.jsx(j.ComposerPrimitive.Input,{placeholder:l.placeholder,className:I.cn("aui-composer-input text-foreground 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",i("h-input"),i("text-base")),rows:1,autoFocus:!c,disabled:c,"aria-label":"Message input"}),p.jsx(OW,{})]})]})},TW=()=>{const{model:e,setModel:t}=I.useElements(),[r,o]=O.useState(!1),[n,a]=O.useState(!1),i=O.useRef(null),s=O.useRef(0),c=O.useRef(!1);O.useEffect(()=>{r&&!c.current&&requestAnimationFrame(()=>{const u=i.current;u&&u.scrollHeight>0&&(u.scrollTop=s.current)}),c.current=r},[r]),O.useEffect(()=>{r&&a(!1)},[r]);const l=u=>{s.current=u.currentTarget.scrollTop};return p.jsx(Rp,{children:p.jsxs(bi,{open:n&&!r,onOpenChange:a,children:[p.jsxs(EO,{open:r,onOpenChange:o,children:[p.jsx(_i,{asChild:!0,children:p.jsx(F7,{asChild:!0,children:p.jsx(rt,{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(eF,{className:"aui-attachment-add-icon size-5 stroke-[1.5px]"})})})}),p.jsx(IO,{side:"top",align:"start",className:"w-min p-0 shadow-none",children:p.jsx("div",{ref:i,className:"max-h-48 overflow-y-auto",onScroll:l,children:sl.map(u=>p.jsxs(rt,{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(zr,{className:"size-4 text-emerald-500"})}):p.jsx("div",{className:"size-4",children:" "}),u]},u))})})]}),p.jsx(wi,{side:"bottom",align:"start",children:"Model Settings"})]})})},$W=!1,OW=()=>{const{config:e}=I.useElements(),t=I.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 text-muted-foreground flex items-center",children:[r.attachments?p.jsx(XH,{}):p.jsx("div",{className:"aui-composer-add-attachment-placeholder"}),e.model?.showModelPicker&&!e.languageModel&&p.jsx(TW,{}),$W]}),p.jsx(j.ThreadPrimitive.If,{running:!1,children:p.jsx(j.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(Xt,{tooltip:"Send message",side:"bottom",type:"submit",variant:"default",size:"icon",className:I.cn("aui-composer-send size-[34px] p-1",t("full")),"aria-label":"Send message",children:p.jsx(x5,{className:"aui-composer-send-icon size-5"})})})}),p.jsx(j.ThreadPrimitive.If,{running:!0,children:p.jsx(j.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(rt,{type:"button",variant:"default",size:"icon",className:I.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(rF,{className:"aui-composer-cancel-icon size-3.5 fill-white dark:fill-black"})})})})]})},CW=()=>p.jsx(j.MessagePrimitive.Error,{children:p.jsx(j.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(j.ErrorPrimitive.Message,{className:"aui-message-error-message line-clamp-2"})})}),AW=()=>j.useAssistantState(({message:t})=>t.status?.type!=="running"?!1:t.parts[t.parts.length-1]?.type==="tool-call")?p.jsx("div",{className:"aui-md mt-2","data-status":"running"}):null,RW=()=>{const{config:e}=I.useElements(),t=e.tools??{},r=e.components??{},o=O.useMemo(()=>({Text:r.Text??oO,Image:r.Image??NW,tools:{by_name:t.components,Fallback:r.ToolFallback??tW},Reasoning:r.Reasoning??mO,ReasoningGroup:r.ReasoningGroup??fO,ToolGroup:r.ToolGroup??yW}),[r,t.components]);return p.jsx(j.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(j.MessagePrimitive.Parts,{components:o}),p.jsx(AW,{}),p.jsx(CW,{})]}),p.jsx("div",{className:"aui-assistant-message-footer mt-2 ml-2 flex items-center gap-3",children:p.jsx(PW,{})})]})})},NW=e=>p.jsx("img",{src:e.image}),PW=()=>p.jsx(j.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(j.ActionBarPrimitive.Copy,{asChild:!0,children:p.jsxs(Xt,{tooltip:"Copy",children:[p.jsx(j.MessagePrimitive.If,{copied:!0,children:p.jsx(zr,{})}),p.jsx(j.MessagePrimitive.If,{copied:!1,children:p.jsx(Jf,{})})]})})}),jW=()=>{const e=I.useRadius();return p.jsx(j.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(KH,{}),p.jsxs("div",{className:"aui-user-message-content-wrapper relative col-start-2 min-w-0",children:[p.jsx("div",{className:I.cn("aui-user-message-content bg-muted text-foreground px-5 py-2.5 wrap-break-word",e("xl")),children:p.jsx(j.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(MW,{})})]}),p.jsx(zW,{className:"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end"})]})})},MW=()=>p.jsx(j.ActionBarPrimitive.Root,{hideWhenRunning:!0,autohide:"not-last",className:"aui-user-action-bar-root flex flex-col items-end",children:p.jsx(j.ActionBarPrimitive.Edit,{asChild:!0,children:p.jsx(Xt,{tooltip:"Edit",className:"aui-user-action-edit p-4",children:p.jsx(Y5,{})})})}),DW=()=>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(j.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(j.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(j.ComposerPrimitive.Cancel,{asChild:!0,children:p.jsx(rt,{variant:"ghost",size:"sm","aria-label":"Cancel edit",children:"Cancel"})}),p.jsx(j.ComposerPrimitive.Send,{asChild:!0,children:p.jsx(rt,{size:"sm","aria-label":"Update message",children:"Update"})})]})]})}),zW=({className:e,...t})=>p.jsxs(j.BranchPickerPrimitive.Root,{hideWhenSingleBranch:!0,className:I.cn("aui-branch-picker-root text-muted-foreground mr-2 -ml-2 inline-flex items-center text-xs",e),...t,children:[p.jsx(j.BranchPickerPrimitive.Previous,{asChild:!0,children:p.jsx(Xt,{tooltip:"Previous",children:p.jsx($5,{})})}),p.jsxs("span",{className:"aui-branch-picker-state font-medium",children:[p.jsx(j.BranchPickerPrimitive.Number,{})," / ",p.jsx(j.BranchPickerPrimitive.Count,{})]}),p.jsx(j.BranchPickerPrimitive.Next,{asChild:!0,children:p.jsx(Xt,{tooltip:"Next",children:p.jsx(dI,{})})})]});function UW({className:e,...t}){return p.jsx("div",{"data-slot":"skeleton",className:I.cn("bg-accent animate-pulse rounded-md",e),...t})}const Gp=({className:e})=>{const t=I.useDensity();return p.jsxs(j.ThreadListPrimitive.Root,{className:I.cn("aui-root aui-thread-list-root bg-background text-foreground flex flex-col items-stretch",t("gap-sm"),e),children:[p.jsx("div",{className:I.cn("aui-thread-list-new-section border-border border-b pb-2",t("py-sm"),t("px-sm")),children:p.jsx(LW,{})}),p.jsx("div",{className:I.cn("aui-thread-list-items-section flex flex-col gap-1",t("py-xs"),t("px-sm")),children:p.jsx(FW,{})})]})},LW=()=>{const e=I.useDensity();return p.jsx(j.ThreadListPrimitive.New,{asChild:!0,children:p.jsxs(rt,{className:I.cn("aui-thread-list-new text-foreground hover:bg-muted data-[active=true]:bg-muted/80 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(mI,{}),"New Thread"]})})},FW=()=>j.useAssistantState(({threads:t})=>t.isLoading)?p.jsx(VW,{}):p.jsx(j.ThreadListPrimitive.Items,{components:{ThreadListItem:ZW}}),VW=()=>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(UW,{className:"aui-thread-list-skeleton h-[22px] grow"})},t))}),ZW=()=>{const e=I.useRadius(),t=I.useDensity();return p.jsx(j.ThreadListItemPrimitive.Root,{className:I.cn("aui-thread-list-item group hover:bg-muted focus-visible:bg-muted focus-visible:ring-ring data-[active=true]:bg-muted flex items-center gap-2 rounded-lg transition-all focus-visible:ring-2 focus-visible:outline-none",e("md")),children:p.jsx(j.ThreadListItemPrimitive.Trigger,{className:I.cn("aui-thread-list-item-trigger flex min-w-0 grow cursor-pointer items-center text-start",t("px-lg"),t("py-sm")),children:p.jsx(qW,{})})})},qW=()=>p.jsx("span",{className:"aui-thread-list-item-title text-foreground text-sm break-words",children:p.jsx(j.ThreadListItemPrimitive.Title,{fallback:"New Chat"})}),AO=()=>{const{config:e,isExpanded:t,setIsExpanded:r}=I.useElements(),o=e.variant==="sidecar"?e.sidecar:e.modal,n=o?.expandable??!1,a=o?.defaultExpanded??!1;return{expandable:n,isExpanded:t,setIsExpanded:r,defaultExpanded:a}},BW={layout:{duration:.25,ease:Qe}},GW=({className:e})=>{const{config:t}=I.useElements(),r=Sl(),o=I.useRadius(),n=I.useDensity(),[a,i]=O.useState(t.modal?.defaultOpen??!1),{expandable:s,isExpanded:c,setIsExpanded:l}=AO(),u=t.modal?.title,d=t.modal?.icon,m=t.history?.enabled&&t.history?.showThreadList!==!1,f=t.modal?.position??"bottom-right",g=HW(f),h=O.useMemo(()=>t.modal?.dimensions?.default??{width:"500px",height:"600px",maxHeight:"95vh"},[t.modal?.dimensions?.default]),v=O.useMemo(()=>t.modal?.dimensions?.expanded??{width:"70vw",height:"90vh"},[t.modal?.dimensions?.expanded]),w=j.useAssistantState(({thread:k})=>k)?.messages?.some(k=>k.status?.type==="running")??!1,x=c?v.width:h.width,y=c?v.height:h.height,S=h.maxHeight;return p.jsx(Ye.LazyMotion,{features:Ye.domMax,children:p.jsx(Ye.MotionConfig,{reducedMotion:"user",transition:BW,children:p.jsx("div",{className:I.cn("aui-root aui-modal-anchor fixed z-10",g,r.className,o("lg"),a&&"shadow-xl",e),children:p.jsx(Ye.AnimatePresence,{mode:"wait",children:a?p.jsxs(Ve.div,{layout:!0,layoutId:"chat-container",className:I.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:f.includes("left")?0:1,originY:f.includes("top")?0:1,width:x,height:y,maxHeight:S},children:[p.jsxs(Ve.div,{className:I.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:Qe},children:[p.jsx("div",{className:I.cn("flex min-w-0 items-center"),children:p.jsxs("span",{className:I.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(Rs,{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(k=>!k),className:I.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(B5,{strokeWidth:2,className:"size-3.5 rotate-90"}):p.jsx(F5,{strokeWidth:2,className:"size-3.5 rotate-90"})}):null,p.jsx("button",{onClick:()=>{i(!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($n,{className:"size-4.5"})})]})]}),p.jsxs(Ve.div,{className:"aui-modal-body flex flex-1 overflow-hidden",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.05,ease:Qe},children:[m&&p.jsx("div",{className:"aui-modal-thread-list w-56 shrink-0 overflow-y-auto border-r",children:p.jsx(Gp,{})}),p.jsx("div",{className:"aui-modal-thread w-full flex-1 overflow-hidden",children:p.jsx(vp,{children:p.jsx(Bp,{})})})]})]},"chat"):p.jsx(Ve.button,{layout:!0,layoutId:"chat-container",onClick:()=>i(!0),className:I.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(Ve.div,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2,ease:Qe},className:"flex size-full items-center justify-center",children:d?d("closed"):p.jsx(Z5,{className:"size-6"})})},"button")})})})})};function HW(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:I.assertNever(e)}}const WW=({className:e})=>{const{config:t}=I.useElements(),r=Sl(),o=t.sidecar??{},{title:n,dimensions:a}=o,{expandable:i,isExpanded:s,setIsExpanded:c}=AO(),u=j.useAssistantState(({thread:m})=>m).messages.some(m=>m.status?.type==="running"),d=t.history?.enabled&&t.history?.showThreadList!==!1;return p.jsx(Ye.LazyMotion,{features:Ye.domMax,children:p.jsxs(Ve.div,{initial:!1,animate:{width:s?a?.expanded?.width??"800px":a?.default?.width??"400px"},transition:{duration:.3,ease:Qe},className:I.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:I.cn("text-foreground text-md flex items-center gap-2 font-medium",u&&"title-shimmer"),children:[n,u&&p.jsx(Rs,{className:"text-muted-foreground size-4.5 animate-spin",strokeWidth:1.25})]}),i&&p.jsx("div",{className:"aui-sidecar-header-actions flex items-center gap-1",children:p.jsx(Xt,{tooltip:s?"Collapse":"Pop out",variant:"ghost",className:"aui-sidecar-popout size-8",onClick:()=>c(m=>!m),children:s?p.jsx(H5,{className:"size-4.5"}):p.jsx(J5,{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(Gp,{})}),p.jsx("div",{className:"aui-sidecar-content flex-1 overflow-hidden",children:p.jsx(vp,{children:p.jsx(Bp,{})})})]})]})})};function JW({containerRef:e,children:t}){return p.jsx(S1.Provider,{value:e,children:t})}const Tu=`@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-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-100:oklch(93% .034 272.788);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-violet-600:oklch(54.1% .281 293.009);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-900:oklch(38.1% .176 304.987);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--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);--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--tracking-tight:-.025em;--tracking-wide:.025em;--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;--blur-2xl:40px;--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-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-2{top:calc(var(--spacing)*2)}.gram-elements .top-4{top:calc(var(--spacing)*4)}.gram-elements .top-\\[50\\%\\]{top:50%}.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-0{bottom:calc(var(--spacing)*0)}.gram-elements .bottom-4{bottom:calc(var(--spacing)*4)}.gram-elements .bottom-full{bottom:100%}.gram-elements .left-0{left:calc(var(--spacing)*0)}.gram-elements .left-4{left:calc(var(--spacing)*4)}.gram-elements .left-\\[50\\%\\]{left:50%}.gram-elements .isolate{isolation:isolate}.gram-elements .z-0{z-index:0}.gram-elements .z-10{z-index:10}.gram-elements .z-50{z-index:50}.gram-elements .z-\\[60\\]{z-index:60}.gram-elements .z-\\[70\\]{z-index:70}.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 .-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{display:inline}.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-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-\\[118px\\]{min-height:118px}.gram-elements .min-h-\\[400px\\]{min-height:400px}.gram-elements .min-h-screen{min-height:100vh}.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-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-shrink-0{flex-shrink:0}.gram-elements .shrink{flex-shrink:1}.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-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)}.gram-elements .gap-8{gap:calc(var(--spacing)*8)}: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-black\\/\\[0\\.08\\]{border-color:#00000014}@supports (color:color-mix(in lab,red,red)){.gram-elements .border-black\\/\\[0\\.08\\]{border-color:color-mix(in oklab,var(--color-black)8%,transparent)}}.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,.gram-elements .bg-background\\/40{background-color:var(--background)}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-background\\/40{background-color:color-mix(in oklab,var(--background)40%,transparent)}}.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-500\\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-emerald-500\\/20{background-color:color-mix(in oklab,var(--color-emerald-500)20%,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-indigo-400{background-color:var(--color-indigo-400)}.gram-elements .bg-indigo-600{background-color:var(--color-indigo-600)}.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-rose-500\\/20{background-color:#ff235733}@supports (color:color-mix(in lab,red,red)){.gram-elements .bg-rose-500\\/20{background-color:color-mix(in oklab,var(--color-rose-500)20%,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-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-b{--tw-gradient-position:to bottom in oklab;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-100{--tw-gradient-from:var(--color-indigo-100);--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-white\\/80{--tw-gradient-from:#fffc}@supports (color:color-mix(in lab,red,red)){.gram-elements .from-white\\/80{--tw-gradient-from:color-mix(in oklab,var(--color-white)80%,transparent)}}.gram-elements .from-white\\/80{--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-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-purple-100{--tw-gradient-to:var(--color-purple-100);--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-white\\/60{--tw-gradient-to:#fff9}@supports (color:color-mix(in lab,red,red)){.gram-elements .to-white\\/60{--tw-gradient-to:color-mix(in oklab,var(--color-white)60%,transparent)}}.gram-elements .to-white\\/60{--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-emerald-500{fill:var(--color-emerald-500)}.gram-elements .fill-foreground{fill:var(--foreground)}.gram-elements .fill-red-500{fill:var(--color-red-500)}.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-end{text-align:end}.gram-elements .text-left{text-align:left}.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-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--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-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.gram-elements .text-balance{text-wrap:balance}.gram-elements .break-words,.gram-elements .wrap-break-word{overflow-wrap:break-word}.gram-elements .whitespace-break-spaces{white-space:break-spaces}.gram-elements .whitespace-normal{white-space:normal}.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-indigo-500{color:var(--color-indigo-500)}.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-slate-300{color:var(--color-slate-300)}.gram-elements .text-slate-400{color:var(--color-slate-400)}.gram-elements .text-slate-500{color:var(--color-slate-500)}.gram-elements .text-slate-600{color:var(--color-slate-600)}.gram-elements .text-slate-900{color:var(--color-slate-900)}.gram-elements .text-white{color:var(--color-white)}.gram-elements .text-yellow-400{color:var(--color-yellow-400)}.gram-elements .text-zinc-900{color:var(--color-zinc-900)}.gram-elements .capitalize{text-transform:capitalize}.gram-elements .lowercase{text-transform:lowercase}.gram-elements .uppercase{text-transform:uppercase}.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-50{opacity:.5}.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-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-2xl{--tw-backdrop-blur:blur(var(--blur-2xl));-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 .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-\\[background-color\\]{transition-property:background-color;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-\\[fill\\]{transition-property:fill;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 .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 .fade-in{--tw-enter-opacity:0}.gram-elements .running{animation-play-state:running}.gram-elements .slide-in-from-bottom-1{--tw-enter-translate-y:calc(1*var(--spacing))}@media(hover:hover){.gram-elements .group-hover\\/btn\\:fill-emerald-500:is(:where(.group\\/btn):hover *){fill:var(--color-emerald-500)}}.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-500\\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-emerald-500\\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500)10%,transparent)}}.gram-elements .hover\\:bg-emerald-700:hover{background-color:var(--color-emerald-700)}.gram-elements .hover\\:bg-indigo-700:hover{background-color:var(--color-indigo-700)}.gram-elements .hover\\:bg-muted:hover{background-color:var(--muted)}.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-rose-500\\/10:hover{background-color:#ff23571a}@supports (color:color-mix(in lab,red,red)){.gram-elements .hover\\:bg-rose-500\\/10:hover{background-color:color-mix(in oklab,var(--color-rose-500)10%,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\\:text-slate-200:hover{color:var(--color-slate-200)}.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\\:cursor-not-allowed:disabled{cursor:not-allowed}.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[data-active=true],.gram-elements .data-\\[active\\=true\\]\\:bg-muted\\/80[data-active=true]{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.gram-elements .data-\\[active\\=true\\]\\:bg-muted\\/80[data-active=true]{background-color:color-mix(in oklab,var(--muted)80%,transparent)}}.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:320px){.gram-elements .\\@\\[320px\\]\\:mr-1{margin-right:calc(var(--spacing)*1)}.gram-elements .\\@\\[320px\\]\\:mr-auto{margin-right:auto}.gram-elements .\\@\\[320px\\]\\:hidden{display:none}.gram-elements .\\@\\[320px\\]\\:inline{display:inline}.gram-elements .\\@\\[320px\\]\\:flex-row{flex-direction:row}.gram-elements .\\@\\[320px\\]\\:items-center{align-items:center}.gram-elements .\\@\\[320px\\]\\:justify-end{justify-content:flex-end}}@container (min-width:24rem){.gram-elements .\\@sm\\:flex-row{flex-direction:row}.gram-elements .\\@sm\\:flex-wrap{flex-wrap:wrap}.gram-elements .\\@sm\\:items-center{align-items:center}.gram-elements .\\@sm\\:justify-center{justify-content:center}}@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-white\\/\\[0\\.08\\]:is(.dark *){border-color:#ffffff14}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:border-white\\/\\[0\\.08\\]:is(.dark *){border-color:color-mix(in oklab,var(--color-white)8%,transparent)}}.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-slate-800:is(.dark *){background-color:var(--color-slate-800)}.gram-elements .dark\\:bg-zinc-900:is(.dark *){background-color:var(--color-zinc-900)}.gram-elements .dark\\:from-indigo-900:is(.dark *){--tw-gradient-from:var(--color-indigo-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 .dark\\:from-white\\/15:is(.dark *){--tw-gradient-from:#ffffff26}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:from-white\\/15:is(.dark *){--tw-gradient-from:color-mix(in oklab,var(--color-white)15%,transparent)}}.gram-elements .dark\\:from-white\\/15:is(.dark *){--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 .dark\\:to-purple-900:is(.dark *){--tw-gradient-to:var(--color-purple-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 .dark\\:to-white\\/10:is(.dark *){--tw-gradient-to:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.gram-elements .dark\\:to-white\\/10:is(.dark *){--tw-gradient-to:color-mix(in oklab,var(--color-white)10%,transparent)}}.gram-elements .dark\\:to-white\\/10:is(.dark *){--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 .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-foreground:is(.dark *){color:var(--foreground)}.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-indigo-400:is(.dark *){color:var(--color-indigo-400)}.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-rose-400:is(.dark *){color:var(--color-rose-400)}.gram-elements .dark\\:text-slate-300:is(.dark *){color:var(--color-slate-300)}.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{--shimmer-track-height:200px;--shimmer-angle:15deg;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}}`,as=({children:e,hostClassName:t,hostStyle:r})=>{const o=O.useRef(null),n=O.useRef(null),[a,i]=O.useState(null),{config:s}=I.useElements(),c=Sl(),l=O.useMemo(()=>I.cn(Ws,c.className),[c.className]);return O.useEffect(()=>{const u=o.current;if(!u)return;const d=u.shadowRoot??u.attachShadow({mode:"open"});i(d)},[]),O.useEffect(()=>{if(!a)return;const u=a.querySelector("style[data-gram-elements]");if(u){u.textContent=Tu;return}const d=document.createElement("style");d.setAttribute("data-gram-elements","true"),d.textContent=Tu,a.prepend(d)},[a,Tu]),p.jsx("div",{ref:o,className:t,style:{isolation:"isolate",...r},children:a?kd.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(JW,{containerRef:n,children:e})}),a):null})},KW=({className:e})=>{const{config:t}=I.useElements();switch(t.variant){case"standalone":return p.jsx(vp,{children:p.jsx(as,{hostStyle:{height:"100%",width:"100%"},children:p.jsx(Bp,{})})});case"sidecar":return p.jsx(as,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(WW,{})});default:return p.jsx(as,{children:p.jsx(GW,{className:e})})}},YW=({className:e})=>p.jsx(as,{hostStyle:{height:"inherit",width:"inherit"},children:p.jsx(Gp,{className:e})});function XW({onShare:e,buildShareUrl:t,variant:r="ghost",size:o="sm",className:n,children:a}){const{threadId:i}=j$(),s=O.useCallback(async()=>{if(!i){e?.({error:new Error("No chat to share yet. Send a message first.")});return}try{const c=t?t(i):(()=>{const l=new URL(window.location.href);return l.searchParams.set("threadId",i),l.toString()})();await navigator.clipboard.writeText(c),e?.({url:c})}catch(c){e?.({error:c instanceof Error?c:new Error("Failed to copy link")})}},[i,t,e]);return p.jsxs(bi,{children:[p.jsx(_i,{asChild:!0,children:p.jsx(rt,{variant:r,size:o,onClick:s,disabled:!i,className:I.cn("aui-share-button",n),"aria-label":"Share chat",children:a??p.jsxs(p.Fragment,{children:[p.jsx(z5,{className:"mr-2 size-4"}),"Share chat"]})})}),p.jsx(wi,{children:i?"Copy chat link to clipboard":"Send a message first to share"})]})}const QW=new YS,eJ=({cassette:e,children:t,config:r,typingSpeed:o,userMessageDelay:n,assistantStartDelay:a,onComplete:i})=>{const s={typingSpeed:o,userMessageDelay:n,assistantStartDelay:a,onComplete:i},c=O.useMemo(()=>dW(e,s),[e,o,n,a,i]),l=Hs.useChatRuntime({transport:c}),u=r?.plugins??I.recommended,d=O.useMemo(()=>({projectSlug:r?.projectSlug??"replay",variant:r?.variant,theme:r?.theme,welcome:r?.welcome,components:r?.components,plugins:u,composer:r?.composer,tools:r?.tools,modal:r?.modal,sidecar:r?.sidecar}),[r,u]),m=O.useMemo(()=>({config:d,setModel:()=>{},model:sl[0],isExpanded:!1,setIsExpanded:()=>{},isOpen:!0,setIsOpen:()=>{},plugins:u,mcpTools:void 0}),[d,u]),f=O.useMemo(()=>({isReplay:!0}),[]);return p.jsx(ek,{client:QW,children:p.jsx(j.AssistantRuntimeProvider,{runtime:l,children:p.jsx(OO.Provider,{value:f,children:p.jsx(I.ElementsContext.Provider,{value:m,children:p.jsxs(R$,{children:[p.jsx("div",{className:I.cn(Ws,(d.variant==="standalone"||d.variant==="sidecar")&&"h-full min-h-0 flex-1"),children:t}),p.jsx(nJ,{cassette:e,options:s})]})})})})})};function tJ(e){return new Promise(t=>setTimeout(t,e))}async function rJ(e){e.getState().isRunning||await new Promise(t=>{const r=e.subscribe(()=>{e.getState().isRunning&&(r(),t())});e.getState().isRunning&&(r(),t())}),e.getState().isRunning&&await new Promise(t=>{const r=e.subscribe(()=>{e.getState().isRunning||(r(),t())});e.getState().isRunning||(r(),t())})}const nJ=({cassette:e,options:t})=>{const r=j.useThreadRuntime(),o=O.useRef(!1);return O.useEffect(()=>{if(o.current)return;o.current=!0;const n=t.userMessageDelay??800;let a=!1;return(async()=>{for(const s of e.messages){if(a)return;if(s.role==="user"){if(await tJ(n),a)return;const c=s.content.filter(l=>l.type==="text").map(l=>l.text).join(`
186
- `);r.append(c),await rJ(r)}}t.onComplete?.()})(),()=>{a=!0}},[]),null};exports.ActionType=rl;exports.CENSORED_IMG_MARK=Wz;exports.CENSORED_STRING_MARK=Ki;exports.Chat=KW;exports.ChatHistory=YW;exports.ElementsProvider=zq;exports.MODELS=sl;exports.NodePrivacyLevel=de;exports.ONE_SECOND=et;exports.PRIVACY_ATTR_NAME=Gf;exports.PRIVACY_ATTR_VALUE_HIDDEN=Gz;exports.Replay=eJ;exports.RumEventType=ne;exports.ShareButton=XW;exports.addEventListener=Ne;exports.addEventListeners=wr;exports.addRecord=zL;exports.addSegment=DL;exports.addTelemetryDebug=$o;exports.addTelemetryMetrics=li;exports.addWroteData=UL;exports.buildTags=jf;exports.buildUrl=ai;exports.canUseEventBridge=pn;exports.clearTimeout=kt;exports.clocksNow=qe;exports.clocksOrigin=$f;exports.createHttpRequest=zf;exports.currentDrift=dk;exports.defineFrontendTool=v5;exports.display=re;exports.elapsed=De;exports.forEachChildNodes=Nz;exports.getEventBridge=Io;exports.getGlobalObject=Rt;exports.getMutationObserverConstructor=bE;exports.getNodePrivacyLevel=di;exports.getNodeSelfPrivacyLevel=DE;exports.getParentNode=CE;exports.getScrollX=b6;exports.getScrollY=tI;exports.getSegmentsCount=ML;exports.getTextContent=Yz;exports.getViewportDimension=al;exports.hasChildNodes=Rz;exports.initViewportObservable=rI;exports.instrumentMethod=Wt;exports.instrumentSetter=bM;exports.isNodeShadowHost=qf;exports.isNodeShadowRoot=OE;exports.isPageExitReason=Jk;exports.isSafari=r2;exports.jsonStringify=ko;exports.monitor=ie;exports.monitorError=br;exports.noop=xe;exports.objectEntries=Yc;exports.reducePrivacyLevel=ME;exports.relativeToClocks=ri;exports.requestIdleCallback=iE;exports.sanitizeIfLongDataUrl=kE;exports.sendToExtension=Mf;exports.setTimeout=Xe;exports.shouldMaskAttribute=zE;exports.shouldMaskNode=Hf;exports.supportPerformanceTimingEvent=Jr;exports.throttle=oi;exports.timeStampNow=We;exports.trackError=Os;exports.useRecordCassette=fW;exports.useThreadId=j$;
187
- //# sourceMappingURL=index-CAtaLV1E.cjs.map