@ipa-vue/element-plus 0.3.3 → 0.3.4

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.
@@ -1,84 +0,0 @@
1
- "use strict";const o=require("vue"),G=require("element-plus"),yi=require("dayjs"),Ei=require("vue-i18n");require("pinia");const Yt=require("vue-router"),ut=require("@element-plus/icons-vue"),Nn=require("vuedraggable"),Me=require("@vueuse/core"),at=require("vue-element-plus-x"),Va=require("x-markdown-vue"),Xe=require("@iconify/vue");var bi={name:"zh-cn",el:{breadcrumb:{label:"面包屑"},colorpicker:{confirm:"确定",clear:"清空",defaultLabel:"颜色选择器",description:"当前颜色 {color},按 Enter 键选择新颜色",alphaLabel:"选择透明度的值",alphaDescription:"透明度 {alpha}, 当前颜色 {color}",hueLabel:"选择色相值",hueDescription:"色相 {hue}, 当前颜色 {color}",svLabel:"选择饱和度与明度的值",svDescription:"饱和度 {saturation}, 明度 {brightness}, 当前颜色 {color}",predefineDescription:"选择 {value} 作为颜色"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",dateTablePrompt:"使用方向键与 Enter 键可选择日期",monthTablePrompt:"使用方向键与 Enter 键可选择月份",yearTablePrompt:"使用方向键与 Enter 键可选择年份",selectedDate:"已选日期",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},weeksFull:{sun:"星期日",mon:"星期一",tue:"星期二",wed:"星期三",thu:"星期四",fri:"星期五",sat:"星期六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},inputNumber:{decrease:"减少数值",increase:"增加数值"},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},mention:{loading:"加载中"},dropdown:{toggleDropdown:"切换下拉选项"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页",page:"页",prev:"上一页",next:"下一页",currentPage:"第 {pager} 页",prevPages:"向前 {pager} 页",nextPages:"向后 {pager} 页",deprecationWarning:"你使用了一些已被废弃的用法,请参考 el-pagination 的官方文档"},dialog:{close:"关闭此对话框"},drawer:{close:"关闭此对话框"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!",close:"关闭此对话框"},upload:{deleteTip:"按 Delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},slider:{defaultLabel:"滑块介于 {min} 至 {max}",defaultRangeStartLabel:"选择起始值",defaultRangeEndLabel:"选择结束值"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计",selectAllLabel:"选择所有行",selectRowLabel:"选择当前行",expandRowLabel:"展开当前行",collapseRowLabel:"收起当前行",sortLabel:"按 {column} 排序",filterLabel:"按 {column} 过滤"},tag:{close:"关闭此标签"},tour:{next:"下一步",previous:"上一步",finish:"结束导览",close:"关闭此对话框"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},carousel:{leftArrow:"上一张幻灯片",rightArrow:"下一张幻灯片",indicator:"幻灯片切换至索引 {index}"},inputOTP:{groupLabel:"一次性密码输入框",defaultLabel:"请输入第 {index} 位 OTP 字符"}}},qt={exports:{}},wi=qt.exports,Tn;function ki(){return Tn||(Tn=1,(function(e,t){(function(r,n){e.exports=n(yi)})(wi,(function(r){function n(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var a=n(r),s={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(i,l){return l==="W"?i+"周":i+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(i,l){var u=100*i+l;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return a.default.locale(s,null,!0),s}))})(qt)),qt.exports}ki();const wr=new WeakMap,_i=(...e)=>{var t;const r=e[0],n=(t=o.getCurrentInstance())===null||t===void 0?void 0:t.proxy,a=n??o.getCurrentScope();if(a==null&&!o.hasInjectionContext())throw new Error("injectLocal must be called in setup");return a&&wr.has(a)&&r in wr.get(a)?wr.get(a)[r]:o.inject(...e)},$i=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ii=Object.prototype.toString,xi=e=>Ii.call(e)==="[object Object]",Si=()=>{};function Da(...e){if(e.length!==1)return o.toRef(...e);const t=e[0];return typeof t=="function"?o.readonly(o.customRef(()=>({get:t,set:Si}))):o.ref(t)}function Ni(e,t){function r(...n){return new Promise((a,s)=>{Promise.resolve(e(()=>t.apply(this,n),{fn:t,thisArg:this,args:n})).then(a).catch(s)})}return r}const Fa=e=>e();function Ti(e=Fa,t={}){const{initialState:r="active"}=t,n=Da(r==="active");function a(){n.value=!1}function s(){n.value=!0}const i=(...l)=>{n.value&&e(...l)};return{isActive:o.shallowReadonly(n),pause:a,resume:s,eventFilter:i}}function On(e){return e.endsWith("rem")?Number.parseFloat(e)*16:Number.parseFloat(e)}function kr(e){return Array.isArray(e)?e:[e]}function Oi(e){return o.getCurrentInstance()}function Ri(e,t,r={}){const{eventFilter:n=Fa,...a}=r;return o.watch(e,Ni(n,t),a)}function Ai(e,t,r={}){const{eventFilter:n,initialState:a="active",...s}=r,{eventFilter:i,pause:l,resume:u,isActive:c}=Ti(n,{initialState:a});return{stop:Ri(e,t,{...s,eventFilter:i}),pause:l,resume:u,isActive:c}}function Za(e,t=!0,r){Oi()?o.onMounted(e,r):t?e():o.nextTick(e)}function Ci(e,t,r){return o.watch(e,t,{...r,immediate:!0})}const $t=$i?window:void 0;function Ua(e){var t;const r=o.toValue(e);return(t=r?.$el)!==null&&t!==void 0?t:r}function Ar(...e){const t=(n,a,s,i)=>(n.addEventListener(a,s,i),()=>n.removeEventListener(a,s,i)),r=o.computed(()=>{const n=kr(o.toValue(e[0])).filter(a=>a!=null);return n.every(a=>typeof a!="string")?n:void 0});return Ci(()=>{var n,a;return[(n=(a=r.value)===null||a===void 0?void 0:a.map(s=>Ua(s)))!==null&&n!==void 0?n:[$t].filter(s=>s!=null),kr(o.toValue(r.value?e[1]:e[0])),kr(o.unref(r.value?e[2]:e[1])),o.toValue(r.value?e[3]:e[2])]},([n,a,s,i],l,u)=>{if(!n?.length||!a?.length||!s?.length)return;const c=xi(i)?{...i}:i,d=n.flatMap(m=>a.flatMap(p=>s.map(f=>t(m,p,f,c))));u(()=>{d.forEach(m=>m())})},{flush:"post"})}function zi(){const e=o.shallowRef(!1),t=o.getCurrentInstance();return t&&o.onMounted(()=>{e.value=!0},t),e}function Pi(e){const t=zi();return o.computed(()=>(t.value,!!e()))}const Li=Symbol("vueuse-ssr-width");function Mi(){const e=o.hasInjectionContext()?_i(Li,null):null;return typeof e=="number"?e:void 0}function ji(e,t={}){const{window:r=$t,ssrWidth:n=Mi()}=t,a=Pi(()=>r&&"matchMedia"in r&&typeof r.matchMedia=="function"),s=o.shallowRef(typeof n=="number"),i=o.shallowRef(),l=o.shallowRef(!1),u=c=>{l.value=c.matches};return o.watchEffect(()=>{if(s.value){s.value=!a.value,l.value=o.toValue(e).split(",").some(c=>{const d=c.includes("not all"),m=c.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/),p=c.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);let f=!!(m||p);return m&&f&&(f=n>=On(m[1])),p&&f&&(f=n<=On(p[1])),d?!f:f});return}a.value&&(i.value=r.matchMedia(o.toValue(e)),l.value=i.value.matches)}),Ar(i,"change",u,{passive:!0}),o.computed(()=>l.value)}const Bt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Vt="__vueuse_ssr_handlers__",Bi=Vi();function Vi(){return Vt in Bt||(Bt[Vt]=Bt[Vt]||{}),Bt[Vt]}function qa(e,t){return Bi[e]||t}function Di(e){return ji("(prefers-color-scheme: dark)",e)}function Fi(e){return e==null?"any":e instanceof Set?"set":e instanceof Map?"map":e instanceof Date?"date":typeof e=="boolean"?"boolean":typeof e=="string"?"string":typeof e=="object"?"object":Number.isNaN(e)?"any":"number"}const Zi={boolean:{read:e=>e==="true",write:e=>String(e)},object:{read:e=>JSON.parse(e),write:e=>JSON.stringify(e)},number:{read:e=>Number.parseFloat(e),write:e=>String(e)},any:{read:e=>e,write:e=>String(e)},string:{read:e=>e,write:e=>String(e)},map:{read:e=>new Map(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e.entries()))},set:{read:e=>new Set(JSON.parse(e)),write:e=>JSON.stringify(Array.from(e))},date:{read:e=>new Date(e),write:e=>e.toISOString()}},Rn="vueuse-storage";function Ui(e,t,r,n={}){var a;const{flush:s="pre",deep:i=!0,listenToStorageChanges:l=!0,writeDefaults:u=!0,mergeDefaults:c=!1,shallow:d,window:m=$t,eventFilter:p,onError:f=j=>{console.error(j)},initOnMounted:v}=n,h=(d?o.shallowRef:o.ref)(typeof t=="function"?t():t),y=o.computed(()=>o.toValue(e));if(!r)try{r=qa("getDefaultStorage",()=>$t?.localStorage)()}catch(j){f(j)}if(!r)return h;const w=o.toValue(t),$=Fi(w),g=(a=n.serializer)!==null&&a!==void 0?a:Zi[$],{pause:O,resume:S}=Ai(h,j=>I(j),{flush:s,deep:i,eventFilter:p});o.watch(y,()=>V(),{flush:s});let _=!1;const E=j=>{v&&!_||V(j)},k=j=>{v&&!_||X(j)};m&&l&&(r instanceof Storage?Ar(m,"storage",E,{passive:!0}):Ar(m,Rn,k)),v?Za(()=>{_=!0,V()}):V();function N(j,U){if(m){const Q={key:y.value,oldValue:j,newValue:U,storageArea:r};m.dispatchEvent(r instanceof Storage?new StorageEvent("storage",Q):new CustomEvent(Rn,{detail:Q}))}}function I(j){try{const U=r.getItem(y.value);if(j==null)N(U,null),r.removeItem(y.value);else{const Q=g.write(j);U!==Q&&(r.setItem(y.value,Q),N(U,Q))}}catch(U){f(U)}}function ne(j){const U=j?j.newValue:r.getItem(y.value);if(U==null)return u&&w!=null&&r.setItem(y.value,g.write(w)),w;if(!j&&c){const Q=g.read(U);return typeof c=="function"?c(Q,w):$==="object"&&!Array.isArray(Q)?{...w,...Q}:Q}else return typeof U!="string"?U:g.read(U)}function V(j){if(!(j&&j.storageArea!==r)){if(j&&j.key==null){h.value=w;return}if(!(j&&j.key!==y.value)){O();try{const U=g.write(h.value);(j===void 0||j?.newValue!==U)&&(h.value=ne(j))}catch(U){f(U)}finally{j?o.nextTick(S):S()}}}}function X(j){V(j.detail)}return h}const qi="*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}";function Gi(e={}){const{selector:t="html",attribute:r="class",initialValue:n="auto",window:a=$t,storage:s,storageKey:i="vueuse-color-scheme",listenToStorageChanges:l=!0,storageRef:u,emitAuto:c,disableTransition:d=!0}=e,m={auto:"",light:"light",dark:"dark",...e.modes||{}},p=Di({window:a}),f=o.computed(()=>p.value?"dark":"light"),v=u||(i==null?Da(n):Ui(i,n,s,{window:a,listenToStorageChanges:l})),h=o.computed(()=>v.value==="auto"?f.value:v.value),y=qa("updateHTMLAttrs",(O,S,_)=>{const E=typeof O=="string"?a?.document.querySelector(O):Ua(O);if(!E)return;const k=new Set,N=new Set;let I=null;if(S==="class"){const V=_.split(/\s/g);Object.values(m).flatMap(X=>(X||"").split(/\s/g)).filter(Boolean).forEach(X=>{V.includes(X)?k.add(X):N.add(X)})}else I={key:S,value:_};if(k.size===0&&N.size===0&&I===null)return;let ne;d&&(ne=a.document.createElement("style"),ne.appendChild(document.createTextNode(qi)),a.document.head.appendChild(ne));for(const V of k)E.classList.add(V);for(const V of N)E.classList.remove(V);I&&E.setAttribute(I.key,I.value),d&&(a.getComputedStyle(ne).opacity,document.head.removeChild(ne))});function w(O){var S;y(t,r,(S=m[O])!==null&&S!==void 0?S:O)}function $(O){e.onChanged?e.onChanged(O,w):w(O)}o.watch(h,$,{flush:"post",immediate:!0}),Za(()=>$(h.value));const g=o.computed({get(){return c?v.value:h.value},set(O){v.value=O}});return Object.assign(g,{store:v,system:f,state:h})}function Ga(e={}){const{valueDark:t="dark",valueLight:r=""}=e,n=Gi({...e,onChanged:(s,i)=>{var l;e.onChanged?(l=e.onChanged)===null||l===void 0||l.call(e,s==="dark",i,s):i(s)},modes:{dark:t,light:r}}),a=o.computed(()=>n.system.value);return o.computed({get(){return n.value==="dark"},set(s){const i=s?"dark":"light";a.value===i?n.value="auto":n.value=i}})}const Ja=Symbol("t");function Ji(e,t){o.provide(Ja,e)}function Ya(e){const t=o.inject(Ja);return(r,n)=>t?t(r):n??r}function Yi(){const e=Ga();return{isDark:e,toggleTheme:t=>{e.value=t??!e.value}}}o.ref();o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./HelloWorld-5ZxSl3jB-CiISNJ3Y.cjs")));function Xa(e){return!!e&&typeof e=="object"&&"type"in e&&"value"in e&&(e.type==="JSExpression"||e.type==="JSFunction")}const Wa="__ipa_ctx:jsScope__";function Xi(e,t){const r=o.shallowRef(e);o.provide(t??Wa,r)}function Wi(e){const t=o.inject(e??Wa,o.shallowRef({}));return o.computed(()=>{const r=o.unref(t),n={};for(const a of Object.keys(r))n[a]=o.unref(r[a]);return n})}function Ha(e,t){try{const r=Object.keys(t),n=new Function("$scope",`"use strict"; const {${r.join(",")}} = $scope; try { return (${e.value}); } catch (e) { return undefined; }`)(t);if(e.type==="JSFunction"&&typeof n=="function"){const a=n;return(...s)=>{try{return a(...s)}catch{return}}}return n}catch{return}}function Cr(e,t){if(Xa(e))return Ha(e,t);if(Array.isArray(e))return e.map(r=>Cr(r,t));if(e&&typeof e=="object"){const r={};for(const[n,a]of Object.entries(e))r[n]=Cr(a,t);return r}return e}function Hi(e={}){let t,r;try{t=Yt.useRouter(),r=Yt.useRoute()}catch{}const n=o.ref([...e.fixedTabs??[]]),a=o.ref(""),s=p=>typeof e.keyBy=="function"?e.keyBy(p):e.keyBy==="path"?p.path:e.keyBy==="fullPath"||(p.meta?.multiTab??!1)?p.fullPath:p.path,i=p=>({key:s(p),fullPath:p.fullPath,title:p.meta?.title||p.name?.toString()||"",icon:p.meta?.icon,closable:p.meta?.closable??!0});function l(p){const f=i(p);if(n.value.some(h=>h.key===f.key))return;const v=n.value.findIndex(h=>h.key===a.value);v===-1?n.value.push(f):n.value.splice(v+1,0,f),a.value=f.key}function u(p){if(e.fixedTabs?.some(v=>v.key===p))return;const f=n.value.findIndex(v=>v.key===p);if(f!==-1&&(n.value.splice(f,1),p===a.value&&n.value.length>0)){const v=e.onTabClose?e.onTabClose(p,n.value):n.value[Math.max(0,f-1)]?.key,h=n.value.find(y=>y.key===v);h&&t&&t.push(h.fullPath)}}function c(p){const f=new Set(e.fixedTabs?.map(v=>v.key)??[]);n.value=n.value.filter(v=>v.key===p||f.has(v.key)),a.value=p}function d(){n.value=[...e.fixedTabs??[]],n.value.length>0?(a.value=n.value[0].key,t?.push(n.value[0].fullPath)):e.fallbackRoute&&t?.push(e.fallbackRoute)}r&&(o.watch(()=>r.fullPath,()=>{if(r.meta?.tab===!1)return;const p=s(r);if(!n.value.some(f=>f.key===p))l(r);else{const f=n.value.find(v=>v.key===p);f&&(f.fullPath=r.fullPath,f.title=r.meta?.title||f.title),a.value=p}},{immediate:!0}),o.watch(()=>r.meta?.title,p=>{if(!p)return;const f=s(r),v=n.value.find(h=>h.key===f);v&&(v.title=p)}));const m=o.computed(()=>r?.meta?.tab===!1||e.hideWhenSingleTab&&n.value.length<=1);return{tabs:n,activeKey:a,hideTabBar:m,openTab:l,closeTab:u,closeOthers:c,closeAll:d}}var Ki=Object.create,Qi=Object.getPrototypeOf,An=Object.defineProperty,el=Object.getOwnPropertyNames,tl=Object.prototype.hasOwnProperty;function rl(e){return this[e]}var nl,al=(e,t,r)=>{var n=e!=null&&typeof e=="object";if(n){var a=nl??=new WeakMap,s=a.get(e);if(s)return s}r=e!=null?Ki(Qi(e)):{};const i=An(r,"default",{value:e,enumerable:!0});for(let l of el(e))tl.call(i,l)||An(i,l,{get:rl.bind(e,l),enumerable:!0});return n&&a.set(e,i),i},W=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ot=W((e,t)=>{var r="2.0.0",n=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,i=n-6,l=["major","premajor","minor","preminor","patch","prepatch","prerelease"];t.exports={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:a,RELEASE_TYPES:l,SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}),nr=W((e,t)=>{var r=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};t.exports=r}),Rt=W((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Ot(),s=nr();e=t.exports={};var i=e.re=[],l=e.safeRe=[],u=e.src=[],c=e.safeSrc=[],d=e.t={},m=0,p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",a],[p,n]],v=y=>{for(const[w,$]of f)y=y.split(`${w}*`).join(`${w}{0,${$}}`).split(`${w}+`).join(`${w}{1,${$}}`);return y},h=(y,w,$)=>{const g=v(w),O=m++;s(y,O,w),d[y]=O,u[O]=w,c[O]=g,i[O]=new RegExp(w,$?"g":void 0),l[O]=new RegExp(g,$?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),h("FULL",`^${u[d.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),h("LOOSE",`^${u[d.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),h("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?(?:${u[d.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",u[d.COERCE],!0),h("COERCERTLFULL",u[d.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",h("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",h("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}),Yr=W((e,t)=>{var r=Object.freeze({loose:!0}),n=Object.freeze({}),a=s=>s?typeof s!="object"?r:s:n;t.exports=a}),Ka=W((e,t)=>{var r=/^[0-9]+$/,n=(s,i)=>{if(typeof s=="number"&&typeof i=="number")return s===i?0:s<i?-1:1;const l=r.test(s),u=r.test(i);return l&&u&&(s=+s,i=+i),s===i?0:l&&!u?-1:u&&!l?1:s<i?-1:1},a=(s,i)=>n(i,s);t.exports={compareIdentifiers:n,rcompareIdentifiers:a}}),he=W((e,t)=>{var r=nr(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:a}=Ot(),{safeRe:s,t:i}=Rt(),l=Yr(),{compareIdentifiers:u}=Ka(),c=(m,p)=>{const f=p.split(".");if(f.length>m.length)return!1;for(let v=0;v<f.length;v++)if(u(m[v],f[v])!==0)return!1;return!0};class d{constructor(p,f){if(f=l(f),p instanceof d){if(p.loose===!!f.loose&&p.includePrerelease===!!f.includePrerelease)return p;p=p.version}else if(typeof p!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof p}".`);if(p.length>n)throw new TypeError(`version is longer than ${n} characters`);r("SemVer",p,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const v=p.trim().match(f.loose?s[i.LOOSE]:s[i.FULL]);if(!v)throw new TypeError(`Invalid Version: ${p}`);if(this.raw=p,this.major=+v[1],this.minor=+v[2],this.patch=+v[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");v[4]?this.prerelease=v[4].split(".").map(h=>{if(/^[0-9]+$/.test(h)){const y=+h;if(y>=0&&y<a)return y}return h}):this.prerelease=[],this.build=v[5]?v[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(p){if(r("SemVer.compare",this.version,this.options,p),!(p instanceof d)){if(typeof p=="string"&&p===this.version)return 0;p=new d(p,this.options)}return p.version===this.version?0:this.compareMain(p)||this.comparePre(p)}compareMain(p){return p instanceof d||(p=new d(p,this.options)),this.major<p.major?-1:this.major>p.major?1:this.minor<p.minor?-1:this.minor>p.minor?1:this.patch<p.patch?-1:this.patch>p.patch?1:0}comparePre(p){if(p instanceof d||(p=new d(p,this.options)),this.prerelease.length&&!p.prerelease.length)return-1;if(!this.prerelease.length&&p.prerelease.length)return 1;if(!this.prerelease.length&&!p.prerelease.length)return 0;let f=0;do{const v=this.prerelease[f],h=p.prerelease[f];if(r("prerelease compare",f,v,h),v===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(v===void 0)return-1;if(v!==h)return u(v,h)}while(++f)}compareBuild(p){p instanceof d||(p=new d(p,this.options));let f=0;do{const v=this.build[f],h=p.build[f];if(r("build compare",f,v,h),v===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(v===void 0)return-1;if(v!==h)return u(v,h)}while(++f)}inc(p,f,v){if(p.startsWith("pre")){if(!f&&v===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const h=`-${f}`.match(this.options.loose?s[i.PRERELEASELOOSE]:s[i.PRERELEASE]);if(!h||h[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(p){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,v);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,v);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,v),this.inc("pre",f,v);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,v),this.inc("pre",f,v);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const h=Number(v)?1:0;if(this.prerelease.length===0)this.prerelease=[h];else{let y=this.prerelease.length;for(;--y>=0;)typeof this.prerelease[y]=="number"&&(this.prerelease[y]++,y=-2);if(y===-1){if(f===this.prerelease.join(".")&&v===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(h)}}if(f){let y=[f,h];if(v===!1&&(y=[f]),c(this.prerelease,f)){const w=this.prerelease[f.split(".").length];isNaN(w)&&(this.prerelease=y)}else this.prerelease=y}break}default:throw new Error(`invalid increment argument: ${p}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}t.exports=d}),Qe=W((e,t)=>{var r=he(),n=(a,s,i=!1)=>{if(a instanceof r)return a;try{return new r(a,s)}catch(l){if(!i)return null;throw l}};t.exports=n}),sl=W((e,t)=>{var r=Qe(),n=(a,s)=>{const i=r(a,s);return i?i.version:null};t.exports=n}),ol=W((e,t)=>{var r=Qe(),n=(a,s)=>{const i=r(a.trim().replace(/^[=v]+/,""),s);return i?i.version:null};t.exports=n}),il=W((e,t)=>{var r=he(),n=(a,s,i,l,u)=>{typeof i=="string"&&(u=l,l=i,i=void 0);try{return new r(a instanceof r?a.version:a,i).inc(s,l,u).version}catch{return null}};t.exports=n}),ll=W((e,t)=>{var r=Qe(),n=(a,s)=>{const i=r(a,null,!0),l=r(s,null,!0),u=i.compare(l);if(u===0)return null;const c=u>0,d=c?i:l,m=c?l:i,p=!!d.prerelease.length;if(m.prerelease.length&&!p){if(!m.patch&&!m.minor)return"major";if(m.compareMain(d)===0)return m.minor&&!m.patch?"minor":"patch"}const f=p?"pre":"";return i.major!==l.major?f+"major":i.minor!==l.minor?f+"minor":i.patch!==l.patch?f+"patch":"prerelease"};t.exports=n}),ul=W((e,t)=>{var r=he(),n=(a,s)=>new r(a,s).major;t.exports=n}),cl=W((e,t)=>{var r=he(),n=(a,s)=>new r(a,s).minor;t.exports=n}),dl=W((e,t)=>{var r=he(),n=(a,s)=>new r(a,s).patch;t.exports=n}),pl=W((e,t)=>{var r=Qe(),n=(a,s)=>{const i=r(a,s);return i&&i.prerelease.length?i.prerelease:null};t.exports=n}),Re=W((e,t)=>{var r=he(),n=(a,s,i)=>new r(a,i).compare(new r(s,i));t.exports=n}),fl=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(s,a,i);t.exports=n}),ml=W((e,t)=>{var r=Re(),n=(a,s)=>r(a,s,!0);t.exports=n}),Xr=W((e,t)=>{var r=he(),n=(a,s,i)=>{const l=new r(a,i),u=new r(s,i);return l.compare(u)||l.compareBuild(u)};t.exports=n}),hl=W((e,t)=>{var r=Xr(),n=(a,s)=>a.sort((i,l)=>r(i,l,s));t.exports=n}),vl=W((e,t)=>{var r=Xr(),n=(a,s)=>a.sort((i,l)=>r(l,i,s));t.exports=n}),ar=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)>0;t.exports=n}),Wr=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)<0;t.exports=n}),Qa=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)===0;t.exports=n}),es=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)!==0;t.exports=n}),Hr=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)>=0;t.exports=n}),Kr=W((e,t)=>{var r=Re(),n=(a,s,i)=>r(a,s,i)<=0;t.exports=n}),ts=W((e,t)=>{var r=Qa(),n=es(),a=ar(),s=Hr(),i=Wr(),l=Kr(),u=(c,d,m,p)=>{switch(d){case"===":return typeof c=="object"&&(c=c.version),typeof m=="object"&&(m=m.version),c===m;case"!==":return typeof c=="object"&&(c=c.version),typeof m=="object"&&(m=m.version),c!==m;case"":case"=":case"==":return r(c,m,p);case"!=":return n(c,m,p);case">":return a(c,m,p);case">=":return s(c,m,p);case"<":return i(c,m,p);case"<=":return l(c,m,p);default:throw new TypeError(`Invalid operator: ${d}`)}};t.exports=u}),gl=W((e,t)=>{var r=he(),n=Qe(),{safeRe:a,t:s}=Rt(),i=(l,u)=>{if(l instanceof r)return l;if(typeof l=="number"&&(l=String(l)),typeof l!="string")return null;u=u||{};let c=null;if(!u.rtl)c=l.match(u.includePrerelease?a[s.COERCEFULL]:a[s.COERCE]);else{const h=u.includePrerelease?a[s.COERCERTLFULL]:a[s.COERCERTL];let y;for(;(y=h.exec(l))&&(!c||c.index+c[0].length!==l.length);)(!c||y.index+y[0].length!==c.index+c[0].length)&&(c=y),h.lastIndex=y.index+y[1].length+y[2].length;h.lastIndex=-1}if(c===null)return null;const d=c[2],m=c[3]||"0",p=c[4]||"0",f=u.includePrerelease&&c[5]?`-${c[5]}`:"",v=u.includePrerelease&&c[6]?`+${c[6]}`:"";return n(`${d}.${m}.${p}${f}${v}`,u)};t.exports=i}),yl=W((e,t)=>{var r=Qe(),n=Ot(),a=he(),s=(c,d,m)=>{if(!n.RELEASE_TYPES.includes(d))return null;const p=i(c,m);return p&&l(p,d)},i=(c,d)=>{const m=c instanceof a?c.version:c;return r(m,d)},l=(c,d)=>{if(u(d))return c.version;switch(c.prerelease=[],d){case"major":c.minor=0,c.patch=0;break;case"minor":c.patch=0;break}return c.format()},u=c=>c.startsWith("pre");t.exports=s}),El=W((e,t)=>{class r{constructor(){this.max=1e3,this.map=new Map}get(a){const s=this.map.get(a);if(s!==void 0)return this.map.delete(a),this.map.set(a,s),s}delete(a){return this.map.delete(a)}set(a,s){if(!this.delete(a)&&s!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(a,s)}return this}}t.exports=r}),Ae=W((e,t)=>{var r=/\s+/g;class n{constructor(b,A){if(A=i(A),b instanceof n)return b.loose===!!A.loose&&b.includePrerelease===!!A.includePrerelease?b:new n(b.raw,A);if(b instanceof l)return this.raw=b.value,this.set=[[b]],this.formatted=void 0,this;if(this.options=A,this.loose=!!A.loose,this.includePrerelease=!!A.includePrerelease,this.raw=b.trim().replace(r," "),this.set=this.raw.split("||").map(C=>this.parseRange(C.trim())).filter(C=>C.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const C=this.set[0];if(this.set=this.set.filter(L=>!g(L[0])),this.set.length===0)this.set=[C];else if(this.set.length>1){for(const L of this.set)if(L.length===1&&O(L[0])){this.set=[L];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let b=0;b<this.set.length;b++){b>0&&(this.formatted+="||");const A=this.set[b];for(let C=0;C<A.length;C++)C>0&&(this.formatted+=" "),this.formatted+=A[C].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(b){b=b.replace($,"");const A=((this.options.includePrerelease&&y)|(this.options.loose&&w))+":"+b,C=s.get(A);if(C)return C;const L=this.options.loose,R=L?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];b=b.replace(R,me(this.options.includePrerelease)),u("hyphen replace",b),b=b.replace(d[p.COMPARATORTRIM],f),u("comparator trim",b),b=b.replace(d[p.TILDETRIM],v),u("tilde trim",b),b=b.replace(d[p.CARETTRIM],h),u("caret trim",b);let z=b.split(" ").map(ee=>_(ee,this.options)).join(" ").split(/\s+/).map(ee=>Q(ee,this.options));L&&(z=z.filter(ee=>(u("loose invalid filter",ee,this.options),!!ee.match(d[p.COMPARATORLOOSE])))),u("range list",z);const D=new Map,B=z.map(ee=>new l(ee,this.options));for(const ee of B){if(g(ee))return[ee];D.set(ee.value,ee)}D.size>1&&D.has("")&&D.delete("");const F=[...D.values()];return s.set(A,F),F}intersects(b,A){if(!(b instanceof n))throw new TypeError("a Range is required");return this.set.some(C=>S(C,A)&&b.set.some(L=>S(L,A)&&C.every(R=>L.every(z=>R.intersects(z,A)))))}test(b){if(!b)return!1;if(typeof b=="string")try{b=new c(b,this.options)}catch{return!1}for(let A=0;A<this.set.length;A++)if(Ne(this.set[A],b,this.options))return!0;return!1}}t.exports=n;var a=El(),s=new a,i=Yr(),l=sr(),u=nr(),c=he(),{safeRe:d,src:m,t:p,comparatorTrimReplace:f,tildeTrimReplace:v,caretTrimReplace:h}=Rt(),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:w}=Ot(),$=new RegExp(m[p.BUILD],"g"),g=x=>x.value==="<0.0.0-0",O=x=>x.value==="",S=(x,b)=>{let A=!0;const C=x.slice();let L=C.pop();for(;A&&C.length;)A=C.every(R=>L.intersects(R,b)),L=C.pop();return A},_=(x,b)=>(x=x.replace(d[p.BUILD],""),u("comp",x,b),x=ne(x,b),u("caret",x),x=N(x,b),u("tildes",x),x=X(x,b),u("xrange",x),x=U(x,b),u("stars",x),x),E=x=>!x||x.toLowerCase()==="x"||x==="*",k=(x,b,A)=>E(x)&&!E(b)||E(b)&&A&&!E(A),N=(x,b)=>x.trim().split(/\s+/).map(A=>I(A,b)).join(" "),I=(x,b)=>{const A=b.loose?d[p.TILDELOOSE]:d[p.TILDE],C=b.includePrerelease?"-0":"";return x.replace(A,(L,R,z,D,B)=>{u("tilde",x,L,R,z,D,B);let F;return E(R)?F="":E(z)?F=`>=${R}.0.0${C} <${+R+1}.0.0-0`:E(D)?F=`>=${R}.${z}.0${C} <${R}.${+z+1}.0-0`:B?(u("replaceTilde pr",B),F=`>=${R}.${z}.${D}-${B} <${R}.${+z+1}.0-0`):F=`>=${R}.${z}.${D} <${R}.${+z+1}.0-0`,u("tilde return",F),F})},ne=(x,b)=>x.trim().split(/\s+/).map(A=>V(A,b)).join(" "),V=(x,b)=>{u("caret",x,b);const A=b.loose?d[p.CARETLOOSE]:d[p.CARET],C=b.includePrerelease?"-0":"";return x.replace(A,(L,R,z,D,B)=>{u("caret",x,L,R,z,D,B);let F;return E(R)?F="":E(z)?F=`>=${R}.0.0${C} <${+R+1}.0.0-0`:E(D)?R==="0"?F=`>=${R}.${z}.0${C} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.0${C} <${+R+1}.0.0-0`:B?(u("replaceCaret pr",B),R==="0"?z==="0"?F=`>=${R}.${z}.${D}-${B} <${R}.${z}.${+D+1}-0`:F=`>=${R}.${z}.${D}-${B} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.${D}-${B} <${+R+1}.0.0-0`):(u("no pr"),R==="0"?z==="0"?F=`>=${R}.${z}.${D} <${R}.${z}.${+D+1}-0`:F=`>=${R}.${z}.${D} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.${D} <${+R+1}.0.0-0`),u("caret return",F),F})},X=(x,b)=>(u("replaceXRanges",x,b),x.split(/\s+/).map(A=>j(A,b)).join(" ")),j=(x,b)=>{x=x.trim();const A=b.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return x.replace(A,(C,L,R,z,D,B)=>{if(u("xRange",x,C,L,R,z,D,B),k(R,z,D))return x;const F=E(R),ee=F||E(z),ae=ee||E(D),$e=ae;return L==="="&&$e&&(L=""),B=b.includePrerelease?"-0":"",F?L===">"||L==="<"?C="<0.0.0-0":C="*":L&&$e?(ee&&(z=0),D=0,L===">"?(L=">=",ee?(R=+R+1,z=0,D=0):(z=+z+1,D=0)):L==="<="&&(L="<",ee?R=+R+1:z=+z+1),L==="<"&&(B="-0"),C=`${L+R}.${z}.${D}${B}`):ee?C=`>=${R}.0.0${B} <${+R+1}.0.0-0`:ae&&(C=`>=${R}.${z}.0${B} <${R}.${+z+1}.0-0`),u("xRange return",C),C})},U=(x,b)=>(u("replaceStars",x,b),x.trim().replace(d[p.STAR],"")),Q=(x,b)=>(u("replaceGTE0",x,b),x.trim().replace(d[b.includePrerelease?p.GTE0PRE:p.GTE0],"")),me=x=>(b,A,C,L,R,z,D,B,F,ee,ae,$e)=>(E(C)?A="":E(L)?A=`>=${C}.0.0${x?"-0":""}`:E(R)?A=`>=${C}.${L}.0${x?"-0":""}`:z?A=`>=${A}`:A=`>=${A}${x?"-0":""}`,E(F)?B="":E(ee)?B=`<${+F+1}.0.0-0`:E(ae)?B=`<${F}.${+ee+1}.0-0`:$e?B=`<=${F}.${ee}.${ae}-${$e}`:x?B=`<${F}.${ee}.${+ae+1}-0`:B=`<=${B}`,`${A} ${B}`.trim()),Ne=(x,b,A)=>{for(let C=0;C<x.length;C++)if(!x[C].test(b))return!1;if(b.prerelease.length&&!A.includePrerelease){for(let C=0;C<x.length;C++)if(u(x[C].semver),x[C].semver!==l.ANY&&x[C].semver.prerelease.length>0){const L=x[C].semver;if(L.major===b.major&&L.minor===b.minor&&L.patch===b.patch)return!0}return!1}return!0}}),sr=W((e,t)=>{var r=Symbol("SemVer ANY");class n{static get ANY(){return r}constructor(p,f){if(f=a(f),p instanceof n){if(p.loose===!!f.loose)return p;p=p.value}p=p.trim().split(/\s+/).join(" "),u("comparator",p,f),this.options=f,this.loose=!!f.loose,this.parse(p),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(p){const f=this.options.loose?s[i.COMPARATORLOOSE]:s[i.COMPARATOR],v=p.match(f);if(!v)throw new TypeError(`Invalid comparator: ${p}`);this.operator=v[1]!==void 0?v[1]:"",this.operator==="="&&(this.operator=""),v[2]?this.semver=new c(v[2],this.options.loose):this.semver=r}toString(){return this.value}test(p){if(u("Comparator.test",p,this.options.loose),this.semver===r||p===r)return!0;if(typeof p=="string")try{p=new c(p,this.options)}catch{return!1}return l(p,this.operator,this.semver,this.options)}intersects(p,f){if(!(p instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(p.value,f).test(this.value):p.operator===""?p.value===""?!0:new d(this.value,f).test(p.semver):(f=a(f),f.includePrerelease&&(this.value==="<0.0.0-0"||p.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||p.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&p.operator.startsWith(">")||this.operator.startsWith("<")&&p.operator.startsWith("<")||this.semver.version===p.semver.version&&this.operator.includes("=")&&p.operator.includes("=")||l(this.semver,"<",p.semver,f)&&this.operator.startsWith(">")&&p.operator.startsWith("<")||l(this.semver,">",p.semver,f)&&this.operator.startsWith("<")&&p.operator.startsWith(">")))}}t.exports=n;var a=Yr(),{safeRe:s,t:i}=Rt(),l=ts(),u=nr(),c=he(),d=Ae()}),or=W((e,t)=>{var r=Ae(),n=(a,s,i)=>{try{s=new r(s,i)}catch{return!1}return s.test(a)};t.exports=n}),bl=W((e,t)=>{var r=Ae(),n=(a,s)=>new r(a,s).set.map(i=>i.map(l=>l.value).join(" ").trim().split(" "));t.exports=n}),wl=W((e,t)=>{var r=he(),n=Ae(),a=(s,i,l)=>{let u=null,c=null,d=null;try{d=new n(i,l)}catch{return null}return s.forEach(m=>{d.test(m)&&(!u||c.compare(m)===-1)&&(u=m,c=new r(u,l))}),u};t.exports=a}),kl=W((e,t)=>{var r=he(),n=Ae(),a=(s,i,l)=>{let u=null,c=null,d=null;try{d=new n(i,l)}catch{return null}return s.forEach(m=>{d.test(m)&&(!u||c.compare(m)===1)&&(u=m,c=new r(u,l))}),u};t.exports=a}),_l=W((e,t)=>{var r=he(),n=Ae(),a=ar(),s=(i,l)=>{i=new n(i,l);let u=new r("0.0.0");if(i.test(u)||(u=new r("0.0.0-0"),i.test(u)))return u;u=null;for(let c=0;c<i.set.length;++c){const d=i.set[c];let m=null;d.forEach(p=>{const f=new r(p.semver.version);switch(p.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!m||a(f,m))&&(m=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${p.operator}`)}}),m&&(!u||a(u,m))&&(u=m)}return u&&i.test(u)?u:null};t.exports=s}),$l=W((e,t)=>{var r=Ae(),n=(a,s)=>{try{return new r(a,s).range||"*"}catch{return null}};t.exports=n}),Qr=W((e,t)=>{var r=he(),n=sr(),{ANY:a}=n,s=Ae(),i=or(),l=ar(),u=Wr(),c=Kr(),d=Hr(),m=(p,f,v,h)=>{p=new r(p,h),f=new s(f,h);let y,w,$,g,O;switch(v){case">":y=l,w=c,$=u,g=">",O=">=";break;case"<":y=u,w=d,$=l,g="<",O="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(p,f,h))return!1;for(let S=0;S<f.set.length;++S){const _=f.set[S];let E=null,k=null;if(_.forEach(N=>{N.semver===a&&(N=new n(">=0.0.0")),E=E||N,k=k||N,y(N.semver,E.semver,h)?E=N:$(N.semver,k.semver,h)&&(k=N)}),E.operator===g||E.operator===O||(!k.operator||k.operator===g)&&w(p,k.semver)||k.operator===O&&$(p,k.semver))return!1}return!0};t.exports=m}),Il=W((e,t)=>{var r=Qr(),n=(a,s,i)=>r(a,s,">",i);t.exports=n}),xl=W((e,t)=>{var r=Qr(),n=(a,s,i)=>r(a,s,"<",i);t.exports=n}),Sl=W((e,t)=>{var r=Ae(),n=(a,s,i)=>(a=new r(a,i),s=new r(s,i),a.intersects(s,i));t.exports=n}),Nl=W((e,t)=>{var r=or(),n=Re();t.exports=(a,s,i)=>{const l=[];let u=null,c=null;const d=a.sort((v,h)=>n(v,h,i));for(const v of d)r(v,s,i)?(c=v,u||(u=v)):(c&&l.push([u,c]),c=null,u=null);u&&l.push([u,null]);const m=[];for(const[v,h]of l)v===h?m.push(v):!h&&v===d[0]?m.push("*"):h?v===d[0]?m.push(`<=${h}`):m.push(`${v} - ${h}`):m.push(`>=${v}`);const p=m.join(" || "),f=typeof s.raw=="string"?s.raw:String(s);return p.length<f.length?p:s}}),Tl=W((e,t)=>{var r=Ae(),n=sr(),{ANY:a}=n,s=or(),i=Re(),l=(f,v,h={})=>{if(f===v)return!0;f=new r(f,h),v=new r(v,h);let y=!1;e:for(const w of f.set){for(const $ of v.set){const g=d(w,$,h);if(y=y||g!==null,g)continue e}if(y)return!1}return!0},u=[new n(">=0.0.0-0")],c=[new n(">=0.0.0")],d=(f,v,h)=>{if(f===v)return!0;if(f.length===1&&f[0].semver===a){if(v.length===1&&v[0].semver===a)return!0;h.includePrerelease?f=u:f=c}if(v.length===1&&v[0].semver===a){if(h.includePrerelease)return!0;v=c}const y=new Set;let w,$;for(const I of f)I.operator===">"||I.operator===">="?w=m(w,I,h):I.operator==="<"||I.operator==="<="?$=p($,I,h):y.add(I.semver);if(y.size>1)return null;let g;if(w&&$&&(g=i(w.semver,$.semver,h),g>0||g===0&&(w.operator!==">="||$.operator!=="<=")))return null;for(const I of y){if(w&&!s(I,String(w),h)||$&&!s(I,String($),h))return null;for(const ne of v)if(!s(I,String(ne),h))return!1;return!0}let O,S,_,E,k=$&&!h.includePrerelease&&$.semver.prerelease.length?$.semver:!1,N=w&&!h.includePrerelease&&w.semver.prerelease.length?w.semver:!1;k&&k.prerelease.length===1&&$.operator==="<"&&k.prerelease[0]===0&&(k=!1);for(const I of v){if(E=E||I.operator===">"||I.operator===">=",_=_||I.operator==="<"||I.operator==="<=",w){if(N&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===N.major&&I.semver.minor===N.minor&&I.semver.patch===N.patch&&(N=!1),I.operator===">"||I.operator===">="){if(O=m(w,I,h),O===I&&O!==w)return!1}else if(w.operator===">="&&!I.test(w.semver))return!1}if($){if(k&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===k.major&&I.semver.minor===k.minor&&I.semver.patch===k.patch&&(k=!1),I.operator==="<"||I.operator==="<="){if(S=p($,I,h),S===I&&S!==$)return!1}else if($.operator==="<="&&!I.test($.semver))return!1}if(!I.operator&&($||w)&&g!==0)return!1}return!(w&&_&&!$&&g!==0||$&&E&&!w&&g!==0||N||k)},m=(f,v,h)=>{if(!f)return v;const y=i(f.semver,v.semver,h);return y>0?f:y<0||v.operator===">"&&f.operator===">="?v:f},p=(f,v,h)=>{if(!f)return v;const y=i(f.semver,v.semver,h);return y<0?f:y>0||v.operator==="<"&&f.operator==="<="?v:f};t.exports=l}),Ol=W((e,t)=>{var r=Rt(),n=Ot(),a=he(),s=Ka(),i=Qe(),l=sl(),u=ol(),c=il(),d=ll(),m=ul(),p=cl(),f=dl(),v=pl(),h=Re(),y=fl(),w=ml(),$=Xr(),g=hl(),O=vl(),S=ar(),_=Wr(),E=Qa(),k=es(),N=Hr(),I=Kr(),ne=ts(),V=gl(),X=yl(),j=sr(),U=Ae(),Q=or(),me=bl(),Ne=wl(),x=kl(),b=_l(),A=$l(),C=Qr(),L=Il(),R=xl(),z=Sl(),D=Nl(),B=Tl();t.exports={parse:i,valid:l,clean:u,inc:c,diff:d,major:m,minor:p,patch:f,prerelease:v,compare:h,rcompare:y,compareLoose:w,compareBuild:$,sort:g,rsort:O,gt:S,lt:_,eq:E,neq:k,gte:N,lte:I,cmp:ne,coerce:V,truncate:X,Comparator:j,Range:U,satisfies:Q,toComparators:me,maxSatisfying:Ne,minSatisfying:x,minVersion:b,validRange:A,outside:C,gtr:L,ltr:R,intersects:z,simplifyRange:D,subset:B,SemVer:a,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n.SEMVER_SPEC_VERSION,RELEASE_TYPES:n.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers}});al(Ol());o.ref(!1);o.ref(0);o.ref(0);o.ref(null);var rs="vercel.ai.error",Rl=Symbol.for(rs),Cn,zn,Le=class ns extends(zn=Error,Cn=Rl,zn){constructor({name:t,message:r,cause:n}){super(r),this[Cn]=!0,this.name=t,this.cause=n}static isInstance(t){return ns.hasMarker(t,rs)}static hasMarker(t,r){const n=Symbol.for(r);return t!=null&&typeof t=="object"&&n in t&&typeof t[n]=="boolean"&&t[n]===!0}};function as(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.message:JSON.stringify(e)}var ss="AI_InvalidArgumentError",os=`vercel.ai.error.${ss}`,Al=Symbol.for(os),Pn,Ln,Cl=class extends(Ln=Le,Pn=Al,Ln){constructor({message:e,cause:t,argument:r}){super({name:ss,message:e,cause:t}),this[Pn]=!0,this.argument=r}static isInstance(e){return Le.hasMarker(e,os)}},is="AI_JSONParseError",ls=`vercel.ai.error.${is}`,zl=Symbol.for(ls),Mn,jn,Bn=class extends(jn=Le,Mn=zl,jn){constructor({text:e,cause:t}){super({name:is,message:`JSON parsing failed: Text: ${e}.
2
- Error message: ${as(t)}`,cause:t}),this[Mn]=!0,this.text=e}static isInstance(e){return Le.hasMarker(e,ls)}},us="AI_TypeValidationError",cs=`vercel.ai.error.${us}`,Pl=Symbol.for(cs),Vn,Dn,dt=class zr extends(Dn=Le,Vn=Pl,Dn){constructor({value:t,cause:r,context:n}){let a="Type validation failed";if(n?.field&&(a+=` for ${n.field}`),n?.entityName||n?.entityId){a+=" (";const s=[];n.entityName&&s.push(n.entityName),n.entityId&&s.push(`id: "${n.entityId}"`),a+=s.join(", "),a+=")"}super({name:us,message:`${a}: Value: ${JSON.stringify(t)}.
3
- Error message: ${as(r)}`,cause:r}),this[Vn]=!0,this.value=t,this.context=n}static isInstance(t){return Le.hasMarker(t,cs)}static wrap({value:t,cause:r,context:n}){var a,s,i;return zr.isInstance(r)&&r.value===t&&((a=r.context)==null?void 0:a.field)===n?.field&&((s=r.context)==null?void 0:s.entityName)===n?.entityName&&((i=r.context)==null?void 0:i.entityId)===n?.entityId?r:new zr({value:t,cause:r,context:n})}},Fn;function T(e,t,r){function n(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,u);const c=i.prototype,d=Object.keys(c);for(let m=0;m<d.length;m++){const p=d[m];p in l||(l[p]=c[p].bind(l))}}const a=r?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function i(l){var u;const c=r?.Parent?new s:this;n(c,l),(u=c._zod).deferred??(u.deferred=[]);for(const d of c._zod.deferred)d();return c}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>r?.Parent&&l instanceof r.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class ct extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ds extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(Fn=globalThis).__zod_globalConfig??(Fn.__zod_globalConfig={});const en=globalThis.__zod_globalConfig;function je(e){return en}function ps(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function Pr(e,t){return typeof t=="bigint"?t.toString():t}function ir(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tn(e){return e==null}function rn(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ll(e,t){const r=e/t,n=Math.round(r),a=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<a?0:r-n}const Zn=Symbol("evaluating");function re(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Zn)return n===void 0&&(n=Zn,n=r()),n},set(a){Object.defineProperty(e,t,{value:a})},configurable:!0})}function et(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ze(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Un(e){return JSON.stringify(e)}function Ml(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const fs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function It(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const jl=ir(()=>{if(en.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function pt(e){if(It(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(It(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ms(e){return pt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Bl=new Set(["string","number","symbol"]);function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Z(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 Vl(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Dl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Fl(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a=Ze(e._zod.def,{get shape(){const s={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(s[i]=r.shape[i])}return et(this,"shape",s),s},checks:[]});return Ue(e,a)}function Zl(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=Ze(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&delete s[i]}return et(this,"shape",s),s},checks:[]});return Ue(e,a)}function Ul(e,t){if(!pt(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const a=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(a,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=Ze(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return et(this,"shape",a),a}});return Ue(e,n)}function ql(e,t){if(!pt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Ze(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return et(this,"shape",n),n}});return Ue(e,r)}function Gl(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Ze(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return et(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ue(e,r)}function Jl(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=Ze(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(r)for(const l in r){if(!(l in s))throw new Error(`Unrecognized key: "${l}"`);r[l]&&(i[l]=e?new e({type:"optional",innerType:s[l]}):s[l])}else for(const l in s)i[l]=e?new e({type:"optional",innerType:s[l]}):s[l];return et(this,"shape",i),i},checks:[]});return Ue(t,a)}function Yl(e,t,r){const n=Ze(t._zod.def,{get shape(){const a=t._zod.def.shape,s={...a};if(r)for(const i in r){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);r[i]&&(s[i]=new e({type:"nonoptional",innerType:a[i]}))}else for(const i in a)s[i]=new e({type:"nonoptional",innerType:a[i]});return et(this,"shape",s),s}});return Ue(t,n)}function it(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 Xl(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function lt(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Dt(e){return typeof e=="string"?e:e?.message}function Be(e,t,r){const n=e.message?e.message:Dt(e.inst?._zod.def?.error?.(e))??Dt(t?.error?.(e))??Dt(r.customError?.(e))??Dt(r.localeError?.(e))??"Invalid input",{inst:a,continue:s,input:i,...l}=e;return l.path??(l.path=[]),l.message=n,t?.reportInput&&(l.input=i),l}function nn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function xt(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}const hs=(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,Pr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},vs=T("$ZodError",hs),gs=T("$ZodError",hs,{Parent:Error});function Wl(e,t=r=>r.message){const r={},n=[];for(const a of e.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}function Hl(e,t=r=>r.message){const r={_errors:[]},n=(a,s=[])=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(l=>n({issues:l},[...s,...i.path]));else if(i.code==="invalid_key")n({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")n({issues:i.issues},[...s,...i.path]);else{const l=[...s,...i.path];if(l.length===0)r._errors.push(t(i));else{let u=r,c=0;for(;c<l.length;){const d=l[c];c===l.length-1?(u[d]=u[d]||{_errors:[]},u[d]._errors.push(t(i))):u[d]=u[d]||{_errors:[]},u=u[d],c++}}}};return n(e),r}const an=e=>(t,r,n,a)=>{const s=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new ct;if(i.issues.length){const l=new(a?.Err??e)(i.issues.map(u=>Be(u,s,je())));throw fs(l,a?.callee),l}return i.value},sn=e=>async(t,r,n,a)=>{const s=n?{...n,async:!0}:{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(a?.Err??e)(i.issues.map(u=>Be(u,s,je())));throw fs(l,a?.callee),l}return i.value},lr=e=>(t,r,n)=>{const a=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},a);if(s instanceof Promise)throw new ct;return s.issues.length?{success:!1,error:new(e??vs)(s.issues.map(i=>Be(i,a,je())))}:{success:!0,data:s.value}},Kl=lr(gs),ur=e=>async(t,r,n)=>{const a=n?{...n,async:!0}:{async:!0};let s=t._zod.run({value:r,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Be(i,a,je())))}:{success:!0,data:s.value}},Ql=ur(gs),eu=e=>(t,r,n)=>{const a=n?{...n,direction:"backward"}:{direction:"backward"};return an(e)(t,r,a)},tu=e=>(t,r,n)=>an(e)(t,r,n),ru=e=>async(t,r,n)=>{const a=n?{...n,direction:"backward"}:{direction:"backward"};return sn(e)(t,r,a)},nu=e=>async(t,r,n)=>sn(e)(t,r,n),au=e=>(t,r,n)=>{const a=n?{...n,direction:"backward"}:{direction:"backward"};return lr(e)(t,r,a)},su=e=>(t,r,n)=>lr(e)(t,r,n),ou=e=>async(t,r,n)=>{const a=n?{...n,direction:"backward"}:{direction:"backward"};return ur(e)(t,r,a)},iu=e=>async(t,r,n)=>ur(e)(t,r,n),lu=/^[cC][0-9a-z]{6,}$/,uu=/^[0-9a-z]+$/,cu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,du=/^[0-9a-vA-V]{20}$/,pu=/^[A-Za-z0-9]{27}$/,fu=/^[a-zA-Z0-9_-]{21}$/,mu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hu=/^([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})$/,qn=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)$/,vu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yu(){return new RegExp(gu,"u")}const Eu=/^(?:(?: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])$/,bu=/^(([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}|:))$/,wu=/^((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])$/,ku=/^(([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])$/,_u=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ys=/^[A-Za-z0-9_-]*$/,$u=/^https?$/,Iu=/^\+[1-9]\d{6,14}$/,Es="(?:(?:\\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])))",xu=new RegExp(`^${Es}$`);function bs(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 Su(e){return new RegExp(`^${bs(e)}$`)}function Nu(e){const t=bs({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Es}T(?:${n})$`)}const Tu=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ou=/^-?\d+$/,ws=/^-?\d+(?:\.\d+)?$/,Ru=/^(?:true|false)$/i,Au=/^null$/i,Cu=/^[^A-Z]*$/,zu=/^[^a-z]*$/,ke=T("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),ks={number:"number",bigint:"bigint",object:"date"},_s=T("$ZodCheckLessThan",(e,t)=>{ke.init(e,t);const r=ks[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,s=(t.inclusive?a.maximum:a.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?a.maximum=t.value:a.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$s=T("$ZodCheckGreaterThan",(e,t)=>{ke.init(e,t);const r=ks[typeof t.value];e._zod.onattach.push(n=>{const a=n._zod.bag,s=(t.inclusive?a.minimum:a.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?a.minimum=t.value:a.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Pu=T("$ZodCheckMultipleOf",(e,t)=>{ke.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ll(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})}}),Lu=T("$ZodCheckNumberFormat",(e,t)=>{ke.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[a,s]=Dl[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=a,l.maximum=s,r&&(l.pattern=Ou)}),e._zod.check=i=>{const l=i.value;if(r){if(!Number.isInteger(l)){i.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):i.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}l<a&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:a,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Mu=T("$ZodCheckMaxLength",(e,t)=>{var r;ke.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!tn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const a=n.value;if(a.length<=t.maximum)return;const s=nn(a);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),ju=T("$ZodCheckMinLength",(e,t)=>{var r;ke.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!tn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const a=n.value;if(a.length>=t.minimum)return;const s=nn(a);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),Bu=T("$ZodCheckLengthEquals",(e,t)=>{var r;ke.init(e,t),(r=e._zod.def).when??(r.when=n=>{const a=n.value;return!tn(a)&&a.length!==void 0}),e._zod.onattach.push(n=>{const a=n._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=n=>{const a=n.value,s=a.length;if(s===t.length)return;const i=nn(a),l=s>t.length;n.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),cr=T("$ZodCheckStringFormat",(e,t)=>{var r,n;ke.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Vu=T("$ZodCheckRegex",(e,t)=>{cr.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})}}),Du=T("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cu),cr.init(e,t)}),Fu=T("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zu),cr.init(e,t)}),Zu=T("$ZodCheckIncludes",(e,t)=>{ke.init(e,t);const r=ft(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),Uu=T("$ZodCheckStartsWith",(e,t)=>{ke.init(e,t);const r=new RegExp(`^${ft(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),qu=T("$ZodCheckEndsWith",(e,t)=>{ke.init(e,t);const r=new RegExp(`.*${ft(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const a=n._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Gu=T("$ZodCheckOverwrite",(e,t)=>{ke.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class Ju{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 r=t.split(`
4
- `).filter(s=>s),n=Math.min(...r.map(s=>s.length-s.trimStart().length)),a=r.map(s=>s.slice(n)).map(s=>" ".repeat(this.indent*2)+s);for(const s of a)this.content.push(s)}compile(){const t=Function,r=this?.args,n=[...(this?.content??[""]).map(a=>` ${a}`)];return new t(...r,n.join(`
5
- `))}}const Yu={major:4,minor:4,patch:3},ue=T("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Yu;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const a of n)for(const s of a._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(i,l,u)=>{let c=it(i),d;for(const m of l){if(m._zod.def.when){if(Xl(i)||!m._zod.def.when(i))continue}else if(c)continue;const p=i.issues.length,f=m._zod.check(i);if(f instanceof Promise&&u?.async===!1)throw new ct;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(c||(c=it(i,p)))});else{if(i.issues.length===p)continue;c||(c=it(i,p))}}return d?d.then(()=>i):i},s=(i,l,u)=>{if(it(i))return i.aborted=!0,i;const c=a(l,n,u);if(c instanceof Promise){if(u.async===!1)throw new ct;return c.then(d=>e._zod.parse(d,u))}return e._zod.parse(c,u)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const c=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return c instanceof Promise?c.then(d=>s(d,i,l)):s(c,i,l)}const u=e._zod.parse(i,l);if(u instanceof Promise){if(l.async===!1)throw new ct;return u.then(c=>a(c,n,l))}return a(u,n,l)}}re(e,"~standard",()=>({validate:a=>{try{const s=Kl(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Ql(e,a).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),on=T("$ZodString",(e,t)=>{ue.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Tu(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),pe=T("$ZodStringFormat",(e,t)=>{cr.init(e,t),on.init(e,t)}),Xu=T("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=hu),pe.init(e,t)}),Wu=T("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=qn(r))}else t.pattern??(t.pattern=qn());pe.init(e,t)}),Hu=T("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vu),pe.init(e,t)}),Ku=T("$ZodURL",(e,t)=>{pe.init(e,t),e._zod.check=r=>{try{const n=r.value.trim();if(!t.normalize&&t.protocol?.source===$u.source&&!/^https?:\/\//i.test(n)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}const a=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.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(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.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=a.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Qu=T("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yu()),pe.init(e,t)}),ec=T("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fu),pe.init(e,t)}),tc=T("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=lu),pe.init(e,t)}),rc=T("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=uu),pe.init(e,t)}),nc=T("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cu),pe.init(e,t)}),ac=T("$ZodXID",(e,t)=>{t.pattern??(t.pattern=du),pe.init(e,t)}),sc=T("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pu),pe.init(e,t)}),oc=T("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Nu(t)),pe.init(e,t)}),ic=T("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=xu),pe.init(e,t)}),lc=T("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Su(t)),pe.init(e,t)}),uc=T("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=mu),pe.init(e,t)}),cc=T("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Eu),pe.init(e,t),e._zod.bag.format="ipv4"}),dc=T("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bu),pe.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})}}}),pc=T("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=wu),pe.init(e,t)}),fc=T("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ku),pe.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[a,s]=n;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${a}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Is(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const mc=T("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=_u),pe.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Is(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function hc(e){if(!ys.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Is(r)}const vc=T("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ys),pe.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{hc(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),gc=T("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Iu),pe.init(e,t)});function yc(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const a=JSON.parse(atob(n));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const Ec=T("$ZodJWT",(e,t)=>{pe.init(e,t),e._zod.check=r=>{yc(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),xs=T("$ZodNumber",(e,t)=>{ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??ws,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const a=r.value;if(typeof a=="number"&&!Number.isNaN(a)&&Number.isFinite(a))return r;const s=typeof a=="number"?Number.isNaN(a)?"NaN":Number.isFinite(a)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:a,inst:e,...s?{received:s}:{}}),r}}),bc=T("$ZodNumberFormat",(e,t)=>{Lu.init(e,t),xs.init(e,t)}),wc=T("$ZodBoolean",(e,t)=>{ue.init(e,t),e._zod.pattern=Ru,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const a=r.value;return typeof a=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:a,inst:e}),r}}),kc=T("$ZodNull",(e,t)=>{ue.init(e,t),e._zod.pattern=Au,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const a=r.value;return a===null||r.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),r}}),_c=T("$ZodUnknown",(e,t)=>{ue.init(e,t),e._zod.parse=r=>r}),$c=T("$ZodNever",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Gn(e,t,r){e.issues.length&&t.issues.push(...lt(r,e.issues)),t.value[r]=e.value}const Ic=T("$ZodArray",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!Array.isArray(a))return r.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),r;r.value=Array(a.length);const s=[];for(let i=0;i<a.length;i++){const l=a[i],u=t.element._zod.run({value:l,issues:[]},n);u instanceof Promise?s.push(u.then(c=>Gn(c,r,i))):Gn(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function Xt(e,t,r,n,a,s){const i=r in n;if(e.issues.length){if(a&&s&&!i)return;t.issues.push(...lt(r,e.issues))}if(!i&&!a){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function Ss(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Vl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ns(e,t,r,n,a,s){const i=[],l=a.keySet,u=a.catchall._zod,c=u.def.type,d=u.optin==="optional",m=u.optout==="optional";for(const p in t){if(p==="__proto__"||l.has(p))continue;if(c==="never"){i.push(p);continue}const f=u.run({value:t[p],issues:[]},n);f instanceof Promise?e.push(f.then(v=>Xt(v,r,p,t,d,m))):Xt(f,r,p,t,d,m)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const xc=T("$ZodObject",(e,t)=>{if(ue.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const i=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...i};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=ir(()=>Ss(t));re(e._zod,"propValues",()=>{const i=t.shape,l={};for(const u in i){const c=i[u]._zod;if(c.values){l[u]??(l[u]=new Set);for(const d of c.values)l[u].add(d)}}return l});const n=It,a=t.catchall;let s;e._zod.parse=(i,l)=>{s??(s=r.value);const u=i.value;if(!n(u))return i.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),i;i.value={};const c=[],d=s.shape;for(const m of s.keys){const p=d[m],f=p._zod.optin==="optional",v=p._zod.optout==="optional",h=p._zod.run({value:u[m],issues:[]},l);h instanceof Promise?c.push(h.then(y=>Xt(y,i,m,u,f,v))):Xt(h,i,m,u,f,v)}return a?Ns(c,u,i,l,r.value,e):c.length?Promise.all(c).then(()=>i):i}}),Sc=T("$ZodObjectJIT",(e,t)=>{xc.init(e,t);const r=e._zod.parse,n=ir(()=>Ss(t)),a=m=>{const p=new Ju(["shape","payload","ctx"]),f=n.value,v=$=>{const g=Un($);return`shape[${g}]._zod.run({ value: input[${g}], issues: [] }, ctx)`};p.write("const input = payload.value;");const h=Object.create(null);let y=0;for(const $ of f.keys)h[$]=`key_${y++}`;p.write("const newResult = {};");for(const $ of f.keys){const g=h[$],O=Un($),S=m[$],_=S?._zod?.optin==="optional",E=S?._zod?.optout==="optional";p.write(`const ${g} = ${v($)};`),_&&E?p.write(`
6
- if (${g}.issues.length) {
7
- if (${O} in input) {
8
- payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
9
- ...iss,
10
- path: iss.path ? [${O}, ...iss.path] : [${O}]
11
- })));
12
- }
13
- }
14
-
15
- if (${g}.value === undefined) {
16
- if (${O} in input) {
17
- newResult[${O}] = undefined;
18
- }
19
- } else {
20
- newResult[${O}] = ${g}.value;
21
- }
22
-
23
- `):_?p.write(`
24
- if (${g}.issues.length) {
25
- payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
26
- ...iss,
27
- path: iss.path ? [${O}, ...iss.path] : [${O}]
28
- })));
29
- }
30
-
31
- if (${g}.value === undefined) {
32
- if (${O} in input) {
33
- newResult[${O}] = undefined;
34
- }
35
- } else {
36
- newResult[${O}] = ${g}.value;
37
- }
38
-
39
- `):p.write(`
40
- const ${g}_present = ${O} in input;
41
- if (${g}.issues.length) {
42
- payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
43
- ...iss,
44
- path: iss.path ? [${O}, ...iss.path] : [${O}]
45
- })));
46
- }
47
- if (!${g}_present && !${g}.issues.length) {
48
- payload.issues.push({
49
- code: "invalid_type",
50
- expected: "nonoptional",
51
- input: undefined,
52
- path: [${O}]
53
- });
54
- }
55
-
56
- if (${g}_present) {
57
- if (${g}.value === undefined) {
58
- newResult[${O}] = undefined;
59
- } else {
60
- newResult[${O}] = ${g}.value;
61
- }
62
- }
63
-
64
- `)}p.write("payload.value = newResult;"),p.write("return payload;");const w=p.compile();return($,g)=>w(m,$,g)};let s;const i=It,l=!en.jitless,u=l&&jl.value,c=t.catchall;let d;e._zod.parse=(m,p)=>{d??(d=n.value);const f=m.value;return i(f)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=a(t.shape)),m=s(m,p),c?Ns([],f,m,p,d,e):m):r(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),m)}});function Jn(e,t,r,n){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const a=e.filter(s=>!it(s));return a.length===1?(t.value=a[0].value,a[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Be(i,n,je())))}),t)}const Ts=T("$ZodUnion",(e,t)=>{ue.init(e,t),re(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),re(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=>rn(a.source)).join("|")})$`)}});const r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,a)=>{if(r)return r(n,a);let s=!1;const i=[];for(const l of t.options){const u=l._zod.run({value:n.value,issues:[]},a);if(u instanceof Promise)i.push(u),s=!0;else{if(u.issues.length===0)return u;i.push(u)}}return s?Promise.all(i).then(l=>Jn(l,n,e,a)):Jn(i,n,e,a)}}),Nc=T("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ts.init(e,t);const r=e._zod.parse;re(e._zod,"propValues",()=>{const a={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,u]of Object.entries(i)){a[l]||(a[l]=new Set);for(const c of u)a[l].add(c)}}return a});const n=ir(()=>{const a=t.options,s=new Map;for(const i of a){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const u of l){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,i)}}return s});e._zod.parse=(a,s)=>{const i=a.value;if(!It(i))return a.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),a;const l=n.value.get(i?.[t.discriminator]);return l?l._zod.run(a,s):t.unionFallback||s.direction==="backward"?r(a,s):(a.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:i,path:[t.discriminator],inst:e}),a)}}),Tc=T("$ZodIntersection",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{const a=r.value,s=t.left._zod.run({value:a,issues:[]},n),i=t.right._zod.run({value:a,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,u])=>Yn(r,l,u)):Yn(r,s,i)}});function Lr(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(pt(e)&&pt(t)){const r=Object.keys(t),n=Object.keys(e).filter(s=>r.indexOf(s)!==-1),a={...e,...t};for(const s of n){const i=Lr(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a[s]=i.data}return{valid:!0,data:a}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const a=e[n],s=t[n],i=Lr(a,s);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Yn(e,t,r){const n=new Map;let a;for(const l of t.issues)if(l.code==="unrecognized_keys"){a??(a=l);for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).l=!0}else e.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const u of l.keys)n.has(u)||n.set(u,{}),n.get(u).r=!0;else e.issues.push(l);const s=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&a&&e.issues.push({...a,keys:s}),it(e))return e;const i=Lr(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Oc=T("$ZodRecord",(e,t)=>{ue.init(e,t),e._zod.parse=(r,n)=>{const a=r.value;if(!pt(a))return r.issues.push({expected:"record",code:"invalid_type",input:a,inst:e}),r;const s=[],i=t.keyType._zod.values;if(i){r.value={};const l=new Set;for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){l.add(typeof c=="number"?c.toString():c);const d=t.keyType._zod.run({value:c,issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(f=>Be(f,n,je())),input:c,path:[c],inst:e});continue}const m=d.value,p=t.valueType._zod.run({value:a[c],issues:[]},n);p instanceof Promise?s.push(p.then(f=>{f.issues.length&&r.issues.push(...lt(c,f.issues)),r.value[m]=f.value})):(p.issues.length&&r.issues.push(...lt(c,p.issues)),r.value[m]=p.value)}let u;for(const c in a)l.has(c)||(u=u??[],u.push(c));u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:a,inst:e,keys:u})}else{r.value={};for(const l of Reflect.ownKeys(a)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},n);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&ws.test(l)&&u.issues.length){const d=t.keyType._zod.run({value:Number(l),issues:[]},n);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(u=d)}if(u.issues.length){t.mode==="loose"?r.value[l]=a[l]:r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(d=>Be(d,n,je())),input:l,path:[l],inst:e});continue}const c=t.valueType._zod.run({value:a[l],issues:[]},n);c instanceof Promise?s.push(c.then(d=>{d.issues.length&&r.issues.push(...lt(l,d.issues)),r.value[u.value]=d.value})):(c.issues.length&&r.issues.push(...lt(l,c.issues)),r.value[u.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Rc=T("$ZodEnum",(e,t)=>{ue.init(e,t);const r=ps(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(a=>Bl.has(typeof a)).map(a=>typeof a=="string"?ft(a):a.toString()).join("|")})$`),e._zod.parse=(a,s)=>{const i=a.value;return n.has(i)||a.issues.push({code:"invalid_value",values:r,input:i,inst:e}),a}}),Ac=T("$ZodLiteral",(e,t)=>{if(ue.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ft(n):n?ft(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,a)=>{const s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}}),Cc=T("$ZodTransform",(e,t)=>{ue.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ds(e.constructor.name);const a=t.transform(r.value,r);if(n.async)return(a instanceof Promise?a:Promise.resolve(a)).then(s=>(r.value=s,r.fallback=!0,r));if(a instanceof Promise)throw new ct;return r.value=a,r.fallback=!0,r}});function Xn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Os=T("$ZodOptional",(e,t)=>{ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${rn(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){const a=r.value,s=t.innerType._zod.run(r,n);return s instanceof Promise?s.then(i=>Xn(i,a)):Xn(s,a)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),zc=T("$ZodExactOptional",(e,t)=>{Os.init(e,t),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Pc=T("$ZodNullable",(e,t)=>{ue.init(e,t),re(e._zod,"optin",()=>t.innerType._zod.optin),re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${rn(r.source)}|null)$`):void 0}),re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Lc=T("$ZodDefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(s=>Wn(s,t)):Wn(a,t)}});function Wn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Mc=T("$ZodPrefault",(e,t)=>{ue.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),jc=T("$ZodNonOptional",(e,t)=>{ue.init(e,t),re(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(s=>Hn(s,e)):Hn(a,e)}});function Hn(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 Bc=T("$ZodCatch",(e,t)=>{ue.init(e,t),e._zod.optin="optional",re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Be(i,n,je()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=a.value,a.issues.length&&(r.value=t.catchValue({...r,error:{issues:a.issues.map(s=>Be(s,n,je()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),Vc=T("$ZodPipe",(e,t)=>{ue.init(e,t),re(e._zod,"values",()=>t.in._zod.values),re(e._zod,"optin",()=>t.in._zod.optin),re(e._zod,"optout",()=>t.out._zod.optout),re(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){const s=t.out._zod.run(r,n);return s instanceof Promise?s.then(i=>Ft(i,t.in,n)):Ft(s,t.in,n)}const a=t.in._zod.run(r,n);return a instanceof Promise?a.then(s=>Ft(s,t.out,n)):Ft(a,t.out,n)}});function Ft(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const Dc=T("$ZodReadonly",(e,t)=>{ue.init(e,t),re(e._zod,"propValues",()=>t.innerType._zod.propValues),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"optin",()=>t.innerType?._zod?.optin),re(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);const a=t.innerType._zod.run(r,n);return a instanceof Promise?a.then(Kn):Kn(a)}});function Kn(e){return e.value=Object.freeze(e.value),e}const Fc=T("$ZodLazy",(e,t)=>{ue.init(e,t),re(e._zod,"innerType",()=>{const r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),re(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),re(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),re(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),re(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Zc=T("$ZodCustom",(e,t)=>{ke.init(e,t),ue.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{const n=r.value,a=t.fn(n);if(a instanceof Promise)return a.then(s=>Qn(s,r,n,e));Qn(a,r,n,e)}});function Qn(e,t,r,n){if(!e){const a={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(a.params=n._zod.def.params),t.issues.push(xt(a))}}var ea;class Uc{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const a={...n,...this._map.get(t)};return Object.keys(a).length?a:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function qc(){return new Uc}(ea=globalThis).__zod_globalRegistry??(ea.__zod_globalRegistry=qc());const kt=globalThis.__zod_globalRegistry;function Gc(e,t){return new e({type:"string",...Z(t)})}function Jc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Z(t)})}function ta(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Z(t)})}function Yc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Z(t)})}function Xc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Z(t)})}function Wc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Z(t)})}function Hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Z(t)})}function Kc(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Z(t)})}function Qc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Z(t)})}function ed(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Z(t)})}function td(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Z(t)})}function rd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Z(t)})}function nd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Z(t)})}function ad(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Z(t)})}function sd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Z(t)})}function od(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Z(t)})}function id(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Z(t)})}function ld(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Z(t)})}function ud(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Z(t)})}function cd(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Z(t)})}function dd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Z(t)})}function pd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Z(t)})}function fd(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Z(t)})}function md(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Z(t)})}function hd(e,t){return new e({type:"string",format:"date",check:"string_format",...Z(t)})}function vd(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Z(t)})}function gd(e,t){return new e({type:"string",format:"duration",check:"string_format",...Z(t)})}function yd(e,t){return new e({type:"number",checks:[],...Z(t)})}function Ed(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Z(t)})}function bd(e,t){return new e({type:"boolean",...Z(t)})}function wd(e,t){return new e({type:"null",...Z(t)})}function kd(e){return new e({type:"unknown"})}function _d(e,t){return new e({type:"never",...Z(t)})}function ra(e,t){return new _s({check:"less_than",...Z(t),value:e,inclusive:!1})}function _r(e,t){return new _s({check:"less_than",...Z(t),value:e,inclusive:!0})}function na(e,t){return new $s({check:"greater_than",...Z(t),value:e,inclusive:!1})}function $r(e,t){return new $s({check:"greater_than",...Z(t),value:e,inclusive:!0})}function aa(e,t){return new Pu({check:"multiple_of",...Z(t),value:e})}function Rs(e,t){return new Mu({check:"max_length",...Z(t),maximum:e})}function Wt(e,t){return new ju({check:"min_length",...Z(t),minimum:e})}function As(e,t){return new Bu({check:"length_equals",...Z(t),length:e})}function $d(e,t){return new Vu({check:"string_format",format:"regex",...Z(t),pattern:e})}function Id(e){return new Du({check:"string_format",format:"lowercase",...Z(e)})}function xd(e){return new Fu({check:"string_format",format:"uppercase",...Z(e)})}function Sd(e,t){return new Zu({check:"string_format",format:"includes",...Z(t),includes:e})}function Nd(e,t){return new Uu({check:"string_format",format:"starts_with",...Z(t),prefix:e})}function Td(e,t){return new qu({check:"string_format",format:"ends_with",...Z(t),suffix:e})}function ht(e){return new Gu({check:"overwrite",tx:e})}function Od(e){return ht(t=>t.normalize(e))}function Rd(){return ht(e=>e.trim())}function Ad(){return ht(e=>e.toLowerCase())}function Cd(){return ht(e=>e.toUpperCase())}function zd(){return ht(e=>Ml(e))}function Pd(e,t,r){return new e({type:"array",element:t,...Z(r)})}function Ld(e,t,r){const n=Z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function Md(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Z(r)})}function jd(e,t){const r=Bd(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(xt(a,n.value,r._zod.def));else{const s=a;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=r),s.continue??(s.continue=!r._zod.def.abort),n.issues.push(xt(s))}},e(n.value,n)),t);return r}function Bd(e,t){const r=new ke({check:"custom",...Z(t)});return r._zod.check=e,r}function Ht(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??kt,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 ie(e,t,r={path:[],schemaPath:[]}){var n;const a=e._zod.def,s=t.seen.get(e);if(s)return s.count++,r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const c={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,c);else{const m=i.schema,p=t.processors[a.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${a.type}`);p(e,t,m,c)}const d=e._zod.parent;d&&(i.ref||(i.ref=d),ie(d,t,c),t.seen.get(d).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(i.schema,u),t.io==="input"&&Ee(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((n=i.schema).default??(n.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Kt(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const u=n.get(l);if(u&&u!==i[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(l,i[0])}}const a=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(i[0])?.id,m=e.external.uri??(f=>f);if(d)return{ref:m(d)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${l}/${p}`}}if(i[1]===r)return{ref:"#"};const u=`#/${l}/`,c=i[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:u+c}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:u,defId:c}=a(i);l.def={...l.schema},c&&(l.defId=c);const d=l.schema;for(const m in d)delete d[m];d.$ref=u};if(e.cycles==="throw")for(const i of e.seen.entries()){const l=i[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
65
-
66
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function Qt(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=l=>{const u=e.seen.get(l);if(u.ref===null)return;const c=u.def??u.schema,d={...c},m=u.ref;if(u.ref=null,m){n(m);const f=e.seen.get(m),v=f.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):Object.assign(c,v),Object.assign(c,d),l._zod.parent===m)for(const h in c)h==="$ref"||h==="allOf"||h in d||delete c[h];if(v.$ref&&f.def)for(const h in c)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(c[h])===JSON.stringify(f.def[h])&&delete c[h]}const p=l._zod.parent;if(p&&p!==m){n(p);const f=e.seen.get(p);if(f?.schema.$ref&&(c.$ref=f.schema.$ref,f.def))for(const v in c)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(c[v])===JSON.stringify(f.def[v])&&delete c[v]}e.override({zodSchema:l,jsonSchema:c,path:u.path??[]})};for(const l of[...e.seen.entries()].reverse())n(l[0]);const a={};if(e.target==="draft-2020-12"?a.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?a.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?a.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const l=e.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");a.$id=e.external.uri(l)}Object.assign(a,r.def??r.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&a.id===s&&delete a.id;const i=e.external?.defs??{};for(const l of e.seen.entries()){const u=l[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,i[u.defId]=u.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?a.$defs=i:a.definitions=i);try{const l=JSON.parse(JSON.stringify(a));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:er(t,"input",e.processors),output:er(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function Ee(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ee(n.element,r);if(n.type==="set")return Ee(n.valueType,r);if(n.type==="lazy")return Ee(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ee(n.innerType,r);if(n.type==="intersection")return Ee(n.left,r)||Ee(n.right,r);if(n.type==="record"||n.type==="map")return Ee(n.keyType,r)||Ee(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Ee(n.in,r)||Ee(n.out,r);if(n.type==="object"){for(const a in n.shape)if(Ee(n.shape[a],r))return!0;return!1}if(n.type==="union"){for(const a of n.options)if(Ee(a,r))return!0;return!1}if(n.type==="tuple"){for(const a of n.items)if(Ee(a,r))return!0;return!!(n.rest&&Ee(n.rest,r))}return!1}const Vd=(e,t={})=>r=>{const n=Ht({...r,processors:t});return ie(e,n),Kt(n,e),Qt(n,e)},er=(e,t,r={})=>n=>{const{libraryOptions:a,target:s}=n??{},i=Ht({...a??{},target:s,io:t,processors:r});return ie(e,i),Kt(i,e),Qt(i,e)},Dd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Cs=(e,t,r,n)=>{const a=r;a.type="string";const{minimum:s,maximum:i,format:l,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof s=="number"&&(a.minLength=s),typeof i=="number"&&(a.maxLength=i),l&&(a.format=Dd[l]??l,a.format===""&&delete a.format,l==="time"&&delete a.format),c&&(a.contentEncoding=c),u&&u.size>0){const d=[...u];d.length===1?a.pattern=d[0].source:d.length>1&&(a.allOf=[...d.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},zs=(e,t,r,n)=>{const a=r,{minimum:s,maximum:i,format:l,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?a.type="integer":a.type="number";const m=typeof d=="number"&&d>=(s??Number.NEGATIVE_INFINITY),p=typeof c=="number"&&c<=(i??Number.POSITIVE_INFINITY),f=t.target==="draft-04"||t.target==="openapi-3.0";m?f?(a.minimum=d,a.exclusiveMinimum=!0):a.exclusiveMinimum=d:typeof s=="number"&&(a.minimum=s),p?f?(a.maximum=c,a.exclusiveMaximum=!0):a.exclusiveMaximum=c:typeof i=="number"&&(a.maximum=i),typeof u=="number"&&(a.multipleOf=u)},Ps=(e,t,r,n)=>{r.type="boolean"},Fd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Zd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Ls=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Ud=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Ms=(e,t,r,n)=>{r.not={}},Gd=(e,t,r,n)=>{},js=(e,t,r,n)=>{},Jd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},Bs=(e,t,r,n)=>{const a=e._zod.def,s=ps(a.entries);s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),r.enum=s},Vs=(e,t,r,n)=>{const a=e._zod.def,s=[];for(const i of a.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");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];r.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[i]:r.const=i}else s.every(i=>typeof i=="number")&&(r.type="number"),s.every(i=>typeof i=="string")&&(r.type="string"),s.every(i=>typeof i=="boolean")&&(r.type="boolean"),s.every(i=>i===null)&&(r.type="null"),r.enum=s},Yd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Xd=(e,t,r,n)=>{const a=r,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");a.type="string",a.pattern=s.source},Wd=(e,t,r,n)=>{const a=r,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:l,mime:u}=e._zod.bag;i!==void 0&&(s.minLength=i),l!==void 0&&(s.maxLength=l),u?u.length===1?(s.contentMediaType=u[0],Object.assign(a,s)):(Object.assign(a,s),a.anyOf=u.map(c=>({contentMediaType:c}))):Object.assign(a,s)},Hd=(e,t,r,n)=>{r.type="boolean"},Ds=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Kd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Fs=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Qd=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},ep=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Zs=(e,t,r,n)=>{const a=r,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(a.minItems=i),typeof l=="number"&&(a.maxItems=l),a.type="array",a.items=ie(s.element,t,{...n,path:[...n.path,"items"]})},Us=(e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object",a.properties={};const i=s.shape;for(const c in i)a.properties[c]=ie(i[c],t,{...n,path:[...n.path,"properties",c]});const l=new Set(Object.keys(i)),u=new Set([...l].filter(c=>{const d=s.shape[c]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));u.size>0&&(a.required=Array.from(u)),s.catchall?._zod.def.type==="never"?a.additionalProperties=!1:s.catchall?s.catchall&&(a.additionalProperties=ie(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(a.additionalProperties=!1)},qs=(e,t,r,n)=>{const a=e._zod.def,s=a.inclusive===!1,i=a.options.map((l,u)=>ie(l,t,{...n,path:[...n.path,s?"oneOf":"anyOf",u]}));s?r.oneOf=i:r.anyOf=i},Gs=(e,t,r,n)=>{const a=e._zod.def,s=ie(a.left,t,{...n,path:[...n.path,"allOf",0]}),i=ie(a.right,t,{...n,path:[...n.path,"allOf",1]}),l=c=>"allOf"in c&&Object.keys(c).length===1,u=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];r.allOf=u},tp=(e,t,r,n)=>{const a=r,s=e._zod.def;a.type="array";const i=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((p,f)=>ie(p,t,{...n,path:[...n.path,i,f]})),c=s.rest?ie(s.rest,t,{...n,path:[...n.path,l,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(a.prefixItems=u,c&&(a.items=c)):t.target==="openapi-3.0"?(a.items={anyOf:u},c&&a.items.anyOf.push(c),a.minItems=u.length,c||(a.maxItems=u.length)):(a.items=u,c&&(a.additionalItems=c));const{minimum:d,maximum:m}=e._zod.bag;typeof d=="number"&&(a.minItems=d),typeof m=="number"&&(a.maxItems=m)},Js=(e,t,r,n)=>{const a=r,s=e._zod.def;a.type="object";const i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){const c=ie(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});a.patternProperties={};for(const d of l)a.patternProperties[d.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(a.propertyNames=ie(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),a.additionalProperties=ie(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const u=i._zod.values;if(u){const c=[...u].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(a.required=c)}},Ys=(e,t,r,n)=>{const a=e._zod.def,s=ie(a.innerType,t,n),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=a.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Xs=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType},Ws=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,r.default=JSON.parse(JSON.stringify(a.defaultValue))},Hs=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(a.defaultValue)))},Ks=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType;let i;try{i=a.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Qs=(e,t,r,n)=>{const a=e._zod.def,s=a.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?a.out:a.in:a.out;ie(i,t,n);const l=t.seen.get(e);l.ref=i},eo=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType,r.readOnly=!0},rp=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType},ln=(e,t,r,n)=>{const a=e._zod.def;ie(a.innerType,t,n);const s=t.seen.get(e);s.ref=a.innerType},to=(e,t,r,n)=>{const a=e._zod.innerType;ie(a,t,n);const s=t.seen.get(e);s.ref=a},sa={string:Cs,number:zs,boolean:Ps,bigint:Fd,symbol:Zd,null:Ls,undefined:Ud,void:qd,never:Ms,any:Gd,unknown:js,date:Jd,enum:Bs,literal:Vs,nan:Yd,template_literal:Xd,file:Wd,success:Hd,custom:Ds,function:Kd,transform:Fs,map:Qd,set:ep,array:Zs,object:Us,union:qs,intersection:Gs,tuple:tp,record:Js,nullable:Ys,nonoptional:Xs,default:Ws,prefault:Hs,catch:Ks,pipe:Qs,readonly:eo,promise:rp,optional:ln,lazy:to};function np(e,t){if("_idmap"in e){const n=e,a=Ht({...t,processors:sa}),s={};for(const u of n._idmap.entries()){const[c,d]=u;ie(d,a)}const i={},l={registry:n,uri:t?.uri,defs:s};a.external=l;for(const u of n._idmap.entries()){const[c,d]=u;Kt(a,d),i[c]=Qt(a,d)}if(Object.keys(s).length>0){const u=a.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[u]:s}}return{schemas:i}}const r=Ht({...t,processors:sa});return ie(e,r),Kt(r,e),Qt(r,e)}const ap=T("ZodISODateTime",(e,t)=>{oc.init(e,t),fe.init(e,t)});function sp(e){return md(ap,e)}const op=T("ZodISODate",(e,t)=>{ic.init(e,t),fe.init(e,t)});function ip(e){return hd(op,e)}const lp=T("ZodISOTime",(e,t)=>{lc.init(e,t),fe.init(e,t)});function up(e){return vd(lp,e)}const cp=T("ZodISODuration",(e,t)=>{uc.init(e,t),fe.init(e,t)});function dp(e){return gd(cp,e)}const pp=(e,t)=>{vs.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Hl(e,r)},flatten:{value:r=>Wl(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Pr,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Pr,2)}},isEmpty:{get(){return e.issues.length===0}}})},Se=T("ZodError",pp,{Parent:Error}),fp=an(Se),mp=sn(Se),hp=lr(Se),ro=ur(Se),vp=eu(Se),gp=tu(Se),yp=ru(Se),Ep=nu(Se),bp=au(Se),wp=su(Se),kp=ou(Se),_p=iu(Se),oa=new WeakMap;function At(e,t,r){const n=Object.getPrototypeOf(e);let a=oa.get(n);if(a||(a=new Set,oa.set(n,a)),!a.has(t)){a.add(t);for(const s in r){const i=r[s];Object.defineProperty(n,s,{configurable:!0,enumerable:!1,get(){const l=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const ce=T("ZodType",(e,t)=>(ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:er(e,"input"),output:er(e,"output")}}),e.toJSONSchema=Vd(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,n)=>fp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>hp(e,r,n),e.parseAsync=async(r,n)=>mp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>ro(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>vp(e,r,n),e.decode=(r,n)=>gp(e,r,n),e.encodeAsync=async(r,n)=>yp(e,r,n),e.decodeAsync=async(r,n)=>Ep(e,r,n),e.safeEncode=(r,n)=>bp(e,r,n),e.safeDecode=(r,n)=>wp(e,r,n),e.safeEncodeAsync=async(r,n)=>kp(e,r,n),e.safeDecodeAsync=async(r,n)=>_p(e,r,n),At(e,"ZodType",{check(...r){const n=this.def;return this.clone(Ze(n,{checks:[...n.checks??[],...r.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return Ue(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Ef(r,n))},superRefine(r,n){return this.check(bf(r,n))},overwrite(r){return this.check(ht(r))},optional(){return ca(this)},exactOptional(){return af(this)},nullable(){return da(this)},nullish(){return ca(da(this))},nonoptional(r){return df(this,r)},array(){return vt(this)},or(r){return we([this,r])},and(r){return Qp(this,r)},transform(r){return pa(this,rf(r))},default(r){return lf(this,r)},prefault(r){return cf(this,r)},catch(r){return ff(this,r)},pipe(r){return pa(this,r)},readonly(){return vf(this)},describe(r){const n=this.clone();return kt.add(n,{description:r}),n},meta(...r){if(r.length===0)return kt.get(this);const n=this.clone();return kt.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return kt.get(e)?.description},configurable:!0}),e)),no=T("_ZodString",(e,t)=>{on.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,a,s)=>Cs(e,n,a);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,At(e,"_ZodString",{regex(...n){return this.check($d(...n))},includes(...n){return this.check(Sd(...n))},startsWith(...n){return this.check(Nd(...n))},endsWith(...n){return this.check(Td(...n))},min(...n){return this.check(Wt(...n))},max(...n){return this.check(Rs(...n))},length(...n){return this.check(As(...n))},nonempty(...n){return this.check(Wt(1,...n))},lowercase(n){return this.check(Id(n))},uppercase(n){return this.check(xd(n))},trim(){return this.check(Rd())},normalize(...n){return this.check(Od(...n))},toLowerCase(){return this.check(Ad())},toUpperCase(){return this.check(Cd())},slugify(){return this.check(zd())}})}),$p=T("ZodString",(e,t)=>{on.init(e,t),no.init(e,t),e.email=r=>e.check(Jc(Ip,r)),e.url=r=>e.check(Kc(xp,r)),e.jwt=r=>e.check(fd(Dp,r)),e.emoji=r=>e.check(Qc(Sp,r)),e.guid=r=>e.check(ta(ia,r)),e.uuid=r=>e.check(Yc(Zt,r)),e.uuidv4=r=>e.check(Xc(Zt,r)),e.uuidv6=r=>e.check(Wc(Zt,r)),e.uuidv7=r=>e.check(Hc(Zt,r)),e.nanoid=r=>e.check(ed(Np,r)),e.guid=r=>e.check(ta(ia,r)),e.cuid=r=>e.check(td(Tp,r)),e.cuid2=r=>e.check(rd(Op,r)),e.ulid=r=>e.check(nd(Rp,r)),e.base64=r=>e.check(cd(jp,r)),e.base64url=r=>e.check(dd(Bp,r)),e.xid=r=>e.check(ad(Ap,r)),e.ksuid=r=>e.check(sd(Cp,r)),e.ipv4=r=>e.check(od(zp,r)),e.ipv6=r=>e.check(id(Pp,r)),e.cidrv4=r=>e.check(ld(Lp,r)),e.cidrv6=r=>e.check(ud(Mp,r)),e.e164=r=>e.check(pd(Vp,r)),e.datetime=r=>e.check(sp(r)),e.date=r=>e.check(ip(r)),e.time=r=>e.check(up(r)),e.duration=r=>e.check(dp(r))});function M(e){return Gc($p,e)}const fe=T("ZodStringFormat",(e,t)=>{pe.init(e,t),no.init(e,t)}),Ip=T("ZodEmail",(e,t)=>{Hu.init(e,t),fe.init(e,t)}),ia=T("ZodGUID",(e,t)=>{Xu.init(e,t),fe.init(e,t)}),Zt=T("ZodUUID",(e,t)=>{Wu.init(e,t),fe.init(e,t)}),xp=T("ZodURL",(e,t)=>{Ku.init(e,t),fe.init(e,t)}),Sp=T("ZodEmoji",(e,t)=>{Qu.init(e,t),fe.init(e,t)}),Np=T("ZodNanoID",(e,t)=>{ec.init(e,t),fe.init(e,t)}),Tp=T("ZodCUID",(e,t)=>{tc.init(e,t),fe.init(e,t)}),Op=T("ZodCUID2",(e,t)=>{rc.init(e,t),fe.init(e,t)}),Rp=T("ZodULID",(e,t)=>{nc.init(e,t),fe.init(e,t)}),Ap=T("ZodXID",(e,t)=>{ac.init(e,t),fe.init(e,t)}),Cp=T("ZodKSUID",(e,t)=>{sc.init(e,t),fe.init(e,t)}),zp=T("ZodIPv4",(e,t)=>{cc.init(e,t),fe.init(e,t)}),Pp=T("ZodIPv6",(e,t)=>{dc.init(e,t),fe.init(e,t)}),Lp=T("ZodCIDRv4",(e,t)=>{pc.init(e,t),fe.init(e,t)}),Mp=T("ZodCIDRv6",(e,t)=>{fc.init(e,t),fe.init(e,t)}),jp=T("ZodBase64",(e,t)=>{mc.init(e,t),fe.init(e,t)}),Bp=T("ZodBase64URL",(e,t)=>{vc.init(e,t),fe.init(e,t)}),Vp=T("ZodE164",(e,t)=>{gc.init(e,t),fe.init(e,t)}),Dp=T("ZodJWT",(e,t)=>{Ec.init(e,t),fe.init(e,t)}),ao=T("ZodNumber",(e,t)=>{xs.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,a,s)=>zs(e,n,a),At(e,"ZodNumber",{gt(n,a){return this.check(na(n,a))},gte(n,a){return this.check($r(n,a))},min(n,a){return this.check($r(n,a))},lt(n,a){return this.check(ra(n,a))},lte(n,a){return this.check(_r(n,a))},max(n,a){return this.check(_r(n,a))},int(n){return this.check(la(n))},safe(n){return this.check(la(n))},positive(n){return this.check(na(0,n))},nonnegative(n){return this.check($r(0,n))},negative(n){return this.check(ra(0,n))},nonpositive(n){return this.check(_r(0,n))},multipleOf(n,a){return this.check(aa(n,a))},step(n,a){return this.check(aa(n,a))},finite(){return this}});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 Fp(e){return yd(ao,e)}const Zp=T("ZodNumberFormat",(e,t)=>{bc.init(e,t),ao.init(e,t)});function la(e){return Ed(Zp,e)}const Up=T("ZodBoolean",(e,t)=>{wc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ps(e,r,n)});function be(e){return bd(Up,e)}const qp=T("ZodNull",(e,t)=>{kc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ls(e,r,n)});function Gp(e){return wd(qp,e)}const Jp=T("ZodUnknown",(e,t)=>{_c.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>js()});function Pe(){return kd(Jp)}const Yp=T("ZodNever",(e,t)=>{$c.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ms(e,r,n)});function so(e){return _d(Yp,e)}const Xp=T("ZodArray",(e,t)=>{Ic.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Zs(e,r,n,a),e.element=t.element,At(e,"ZodArray",{min(r,n){return this.check(Wt(r,n))},nonempty(r){return this.check(Wt(1,r))},max(r,n){return this.check(Rs(r,n))},length(r,n){return this.check(As(r,n))},unwrap(){return this.element}})});function vt(e,t){return Pd(Xp,e,t)}const oo=T("ZodObject",(e,t)=>{Sc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Us(e,r,n,a),re(e,"shape",()=>t.shape),At(e,"ZodObject",{keyof(){return lo(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Pe()})},loose(){return this.clone({...this._zod.def,catchall:Pe()})},strict(){return this.clone({...this._zod.def,catchall:so()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Ul(this,r)},safeExtend(r){return ql(this,r)},merge(r){return Gl(this,r)},pick(r){return Fl(this,r)},omit(r){return Zl(this,r)},partial(...r){return Jl(uo,this,r[0])},required(...r){return Yl(co,this,r[0])}})});function oe(e,t){const r={type:"object",shape:e??{},...Z(t)};return new oo(r)}function le(e,t){return new oo({type:"object",shape:e,catchall:so(),...Z(t)})}const io=T("ZodUnion",(e,t)=>{Ts.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>qs(e,r,n,a),e.options=t.options});function we(e,t){return new io({type:"union",options:e,...Z(t)})}const Wp=T("ZodDiscriminatedUnion",(e,t)=>{io.init(e,t),Nc.init(e,t)});function Hp(e,t,r){return new Wp({type:"union",options:t,discriminator:e,...Z(r)})}const Kp=T("ZodIntersection",(e,t)=>{Tc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Gs(e,r,n,a)});function Qp(e,t){return new Kp({type:"intersection",left:e,right:t})}const ua=T("ZodRecord",(e,t)=>{Oc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Js(e,r,n,a),e.keyType=t.keyType,e.valueType=t.valueType});function We(e,t,r){return!t||!t._zod?new ua({type:"record",keyType:M(),valueType:e,...Z(t)}):new ua({type:"record",keyType:e,valueType:t,...Z(r)})}const Mr=T("ZodEnum",(e,t)=>{Rc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(n,a,s)=>Bs(e,n,a),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(n,a)=>{const s={};for(const i of n)if(r.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Mr({...t,checks:[],...Z(a),entries:s})},e.exclude=(n,a)=>{const s={...t.entries};for(const i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Mr({...t,checks:[],...Z(a),entries:s})}});function lo(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Mr({type:"enum",entries:r,...Z(t)})}const ef=T("ZodLiteral",(e,t)=>{Ac.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Vs(e,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Y(e,t){return new ef({type:"literal",values:Array.isArray(e)?e:[e],...Z(t)})}const tf=T("ZodTransform",(e,t)=>{Cc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Fs(e,r),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ds(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(xt(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(xt(i))}};const a=t.transform(r.value,r);return a instanceof Promise?a.then(s=>(r.value=s,r.fallback=!0,r)):(r.value=a,r.fallback=!0,r)}});function rf(e){return new tf({type:"transform",transform:e})}const uo=T("ZodOptional",(e,t)=>{Os.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>ln(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function ca(e){return new uo({type:"optional",innerType:e})}const nf=T("ZodExactOptional",(e,t)=>{zc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>ln(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function af(e){return new nf({type:"optional",innerType:e})}const sf=T("ZodNullable",(e,t)=>{Pc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ys(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function da(e){return new sf({type:"nullable",innerType:e})}const of=T("ZodDefault",(e,t)=>{Lc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ws(e,r,n,a),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lf(e,t){return new of({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ms(t)}})}const uf=T("ZodPrefault",(e,t)=>{Mc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Hs(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function cf(e,t){return new uf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ms(t)}})}const co=T("ZodNonOptional",(e,t)=>{jc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Xs(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function df(e,t){return new co({type:"nonoptional",innerType:e,...Z(t)})}const pf=T("ZodCatch",(e,t)=>{Bc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ks(e,r,n,a),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ff(e,t){return new pf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mf=T("ZodPipe",(e,t)=>{Vc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Qs(e,r,n,a),e.in=t.in,e.out=t.out});function pa(e,t){return new mf({type:"pipe",in:e,out:t})}const hf=T("ZodReadonly",(e,t)=>{Dc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>eo(e,r,n,a),e.unwrap=()=>e._zod.def.innerType});function vf(e){return new hf({type:"readonly",innerType:e})}const gf=T("ZodLazy",(e,t)=>{Fc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>to(e,r,n,a),e.unwrap=()=>e._zod.def.getter()});function yf(e){return new gf({type:"lazy",getter:e})}const un=T("ZodCustom",(e,t)=>{Zc.init(e,t),ce.init(e,t),e._zod.processJSONSchema=(r,n,a)=>Ds(e,r)});function po(e,t){return Ld(un,e??(()=>!0),t)}function Ef(e,t={}){return Md(un,e,t)}function bf(e,t){return jd(e,t)}function tr(e,t={}){const r=new un({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...Z(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var K;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(K||(K={}));class Ir 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}}const fa=10,wf=13,Ge=32;function xr(e){}function kf(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?");const{onEvent:t=xr,onError:r=xr,onRetry:n=xr,onComment:a,maxBufferSize:s}=e,i=[];let l=0,u=!0,c,d="",m=0,p,f=!1;function v(S){if(f)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(u&&(u=!1,S.charCodeAt(0)===239&&S.charCodeAt(1)===187&&S.charCodeAt(2)===191&&(S=S.slice(3))),i.length===0){const k=y(S);k!==""&&(i.push(k),l=k.length),h();return}if(S.indexOf(`
67
- `)===-1&&S.indexOf("\r")===-1){i.push(S),l+=S.length,h();return}i.push(S);const _=i.join("");i.length=0,l=0;const E=y(_);E!==""&&(i.push(E),l=E.length),h()}function h(){s!==void 0&&(l+d.length<=s||(f=!0,i.length=0,l=0,c=void 0,d="",m=0,p=void 0,r(new Ir(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function y(S){let _=0;if(S.indexOf("\r")===-1){let E=S.indexOf(`
68
- `,_);for(;E!==-1;){if(_===E){m>0&&t({id:c,event:p,data:d}),c=void 0,d="",m=0,p=void 0,_=E+1,E=S.indexOf(`
69
- `,_);continue}const k=S.charCodeAt(_);if(ma(S,_,k)){const N=S.charCodeAt(_+5)===Ge?_+6:_+5,I=S.slice(N,E);if(m===0&&S.charCodeAt(E+1)===fa){t({id:c,event:p,data:I}),c=void 0,d="",p=void 0,_=E+2,E=S.indexOf(`
70
- `,_);continue}d=m===0?I:`${d}
71
- ${I}`,m++}else ha(S,_,k)?p=S.slice(S.charCodeAt(_+6)===Ge?_+7:_+6,E)||void 0:w(S,_,E);_=E+1,E=S.indexOf(`
72
- `,_)}return S.slice(_)}for(;_<S.length;){const E=S.indexOf("\r",_),k=S.indexOf(`
73
- `,_);let N=-1;if(E!==-1&&k!==-1?N=E<k?E:k:E!==-1?E===S.length-1?N=-1:N=E:k!==-1&&(N=k),N===-1)break;w(S,_,N),_=N+1,S.charCodeAt(_-1)===wf&&S.charCodeAt(_)===fa&&_++}return S.slice(_)}function w(S,_,E){if(_===E){g();return}const k=S.charCodeAt(_);if(ma(S,_,k)){const j=S.charCodeAt(_+5)===Ge?_+6:_+5,U=S.slice(j,E);d=m===0?U:`${d}
74
- ${U}`,m++;return}if(ha(S,_,k)){p=S.slice(S.charCodeAt(_+6)===Ge?_+7:_+6,E)||void 0;return}if(k===105&&S.charCodeAt(_+1)===100&&S.charCodeAt(_+2)===58){const j=S.slice(S.charCodeAt(_+3)===Ge?_+4:_+3,E);c=j.includes("\0")?void 0:j;return}if(k===58){if(a){const j=S.slice(_,E);a(j.slice(S.charCodeAt(_+1)===Ge?2:1))}return}const N=S.slice(_,E),I=N.indexOf(":");if(I===-1){$(N,"",N);return}const ne=N.slice(0,I),V=N.charCodeAt(I+1)===Ge?2:1,X=N.slice(I+V);$(ne,X,N)}function $(S,_,E){switch(S){case"event":p=_||void 0;break;case"data":d=m===0?_:`${d}
75
- ${_}`,m++;break;case"id":c=_.includes("\0")?void 0:_;break;case"retry":/^\d+$/.test(_)?n(parseInt(_,10)):r(new Ir(`Invalid \`retry\` value: "${_}"`,{type:"invalid-retry",value:_,line:E}));break;default:r(new Ir(`Unknown field "${S.length>20?`${S.slice(0,20)}…`:S}"`,{type:"unknown-field",field:S,value:_,line:E}));break}}function g(){m>0&&t({id:c,event:p,data:d}),c=void 0,d="",m=0,p=void 0}function O(S={}){if(S.consume&&i.length>0){const _=i.join("");w(_,0,_.length)}u=!0,c=void 0,d="",m=0,p=void 0,i.length=0,l=0,f=!1}return{feed:v,reset:O}}function ma(e,t,r){return r===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function ha(e,t,r){return r===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class _f extends TransformStream{constructor({onError:t,onRetry:r,onComment:n,maxBufferSize:a}={}){let s;super({start(i){s=kf({onEvent:l=>{i.enqueue(l)},onError(l){typeof t=="function"&&t(l),(t==="terminate"||l.type==="max-buffer-size-exceeded")&&i.error(l)},onRetry:r,onComment:n,maxBufferSize:a})},transform(i){s.feed(i)}})}}var Ct=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:n="-"}={})=>{const a=()=>{const s=r.length,i=new Array(t);for(let l=0;l<t;l++)i[l]=r[Math.random()*s|0];return i.join("")};if(e==null)return a;if(r.includes(n))throw new Cl({argument:"separator",message:`The separator "${n}" must not be part of the alphabet "${r}".`});return()=>`${e}${n}${a()}`},$f=Ct();function st(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((r,n)=>{t[n.toLowerCase()]=r});else{Array.isArray(e)||(e=Object.entries(e));for(const[r,n]of e)n!=null&&(t[r.toLowerCase()]=n)}return t}var If=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,xf=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function va(e){const t=JSON.parse(e);return t===null||typeof t!="object"||If.test(e)===!1&&xf.test(e)===!1?t:Sf(t)}function Sf(e){let t=[e];for(;t.length;){const r=t;t=[];for(const n of r){if(Object.prototype.hasOwnProperty.call(n,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(n,"constructor")&&n.constructor!==null&&typeof n.constructor=="object"&&Object.prototype.hasOwnProperty.call(n.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const a in n){const s=n[a];s&&typeof s=="object"&&t.push(s)}}}return e}function Nf(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return va(e)}try{return va(e)}finally{Error.stackTraceLimit=t}}function cn(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:r}=e;if(r!=null)for(const n of Object.keys(r))r[n]=Je(r[n])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Je):Je(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Je)),e.allOf!=null&&(e.allOf=e.allOf.map(Je)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Je));const{definitions:t}=e;if(t!=null)for(const r of Object.keys(t))t[r]=Je(t[r]);return e}function Je(e){return typeof e=="boolean"?e:cn(e)}var Tf=Symbol("Let zodToJsonSchema decide on which parser to use"),ga={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"},Of=e=>typeof e=="string"?{...ga,name:e}:{...ga,...e};function xe(){return{}}function Rf(e,t){var r,n,a;const s={type:"array"};return(r=e.type)!=null&&r._def&&((a=(n=e.type)==null?void 0:n._def)==null?void 0:a.typeName)!==K.ZodAny&&(s.items=se(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}function Af(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 Cf(){return{type:"boolean"}}function fo(e,t){return se(e.type._def,t)}var zf=(e,t)=>se(e.innerType._def,t);function mo(e,t,r){const n=r??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,s)=>mo(e,t,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Pf(e)}}var Pf=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 Lf(e,t){return{...se(e.innerType._def,t),default:e.defaultValue()}}function Mf(e,t){return t.effectStrategy==="input"?se(e.schema._def,t):xe()}function jf(e){return{type:"string",enum:Array.from(e.values)}}var Bf=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function Vf(e,t){const r=[se(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),se(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(a=>!!a),n=[];return r.forEach(a=>{if(Bf(a))n.push(...a.allOf);else{let s=a;if("additionalProperties"in a&&a.additionalProperties===!1){const{additionalProperties:i,...l}=a;s=l}n.push(s)}}),n.length?{allOf:n}:void 0}function Df(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 Sr=void 0,Te={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:()=>(Sr===void 0&&(Sr=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Sr),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 ho(e,t){const r={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":Oe(r,"email",n.message,t);break;case"format:idn-email":Oe(r,"idn-email",n.message,t);break;case"pattern:zod":ye(r,Te.email,n.message,t);break}break;case"url":Oe(r,"uri",n.message,t);break;case"uuid":Oe(r,"uuid",n.message,t);break;case"regex":ye(r,n.regex,n.message,t);break;case"cuid":ye(r,Te.cuid,n.message,t);break;case"cuid2":ye(r,Te.cuid2,n.message,t);break;case"startsWith":ye(r,RegExp(`^${Nr(n.value,t)}`),n.message,t);break;case"endsWith":ye(r,RegExp(`${Nr(n.value,t)}$`),n.message,t);break;case"datetime":Oe(r,"date-time",n.message,t);break;case"date":Oe(r,"date",n.message,t);break;case"time":Oe(r,"time",n.message,t);break;case"duration":Oe(r,"duration",n.message,t);break;case"length":r.minLength=typeof r.minLength=="number"?Math.max(r.minLength,n.value):n.value,r.maxLength=typeof r.maxLength=="number"?Math.min(r.maxLength,n.value):n.value;break;case"includes":{ye(r,RegExp(Nr(n.value,t)),n.message,t);break}case"ip":{n.version!=="v6"&&Oe(r,"ipv4",n.message,t),n.version!=="v4"&&Oe(r,"ipv6",n.message,t);break}case"base64url":ye(r,Te.base64url,n.message,t);break;case"jwt":ye(r,Te.jwt,n.message,t);break;case"cidr":{n.version!=="v6"&&ye(r,Te.ipv4Cidr,n.message,t),n.version!=="v4"&&ye(r,Te.ipv6Cidr,n.message,t);break}case"emoji":ye(r,Te.emoji(),n.message,t);break;case"ulid":{ye(r,Te.ulid,n.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Oe(r,"binary",n.message,t);break}case"contentEncoding:base64":{r.contentEncoding="base64";break}case"pattern:zod":{ye(r,Te.base64,n.message,t);break}}break}case"nanoid":ye(r,Te.nanoid,n.message,t)}return r}function Nr(e,t){return t.patternStrategy==="escape"?Zf(e):e}var Ff=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Zf(e){let t="";for(let r=0;r<e.length;r++)Ff.has(e[r])||(t+="\\"),t+=e[r];return t}function Oe(e,t,r,n){var a;e.format||(a=e.anyOf)!=null&&a.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function ye(e,t,r,n){var a;e.pattern||(a=e.allOf)!=null&&a.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:ya(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=ya(t,n)}function ya(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=n.i?e.source.toLowerCase():e.source;let s="",i=!1,l=!1,u=!1;for(let c=0;c<a.length;c++){if(i){s+=a[c],i=!1;continue}if(n.i){if(l){if(a[c].match(/[a-z]/)){u?(s+=a[c],s+=`${a[c-2]}-${a[c]}`.toUpperCase(),u=!1):a[c+1]==="-"&&(r=a[c+2])!=null&&r.match(/[a-z]/)?(s+=a[c],u=!0):s+=`${a[c]}${a[c].toUpperCase()}`;continue}}else if(a[c].match(/[a-z]/)){s+=`[${a[c]}${a[c].toUpperCase()}]`;continue}}if(n.m){if(a[c]==="^"){s+=`(^|(?<=[\r
76
- ]))`;continue}else if(a[c]==="$"){s+=`($|(?=[\r
77
- ]))`;continue}}if(n.s&&a[c]==="."){s+=l?`${a[c]}\r
78
- `:`[${a[c]}\r
79
- ]`;continue}s+=a[c],a[c]==="\\"?i=!0:l&&a[c]==="]"?l=!1:!l&&a[c]==="["&&(l=!0)}try{new RegExp(s)}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 s}function vo(e,t){var r,n,a,s,i,l;const u={type:"object",additionalProperties:(r=se(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?r:t.allowedAdditionalProperties};if(((n=e.keyType)==null?void 0:n._def.typeName)===K.ZodString&&(a=e.keyType._def.checks)!=null&&a.length){const{type:c,...d}=ho(e.keyType._def,t);return{...u,propertyNames:d}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===K.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===K.ZodBranded&&e.keyType._def.type._def.typeName===K.ZodString&&(l=e.keyType._def.type._def.checks)!=null&&l.length){const{type:c,...d}=fo(e.keyType._def,t);return{...u,propertyNames:d}}}return u}function Uf(e,t){if(t.mapStrategy==="record")return vo(e,t);const r=se(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||xe(),n=se(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||xe();return{type:"array",maxItems:125,items:{type:"array",items:[r,n],minItems:2,maxItems:2}}}function qf(e){const t=e.values,r=Object.keys(e.values).filter(a=>typeof t[t[a]]!="number").map(a=>t[a]),n=Array.from(new Set(r.map(a=>typeof a)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:r}}function Gf(){return{not:xe()}}function Jf(){return{type:"null"}}var jr={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Yf(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(n=>n._def.typeName in jr&&(!n._def.checks||!n._def.checks.length))){const n=r.reduce((a,s)=>{const i=jr[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:n.length>1?n:n[0]}}else if(r.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){const n=r.reduce((a,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];default:return a}},[]);if(n.length===r.length){const a=n.filter((s,i,l)=>l.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:r.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(r.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((n,a)=>[...n,...a._def.values.filter(s=>!n.includes(s))],[])};return Xf(e,t)}var Xf=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((n,a)=>se(n._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(n=>!!n&&(!t.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return r.length?{anyOf:r}:void 0};function Wf(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[jr[e.innerType._def.typeName],"null"]};const r=se(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function Hf(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 Kf(e,t){const r={type:"object",properties:{}},n=[],a=e.shape();for(const i in a){let l=a[i];if(l===void 0||l._def===void 0)continue;const u=em(l),c=se(l._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});c!==void 0&&(r.properties[i]=c,u||n.push(i))}n.length&&(r.required=n);const s=Qf(e,t);return s!==void 0&&(r.additionalProperties=s),r}function Qf(e,t){if(e.catchall._def.typeName!=="ZodNever")return se(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function em(e){try{return e.isOptional()}catch{return!0}}var tm=(e,t)=>{var r;if(t.currentPath.toString()===((r=t.propertyPath)==null?void 0:r.toString()))return se(e.innerType._def,t);const n=se(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:xe()},n]}:xe()},rm=(e,t)=>{if(t.pipeStrategy==="input")return se(e.in._def,t);if(t.pipeStrategy==="output")return se(e.out._def,t);const r=se(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),n=se(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,n].filter(a=>a!==void 0)}};function nm(e,t){return se(e.type._def,t)}function am(e,t){const r={type:"array",uniqueItems:!0,items:se(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function sm(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((r,n)=>se(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[]),additionalItems:se(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,n)=>se(r._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((r,n)=>n===void 0?r:[...r,n],[])}}function om(){return{not:xe()}}function im(){return xe()}var lm=(e,t)=>se(e.innerType._def,t),um=(e,t,r)=>{switch(t){case K.ZodString:return ho(e,r);case K.ZodNumber:return Hf(e);case K.ZodObject:return Kf(e,r);case K.ZodBigInt:return Af(e);case K.ZodBoolean:return Cf();case K.ZodDate:return mo(e,r);case K.ZodUndefined:return om();case K.ZodNull:return Jf();case K.ZodArray:return Rf(e,r);case K.ZodUnion:case K.ZodDiscriminatedUnion:return Yf(e,r);case K.ZodIntersection:return Vf(e,r);case K.ZodTuple:return sm(e,r);case K.ZodRecord:return vo(e,r);case K.ZodLiteral:return Df(e);case K.ZodEnum:return jf(e);case K.ZodNativeEnum:return qf(e);case K.ZodNullable:return Wf(e,r);case K.ZodOptional:return tm(e,r);case K.ZodMap:return Uf(e,r);case K.ZodSet:return am(e,r);case K.ZodLazy:return()=>e.getter()._def;case K.ZodPromise:return nm(e,r);case K.ZodNaN:case K.ZodNever:return Gf();case K.ZodEffects:return Mf(e,r);case K.ZodAny:return xe();case K.ZodUnknown:return im();case K.ZodDefault:return Lf(e,r);case K.ZodBranded:return fo(e,r);case K.ZodReadonly:return lm(e,r);case K.ZodCatch:return zf(e,r);case K.ZodPipeline:return rm(e,r);case K.ZodFunction:case K.ZodVoid:case K.ZodSymbol:return;default:return(n=>{})()}},cm=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function se(e,t,r=!1){var n;const a=t.seen.get(e);if(t.override){const u=(n=t.override)==null?void 0:n.call(t,e,t,a,r);if(u!==Tf)return u}if(a&&!r){const u=dm(a,t);if(u!==void 0)return u}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=um(e,e.typeName,t),l=typeof i=="function"?se(i(),t):i;if(l&&pm(e,t,l),t.postProcess){const u=t.postProcess(l,e,t);return s.jsonSchema=l,u}return s.jsonSchema=l,l}var dm=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:cm(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((r,n)=>t.currentPath[n]===r)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),xe()):t.$refStrategy==="seen"?xe():void 0}},pm=(e,t,r)=>(e.description&&(r.description=e.description),r),fm=e=>{const t=Of(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,n],jsonSchema:void 0}]))}},mm=(e,t)=>{var r;const n=fm(t);let a=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[d,m])=>{var p;return{...c,[d]:(p=se(m._def,{...n,currentPath:[...n.basePath,n.definitionPath,d]},!0))!=null?p:xe()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(r=se(e._def,s===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))!=null?r:xe(),l=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;l!==void 0&&(i.title=l);const u=s===void 0?a?{...i,[n.definitionPath]:a}:i:{$ref:[...n.$refStrategy==="relative"?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...a,[s]:i}};return u.$schema="http://json-schema.org/draft-07/schema#",u},Br=Symbol.for("vercel.ai.schema");function hm(e){let t;return()=>(t==null&&(t=e()),t)}function dr(e,{validate:t}={}){return{[Br]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function vm(e){return typeof e=="object"&&e!==null&&Br in e&&e[Br]===!0&&"jsonSchema"in e&&"validate"in e}function dn(e){return e==null?dr({properties:{},additionalProperties:!1}):vm(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?go(e):gm(e):e()}function gm(e){return dr(()=>cn(e["~standard"].jsonSchema.input({target:"draft-07"})),{validate:async t=>{const r=await e["~standard"].validate(t);return"value"in r?{success:!0,value:r.value}:{success:!1,error:new dt({value:t,cause:r.issues})}}})}function ym(e,t){var r;const n=(r=void 0)!=null?r:!1;return dr(()=>mm(e,{$refStrategy:n?"root":"none"}),{validate:async a=>{const s=await e.safeParseAsync(a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function Em(e,t){var r;const n=(r=void 0)!=null?r:!1;return dr(()=>cn(np(e,{target:"draft-7",io:"input",reused:n?"ref":"inline"})),{validate:async a=>{const s=await ro(e,a);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function bm(e){return"_zod"in e}function go(e,t){return bm(e)?Em(e):ym(e)}async function Ea({value:e,schema:t,context:r}){const n=await St({value:e,schema:t,context:r});if(!n.success)throw dt.wrap({value:e,cause:n.error,context:r});return n.value}async function St({value:e,schema:t,context:r}){const n=dn(t);try{if(n.validate==null)return{success:!0,value:e,rawValue:e};const a=await n.validate(e);return a.success?{success:!0,value:a.value,rawValue:e}:{success:!1,error:dt.wrap({value:e,cause:a.error,context:r}),rawValue:e}}catch(a){return{success:!1,error:dt.wrap({value:e,cause:a,context:r}),rawValue:e}}}async function He({text:e,schema:t}){try{const r=Nf(e);return t==null?{success:!0,value:r,rawValue:r}:await St({value:r,schema:t})}catch(r){return{success:!1,error:Bn.isInstance(r)?r:new Bn({text:e,cause:r}),rawValue:void 0}}}function wm({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new _f).pipeThrough(new TransformStream({async transform({data:r},n){r!=="[DONE]"&&n.enqueue(await He({text:r,schema:t}))}}))}async function De(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}var km=Object.defineProperty,_m=(e,t)=>{for(var r in t)km(e,r,{get:t[r],enumerable:!0})},yo="AI_NoObjectGeneratedError",Eo=`vercel.ai.error.${yo}`,$m=Symbol.for(Eo),bo,Fe=class extends Le{constructor({message:e="No object generated.",cause:t,text:r,response:n,usage:a,finishReason:s}){super({name:yo,message:e,cause:t}),this[bo]=!0,this.text=r,this.response=n,this.usage=a,this.finishReason=s}static isInstance(e){return Le.hasMarker(e,Eo)}};bo=$m;var wo="AI_UIMessageStreamError",ko=`vercel.ai.error.${wo}`,Im=Symbol.for(ko),_o,ot=class extends Le{constructor({chunkType:e,chunkId:t,message:r}){super({name:wo,message:r}),this[_o]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return Le.hasMarker(e,ko)}};_o=Im;var $o=we([M(),tr(Uint8Array),tr(ArrayBuffer),po(e=>{var t,r;return(r=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?r:!1},{message:"Must be a Buffer"})]),Ke=yf(()=>we([Gp(),M(),Fp(),be(),We(M(),Ke.optional()),vt(Ke)])),te=We(M(),We(M(),Ke.optional())),Io=oe({type:Y("text"),text:M(),providerOptions:te.optional()}),xm=oe({type:Y("image"),image:we([$o,tr(URL)]),mediaType:M().optional(),providerOptions:te.optional()}),xo=oe({type:Y("file"),data:we([$o,tr(URL)]),filename:M().optional(),mediaType:M(),providerOptions:te.optional()}),Sm=oe({type:Y("reasoning"),text:M(),providerOptions:te.optional()}),Nm=oe({type:Y("tool-call"),toolCallId:M(),toolName:M(),input:Pe(),providerOptions:te.optional(),providerExecuted:be().optional()}),Tm=Hp("type",[oe({type:Y("text"),value:M(),providerOptions:te.optional()}),oe({type:Y("json"),value:Ke,providerOptions:te.optional()}),oe({type:Y("execution-denied"),reason:M().optional(),providerOptions:te.optional()}),oe({type:Y("error-text"),value:M(),providerOptions:te.optional()}),oe({type:Y("error-json"),value:Ke,providerOptions:te.optional()}),oe({type:Y("content"),value:vt(we([oe({type:Y("text"),text:M(),providerOptions:te.optional()}),oe({type:Y("media"),data:M(),mediaType:M()}),oe({type:Y("file-data"),data:M(),mediaType:M(),filename:M().optional(),providerOptions:te.optional()}),oe({type:Y("file-url"),url:M(),providerOptions:te.optional()}),oe({type:Y("file-id"),fileId:we([M(),We(M(),M())]),providerOptions:te.optional()}),oe({type:Y("image-data"),data:M(),mediaType:M(),providerOptions:te.optional()}),oe({type:Y("image-url"),url:M(),providerOptions:te.optional()}),oe({type:Y("image-file-id"),fileId:we([M(),We(M(),M())]),providerOptions:te.optional()}),oe({type:Y("custom"),providerOptions:te.optional()})]))})]),So=oe({type:Y("tool-result"),toolCallId:M(),toolName:M(),output:Tm,providerOptions:te.optional()}),Om=oe({type:Y("tool-approval-request"),approvalId:M(),toolCallId:M()}),Rm=oe({type:Y("tool-approval-response"),approvalId:M(),approved:be(),reason:M().optional()}),Am=oe({role:Y("system"),content:M(),providerOptions:te.optional()}),Cm=oe({role:Y("user"),content:we([M(),vt(we([Io,xm,xo]))]),providerOptions:te.optional()}),zm=oe({role:Y("assistant"),content:we([M(),vt(we([Io,xo,Sm,Nm,So,Om]))]),providerOptions:te.optional()}),Pm=oe({role:Y("tool"),content:vt(we([So,Rm])),providerOptions:te.optional()});we([Am,Cm,zm,Pm]);function No(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const r={...e};for(const n in t)if(!(n==="__proto__"||n==="constructor"||n==="prototype")&&Object.prototype.hasOwnProperty.call(t,n)){const a=t[n];if(a===void 0)continue;const s=n in e?e[n]:void 0,i=a!==null&&typeof a=="object"&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp),l=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&l?r[n]=No(s,a):r[n]=a}return r}new TextEncoder;var Lm={};_m(Lm,{array:()=>Vm,choice:()=>Dm,json:()=>Fm,object:()=>Bm,text:()=>jm});function Mm(e){const t=["ROOT"];let r=-1,n=null,a=0;function s(d){return d>="0"&&d<="9"||d>="A"&&d<="F"||d>="a"&&d<="f"}function i(d,m,p){switch(d){case'"':{r=m,t.pop(),t.push(p),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{r=m,n=m,t.pop(),t.push(p),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(p),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=m,t.pop(),t.push(p),t.push("INSIDE_NUMBER");break}case"{":{r=m,t.pop(),t.push(p),t.push("INSIDE_OBJECT_START");break}case"[":{r=m,t.pop(),t.push(p),t.push("INSIDE_ARRAY_START");break}}}function l(d,m){switch(d){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{r=m,t.pop();break}}}function u(d,m){switch(d){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=m,t.pop();break}}}for(let d=0;d<e.length;d++){const m=e[d];switch(t[t.length-1]){case"ROOT":i(m,d,"FINISH");break;case"INSIDE_OBJECT_START":{switch(m){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{r=d,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{m==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{m==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{m===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(m,d,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{l(m,d);break}case"INSIDE_STRING":{switch(m){case'"':{t.pop(),r=d;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:r=d}break}case"INSIDE_ARRAY_START":{m==="]"?(r=d,t.pop()):(r=d,i(m,d,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(m){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{r=d,t.pop();break}default:{r=d;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(m,d,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),m==="u"?(a=0,t.push("INSIDE_STRING_UNICODE_ESCAPE")):r=d;break}case"INSIDE_STRING_UNICODE_ESCAPE":{s(m)&&(a++,a===4&&(t.pop(),r=d));break}case"INSIDE_NUMBER":{switch(m){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{r=d;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(m,d),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(m,d);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&l(m,d);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(m,d);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const p=e.substring(n,d+1);!"false".startsWith(p)&&!"true".startsWith(p)&&!"null".startsWith(p)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?l(m,d):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&u(m,d)):r=d;break}}}let c=e.slice(0,r+1);for(let d=t.length-1;d>=0;d--)switch(t[d]){case"INSIDE_STRING":{c+='"';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":{c+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{c+="]";break}case"INSIDE_LITERAL":{const m=e.substring(n,e.length);"true".startsWith(m)?c+="true".slice(m.length):"false".startsWith(m)?c+="false".slice(m.length):"null".startsWith(m)&&(c+="null".slice(m.length))}}return c}async function zt(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await He({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await He({text:Mm(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var jm=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),Bm=({schema:e,name:t,description:r})=>{const n=dn(e);return{name:"object",responseFormat:De(n.jsonSchema).then(a=>({type:"json",schema:a,...t!=null&&{name:t},...r!=null&&{description:r}})),async parseCompleteOutput({text:a},s){const i=await He({text:a});if(!i.success)throw new Fe({message:"No object generated: could not parse the response.",cause:i.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});const l=await St({value:i.value,schema:n});if(!l.success)throw new Fe({message:"No object generated: response did not match schema.",cause:l.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});return l.value},async parsePartialOutput({text:a}){const s=await zt(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},Vm=({element:e,name:t,description:r})=>{const n=dn(e);return{name:"array",responseFormat:De(n.jsonSchema).then(a=>{const{$schema:s,...i}=a;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}}),async parseCompleteOutput({text:a},s){const i=await He({text:a});if(!i.success)throw new Fe({message:"No object generated: could not parse the response.",cause:i.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});const l=i.value;if(l==null||typeof l!="object"||!("elements"in l)||!Array.isArray(l.elements))throw new Fe({message:"No object generated: response did not match schema.",cause:new dt({value:l,cause:"response must be an object with an elements array"}),text:a,response:s.response,usage:s.usage,finishReason:s.finishReason});for(const u of l.elements){const c=await St({value:u,schema:n});if(!c.success)throw new Fe({message:"No object generated: response did not match schema.",cause:c.error,text:a,response:s.response,usage:s.usage,finishReason:s.finishReason})}return l.elements},async parsePartialOutput({text:a}){const s=await zt(a);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const l=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,u=[];for(const c of l){const d=await St({value:c,schema:n});d.success&&u.push(d.value)}return{partial:u}}}},createElementStreamTransform(){let a=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;a<s.length;a++)i.enqueue(s[a])}})}}},Dm=({options:e,name:t,description:r})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...r!=null&&{description:r}}),async parseCompleteOutput({text:n},a){const s=await He({text:n});if(!s.success)throw new Fe({message:"No object generated: could not parse the response.",cause:s.error,text:n,response:a.response,usage:a.usage,finishReason:a.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new Fe({message:"No object generated: response did not match schema.",cause:new dt({value:i,cause:"response must be an object that contains a choice value."}),text:n,response:a.response,usage:a.usage,finishReason:a.finishReason});return i.result},async parsePartialOutput({text:n}){const a=await zt(n);switch(a.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=a.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string")return;const i=e.filter(l=>l.startsWith(s.result));return a.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),Fm=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:r},n){const a=await He({text:r});if(!a.success)throw new Fe({message:"No object generated: could not parse the response.",cause:a.error,text:r,response:n.response,usage:n.usage,finishReason:n.finishReason});return a.value},async parsePartialOutput({text:r}){const n=await zt(r);switch(n.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return n.value===void 0?void 0:{partial:n.value}}},createElementStreamTransform(){}});Ct({prefix:"aitxt",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
80
-
81
- `)},flush(e){e.enqueue(`data: [DONE]
82
-
83
- `)}})}});var bt=We(M(),Ke.optional()),Zm=hm(()=>go(we([le({type:Y("text-start"),id:M(),providerMetadata:te.optional()}),le({type:Y("text-delta"),id:M(),delta:M(),providerMetadata:te.optional()}),le({type:Y("text-end"),id:M(),providerMetadata:te.optional()}),le({type:Y("error"),errorText:M()}),le({type:Y("tool-input-start"),toolCallId:M(),toolName:M(),providerExecuted:be().optional(),providerMetadata:te.optional(),toolMetadata:bt.optional(),dynamic:be().optional(),title:M().optional()}),le({type:Y("tool-input-delta"),toolCallId:M(),inputTextDelta:M()}),le({type:Y("tool-input-available"),toolCallId:M(),toolName:M(),input:Pe(),providerExecuted:be().optional(),providerMetadata:te.optional(),toolMetadata:bt.optional(),dynamic:be().optional(),title:M().optional()}),le({type:Y("tool-input-error"),toolCallId:M(),toolName:M(),input:Pe(),providerExecuted:be().optional(),providerMetadata:te.optional(),toolMetadata:bt.optional(),dynamic:be().optional(),errorText:M(),title:M().optional()}),le({type:Y("tool-approval-request"),approvalId:M(),toolCallId:M(),signature:M().optional()}),le({type:Y("tool-output-available"),toolCallId:M(),output:Pe(),providerExecuted:be().optional(),providerMetadata:te.optional(),toolMetadata:bt.optional(),dynamic:be().optional(),preliminary:be().optional()}),le({type:Y("tool-output-error"),toolCallId:M(),errorText:M(),providerExecuted:be().optional(),providerMetadata:te.optional(),toolMetadata:bt.optional(),dynamic:be().optional()}),le({type:Y("tool-output-denied"),toolCallId:M()}),le({type:Y("reasoning-start"),id:M(),providerMetadata:te.optional()}),le({type:Y("reasoning-delta"),id:M(),delta:M(),providerMetadata:te.optional()}),le({type:Y("reasoning-end"),id:M(),providerMetadata:te.optional()}),le({type:Y("source-url"),sourceId:M(),url:M(),title:M().optional(),providerMetadata:te.optional()}),le({type:Y("source-document"),sourceId:M(),mediaType:M(),title:M(),filename:M().optional(),providerMetadata:te.optional()}),le({type:Y("file"),url:M(),mediaType:M(),providerMetadata:te.optional()}),le({type:po(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:M().optional(),data:Pe(),transient:be().optional()}),le({type:Y("start-step")}),le({type:Y("finish-step")}),le({type:Y("start"),messageId:M().optional(),messageMetadata:Pe().optional()}),le({type:Y("finish"),finishReason:lo(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:Pe().optional()}),le({type:Y("abort"),reason:M().optional()}),le({type:Y("message-metadata"),messageMetadata:Pe()})])));function Um(e){return e.type.startsWith("data-")}function _t(){return Object.create(null)}function Vr(e){return e.type.startsWith("tool-")}function qm(e){return e.type==="dynamic-tool"}function Nt(e){return Vr(e)||qm(e)}function ba(e){return e.type.split("-").slice(1).join("-")}function Gm({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:_t(),activeReasoningParts:_t(),partialToolCalls:_t()}}function Jm({stream:e,messageMetadataSchema:t,dataPartSchemas:r,runUpdateMessageJob:n,onError:a,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(l,u){await n(async({state:c,write:d})=>{var m,p,f,v;function h(g){const O=c.message.parts.filter(Nt).find(S=>S.toolCallId===g);if(O==null)throw new ot({chunkType:"tool-invocation",chunkId:g,message:`No tool invocation found for tool call ID "${g}".`});return O}function y(g){var O;const S=c.message.parts.find(k=>Vr(k)&&k.toolCallId===g.toolCallId),_=g,E=S;if(S!=null){S.state=g.state,E.input=_.input,E.output=_.output,E.errorText=_.errorText,E.rawInput=_.rawInput,E.preliminary=_.preliminary,g.title!==void 0&&(E.title=g.title),g.toolMetadata!==void 0&&(E.toolMetadata=g.toolMetadata),E.providerExecuted=(O=_.providerExecuted)!=null?O:S.providerExecuted;const k=_.providerMetadata;if(k!=null)if(g.state==="output-available"||g.state==="output-error"){const N=S;N.resultProviderMetadata=k}else S.callProviderMetadata=k}else c.message.parts.push({type:`tool-${g.toolName}`,toolCallId:g.toolCallId,state:g.state,title:g.title,...g.toolMetadata!==void 0?{toolMetadata:g.toolMetadata}:{},input:_.input,output:_.output,rawInput:_.rawInput,errorText:_.errorText,providerExecuted:_.providerExecuted,preliminary:_.preliminary,..._.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:_.providerMetadata}:{},..._.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:_.providerMetadata}:{}})}function w(g){var O,S;const _=c.message.parts.find(N=>N.type==="dynamic-tool"&&N.toolCallId===g.toolCallId),E=g,k=_;if(_!=null){_.state=g.state,k.toolName=g.toolName,k.input=E.input,k.output=E.output,k.errorText=E.errorText,k.rawInput=(O=E.rawInput)!=null?O:k.rawInput,k.preliminary=E.preliminary,g.title!==void 0&&(k.title=g.title),g.toolMetadata!==void 0&&(k.toolMetadata=g.toolMetadata),k.providerExecuted=(S=E.providerExecuted)!=null?S:_.providerExecuted;const N=E.providerMetadata;if(N!=null)if(g.state==="output-available"||g.state==="output-error"){const I=_;I.resultProviderMetadata=N}else _.callProviderMetadata=N}else c.message.parts.push({type:"dynamic-tool",toolName:g.toolName,toolCallId:g.toolCallId,state:g.state,input:E.input,output:E.output,errorText:E.errorText,preliminary:E.preliminary,providerExecuted:E.providerExecuted,title:g.title,...g.toolMetadata!==void 0?{toolMetadata:g.toolMetadata}:{},...E.providerMetadata!=null&&(g.state==="output-available"||g.state==="output-error")?{resultProviderMetadata:E.providerMetadata}:{},...E.providerMetadata!=null&&!(g.state==="output-available"||g.state==="output-error")?{callProviderMetadata:E.providerMetadata}:{}})}async function $(g){if(g!=null){const O=c.message.metadata!=null?No(c.message.metadata,g):g;t!=null&&await Ea({value:O,schema:t,context:{field:"message.metadata",entityId:c.message.id}}),c.message.metadata=O}}switch(l.type){case"text-start":{const g={type:"text",text:"",providerMetadata:l.providerMetadata,state:"streaming"};c.activeTextParts[l.id]=g,c.message.parts.push(g),d();break}case"text-delta":{const g=c.activeTextParts[l.id];if(g==null)throw new ot({chunkType:"text-delta",chunkId:l.id,message:`Received text-delta for missing text part with ID "${l.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});g.text+=l.delta,g.providerMetadata=(m=l.providerMetadata)!=null?m:g.providerMetadata,d();break}case"text-end":{const g=c.activeTextParts[l.id];if(g==null)throw new ot({chunkType:"text-end",chunkId:l.id,message:`Received text-end for missing text part with ID "${l.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});g.state="done",g.providerMetadata=(p=l.providerMetadata)!=null?p:g.providerMetadata,delete c.activeTextParts[l.id],d();break}case"reasoning-start":{const g={type:"reasoning",text:"",providerMetadata:l.providerMetadata,state:"streaming"};c.activeReasoningParts[l.id]=g,c.message.parts.push(g),d();break}case"reasoning-delta":{const g=c.activeReasoningParts[l.id];if(g==null)throw new ot({chunkType:"reasoning-delta",chunkId:l.id,message:`Received reasoning-delta for missing reasoning part with ID "${l.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});g.text+=l.delta,g.providerMetadata=(f=l.providerMetadata)!=null?f:g.providerMetadata,d();break}case"reasoning-end":{const g=c.activeReasoningParts[l.id];if(g==null)throw new ot({chunkType:"reasoning-end",chunkId:l.id,message:`Received reasoning-end for missing reasoning part with ID "${l.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});g.providerMetadata=(v=l.providerMetadata)!=null?v:g.providerMetadata,g.state="done",delete c.activeReasoningParts[l.id],d();break}case"file":{c.message.parts.push({type:"file",mediaType:l.mediaType,url:l.url,...l.providerMetadata!=null?{providerMetadata:l.providerMetadata}:{}}),d();break}case"source-url":{c.message.parts.push({type:"source-url",sourceId:l.sourceId,url:l.url,title:l.title,providerMetadata:l.providerMetadata}),d();break}case"source-document":{c.message.parts.push({type:"source-document",sourceId:l.sourceId,mediaType:l.mediaType,title:l.title,filename:l.filename,providerMetadata:l.providerMetadata}),d();break}case"tool-input-start":{const g=c.message.parts.filter(Vr);c.partialToolCalls[l.toolCallId]={text:"",toolName:l.toolName,index:g.length,dynamic:l.dynamic,title:l.title,toolMetadata:l.toolMetadata},l.dynamic?w({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-streaming",input:void 0,providerExecuted:l.providerExecuted,title:l.title,toolMetadata:l.toolMetadata,providerMetadata:l.providerMetadata}):y({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-streaming",input:void 0,providerExecuted:l.providerExecuted,title:l.title,toolMetadata:l.toolMetadata,providerMetadata:l.providerMetadata}),d();break}case"tool-input-delta":{const g=c.partialToolCalls[l.toolCallId];if(g==null)throw new ot({chunkType:"tool-input-delta",chunkId:l.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${l.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});g.text+=l.inputTextDelta;const{value:O}=await zt(g.text);g.dynamic?w({toolCallId:l.toolCallId,toolName:g.toolName,state:"input-streaming",input:O,title:g.title,toolMetadata:g.toolMetadata}):y({toolCallId:l.toolCallId,toolName:g.toolName,state:"input-streaming",input:O,title:g.title,toolMetadata:g.toolMetadata}),d();break}case"tool-input-available":{l.dynamic?w({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-available",input:l.input,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:l.title,toolMetadata:l.toolMetadata}):y({toolCallId:l.toolCallId,toolName:l.toolName,state:"input-available",input:l.input,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:l.title,toolMetadata:l.toolMetadata}),d(),s&&!l.providerExecuted&&await s({toolCall:l});break}case"tool-input-error":{const g=c.message.parts.filter(Nt).find(O=>O.toolCallId===l.toolCallId);(g!=null?g.type==="dynamic-tool":l.dynamic)?w({toolCallId:l.toolCallId,toolName:l.toolName,state:"output-error",input:l.input,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,toolMetadata:l.toolMetadata}):y({toolCallId:l.toolCallId,toolName:l.toolName,state:"output-error",input:void 0,rawInput:l.input,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,toolMetadata:l.toolMetadata}),d();break}case"tool-approval-request":{const g=h(l.toolCallId);g.state="approval-requested",g.approval={id:l.approvalId,...l.signature!=null?{signature:l.signature}:{}},d();break}case"tool-output-denied":{const g=h(l.toolCallId);g.state="output-denied",d();break}case"tool-output-available":{const g=h(l.toolCallId);g.type==="dynamic-tool"?w({toolCallId:l.toolCallId,toolName:g.toolName,state:"output-available",input:g.input,output:l.output,preliminary:l.preliminary,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:g.title,toolMetadata:g.toolMetadata}):y({toolCallId:l.toolCallId,toolName:ba(g),state:"output-available",input:g.input,output:l.output,providerExecuted:l.providerExecuted,preliminary:l.preliminary,providerMetadata:l.providerMetadata,title:g.title,toolMetadata:g.toolMetadata}),d();break}case"tool-output-error":{const g=h(l.toolCallId);g.type==="dynamic-tool"?w({toolCallId:l.toolCallId,toolName:g.toolName,state:"output-error",input:g.input,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:g.title,toolMetadata:g.toolMetadata}):y({toolCallId:l.toolCallId,toolName:ba(g),state:"output-error",input:g.input,rawInput:g.rawInput,errorText:l.errorText,providerExecuted:l.providerExecuted,providerMetadata:l.providerMetadata,title:g.title,toolMetadata:g.toolMetadata}),d();break}case"start-step":{c.message.parts.push({type:"step-start"});break}case"finish-step":{c.activeTextParts=_t(),c.activeReasoningParts=_t();break}case"start":{l.messageId!=null&&(c.message.id=l.messageId),await $(l.messageMetadata),(l.messageId!=null||l.messageMetadata!=null)&&d();break}case"finish":{l.finishReason!=null&&(c.finishReason=l.finishReason),await $(l.messageMetadata),l.messageMetadata!=null&&d();break}case"message-metadata":{await $(l.messageMetadata),l.messageMetadata!=null&&d();break}case"error":{a?.(new Error(l.errorText));break}default:if(Um(l)){if(r?.[l.type]!=null){const S=c.message.parts.findIndex(E=>"id"in E&&"data"in E&&E.id===l.id&&E.type===l.type),_=S>=0?S:c.message.parts.length;await Ea({value:l.data,schema:r[l.type],context:{field:`message.parts[${_}].data`,entityName:l.type,entityId:l.id}})}const g=l;if(g.transient){i?.(g);break}const O=g.id!=null?c.message.parts.find(S=>g.type===S.type&&g.id===S.id):void 0;O!=null?O.data=g.data:c.message.parts.push(g),i?.(g),d()}}u.enqueue(l)})}}))}async function Ym({stream:e,onError:t}){const r=e.getReader();try{for(;;){const{done:n}=await r.read();if(n)break}}catch(n){t?.(n)}finally{r.releaseLock()}}Ct({prefix:"aitxt",size:24});We(M(),Ke.optional());Ct({prefix:"aiobj",size:24});var Xm=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,r)=>{this.queue.push(async()=>{try{await e(),t()}catch(n){r(n)}}),this.processQueue()})}};Ct({prefix:"aiobj",size:24});async function Wm(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:r,type:n}=t,a=await new Promise((s,i)=>{const l=new FileReader;l.onload=u=>{var c;s((c=u.target)==null?void 0:c.result)},l.onerror=u=>i(u),l.readAsDataURL(t)});return{type:"file",mediaType:n,filename:r,url:a}}))}var Hm=class{constructor({api:e="/api/chat",credentials:t,headers:r,body:n,fetch:a,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=r,this.body=n,this.fetch=a,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var r,n,a,s,i;const l=await De(this.body),u=await De(this.headers),c=await De(this.credentials),d={...st(u),...st(t.headers)},m=await((r=this.prepareSendMessagesRequest)==null?void 0:r.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...l,...t.body},headers:d,credentials:c,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),p=(n=m?.api)!=null?n:this.api,f=m?.headers!==void 0?st(m.headers):d,v=m?.body!==void 0?m.body:{...l,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},h=(a=m?.credentials)!=null?a:c,y=await((s=this.fetch)!=null?s:globalThis.fetch)(p,{method:"POST",headers:{"Content-Type":"application/json",...f},body:JSON.stringify(v),credentials:h,signal:e});if(!y.ok)throw new Error((i=await y.text())!=null?i:"Failed to fetch the chat response.");if(!y.body)throw new Error("The response body is empty.");return this.processResponseStream(y.body)}async reconnectToStream(e){var t,r,n,a,s;const i=await De(this.body),l=await De(this.headers),u=await De(this.credentials),c={...st(l),...st(e.headers)},d=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:c,credentials:u,requestMetadata:e.metadata})),m=(r=d?.api)!=null?r:`${this.api}/${e.chatId}/stream`,p=d?.headers!==void 0?st(d.headers):c,f=(n=d?.credentials)!=null?n:u,v=await((a=this.fetch)!=null?a:globalThis.fetch)(m,{method:"GET",headers:p,credentials:f});if(v.status===204)return null;if(!v.ok)throw new Error((s=await v.text())!=null?s:"Failed to fetch the chat response.");if(!v.body)throw new Error("The response body is empty.");return this.processResponseStream(v.body)}},To=class extends Hm{constructor(e={}){super(e)}processResponseStream(e){return wm({stream:e,schema:Zm}).pipeThrough(new TransformStream({async transform(t,r){if(!t.success)throw t.error;r.enqueue(t.value)}}))}},Km=class{constructor({generateId:e=$f,id:t=e(),transport:r=new To,messageMetadataSchema:n,dataPartSchemas:a,state:s,onError:i,onToolCall:l,onFinish:u,onData:c,sendAutomaticallyWhen:d}){this.activeResponse=void 0,this.jobExecutor=new Xm,this.sendMessage=async(m,p)=>{var f,v,h,y;if(m==null){await this.makeRequest({trigger:"submit-message",messageId:(f=this.lastMessage)==null?void 0:f.id,...p});return}let w;if("text"in m||"files"in m?w={parts:[...Array.isArray(m.files)?m.files:await Wm(m.files),..."text"in m&&m.text!=null?[{type:"text",text:m.text}]:[]]}:w=m,m.messageId!=null){const $=this.state.messages.findIndex(g=>g.id===m.messageId);if($===-1)throw new Error(`message with id ${m.messageId} not found`);if(this.state.messages[$].role!=="user")throw new Error(`message with id ${m.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,$+1),this.state.replaceMessage($,{...w,id:m.messageId,role:(v=w.role)!=null?v:"user",metadata:m.metadata})}else this.state.pushMessage({...w,id:(h=w.id)!=null?h:this.generateId(),role:(y=w.role)!=null?y:"user",metadata:m.metadata});await this.makeRequest({trigger:"submit-message",messageId:m.messageId,...p})},this.regenerate=async({messageId:m,...p}={})=>{const f=m==null?this.state.messages.length-1:this.state.messages.findIndex(v=>v.id===m);if(f===-1)throw new Error(`message ${m} not found`);this.state.messages=this.state.messages.slice(0,this.messages[f].role==="assistant"?f:f+1),await this.makeRequest({trigger:"regenerate-message",messageId:m,...p})},this.resumeStream=async(m={})=>{await this.makeRequest({trigger:"resume-stream",...m})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:m,approved:p,reason:f,options:v})=>this.jobExecutor.run(async()=>{const h=this.state.messages,y=h[h.length-1],w=$=>Nt($)&&$.state==="approval-requested"&&$.approval.id===m?{...$,state:"approval-responded",approval:{id:m,approved:p,reason:f}}:$;this.state.replaceMessage(h.length-1,{...y,parts:y.parts.map(w)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(w)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then($=>{var g;$&&this.makeRequest({trigger:"submit-message",messageId:(g=this.lastMessage)==null?void 0:g.id,...v})})}),this.addToolOutput=async({state:m="output-available",toolCallId:p,output:f,errorText:v,options:h})=>this.jobExecutor.run(async()=>{const y=this.state.messages,w=y[y.length-1],$=g=>Nt(g)&&g.toolCallId===p?{...g,state:m,output:f,errorText:v}:g;this.state.replaceMessage(y.length-1,{...w,parts:w.parts.map($)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map($)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(g=>{var O;g&&this.makeRequest({trigger:"submit-message",messageId:(O=this.lastMessage)==null?void 0:O.id,...h})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var m;this.status!=="streaming"&&this.status!=="submitted"||(m=this.activeResponse)!=null&&m.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=r,this.generateId=e,this.messageMetadataSchema=n,this.dataPartSchemas=a,this.state=s,this.onError=i,this.onToolCall=l,this.onFinish=u,this.onData=c,this.sendAutomaticallyWhen=d}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:r,body:n,messageId:a}){var s,i,l;let u;if(e==="resume-stream")try{const f=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:r,body:n});if(f==null)return;u=f}catch(f){this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f});return}this.setStatus({status:"submitted",error:void 0});const c=this.lastMessage;let d=!1,m=!1,p=!1;try{const f={state:Gm({lastMessage:this.state.snapshot(c),messageId:this.generateId()}),abortController:new AbortController};f.abortController.signal.addEventListener("abort",()=>{d=!0}),this.activeResponse=f;let v;e==="resume-stream"?v=u:v=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:f.abortController.signal,metadata:t,headers:r,body:n,trigger:e,messageId:a});const h=y=>this.jobExecutor.run(()=>y({state:f.state,write:()=>{var w;this.setStatus({status:"streaming"}),f.state.message.id===((w=this.lastMessage)==null?void 0:w.id)?this.state.replaceMessage(this.state.messages.length-1,f.state.message):this.state.pushMessage(f.state.message)}}));await Ym({stream:Jm({stream:v,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:h,onError:y=>{throw y}}),onError:y=>{throw y}}),this.setStatus({status:"ready"})}catch(f){if(d||f.name==="AbortError")return d=!0,this.setStatus({status:"ready"}),null;p=!0,f instanceof TypeError&&(f.message.toLowerCase().includes("fetch")||f.message.toLowerCase().includes("network"))&&(m=!0),this.onError&&f instanceof Error&&this.onError(f),this.setStatus({status:"error",error:f})}finally{try{(i=this.onFinish)==null||i.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:d,isDisconnect:m,isError:p,finishReason:(s=this.activeResponse)==null?void 0:s.state.finishReason})}catch(f){console.error(f)}this.activeResponse=void 0}!p&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(l=this.lastMessage)==null?void 0:l.id,metadata:t,headers:r,body:n})}};function Qm({messages:e}){const t=e[e.length-1];if(!t||t.role!=="assistant")return!1;const r=t.parts.reduce((a,s,i)=>s.type==="step-start"?i:a,-1),n=t.parts.slice(r+1).filter(Nt).filter(a=>!a.providerExecuted);return n.length>0&&n.every(a=>a.state==="output-available"||a.state==="output-error")}var eh=class{constructor(e){this.statusRef=o.ref("ready"),this.errorRef=o.ref(void 0),this.pushMessage=t=>{this.messagesRef.value=[...this.messagesRef.value,t]},this.popMessage=()=>{this.messagesRef.value=this.messagesRef.value.slice(0,-1)},this.replaceMessage=(t,r)=>{this.messagesRef.value[t]={...r}},this.snapshot=t=>t,this.messagesRef=o.ref(e??[])}get messages(){return this.messagesRef.value}set messages(e){this.messagesRef.value=e}get status(){return this.statusRef.value}set status(e){this.statusRef.value=e}get error(){return this.errorRef.value}set error(e){this.errorRef.value=e}},th=class extends Km{constructor({messages:e,...t}){super({...t,state:new eh(e)})}};function rh(e="ipa-ai-"){function t(){try{const s=localStorage.getItem(`${e}sessions`);return s?JSON.parse(s):[]}catch{return[]}}function r(s){localStorage.setItem(`${e}sessions`,JSON.stringify(s))}let n=0;function a(){return`session_${Date.now()}_${++n}`}return{async create(s){const i=t(),l={...s,id:s.id||a()};return i.unshift(l),r(i),l},async readAll(){return t()},async updatePartiallyById(s){const i=t(),l=i.findIndex(u=>u.id===s.id);return l>=0&&(i[l]={...i[l],...s,updatedAt:Date.now()},r(i)),!0},async deleteById(s){const i=t(),l=i.findIndex(u=>u.id===s);return l===-1?!1:(i.splice(l,1),r(i),localStorage.removeItem(`${e}msg-${s}`),!0)},async getMessages(s){try{const i=localStorage.getItem(`${e}msg-${s}`);return i?JSON.parse(i):[]}catch{return[]}},async saveMessages(s,i){localStorage.setItem(`${e}msg-${s}`,JSON.stringify(i))}}}function nh(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"){const t=e?.message;if(typeof t=="string")return t}return String(e)}function ah(e={}){const t=e.api??"/api/chat",r=e.provider,n=e.model,a=e.storage??rh(e.storagePrefix),s=e.autoTitle!==!1,i=e.titlePrompt??"请用6个字以内概括这段对话的主题。只输出标题,不要任何其他内容、标点或解释。",l=o.ref([]),u=o.ref(""),c=o.ref("idle"),d=o.ref(null);function m(V={}){e.systemPrompt&&(V.system=e.systemPrompt);const X=e.tools?.value;return X&&Object.keys(X).length>0&&(V.tools=X),r?.value&&(V.provider={type:r.value.type,apiKey:r.value.apiKey,baseUrl:r.value.baseUrl,headers:r.value.headers},V.model=n?.value),V}function p(){return e.transport?e.transport:r?.value?.createTransport&&n?.value?r.value.createTransport(n.value):new To({api:t,body:()=>m(),fetch:async(V,X)=>{const j=typeof e.fetchOptions=="function"?e.fetchOptions():e.fetchOptions??{},U=await globalThis.fetch(V,{...X,...j});if((U.headers.get("content-type")||"").includes("application/json")){const Q=await U.clone().json();if(Q&&(Q.success===!1||Q.error))throw new Error(Q.error?.message||Q.error||Q.message||"请求失败")}return U}})}function f(){const V=p();return new th({transport:V,sendAutomaticallyWhen:Qm,onToolCall:({toolCall:X})=>{const{toolName:j,input:U,toolCallId:Q}=X;e.onToolCall&&e.onToolCall({toolName:j,args:U}).then(me=>{v.value.addToolOutput({tool:j,toolCallId:Q,output:me})},me=>{v.value.addToolOutput({tool:j,toolCallId:Q,output:{error:nh(me)}})})}})}const v=o.shallowRef(f()),h=o.ref(0);function y(){v.value.activeResponse?.abortController?.abort()}const w=o.computed(()=>v.value.messages);o.watchEffect(()=>{c.value=v.value.status??"idle"}),o.watchEffect(()=>{d.value=v.value.error??null});const $=o.ref();o.watch([()=>v.value.messages,()=>c.value],([V,X])=>{V.length>0&&X!=="streaming"&&a.saveMessages(u.value,V);const j=$.value;j&&X!=="streaming"&&($.value=void 0,k(j.sessionId,j.text))},{deep:!0}),o.watch([()=>r?.value,()=>n?.value],async([V,X])=>{if(!V||!X)return;const j=v.value.messages;y(),h.value++,v.value=f(),j.length>0&&(v.value.messages=j)});async function g(){if(l.value=await a.readAll(),l.value.length===0)O();else if(!u.value){u.value=l.value[0].id;const V=await a.getMessages(u.value);v.value.messages=V}}function O(V){const X=`session_${Date.now()}`,j={id:X,name:V||`会话 ${l.value.length+1}`,createdAt:Date.now(),updatedAt:Date.now(),autoNamed:!V};return a.create(j).then(()=>{l.value.unshift(j),u.value=X,v.value.messages=[]}),X}function S(V,X){a.updatePartiallyById({id:V,name:X,updatedAt:Date.now()});const j=l.value.find(U=>U.id===V);j&&(j.name=X)}async function _(V){await a.deleteById(V);const X=l.value.findIndex(j=>j.id===V);if(X>=0&&l.value.splice(X,1),u.value===V)if(l.value.length>0){u.value=l.value[0].id;const j=await a.getMessages(u.value);v.value.messages=j}else O()}async function E(V){u.value&&w.value.length>0&&await a.saveMessages(u.value,w.value),u.value=V;const X=await a.getMessages(V);v.value.messages=X}async function k(V,X){const j=l.value.find(U=>U.id===V);if(!(!j||!j.autoNamed))try{const U=(await p().sendMessages({trigger:"submit-message",chatId:V,messageId:void 0,messages:[{role:"user",id:`title_user_${Date.now()}`,parts:[{type:"text",text:X}]}],abortSignal:void 0,body:{...m(),system:i}})).getReader();let Q="";for(;;){const{done:me,value:Ne}=await U.read();if(me)break;const x=Ne;x?.type==="text-delta"&&x?.delta&&(Q+=x.delta)}Q=Q.trim(),console.log("[useAiChat] 自动标题生成结果:",Q),Q&&(S(V,Q),j.autoNamed=!1,a.updatePartiallyById({id:V,autoNamed:!1}))}catch(U){console.warn("[useAiChat] 自动生成标题失败:",U)}}function N(V){h.value++;const X=w.value.length===0;v.value.sendMessage({text:V}),X&&s&&!$.value&&($.value={sessionId:u.value,text:V})}function I(V=[]){y(),h.value++,v.value.messages=V}function ne(){h.value++,y()}return g(),{sessions:l,activeId:u,messages:w,status:c,error:d,storage:a,responseEpoch:h,createSession:O,renameSession:S,deleteSession:_,switchSession:E,sendMessage:N,resetMessages:I,abort:ne}}const sh=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},Oo=/^[a-z0-9]+(-[a-z0-9]+)*$/,pr=(e,t,r,n="")=>{const a=e.split(":");if(e.slice(0,1)==="@"){if(a.length<2||a.length>3)return null;n=a.shift().slice(1)}if(a.length>3||!a.length)return null;if(a.length>1){const l=a.pop(),u=a.pop(),c={provider:a.length>0?a[0]:n,prefix:u,name:l};return t&&!Gt(c)?null:c}const s=a[0],i=s.split("-");if(i.length>1){const l={provider:n,prefix:i.shift(),name:i.join("-")};return t&&!Gt(l)?null:l}if(r&&n===""){const l={provider:n,prefix:"",name:s};return t&&!Gt(l,r)?null:l}return null},Gt=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1;function oh(e,t){const r=e.icons,n=e.aliases||Object.create(null),a=Object.create(null);function s(i){if(r[i])return a[i]=[];if(!(i in a)){a[i]=null;const l=n[i]&&n[i].parent,u=l&&s(l);u&&(a[i]=[l].concat(u))}return a[i]}return Object.keys(r).concat(Object.keys(n)).forEach(s),a}const Ro=Object.freeze({left:0,top:0,width:16,height:16}),rr=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),fr=Object.freeze({...Ro,...rr}),Dr=Object.freeze({...fr,body:"",hidden:!1});function ih(e,t){const r={};!e.hFlip!=!t.hFlip&&(r.hFlip=!0),!e.vFlip!=!t.vFlip&&(r.vFlip=!0);const n=((e.rotate||0)+(t.rotate||0))%4;return n&&(r.rotate=n),r}function wa(e,t){const r=ih(e,t);for(const n in Dr)n in rr?n in e&&!(n in r)&&(r[n]=rr[n]):n in t?r[n]=t[n]:n in e&&(r[n]=e[n]);return r}function lh(e,t,r){const n=e.icons,a=e.aliases||Object.create(null);let s={};function i(l){s=wa(n[l]||a[l],s)}return i(t),r.forEach(i),wa(e,s)}function Ao(e,t){const r=[];if(typeof e!="object"||typeof e.icons!="object")return r;e.not_found instanceof Array&&e.not_found.forEach(a=>{t(a,null),r.push(a)});const n=oh(e);for(const a in n){const s=n[a];s&&(t(a,lh(e,a,s)),r.push(a))}return r}const uh={provider:"",aliases:{},not_found:{},...Ro};function Tr(e,t){for(const r in t)if(r in e&&typeof e[r]!=typeof t[r])return!1;return!0}function Co(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!Tr(e,uh))return null;const r=t.icons;for(const a in r){const s=r[a];if(!a||typeof s.body!="string"||!Tr(s,Dr))return null}const n=t.aliases||Object.create(null);for(const a in n){const s=n[a],i=s.parent;if(!a||typeof i!="string"||!r[i]&&!n[i]||!Tr(s,Dr))return null}return t}const ka=Object.create(null);function ch(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function mt(e,t){const r=ka[e]||(ka[e]=Object.create(null));return r[t]||(r[t]=ch(e,t))}function zo(e,t){return Co(t)?Ao(t,(r,n)=>{n?e.icons[r]=n:e.missing.add(r)}):[]}function dh(e,t,r){try{if(typeof r.body=="string")return e.icons[t]={...r},!0}catch{}return!1}let Tt=!1;function Po(e){return typeof e=="boolean"&&(Tt=e),Tt}function ph(e){const t=typeof e=="string"?pr(e,!0,Tt):e;if(t){const r=mt(t.provider,t.prefix),n=t.name;return r.icons[n]||(r.missing.has(n)?null:void 0)}}function fh(e,t){const r=pr(e,!0,Tt);if(!r)return!1;const n=mt(r.provider,r.prefix);return t?dh(n,r.name,t):(n.missing.add(r.name),!0)}function mh(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),Tt&&!t&&!e.prefix){let n=!1;return Co(e)&&(e.prefix="",Ao(e,(a,s)=>{fh(a,s)&&(n=!0)})),n}const r=e.prefix;return Gt({prefix:r,name:"a"})?!!zo(mt(t,r),e):!1}const Lo=Object.freeze({width:null,height:null}),Mo=Object.freeze({...Lo,...rr}),hh=/(-?[0-9.]*[0-9]+[0-9.]*)/g,vh=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function _a(e,t,r){if(t===1)return e;if(r=r||100,typeof e=="number")return Math.ceil(e*t*r)/r;if(typeof e!="string")return e;const n=e.split(hh);if(n===null||!n.length)return e;const a=[];let s=n.shift(),i=vh.test(s);for(;;){if(i){const l=parseFloat(s);isNaN(l)?a.push(s):a.push(Math.ceil(l*t*r)/r)}else a.push(s);if(s=n.shift(),s===void 0)return a.join("");i=!i}}function gh(e,t="defs"){let r="";const n=e.indexOf("<"+t);for(;n>=0;){const a=e.indexOf(">",n),s=e.indexOf("</"+t);if(a===-1||s===-1)break;const i=e.indexOf(">",s);if(i===-1)break;r+=e.slice(a+1,s).trim(),e=e.slice(0,n).trim()+e.slice(i+1)}return{defs:r,content:e}}function yh(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Eh(e,t,r){const n=gh(e);return yh(n.defs,t+n.content+r)}const bh=e=>e==="unset"||e==="undefined"||e==="none";function wh(e,t){const r={...fr,...e},n={...Mo,...t},a={left:r.left,top:r.top,width:r.width,height:r.height};let s=r.body;[r,n].forEach(h=>{const y=[],w=h.hFlip,$=h.vFlip;let g=h.rotate;w?$?g+=2:(y.push("translate("+(a.width+a.left).toString()+" "+(0-a.top).toString()+")"),y.push("scale(-1 1)"),a.top=a.left=0):$&&(y.push("translate("+(0-a.left).toString()+" "+(a.height+a.top).toString()+")"),y.push("scale(1 -1)"),a.top=a.left=0);let O;switch(g<0&&(g-=Math.floor(g/4)*4),g=g%4,g){case 1:O=a.height/2+a.top,y.unshift("rotate(90 "+O.toString()+" "+O.toString()+")");break;case 2:y.unshift("rotate(180 "+(a.width/2+a.left).toString()+" "+(a.height/2+a.top).toString()+")");break;case 3:O=a.width/2+a.left,y.unshift("rotate(-90 "+O.toString()+" "+O.toString()+")");break}g%2===1&&(a.left!==a.top&&(O=a.left,a.left=a.top,a.top=O),a.width!==a.height&&(O=a.width,a.width=a.height,a.height=O)),y.length&&(s=Eh(s,'<g transform="'+y.join(" ")+'">',"</g>"))});const i=n.width,l=n.height,u=a.width,c=a.height;let d,m;i===null?(m=l===null?"1em":l==="auto"?c:l,d=_a(m,u/c)):(d=i==="auto"?u:i,m=l===null?_a(d,c/u):l==="auto"?c:l);const p={},f=(h,y)=>{bh(y)||(p[h]=y.toString())};f("width",d),f("height",m);const v=[a.left,a.top,u,c];return p.viewBox=v.join(" "),{attributes:p,viewBox:v,body:s}}const kh=/\sid="(\S+)"/g,$a=new Map;function _h(e){e=e.replace(/[0-9]+$/,"")||"a";const t=$a.get(e)||0;return $a.set(e,t+1),t?`${e}${t}`:e}function $h(e){const t=[];let r;for(;r=kh.exec(e);)t.push(r[1]);if(!t.length)return e;const n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(a=>{const s=_h(a),i=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+i+')([")]|\\.[a-z])',"g"),"$1"+s+n+"$3")}),e=e.replace(new RegExp(n,"g"),""),e}const Fr=Object.create(null);function Ih(e,t){Fr[e]=t}function Zr(e){return Fr[e]||Fr[""]}function pn(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const fn=Object.create(null),Ut=["https://api.simplesvg.com","https://api.unisvg.com"],Ur=[];for(;Ut.length>0;)Ut.length===1||Math.random()>.5?Ur.push(Ut.shift()):Ur.push(Ut.pop());fn[""]=pn({resources:["https://api.iconify.design"].concat(Ur)});function xh(e,t){const r=pn(t);return r===null?!1:(fn[e]=r,!0)}function mn(e){return fn[e]}const Sh=()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}};let Ia=Sh();function Nh(e,t){const r=mn(e);if(!r)return 0;let n;if(!r.maxURL)n=0;else{let a=0;r.resources.forEach(i=>{a=Math.max(a,i.length)});const s=t+".json?icons=";n=r.maxURL-a-r.path.length-s.length}return n}function Th(e){return e===404}const Oh=(e,t,r)=>{const n=[],a=Nh(e,t),s="icons";let i={type:s,provider:e,prefix:t,icons:[]},l=0;return r.forEach((u,c)=>{l+=u.length+1,l>=a&&c>0&&(n.push(i),i={type:s,provider:e,prefix:t,icons:[]},l=u.length),i.icons.push(u)}),n.push(i),n};function Rh(e){if(typeof e=="string"){const t=mn(e);if(t)return t.path}return"/"}const Ah=(e,t,r)=>{if(!Ia){r("abort",424);return}let n=Rh(t.provider);switch(t.type){case"icons":{const s=t.prefix,i=t.icons.join(","),l=new URLSearchParams({icons:i});n+=s+".json?"+l.toString();break}case"custom":{const s=t.uri;n+=s.slice(0,1)==="/"?s.slice(1):s;break}default:r("abort",400);return}let a=503;Ia(e+n).then(s=>{const i=s.status;if(i!==200){setTimeout(()=>{r(Th(i)?"abort":"next",i)});return}return a=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?r("abort",s):r("next",a)});return}setTimeout(()=>{r("success",s)})}).catch(()=>{r("next",a)})},Ch={prepare:Oh,send:Ah};function jo(e,t){e.forEach(r=>{const n=r.loaderCallbacks;n&&(r.loaderCallbacks=n.filter(a=>a.id!==t))})}function zh(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let r=!1;const n=e.provider,a=e.prefix;t.forEach(s=>{const i=s.icons,l=i.pending.length;i.pending=i.pending.filter(u=>{if(u.prefix!==a)return!0;const c=u.name;if(e.icons[c])i.loaded.push({provider:n,prefix:a,name:c});else if(e.missing.has(c))i.missing.push({provider:n,prefix:a,name:c});else return r=!0,!0;return!1}),i.pending.length!==l&&(r||jo([e],s.id),s.callback(i.loaded.slice(0),i.missing.slice(0),i.pending.slice(0),s.abort))})}))}let Ph=0;function Lh(e,t,r){const n=Ph++,a=jo.bind(null,r,n);if(!t.pending.length)return a;const s={id:n,icons:t,callback:e,abort:a};return r.forEach(i=>{(i.loaderCallbacks||(i.loaderCallbacks=[])).push(s)}),a}function Mh(e){const t={loaded:[],missing:[],pending:[]},r=Object.create(null);e.sort((a,s)=>a.provider!==s.provider?a.provider.localeCompare(s.provider):a.prefix!==s.prefix?a.prefix.localeCompare(s.prefix):a.name.localeCompare(s.name));let n={provider:"",prefix:"",name:""};return e.forEach(a=>{if(n.name===a.name&&n.prefix===a.prefix&&n.provider===a.provider)return;n=a;const s=a.provider,i=a.prefix,l=a.name,u=r[s]||(r[s]=Object.create(null)),c=u[i]||(u[i]=mt(s,i));let d;l in c.icons?d=t.loaded:i===""||c.missing.has(l)?d=t.missing:d=t.pending;const m={provider:s,prefix:i,name:l};d.push(m)}),t}function jh(e,t=!0,r=!1){const n=[];return e.forEach(a=>{const s=typeof a=="string"?pr(a,t,r):a;s&&n.push(s)}),n}const Bh={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Vh(e,t,r,n){const a=e.resources.length,s=e.random?Math.floor(Math.random()*a):e.index;let i;if(e.random){let _=e.resources.slice(0);for(i=[];_.length>1;){const E=Math.floor(Math.random()*_.length);i.push(_[E]),_=_.slice(0,E).concat(_.slice(E+1))}i=i.concat(_)}else i=e.resources.slice(s).concat(e.resources.slice(0,s));const l=Date.now();let u="pending",c=0,d,m=null,p=[],f=[];typeof n=="function"&&f.push(n);function v(){m&&(clearTimeout(m),m=null)}function h(){u==="pending"&&(u="aborted"),v(),p.forEach(_=>{_.status==="pending"&&(_.status="aborted")}),p=[]}function y(_,E){E&&(f=[]),typeof _=="function"&&f.push(_)}function w(){return{startTime:l,payload:t,status:u,queriesSent:c,queriesPending:p.length,subscribe:y,abort:h}}function $(){u="failed",f.forEach(_=>{_(void 0,d)})}function g(){p.forEach(_=>{_.status==="pending"&&(_.status="aborted")}),p=[]}function O(_,E,k){const N=E!=="success";switch(p=p.filter(I=>I!==_),u){case"pending":break;case"failed":if(N||!e.dataAfterTimeout)return;break;default:return}if(E==="abort"){d=k,$();return}if(N){d=k,p.length||(i.length?S():$());return}if(v(),g(),!e.random){const I=e.resources.indexOf(_.resource);I!==-1&&I!==e.index&&(e.index=I)}u="completed",f.forEach(I=>{I(k)})}function S(){if(u!=="pending")return;v();const _=i.shift();if(_===void 0){if(p.length){m=setTimeout(()=>{v(),u==="pending"&&(g(),$())},e.timeout);return}$();return}const E={status:"pending",resource:_,callback:(k,N)=>{O(E,k,N)}};p.push(E),c++,m=setTimeout(S,e.rotate),r(_,t,E.callback)}return setTimeout(S),w}function Bo(e){const t={...Bh,...e};let r=[];function n(){r=r.filter(i=>i().status==="pending")}function a(i,l,u){const c=Vh(t,i,l,(d,m)=>{n(),u&&u(d,m)});return r.push(c),c}function s(i){return r.find(l=>i(l))||null}return{query:a,find:s,setIndex:i=>{t.index=i},getIndex:()=>t.index,cleanup:n}}function xa(){}const Or=Object.create(null);function Dh(e){if(!Or[e]){const t=mn(e);if(!t)return;Or[e]={config:t,redundancy:Bo(t)}}return Or[e]}function Fh(e,t,r){let n,a;if(typeof e=="string"){const s=Zr(e);if(!s)return r(void 0,424),xa;a=s.send;const i=Dh(e);i&&(n=i.redundancy)}else{const s=pn(e);if(s){n=Bo(s);const i=Zr(e.resources?e.resources[0]:"");i&&(a=i.send)}}return!n||!a?(r(void 0,424),xa):n.query(t,a,r)().abort}function Sa(){}function Zh(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,zh(e)}))}function Uh(e){const t=[],r=[];return e.forEach(n=>{(n.match(Oo)?t:r).push(n)}),{valid:t,invalid:r}}function wt(e,t,r){function n(){const a=e.pendingIcons;t.forEach(s=>{a&&a.delete(s),e.icons[s]||e.missing.add(s)})}if(r&&typeof r=="object")try{if(!zo(e,r).length){n();return}}catch(a){console.error(a)}n(),Zh(e)}function Na(e,t){e instanceof Promise?e.then(r=>{t(r)}).catch(()=>{t(null)}):t(e)}function qh(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:r,prefix:n}=e,a=e.iconsToLoad;if(delete e.iconsToLoad,!a||!a.length)return;const s=e.loadIcon;if(e.loadIcons&&(a.length>1||!s)){Na(e.loadIcons(a,n,r),c=>{wt(e,a,c)});return}if(s){a.forEach(c=>{Na(s(c,n,r),d=>{wt(e,[c],d?{prefix:n,icons:{[c]:d}}:null)})});return}const{valid:i,invalid:l}=Uh(a);if(l.length&&wt(e,l,null),!i.length)return;const u=n.match(Oo)?Zr(r):null;if(!u){wt(e,i,null);return}u.prepare(r,n,i).forEach(c=>{Fh(r,c,d=>{wt(e,c.icons,d)})})}))}const Gh=(e,t)=>{const r=Mh(jh(e,!0,Po()));if(!r.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(r.loaded,r.missing,r.pending,Sa)}),()=>{l=!1}}const n=Object.create(null),a=[];let s,i;return r.pending.forEach(l=>{const{provider:u,prefix:c}=l;if(c===i&&u===s)return;s=u,i=c,a.push(mt(u,c));const d=n[u]||(n[u]=Object.create(null));d[c]||(d[c]=[])}),r.pending.forEach(l=>{const{provider:u,prefix:c,name:d}=l,m=mt(u,c),p=m.pendingIcons||(m.pendingIcons=new Set);p.has(d)||(p.add(d),n[u][c].push(d))}),a.forEach(l=>{const u=n[l.provider][l.prefix];u.length&&qh(l,u)}),t?Lh(t,r,a):Sa};function Jh(e,t){const r={...e};for(const n in t){const a=t[n],s=typeof a;n in Lo?(a===null||a&&(s==="string"||s==="number"))&&(r[n]=a):s===typeof r[n]&&(r[n]=n==="rotate"?a%4:a)}return r}const Yh=/[\s,]+/;function Xh(e,t){t.split(Yh).forEach(r=>{switch(r.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function Wh(e,t=0){const r=e.replace(/^-?[0-9.]*/,"");function n(a){for(;a<0;)a+=4;return a%4}if(r===""){const a=parseInt(e);return isNaN(a)?0:n(a)}else if(r!==e){let a=0;switch(r){case"%":a=25;break;case"deg":a=90}if(a){let s=parseFloat(e.slice(0,e.length-r.length));return isNaN(s)?0:(s=s/a,s%1===0?n(s):0)}}return t}function Hh(e,t){let r=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const n in t)r+=" "+n+'="'+t[n]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+r+">"+e+"</svg>"}function Kh(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function Qh(e){return"data:image/svg+xml,"+Kh(e)}function ev(e){return'url("'+Qh(e)+'")'}const Ta={...Mo,inline:!1},tv={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},rv={display:"inline-block"},qr={backgroundColor:"currentColor"},Vo={backgroundColor:"transparent"},Oa={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},Ra={webkitMask:qr,mask:qr,background:Vo};for(const e in Ra){const t=Ra[e];for(const r in Oa)t[e+r]=Oa[r]}const Jt={};["horizontal","vertical"].forEach(e=>{const t=e.slice(0,1)+"Flip";Jt[e+"-flip"]=t,Jt[e.slice(0,1)+"-flip"]=t,Jt[e+"Flip"]=t});function Aa(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const Ca=(e,t)=>{const r=Jh(Ta,t),n={...tv},a=t.mode||"svg",s={},i=t.style,l=typeof i=="object"&&!(i instanceof Array)?i:{};for(let h in t){const y=t[h];if(y!==void 0)switch(h){case"icon":case"style":case"onLoad":case"mode":case"ssr":case"customise":break;case"inline":case"hFlip":case"vFlip":r[h]=y===!0||y==="true"||y===1;break;case"flip":typeof y=="string"&&Xh(r,y);break;case"color":s.color=y;break;case"rotate":typeof y=="string"?r[h]=Wh(y):typeof y=="number"&&(r[h]=y);break;case"ariaHidden":case"aria-hidden":y!==!0&&y!=="true"&&delete n["aria-hidden"];break;default:{const w=Jt[h];w?(y===!0||y==="true"||y===1)&&(r[w]=!0):Ta[h]===void 0&&(n[h]=y)}}}const u=wh(e,r),c=u.attributes;if(r.inline&&(s.verticalAlign="-0.125em"),a==="svg")return n.style={...s,...l},Object.assign(n,c),n.innerHTML=$h(u.body),o.h("svg",n);const{body:d,width:m,height:p}=e,f=a==="mask"||(a==="bg"?!1:d.indexOf("currentColor")!==-1),v=Hh(d,{...c,width:m+"",height:p+""});return n.style={...s,"--svg":ev(v),width:Aa(c.width),height:Aa(c.height),...rv,...f?qr:Vo,...l},o.h("span",n)};Po(!0);Ih("",Ch);if(typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,r="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(n=>{try{(typeof n!="object"||n===null||n instanceof Array||typeof n.icons!="object"||typeof n.prefix!="string"||!mh(n))&&console.error(r)}catch{console.error(r)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let r in t){const n="IconifyProviders["+r+"] is invalid.";try{const a=t[r];if(typeof a!="object"||!a||a.resources===void 0)continue;xh(r,a)||console.error(n)}catch{console.error(n)}}}}const nv={...fr,body:""};o.defineComponent((e,{emit:t})=>{const r=o.ref(null);function n(){r.value&&(r.value.abort?.(),r.value=null)}const a=o.ref(!!e.ssr),s=o.ref(""),i=o.shallowRef(null);function l(){const c=e.icon;if(typeof c=="object"&&c!==null&&typeof c.body=="string")return s.value="",{data:c};let d;if(typeof c!="string"||(d=pr(c,!1,!0))===null)return null;let m=ph(d);if(!m){const v=r.value;return(!v||v.name!==c)&&(m===null?r.value={name:c}:r.value={name:c,abort:Gh([d],u)}),null}n(),s.value!==c&&(s.value=c,o.nextTick(()=>{t("load",c)}));const p=e.customise;if(p){m=Object.assign({},m);const v=p(m.body,d.name,d.prefix,d.provider);typeof v=="string"&&(m.body=v)}const f=["iconify"];return d.prefix!==""&&f.push("iconify--"+d.prefix),d.provider!==""&&f.push("iconify--"+d.provider),{data:m,classes:f}}function u(){const c=l();c?c.data!==i.value?.data&&(i.value=c):i.value=null}return a.value?u():o.onMounted(()=>{a.value=!0,u()}),o.watch(()=>e.icon,u),o.onUnmounted(n),()=>{const c=i.value;if(!c)return Ca(nv,e);let d=e;return c.classes&&(d={...e,class:c.classes.join(" ")}),Ca({...fr,...c.data},d)}},{props:["icon","mode","ssr","width","height","style","color","inline","rotate","hFlip","horizontalFlip","vFlip","verticalFlip","flip","id","ariaHidden","customise","title"],emits:["load"]});o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./ThemeToggle-BUNljRAf-De-AyYWp.cjs")));const av=o.defineComponent({__name:"BaseLayout",setup(e){const{t}=Ei.useI18n();return Ji(t),(r,n)=>(o.openBlock(),o.createBlock(o.unref(G.ElConfigProvider),{locale:o.unref(bi)},{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},8,["locale"]))}}),sv=["onClick"],ov={key:1},iv=["onClick"],lv={key:1},uv={key:0,class:"ipa-grid__group-body-wrap"},cv=["onClick"],dv={key:1},pv=["onClick"],fv={key:1},za="__default__",mv=o.defineComponent({__name:"IpaGrid",props:o.mergeModels({groupBy:{},groups:{},direction:{default:"horizontal"},columns:{default:4},rows:{default:4},gap:{default:12},sortable:{type:Boolean},crossGroup:{type:Boolean},itemComponent:{},itemKey:{default:"id"},collapsible:{type:Boolean,default:!1}},{items:{required:!0},itemsModifiers:{},collapsed:{default:()=>[]},collapsedModifiers:{}}),emits:o.mergeModels(["item-click","sort-change"],["update:items","update:collapsed"]),setup(e,{emit:t}){const r=e,n=t,a=o.useModel(e,"items"),s=o.useModel(e,"collapsed"),i=o.useSlots(),l=E=>s.value.includes(E),u=E=>{s.value=l(E)?s.value.filter(k=>k!==E):[...s.value,E]},c=o.computed(()=>{const E=new Map;if(!r.groupBy)return E;for(const k of a.value){const N=r.groupBy(k);for(const I of N)E.has(I)||E.set(I,[]),E.get(I).push(k)}return E}),d=o.computed(()=>{if(!r.groupBy)return[];const E=c.value;return r.groups&&r.groups.length>0?r.groups.filter(k=>E.has(k.id)).map(k=>({...k,items:E.get(k.id)??[]})):Array.from(E.entries()).filter(([,k])=>k.length>0).map(([k,N])=>({id:k,label:String(k),items:N}))}),m=o.computed(()=>{if(!r.groupBy)return[];const E=c.value;if(r.groups&&r.groups.length>0)return r.groups.map(N=>({...N,items:E.get(N.id)??[]}));const k=new Set([...E.keys()]);return Array.from(k).map(N=>({id:N,label:String(N),items:E.get(N)??[]}))}),p=o.computed(()=>{const E=r.groupBy?m.value:[{id:za,label:"",items:[...a.value]}];return r.sortable?E.map(k=>({...k,items:f[String(k.id)]??k.items})):E}),f=o.reactive({});o.watch(d,E=>{const k=new Set(E.map(N=>String(N.id)));for(const N of E){const I=String(N.id);f[I]=[...N.items]}for(const N of Object.keys(f))k.has(N)||delete f[N]},{immediate:!0,deep:!0});const v=o.computed(()=>r.direction==="vertical"?"ipa-grid__body--vertical":"ipa-grid__body--horizontal"),h=o.computed(()=>{const E=[];if(typeof r.columns=="object"){const k=r.columns;k.xs!=null&&E.push(`ipa-grid-cols-xs-${k.xs}`),k.sm!=null&&E.push(`ipa-grid-cols-sm-${k.sm}`),k.md!=null&&E.push(`ipa-grid-cols-md-${k.md}`),k.lg!=null&&E.push(`ipa-grid-cols-lg-${k.lg}`),k.xl!=null&&E.push(`ipa-grid-cols-xl-${k.xl}`)}if(typeof r.rows=="object"&&r.direction==="vertical"){const k=r.rows;k.xs!=null&&E.push(`ipa-grid-rows-xs-${k.xs}`),k.sm!=null&&E.push(`ipa-grid-rows-sm-${k.sm}`),k.md!=null&&E.push(`ipa-grid-rows-md-${k.md}`),k.lg!=null&&E.push(`ipa-grid-rows-lg-${k.lg}`),k.xl!=null&&E.push(`ipa-grid-rows-xl-${k.xl}`)}return E}),y=o.computed(()=>{const E={};return E["--ipa-grid-gap"]=`${r.gap}px`,typeof r.columns=="number"&&(E["--ipa-grid-columns"]=String(r.columns)),typeof r.rows=="number"&&r.direction==="vertical"&&(E["--ipa-grid-rows"]=String(r.rows)),E}),w=o.computed(()=>{if(r.sortable)return{group:r.crossGroup?{name:"ipa-grid",pull:!0,put:!0}:void 0,ghostClass:"ipa-grid-ghost",dragClass:"ipa-grid-dragging",animation:200}}),$=(E,k)=>{const N=k.added??k.moved;N&&n("sort-change",{group:E,dragItem:N.element})},g=E=>{n("sort-change",{group:za,dragItem:a.value[E.newIndex]})},O=E=>{n("item-click",E)},S=E=>E.component??r.itemComponent,_=(E,k)=>{const N=E[r.itemKey];return N!=null?String(N):String(k)};return(E,k)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["ipa-grid",{"ipa-grid--sortable":e.sortable}])},[o.unref(i).default?o.renderSlot(E.$slots,"default",{key:0,items:a.value,groups:p.value,direction:e.direction},void 0,!0):e.groupBy?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:2},o.renderList(p.value,N=>(o.openBlock(),o.createElementBlock("div",{key:N.id,class:"ipa-grid__group"},[o.renderSlot(E.$slots,"group-header",{group:N,collapsed:l(N.id)},()=>[o.createElementVNode("div",{class:o.normalizeClass(["ipa-grid__group-header",{"ipa-grid__group-header--collapsible":e.collapsible}])},[o.createElementVNode("span",null,o.toDisplayString(N.label),1),e.collapsible?(o.openBlock(),o.createBlock(o.unref(G.ElIcon),{key:0,size:14,class:"ipa-grid__collapse-icon",onClick:o.withModifiers(I=>u(N.id),["stop"])},{default:o.withCtx(()=>[l(N.id)?(o.openBlock(),o.createBlock(o.unref(ut.ArrowRight),{key:1})):(o.openBlock(),o.createBlock(o.unref(ut.ArrowDown),{key:0}))]),_:2},1032,["onClick"])):o.createCommentVNode("",!0)],2)],!0),o.createVNode(o.Transition,{name:"ipa-grid-collapse"},{default:o.withCtx(()=>[!e.collapsible||!l(N.id)?(o.openBlock(),o.createElementBlock("div",uv,[e.sortable?(o.openBlock(),o.createBlock(o.unref(Nn),o.mergeProps({key:0,ref_for:!0},w.value,{list:f[String(N.id)],"item-key":e.itemKey,class:["ipa-grid__body",v.value,...h.value],style:y.value,onChange:I=>$(N.id,I)}),{item:o.withCtx(({element:I,index:ne})=>[o.createElementVNode("div",{class:"ipa-grid-item",onClick:V=>O(I)},[o.renderSlot(E.$slots,"item",{item:I,index:ne},()=>[S(I)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(S(I).is),o.mergeProps({key:0,ref_for:!0},{...S(I).props,item:I}),null,16)):(o.openBlock(),o.createElementBlock("span",dv,o.toDisplayString(I),1))],!0)],8,cv)]),_:3},16,["list","item-key","class","style","onChange"])):(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["ipa-grid__body",v.value,...h.value]),style:o.normalizeStyle(y.value)},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(N.items,(I,ne)=>(o.openBlock(),o.createElementBlock("div",{key:_(I,ne),class:"ipa-grid-item",onClick:V=>O(I)},[o.renderSlot(E.$slots,"item",{item:I,index:ne},()=>[S(I)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(S(I).is),o.mergeProps({key:0,ref_for:!0},{...S(I).props,item:I}),null,16)):(o.openBlock(),o.createElementBlock("span",fv,o.toDisplayString(I),1))],!0)],8,pv))),128))],6))])):o.createCommentVNode("",!0)]),_:2},1024)]))),128)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[e.sortable?(o.openBlock(),o.createBlock(o.unref(Nn),o.mergeProps({key:0,modelValue:a.value,"onUpdate:modelValue":k[0]||(k[0]=N=>a.value=N)},w.value,{"item-key":e.itemKey,class:["ipa-grid__body",v.value,...h.value],style:y.value,onEnd:g}),{item:o.withCtx(({element:N,index:I})=>[o.createElementVNode("div",{class:"ipa-grid-item",onClick:ne=>O(N)},[o.renderSlot(E.$slots,"item",{item:N,index:I},()=>[S(N)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(S(N).is),o.normalizeProps(o.mergeProps({key:0},{...S(N).props,item:N})),null,16)):(o.openBlock(),o.createElementBlock("span",ov,o.toDisplayString(N),1))],!0)],8,sv)]),_:3},16,["modelValue","item-key","class","style"])):(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["ipa-grid__body",v.value,...h.value]),style:o.normalizeStyle(y.value)},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(N,I)=>(o.openBlock(),o.createElementBlock("div",{key:_(N,I),class:"ipa-grid-item",onClick:ne=>O(N)},[o.renderSlot(E.$slots,"item",{item:N,index:I},()=>[S(N)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(S(N).is),o.mergeProps({key:0,ref_for:!0},{...S(N).props,item:N}),null,16)):(o.openBlock(),o.createElementBlock("span",lv,o.toDisplayString(N),1))],!0)],8,iv))),128))],6))],64))],2))}}),_e=(e,t)=>{const r=e.__vccOpts||e;for(const[n,a]of t)r[n]=a;return r},Do=_e(mv,[["__scopeId","data-v-e4f8f549"]]),hv=o.defineComponent({name:"IpaTabs",__name:"IpaTabs",props:o.mergeModels({headerHeight:{default:void 0},headerFontSize:{default:void 0}},{tabs:{default:()=>[]},tabsModifiers:{}}),emits:["update:tabs"],setup(e){const t=o.useModel(e,"tabs");return(r,n)=>(o.openBlock(),o.createBlock(o.unref(G.ElTabs),o.mergeProps({"tab-position":"top",class:"flex h-full w-full overflow-hidden",style:{"--el-tabs-header-height":e.headerHeight?`${e.headerHeight}px`:void 0,"--el-font-size-base":e.headerFontSize?`${e.headerFontSize}px`:void 0}},r.$attrs),o.createSlots({default:o.withCtx(()=>[t.value?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(t.value,(a,s)=>(o.openBlock(),o.createBlock(o.unref(G.ElTabPane),o.mergeProps({key:s,lazy:!0},{ref_for:!0},a.paneProps),{default:o.withCtx(()=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(a.is),o.mergeProps({ref_for:!0},a.props,{class:"flex-1 overflow-x-hidden overflow-y-auto"}),null,16))]),_:2},1040))),128)):o.createCommentVNode("",!0)]),_:2},[o.renderList(r.$slots,(a,s)=>({name:s,fn:o.withCtx(i=>[o.renderSlot(r.$slots,s,o.normalizeProps(o.guardReactiveProps(i)),void 0,!0)])}))]),1040,["style"]))}}),vv=_e(hv,[["__scopeId","data-v-e162ce81"]]),gv="ipa-pager-persist-key-session";function Fo(e){return typeof e=="object"&&e?.key?e.key:gv}function Zo(e,t){return e?Me.useStorage(e,void 0,Me.defaultWindow?.sessionStorage,{serializer:{read:r=>Number.parseFloat(r),write:r=>String(r)}}):o.ref(void 0)}const Uo=o.defineComponent({inheritAttrs:!1,__name:"IpaPager",props:o.mergeModels({pagerCount:{},layout:{default:"total, sizes, prev, pager, next, jumper"},pageSizes:{default:()=>[10,20,50,100]},popperClass:{},popperStyle:{},prevText:{},prevIcon:{},nextText:{},nextIcon:{},teleported:{type:Boolean},small:{type:Boolean},size:{},background:{type:Boolean},disabled:{type:Boolean},hideOnSinglePage:{type:Boolean},appendSizeTo:{},persist:{type:[Boolean,Object],default:!1}},{modelValue:{required:!0},modelModifiers:{}}),emits:o.mergeModels(["change"],["update:modelValue"]),setup(e,{emit:t}){const r=e,n=o.useModel(e,"modelValue"),a=t,s=o.computed(()=>r.persist?Fo(r.persist):""),i=Zo(r.persist?s.value:"");o.watch(()=>n.value.pageSize,p=>{r.persist&&(i.value=p)},{immediate:!0});const l=o.computed(()=>n.value.pageBase??0),u=o.computed(()=>n.value.pageAt-l.value+1),c=p=>{n.value={...n.value,pageAt:p-1+l.value}},d=p=>{n.value={...n.value,pageSize:p}},m=(p,f)=>{n.value={...n.value,pageAt:p-1+l.value,pageSize:f},a("change",n.value)};return(p,f)=>(o.openBlock(),o.createBlock(o.unref(G.ElPagination),o.mergeProps({...p.$attrs,...r},{"current-page":u.value,"page-size":n.value.pageSize,total:n.value.total,"onUpdate:currentPage":c,"onUpdate:pageSize":d,onChange:m}),null,16,["current-page","page-size","total"]))}}),yv={length:[{label:"mm",value:"mm"},{label:"cm",value:"cm"},{label:"m",value:"m"},{label:"km",value:"km"},{label:"in",value:"in"},{label:"ft",value:"ft"}],area:[{label:"mm²",value:"mm2"},{label:"cm²",value:"cm2"},{label:"m²",value:"m2"},{label:"km²",value:"km2"},{label:"ha",value:"ha"}],volume:[{label:"mL",value:"mL"},{label:"L",value:"L"},{label:"m³",value:"m3"},{label:"gal",value:"gal"}],mass:[{label:"g",value:"g"},{label:"kg",value:"kg"},{label:"t",value:"t"},{label:"lb",value:"lb"}],speed:[{label:"m/s",value:"m/s"},{label:"km/h",value:"km/h"},{label:"mph",value:"mph"},{label:"kn",value:"kn"}],time:[{label:"ms",value:"ms"},{label:"s",value:"s"},{label:"min",value:"min"},{label:"h",value:"h"},{label:"day",value:"day"}],temperature:[{label:"°C",value:"C"},{label:"°F",value:"F"},{label:"K",value:"K"}]},Ev={class:"ipa-quantified-value"},bv=o.defineComponent({__name:"IpaQuantifiedValue",props:o.mergeModels({units:{default:()=>[]},unitType:{},unitMode:{type:[String,Boolean],default:"auto"},placeholder:{default:"请输入"},size:{default:"default"},disabled:{type:Boolean},min:{},max:{},step:{default:1},precision:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=o.useModel(e,"modelValue");function n(d){return typeof d=="object"&&d!==null&&"unit"in d}o.watch([()=>t.unitMode,r],([d,m])=>{d===!0&&typeof m=="number"?r.value={quantity:m,unit:""}:d===!1&&n(m)&&(r.value=m.quantity??0)},{immediate:!0});const a=o.computed(()=>t.unitMode===!0?!1:t.unitMode===!1?!0:!n(r.value)),s=o.computed({get:()=>{if(typeof r.value=="number")return r.value;if(n(r.value))return r.value.quantity},set:d=>{const m=d??void 0;n(r.value)?r.value={...r.value,quantity:m}:r.value=m??0}}),i=o.computed(()=>n(r.value)?r.value.unit??"":"");function l(d){return typeof d=="string"?{label:d,value:d}:d}const u=o.computed(()=>{const d=t.unitType?[...yv[t.unitType]||[]]:[],m=(t.units||[]).map(l),p=[...d,...m],f=new Set;return p.filter(v=>f.has(v.value)?!1:(f.add(v.value),!0))});function c(d){const m=String(d);if(n(r.value))r.value={...r.value,unit:m};else{const p=r.value;r.value={quantity:typeof p=="number"?p:void 0,unit:m}}}return(d,m)=>(o.openBlock(),o.createElementBlock("div",Ev,[o.createVNode(o.unref(G.ElInputNumber),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=p=>s.value=p),placeholder:e.placeholder,size:e.size,disabled:e.disabled,controls:!1,max:e.max,min:e.min,step:e.step,precision:e.precision},o.createSlots({suffix:o.withCtx(()=>[a.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(o.unref(G.ElSelect),{key:0,"model-value":i.value,size:e.size,disabled:e.disabled,filterable:"","allow-create":"",class:"ipa-quantified-value__select",onChange:c},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(u.value,p=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","size","disabled"]))]),_:2},[d.$slots.prefix?{name:"prefix",fn:o.withCtx(()=>[o.renderSlot(d.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0]),1032,["modelValue","placeholder","size","disabled","max","min","step","precision"])]))}}),qo=_e(bv,[["__scopeId","data-v-85108c3a"]]),wv={class:"ipa-point"},kv=o.defineComponent({__name:"IpaPoint",props:o.mergeModels({axes:{default:()=>["x","y","z"]},unitType:{},unitMode:{type:[String,Boolean],default:"auto"},units:{},size:{default:"default"},disabled:{type:Boolean},placeholder:{default:"请输入"},min:{},max:{},step:{default:1},precision:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=o.useModel(e,"modelValue");function n(l){const u=r.value?.[l];if(u!==void 0)return u;const c=a(l);return c!==void 0?{unit:c}:0}function a(l){for(const u of t.axes){if(u===l)continue;const c=r.value?.[u];if(typeof c=="object"&&c!==null)return c.unit??""}}const s=o.computed(()=>t.axes.some(l=>{const u=r.value?.[l];return typeof u=="object"&&u!==null}));function i(l,u){r.value={...r.value,[l]:u}}return(l,u)=>(o.openBlock(),o.createElementBlock("div",wv,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.axes,c=>(o.openBlock(),o.createElementBlock("div",{key:c,class:o.normalizeClass(["ipa-point__axis",{"ipa-point__axis--narrow":!s.value}])},[o.createVNode(o.unref(qo),{"model-value":n(c),units:e.units,"unit-type":e.unitType,"unit-mode":e.unitMode,placeholder:e.placeholder,size:e.size,disabled:e.disabled,min:e.min,max:e.max,step:e.step,precision:e.precision,"onUpdate:modelValue":d=>i(c,d)},{prefix:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(c.toUpperCase()),1)]),_:2},1032,["model-value","units","unit-type","unit-mode","placeholder","size","disabled","min","max","step","precision","onUpdate:modelValue"])],2))),128))]))}}),_v=_e(kv,[["__scopeId","data-v-ec604041"]]);function Rr(e){const t={scheme:"",host:"",port:"",path:"",query:"",fragment:""};if(!e)return t;let r=e;const n=r.indexOf("#");n>=0&&(t.fragment=r.slice(n+1),r=r.slice(0,n));const a=r.indexOf("?");a>=0&&(t.query=r.slice(a+1),r=r.slice(0,a));const s=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*):\/\//);s&&(t.scheme=s[1],r=r.slice(s[0].length));const i=r.indexOf("/");let l=r;if(i>=0&&(t.path=r.slice(i),l=r.slice(0,i)),l.startsWith("[")){const u=l.indexOf("]");if(u>=0){t.host=l.slice(0,u+1);const c=l.slice(u+1);c.startsWith(":")&&(t.port=c.slice(1))}else t.host=l}else{const u=l.lastIndexOf(":");u>=0?(t.host=l.slice(0,u),t.port=l.slice(u+1)):t.host=l}return t}function Pa(e,t){const r=new Set(t);let n="";return r.has("scheme")&&e.scheme&&(n+=`${e.scheme}://`),r.has("host")&&e.host&&(n+=e.host),r.has("port")&&e.port&&(n+=`:${e.port}`),r.has("path")&&e.path&&(n+=e.path.startsWith("/")?e.path:`/${e.path}`),r.has("query")&&e.query&&(n+=`?${e.query}`),r.has("fragment")&&e.fragment&&(n+=`#${e.fragment}`),n}const $v=["http","https","ws","wss","ftp"],Iv=["80","443","8080","3000","3306","6379"],xv={class:"ipa-url"},Sv={key:1,class:"ipa-url__sep"},Nv={key:3,class:"ipa-url__sep"},Tv={key:5,class:"ipa-url__sep"},Ov={key:7,class:"ipa-url__sep"},Rv={key:9,class:"ipa-url__sep"},Av=o.defineComponent({__name:"IpaUrl",props:o.mergeModels({parts:{default:()=>["scheme","host","port","path","query","fragment"]},schemes:{default:()=>[]},ports:{default:()=>[]},disabled:{type:Boolean},size:{default:"default"},placeholder:{default:"请输入"}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=o.useModel(e,"modelValue"),n=o.ref(Rr(r.value));o.watch(r,l=>{const u=Pa(n.value,t.parts);l!==u&&(n.value=Rr(l??""))},{immediate:!0}),o.watch(n,()=>{r.value=Pa(n.value,t.parts)},{deep:!0});function a(l){const u=l.clipboardData?.getData("text")??"",c=Rr(u);c.host&&(u.includes("://")||u.includes(":"))&&(l.preventDefault(),n.value=c)}const s=o.computed(()=>[...new Set([...$v,...t.schemes])]),i=o.computed(()=>[...new Set([...Iv,...t.ports])]);return(l,u)=>(o.openBlock(),o.createElementBlock("div",xv,[e.parts.includes("scheme")?(o.openBlock(),o.createBlock(o.unref(G.ElSelect),{key:0,modelValue:n.value.scheme,"onUpdate:modelValue":u[0]||(u[0]=c=>n.value.scheme=c),class:"ipa-url__scheme",size:e.size,disabled:e.disabled,filterable:"","allow-create":"",placeholder:"scheme"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,c=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:c,label:c,value:c},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size","disabled"])):o.createCommentVNode("",!0),e.parts.includes("scheme")&&e.parts.includes("host")?(o.openBlock(),o.createElementBlock("span",Sv,"://")):o.createCommentVNode("",!0),e.parts.includes("host")?(o.openBlock(),o.createBlock(o.unref(G.ElInput),{key:2,modelValue:n.value.host,"onUpdate:modelValue":u[1]||(u[1]=c=>n.value.host=c),class:"ipa-url__host",size:e.size,disabled:e.disabled,placeholder:e.placeholder,onPaste:a},null,8,["modelValue","size","disabled","placeholder"])):o.createCommentVNode("",!0),e.parts.includes("host")&&e.parts.includes("port")?(o.openBlock(),o.createElementBlock("span",Nv,":")):o.createCommentVNode("",!0),e.parts.includes("port")?(o.openBlock(),o.createBlock(o.unref(G.ElSelect),{key:4,modelValue:n.value.port,"onUpdate:modelValue":u[2]||(u[2]=c=>n.value.port=c),class:"ipa-url__port",size:e.size,disabled:e.disabled,filterable:"","allow-create":"",placeholder:"port"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,c=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:c,label:c,value:c},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size","disabled"])):o.createCommentVNode("",!0),e.parts.includes("port")&&e.parts.includes("path")?(o.openBlock(),o.createElementBlock("span",Tv,"/")):o.createCommentVNode("",!0),e.parts.includes("path")?(o.openBlock(),o.createBlock(o.unref(G.ElInput),{key:6,modelValue:n.value.path,"onUpdate:modelValue":u[3]||(u[3]=c=>n.value.path=c),class:"ipa-url__path",size:e.size,disabled:e.disabled,placeholder:"/path"},null,8,["modelValue","size","disabled"])):o.createCommentVNode("",!0),e.parts.includes("path")&&e.parts.includes("query")?(o.openBlock(),o.createElementBlock("span",Ov,"?")):o.createCommentVNode("",!0),e.parts.includes("query")?(o.openBlock(),o.createBlock(o.unref(G.ElInput),{key:8,modelValue:n.value.query,"onUpdate:modelValue":u[4]||(u[4]=c=>n.value.query=c),class:"ipa-url__query",size:e.size,disabled:e.disabled,placeholder:"query"},null,8,["modelValue","size","disabled"])):o.createCommentVNode("",!0),e.parts.includes("query")&&e.parts.includes("fragment")?(o.openBlock(),o.createElementBlock("span",Rv,"#")):o.createCommentVNode("",!0),e.parts.includes("fragment")?(o.openBlock(),o.createBlock(o.unref(G.ElInput),{key:10,modelValue:n.value.fragment,"onUpdate:modelValue":u[5]||(u[5]=c=>n.value.fragment=c),class:"ipa-url__fragment",size:e.size,disabled:e.disabled,placeholder:"fragment"},null,8,["modelValue","size","disabled"])):o.createCommentVNode("",!0)]))}}),Cv=_e(Av,[["__scopeId","data-v-7021258e"]]);function zv(e){return[...new Set(e.split(/[\s,,;;]+/).map(t=>t.trim()).filter(Boolean))]}const Pv=["localhost","example.com","api.local",".local",".lan"],Lv={class:"ipa-host-item"},Mv=o.defineComponent({__name:"IpaHostItem",props:o.mergeModels({hostPresets:{default:()=>[]},disabled:{type:Boolean},size:{default:"default"}},{modelValue:{default:()=>({ip:"",hosts:[]})},modelModifiers:{}}),emits:["update:modelValue"],setup(e){const t=e,r=o.useModel(e,"modelValue"),n=o.ref({ip:r.value?.ip??"",hosts:[...r.value?.hosts??[]]});o.watch(r,i=>{const l={ip:i?.ip??"",hosts:[...i?.hosts??[]]};JSON.stringify(l)!==JSON.stringify(n.value)&&(n.value=l)},{immediate:!0,deep:!0}),o.watch(n,()=>{r.value={ip:n.value.ip,hosts:[...n.value.hosts]}},{deep:!0});function a(i){const l=i.clipboardData?.getData("text")??"",u=zv(l);u.length>0&&(i.preventDefault(),n.value.hosts=[...new Set([...n.value.hosts,...u])])}const s=o.computed(()=>[...new Set([...Pv,...t.hostPresets])]);return(i,l)=>(o.openBlock(),o.createElementBlock("div",Lv,[o.createVNode(o.unref(G.ElInput),{modelValue:n.value.ip,"onUpdate:modelValue":l[0]||(l[0]=u=>n.value.ip=u),class:"ipa-host-item__ip",size:e.size,disabled:e.disabled,placeholder:"IP 地址"},null,8,["modelValue","size","disabled"]),o.createVNode(o.unref(G.ElSelect),{modelValue:n.value.hosts,"onUpdate:modelValue":l[1]||(l[1]=u=>n.value.hosts=u),class:"ipa-host-item__hosts",size:e.size,disabled:e.disabled,multiple:"",filterable:"","allow-create":"",placeholder:"域名(可创建)",onPaste:a},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,u=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:u,label:u,value:u},null,8,["label","value"]))),128))]),_:1},8,["modelValue","size","disabled"])]))}}),jv=_e(Mv,[["__scopeId","data-v-dd506f3b"]]);var Bv=Object.defineProperty,Vv=e=>e;function Dv(e,t){this[e]=Vv.bind(null,t)}var hn=(e,t)=>{for(var r in t)Bv(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Dv.bind(t,r)})},Fv={};hn(Fv,{resolveCssVar:()=>Zv});function Zv(e){return e.startsWith("var(")?(e=e.slice(4,-1).trim(),getComputedStyle(document.documentElement).getPropertyValue(e).trim()):e}var Uv={};hn(Uv,{name:()=>Jv,join:()=>Gv,DEFAULT_DICT_JOIN_OPTS:()=>Gr});var qv=e=>e==null,Gr={kvDelimeter:":",entryDelimeter:`
84
- `,excludeNil:!0};function Gv(e,t=Gr){return t={...Gr,...t},Object.entries(e).filter(([r,n])=>!qv(n)||!t.excludeNil).map(([r,n])=>`${r}${t.kvDelimeter}${n}`).join(t.entryDelimeter)}function Jv(){return"dict"}var Yv={};hn(Yv,{name:()=>Xv});function Xv(){return"number"}function Wv(e){if(e instanceof Response)return{code:e.status,message:e.statusText};if(e instanceof Error)return{code:-1,message:e.message,stack:e.stack};if(typeof e=="object"&&e!==null){const t=e;return{code:t.code??-1,message:t.message??t.msg??t.errmsg??t.errorMessage??String(e)}}return typeof e=="number"?{code:e,message:String(e)}:{code:-1,message:String(e??"unknown error")}}function Hv(e){return Wv(e).message}const Kv={class:"mb-2 flex items-center"},Qv={class:"ml-auto flex gap-2 items-center"},eg={class:"flex flex-1 flex-col min-h-0 overflow-y-auto"},tg={key:0,class:"mt-2 flex justify-center"},rg={key:1},ng=o.defineComponent({inheritAttrs:!1,__name:"IpaCollection",props:o.mergeModels({service:{},condition:{},pagination:{type:Boolean,default:!0},autoLoad:{type:Boolean,default:!0},hidePaginationOnEmpty:{type:Boolean,default:!0},showRefresh:{type:Boolean,default:!0},pagerProps:{},modes:{},persist:{type:[Boolean,Object],default:!1}},{mode:{default:"default"},modeModifiers:{},modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:mode","update:modelValue"],setup(e,{expose:t}){const r=Ya(),n=e,a=o.useModel(e,"mode"),s=Zo(n.persist?Fo(n.persist):""),i=o.ref({pageBase:n.pagerProps?.pageBase??1,pageAt:n.pagerProps?.pageBase??1,pageSize:n.pagerProps?.pageSize??s.value??20}),l=o.computed(()=>i.value.total??0),u=o.computed(()=>{const{pageBase:y,pageSize:w,...$}=n.pagerProps??{};return $}),c=o.useModel(e,"modelValue"),d=o.ref(!1),m=o.ref(null);async function p(){if(n.service){d.value=!0,m.value=null;try{if(n.pagination&&n.service.readByPage){const y=await n.service.readByPage(i.value,n.condition);c.value=y?.items??[],i.value={...i.value,total:y?.total??0}}else if(n.service.readAll){const y=await n.service.readAll(n.condition);c.value=y??[],i.value={...i.value,total:c.value.length}}}catch(y){console.error("[IpaCollection] fetchData error:",y),m.value=y}finally{d.value=!1}}}function f(){p()}function v(y,w){return i.value={...i.value,pageAt:n.pagerProps?.pageBase??1},p()}function h(){v()}return t({refresh:f,reset:h}),o.watch(()=>n.autoLoad,()=>{n.autoLoad?p():c.value&&c.value.length>0&&(i.value={...i.value,total:c.value.length})},{immediate:!0}),o.watch(()=>n.condition,()=>{i.value={...i.value,pageAt:n.pagerProps?.pageBase??1},p()}),(y,w)=>(o.openBlock(),o.createElementBlock("div",o.mergeProps({class:"flex flex-col"},y.$attrs),[o.createElementVNode("div",Kv,[o.renderSlot(y.$slots,"header"),o.createElementVNode("div",Qv,[e.modes.length>1?(o.openBlock(),o.createBlock(o.unref(G.ElButtonGroup),{key:0},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.modes,$=>(o.openBlock(),o.createBlock(o.unref(G.ElButton),{key:$.key,type:a.value===$.key?"primary":"default",size:"small",onClick:g=>a.value=$.key},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString($.label),1)]),_:2},1032,["type","onClick"]))),128))]),_:1})):o.createCommentVNode("",!0),e.showRefresh?(o.openBlock(),o.createBlock(o.unref(G.ElTooltip),{key:1,placement:"left",content:o.unref(r)("refresh")},{default:o.withCtx(()=>[o.createVNode(o.unref(G.ElIcon),{size:"18",color:"var(--el-color-primary)",onClick:w[0]||(w[0]=$=>f())},{default:o.withCtx(()=>[o.createVNode(o.unref(ut.Refresh))]),_:1})]),_:1},8,["content"])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",eg,[o.renderSlot(y.$slots,a.value,{data:c.value,total:l.value,loading:d.value,error:m.value})]),e.pagination&&!(n.hidePaginationOnEmpty&&c.value.length===0)?(o.openBlock(),o.createElementBlock("div",tg,[o.createVNode(o.unref(Uo),o.mergeProps({modelValue:i.value,"onUpdate:modelValue":w[1]||(w[1]=$=>i.value=$)},u.value,{persist:e.persist,onChange:p}),null,16,["modelValue","persist"])])):o.createCommentVNode("",!0),y.$slots.footer?(o.openBlock(),o.createElementBlock("div",rg,[o.renderSlot(y.$slots,"footer")])):o.createCommentVNode("",!0)],16))}}),Ye=o.reactive({}),La={};function ag(e){let t=La[e];return t||(t=o.reactive({}),La[e]=t),t}const Go="ipa-ai-tool-states";function Jo(e){try{const t=localStorage.getItem(`${Go}:${e}`);return t?JSON.parse(t):{}}catch{return{}}}function Ma(e,t,r){try{const n=Jo(e);n[t]=r,localStorage.setItem(`${Go}:${e}`,JSON.stringify(n))}catch{}}function Yo(e){const t=ag(e),r=Jo(e);function n(p){return p?.global?Ye:t}function a(p,f,v,h){const y=n(h),w=y[p],$=h?.disabled??w?.disabled,g=h?.needsApproval??w?.needsApproval,O=h?.needsApproval??w?._origNeedsApproval,S=r[p];y[p]={handler:f,definition:v??w?.definition??{description:"",inputSchema:{}},disabled:S?.disabled??$,needsApproval:S?.needsApproval??g,_origNeedsApproval:O}}function s(p,f){const v=n(f);delete v[p]}function i(p){return t[p]??Ye[p]??null}const l=o.computed(()=>async p=>{const f=t[p.toolName]??Ye[p.toolName];if(!f)return{};if(f.disabled)return{success:!1,error:`工具「${p.toolName}」已被禁用且无法恢复,请勿重试,通过其他方式实现用户需求`};try{return await f.handler(p.args)}catch(v){const h=Hv(v?.data?.error??v?.data??v);return{success:!1,error:`工具「${p.toolName}」调用失败: ${h}`}}}),u=o.computed(()=>{const p={};for(const[f,v]of Object.entries(Ye))v.disabled||(p[f]=v.definition);for(const[f,v]of Object.entries(t))v.disabled||(p[f]=v.definition);return p}),c=o.computed(()=>{const p={};for(const[f,v]of Object.entries(Ye))p[f]=v;for(const[f,v]of Object.entries(t))p[f]=v;return p});function d(p){const f=t[p]??Ye[p];f&&(f.disabled=!f.disabled,Ma(e,p,{disabled:f.disabled}))}function m(p,f){const v=t[p]??Ye[p];v&&(v.needsApproval=f?v._origNeedsApproval??!0:!1,Ma(e,p,{disabled:v.disabled,needsApproval:typeof v.needsApproval=="function"?void 0:v.needsApproval}))}return{handler:l,registerTool:a,unregisterTool:s,getTool:i,tools:u,toolStates:c,toggleTool:d,setToolApproval:m}}const ja="__ungrouped__",sg=o.defineComponent({name:"IpaAiToolPanel",__name:"IpaAiToolPanel",props:{tools:{},detailVisible:{type:Boolean,default:!1}},emits:["toggle","setApproval"],setup(e,{emit:t}){const r=e,n=t,a=o.computed(()=>Object.entries(r.tools).map(([u,c])=>({id:u,name:u,tool:c,group:c.definition.group??ja}))),s=o.computed(()=>[...new Set(a.value.map(c=>c.group))].map(c=>({id:c,label:c===ja?"未分组":c})).toSorted());function i(u){return u===void 0?!1:typeof u=="function"?!0:u}function l(u){try{return JSON.stringify(u,null,2)}catch{return String(u)}}return(u,c)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(u.$style.panel+" p-10px")},[a.value.length===0?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(u.$style.empty)},"暂无可用工具",2)):(o.openBlock(),o.createBlock(o.unref(Do),{key:1,items:a.value,"onUpdate:items":c[0]||(c[0]=d=>a.value=d),"group-by":d=>[d.group],groups:s.value,columns:1,gap:8,class:"pt-2 flex-1 overflow-y-auto",collapsible:!0},{item:o.withCtx(({item:d})=>[o.createElementVNode("div",{class:o.normalizeClass([u.$style.item,d.tool.disabled&&u.$style.disabled])},[o.createElementVNode("div",{class:o.normalizeClass(u.$style.itemHeader)},[o.createElementVNode("span",{class:o.normalizeClass(u.$style.toolName)},o.toDisplayString(d.name),3),o.createVNode(o.unref(G.ElSwitch),{"model-value":!d.tool.disabled,size:"small",onClick:m=>n("toggle",d.name)},null,8,["model-value","onClick"])],2),o.createElementVNode("div",{class:o.normalizeClass(u.$style.description)},o.toDisplayString(d.tool.definition.description),3),o.createElementVNode("div",{class:o.normalizeClass(u.$style.actions)},[o.createVNode(o.unref(G.ElTag),{type:i(d.tool.needsApproval)?"warning":"info",size:"small",style:{cursor:"pointer"},onClick:m=>n("setApproval",d.name,!i(d.tool.needsApproval))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i(d.tool.needsApproval)?"需审批":"自动执行"),1)]),_:2},1032,["type","onClick"])],2),r.detailVisible?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(u.$style.detail)},[o.createElementVNode("pre",{class:o.normalizeClass(u.$style.code)},o.toDisplayString(l(d.tool.definition.inputSchema)),3)],2)):o.createCommentVNode("",!0)],2)]),_:1},8,["items","group-by","groups"]))],2))}}),og="_panel_1wtgy_2",ig="_header_1wtgy_11",lg="_empty_1wtgy_19",ug="_item_1wtgy_28",cg="_disabled_1wtgy_35",dg="_itemHeader_1wtgy_39",pg="_toolName_1wtgy_46",fg="_description_1wtgy_50",mg="_actions_1wtgy_57",hg="_detail_1wtgy_63",vg="_code_1wtgy_67",gg={panel:og,header:ig,empty:lg,item:ug,disabled:cg,itemHeader:dg,toolName:pg,description:fg,actions:mg,detail:hg,code:vg},yg={$style:gg},Eg=_e(sg,[["__cssModules",yg]]);function Jr(e){if(e==null)return"";try{return JSON.stringify(e,null,2)}catch{return String(e)}}const bg=o.defineComponent({name:"IpaAiToolCallCard",__name:"IpaAiToolCallCard",props:{toolName:{},args:{},status:{default:"calling"},result:{},error:{}},setup(e){const t=e,r=o.computed(()=>t.status==="calling"?"⏳":t.status==="success"?"✅":"❌"),n=o.computed(()=>t.status==="calling"?"调用中...":t.status==="success"?"调用完成":"调用失败"),a=o.computed(()=>Jr(t.args)),s=o.computed(()=>Jr(t.result));return(i,l)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass([i.$style.card,e.status==="error"?i.$style.cardError:i.$style.cardDefault])},[o.createElementVNode("div",{class:o.normalizeClass(i.$style.header)},[o.createElementVNode("span",{class:o.normalizeClass([i.$style.icon,e.status==="calling"&&i.$style.spin])},o.toDisplayString(r.value),3),o.createElementVNode("span",{class:o.normalizeClass(i.$style.toolName)},o.toDisplayString(e.toolName),3),o.createElementVNode("span",{class:o.normalizeClass(i.$style.statusLabel)},o.toDisplayString(n.value),3)],2),a.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(i.$style.section)},[o.createElementVNode("div",{class:o.normalizeClass(i.$style.sectionTitle)},"参数",2),o.createElementVNode("pre",{class:o.normalizeClass(i.$style.code)},o.toDisplayString(a.value),3)],2)):o.createCommentVNode("",!0),e.status==="error"&&e.error?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass([i.$style.section,i.$style.sectionError])},[o.createElementVNode("div",{class:o.normalizeClass(i.$style.sectionTitle)},"错误信息",2),o.createElementVNode("div",{class:o.normalizeClass(i.$style.errorText)},o.toDisplayString(e.error),3)],2)):o.createCommentVNode("",!0),e.status==="success"&&s.value?(o.openBlock(),o.createElementBlock("div",{key:2,class:o.normalizeClass(i.$style.section)},[o.createElementVNode("div",{class:o.normalizeClass(i.$style.sectionTitle)},"结果",2),o.createElementVNode("pre",{class:o.normalizeClass(i.$style.code)},o.toDisplayString(s.value),3)],2)):o.createCommentVNode("",!0)],2))}}),wg="_card_lrk9b_2",kg="_cardDefault_lrk9b_10",_g="_cardError_lrk9b_15",$g="_header_lrk9b_20",Ig="_icon_lrk9b_26",xg="_spin_lrk9b_31",Sg="_toolName_lrk9b_44",Ng="_statusLabel_lrk9b_49",Tg="_section_lrk9b_55",Og="_sectionError_lrk9b_61",Rg="_sectionTitle_lrk9b_65",Ag="_code_lrk9b_71",Cg="_errorText_lrk9b_84",zg={card:wg,cardDefault:kg,cardError:_g,header:$g,icon:Ig,spin:xg,toolName:Sg,statusLabel:Ng,section:Tg,sectionError:Og,sectionTitle:Rg,code:Ag,errorText:Cg},Pg={$style:zg},Lg=_e(bg,[["__cssModules",Pg]]),Mg={class:"ipa-ai-provider-select"},jg={class:"field"},Bg={class:"field"},Vg={class:"field"},Dg=o.defineComponent({__name:"IpaAiProviderSelect",props:{providers:{},provider:{},model:{},apiKey:{}},emits:["update:provider","update:model","update:apiKey"],setup(e,{emit:t}){const r=e,n=t,a=o.computed(()=>r.provider.models);function s(u){const c=r.providers.find(d=>d.type===u);c&&c!==r.provider&&(n("update:provider",c),n("update:model",c.defaultModel))}function i(u){n("update:model",u)}function l(u){n("update:apiKey",u)}return(u,c)=>(o.openBlock(),o.createElementBlock("div",Mg,[o.createElementVNode("div",jg,[c[0]||(c[0]=o.createElementVNode("label",{class:"label"},"提供商",-1)),o.createVNode(o.unref(G.ElSelect),{"model-value":e.provider.type,"onUpdate:modelValue":s,size:"small","fit-input-width":"",teleported:!1},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.providers,d=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:d.type,label:d.label,value:d.type},null,8,["label","value"]))),128))]),_:1},8,["model-value"])]),o.createElementVNode("div",Bg,[c[1]||(c[1]=o.createElementVNode("label",{class:"label"},"模型",-1)),o.createVNode(o.unref(G.ElSelect),{"model-value":e.model,"onUpdate:modelValue":i,size:"small","fit-input-width":"",teleported:!1},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,d=>(o.openBlock(),o.createBlock(o.unref(G.ElOption),{key:d,label:d,value:d},null,8,["label","value"]))),128))]),_:1},8,["model-value"])]),o.createElementVNode("div",Vg,[c[2]||(c[2]=o.createElementVNode("label",{class:"label"},"API Key",-1)),o.createVNode(o.unref(G.ElInput),{"model-value":e.apiKey,"onUpdate:modelValue":l,size:"small",type:"password","show-password":"",placeholder:"留空则使用预设 key"},null,8,["model-value"])])]))}}),Fg=_e(Dg,[["__scopeId","data-v-f4ede2c6"]]);var Xo=[{id:"ollama",type:"ollama",label:"Ollama 本地",baseUrl:"http://localhost:11434/v1",defaultModels:["qwen2.5-coder:0.5b","qwen2.5:1.5b","llama3.2:3b"]},{id:"openai",type:"openai",label:"OpenAI",baseUrl:"https://api.openai.com/v1",defaultModels:["gpt-4o-mini","gpt-4o"]},{id:"deepseek",type:"deepseek",label:"DeepSeek",baseUrl:"https://api.deepseek.com/v1",defaultModels:["deepseek-chat","deepseek-reasoner"]},{id:"openrouter",type:"openrouter",label:"OpenRouter",baseUrl:"https://openrouter.ai/api/v1",defaultModels:["openai/gpt-4o-mini","anthropic/claude-3.5-sonnet","google/gemini-2.0-flash-001"]},{id:"qwen",type:"qwen",label:"通义千问",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode/v1",defaultModels:["qwen-plus","qwen-max"]},{id:"kimi",type:"kimi",label:"Kimi",baseUrl:"https://api.moonshot.cn/v1",defaultModels:["kimi-k2-0711-preview"]}];function Zg(e,t){const r=typeof e=="string"?Xo.find(a=>a.id===e||a.type===e):e;if(!r)throw new Error(`Unknown provider preset: ${e}`);const n=r.defaultModels;return{id:r.id,type:r.type??r.id,label:r.label,baseUrl:r.baseUrl,models:n,defaultModel:n[0]}}function Ug(){return Xo.map(e=>Zg(e))}const qg=["onClick"],Gg=o.defineComponent({name:"IpaAiToolApprovalCard",__name:"IpaAiToolApprovalCard",props:{pendingToolCalls:{}},emits:["update:pendingToolCalls","approve","reject","cancel"],setup(e,{emit:t}){const r=e,n=t,a=o.ref(new Set),s=o.computed(()=>r.pendingToolCalls.filter(f=>f.selected).length),i=o.computed(()=>r.pendingToolCalls.length>0&&r.pendingToolCalls.every(f=>f.selected)),l=o.computed(()=>r.pendingToolCalls.every(f=>!f.selected));function u(f){const v=r.pendingToolCalls.map(h=>h.id===f?{...h,selected:!h.selected}:h);n("update:pendingToolCalls",v)}function c(){const f=r.pendingToolCalls.map(v=>({...v,selected:!0}));n("update:pendingToolCalls",f)}function d(){const f=r.pendingToolCalls.map(v=>({...v,selected:!1}));n("update:pendingToolCalls",f)}function m(f){a.value.has(f)?a.value.delete(f):a.value.add(f)}const p=o.computed(()=>r.pendingToolCalls.map(f=>{const v=Jr(f.args);return{item:f,argsText:v,hasArgs:v.length>0,short:v.length<=80}}));return(f,v)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(f.$style.card)},[o.createElementVNode("div",{class:o.normalizeClass(f.$style.header)},[o.createElementVNode("div",{class:o.normalizeClass(f.$style.headerLeft)},[o.createVNode(o.unref(Xe.Icon),{icon:"mdi:shield-alert",class:o.normalizeClass(f.$style.headerIcon)},null,8,["class"]),o.createElementVNode("span",{class:o.normalizeClass(f.$style.headerTitle)},"工具执行审批",2),o.createElementVNode("span",{class:o.normalizeClass(f.$style.count)},o.toDisplayString(s.value)+"/"+o.toDisplayString(e.pendingToolCalls.length),3)],2),o.createElementVNode("button",{class:o.normalizeClass(f.$style.cancelBtn),onClick:v[0]||(v[0]=h=>n("cancel")),title:"终止本轮执行"},[o.createVNode(o.unref(Xe.Icon),{icon:"mdi:stop-circle-outline",width:"14",height:"14"}),v[3]||(v[3]=o.createElementVNode("span",null,"终止本轮",-1))],2)],2),o.createElementVNode("div",{class:o.normalizeClass(f.$style.list)},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,h=>(o.openBlock(),o.createElementBlock("div",{key:h.item.id,class:o.normalizeClass(f.$style.item)},[o.createVNode(o.unref(G.ElCheckbox),{"model-value":h.item.selected,onChange:y=>u(h.item.id),class:o.normalizeClass(f.$style.checkbox)},null,8,["model-value","onChange","class"]),o.createElementVNode("div",{class:o.normalizeClass(f.$style.content)},[o.createElementVNode("div",{class:o.normalizeClass(f.$style.contentHead)},[o.createElementVNode("span",{class:o.normalizeClass(f.$style.toolName)},o.toDisplayString(h.item.toolName),3),h.hasArgs?h.short?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass(f.$style.argsInline)},o.toDisplayString(h.argsText),3)):(o.openBlock(),o.createElementBlock("button",{key:2,class:o.normalizeClass(f.$style.expandBtn),onClick:y=>m(h.item.id)},[o.createVNode(o.unref(Xe.Icon),{icon:a.value.has(h.item.id)?"mdi:chevron-up":"mdi:chevron-down",width:"14",height:"14"},null,8,["icon"]),v[4]||(v[4]=o.createElementVNode("span",null,"参数详情",-1))],10,qg)):(o.openBlock(),o.createElementBlock("span",{key:0,class:o.normalizeClass(f.$style.noArgs)},"(无参数)",2))],2),!h.short&&a.value.has(h.item.id)?(o.openBlock(),o.createElementBlock("pre",{key:0,class:o.normalizeClass(f.$style.argsCode)},o.toDisplayString(h.argsText),3)):o.createCommentVNode("",!0)],2)],2))),128))],2),o.createElementVNode("div",{class:o.normalizeClass(f.$style.footer)},[o.createElementVNode("div",{class:o.normalizeClass(f.$style.footerLeft)},[o.createVNode(o.unref(G.ElButton),{size:"small",text:"",onClick:c,disabled:i.value},{default:o.withCtx(()=>[...v[5]||(v[5]=[o.createTextVNode(" 全选 ",-1)])]),_:1},8,["disabled"]),o.createVNode(o.unref(G.ElButton),{size:"small",text:"",onClick:d,disabled:l.value},{default:o.withCtx(()=>[...v[6]||(v[6]=[o.createTextVNode(" 全不选 ",-1)])]),_:1},8,["disabled"])],2),o.createElementVNode("div",{class:o.normalizeClass(f.$style.footerRight)},[o.createVNode(o.unref(G.ElButton),{size:"small",onClick:v[1]||(v[1]=h=>n("reject")),disabled:l.value},{default:o.withCtx(()=>[...v[7]||(v[7]=[o.createTextVNode(" 拒绝所选 ",-1)])]),_:1},8,["disabled"]),o.createVNode(o.unref(G.ElButton),{size:"small",type:"primary",onClick:v[2]||(v[2]=h=>n("approve")),disabled:l.value},{default:o.withCtx(()=>[...v[8]||(v[8]=[o.createTextVNode(" 允许所选 ",-1)])]),_:1},8,["disabled"])],2)],2)],2))}}),Jg="_card_ycubi_2",Yg="_header_ycubi_10",Xg="_headerLeft_ycubi_19",Wg="_headerIcon_ycubi_25",Hg="_headerTitle_ycubi_30",Kg="_count_ycubi_36",Qg="_cancelBtn_ycubi_42",ey="_list_ycubi_59",ty="_item_ycubi_66",ry="_checkbox_ycubi_76",ny="_content_ycubi_81",ay="_contentHead_ycubi_86",sy="_toolName_ycubi_93",oy="_noArgs_ycubi_101",iy="_argsInline_ycubi_106",ly="_expandBtn_ycubi_113",uy="_argsCode_ycubi_125",cy="_footer_ycubi_138",dy="_footerLeft_ycubi_147",py="_footerRight_ycubi_152",fy={card:Jg,header:Yg,headerLeft:Xg,headerIcon:Wg,headerTitle:Hg,count:Kg,cancelBtn:Qg,list:ey,item:ty,checkbox:ry,content:ny,contentHead:ay,toolName:sy,noArgs:oy,argsInline:iy,expandBtn:ly,argsCode:uy,footer:cy,footerLeft:dy,footerRight:py},my={$style:fy},Wo=_e(Gg,[["__cssModules",my]]),hy={class:o.normalizeClass(["flex","items-center","gap-1"])},vy={style:{padding:"12px",overflow:"visible"}},gy={class:"py-2 flex items-center justify-center"},yy={class:"flex flex-col h-full overflow-hidden"},Ey={class:"p-2 flex flex-1 flex-col overflow-y-auto"},by={key:2,class:"text-sm text-[var(--el-color-danger)]"},wy=50,ky=o.defineComponent({name:"IpaAiPanel",__name:"IpaAiPanel",props:o.mergeModels({appId:{},api:{},storage:{},storagePrefix:{},onToolCall:{},systemPrompt:{},tools:{},title:{default:"AI 助手"},icon:{default:"🤖"},placeholder:{default:"输入消息..."},componentProps:{},mode:{default:"dock"},draggable:{type:Boolean,default:!0},toolPanelDetailVisible:{type:Boolean,default:!1},providers:{},provider:{},model:{},providerSwitchable:{type:Boolean,default:!1},showBuiltinProviders:{type:Boolean,default:!0},transport:{},fetchOptions:{}},{visible:{type:Boolean,default:!1},visibleModifiers:{},toolPanelVisible:{type:Boolean,default:!0},toolPanelVisibleModifiers:{}}),emits:o.mergeModels(["update:provider","update:model"],["update:visible","update:toolPanelVisible"]),setup(e,{emit:t}){const r=e,n=o.useModel(e,"visible"),a=o.useModel(e,"toolPanelVisible"),s=t,i=r.appId,l=r.storagePrefix??`${i}-ai-`,{handler:u,getTool:c,tools:d,toolStates:m,toggleTool:p,setToolApproval:f}=Yo(i),v=o.computed(()=>r.onToolCall??u.value),h=o.shallowRef([]),y=o.ref(!1),w=new Map;let $=[],g=null;const O=()=>globalThis.crypto?.randomUUID?.()??`id_${Date.now()}_${Math.random().toString(36).slice(2)}`;function S(P,q="用户取消了该操作"){w.get(P)?.({cancelled:!0,message:q}),w.delete(P)}function _(){g=null;const P=$;if($=[],P.length===0)return;const q=[];for(const{tc:J,resolve:Ie}of P){const ge={id:O(),toolName:J.toolName,args:J.args,selected:!0};q.push(ge),w.set(ge.id,Ie)}h.value=[...h.value,...q]}async function E(P){const q=kn.value,J=c(P.toolName),Ie=J?.needsApproval?typeof J.needsApproval=="function"?await J.needsApproval(P.args):J.needsApproval:!1;if(q!==kn.value)return{cancelled:!0,message:"响应已终止"};if(!Ie){const ge=v.value;return ge?ge(P):{}}return y.value?{cancelled:!0,message:"用户终止了本轮操作"}:new Promise(ge=>{$.push({tc:P,resolve:ge}),g||(g=setTimeout(_,wy))})}async function k(){const P=h.value.filter(J=>J.selected),q=h.value.filter(J=>!J.selected);for(const J of q)S(J.id);h.value=[];for(const J of P){const Ie=w.get(J.id);if(Ie){w.delete(J.id);try{const ge=await v.value({toolName:J.toolName,args:J.args});Ie(ge)}catch(ge){const Et=ge?.data?.error?.message??ge?.message??"工具调用失败";Ie({success:!1,error:Et})}}}}function N(){for(const P of h.value)S(P.id);h.value=[]}function I(){if(y.value=!0,g){clearTimeout(g),g=null;for(const{resolve:P}of $)P({cancelled:!0,message:"用户终止了本轮操作"});$=[]}for(const P of Array.from(w.keys()))S(P,"用户终止了本轮操作");h.value=[],ni()}o.onUnmounted(()=>I());const ne=o.computed(()=>({...d.value,...r.tools})),V=o.computed(()=>r.providers?.length?r.providers:r.showBuiltinProviders?Ug().map(P=>({...P,type:P.type??P.id,models:P.models??[],defaultModel:P.defaultModel??P.models[0]??""})):[]),X=o.computed(()=>`${i}-ai-provider`),j=o.computed(()=>`${i}-ai-api-keys`),U=Me.useStorage(X,{type:"",model:""}),Q=Me.useStorage(j,{});function me(){if(U.value.type)return V.value.find(P=>P.type===U.value.type)}function Ne(P){if(U.value.model&&P.models.includes(U.value.model))return U.value.model}function x(P){const q=Q.value[P.type];return q?{...P,apiKey:q}:P}const b=o.computed({get(){const P=me()??r.provider??V.value[0];return P&&x(P)},set(P){if(P){const q=U.value.model&&P.models.includes(U.value.model)?U.value.model:P.defaultModel;U.value={type:P.type,model:q}}s("update:provider",P)}}),A=o.computed({get(){const P=b.value;return P?Ne(P)??r.model??P.defaultModel:""},set(P){const q=b.value;P&&q&&(U.value={type:q.type,model:P}),s("update:model",P)}}),C=o.computed(()=>{const P=b.value;return P?Q.value[P.type]??"":""});function L(P){const q=b.value;q&&(Q.value={...Q.value,[q.type]:P})}o.onMounted(()=>{if(U.value.type&&U.value.type!==r.provider?.type){const P=me();P&&s("update:provider",P),U.value.model&&s("update:model",U.value.model)}});const{sessions:R,activeId:z,messages:D,status:B,error:F,createSession:ee,renameSession:ae,deleteSession:$e,switchSession:ti,sendMessage:ri,abort:ni,responseEpoch:kn}=ah({provider:b,model:A,api:r.api,transport:r.transport,fetchOptions:r.fetchOptions,storage:r.storage,storagePrefix:l,systemPrompt:r.systemPrompt,tools:ne,onToolCall:E}),_n=o.ref(),Mt=o.ref(),rt=o.ref(),{isFullscreen:gt,toggle:ai}=Me.useFullscreen(rt);function si(){ai()}function oi(){n.value=!n.value}o.watch(n,P=>{P&&o.nextTick(()=>{Mt.value?.focus?.("last")})});const ii=[{label:"重命名",key:"rename",command:"rename"},{label:"删除",key:"delete",command:"delete",divided:!0}];async function li(P,q){if(P==="rename")try{const{value:J}=await G.ElMessageBox.prompt("请输入新名称","重命名");J&&ae(q.id,J)}catch{}else if(P==="delete")try{await G.ElMessageBox.confirm("确定删除该会话?","删除"),await $e(q.id)}catch{}}function ui(){ee()}function ci(){const q=Mt.value?.getModelValue?.()?.text??"";q.trim()&&(y.value=!1,ri(q),o.nextTick(()=>Mt.value?.clear?.()))}const nt=o.shallowRef([]),yr=o.ref(""),Er=o.ref("start");o.watch(D,P=>{const q=[],J=new Map;let Ie="",ge;for(const Et of P??[]){const gi=Et.parts??[];for(const de of gi)if(de.type==="reasoning")Ie=de.text??"",ge=de.state,de.state==="done"&&Ie.trim()&&q.push({type:"reasoning",content:Ie,status:"end"});else if(de.type==="text"&&de.text?.trim())q.push({content:de.text,role:Et.role==="assistant"?"ai":"user",placement:Et.role==="assistant"?"start":"end",variant:"filled",shape:"corner"});else if(de.type==="tool-call"||de.type==="tool_use"){const jt=de.toolCallId??de.id,qe={type:"tool-call",id:jt,toolName:de.toolName??de.name,args:de.input??de.args,status:"calling"};q.push(qe),J.set(jt,qe)}else if(de.type==="tool-result"||de.type==="tool_result"){const jt=de.toolCallId??de.toolUseId,qe=J.get(jt);if(qe){const Ve=de.result??de.output??de.content,xn=Ve&&typeof Ve=="object"&&"error"in Ve?Ve.error:void 0,Sn=de.isError||!!xn||Ve&&typeof Ve=="object"&&Ve.success===!1;qe.status=Sn?"error":"success",qe.result=Ve,qe.error=xn||de.error||(Sn?"调用失败":void 0)}}}nt.value=q,yr.value=Ie||"",Ie&&(Er.value=ge==="done"?"end":"thinking")},{immediate:!0,deep:!0}),o.watch(F,P=>{if(P){console.error("[IpaAiPanel] API 请求失败:",P);const q=P.message||"AI 服务出错:未知错误",J=nt.value[nt.value.length-1];if(J?.type==="error"&&J.content===q)return;nt.value=[...nt.value,{type:"error",content:q}]}}),Me.onClickOutside(rt,P=>{r.mode!=="dock"||P.target.closest(".el-overlay, .el-overlay-dialog, .el-message-box__wrapper, .el-popper")||n.value&&(n.value=!1)},{ignore:[_n]});const $n=o.useTemplateRef("btnRef"),{style:di,isDragging:pi}=Me.useDraggable($n,{initialValue:{x:window.innerWidth-64,y:window.innerHeight-64},disabled:o.computed(()=>!r.draggable||r.mode!=="dock"||gt.value)}),In=o.useTemplateRef("headerRef"),fi=o.computed(()=>{const P=a.value?1040:800;return{x:(window.innerWidth-P)/2,y:Math.max(24,(window.innerHeight-720)/2)}}),{style:mi,isDragging:hi}=Me.useDraggable(rt,{initialValue:fi,handle:In,disabled:o.computed(()=>!r.draggable||gt.value)}),vi=o.computed(()=>({title:"您好!",description:"我是您的 AI 助手,请问有什么可以帮你的?",...r.componentProps?.welcome})),yt=o.ref(a.value?"1040px":"800px"),br=o.ref(!1);return Me.useResizeObserver(rt,()=>{if(br.value)return;const P=rt.value;if(P){const q=P.offsetWidth;q>0&&(yt.value=`${q}px`)}}),o.watch(a,P=>{const q=parseFloat(yt.value)||800;br.value=!0,yt.value=`${Math.max(P?q+240:q-240,480)}px`,o.nextTick(()=>{br.value=!1})}),(P,q)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"containerRef",ref:_n,class:o.normalizeClass(["z-1000",e.mode==="dock"?e.draggable?["fixed"]:["fixed","bottom-6","right-6"]:["fixed","inset-0","flex","items-center","justify-center"]]),style:o.normalizeStyle(e.mode==="modal"&&!n.value?{pointerEvents:"none"}:void 0)},[e.mode==="dock"?(o.openBlock(),o.createElementBlock("button",{key:0,ref_key:"btnRef",ref:$n,style:o.normalizeStyle(e.draggable?[o.unref(di),{zIndex:o.unref(pi)?100000002:1e7}]:void 0),class:o.normalizeClass(["w-10","h-10","rounded-full","flex","items-center","justify-center",e.draggable?"fixed":null,P.$style.floatBtn]),onClick:oi},o.toDisplayString(e.icon),7)):o.createCommentVNode("",!0),o.createVNode(o.Transition,{name:"panel-fade"},{default:o.withCtx(()=>[e.mode==="modal"&&n.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"bg-[rgba(0,0,0,0.5)] inset-0 absolute",onClick:q[0]||(q[0]=J=>n.value=!1)})):o.createCommentVNode("",!0)]),_:1}),o.createVNode(o.Transition,{name:e.mode==="dock"?"panel-slide":"panel-fade"},{default:o.withCtx(()=>[n.value?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"panelRef",ref:rt,class:o.normalizeClass(["h-180","flex","flex-col","overflow-hidden",P.$style.panel,o.unref(gt)&&P.$style.panelMaximized,e.draggable?["fixed"]:e.mode==="dock"?["fixed","inset-0","m-auto"]:["relative"]]),style:o.normalizeStyle(e.draggable?[{width:yt.value},o.unref(mi),{zIndex:o.unref(hi)?10000002:1e6}]:{width:yt.value})},[o.createElementVNode("div",{class:o.normalizeClass(["flex","items-center","justify-between","px-4","py-3",P.$style.header]),ref_key:"headerRef",ref:In},[o.createElementVNode("span",null,o.toDisplayString(e.title),1),o.createElementVNode("div",hy,[o.renderSlot(P.$slots,"header-actions",{},void 0,!0),V.value.length&&e.providerSwitchable?(o.openBlock(),o.createBlock(o.unref(G.ElPopover),{key:0,trigger:"click",placement:"bottom-end",width:260,"popper-style":"overflow: visible"},{reference:o.withCtx(()=>[o.createElementVNode("button",{class:o.normalizeClass(["w-6","h-6","flex","items-center","justify-center",P.$style.iconBtn]),title:"设置"},[o.createVNode(o.unref(Xe.Icon),{icon:"mdi:cog",width:"18",height:"18"})],2)]),default:o.withCtx(()=>[o.createElementVNode("div",vy,[o.createVNode(Fg,{providers:V.value,provider:b.value,model:A.value,"api-key":C.value,"onUpdate:provider":q[1]||(q[1]=J=>b.value=J),"onUpdate:model":q[2]||(q[2]=J=>A.value=J),"onUpdate:apiKey":L},null,8,["providers","provider","model","api-key"])])]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("button",{class:o.normalizeClass(["w-6","h-6","flex","items-center","justify-center",P.$style.iconBtn]),onClick:q[3]||(q[3]=J=>a.value=!a.value),title:"工具面板"},[o.createVNode(o.unref(Xe.Icon),{icon:"mdi:toolbox",width:"18",height:"18"})],2),o.createElementVNode("button",{class:o.normalizeClass(["w-6","h-6","flex","items-center","justify-center",P.$style.iconBtn]),onClick:si},[o.createVNode(o.unref(Xe.Icon),{icon:o.unref(gt)?"mdi:fullscreen-exit":"mdi:fullscreen",width:"18",height:"18"},null,8,["icon"])],2),o.createElementVNode("button",{class:o.normalizeClass(["w-6","h-6","flex","items-center","justify-center",P.$style.iconBtn]),onClick:q[4]||(q[4]=J=>n.value=!1)},[o.createVNode(o.unref(Xe.Icon),{icon:"mdi:close",width:"18",height:"18"})],2)])],2),o.createVNode(o.unref(G.ElSplitter),{layout:"horizontal",class:"flex-1 overflow-hidden"},{default:o.withCtx(()=>[o.createVNode(o.unref(G.ElSplitterPanel),{size:160,min:120,max:o.unref(gt)?240:160},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["flex flex-col h-full overflow-y-auto",P.$style.sidebar])},[o.createVNode(o.unref(at.Conversations),o.mergeProps(e.componentProps?.conversations,{items:o.unref(R),active:o.unref(z),menu:ii,"show-built-in-menu":!0,"row-key":"id","label-key":"name","onUpdate:active":q[5]||(q[5]=J=>o.unref(ti)(J)),onMenuCommand:li}),{header:o.withCtx(()=>[o.createElementVNode("div",gy,[o.createVNode(o.unref(G.ElButton),{text:"",size:"small",onClick:ui},{default:o.withCtx(()=>[...q[7]||(q[7]=[o.createTextVNode("+ 新会话",-1)])]),_:1})])]),_:1},16,["items","active"])],2)]),_:1},8,["max"]),o.createVNode(o.unref(G.ElSplitterPanel),{min:400},{default:o.withCtx(()=>[o.createElementVNode("div",yy,[o.createElementVNode("div",Ey,[o.unref(D).length===0&&o.unref(B)!=="streaming"?(o.openBlock(),o.createBlock(o.unref(at.Welcome),o.normalizeProps(o.mergeProps({key:0},vi.value)),null,16)):(o.openBlock(),o.createBlock(o.unref(at.BubbleList),o.mergeProps({key:1},e.componentProps?.bubbleList,{list:nt.value,class:"flex-1 min-h-0"}),{content:o.withCtx(({item:J})=>[J.type==="tool-call"?(o.openBlock(),o.createBlock(Lg,{key:0,"tool-name":J.toolName,args:J.args,status:J.status,result:J.result,error:J.error},null,8,["tool-name","args","status","result","error"])):J.type==="reasoning"?(o.openBlock(),o.createBlock(o.unref(at.Thinking),o.mergeProps({key:1,content:J.content,status:J.status},e.componentProps?.thinking),null,16,["content","status"])):J.type==="error"?(o.openBlock(),o.createElementBlock("div",by,o.toDisplayString(J.content),1)):o.renderSlot(P.$slots,"bubble-content",{key:3,item:J},()=>[o.createVNode(o.unref(Va.MarkdownRenderer),{markdown:J.content},null,8,["markdown"])],!0)]),_:3},16,["list"])),h.value.length>0?(o.openBlock(),o.createBlock(o.unref(Wo),{key:2,"pending-tool-calls":h.value,"onUpdate:pendingToolCalls":q[6]||(q[6]=J=>h.value=J),class:"flex-shrink-0",onApprove:k,onReject:N,onCancel:I},null,8,["pending-tool-calls"])):o.createCommentVNode("",!0),o.unref(B)==="streaming"&&yr.value&&Er.value==="thinking"?(o.openBlock(),o.createBlock(o.unref(at.Thinking),o.mergeProps({key:3,content:yr.value,status:Er.value},e.componentProps?.thinking),null,16,["content","status"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",{class:o.normalizeClass(["p-2",P.$style.footer])},[o.createVNode(o.unref(at.XSender),o.mergeProps({ref_key:"senderRef",ref:Mt},e.componentProps?.xSender,{placeholder:e.placeholder,onSubmit:ci}),null,16,["placeholder"])],2)])]),_:3}),a.value?(o.openBlock(),o.createBlock(o.unref(G.ElSplitterPanel),{key:0,size:240,min:200,collapsible:"",resizable:""},{default:o.withCtx(()=>[o.createVNode(Eg,{tools:o.unref(m),"detail-visible":e.toolPanelDetailVisible,onToggle:o.unref(p),onSetApproval:o.unref(f)},null,8,["tools","detail-visible","onToggle","onSetApproval"])]),_:1})):o.createCommentVNode("",!0)]),_:3})],6)):o.createCommentVNode("",!0)]),_:3},8,["name"])],6))}}),_y="_floatBtn_8sqc6_2",$y="_panel_8sqc6_15",Iy="_panelMaximized_8sqc6_28",xy="_header_8sqc6_33",Sy="_iconBtn_8sqc6_40",Ny="_sidebar_8sqc6_54",Ty="_footer_8sqc6_59",Oy={floatBtn:_y,panel:$y,panelMaximized:Iy,header:xy,iconBtn:Sy,sidebar:Ny,footer:Ty},Ry={$style:Oy},Ay=_e(ky,[["__cssModules",Ry],["__scopeId","data-v-c7ec99b1"]]),Cy={class:"ipa-router-tabs flex flex-col h-full overflow-hidden"},zy={class:"ipa-router-tabs__content flex-1 min-h-0 overflow-hidden"},Py=o.defineComponent({__name:"IpaRouterTabs",props:{tabProps:{default:()=>({})},fixedTabs:{default:()=>[]},fallbackRoute:{},keyBy:{},keepaliveProps:{default:()=>({})},headerHeight:{default:void 0},headerFontSize:{default:void 0},hideWhenSingleTab:{type:Boolean,default:!1}},setup(e){const t=e;let r;try{r=Yt.useRouter()}catch{console.warn("no router provided — degrade to pure tab component")}const{tabs:n,activeKey:a,hideTabBar:s,closeTab:i}=Hi({fixedTabs:t.fixedTabs,fallbackRoute:t.fallbackRoute,keyBy:t.keyBy,hideWhenSingleTab:t.hideWhenSingleTab});o.watch(()=>t.fixedTabs,c=>{const d=new Set(c.map(p=>p.key)),m=n.value.filter(p=>!d.has(p.key));n.value=[...c,...m]},{deep:!0});function l(c){const d=n.value.find(m=>m.key===c.props.name);d&&r&&r.push(d.fullPath)}function u(c){i(String(c))}return(c,d)=>(o.openBlock(),o.createElementBlock("div",Cy,[o.unref(s)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(o.unref(G.ElTabs),o.mergeProps({key:0,"model-value":o.unref(a),type:"card",class:"ipa-router-tabs__bar flex-shrink-0",style:{"--el-tabs-header-height":t.headerHeight?`${t.headerHeight}px`:void 0,"--el-font-size-base":t.headerFontSize?`${t.headerFontSize}px`:void 0}},e.tabProps,{onTabClick:l,onTabRemove:u}),{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(n),m=>(o.openBlock(),o.createBlock(o.unref(G.ElTabPane),{key:m.key,lazy:!0,name:m.key,closable:m.closable},{label:o.withCtx(()=>[o.renderSlot(c.$slots,"label",{tab:m},()=>[o.createElementVNode("span",null,o.toDisplayString(m.title),1)],!0)]),_:2},1032,["name","closable"]))),128))]),_:3},16,["model-value","style"])),o.createElementVNode("div",zy,[o.renderSlot(c.$slots,"default",{tabs:o.unref(n),activeKey:o.unref(a)},()=>[o.createVNode(o.unref(Yt.RouterView),null,{default:o.withCtx(({Component:m})=>[(o.openBlock(),o.createBlock(o.KeepAlive,o.normalizeProps(o.guardReactiveProps(e.keepaliveProps)),[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(m),{key:o.unref(a)}))],1040))]),_:1})],!0)])]))}}),Ly=_e(Py,[["__scopeId","data-v-1d603a17"]]);var My=Object.create,jy=Object.getPrototypeOf,Ba=Object.defineProperty,By=Object.getOwnPropertyNames,Vy=Object.prototype.hasOwnProperty;function Dy(e){return this[e]}var Fy,Zy=(e,t,r)=>{var n=e!=null&&typeof e=="object";if(n){var a=Fy??=new WeakMap,s=a.get(e);if(s)return s}r=e!=null?My(jy(e)):{};const i=Ba(r,"default",{value:e,enumerable:!0});for(let l of By(e))Vy.call(i,l)||Ba(i,l,{get:Dy.bind(e,l),enumerable:!0});return n&&a.set(e,i),i},H=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Pt=H((e,t)=>{var r="2.0.0",n=256,a=Number.MAX_SAFE_INTEGER||9007199254740991,s=16,i=n-6,l=["major","premajor","minor","preminor","patch","prepatch","prerelease"];t.exports={MAX_LENGTH:n,MAX_SAFE_COMPONENT_LENGTH:s,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:a,RELEASE_TYPES:l,SEMVER_SPEC_VERSION:r,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}),mr=H((e,t)=>{var r=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...n)=>console.error("SEMVER",...n):()=>{};t.exports=r}),Lt=H((e,t)=>{var{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Pt(),s=mr();e=t.exports={};var i=e.re=[],l=e.safeRe=[],u=e.src=[],c=e.safeSrc=[],d=e.t={},m=0,p="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",a],[p,n]],v=y=>{for(const[w,$]of f)y=y.split(`${w}*`).join(`${w}{0,${$}}`).split(`${w}+`).join(`${w}{1,${$}}`);return y},h=(y,w,$)=>{const g=v(w),O=m++;s(y,O,w),d[y]=O,u[O]=w,c[O]=g,i[O]=new RegExp(w,$?"g":void 0),l[O]=new RegExp(g,$?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),h("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${p}+`),h("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),h("FULL",`^${u[d.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),h("LOOSE",`^${u[d.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),h("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?(?:${u[d.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",u[d.COERCE],!0),h("COERCERTLFULL",u[d.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",h("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",h("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}),vn=H((e,t)=>{var r=Object.freeze({loose:!0}),n=Object.freeze({}),a=s=>s?typeof s!="object"?r:s:n;t.exports=a}),Ho=H((e,t)=>{var r=/^[0-9]+$/,n=(s,i)=>{if(typeof s=="number"&&typeof i=="number")return s===i?0:s<i?-1:1;const l=r.test(s),u=r.test(i);return l&&u&&(s=+s,i=+i),s===i?0:l&&!u?-1:u&&!l?1:s<i?-1:1},a=(s,i)=>n(i,s);t.exports={compareIdentifiers:n,rcompareIdentifiers:a}}),ve=H((e,t)=>{var r=mr(),{MAX_LENGTH:n,MAX_SAFE_INTEGER:a}=Pt(),{safeRe:s,t:i}=Lt(),l=vn(),{compareIdentifiers:u}=Ho(),c=(m,p)=>{const f=p.split(".");if(f.length>m.length)return!1;for(let v=0;v<f.length;v++)if(u(m[v],f[v])!==0)return!1;return!0};class d{constructor(p,f){if(f=l(f),p instanceof d){if(p.loose===!!f.loose&&p.includePrerelease===!!f.includePrerelease)return p;p=p.version}else if(typeof p!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof p}".`);if(p.length>n)throw new TypeError(`version is longer than ${n} characters`);r("SemVer",p,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const v=p.trim().match(f.loose?s[i.LOOSE]:s[i.FULL]);if(!v)throw new TypeError(`Invalid Version: ${p}`);if(this.raw=p,this.major=+v[1],this.minor=+v[2],this.patch=+v[3],this.major>a||this.major<0)throw new TypeError("Invalid major version");if(this.minor>a||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>a||this.patch<0)throw new TypeError("Invalid patch version");v[4]?this.prerelease=v[4].split(".").map(h=>{if(/^[0-9]+$/.test(h)){const y=+h;if(y>=0&&y<a)return y}return h}):this.prerelease=[],this.build=v[5]?v[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(p){if(r("SemVer.compare",this.version,this.options,p),!(p instanceof d)){if(typeof p=="string"&&p===this.version)return 0;p=new d(p,this.options)}return p.version===this.version?0:this.compareMain(p)||this.comparePre(p)}compareMain(p){return p instanceof d||(p=new d(p,this.options)),this.major<p.major?-1:this.major>p.major?1:this.minor<p.minor?-1:this.minor>p.minor?1:this.patch<p.patch?-1:this.patch>p.patch?1:0}comparePre(p){if(p instanceof d||(p=new d(p,this.options)),this.prerelease.length&&!p.prerelease.length)return-1;if(!this.prerelease.length&&p.prerelease.length)return 1;if(!this.prerelease.length&&!p.prerelease.length)return 0;let f=0;do{const v=this.prerelease[f],h=p.prerelease[f];if(r("prerelease compare",f,v,h),v===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(v===void 0)return-1;if(v===h)continue;return u(v,h)}while(++f)}compareBuild(p){p instanceof d||(p=new d(p,this.options));let f=0;do{const v=this.build[f],h=p.build[f];if(r("build compare",f,v,h),v===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(v===void 0)return-1;if(v===h)continue;return u(v,h)}while(++f)}inc(p,f,v){if(p.startsWith("pre")){if(!f&&v===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const h=`-${f}`.match(this.options.loose?s[i.PRERELEASELOOSE]:s[i.PRERELEASE]);if(!h||h[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(p){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,v);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,v);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,v),this.inc("pre",f,v);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,v),this.inc("pre",f,v);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const h=Number(v)?1:0;if(this.prerelease.length===0)this.prerelease=[h];else{let y=this.prerelease.length;for(;--y>=0;)typeof this.prerelease[y]=="number"&&(this.prerelease[y]++,y=-2);if(y===-1){if(f===this.prerelease.join(".")&&v===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(h)}}if(f){let y=[f,h];if(v===!1&&(y=[f]),c(this.prerelease,f)){const w=this.prerelease[f.split(".").length];isNaN(w)&&(this.prerelease=y)}else this.prerelease=y}break}default:throw new Error(`invalid increment argument: ${p}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}t.exports=d}),tt=H((e,t)=>{var r=ve(),n=(a,s,i=!1)=>{if(a instanceof r)return a;try{return new r(a,s)}catch(l){if(!i)return null;throw l}};t.exports=n}),Uy=H((e,t)=>{var r=tt(),n=(a,s)=>{const i=r(a,s);return i?i.version:null};t.exports=n}),qy=H((e,t)=>{var r=tt(),n=(a,s)=>{const i=r(a.trim().replace(/^[=v]+/,""),s);return i?i.version:null};t.exports=n}),Gy=H((e,t)=>{var r=ve(),n=(a,s,i,l,u)=>{typeof i=="string"&&(u=l,l=i,i=void 0);try{return new r(a instanceof r?a.version:a,i).inc(s,l,u).version}catch{return null}};t.exports=n}),Jy=H((e,t)=>{var r=tt(),n=(a,s)=>{const i=r(a,null,!0),l=r(s,null,!0),u=i.compare(l);if(u===0)return null;const c=u>0,d=c?i:l,m=c?l:i,p=!!d.prerelease.length;if(!!m.prerelease.length&&!p){if(!m.patch&&!m.minor)return"major";if(m.compareMain(d)===0)return m.minor&&!m.patch?"minor":"patch"}const v=p?"pre":"";return i.major!==l.major?v+"major":i.minor!==l.minor?v+"minor":i.patch!==l.patch?v+"patch":"prerelease"};t.exports=n}),Yy=H((e,t)=>{var r=ve(),n=(a,s)=>new r(a,s).major;t.exports=n}),Xy=H((e,t)=>{var r=ve(),n=(a,s)=>new r(a,s).minor;t.exports=n}),Wy=H((e,t)=>{var r=ve(),n=(a,s)=>new r(a,s).patch;t.exports=n}),Hy=H((e,t)=>{var r=tt(),n=(a,s)=>{const i=r(a,s);return i&&i.prerelease.length?i.prerelease:null};t.exports=n}),Ce=H((e,t)=>{var r=ve(),n=(a,s,i)=>new r(a,i).compare(new r(s,i));t.exports=n}),Ky=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(s,a,i);t.exports=n}),Qy=H((e,t)=>{var r=Ce(),n=(a,s)=>r(a,s,!0);t.exports=n}),gn=H((e,t)=>{var r=ve(),n=(a,s,i)=>{const l=new r(a,i),u=new r(s,i);return l.compare(u)||l.compareBuild(u)};t.exports=n}),e0=H((e,t)=>{var r=gn(),n=(a,s)=>a.sort((i,l)=>r(i,l,s));t.exports=n}),t0=H((e,t)=>{var r=gn(),n=(a,s)=>a.sort((i,l)=>r(l,i,s));t.exports=n}),hr=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)>0;t.exports=n}),yn=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)<0;t.exports=n}),Ko=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)===0;t.exports=n}),Qo=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)!==0;t.exports=n}),En=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)>=0;t.exports=n}),bn=H((e,t)=>{var r=Ce(),n=(a,s,i)=>r(a,s,i)<=0;t.exports=n}),ei=H((e,t)=>{var r=Ko(),n=Qo(),a=hr(),s=En(),i=yn(),l=bn(),u=(c,d,m,p)=>{switch(d){case"===":return typeof c=="object"&&(c=c.version),typeof m=="object"&&(m=m.version),c===m;case"!==":return typeof c=="object"&&(c=c.version),typeof m=="object"&&(m=m.version),c!==m;case"":case"=":case"==":return r(c,m,p);case"!=":return n(c,m,p);case">":return a(c,m,p);case">=":return s(c,m,p);case"<":return i(c,m,p);case"<=":return l(c,m,p);default:throw new TypeError(`Invalid operator: ${d}`)}};t.exports=u}),r0=H((e,t)=>{var r=ve(),n=tt(),{safeRe:a,t:s}=Lt(),i=(l,u)=>{if(l instanceof r)return l;if(typeof l=="number"&&(l=String(l)),typeof l!="string")return null;u=u||{};let c=null;if(!u.rtl)c=l.match(u.includePrerelease?a[s.COERCEFULL]:a[s.COERCE]);else{const h=u.includePrerelease?a[s.COERCERTLFULL]:a[s.COERCERTL];let y;for(;(y=h.exec(l))&&(!c||c.index+c[0].length!==l.length);)(!c||y.index+y[0].length!==c.index+c[0].length)&&(c=y),h.lastIndex=y.index+y[1].length+y[2].length;h.lastIndex=-1}if(c===null)return null;const d=c[2],m=c[3]||"0",p=c[4]||"0",f=u.includePrerelease&&c[5]?`-${c[5]}`:"",v=u.includePrerelease&&c[6]?`+${c[6]}`:"";return n(`${d}.${m}.${p}${f}${v}`,u)};t.exports=i}),n0=H((e,t)=>{var r=tt(),n=Pt(),a=ve(),s=(c,d,m)=>{if(!n.RELEASE_TYPES.includes(d))return null;const p=i(c,m);return p&&l(p,d)},i=(c,d)=>{const m=c instanceof a?c.version:c;return r(m,d)},l=(c,d)=>{if(u(d))return c.version;switch(c.prerelease=[],d){case"major":c.minor=0,c.patch=0;break;case"minor":c.patch=0;break}return c.format()},u=c=>c.startsWith("pre");t.exports=s}),a0=H((e,t)=>{class r{constructor(){this.max=1e3,this.map=new Map}get(a){const s=this.map.get(a);if(s!==void 0)return this.map.delete(a),this.map.set(a,s),s}delete(a){return this.map.delete(a)}set(a,s){if(!this.delete(a)&&s!==void 0){if(this.map.size>=this.max){const l=this.map.keys().next().value;this.delete(l)}this.map.set(a,s)}return this}}t.exports=r}),ze=H((e,t)=>{var r=/\s+/g;class n{constructor(b,A){if(A=i(A),b instanceof n)return b.loose===!!A.loose&&b.includePrerelease===!!A.includePrerelease?b:new n(b.raw,A);if(b instanceof l)return this.raw=b.value,this.set=[[b]],this.formatted=void 0,this;if(this.options=A,this.loose=!!A.loose,this.includePrerelease=!!A.includePrerelease,this.raw=b.trim().replace(r," "),this.set=this.raw.split("||").map(C=>this.parseRange(C.trim())).filter(C=>C.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const C=this.set[0];if(this.set=this.set.filter(L=>!g(L[0])),this.set.length===0)this.set=[C];else if(this.set.length>1){for(const L of this.set)if(L.length===1&&O(L[0])){this.set=[L];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let b=0;b<this.set.length;b++){b>0&&(this.formatted+="||");const A=this.set[b];for(let C=0;C<A.length;C++)C>0&&(this.formatted+=" "),this.formatted+=A[C].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(b){b=b.replace($,"");const C=((this.options.includePrerelease&&y)|(this.options.loose&&w))+":"+b,L=s.get(C);if(L)return L;const R=this.options.loose,z=R?d[p.HYPHENRANGELOOSE]:d[p.HYPHENRANGE];b=b.replace(z,me(this.options.includePrerelease)),u("hyphen replace",b),b=b.replace(d[p.COMPARATORTRIM],f),u("comparator trim",b),b=b.replace(d[p.TILDETRIM],v),u("tilde trim",b),b=b.replace(d[p.CARETTRIM],h),u("caret trim",b);let D=b.split(" ").map(ae=>_(ae,this.options)).join(" ").split(/\s+/).map(ae=>Q(ae,this.options));R&&(D=D.filter(ae=>(u("loose invalid filter",ae,this.options),!!ae.match(d[p.COMPARATORLOOSE])))),u("range list",D);const B=new Map,F=D.map(ae=>new l(ae,this.options));for(const ae of F){if(g(ae))return[ae];B.set(ae.value,ae)}B.size>1&&B.has("")&&B.delete("");const ee=[...B.values()];return s.set(C,ee),ee}intersects(b,A){if(!(b instanceof n))throw new TypeError("a Range is required");return this.set.some(C=>S(C,A)&&b.set.some(L=>S(L,A)&&C.every(R=>L.every(z=>R.intersects(z,A)))))}test(b){if(!b)return!1;if(typeof b=="string")try{b=new c(b,this.options)}catch{return!1}for(let A=0;A<this.set.length;A++)if(Ne(this.set[A],b,this.options))return!0;return!1}}t.exports=n;var a=a0(),s=new a,i=vn(),l=vr(),u=mr(),c=ve(),{safeRe:d,src:m,t:p,comparatorTrimReplace:f,tildeTrimReplace:v,caretTrimReplace:h}=Lt(),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:w}=Pt(),$=new RegExp(m[p.BUILD],"g"),g=x=>x.value==="<0.0.0-0",O=x=>x.value==="",S=(x,b)=>{let A=!0;const C=x.slice();let L=C.pop();for(;A&&C.length;)A=C.every(R=>L.intersects(R,b)),L=C.pop();return A},_=(x,b)=>(x=x.replace(d[p.BUILD],""),u("comp",x,b),x=ne(x,b),u("caret",x),x=N(x,b),u("tildes",x),x=X(x,b),u("xrange",x),x=U(x,b),u("stars",x),x),E=x=>!x||x.toLowerCase()==="x"||x==="*",k=(x,b,A)=>E(x)&&!E(b)||E(b)&&A&&!E(A),N=(x,b)=>x.trim().split(/\s+/).map(A=>I(A,b)).join(" "),I=(x,b)=>{const A=b.loose?d[p.TILDELOOSE]:d[p.TILDE],C=b.includePrerelease?"-0":"";return x.replace(A,(L,R,z,D,B)=>{u("tilde",x,L,R,z,D,B);let F;return E(R)?F="":E(z)?F=`>=${R}.0.0${C} <${+R+1}.0.0-0`:E(D)?F=`>=${R}.${z}.0${C} <${R}.${+z+1}.0-0`:B?(u("replaceTilde pr",B),F=`>=${R}.${z}.${D}-${B} <${R}.${+z+1}.0-0`):F=`>=${R}.${z}.${D} <${R}.${+z+1}.0-0`,u("tilde return",F),F})},ne=(x,b)=>x.trim().split(/\s+/).map(A=>V(A,b)).join(" "),V=(x,b)=>{u("caret",x,b);const A=b.loose?d[p.CARETLOOSE]:d[p.CARET],C=b.includePrerelease?"-0":"";return x.replace(A,(L,R,z,D,B)=>{u("caret",x,L,R,z,D,B);let F;return E(R)?F="":E(z)?F=`>=${R}.0.0${C} <${+R+1}.0.0-0`:E(D)?R==="0"?F=`>=${R}.${z}.0${C} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.0${C} <${+R+1}.0.0-0`:B?(u("replaceCaret pr",B),R==="0"?z==="0"?F=`>=${R}.${z}.${D}-${B} <${R}.${z}.${+D+1}-0`:F=`>=${R}.${z}.${D}-${B} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.${D}-${B} <${+R+1}.0.0-0`):(u("no pr"),R==="0"?z==="0"?F=`>=${R}.${z}.${D} <${R}.${z}.${+D+1}-0`:F=`>=${R}.${z}.${D} <${R}.${+z+1}.0-0`:F=`>=${R}.${z}.${D} <${+R+1}.0.0-0`),u("caret return",F),F})},X=(x,b)=>(u("replaceXRanges",x,b),x.split(/\s+/).map(A=>j(A,b)).join(" ")),j=(x,b)=>{x=x.trim();const A=b.loose?d[p.XRANGELOOSE]:d[p.XRANGE];return x.replace(A,(C,L,R,z,D,B)=>{if(u("xRange",x,C,L,R,z,D,B),k(R,z,D))return x;const F=E(R),ee=F||E(z),ae=ee||E(D),$e=ae;return L==="="&&$e&&(L=""),B=b.includePrerelease?"-0":"",F?L===">"||L==="<"?C="<0.0.0-0":C="*":L&&$e?(ee&&(z=0),D=0,L===">"?(L=">=",ee?(R=+R+1,z=0,D=0):(z=+z+1,D=0)):L==="<="&&(L="<",ee?R=+R+1:z=+z+1),L==="<"&&(B="-0"),C=`${L+R}.${z}.${D}${B}`):ee?C=`>=${R}.0.0${B} <${+R+1}.0.0-0`:ae&&(C=`>=${R}.${z}.0${B} <${R}.${+z+1}.0-0`),u("xRange return",C),C})},U=(x,b)=>(u("replaceStars",x,b),x.trim().replace(d[p.STAR],"")),Q=(x,b)=>(u("replaceGTE0",x,b),x.trim().replace(d[b.includePrerelease?p.GTE0PRE:p.GTE0],"")),me=x=>(b,A,C,L,R,z,D,B,F,ee,ae,$e)=>(E(C)?A="":E(L)?A=`>=${C}.0.0${x?"-0":""}`:E(R)?A=`>=${C}.${L}.0${x?"-0":""}`:z?A=`>=${A}`:A=`>=${A}${x?"-0":""}`,E(F)?B="":E(ee)?B=`<${+F+1}.0.0-0`:E(ae)?B=`<${F}.${+ee+1}.0-0`:$e?B=`<=${F}.${ee}.${ae}-${$e}`:x?B=`<${F}.${ee}.${+ae+1}-0`:B=`<=${B}`,`${A} ${B}`.trim()),Ne=(x,b,A)=>{for(let C=0;C<x.length;C++)if(!x[C].test(b))return!1;if(b.prerelease.length&&!A.includePrerelease){for(let C=0;C<x.length;C++)if(u(x[C].semver),x[C].semver!==l.ANY&&x[C].semver.prerelease.length>0){const L=x[C].semver;if(L.major===b.major&&L.minor===b.minor&&L.patch===b.patch)return!0}return!1}return!0}}),vr=H((e,t)=>{var r=Symbol("SemVer ANY");class n{static get ANY(){return r}constructor(p,f){if(f=a(f),p instanceof n){if(p.loose===!!f.loose)return p;p=p.value}p=p.trim().split(/\s+/).join(" "),u("comparator",p,f),this.options=f,this.loose=!!f.loose,this.parse(p),this.semver===r?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(p){const f=this.options.loose?s[i.COMPARATORLOOSE]:s[i.COMPARATOR],v=p.match(f);if(!v)throw new TypeError(`Invalid comparator: ${p}`);this.operator=v[1]!==void 0?v[1]:"",this.operator==="="&&(this.operator=""),v[2]?this.semver=new c(v[2],this.options.loose):this.semver=r}toString(){return this.value}test(p){if(u("Comparator.test",p,this.options.loose),this.semver===r||p===r)return!0;if(typeof p=="string")try{p=new c(p,this.options)}catch{return!1}return l(p,this.operator,this.semver,this.options)}intersects(p,f){if(!(p instanceof n))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(p.value,f).test(this.value):p.operator===""?p.value===""?!0:new d(this.value,f).test(p.semver):(f=a(f),f.includePrerelease&&(this.value==="<0.0.0-0"||p.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||p.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&p.operator.startsWith(">")||this.operator.startsWith("<")&&p.operator.startsWith("<")||this.semver.version===p.semver.version&&this.operator.includes("=")&&p.operator.includes("=")||l(this.semver,"<",p.semver,f)&&this.operator.startsWith(">")&&p.operator.startsWith("<")||l(this.semver,">",p.semver,f)&&this.operator.startsWith("<")&&p.operator.startsWith(">")))}}t.exports=n;var a=vn(),{safeRe:s,t:i}=Lt(),l=ei(),u=mr(),c=ve(),d=ze()}),gr=H((e,t)=>{var r=ze(),n=(a,s,i)=>{try{s=new r(s,i)}catch{return!1}return s.test(a)};t.exports=n}),s0=H((e,t)=>{var r=ze(),n=(a,s)=>new r(a,s).set.map(i=>i.map(l=>l.value).join(" ").trim().split(" "));t.exports=n}),o0=H((e,t)=>{var r=ve(),n=ze(),a=(s,i,l)=>{let u=null,c=null,d=null;try{d=new n(i,l)}catch{return null}return s.forEach(m=>{d.test(m)&&(!u||c.compare(m)===-1)&&(u=m,c=new r(u,l))}),u};t.exports=a}),i0=H((e,t)=>{var r=ve(),n=ze(),a=(s,i,l)=>{let u=null,c=null,d=null;try{d=new n(i,l)}catch{return null}return s.forEach(m=>{d.test(m)&&(!u||c.compare(m)===1)&&(u=m,c=new r(u,l))}),u};t.exports=a}),l0=H((e,t)=>{var r=ve(),n=ze(),a=hr(),s=(i,l)=>{i=new n(i,l);let u=new r("0.0.0");if(i.test(u)||(u=new r("0.0.0-0"),i.test(u)))return u;u=null;for(let c=0;c<i.set.length;++c){const d=i.set[c];let m=null;d.forEach(p=>{const f=new r(p.semver.version);switch(p.operator){case">":f.prerelease.length===0?f.patch++:f.prerelease.push(0),f.raw=f.format();case"":case">=":(!m||a(f,m))&&(m=f);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${p.operator}`)}}),m&&(!u||a(u,m))&&(u=m)}return u&&i.test(u)?u:null};t.exports=s}),u0=H((e,t)=>{var r=ze(),n=(a,s)=>{try{return new r(a,s).range||"*"}catch{return null}};t.exports=n}),wn=H((e,t)=>{var r=ve(),n=vr(),{ANY:a}=n,s=ze(),i=gr(),l=hr(),u=yn(),c=bn(),d=En(),m=(p,f,v,h)=>{p=new r(p,h),f=new s(f,h);let y,w,$,g,O;switch(v){case">":y=l,w=c,$=u,g=">",O=">=";break;case"<":y=u,w=d,$=l,g="<",O="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(p,f,h))return!1;for(let S=0;S<f.set.length;++S){const _=f.set[S];let E=null,k=null;if(_.forEach(N=>{N.semver===a&&(N=new n(">=0.0.0")),E=E||N,k=k||N,y(N.semver,E.semver,h)?E=N:$(N.semver,k.semver,h)&&(k=N)}),E.operator===g||E.operator===O||(!k.operator||k.operator===g)&&w(p,k.semver))return!1;if(k.operator===O&&$(p,k.semver))return!1}return!0};t.exports=m}),c0=H((e,t)=>{var r=wn(),n=(a,s,i)=>r(a,s,">",i);t.exports=n}),d0=H((e,t)=>{var r=wn(),n=(a,s,i)=>r(a,s,"<",i);t.exports=n}),p0=H((e,t)=>{var r=ze(),n=(a,s,i)=>(a=new r(a,i),s=new r(s,i),a.intersects(s,i));t.exports=n}),f0=H((e,t)=>{var r=gr(),n=Ce();t.exports=(a,s,i)=>{const l=[];let u=null,c=null;const d=a.sort((v,h)=>n(v,h,i));for(const v of d)r(v,s,i)?(c=v,u||(u=v)):(c&&l.push([u,c]),c=null,u=null);u&&l.push([u,null]);const m=[];for(const[v,h]of l)v===h?m.push(v):!h&&v===d[0]?m.push("*"):h?v===d[0]?m.push(`<=${h}`):m.push(`${v} - ${h}`):m.push(`>=${v}`);const p=m.join(" || "),f=typeof s.raw=="string"?s.raw:String(s);return p.length<f.length?p:s}}),m0=H((e,t)=>{var r=ze(),n=vr(),{ANY:a}=n,s=gr(),i=Ce(),l=(f,v,h={})=>{if(f===v)return!0;f=new r(f,h),v=new r(v,h);let y=!1;e:for(const w of f.set){for(const $ of v.set){const g=d(w,$,h);if(y=y||g!==null,g)continue e}if(y)return!1}return!0},u=[new n(">=0.0.0-0")],c=[new n(">=0.0.0")],d=(f,v,h)=>{if(f===v)return!0;if(f.length===1&&f[0].semver===a){if(v.length===1&&v[0].semver===a)return!0;h.includePrerelease?f=u:f=c}if(v.length===1&&v[0].semver===a){if(h.includePrerelease)return!0;v=c}const y=new Set;let w,$;for(const I of f)I.operator===">"||I.operator===">="?w=m(w,I,h):I.operator==="<"||I.operator==="<="?$=p($,I,h):y.add(I.semver);if(y.size>1)return null;let g;if(w&&$){if(g=i(w.semver,$.semver,h),g>0)return null;if(g===0&&(w.operator!==">="||$.operator!=="<="))return null}for(const I of y){if(w&&!s(I,String(w),h)||$&&!s(I,String($),h))return null;for(const ne of v)if(!s(I,String(ne),h))return!1;return!0}let O,S,_,E,k=$&&!h.includePrerelease&&$.semver.prerelease.length?$.semver:!1,N=w&&!h.includePrerelease&&w.semver.prerelease.length?w.semver:!1;k&&k.prerelease.length===1&&$.operator==="<"&&k.prerelease[0]===0&&(k=!1);for(const I of v){if(E=E||I.operator===">"||I.operator===">=",_=_||I.operator==="<"||I.operator==="<=",w){if(N&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===N.major&&I.semver.minor===N.minor&&I.semver.patch===N.patch&&(N=!1),I.operator===">"||I.operator===">="){if(O=m(w,I,h),O===I&&O!==w)return!1}else if(w.operator===">="&&!I.test(w.semver))return!1}if($){if(k&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===k.major&&I.semver.minor===k.minor&&I.semver.patch===k.patch&&(k=!1),I.operator==="<"||I.operator==="<="){if(S=p($,I,h),S===I&&S!==$)return!1}else if($.operator==="<="&&!I.test($.semver))return!1}if(!I.operator&&($||w)&&g!==0)return!1}return!(w&&_&&!$&&g!==0||$&&E&&!w&&g!==0||N||k)},m=(f,v,h)=>{if(!f)return v;const y=i(f.semver,v.semver,h);return y>0?f:y<0||v.operator===">"&&f.operator===">="?v:f},p=(f,v,h)=>{if(!f)return v;const y=i(f.semver,v.semver,h);return y<0?f:y>0||v.operator==="<"&&f.operator==="<="?v:f};t.exports=l}),h0=H((e,t)=>{var r=Lt(),n=Pt(),a=ve(),s=Ho(),i=tt(),l=Uy(),u=qy(),c=Gy(),d=Jy(),m=Yy(),p=Xy(),f=Wy(),v=Hy(),h=Ce(),y=Ky(),w=Qy(),$=gn(),g=e0(),O=t0(),S=hr(),_=yn(),E=Ko(),k=Qo(),N=En(),I=bn(),ne=ei(),V=r0(),X=n0(),j=vr(),U=ze(),Q=gr(),me=s0(),Ne=o0(),x=i0(),b=l0(),A=u0(),C=wn(),L=c0(),R=d0(),z=p0(),D=f0(),B=m0();t.exports={parse:i,valid:l,clean:u,inc:c,diff:d,major:m,minor:p,patch:f,prerelease:v,compare:h,rcompare:y,compareLoose:w,compareBuild:$,sort:g,rsort:O,gt:S,lt:_,eq:E,neq:k,gte:N,lte:I,cmp:ne,coerce:V,truncate:X,Comparator:j,Range:U,satisfies:Q,toComparators:me,maxSatisfying:Ne,minSatisfying:x,minVersion:b,validRange:A,outside:C,gtr:L,ltr:R,intersects:z,simplifyRange:D,subset:B,SemVer:a,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:n.SEMVER_SPEC_VERSION,RELEASE_TYPES:n.RELEASE_TYPES,compareIdentifiers:s.compareIdentifiers,rcompareIdentifiers:s.rcompareIdentifiers}});function v0(e){return e.phase==="available"&&!!e.info}Zy(h0());const g0={class:"flex gap-2 items-center"},y0={class:"text-base font-semibold"},E0={class:"mb-5 flex gap-3 items-center"},b0={class:"px-3 py-2.5 text-center rounded-lg bg-[var(--el-fill-color-light)] flex-1"},w0={class:"text-sm text-[var(--el-text-color-regular)] font-semibold"},k0={class:"px-3 py-2.5 text-center rounded-lg bg-[var(--el-color-primary-light-9)] flex-1"},_0={class:"text-sm text-[var(--el-color-primary)] font-semibold"},$0={key:0,class:"mb-4"},I0={class:"mb-2 flex gap-2 items-center"},x0={class:"text-xs text-[var(--el-text-color-placeholder)]"},S0={class:"markdown-body text-sm text-[var(--el-text-color-regular)] leading-relaxed p-3 border border-[var(--el-border-color-lighter)] rounded-lg max-h-48 overflow-y-auto"},N0={key:1,class:"mb-2"},T0={class:"text-xs text-[var(--el-text-color-secondary)] mb-1 flex items-center justify-between"},O0={key:1,class:"mt-3 p-3 rounded-lg bg-[var(--el-color-danger-light-9)] flex gap-2.5 items-start"},R0={class:"text-sm text-[var(--el-color-danger)]"},A0={class:"flex gap-2 items-center justify-end"},C0=o.defineComponent({__name:"IpaUpdateDialog",props:{state:{}},emits:["download","install","dismiss","retry"],setup(e,{emit:t}){const r=e,n=t;o.watch(()=>r.state.phase,v=>{v==="error"&&r.state.error&&G.ElMessage.error(`更新失败:${r.state.error}`)});const a=o.computed(()=>v0(r.state)),s=o.computed(()=>r.state.phase==="downloading"),i=o.computed(()=>r.state.phase==="installing"),l=o.computed(()=>r.state.phase==="available"&&r.state.progress===100),u=o.computed(()=>r.state.phase==="error"?r.state.error:void 0),c=o.computed(()=>r.state.info),d=o.computed(()=>r.state.phase==="available"||r.state.phase==="downloading"||r.state.phase==="installing"||r.state.phase==="error"),m=o.computed(()=>{if(!c.value?.pubDate)return"";try{return new Date(c.value.pubDate).toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"})}catch{return c.value.pubDate}}),p=o.computed(()=>r.state.phase==="error"?"exception":void 0);function f(){n("dismiss")}return(v,h)=>{const y=o.resolveComponent("el-icon");return o.openBlock(),o.createBlock(o.unref(G.ElDialog),{"model-value":d.value,"show-close":!s.value,"close-on-click-modal":!s.value,"close-on-press-escape":!s.value,width:"600px",class:"update-dialog",onClose:f},{header:o.withCtx(()=>[o.createElementVNode("div",g0,[s.value||i.value?(o.openBlock(),o.createBlock(y,{key:0,class:"is-loading text-[var(--el-color-primary)]",size:18},{default:o.withCtx(()=>[o.createVNode(o.unref(ut.Loading))]),_:1})):(o.openBlock(),o.createBlock(y,{key:1,class:"text-[var(--el-color-primary)]",size:18},{default:o.withCtx(()=>[o.createVNode(o.unref(ut.Download))]),_:1})),o.createElementVNode("span",y0,o.toDisplayString(s.value?"正在下载更新":i.value?"正在安装":"发现新版本"),1)])]),footer:o.withCtx(()=>[o.createElementVNode("div",A0,[s.value?(o.openBlock(),o.createBlock(o.unref(G.ElButton),{key:0,onClick:h[0]||(h[0]=w=>n("dismiss"))},{default:o.withCtx(()=>[...h[7]||(h[7]=[o.createTextVNode(" 取消下载 ",-1)])]),_:1})):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createVNode(o.unref(G.ElButton),{onClick:h[1]||(h[1]=w=>n("dismiss"))},{default:o.withCtx(()=>[...h[8]||(h[8]=[o.createTextVNode(" 稍后再说 ",-1)])]),_:1}),u.value?(o.openBlock(),o.createBlock(o.unref(G.ElButton),{key:0,type:"primary",onClick:h[2]||(h[2]=w=>n("retry"))},{default:o.withCtx(()=>[...h[9]||(h[9]=[o.createTextVNode(" 重试 ",-1)])]),_:1})):l.value?(o.openBlock(),o.createBlock(o.unref(G.ElButton),{key:1,type:"primary",loading:i.value,onClick:h[3]||(h[3]=w=>n("install"))},{default:o.withCtx(()=>[...h[10]||(h[10]=[o.createTextVNode(" 安装并重启 ",-1)])]),_:1},8,["loading"])):(o.openBlock(),o.createBlock(o.unref(G.ElButton),{key:2,type:"primary",disabled:!a.value,onClick:h[4]||(h[4]=w=>n("download"))},{default:o.withCtx(()=>[...h[11]||(h[11]=[o.createTextVNode(" 立即更新 ",-1)])]),_:1},8,["disabled"]))],64))])]),default:o.withCtx(()=>[c.value?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",E0,[o.createElementVNode("div",b0,[h[5]||(h[5]=o.createElementVNode("div",{class:"text-xs text-[var(--el-text-color-secondary)] mb-1"}," 当前版本 ",-1)),o.createElementVNode("div",w0," v"+o.toDisplayString(c.value.currentVersion),1)]),o.createVNode(y,{class:"text-[var(--el-color-primary)] shrink-0",size:20},{default:o.withCtx(()=>[o.createVNode(o.unref(ut.RefreshRight))]),_:1}),o.createElementVNode("div",k0,[h[6]||(h[6]=o.createElementVNode("div",{class:"text-xs text-[var(--el-color-primary)] mb-1"}," 最新版本 ",-1)),o.createElementVNode("div",_0," v"+o.toDisplayString(c.value.version),1)])]),c.value.body?(o.openBlock(),o.createElementBlock("div",$0,[o.createElementVNode("div",I0,[o.createElementVNode("span",x0,o.toDisplayString(m.value),1)]),o.createElementVNode("div",S0,[o.createVNode(o.unref(Va.MarkdownRenderer),{markdown:c.value.body},null,8,["markdown"])])])):o.createCommentVNode("",!0),s.value||l.value?(o.openBlock(),o.createElementBlock("div",N0,[o.createElementVNode("div",T0,[o.createElementVNode("span",null,o.toDisplayString(s.value?"下载中...":"下载完成"),1),o.createElementVNode("span",null,o.toDisplayString(e.state.progress.toFixed(2))+"%",1)]),o.createVNode(o.unref(G.ElProgress),{percentage:e.state.progress,"stroke-width":8,"show-text":!1,status:p.value,indeterminate:s.value&&e.state.progress===0},null,8,["percentage","status","indeterminate"])])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),u.value?(o.openBlock(),o.createElementBlock("div",O0,[o.createElementVNode("span",R0,o.toDisplayString(u.value),1)])):o.createCommentVNode("",!0)]),_:1},8,["model-value","show-close","close-on-click-modal","close-on-press-escape"])}}}),z0=_e(C0,[["__scopeId","data-v-7ea26cf9"]]),P0=o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./SchemaForm-Cw92Loan.cjs"))),L0=o.defineAsyncComponent(()=>Promise.resolve().then(()=>require("./IpaBaseTable-DcXajW88.cjs")));exports.IpaAiPanel=Ay;exports.IpaAiToolApprovalCard=Wo;exports.IpaBaseTable=L0;exports.IpaGrid=Do;exports.IpaHostItem=jv;exports.IpaPoint=_v;exports.IpaQuantifiedValue=qo;exports.IpaRouterTabs=Ly;exports.IpaTabs=vv;exports.IpaUpdateDialog=z0;exports.IpaUrl=Cv;exports.SchemaForm=P0;exports._export_sfc=_e;exports._sfc_main=av;exports._sfc_main$1=ng;exports._sfc_main$2=Uo;exports.ev=Ya;exports.fi=Ga;exports.lv=Xi;exports.mi=Xa;exports.mn=Cr;exports.on=sh;exports.tv=Yi;exports.useAiToolCall=Yo;exports.uv=Wi;exports.vi=Ha;